Debian Codegraph @

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