| 1 |
% \iffalse meta-comment |
| 2 |
% ====================================================================== |
| 3 |
% floatrowbytocbasic.dtx |
| 4 |
% Copyright © 2008–2023 Markus Kohm |
| 5 |
% |
| 6 |
% This work is a KOMA-Script spin-off. For the original sources of |
| 7 |
% KOMA-Script's `floatrow.hak' see file `scrhack.dtx' in the KOMA-Script |
| 8 |
% sources at <https://sourceforge.net/p/koma-script/code/>. |
| 9 |
% |
| 10 |
% Development is taking place as part of `third-party-hacks' at |
| 11 |
% <https://github.com/komascript/third-party-hacks>. New issues should |
| 12 |
% be reported there as well as known issues can be found. |
| 13 |
% |
| 14 |
% This work may be distributed and/or modified under the conditions of |
| 15 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 16 |
% The latest version of this license is in |
| 17 |
% http://www.latex-project.org/lppl.txt |
| 18 |
% and version 1.<3c or later is part of all distributions of LaTeX |
| 19 |
% version 2005/12/01 or later and of this work. |
| 20 |
% |
| 21 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 22 |
% |
| 23 |
% This work consists of the file `floatrowbytocbasic.dtx' and |
| 24 |
% `README.md'. |
| 25 |
% |
| 26 |
% The recommended way to install `floatrowbytocbasic' is to use |
| 27 |
% the package manager of your TeX distribution. |
| 28 |
% ====================================================================== |
| 29 |
% |
| 30 |
%<*dtx> |
| 31 |
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi |
| 32 |
\ProvidesFile{floatrowbytocbasic.dtx} |
| 33 |
%</dtx> |
| 34 |
%<*dtx|package> |
| 35 |
%<package>\ProvidesPackage{floatrowbytocbasic} |
| 36 |
[2023-08-16 v1.0 |
| 37 |
%<dtx> sources and unpack driver of |
| 38 |
improved floatrow package using tocbasic] |
| 39 |
%</dtx|package> |
| 40 |
%<*dtx> |
| 41 |
\ifx\documentclass\undefined |
| 42 |
\input docstrip.tex |
| 43 |
\generate{% |
| 44 |
\file{floatrowbytocbasic.sty}{% |
| 45 |
\from{floatrowbytocbasic.dtx}{package}% |
| 46 |
}% |
| 47 |
}% |
| 48 |
\else |
| 49 |
\let\endbatchfile\relax |
| 50 |
\fi |
| 51 |
\endbatchfile |
| 52 |
\documentclass[ngerman,USenglish]{koma-script-source-doc} |
| 53 |
\usepackage{babel} |
| 54 |
\usepackage{csquotes} |
| 55 |
\usepackage[style=alphabetic]{biblatex} |
| 56 |
\begin{filecontents}[force]{\jobname.bib} |
| 57 |
@online{pkg:floatrow, |
| 58 |
author={Olga Lapko}, |
| 59 |
title={\pkg*{floatrow} --- Modifying the layout of floats}, |
| 60 |
version={0.3b}, |
| 61 |
date={2008-08-02}, |
| 62 |
url={https://ctan.org/pkg/floatrow}, |
| 63 |
urldate={2023-07-18}, |
| 64 |
note={The \pkg*{floatrow} package provides many ways to customize layouts of |
| 65 |
floating environments and has code to cooperate with the \pkg{caption} |
| 66 |
3.x package. The package offers mechanisms to put floats side by side, |
| 67 |
and to put the caption beside its float. The \pkg*{floatrow} settings |
| 68 |
could be expanded to the floats created by packages \pkg{rotating}, |
| 69 |
\pkg{wrapfig}, \pkg{subfig} (in the case of rows of subfloats), and |
| 70 |
\pkg{longtable}.}, |
| 71 |
} |
| 72 |
@manual{pkg:floatrow:manual, |
| 73 |
author={Olga Lapko}, |
| 74 |
date={2009-08-02}, |
| 75 |
title={The \pkg*{floatrow} package}, |
| 76 |
url={http://mirrors.ctan.org/macros/latex/contrib/floatrow/floatrow.pdf}, |
| 77 |
urldate={2023-07-18}, |
| 78 |
abstract={This package was created as extension of the \pkg{float} package. |
| 79 |
The \pkg*{floatrow} package borrows core code from the \pkg{float} |
| 80 |
and \pkg{rotfloat} packages, so you must not load these packages.}, |
| 81 |
} |
| 82 |
@online{pkg:xpatch, |
| 83 |
author = {Enrico Gregorio}, |
| 84 |
version = {0.3}, |
| 85 |
date = {2020-03-25}, |
| 86 |
title = {\pkg*{xpatch} – Extending \pkg{etoolbox} patching commands}, |
| 87 |
url = {https://ctan.org/pkg/xpatch}, |
| 88 |
urldate = {2023-07-19}, |
| 89 |
note = {The package generalises the macro patching commands provided |
| 90 |
by Philipp Lehmann's \pkg{etoolbox}.}, |
| 91 |
} |
| 92 |
@manual{pkg:xpatch:manual, |
| 93 |
author = {Enrico Gregorio}, |
| 94 |
version = {0.3}, |
| 95 |
date = {2020-03-25}, |
| 96 |
title = {The \pkg*{xpatch} package |
| 97 |
extending \pkg{etoolbox} patching commands}, |
| 98 |
url = {http://mirrors.ctan.org/macros/latex/contrib/xpatch/xpatch.pdf}, |
| 99 |
urldate = {2023-07-19}, |
| 100 |
abstract = {}, |
| 101 |
} |
| 102 |
@online{pkg:scrlfile, |
| 103 |
author = {Markus Kohm}, |
| 104 |
version = {3.41}, |
| 105 |
date = {2023-07-07}, |
| 106 |
title = {\pkg*{scrlfile} – Installation control (not only) for |
| 107 |
\KOMAScript{} packages}, |
| 108 |
url = {https://ctan.org/pkg/scrlfile}, |
| 109 |
urldate = {2023-07-19}, |
| 110 |
note = {The package provides hooks for the execution of commands before |
| 111 |
or after loading files, classes or packages independent from the |
| 112 |
\LaTeX{} kernel version.}, |
| 113 |
} |
| 114 |
@online{pkg:koma-script, |
| 115 |
author={Markus Kohm}, |
| 116 |
version={3.41}, |
| 117 |
date={2023-07-07}, |
| 118 |
title={{\KOMAScript} --- A bundle of versatile classes and packages}, |
| 119 |
url={https://ctan.org/pkg/koma-script}, |
| 120 |
urldate={2023-07-14}, |
| 121 |
note={The \KOMAScript{} bundle provides replacements for the \pkg*{article}, |
| 122 |
\pkg*{report}, and \pkg*{book} classes with emphasis on typography and |
| 123 |
versatility. There is also a letter class.}, |
| 124 |
} |
| 125 |
@online{pkg:tocbasic, |
| 126 |
author={Markus Kohm}, |
| 127 |
version={3.41}, |
| 128 |
date={2023-07-07}, |
| 129 |
title={\pkg*{tocbasic} --- Management of tables/lists of contents (and the |
| 130 |
like)}, |
| 131 |
url={https://ctan.org/pkg/tocbasic}, |
| 132 |
urldate={2023-07-14}, |
| 133 |
note={The package provides means to create specialised ``table of |
| 134 |
contents''-like lists of features of a document.}, |
| 135 |
} |
| 136 |
@manual{pkg:koma-script:manual:de, |
| 137 |
author={Markus Kohm}, |
| 138 |
date={2023-06-16}, |
| 139 |
title={{\KOMAScript}}, |
| 140 |
subtitle={Die Anleitung}, |
| 141 |
url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-de.pdf}, |
| 142 |
urldate={2023-07-04}, |
| 143 |
} |
| 144 |
@manual{pkg:koma-script:manual:en, |
| 145 |
author={Markus Kohm}, |
| 146 |
date={2023-06-16}, |
| 147 |
title={{\KOMAScript}}, |
| 148 |
subtitle={The Guide}, |
| 149 |
url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-en.pdf}, |
| 150 |
urldate={2023-07-14}, |
| 151 |
} |
| 152 |
\end{filecontents} |
| 153 |
\addbibresource{\jobname.bib} |
| 154 |
\setcounter{StandardModuleDepth}{2} |
| 155 |
\begin{document} |
| 156 |
\nocite{pkg:floatrow,pkg:koma-script,pkg:tocbasic} |
| 157 |
\DocInput{floatrowbytocbasic.dtx} |
| 158 |
\end{document} |
| 159 |
%</dtx> |
| 160 |
%\fi |
| 161 |
% |
| 162 |
% \changes{v0.1}{2023/06/01}{start of \KOMAScript{} spin-off} |
| 163 |
% \changes{v1.0}{2023/08/19}{first package release} |
| 164 |
% |
| 165 |
% \GetFileInfo{floatrowbytocbasic.dtx} |
| 166 |
% \title{Improving Package \pkg{floatrow} Using |
| 167 |
% \href{https://komascript.de/}{\KOMAScript} Package \pkg{tocbasic}} |
| 168 |
% \author{\href{mailto:[email protected]}{Markus Kohm}} |
| 169 |
% \date{Version \filedate{} \fileversion} |
| 170 |
% \maketitle |
| 171 |
% \begin{abstract} |
| 172 |
% Package \pkg*{floatrowbytocbasic} has started as hack module of the |
| 173 |
% \KOMAScript{} package \pkg*{scrhack} years ago to fix an issue when using |
| 174 |
% package \pkg{floatrow} with \KOMAScript~3. This became necessary because |
| 175 |
% package \pkg{floatrow} still depends on an interface once proposed by the |
| 176 |
% \KOMAScript{} author, but which has long since failed to meet |
| 177 |
% requirements. Unfortunately, this problem could not be solved in dialog |
| 178 |
% with the author of \pkg{floatrow}. Although \pkg*{floatrowbytocbasic} still |
| 179 |
% loads the \pkg{floatrow} package, it then changes some internal commands to |
| 180 |
% use and optimally support the \KOMAScript{} package \pkg{tocbasic}. On the |
| 181 |
% one hand, the user interface of \pkg{floatrow} remains usable unchanged, |
| 182 |
% but at the same time the package benefits from many possibilities of |
| 183 |
% \pkg{tocbasic}. |
| 184 |
% \end{abstract} |
| 185 |
% |
| 186 |
% \tableofcontents |
| 187 |
% |
| 188 |
%\iffalse |
| 189 |
%<*doc> |
| 190 |
%\fi |
| 191 |
\section{Why should I use this package instead of |
| 192 |
\texorpdfstring{\pkg{floatrow}}{floatrow} only if I use a \KOMAScript{} |
| 193 |
class or \KOMAScript{} package \texorpdfstring{\pkg{tocbasic}}{tocbasic}?} |
| 194 |
\label{sec:whywithkomascript} |
| 195 |
|
| 196 |
The main symptom of using a deprecated interface to \KOMAScript{} by package |
| 197 |
\pkg{floatrow}, namely the use of \cs{float@listhead} and |
| 198 |
\cs{float@addtolists}, are corresponding warnings when using one of the |
| 199 |
\KOMAScript{} classes at the same time, for example: |
| 200 |
\begin{verbatim} |
| 201 |
Class scrbook Warning: \float@addtolists detected! |
| 202 |
(scrbook) Implementation of \float@addtolist became |
| 203 |
(scrbook) deprecated in KOMA-Script v3.01 2008/11/14 and |
| 204 |
(scrbook) has been replaced by several more flexible |
| 205 |
(scrbook) features of package `tocbasic`. |
| 206 |
(scrbook) Since Version 3.12 support for deprecated |
| 207 |
(scrbook) \float@addtolist interface has been |
| 208 |
(scrbook) restricted to only some of the KOMA-Script |
| 209 |
(scrbook) features and been removed from others. |
| 210 |
(scrbook) Loading of package `scrhack' may help to |
| 211 |
(scrbook) avoid this warning, if you are using a |
| 212 |
(scrbook) a package that still implements the |
| 213 |
(scrbook) deprecated \float@addtolist interface. |
| 214 |
\end{verbatim} |
| 215 |
or |
| 216 |
\begin{verbatim} |
| 217 |
Class scrbook Warning: \float@listhead detected! |
| 218 |
(scrbook) Implementation of \float@listhead became |
| 219 |
(scrbook) deprecated in KOMA-Script v3.01 2008/11/14 and |
| 220 |
(scrbook) has been replaced by several more flexible |
| 221 |
(scrbook) features of package `tocbasic`. |
| 222 |
(scrbook) Maybe implementation of \float@listhead will |
| 223 |
(scrbook) removed from KOMA-Script soon. |
| 224 |
(scrbook) Loading of package `scrhack' may help to |
| 225 |
(scrbook) avoid this warning, if you are using a |
| 226 |
(scrbook) a package that still implements the |
| 227 |
(scrbook) deprecated \float@listhead interface. |
| 228 |
\end{verbatim} |
| 229 |
|
| 230 |
If you know, that the issue is because of loading package \pkg{floatrow} you |
| 231 |
can avoid it using \pkg{floatrowbytocbasic} as explained in |
| 232 |
\autoref{sec:howtouse}. |
| 233 |
|
| 234 |
\section{Why should I use this package instead of |
| 235 |
\texorpdfstring{\pkg{floatrow}}{floatrow} only if I don't use a |
| 236 |
\KOMAScript{} class or package?} |
| 237 |
\label{sec:whywithoutkomascript} |
| 238 |
|
| 239 |
Package \pkg{floatrow} does not check if a file extension or environment |
| 240 |
already has been defined when using \cs{DeclareNewFloatType}. So several |
| 241 |
definitions of float environments either with the same name or the same file |
| 242 |
extension could happen by accident. Package \pkg*{floatrowbytocbasic} adds |
| 243 |
test to avoid such issues. But it also allows to redefine an environment or |
| 244 |
reuse a file extension, if you want. Alternatively you can force the |
| 245 |
definition or do the definition only if needed. See description of |
| 246 |
\cs{DeclareFloatType}, \cs{RedeclareFloatType} and \cs{ProvideFloatType} in |
| 247 |
\autoref{sec:howtouse} for more information. |
| 248 |
|
| 249 |
Package \pkg{tocbasic} provides several additional features, e.g.: |
| 250 |
\begin{itemize} |
| 251 |
\item automatic handling of language switching using \pkg{babel}, |
| 252 |
\item optional numbered heading for a list/table of contents, |
| 253 |
\item optional adding an entry to the table of contents for a list/table of |
| 254 |
contents even if the heading is not numbered, |
| 255 |
\item easy configuration of entries to a list/table of contents. |
| 256 |
\end{itemize} |
| 257 |
Several more features can be added by the class or other packages. See section |
| 258 |
about \pkg*{tocbasic} in the \KOMAScript{} manual, either |
| 259 |
\autocite{pkg:koma-script:manual:en} or \autocite{pkg:koma-script:manual:de}. |
| 260 |
|
| 261 |
\section{How to use |
| 262 |
\texorpdfstring{\pkg*{floatrowbytocbasic}}{floatrowbytocbasic}} |
| 263 |
\label{sec:howtouse} |
| 264 |
|
| 265 |
In the document preamble of your document you just can replace |
| 266 |
\begin{verbatim} |
| 267 |
\usepackage{floatrow} |
| 268 |
\end{verbatim} |
| 269 |
by |
| 270 |
\begin{verbatim} |
| 271 |
\usepackage{floatrowbytocbasic} |
| 272 |
\end{verbatim} |
| 273 |
to load package \pkg*{floatrowbytocbasic}. This does still also load package |
| 274 |
\pkg{floatrow} but additionally patches several commands of \pkg{floatrow} to |
| 275 |
avoid the issues shown in \autoref{sec:whywithkomascript}. |
| 276 |
|
| 277 |
If you want you can alternatively also load both packages explicitly, either |
| 278 |
\pkg{floatrow} before \pkg{floatrowbytocbasic} or---if you |
| 279 |
want---\pkg{floatrowbytocbasic} before \pkg{floatrow}. This is also useful, if |
| 280 |
you use a package, that uses \pkg{floatrow} itself. In this case, you always |
| 281 |
should load \pkg{floatrowbytocbasic} \emph{before} the package, that uses |
| 282 |
\pkg{floatrow}. Otherwise it is very likely that for some new float |
| 283 |
environments the enhancements of \pkg*{floatrowbytocbasic} will not be |
| 284 |
used. Only if \pkg*{floatrowbytocbasic} is loaded before the first use of |
| 285 |
\cs{DeclareNewFloatType} can it be ensured that the definition of the new |
| 286 |
sliding environments is really done with the help of \pkg{tocbasic} and thus |
| 287 |
its extended user interface is used. |
| 288 |
|
| 289 |
When using a class that uses \pkg{floatrow}, the correct operation can be |
| 290 |
ensured with |
| 291 |
\begin{verbatim} |
| 292 |
\AddToHook{package/floatrow/after}{\RequirePackage{floatrowbytocbasic}} |
| 293 |
\end{verbatim} |
| 294 |
even before \cs{documentclass}. This requires at least \LaTeX{} |
| 295 |
2020/10/01. For older versions of \LaTeX{} you can use |
| 296 |
\begin{verbatim} |
| 297 |
\RequirePackage{scrlfile} |
| 298 |
\AfterPackage{floatrow}{\RequirePackage{floatrowbytocbasic}} |
| 299 |
\end{verbatim} |
| 300 |
also before \cs{documentclass}. This would require the \KOMAScript{} package |
| 301 |
\pkg{scrlfile}\nocite{pkg:scrlfile}. |
| 302 |
|
| 303 |
The user interface of \pkg*{floatrowbytocbasic} is the same as of |
| 304 |
\pkg{floatrow}, see \autocite{pkg:floatrow:manual}. Following we document only |
| 305 |
the differences. |
| 306 |
|
| 307 |
\DescribeCommand{\DeclareNewFloatType} |
| 308 |
\DescribeCommand{\ProvideFloatType} |
| 309 |
\DescribeCommand{\RedeclareFloatType} |
| 310 |
\DescribeCommand{\DeclareFloatType} |
| 311 |
See \autocite[section~2]{pkg:floatrow:manual} for the basic usage of |
| 312 |
\cs{DeclareNewFloatType}. The command takes two mandatory arguments. It is of |
| 313 |
the form: |
| 314 |
\begin{quote} |
| 315 |
\cs{DeclareNewFloatType}\marg{type}\marg{options} |
| 316 |
\end{quote} |
| 317 |
\pkg{floatrowbytocbasic} adds the registration of the file extension of the |
| 318 |
new \meta{type} given either by option \opt{fileext} in the \meta{options} or |
| 319 |
implicitly (see \autocite[section~4]{pkg:floatrow:manual}). The main problem |
| 320 |
here is to decide what to do, if \meta{ext} already has been |
| 321 |
registered. Package \pkg{floatrow} simply does not care for this case. It does |
| 322 |
neither report an error nor a warning, but just redefine the float \meta{type} |
| 323 |
and reuses the auxiliary file extension. Because of the ``\texttt{New}'' in |
| 324 |
the name of the command, we have decided to report an error instead, but only |
| 325 |
of the owner/category differs and therefore is not \texttt{float}. But we |
| 326 |
also decided to define three new commands: |
| 327 |
\begin{quote}\raggedright |
| 328 |
\cs{DeclareFloatType}\marg{type}\marg{options}\\ |
| 329 |
\cs{ProvideFloatType}\marg{type}\marg{options}\\ |
| 330 |
\cs{RedeclareFloatType}\marg{type}\marg{options} |
| 331 |
\end{quote} |
| 332 |
\cs{DeclareFloatTpye} also does not care for already existing \meta{type} |
| 333 |
environment or already registered file extension. \cs{DeclareNewFloatType} |
| 334 |
reports and error for an already existing \meta{type} |
| 335 |
environment. \cs{ProvideFloatType} does not overwrite existing \meta{type} |
| 336 |
environment or already registered file extensions for other |
| 337 |
owners. \cs{RedeclareFloatType} does overwrite only already existing |
| 338 |
\meta{type} environment with registered file extension. There are also cases |
| 339 |
like defined \cs{\meta{type}} but not \cs{end\meta{type}} or not defined |
| 340 |
environment \meta{type} but registered file extension. But there are no |
| 341 |
special commands to handle these. If users need to take care for these cases, |
| 342 |
they can test for definition using the \LaTeX{} kernel macro \cs{@ifundefined} |
| 343 |
and the \pkg{tocbasic} command \cs{Ifattoclist}, described in the |
| 344 |
\KOMAScript{} user manuals \autocite{pkg:koma-script:manual:en} |
| 345 |
resp. \autocite{pkg:koma-script:manual:de}. |
| 346 |
% |
| 347 |
% \iffalse |
| 348 |
%</doc> |
| 349 |
% \fi |
| 350 |
% |
| 351 |
% \MaybeStop{\printbibliography[heading=bibintoc]\PrintIndex} |
| 352 |
% |
| 353 |
% \iffalse |
| 354 |
%<*package> |
| 355 |
%<@@=floatrowbytocbasic> |
| 356 |
% \fi |
| 357 |
% \section{Implementation} |
| 358 |
% |
| 359 |
% \pkg{floatrowbytocbasic} depend on \KOMAScript{} package \pkg{tocbasic}. So |
| 360 |
% we load it already before everything else. We use this package also to |
| 361 |
% require at least \KOMAScript{} 3.41, which is one version before the |
| 362 |
% intended spin-off. |
| 363 |
% \begin{macrocode} |
| 364 |
\RequirePackage{tocbasic}[2023/07/07] |
| 365 |
% \end{macrocode} |
| 366 |
% |
| 367 |
% We also load package \pkg{floatrow}, because we reuse most of the code: |
| 368 |
% \begin{macrocode} |
| 369 |
\RequirePackage{floatrow} |
| 370 |
% \end{macrocode} |
| 371 |
% |
| 372 |
% As often as possible, we do not redefine macors of \pkg{floatrow}, but patch |
| 373 |
% them using \pkg{xpatch}\nocite{pkg:xpatch}: |
| 374 |
% \begin{macrocode} |
| 375 |
\RequirePackage{xpatch} |
| 376 |
% \end{macrocode} |
| 377 |
% |
| 378 |
% We also use some \LaTeX3 functions. So if the \LaTeX{} kernel is |
| 379 |
% too old, we require \pkg{expl3}: |
| 380 |
% \begin{macrocode} |
| 381 |
\@ifundefined{ExplSyntaxOn}{% |
| 382 |
\RequirePackage{expl3}% |
| 383 |
}{} |
| 384 |
% \end{macrocode} |
| 385 |
% |
| 386 |
% \begin{command}{\DeclareFloatType} |
| 387 |
% Basicly \cs{DeclareFloatType} is \cs{DeclareNewFloatType} of |
| 388 |
% \pkg{floatrow}: |
| 389 |
% \begin{macrocode} |
| 390 |
\@ifundefined{NewCommandCopy}{\let\DeclareFloatType\DeclareNewFloatType}{% |
| 391 |
\NewCommandCopy\DeclareFloatType\DeclareNewFloatType |
| 392 |
} |
| 393 |
% \end{macrocode} |
| 394 |
% But we also have to take care, that a not yet registered file extension has |
| 395 |
% to be registered. |
| 396 |
% \begin{description} |
| 397 |
% \item[Note:] We do not need to setup feature \texttt{chapteratlist}, because |
| 398 |
% classes like the \KOMAScript{} classes should use |
| 399 |
%\begin{verbatim} |
| 400 |
% \AtAddToTocList[float]{\setuptoc{\@currext}{chapteratlist}} |
| 401 |
%\end{verbatim} |
| 402 |
% to implement such features. |
| 403 |
% \end{description} |
| 404 |
% \begin{macrocode} |
| 405 |
\newcommand*{\floatrowbytocbasic@incompatibility@error}[1]{% |
| 406 |
\PackageError{floatrowbytocbasic}{incompatible definition of |
| 407 |
\expandafter\string\csname #1\endcsname}{% |
| 408 |
Package `floatrowbytocbasic' depends on the original definition of |
| 409 |
package\MessageBreal |
| 410 |
`floatrow'.\MessageBreak |
| 411 |
Some changes to that definition are tolerated.\MessageBreak |
| 412 |
\@ifundefined{#1}% |
| 413 |
{But it seems the definition is completely missing!}% |
| 414 |
{But the current definition is incompatible!}% |
| 415 |
\MessageBreak |
| 416 |
Make sure, you have installed the original package `floatrow' as |
| 417 |
referred\MessageBreak |
| 418 |
by section ``References'' of the manual.% |
| 419 |
}% |
| 420 |
} |
| 421 |
\xpatchcmd{\DeclareFloatType}{% |
| 422 |
\xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}% |
| 423 |
\@tempa |
| 424 |
}{% |
| 425 |
\Ifattoclist{\@nameuse{ext@\FB@captype}}{% |
| 426 |
\let\reserved@a\relax |
| 427 |
\owneroftoc[\def\reserved@a]{\@nameuse{ext@\FB@captype}}\relax |
| 428 |
\@ifundefined{reserved@a}{}{% |
| 429 |
\Ifstr{\reserved@a}{float}{% |
| 430 |
\PackageInfo{floarowtbytocbasic}{% |
| 431 |
reusing file extension `\@nameuse{ext@\FB@captype}' for\MessageBreak |
| 432 |
float type `#1'% |
| 433 |
}% |
| 434 |
}{% |
| 435 |
\PackageWarning{floatrowbytocbasic}{% |
| 436 |
reusing file extension `\@nameuse{ext@\FB@captype}' of owner\MessageBreak |
| 437 |
`\reserved@a' for float `#1'\MessageBreak |
| 438 |
not recommended% |
| 439 |
}% |
| 440 |
}% |
| 441 |
}% |
| 442 |
}{% |
| 443 |
\addtotoclist[float]{\@nameuse{ext@\FB@captype}}% |
| 444 |
}% |
| 445 |
\xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}% |
| 446 |
\@tempa |
| 447 |
}{}{% |
| 448 |
\floatrowbytocbasic@incompatibility@error{DeclareNewFloatType}% |
| 449 |
} |
| 450 |
% \end{macrocode} |
| 451 |
% \begin{description} |
| 452 |
% \item[Note:] In difference to \pkg{floatrow} we think, reusing a counter is |
| 453 |
% not a big problem, so we don't report an error. |
| 454 |
% \end{description} |
| 455 |
% \begin{macrocode} |
| 456 |
\xpatchcmd{\DeclareFloatType}{% |
| 457 |
\newcounter{#1}% |
| 458 |
}{% |
| 459 |
\@ifundefined{c@#1}{\newcounter{#1}}{% |
| 460 |
\PackageInfo{floatrowbytocbasic}{% |
| 461 |
reusing existing counter for float type `#1'% |
| 462 |
}% |
| 463 |
}% |
| 464 |
}{}{% |
| 465 |
\floatrowbytocbasic@incompatibility@error{DeclareNewFloatType}% |
| 466 |
} |
| 467 |
\xpatchcmd{\DeclareFloatType}{% |
| 468 |
\@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}% |
| 469 |
}{% |
| 470 |
\@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure |
| 471 |
\@ifundefined{l@#1}{% |
| 472 |
\DeclareTOCStyleEntry[level=1,numwith=2.3em,indent=1.5em]{default}{#1}% |
| 473 |
}{}% |
| 474 |
}{}% |
| 475 |
}{}{% |
| 476 |
\floatrowbytocbasic@incompatibility@error{DeclareNewFloatType}% |
| 477 |
} |
| 478 |
% \end{macrocode} |
| 479 |
% \end{command} |
| 480 |
% |
| 481 |
% \begin{command}{\DeclareNewFloatType,\ProvideFloatType,\RedeclareFloatType} |
| 482 |
% \cs{DeclareNewFloatType} and \cs{RedeclareFloatType} similar to |
| 483 |
% \cs{newcommand} and \cs{renewcommand} do some tests and maybe report an |
| 484 |
% error, before (nevertheless) defining the float. |
| 485 |
% \begin{description} |
| 486 |
% \item[Note:] The test for already defined floats is somehow complicated, |
| 487 |
% because \pkg{floatrow} delays the definition until |
| 488 |
% |\begin{document}|. Before, there is only a list of \cs{FR@tmp} commands |
| 489 |
% stored in toks register \cs{flrow@types}. But we also have to test for |
| 490 |
% reusing another environment instead of a float. |
| 491 |
% \end{description} |
| 492 |
% \begin{macrocode} |
| 493 |
\renewcommand{\DeclareNewFloatType}[2]{% |
| 494 |
\floatrowbytocbasic@get@currext{#1}{#2}% |
| 495 |
\@tempswatrue |
| 496 |
\begingroup |
| 497 |
\def\FR@tmp##1{% |
| 498 |
\Ifstr{#1}{##1}{\aftergroup\@tempswafalse}{}% |
| 499 |
}% |
| 500 |
\the\flrow@types |
| 501 |
\endgroup |
| 502 |
\if@tempswa |
| 503 |
\expandafter\@ifdefinable\csname #1\endcsname {% |
| 504 |
\Ifattoclist{\floatrowbytocbasic@currext}{% |
| 505 |
\let\reserved@a\relax |
| 506 |
\owneroftoc[\def\reserved@a]{\floatrowbytocbasic@currext}\relax |
| 507 |
\@ifundefined{reserved@a}{% |
| 508 |
\DeclareFloatType{#1}{#2}% |
| 509 |
}{% |
| 510 |
\Ifstr{\reserved@a}{float}{% |
| 511 |
\PackageInfo{floatrowbytocbasic}{% |
| 512 |
reusing `\floatrowbytocbasic@currext' of owner `float'% |
| 513 |
}% |
| 514 |
\DeclareFloatType{#1}{#2}% |
| 515 |
}{% |
| 516 |
\PackageError{floatrowbytocbasic}{% |
| 517 |
reusing `\floatrowbytocbasic@currext' of owner `\reserved@a' not |
| 518 |
allowed% |
| 519 |
}{% |
| 520 |
Each file extension should be used only once.\MessageBreak |
| 521 |
Reusing is only allowed with the same owner/category.\MessageBreak |
| 522 |
You, the class, or another package already uses |
| 523 |
`\floatrowbytocbasic@currext'.\MessageBreak |
| 524 |
\@eha |
| 525 |
}% |
| 526 |
}% |
| 527 |
}% |
| 528 |
}{% |
| 529 |
\DeclareFloatType{#1}{#2}% |
| 530 |
}% |
| 531 |
}% |
| 532 |
\else |
| 533 |
\PackageError{floatrowbytocbasic}{Float `#1' already defined}{% |
| 534 |
Each float can be defined only once using |
| 535 |
\string\DeclareNewFloatType.\MessageBreak |
| 536 |
If you want to redefine an already existing float, please |
| 537 |
use\MessageBreak |
| 538 |
\string\RedeclareFloatType.\MessageBreak |
| 539 |
\@eha |
| 540 |
}% |
| 541 |
\fi |
| 542 |
} |
| 543 |
\newcommand{\ProvideFloatType}[2]{% |
| 544 |
\@ifundefined{#1}{% |
| 545 |
\@tempswatrue |
| 546 |
\begingroup |
| 547 |
\def\FR@tmp##1{% |
| 548 |
\Ifstr{#1}{##1}{\aftergroup\@tempswafalse}{}% |
| 549 |
}% |
| 550 |
\the\flrow@types |
| 551 |
\endgroup |
| 552 |
\if@tempswa |
| 553 |
\DeclareNewFloatType{#1}{#2}% |
| 554 |
\fi |
| 555 |
}{}% |
| 556 |
} |
| 557 |
\newcommand{\RedeclareFloatType}[2]{% |
| 558 |
\@tempswafalse |
| 559 |
\@ifundefined{#1}{% |
| 560 |
\begingroup |
| 561 |
\def\FR@tmp##1{% |
| 562 |
\Ifstr{#1}{##1}{\aftergroup\@tempswatrue}{}% |
| 563 |
}% |
| 564 |
\the\flrow@types |
| 565 |
\endgroup |
| 566 |
}{\@tempswatrue}% |
| 567 |
\floatrowbytocbasic@get@currext{#1}{#2}% |
| 568 |
\if@tempswa |
| 569 |
\Ifattoclist{\floatrowbytocbasic@currext}{% |
| 570 |
\removefromtoclist{\floatrowbytocbasic@currext}% |
| 571 |
}{% |
| 572 |
\PackageError{floatrowbytocbasic}{% |
| 573 |
extension `\floatrowbytocbasic@currext' not yet registered% |
| 574 |
}{% |
| 575 |
I can only renew floats with already registered |
| 576 |
extensions.\MessageBreak |
| 577 |
\@ehc |
| 578 |
}% |
| 579 |
}% |
| 580 |
\else |
| 581 |
\@latex@error{Environment #1 undefined}\@ehc |
| 582 |
\removefromtoclist{\floatrowbytocbasic@currext}% |
| 583 |
\fi |
| 584 |
\DeclareFloatType{#1}{#2}% |
| 585 |
} |
| 586 |
% \end{macrocode} |
| 587 |
% \end{command} |
| 588 |
% |
| 589 |
% \ExplSyntaxOn |
| 590 |
% \begin{macro}{\__floatrowbytocbasic_get_ext_from_prop:nn, |
| 591 |
% \floatrowbytocbasic@get@currext} |
| 592 |
% \ExplSyntaxOff |
| 593 |
% Helper macros to set \cs{floatrowbytocbasic@currext} to the extension set by |
| 594 |
% the options (=\#2). \#1 is the name of the new float type. We are not really |
| 595 |
% interested in handling of all the options. So we just use the options to |
| 596 |
% setup a property list and then get the one interesting property. |
| 597 |
% \begin{macrocode} |
| 598 |
\ExplSyntaxOn |
| 599 |
\prop_new:N \@@_DeclareNewFloatType_prop |
| 600 |
\tl_new:N \@@_ext_tl |
| 601 |
\cs_new:Nn \@@_get_ext_from_prop:nn |
| 602 |
{ |
| 603 |
\prop_set_from_keyval:Nn \@@_DeclareNewFloatType_prop { #2 } |
| 604 |
\prop_get:NnN \@@_DeclareNewFloatType_prop { fileext } \@@_ext_tl |
| 605 |
\quark_if_no_value:NT \@@_ext_tl |
| 606 |
{ |
| 607 |
\tl_set:Nn \@@_ext_tl { lo#1 } |
| 608 |
} |
| 609 |
} |
| 610 |
\newcommand*{\floatrowbytocbasic@get@currext}[2]{% |
| 611 |
\@@_get_ext_from_prop:nn { #1 } { #2 } |
| 612 |
\let\floatrowbytocbasic@currext\@@_ext_tl |
| 613 |
} |
| 614 |
\ExplSyntaxOff |
| 615 |
% \end{macrocode} |
| 616 |
% \end{macro} |
| 617 |
% \ExplSyntaxOff |
| 618 |
% |
| 619 |
% \begin{command}{\listof} |
| 620 |
% This command is redefined using a complete new definition using |
| 621 |
% \pkg{tocbasic}'s \cs{listoftoc}. |
| 622 |
% \begin{macrocode} |
| 623 |
\renewcommand*{\listof}[2]{% |
| 624 |
\@ifundefined{ext@#1}{\flrow@error{Unknown float style `#1'}}{% |
| 625 |
\@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure |
| 626 |
\@ifundefined{l@#1}{% |
| 627 |
\DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em] |
| 628 |
{default}{#1}% |
| 629 |
}{}% |
| 630 |
}{}% |
| 631 |
\listoftoc[{#2}]{\csname ext@#1\endcsname}% |
| 632 |
}% |
| 633 |
}% |
| 634 |
% \end{macrocode} |
| 635 |
% \end{command} |
| 636 |
% |
| 637 |
% \iffalse |
| 638 |
%</package> |
| 639 |
% \fi |
| 640 |
% |
| 641 |
% \Finale |
| 642 |
% \PrintChanges |
| 643 |
% |
| 644 |
% \endinput |
| 645 |
% Local Variables: |
| 646 |
% mode: doctex |
| 647 |
% ispell-local-dictionary: "en_US" |
| 648 |
% eval: (flyspell-mode 1) |
| 649 |
% TeX-master: t |
| 650 |
% End: |