Debian Codegraph @

texmf-dist/source/latex/caption/fallback/v3.3/caption.dtx

raw
1 % \iffalse meta-comment
2 %
3 % This is file `caption.dtx'.
4 %
5 % Copyright (C) 1994-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 "maintained".
18 %
19 % This Current Maintainer of this work is Axel Sommerfeldt.
20 %
21 % This work consists of the files caption.ins, caption.dtx, caption2.dtx,
22 % caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx,
23 % the derived files caption.sty, caption2.sty, caption3.sty,
24 % bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty,
25 % and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
26 %
27 % \fi
28 % \CheckSum{3697}
29 %
30 % \iffalse
31 %<*driver>
32 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
33 \ProvidesFile{caption.drv}[2011/08/06 v3.3 Implementation of the caption package]
34 \hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
35 %\errorcontextlines=3
36 %
37 \documentclass{ltxdoc}
38 \setlength\parindent{0pt}
39 \setlength\parskip{\smallskipamount}
40 %
41 \makeatletter % make room for subsections like 2.16.14 in the TOC
42 %\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
43 \renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
44 \makeatother
45 %
46 \usepackage{ifpdf}
47 \ifpdf
48 \usepackage{mathptmx,courier}
49 \usepackage[scaled=0.90]{helvet}
50 \addtolength\marginparwidth{15pt}
51 \fi
52 %
53 \usepackage{hypdoc}
54 \ifpdf\usepackage{hypdestopt}\fi
55 \hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
56 %
57 \usepackage[debug]{caption}[2013/01/01]
58 %
59 \DeclareRobustCommand*\eTeX{\texorpdfstring
60 {\leavevmode\hbox{$\varepsilon$}-\TeX}%
61 {e-TeX}}
62 \DeclareRobustCommand*\AmS{\texorpdfstring
63 {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
64 {AMS}}
65 \DeclareRobustCommand*\KOMAScript{\texorpdfstring
66 {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
67 {KOMA-Script}}
68 \DeclareRobustCommand*\NTG{NTG}
69 \DeclareRobustCommand*\SmF{SMF}
70 %
71 \begin{document}
72 \DocInput{caption.dtx}
73 \end{document}
74 %</driver>
75 % \fi
76 %
77 % \newcommand*\purerm[1]{\texorpdfstring{{\upshape\mdseries\rmfamily #1}}{#1}}
78 % \newcommand*\puresf[1]{\texorpdfstring{{\upshape\mdseries\sffamily #1}}{#1}}
79 % \newcommand*\purett[1]{\texorpdfstring{{\upshape\mdseries\ttfamily #1}}{#1}}
80 % \let\class\puresf \let\package\puresf
81 % \let\env\purett \let\opt\purett
82 %
83 % \def\thispackage{the \package{caption} package}
84 % \def\Thispackage{The \package{caption} package}
85 %
86 % \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
87 % \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
88 % \newcommand*\version[2][]{\textit{v#2}}
89 %
90 % \newcommand*\issue[1]{GitLab~\##1}
91 %
92 % \GetFileInfo{caption.drv}
93 % \let\docdate\filedate
94 % \GetFileInfo{caption.sty}
95 %
96 % \title{The Implementation of
97 % \texorpdfstring{\thispackage\thanks{%^^A
98 % This package has version number \fileversion, last revised \filedate.}}%^^A
99 % {the caption package}}
100 % \author{Axel Sommerfeldt\\
101 % \url{https://gitlab.com/axelsommerfeldt/caption}}
102 % \date{\docdate}
103 % \maketitle
104 %
105 % \begin{abstract}
106 % \Thispackage\ consists of two parts -- the kernel
107 % (|caption3.sty|) and the main package (|caption.sty|).
108 %
109 % \Thispackage\ redefines the \LaTeX\ commands
110 % |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
111 % |\caption@@make|, giving the user the possibility to control the look \& feel
112 % of the captions from floating environments like |figure| and |table|.
113 % Furthermore it does similar to the caption stuff coming from other packages
114 % (like the \package{longtable} or \package{supertabular} package):
115 % Mapping the appropriate internal commands (like |\LT@makecaption| or
116 % |\ST@caption|) to the ones offered by the \package{caption3} kernel.
117 % So you can think of \thispackage\ as a layer package, it
118 % simply provides adaptation layers between the caption stuff coming from
119 % \LaTeXe\ or packages, and the caption stuff offered by the
120 % \package{caption3} kernel.
121 % \end{abstract}
122 %
123 % \section*{User manuals}
124 %
125 % This document is describing the code implementation only. The user
126 % documentation can be found in
127 % \nopagebreak\begin{quote}
128 % \begin{tabular}{ll}
129 % \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-eng.pdf}%
130 % {\texttt{caption-eng.pdf}} & The English documentation \\
131 % \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-rus.pdf}%
132 % {\texttt{caption-rus.pdf}} & The Russian documentation\footnotemark \\
133 % \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-deu.pdf}%
134 % {\texttt{caption-deu.pdf}} & The German documentation \\
135 % \end{tabular}
136 % \footnotetext{Thanks a lot to Olga Lapko for this translation}
137 % \end{quote}
138 %
139 % \StopEventually{}
140 % \clearpage
141 % \tableofcontents
142 %
143 % \iffalse
144 % --------------------------------------------------------------------------- %
145 % \fi
146 %
147 % \DoNotIndex{\\,\_,\ ,\@@par}
148 % \DoNotIndex{\@bsphack}
149 % \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
150 % \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
151 % \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
152 % \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
153 % \DoNotIndex{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
154 % \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
155 % \DoNotIndex{\@namedef,\@nameuse}
156 % \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
157 % \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
158 % \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
159 % \DoNotIndex{\@testopt}
160 % \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
161 % \DoNotIndex{\p@,\z@}
162 % \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
163 % \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
164 % \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
165 % \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
166 % \DoNotIndex{\fi,\footnotesize,\global}
167 % \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
168 % \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
169 % \DoNotIndex{\ifx,\ignorespaces,\itshape}
170 % \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
171 % \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
172 % \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
173 % \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
174 % \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
175 % \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
176 % \DoNotIndex{\providecommand,\quad}
177 % \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
178 % \DoNotIndex{\rightskip,\rmfamily}
179 % \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
180 % \DoNotIndex{\small,\string,\space,\strut}
181 % \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
182 % \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
183 % \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
184 % \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
185 % \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
186 % \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
187 % \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
188 % \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
189 %
190 % \iffalse
191 % --------------------------------------------------------------------------- %
192 % \fi
193 %
194 % \setlength{\parskip}{0pt plus 1pt}
195 % \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
196 %
197 % \changes{v1.0}{1994/10/27}{First release}
198 % \changes{v1.1}{1994/11/03}{New option \texttt{centerlast}}
199 % \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
200 % \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
201 % \changes{v1.4}{1995/01/30}{New option \texttt{nooneline}}
202 % \changes{v1.4b}{1995/04/05}{Bugfix release}
203 % \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
204 % \changes{v3.0d}{2004/11/28}{Split into two packages:
205 % \package{caption} \& \package{caption3}}
206 %
207 % \iffalse
208 % --------------------------------------------------------------------------- %
209 % \fi
210 %
211 % \clearpage
212 % \let\subsubsection\subsection
213 % \let\subsection\section
214 %
215 % \iffalse
216 %<*package>
217 % \fi
218 %
219 % \subsection{Identification}
220 %
221 % \begin{macrocode}
222 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
223 \ProvidesPackage{caption}[2023/08/05 v3.3f Customizing captions (AR)]
224 % \end{macrocode}
225 %
226 % \subsection{Loading the kernel}
227 %
228 % \begin{macrocode}
229 \RequirePackage{caption3}[=2019/09/01] % needs v1.8d or newer
230 % \end{macrocode}
231 %
232 % \subsection{Check against incompatible document classes}
233 %
234 % \begin{macrocode}
235 \caption@ifbool{documentclass}{}{%
236 \caption@WarningNoLine{%
237 Unsupported document class (or package) detected,\MessageBreak
238 usage of the caption package is not recommended}%
239 \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption}%
240 }
241 % \end{macrocode}
242 %
243 % \subsection{Check against incompatible packages}
244 %
245 % \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
246 % \begin{macrocode}
247 \@ifpackageloaded{caption2}{%
248 \caption@Error{%
249 You can't use both, the (obsolete) caption2 *and*\MessageBreak
250 the (current) caption package}%
251 \endinput
252 }{}
253 % \end{macrocode}
254 %
255 % \changes{v3.1}{2007/06/15}{Check against incompatible \package{ftcap} package added}
256 % \changes{v3.1}{2007/06/15}{Check against incompatible \package{nonfloat} package added}
257 % \changes{v3.1}{2007/06/18}{Check against incompatible \package{topcapt} package added}
258 % \begin{macrocode}
259 \caption@AtBeginDocument{%
260 \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}%
261 \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}%
262 \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}}
263 % \end{macrocode}
264 % \begin{macro}{\caption@DisablePositionOption}
265 % \changes{v3.1g}{2008/03/20}{\texttt{position=b} added}
266 % \changes{v3.1h}{2008/03/29}{%
267 % Name changed from \cs{caption@IncompatiblePackage} to \cs{caption@DisablePositionOption};
268 % moved from package to kernel; disables the `position' option now instead of issuing a warning}
269 % |\caption@DisablePositionOption|\marg{package}\par
270 % disables the `position' option.
271 % \begin{macrocode}
272 \newcommand*\caption@DisablePositionOption[1]{%
273 \caption@InfoNoLine{%
274 `#1' package detected; setting `position=b' for compatibility reasons}%
275 \caption@setposition b%
276 % \end{macrocode}
277 % \begin{macrocode}
278 \DeclareCaptionOption{position}{%
279 \caption@Error{Usage of the `position' option is incompatible\MessageBreak
280 to the `#1' package}}}
281 % \end{macrocode}
282 % \begin{macrocode}
283 \@onlypreamble\caption@DisablePositionOption
284 % \end{macrocode}
285 % \end{macro}
286 %
287 % \subsection{Declaration of options}
288 %
289 % \subsubsection{Options for figure and table}
290 %
291 % \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
292 % \begin{macrocode}
293 \DeclareCaptionOption{figureposition}{%
294 \captionsetup*[figure]{position=#1}}
295 \@onlypreamble@key{caption}{figureposition}
296 % \end{macrocode}
297 % \begin{macrocode}
298 \DeclareCaptionOption{tableposition}{%
299 \captionsetup*[table]{position=#1}}
300 \@onlypreamble@key{caption}{tableposition}
301 % \end{macrocode}
302 %
303 % \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
304 % \changes{v3.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written}
305 % \changes{v3.1f}{2007/11/18}{Option \opt{name} added}
306 % \begin{macrocode}
307 \DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}}
308 \@onlypreamble@key{caption}{figurename}
309 \DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}}
310 \@onlypreamble@key{caption}{tablename}
311 % \end{macrocode}
312 %
313 % \changes{v3.1g}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added}
314 % \begin{macrocode}
315 \DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}}
316 \@onlypreamble@key{caption}{listfigurename}
317 \DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}}
318 \@onlypreamble@key{caption}{listtablename}
319 % \end{macrocode}
320 %
321 % \begin{macro}{\caption@SetName}
322 % \changes{v3.1}{2007/07/04}{This macro added}
323 % \changes{v3.1f}{2007/11/18}{After-preamble variant added}
324 % \changes{v3.1g}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}}
325 % \changes{v3.1i}{2008/08/02}{Bugfix: Works now without \cs{addto}, too}
326 % \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package}
327 % \changes{v3.2f}{2012/01/12}{Bugfix: Uses \cs{caption@NewFloat} now}
328 % |\caption@SetName|\marg{float}\marg{name}
329 % \begin{macrocode}
330 \newcommand*\caption@SetName[2]{%
331 \caption@NewFloat{\newfloat@setname{#1}{#2}}}
332 \@onlypreamble\caption@SetName
333 % \end{macrocode}
334 % \end{macro}
335 %
336 % \begin{macrocode}
337 \DeclareCaptionOption{name}{\caption@setname\@captype{#1}}
338 % \end{macrocode}
339 % \begin{macro}{\caption@setname}
340 % |\caption@setname|\marg{float}\marg{name}
341 % \begin{macrocode}
342 \newcommand*\caption@setname[2]{%
343 \@namedef{#1name}{#2}}
344 % \end{macrocode}
345 % \end{macro}
346 %
347 % \changes{v3.1f}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added}
348 % \changes{v3.1i}{2008/04/13}{Option \opt{within} added}
349 % \changes{v3.1l}{2010/01/09}{The \opt{within} options are now available within the document, too}
350 % \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined
351 % floats declared with \cs{DeclareCaptionType}, too}
352 %
353 % \begin{macro}{\caption@DeclareWithinOption}
354 % \changes{v3.1l}{2010/01/09}{This macro and its usage added}
355 % |\caption@DeclareWithinOption|\marg{float}
356 % declares the options \meta{float}\texttt{within} and \meta{float}\texttt{without},
357 % e.g. \texttt{figurewithin} and \texttt{figurewithout}.
358 % \begin{macrocode}
359 \newcommand*\caption@DeclareWithinOption[1]{%
360 \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}%
361 \DeclareCaptionOptionNoValue{#1without}{\caption@Within{#1}{none}}}
362 \@onlypreamble\caption@DeclareWithinOption
363 % \end{macrocode}
364 % \end{macro}
365 % \begin{macrocode}
366 \caption@DeclareWithinOption{figure}
367 \caption@DeclareWithinOption{table}
368 % \end{macrocode}
369 % \begin{macrocode}
370 \DeclareCaptionOption{within}{%
371 \caption@NewFloat{\newfloatsetup{within=#1}}}
372 \DeclareCaptionOptionNoValue{without}{%
373 \caption@NewFloat{\newfloatsetup{without}}}
374 % \end{macrocode}
375 % \begin{macro}{\caption@Within}
376 % \changes{v3.1}{2007/12/21}{This macro added}
377 % \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package}
378 % \changes{v3.2f}{2012/01/12}{Bugfix: Uses \cs{caption@NewFloat} now}
379 % |\caption@Within|\marg{float}\marg{value}
380 % \begin{macrocode}
381 \newcommand*\caption@Within[2]{%
382 \caption@NewFloat{\newfloat@setwithin{#1}{#2}}}
383 % \end{macrocode}
384 % \end{macro}
385 %
386 % \begin{macro}{\caption@NewFloat}
387 % \changes{v3.2f}{2012/01/12}{This macro added}
388 % |\caption@NewFloat|\marg{code}
389 % loads the \package{newfloat} package and executes the given code afterwards.
390 % Note: Since the \package{newfloat} package uses the crappy \package{keyval}
391 % package, too, we need to save \& restore some macros here, otherwise this
392 % recursion won't work properly.
393 % {\itshape (TODO: Re-write \package{newfloat} so it uses \package{kvoptions} instead.)}
394 % \begin{macrocode}
395 \newcommand*\caption@NewFloat[1]{%
396 \let\KV@prefix@ORI\KV@prefix
397 \let\@tempc@ORI\@tempc
398 \caption@ifpackageloaded{newfloat}{#1}{}%
399 \let\@tempc\@tempc@ORI
400 \let\KV@prefix\KV@prefix@ORI}
401 % \end{macrocode}
402 % \end{macro}
403 %
404 % \subsubsection{Miscellaneous options}
405 %
406 % \begin{macrocode}
407 \DeclareCaptionOption*{config}[caption]{%
408 \InputIfFileExists{#1.cfg}%
409 {\typeout{*** Local configuration file #1.cfg used ***}}%
410 {\caption@Warning{Configuration file #1.cfg not found}}}
411 % \end{macrocode}
412 %
413 % \begin{macro}{\caption@selectlistentry}
414 % \changes{v3.2}{2010/11/07}{This macro added}
415 % |\caption@selectlistentry|\marg{\purett{heading} or \purett{entry}}
416 % \begin{macrocode}
417 \newcommand*\caption@selectlistentry[1]{%
418 \caption@ifinlist{#1}{heading}{%
419 \let\caption@iflistheading\@firstoftwo
420 }{\caption@ifinlist{#1}{default,list-entry,entry}{%
421 \let\caption@iflistheading\@secondoftwo
422 }{%
423 \caption@Error{Undefined list-entry selection `#1'}%
424 }}}
425 % \end{macrocode}
426 % \end{macro}
427 %
428 % \changes{v3.3}{2012-03-25}{Option \opt{list-entry} added}
429 % \begin{macrocode}
430 \DeclareCaptionOption{list-entry}{\caption@selectlistentry{#1}}
431 \captionsetup{list-entry=default}
432 % \end{macrocode}
433 %
434 % \begin{macro}{\caption@setparboxrestore}
435 % \changes{v3.2}{2010/11/07}{This macro added}
436 % |\caption@setparboxrestore|\marg{\purett{partial} or \purett{full}}
437 % \begin{macrocode}
438 \newcommand*\caption@setparboxrestore[1]{%
439 \caption@ifinlist{#1}{full}{%
440 \caption@setfullparboxrestore
441 }{\caption@ifinlist{#1}{default,light,partial}{%
442 \let\caption@parboxrestore\@secondoftwo
443 }{%
444 \caption@Error{Undefined parboxrestore `#1'}%
445 }}}
446 % \end{macrocode}
447 % \end{macro}
448 %
449 % \begin{macro}{\caption@setfullparboxrestore}
450 % \changes{v3.2}{2010/11/07}{This macro added}
451 % |\caption@setfullparboxrestore|\par
452 % This is an abbreviation for |\caption@setparboxrestore{full}|.
453 % \begin{macrocode}
454 \newcommand*\caption@setfullparboxrestore{%
455 \let\caption@parboxrestore\@firstoftwo}
456 % \end{macrocode}
457 % \end{macro}
458 %
459 % \changes{v3.2}{2010/11/07}{Option \opt{parboxrestore} added}
460 % \begin{macrocode}
461 \DeclareCaptionOption{parboxrestore}{\caption@setparboxrestore{#1}}
462 \captionsetup{parboxrestore=default}
463 % \end{macrocode}
464 %
465 % \changes{v3.1f}{2007/11/28}{Option \opt{@minipage=} added}
466 % \begin{macrocode}
467 \DeclareCaptionOption{@minipage}{%
468 \caption@ifinlist{#1}{auto,default}%
469 {\let\caption@if@minipage\@gobbletwo}%
470 {\caption@set@bool\caption@if@minipage{#1}}}
471 \captionsetup{@minipage=default}
472 % \end{macrocode}
473 %
474 % \subsubsection{caption v1.x compatibility options}
475 % \changes{v3.1}{2007/07/21}{Option `compatibility' added}
476 % \changes{v3.1}{2007/09/01}{caption v1.x compatibility options revised}
477 % \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v1.x$ compatibility options}
478 %
479 % \begin{macrocode}
480 \DeclareCaptionOption{compatibility}[1]{\caption@setbool{compatibility}{#1}}
481 \@onlypreamble@key{caption}{compatibility}
482 % \end{macrocode}
483 %
484 % \begin{macrocode}
485 \DeclareCaptionOptionNoValue*{normal}{%
486 \caption@setformat{plain}%
487 \caption@setjustification{justified}}
488 \DeclareCaptionOptionNoValue*{isu}{%
489 \caption@setformat{hang}%
490 \caption@setjustification{justified}}
491 \DeclareCaptionOptionNoValue*{hang}{%
492 \caption@setformat{hang}%
493 \caption@setjustification{justified}}
494 \DeclareCaptionOptionNoValue*{center}{%
495 \caption@setformat{plain}%
496 \caption@setjustification{centering}}
497 \DeclareCaptionOptionNoValue*{centerlast}{%
498 \caption@setformat{plain}%
499 \caption@setjustification{centerlast}}
500 % \end{macrocode}
501 %
502 % \begin{macrocode}
503 \DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}}
504 \DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}}
505 \DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}}
506 \DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}}
507 \DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}}
508 \DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}}
509 % \end{macrocode}
510 %
511 % \begin{macrocode}
512 \DeclareCaptionOptionNoValue*{up}{\l@addto@macro\captionlabelfont\upshape}
513 \DeclareCaptionOptionNoValue*{it}{\l@addto@macro\captionlabelfont\itshape}
514 \DeclareCaptionOptionNoValue*{sl}{\l@addto@macro\captionlabelfont\slshape}
515 \DeclareCaptionOptionNoValue*{sc}{\l@addto@macro\captionlabelfont\scshape}
516 \DeclareCaptionOptionNoValue*{md}{\l@addto@macro\captionlabelfont\mdseries}
517 \DeclareCaptionOptionNoValue*{bf}{\l@addto@macro\captionlabelfont\bfseries}
518 \DeclareCaptionOptionNoValue*{rm}{\l@addto@macro\captionlabelfont\rmfamily}
519 \DeclareCaptionOptionNoValue*{sf}{\l@addto@macro\captionlabelfont\sffamily}
520 \DeclareCaptionOptionNoValue*{tt}{\l@addto@macro\captionlabelfont\ttfamily}
521 % \end{macrocode}
522 %
523 % \begin{macrocode}
524 \DeclareCaptionOptionNoValue*{nooneline}{\caption@setbool{slc}{0}}
525 % \end{macrocode}
526 %
527 % \begin{macrocode}
528 \caption@setbool{ruled}{0}
529 \DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}}
530 % \end{macrocode}
531 %
532 % \subsubsection{caption2 v2.x compatibility options}
533 % \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
534 % \changes{v3.1}{2007/09/01}{caption2 v2.x compatibility options revised}
535 % \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v2.x$ compatibility options}
536 %
537 % \begin{macrocode}
538 \DeclareCaptionOptionNoValue*{flushleft}{%
539 \caption@setformat{plain}%
540 \caption@setjustification{raggedright}}
541 \DeclareCaptionOptionNoValue*{flushright}{%
542 \caption@setformat{plain}%
543 \caption@setjustification{raggedleft}}
544 % \end{macrocode}
545 % \begin{macrocode}
546 \DeclareCaptionOptionNoValue*{oneline}{\caption@setbool{slc}{1}}
547 % \end{macrocode}
548 % \begin{macrocode}
549 \DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{%
550 \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}}
551 % \end{macrocode}
552 %
553 % \subsubsection{Obsolete caption v3.0 options}
554 % \changes{v3.1}{2007/05/07}{Package option \opt{caption} marked as obsolete,
555 % gives error now}
556 %
557 % \begin{macrocode}
558 \DeclareCaptionOption*{caption}{%
559 \caption@setbool{temp}{#1}%
560 \caption@ifbool{temp}{}{%
561 \caption@Error{%
562 The package option `caption=#1' is obsolete.\MessageBreak
563 Please pass this option to the subfig package instead\MessageBreak
564 and do *not* load the caption package anymore}}}
565 % \end{macrocode}
566 %
567 % \subsubsection{fltpage package support options}
568 %
569 % \changes{v3.1}{2007/09/01}{Options `FPlist' \& `FPref' added}
570 % With these options is controlled where the list-of entry and |\ref| resp.
571 % |\pageref| or |\autoref| will link to.
572 % Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent,
573 % but compatible to the usual behaviour of the \package{fltpage} package.
574 % \begin{macrocode}
575 \DeclareCaptionOption{FPlist}[1]{\caption@setFPoption{list}{#1}}
576 \DeclareCaptionOption{FPref}[1]{\caption@setFPoption{ref}{#1}}
577 \@onlypreamble@key{caption}{FPlist}
578 \@onlypreamble@key{caption}{FPref}
579 % \end{macrocode}
580 % \begin{macrocode}
581 \newcommand*\caption@setFPoption[2]{%
582 \edef\caption@tempa{\@car#2\@nil}%
583 \caption@setbool{FP#1cap}{\if c\caption@tempa 1\else 0\fi}}
584 \@onlypreamble\caption@setFPoption
585 % \end{macrocode}
586 % \begin{macrocode}
587 \captionsetup{FPlist=caption,FPref=figure}
588 % \end{macrocode}
589 %
590 % \subsubsection{hyperref package support options}
591 %
592 % \changes{v3.1}{2007/06/21}{Options `hypcap' \& `hypcapspace' added}
593 % With |hypcap=off| one can turn the \package{hypcap} support off
594 % (default is |on|).
595 % \begin{macrocode}
596 \DeclareCaptionOption{hypcap}[1]{\caption@setbool{hypcap}{#1}}
597 \DeclareCaptionOption{hypcapspace}{\def\caption@hypcapspace{#1}}
598 % \end{macrocode}
599 % \begin{macrocode}
600 \captionsetup{hypcap=1,hypcapspace=.5\baselineskip}
601 % \end{macrocode}
602 %
603 % \subsection{\AmS{} \& \SmF{} document classes support}
604 % \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ document classes support added}
605 %
606 % \begin{macrocode}
607 \caption@ifamsclass{%
608 \caption@InfoNoLine{AMS or SMF document class}%
609 % \end{macrocode}
610 % \begin{macrocode}
611 \setlength\belowcaptionskip{0pt}% set to 12pt by AMS class
612 % \end{macrocode}
613 % \begin{macrocode}
614 }
615 % \end{macrocode}
616 %
617 % \subsection{\KOMAScript{} document classes support}
618 % \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added}
619 % \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added}
620 % \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added}
621 % \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised}
622 % \changes{v3.1}{2007/03/17}{\KOMAScript\ compatibility options removed}
623 % \changes{v3.1}{2007/04/05}{\KOMAScript\ compatibility revised \& enhanced}
624 %
625 % \begin{macrocode}
626 \caption@ifkomaclass{%
627 \caption@InfoNoLine{KOMA-Script document class}%
628 % \end{macrocode}
629 %
630 % Here we emulate the caption related commands and take over the caption
631 % related settings from the \KOMAScript\ classes.
632 %
633 % \begin{macro}{\@tablecaptionabovetrue}
634 % \begin{macro}{\@tablecaptionabovefalse}
635 % \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
636 % \begin{macrocode}
637 \g@addto@macro\@tablecaptionabovetrue{\captionsetup*[table]{position=t}}
638 \g@addto@macro\@tablecaptionabovefalse{\captionsetup*[table]{position=b}}
639 % \end{macrocode}
640 % \begin{macrocode}
641 \if@tablecaptionabove
642 \@tablecaptionabovetrue
643 \else
644 \@tablecaptionabovefalse
645 \fi
646 % \end{macrocode}
647 % \end{macro}
648 % \end{macro}
649 %
650 % \begin{macro}{\@figurecaptionabovetrue}
651 % \begin{macro}{\@figurecaptionabovefalse}
652 % \changes{v3.3}{2013/02/15}{Support of \cs{@figurecaptionabovetrue} added}
653 % \begin{macrocode}
654 \caption@ifundefined\@figurecaptionabovetrue{}{%
655 % \end{macrocode}
656 % \begin{macrocode}
657 \g@addto@macro\@figurecaptionabovetrue{\captionsetup*[figure]{position=t}}
658 \g@addto@macro\@figurecaptionabovefalse{\captionsetup*[figure]{position=b}}
659 % \end{macrocode}
660 % \begin{macrocode}
661 \if@figurecaptionabove
662 \@figurecaptionabovetrue
663 \else
664 \@figurecaptionabovefalse
665 \fi
666 % \end{macrocode}
667 % \begin{macrocode}
668 }%
669 % \end{macrocode}
670 % \end{macro}
671 % \end{macro}
672 %
673 % \begin{macro}{\onelinecaptionstrue}
674 % \begin{macro}{\onelinecaptionsfalse}
675 % \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
676 % \begin{macrocode}
677 \g@addto@macro\onelinecaptionstrue{\let\caption@ifslc\@firstoftwo}
678 \g@addto@macro\onelinecaptionsfalse{\let\caption@ifslc\@secondoftwo}
679 % \end{macrocode}
680 % \begin{macrocode}
681 \ifonelinecaptions
682 \onelinecaptionstrue
683 \else
684 \onelinecaptionsfalse
685 \fi
686 % \end{macrocode}
687 % \end{macro}
688 % \end{macro}
689 %
690 % \begin{macro}{\@captionabovetrue}
691 % \begin{macro}{\@captionabovefalse}
692 % \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21:
693 % \cs{let}\cs{caption@setposition}\cs{@gobble} added}
694 % \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed}
695 % \changes{v3.1}{2007/03/31}{We redefine \cs{captionabovetrue/false} now
696 % instead of \cs{captionabove/below}}
697 % \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
698 % \changes{v3.1k}{2009/10/09}{\opt{figureposition} and \opt{tableposition} will issue a warning now}
699 % Please note that these are stronger than the \opt{position} setting, therefore we
700 % override the options \opt{figureposition} and \opt{tableposition} to typeout a warning.
701 % \begin{macrocode}
702 \g@addto@macro\@captionabovetrue{\let\caption@position\@firstoftwo}
703 \g@addto@macro\@captionabovefalse{\let\caption@position\@secondoftwo}
704 % \end{macrocode}
705 % \begin{macrocode}
706 \DeclareCaptionOption{figureposition}{%
707 \caption@WarningNoLine{Option `figureposition=#1' has no effect\MessageBreak
708 when used with a KOMA script document class}}
709 \DeclareCaptionOption{tableposition}{%
710 \caption@WarningNoLine{Option `tableposition=#1' has no effect\MessageBreak
711 when used with a KOMA script document class}}
712 % \end{macrocode}
713 % \end{macro}
714 % \end{macro}
715 %
716 % \begin{macro}{\setcapindent}
717 % \begin{macrocode}
718 \let\caption@KOMA@setcapindent\@setcapindent
719 \renewcommand*\@setcapindent[1]{%
720 \caption@KOMA@setcapindent{#1}\caption@setcapindent}
721 % \end{macrocode}
722 % \begin{macrocode}
723 \let\caption@KOMA@@setcapindent\@@setcapindent
724 \renewcommand*\@@setcapindent[1]{%
725 \caption@KOMA@@setcapindent{#1}\caption@setcapindent}
726 % \end{macrocode}
727 % \begin{macrocode}
728 \newcommand*\caption@setcapindent{%
729 \captionsetup{indent=\ifdim\cap@indent<\z@\z@\else\cap@indent\fi}}
730 % \end{macrocode}
731 % \end{macro}
732 %
733 % \begin{macrocode}
734 \caption@ifundefined\cap@indent{}{\caption@setcapindent}
735 % \end{macrocode}
736 %
737 % \begin{macro}{\setcapwidth}
738 % \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
739 % \Note{The optional argument of \cs{setcapwidth} if not supported (yet),
740 % so we issue a warning if used.
741 % (Since this does not seem to have an negative effect when used
742 % by the \texttt{captionbeside} environment, we suppress the warning here.)}
743 % \begin{macrocode}
744 \expandafter\let\expandafter\caption@KOMA@setcapwidth
745 \csname\string\setcapwidth\endcsname
746 \@namedef{\string\setcapwidth}[#1]#2{%
747 \caption@KOMA@setcapwidth[{#1}]{#2}\caption@setcapwidth{#1}}
748 % \end{macrocode}
749 % \begin{macrocode}
750 \newcommand*\caption@setcapwidth[1]{%
751 \ifx\\#1\\\else
752 \caption@ifundefined\cap@margin{}{%
753 \def\@tempa{captionbeside}%
754 \ifx\@tempa\@currenvir\else\caption@Warning{%
755 Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}%
756 \fi}%
757 \fi
758 \captionsetup{width=\cap@width}}
759 % \end{macrocode}
760 % \end{macro}
761 %
762 % \begin{macrocode}
763 \def\caption@tempa{\hsize}%
764 \ifx\caption@tempa\cap@width \else
765 \caption@setcapwidth{?}
766 \fi
767 % \end{macrocode}
768 %
769 % \begin{macro}{\setcapmargin}
770 % \begin{macrocode}
771 \expandafter\let\expandafter\caption@KOMA@setcapmargin
772 \csname\string\@setcapmargin\endcsname
773 \@namedef{\string\@setcapmargin}[#1]#2{%
774 \caption@KOMA@setcapmargin[{#1}]{#2}\caption@setcapmargin}
775 % \end{macrocode}
776 % \begin{macrocode}
777 \expandafter\let\expandafter\caption@KOMA@@setcapmargin
778 \csname\string\@@setcapmargin\endcsname
779 \@namedef{\string\@@setcapmargin}[#1]#2{%
780 \caption@KOMA@@setcapmargin[{#1}]{#2}\caption@setcapmargin}
781 % \end{macrocode}
782 % \begin{macrocode}
783 \newcommand*\caption@setcapmargin{%
784 \begingroup
785 \let\onelinecaptionsfalse\relax
786 \def\@twoside{0}%
787 \def\if@twoside{\def\@twoside{1}\iffalse}%
788 \cap@margin
789 \def\@tempa{\endgroup}%
790 \ifx\cap@left\hfill\else\ifx\cap@right\hfill\else
791 \def\hspace##1##{\@firstofone}%
792 \edef\@tempa{\endgroup
793 \noexpand\captionsetup{%
794 twoside=\@twoside,slc=0,%
795 margin={\cap@left,\cap@right}}}%
796 \fi\fi
797 \@tempa}
798 % \end{macrocode}
799 % \end{macro}
800 %
801 % \begin{macrocode}
802 \ifx\cap@margin\relax \else
803 \caption@setcapmargin
804 \fi
805 % \end{macrocode}
806 %
807 % \begin{macrocode}
808 }
809 % \end{macrocode}
810 %
811 % \subsection{Processing of options}
812 %
813 % \changes{v3.0m}{2007/03/04}{Verbose option added}
814 % \changes{v3.1}{2007/07/02}{Verbose option removed from package}
815 %
816 % \changes{v3.1}{2007/03/17}{We do not process global options anymore}
817 % \begin{macrocode}
818 \caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}
819 \caption@ProcessOptions*{caption}
820 % \end{macrocode}
821 %
822 % \subsection{\cs{caption}, \cs{@caption}, and \cs{@makecaption}}
823 %
824 % \begin{macro}{\caption@ifflag}
825 % \changes{v3.3}{2011/12/28}{This switch added}
826 % \changes{v3.3}{2018/08/08}{Rewritten (and renamed) so a counter is used instead of a switch}
827 % Since we support continued floats and sub-figures it's not an easy task
828 % to manage the figure (and table) counter. (Especially since previous versions
829 % of the caption package has proven that correcting a counter locally is not a good idea.)
830 %
831 % These three switches hold the
832 % current status: |\caption@if|\-|flag{2}| is set if the caption was already
833 % typeset (so the counter doesn't need to be incremented for sub-figures),
834 % |\caption@if|\-|flag{4}| is set if there is already content which have
835 % incremented the counter (so the counter doesn't need to be incremented
836 % for the main caption, further sub-figures, and other stuff), and
837 % |\caption@if|\-|flag{1}| is set if |\Continued|\-|Float| was given.
838 %
839 % In the past three boolean switches were used to store the flags, but since some
840 % packages (like the \package{floatrow} and \package{tabu} package) try hard to keep
841 % counter changes locally under certain circumstances, it seems a good idea to make
842 % these flags a counter value, too.
843 % \begin{macrocode}
844 \newcounter{caption@flags}
845 % \end{macrocode}
846 % \begin{macrocode}
847 \newcommand*\caption@ifflag[1]{%
848 \@tempcnta\c@caption@flags
849 \divide\@tempcnta #1\relax
850 \ifodd\@tempcnta
851 \expandafter\@firstoftwo
852 \else
853 \expandafter\@secondoftwo
854 \fi}
855 % \end{macrocode}
856 % \end{macro}
857 %
858 % \begin{macro}{\caption@clrflags}
859 % \changes{v3.3}{2018/08/08}{This macro added}
860 % \begin{macro}{\caption@clrflag}
861 % \changes{v3.3}{2013/04/14}{This macro added}
862 % \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
863 % \begin{macro}{\caption@setflag}
864 % \changes{v3.3}{2013/04/14}{This macro added}
865 % \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
866 % Furthermore we introduce the macros \cs{caption@clrflag} and \cs{caption@setflag}
867 % for clearing resp.~setting these flags.
868 % \begin{macrocode}
869 \newcommand*\caption@clrflags{%
870 \setcounter{caption@flags}\z@}
871 % \end{macrocode}
872 % \begin{macrocode}
873 \newcommand*\caption@clrflag[1]{%
874 \caption@ifflag{#1}{\caption@addtoflags{-#1}}{}}
875 \newcommand*\caption@setflag[1]{%
876 \caption@ifflag{#1}{}{\caption@addtoflags{#1}}}
877 \newcommand*\caption@addtoflags{%
878 \addtocounter{caption@flags}}
879 % \end{macrocode}
880 % \end{macro}
881 % \end{macro}
882 % \end{macro}
883 %
884 % \begin{macro}{\caption@caption}
885 % \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
886 % \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
887 % \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
888 % \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
889 % Here comes our definition of |\caption| and |\caption*|.
890 % Beside the support of the starred variant this code was adapted to the
891 % various packages we support.
892 % We are using |\caption@dblarg| instead of |\@dblarg| so |\caption{}|
893 % (with an empty arg.) will produce a list-of entry, but |\caption[]{}|
894 % won't.
895 % \begin{macrocode}
896 \def\caption@caption{%
897 \caption@iftype
898 {\caption@checkgrouplevel\@empty\caption
899 \caption@star
900 {\caption@refstepcounter\@captype}%
901 {\caption@dblarg{\@caption\@captype}}}%
902 {\caption@Error{\noexpand\caption outside float}%
903 \caption@gobble}}
904 % \end{macrocode}
905 % \end{macro}
906 %
907 % \begin{macro}{\caption@star}
908 % \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}}
909 % \changes{v3.2c}{2011/08/21}{\cs{global} removed}
910 % A helper macro which processes the optional |*| after |\caption|.
911 % \begin{macrocode}
912 \newcommand*\caption@star[2]{%
913 \@ifstar{\caption@startrue#2[]}{#1#2}}
914 % \end{macrocode}
915 % \end{macro}
916 %
917 % \begin{macro}{\caption@@caption}
918 % \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
919 % \changes{v3.1f}{2007/11/28}{Bugfix: Handling of \texttt{@minipage} flag added}
920 % \changes{v3.1f}{2007/11/28}{Support of option \opt{@minipage} added}
921 % \changes{v3.1g}{2008/03/16}{Internal: Uses \cs{caption@prepareanchor} now}
922 % \changes{v3.2d}{2011/10/21}{Adapted to the \textsf{memoir} document class}
923 % \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved to \cs{caption@prepareanchor}}
924 % \changes{v3.3}{2013/01/06}{Adapted to the \textsf{nag} package}
925 % As above, our version has been adapted to the packages we support.
926 % Additionally our code is nested by |\caption@beginex| \&
927 % |\caption@end| instead of |\begingroup| \& |\endgroup|.
928 % Furthermore we use |\caption@boxrestore| instead of |\@parboxrestore|
929 % so this code also works correctly inside list-based environments
930 % like |wide| \& |addmargin|. (This, and the fact that we use
931 % |\linewidth| instead of |\hsize| inside |\@makecaption|, solves
932 % \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2472}%^^A
933 % {\LaTeX\ PR \texttt{latex/2472}}.)
934 % \begin{macrocode}
935 \long\def\caption@@caption#1[#2]#3{%
936 % \end{macrocode}
937 % \begin{macrocode}
938 \ifcaption@star \else
939 \caption@prepareanchor{#1}{#2}%
940 \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}%
941 \@nameuse{nag@hascaptiontrue}%
942 \fi
943 % \end{macrocode}
944 % \begin{macrocode}
945 \par
946 \caption@beginex{#1}{#2}{#3}%
947 \caption@setfloatcapt{%
948 \caption@boxrestore
949 \if@minipage
950 \@setminipage
951 \fi
952 \caption@normalsize
953 \ifcaption@star
954 \let\caption@makeanchor\@firstofone
955 \fi
956 \@makecaption{\csname fnum@#1\endcsname}%
957 {\ignorespaces\caption@makeanchor{#3}}\par
958 \caption@if@minipage\@minipagetrue\@minipagefalse}%
959 \caption@end}
960 % \end{macrocode}
961 % \textsf{memoir} document class stuff:
962 % \begin{macrocode}
963 \providecommand\M@gettitle[1]{}
964 \providecommand\memcaptioninfo[4]{}
965 % \end{macrocode}
966 % \end{macro}
967 %
968 % \begin{macro}{\caption@prepareanchor}
969 % \changes{v3.1g}{2008/03/16}{This macro added}
970 % \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved from \cs{caption@@caption}}
971 % \begin{macrocode}
972 \newcommand*\caption@prepareanchor[2]{%
973 \caption@makecurrent{#1}{#2}%
974 \caption@ifhypcap\caption@@start\relax
975 \M@gettitle{#2}}
976 % \end{macrocode}
977 % \end{macro}
978 %
979 % \begin{macro}{\caption@makecaption}
980 % \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added}
981 % |\@makecaption|\marg{label}\marg{text}\par
982 % We do basically the same as the original code (from the standard
983 % \LaTeX\ document classes), but take care of the |position=| setting
984 % and use |\caption@@make| from the \package{caption} kernel to finally
985 % typeset the caption.
986 % \begin{macrocode}
987 \long\def\caption@makecaption#1#2{%
988 \caption@make@above
989 \caption@@make{#1}{#2}%
990 \caption@make@below}
991 % \end{macrocode}
992 % \end{macro}
993 %
994 % \begin{macro}{\caption@make@above}
995 % \begin{macro}{\caption@make@below}
996 % \changes{v3.3a}{2019/04/02}{This macro added}
997 % |\caption@make@above|\\
998 % |\caption@make@below|\par
999 % Typesets the stuff above resp.~below the caption, depending on |\caption@iftop|.
1000 % \begin{macrocode}
1001 \newcommand*\caption@make@above{%
1002 \caption@iftop
1003 \caption@belowskip
1004 {\caption@rule\caption@aboveskip}}
1005 % \end{macrocode}
1006 % \begin{macrocode}
1007 \newcommand*\caption@make@below{%
1008 \caption@iftop
1009 {\caption@aboveskip\caption@rule}%
1010 \caption@belowskip}
1011 % \end{macrocode}
1012 % \end{macro}
1013 % \end{macro}
1014 %
1015 % \begin{macro}{\caption@aboveskip}
1016 % \begin{macro}{\caption@belowskip}
1017 % \changes{v3.3a}{2019/04/02}{This macro added}
1018 % |\caption@aboveskip|\\
1019 % |\caption@belowskip|\par
1020 % Typesets the skip above resp.~below the caption.
1021 % \begin{macrocode}
1022 \newcommand*\caption@aboveskip{%
1023 \vskip\abovecaptionskip}
1024 % \end{macrocode}
1025 % \begin{macrocode}
1026 \newcommand*\caption@belowskip{%
1027 \vskip\belowcaptionskip}
1028 % \end{macrocode}
1029 % \end{macro}
1030 % \end{macro}
1031 %
1032 % \begin{macro}{\caption@redefine}
1033 % \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now}
1034 % We only redefine |\caption| and |\@caption| if the current definitions
1035 % are well known, so documents written in the old (\package{caption}
1036 % package \version{1.x}) days (where |\caption| \& |\@caption| were not
1037 % redefined by us) will still compile fine.
1038 % For example the usage of the (now obsolete) \package{captcont} package,
1039 % which brings its own definition of |\caption*|, was quite common these days.
1040 % \begin{macrocode}
1041 \newcommand*\caption@redefine{}
1042 \g@addto@macro\caption@redefine{%
1043 % \end{macrocode}
1044 %
1045 % \begin{macrocode}
1046 \caption@setbool{incompatible}{0}%
1047 % \end{macrocode}
1048 %
1049 % \begin{macrocode}
1050 \caption@CheckCommand\caption{%
1051 % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
1052 \def\caption{%
1053 \ifx\@captype\@undefined
1054 \@latex@error{\noexpand\caption outside float}\@ehd
1055 \expandafter\@gobble
1056 \else
1057 \refstepcounter\@captype
1058 \expandafter\@firstofone
1059 \fi
1060 {\@dblarg{\@caption\@captype}}%
1061 }}%
1062 % \end{macrocode}
1063 %
1064 % \begin{macrocode}
1065 \caption@CheckCommand\caption{%
1066 % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
1067 \def\caption{
1068 \ifx\@captype\@undefined
1069 \@latex@error{\noexpand\caption outside figure or table}\@ehd
1070 \expandafter\@gobble
1071 \else
1072 \refstepcounter\@captype
1073 \expandafter\@firstofone
1074 \fi
1075 {\@dblarg{\@caption\@captype}}%
1076 }}%
1077 % \end{macrocode}
1078 %
1079 % \begin{macrocode}
1080 \caption@CheckCommand\caption{%
1081 % beamerbaselocalstructure.sty, Joseph Wright committed 4ac715c 2013-09-04
1082 \def\caption{%
1083 \ifx\@captype\@undefined
1084 \@latex@error{\noexpand\caption outside figure or table}\@ehd
1085 \expandafter\@gobble
1086 \else
1087 \refstepcounter\@captype
1088 \expandafter\@firstofone
1089 \fi
1090 {\@dblarg{\@caption\@captype}}%
1091 }}%
1092 % \end{macrocode}
1093 %
1094 % \begin{macrocode}
1095 \caption@CheckCommand\caption{%
1096 % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
1097 \long\def\caption{%
1098 \ifx\@captype\@undefined
1099 \@latex@error{\noexpand\caption outside float}\@ehd
1100 \expandafter\@gobble
1101 \else
1102 \refstepcounter\@captype
1103 \let\@tempf\@caption
1104 \expandafter\ifx\csname @float@c@\@captype\endcsname\relax\else
1105 \expandafter\expandafter\let
1106 \expandafter\@tempf\csname @float@c@\@captype\endcsname
1107 \fi
1108 \fi
1109 \@dblarg{\@tempf\@captype}}}%
1110 % \end{macrocode}
1111 %
1112 % \begin{macrocode}
1113 \caption@CheckCommand\caption{%
1114 % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
1115 % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
1116 % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
1117 \def\caption{%
1118 \ifx\@captype\@undefined
1119 \@latex@error{\noexpand\caption outside float}\@ehd
1120 \expandafter\@gobble
1121 \else
1122 \H@refstepcounter\@captype
1123 \@ifundefined{fst@\@captype}{%
1124 \let\Hy@tempa\@caption
1125 }{%
1126 \let\Hy@tempa\Hy@float@caption
1127 }%
1128 \expandafter\@firstofone
1129 \fi
1130 {\@dblarg{\Hy@tempa\@captype}}%
1131 }}%
1132 % \end{macrocode}
1133 % \begin{macrocode}
1134 \caption@CheckCommand\caption{%
1135 % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
1136 \def\caption{%
1137 \ifx\@captype\@undefined
1138 \@latex@error{\noexpand\caption outside float}\@ehd
1139 \expandafter\@gobble
1140 \else
1141 \H@refstepcounter\@captype
1142 \let\Hy@tempa\@caption
1143 \@ifundefined{float@caption}{%
1144 }{%
1145 \expandafter\ifx\csname @float@c@\@captype\endcsname\float@caption
1146 \let\Hy@tempa\Hy@float@caption
1147 \fi
1148 }%
1149 \expandafter\@firstofone
1150 \fi
1151 {\@dblarg{\Hy@tempa\@captype}}%
1152 }}%
1153 % \end{macrocode}
1154 % \begin{macrocode}
1155 \caption@CheckCommand\caption{%
1156 % memhfixc.sty [2010/08/17 v1.15 nameref/hyperref package fixes for memoir class]
1157 % \let\m@moldhypcaption\caption
1158 \long\def\caption{\donemaincaptiontrue\m@moldhypcaption}}%
1159 % \end{macrocode}
1160 % \begin{macrocode}
1161 \caption@IfCheckCommand{}{%
1162 \caption@InfoNoLine{%
1163 Incompatible package detected (regarding \string\caption).\MessageBreak
1164 \string\caption\space=\space\meaning\caption}%
1165 \caption@setbool{incompatible}{1}}%
1166 % \end{macrocode}
1167 %
1168 % \begin{macrocode}
1169 \caption@CheckCommand\@caption{%
1170 % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
1171 \long\def\@caption#1[#2]#3{%
1172 \par
1173 \addcontentsline{\csname ext@#1\endcsname}{#1}%
1174 {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
1175 \begingroup
1176 \@parboxrestore
1177 \if@minipage
1178 \@setminipage
1179 \fi
1180 \normalsize
1181 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
1182 \endgroup}}%
1183 % \end{macrocode}
1184 %
1185 % \begin{macrocode}
1186 \caption@CheckCommand\@caption{%
1187 % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
1188 \long\def\@caption#1[#2]#3{% second argument ignored
1189 \par\nobreak
1190 \begingroup
1191 \@parboxrestore
1192 \if@minipage
1193 \@setminipage
1194 \fi
1195 \beamer@makecaption{#1}{\ignorespaces #3}\par\nobreak
1196 \endgroup}}%
1197 % \end{macrocode}
1198 %
1199 % \begin{macrocode}
1200 \caption@CheckCommand\@caption{%
1201 % memhfixc.sty [2010/08/17 v1.15 nameref/hyperref package fixes for memoir class]
1202 \long\def\@caption#1[#2]#3{%
1203 \MNR@old@caption{#1}[{#2}]{#3}%
1204 \def\@currentlabelname{#2}%
1205 \M@gettitle{#2}%
1206 }}%
1207 % \end{macrocode}
1208 %
1209 % \begin{macrocode}
1210 \caption@CheckCommand\@caption{%
1211 % arabicore.sty [2006/01/01 v1.0 Arabi Core switching commands (may still change)]
1212 \long\def\@caption#1[#2]#3{%
1213 \par
1214 \addtocontents{\csname ext@#1\endcsname}{\xstring\select@language{\main@Arabi@language}}%
1215 \addcontentsline{\csname ext@#1\endcsname}{#1}%
1216 {\protect\numberline{\csname the#1\endcsname}{\ignorespaces \if@rl{\textRL{#2}}\else\textLR{#2}\fi}}%
1217 \begingroup
1218 \@parboxrestore
1219 \if@minipage
1220 \@setminipage
1221 \fi
1222 \normalsize
1223 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces \if@rl{\textRL{#3}}\else\textLR{#3}\fi}\par
1224 \endgroup}}%
1225 % \end{macrocode}
1226 %
1227 % \begin{macrocode}
1228 \caption@CheckCommand\@caption{%
1229 % rlbabel.def [2005/03/30 v2.3h Right-to-Left support from the babel system Hebrew language support from the babel system]
1230 \long\def\@caption#1[#2]#3{%
1231 \par
1232 \addcontentsline{\csname ext@#1\endcsname}{#1}%
1233 {\protect\numberline{\csname the#1\endcsname}%
1234 {\ignorespaces #2}}%
1235 \def\@fignm{figure}
1236 \ifx#1\@fignm\addcontentsline{fol}{#1}%
1237 {\protect\numberline{\csname the#1\endcsname}%
1238 {\ignorespaces #2}}\fi%
1239 \def\@tblnm{table}
1240 \ifx#1\@tblnm\addcontentsline{tol}{#1}%
1241 {\protect\numberline{\csname the#1\endcsname}%
1242 {\ignorespaces #2}}\fi%
1243 \begingroup
1244 \@parboxrestore
1245 \if@minipage
1246 \@setminipage
1247 \fi
1248 \normalsize
1249 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
1250 \endgroup}}%
1251 % \end{macrocode}
1252 %
1253 % \begin{macrocode}
1254 \caption@CheckCommand\@caption{%
1255 % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system]
1256 \long\def\@caption#1[#2]#3{%
1257 \csname par\endcsname
1258 \addcontentsline{\csname ext@#1\endcsname}{#1}%
1259 {\protect\numberline{\csname the#1\endcsname.}{\ignorespaces #2}}%
1260 \begingroup
1261 \@parboxrestore
1262 \if@minipage
1263 \@setminipage
1264 \fi
1265 \normalsize
1266 \@makecaption{\csname fnum@#1\endcsname}%
1267 {\ignorespaces #3}\csname par\endcsname
1268 \endgroup}}%
1269 % \end{macrocode}
1270 %
1271 % \begin{macrocode}
1272 % \caption@CheckCommand\float@caption{%
1273 % % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
1274 % \long\def\float@caption#1[#2]#3{%
1275 % \addcontentsline{\@nameuse{ext@#1}}{#1}%
1276 % {\protect\numberline{\@nameuse{the#1}}{\ignorespaces #2}}
1277 % \global\setbox\@floatcapt\vbox\bgroup\@parboxrestore
1278 % \normalsize\@fs@capt{\@nameuse{fnum@#1}}{\ignorespaces #3}%
1279 % \@ifnextchar[{\float@ccon}{\egroup}}%
1280 % \long\def\float@ccon[#1]{#1\par\egroup}}%
1281 % \end{macrocode}
1282 %
1283 % \begin{macrocode}
1284 \caption@CheckCommand\@caption{%
1285 % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
1286 \long\def\@caption#1[#2]#3{%
1287 \hyper@makecurrent{\@captype}%
1288 \def\@currentlabelname{#2}%
1289 \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
1290 \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
1291 }%
1292 \begingroup
1293 \@parboxrestore
1294 \if@minipage
1295 \@setminipage
1296 \fi
1297 \normalsize
1298 \@makecaption{\csname fnum@#1\endcsname}{%
1299 \ignorespaces
1300 \ifHy@nesting
1301 \hyper@@anchor{\@currentHref}{#3}%
1302 \else
1303 \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
1304 \fi
1305 }%
1306 \par
1307 \endgroup
1308 }}%
1309 % \end{macrocode}
1310 % \begin{macrocode}
1311 \caption@CheckCommand\@caption{%
1312 % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
1313 % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
1314 % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
1315 \long\def\@caption#1[#2]#3{%
1316 \expandafter\ifx\csname if@capstart\expandafter\endcsname
1317 \csname iftrue\endcsname
1318 \global\let\@currentHref\hc@currentHref
1319 \else
1320 \hyper@makecurrent{\@captype}%
1321 \fi
1322 \def\@currentlabelname{#2}%
1323 \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
1324 \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
1325 }%
1326 \begingroup
1327 \@parboxrestore
1328 \if@minipage
1329 \@setminipage
1330 \fi
1331 \normalsize
1332 \expandafter\ifx\csname if@capstart\expandafter\endcsname
1333 \csname iftrue\endcsname
1334 \global\@capstartfalse
1335 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
1336 \else
1337 \@makecaption{\csname fnum@#1\endcsname}{%
1338 \ignorespaces
1339 \ifHy@nesting
1340 \hyper@@anchor{\@currentHref}{#3}%
1341 \else
1342 \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
1343 \fi
1344 }%
1345 \fi
1346 \par
1347 \endgroup
1348 }}%
1349 % \end{macrocode}
1350 % \begin{macrocode}
1351 \caption@CheckCommand\@caption{%
1352 % hyperref.sty [2009/11/27 v6.79k Hypertext links for LaTeX]
1353 \long\def\@caption#1[#2]#3{%
1354 \expandafter\ifx\csname if@capstart\expandafter\endcsname
1355 \csname iftrue\endcsname
1356 \global\let\@currentHref\hc@currentHref
1357 \else
1358 \hyper@makecurrent{\@captype}%
1359 \fi
1360 \def\@currentlabelname{#2}%
1361 \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
1362 \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
1363 }%
1364 \begingroup
1365 \@parboxrestore
1366 \if@minipage
1367 \@setminipage
1368 \fi
1369 \normalsize
1370 \expandafter\ifx\csname if@capstart\expandafter\endcsname
1371 \csname iftrue\endcsname
1372 \global\@capstartfalse
1373 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
1374 \else
1375 \@makecaption{\csname fnum@#1\endcsname}{%
1376 \ignorespaces
1377 \ifHy@nesting
1378 \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
1379 \else
1380 \Hy@raisedlink{%
1381 \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
1382 }%
1383 #3%
1384 \fi
1385 }%
1386 \fi
1387 \par
1388 \endgroup
1389 }}%
1390 % \end{macrocode}
1391 % \begin{macrocode}
1392 \caption@CheckCommand\@caption{%
1393 % hyperref.sty [2009/12/09 v6.79m Hypertext links for LaTeX]
1394 % hyperref.sty [2009/12/28 v6.79z Hypertext links for LaTeX]
1395 \long\def\@caption#1[#2]#3{%
1396 \expandafter\ifx\csname if@capstart\expandafter\endcsname
1397 \csname iftrue\endcsname
1398 \global\let\@currentHref\hc@currentHref
1399 \else
1400 \hyper@makecurrent{\@captype}%
1401 \fi
1402 \@ifundefined{NR@gettitle}{%
1403 \def\@currentlabelname{#2}%
1404 }{%
1405 \NR@gettitle{#2}%
1406 }%
1407 \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
1408 \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
1409 }%
1410 \begingroup
1411 \@parboxrestore
1412 \if@minipage
1413 \@setminipage
1414 \fi
1415 \normalsize
1416 \expandafter\ifx\csname if@capstart\expandafter\endcsname
1417 \csname iftrue\endcsname
1418 \global\@capstartfalse
1419 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
1420 \else
1421 \@makecaption{\csname fnum@#1\endcsname}{%
1422 \ignorespaces
1423 \ifHy@nesting
1424 \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
1425 \else
1426 \Hy@raisedlink{%
1427 \expandafter\hyper@@anchor\expandafter{%
1428 \@currentHref
1429 }{\relax}%
1430 }%
1431 #3%
1432 \fi
1433 }%
1434 \fi
1435 \par
1436 \endgroup
1437 }}%
1438 % \end{macrocode}
1439 %
1440 % \begin{macrocode}
1441 \caption@CheckCommand\@caption{%
1442 % nameref.sty [2006/12/27 v2.28 Cross-referencing by name of section]
1443 \long\def\@caption#1[#2]{%
1444 \def\@currentlabelname{#2}%
1445 \NR@@caption{#1}[{#2}]%
1446 }}%
1447 % \end{macrocode}
1448 % \begin{macrocode}
1449 \caption@CheckCommand\@caption{%
1450 % nameref.sty [2009/11/27 v2.32 Cross-referencing by name of section]
1451 \long\def\@caption#1[#2]{%
1452 \NR@gettitle{#2}%
1453 \NR@@caption{#1}[{#2}]%
1454 }}%
1455 % \end{macrocode}
1456 %
1457 % \begin{macrocode}
1458 \caption@CheckCommand\@caption{%
1459 % subfigure.sty [2002/07/30 v2.1.4 subfigure package]
1460 \long\def\@caption#1[#2]#3{%
1461 \@ifundefined{if#1topcap}%
1462 {\subfig@oldcaption{#1}[{#2}]{#3}}%
1463 {\@nameuse{if#1topcap}%
1464 \@listsubcaptions{#1}%
1465 \subfig@oldcaption{#1}[{#2}]{#3}%
1466 \else
1467 \subfig@oldcaption{#1}[{#2}]{#3}%
1468 \@listsubcaptions{#1}%
1469 \fi}}}%
1470 % \end{macrocode}
1471 %
1472 % \begin{macrocode}
1473 \caption@CheckCommand\@caption{%
1474 % subfig.sty [2005/06/28 ver: 1.3 subfig package]
1475 \def\@caption{\caption@}%
1476 % \long\def\caption@#1[#2]#3{%
1477 % \@ifundefined{caption@setfloattype}%
1478 % \caption@settype
1479 % \caption@setfloattype
1480 % \@captype
1481 % \sf@ifpositiontop{%
1482 % \@listsubcaptions{#1}%
1483 % \sf@old@caption{#1}[{#2}]{#3}%
1484 % }{%
1485 % \sf@old@caption{#1}[{#2}]{#3}%
1486 % \@listsubcaptions{#1}%
1487 % }}%
1488 }%
1489 % \end{macrocode}
1490 %
1491 % \begin{macrocode}
1492 \caption@CheckCommand\@caption{%
1493 % chkfloat.sty [2012/08/19 v0.1 chkfloat: check for moved floats]
1494 \def\@caption#1[#2]#3{\chkfloat@caption{#1}[#2]{#3}%
1495 \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}%
1496 }}%
1497 % \end{macrocode}
1498 % \begin{macrocode}
1499 \caption@CheckCommand\@caption{%
1500 % chkfloat.sty [20??/??/?? v0.? chkfloat: check for moved floats]
1501 \def\@caption#1[#2]#3{\chkfloat@caption{#1}[{#2}]{#3}%
1502 \chkfloat@addcontentsline{#1}{#2}%
1503 }}%
1504 % \end{macrocode}
1505 %
1506 % \begin{macrocode}
1507 \caption@IfCheckCommand{}{%
1508 \caption@InfoNoLine{%
1509 Incompatible package detected (regarding \string\@caption).\MessageBreak
1510 \string\@caption\space=\space\meaning\@caption}%
1511 \caption@setbool{incompatible}{1}}%
1512 % \end{macrocode}
1513 %
1514 % The option |compatibility=| will override the compatibility mode.
1515 % \begin{macrocode}
1516 \caption@ifundefined\caption@ifcompatibility
1517 {\let\caption@ifcompatibility\caption@ifincompatible
1518 \let\caption@tempa\caption@WarningNoLine}%
1519 {\let\caption@tempa\@gobble}% suppress warning
1520 % \end{macrocode}
1521 %
1522 % \begin{macrocode}
1523 \caption@ifcompatibility{%
1524 % \end{macrocode}
1525 %
1526 % \begin{macrocode}
1527 \caption@tempa{%
1528 \noexpand\caption will not be redefined since it's already\MessageBreak
1529 redefined by a document class or package which is\MessageBreak
1530 unknown to the caption package}%
1531 % \end{macrocode}
1532 %
1533 % \begin{macrocode}
1534 \renewcommand*\caption@redefine{}%
1535 % \end{macrocode}
1536 %
1537 % |\ContinuedFloat| is not supported in compatibility mode.
1538 % \begin{macrocode}
1539 \renewcommand*\caption@ContinuedFloatX[1]{%
1540 \caption@Error{Not available in compatibility mode}}%
1541 % \end{macrocode}
1542 %
1543 % |\caption@start| is not supported in compatibility mode.
1544 % \begin{macrocode}
1545 \caption@AtBeginDocument*{%
1546 \let\caption@start\relax
1547 \caption@ifundefined\caption@ORI@capstart{}{%
1548 \caption@Debug{%
1549 Restore hypcap definition of \string\capstart\@gobble}%
1550 \let\capstart\caption@ORI@capstart}%
1551 }%
1552 % \end{macrocode}
1553 %
1554 % \begin{macro}{\caption@star}
1555 % We redefine |\caption@star| here so it does not make any harm.
1556 % \begin{macrocode}
1557 \renewcommand*\caption@star[2]{#1#2}%
1558 % \end{macrocode}
1559 % \end{macro}
1560 %
1561 % \begin{macrocode}
1562 }{%
1563 % \end{macrocode}
1564 %
1565 % \begin{macrocode}
1566 \caption@ifincompatible{%
1567 \caption@WarningNoLine{%
1568 Forced redefinition of \noexpand\caption since the\MessageBreak
1569 unsupported(!) package option `compatibility=false'\MessageBreak
1570 was given}%
1571 }{}%
1572 % \end{macrocode}
1573 %
1574 % \begin{macro}{\caption}
1575 % \begin{macro}{\@caption}
1576 % \begin{macrocode}
1577 \renewcommand*\caption@redefine{%
1578 \let\caption\caption@caption
1579 \let\@caption\caption@@caption}%
1580 \caption@redefine
1581 % \end{macrocode}
1582 % \end{macro}
1583 % \end{macro}
1584 %
1585 % \begin{macrocode}
1586 }%
1587 % \end{macrocode}
1588 % \begin{macrocode}
1589 \caption@AtBeginDocument*{%
1590 \let\caption@ORI@capstart\@undefined}%
1591 % \end{macrocode}
1592 %
1593 % \begin{macro}{\@xfloat}
1594 % \changes{v3.1}{2007/05/09}{This re-definition added}
1595 % \changes{v3.1b}{2007/09/22}{Will now be redefined in compatibility mode, too}
1596 % We redefine |\@xfloat| so inside floating environments our
1597 % type-specific options will be used, a \package{hyperref}
1598 % anchor will be set etc.
1599 % \begin{macrocode}
1600 \let\caption@ORI@xfloat\@xfloat
1601 \def\@xfloat#1[#2]{%
1602 \caption@ORI@xfloat{#1}[#2]%
1603 \caption@settype{#1}}%
1604 % \end{macrocode}
1605 % \end{macro}
1606 %
1607 % \begin{macrocode}
1608 }
1609 % \end{macrocode}
1610 % \end{macro}
1611 %
1612 % Some packages (like the \package{hyperref} package for example) redefines
1613 % |\caption| and |\@caption|, too.
1614 % So we have to use |\AtBeginDocument| here, so we can make sure
1615 % our definition is the one which will be valid at last.
1616 % \begin{macrocode}
1617 \caption@AtBeginDocument{\caption@redefine}
1618 % \end{macrocode}
1619 %
1620 % \begin{macro}{\@makecaption}
1621 % \begin{macrocode}
1622 \let\@makecaption\caption@makecaption
1623 % \end{macrocode}
1624 % \end{macro}
1625 %
1626 % \begin{macro}{\phantomcaption}
1627 % \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added}
1628 % |\phantomcaption|\par
1629 % Use this one for figures with subcaptions but without main caption.
1630 % \begin{macrocode}
1631 \newcommand\phantomcaption{%
1632 \caption@iftype
1633 {\caption@refstepcounter\@captype}%
1634 {\caption@Error{\noexpand\phantomcaption outside float}}}%
1635 % \end{macrocode}
1636 % \end{macro}
1637 %
1638 % \subsection{\cs{captionof}}
1639 %
1640 % \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
1641 % \changes{v3.1}{2007/06/25}{Option \opt{type*=} added}
1642 % \changes{v3.1f}{2007/11/16}{Option \opt{subtype} \& \opt{subtype*} added}
1643 % \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Option \opt{type=} uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
1644 %
1645 % \begin{macrocode}
1646 \caption@AtBeginDocument{%
1647 % \end{macrocode}
1648 % \begin{macrocode}
1649 \DeclareCaptionOption{type}{\setcaptiontype{#1}}%
1650 \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}%
1651 % \end{macrocode}
1652 % \begin{macrocode}
1653 \DeclareCaptionOptionNoValue{subtype}{\setcaptionsubtype\relax}%
1654 \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}%
1655 % \end{macrocode}
1656 % \begin{macrocode}
1657 }
1658 % \end{macrocode}
1659 %
1660 % \emph{Important Note:}
1661 % Like |\captionof| the option |type=| should only be used inside a
1662 % group, box, or environment and does not check if the argument is a valid
1663 % floating environment or not.
1664 %
1665 % \begin{macro}{\setcaptiontype}
1666 % \changes{v3.2}{2010/10/24}{This macro added}
1667 % Like |\captionsetup{type=xxx}|, but also works if \cs{captionsetup} was redefined.
1668 % \begin{macrocode}
1669 \newcommand\setcaptiontype{%
1670 \caption@boxrestore@mini
1671 \caption@settype}
1672 % \end{macrocode}
1673 % \end{macro}
1674 %
1675 % \begin{macro}{\setcaptionsubtype}
1676 % \changes{v3.2a}{2011/08/15}{This macro added}
1677 % Same, but sets the sub-type.
1678 % \begin{macrocode}
1679 \newcommand\setcaptionsubtype{%
1680 \caption@iftype
1681 \caption@setsubtype
1682 {\caption@Error{\noexpand\setcaptionsubtype outside float}}}%
1683 % \end{macrocode}
1684 % \begin{macrocode}
1685 \newcommand\caption@setsubtype{%
1686 \@ifstar
1687 {\caption@@settype{sub}*{sub\@captype}}%
1688 {\caption@@settype{sub}{sub\@captype}}}%
1689 % \end{macrocode}
1690 % \end{macro}
1691 %
1692 % \begin{macro}{\caption@settype}
1693 % \changes{v3.1}{2007/05/09}{This macro added}
1694 % \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added}
1695 % \changes{v3.1d}{2007/10/23}{Error message for \cs{caption@checkgrouplevel} revised}
1696 % \changes{v3.1f}{2007/11/16}{\cs{caption@setsubtype} added}
1697 % \changes{v3.1f}{2007/12/03}{Crappy \cs{caption@iftypewarning} replaced}
1698 % \changes{v3.1g}{2008/01/12}{Usage of \cs{ifcaptionsetup@star} added}
1699 % \changes{v3.2}{2010/10/26}{Error message moved from here to \cs{caption@refstepcounter}}
1700 % \changes{v3.3}{2011/12/28}{Resetting of \cs{ifcaption@caption} and \cs{ifcaption@subcaption} added}
1701 % |\caption@settype*|\marg{type}\par
1702 % sets |\@captype| and executes the options associated with it
1703 % (using |\caption@set|\-|options|).
1704 % Furthermore we check |\current|\-|group|\-|level| (if avail),
1705 % redefine |\@currentlabel| so a |\label| before |\caption| will result
1706 % in a hint instead of a wrong reference, and
1707 % use the macro |\caption@|(|sub|)|type|\-|hook| (which will be used by our
1708 % \package{float} package support).\par
1709 % The non-starred version sets a \package{hyperref} anchor additionally
1710 % (if |hypcap=|\-|true| and the \package{hypcap} package is not loaded).
1711 % \begin{macrocode}
1712 \newcommand*\caption@settype{%
1713 \caption@clrflags
1714 \caption@set@type}
1715 % \end{macrocode}
1716 % \begin{macrocode}
1717 \newcommand*\caption@set@type{%
1718 \caption@@settype{}}
1719 % \end{macrocode}
1720 % \begin{macrocode}
1721 \newcommand*\caption@@settype[1]{%
1722 \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo}
1723 % \end{macrocode}
1724 % \begin{macrocode}
1725 \newcommand*\caption@@@settype[3]{%
1726 % #1 = "" or "sub"
1727 % #2 = \@firstoftwo in star form, \@secondoftwo otherwise
1728 % #3 = <type>, e.g. "figure" or "table"
1729 \caption@Debug{#1type=#3}%
1730 \caption@checkgrouplevel{#1}{%
1731 \captionsetup{#1type#2*\@empty=...}#2{ or
1732 \@backslashchar#1captionof}{}}%
1733 % \end{macrocode}
1734 % \begin{macrocode}
1735 \edef\caption@tempa{#3}%
1736 \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else
1737 \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi
1738 \fi
1739 \expandafter\let\csname @#1captype\endcsname\caption@tempa
1740 % \end{macrocode}
1741 % \begin{macrocode}
1742 \@nameuse{caption@#1typehook}%
1743 % \end{macrocode}
1744 % \begin{macrocode}
1745 \caption@setoptions{#3}%
1746 \ifx\caption@opt\relax
1747 \@nameundef{caption@#1type@warning}%
1748 \else
1749 \@namedef{caption@#1type@warning}{\caption@Warning{%
1750 The #1caption type was already set to
1751 `\csname @#1captype\endcsname'\MessageBreak}}%
1752 \fi
1753 % \end{macrocode}
1754 % \begin{macrocode}
1755 #2{}{%
1756 \let\@currentlabel\caption@undefinedlabel
1757 % \let\@currentHlabel\@undefined
1758 \ifx\caption@x@label\@undefined
1759 \let\caption@x@label\label
1760 \let\label\caption@xlabel
1761 \fi
1762 \caption@start}}
1763 % \end{macrocode}
1764 % \end{macro}
1765 %
1766 % \begin{macro}{\caption@typehook}
1767 % Hook which will be used inside |\caption@set|\-|type|.
1768 % It will be extended later on, e.g.~by our \package{float} package
1769 % support.
1770 % \begin{macrocode}
1771 \newcommand*\caption@typehook{}
1772 % \end{macrocode}
1773 % \end{macro}
1774 %
1775 % \begin{macro}{\caption@iftype}
1776 % \changes{v3.1}{2007/04/11}{This macro and its usage added}
1777 % Since we often need to check if |\@captype| is defined (means: we
1778 % are inside a floating environment) this helper macro was introduced.
1779 % \begin{macrocode}
1780 \newcommand*\caption@iftype{%
1781 \caption@ifundefined\@captype\@secondoftwo\@firstoftwo}
1782 % \end{macrocode}
1783 % \end{macro}
1784 %
1785 % \begin{macro}{\caption@checkgrouplevel}
1786 % \changes{v3.1}{2007/07/15}{This macro and its usage added}
1787 % \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)}
1788 % \changes{v3.3}{2013/04/21}{Uses \cs{caption@ifeTeX} now}
1789 % Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done
1790 % inside a group or not -- in the latter case a warning message will
1791 % be issued. (needs \eTeX)
1792 % \begin{macrocode}
1793 \caption@ifeTeX{%
1794 \newcommand*\caption@checkgrouplevel[2]{%
1795 \@ifundefined{#1caption@grouplevel}{%
1796 \caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}%
1797 \ifnum\currentgrouplevel>\caption@grouplevel\relax
1798 \expandafter\edef\csname #1caption@grouplevel\endcsname{%
1799 \the\currentgrouplevel}%
1800 \else
1801 \caption@Warning{\string#2\MessageBreak outside box or environment}%
1802 \fi
1803 }{}}%
1804 }{%
1805 \let\caption@checkgrouplevel\@gobbletwo
1806 }
1807 % \end{macrocode}
1808 % \end{macro}
1809 %
1810 % \begin{macro}{\caption@undefinedlabel}
1811 % \changes{v3.1}{2007/07/03}{This macro and its usage added}
1812 % \changes{v3.1b}{2007/09/22}{Contents changed to \texttt{??}}
1813 % \changes{v3.1i}{2008/04/13}{Contents changed to \cs{caption@xref}(\ldots)}
1814 % \changes{v3.1k}{2009/03/30}{Bugfix 08-12-08: \cs{caption@xref} is robust now}
1815 % \changes{v3.2c}{2011/09/13}{Text changed from `before' to `without proper'}
1816 % \changes{v3.3}{2016/02/21}{Text changed from `without proper \cs{caption}' to `without proper reference'}
1817 % This label will be used for |\currentlabel| inside (floating) environments
1818 % as default. (see above)
1819 % \iffalse\Note{All commands used have to be robust here.}\fi
1820 % \begin{macrocode}
1821 \newcommand*\caption@undefinedlabel{%
1822 \protect\caption@xref{\caption@labelname}{\on@line}}
1823 % \end{macrocode}
1824 % \begin{macrocode}
1825 \DeclareRobustCommand*\caption@xref[2]{%
1826 \caption@WarningNoLine{\noexpand\label without proper reference#2}%
1827 \@setref\relax\@undefined{#1}}
1828 % \end{macrocode}
1829 % \begin{macrocode}
1830 \newcommand*\caption@labelname{??}
1831 % \end{macrocode}
1832 % \end{macro}
1833 % \begin{macro}{\caption@xlabel}
1834 % \changes{v3.1b}{2007/09/22}{This macro and its usage added}
1835 % \changes{v3.1f}{2007/11/11}{Revised}
1836 % \changes{v3.1i}{2008/04/13}{Bugfix: \cs{pageref} should always work now}
1837 % \changes{v3.2c}{2011/08/19}{Works with optional arguments now, too}
1838 % The new code of |\label| inside floating environments.
1839 % |\label| will be redefined using |\caption@withoptargs|, so
1840 % |#1| are the optional arguments (if any), and
1841 % |#2| is the mandatory argument here.
1842 % \begin{macrocode}
1843 \newcommand*\caption@xlabel{%
1844 \caption@withoptargs\caption@@xlabel}
1845 % \end{macrocode}
1846 % \begin{macrocode}
1847 \newcommand*\caption@@xlabel[2]{%
1848 \caption@@@xlabel
1849 \def\caption@labelname{#2}%
1850 \caption@x@label#1{#2}}
1851 % \end{macrocode}
1852 % \begin{macrocode}
1853 \newcommand*\caption@@@xlabel{%
1854 \global\let\caption@@@xlabel\@empty
1855 \@bsphack
1856 \protected@write\@auxout{}%
1857 {\string\providecommand*\string\caption@xref[2]{%
1858 \string\@setref\string\relax\string\@undefined{\string##1}}}%
1859 \@esphack}
1860 % \end{macrocode}
1861 % \end{macro}
1862 %
1863 % \begin{macro}{\captionof}
1864 % \changes{v3.1}{2007/05/09}{Uses \cs{caption@settype} instead of \cs{def}\cs{@captype}}
1865 % \changes{v3.1c}{2007/09/22}{Bugfix: Redefinition of \cs{caption@setfloatcapt} removed}
1866 % \changes{v3.1e}{2007/10/30}{Better compatibility: Will be defined with \cs{AtBeginDocument} now}
1867 % \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
1868 % |\captionof|\marg{type}\oarg{lst\_entry}\marg{heading}\\
1869 % |\captionof*|\oarg{lst\_entry}\marg{heading}\par
1870 % \Note{This will be defined with \cs{AtBeginDocument} so
1871 % \cs{usepackage}\csmarg{caption,capt-of} will still work.
1872 % (Compatibility to \version{1.x})}
1873 % \begin{macrocode}
1874 \caption@AtBeginDocument{%
1875 \def\captionof{\caption@teststar\caption@of{\caption*}\caption}}
1876 % \end{macrocode}
1877 % \begin{macrocode}
1878 \newcommand*\caption@of[2]{\setcaptiontype*{#2}#1}
1879 % \end{macrocode}
1880 % \end{macro}
1881 %
1882 % \subsection{\cs{captionlistentry}}
1883 %
1884 % \begin{macro}{\captionlistentry}
1885 % \changes{v3.1}{2007/07/28}{This macro added}
1886 % \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
1887 % \changes{v3.1g}{2008/01/20}{Starred variant added}
1888 % \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
1889 % |\captionlistentry|\oarg{float type}\marg{list entry}\\
1890 % |\captionlistentry*|\oarg{float type}\marg{list entry}
1891 % \begin{macrocode}
1892 \newcommand*\captionlistentry{%
1893 \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo}
1894 % \end{macrocode}
1895 % \begin{macrocode}
1896 \newcommand*\@captionlistentry[1]{%
1897 \@testopt{\caption@listentry{#1}}\@captype}
1898 % \end{macrocode}
1899 % \begin{macrocode}
1900 \def\caption@listentry#1[#2]#3{%
1901 \@bsphack
1902 #1{\caption@gettitle{#3}}%
1903 {\caption@refstepcounter{#2}%
1904 \caption@makecurrent{#2}{#3}}%
1905 \caption@addcontentsline{#2}{#3}%
1906 \@esphack}
1907 % \end{macrocode}
1908 % \end{macro}
1909 %
1910 % \subsection{\cs{captionbox}}
1911 %
1912 % \begin{macro}{\captionbox}
1913 % \changes{v3.2}{2010/12/17}{This macro added}
1914 % \changes{v3.2a}{2011/08/16}{\cs{captionsetup} replaces with \cs{captionbox@settype} and \cs{caption@setposition}}
1915 % \changes{v3.3}{2012/04/09}{Adapted to revised version of \cs{caption@withoptargs}}
1916 % \changes{v3.3}{2017/03/19}{When used with fixed witdh the content will not be hboxed anymore}
1917 % \changes{v3.3c}{2019/09/01}{Adapted so it could be used by \cs{subfloat} offered by \package{subcaption}}
1918 % A |\parbox| with contents and caption, separated by an invisible |\hrule|.
1919 % \begin{macrocode}
1920 \newcommand*\captionbox{%
1921 \caption@withoptargs{\caption@ibox\@gobble}}
1922 % \end{macrocode}
1923 % \begin{macrocode}
1924 \newcommand\caption@ibox[3]{%
1925 \kernel@ifnextchar[%]
1926 {\caption@iibox{#1}{#2}{#3}}%
1927 {\caption@iibox@{#1}{#2}{#3}}}
1928 % \end{macrocode}
1929 % \begin{macrocode}
1930 \long\def\caption@iibox#1#2#3[#4]{%
1931 \@testopt{\caption@iiibox{#1}{#2}{#3}[{#4}]}\captionbox@hj@default}
1932 % \end{macrocode}
1933 % \begin{macrocode}
1934 \long\def\caption@iibox@#1#2#3#4{%
1935 \setbox\@tempboxa\hbox{#4}%
1936 \caption@iiibox{#1}{#2}{#3}[\wd\@tempboxa][\captionbox@hj@default]{\unhbox\@tempboxa}}
1937 % \end{macrocode}
1938 % \begin{macrocode}
1939 \long\def\caption@iiibox#1{%
1940 \caption@iiiibox{#1}\vbox\vtop}
1941 % \end{macrocode}
1942 % \begin{macrocode}
1943 \long\def\caption@iiiibox#1#2#3#4#5[#6][#7]#8{%
1944 \begingroup
1945 #1*% set \caption@position
1946 \caption@iftop{%
1947 \endgroup
1948 \parbox[t]{#6}{%
1949 #1\relax
1950 \caption@setposition t%
1951 #2{\caption#4{#5}}%
1952 \captionbox@hrule
1953 \csname caption@hj@#7\endcsname
1954 #8}%
1955 }{%
1956 \endgroup
1957 \parbox[b]{#6}{%
1958 #1\relax
1959 \caption@setposition b%
1960 \csname caption@hj@#7\endcsname
1961 #8%
1962 \captionbox@hrule
1963 #3{\caption#4{#5}}}%
1964 }}
1965 % \end{macrocode}
1966 % \begin{macrocode}
1967 \newcommand*\captionbox@hj@default{c}
1968 \newcommand*\captionbox@hrule{\hrule\@height\z@\relax}
1969 % \end{macrocode}
1970 % \begin{macrocode}
1971 \providecommand*\caption@hj@c{\centering}
1972 \providecommand*\caption@hj@l{\raggedright}
1973 \providecommand*\caption@hj@r{\raggedleft}
1974 \providecommand*\caption@hj@s{}
1975 % \end{macrocode}
1976 % \end{macro}
1977 %
1978 % \subsection{\cs{ContinuedFloat}}
1979 %
1980 % \begin{macro}{\ContinuedFloat}
1981 % \changes{v3.0i}{2005/11/12}{Optional argument added}
1982 % \changes{v3.0g}{2005/06/28}{Bugfix: \cs{newcounter} replaced by \cs{newcount}}
1983 % \changes{v3.1}{2007/07/02}{Format of \package{hyperref} extension changed}
1984 % \changes{v3.1}{2007/07/07}{\cs{caption@setoptions} added}
1985 % \changes{v3.1g}{2008/01/29}{Starred variant added}
1986 % \changes{v3.2f}{2011/12/17}{Undocumented optional argument removed}
1987 % \changes{v3.3}{2011/12/28}{Uses \cs{ifcaption@ContinuedFloat} now}
1988 % \changes{v3.3}{2013/05/01}{Usage of \cs{caption@restorecounters} added}
1989 % \changes{v3.3}{2013/12/16}{Bugfix: Does not use \cs{caption@ContinuedFloat} anymore since this breaks \cs{ContinuedFloat} offered by the \package{subfig} package}
1990 % |\ContinuedFloat|\\
1991 % |\ContinuedFloat*|\par
1992 % This mainly sets the appropriate flag, increments the
1993 % continuation counter, and executes the given options.
1994 % Furthermore we set |\caption@reset|\-|Continued|\-|Float| to |\@gobble| so the
1995 % continuation counter will not be reset to zero inside |\caption@ref|\-|step|\-|counter|.\par
1996 % When the \package{hyperref} package is used we have the problem
1997 % that the usage of |\Continued|\-|Float| will create duplicate
1998 % hyper links -- |\@current|\-|Href| will be the same for the main float and
1999 % the continued ones. So we have to make sure unique labels and references
2000 % will be created each time. We do this by extending |\the|\-|H|\-|figure| and
2001 % |\the|\-|H|\-|table|, so for continued floats the scheme
2002 % \begin{quote}\meta{type}|.|\meta{type \#}|\alph{|\meta{continued \#}|}|\end{quote}
2003 % will be used instead of
2004 % \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
2005 % \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
2006 % \Note{This does not help if the \package{hyperref} package option
2007 % \texttt{naturalnames=true} is set.}
2008 % \begin{macrocode}
2009 \def\ContinuedFloat{%
2010 \caption@iftype
2011 {\caption@ContinuedFloatX\@captype}%
2012 {\caption@Error{\noexpand\ContinuedFloat outside float}}}
2013 % \end{macrocode}
2014 % \begin{macrocode}
2015 \newcommand*\caption@ContinuedFloatX[1]{%
2016 \@ifstar
2017 {\caption@@refstepcounter\@captype
2018 \caption@@ContinuedFloat{#1}}%
2019 {\caption@Continued@Float{#1}}}
2020 % \end{macrocode}
2021 % \begin{macrocode}
2022 \newcommand*\caption@Continued@Float[1]{%
2023 \edef\caption@tempa{#1}%
2024 \ifx\caption@tempa\caption@CFtype
2025 \caption@restorecounters
2026 \caption@@ContinuedFloat{#1}%
2027 \else
2028 \caption@Error{Continued `#1' after `\caption@CFtype'}%
2029 \fi}
2030 % \end{macrocode}
2031 % \begin{macrocode}
2032 \newcommand*\caption@@ContinuedFloat{%
2033 \caption@setflag1% ContinuedFloat
2034 \caption@@@ContinuedFloat}
2035 \newcommand*\caption@@@ContinuedFloat{%
2036 \stepcounter{ContinuedFloat}%
2037 \caption@@@@ContinuedFloat}
2038 % \end{macrocode}
2039 % \begin{macrocode}
2040 \newcommand*\caption@@@@ContinuedFloat[1]{%
2041 \caption@setoptions{ContinuedFloat}%
2042 \caption@setoptions{continued#1}%
2043 \expandafter\l@addto@macro\csname the#1\endcsname\theContinuedFloat
2044 \@ifundefined{theH#1}{}{%
2045 \expandafter\l@addto@macro\csname theH#1\endcsname{%
2046 \@alph\c@ContinuedFloat}}%
2047 \let\caption@@@@ContinuedFloat\@gobble}
2048 % \end{macrocode}
2049 % \begin{macrocode}
2050 \newcommand*\caption@CFtype{??}
2051 % \end{macrocode}
2052 % \end{macro}
2053 %
2054 % \begin{macro}{\theContinuedFloat}
2055 % This one is preset to \cs{@empty}, so usually the continuation counter is not
2056 % included in the caption label or references.
2057 % \begin{macrocode}
2058 \newcounter{ContinuedFloat}
2059 \let\theContinuedFloat\@empty
2060 % \end{macrocode}
2061 % \end{macro}
2062 %
2063 % \begin{macro}{\caption@ContinuedFloat}
2064 % \changes{v3.0f}{2005/06/11}{This macro added}
2065 % \changes{v3.3}{2013/12/16}{Bugfix: Revised and defined with \cs{def} instead of \cs{newcommand}}
2066 % |\caption@ContinuedFloat|\marg{type}\par
2067 % This one is used by \cs{ContinuedFloat} offered by the \package{subfig} package.
2068 % \begin{macrocode}
2069 \def\caption@ContinuedFloat{%
2070 \let\caption@resetContinuedFloat\@gobble
2071 \caption@@@ContinuedFloat}
2072 % \end{macrocode}
2073 % \end{macro}
2074 %
2075 % \begin{macro}{\caption@resetContinuedFloat}
2076 % \changes{v3.2f}{2011/12/17}{Redefinition of \cs{ContinuedFloat} added}
2077 % |\caption@resetContinuedFloat|\marg{type}\par
2078 % If a continuation counter is defined, we reset it.
2079 % (This one will be called inside |\@caption|.)
2080 % \begin{macrocode}
2081 \newcommand*\caption@resetContinuedFloat[1]{%
2082 \xdef\caption@CFtype{#1}%
2083 \@stpelt{ContinuedFloat}}
2084 % \end{macrocode}
2085 % \end{macro}
2086 %
2087 % \begin{macro}{\donemaincaptionfalse}
2088 % Since the \class{memoir} document class resets the sub-caption
2089 % counter at |\@float|, right after |\done|\-|main|\-|caption|\-|false|,
2090 % we save all sub-caption counters at |\done|\-|main|\-|caption|\-|false|
2091 % so we can restore them using |\caption@restore|\-|counters|
2092 % inside |\Continued|\-|Float|.
2093 % \begin{macrocode}
2094 \caption@ifundefined\donemaincaptionfalse{}{%
2095 \g@addto@macro\donemaincaptionfalse\caption@savesubcounters}
2096 % \end{macrocode}
2097 % \end{macro}
2098 %
2099 % \subsection{Internal helpers}
2100 %
2101 % \begin{macro}{\caption@refstepcounter}
2102 % \changes{v3.1}{2007/07/28}{This macro added}
2103 % \changes{v3.2}{2010/10/26}{Error message moved from \cs{caption@@@settype} to here}
2104 % \changes{v3.2c}{2011/09/04}{Support of \cs{donemaincaptiontrue} from \textsf{memoir} document class added}
2105 % \changes{v3.3}{2011/12/28}{Usage of \cs{ifcaption@caption}, \cs{ifcaption@subcaption}, and \cs{ifcaption@ContinuedFloat} added}
2106 % Increments the float (i.e. |figure| or |table|) counter,
2107 % resets the continuation counter, and redefines itself to |\@gobble|.
2108 % \begin{macrocode}
2109 \newcommand*\caption@refstepcounter[1]{%
2110 \@ifundefined{c@#1}%
2111 {\caption@Error{No float type '#1' defined}}%
2112 {\caption@ref@stepcounter{#1}%
2113 % \end{macrocode}
2114 % Set flag if this part of the figure (or table) contains a caption now.
2115 % (If |\caption@if|\-|top| is not set, |\caption| is at the bottom of this part,
2116 % therefore ending this part, so we set the flag to |false| in this case.)
2117 % \begin{macrocode}
2118 \caption@fixposition
2119 \caption@iftop\caption@setflag\caption@clrflag2% caption
2120 % \end{macrocode}
2121 % This part does not contain content (like sub-figures) yet,
2122 % so we set |\if|\-|caption@sub|\-|caption| to |false|.
2123 % \begin{macrocode}
2124 \caption@clrflag4% subcaption
2125 % \end{macrocode}
2126 % Support of the \textsf{memoir} document class.
2127 % \begin{macrocode}
2128 \@nameuse{donemaincaptiontrue}}}
2129 % \end{macrocode}
2130 % \begin{macrocode}
2131 \newcommand*\caption@ref@stepcounter{%
2132 \caption@ifflag1{% ContinuedFloat
2133 \let\caption@tempa\caption@@refcounter
2134 \caption@clrflag1% ContinuedFloat
2135 }{%
2136 \let\caption@tempa\caption@@refstepcounter
2137 \caption@ifflag2{}{% caption
2138 \caption@ifflag4{% subcaption
2139 % Counter was already incremented by content, so we suppress \stepcounter{#1} here
2140 \let\caption@tempa\caption@@refcounter
2141 }{}%
2142 }%
2143 }%
2144 \caption@tempa}
2145 % \end{macrocode}
2146 % \begin{macrocode}
2147 \newcommand*\caption@@refcounter[1]{%
2148 \let\caption@stepcounter@ORI\stepcounter
2149 \def\stepcounter##1{%
2150 \def\caption@tempa{#1}%
2151 \def\caption@tempb{##1}%
2152 \ifx\caption@tempa\caption@tempb \else
2153 \caption@stepcounter@ORI{##1}%
2154 \fi}%
2155 \caption@@@refstepcounter{#1}%
2156 \let\stepcounter\caption@stepcounter@ORI}
2157 % \end{macrocode}
2158 % \begin{macrocode}
2159 \newcommand*\caption@@refstepcounter[1]{%
2160 \caption@prepare@stepcounter{#1}{ref}%
2161 \caption@@@refstepcounter{#1}}
2162 % \end{macrocode}
2163 % \begin{macrocode}
2164 \newcommand*\caption@@stepcounter[1]{%
2165 \caption@prepare@stepcounter{#1}{}%
2166 \caption@@@stepcounter{#1}}
2167 % \end{macrocode}
2168 % \begin{macrocode}
2169 \newcommand*\caption@prepare@stepcounter[2]{%
2170 \caption@addsubcontentslines{#2stepcounter}%
2171 \caption@resetContinuedFloat{#1}}
2172 % \end{macrocode}
2173 % \begin{macrocode}
2174 \newcommand*\caption@@@refstepcounter{\refstepcounter}
2175 % \end{macrocode}
2176 % \begin{macrocode}
2177 \newcommand*\caption@@@stepcounter{\stepcounter}
2178 % \end{macrocode}
2179 % \end{macro}
2180 %
2181 % \begin{macro}{\caption@dblarg}
2182 % \changes{v3.1}{2007/02/05}{This macro added}
2183 % \changes{v3.1f}{2007/12/06}{Bugfix 07-12-06: Changed so it works without \cs{kernel@ifnextchar}
2184 % (which was introduced in \LaTeXe\ 2004/01/23), too}
2185 % \changes{v3.3}{2012/03/25}{Support of option \opt{list-entry} added}
2186 % A |\relax| was added compared to |\@dblarg| so |\caption{}| will be
2187 % expanded to |\caption[\relax]{}| (and not to |\caption[]{}|).
2188 % Furthermore support for option \opt{list-entry} was added.
2189 % \begin{macrocode}
2190 \@ifundefined{kernel@ifnextchar}{\let\kernel@ifnextchar\@ifnextchar}{}
2191 % \end{macrocode}
2192 % \begin{macrocode}
2193 \newcommand\caption@dblarg[1]{%
2194 \kernel@ifnextchar[{\caption@ydblarg{#1}}{\caption@xdblarg{#1}}}
2195 % \end{macrocode}
2196 % \begin{macrocode}
2197 \newcommand\caption@xdblarg[2]{%
2198 #1[{#2\relax}]{#2}}
2199 % \end{macrocode}
2200 % \begin{macrocode}
2201 \long\def\caption@ydblarg#1[#2]#3{%
2202 \caption@iflistheading{#1[{#3}]{#3}}{#1[{#2}]{#3}}}
2203 % \end{macrocode}
2204 % \end{macro}
2205 %
2206 % \begin{macro}{\caption@begin}
2207 % \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed to \cs{caption@setfloattype}}
2208 % \changes{v3.0e}{2005/04/12}{Check for default label format added}
2209 % \changes{v3.0f}{2005/06/11}{Usage of \cs{caption@resetContinuedFloat} added}
2210 % \changes{v3.1}{2007/05/09}{Usage of \cs{caption@setfloattype} \&
2211 % \cs{caption@resetContinuedFloat} removed}
2212 % \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} removed}
2213 % Our handling of |\caption| will always be surrounded by
2214 % |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
2215 % |\caption@begin|\marg{type} performs these tasks:
2216 % \begin{enumerate}
2217 % \item[1.] Override the |position=| setting, if necessary.
2218 % (for example if set to |auto| or used inside a |supertabular|)
2219 % \item[2.] Start a new group.
2220 % \item[3.] Define |\fnum@|\meta{type} if the caption label format is set
2221 % to non-default.
2222 % \end{enumerate}
2223 % \begin{macrocode}
2224 \newcommand*\caption@begin[1]{%
2225 \caption@fixposition
2226 \begingroup
2227 \caption@setfnum{#1}}
2228 % \end{macrocode}
2229 % \end{macro}
2230 %
2231 % \begin{macro}{\caption@beginex}
2232 % \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
2233 % \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
2234 % \changes{v3.1}{2007/07/01}{Makes lst-entry now instead of redefining \cs{addcontentsline}}
2235 % \changes{v3.2}{2010/10/26}{Bugfix 09-05-15: Setting of \cs{lst@@caption} added}
2236 % |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par
2237 % performs the same tasks as |\caption@begin| and additionally:
2238 % \begin{enumerate}
2239 % \item[4.] Set |\lst@@caption|, so |\fnum@lstlisting| will include a numbering.
2240 % \item[5.] Make an entry in the list-of-whatever.
2241 % \item[6.] Set |\caption@ifempty| according argument \meta{heading}.
2242 % \end{enumerate}
2243 % \begin{macrocode}
2244 \newcommand\caption@beginex[3]{%
2245 \caption@begin{#1}%
2246 \let\lst@@caption\relax
2247 \caption@addcontentsline{#1}{#2}%
2248 \caption@ifempty{#3}{}}
2249 % \end{macrocode}
2250 % \end{macro}
2251 %
2252 % \begin{macro}{\caption@end}
2253 % \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} removed}
2254 % |\caption@end| closes the group.
2255 % \begin{macrocode}
2256 \newcommand*\caption@end{%
2257 \endgroup}
2258 % \end{macrocode}
2259 % \end{macro}
2260 %
2261 % \changes{v3.0a}{2004/01/23}{%
2262 % Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
2263 % \changes{v3.0h}{2005/10/06}{%
2264 % Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
2265 %
2266 % \begin{macro}{\caption@setfnum}
2267 % \changes{v3.1}{2007/03/10}{This macro added}
2268 % |\caption@setfnum|\marg{type}\\
2269 % redefines |\fnum@|\meta{type} according the caption label format
2270 % set with |labelformat=|. But if |labelformat=default| is set,
2271 % |\fnum@|\meta{type} will not be overwritten by us.
2272 % \begin{macrocode}
2273 \newcommand*\caption@setfnum[1]{%
2274 \@ifundefined{fnum@#1}{\iftrue}{\ifx\caption@lfmt\caption@lfmt@default\else}%
2275 \@namedef{fnum@#1}{\caption@fnum{#1}}%
2276 \fi}
2277 % \end{macrocode}
2278 % \end{macro}
2279 %
2280 % \begin{macro}{\caption@boxrestore}
2281 % \changes{v3.1}{2007/03/03}{This macro and its usage added}
2282 % \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added}
2283 % \changes{v3.2}{2010/11/07}{Support of option \opt{parboxrestore} added}
2284 % The original code (from |latex/base/ltboxes.dtx|):
2285 % \begin{verbatim}
2286 % \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}
2287 % \def\@arrayparboxrestore{%
2288 % \let\if@nobreak\iffalse
2289 % \let\if@noskipsec\iffalse
2290 % \let\par\@@par
2291 % \let\-\@dischyph
2292 % \let\'\@acci\let\`\@accii\let\=\@acciii
2293 % \parindent\z@ \parskip\z@skip
2294 % \everypar{}%
2295 % \linewidth\hsize
2296 % \@totalleftmargin\z@
2297 % \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
2298 % \parfillskip\@flushglue \lineskip\normallineskip
2299 % \baselineskip\normalbaselineskip
2300 % \sloppy}
2301 % \end{verbatim}%^^A
2302 % This one will be used by |\@caption| instead of |\@parboxrestore|.
2303 % \begin{macrocode}
2304 \newcommand*\caption@boxrestore{%
2305 \caption@parboxrestore{\@parboxrestore}{%
2306 \let\if@nobreak\iffalse
2307 \let\if@noskipsec\iffalse
2308 \let\par\@@par
2309 % \let\-\@dischyph
2310 % \let\'\@acci\let\`\@accii\let\=\@acciii
2311 \parindent\z@ \parskip\z@skip
2312 \everypar{}%
2313 % \linewidth\hsize
2314 % \@totalleftmargin\z@
2315 \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
2316 \parfillskip\@flushglue \lineskip\normallineskip
2317 \baselineskip\normalbaselineskip
2318 \sloppy
2319 \let\\\@normalcr
2320 }}
2321 % \end{macrocode}
2322 % \end{macro}
2323 %
2324 % \begin{macro}{\caption@boxrestore@mini}
2325 % \changes{v3.2}{2010/10/24}{This macro added}
2326 % Resets \cs{par} so the very first \cs{par} in \cs{@caption} behaves quite the same as in floating environments.
2327 % Will be used by \cs{setcaptiontype}.
2328 % \begin{macrocode}
2329 \newcommand\caption@boxrestore@mini{%
2330 \let\par\@@par
2331 \parindent\z@ \parskip\z@skip
2332 \sloppy}
2333 % \end{macrocode}
2334 % \end{macro}
2335 %
2336 % \begin{macro}{\caption@normalsize}
2337 % \changes{v3.1}{2007/05/05}{This macro and its usage added}
2338 % This one will be used by |\@caption| instead of |\normalsize|.\par
2339 % Its code is equivalent to
2340 % \begin{quote}
2341 % |\caption@font{normal}%|
2342 % \end{quote}
2343 % but executes faster (since the starred form of |\caption@font|
2344 % does not use |\setkeys| internally).
2345 % \begin{macrocode}
2346 \newcommand*\caption@normalsize{%
2347 \caption@font*{\KV@caption@fnt@normal\@unused}}
2348 % \end{macrocode}
2349 % \end{macro}
2350 %
2351 % \begin{macro}{\caption@setfloatcapt}
2352 % Needed for support of the \package{float} package, where the caption will
2353 % not be typeset directly, but catched in a |\vbox| called |\@floatcapt|
2354 % instead.
2355 % \begin{macrocode}
2356 \let\caption@setfloatcapt\@firstofone
2357 % \end{macrocode}
2358 % \end{macro}
2359 %
2360 % \begin{macro}{\caption@makecurrent}
2361 % This one is needed for support of the \package{nameref} and \package{hyperref} package.
2362 % \changes{v3.2f}{2012/01/14}{Bugfix: Usage of \cs{caption@gettitle} added}
2363 % \begin{macrocode}
2364 \newcommand*\caption@makecurrent[1]{\caption@gettitle}
2365 % \end{macrocode}
2366 % \end{macro}
2367 %
2368 % \begin{macro}{\caption@makeanchor}
2369 % \begin{macro}{\caption@start}
2370 % \begin{macro}{\caption@@start}
2371 % \begin{macro}{\caption@freezeHref}
2372 % \begin{macro}{\caption@defrostHref}
2373 % All these are needed for support of the \package{hyperref} package.
2374 % \begin{macrocode}
2375 \let\caption@makeanchor\@firstofone
2376 \let\caption@start\relax
2377 \let\caption@@start\relax
2378 \let\caption@freezeHref\relax
2379 \let\caption@defrostHref\relax
2380 % \end{macrocode}
2381 % \end{macro}
2382 % \end{macro}
2383 % \end{macro}
2384 % \end{macro}
2385 % \end{macro}
2386 %
2387 % \begin{macro}{\caption@gettitle}
2388 % \changes{v3.1l}{2010/01/09}{This macro and its usage added to adapt the definition of \cs{@currentlabelname} to recent versions of \package{nameref}}
2389 % \changes{v3.3f}{2023/08/05}{Support for older versions of \package{nameref} revised to make it compatible with \LaTeX\ 2023-06-01}
2390 % This one is needed for support of the \package{nameref} package.
2391 % \begin{macrocode}
2392 \newcommand\caption@gettitle[1]{%
2393 \caption@ifundefined\NR@gettitle
2394 {\caption@ifundefined\NR@sect{}{\def\@currentlabelname{#1}}}% support for older versions of nameref package
2395 {\NR@gettitle{#1}}} % support for recent versions of nameref package
2396 % \end{macrocode}
2397 % \end{macro}
2398 %
2399 % \subsection{Support for sub-captions}
2400 % \changes{v3.1f}{2007/11/16}{Support for sub-captions added}
2401 %
2402 % \begin{macro}{\caption@DeclareSubType}
2403 % |\caption@DeclareSub| initializes the usage of \cs{caption}
2404 % in sub-floats.
2405 % \begin{macrocode}
2406 \def\caption@DeclareSubType sub#1\@nil{%
2407 \caption@Debug{Initializing subtype for `#1'\@gobble}%
2408 \@namedef{caption@beginsub#1}{\caption@beginsubfloat{#1}}}
2409 \@onlypreamble\caption@DeclareSubType
2410 % \end{macrocode}
2411 % \end{macro}
2412 %
2413 % Initialize the sub-captions defined with \cs{DeclareCaptionSubType}\ldots
2414 % \begin{macrocode}
2415 \caption@For*{subtypelist}{\caption@DeclareSubType sub#1\@nil}
2416 % \end{macrocode}
2417 %
2418 % Initialize the sub-captions defined with \cs{newsubfloat}\cite{subfig}\ldots
2419 % \begin{macrocode}
2420 \caption@AtBeginDocument*{%
2421 \caption@ifundefined\sf@counterlist{}{%
2422 \@for\sf@temp:=\sf@counterlist\do{%
2423 \expandafter\caption@DeclareSubType\sf@temp\@nil}}}
2424 % \end{macrocode}
2425 %
2426 % \begin{macro}{\caption@subtypehook}
2427 % \changes{v3.1g}{2008/03/20}{Redefinition of \cs{caption@setlist} added}
2428 % \changes{v3.1k}{2009/10/09}{Bugfix 09-08-12b: \cs{@makecaption} will now be restored here, too}
2429 % \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
2430 % \changes{v3.2a}{2011/08/17}{Redefinition of \cs{phantomcaption} added}
2431 % \changes{v3.2a}{2011/08/17}{Usage of \cs{caption@warmup} added}
2432 % \changes{v3.2c}{2011/09/30}{Bugfix 11-09-26: Usage of \cs{if@subfloatrow} added}
2433 % \changes{v3.3}{2011/12/28}{Bugfix 11-12-16: \cs{caption@l@stepcounter} replaced by \cs{stepcounter}}
2434 % \changes{v3.3}{2012/03/15}{Usage of \cs{caption@setbox} added}
2435 % \changes{v3.3}{2013/05/01}{Redefinition of \cs{caption@settype} added}
2436 % \changes{v3.3}{2013/06/17}{Missing redefinition of \cs{captionlistentry} added}
2437 % \changes{v3.3}{2018/09/06}{Adapted to the \package{chkfloat} package}
2438 % Hook, will be used inside \cs{caption@setsubtype}.\par
2439 % (Note: If we are inside an |sub|\-|float|\-|row| environment we have to keep
2440 % the |\@make|\-|caption| code of the \package{floatrow} package intact.)
2441 % \begin{macrocode}
2442 \newcommand*\caption@subtypehook{%
2443 \ifx\caption\caption@subcaption \else
2444 \caption@warmup
2445 % \end{macrocode}
2446 % \begin{macrocode}
2447 \caption@ifflag2{}{% caption
2448 % no \caption in this part of the (floating) environment yet
2449 \let\caption@add@contentsline\caption@addsubcontentsline
2450 \let\caption@addsubcontentslines\@gobble
2451 \caption@ifflag4{}{% subcaption
2452 % no \subcaption in this part of the (floating) environment yet
2453 \caption@ifflag1{% ContinuedFloat
2454 \caption@clrflag1%
2455 }{%
2456 \caption@@stepcounter\@captype
2457 }%
2458 \caption@setflag4% subcaption
2459 }%
2460 }%
2461 % \end{macrocode}
2462 % \begin{macrocode}
2463 \c@ContinuedFloat=0\relax
2464 \let\caption@setfloatcapt\@firstofone
2465 \let\caption@chkfloat\@gobbletwo
2466 % \end{macrocode}
2467 % \begin{macrocode}
2468 \caption@setbox{none}%
2469 \caption@clearmargin
2470 \caption@iflist{}{\let\caption@setlist\@gobble}%
2471 \caption@setoptions{sub}%
2472 \caption@setoptions{subfloat}% for subfig-package compatibility
2473 % \end{macrocode}
2474 % \begin{macrocode}
2475 % redefine \setcaptiontype
2476 \def\caption@settype{\caption@withoptargs\caption@sub@settype}%
2477 \def\caption@sub@settype##1##2{%
2478 \def\caption@tempa{##2}%
2479 \ifx\caption@tempa\@captype
2480 %%% \caption@setsubtype##1\relax
2481 \else
2482 \caption@Error{##2 inside \@subcaptype}%
2483 \fi}%
2484 % \end{macrocode}
2485 % \begin{macrocode}
2486 % redefine \caption
2487 \let\caption\caption@subcaption
2488 \let\phantomcaption\caption@subphantom
2489 \let\captionlistentry\caption@sublistentry
2490 % \let\@captype\@subcaptype
2491 \let\caption@refstepcounter\caption@@@refstepcounter
2492 % \end{macrocode}
2493 % \begin{macrocode}
2494 % restore \@makecaption
2495 \if@subfloatrow
2496 \caption@Debug{Keeping \string\@makecaption}%
2497 \else
2498 \let\@makecaption\caption@makecaption
2499 \fi
2500 \fi}%
2501 % \end{macrocode}
2502 % \end{macro}
2503 %
2504 % \begin{macro}{\if@subfloatrow}
2505 % \changes{v3.2c}{2011/09/30}{This macro added}
2506 % This macro tests if we are inside an |sub|\-|float|\-|row| or |sub|\-|float|\-|row*| environment.
2507 % \begin{macrocode}
2508 \caption@AtBeginDocument{%
2509 \caption@ifundefined\@subfloatrowtrue
2510 {\newif\if@subfloatrow
2511 \caption@ifundefined\subfloatrow{}%
2512 {\caption@Debug{Patching subfloatrow environment}%
2513 \g@addto@macro\capsubrowsettings{\@subfloatrowtrue}%
2514 \g@addto@macro\killfloatstyle{%
2515 \ifx\c@FRobj\c@FRsobj\@subfloatrowtrue\fi}}}%
2516 {\caption@Debug{\string\if@subfloatrow is already defined}}}%
2517 % \end{macrocode}
2518 % \end{macro}
2519 %
2520 % \begin{macro}{\caption@subcaption}
2521 % Makes a sub-caption.
2522 % \begin{macrocode}
2523 \newcommand*\caption@subcaption{%
2524 \caption@checkgrouplevel{sub}\subcaption
2525 \caption@star
2526 {\caption@refstepcounter\@subcaptype}%
2527 {\caption@dblarg{\@caption\@subcaptype}}}
2528 % \end{macrocode}
2529 % \end{macro}
2530 %
2531 % \begin{macro}{\caption@subphantom}
2532 % \changes{v3.2a}{2011/08/17}{This macro added}
2533 % Same as |\phantomcaption|, but for sub-captions.
2534 % \begin{macrocode}
2535 \newcommand*\caption@subphantom{%
2536 \caption@checkgrouplevel{sub}\phantomsubcaption
2537 \caption@refstepcounter\@subcaptype}
2538 % \end{macrocode}
2539 % \end{macro}
2540 %
2541 % \begin{macro}{\caption@sublistentry}
2542 % \changes{v3.3}{2013/06/17}{This macro added}
2543 % Same as |\captionlistentry|, but for sub-captions.
2544 % \begin{macrocode}
2545 \newcommand*\caption@sublistentry{%
2546 \caption@teststar\@subcaptionlistentry\@firstoftwo\@secondoftwo}
2547 % \end{macrocode}
2548 % \begin{macrocode}
2549 \newcommand*\@subcaptionlistentry[1]{%
2550 \@testopt{\caption@listentry{#1}}\@subcaptype}
2551 % \end{macrocode}
2552 % \end{macro}
2553 %
2554 % \begin{macro}{caption@clearsubcontentslines}
2555 % Clear pending sub-caption list entries.
2556 % \begin{macrocode}
2557 \newcommand*\caption@clearsubcontentslines{%
2558 \global\let\caption@subcontentslines\@empty}
2559 % \end{macrocode}
2560 % \begin{macrocode}
2561 \caption@clearsubcontentslines
2562 % \end{macrocode}
2563 % \end{macro}
2564 %
2565 % \begin{macro}{\caption@addsubcontentsline}
2566 % \changes{v3.1i}{2008/08/02}{Bugfix 08-07-28:
2567 % \cs{label}, \cs{index}, and \cs{glossary} are allowed inside the list entry now}
2568 % \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
2569 % \changes{v3.2c}{2011/08/19}{Uses \cs{caption@gobble} instead of \cs{@gobble} now}
2570 % \changes{v3.3}{2012/01/15}{Debug message added}
2571 % \changes{v3.3}{2013/03/10}{A single \cs{protect} replaced by \cs{noexpand}}
2572 % Add a pending sub-caption list entry.
2573 % \begin{macrocode}
2574 \newcommand*\caption@addsubcontentsline[4]{%
2575 \caption@Debug{\string\caption@addsubcontentsline{#1}{#2}}%
2576 \begingroup
2577 \let\label\caption@gobble
2578 \let\index\caption@gobble
2579 \let\glossary\caption@gobble
2580 \protected@edef\@tempa{\endgroup
2581 \noexpand\g@addto@macro\noexpand\caption@subcontentslines{%
2582 \noexpand\@namedef{the#2}{\csname the#2\endcsname}%
2583 \ifx\@currentHref\@undefined \else
2584 \noexpand\def\noexpand\@currentHref{\@currentHref}%
2585 \fi
2586 \noexpand\caption@@@addcontentsline{#1}{#2}{#3}{#4}}}%
2587 \@tempa}
2588 % \end{macrocode}
2589 % \end{macro}
2590 %
2591 % \begin{macro}{\flushsubcaptionlistentries}
2592 % \changes{v3.3}{2012/01/15}{Renamed from \cs{caption@addsubcontentslines} to \cs{flushsubcaptionlistentries}}
2593 % \changes{v3.3}{2013/03/10}{Bugfix: Missing redefinition of \cs{caption@addsubcontentslines} added}
2594 % Writes pending sub-caption list entries.
2595 % \begin{macrocode}
2596 \newcommand*\flushsubcaptionlistentries{%
2597 \caption@addsubcontentslines{user}}
2598 % \end{macrocode}
2599 % \begin{macrocode}
2600 \renewcommand*\caption@addsubcontentslines[1]{%
2601 \caption@Debug{\string\flushsubcaptionlistentries (#1)}%
2602 \begingroup
2603 \caption@subcontentslines
2604 \endgroup
2605 \caption@clearsubcontentslines}
2606 % \end{macrocode}
2607 % We need to patch \cs{chapter} otherwise a vertical gap will be inserted into
2608 % the list prior pending sub-caption list entries.
2609 % We do this |\At|\-|Begin|\-|Document| so packages like \package{newfloat}
2610 % will not complain about an unknown document class.
2611 % \begin{macrocode}
2612 \AtBeginDocument{\caption@ifundefined\chapter{}{%
2613 \let\caption@chapter@ORI\chapter
2614 \def\chapter{%
2615 \caption@addsubcontentslines{chapter}\caption@chapter@ORI}}}
2616 % \end{macrocode}
2617 % Same for \cs{appendix}.
2618 % \begin{macrocode}
2619 \AtBeginDocument{\caption@ifundefined\appendix{}{%
2620 \let\caption@appendix@ORI\appendix
2621 \def\appendix{%
2622 \caption@addsubcontentslines{appendix}\caption@appendix@ORI}}}
2623 % \end{macrocode}
2624 % Flush the list of pending sub-caption list entries at the end of the document.
2625 % \begin{macrocode}
2626 \AtEndDocument{%
2627 \caption@addsubcontentslines{AtEndDocument}}
2628 % \end{macrocode}
2629 % \end{macro}
2630 %
2631 %
2632 % \subsection{Document class \& Babel package support}
2633 %
2634 % \subsubsection{The \AmS{} \& \SmF{} classes}
2635 % \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added}
2636 %
2637 % \begin{macrocode}
2638 \caption@ifundefined\smf@makecaption{}{\let\smf@makecaption\@makecaption}
2639 % \end{macrocode}
2640 %
2641 % \subsubsection{The beamer class}
2642 % \changes{v3.1}{2007/03/10}{beamer class support added}
2643 %
2644 % \begin{macrocode}
2645 \@ifclassloaded{beamer}{%
2646 \caption@InfoNoLine{beamer document class}%
2647 % \end{macrocode}
2648 %
2649 % \begin{macro}{\figure}
2650 % \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
2651 % \changes{v3.3d}{2019/09/01}{This re-definition for \class{beamer} document class revised}
2652 % We redefine |figure| so our type-specific options will be used etc.
2653 % \begin{macrocode}
2654 \let\caption@ORI@figure\figure
2655 \def\figure{\caption@settype{figure}\caption@ORI@figure}
2656 % \end{macrocode}
2657 % \end{macro}
2658 %
2659 % \begin{macro}{\table}
2660 % \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
2661 % \changes{v3.3d}{2019/09/01}{This re-definition for \class{beamer} document class revised}
2662 % We redefine |table| so our type-specific options will be used etc.
2663 % \begin{macrocode}
2664 \let\caption@ORI@table\figure
2665 \def\table{\caption@settype{table}\caption@ORI@table}
2666 % \end{macrocode}
2667 % \end{macro}
2668 %
2669 % \begin{macrocode}
2670 }{}
2671 % \end{macrocode}
2672 %
2673 % \subsubsection{The \KOMAScript{} classes}
2674 %
2675 % \KOMAScript\ contains the code
2676 % |\AtBeginDocument{\let\scr@caption\caption}|
2677 % so we need to update |\scr@caption| here, too.
2678 %
2679 % \begin{macrocode}
2680 \caption@ifundefined\scr@caption{}{%
2681 \caption@AtBeginDocument{\let\scr@caption\caption}}
2682 % \end{macrocode}
2683 %
2684 % \subsubsection{The frenchb Babel option}
2685 % \changes{v3.1}{2006/05/14}{Adaptation to \package{frenchb} added}
2686 %
2687 % Suppress
2688 % ``Package |frenchb.ldf| Warning: The definition of |\@makecaption| has been
2689 % changed, frenchb will NOT customize it.''
2690 % (but only if we emulate this customization)
2691 % \begin{macrocode}
2692 \@nameuse{caption@frenchb}\@nameundef{caption@frenchb}
2693 % \end{macrocode}
2694 %
2695 % \subsubsection{The frenchle/pro package}
2696 % \changes{v3.0h}{2005/10/03}{Adaptation to \package{frenchle/pro} added}
2697 %
2698 % \begin{macrocode}
2699 \caption@AtBeginDocument{\caption@ifundefined\frenchTeXmods{}{%
2700 \caption@InfoNoLine{frenchle/pro package is loaded}%
2701 % \end{macrocode}
2702 %
2703 % \begin{macrocode}
2704 \let\captionfont@ORI\captionfont
2705 \let\captionlabelfont@ORI\captionlabelfont
2706 \let\@makecaption@ORI\@makecaption
2707 % \end{macrocode}
2708
2709 % If |\GOfrench| is defined as |\relax| all the re-definitions regarding
2710 % captions have already been done, so we can do our patches immediately.
2711 % Otherwise we must add our stuff to |\GOfrench|.
2712 % \begin{macrocode}
2713 \caption@ifundefined\GOfrench
2714 {\let\caption@tempa\@firstofone}%
2715 {\def\caption@tempa{\g@addto@macro\GOfrench}}%
2716 \caption@tempa{%
2717 % \end{macrocode}
2718 %
2719 % \begin{macrocode}
2720 \let\captionfont\captionfont@ORI
2721 \let\captionfont@ORI\@undefined
2722 \let\captionlabelfont\captionlabelfont@ORI
2723 \let\captionlabelfont@ORI\@undefined
2724 \let\@makecaption\@makecaption@ORI
2725 \let\@makecaption@ORI\@undefined
2726 % \end{macrocode}
2727 %
2728 % \begin{macro}{\@cnORI}
2729 % We update the definition of |\@cnORI| so it actually reflects
2730 % our definition of |\caption|.
2731 % \begin{macrocode}
2732 \let\@cnORI\caption
2733 % \end{macrocode}
2734 % \end{macro}
2735 %
2736 % \begin{macro}{\@tablescaption}
2737 % The \package{frenchle/pro} package sets |\caption| to |\@tablescaption| at
2738 % |\begin{table}| for special treatment of footnotes.
2739 % Therefore we have to patch |\@tablescaption| so |\caption*| will work
2740 % inside the |table| environment.
2741 % \begin{macrocode}
2742 \let\caption@tcORI\@tablescaption
2743 \def\@tablescaption{\caption@star\relax\caption@tcORI}%
2744 % \end{macrocode}
2745 % \end{macro}
2746 %
2747 % \begin{macro}{\f@ffrench}
2748 % \begin{macro}{\f@tfrench}
2749 % |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
2750 % when used in French mode. These contain additional code which typesets
2751 % the caption separator |\captionseparator| instead of the usual colon.
2752 % Because this breaks with our |\@makecaption| code we have to remove
2753 % this additional code here.
2754 % \begin{macrocode}
2755 \let\@eatDP\@undefined
2756 \let\caption@tempa\@empty
2757 \ifx\f@ffrench\fnum@figure
2758 \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
2759 \fi
2760 \ifx\f@tfrench\fnum@table
2761 \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
2762 \fi
2763 \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
2764 \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
2765 \caption@tempa
2766 % \end{macrocode}
2767 % \end{macro}
2768 % \end{macro}
2769 %
2770 % \begin{macrocode}
2771 }%
2772 }}
2773 % \end{macrocode}
2774 %
2775 % \subsubsection{The hungarian and magyar Babel option}
2776 % \changes{v3.2}{2009/03/29}{\package{magyar} package support added}
2777 % \changes{v3.3}{2018/08/26}{\package{magyar} package support revised}
2778 %
2779 % \begin{macrocode}
2780 \def\caption@tempa#1{%
2781 \@ifpackagewith{babel}{#1}{%
2782 \caption@InfoNoLine{#1 babel option is loaded}%
2783 \expandafter\addto\csname extras#1\endcsname{%
2784 % reverse changes made by magyar.ldf
2785 \let\@makecaption\caption@makecaption
2786 \babel@save\@makecaption
2787 \caption@redefine
2788 \babel@save\@caption}%
2789 }{}}
2790 % \end{macrocode}
2791 % \begin{macrocode}
2792 \caption@tempa{hungarian}%
2793 \caption@tempa{magyar}%
2794 % \end{macrocode}
2795 %
2796 % \subsection{Package support}
2797 % \changes{v3.1}{2007/04/11}{Package options `float', `longtable' etc.
2798 % are not supported anymore, removed}
2799 %
2800 % \begin{macro}{\caption@IfPackageLoaded}
2801 % \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added,
2802 % so no extra check is needed}
2803 % \changes{v3.1}{2007/07/04}{Re-written \& renamed from \cs{caption@ifpackage}
2804 % to \cs{caption@IfPackageLoaded}}
2805 % \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
2806 % |\caption@IfPackageLoaded|\marg{package}\oarg{version}\marg{true}\marg{false}\par
2807 % Some kind of combination of |\@ifpackageloaded| and |\@ifpackagelater|.
2808 % If the \meta{package} is not loaded yet, the check will be (re-)done
2809 % |\AtBeginDocument|, so the \meta{package} could be loaded later on, too.
2810 % \begin{macrocode}
2811 \newcommand\caption@IfPackageLoaded[1]{%
2812 \@testopt{\caption@@IfPackageLoaded{#1}}{}}
2813 \@onlypreamble\caption@IfPackageLoaded
2814 % \end{macrocode}
2815 % \begin{macrocode}
2816 \long\def\caption@@IfPackageLoaded#1[#2]#3#4{%
2817 \@ifpackageloaded{#1}\@firstofone{%
2818 \caption@Debug{#1 package is not loaded (yet)\@gobble}%
2819 \caption@AtBeginDocument}{%
2820 \caption@If@Package@Loaded{#1}[{#2}]{#3}{#4}}}
2821 \@onlypreamble\caption@@IfPackageLoaded
2822 % \end{macrocode}
2823 % \begin{macrocode}
2824 \long\def\caption@If@Package@Loaded#1[#2]{%
2825 \@ifpackageloaded{#1}{%
2826 \caption@InfoNoLine{#1 package is loaded}%
2827 \@ifpackagelater{#1}{#2}\@firstoftwo{%
2828 \caption@Error{%
2829 For a successful cooperation we need at least version\MessageBreak
2830 `#2' of package #1,\MessageBreak
2831 but only version\MessageBreak
2832 `\csname ver@#1.\@pkgextension\endcsname'\MessageBreak
2833 is available}%
2834 \@secondoftwo}%
2835 }{\@secondoftwo}}
2836 \@onlypreamble\caption@If@Package@Loaded
2837 % \end{macrocode}
2838 % \end{macro}
2839 %
2840 % \begin{macro}{\caption@clearmargin}
2841 % \changes{v3.1}{2007/05/05}{This macro and its usage added}
2842 % This macro will be used by some package support stuff where the usual
2843 % margin setting is not welcome, e.g. in the \package{sidecap} package.
2844 % \begin{macrocode}
2845 \newcommand*\caption@clearmargin{%
2846 \setcaptionmargin\z@
2847 \let\caption@minmargin\@undefined}
2848 % \end{macrocode}
2849 % \end{macro}
2850 %
2851 % \begin{macrocode}
2852 \caption@setbool{needfreeze}{0}
2853 \caption@AtBeginDocument*{%
2854 \caption@ifneedfreeze{%
2855 % \end{macrocode}
2856 %
2857 % \begin{macro}{\caption@freezetype}
2858 % \changes{v3.3}{2013/05/01}{This macro added}
2859 % |\caption@freezetype|\marg{type}\par
2860 % Used by the \package{fltpage} \& \package{sidecap} package support.
2861 % \begin{macrocode}
2862 \newcommand*\caption@freezetype[1]{%
2863 \caption@settype*{#1}%
2864 \captionsetup*[sub]{hypcap=true}% Note: This is just a (q&d) workaround!
2865 \caption@freeze}%
2866 % \end{macrocode}
2867 % \end{macro}
2868 %
2869 % \begin{macro}{\caption@freeze}
2870 % \changes{v3.1}{2007/07/22}{This macro added}
2871 % \changes{v3.1c}{2007/10/06}{\cs{caption} \& \cs{@caption} revised for enhanced compatibility}
2872 % \changes{v3.1c}{2007/10/06}{Bugfix: Made \cs{@caption} long}
2873 % \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
2874 % \changes{v3.1g}{2008/01/29}{Starred variants of \cs{ContinuedFloat} and \cs{captionsetup} added}
2875 % \changes{v3.2}{2010/10/26}{Bugfix 10-09-01a: Uses \cs{ignorespaces} instead of `space hack' again}
2876 % \changes{v3.2a}{2011/08/17}{Starred variant of \cs{caption@freeze} removed}
2877 % \changes{v3.2b}{2011/08/18}{Redefines \cs{caption@setup} instead of \cs{captionsetup} now}
2878 % \changes{v3.2b}{2011/08/18}{Redefinition of \cs{label} revised}
2879 % \changes{v3.2c}{2011/08/21}{Revised}
2880 % \changes{v3.3}{2013/01/06}{Adapted to new switch \cs{caption@caption} etc.}
2881 % |\caption@freeze|\par
2882 % Used by the \package{bicaption} package.
2883 % \begin{macrocode}
2884 \newcommand*\caption@freeze{%
2885 \let\caption@frozen@ContinuedFloat\ContinuedFloat
2886 \def\ContinuedFloat{%
2887 \caption@@freeze{\caption@@@@ContinuedFloat\@captype}%
2888 \caption@frozen@ContinuedFloat}%
2889 % \end{macrocode}
2890 % \begin{macrocode}
2891 \let\caption@frozen@setup\caption@setup
2892 \def\caption@setup##1{%
2893 \caption@@freeze{\caption@setup{##1}}%
2894 \caption@frozen@setup{##1}}%
2895 % \end{macrocode}
2896 % \begin{macrocode}
2897 \let\caption@frozen@caption\caption
2898 \def\caption{%
2899 \def\caption{%
2900 \caption@Error{%
2901 Only one \noexpand\caption can be placed in this environment}%
2902 \caption@gobble}%
2903 \@ifstar
2904 {\caption@SC@caption*}%
2905 {\let\@currentlabel\caption@SClabel
2906 \caption@withoptargs\caption@SC@caption}}%
2907 \long\def\caption@SC@caption##1##2{%
2908 \caption@@freeze{\caption##1{##2}}%
2909 \ignorespaces}%
2910 % \end{macrocode}
2911 % \begin{macrocode}
2912 \let\caption@frozen@label\label
2913 \def\label{%
2914 \caption@withoptargs\caption@SC@label}%
2915 \def\caption@SC@label##1##2{%
2916 \ifx\@currentlabel\caption@SClabel
2917 \@bsphack
2918 \caption@freeze@label{##1}{##2}%
2919 \@esphack
2920 \else
2921 \caption@frozen@label##1{##2}%
2922 \fi}%
2923 \def\caption@SClabel{\caption@undefinedlabel}%
2924 \def\caption@freeze@label##1##2{%
2925 \caption@@freeze{\label##1{##2}}}%
2926 % \end{macrocode}
2927 % \begin{macrocode}
2928 \global\let\caption@frozen@content\@empty
2929 \long\def\caption@@freeze{%
2930 \g@addto@macro\caption@frozen@content}%
2931 % \end{macrocode}
2932 % \begin{macrocode}
2933 \def\caption@warmup{%
2934 \let\ContinuedFloat\caption@frozen@ContinuedFloat
2935 \let\caption@setup\caption@frozen@setup
2936 \let\caption\caption@frozen@caption
2937 \let\label\caption@frozen@label}}%
2938 % \end{macrocode}
2939 % \end{macro}
2940 %
2941 % \begin{macro}{\caption@prepare@defrost}
2942 % \changes{v3.3}{2013/01/06}{This macro added}
2943 % Prevent resetting the caption flags
2944 % \begin{macrocode}
2945 \newcommand*\caption@prepare@defrost{%
2946 \let\caption@settype\caption@set@type}
2947 % \end{macrocode}
2948 % \end{macro}
2949 %
2950 % \begin{macro}{\caption@defrost}
2951 % \changes{v3.1}{2007/07/22}{This macro added}
2952 % \changes{v3.1g}{2008/01/30}{\cs{caption@defrost@setup} added}
2953 % \changes{v3.2c}{2011/08/21}{Adapted to changes of \cs{caption@freeze}}
2954 % \changes{v3.2c}{2011/08/21}{\cs{caption@defrost@setup} removed}
2955 % |\caption@defrost|
2956 % \begin{macrocode}
2957 \newcommand*\caption@defrost{%
2958 \ifx\caption@frozen@caption\@undefined
2959 \caption@frozen@content
2960 \else
2961 \caption@Error{Internal Error:\MessageBreak
2962 \noexpand\caption@defrost in same group as \string\caption@freeze}%
2963 \fi}%
2964 % \end{macrocode}
2965 % \end{macro}
2966 %
2967 % \begin{macrocode}
2968 }{}%
2969 \caption@undefbool{needfreeze}}
2970 % \end{macrocode}
2971 %
2972 % \begin{macro}{\caption@warmup}
2973 % \changes{v3.2a}{2011/08/17}{This macro added}
2974 % |\caption@warmup|
2975 % \begin{macrocode}
2976 \let\caption@warmup\relax
2977 % \end{macrocode}
2978 % \end{macro}
2979 %
2980 % \subsubsection{The chkfloat package}
2981 % \changes{v3.3}{2018/09/06}{Support of the \package{chkfloat} package added}
2982 %
2983 % \begin{macrocode}
2984 \caption@IfPackageLoaded{chkfloat}[2012/08/19 v0.1]{%
2985 % \end{macrocode}
2986 %
2987 % \begin{macro}{\caption@chkfloat}
2988 % \changes{v3.3}{2018/09/06}{This macro added}
2989 % \begin{macrocode}
2990 \caption@ifundefined\chkfloat@addcontentsline{%
2991 \renewcommand\caption@chkfloat[2]{%
2992 \caption@ifundefined\chkfloat@page{}{%
2993 \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}}}%
2994 }{%
2995 \renewcommand\caption@chkfloat{\chkfloat@addcontentsline}%
2996 }%
2997 % \end{macrocode}
2998 % \end{macro}
2999 %
3000 % \begin{macrocode}
3001 }{}%
3002 % \end{macrocode}
3003 %
3004 % \subsubsection{The float package}
3005 % \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
3006 % \iffalse
3007 % (This is a more straight-ahead implementation, but it only works with v1.3
3008 % now, so v1.2 is no longer supported. The old code including documentation
3009 % can be found in caption-30f-050530.zip)
3010 % \fi
3011 %
3012 % The \package{float} package usually do not use the \LaTeX\ kernel command
3013 % |\@caption| to typeset the caption but |\float@caption| instead.
3014 % (|\@caption| will only be used if the float is re-styled with
3015 % |\restylefloat*|.)
3016 %
3017 % The main two things |\float@caption| is doing different are:
3018 % \begin{itemize}
3019 % \item The caption will be typeset inside a |\savebox| called |\@floatcapt|
3020 % so it can be placed above or below the float contents afterwards.
3021 % \item |\@makecaption| will not be used to finally typeset the caption.
3022 % Instead |\@fs@capt| will be used which definition is part of the float
3023 % style.
3024 % (Note that |\@fs@capt| will not typeset any vertical space above or below
3025 % the caption; instead this space will be typeset by the float style code
3026 % itself.)
3027 % \end{itemize}
3028 %
3029 % \begin{macrocode}
3030 \caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{%
3031 \@ifpackageloaded{floatrow}{%
3032 \caption@If@Package@Loaded{floatrow}[2007/08/24 v0.2a]{}{}%
3033 }{%
3034 % \end{macrocode}
3035 %
3036 % \begin{macro}{\@float@setevery}
3037 % \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added
3038 % to redefinition of \cs{caption@setfloatcapt}}
3039 % |\@float@setevery|\marg{float type} is provided by the \package{float}
3040 % package; it's called every time a floating environment defined with
3041 % |\newfloat| or |\restylefloat| begins.
3042 % We use this hook to do some adaptations and to setup the proper caption
3043 % style (if defined) and additional settings declared with
3044 % |\captionsetup|\oarg{float style}.
3045 % \begin{macrocode}
3046 \let\caption@ORI@float@setevery\@float@setevery
3047 \def\@float@setevery#1{%
3048 \float@ifcaption{#1}{%
3049 % \end{macrocode}
3050 %
3051 % First of all we set the caption position to it's proper value by
3052 % converting |\@fs@iftopcapt| (which is part of a float style and
3053 % controls where the caption will be typeset, above or below the float
3054 % contents) to our |position=| setting.
3055 % Since the spacing above and below the caption will be done by the float
3056 % style and \emph{not} by us this sounds quite useless. But in fact it isn't,
3057 % since some packages based on \thispackage\ (like the \package{subfig}
3058 % package) could have an interest for this information and therefore use the
3059 % |\caption@iftop| macro we provide in our kernel. Furthermore we need this
3060 % information for ourself in |\captionof| which uses |\@makecaption| to
3061 % finally typeset the caption with skips.
3062 % \begin{macrocode}
3063 \caption@setposition{\@fs@iftopcapt t\else b\fi}%
3064 % \end{macrocode}
3065 %
3066 % Afterward we redefine |\caption@setfloatcapt| (which will be used inside
3067 % |\@caption|) so the caption will be set inside the box |\@floatcapt|,
3068 % without extra vertical space.
3069 % \begin{macrocode}
3070 \renewcommand\caption@setfloatcapt[1]{%
3071 \let\@makecaption\caption@@make
3072 \global\setbox\@floatcapt\vbox{%
3073 \color@begingroup ##1\color@endgroup}}%
3074 % \end{macrocode}
3075 %
3076 % To allow different caption styles for different float styles we also
3077 % determine the current float style (e.g. `ruled') and select
3078 % a caption style (and additional settings) with the same name, if defined.
3079 % \begin{macrocode}
3080 \float@getstyle\float@style{#1}%
3081 \caption@setstyle*\float@style
3082 \caption@setoptions\float@style
3083 % \end{macrocode}
3084 %
3085 % \begin{macrocode}
3086 }{}%
3087 \caption@freezeHref % will be defrosted in \float@makebox
3088 \caption@ORI@float@setevery{#1}}%
3089 % \end{macrocode}
3090 % \end{macro}
3091 %
3092 % \begin{macro}{\float@makebox}
3093 % \changes{v3.3}{2013/01/06}{Corrects wrong load order hyperref-float now}
3094 % \changes{v3.3}{2013/02/03}{Correction of wrong load order hyperref-float revised}
3095 % Redefine |\float@makebox| (only if we are not operating in compatibility mode).
3096 % \begin{macrocode}
3097 \caption@AtBeginDocument{\caption@ifcompatibility{}{%
3098 % \end{macrocode}
3099 % If it was redefined by the \package{hyperref} package,
3100 % we need to build on the original definition (and not on the redefined one).
3101 % \begin{macrocode}
3102 \caption@ifundefined\HyOrg@float@makebox
3103 {\let\caption@ORI@float@makebox\float@makebox}%
3104 {\let\caption@ORI@float@makebox\HyOrg@float@makebox}%
3105 \renewcommand\float@makebox[1]{%
3106 \caption@ORI@float@makebox{#1\relax \caption@defrostHref}}%
3107 % \end{macrocode}
3108 % \begin{macrocode}
3109 }}%
3110 % \end{macrocode}
3111 % \end{macro}
3112 %
3113 % \begin{macro}{\caption@typehook}
3114 % \changes{v3.1}{2007/07/08}{float package hook added}
3115 % \LaTeX\ and almost every other packages use
3116 % |\|\meta{type}|name|
3117 % to provide a macro for the type resp.~environment name -- for example
3118 % the command |\figurename| will usually contain the name of the floating
3119 % environment |figure|:
3120 % \begin{quote}
3121 % |\newcommand\figurename{Figure}|
3122 % \end{quote}
3123 % But the \package{float} package doesn't follow this common naming
3124 % convention:
3125 % For floats defined with |\newfloat| it uses |\fname@|\meta{type} instead,
3126 % which breaks with our code (and with |\autoref| and some other things as
3127 % well).
3128 % So we have to map the \package{float} package name to the common one here.\par
3129 % \Note{If the float was not defined with \cs{newfloat} but with
3130 % \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.}
3131 % \begin{macrocode}
3132 \g@addto@macro\caption@typehook{%
3133 \expandafter\ifx\csname #1name\endcsname\relax
3134 \expandafter\let\csname #1name\expandafter\endcsname
3135 \csname fname@#1\endcsname
3136 \fi}%
3137 % \end{macrocode}
3138 % \end{macro}
3139 %
3140 % \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
3141 % \begin{macro}{\fs@plaintop}
3142 % \begin{macro}{\fs@boxed}
3143 % Since the float styles |plaintop| and |boxed| don't use |\abovecaptionskip|
3144 % which could be set with |skip=| (|plaintop| uses |\belowcaptionskip| instead of
3145 % |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|)
3146 % we patch the according float style macros here to change this.
3147 % \begin{macrocode}
3148 \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
3149 \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
3150 % \end{macrocode}
3151 % \end{macro}
3152 % \end{macro}
3153 %
3154 % \begin{macro}{\float@getstyle}
3155 % \changes{v3.1}{2007/06/10}{This macro added}
3156 % |\float@getstyle|\marg{cmd}\marg{type}\par
3157 % Determining the float style is not so easy because the only hint
3158 % provided by the \package{float} package is the macro
3159 % |\fst@|\meta{float type} which points to the macro which represents the
3160 % float style. So for example after
3161 % \begin{quote}
3162 % |\floatstyle{ruled}|\\
3163 % |\newfloat{Program}{tbp}{lop}|
3164 % \end{quote}
3165 % |\fst@Program| will be defined as
3166 % \begin{quote}
3167 % |\def\fst@Program{\fs@ruled}|\quad.
3168 % \end{quote}\par
3169 % So here is what we do: We make the first level expansion of
3170 % |\fst@|\meta{float type} a string so we can gobble the first four tokens
3171 % (= |\fs@|), so only the the name of the float style is left.\par
3172 % \emph{TODO:} We need to convert the catcodes here.
3173 % \begin{macrocode}
3174 \providecommand*\float@getstyle[2]{%
3175 \edef#1{%
3176 \noexpand\expandafter\noexpand\@gobblefour\noexpand\string
3177 \expandafter\expandafter\expandafter\noexpand
3178 \csname fst@#2\endcsname}%
3179 \edef#1{#1}%
3180 \caption@Debug{floatstyle{#2} = `#1'}}%
3181 % \end{macrocode}
3182 % \end{macro}
3183 %
3184 % \begin{macro}{\float@ifcaption}
3185 % \changes{v3.1}{2007/06/23}{This macro added}
3186 % |\float@ifcaption|\marg{type}\marg{if-clause}\marg{else-clause}\par
3187 % Here we determine if the user has used |\newfloat| resp.~|\restylefloat|,
3188 % or |\restylefloat*|.
3189 % This is quite easy: If |\@float@c@|\meta{captype} is the same as
3190 % |\float@caption|, the user has used |\newfloat| or |\restylefloat|,
3191 % otherwise we assume he has used |\restylefloat*|.
3192 % (This test will fail if some package re-defines |\float@caption|,
3193 % so we have to assume that there is no one.)
3194 % \begin{macrocode}
3195 \providecommand*\float@ifcaption[1]{%
3196 \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
3197 \expandafter\@firstoftwo
3198 \else
3199 \expandafter\@secondoftwo
3200 \fi}%
3201 % \end{macrocode}
3202 % \end{macro}
3203 %
3204 % \begin{macrocode}
3205 }}{%
3206 \providecommand*\float@ifcaption[1]{\@secondoftwo}%
3207 % \clearcaptionsetup{boxed}% used by the floatrow package?
3208 }
3209 % \end{macrocode}
3210 %
3211 % The skip between `boxed' floats and their caption defaults to |2pt|.
3212 %
3213 % \begin{macrocode}
3214 \captionsetup[boxed]{skip=2pt} % do not issue a warning when not used
3215 % \end{macrocode}
3216 %
3217 % \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
3218 % \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
3219 % To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
3220 % `ruled' with appropriate options. But if the package option |ruled| was
3221 % specified, we setup some caption parameters to emulate the behavior
3222 % of \thispackage\ \version{1.x} option |ruled| instead, i.e.,
3223 % the current caption settings will be used, but without margin and without
3224 % `single-line-check'.
3225 % \begin{macrocode}
3226 \caption@ifbool{ruled}{%
3227 \captionsetup[ruled]{margin=0pt,minmargin=0,slc=0}%
3228 }{%
3229 \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
3230 }
3231 \caption@undefbool{ruled}
3232 % \end{macrocode}
3233 %
3234 % \subsubsection{The floatflt package}
3235 % \changes{v3.1}{2007/06/10}{Support of the \package{floatflt} package added}
3236 %
3237 % \begin{macrocode}
3238 \caption@IfPackageLoaded{floatflt}[1996/02/27 v1.3]{%
3239 % \end{macrocode}
3240 %
3241 % \begin{macro}{\floatingfigure}
3242 % We patch |\floatingfigure| so |\caption@floatflt| will be used.
3243 % \begin{macrocode}
3244 \let\caption@ORI@floatingfigure\floatingfigure
3245 \def\floatingfigure{%
3246 \caption@floatflt{figure}%
3247 \caption@ORI@floatingfigure}%
3248 % \end{macrocode}
3249 % \end{macro}
3250 %
3251 % \begin{macro}{\floatingtable}
3252 % Same with |\floatingtable|\ldots
3253 % \begin{macrocode}
3254 \let\caption@ORI@floatingtable\floatingtable
3255 \def\floatingtable{%
3256 \caption@floatflt{table}%
3257 % \caption@setautoposition b%
3258 \caption@ORI@floatingtable}%
3259 % \end{macrocode}
3260 % \end{macro}
3261 %
3262 % \begin{macro}{\caption@floatflt}
3263 % \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
3264 % Here we do two things:
3265 % \begin{enumerate}
3266 % \item We use |\caption@set|\-|options{|\-|floating|\meta{type}|}| so
3267 % |\caption|\-|setup[|\-|floating|\meta{type}|]{|\ldots|}| is supported.
3268 % \item |\line|\-|width| must be set correctly.
3269 % Usually this is done by |\@par|\-|box|\-|restore| inside |\@caption|,
3270 % but since we use |\@caption@box|\-|restore| we have to map this to
3271 % |\@par|\-|box|\-|restore| instead.
3272 % \end{enumerate}
3273 % \begin{macrocode}
3274 \newcommand*\caption@floatflt[1]{%
3275 \caption@settype{#1}%
3276 \caption@clearmargin
3277 \caption@setfullparboxrestore
3278 \caption@setoptions{floating#1}}%
3279 % \end{macrocode}
3280 % \end{macro}
3281 %
3282 % \begin{macrocode}
3283 }{}
3284 % \end{macrocode}
3285 %
3286 % \subsubsection{The fltpage package}
3287 % \changes{v3.1}{2007/07/22}{Support of the \package{fltpage} package added}
3288 %
3289 % \begin{macrocode}
3290 \caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{%
3291 \caption@setbool{needfreeze}{1}%
3292 % \end{macrocode}
3293 %
3294 % \begin{macro}{\FP@positionLabel}
3295 % \changes{v3.2c}{2011/08/28}{This redefinition added}
3296 % Original code:
3297 % \begin{verbatim}
3298 % \newcommand{\FP@positionLabel}{%
3299 % FP\@captype-\number\value{FP@\@captype C}-pos}
3300 % \end{verbatim}%^^A
3301 % \begin{macrocode}
3302 \renewcommand\FP@positionLabel{%
3303 FP\FP@captype-\number\value{FP@\FP@captype C}-pos}%
3304 % \end{macrocode}
3305 % \end{macro}
3306 %
3307 % \begin{macro}{\FP@helpNote}
3308 % Original code:
3309 % \begin{verbatim}
3310 % \newcommand{\FP@helpNote}[2]{%
3311 % \typeout{FP#1 is inserted on page \pageref{#2}!}}%
3312 % \end{verbatim}%^^A
3313 % \begin{macrocode}
3314 \renewcommand\FP@helpNote[2]{%
3315 \begingroup % save \caption@thepage
3316 \caption@pageref{#2}%
3317 \typeout{FP#1 is inserted on page \caption@thepage!}%
3318 \endgroup}%
3319 % \end{macrocode}
3320 % \end{macro}
3321 %
3322 % \begin{macro}{\FP@floatBegin}
3323 % \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
3324 % \changes{v3.1k}{2009/10/09}{Bugfix 09-09-11: Missing \cs{ignorespaces} added}
3325 % \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
3326 % \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added}
3327 % \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
3328 % Original code:
3329 % \begin{verbatim}
3330 % \newcommand{\FP@floatBegin}[1]{%
3331 % \gdef\@captype{#1}%
3332 % \global\let\FP@savedCaptionCommand\caption%
3333 % \global\let\FP@savedLabelCommand\label%
3334 % \ifthenelse{\equal{\@captype}{figure}}
3335 % {\global\let\old@Fnum\fnum@figure}%
3336 % {\global\let\old@Fnum\fnum@table}%
3337 % \let\FP@LabelText\@empty%
3338 % \let\FP@CaptionText\@empty%
3339 % \let\FP@optionalCaptionText\@empty%
3340 % \renewcommand\label[1]{\gdef\FP@LabelText{##1}}%
3341 % \renewcommand\caption[2][]{%
3342 % \gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}%
3343 % \begin{lrbox}{\FP@floatCorpusBOX}%
3344 % }%
3345 % \end{verbatim}%^^A
3346 % \begin{macrocode}
3347 \renewcommand*\FP@floatBegin[1]{%
3348 \def\FP@captype{#1}%
3349 \begin{lrbox}{\FP@floatCorpusBOX}%
3350 \minipage\hsize % changes from LR mode to vertical mode
3351 \caption@freezetype{#1}%
3352 \ignorespaces}%
3353 % \end{macrocode}
3354 % \end{macro}
3355 %
3356 % \begin{macro}{\FP@floatEnd}
3357 % \changes{v3.1g}{2008/01/30}{Some minor bugfixes}
3358 % \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
3359 % \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added}
3360 % Original code:
3361 % \begin{verbatim}
3362 % \newcommand{\FP@floatEnd}{%
3363 % \end{lrbox}%
3364 % \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
3365 % \stepcounter{FP@\@captype C}%
3366 % \FP@savedLabelCommand{\FP@positionLabel}%
3367 % \FP@helpNote{\@captype}{\FP@positionLabel}%
3368 % \FP@float
3369 % {\FP@positionLabel}% location label test
3370 % {\begin{\@captype}[p!]
3371 % \usebox{\FP@floatCorpusBOX}%
3372 % \refstepcounter{\@captype}%
3373 % \ifthenelse{\equal{\FP@LabelText}{\@empty}}
3374 % {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
3375 % \end{\@captype}}
3376 % {\addtocounter{\@captype}{-1}}
3377 % {\begin{\@captype}[b!]%
3378 % \ifthenelse{\equal{\FP@guide}{\@empty}}%
3379 % {}{\ifthenelse{\equal{\@captype}{figure}}%
3380 % {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}%
3381 % {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}%
3382 % \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption
3383 % \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption
3384 % \FP@separatorCaption%
3385 % \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
3386 % {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%
3387 % {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]%
3388 % {\expandafter\protect\FP@CaptionText}}%
3389 % \end{\@captype}}%
3390 % }%
3391 % \end{verbatim}%^^A
3392 % \begin{macrocode}
3393 \renewcommand*\FP@floatEnd{%
3394 \endminipage
3395 \end{lrbox}%
3396 % \end{macrocode}
3397 % \begin{macrocode}
3398 \stepcounter{FP@\FP@captype C}%
3399 \caption@label\FP@positionLabel
3400 \FP@helpNote\FP@captype\FP@positionLabel
3401 % \end{macrocode}
3402 % \begin{macrocode}
3403 \FP@float
3404 {\FP@positionLabel}% location label test
3405 {\caption@prepare@defrost
3406 \begin\FP@captype[p!]%
3407 \usebox\FP@floatCorpusBOX
3408 \end\FP@captype}%
3409 {\@ifundefined{theH\FP@captype}{}{%
3410 \expandafter\l@addto@macro\csname theH\FP@captype\endcsname{.FP}}}%
3411 {\caption@prepare@defrost
3412 \begin\FP@captype[b!]%
3413 \let\FP@savedSetfnumCommand\caption@setfnum
3414 \def\caption@setfnum##1{%
3415 \FP@savedSetfnumCommand{##1}%
3416 \ifx\FP@guide\@empty \else
3417 \expandafter\l@addto@macro\csname fnum@##1\endcsname{\ {\FP@guide}}%
3418 \fi}%
3419 \setlength\abovecaptionskip{2pt plus 2pt minus 1pt}% length above caption
3420 \setlength\belowcaptionskip{2pt plus 2pt minus 1pt}% length below caption
3421 \caption@setoptions{FP\@captype}%
3422 \FP@separatorCaption
3423 \caption@defrost
3424 \end\FP@captype}%
3425 }%
3426 % \end{macrocode}
3427 % \end{macro}
3428 %
3429 % \begin{macrocode}
3430 }{%
3431 \let\caption@ifFPlistcap\@undefined
3432 \let\caption@ifFPrefcap\@undefined
3433 }
3434 % \end{macrocode}
3435 %
3436 % \subsubsection{The hyperref package}
3437 % \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
3438 % \changes{v3.1}{2007/03/09}{Usage of \cs{hyper@makecurrent} instead of
3439 % \cs{theHfigure} as indicator for \package{hyperref} package}
3440 % \changes{v3.2}{2011/07/30}{Test if \package{hyperref} has stopped early revised}
3441 % \changes{v3.2c}{2011/08/24}{Test if \package{hyperref} has stopped early adapted to current version of \package{hyperref} package: Usage of \cs{IfHyperBoolean} added}
3442 %
3443 % \begin{macrocode}
3444 \caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{%
3445 % Test if hyperref has stopped early
3446 \caption@ifundefined\IfHyperBoolean{%
3447 \caption@set@bool\caption@ifhyp@stoppedearly0%
3448 \caption@ifundefined\H@refstepcounter
3449 {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
3450 \caption@ifundefined\hyper@makecurrent
3451 {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
3452 \caption@ifundefined\measuring@true
3453 {\caption@set@bool\caption@ifhyp@stoppedearly1}{}}}%
3454 }{%
3455 \def\caption@ifhyp@stoppedearly{\IfHyperBoolean{stoppedearly}}%
3456 }%
3457 \caption@ifhyp@stoppedearly{% hyperref has stopped early
3458 \caption@InfoNoLine{%
3459 Hyperref support is turned off\MessageBreak
3460 because hyperref has stopped early}%
3461 }{%
3462 \g@addto@macro\caption@prepareslc{\measuring@true}%
3463 % \end{macrocode}
3464 %
3465 % \begin{macro}{\caption@@@refstepcounter}
3466 % We redefine |\caption@@refstepcounter| so |\H@refstepcounter| will be used
3467 % instead of |\refstepcounter| inside |\caption| \& |\captionlistentry|.
3468 % \begin{macrocode}
3469 \renewcommand*\caption@@@refstepcounter{\H@refstepcounter}%
3470 % \end{macrocode}
3471 % \end{macro}
3472 %
3473 % \begin{macro}{\caption@makecurrent}
3474 % \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
3475 % We redefine |\caption@makecurrent| so a \package{hyperref} label
3476 % will be defined inside |\@caption|.
3477 % \Note{Will be redefined by \cs{caption@start}.}
3478 % \begin{macrocode}
3479 \renewcommand*\caption@makecurrent[2]{%
3480 \caption@makecurrentHref{#1}%
3481 \caption@Debug{hyperref current=\@currentHref}%
3482 \caption@gettitle{#2}}%
3483 % \end{macrocode}
3484 % \begin{macrocode}
3485 \newcommand*\caption@makecurrentHref{\hyper@makecurrent}%
3486 % \end{macrocode}
3487 % \end{macro}
3488 %
3489 % \begin{macro}{\caption@makeanchor}
3490 % \changes{v3.1l}{2010/01/09}{Adapted to the current hyperref package}
3491 % We redefine |\caption@makeanchor| so a \package{hyperref} anchor
3492 % will be set inside |\@caption|.
3493 % \Note{Will be redefined by \cs{caption@start}.}
3494 % \begin{macrocode}
3495 \renewcommand\caption@makeanchor[1]{%
3496 \caption@Debug{hyperref anchor: \@currentHref}%
3497 % If we cannot have nesting, the anchor is empty.
3498 \ifHy@nesting
3499 \expandafter\hyper@@anchor\expandafter{\@currentHref}{#1}%
3500 \else
3501 \Hy@raisedlink{%
3502 \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
3503 }#1%
3504 \fi}%
3505 % \end{macrocode}
3506 % \begin{macrocode}
3507 \g@addto@macro\caption@prepareslc{\let\caption@makeanchor\@firstofone}%
3508 % \end{macrocode}
3509 % \end{macro}
3510 %
3511 % \paragraph{The hypcap option}
3512 %
3513 % \begin{macro}{\if@capstart}
3514 % Like the \package{hypcap} package we define the switch |\if@capstart|, too.
3515 % \begin{macrocode}
3516 \newif\if@capstart
3517 % \end{macrocode}
3518 % \end{macro}
3519 %
3520 % \begin{macro}{\caption@start}
3521 % \changes{v3.0l}{2007/02/20}{%
3522 % \cs{caption@currentHref} renamed to \cs{hc@currentHref}}
3523 % \changes{v3.1}{2007/06/21}{%
3524 % This macro renamed from \cs{capstart} to \cs{caption@start} and revised}
3525 % While the \package{hypcap} package defines a macro called |\capstart|
3526 % our variant is called |\caption@start| and is controlled by the option
3527 % |hypcap=||false|/|true|.
3528 % \begin{macrocode}
3529 \def\caption@start{\caption@ifhypcap\caption@start@\relax}%
3530 \def\caption@start@{%
3531 % \end{macrocode}
3532 % Generate the \package{hyperref} label and set the \package{hyperref} anchor,
3533 % usually (if |hypcap=false|) both is done inside |\@caption|.
3534 % \begin{macrocode}
3535 \caption@makestart\@captype
3536 \caption@startanchor\@currentHref
3537 % \end{macrocode}
3538 % Prevent |\@caption| from generating a new \package{hyperref} label,
3539 % use the label we save in |\hc@currentHref| instead.
3540 % (We also support the |@capstart| flag from the \package{hypcap} package.)
3541 % \begin{macrocode}
3542 \global\@capstarttrue
3543 \let\hc@currentHref\@currentHref
3544 \def\caption@makecurrentHref##1{%
3545 \global\@capstartfalse
3546 \global\let\@currentHref\hc@currentHref}%
3547 % \end{macrocode}
3548 % Prevent |\@caption| from generating a \package{hyperref} anchor since this
3549 % has already been done.
3550 % \begin{macrocode}
3551 \let\caption@makeanchor\@firstofone
3552 % \end{macrocode}
3553 % \begin{macrocode}
3554 }%
3555 % \end{macrocode}
3556 % \end{macro}
3557 %
3558 % \begin{macro}{\caption@makestart}
3559 % \changes{v3.1c}{2007/09/30}{\cs{@currentHref} will be extended by \texttt{caption}
3560 % instead of \texttt{xxx} now}
3561 % |\caption@makestart|\marg{type}
3562 % defines a \package{hyperref} anchor inside |\caption@start|.\par
3563 % Since we offer |\ContinuedFloat| the float counter can change between
3564 % `now' and |\caption|, i.e., we simply don't know the figure or table counter
3565 % yet and therefore we are not able to generate the `right' \package{hyperref}
3566 % label.
3567 % Two different solutions of this problem came into my mind:
3568 % \begin{enumerate}
3569 % \item I could use the aux file for this purpose.\par
3570 % -or-
3571 % \item I set |hypertexnames=false| locally.
3572 % Furthermore I use |#1.caption.|\meta{counter} (instead of |#1.|\meta{counter})
3573 % as naming scheme for |\@currentHref| to avoid conflicts with other hyper
3574 % links which are generated with |hypertexnames=true|.
3575 % \end{enumerate}
3576 % The first idea has the advantage that the `right' anchor name will be
3577 % generated, but one needs an additional \LaTeX\ run if figures or tables
3578 % will be inserted or removed.\par
3579 % The second idea has the advantage that it's very easy to implement, but
3580 % has some side-effects, e.g. the anchor names don't follow the figure or
3581 % table label names anymore.\par
3582 % Since I'm lazy I implemented the second idea, maybe I will revise this
3583 % later on.
3584 % \begin{macrocode}
3585 \newcommand*\caption@makestart[1]{%
3586 \begingroup
3587 \Hy@hypertexnamesfalse
3588 % \gdef\@currentHlabel{}%
3589 \hyper@makecurrent{#1.caption}%
3590 \endgroup
3591 \caption@Debug{hypcap start=\@currentHref}}%
3592 % \end{macrocode}
3593 % \end{macro}
3594 %
3595 % \begin{macro}{\caption@startanchor}
3596 % \changes{v3.1b}{2007/09/17}{Bugfix 06-09-17: We use \cs{caption@anchor} instead of \cs{hyper@@anchor}}
3597 % \changes{v3.1g}{2008/03/16}{Warning about TeX mode replaced with debug info}
3598 % |\caption@startanchor|\marg{Href}
3599 % sets a \package{hyperref} anchor inside |\caption@start|.\par
3600 % This code was taken from the \package{hypcap} package\cite{hypcap} and adapted.
3601 % \Note{Since \cs{hyper@@anchor}\marg{Href}\csmarg{\string\relax} can cause
3602 % a change from vertical mode to horizontal mode (design flaw in
3603 % \package{hyperref} package!?), and since the workaround
3604 % \cs{let}\cs{leavevmode}\cs{relax} which can be found in the
3605 % \package{hypcap} package is not always sufficient
3606 % (for example with ``Direct pdfmark support'' and \texttt{breaklinks=true}),
3607 % we use \cs{caption@anchor} instead of \cs{hyper@@anchor} here.}
3608 % \begin{macrocode}
3609 \newcommand*\caption@startanchor[1]{%
3610 \ifvmode\begingroup
3611 \caption@Debug{hypcap anchor: #1 (vertical mode)}%
3612 \@tempdima\prevdepth
3613 \nointerlineskip
3614 \vspace*{-\caption@hypcapspace}%
3615 \caption@anchor{#1}%
3616 \vspace*{\caption@hypcapspace}%
3617 \prevdepth\@tempdima
3618 \endgroup\else
3619 \caption@Debug{hypcap anchor: #1 (horizontal mode)}%
3620 \caption@anchor{#1}%
3621 \fi}%
3622 % \end{macrocode}
3623 % \end{macro}
3624 %
3625 % \begin{macro}{\caption@anchor}
3626 % \changes{v3.1c}{2007/10/17}{Workaround 07-10-17: We use \cs{caption@raisedlink} instead of \cs{Hy@raisedlink} now}
3627 % |\caption@anchor|\marg{Href} sets a \package{hyperref} anchor.
3628 % \begin{macrocode}
3629 \newcommand*\caption@anchor[1]{%
3630 \ifmeasuring@ \else
3631 \caption@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}%
3632 \fi}%
3633 % \end{macrocode}
3634 % \Note{Since \cs{Hy@raisedlink} change \cs{@tempdima} we surrounded it by \cs{ifvmode},
3635 % suppressing ``\texttt{LaTeX Warning: Float too large for page by 1.0pt}'' in \texttt{sideways} floats.
3636 % (This is not necessary since \package{hyperref} \version{6.77}.)}
3637 % \begin{macrocode}
3638 \ifx\HyperRaiseLinkLength\@tempdima
3639 \def\caption@raisedlink#1{\ifvmode#1\else\Hy@raisedlink{#1}\fi}%
3640 \else
3641 \let\caption@raisedlink\Hy@raisedlink
3642 \fi
3643 % \end{macrocode}
3644 % \end{macro}
3645 %
3646 % \begin{macro}{\caption@@start}
3647 % Will be used by |\caption@freezeHref|. Apart from that we issue a warning
3648 % if we expect a saved \package{hyperref} label coming from |\caption@start|,
3649 % but there isn't any.
3650 % \begin{macrocode}
3651 \def\caption@@start{%
3652 \caption@ifundefined\hc@currentHref{%
3653 \caption@Warning{%
3654 The option `hypcap=true' will be ignored for this\MessageBreak
3655 particular \string\caption}}{}}%
3656 % \end{macrocode}
3657 % \end{macro}
3658 %
3659 % \begin{macro}{\caption@freezeHref}
3660 % Suppress |\caption@start| from generating a \package{hyperref} label and
3661 % setting a \package{hyperref} anchor. Instead if |\@caption| generates a
3662 % \package{hyperref} label, it will be stored in |\caption@currentHref|.
3663 % Furthermore we need to redefine |\caption@setfloatcapt| so no
3664 % \package{hyperref} anchor will be placed in |\@caption|.
3665 % \iffalse
3666 % (Since |\caption@setfloatcapt| will be set to |\@firstofone| inside
3667 % |\subcaption| there is no need to add its restauration to
3668 % |\caption@subtypehook|.)
3669 % \fi
3670 % \begin{macrocode}
3671 \def\caption@freezeHref{%
3672 \let\caption@ORI@start\caption@start
3673 \def\caption@start{\let\caption@start\caption@ORI@start}%
3674 % \end{macrocode}
3675 % \begin{macrocode}
3676 % \let\caption@ORI@@start\caption@@start
3677 % \l@addto@macro\caption@subtypehook{%
3678 % \let\caption@@start\caption@ORI@@start}%
3679 % \end{macrocode}
3680 % \begin{macrocode}
3681 \global\let\caption@currentHref\@undefined
3682 \def\caption@@start{\global\let\caption@currentHref\@currentHref}%
3683 % \end{macrocode}
3684 % \begin{macrocode}
3685 \let\caption@ORI@setfloatcapt\caption@setfloatcapt
3686 \renewcommand*\caption@setfloatcapt{%
3687 \ifx\caption@currentHref\@undefined \else
3688 \let\caption@makeanchor\@firstofone
3689 \fi
3690 \caption@ORI@setfloatcapt}}%
3691 % \end{macrocode}
3692 % \end{macro}
3693 %
3694 % \begin{macro}{\caption@defrostHref}
3695 % If there is a freezed |\@currentHref|, we set the \package{hyperref}
3696 % anchor here.
3697 % \begin{macrocode}
3698 \def\caption@defrostHref{%
3699 \ifx\caption@currentHref\@undefined \else
3700 \caption@startanchor\caption@currentHref
3701 \global\let\caption@currentHref\@undefined
3702 \fi}%
3703 % \end{macrocode}
3704 % \end{macro}
3705 %
3706 % \begin{macrocode}
3707 }}{}
3708 % \end{macrocode}
3709 %
3710 % \subsubsection{The hypcap package}
3711 % \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
3712 % \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} \version{1.6}}
3713 % \changes{v3.1e}{2007/11/04}{\package{hypcap} support adapted to \package{hyperref} \version{6.77}}
3714 %
3715 % \begin{macrocode}
3716 \caption@IfPackageLoaded{hypcap}{% v1.0
3717 \ifx\caption@start\relax \else % hyperref hasn't stopped early
3718 % \end{macrocode}
3719 %
3720 % If the \package{hypcap} package was loaded, we give up our own
3721 % hyperlink placement algorithm and give the control over the placement
3722 % to the \package{hypcap} package instead.
3723 %
3724 % \begin{macro}{\capstart}
3725 % \changes{v3.1k}{2009/10/09}{Support of \cs{ifcapstart} (\package{hypcap} package \version{1.10}) added}
3726 % We do this simply by mapping |\capstart| to |\caption@start@|,
3727 % although our code does not behave exactly like the original one:
3728 % The original |\capstart| has an effect on the next |\caption|
3729 % only but our version affects \emph{all} |\caption|s in the same
3730 % environment, at least unless a new |\capstart| will be placed.
3731 % \begin{macrocode}
3732 \let\caption@ORI@capstart\capstart % save for compatibility mode
3733 \caption@ifundefined\capstarttrue % check for v1.10 of hypcap package
3734 {\def\capstart{\caption@start@}}%
3735 {\def\capstart{\ifcapstart\caption@start@\fi}}%
3736 \let\caption@start\relax
3737 \let\caption@@start\relax
3738 % \end{macrocode}
3739 % \end{macro}
3740 %
3741 % \begin{macro}{\caption@hypcapspace}
3742 % Furthermore we map our |\caption@hypcapspace| to |\hypcapspace|
3743 % offered by the \package{hypcap} package.
3744 % \begin{macrocode}
3745 \caption@set@bool\caption@ifhypcap 1%
3746 \renewcommand*\caption@hypcapspace{\hypcapspace}%
3747 % \end{macrocode}
3748 % \end{macro}
3749 %
3750 % \begin{macrocode}
3751 \fi}{}
3752 % \end{macrocode}
3753 %
3754 % \subsubsection{The listings package}
3755 % \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
3756 %
3757 % \begin{macrocode}
3758 \caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{%
3759 % \end{macrocode}
3760 %
3761 % \begin{macro}{\lst@MakeCaption}
3762 % \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now}
3763 % \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added}
3764 % \changes{v3.2}{2010/10/26}{Bugfix 10-07-20a: Set \cs{hsize} to \cs{linewidth}, if necessary}
3765 % To support the \package{listings} package we need to redefine
3766 % |\lst@MakeCaption| so the original stuff is nested with
3767 % |\caption@begin| and |\caption@end| etc.
3768 % \Note{This macro is always called twice (with `t' resp. `b' as
3769 % parameter), therefore we need an extra group here.}
3770 % \begin{macrocode}
3771 \let\caption@ORI@lst@MakeCaption\lst@MakeCaption
3772 \def\lst@MakeCaption#1{% #1 is `t' or `b'
3773 \begingroup
3774 % \end{macrocode}
3775 % Workaround for bug in \package{listings} package:
3776 % If |\hsize| seems not to be set correctly, we set it to |\linewidth|.
3777 % \changes{v3.3}{2018/04/30}{Bugfix from Ulrike Fischer applied, see also \url{https://github.com/axelsommerfeldt/caption/issues/1}}
3778 % \begin{macrocode}
3779 \@tempdima\linewidth
3780 \advance\@tempdima\lst@xleftmargin
3781 \advance\@tempdima\lst@xrightmargin
3782 \ifdim\hsize>\@tempdima
3783 \hsize\@tempdima
3784 \fi
3785 % \end{macrocode}
3786 % First of all, we set |position=#1| and if it was set to `top',
3787 % we swap the skips so the default behavior of the \package{listings} package
3788 % will not be changed. (Note that the \package{listings} package has set its
3789 % own |\abovecaptionskip| \& |\belowcaptionskip| values prior to calling
3790 % \cs{lst@MakeCaption}.)
3791 % \begin{macrocode}
3792 \caption@setposition{#1}%
3793 \caption@iftop{%
3794 \@tempdima\belowcaptionskip
3795 \belowcaptionskip\abovecaptionskip
3796 \abovecaptionskip\@tempdima}{}%
3797 % \end{macrocode}
3798 % Workaround for issue with wrong skips (FIXME: should be examined further)
3799 % \begin{macrocode}
3800 \caption@setup{rule=0}%
3801 % \end{macrocode}
3802 % Afterwards we set the local `lstlisting' options.
3803 % \begin{macrocode}
3804 \caption@setoptions{lstlisting}%
3805 % \end{macrocode}
3806 % If the |position=| is now set to |auto|, we take over the |captionpos=|
3807 % setting from the \package{listings} package.
3808 % \begin{macrocode}
3809 \caption@setautoposition{#1}%
3810 % \end{macrocode}
3811 % At the end we do similar stuff as in our \cs{@caption} code.
3812 % \begin{macrocode}
3813 \caption@begin{lstlisting}%
3814 \caption@ORI@lst@MakeCaption{#1}%
3815 \caption@end
3816 % \end{macrocode}
3817 % \begin{macrocode}
3818 \endgroup}%
3819 % \end{macrocode}
3820 % \end{macro}
3821 %
3822 % \begin{macro}{\lst@makecaption}
3823 % \begin{macro}{\lst@maketitle}
3824 % Wrapper macros for typesetting the |caption=| resp. |title=| value.
3825 % \begin{macrocode}
3826 \def\lst@makecaption{\caption@starfalse\@makecaption}%
3827 \def\lst@maketitle{\caption@startrue\@makecaption\@empty}%
3828 % \end{macrocode}
3829 % \end{macro}
3830 % \end{macro}
3831 %
3832 % \begin{macro}{\ext@lstlisting}
3833 % \changes{v3.1}{2007/03/03}{This macro added}
3834 % Since the \package{listings} package do not define |\ext@lstlisting|
3835 % but we needed it when |\captionof{lstlisting}| will be done by the end user,
3836 % we define it here.
3837 % \begin{macrocode}
3838 \providecommand*\ext@lstlisting{lol}%
3839 % \end{macrocode}
3840 % \end{macro}
3841 %
3842 % \changes{v3.1a}{2007/07/13}{Bugfix 07-09-13: \cs{lst@@caption} will not be re-defined anymore}
3843 %
3844 % \begin{macrocode}
3845 }{}
3846 % \end{macrocode}
3847 %
3848 % \subsubsection{The longtable package}
3849 %
3850 % \begin{macro}{\LTcaptype}
3851 % \changes{v3.1}{2007/07/06}{This macro and its support added}
3852 % |\LTcaptype| is preset to |table|.
3853 % \begin{macrocode}
3854 \providecommand*\LTcaptype{table}
3855 % \end{macrocode}
3856 % \end{macro}
3857 %
3858 % \begin{macrocode}
3859 \caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{%
3860 % \end{macrocode}
3861 % \begin{macrocode}
3862 \RequirePackage{ltcaption}[=2018/08/26]%
3863 \let\LT@@makecaption\@undefined
3864 % \end{macrocode}
3865 %
3866 % \begin{macro}{\LT@array}
3867 % \changes{v3.1}{2007/07/22}{This redefinition added}
3868 % \changes{v3.1a}{2007/09/14}{Bugfix 07-09-14: Redefinition of \cs{@captionabovetrue} \& \cs{@captionabovefalse} added}
3869 % \changes{v3.1a}{2007/09/16}{Bugfix: This redefinition will always be done \cs{AtBeginDocument}}
3870 % \changes{v3.1g}{2008/01/20}{Bugfix in \cs{captionlistentry}: Table counter will not be incremented anymore, \cs{nameref} works}
3871 % \changes{v3.3}{2016/01/31}{Support for \cs{bicaption} added}
3872 % \changes{v3.3}{2018/10/05}{Definition of \cs{captionlistentry} fixed}
3873 % We redefine |\LT@array| here to get |\captionsetup|\marg{options}
3874 % working inside |longtable|s.
3875 % \Note{Since the \package{hyperref} package patches \cs{LT@array} as well
3876 % and since this only works with the original definition of \cs{LT@array},
3877 % we have to do this after the \package{hyperref} package,
3878 % i.e.~\cs{AtBeginDocument}.}
3879 % \begin{macrocode}
3880 \caption@AtBeginDocument{%
3881 \let\caption@ORI@LT@array\LT@array
3882 \renewcommand*\LT@array{%
3883 % \end{macrocode}
3884 % |\captionsetup| for longtable:
3885 % \begin{macrocode}
3886 \global\let\caption@opt@@longtable\@undefined
3887 \def\captionsetup{%
3888 \noalign\bgroup
3889 \@ifstar\@captionsetup\@captionsetup}% gobble *
3890 \def\@captionsetup##1{\LT@captionsetup{##1}\egroup}%
3891 \def\LT@captionsetup##1{%
3892 \captionsetup@startrue\caption@setup@options[@longtable]{##1}%
3893 \global\let\caption@opt@@longtable\caption@opt@@longtable}%
3894 % \end{macrocode}
3895 % |\captionabove| \& |\captionbelow| for longtable: (\KOMAScript\ document class)
3896 % \begin{macrocode}
3897 \def\@captionabovetrue{\LT@captionsetup{position=t}}%
3898 \def\@captionabovefalse{\LT@captionsetup{position=b}}%
3899 % \end{macrocode}
3900 % |\captionlistentry| for longtable:
3901 % \begin{macrocode}
3902 \def\captionlistentry{%
3903 \noalign\bgroup
3904 \@ifstar{\egroup\LT@listentry\LTcaptype}% gobble *
3905 {\egroup\LT@listentry\LTcaptype}}%
3906 % \end{macrocode}
3907 % |\ContinuedFloat| for longtable:\\
3908 % {\small(Commented out, since it's not deeply tested and quite useless anyway)}
3909 % \Note{\package{hyperref} versions $<$ v6.76j uses $2\times$ \cs{hyper@makecurrent}}
3910 % \begin{macrocode}
3911 % \caption@ifhypcap{%
3912 % \let\caption@ORI@hyper@makecurrent\hyper@makecurrent
3913 % \def\hyper@makecurrent##1{%
3914 % \let\hyper@makecurrent\caption@ORI@hyper@makecurrent
3915 % \caption@makestart{##1}%
3916 %% \let\Hy@LT@currentHlabel\@currentHlabel
3917 % \let\Hy@LT@currentHref\@currentHref
3918 % \def\hyper@makecurrent####1{%
3919 %% \let\@currentHlabel\Hy@LT@currentHlabel
3920 % \let\@currentHref\Hy@LT@currentHref}}%
3921 % \let\caption@ORI@ContinuedFloat\ContinuedFloat
3922 % \def\ContinuedFloat{\noalign{%
3923 % \gdef\caption@setContinuedFloat{%
3924 % \let\caption@resetContinuedFloat\@gobble}%
3925 % \def\caption@setoptions####1{%
3926 % \g@addto@macro\caption@setContinuedFloat{%
3927 % \caption@setoptions{####1}}}%
3928 % \let\@captype\LTcaptype
3929 % \caption@ORI@ContinuedFloat}}%
3930 % }{%
3931 % \def\ContinuedFloat{\noalign{%
3932 % \caption@Error{%
3933 % \noexpand\ContinuedFloat inside longtables\MessageBreak
3934 % is only available with `hypcap=true'}}}%
3935 % }%
3936 % \global\let\caption@setContinuedFloat\@empty
3937 \def\ContinuedFloat{\noalign{%
3938 \caption@Error{\noexpand\ContinuedFloat outside float}}}%
3939 % \end{macrocode}
3940 % |\bicaption| for longtable:
3941 % \begin{macrocode}
3942 \let\bicaption\LT@bicaption
3943 % \end{macrocode}
3944 %
3945 % \begin{macrocode}
3946 \caption@ORI@LT@array}}%
3947 % \end{macrocode}
3948 % \end{macro}
3949 %
3950 % \begin{macro}{\LT@capti@n}
3951 % \changes{v3.3}{2016/02/01}{This re-definition added}
3952 % The original implementation:
3953 % \begin{verbatim}
3954 % \def\LT@capti@n{%
3955 % \@ifstar
3956 % {\egroup\LT@c@ption\@gobble[]}%
3957 % {\egroup\@xdblarg{\LT@c@ption\@firstofone}}}
3958 % \end{verbatim}%^^A
3959 % Our implementation uses |\caption@xdblarg| instead of |\@xdblarg|:
3960 % \begin{macrocode}
3961 \def\LT@capti@n{%
3962 \@ifstar
3963 {\egroup\LT@c@ption\@gobble[]}%
3964 {\egroup\caption@xdblarg{\LT@c@ption\@firstofone}}}%
3965 % \end{macrocode}
3966 % \end{macro}
3967 %
3968 % \begin{macro}{\LT@makecaption}
3969 % \changes{v3.0d}{2004/08/10}{%
3970 % Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
3971 % \changes{v3.0e}{2005/05/05}{%
3972 % Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
3973 % \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
3974 % \changes{v3.3}{2016/02/01}{Support for \cs{bicaption} via \cs{caption@LT@setup} added}
3975 % \changes{v3.3a}{2019/04/02}{Work-around for problem with \package{floatrow} added}
3976 % |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
3977 % \smallskip
3978 % The original definition:
3979 % \begin{verbatim}
3980 % \def\LT@makecaption#1#2#3{%
3981 % \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
3982 % % Based on article class "\@makecaption", "#1" is "\@gobble" in star
3983 % % form, and "\@firstofone" otherwise.
3984 % \sbox\@tempboxa{#1{#2: }#3}%
3985 % \ifdim\wd\@tempboxa>\hsize
3986 % #1{#2: }#3%
3987 % \else
3988 % \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
3989 % \fi
3990 % \endgraf\vskip\baselineskip}%
3991 % \hss}}}
3992 % \end{verbatim}%^^A
3993 % Our definition:
3994 % \begin{macrocode}
3995 \renewcommand\LT@makecaption[3]{%
3996 \caption@LT@make{%
3997 \caption@LT@settype\LTcaptype
3998 % \end{macrocode}
3999 %
4000 % |\caption@LT@setup| is re-defined inside the \package{bicaption} package
4001 % and contains the preparation of typesetting of the bilingual caption.
4002 % \begin{macrocode}
4003 \caption@LT@setup
4004 % \end{macrocode}
4005 %
4006 % \iffalse
4007 % The default |position=| setting for longtables is |top|.
4008 % (This emulates the standard behavior of the \package{longtable} package
4009 % which has no skip above the caption but a skip below it.)
4010 % \fi
4011 %
4012 % |position=auto| is a bad idea for longtables, but we do our very best.
4013 % This works quite well for captions inside the longtable contents, but
4014 % not for captions inside the longtable (end)foot.
4015 % \Note{This should be `top' if unclear!}
4016 % \begin{macrocode}
4017 \caption@setautoposition{\ifcase\LT@rows t\else b\fi}%
4018 % \end{macrocode}
4019 %
4020 % We set |\ifcaption@star| according the 1st argument.
4021 % \begin{macrocode}
4022 \caption@startrue#1\caption@starfalse
4023 % \end{macrocode}
4024 %
4025 % \begin{macrocode}
4026 \caption@prepare@stepcounter\LTcaptype{LT}%
4027 % \end{macrocode}
4028 %
4029 % \changes{v3.1}{2007/05/05}{\cs{caption@normalsize} added}
4030 % \begin{macrocode}
4031 \caption@begin\LTcaptype
4032 \caption@normalsize
4033 % \end{macrocode}
4034 %
4035 % The following skip has the purpose to correct the height of the
4036 % |\parbox[t]|. Usually it's the height of the very first line, but
4037 % because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
4038 % it's always |0pt|.\par
4039 % (A different idea would be typesetting the first skip outside the longtable
4040 % column with |\noalign{\vskip|\ldots|}|, but this means we have to move
4041 % |\caption@begin| to some other place because it does not work in tabular
4042 % mode. And at the moment I have no idea on how to do this in an elegant
4043 % way\ldots)
4044 % \begin{macrocode}
4045 \vskip-\ht\strutbox
4046 % \end{macrocode}
4047 %
4048 % Work-around for problem with \package{floatrow}:
4049 % The |\belowcaptionskip| disturbs the environment in which the caption is actually typeset (by creating extra, unwanted space),
4050 % so we supress this skip if the \package{floatrow} package is loaded.
4051 % (This fixes \issue{50})
4052 % \begin{macrocode}
4053 \caption@ifundefined\FBifcaptop{}{%
4054 \let\caption@belowskip\@empty}%
4055 % \end{macrocode}
4056 %
4057 % The following code should look familiar. We do our skips and use
4058 % |\caption@@make| to typeset the caption itself.
4059 % \begin{macrocode}
4060 \caption@make@above
4061 \caption@@make{#2}{#3}\endgraf
4062 \caption@make@below
4063 \caption@end}}%
4064 % \end{macrocode}
4065 % \end{macro}
4066 %
4067 % \begin{macro}{\LT@listentry}
4068 % \changes{v3.3}{2018/08/26}{This macro added}
4069 % \changes{v3.3}{2018/10/05}{Bugfix: \cs{ignorespaces} added}
4070 % \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
4071 % \begin{macrocode}
4072 \renewcommand*\LT@listentry[2]{%
4073 \begingroup
4074 \caption@LT@settype{#1}%
4075 \caption@listentry\@firstoftwo[{#1}]{#2}%
4076 \endgroup\ignorespaces}%
4077 % \end{macrocode}
4078 % \end{macro}
4079 %
4080 % \begin{macro}{\caption@LT@settype}
4081 % \changes{v3.3}{2018/08/26}{This macro added}
4082 % \changes{v3.3}{2018/10/05}{Uses argument no. 1 instead of \cs{LTcaptype}}
4083 % \begin{macrocode}
4084 \newcommand*\caption@LT@settype[1]{%
4085 \caption@settype*{#1}%
4086 % \end{macrocode}
4087 % If |\LTcapwidth| is not set to its default value |4in| we assume
4088 % that it shall overwrite our own setting.
4089 % (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
4090 % \begin{macrocode}
4091 \ifdim\LTcapwidth=4in \else
4092 \setcaptionwidth\LTcapwidth
4093 \fi
4094 % \end{macrocode}
4095 % \begin{macrocode}
4096 \caption@setoptions{longtable}%
4097 % \caption@setContinuedFloat
4098 % \end{macrocode}
4099 % Finally set options applied by |\captionsetup| inside the longtable.
4100 % \begin{macrocode}
4101 \caption@setoptions{@longtable}}%
4102 % \end{macrocode}
4103 % \end{macro}
4104 %
4105 % \begin{macrocode}
4106 }{}
4107 % \end{macrocode}
4108 %
4109 % \begin{macro}{\caption@LT@setup}
4110 % \changes{v3.3}{2016/02/01}{This macro added}
4111 % Hook for stuff which prepares the typesetting of the \package{longtable} caption.
4112 % \begin{macrocode}
4113 \providecommand*\caption@LT@setup{}
4114 % \end{macrocode}
4115 % \end{macro}
4116 %
4117 % \subsubsection{The picinpar package}
4118 % \changes{v3.1}{2007/06/13}{Support of the \package{picinpar} package added}
4119 %
4120 % \begin{macrocode}
4121 \caption@IfPackageLoaded{picinpar}{%
4122 % \end{macrocode}
4123 %
4124 % \begin{macro}{\figwindow}
4125 % \begin{macro}{\tabwindow}
4126 % The \package{picinpar} package comes with its own caption code
4127 % (|\wincaption|, |\@wincaption|, |\@makewincaption|, \ldots)
4128 % so we redefine |\figwindow| \& |\tabwindow| to use |\caption| instead.
4129 % \begin{macrocode}
4130 \long\def\figwindow[#1,#2,#3,#4] {%
4131 \caption@window{figure}%
4132 \caption@setoptions{figwindow}%
4133 \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
4134 % \end{macrocode}
4135 % \begin{macrocode}
4136 \long\def\tabwindow[#1,#2,#3,#4] {%
4137 \caption@window{table}%
4138 \caption@setoptions{tabwindow}%
4139 \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
4140 % \end{macrocode}
4141 % \end{macro}
4142 % \end{macro}
4143 %
4144 % \begin{macro}{\caption@window}
4145 % \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
4146 % Beside calling |\caption@settype| we redefine |\caption@boxrestore|
4147 % (as in \package{floatflt} \& \package{picins} package support)
4148 % and |\@makecaption| (as in \package{float} package support) here.
4149 % \begin{macrocode}
4150 \newcommand*\caption@window[1]{%
4151 \let\@makecaption\caption@@make
4152 \caption@setautoposition b%
4153 \caption@settype{#1}%
4154 \caption@clearmargin
4155 \caption@setfullparboxrestore}%
4156 % \end{macrocode}
4157 % \end{macro}
4158 %
4159 % \begin{macro}{\caption@wincaption}
4160 % \changes{v3.1d}{2007/10/25}{Missing \% added}
4161 % \changes{v3.3}{2013/04/14}{\cs{caption@ContinuedFloattrue} added}
4162 % \changes{v3.3}{2018/10/06}{\cs{caption@ContinuedFloattrue} replaced by \cs{caption@setflag1}}
4163 % This one finally typesets the caption using |\caption|.
4164 % \begin{macrocode}
4165 \newcommand\caption@wincaption[1]{%
4166 % \end{macrocode}
4167 % This will be done twice for every |figwindow| \& |tabwindow| caption --
4168 % on the first run |\picwd| is |0pt|, on the second run |\picwd| is |\hsize|.
4169 % \begin{macrocode}
4170 \ifdim\picwd=\z@
4171 \let\caption@makecurrent\@gobbletwo
4172 \let\caption@@start\relax
4173 \caption@prepareslc
4174 \else
4175 \caption@setflag1%
4176 \fi
4177 % \end{macrocode}
4178 % The argument |#1| could contain simply the caption text
4179 % (e.g.~|A figure caption|), but it could also contain an optional argument,
4180 % the \meta{lst\_entry}
4181 % (e.g.~|[An| |entry| |to| |the| |LOF]||{A| |figure| |caption}|).
4182 % Therefore we have to test if |#1| begins with~|[| or not; furthermore we
4183 % support a starred variant -- as in |\caption*| -- so we test for~|*|, too.
4184 % \begin{macrocode}
4185 \edef\@tempa{\expandafter\noexpand\@car#1\@nil}%
4186 \if\@tempa*%
4187 \let\@tempa\@firstofone
4188 \else\if\@tempa[%]
4189 \let\@tempa\@firstofone
4190 \else
4191 \let\@tempa\@empty
4192 \fi\fi
4193 \expandafter\caption\@tempa{#1}}%
4194 % \end{macrocode}
4195 % \end{macro}
4196 %
4197 % \begin{macrocode}
4198 }{}
4199 % \end{macrocode}
4200 %
4201 % \subsubsection{The picins package}
4202 % \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
4203 %
4204 % \begin{macro}{\piccaptiontype}
4205 % |\piccaptiontype|\marg{type}\par
4206 % We offer this macro for changing the \meta{type} of the caption, so the user
4207 % doesn't have to redefine |\@captype|, as proposed in the \package{picins}
4208 % documentation.
4209 % \Note{We define this macro here so it can be used in the
4210 % preamble of the document, even when \thispackage\ was loaded prior to the
4211 % \package{picins} package.}
4212 % \begin{macrocode}
4213 \newcommand*\piccaptiontype[1]{\def\@piccaptype{#1}}
4214 % \end{macrocode}
4215 % \end{macro}
4216 %
4217 % \begin{macrocode}
4218 \caption@IfPackageLoaded{picins}{%
4219 % \end{macrocode}
4220 %
4221 % Initial set |\@piccaptype| and undefine |\@captype| which was set to
4222 % |figure| by the \package{picins} package.
4223 % \begin{macrocode}
4224 \caption@ifundefined\@piccaptype{%
4225 \caption@iftype{%
4226 \let\@piccaptype\@captype
4227 }{%
4228 \def\@piccaptype{figure}%
4229 }%
4230 }{}%
4231 \let\@captype\@undefined
4232 % \end{macrocode}
4233 %
4234 % \begin{macro}{\piccaption}
4235 % The original code:
4236 % \begin{verbatim}
4237 % \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
4238 % \end{verbatim}%^^A
4239 % Our code uses |\caption@star| so |\piccaption*| works,
4240 % and |\caption@dblarg| so |\piccaption{}| works correctly.
4241 % \begin{macrocode}
4242 \def\piccaption{\caption@star\relax{\caption@dblarg\@piccaption}}%
4243 % \end{macrocode}
4244 % \end{macro}
4245 %
4246 % \begin{macro}{\make@piccaption}
4247 % \changes{v3.1}{2007/12/06}{Bugfix: \cs{caption@clearmargin} will always be used now}
4248 % The original code:
4249 % \begin{verbatim}
4250 % \def\make@piccaption{%
4251 % [...]
4252 % \setbox\@TEXT=\vbox{\hsize\hsiz@\caption[\sh@rtf@rm]{\capti@nt@xt}}%
4253 % }
4254 % \end{verbatim}%^^A
4255 % In our code we have to correct several things:
4256 % \begin{enumerate}
4257 % \item |\@captype| must be defined, since we have removed the global
4258 % definition.
4259 % \item We use |\caption@setoptions{parpic}| so
4260 % |\captionsetup[parpic]{|\ldots|}| is supported.
4261 % \item |\linewidth| must be set correctly.
4262 % Usually this is done by |\@parboxrestore| inside |\@caption|,
4263 % but since we use |\@caption@boxrestore| we have to map this to
4264 % |\@parboxrestore| instead.
4265 % \item The two arguments of |\caption| (|\sh@rtf@rm| \& |\capti@nt@xt|)
4266 % should be expanded on first level so |\caption[]{|\ldots|}| and
4267 % |\caption[|\ldots|]{}| work correctly.
4268 % \end{enumerate}
4269 % \begin{macrocode}
4270 \let\caption@ORI@make@piccaption\make@piccaption
4271 \def\make@piccaption{%
4272 \let\caption@ORI\caption
4273 % \end{macrocode}
4274 % \begin{macrocode}
4275 \long\def\caption[##1]##2{%
4276 \caption@freezeHref % will be defrosted in \ivparpic
4277 \caption@settype\@piccaptype
4278 % \ifnum\c@piccaptionpos>2\relax
4279 \caption@clearmargin
4280 % \else
4281 % \captionwidth\z@ % do not use "width=" setting
4282 % \fi
4283 \caption@setfullparboxrestore
4284 \caption@setoptions{parpic}%
4285 \caption@setautoposition b%
4286 % \end{macrocode}
4287 % \begin{macrocode}
4288 \expandafter\expandafter\expandafter\caption@ORI
4289 \expandafter\expandafter\expandafter[%
4290 \expandafter\expandafter\expandafter{%
4291 \expandafter##1\expandafter}\expandafter]\expandafter{##2}}%
4292 % \end{macrocode}
4293 % {\footnotesize\begin{quote}
4294 % \leavevmode\llap{-or-\quad}%^^A
4295 % |\begingroup|\\
4296 % | \toks0\expandafter{##1}| |\toks2\expandafter{##2}|\\
4297 % | \edef\x{\endgroup|\\
4298 % | \noexpand\caption@ORI[{\the\toks0}]{\the\toks2}}|\\
4299 % | \x|
4300 % \end{quote}
4301 % \begin{quote}
4302 % \leavevmode\llap{-or-\quad}%^^A
4303 % |\edef\x{%|\\
4304 % | \noexpand\caption@ORI[{\unexpanded\expandafter{##1}}]%|\\
4305 % | {\unexpanded\expandafter{##2}}}|\\
4306 % |\-|
4307 % \end{quote}}
4308 % \begin{macrocode}
4309 \caption@ORI@make@piccaption
4310 \let\caption\caption@ORI}%
4311 % \end{macrocode}
4312 % \end{macro}
4313 %
4314
4315 % \begin{macro}{\ivparpic}
4316 % \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
4317 % We need to set our \package{hyperref} anchor here.
4318 % Not bullet-proof since we have to redefine |\noindent| here!
4319 % \begin{macrocode}
4320 \let\caption@ORI@ivparpic\ivparpic
4321 \def\ivparpic(#1,#2)(#3,#4)[#5][#6]#7{%
4322 \let\caption@ORI@noindent\noindent
4323 \def\noindent{%
4324 \caption@defrostHref
4325 \let\noindent\caption@ORI@noindent
4326 \noindent}%
4327 \caption@ORI@ivparpic(#1,#2)(#3,#4)[{#5}][{#6}]{#7}%
4328 \let\noindent\caption@ORI@noindent}%
4329 % \end{macrocode}
4330 % \end{macro}
4331 %
4332 % \begin{macrocode}
4333 }{%
4334 \let\piccaptiontype\@undefined
4335 }
4336 % \end{macrocode}
4337 %
4338 % \subsubsection{The rotating package}
4339 %
4340 % \begin{macrocode}
4341 \caption@IfPackageLoaded{rotating}[1995/08/22 v2.10]{%
4342 % \end{macrocode}
4343 %
4344 % \begin{macro}{\rotcaption}
4345 % \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@star} removed}
4346 % \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
4347 % Make |\rotcaption*| work.
4348 % \begin{macrocode}
4349 \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
4350 % \let\@rotcaption\@undefined
4351 % \end{macrocode}
4352 % \end{macro}
4353 %
4354 % \begin{macro}{\rotcaptionof}
4355 % \changes{v3.0i}{2005/12/07}{New}
4356 % Make |\rotcaptionof(*)| work.
4357 % \begin{macrocode}
4358 \def\rotcaptionof{%
4359 \caption@teststar\caption@of{\rotcaption*}\rotcaption}%
4360 % \end{macrocode}
4361 % \end{macro}
4362 %
4363 % \begin{macro}{\@makerotcaption}
4364 % \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
4365 % \changes{v3.0m}{2007/03/04}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox} now}
4366 % \changes{v3.3}{2012/12/26}{Rewritten (again)}
4367 % Original (bugfixed) code:
4368 % \begin{verbatim}
4369 % \long\def\@makerotcaption#1#2{%
4370 % \setbox\@tempboxa\hbox{#1: #2}%
4371 % \ifdim \wd\@tempboxa > .8\vsize
4372 % \rotatebox{90}{%
4373 % \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
4374 % }%\par % <== \par removed (AR)
4375 % \else%
4376 % \rotatebox{90}{\box\@tempboxa}%
4377 % \fi
4378 % \nobreak\hspace{12pt}% <== \nobreak added (AR)
4379 % }
4380 % \end{verbatim}%^^A
4381 % Our version emulates this behavior, but if |width=| is set,
4382 % the rotated caption is always typeset as |\parbox|.
4383 % (Note that |margin=| is not supported here.)
4384 % \begin{macrocode}
4385 \long\def\@makerotcaption#1#2{%
4386 \rotatebox{90}{%
4387 \ifdim\captionwidth=\z@
4388 \setcaptionwidth{.8\vsize}%
4389 \l@addto@macro\caption@singleline{%
4390 \caption@setup{parbox=none}}%
4391 \fi
4392 \let\caption@calcmargin\relax
4393 \caption@@make{#1}{#2}}%
4394 \nobreak\hspace{12pt}}%
4395 % \end{macrocode}
4396 % \end{macro}
4397 %
4398 % \begin{macrocode}
4399 }{}
4400 % \end{macrocode}
4401 %
4402 % \subsubsection{The sidecap package}
4403 %
4404 % \begin{macrocode}
4405 \caption@IfPackageLoaded{sidecap}[2003/06/06 v1.6f]{%
4406 \caption@setbool{needfreeze}{1}%
4407 % \end{macrocode}
4408 %
4409 % \begin{macro}{\SC@zfloat}
4410 % \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
4411 % \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@star} removed}
4412 % \changes{v3.1c}{2007/10/06}{\cs{caption} will be saved \& restored now}
4413 % \changes{v3.2a}{2011/08/17}{Bugfix: Uses \cs{caption@freeze} instead of \cs{caption@freeze*} now}
4414 % \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
4415 % \changes{v3.3e}{2022/07/10}{\cs{ignorespaces} appended}
4416 % This macro will be called at the start of the environment, here is a good
4417 % opportunity to do some adaptations to |\caption| and |\captionsetup|.
4418 % \begin{macrocode}
4419 \let\caption@ORI@SC@zfloat\SC@zfloat
4420 \def\SC@zfloat#1#2#3[#4]{%
4421 % \end{macrocode}
4422 % First we use the original definition, but restore \cs{caption} and \cs{label}
4423 % so \cs{caption@freeze} and \cs{caption@warmup} will work correctly.
4424 % \begin{macrocode}
4425 \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]%
4426 \SC@RestoreCommands
4427 % \end{macrocode}
4428 % Since the sidecap package uses our |\caption| code outside the
4429 % environment the regular |\caption|\-|setup| will not work.
4430 % So we need a special version here which saves the given argument list
4431 % which will be executed later on.
4432 % Furthermore we need to make |\caption*| work.
4433 % \begin{macrocode}
4434 \caption@freezetype{#2}%
4435 % \end{macrocode}
4436 % The sidecap package uses |\ifx\label\SC@label| to test if it is just inside a
4437 % |SC|\-|figure| or not. So we redefine |\SC@label| here so this test will still work.
4438 % \begin{macrocode}
4439 \let\SC@label\label
4440 % \end{macrocode}
4441 % Since the original definition of |\SC@zfloat| ends with |\begin{lrbox}| which ends with |\ignore|\-|spaces|,
4442 % we do have to end our re-definition of |\SC@zfloat| with |\ignore|\-|spaces| as well.
4443 % \begin{macrocode}
4444 \ignorespaces}%
4445 % \end{macrocode}
4446 % \begin{macrocode}
4447 \providecommand*\SC@RestoreCommands{%
4448 \let\caption=\SC@orig@caption \let\label=\SC@orig@label}%
4449 % \end{macrocode}
4450 % \end{macro}
4451 %
4452 % \begin{macro}{\endSC@FLOAT}
4453 % \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
4454 % \changes{v3.1}{2007/05/05}{Call of \cs{caption@setoptions}\arg{SCfloat} added}
4455 % This macro will be called at the end of the environment, here we need to
4456 % setup our stuff before the \package{sidecap} package actually typesets
4457 % its caption.
4458 % \begin{macrocode}
4459 \let\caption@ORI@endSC@FLOAT\endSC@FLOAT
4460 \def\endSC@FLOAT{%
4461 % \end{macrocode}
4462 % Before we can typeset the caption we need to set the margin to zero
4463 % because any extra margin would only be disturbing here.\par
4464 % (We don't need to take care about the caption position because
4465 % the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
4466 % to a skip of zero anyway.)\par
4467 % Furthermore |\SC@justify| will override the caption justification, if set.
4468 % The usage of |\SC@justify| differs from version to version of the
4469 % \package{sidecap} package:\par
4470 % \begin{tabular}{ll}
4471 % Version 1.4: & |\SC@justify| is not defined\\
4472 % Version 1.5: & |\SC@justify| is |\relax| when not set\\
4473 % Version 1.6: & |\SC@justify| is |\@empty| when not set\\
4474 % \end{tabular}
4475 % \begin{macrocode}
4476 \def\caption@setSC@justify{%
4477 \caption@clearmargin
4478 \ifx\SC@justify\@empty \else
4479 \let\caption@hj\SC@justify
4480 \let\SC@justify\@empty
4481 \fi}%
4482 % \end{macrocode}
4483 % Make the original definition of |\endSC@FLOAT| to use our caption
4484 % stuff instead of its own.
4485 % \Note{At this point the \package{sidecap} definition of \cs{caption} is valid,
4486 % not the regular one!}
4487 % \begin{macrocode}
4488 \let\caption\SC@orig@caption
4489 \def\SC@orig@caption[##1]##2{%
4490 \caption@setSC@justify
4491 %%% \caption@setoptions{SC}%
4492 \caption@setoptions{SC\@captype}%
4493 \caption@defrost}%
4494 % \end{macrocode}
4495 % Finally we call the original definition of |\endSC@FLOAT|.
4496 % \begin{macrocode}
4497 \caption@setSC@justify % for compatibility mode
4498 \caption@prepare@defrost
4499 \caption@ORI@endSC@FLOAT}%
4500 % \end{macrocode}
4501 % \end{macro}
4502 %
4503 % \begin{macrocode}
4504 }{}
4505 % \end{macrocode}
4506 %
4507 % \subsubsection{The subfigure package}
4508 % \changes{v3.1}{2007/04/06}{subfigure package support added}
4509 %
4510 % \begin{macrocode}
4511 \caption@IfPackageLoaded{subfigure}[2002/01/23 v2.1]{%
4512 % \end{macrocode}
4513 %
4514 % \begin{macro}{\sf@ifpositiontop}
4515 % \changes{v3.1a}{2007/09/15}{Bugfix 07-09-15: Check for \cs{@captype} added}
4516 % If the \package{subfigure} package is loaded, we map |\sf@ifpositiontop|
4517 % to |\iffiguretopcap| resp. |\iftabletopcap|, so the \package{subfigure}
4518 % \version{2.1} options \opt{figbotcap} etc. will still work.
4519 % \begin{macrocode}
4520 \def\sf@ifpositiontop{%
4521 \ifx\@captype\@undefined
4522 \expandafter\@gobbletwo
4523 \else\ifx\@captype\relax
4524 \expandafter\expandafter\expandafter\@gobbletwo
4525 \else
4526 \expandafter\expandafter\expandafter\sf@if@position@top
4527 \fi\fi}
4528 % \end{macrocode}
4529 % \begin{macrocode}
4530 \def\sf@if@position@top{%
4531 \@ifundefined{if\@captype topcap}%
4532 {\@gobbletwo}%
4533 {\@nameuse{if\@captype topcap}%
4534 \expandafter\@firstoftwo
4535 \else
4536 \expandafter\@secondoftwo
4537 \fi}}
4538 % \end{macrocode}
4539 % \end{macro}
4540 %
4541 % \begin{macrocode}
4542 }{}
4543 % \end{macrocode}
4544 %
4545 % \subsubsection{The supertabular and xtab packages}
4546 %
4547 % \begin{macrocode}
4548 \caption@IfPackageLoaded{supertabular}[2002/07/19 v4.1e]{%
4549 % \end{macrocode}
4550 %
4551 % \begin{macro}{\tablecaption}
4552 % \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
4553 % \changes{v3.1h}{2008/04/01}{Bugfix: Star variant does not increment table counter anymore}
4554 % Make |\topcaption*| and |\bottomcaption*| work.
4555 % \begin{macrocode}
4556 \renewcommand*\tablecaption{%
4557 \caption@star
4558 {\refstepcounter{table}}%
4559 {\caption@dblarg{\@xtablecaption}}}%
4560 % \end{macrocode}
4561 % \end{macro}
4562 %
4563 % \begin{macro}{\@xtablecaption}
4564 % \changes{v3.1h}{2008/04/01}{Made \cs{nameref} \& \cs{autoref} work}
4565 % \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
4566 % \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
4567 % Make |\nameref| and |\autoref| work.
4568 % \begin{macrocode}
4569 \let\caption@ORI@xtablecaption\@xtablecaption
4570 \long\def\@xtablecaption[#1]#2{%
4571 \caption@gettitle{#2}%
4572 \caption@ORI@xtablecaption[{#1}]{#2}}%
4573 % \end{macrocode}
4574 % \end{macro}
4575 %
4576 % \begin{macro}{\ST@caption}
4577 % \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
4578 % \changes{v3.1h}{2008/04/01}{Bugfix: \cs{@currentlabelname} will be set now}
4579 % The original code:
4580 % \begin{verbatim}
4581 % \long\def\ST@caption#1[#2]#3{\par%
4582 % \addcontentsline{\csname ext@#1\endcsname}{#1}%
4583 % {\protect\numberline{%
4584 % \csname the#1\endcsname}{\ignorespaces #2}}
4585 % \begingroup
4586 % \@parboxrestore
4587 % \normalsize
4588 % \if@topcaption \vskip -10\p@ \fi
4589 % \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
4590 % \if@topcaption \vskip 10\p@ \fi
4591 % \endgroup}
4592 % \end{verbatim}%^^A
4593 % \begin{macrocode}
4594 \long\def\ST@caption#1[#2]#3{\par%
4595 \caption@settype*{#1}%
4596 \caption@setoptions{supertabular}%
4597 % \end{macrocode}
4598 % The |position=| setting will be overwritten by the
4599 % \package{supertabular} package: If |\topcaption| was used,
4600 % the position will be |top| automatically, |bottom| otherwise.
4601 % \begin{macrocode}
4602 \def\caption@fixposition{%
4603 \caption@setposition{\if@topcaption t\else b\fi}}%
4604 % \end{macrocode}
4605 % \begin{macrocode}
4606 \caption@beginex{#1}{#2}{#3}%
4607 \caption@boxrestore
4608 \caption@normalsize
4609 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
4610 \caption@end}%
4611 % \end{macrocode}
4612 % \end{macro}
4613 %
4614 % \begin{macrocode}
4615 }{}
4616 % \end{macrocode}
4617 %
4618 % \changes{v3.1h}{2008/04/01}{Support of the xtab package added}
4619 % \begin{macrocode}
4620 \caption@IfPackageLoaded{xtab}[2000/04/09 v2.3]{%
4621 % \end{macrocode}
4622 %
4623 % \begin{macro}{\tablecaption}
4624 % Make |\topcaption*| and |\bottomcaption*| work.
4625 % \begin{macrocode}
4626 \renewcommand*\tablecaption{%
4627 \caption@star
4628 {\refstepcounter{table}}%
4629 {\caption@dblarg{\@xtablecaption}}}%
4630 % \end{macrocode}
4631 % \end{macro}
4632 %
4633 % \begin{macro}{\@xtablecaption}
4634 % \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
4635 % \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
4636 % Make |\nameref| and |\autoref| work.
4637 % \begin{macrocode}
4638 \let\caption@ORI@xtablecaption\@xtablecaption
4639 \long\def\@xtablecaption[#1]#2{%
4640 \caption@gettitle{#2}%
4641 \caption@ORI@xtablecaption[{#1}]{#2}}%
4642 % \end{macrocode}
4643 % \end{macro}
4644 %
4645 % \begin{macro}{\ST@caption}
4646 % The original code:
4647 % \begin{verbatim}
4648 % \long\def\ST@caption#1[#2]#3{\par%
4649 % \@initisotab
4650 % \addcontentsline{\csname ext@#1\endcsname}{#1}%
4651 % {\protect\numberline{%
4652 % \csname the#1\endcsname}{\ignorespaces #2}}%
4653 % \begingroup
4654 % \@parboxrestore
4655 % \normalsize
4656 % %% \if@topcaption \vskip -10\p@ \fi
4657 % \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
4658 % %% \if@topcaption \vskip 10\p@ \fi
4659 % \endgroup
4660 % \global\advance\ST@pageleft -\PWSTcapht
4661 % \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}
4662 % \end{verbatim}%^^A
4663 % \begin{macrocode}
4664 \long\def\ST@caption#1[#2]#3{\par%
4665 \caption@settype*{#1}%
4666 \caption@setoptions{xtabular}%
4667 % \end{macrocode}
4668 % \begin{macrocode}
4669 \def\caption@fixposition{%
4670 \caption@setposition{\if@topcaption t\else b\fi}}%
4671 % \end{macrocode}
4672 % \begin{macrocode}
4673 \@initisotab
4674 \caption@beginex{#1}{#2}{#3}%
4675 \caption@boxrestore
4676 \caption@normalsize
4677 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
4678 \caption@end
4679 \global\advance\ST@pageleft -\PWSTcapht
4680 \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}%
4681 % \end{macrocode}
4682 % \end{macro}
4683 %
4684 % \begin{macrocode}
4685 }{}
4686 % \end{macrocode}
4687 %
4688 % \subsubsection{The threeparttable package}
4689 % \changes{v3.1}{2007/05/08}{Support of the \package{threeparttable} package added}
4690 %
4691 % \begin{macrocode}
4692 \caption@IfPackageLoaded{threeparttable}[2003/06/13 v3.0]{%
4693 % \end{macrocode}
4694 %
4695 % \begin{macro}{\threeparttable}
4696 % \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined}
4697 % Unfortunately |\@captype| is not set when |\TPT@common| will be used,
4698 % so we have to redefine |\threeparttable| and |\measuredfigure| instead.
4699 % \begin{macrocode}
4700 \let\caption@ORI@threeparttable\threeparttable
4701 \renewcommand*\threeparttable{%
4702 \caption@settype{\@ifundefined{@captype}{table}{\@captype}}%
4703 %%% \caption@setposition a% ?
4704 \caption@clearmargin
4705 \caption@setoptions{threeparttable}%
4706 \caption@ORI@threeparttable}%
4707 % \end{macrocode}
4708 % \end{macro}
4709 % \begin{macro}{\measuredfigure}
4710 % \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined}
4711 % Same here\ldots
4712 % \begin{macrocode}
4713 \let\caption@ORI@measuredfigure\measuredfigure
4714 \renewcommand*\measuredfigure{%
4715 \caption@settype{\@ifundefined{@captype}{figure}{\@captype}}%
4716 %%% \caption@setposition a% ?
4717 \caption@clearmargin
4718 \caption@setoptions{measuredfigure}%
4719 \caption@ORI@measuredfigure}%
4720 % \end{macrocode}
4721 % \end{macro}
4722 %
4723 % \begin{macro}{\TPT@caption}
4724 % The original code:
4725 % \begin{verbatim}
4726 % \def\TPT@caption#1[#2]#3{\gdef\TPT@docapt
4727 % {\par\global\let\TPT@docapt\@undefined \TPT@LA@caption{#1}[{#2}]%
4728 % {\strut\ignorespaces#3\ifhmode\unskip\@finalstrut\strutbox\fi}}%
4729 % \ifx\TPT@hsize\@empty \let\label\TPT@gatherlabel \abovecaptionskip\z@skip
4730 % \else \TPT@docapt \fi \ignorespaces}
4731 % \end{verbatim}%^^A
4732 % \begin{macrocode}
4733 \def\TPT@caption#1[#2]#3{%
4734 \gdef\TPT@docapt{%
4735 \global\let\TPT@docapt\@undefined
4736 \caption@setautoposition\caption@TPT@position
4737 \TPT@LA@caption{#1}[{#2}]{#3}}%
4738 \ifx\TPT@hsize\@empty
4739 \let\label\TPT@gatherlabel % Bug: does not work for measuredfigures
4740 \gdef\caption@TPT@position{t}%
4741 \g@addto@macro\TPT@docapt\caption@TPT@eatvskip
4742 \else
4743 \def\caption@TPT@position{b}%
4744 \TPT@docapt
4745 \fi
4746 \ignorespaces}%
4747 % \end{macrocode}
4748 % \begin{macrocode}
4749 %\newcommand*\caption@TPT@eatvskip{\vskip-.2\baselineskip}%
4750 \def\caption@TPT@eatvskip#1\vskip{#1\@tempdima=}%
4751 % \end{macrocode}
4752 % \end{macro}
4753 %
4754 % \begin{macrocode}
4755 }{}
4756 % \end{macrocode}
4757 %
4758 % \subsubsection{The wrapfig package}
4759 % \changes{v3.1}{2007/05/05}{Support of the \package{wrapfig} package added}
4760 % \changes{v3.2d}{2011/11/02}{Support of the \package{wrapfig} package rewritten}
4761 %
4762 % \begin{macrocode}
4763 \caption@IfPackageLoaded{wrapfig}[2003/01/31 v3.6]{%
4764 % \end{macrocode}
4765 %
4766 % \begin{macro}{\wrapfloat}
4767 % \changes{v3.2d}{2011/11/02}{Redefinition of this macro added}
4768 % First of all we make the \package{wrapfig} package independent from the package
4769 % load order regarding the \package{float} package.
4770 % Since the usage of |\@float@set|\-|every| is missing in the code of the \package{wrapfig}
4771 % package (it should be in the redefinition of |\float@re|\-|style|, right after
4772 % |\@nameuse{fst@#1}|), we don't use it here, too,
4773 % especially since |\wrap|\-|float| will usually not be used when used with re-styled floats.
4774 % \begin{macrocode}
4775 \renewcommand*\wrapfloat[1]{%
4776 \def\@captype{#1}%
4777 \@ifundefined{fst@#1}{}{%
4778 \@nameuse{fst@#1}%
4779 % \@float@setevery{#1}%
4780 \def\WF@floatstyhook{\let\@currbox\WF@box
4781 \global\setbox\WF@box\float@makebox{\wd\WF@box}}}%
4782 \@ifnextchar[\WF@wr{\WF@wr[]}}
4783 % \end{macrocode}
4784 % \end{macro}
4785 %
4786 % \begin{macro}{\WF@rapt}
4787 % \changes{v3.2d}{2011/11/02}{Usage of \cs{WF@captionstyhook} added}
4788 % Original code:
4789 % \begin{verbatim}
4790 % \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
4791 % \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
4792 % \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
4793 % \ifdim\hsize>\z@ \@parboxrestore \else
4794 % \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
4795 % \ignorespaces \fi}
4796 % \end{verbatim}%^^A
4797 % Our code has |\WF@captionstyhook| in addition:
4798 % \begin{macrocode}
4799 \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
4800 \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
4801 \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
4802 \expandafter\WF@captionstyhook\expandafter{\@captype}% <= new
4803 \ifdim\hsize>\z@ \@parboxrestore \else
4804 \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
4805 \ignorespaces \fi}%
4806 % \end{macrocode}
4807 % \end{macro}
4808 %
4809 % \begin{macro}{\WF@captionstyhook}
4810 % \changes{v3.2d}{2011/11/02}{This macro added}
4811 % \changes{v3.2e}{2011/11/10}{Bugfix 11-11-09: float package support fixed}
4812 % We place our \package{hyperref} anchor here, apply the `wrap' options etc.
4813 % Since the usage of |\@float@set|\-|every| is missing in the \package{wrapfig}
4814 % package we will catch it up here for making the necessary adaptions to the
4815 % \package{float} package.
4816 % \begin{macrocode}
4817 \def\WF@captionstyhook#1{%
4818 \let\@captype\@undefined
4819 \@ifundefined{fst@#1}{}{\@float@setevery{#1}}%
4820 \caption@settype{#1}%
4821 \caption@clearmargin
4822 %%% \caption@setoptions{wrap}%
4823 \caption@setoptions{wrap#1}}%
4824 % \end{macrocode}
4825 % \end{macro}
4826 %
4827 % \begin{macrocode}
4828 }{}
4829 % \end{macrocode}
4830 %
4831 % \iffalse
4832 %</package>
4833 % \fi
4834 %
4835 % \iffalse
4836 % --------------------------------------------------------------------------- %
4837 % \fi
4838 %
4839 % \clearpage
4840 % \begin{thebibliography}{99}
4841 % \bibitem{beamer}
4842 % Till Tantau:\\
4843 % \href{http://www.ctan.org/pkg/beamer}%
4844 % {\emph{The beamer class, User Guide for version 3.25}},\\
4845 % December 26, 2012
4846 %
4847 % \bibitem{KOMAScript}
4848 % Markus Kohm \& Jens-Uwe-Morawski:\\
4849 % \href{http://www.ctan.org/pkg/koma-script}%
4850 % {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\
4851 % 2012-07-22
4852 %
4853 % \bibitem{NTG}
4854 % Victor Eijkhout:\\
4855 % \href{http://www.ctan.org/pkg/ntgclass}%
4856 % {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\
4857 % 3 September 1989
4858 %
4859 % \bibitem{float}
4860 % Anselm Lingnau:\\
4861 % \href{http://www.ctan.org/pkg/float}%
4862 % {\emph{An Improved Environment for Floats}},\\
4863 % 2001/11/08
4864 %
4865 % \bibitem{floatflt}
4866 % Mats Dahlgren:\\
4867 % \href{http://www.ctan.org/pkg/floatflt}%
4868 % {\emph{Welcome to the floatflt package}},\\
4869 % 1998/06/05
4870 %
4871 % \bibitem{floatrow}
4872 % Olga Lapko:\\
4873 % \href{http://www.ctan.org/pkg/floatrow}%
4874 % {\emph{The floatrow package documentation}},\\
4875 % 2009/08/02
4876 %
4877 % \bibitem{fltpage}
4878 % Sebastian Gross:\\
4879 % \href{http://www.ctan.org/pkg/fltpage}%
4880 % {\emph{Welcome to the beta test of fltpage package!}},\\
4881 % 1998/11/13
4882 %
4883 % \bibitem{hyperref}
4884 % Sebastian Rahtz \& Heiko Oberdiek:\\
4885 % \href{http://www.ctan.org/pkg/hyperref}%
4886 % {\emph{Hypertext marks in \LaTeX: a manual for hyperref}},\\
4887 % November 2012
4888 %
4889 % \bibitem{hypcap}
4890 % Heiko Oberdiek:\\
4891 % \href{http://www.ctan.org/pkg/oberdiek}%
4892 % {\emph{The hypcap package -- Adjusting anchors of captions}},\\
4893 % 2011/02/16
4894 %
4895 % \bibitem{listings}
4896 % Carsten Heinz \& Brooks Moses:\\
4897 % \href{http://www.ctan.org/pkg/listings}%
4898 % {\emph{The Listings Package}},\\
4899 % 2007/02/22
4900 %
4901 % \bibitem{longtable}
4902 % David Carlisle:\\
4903 % \href{http://www.ctan.org/pkg/longtable}%
4904 % {\emph{The longtable package}},\\
4905 % 2004/02/01
4906 %
4907 % \bibitem{picinpar}
4908 % Friedhelm Sowa:\\
4909 % \href{http://www.ctan.org/pkg/picinpar}%
4910 % {\emph{Pictures in Paragraphs}},\\
4911 % July 13, 1993
4912 %
4913 % \bibitem{picins}
4914 % Joachim Bleser and Edmund Lang:\\
4915 % \href{http://www.ctan.org/pkg/picins}%
4916 % {\emph{PicIns-Benutzerhandbuch Version 3.0}},\\
4917 % September~1992
4918 %
4919 % \bibitem{rotating}
4920 % Sebastian Rahtz and Leonor Barroca:\\
4921 % \href{http://www.ctan.org/pkg/rotating}%
4922 % {\emph{A style option for rotated objects in \LaTeX}},\\
4923 % 1997/09/26
4924 %
4925 % \bibitem{sidecap}
4926 % Rolf Niepraschk \& Hubert G\"a\ss lein:\\
4927 % \href{http://www.ctan.org/pkg/sidecap}%
4928 % {\emph{The sidecap package}},\\
4929 % 2003/06/06
4930 %
4931 % \bibitem{subfigure}
4932 % Steven D. Cochran:\\
4933 % \href{http://www.ctan.org/pkg/subfigure}%
4934 % {\emph{The subfigure package}},\\
4935 % 2005/03/15
4936 %
4937 % \bibitem{subfig}
4938 % Steven D. Cochran:\\
4939 % \href{http://www.ctan.org/pkg/subfig}%
4940 % {\emph{The subfig package}},\\
4941 % 2005/07/05
4942 %
4943 % \bibitem{supertabular}
4944 % Johannes Braams and Theo Jurriens:\\
4945 % \href{http://www.ctan.org/pkg/supertabular}%
4946 % {\emph{The supertabular environment}},\\
4947 % 2004/02/20
4948 %
4949 % \bibitem{threeparttable}
4950 % Donald Arseneau:\\
4951 % \href{http://www.ctan.org/pkg/threeparttable}%
4952 % {\emph{Three part tables: title, tabular environment, notes}},\\
4953 % March 5, 2010
4954 %
4955 % \bibitem{wrapfig}
4956 % Donald Arseneau:\\
4957 % \href{http://www.ctan.org/pkg/wrapfig}%
4958 % {\emph{WRAPFIG.STY ver 3.6}},\\
4959 % Jan 31, 2003
4960 %
4961 % \bibitem{xtab}
4962 % Peter Wilson:\\
4963 % \href{http://www.ctan.org/pkg/xtab}%
4964 % {\emph{The xtab package}},\\
4965 % 2011/07/31
4966 % \end{thebibliography}
4967 %
4968 % \iffalse
4969 % --------------------------------------------------------------------------- %
4970 % \fi
4971 %
4972 % \clearpage
4973 % \Finale
4974 %
4975 \endinput