Debian Codegraph @

texmf-dist/source/latex/newfloat/newfloat.dtx

raw
1 % \iffalse meta-comment
2 %
3 % This is file `newfloat.dtx'.
4 %
5 % Copyright (C) 2011-2023 Axel Sommerfeldt ([email protected])
6 %
7 % --------------------------------------------------------------------------
8 %
9 % This work may be distributed and/or modified under the
10 % conditions of the LaTeX Project Public License, either version 1.3
11 % of this license or (at your option) any later version.
12 % The latest version of this license is in
13 % http://www.latex-project.org/lppl.txt
14 % and version 1.3 or later is part of all distributions of LaTeX
15 % version 2003/12/01 or later.
16 %
17 % This work has the LPPL maintenance status "unmaintained".
18 %
19 % This work consists of the files newfloat.ins, newfloat.dtx,
20 % and the derived file newfloat.sty.
21 %
22 % \fi
23 % \CheckSum{1665}
24 %
25 % \iffalse
26 %<*driver>
27 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
28 \ProvidesFile{newfloat.drv}[2023/10/01 v1.2 This package offers a command for defining new floating environments]
29 \hbadness=9999 \newcount\hbadness \hfuzz=48pt % Make TeX shut up.
30 %
31 \documentclass{ltxdoc}
32 \setlength\parindent{0pt}
33 \setlength\parskip{\smallskipamount}
34 %
35 \usepackage{ifpdf}
36 \ifpdf
37 \usepackage{mathptmx,courier}
38 \usepackage[scaled=0.90]{helvet}
39 % \addtolength\marginparwidth{15pt}
40 \fi
41 %
42 \usepackage[bottom]{footmisc}
43 %
44 \usepackage{hypdoc}
45 \ifpdf\usepackage{hypdestopt}\fi
46 \hypersetup{pdfkeywords={LaTeX, package, newfloat},pdfstartpage={},pdfstartview={}}
47 %
48 \usepackage{newfloat}
49 %
50 \DeclareRobustCommand*\eTeX{\texorpdfstring
51 {\leavevmode\hbox{$\varepsilon$}-\TeX}%
52 {e-TeX}}
53 \DeclareRobustCommand*\AmS{\texorpdfstring
54 {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
55 {AMS}}
56 \DeclareRobustCommand*\KOMAScript{\texorpdfstring
57 {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
58 {KOMA-Script}}
59 \DeclareRobustCommand*\NTG{NTG}
60 \DeclareRobustCommand*\SmF{SMF}
61 %
62 \begin{document}
63 \DocInput{newfloat.dtx}
64 \end{document}
65 %</driver>
66 % \fi
67 %
68 % \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
69 % \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
70 % \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
71 % \let\cls\puresf \let\pkg\puresf
72 % \let\env\purett \let\opt\purett
73 %
74 % \def\thispackage{the \pkg{newfloat} package}
75 % \def\Thispackage{The \pkg{newfloat} package}
76 %
77 % \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
78 % \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
79 % \newcommand*\version[2][]{\textit{v#2}}
80 %
81 % \setlength\leftmargini{1.5em}
82 %
83 % \GetFileInfo{newfloat.drv}
84 % \let\docdate\filedate
85 % \let\docversion\fileversion
86 % \GetFileInfo{newfloat.sty}
87 %
88 % \title{\texorpdfstring{\Thispackage\thanks{%^^A
89 % This package has version number \docversion.}}%^^A
90 % {The newfloat package}}
91 % \author{Axel Sommerfeldt\\
92 % \url{https://gitlab.com/axelsommerfeldt/newfloat}}
93 % \date{\docdate}
94 % \maketitle
95 %
96 % \begin{abstract}
97 % \centering
98 % This package offers the command
99 % |\Declare|\-|Floating|\-|Environment| for defining new floating environments
100 % which behave like |figure| and |table|.
101 % \end{abstract}
102 %
103 % \tableofcontents
104 %
105 % \clearpage
106 % \section{Loading the package}
107 %
108 % First of all you need to include this package into your document with
109 % \begin{quote}
110 % |\usepackage|\oarg{options}|{newfloat}|
111 % \end{quote}
112 % where \meta{options} are one or more of
113 % \begin{quote}\begin{tabular}{r@{\,}l}
114 % |within=| & \meta{``within'' counter} \emph{or} \texttt{none}\quad\\
115 % |chapterlistsgap=| & \meta{value}~\footnotemark[1]
116 % \end{tabular}\end{quote}
117 %
118 % The ``within'' counter specifies the counter which will be used to reset
119 % the counter of the floating environments |figure| and |table| .
120 % (Furthermore this setting will be used as default setting for
121 % |\Declare|\-|Floating|\-|Environment|.)
122 %
123 % So for example |within=chapter| will give you a numbering scheme
124 % \meta{chapter}.\meta{x} for floating environments,
125 % while |within=section| will give you a numbering scheme
126 % \meta{chapter}.\meta{section}.\meta{x}, or \meta{section}.\meta{x}
127 % if the document class does not offer |\chapter|.
128 % |within=none| will result in a continuous numbering throughout the document,
129 % i.e.~the numbering scheme will be simply \meta{x}.
130 %
131 % The option |chapterlistsgap=|\meta{value} sets the amount of the
132 % vertical gap inserted into the ``List of Figure'', ``List of Tables'',
133 % and all lists created with |\Declare|\-|Floating|\-|Environment|
134 % when a new chapter will be started.
135 % The default value is |10pt|.
136 % (This option will only be available if the document class used offer
137 % the usage of chapters, e.g.~the |book| or |report| document class.)
138 %
139 % \pagebreak[3]
140 % Both options can be changed later on, too, by using the command
141 % \begin{quote}
142 % |\newfloatsetup|\meta{options}\quad,
143 % \end{quote}
144 %
145 % \pagebreak[3]
146 % \section{\cs{DeclareFloatingEnvironment}}
147 %
148 % After loading \thispackage\ you can define your own floating environments with
149 % \begin{quote}
150 % \iffalse
151 % \setlength{\leftmargin}{6cm}
152 % \fi
153 % |\DeclareFloatingEnvironment|\oarg{options}\marg{type}%
154 % \iffalse
155 % \oarg{name}\oarg{list name}
156 % \fi
157 % \end{quote}
158 % where \meta{options} are one or more of
159 % \begin{quote}\begin{tabular}{r@{\,}l}
160 % |fileext=| & \meta{file extension}\\
161 % |listname=| & \meta{list name}\\
162 % |name=| & \meta{prosa name}\\
163 % |autorefname=| & \meta{name used in \cs{autoref} offered by \pkg{hyperref}}\\
164 % |legendname=| & \meta{name used in \cs{legend} offered by \cls{memoir}}\\
165 % |placement=| & \meta{combination of \,\purett{htbp}}\\
166 % |within=| & \meta{``within'' counter} \emph{or} \texttt{none}\\
167 % |chapterlistsgaps=| & \texttt{on} \emph{or} \texttt{off}~\footnotemark[1]
168 % \end{tabular}\end{quote}
169 % \footnotetext[1]{Please note that although \thispackage\ tries hard to offer this
170 % option it may not be available or is working incorrectly in cooperation with
171 % your document class since there is no standard interface which we could use
172 % for that purpose. Therefore we have to try to patch the \cs{chapter} command,
173 % and if this fails, we try to patch \cs{addtocontents} (in an unusual way) instead.}
174 %
175 % If no \meta{options} are given,
176 % ``lo\meta{type}'' will be used as \meta{file extension} for the list,
177 % ``List of \meta{name}s'' as \meta{list name}.
178 % ``\meta{name}'' as \meta{name}, \meta{autoref name}, and \meta{legend name} (but with the first letter capitalized),
179 % ``|tbp|'' as \meta{placement} specifier,
180 % and ``|chapter|'' resp. ``|none|'' as \meta{``within'' counter},
181 % i.e., the counter which resets the numbering.
182 %
183 % The default value of the |chapterlistsgaps=| option depends on the
184 % ``within'' setting, it is set to |on| if |chapter| or |section| is selected,
185 % otherwise it is set to |off|.
186 % (This option will only be available if the document class used offer
187 % the usage of chapters, e.g.~the |book| or |report| document class.)
188 %
189 % The list will be typeset using the command |\list|\-|of|\meta{type}|s|
190 % resp.~|\list|\-|of|\meta{type}|es|,
191 % analogous to |\list|\-|of|\-|figures| and |\list|\-|of|\-|tables|.
192 %
193 % If the \pkg{fltpage} package is loaded, an environment called
194 % |FP|\meta{type} will be defined additionally, same for |sideways|\meta{type}
195 % (\pkg{rotating} package), |SC|\meta{type} (\pkg{sidecap} package),
196 % and |wrap|\meta{type} (\pkg{wrapfig} package).
197 %
198 % \bigskip
199 %
200 % \pagebreak[3]
201 % So for example
202 % \begin{quote}
203 % |\DeclareFloatingEnvironment{diagram}|
204 % \end{quote}
205 % will define a new floating environment called |diagram|,
206 % the list will be stored in a file with the extension |lodiagram|, the name
207 % (used for the caption) will be ``Diagram'' and the list name
208 % ``List of Diagrams''.
209 % The list could be typeset with |\list|\-|of|\-|diagrams|.
210 % Dependent on which packages are loaded, the environments |FP|\-|diagram|,
211 % |sideways|\-|diagram|, |SC|\-|diagram|, and |wrap|\-|diagram| will be defined additionally.
212 %
213 % \pagebreak[3]
214 % Another example:
215 % \begin{quote}
216 % |\DeclareFloatingEnvironment[|\\
217 % | fileext=lox,|\\
218 % | listname={List of Matrixes},|\\
219 % | name=Matrix,|\\
220 % | placement=p,|\\
221 % | within=section,|\\
222 % | chapterlistsgaps=off|\\
223 % | ]{matrixx}|
224 % \end{quote}
225 % will define a new floating environment called |matrixx| with the given settings.
226 % Please note that names which contain spaces needs to be enclosed in curly braces.
227 %
228 % \pagebreak[3]
229 % \section{\cs{SetupFloatingEnvironment}}
230 %
231 % While |\DeclareFloatingEnvironment| will create new floating environments,
232 % \begin{quote}
233 % |\SetupFloatingEnvironment|\marg{floating environment}\marg{options}
234 % \end{quote}
235 % will change the settings of existing ones, i.e. either |figure| or |table|,
236 % or a one created with |\Declare|\-|Floating|\-|Environment|,
237 % or a one created with |\new|\-|float| offered by the \pkg{float} package,
238 % or a one created with |\new|\-|float| offered by the \pkg{memoir} document class,
239 % or a one created with |\Declare|\-|New|\-|Float|\-|Type| offered by the \pkg{floatrow} package,
240 % or a one created by a document class or any other package.
241 %
242 % The \meta{options} are the same as the options for
243 % |\Declare|\-|Floating|\-|Environment|,
244 % but one should avoid changing the file extension
245 % of existing floating environments,
246 % i.e.~using the |fileext=| option within |\Setup|\-|Floating|\-|Environment|
247 % is usually a very bad idea.
248 %
249 % \bigskip
250 %
251 % \pagebreak[3]
252 % An example:
253 % \begin{quote}
254 % |\SetupFloatingEnvironment{lstlisting}{chapterlistsgaps=off}|
255 % \end{quote}
256 % will switch off the chapter lists gaps for |lstlisting| environments
257 % offered by the \pkg{listings} package.
258 %
259 % \pagebreak[3]
260 % \section{\cs{ForEachFloatingEnvironment}}
261 %
262 % \begin{quote}
263 % |\ForEachFloatingEnvironment|\marg{code with \#1}
264 % \end{quote}
265 % will execute the given \meta{code} for all known floating environments,
266 % and for ones defined with |\Declare|\-|Floating|\-|Environment| later on.
267 %
268 % \pagebreak[3]
269 % So for example the \pkg{subcaption} packages uses
270 % \begin{quote}
271 % |\ForEachFloatingEnvironment{\DeclareCaptionSubType{#1}}|
272 % \end{quote}
273 % for initializing itself for all floating environments which are
274 % known to \thispackage.
275 %
276 % \medskip
277 %
278 % There is also a starred variant |\For|\-|Each|\-|Floating|\-|Environment*|
279 % which will execute the given code for already existing floating environments
280 % only, i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment|.
281 %
282 % \pagebreak[3]
283 % An example:
284 % \begin{quote}
285 % |\ForEachFloatingEnvironment*{\typeout{#1}}|
286 % \end{quote}
287 % will typeout the names of all already known floating environments to the terminal
288 % and log file.
289 %
290 % \pagebreak[3]
291 % \section{\cs{PrepareListOf}}
292 %
293 % Unfortunately there is no standardized way of typesetting and customizing
294 % lists of floating environments, i.e.~every document class offers it's own stuff here,
295 % and there are plenty of \LaTeXe\ packages for this purpose.
296 %
297 % \pagebreak[3]
298 % For that reason the \thispackage\ simply typesets the lists of newly
299 % defined floating environments as ``List of Figure'' internally (using |\list|\-|of|\-|figure|)
300 % but using a different list (the right one, of course) and using a different list name,
301 % the one you have specified with either |\Declare|\-|Floating|\-|Environment| or
302 % |\Setup|\-|Floating|\-|Environment|.\footnote{Please note that this is not the
303 % fact when using a \KOMAScript\ document class, not \cs{listoffigure} but \cs{listoftoc}
304 % will be used here, and therefore no problems should occur.}
305 %
306 % \pagebreak[3]
307 % While this usually results in the same layout as the ``List of Figure'' and
308 % is sufficient for most cases, there are some cases where this might
309 % lead to an unwanted side effect.
310 %
311 % \pagebreak[3]
312 % Therefore the \thispackage\ offers
313 % \begin{quote}
314 % |\PrepareListOf|\marg{floating environment}\marg{code}
315 % \end{quote}
316 % which will execute the given \meta{code} right before actually typesetting the list
317 % with |\list|\-|of|\-|figures| internally.
318 %
319 % \pagebreak[3]
320 % One example:
321 % \begin{quote}
322 % |\PrepareListOf{diagram}{%|\\
323 % | \renewcommand{\cftfigpresnum}{Diagram~}}|
324 % \end{quote}
325 % will change the part typeset in front of the diagram number within the
326 % ``List of Diagrams'' when using the \pkg{tocloft} package~\cite{tocloft}.
327 % Without the code above you will get the part defined for figures instead.
328 %
329 % \pagebreak[3]
330 % However, when dealing with the \pkg{tocloft} package it's a better
331 % idea not to use |\Prepare|\-|List|\-|Of| but the customization facilities of that package
332 % instead, e.g.:
333 % \begin{quote}
334 % |\documentclass{book}|\\
335 % \ldots\\
336 % |\usepackage{newfloat,tocloft}|\\
337 % |\newlistof{diagram}{lod}{List of Diagrams}|\\
338 % |\DeclareFloatingEnvironment[name=Diagram,fileext=lod]{diagram}|\\
339 % | % Note: Due of a bug in tocloft the file extension|\\
340 % | % must be repeated at \DeclareFloatingEnvironment,|\\
341 % | % otherwise you will get an empty list.|\\
342 % ||\\
343 % |% Customize `List of Figures'|\\
344 % |\renewcommand{\cftfigpresnum}{Figure~}|\\
345 % |\setlength{\cftfignumwidth}{2cm}|\\
346 % ||\\
347 % |% Customize `List of Diagrams'|\\
348 % |\renewcommand{\cftdiagrampresnum}{Diagram~}|\\
349 % |\setlength{\cftdiagramnumwidth}{2cm}|\\
350 % ||\\
351 % \ldots\\
352 % ||\\
353 % |\begin{document}|\\
354 % \ldots\\
355 % |\listoffigures|\\
356 % |\listofdiagrams|\\
357 % \ldots\\
358 % |\end{document}|
359 % \end{quote}
360 %
361 % \pagebreak[3]
362 % \section{Multi-language support}
363 %
364 % The options \opt{name=} etc.~will set names for the current language only.
365 % If support for multiple languages is needed, the command |\addto\captions|\meta{language}
366 % offered by the \pkg{babel} package needs to be used to set names for all the different languages.
367 %
368 % These are the corresponding command names:
369 %
370 % \nobreak\medskip\nobreak\noindent
371 % \begin{minipage}{\linewidth}
372 % \centering
373 % \begin{tabular}{lll}
374 % Option & Command & Description \\
375 % \hline
376 % \opt{listname=} & |\list|\meta{float}|name| & Heading of the list \\
377 % \opt{name=} & |\|\meta{float}|name| & Name used in |\caption| \\
378 % \opt{autorefname=} & |\|\meta{float}|autorefname| & Name used in |\autoref| \\
379 % \opt{legendname=} & |\fleg|\meta{float} & Name used in |\legend| \\
380 % \end{tabular}
381 % \end{minipage}
382 %
383 % \medskip
384 %
385 % \pagebreak[3]
386 % Example code:
387 % \nobreak\begin{quote}
388 % |\documentclass{book}|\\
389 % \ldots\\
390 % |\usepackage[T1]{fontenc}|\\
391 % |\usepackage[english,french,german]{babel}|\\
392 % \ldots\\
393 % |\usepackage{newfloat}|\\
394 % |\DeclareFloatingEnvironment{diagram}|\\
395 % |% Set names for the English language|\\
396 % |\addto\captionsenglish{%|\\
397 % | \renewcommand\diagramname{Diagram}%|\\
398 % | \renewcommand\listdiagramname{List of Diagrams}%|\\
399 % |}|\\
400 % |% Set names for the French language|\\
401 % |\addto\captionsfrench{%|\\
402 % | \renewcommand\diagramname{Diagramme}%|\\
403 % | \renewcommand\listdiagramname{Liste des diagrammes}%|\\
404 % |}|\\
405 % |% Set names for the German language|\\
406 % |\addto\captionsgerman{%|\\
407 % | \renewcommand\diagramname{Diagramm}%|\\
408 % | \renewcommand\listdiagramname{Liste der Diagramme}%|\\
409 % |}|\\
410 % \ldots
411 % \end{quote}
412 %
413 % \pagebreak[3]
414 % \emph{Note:}
415 % As default the names for |\autoref| and |\legend| point to the one used for captions,
416 % so these names only need to be set if they should differ from it.
417 %
418 % \pagebreak[3]
419 % \section{Important notes for \LaTeX\ document class maintainers}
420 %
421 % If you are a maintainer of a \LaTeX\ document class and want to support this package
422 % you could tell this package to keep its fingers from your definition of |\chapter| by defining
423 % |\new|\-|float@dont@patch@chapter| to anything. (The content of the definition does not matter
424 % since the \pkg{newfloat} package only checks if this macro is defined or not.)
425 %
426 % If |\new|\-|float@dont@patch@chapter| is defined, the \pkg{newfloat} package does not try to patch
427 % |\chapter| but assumes that |\@add|\-|chapter|\-|lists|\-|gaps| is already used by the document class inside
428 % its definition of |\chapter|, so it only needs to re-define |\@add|\-|chapter|\-|lists|\-|gaps|
429 % to use the settings configured by |\De|\-|clare|\-|Float|\-|ing|\-|En|\-|vi|\-|ron|\-|ment|
430 % or |\Setup|\-|Float|\-|ing|\-|En|\-|vi|\-|ron|\-|ment|.
431 %
432 % \medskip
433 %
434 % \pagebreak[3]
435 % Example code:
436 % \nobreak\begin{quote}
437 % |\newcommand\@chapterlistsgap{10\p@}|\\
438 % ||\\
439 % |\newcommand\@addchapterlistsgaps{%|\\
440 % | % Add a gap to List of Figures and List of Tables|\\
441 % | % (This macro will be re-defined if the newfloat package|\\
442 % | % is loaded by the user later on.)|\\
443 % | \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%|\\
444 % | \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%|\\
445 % |}|\\
446 % ||\\
447 % |\newcommand\chapter{%|\\
448 % | |\ldots\\
449 % | \secdef\@chapter\@schapter}|\\
450 % |\def\@chapter[#1]#2{%|\\
451 % | |\ldots\\
452 % | \@addchapterlistsgaps|\\
453 % | |\ldots\\
454 % |}|\\
455 % ||\\
456 % |% Hey newfloat package, don't patch my \chapter!|\\
457 % |\def\newfloat@dont@patch@chapter{}|
458 % \end{quote}
459 %
460 % \iffalse
461 % \pagebreak[3]
462 % \section{Notes for \LaTeX{} package authors}
463 %
464 % |\For|\-|Each|\-|Floating|\-|Environment| without \pkg{newfloat} package:
465 % \begin{quote}
466 % |\newcommand\mypackage@foreachfloat[1]{%|\\
467 % | \@ifundefined{ForEachFloatingEnvironment}%|\\
468 % | {\def\@elt##1{#1}%|\\
469 % | \@ifundefined{c@figure}\@gobble\@elt{figure}%|\\
470 % | \@ifundefined{c@table}\@gobble\@elt{table}%|\\
471 % | \let\@elt\relax|\\
472 % | \newfloat@addtohook{#1}}%|\\
473 % | {\ForEachFloatingEnvironment{#1}}}|\\
474 % |\providecommand\newfloat@addtohook[1]{%|\\
475 % | \toks@=\expandafter{\newfloat@hook{##1}#1}%|\\
476 % | \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%|\\
477 % | \@tempa}|\\
478 % |\providecommand*\newfloat@hook[1]{}|
479 % \end{quote}
480 %
481 % \pagebreak[3]
482 % Adding environment to list of floating environments:
483 % \begin{quote}
484 % |\SetupFloatingEnvironment|\marg{environment}|{}|
485 % \end{quote}
486 % or (without \pkg{newfloat} package loaded):
487 % \begin{quote}
488 % |\providecommand\newfloat@list{}|\\
489 % |\@cons\newfloat@list{|\marg{environment}|}|
490 % \end{quote}
491 % (Please note the doubled curly braces around the environment name.)
492 % \fi
493 %
494 % \iffalse
495 % --------------------------------------------------------------------------- %
496 % \fi
497 %
498 % \StopEventually{%^^A
499 % \pagebreak[4]
500 % \begin{thebibliography}{9}
501 %
502 % \bibitem{memoir}
503 % Peter Wilson:\\
504 % \href{http://www.ctan.org/pkg/memoir}%
505 % {\emph{The Memoir Class for Configurable Typesetting}},\\
506 % 2011/03/06
507 %
508 % \bibitem{NTGclasses}
509 % Victor Eijkhout:\\
510 % \href{http://www.ctan.org/pkg/ntgclass}%
511 % {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\
512 % \mbox{3~September~1989}
513 %
514 % \bibitem{KOMAScript}
515 % Markus Kohm \& Jens-Uwe-Morawski:\\
516 % \href{http://www.ctan.org/pkg/koma-script}%
517 % {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\
518 % 2012-07-22
519 %
520 % \bibitem{float}
521 % Anselm Lingnau:\\
522 % \href{http://www.ctan.org/pkg/float}%
523 % {\emph{An Improved Environment for Floats}},\\
524 % 2001/11/08
525 %
526 % \bibitem{fltpage}
527 % Sebastian Gross:\\
528 % \href{http://www.ctan.org/pkg/fltpage}%
529 % {\emph{Welcome to the beta test of fltpage package!}},\\
530 % 1998/11/13
531 %
532 % \bibitem{rotating}
533 % Sebastian Rahtz and Leonor Barroca:\\
534 % \href{http://www.ctan.org/pkg/rotating}%
535 % {\emph{A style option for rotated objects in \LaTeX}},\\
536 % 1997/09/26
537 %
538 % \bibitem{sidecap}
539 % Rolf Niepraschk \& Hubert G\"a\ss lein:\\
540 % \href{http://www.ctan.org/pkg/sidecap}%
541 % {\emph{The sidecap package}},\\
542 % 2003/06/06
543 %
544 % \bibitem{tocloft}
545 % Peter Wilson, Herries Press, Will Robertson:\\
546 % \href{http://www.ctan.org/pkg/tocloft}%
547 % {\emph{The tocloft package}},\\
548 % 2010/10/13
549 %
550 % \bibitem{wrapfig}
551 % Donald Arseneau:\\
552 % \href{http://www.ctan.org/pkg/wrapfig}%
553 % {\emph{WRAPFIG.STY ver 3.6}},\\
554 % 2003/01/31
555 %
556 % \end{thebibliography}
557 % }
558 %
559 % \iffalse
560 % --------------------------------------------------------------------------- %
561 % \fi
562 %
563 % \DoNotIndex{\\,\_,\ ,\@@par}
564 % \DoNotIndex{\@bsphack}
565 % \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
566 % \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
567 % \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
568 % \DoNotIndex{\@gobble,\@gobbletwo,\@gobblethree,\@gobblefour,\@hangfrom}
569 % \DoNotIndex{\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
570 % \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse}
571 % \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
572 % \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
573 % \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
574 % \DoNotIndex{\@testopt}
575 % \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
576 % \DoNotIndex{\p@,\z@}
577 % \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
578 % \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
579 % \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
580 % \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
581 % \DoNotIndex{\fi,\footnotesize,\global}
582 % \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
583 % \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
584 % \DoNotIndex{\ifx,\ignorespaces,\itshape}
585 % \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
586 % \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
587 % \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
588 % \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
589 % \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
590 % \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
591 % \DoNotIndex{\providecommand,\quad}
592 % \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
593 % \DoNotIndex{\rightskip,\rmfamily}
594 % \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
595 % \DoNotIndex{\small,\string,\space,\strut}
596 % \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
597 % \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
598 % \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
599 % \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
600 % \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
601 % \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
602 % \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
603 % \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
604 %
605 % \iffalse
606 % --------------------------------------------------------------------------- %
607 % \fi
608 %
609 % \setlength{\parskip}{0pt plus 1pt}
610 % \changes{v1.0}{2011/10/30}{First release as \pkg{newfloat} package,
611 % outsourced from the \pkg{caption3} package and revised}
612 % \changes{v1.1}{2013/04/27}{Adapted to the \pkg{tocloft} package}
613 % \changes{v1.1}{2013/04/27}{New command \cs{PrepareListOf} added}
614 % \changes{v1.1d}{2019/03/16}{Adapted to the \pkg{dgruyter} package}
615 %
616 % \iffalse
617 % --------------------------------------------------------------------------- %
618 % \fi
619 %
620 % \clearpage
621 % \section{The Implementation}
622 % \iffalse
623 %<*package>
624 % \fi
625 %
626 % \pagebreak[3]
627 % \subsection{Identification}
628 %
629 % We need at least \LaTeX2e\ version 1994/12/01.
630 % \begin{macrocode}
631 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
632 % \end{macrocode}
633 %
634 % Bypass the release declarations in case the \LaTeX\ kernel doesn’t know how to deal with them
635 % (as suggested by \url{https://www.latex-project.org/publications/2018-FMi-TUB-tb122mitt-version-rollback.pdf}).
636 % \begin{macrocode}
637 \providecommand\DeclareRelease[3]{}
638 \providecommand\DeclareCurrentRelease[2]{}
639 % \end{macrocode}
640 %
641 % Declare all supported releases.
642 % \begin{macrocode}
643 \DeclareRelease{v1.0}{2011-10-30}{newfloat_v1.0.sty}
644 \DeclareRelease{v1.1}{2013-05-12}{newfloat_v1.1.sty}
645 \DeclareCurrentRelease{v1.2}{2023-10-01}
646 % \end{macrocode}
647 %
648 % Identify the current version of the package.
649 % \begin{macrocode}
650 \ProvidesPackage{newfloat}[2023/10/01 v1.2 Defining new floating environments (AR)]
651 % \end{macrocode}
652 %
653 % \begin{macro}{\newfloat@Info}
654 % \begin{macro}{\newfloat@InfoNoLine}
655 % |\newfloat@Info|\marg{message}
656 % \begin{macrocode}
657 \newcommand*\newfloat@Info[1]{%
658 \PackageInfo{newfloat}{#1}}
659 \newcommand*\newfloat@InfoNoLine[1]{%
660 \newfloat@Info{#1\@gobble}}
661 % \end{macrocode}
662 % \end{macro}
663 % \end{macro}
664 %
665 % \begin{macro}{\newfloat@Warning}
666 % \begin{macro}{\newfloat@WarningNoLine}
667 % |\newfloat@Warning|\marg{message}
668 % \begin{macrocode}
669 \newcommand*\newfloat@Warning[1]{%
670 \PackageWarning{newfloat}{#1}}
671 \newcommand*\newfloat@WarningNoLine[1]{%
672 \newfloat@Warning{#1\@gobble}}
673 % \end{macrocode}
674 % \end{macro}
675 % \end{macro}
676 %
677 % \begin{macro}{\newfloat@Error}
678 % |\newfloat@Error|\marg{message}
679 % \begin{macrocode}
680 \newcommand*\newfloat@Error[1]{%
681 \PackageError{newfloat}{#1}\newfloat@eh}
682 % \end{macrocode}
683 % \begin{macrocode}
684 \newcommand*\newfloat@eh{%
685 If you do not understand this error, please take a closer look\MessageBreak
686 at the documentation of the `newfloat' package.\MessageBreak\@ehc}
687 % \end{macrocode}
688 % \end{macro}
689 %
690 % \pagebreak[3]
691 % \subsection{Using the keyval package}
692 %
693 % We need the \pkg{keyval} package for option handling, so we load it here.
694 % \begin{macrocode}
695 \RequirePackage{keyval}[1997/11/10]
696 % \end{macrocode}
697 %
698 % \pagebreak[3]
699 % \subsection{Helper macros}
700 %
701 % \begin{macro}{\newfloat@def}
702 % \changes{v1.1}{2013/04/27}{This macro added}
703 % |\newfloat@def|\marg{macro name}\marg{definition}
704 % \begin{macrocode}
705 \newcommand*\newfloat@def[2]{%
706 \newfloat@ifundefined{#1}{%
707 \@namedef{#1}{#2}}}
708 % \end{macrocode}
709 % \end{macro}
710 %
711 % \begin{macro}{\newfloat@let}
712 % \changes{v1.1}{2013/04/27}{This macro added}
713 % |\newfloat@let|\marg{macro name}\marg{macro}
714 % \begin{macrocode}
715 \newcommand*\newfloat@let[2]{%
716 \newfloat@ifundefined{#1}{%
717 \expandafter\let\csname #1\endcsname#2}}
718 % \end{macrocode}
719 % \end{macro}
720 %
721 % \begin{macro}{\newfloat@ifundefined}
722 % \changes{v1.1}{2013/04/27}{This macro added}
723 % |\newfloat@ifundefined|\marg{macro name}\marg{code}
724 % \begin{macrocode}
725 \newcommand*\newfloat@ifundefined[2]{%
726 \@ifundefined{#1}{#2}{%
727 \newfloat@Info{%
728 \expandafter\string\csname#1\endcsname\space is already defined}}}
729 % \end{macrocode}
730 % \end{macro}
731 %
732 % \pagebreak[3]
733 % \subsection{\cs{DeclareFloatingEnvironment}}
734 %
735 % \begin{macro}{\DeclareFloatingEnvironment}
736 % \changes{v1.0a}{2011/11/16}{Bugfix: Undefines \cs{fst@}\meta{environment} now}
737 % \changes{v1.1}{2013/04/27}{Revised, only defines stuff yet undefined now}
738 % \changes{v1.1}{2013/11/03}{Uses \cs{newfloat@capitalize} now}
739 % \changes{v1.1}{2015/09/16}{Support of \cs{autodot} (offered by the \KOMAScript\ classes) added}
740 % \changes{v1.1}{2018/03/04}{Usage of \cs{ifdefined} replaced by \cs{@ifundefined} to improve compatibility with the \pkg{listings} package}
741 % \changes{v1.1b}{2018/12/26}{Bugfix: Missing curly braces added}
742 % \changes{v1.1c}{2019/01/10}{Bugfix: Support of \cs{autodot} fixed}
743 % \changes{v1.1k}{2019/09/01}{Adapted to the \cls{beamer} document class}
744 % \changes{v1.2}{2021/02/28}{Definition of \cs{xxxautorefname} added}
745 % |\DeclareFloatingEnvironment|\oarg{options}\marg{environment}\oarg{name}\oarg{list name}
746 % \begin{macrocode}
747 \newcommand*\DeclareFloatingEnvironment{%
748 \@testopt\@DeclareFloatingEnvironment{}}
749 \@onlypreamble\DeclareFloatingEnvironment
750 % \end{macrocode}
751 % \begin{macrocode}
752 \def\@DeclareFloatingEnvironment[#1]#2{%
753 \newfloat@Info{New float `#2' with options `#1'}%
754 % \end{macrocode}
755 % Define a counter with the same name as the floating environment
756 % \begin{macrocode}
757 \newfloat@ifundefined{c@#2}{\newcounter{#2}}%
758 % \end{macrocode}
759 % Set |\ftype@|\meta{type} which contains the type number for floats of type \meta{type}\par
760 % (See also \url{http://tex.stackexchange.com/q/32359/2574})
761 % \begin{macrocode}
762 \@ifundefined{c@float@type}% from float package
763 {\@ifundefined{c@newflo@tctr}% from memoir document class
764 {\ifdefined\newfloat@ftype \else
765 \newcount\newfloat@ftype
766 \newfloat@ftype=8\relax
767 \fi
768 \expandafter\xdef\csname ftype@#2\endcsname{\the\newfloat@ftype}%
769 \advance\newfloat@ftype\newfloat@ftype}%
770 {\expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr}%
771 \advance\c@newflo@tctr \c@newflo@tctr}}%
772 {\expandafter\edef\csname ftype@#2\endcsname{\the\value{float@type}}%
773 \addtocounter{float@type}{\value{float@type}}}%
774 % \end{macrocode}
775 % \begin{macrocode}
776 \newfloat@Info{float type `#2'=\@nameuse{ftype@#2}}%
777 % \end{macrocode}
778 % Define |\fnum@|\meta{type}, a macro to generate the figure number for a caption
779 % \begin{macrocode}
780 \newfloat@def{fnum@#2}%
781 {\@nameuse{#2name}\nobreakspace\@nameuse{the#2}%
782 \ifdefined\autodot\expandafter\autodot\fi}%
783 % \end{macrocode}
784 % Define |\|\meta{type}|name| used by |\fnum@|\meta{type} as \meta{type},
785 % but with first letter capitalized
786 % \begin{macrocode}
787 \newfloat@capitalize\newfloat@Type{#2}%
788 \newfloat@let{#2name}{\newfloat@Type}% \caption naming
789 \newfloat@def{#2autorefname}{\@nameuse{#2name}}% \autoref naming (hyperref)
790 \newfloat@def{fleg#2}{\@nameuse{#2name}}% \legend naming (memoir)
791 % \end{macrocode}
792 % Legend name in ToC (memoir document class)
793 % \begin{macrocode}
794 \newfloat@ifundefined{flegtoc#2}{\@namedef{flegtoc#2}##1{}}%
795 % \end{macrocode}
796 % Define the floating environment\par
797 % If the \cls{tufte} document class is loaded,
798 % |\@tufte@float| and |\end@tufte@float| will be used instead of
799 % |\@float|, |\end@float|, |\@dblfloat|, and |\end@dblfloat|.\par
800 % If the \cls{beamer} document class is loaded,
801 % |\beamer@float| and |\end@beamer@float| will be used.
802 % \begin{macrocode}
803 \ifcsname @tufte@float\endcsname
804 \newenvironment{#2}[1][htbp]%
805 {\begin{@tufte@float}[{##1}]{#2}{}}%
806 {\end{@tufte@float}}%
807 \newenvironment{#2*}[1][htbp]%
808 {\begin{@tufte@float}[{##1}]{#2}{star}}%
809 {\end{@tufte@float}}%
810 \else
811 \@ifclassloaded{beamer}{%
812 \newenvironment{#2}[1][]{\beamer@float{#2}}{\end@beamer@float}%
813 }{%
814 \newenvironment{#2}{\@float{#2}}{\end@float}%
815 \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}%
816 }%
817 \fi
818 % \end{macrocode}
819 % Define the listing command |\listof|\meta{type}(|e|)|s|
820 % \changes{v1.1}{2013/04/27}{Definition of list hook added}
821 % \begin{macrocode}
822 \newfloat@def{listof#2}{\newfloat@listof{#2}}%
823 \newfloat@def{listof#2s}{\@nameuse{listof#2}}%
824 \newfloat@def{listof#2es}{\@nameuse{listof#2s}}%
825 \newfloat@def{newfloat@listof#2@hook}{}%
826 \ifdefined\l@figure
827 \newfloat@let{l@#2}{\l@figure}%
828 \else
829 \newfloat@def{l@#2}{\@dottedtocline{1}{1.5em}{2.3em}}%
830 \fi
831 \edef\newfloat@tempa{List of \newfloat@Type s}%
832 \newfloat@let{list#2name}{\newfloat@tempa}%
833 % \end{macrocode}
834 % We undefine |\fst@|\meta{environment} so the new environment
835 % will not be recognized as defined by the \pkg{float} package.
836 % (|\fst@|\meta{type} use to hold the float style, see \pkg{float} package
837 % implementation for details.)
838 % \begin{macrocode}
839 \expandafter\let\csname fst@#2\endcsname\@undefined
840 % \end{macrocode}
841 % Set default parameters
842 % \begin{macrocode}
843 \newfloat@ifundefined{fps@#2}{\newfloat@setplacement{#2}{tbp}}%
844 \newfloat@ifundefined{ext@#2}{\newfloat@setfileext{#2}{lo#2}}%
845 % \end{macrocode}
846 % Apply given options
847 % \begin{macrocode}
848 \newfloat@setoptions*{#2}{#1}%
849 % \end{macrocode}
850 % Announce the new floating environment to other packages
851 % \begin{macrocode}
852 \@expandtwoargs\newfloat@announce{#2}{\@nameuse{ext@#2}}%
853 % \end{macrocode}
854 % Apply the last two optional arguments for setting names
855 % \begin{macrocode}
856 \@ifnextchar[\newfloat@DFE@setname\relax}
857 \@onlypreamble\@DeclareFloatingEnvironment
858 % \end{macrocode}
859 % \begin{macrocode}
860 \def\newfloat@DFE@setname[#1]{%
861 \KV@@newfloat@name{#1}%
862 \@ifnextchar[\newfloat@DFE@setlistname\relax}
863 \@onlypreamble\newfloat@DFE@setname
864 % \end{macrocode}
865 % \begin{macrocode}
866 \def\newfloat@DFE@setlistname[#1]{%
867 \KV@@newfloat@listname{#1}}
868 \@onlypreamble\newfloat@DFE@setlistname
869 % \end{macrocode}
870 % \end{macro}
871 %
872 % \begin{macro}{\newfloat@capitalize}
873 % \changes{v1.1}{2013/11/03}{Code extracted from \cs{DeclareFloatingEnvironment}}
874 % \changes{v1.1}{2013/11/03}{Uses \cs{newfloat@tempa} instead of \cs{@tempa} now}
875 % |\newfloat@capitalize|\marg{command}\marg{name}\\
876 % Defines \meta{command} to \meta{name}, but with first letter capitalized.
877 % \begin{macrocode}
878 \newcommand*\newfloat@capitalize[2]{%
879 \edef\newfloat@tempa{\gdef\noexpand#1{\@car#2\@nil}}%
880 \uppercase\expandafter{\newfloat@tempa}%
881 \edef\newfloat@tempa{%
882 \noexpand\g@addto@macro\noexpand#1{\@cdr#2\@nil}}%
883 \newfloat@tempa}
884 % \end{macrocode}
885 % \end{macro}
886 %
887 % \begin{macro}{\newfloat@listof}
888 % \changes{v1.1}{2013/04/27}{Revised}
889 % \changes{v1.1g}{2019/08/28}{Starred variant added}
890 % \changes{v1.1n}{2021/02/27}{Uses \cs{newfloat@ext} now instead of \cs{ext@xxx}}
891 % |\newfloat@listof|\marg{float type}\\
892 % typesets the list, using |\listoffigure| with patched list name and file extension.
893 % \begin{macrocode}
894 \newcommand*\newfloat@listof[1]{%
895 \@ifstar
896 {\newfloat@list@of{#1}*}%
897 {\newfloat@list@of{#1}\relax}}
898 % \end{macrocode}
899 % \begin{macrocode}
900 \newcommand*\newfloat@list@of[1]{%
901 \@expandtwoargs\newfloat@list@of@{#1}{\newfloat@ext{#1}}}
902 % \end{macrocode}
903 % \begin{macrocode}
904 \newcommand*\newfloat@list@of@[3]{%
905 \begingroup
906 \expandafter\let\expandafter\listfigurename\csname list#1name\endcsname
907 \def\ext@figure{#2}%
908 \let\newfloat@starttoc\@starttoc
909 \def\@starttoc##1{\newfloat@starttoc{#2}}%
910 \let\newfloat@listoftoc\listoftoc
911 \def\listoftoc##1{\newfloat@listoftoc{#2}}%
912 \@nameuse{newfloat@listof#1@hook}%
913 \listoffigures#3%
914 \endgroup}
915 % \end{macrocode}
916 % \end{macro}
917 %
918 % \begin{macro}{\newfloat@setoptions}
919 % |\newfloat@setoptions*|\marg{environment}\marg{options}
920 % \begin{macrocode}
921 \newcommand*\newfloat@setoptions{%
922 \@ifstar
923 {\newfloat@@setoptions\@firstofone}%
924 {\newfloat@@setoptions\@gobble}}
925 % \end{macrocode}
926 % \begin{macrocode}
927 \newcommand*\newfloat@@setoptions[3]{%
928 \let\newfloat@within@value\@undefined
929 \let\newfloat@chapterlistsgaps@value\@undefined
930 #1{\KV@@newfloat@within\newfloat@within@default}% set default value for new floats
931 \def\newfloat@type{#2}%
932 \setkeys{@newfloat}{#3}%
933 \ifx\newfloat@within@value\@undefined \else
934 \newfloat@setoption{within}\newfloat@within@value
935 \fi
936 \ifx\newfloat@chapterlistsgaps@value\@undefined \else
937 \newfloat@setoption{chapterlistsgaps}\newfloat@chapterlistsgaps@value
938 \fi}
939 % \end{macrocode}
940 % \end{macro}
941 %
942 % \begin{macro}{\newfloat@within@default}
943 % The default `within' value.
944 % This one will be used if no option |within=|\meta{counter} is given.
945 % \begin{macrocode}
946 \newcommand*\newfloat@within@default{%
947 \ifcsname c@chapter\endcsname chapter\else none\fi}
948 \@onlypreamble\newfloat@within@default
949 % \end{macrocode}
950 % \end{macro}
951 %
952 % \begin{macro}{\newfloat@setoption}
953 % \changes{v1.1}{2015/09/15}{\cs{@expandtwoargs} replaced by own expansion so the option value do not get expanded anymore}
954 % \changes{v1.1m}{2020/10/11}{Usage of \cs{caption@tempa} replaced by \cs{newfloat@tempa}}
955 % |\newfloat@setoption|\marg{option name}{options}
956 % \begin{macrocode}
957 \newcommand*\newfloat@setoption[1]{%
958 \edef\newfloat@tempa{\noexpand\@nameuse{newfloat@set#1}{\newfloat@type}}%
959 \newfloat@tempa}
960 % \end{macrocode}
961 % \end{macro}
962 %
963 % The available \meta{options} are:
964 % |fileext=|\meta{file extension},
965 % |listname=|\meta{list name},
966 % |name=|\meta{prosa name},
967 % |placement=|\meta{htbp},
968 % |within=|\meta{none,chapter,section}, and
969 % |without|.
970 %
971 % \begin{macro}{\newfloat@setfileext}
972 % |\newfloat@setfileext|\marg{environment}\marg{file extension}
973 % \begin{macrocode}
974 \newcommand*\newfloat@setfileext[2]{%
975 \@namedef{ext@#1}{#2}}
976 % \end{macrocode}
977 % \begin{macrocode}
978 \define@key{@newfloat}{fileext}{%
979 \newfloat@setoption{fileext}{#1}}
980 % \end{macrocode}
981 % \end{macro}
982 %
983 % \begin{macro}{\newfloat@setlistname}
984 % |\newfloat@setlistname|\marg{environment}\marg{list name}
985 % \begin{macrocode}
986 \newcommand*\newfloat@setlistname[2]{%
987 \@namedef{list#1name}{#2}}
988 % \end{macrocode}
989 % \begin{macrocode}
990 \define@key{@newfloat}{listname}{%
991 \newfloat@setoption{listname}{#1}}
992 % \end{macrocode}
993 % \end{macro}
994 %
995 % \begin{macro}{\newfloat@setname}
996 % |\newfloat@setname|\marg{environment}\marg{name}
997 % \begin{macrocode}
998 \newcommand*\newfloat@setname[2]{%
999 \newfloat@@setname{#1}{#2}%
1000 \begingroup
1001 \ifcsname languagename\endcsname
1002 \ifcsname captions\languagename\endcsname
1003 \expandafter\g@addto@macro\csname captions\languagename\endcsname
1004 {\newfloat@@setname{#1}{#2}}%
1005 \fi
1006 \fi
1007 \endgroup}
1008 %%\AtBeginDocument{\let\newfloat@setname\newfloat@@setname}
1009 % \end{macrocode}
1010 % \begin{macrocode}
1011 \newcommand*\newfloat@@setname[2]{%
1012 \@namedef{#1name}{#2}}
1013 % \end{macrocode}
1014 % \begin{macrocode}
1015 \define@key{@newfloat}{name}{%
1016 \newfloat@setoption{name}{#1}}
1017 % \end{macrocode}
1018 % \end{macro}
1019 %
1020 % \begin{macro}{\newfloat@setautorefname}
1021 % \changes{v1.2}{2023/10/01}{This macro and corresponding option \opt{autorefname=} added}
1022 % |\newfloat@setautorefname|\marg{environment}\marg{autoref name}\par
1023 % This name is used in |\autoref| offered by the \pkg{hyperref} package.
1024 % \begin{macrocode}
1025 \newcommand*\newfloat@setautorefname[2]{%
1026 \@namedef{#1autorefname}{#2}}
1027 % \end{macrocode}
1028 % \begin{macrocode}
1029 \define@key{@newfloat}{autorefname}{%
1030 \newfloat@setoption{autorefname}{#1}}
1031 % \end{macrocode}
1032 % \end{macro}
1033 %
1034 % \begin{macro}{\newfloat@setlegendname}
1035 % \changes{v1.2}{2023/10/01}{This macro and corresponding option \opt{legendname=} added}
1036 % |\newfloat@setlegendname|\marg{environment}\marg{legend name}
1037 % This name is used in |\legend| offered by the \cls{memoir} document class.
1038 % \begin{macrocode}
1039 \newcommand*\newfloat@setlegendname[2]{%
1040 \@namedef{fleg#1}{#2}}
1041 % \end{macrocode}
1042 % \begin{macrocode}
1043 \define@key{@newfloat}{legendname}{%
1044 \newfloat@setoption{legendname}{#1}}
1045 % \end{macrocode}
1046 % \end{macro}
1047 %
1048 % \begin{macro}{\newfloat@setplacement}
1049 % |\newfloat@setplacement|\marg{environment}\marg{float placement}
1050 % \begin{macrocode}
1051 \newcommand*\newfloat@setplacement[2]{%
1052 \@namedef{fps@#1}{#2}}
1053 % \end{macrocode}
1054 % \begin{macrocode}
1055 \define@key{@newfloat}{placement}{%
1056 \newfloat@setoption{placement}{#1}}
1057 % \end{macrocode}
1058 % \end{macro}
1059 %
1060 % \begin{macro}{\newfloat@setwithin}
1061 % |\newfloat@setwithin|\marg{environment}\marg{counter}\par
1062 % setup the counter for working ``within'' a given counter.
1063 % Furthermore the chapters lists gap will be switched on
1064 % (if counter $=$ |chapter|) or off (otherwise).
1065 % \begin{macrocode}
1066 \newcommand*\newfloat@setwithin[2]{%
1067 \ifcsname c@chapter\endcsname
1068 \@removefromreset{#1}{chapter}%
1069 \fi
1070 \@removefromreset{#1}{section}%
1071 % \end{macrocode}
1072 % \begin{macrocode}
1073 \edef\@tempa{#2}%
1074 \ifx\@tempa\@empty
1075 \def\@tempa{none}%
1076 \fi
1077 \def\@tempb{none}%
1078 \ifx\@tempa\@tempb
1079 \ifcsname c@chapter\endcsname
1080 \@chapterlistsgap@off{#1}%
1081 \fi
1082 \newfloat@@setwithin{#1}{}{}%
1083 \else
1084 \def\@tempb{chapter}%
1085 \ifx\@tempa\@tempb
1086 \@addtoreset{#1}{chapter}%
1087 \@chapterlistsgap@on{#1}%
1088 \newfloat@@setwithin{#1}{\ifnum\c@chapter>\z@ \thechapter.\fi}{\theHchapter.}%
1089 \else
1090 \def\@tempb{section}%
1091 \ifx\@tempa\@tempb
1092 \@addtoreset{#1}{section}%
1093 \ifcsname c@chapter\endcsname
1094 \@addtoreset{#1}{chapter}%
1095 \@chapterlistsgap@on{#1}%
1096 \newfloat@@setwithin{#1}{\thesection.}{\theHsection.}%
1097 \else
1098 \newfloat@@setwithin{#1}{\ifnum\c@section>\z@ \thesection.\fi}{\theHsection.}%
1099 \fi
1100 \else
1101 \newfloat@Error{Invalid value `#2' for option `within'}%
1102 \fi
1103 \fi
1104 \fi}
1105 % \end{macrocode}
1106 % Note: Since the \pkg{hyperref} package with version $<$ 6.82k defines
1107 % |\the|\-|H|\-|figure| and |\the|\-|H|\-|table| with |\new|\-|command|,
1108 % |\newfloat@@setwithin| will yield to an error message when using with an
1109 % old version of \pkg{hyperref},
1110 % e.g. ``\texttt{LaTeX Error: Command \cs{theHfigure} already defined}''.
1111 % \begin{macrocode}
1112 \newcommand*\newfloat@@setwithin[3]{%
1113 \global\@namedef{the#1}{#2\arabic{#1}}%
1114 \global\@namedef{theH#1}{#3\arabic{#1}}}
1115 % \end{macrocode}
1116 % \begin{macrocode}
1117 \define@key{@newfloat}{within}{%
1118 \def\newfloat@within@value{#1}}
1119 % \end{macrocode}
1120 % \end{macro}
1121 %
1122 % \begin{macro}{\newfloat@setwithout}
1123 % |\newfloat@setwithout|\marg{environment}
1124 % \begin{macrocode}
1125 \newcommand*\newfloat@setwithout[1]{%
1126 \newfloat@setwithin{#1}{none}}
1127 % \end{macrocode}
1128 % \begin{macrocode}
1129 \define@key{@newfloat}{without}[]{%
1130 \def\newfloat@within@value{none}}
1131 % \end{macrocode}
1132 % \end{macro}
1133 %
1134 % \begin{macro}{\newfloat@setchapterlistsgaps}
1135 % |\newfloat@setchapterlistsgaps|\marg{environment}\marg{on/off}
1136 % \begin{macrocode}
1137 \newcommand*\newfloat@setchapterlistsgaps[2]{%
1138 \edef\@tempa{#2}%
1139 \newfloat@setchapterlistsgaps@{off}{off}{#1}%
1140 \newfloat@setchapterlistsgaps@{false}{off}{#1}%
1141 \newfloat@setchapterlistsgaps@{on}{on}{#1}%
1142 \newfloat@setchapterlistsgaps@{true}{on}{#1}%
1143 \ifx\@tempa\newfloat@setchapterlistsgaps@ \else
1144 \newfloat@Error{Invalid value `#2' for option `chapterlistsgaps'}%
1145 \fi}
1146 % \end{macrocode}
1147 % \begin{macrocode}
1148 \newcommand*\newfloat@setchapterlistsgaps@[3]{%
1149 \def\@tempb{#1}%
1150 \ifx\@tempa\@tempb
1151 \newfloat@chapterlistsgap@{#2}{#3}%
1152 \let\@tempa\newfloat@setchapterlistsgaps@
1153 \fi}
1154 % \end{macrocode}
1155 % \begin{macrocode}
1156 \newcommand*\newfloat@chapterlistsgap@[1]{%
1157 \@ifundefined{@chapterlistsgap@#1}%
1158 {\@gobble}%
1159 {\@nameuse{@chapterlistsgap@#1}}}
1160 % \end{macrocode}
1161 % \begin{macrocode}
1162 \define@key{@newfloat}{chapterlistsgaps}{%
1163 \def\newfloat@chapterlistsgaps@value{#1}}
1164 % \end{macrocode}
1165 % \end{macro}
1166 %
1167 % \begin{macro}{\@removefromreset}
1168 % This code was taken from the \pkg{remreset} package
1169 % which is part of the `carlisle' package bundle.
1170 % (Copyright 1997 David Carlisle)
1171 % \begin{macrocode}
1172 \providecommand*\@removefromreset[2]{{%
1173 \expandafter\let\csname c@#1\endcsname\@removefromreset
1174 \def\@elt##1{%
1175 \expandafter\ifx\csname c@##1\endcsname\@removefromreset
1176 \else
1177 \noexpand\@elt{##1}%
1178 \fi}%
1179 \expandafter\xdef\csname cl@#2\endcsname{%
1180 \csname cl@#2\endcsname}}}
1181 % \end{macrocode}
1182 % \end{macro}
1183 %
1184 % \begin{macro}{\newfloat@announce}
1185 % \changes{v1.1n}{2021/02/27}{Defines \cs{newfloat@env@xxx} now instead of \cs{newfloat@ext@xxx}}
1186 % |\newfloat@announce|\marg{environment name}\marg{list file extension}
1187 % \begin{macrocode}
1188 \newcommand*\newfloat@announce[2]{%
1189 % \end{macrocode}
1190 % \begin{macrocode}
1191 \@cons\newfloat@list{{#1}}%
1192 \@cons\newfloat@@list{{#1}}%
1193 % \end{macrocode}
1194 % \begin{macrocode}
1195 \newfloat@ifundefined{newfloat@env@#2}{%
1196 \@namedef{newfloat@env@#2}{#1}%
1197 % \end{macrocode}
1198 % Support of \pkg{memoir} document class
1199 % \begin{macrocode}
1200 \ifcsname c@lofdepth\endcsname
1201 \newfloat@ifundefined{c@#2depth}{%
1202 \newcounter{#2depth}%
1203 \setcounter{#2depth}{1}}%
1204 \fi
1205 % \end{macrocode}
1206 % Support of \pkg{tocbasic} package
1207 % \begin{macrocode}
1208 \ifcsname addtotoclist\endcsname
1209 \addtotoclist[float]{#2}%
1210 \newfloat@def{listof#2name}{\@nameuse{list#1name}}%
1211 \fi
1212 % \end{macrocode}
1213 % \begin{macrocode}
1214 }%
1215 % \end{macrocode}
1216 % Support of \pkg{titletoc} package
1217 % \begin{macrocode}
1218 \ifcsname contentsuse\endcsname
1219 \contentsuse{#1}{#2}%
1220 \fi
1221 % \end{macrocode}
1222 % \begin{macrocode}
1223 \newfloat@hook{#1}}
1224 \@onlypreamble\newfloat@announce
1225 % \end{macrocode}
1226 % \end{macro}
1227 %
1228 % \begin{macro}{\newfloat@ext}
1229 % \changes{v1.1n}{2021/02/27}{This macro added}
1230 % |\newfloat@ext|\marg{environment}
1231 % expands to the file extension used for the given \meta{environment}.
1232 % \begin{macrocode}
1233 \newcommand*\newfloat@ext[1]{\@nameuse{ext@#1}}
1234 % \end{macrocode}
1235 % \end{macro}
1236 %
1237 % \begin{macro}{\newfloat@@list}
1238 % |\newfloat@@list| is an \cs{@elt}-list containing the floating environments defined
1239 % with |\Declare|\-|Floating|\-|Environment| only.
1240 % \begin{macrocode}
1241 \newcommand*\newfloat@@list{}
1242 % \end{macrocode}
1243 % \end{macro}
1244 %
1245 % \pagebreak[3]
1246 % \subsection{\cs{SetupFloatingEnvironment}}
1247 %
1248 % \begin{macro}{\SetupFloatingEnvironment}
1249 % |\SetupFloatingEnvironment|\marg{environment}\marg{options}
1250 % \begin{macrocode}
1251 \newcommand*\SetupFloatingEnvironment[1]{%
1252 \newfloat@addtolist{#1}%
1253 \newfloat@setoptions{#1}}
1254 % \end{macrocode}
1255 % \end{macro}
1256 %
1257 % \pagebreak[3]
1258 % \subsection{\cs{ForEachFloatingEnvironment}}
1259 %
1260 % \begin{macro}{\ForEachFloatingEnvironment}
1261 % |\ForEachFloatingEnvironment|\marg{code with \#1}\par
1262 % will execute the given code for each (known) floating environment.
1263 % The starred variant will only work for already existing environments,
1264 % i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment|.
1265 % \begin{macrocode}
1266 \newcommand*\ForEachFloatingEnvironment{%
1267 \@ifstar
1268 {\newfloat@foreach\@gobble}%
1269 {\newfloat@foreach\@iden}}
1270 % \end{macrocode}
1271 % \begin{macrocode}
1272 \newcommand\newfloat@foreach[2]{%
1273 \def\@elt##1{#2}%
1274 \newfloat@list
1275 \let\@elt\relax
1276 #1{\newfloat@addtohook{#2}}}
1277 % \end{macrocode}
1278 % \end{macro}
1279 %
1280 % \begin{macro}{\newfloat@addtohook}
1281 % |\newfloat@addtohook|\marg{code with \#1}\par
1282 % adds code to the hook called in |\Declare|\-|Floating|\-|Environment|.\par
1283 % Note: We use |\provide|\-|command| instead of |\new|\-|command| here since the
1284 % exact same code is defined for |\For|\-|Each|\-|Caption|\-|Type| offered by
1285 % the \pkg{caption3} package.
1286 % \begin{macrocode}
1287 \providecommand\newfloat@addtohook[1]{%
1288 \toks@=\expandafter{\newfloat@hook{##1}#1}%
1289 \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%
1290 \@tempa}
1291 % \end{macrocode}
1292 % \end{macro}
1293 %
1294 % \begin{macro}{\newfloat@hook}
1295 % Hook used in |\Declare|\-|Floating|\-|Environment|.
1296 % \begin{macrocode}
1297 \providecommand*\newfloat@hook[1]{}
1298 % \end{macrocode}
1299 % \end{macro}
1300 %
1301 % \pagebreak[3]
1302 % \subsection{\cs{PrepareListOf}}
1303 %
1304 % \begin{macro}{\PrepareListOf}
1305 % \changes{v1.1}{2013/04/27}{This macro added}
1306 % |\PrepareListOf|\marg{float type}\marg{code}\\
1307 % adds \meta{code} to the one which prepares typesetting the list,
1308 % just before |\listoffigures|.
1309 % \begin{macrocode}
1310 \newcommand\PrepareListOf[1]{%
1311 \expandafter\g@addto@macro\csname newfloat@listof#1@hook\endcsname}
1312 \@onlypreamble\PrepareListOf
1313 % \end{macrocode}
1314 % \end{macro}
1315 %
1316 % \pagebreak[3]
1317 % \subsection{The list of floating environments}
1318 %
1319 % \begin{macro}{\newfloat@list}
1320 % |\newfloat@list| is an \cs{@elt}-list containing the already existising floating
1321 % environments as well the ones defined with |\Declare|\-|Floating|\-|Environment|.
1322 % \begin{macrocode}
1323 \newcommand*\newfloat@list{}
1324 % \end{macrocode}
1325 % \end{macro}
1326 %
1327 % \begin{macro}{\newfloat@addtolist}
1328 % \changes{v1.0b}{2012/05/18}{Bugfix: Definition of \cs{@ifchapterlistsgap@}\meta{environment} added}
1329 % \changes{v1.1n}{2021/02/27}{Defines \cs{newfloat@env@xxx} now instead of \cs{newfloat@ext@xxx}}
1330 % |\newfloat@addtolist|\marg{environment}
1331 % adds an environment to the list of floating environments.
1332 % \begin{macrocode}
1333 \newcommand*\newfloat@addtolist[1]{%
1334 \newfloat@ifinlist{#1}{}{%
1335 \ifcsname ext@#1\endcsname
1336 \@cons\newfloat@list{{#1}}%
1337 \@namedef{newfloat@env@\@nameuse{ext@#1}}{#1}%
1338 \newfloat@let{@ifchapterlistsgap@#1}{\@iden}%
1339 \else
1340 \newfloat@Error{`#1' does not seem to be a floating environment}%
1341 \fi}}
1342 % \end{macrocode}
1343 % \end{macro}
1344 %
1345 % \begin{macro}{\newfloat@ifinlist}
1346 % |\newfloat@ifinlist|\marg{environment}\marg{yes code}\marg{no code}
1347 % tests if an environment is an element of the list of floating environments.
1348 % \begin{macrocode}
1349 \newcommand*\newfloat@ifinlist[1]{%
1350 \let\next\@secondoftwo
1351 \begingroup
1352 \expandafter\let\csname c@#1\endcsname\newfloat@ifinlist
1353 \def\@elt##1{%
1354 \expandafter\ifx\csname c@##1\endcsname\newfloat@ifinlist
1355 \global\let\next\@firstoftwo
1356 \fi}%
1357 \newfloat@list
1358 \endgroup
1359 \next}
1360 % \end{macrocode}
1361 % \end{macro}
1362 %
1363 % Add |figure| and |table| to the list of floating environments.
1364 % \begin{macrocode}
1365 \ifcsname ext@figure\endcsname
1366 \newfloat@addtolist{figure}
1367 \fi
1368 \ifcsname ext@table\endcsname
1369 \newfloat@addtolist{table}
1370 \fi
1371 % \end{macrocode}
1372 %
1373 % \pagebreak[3]
1374 % \subsection{Chapter lists gaps}
1375 %
1376 % \begin{macrocode}
1377 \ifcsname @chapter\endcsname
1378 % \end{macrocode}
1379 %
1380 % \begin{macro}{\@chapterlistsgap}
1381 % The amount of the chapter lists gap, the default one is |10pt|.
1382 % (This command is already defined in \KOMAScript.)
1383 % \begin{macrocode}
1384 \providecommand*\@chapterlistsgap{10\p@}%
1385 % \end{macrocode}
1386 % If the \pkg{dgruyter} package is loaded, the default gap is |13pt|.
1387 % \begin{macrocode}
1388 \@ifpackageloaded{dgruyter}{\renewcommand*\@chapterlistsgap{13\p@}}{}%
1389 % \end{macrocode}
1390 % \end{macro}
1391 %
1392 % \begin{macro}{\@addchapterlistsgap}
1393 % |\@addchapterlistsgap|\marg{float type}\marg{file extension}\par
1394 % will add the chapter lists gap for the given float type.
1395 % \begin{macrocode}
1396 \providecommand*\@addchapterlistsgap[2]{%
1397 \@nameuse{@ifchapterlistsgap@#1}{% if switched on
1398 \@@addchapterlistsgap{#1}{#2}}}
1399 % \end{macrocode}
1400 % \begin{macrocode}
1401 \providecommand*\@@addchapterlistsgap[2]{%
1402 \@ifundefined{@addchapterlistsgap@#2}{% only once per extension
1403 \@namedef{@addchapterlistsgap@#2}{#1}%
1404 \@@@addchapterlistsgap{#2}}{}}
1405 % \end{macrocode}
1406 % \begin{macrocode}
1407 \providecommand*\@@@addchapterlistsgap[1]{%
1408 \ifdim \@chapterlistsgap>\z@
1409 \addtocontents{#1}{\protect\addvspace{\@chapterlistsgap}}%
1410 \fi}
1411 % \end{macrocode}
1412 % \end{macro}
1413 %
1414 % \begin{macro}{\@addchapterlistsgaps}
1415 % \changes{v1.0b}{2012/05/18}{Bugfix: Group added to make \cs{@addchapterlistsgap} work correctly}
1416 % \changes{v1.1n}{2021/02/27}{Uses \cs{newfloat@ext} now instead of \cs{ext@xxx}}
1417 % \changes{v1.2}{2023/10/01}{A previous definition of this macro will be overwritten if \cs{newfloat@dont@patch@chapter} is defined}
1418 % |\@addchapterlistsgaps|\par
1419 % will add the chapter lists gaps for all floating environments in |\newfloat@list|.
1420 % \begin{macrocode}
1421 \ifcsname newfloat@dont@patch@chapter\endcsname
1422 \let\@addchapterlistsgaps\@undefined % force a re-definition
1423 \fi
1424 % \end{macrocode}
1425 % \begin{macrocode}
1426 \providecommand*\@addchapterlistsgaps{%
1427 \begingroup
1428 \def\@elt##1{%
1429 \@expandtwoargs\@addchapterlistsgap{##1}{\newfloat@ext{##1}}}%
1430 \newfloat@list
1431 \endgroup}
1432 % \end{macrocode}
1433 % \end{macro}
1434 %
1435 % \begin{macro}{\@chapterlistsgap@off}
1436 % \changes{v1.1n}{2021/02/27}{Uses \cs{newfloat@ext} now instead of \cs{ext@xxx}}
1437 % |\@chapterlistsgap@off|\marg{float type}\par
1438 % switches the chapter lists gap off for the given float type.
1439 % Since \KOMAScript{} (still) supports |\float@exts| we need to handle
1440 % this locally, too, even if |\unsettoc| is offered by the \pkg{tocbasic} package.
1441 % (Otherwise our handling could be moved into the |\else| branch.)
1442 % \begin{macrocode}
1443 \providecommand*\@chapterlistsgap@off[1]{%
1444 \expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@gobble
1445 \ifcsname unsettoc\endcsname
1446 \@expandtwoargs\unsettoc{\newfloat@ext{#1}}{chapteratlist}%
1447 \fi}
1448 % \end{macrocode}
1449 % \end{macro}
1450 %
1451 % \begin{macro}{\@chapterlistsgap@on}
1452 % \changes{v1.1n}{2021/02/27}{Uses \cs{newfloat@ext} now instead of \cs{ext@xxx}}
1453 % |\@chapterlistsgap@off|\marg{float type}\par
1454 % switches the chapter lists gap on for the given float type.
1455 % \begin{macrocode}
1456 \providecommand*\@chapterlistsgap@on[1]{%
1457 \expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@iden
1458 \ifcsname setuptoc\endcsname
1459 \@expandtwoargs\setuptoc{\newfloat@ext{#1}}{chapteratlist}%
1460 \fi}
1461 % \end{macrocode}
1462 % \end{macro}
1463 %
1464 % \begin{macrocode}
1465 \fi
1466 % \end{macrocode}
1467 %
1468 % \pagebreak[3]
1469 % \subsection{Global options}
1470 %
1471 % \begin{macro}{chapterlistsgap=}
1472 % The |chapterlistsgap=| option sets the vertical skip added to each list when
1473 % starting a new chapter.
1474 % \begin{macrocode}
1475 \define@key{newfloat}{chapterlistsgap}{%
1476 \renewcommand*\@chapterlistsgap{#1}}
1477 % \end{macrocode}
1478 % \end{macro}
1479 %
1480 % \begin{macro}{within=}
1481 % The |within=| option redefines the default value and modifies all
1482 % existing floating environments.
1483 % \begin{macrocode}
1484 \define@key{newfloat}{within}{%
1485 \def\newfloat@within@default{#1}% set new default value
1486 \def\@elt##1{\newfloat@setwithin{##1}{#1}}%
1487 \newfloat@list
1488 \let\@elt\relax}
1489 % \end{macrocode}
1490 % \begin{macrocode}
1491 \define@key{newfloat}{without}[]{%
1492 \KV@newfloat@within{none}}
1493 % \end{macrocode}
1494 % \end{macro}
1495 %
1496 % \begin{macro}{figurename=}
1497 % \begin{macro}{listfigurename=}
1498 % \begin{macro}{figurewithin=}
1499 % We define these options not only for |figure| but for all existing floating environments.
1500 % \begin{macrocode}
1501 \def\@elt#1{%
1502 \define@key{newfloat}{#1name}{%
1503 \newfloat@setname{#1}{##1}}%
1504 \define@key{newfloat}{list#1name}{%
1505 \newfloat@setname{list#1}{##1}}%
1506 \define@key{newfloat}{#1within}{%
1507 \newfloat@setwithin{#1}{##1}}%
1508 \define@key{newfloat}{#1without}[]{%
1509 \newfloat@setwithout{#1}}%
1510 }%
1511 \newfloat@list
1512 \let\@elt\relax
1513 % \end{macrocode}
1514 % \end{macro}
1515 % \end{macro}
1516 % \end{macro}
1517 %
1518 % \begin{macro}{planb=}
1519 % \changes{v1.0b}{2012/05/18}{This option added}
1520 % This option switches the `Plan B' on or off. (default$=$true)
1521 % \begin{macrocode}
1522 \define@key{newfloat}{planb}[true]{%
1523 \def\@tempa{#1}%
1524 \def\@tempb{false}%
1525 \ifx\@tempa\@tempb
1526 \let\newfloat@ifplanb\@gobble
1527 \else
1528 \def\@tempb{true}%
1529 \ifx\@tempa\@tempb
1530 \let\newfloat@ifplanb\@iden
1531 \else
1532 \newfloat@Error{Invalid value `#1' for option `planb'}%
1533 \fi
1534 \fi}
1535 % \end{macrocode}
1536 % \end{macro}
1537 % \begin{macro}{planb-filext=}
1538 % \changes{v1.0b}{2012/05/19}{This option added}
1539 % This option sets the file extension used for `Plan B'.
1540 % (default$=$use the 1st one which seem to fit)
1541 % \begin{macrocode}
1542 \define@key{newfloat}{planb-fileext}{%
1543 \newfloat@Info{Setting Plan B file extension to `#1'}
1544 \xdef\newfloat@addtocontents@ext{#1}}
1545 % \end{macrocode}
1546 % \end{macro}
1547 %
1548 % Process the package options:
1549 % We use |\set|\-|keys| here instead of |\Process|\-|Options|.
1550 % \begin{macrocode}
1551 \let\@tempc\relax
1552 \@expandtwoargs\setkeys{newfloat}{planb,\@ptionlist{\@currname.\@currext}}%
1553 \AtEndOfPackage{\let\@unprocessedoptions\relax}
1554 % \end{macrocode}
1555 %
1556 % \begin{macro}{\newfloatsetup}
1557 % |\newfloatsetup|\marg{options}
1558 % sets global options after loading the package.
1559 % \begin{macrocode}
1560 \newcommand*\newfloatsetup{\setkeys{newfloat}}
1561 % \end{macrocode}
1562 % \end{macro}
1563 %
1564 % \pagebreak[3]
1565 % \subsection{Patching \cs{chapter}}
1566 %
1567 % Since the \LaTeX\ team has refused to replace the hard coded |10pt| skip inside |\chapter|
1568 % (for lists of floating environments like |figure| or |table|)
1569 % with a proper interface~\footnote{I have asked David Carlisle in 2018, Frank Mittelbach in 2020, and Frank again at a later date.},
1570 % we need to patch |\chapter|. (Sigh!)
1571 %
1572 % And since most document class authors takes \cls{article}, \cls{report}, or \cls{book} as template for own classes,
1573 % they inherit the same problem: Hard coded skips we need to replace with an interface for ourself. (Sigh!)
1574 %
1575 % \begin{macro}{\newfloat@replace@chapter}
1576 % \changes{v1.1f}{2019/08/25}{Parameter \meta{class name} added to macro}
1577 % \changes{v1.1i}{2019/08/31}{Local definition of \cs{if@chapnum} added}
1578 % \changes{v1.1o}{2021/02/27}{Support of the \pkg{algorithm2e} package added}
1579 % |\newfloat@replace@chapter|\marg{class name}\marg{original code}\marg{replacement code}\par
1580 % tries to patch |\@chapter| so |\@add|\-|chapter|\-|lists|\-|gaps| will be supported.
1581 % It checks for |\Hy@org@chapter|, too, since the original code will be stored here
1582 % if the \pkg{hyperref} package was loaded.
1583 % \begin{macrocode}
1584 \newcommand\newfloat@replace@chapter[3]{%
1585 \begingroup
1586 \let\if@twocolumn\iffalse
1587 \let\if@mainmatter\iffalse
1588 \let\if@thema\iffalse
1589 \let\if@chapnum\iffalse
1590 \def\@tempa[##1]##2{#2}%
1591 \newfloat@replace@chapter@\@chapter{original}{#1}{#3}%
1592 \newfloat@replace@chapter@\Hy@org@chapter{hyperref}{#1}{#3}%
1593 \newfloat@replace@chapter@\algocf@original@chapter{algorithm2e}{#1}{#3}%
1594 \endgroup}
1595 % \end{macrocode}
1596 % \begin{macrocode}
1597 \newcommand\newfloat@replace@chapter@[4]{%
1598 \ifx\@tempa#1%
1599 \newfloat@InfoNoLine{Document class `#3' detected (#2)}%
1600 \global\def#1[##1]##2{#4}%
1601 \global\let\newfloat@replace@chapter\newfloat@dont@replace@chapter
1602 \global\let\newfloat@replace@chapter@\@gobblefour
1603 \fi}
1604 % \end{macrocode}
1605 % \begin{macrocode}
1606 \newcommand\newfloat@dont@replace@chapter[3]{}
1607 % \end{macrocode}
1608 % \begin{macrocode}
1609 \ifcsname @chapter\endcsname \else
1610 \let\newfloat@replace@chapter\newfloat@dont@replace@chapter
1611 \fi
1612 % \end{macrocode}
1613 % \end{macro}
1614 %
1615 % \begin{macro}{\newfloat@dont@patch@chapter}
1616 % \changes{v1.2}{2023/10/01}{Detection of this macro added}
1617 % If |\newfloat@dont@patch@chapter| is defined, we don't try to patch |\chapter|
1618 % but assume that the document class is already using |\@add|\-|chapter|\-|lists|\-|gaps|
1619 % inside its definition of |\chapter|.
1620 % \begin{macrocode}
1621 \ifcsname newfloat@dont@patch@chapter\endcsname
1622 \newfloat@InfoNoLine{\noexpand\newfloat@dont@patch@chapter is set}
1623 \let\newfloat@replace@chapter\newfloat@dont@replace@chapter
1624 \fi
1625 % \end{macrocode}
1626 % \end{macro}
1627 %
1628 % \pagebreak[3]
1629 % \subsubsection{Standard \LaTeX{} document classes}
1630 %
1631 % \begin{macrocode}
1632 % report.cls [2005/09/16 v1.4f Standard LaTeX document class]
1633 \newfloat@replace@chapter{report}{%
1634 \ifnum \c@secnumdepth >\m@ne
1635 \refstepcounter{chapter}%
1636 \typeout{\@chapapp\space\thechapter.}%
1637 \addcontentsline{toc}{chapter}%
1638 {\protect\numberline{\thechapter}#1}%
1639 \else
1640 \addcontentsline{toc}{chapter}{#1}%
1641 \fi
1642 \chaptermark{#1}%
1643 \addtocontents{lof}{\protect\addvspace{10\p@}}%
1644 \addtocontents{lot}{\protect\addvspace{10\p@}}%
1645 \if@twocolumn
1646 \@topnewpage[\@makechapterhead{#2}]%
1647 \else
1648 \@makechapterhead{#2}%
1649 \@afterheading
1650 \fi
1651 }{%
1652 \ifnum \c@secnumdepth >\m@ne
1653 \refstepcounter{chapter}%
1654 \typeout{\@chapapp\space\thechapter.}%
1655 \addcontentsline{toc}{chapter}%
1656 {\protect\numberline{\thechapter}#1}%
1657 \else
1658 \addcontentsline{toc}{chapter}{#1}%
1659 \fi
1660 \chaptermark{#1}%
1661 \@addchapterlistsgaps
1662 \if@twocolumn
1663 \@topnewpage[\@makechapterhead{#2}]%
1664 \else
1665 \@makechapterhead{#2}%
1666 \@afterheading
1667 \fi}
1668 % \end{macrocode}
1669 %
1670 % \begin{macrocode}
1671 % book.cls [2005/09/16 v1.4f Standard LaTeX document class]
1672 \newfloat@replace@chapter{book}{%
1673 \ifnum \c@secnumdepth >\m@ne
1674 \if@mainmatter
1675 \refstepcounter{chapter}%
1676 \typeout{\@chapapp\space\thechapter.}%
1677 \addcontentsline{toc}{chapter}%
1678 {\protect\numberline{\thechapter}#1}%
1679 \else
1680 \addcontentsline{toc}{chapter}{#1}%
1681 \fi
1682 \else
1683 \addcontentsline{toc}{chapter}{#1}%
1684 \fi
1685 \chaptermark{#1}%
1686 \addtocontents{lof}{\protect\addvspace{10\p@}}%
1687 \addtocontents{lot}{\protect\addvspace{10\p@}}%
1688 \if@twocolumn
1689 \@topnewpage[\@makechapterhead{#2}]%
1690 \else
1691 \@makechapterhead{#2}%
1692 \@afterheading
1693 \fi
1694 }{%
1695 \ifnum \c@secnumdepth >\m@ne
1696 \if@mainmatter
1697 \refstepcounter{chapter}%
1698 \typeout{\@chapapp\space\thechapter.}%
1699 \addcontentsline{toc}{chapter}%
1700 {\protect\numberline{\thechapter}#1}%
1701 \else
1702 \addcontentsline{toc}{chapter}{#1}%
1703 \fi
1704 \else
1705 \addcontentsline{toc}{chapter}{#1}%
1706 \fi
1707 \chaptermark{#1}%
1708 \@addchapterlistsgaps
1709 \if@twocolumn
1710 \@topnewpage[\@makechapterhead{#2}]%
1711 \else
1712 \@makechapterhead{#2}%
1713 \@afterheading
1714 \fi}
1715 % \end{macrocode}
1716 %
1717 % \pagebreak[3]
1718 % \subsubsection{\AmS{} \& \SmF{} document classes}
1719 %
1720 % \begin{macrocode}
1721 % amsbook.cls [2004/08/06 v2.20]
1722 % smfbook.cls [1999/11/15 v1.2f Classe LaTeX pour les monographies editees par la SMF]
1723 \newfloat@replace@chapter{amsbook}{%
1724 \refstepcounter{chapter}%
1725 \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
1726 \else \let\@secnumber\thechapter \fi
1727 \typeout{\chaptername\space\@secnumber}%
1728 \def\@toclevel{0}%
1729 \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{#2}%
1730 \else \@tocwriteb\tocchapter{chapter}{#2}\fi
1731 \chaptermark{#1}%
1732 \addtocontents{lof}{\protect\addvspace{10\p@}}%
1733 \addtocontents{lot}{\protect\addvspace{10\p@}}%
1734 \@makechapterhead{#2}\@afterheading
1735 }{%
1736 \refstepcounter{chapter}%
1737 \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
1738 \else \let\@secnumber\thechapter \fi
1739 \typeout{\chaptername\space\@secnumber}%
1740 \def\@toclevel{0}%
1741 \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{#2}%
1742 \else \@tocwriteb\tocchapter{chapter}{#2}\fi
1743 \chaptermark{#1}%
1744 \@addchapterlistsgaps
1745 \@makechapterhead{#2}\@afterheading}
1746 % \end{macrocode}
1747 %
1748 % \pagebreak[3]
1749 % \subsubsection{\KOMAScript{} document classes}
1750 %
1751 % If a \KOMAScript{} document class or the \pkg{tocbasic} package is used
1752 % we don't need to patch anything.
1753 % Instead we use |\setup|\-|toc| and |\un|\-|set|\-|toc| to setup the
1754 % chapters gap in |\@chapter|\-|lists|\-|gap@on| and |\@chapter|\-|lists|\-|gap@off|.
1755 % \begin{macrocode}
1756 \@ifpackageloaded{tocbasic}{%
1757 \let\newfloat@replace@chapter\newfloat@dont@replace@chapter}{}
1758 % \end{macrocode}
1759 %
1760 % \pagebreak[3]
1761 % \subsubsection{memoir document classes}
1762 %
1763 % If the \pkg{memoir} document class is used,
1764 % replacing |\insert|\-|chapter|\-|space| by |\@add|\-|chapter|\-|lists|\-|gaps| is sufficient.
1765 % \begin{macrocode}
1766 \ifcsname insertchapterspace\endcsname
1767 \renewcommand*\insertchapterspace{\@addchapterlistsgaps}
1768 \let\newfloat@replace@chapter\newfloat@dont@replace@chapter
1769 \fi
1770 % \end{macrocode}
1771 %
1772 % \pagebreak[3]
1773 % \subsubsection{NTG document classes}
1774 %
1775 % \begin{macrocode}
1776 % rapport1/3.cls [2004/06/07 v2.1a NTG LaTeX document class]
1777 \newfloat@replace@chapter{rapport}{%
1778 \ifnum \c@secnumdepth >\m@ne
1779 \refstepcounter{chapter}%
1780 \typeout{\@chapapp\space\thechapter.}%
1781 \addcontentsline{toc}{chapter}%
1782 {\protect\numberline{\thechapter}\toc@font0 #1}%
1783 \else
1784 \addcontentsline{toc}{chapter}{\toc@font0 #1}%
1785 \fi
1786 \chaptermark{#1}%
1787 \addtocontents{lof}{\protect\addvspace{10\p@}}%
1788 \addtocontents{lot}{\protect\addvspace{10\p@}}%
1789 \if@twocolumn
1790 \@topnewpage[\@makechapterhead{#2}]%
1791 \else
1792 \@makechapterhead{#2}%
1793 \@afterheading
1794 \fi
1795 }{%
1796 \ifnum \c@secnumdepth >\m@ne
1797 \refstepcounter{chapter}%
1798 \typeout{\@chapapp\space\thechapter.}%
1799 \addcontentsline{toc}{chapter}%
1800 {\protect\numberline{\thechapter}\toc@font0 #1}%
1801 \else
1802 \addcontentsline{toc}{chapter}{\toc@font0 #1}%
1803 \fi
1804 \chaptermark{#1}%
1805 \@addchapterlistsgaps
1806 \if@twocolumn
1807 \@topnewpage[\@makechapterhead{#2}]%
1808 \else
1809 \@makechapterhead{#2}%
1810 \@afterheading
1811 \fi}
1812 % \end{macrocode}
1813 % \begin{macrocode}
1814 % boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class]
1815 \newfloat@replace@chapter{boek}{%
1816 \ifnum \c@secnumdepth >\m@ne
1817 \if@mainmatter
1818 \refstepcounter{chapter}%
1819 \typeout{\@chapapp\space\thechapter.}%
1820 \addcontentsline{toc}{chapter}%
1821 {\protect\numberline{\thechapter}\toc@font0 #1}%
1822 \else
1823 \addcontentsline{toc}{chapter}{\toc@font0 #1}%
1824 \fi
1825 \else
1826 \addcontentsline{toc}{chapter}{\toc@font0 #1}%
1827 \fi
1828 \chaptermark{#1}%
1829 \addtocontents{lof}{\protect\addvspace{10\p@}}%
1830 \addtocontents{lot}{\protect\addvspace{10\p@}}%
1831 \if@twocolumn
1832 \@topnewpage[\@makechapterhead{#2}]%
1833 \else
1834 \@makechapterhead{#2}%
1835 \@afterheading
1836 \fi
1837 }{%
1838 \ifnum \c@secnumdepth >\m@ne
1839 \if@mainmatter
1840 \refstepcounter{chapter}%
1841 \typeout{\@chapapp\space\thechapter.}%
1842 \addcontentsline{toc}{chapter}%
1843 {\protect\numberline{\thechapter}\toc@font0 #1}%
1844 \else
1845 \addcontentsline{toc}{chapter}{\toc@font0 #1}%
1846 \fi
1847 \else
1848 \addcontentsline{toc}{chapter}{\toc@font0 #1}%
1849 \fi
1850 \chaptermark{#1}%
1851 \@addchapterlistsgaps
1852 \if@twocolumn
1853 \@topnewpage[\@makechapterhead{#2}]%
1854 \else
1855 \@makechapterhead{#2}%
1856 \@afterheading
1857 \fi}
1858 % \end{macrocode}
1859 %
1860 % \pagebreak[3]
1861 % \subsubsection{The thesis document class}
1862 %
1863 % \begin{macrocode}
1864 % thesis.cls [1996/25/01 1.0g LaTeX document class (wm).]
1865 \newfloat@replace@chapter{thesis}{%
1866 \ifnum \c@secnumdepth >\m@ne
1867 \if@mainmatter
1868 \refstepcounter{chapter}%
1869 \typeout{\chaptername\space\thechapter.}
1870 \if@thema
1871 \ifx\@shortauthor\@empty
1872 \addcontentsline{toc}{chapter}{%
1873 \protect\numberline{\thechapter.}#1}%
1874 \else
1875 \addcontentsline{toc}{chapter}{%
1876 \protect\numberline{\thechapter.}%
1877 \@shortauthor\hfill\mbox{}\vskip\normallineskip #1}%
1878 \fi
1879 \else
1880 \addcontentsline{toc}{chapter}{%
1881 \protect\numberline{\thechapter.}#1}%
1882 \fi
1883 \else
1884 \addcontentsline{toc}{chapter}{#1}
1885 \fi
1886 \else
1887 \addcontentsline{toc}{chapter}{#1}
1888 \fi
1889 \chaptermark{#1}
1890 \addtocontents{lof}{\protect\addvspace{10pt}}
1891 \addtocontents{lot}{\protect\addvspace{10pt}}
1892 \if@twocolumn
1893 \@topnewpage[\@makechapterhead{#2}]
1894 \else
1895 \@makechapterhead{#2}
1896 \@afterheading
1897 \fi
1898 }{%
1899 \ifnum \c@secnumdepth >\m@ne
1900 \if@mainmatter
1901 \refstepcounter{chapter}%
1902 \typeout{\chaptername\space\thechapter.}%
1903 \if@thema
1904 \ifx\@shortauthor\@empty
1905 \addcontentsline{toc}{chapter}{%
1906 \protect\numberline{\thechapter.}#1}%
1907 \else
1908 \addcontentsline{toc}{chapter}{%
1909 \protect\numberline{\thechapter.}%
1910 \@shortauthor\hfill\mbox{}\vskip\normallineskip #1}%
1911 \fi
1912 \else
1913 \addcontentsline{toc}{chapter}{%
1914 \protect\numberline{\thechapter.}#1}%
1915 \fi
1916 \else
1917 \addcontentsline{toc}{chapter}{#1}%
1918 \fi
1919 \else
1920 \addcontentsline{toc}{chapter}{#1}%
1921 \fi
1922 \chaptermark{#1}%
1923 \@addchapterlistsgaps
1924 \if@twocolumn
1925 \@topnewpage[\@makechapterhead{#2}]%
1926 \else
1927 \@makechapterhead{#2}%
1928 \@afterheading
1929 \fi}
1930 % \end{macrocode}
1931 %
1932 % \pagebreak[3]
1933 % \subsubsection{The Springer Verlag document classes}
1934 % \changes{v1.1f}{2019/08/25}{Support of \pkg{svmono} and \pkg{svmult} document classes added}
1935 %
1936 % \begin{macrocode}
1937 % svmono.cls [2018/06/25 v5.6 Springer Verlag global LaTeX document class for monographs]
1938 % svmult.cls [2018/01/11 v5.5 Springer Verlag global LaTeX document class for multi authored books]
1939 \newfloat@replace@chapter{svmono}{%
1940 \if@chapnum % war mal \ifnum \c@secnumdepth >\m@ne
1941 \refstepcounter{chapter}%
1942 \if@mainmatter
1943 \typeout{\@chapapp\space\thechapter.}%
1944 \addcontentsline{toc}{chapter}{\protect
1945 \numberline{\thechapter\thechapterend}#1}%
1946 \else
1947 \addcontentsline{toc}{chapter}{#1}%
1948 \fi
1949 \else
1950 \addcontentsline{toc}{chapter}{#1}%
1951 \fi
1952 \chaptermark{#1}%
1953 \addtocontents{lof}{\protect\addvspace{10\p@}}%
1954 \addtocontents{lot}{\protect\addvspace{10\p@}}%
1955 \if@twocolumn
1956 \@topnewpage[\@makechapterhead{#2}]%
1957 \else
1958 \@makechapterhead{#2}%
1959 \@afterheading
1960 \fi
1961 }{%
1962 \if@chapnum % war mal \ifnum \c@secnumdepth >\m@ne
1963 \refstepcounter{chapter}%
1964 \if@mainmatter
1965 \typeout{\@chapapp\space\thechapter.}%
1966 \addcontentsline{toc}{chapter}{\protect
1967 \numberline{\thechapter\thechapterend}#1}%
1968 \else
1969 \addcontentsline{toc}{chapter}{#1}%
1970 \fi
1971 \else
1972 \addcontentsline{toc}{chapter}{#1}%
1973 \fi
1974 \chaptermark{#1}%
1975 \@addchapterlistsgaps
1976 \if@twocolumn
1977 \@topnewpage[\@makechapterhead{#2}]%
1978 \else
1979 \@makechapterhead{#2}%
1980 \@afterheading
1981 \fi}
1982 % \end{macrocode}
1983 %
1984 % \pagebreak[3]
1985 % \subsubsection{The dgruyter package}
1986 % \changes{v1.1j}{2019/08/31}{Extended support of \pkg{dgruyter} package added}
1987 %
1988 % \begin{macrocode}
1989 % dgruyter.sty [2017/09/19 v2.00 De Gruyter layout]
1990 \newfloat@replace@chapter{dgruyter}{%
1991 \let\thesection\theinchapsection
1992 \let\theequation\theinchapequation
1993 \let\thefigure\theinchapfigure
1994 \let\thetable\theinchaptable
1995 \ifx\bookDOI\@undefined
1996 \else
1997 \@tempcnta\numexpr\componentd@i+\@ne\relax
1998 \xdef\componentd@i{\the\@tempcnta}%
1999 \xdef\@DOI{%
2000 https://doi.org/\bookDOI
2001 -\ifx\thepage\thefrontmatterpage2\else\ifnum\@tempcnta<100 0\fi\fi
2002 \ifnum\@tempcnta<10 0\fi\componentd@i}%
2003 \fi
2004 \ifnum \c@secnumdepth >\m@ne
2005 \if@mainmatter
2006 \refstepcounter{chapter}%
2007 \typeout{\@chapapp\space\thechapter.}%
2008 \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}%
2009 \else
2010 \addcontentsline{toc}{schapter}{#1}%
2011 \fi
2012 \else
2013 \addcontentsline{toc}{schapter}{#1}%
2014 \fi
2015 \chaptermark{#1}%
2016 \addtocontents{lof}{\protect\addvspace{13\p@}}%
2017 \addtocontents{lot}{\protect\addvspace{13\p@}}%
2018 \if@twocolumn
2019 \@topnewpage[\@makechapterhead{#2}]%
2020 \else
2021 \@makechapterhead{#2}%
2022 \@afterheading
2023 \fi
2024 }{%
2025 \let\thesection\theinchapsection
2026 \let\theequation\theinchapequation
2027 \let\thefigure\theinchapfigure
2028 \let\thetable\theinchaptable
2029 \ifx\bookDOI\@undefined
2030 \else
2031 \@tempcnta\numexpr\componentd@i+\@ne\relax
2032 \xdef\componentd@i{\the\@tempcnta}%
2033 \xdef\@DOI{%
2034 https://doi.org/\bookDOI
2035 -\ifx\thepage\thefrontmatterpage2\else\ifnum\@tempcnta<100 0\fi\fi
2036 \ifnum\@tempcnta<10 0\fi\componentd@i}%
2037 \fi
2038 \ifnum \c@secnumdepth >\m@ne
2039 \if@mainmatter
2040 \refstepcounter{chapter}%
2041 \typeout{\@chapapp\space\thechapter.}%
2042 \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}%
2043 \else
2044 \addcontentsline{toc}{schapter}{#1}%
2045 \fi
2046 \else
2047 \addcontentsline{toc}{schapter}{#1}%
2048 \fi
2049 \chaptermark{#1}%
2050 \@addchapterlistsgaps
2051 \if@twocolumn
2052 \@topnewpage[\@makechapterhead{#2}]%
2053 \else
2054 \@makechapterhead{#2}%
2055 \@afterheading
2056 \fi}
2057 % \end{macrocode}
2058 %
2059 % \pagebreak[3]
2060 % \subsubsection{Compatibility warning}
2061 %
2062 % \begin{macrocode}
2063 \ifx\newfloat@replace@chapter\newfloat@dont@replace@chapter \else
2064 % \end{macrocode}
2065 % If we were not able to patch |\@chapter| an info message is issued
2066 % since we may not be able to support chapter lists gaps then.
2067 % \begin{macrocode}
2068 \newfloat@InfoNoLine{%
2069 Unsupported document class, or \noexpand\@chapter\MessageBreak
2070 was already redefined by another package}
2071 \newfloat@InfoNoLine{\string\@chapter\space=\space\meaning\@chapter}
2072 \newfloat@InfoNoLine{\string\Hy@org@chapter\space=\space\meaning\Hy@org@chapter}
2073 \newfloat@InfoNoLine{\string\algocf@original@chapter\space=\space\meaning\algocf@original@chapter}
2074 % \end{macrocode}
2075 % Plan B: We patch |\add|\-|to|\-|contents| instead, and keep our fingers crossed
2076 % in the hope that this redefinition actually will fit.
2077 % (Note: Since \pkg{biblatex} patches |\add|\-|to|\-|contents| as well we do
2078 % this using |\At||Begin||Document|.)
2079 % \changes{v1.1f}{2019/08/25}{Plan B will now be done using \cs{AtBeginDocument}}
2080 % \begin{macrocode}
2081 \newfloat@ifplanb{\AtBeginDocument{%
2082 \newfloat@InfoNoLine{Trying Plan B..}%
2083 \let\newfloat@addtocontents@ORI\addtocontents
2084 \long\def\addtocontents#1#2{%
2085 \newfloat@addtocontents{#1}{#2}#2\addvspace\newfloat@nil}%
2086 \long\def\newfloat@addtocontents#1#2#3\addvspace#4\newfloat@nil{%
2087 \def\newfloat@tempa{#4}%
2088 \ifx\newfloat@tempa\@empty
2089 \newfloat@addtocontents@ORI{#1}{#2}%
2090 \else
2091 \ifx\newfloat@addtocontents@ext\@undefined
2092 \newfloat@Info{Setting Plan B file extension to `#1'...}%
2093 \xdef\newfloat@addtocontents@ext{#1}%
2094 \fi
2095 \edef\newfloat@tempa{#1}%
2096 \ifx\newfloat@tempa\newfloat@addtocontents@ext
2097 \begingroup
2098 \let\addtocontents\newfloat@addtocontents@ORI
2099 \@addchapterlistsgaps
2100 \endgroup
2101 \fi
2102 \fi}}}
2103 % \end{macrocode}
2104 % \begin{macrocode}
2105 \fi
2106 % \end{macrocode}
2107 %
2108 % \pagebreak[3]
2109 % \subsection{Support of document classes}
2110 %
2111 % \subsubsection{The beamer document class}
2112 %
2113 % \begin{macro}{\beamer@float}
2114 % \changes{v1.1k}{2019/09/01}{This macro added}
2115 % Unfortunately the \cls{beamer} document class does not offer
2116 % |\beamer@float| and |\end@beamer@float| (yet), so we have to define them
2117 % for ourself.
2118 % (This code was taken from beamerbaselocalstructure.sty [2019/07/23 v3.56] and adapted.)
2119 % \begin{macrocode}
2120 \ifcsname beamer@float\endcsname \else
2121 % \end{macrocode}
2122 % \begin{macrocode}
2123 \def\beamer@float#1{%
2124 \ifcsname caption@settype\endcsname
2125 \caption@settype{#1}%
2126 \else
2127 \def\@captype{#1}%
2128 \fi
2129 \par\nobreak\begin{center}\nobreak}
2130 % \end{macrocode}
2131 % \begin{macrocode}
2132 \def\end@beamer@float{%
2133 \par\nobreak\end{center}}
2134 % \end{macrocode}
2135 % \begin{macrocode}
2136 \fi
2137 % \end{macrocode}
2138 % \end{macro}
2139 %
2140 % \pagebreak[3]
2141 % \subsection{Support of other packages}
2142 %
2143 % \begin{macro}{\newfloat@IfPackageLoaded}
2144 % \changes{v1.1e}{2019/03/17}{This macro revised}
2145 % \changes{v1.1h}{2019/08/31}{This macro revised again and renamed from \cs{newfloat@ForEachNew} to \cs{newfloat@IfPackageLoaded}}
2146 % |\newfloat@IfPackageLoaded|\marg{package name}\marg{command}\marg{code}
2147 % will execute the given code for every floating environment defined with
2148 % |\Declare|\-|Floating|\-|Environment| if \meta{command} is not defined yet.
2149 % (If \meta{command} is already defined a warning will be issued.)
2150 % This will be tried |\At|\-|Begin|\-|Document| additionally so the affected package could
2151 % be loaded after \thispackage.
2152 % \begin{macrocode}
2153 \newcommand\newfloat@IfPackageLoaded[3]{%
2154 \@ifpackageloaded{#1}{%
2155 \newfloat@@IfPackageLoaded{#1}{#2}{#3}%
2156 }{%
2157 \AtBeginDocument{%
2158 \@ifpackageloaded{#1}{%
2159 \newfloat@@IfPackageLoaded{#1}{#2}{#3}%
2160 }{}}%
2161 }}
2162 \@onlypreamble\newfloat@IfPackageLoaded
2163 % \end{macrocode}
2164 % \begin{macrocode}
2165 \newcommand\newfloat@@IfPackageLoaded[3]{%
2166 \newfloat@InfoNoLine{`#1' package detected}%
2167 % Execute code for every previous \DeclareFloatingEnvironment
2168 \def\@elt##1{\newfloat@@@IfPackageLoaded{#1}{#2}{#3}}%
2169 \newfloat@@list
2170 \let\@elt\relax
2171 % Execute code for every future \DeclareFloatingEnvironment
2172 \newfloat@addtohook{\newfloat@@@IfPackageLoaded{#1}{#2}{#3}}}
2173 \@onlypreamble\newfloat@@IfPackageLoaded
2174 % \end{macrocode}
2175 % \begin{macrocode}
2176 \newcommand\newfloat@@@IfPackageLoaded[3]{%
2177 \ifcsname#2\endcsname
2178 \newfloat@WarningNoLine{%
2179 Command \@backslashchar#2 already defined.\MessageBreak
2180 (`#1' package support)}%
2181 \else
2182 #3%
2183 \fi}
2184 \@onlypreamble\newfloat@@@IfPackageLoaded
2185 % \end{macrocode}
2186 % \end{macro}
2187 %
2188 % \pagebreak[3]
2189 % \subsubsection{\pkg{dgruyter}}
2190 %
2191 % The De Gruyter layout package (for preparing books for Walter de Gruyter GmbH)
2192 % is defining |\plist@figure| and |\plist@table|, and expects this to be
2193 % defined for other floating environments as well.
2194 % (This will be used as prefix for the ``List of''.)
2195 % \begin{macrocode}
2196 \newfloat@IfPackageLoaded{dgruyter}{plist@#1}{%
2197 \expandafter\newcommand\csname plist@#1\endcsname{%
2198 \@nameuse{#1name}\space}}
2199 % \end{macrocode}
2200 %
2201 % \pagebreak[3]
2202 % \subsubsection{\pkg{float}}
2203 %
2204 % If the \pkg{float} package is used we fill up |\float@exts| with our file
2205 % extensions, too. Since this list will be used for inserting chapters gaps
2206 % we only add the ones which are configured for chapters gaps on.\par
2207 % Note: This has to be done |\At|\-|Begin|\-|Document| so the settings for
2208 % chapter gaps could be changed by the user within the preamble of the document.
2209 % \begin{macrocode}
2210 \AtBeginDocument{%
2211 \ifcsname float@exts\endcsname
2212 \newfloat@@IfPackageLoaded{float}{newfloat@undefined}{%
2213 \@nameuse{@ifchapterlistsgap@#1}{% if switched on
2214 \let\float@do=\relax
2215 \edef\@tempa{%
2216 \noexpand\float@exts{\the\float@exts\float@do{\@nameuse{ext@#1}}}}%
2217 \@tempa}}%
2218 \fi}
2219 % \end{macrocode}
2220 %
2221 % \pagebreak[3]
2222 % \subsubsection{\pkg{fltpage}}
2223 %
2224 % We define a FP-variant of new floating environments here.
2225 % \begin{macrocode}
2226 \newfloat@IfPackageLoaded{fltpage}{FP#1}{%
2227 \newcounter{FP@#1C}%
2228 \newenvironment{FP#1}{\FP@floatBegin{#1}}{\FP@floatEnd}}
2229 % \end{macrocode}
2230 %
2231 % \pagebreak[3]
2232 % \subsubsection{\pkg{listings}}
2233 %
2234 % \begin{macro}{\ext@lstlisting}
2235 % Since the \pkg{listings} package do not define |\ext@lst|\-|listing|
2236 % but we needed it when |Setup|\-|Floating|\-|Environment{lst|\-|listing}{|\ldots|}|
2237 % will be done by the end user, we define it here.
2238 % \begin{macrocode}
2239 \providecommand*\ext@lstlisting{lol}%
2240 % \end{macrocode}
2241 % \end{macro}
2242 %
2243 % \pagebreak[3]
2244 % \subsubsection{\pkg{rotating}}
2245 %
2246 % We define a sideways-variant of new floating environments here.
2247 % \begin{macrocode}
2248 \newfloat@IfPackageLoaded{rotating}{sideways#1}{%
2249 \newenvironment{sideways#1}{\@rotfloat{#1}}{\end@rotfloat}%
2250 \newenvironment{sideways#1*}{\@rotdblfloat{#1}}{\end@rotdblfloat}}
2251 % \end{macrocode}
2252 %
2253 % \pagebreak[3]
2254 % \subsubsection{\pkg{sidecap}}
2255 %
2256 % We define a SC-variant of new floating environments here.
2257 % \begin{macro}{\SC@float}
2258 % \changes{v1.1b}{2018/12/26}{Bugfix: Missing curly braces added}
2259 % \begin{macrocode}
2260 \newcommand*\newfloat@For@SC[2]{%
2261 \def#1{b}% = \sidecaptionvpos{#2}{b} (v1.6)
2262 \newenvironment{SC#2}%
2263 {\SC@float[{#1}]{#2}}{\endSC@float}%
2264 \newenvironment{SC#2*}%
2265 {\SC@dblfloat[{#1}]{#2}}{\endSC@dblfloat}}
2266 \@onlypreamble\newfloat@For@SC
2267 % \end{macrocode}
2268 % \begin{macrocode}
2269 \newfloat@IfPackageLoaded{sidecap}{SC#1}{%
2270 \expandafter\newfloat@For@SC\csname SC@#1@vpos\endcsname{#1}}
2271 % \end{macrocode}
2272 % \end{macro}
2273 %
2274 % \pagebreak[3]
2275 % \subsubsection{\pkg{wrapfig}}
2276 %
2277 % We define a wrap-variant of new floating environments here.
2278 % \begin{macrocode}
2279 \newfloat@IfPackageLoaded{wrapfig}{wrap#1}{%
2280 \newenvironment{wrap#1}{\wrapfloat{#1}}{\endwrapfloat}}
2281 % \end{macrocode}
2282 %
2283 % \iffalse
2284 %</package>
2285 % \fi
2286 %
2287 % \iffalse
2288 % --------------------------------------------------------------------------- %
2289 % \fi
2290 %
2291 % \Finale
2292 %
2293 \endinput
2294