Debian Codegraph @

texmf-dist/source/latex/caption/fallback/v3.2/caption3.dtx

raw
1 % \iffalse meta-comment
2 %
3 % This is file `caption3.dtx'.
4 %
5 % Copyright (C) 1994-2011 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{3390}
29 %
30 % \iffalse
31 %<*driver>
32 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
33 \ProvidesFile{caption3.drv}[2011/10/09 v1.4 Implementation of the caption kernel]
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 %\let\ORIsubsection\subsection
42 %\def\subsection{\clearpage\ORIsubsection}
43 %
44 \makeatletter % make room for subsections like 2.16.14 in the TOC
45 %\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
46 \renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
47 \makeatother
48 %
49 \usepackage{ifpdf}
50 \ifpdf
51 \usepackage{mathptmx,courier}
52 \usepackage[scaled=0.90]{helvet}
53 \addtolength\marginparwidth{15pt}
54 \fi
55 %
56 \usepackage{hypdoc}
57 \ifpdf\usepackage{hypdestopt}\fi
58 \hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
59 %
60 \usepackage[debug]{caption3}[2011/07/01]
61 %
62 \DeclareRobustCommand*\eTeX{\texorpdfstring
63 {\leavevmode\hbox{$\varepsilon$}-\TeX}%
64 {e-TeX}}
65 \DeclareRobustCommand*\AmS{\texorpdfstring
66 {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
67 {AMS}}
68 \DeclareRobustCommand*\KOMAScript{\texorpdfstring
69 {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
70 {KOMA-Script}}
71 \DeclareRobustCommand*\NTG{NTG}
72 \DeclareRobustCommand*\SmF{SMF}
73 %
74 \begin{document}
75 \DocInput{caption3.dtx}
76 \end{document}
77 %</driver>
78 % \fi
79 %
80 % \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
81 % \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
82 % \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
83 % \let\class\puresf \let\package\puresf
84 % \let\env\purett \let\opt\purett
85 %
86 % \def\thispackage{the \package{caption} kernel}
87 % \def\Thispackage{The \package{caption} kernel}
88 %
89 % \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
90 % \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
91 % \newcommand*\version[2][]{\textit{v#2}}
92 % \newcommand*\x{\discretionary{-}{}{}}
93 % \newcommand*\xx{\discretionary{}{}{}}
94 %
95 % \GetFileInfo{caption3.drv}
96 % \let\docdate\filedate
97 % \GetFileInfo{caption3.sty}
98 %
99 % \title{The Implementation of
100 % \texorpdfstring{\thispackage\thanks{%^^A
101 % This package has version number \fileversion, last revised \filedate.}}%^^A
102 % {the caption kernel}}
103 % \author{Axel Sommerfeldt\\
104 % \href{mailto:[email protected]}{\texttt{[email protected]}}}
105 % \date{\docdate}
106 % \maketitle
107 %
108 % \begin{abstract}
109 % \Thispackage\ consists of two parts -- the kernel
110 % (|caption3.sty|) and the main package (|caption.sty|).
111 %
112 % The kernel provides all the user commands and internal macros which are
113 % necessary for typesetting captions and setting parameters regarding these.
114 % While the standard \LaTeX\ document classes provide an internal command
115 % called |\@makecaption| and no options to control its behavior (except the
116 % vertical skips above and below the caption itself), we provide similar
117 % commands called |\caption@make| and |\caption@@make|, but with a lot of
118 % options which can be selected with |\captionsetup|.
119 % Loading the kernel part do not change the output of a \LaTeX\ document
120 % -- it just provides functionality which can be used by \LaTeXe\ packages
121 % which typesets captions, for example the \package{caption} and
122 % \package{subfig} packages.
123 % \end{abstract}
124 %
125 % \StopEventually{}
126 % \clearpage
127 % \tableofcontents
128 %
129 % \iffalse
130 % --------------------------------------------------------------------------- %
131 % \fi
132 %
133 % \DoNotIndex{\\,\_,\ ,\@@par}
134 % \DoNotIndex{\@bsphack}
135 % \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
136 % \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
137 % \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
138 % \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
139 % \DoNotIndex{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
140 % \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
141 % \DoNotIndex{\@namedef,\@nameuse}
142 % \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
143 % \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
144 % \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
145 % \DoNotIndex{\@testopt}
146 % \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
147 % \DoNotIndex{\p@,\z@}
148 % \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
149 % \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
150 % \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
151 % \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
152 % \DoNotIndex{\fi,\footnotesize,\global}
153 % \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
154 % \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
155 % \DoNotIndex{\ifx,\ignorespaces,\itshape}
156 % \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
157 % \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
158 % \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
159 % \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
160 % \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
161 % \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
162 % \DoNotIndex{\providecommand,\quad}
163 % \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
164 % \DoNotIndex{\rightskip,\rmfamily}
165 % \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
166 % \DoNotIndex{\small,\string,\space,\strut}
167 % \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
168 % \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
169 % \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
170 % \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
171 % \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
172 % \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
173 % \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
174 % \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
175 %
176 % \iffalse
177 % --------------------------------------------------------------------------- %
178 % \fi
179 %
180 % \setlength{\parskip}{0pt plus 1pt}
181 % \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
182 %
183 % \changes{v1.0}{2003/12/20}{Rewritten; many new commands and features}
184 % \changes{v1.0c}{2004/11/28}{Split into two packages:
185 % \package{caption} \& \package{caption3}}
186 %
187 % \iffalse
188 % --------------------------------------------------------------------------- %
189 % \fi
190 %
191 % \clearpage
192 % \let\subsubsection\subsection
193 % \let\subsection\section
194 %
195 % \iffalse
196 %<*package>
197 % \fi
198 %
199 % \subsection{Identification}
200 %
201 % \begin{macrocode}
202 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
203 \ProvidesPackage{caption3}[2011/11/01 v1.4a caption3 kernel (AR)]
204 % \end{macrocode}
205 %
206 % \subsection{Generic helpers}
207 %
208 % \begin{macro}{\@nameundef}
209 % This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel.
210 % We use it to remove the definition of some commands and keyval options after
211 % |\begin{document}| (to save \TeX\ memory) and to remove caption options defined
212 % with |\captionsetup|\oarg{type}.
213 % \begin{macrocode}
214 \providecommand*\@nameundef[1]{%
215 \expandafter\let\csname #1\endcsname\@undefined}
216 % \end{macrocode}
217 % \end{macro}
218 %
219 % \begin{macro}{\l@addto@macro}
220 % The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which
221 % globally adds tokens to existing macros, like in |\AtBeginDocument|.
222 % This is the same but it works local, not global
223 % (using \cs{edef} instead of \cs{xdef}).
224 % \begin{macrocode}
225 \providecommand\l@addto@macro[2]{%
226 \begingroup
227 \toks@\expandafter{#1#2}%
228 \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
229 \@tempa}
230 % \end{macrocode}
231 % \end{macro}
232 %
233 % \begin{macro}{\bothIfFirst}
234 % \begin{macro}{\bothIfSecond}
235 % |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond|
236 % tests if the second argument is not empty. If yes both arguments get
237 % typeset, otherwise none of them.
238 % \begin{macrocode}
239 \def\bothIfFirst#1#2{%
240 \protected@edef\caption@tempa{#1}%
241 \ifx\caption@tempa\@empty \else
242 #1#2%
243 \fi}
244 % \end{macrocode}
245 % \begin{macrocode}
246 \def\bothIfSecond#1#2{%
247 \protected@edef\caption@tempa{#2}%
248 \ifx\caption@tempa\@empty \else
249 #1#2%
250 \fi}
251 % \end{macrocode}
252 % \end{macro}
253 % \end{macro}
254 %
255 % \begin{macro}{\caption@ifundefined}
256 % \changes{v1.3a}{2011/08/12}{This macro added}
257 % \changes{v1.3b}{2011/08/18}{Made expandable}
258 % Similar to \cs{@ifundefined} offered by the \LaTeX kernel, but does
259 % not define the undefined macro as \cs{relax}.
260 % \begin{macrocode}
261 \newcommand*\caption@ifundefined[1]{%
262 \ifx#1\@undefined
263 \expandafter\@firstoftwo
264 \else\ifx#1\relax
265 \expandafter\expandafter\expandafter\@firstoftwo
266 \else
267 \expandafter\expandafter\expandafter\@secondoftwo
268 \fi\fi}
269 % \end{macrocode}
270 % \end{macro}
271 %
272 % \begin{macro}{\caption@ifinlist}
273 % \changes{v1.1}{2007/07/29}{Rewritten}
274 % This helper macro checks if the first argument is in the comma separated
275 % list which is offered as second argument. So for example
276 % \begin{quote}
277 % |\caption@ifinlist{frank}{axel,frank,olga,steven}{yes}{no}|
278 % \end{quote}
279 % would expand to |yes|.
280 % \begin{macrocode}
281 \newcommand*\caption@ifinlist{%
282 \@expandtwoargs\caption@@ifinlist}
283 % \end{macrocode}
284 % \begin{macrocode}
285 \newcommand*\caption@@ifinlist[2]{%
286 \begingroup
287 \def\@tempa##1,#1,##2\@nil{%
288 \endgroup
289 \ifx\relax##2\relax
290 \expandafter\@secondoftwo
291 \else
292 \expandafter\@firstoftwo
293 \fi}%
294 \@tempa,#2,#1,\@nil}%
295 % \end{macrocode}
296 % \end{macro}
297 %
298 % \begin{macro}{\caption@ifin@list}
299 % \changes{v1.1}{2007/08/12}{This macro added}
300 % |\caption@ifin@list|\marg{cmd}\marg{list entry}\marg{yes}\marg{no}
301 % \begin{macrocode}
302 \newcommand*\caption@ifin@list[2]{%
303 \caption@ifempty@list#1%
304 {\@secondoftwo}%
305 {\@expandtwoargs\caption@@ifinlist{#2}{#1}}}
306 % \end{macrocode}
307 % \end{macro}
308 %
309 % \begin{macro}{\caption@g@addto@list}
310 % \changes{v1.1}{2007/07/29}{This macro added}
311 % |\caption@g@addto@list|\marg{cmd}\marg{list entry}
312 % \begin{macrocode}
313 \newcommand*\caption@g@addto@list[2]{%
314 \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}}
315 % \end{macrocode}
316 % \end{macro}
317 % \begin{macro}{\caption@l@addto@list}
318 % \changes{v1.1}{2007/07/29}{This macro added}
319 % |\caption@l@addto@list|\marg{cmd}\marg{list entry}
320 % \begin{macrocode}
321 \newcommand*\caption@l@addto@list[2]{%
322 \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}}
323 % \end{macrocode}
324 % \end{macro}
325 %
326 % \begin{macro}{\caption@g@removefrom@list}
327 % \changes{v1.1}{2007/07/29}{This macro added}
328 % |\caption@g@removefrom@list|\marg{cmd}\marg{list entry}
329 % \begin{macrocode}
330 \newcommand*\caption@g@removefrom@list[2]{%
331 \caption@l@removefrom@list#1{#2}%
332 \global\let#1#1}
333 % \end{macrocode}
334 % \end{macro}
335 % \begin{macro}{\caption@l@removefrom@list}
336 % \changes{v1.1}{2007/07/29}{This macro added}
337 % |\caption@l@removefrom@list|\marg{cmd}\marg{list entry}\par
338 % \Note[Caveat]{\meta{cmd} will be expanded during this process since
339 % \cs{@removeelement} is using \cs{edef} to build the new list!}
340 % \begin{macrocode}
341 \newcommand*\caption@l@removefrom@list[2]{%
342 \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}}
343 % \end{macrocode}
344 % \end{macro}
345 %
346 % \begin{macro}{\caption@for@list}
347 % \changes{v1.1}{2007/07/29}{This macro added}
348 % |\caption@for@list|\marg{cmd}\marg{code with \#1}
349 % \begin{macrocode}
350 \newcommand*\caption@for@list[2]{%
351 \caption@ifempty@list#1{}{%
352 \def\caption@tempb##1{#2}%
353 \@for\caption@tempa:=#1\do{%
354 \expandafter\caption@tempb\expandafter{\caption@tempa}}}}
355 % \end{macrocode}
356 % \end{macro}
357 %
358 % \begin{macro}{\caption@ifempty@list}
359 % \changes{v1.1}{2007/07/29}{This macro added}
360 % |\caption@ifempty@list|\marg{cmd}\marg{true}\marg{false}
361 % \begin{macrocode}
362 \newcommand*\caption@ifempty@list[1]{%
363 \ifx#1\@undefined
364 \expandafter\@firstoftwo
365 \else\ifx#1\relax
366 \expandafter\expandafter\expandafter\@firstoftwo
367 \else\ifx#1\@empty
368 \expandafter\expandafter\expandafter\expandafter
369 \expandafter\expandafter\expandafter\@firstoftwo
370 \else
371 \expandafter\expandafter\expandafter\expandafter
372 \expandafter\expandafter\expandafter\@secondoftwo
373 \fi\fi\fi}
374 % \end{macrocode}
375 % \end{macro}
376 %
377 % \pagebreak[3]
378 % \begin{macro}{\caption@setbool}
379 % \begin{macro}{\caption@set@bool}
380 % \changes{v1.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added}
381 % \begin{macro}{\caption@ifbool}
382 % \begin{macro}{\caption@undefbool}
383 % For setting and testing boolean options we offer these three helper macros:
384 % \begin{quote}
385 % |\caption@setbool|\marg{name}\marg{value}\\
386 % | |(with |value = false/true/no/yes/off/on/0/1|)\\
387 % |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\
388 % |\caption@undefbool|\marg{name}
389 % \end{quote}
390 % \begin{macrocode}
391 \newcommand*\caption@setbool[1]{%
392 \expandafter\caption@set@bool\csname caption@if#1\endcsname}
393 % \end{macrocode}
394 % \begin{macrocode}
395 \newcommand*\caption@set@bool[2]{%
396 \caption@ifinlist{#2}{1,true,yes,on}{%
397 \let#1\@firstoftwo
398 }{\caption@ifinlist{#2}{0,false,no,off}{%
399 \let#1\@secondoftwo
400 }{%
401 \caption@Error{Undefined boolean value `#2'}%
402 }}}
403 % \end{macrocode}
404 % \begin{macrocode}
405 \newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}}
406 % \end{macrocode}
407 % \begin{macrocode}
408 \newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}}
409 % \end{macrocode}
410 % \end{macro}
411 % \end{macro}
412 % \end{macro}
413 % \end{macro}
414 %
415 % \begin{macro}{\caption@teststar}
416 % \changes{v1.1}{2007/05/08}{This macro and its usage added}
417 % \changes{v1.1e}{2007/10/28}{\cs{caption@teststar@} added}
418 % |\caption@teststar|\marg{cmd}\marg{star arg}\marg{non-star arg}\\
419 % |\caption@teststar@|\marg{cmd}\marg{star arg}\marg{non-star arg}
420 % \begin{macrocode}
421 \newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}}
422 % \end{macrocode}
423 % \begin{macrocode}
424 \newcommand*\caption@teststar@[3]{%
425 \@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}}
426 \AtBeginDocument{\let\caption@teststar@\caption@teststar}
427 % \end{macrocode}
428 % \begin{macrocode}
429 \newcommand*\caption@ifatletter{%
430 \ifnum\the\catcode`\@=11
431 \expandafter\@firstoftwo
432 \else
433 \expandafter\@secondoftwo
434 \fi}
435 \AtBeginDocument{\let\caption@ifatletter\@secondoftwo}
436 % \end{macrocode}
437 % \end{macro}
438 %
439 % \begin{macro}{\caption@withoptargs}
440 % \changes{v1.1}{2007/08/12}{This macro added}
441 % |\caption@withoptargs|\marg{cmd}
442 % \begin{macrocode}
443 \newcommand*\caption@withoptargs[1]{%
444 \@ifstar
445 {\def\caption@tempa{*}\caption@@withoptargs#1}%
446 {\def\caption@tempa{}\caption@@withoptargs#1}}
447 % \end{macrocode}
448 % \begin{macrocode}
449 \def\caption@@withoptargs#1{%
450 \@ifnextchar[%]
451 {\caption@@@withoptargs#1}%
452 {\caption@@@@withoptargs#1}}
453 % \end{macrocode}
454 % \begin{macrocode}
455 \def\caption@@@withoptargs#1[#2]{%
456 \l@addto@macro\caption@tempa{[{#2}]}%
457 \caption@@withoptargs#1}
458 % \end{macrocode}
459 % \begin{macrocode}
460 \def\caption@@@@withoptargs#1{%
461 \expandafter#1\expandafter{\caption@tempa}}
462 % \end{macrocode}
463 % \end{macro}
464 %
465 % \begin{macro}{\caption@gobble}
466 % \changes{v1.4}{2011/08/19}{This macro added}
467 % |\caption@gobble*|\oarg{arg}\oarg{\ldots}\marg{arg}\par
468 % Same as |\@gobble|, but gobbles optional arguments as well.
469 % \begin{macrocode}
470 \DeclareRobustCommand*\caption@gobble{%
471 \caption@withoptargs\@gobbletwo}
472 % \end{macrocode}
473 % \end{macro}
474 %
475 % \begin{macro}{\caption@CheckCommand}
476 % \changes{v1.1}{2007/04/10}{This macro added}
477 % \begin{macro}{\caption@IfCheckCommand}
478 % \changes{v1.1}{2007/04/10}{This macro added}
479 % \changes{v1.2b}{2008/08/02}{Revised so \cs{next} is no longer used}
480 % |\caption@CheckCommand|\marg{macro}\marg{definition of macro}\par
481 % checks if a command already exists, with the same definition.
482 % It can be used more-than-once to check if one of multiple definitions will
483 % finally match.
484 % (It redefines itself later on to |\@gobbletwo| if the two commands match
485 % fine, making further checks harmless.)\par
486 % |\caption@IfCheckCommand|\marg{true}\marg{false}\par
487 % will execute the \meta{true} code if one match was finally given,
488 % the \meta{false} code otherwise.
489 % (It simply checks if |\caption@CheckCommand| is |\@gobbletwo| and
490 % restores the starting definition of |\caption@CheckCommand|.)
491 % \begin{macrocode}
492 \newcommand\caption@DoCheckCommand[2]{%
493 \begingroup
494 \let\@tempa#1%
495 #2%
496 \ifx\@tempa#1%
497 \endgroup
498 \let\caption@CheckCommand\@gobbletwo
499 \else
500 \endgroup
501 \fi}
502 \@onlypreamble\caption@DoCheckCommand
503 % \end{macrocode}
504 % \begin{macrocode}
505 \let\caption@CheckCommand\caption@DoCheckCommand
506 \@onlypreamble\caption@CheckCommand
507 % \end{macrocode}
508 % \begin{macrocode}
509 \newcommand*\caption@IfCheckCommand{%
510 \ifx\caption@CheckCommand\@gobbletwo
511 \let\caption@CheckCommand\caption@DoCheckCommand
512 \expandafter\@firstoftwo
513 \else
514 \expandafter\@secondoftwo
515 \fi}
516 \@onlypreamble\caption@IfCheckCommand
517 % \end{macrocode}
518 % \end{macro}
519 % \end{macro}
520 %
521 % \begin{macro}{\caption@AtBeginDocument}
522 % \changes{v1.1}{2007/04/13}{This macro and its usage added}
523 % \changes{v1.2e}{2010/01/09}{Adapted to the combine document class}
524 % |\caption@AtBeginDocument*|\marg{code}\\
525 % Same as |\AtBeginDocument| but the execution of code
526 % will be surrounded by two |\PackageInfo|s.
527 % The starred variant causes the code to be executed after all code
528 % specified using the non-starred variant.
529 % \begin{macrocode}
530 \let\caption@begindocumenthook\@empty
531 \let\caption@@begindocumenthook\@empty
532 % \end{macrocode}
533 % \begin{macrocode}
534 \def\caption@AtBeginDocument{%
535 \caption@teststar\g@addto@macro
536 \caption@@begindocumenthook\caption@begindocumenthook}
537 %\@onlypreamble\caption@AtBeginDocument
538 % \end{macrocode}
539 % \begin{macrocode}
540 \AtBeginDocument{%
541 \caption@InfoNoLine{Begin \noexpand\AtBeginDocument code}%
542 % \end{macrocode}
543 % \begin{macrocode}
544 \def\caption@AtBeginDocument{%
545 \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}%
546 \caption@begindocumenthook
547 \let\caption@begindocumenthook\relax
548 % \end{macrocode}
549 % \begin{macrocode}
550 \def\caption@AtBeginDocument{%
551 \@ifstar\@firstofone\@firstofone}%
552 \caption@@begindocumenthook
553 \let\caption@@begindocumenthook\relax
554 % \end{macrocode}
555 % \begin{macrocode}
556 \caption@InfoNoLine{End \noexpand\AtBeginDocument code}}
557 % \end{macrocode}
558 % \end{macro}
559 %
560 % \subsection{Information, Warnings, and Errors}
561 %
562 % \begin{macro}{\caption@Info}
563 % \changes{v1.3}{2010/10/25}{Moved from package to kernel}
564 % |\caption@Info|\marg{message}
565 % \begin{macrocode}
566 \newcommand*\caption@Info[1]{%
567 \PackageInfo{caption}{#1}}
568 % \end{macrocode}
569 % \end{macro}
570 % \begin{macro}{\caption@InfoNoLine}
571 % \changes{v1.3}{2010/10/25}{Moved from package to kernel}
572 % |\caption@InfoNoLine|\marg{message}\\
573 % \Note{The \cs{@gobble} at the end of the 2nd argument of
574 % \cs{PackageInfo} suppresses the line number info.
575 % See TLC2\cite{TLC2}, A.4.7, p885 for details.}
576 % \begin{macrocode}
577 \newcommand*\caption@InfoNoLine[1]{%
578 \PackageInfo{caption}{#1\@gobble}}
579 % \end{macrocode}
580 % \end{macro}
581 % \begin{macro}{\caption@Warning}
582 % \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
583 % |\caption@Warning|\marg{message}
584 % \begin{macrocode}
585 \newcommand*\caption@Warning[1]{%
586 \caption@WarningNoLine{#1\on@line}}
587 % \end{macrocode}
588 % \end{macro}
589 % \begin{macro}{\caption@WarningNoLine}
590 % \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
591 % |\caption@WarningNoLine|\marg{message}
592 % \begin{macrocode}
593 \newcommand*\caption@WarningNoLine[1]{%
594 \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}}
595 % \end{macrocode}
596 % \begin{macrocode}
597 \newcommand*\caption@wh{%
598 See the caption package documentation for explanation.}
599 % \end{macrocode}
600 % \end{macro}
601 % \begin{macro}{\caption@Error}
602 % \changes{v1.0j}{2007/01/20}{This macro added, will now be used for errors}
603 % \changes{v1.0o}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}}
604 % \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed}
605 % |\caption@Error|\marg{message}
606 % \begin{macrocode}
607 \newcommand*\caption@Error[1]{%
608 \PackageError{caption}{#1}\caption@eh}
609 % \end{macrocode}
610 % \begin{macrocode}
611 \newcommand*\caption@eh{%
612 If you do not understand this error, please take a closer look\MessageBreak
613 at the documentation of the `caption' package, especially the\MessageBreak
614 section about errors.\MessageBreak\@ehc}
615 % \end{macrocode}
616 % \end{macro}
617 % \begin{macro}{\caption@KV@err}
618 % \changes{v1.1b}{2007/09/18}{This macro added}
619 % \begin{macrocode}
620 \let\caption@KV@err\caption@Error
621 % \end{macrocode}
622 % \end{macro}
623 %
624 % \subsection{Using the keyval package}
625 %
626 % We need the \package{keyval} package for option handling, so we load it here.
627 % \begin{macrocode}
628 \RequirePackage{keyval}[1997/11/10]
629 % \end{macrocode}
630 %
631 % \begin{macro}{\undefine@key}
632 % |\undefine@key|\marg{family}\marg{key}\par
633 % This helper macro is the opposite of |\define@key|, it removes a keyval
634 % definition.
635 % \begin{macrocode}
636 \providecommand*\undefine@key[2]{%
637 \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
638 % \end{macrocode}
639 % \end{macro}
640 %
641 % \begin{macro}{\@onlypreamble@key}
642 % \changes{v1.1}{2007/07/22}{This macro added}
643 % \changes{v1.1e}{2007/11/01}{\cs{KV@err} will be used now instead of \cs{@notprerr}}
644 % |\onlypreamble@key|\marg{family}\marg{key}\par
645 % Analogous to |\@onlypreamble| from \LaTeXe.
646 % \begin{macrocode}
647 \providecommand*\@preamble@keys{}
648 \providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}}
649 \@onlypreamble\@onlypreamble@key
650 \@onlypreamble\@preamble@keys
651 % \end{macrocode}
652 % \begin{macrocode}
653 \providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}}
654 % \end{macrocode}
655 % \begin{macrocode}
656 \caption@AtBeginDocument*{%
657 \def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}%
658 \@preamble@keys
659 \let\@elt\relax}
660 % \end{macrocode}
661 % \end{macro}
662 %
663 % \begin{macro}{\DeclareCaptionOption}
664 % |\DeclareCaptionOption|\marg{option}\oarg{default value}\marg{code}\\
665 % |\DeclareCaptionOption*|\marg{option}\oarg{default value}\marg{code}\par
666 % We declare our options using these commands (instead of using
667 % |\DeclareOption| offered by \LaTeXe), so the keyval package is used.
668 % The starred form makes the option available during the lifetime of the
669 % current package only, so they can be used with |\usepackage|, but
670 % \emph{not} with |\captionsetup| later on.
671 % \begin{macrocode}
672 \newcommand*\DeclareCaptionOption{%
673 \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble}
674 \@onlypreamble\DeclareCaptionOption
675 % \end{macrocode}
676 % \begin{macrocode}
677 \newcommand*\caption@declareoption[2]{%
678 #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}}
679 \@onlypreamble\caption@declareoption
680 % \end{macrocode}
681 % \end{macro}
682 %
683 % \begin{macro}{\DeclareCaptionOptionNoValue}
684 % \changes{v1.1c}{2007/10/06}{This macro added}
685 % |\DeclareCaptionOptionNoValue|\marg{option}\marg{code}\\
686 % |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\par
687 % Same as \cs{DeclareCaptionOption} but issues an error if a value is given.
688 % \begin{macrocode}
689 \newcommand*\DeclareCaptionOptionNoValue{%
690 \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble}
691 \@onlypreamble\DeclareCaptionOptionNoValue
692 % \end{macrocode}
693 % \begin{macrocode}
694 \newcommand\caption@declareoption@novalue[3]{%
695 \caption@declareoption{#1}{#2}[\KV@err]{%
696 \caption@option@novalue{#2}{##1}{#3}}}
697 \@onlypreamble\caption@declareoption@novalue
698 % \end{macrocode}
699 % \begin{macrocode}
700 \newcommand*\caption@option@novalue[2]{%
701 \ifx\KV@err#2%
702 \expandafter\@firstofone
703 \else
704 \KV@err{No value allowed for #1}%
705 \expandafter\@gobble
706 \fi}
707 % \end{macrocode}
708 % \end{macro}
709 %
710 % \begin{macro}{\ifcaptionsetup@star}
711 % \changes{v1.2a}{2008/01/12}{This macro added}
712 % If the starred form of |\captionsetup| is used, this will be set to |true|.
713 % (It will be reset to |false| at the end of |\caption@setkeys|.)
714 % \begin{macrocode}
715 \newif\ifcaptionsetup@star
716 % \end{macrocode}
717 % \end{macro}
718 %
719 % \begin{macro}{\captionsetup}
720 % \changes{v1.0a}{2004/01/17}{Bugfix: Missing \% added}
721 % \changes{v1.1}{2007/07/22}{Starred-variant added}
722 % \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
723 % \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
724 % \changes{v1.2a}{2008/01/12}{\cs{ifcaptionsetup@star} will be set now}
725 % |\captionsetup|\oarg{type}\marg{keyval-list of options}\\
726 % |\captionsetup*|\oarg{type}\marg{keyval-list of options}\par
727 % If the optional argument `type' is specified, we simply save or append
728 % the option list, otherwise we `execute' it with |\setkeys|.
729 % (The non-starred variant issues a warning if \meta{keyval-list of options}
730 % is not used later on.)
731 % \Note{The starred variant will be used inside packages automatically.}
732 % \begin{macrocode}
733 \newcommand*\captionsetup{%
734 \caption@teststar@\@captionsetup\@gobble\@firstofone}
735 % \end{macrocode}
736 % \begin{macrocode}
737 \newcommand*\@captionsetup[1]{%
738 \captionsetup@startrue#1\captionsetup@starfalse
739 \@ifnextchar[\caption@setup@options\caption@setup}
740 % \end{macrocode}
741 % \begin{macrocode}
742 \newcommand*\caption@setup{\caption@setkeys{caption}}
743 % \end{macrocode}
744 % \begin{macrocode}
745 \def\caption@setup@options[#1]#2{%
746 \@bsphack
747 \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi
748 \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}%
749 \@esphack}
750 % \end{macrocode}
751 % \end{macro}
752 %
753 % \begin{macro}{\clearcaptionsetup}
754 % \changes{v1.1}{2007/07/29}{Optional argument added}
755 % \changes{v1.1}{2007/08/17}{Starred variant added}
756 % \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
757 % \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
758 % |\clearcaptionsetup|\oarg{option}\marg{type}\\
759 % |\clearcaptionsetup*|\oarg{option}\marg{type}\par
760 % This removes the saved option list associated with \meta{type}.
761 % If \meta{option} is given, only this option will be removed from the list.
762 % (The starred variant does not issue warnings.)
763 % \Note{The starred variant will be used inside packages automatically.}
764 % \begin{macrocode}
765 \newcommand*\clearcaptionsetup{%
766 \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone}
767 % \end{macrocode}
768 % \begin{macrocode}
769 \newcommand*\@clearcaptionsetup[1]{%
770 \let\caption@tempa#1%
771 \@testopt\@@clearcaptionsetup{}}
772 % \end{macrocode}
773 % \begin{macrocode}
774 \def\@@clearcaptionsetup[#1]#2{%
775 \@bsphack
776 \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
777 {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}%
778 {\ifx,#1,%
779 \caption@clearsetup{#2}%
780 \else
781 \caption@@removefromsetup{#1}{#2}%
782 \fi}%
783 \@esphack}
784 % \end{macrocode}
785 % \begin{macrocode}
786 \newcommand*\caption@clearsetup[1]{%
787 \caption@removefromoptlist{#1}%
788 \@nameundef{caption@opt@#1}}
789 % \end{macrocode}
790 % \begin{macrocode}
791 \newcommand*\caption@removefromsetup{%
792 \let\caption@tempa\@gobble
793 \caption@@removefromsetup}
794 % \end{macrocode}
795 % \begin{macrocode}
796 \newcommand*\caption@@removefromsetup[2]{%
797 \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname
798 \expandafter\let\csname caption@opt@#2\endcsname\@undefined
799 \def\@tempb##1=##2\@nil{##1}%
800 \edef\@tempc{#1}%
801 \@for\@tempa:=\@tempa\do{%
802 \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}%
803 \ifx\@tempd\@tempc
804 \let\caption@tempa\@gobble
805 \else
806 \expandafter\expandafter\expandafter\caption@l@addto@list
807 \expandafter\csname caption@opt@#2\expandafter\endcsname
808 \expandafter{\@tempa}%
809 \fi}%
810 \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
811 {\caption@removefromoptlist{#2}}{}%
812 \caption@tempa{\caption@Warning{%
813 Option `#1' was not in list `#2'\MessageBreak}}}
814 % \end{macrocode}
815 % \end{macro}
816 %
817 % \begin{macro}{\showcaptionsetup}
818 % \changes{v1.0d}{2005/05/03}{Optimized for memory usage}
819 % \changes{v1.1}{2007/07/29}{Bugfix: Does not expand option list anymore}
820 % \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
821 % |\showcaptionsetup|\oarg{package}\marg{type}\par
822 % This comes for debugging issues: It shows the saved option list which
823 % is associated with \meta{type}.
824 % \begin{macrocode}
825 \newcommand*\showcaptionsetup[2][\@firstofone]{%
826 \@bsphack
827 \GenericWarning{}{%
828 #1 Caption Info: Option list on `#2'\MessageBreak
829 #1 Caption Data: \@ifundefined{caption@opt@#2}{%
830 -none-%
831 }{%
832 {\expandafter\expandafter\expandafter\strip@prefix
833 \expandafter\meaning\csname caption@opt@#2\endcsname}%
834 }}%
835 \@esphack}
836 % \end{macrocode}
837 % \end{macro}
838 %
839 % \changes{v1.1}{2007/07/02}{Option \opt{options=} added}
840 % \changes{v1.3}{2010/09/05}{Option \opt{options*=} added}
841 % \begin{macrocode}
842 \DeclareCaptionOption{options}{\caption@setoptions{#1}}
843 \DeclareCaptionOption{options*}{\caption@setoptions*{#1}}
844 % \end{macrocode}
845 %
846 % \begin{macro}{\caption@setoptions}
847 % \changes{v1.0g}{2006/01/03}{Optional argument added}
848 % \changes{v1.0h}{2006/01/26}{Revised}
849 % \changes{v1.0j}{2007/01/30}{Optional argument removed}
850 % \changes{v1.1}{2007/04/11}{Usage of \cs{clearcaptionsetup} added}
851 % \changes{v1.1}{2007/05/09}{Renamed from \cs{caption@settype} to \cs{caption@setoptions}}
852 % \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
853 % \changes{v1.3}{2010/09/05}{Starred variant added}
854 % |\caption@setoptions*|\marg{type or environment or\ldots}\par
855 % Caption options which have been saved with |\captionsetup|\oarg{type} can
856 % be executed by using this command.
857 % It simply executes the saved option list (and clears it afterwards),
858 % if there is any. (The starred variant do not clear the option list.)
859 % \begin{macrocode}
860 \newcommand*\caption@setoptions{%
861 \caption@teststar\caption@set@options\@gobble\@firstofone}
862 % \end{macrocode}
863 % \begin{macrocode}
864 \newcommand*\caption@set@options[2]{%
865 \caption@Debug{options=#2}%
866 \expandafter\let\expandafter\caption@opt\csname caption@opt@#2\endcsname
867 \ifx\caption@opt\relax \else
868 \caption@xsetup\caption@opt
869 #1{\caption@clearsetup{#2}}% #1 = \@firstofone -or- \@gobble
870 \fi}
871 % \end{macrocode}
872 % \begin{macrocode}
873 \newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}}
874 % \end{macrocode}
875 % \end{macro}
876 %
877 % \begin{macro}{\caption@addtooptlist}
878 % \changes{v1.1}{2007/07/22}{This macro added}
879 % \begin{macro}{\caption@removefromoptlist}
880 % \changes{v1.1}{2007/07/22}{This macro added}
881 % \changes{v1.2c}{2008/08/24}{Fatal typo corrected}
882 % |\caption@addtooptlist|\marg{type}\\
883 % |\caption@removefromoptlist|\marg{type}\par
884 % Adds or removes an \meta{type} to the list of unused caption options.
885 % Note that the catcodes of \meta{type} are sanitized here so removing
886 % \meta{type} from the list do not fail when the \package{float} package
887 % is used (since |\float@getstyle| gives a result which tokens have catcode
888 % 12 $=$ ``other'').
889 % \begin{macrocode}
890 \newcommand*\caption@addtooptlist[1]{%
891 \@ifundefined{caption@opt@#1@lineno}{%
892 \caption@dooptlist\caption@g@addto@list{#1}%
893 \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}%
894 }{}}
895 % \end{macrocode}
896 % \begin{macrocode}
897 \newcommand*\caption@removefromoptlist[1]{%
898 \caption@dooptlist\caption@g@removefrom@list{#1}%
899 \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined}
900 % \end{macrocode}
901 % \begin{macrocode}
902 \newcommand*\caption@dooptlist[2]{%
903 \begingroup
904 \edef\@tempa{#2}\@onelevel@sanitize\@tempa
905 \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}%
906 \endgroup}
907 % \end{macrocode}
908 % \begin{macrocode}
909 \AtEndDocument{%
910 \caption@for@list\caption@optlist{%
911 \caption@WarningNoLine{%
912 Unused \string\captionsetup[#1]
913 on input line \csname caption@opt@#1@lineno\endcsname}}}
914 % \end{macrocode}
915 % \end{macro}
916 % \end{macro}
917 %
918 % \begin{macro}{\caption@setkeys}
919 % \changes{v1.0g}{2006/01/03}{This macro added}
920 % \changes{v1.0j}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added}
921 % \changes{v1.0j}{2007/01/30}{Optional argument added}
922 % \changes{v1.0n}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter}
923 % \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed, we use \cs{caption@KV@err} instead}
924 % \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
925 % \changes{v1.2a}{2008/01/12}{\cs{captionsetup@starfalse} added}
926 % \changes{v1.2d}{2009/09/30}{Bugfix 09-09-29: Missing error handler will be defined automatically}
927 % \changes{v1.4}{2011/08/24}{Redefinition of \cs{XKV@err} added}
928 % |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\par
929 % This one simply calls |\setkeys|\marg{family}\marg{key-values}
930 % but lets the error messages not refer to the \package{keyval} package,
931 % but to the \meta{package} package instead.
932 % \begin{macrocode}
933 \newcommand*\caption@setkeys{\@dblarg\caption@@setkeys}
934 % \end{macrocode}
935 % \begin{macrocode}
936 \long\def\caption@@setkeys[#1]#2#3{%
937 \@bsphack
938 % \end{macrocode}
939 % \begin{macrocode}
940 \expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err
941 \expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx
942 \expandafter\let\csname ORI@XKV@err\caption@keydepth\endcsname\XKV@err
943 \edef\caption@keydepth{\caption@keydepth i}%
944 % \end{macrocode}
945 % \begin{macrocode}
946 \expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname
947 \ifx\KV@err\relax
948 \def\KV@err##1{\PackageError{#1}{##1}{%
949 See the #1 package documentation for explanation.}}%
950 \fi
951 \def\KV@errx{\KV@err}%
952 \def\XKV@err{\let\@tempa\XKV@tkey\KV@err}%
953 % \end{macrocode}
954 % \begin{macrocode}
955 \caption@Debug{\protect\setkeys{#2}{#3}}%
956 \setkeys{#2}{#3}%
957 % \end{macrocode}
958 % \begin{macrocode}
959 \edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}%
960 \expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname
961 \expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname
962 \expandafter\let\expandafter\XKV@err\csname ORI@XKV@err\caption@keydepth\endcsname
963 % \end{macrocode}
964 % \begin{macrocode}
965 \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi
966 % \end{macrocode}
967 % \begin{macrocode}
968 \@esphack}
969 % \end{macrocode}
970 % \begin{macrocode}
971 \let\caption@keydepth\@empty
972 % \end{macrocode}
973 % \end{macro}
974 %
975 % \begin{macro}{\caption@ExecuteOptions}
976 % \changes{v1.1}{2007/07/15}{This macro added}
977 % \changes{v1.3}{2010/09/04}{Depends on package now}
978 % |\caption@ExecuteOptions|\marg{package}\marg{key-values}\par
979 % We execute our options using the keyval interface, so we use this one
980 % instead of |\ExecuteOptions| offered by \LaTeXe.
981 % \begin{macrocode}
982 \newcommand*\caption@ExecuteOptions[2]{%
983 \expandafter\@expandtwoargs\csname caption@setkeys@#1\endcsname{#1}{#2}}%
984 \@onlypreamble\caption@ExecuteOptions
985 % \end{macrocode}
986 % \end{macro}
987 %
988 % \begin{macro}{\caption@ProcessOptions}
989 % \changes{v1.0a}{2004/01/23}{Bugfix, see
990 % \purett{news:[email protected]} for details}
991 % \changes{v1.0g}{2006/01/03}{Improvement, uses \cs{caption@setkeys}
992 % instead of \cs{setkeys}}
993 % \changes{v1.0h}{2006/02/23}{Bugfix, now processes only those global
994 % options which have a default value}
995 % \changes{v1.0j}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to
996 % \cs{caption@ProcessOptions} and moved from the package to the kernel}
997 % \changes{v1.1}{2007/04/17}{Star variant added}
998 % |\caption@ProcessOptions*|\marg{package}\par
999 % We process our options using the keyval package, so we use this one
1000 % instead of |\ProcessOptions| offered by \LaTeXe.
1001 % The starred variant do not process the global options.
1002 % (This code was taken from the \package{hyperref} package\cite{hyperref}
1003 % \version{6.74} and improved.)
1004 % \begin{macrocode}
1005 \newcommand*\caption@ProcessOptions{%
1006 \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone}
1007 \@onlypreamble\caption@ProcessOptions
1008 % \end{macrocode}
1009 % \begin{macrocode}
1010 \newcommand\caption@@ProcessOptions[2]{%
1011 \let\@tempc\relax
1012 \let\caption@tempa\@empty
1013 #1{% \@firstofone -or- \@gobble
1014 \@for\CurrentOption:=\@classoptionslist\do{%
1015 \@ifundefined{KV@#2@\CurrentOption}{}{%
1016 \@ifundefined{KV@#2@\CurrentOption @default}{%
1017 \PackageInfo{#2}{Global option `\CurrentOption' ignored}%
1018 }{%
1019 \PackageInfo{#2}{Global option `\CurrentOption' processed}%
1020 \edef\caption@tempa{\caption@tempa\CurrentOption,}%
1021 \@expandtwoargs\@removeelement\CurrentOption
1022 \@unusedoptionlist\@unusedoptionlist
1023 }%
1024 }%
1025 }%
1026 \let\CurrentOption\@empty
1027 }%
1028 \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}%
1029 \AtEndOfPackage{\let\@unprocessedoptions\relax}}
1030 \@onlypreamble\caption@@ProcessOptions
1031 % \end{macrocode}
1032 % \end{macro}
1033 %
1034 % \begin{macro}{\caption@SetupOptions}
1035 % \changes{v1.3}{2010/09/04}{This macro added}
1036 % |\caption@SetupOptions|\marg{package}\marg{code}\par
1037 % After calling this macro |\caption@ExecuteOptions| and
1038 % |\usepackage|\oarg{options}\marg{package}
1039 % will both be mapped to \meta{code} with \meta{package} and \meta{options}
1040 % as arguments |#1| and |#2|. (This helps avoiding ``Option clash'' errors.)
1041 % \begin{macrocode}
1042 \newcommand*\caption@packagelist{}
1043 \@onlypreamble\caption@packagelist
1044 % \end{macrocode}
1045 % \begin{macrocode}
1046 \newcommand\caption@SetupOptions[2]{%
1047 \@namedef{caption@setkeys@#1}##1##2{#2}%
1048 \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname
1049 \@cons\caption@packagelist{{#1}}}
1050 \@onlypreamble\caption@SetupOptions
1051 % \end{macrocode}
1052 % \begin{macrocode}
1053 \let\caption@onefilewithoptions\@onefilewithoptions
1054 \def\@onefilewithoptions#1[#2]{%
1055 \begingroup
1056 \def\@tempa{%
1057 \endgroup
1058 \caption@onefilewithoptions{#1}[{#2}]}%
1059 \def\@tempb{#1}%
1060 \def\@elt##1{%
1061 \def\@tempc{##1}%
1062 \ifx\@tempb\@tempc
1063 \def\@tempa{%
1064 \endgroup
1065 \caption@ExecuteOptions{#1}{#2}%
1066 \caption@onefilewithoptions{#1}[]}%
1067 \fi}
1068 \caption@packagelist
1069 \@tempa}
1070 \@onlypreamble\caption@onefilewithoptions
1071 % \end{macrocode}
1072 % \end{macro}
1073 %
1074 % \subsection{Margin resp. width}
1075 % \changes{v1.0n}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}}
1076 % \changes{v1.0n}{2007/04/03}{Option `twoside' added}
1077 % \changes{v1.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added}
1078 % \changes{v1.2}{2007/11/10}{Option `oneside' added}
1079 %
1080 % \begin{macro}{\captionmargin}
1081 % \begin{macro}{\captionwidth}
1082 % |\captionmargin| and |\captionwidth| contain the extra margin
1083 % resp. the total width used for captions. Please never set these values in
1084 % a direct way, they are just accessible in user documents to provide
1085 % compatibility to \version{1.x}.\par
1086 % Note that we can only set one value at a time, `margin' \emph{or} `width'.
1087 % If |\captionwidth| is not zero we will take this value afterwards,
1088 % otherwise |\captionmargin| and |\captionmargin@|.
1089 % \begin{macrocode}
1090 \newdimen\captionmargin
1091 \newdimen\captionmargin@
1092 \newdimen\captionwidth
1093 % \end{macrocode}
1094 % \end{macro}
1095 % \end{macro}
1096 %
1097 % \begin{macrocode}
1098 \DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
1099 \DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}}
1100 \DeclareCaptionOption{width}{\setcaptionwidth{#1}}
1101 \DeclareCaptionOption{width*}{\setcaptionwidth*{#1}}
1102 % \end{macrocode}
1103 % \begin{macrocode}
1104 \DeclareCaptionOption{calcmargin}{\caption@setcalcmargin{#1}}
1105 \DeclareCaptionOption{calcmargin*}{\caption@setcalcmargin*{#1}}
1106 \DeclareCaptionOption{calcwidth}{\caption@setcalcwidth{#1}}
1107 \DeclareCaptionOption{calcwidth*}{\caption@setcalcwidth*{#1}}
1108 % \end{macrocode}
1109 % \begin{macrocode}
1110 \DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}}
1111 \DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0}
1112 % \end{macrocode}
1113 % \begin{macrocode}
1114 \DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}}
1115 \DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}}
1116 % \end{macrocode}
1117 %
1118 % \begin{macro}{\setcaptionmargin}
1119 % \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
1120 % \changes{v1.0f}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take
1121 % left+right margin}
1122 % \changes{v1.1}{2007/08/11}{Starred variant added}
1123 % \changes{v1.1}{2007/08/12}{\cs{setlength}\cs{captionmargin} \&
1124 % \cs{setlength}\cs{captionmargin@} swapped so
1125 % `\texttt{margin*=}\cs{captionmargin}' works in singleline options}
1126 % \changes{v1.3}{2010/11/07}{Support for option \opt{calcmargin} added}
1127 % |\setcaptionmargin|\marg{amount}\\
1128 % |\setcaptionmargin*|\marg{amount}\par
1129 % Please never use this in user documents, it's just there to
1130 % provide compatibility to the \package{caption2} package.
1131 % \begin{macrocode}
1132 \newcommand*\setcaptionmargin{%
1133 \caption@resetcalcmargin
1134 \caption@setmargin}
1135 % \end{macrocode}
1136 % \begin{macrocode}
1137 \newcommand*\caption@setmargin{%
1138 \caption@teststar\caption@@setmargin\@gobble\@firstofone}
1139 % \end{macrocode}
1140 % \begin{macrocode}
1141 \newcommand*\caption@@setmargin[2]{%
1142 #1{\captionwidth\z@}%
1143 \caption@@@setmargin#2,#2,\@nil}
1144 % \end{macrocode}
1145 % \begin{macrocode}
1146 \def\caption@@@setmargin#1,#2,#3\@nil{%
1147 \setlength\captionmargin@{#2}%
1148 \setlength\captionmargin{#1}%
1149 \addtolength\captionmargin@{-\captionmargin}}
1150 % \end{macrocode}
1151 % \end{macro}
1152 %
1153 % \begin{macro}{\setcaptionwidth}
1154 % \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
1155 % \changes{v1.3}{2010/11/07}{Starred variant added}
1156 % \changes{v1.3}{2010/11/07}{Support for option \opt{calcwidth} added}
1157 % |\setcaptionwidth|\marg{amount}\\
1158 % |\setcaptionwidth*|\marg{amount}\par
1159 % Please never use this in user documents, it's just there to
1160 % provide compatibility to the \package{caption2} package.
1161 % \begin{macrocode}
1162 \newcommand*\setcaptionwidth{%
1163 \caption@resetcalcmargin
1164 \caption@setwidth}
1165 % \end{macrocode}
1166 % \begin{macrocode}
1167 \newcommand*\caption@setwidth{%
1168 \caption@teststar\caption@@setwidth\@gobble\@firstofone}
1169 % \end{macrocode}
1170 % \begin{macrocode}
1171 \newcommand*\caption@@setwidth[2]{%
1172 #1{\captionmargin\z@\captionmargin@\z@}%
1173 \setlength\captionwidth{#2}}%
1174 % \end{macrocode}
1175 % \end{macro}
1176 %
1177 % \begin{macro}{\caption@resetcalcmargin}
1178 % \changes{v1.3}{2010/11/07}{This macro added}
1179 % \begin{macrocode}
1180 \newcommand*\caption@resetcalcmargin{%
1181 \let\caption@calcmargin@hook\@empty}
1182 % \end{macrocode}
1183 % \end{macro}
1184 %
1185 % \begin{macro}{\caption@setcalcmargin}
1186 % \changes{v1.3}{2010/11/07}{This macro added}
1187 % \begin{macrocode}
1188 \newcommand*\caption@setcalcmargin{%
1189 \caption@teststar{\caption@@setcalcmargin\caption@setmargin}%
1190 \@secondoftwo\@firstoftwo}
1191 % \end{macrocode}
1192 % \begin{macrocode}
1193 \newcommand*\caption@@setcalcmargin[3]{%
1194 #2{\caption@resetcalcmargin
1195 \l@addto@macro\caption@calcmargin@hook{#1{#3}}}%
1196 {\l@addto@macro\caption@calcmargin@hook{#1*{#3}}}}
1197 % \end{macrocode}
1198 % \end{macro}
1199 %
1200 % \begin{macro}{\caption@setcalcwidth}
1201 % \changes{v1.3}{2010/11/07}{This macro added}
1202 % \begin{macrocode}
1203 \newcommand*\caption@setcalcwidth{%
1204 \caption@teststar{\caption@@setcalcmargin\caption@setwidth}%
1205 \@secondoftwo\@firstoftwo}
1206 % \end{macrocode}
1207 % \end{macro}
1208 %
1209 % \begin{macro}{\caption@counter}
1210 % \changes{v1.0n}{2007/04/03}{This counter added}
1211 % \changes{v1.1e}{2007/10/28}{Renamed to \cs{caption@thecounter}; \cs{caption@stepcounter} added}
1212 % This counter numbers the captions. At the moment it will be used inside
1213 % |\caption@ifoddpage| only.
1214 % \begin{macrocode}
1215 \newcommand*\caption@thecounter{0}
1216 % \end{macrocode}
1217 % \begin{macrocode}
1218 \newcommand*\caption@stepcounter{%
1219 \@tempcnta\caption@thecounter
1220 \advance\@tempcnta\@ne
1221 \xdef\caption@thecounter{\the\@tempcnta}}
1222 % \end{macrocode}
1223 % \end{macro}
1224 %
1225 % \begin{macro}{\caption@newlabel}
1226 % \changes{v1.0n}{2007/04/03}{This macro added}
1227 % This command is a modified version of |\newlabel| from \LaTeX2e.
1228 % It will be written to the \texttt{.aux} file to
1229 % pass label information from one run to another.
1230 % (We use it inside |\caption@ifoddpage| and |\caption@ragged|.)
1231 % \begin{macrocode}
1232 \newcommand*\caption@newlabel{\@newl@bel{caption@r}}
1233 % \end{macrocode}
1234 % \end{macro}
1235 %
1236 % \begin{macro}{\caption@thepage}
1237 % \changes{v1.0n}{2007/04/03}{This macro added}
1238 % This command is a modified version of |\thepage| from \LaTeX2e.
1239 % It will be used inside |\caption@ifoddpage| only.
1240 % \begin{macrocode}
1241 \newcommand*\caption@thepage{\the\c@page}
1242 % \end{macrocode}
1243 % \end{macro}
1244 %
1245 % \begin{macro}{\caption@label}
1246 % \changes{v1.1}{2007/09/01}{This macro added}
1247 % \changes{v1.2}{2007/12/03}{Definition of \cs{caption@newlabel} in AUX file added}
1248 % This command is a modified version of |\label| from \LaTeX2e.
1249 % It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
1250 % \begin{macrocode}
1251 \newcommand*\caption@label[1]{%
1252 \caption@@label
1253 \protected@write\@auxout{\let\caption@thepage\relax}%
1254 {\string\caption@newlabel{#1}{\caption@thepage}}}
1255 % \end{macrocode}
1256 % \begin{macrocode}
1257 \newcommand*\caption@@label{%
1258 \global\let\caption@@label\relax
1259 \protected@write\@auxout{}%
1260 {\string\providecommand*\string\caption@newlabel[2]{}}}
1261 % \end{macrocode}
1262 % \end{macro}
1263 %
1264 % \begin{macro}{\caption@pageref}
1265 % \changes{v1.1}{2007/09/01}{This macro added}
1266 % \changes{v1.2d}{2009/10/09}{Uses \cs{@latex@warning} instead of \cs{caption@Warning} now}
1267 % This command is a modified version of |\pageref| from \LaTeX2e.
1268 % It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
1269 % \begin{macrocode}
1270 \newcommand*\caption@pageref[1]{%
1271 \expandafter\ifx\csname caption@r@#1\endcsname\relax
1272 \G@refundefinedtrue % => 'There are undefined references.'
1273 \@latex@warning{Reference `#1' on page \thepage \space undefined}%
1274 \else
1275 \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname
1276 \fi}
1277 % \end{macrocode}
1278 % \end{macro}
1279 %
1280 % \begin{macro}{\caption@ifoddpage}
1281 % \changes{v1.0n}{2007/04/03}{This macro added}
1282 % \changes{v1.1e}{2007/10/28}{Incrementation of counter moved to \cs{caption@@make}}
1283 % At the moment this macro uses an own label\ldots ref mechanism,
1284 % but an alternative implementation method would be using the
1285 % \package{refcount} package\cite{refcount} and |\ifodd\getpagerefnumber{|\ldots|}|.
1286 % \Note{This macro re-defines itself so the \texttt{.aux} file will
1287 % only be used once per group.}
1288 % \begin{macrocode}
1289 \newcommand*\caption@ifoddpage{%
1290 \caption@iftwoside{%
1291 \caption@label\caption@thecounter
1292 \caption@pageref\caption@thecounter
1293 \ifodd\caption@thepage
1294 \let\caption@ifoddpage\@firstoftwo
1295 \else
1296 \let\caption@ifoddpage\@secondoftwo
1297 \fi
1298 }{\let\caption@ifoddpage\@firstoftwo}%
1299 % \end{macrocode}
1300 % \begin{macrocode}
1301 \caption@ifoddpage}
1302 % \end{macrocode}
1303 % \end{macro}
1304 %
1305 % \begin{macro}{\caption@setoptcmd}
1306 % \changes{v1.1}{2007/08/11}{This macro added}
1307 % |\caption@setoptcmd|\marg{cmd}\marg{off -or- value}
1308 % \begin{macrocode}
1309 \newcommand*\caption@setoptcmd[2]{%
1310 \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}}
1311 % \end{macrocode}
1312 % \end{macro}
1313 %
1314 % \subsection{Indentions}
1315 %
1316 % \begin{macro}{\caption@indent}
1317 % \changes{v1.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}}
1318 % \begin{macro}{\caption@parindent}
1319 % \begin{macro}{\caption@hangindent}
1320 % These are the indentions we support.
1321 % \begin{macrocode}
1322 \newdimen\caption@indent
1323 \newdimen\caption@parindent
1324 \newdimen\caption@hangindent
1325 % \end{macrocode}
1326 % \end{macro}
1327 % \end{macro}
1328 % \end{macro}
1329 %
1330 % \changes{v1.0b}{2004/05/16}{Defaults added for options \opt{parindent=}
1331 % and \opt{hangindent=}}
1332 % \changes{v1.0f}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption}
1333 % replaced by \cs{caption@@par}}
1334 % \changes{v1.0f}{2005/08/22}{Undocumented defaults for \opt{parindent=},
1335 % \opt{hangindent=}, and \opt{parskip=} removed}
1336 % \begin{macrocode}
1337 \DeclareCaptionOption{indent}[\leftmargini]{% obsolete!
1338 \setlength\caption@indent{#1}}
1339 \DeclareCaptionOption{indention}[\leftmargini]{%
1340 \setlength\caption@indent{#1}}
1341 \DeclareCaptionOption{parindent}{%
1342 \setlength\caption@parindent{#1}}
1343 \DeclareCaptionOption{hangindent}{%
1344 \setlength\caption@hangindent{#1}}
1345 \DeclareCaptionOption{parskip}{%
1346 \l@addto@macro\caption@@par{\setlength\parskip{#1}}}
1347 % \end{macrocode}
1348 %
1349 % \changes{v1.0f}{2005/08/22}{Increased compatibility to KOMA-Script:
1350 % A special version of options `parindent' and `parskip' added}
1351 % \changes{v1.0g}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of
1352 % `parskip' and `parindent' options revised and moved into caption kernel}
1353 % \changes{v1.0h}{2006/02/23}{KOMA-Script variants of `parskip' and
1354 % `parindent' are obsolete now, removed}
1355 % \changes{v1.0m}{2007/03/30}{KOMA-Script variants of `parskip' and
1356 % `parindent' re-added, since they still collide with the current
1357 % version of the subfig package (Sigh!)}
1358 %
1359 % There is an option clash between the \KOMAScript\ document classes
1360 % and the \package{caption} kernel, both define the options |parindent| and
1361 % |parskip| but with different meaning.
1362 % Furthermore the ones defined by the \package{caption} kernel take a
1363 % value as parameter but the \KOMAScript\ ones do not.
1364 % So we need special versions of the options |parindent| and |parskip| here
1365 % which determine if a value is given (and therefore should be treated as
1366 % our option) or not (and therefore should be ignored by us).\footnote{%^^A
1367 % This problem was completely solved due a change of \cs{caption@ProcessOptions}
1368 % in \thispackage\ \version{1.0h}, but we still need this workaround since
1369 % these options would otherwise still collide with the current version $1.3$
1370 % of the \package{subfig} package (Sigh!)}
1371 % \begin{macrocode}
1372 \providecommand*\caption@ifkomaclass{%
1373 \caption@ifundefined\scr@caption\@gobble\@firstofone}
1374 \@onlypreamble\caption@ifkomaclass
1375 % \end{macrocode}
1376 % \begin{macrocode}
1377 \caption@ifkomaclass{%
1378 % \end{macrocode}
1379 % \begin{macrocode}
1380 \let\caption@KV@parindent\KV@caption@parindent
1381 \DeclareCaptionOption{parindent}[]{%
1382 \ifx,#1,%
1383 \caption@Debug{Option `parindent' ignored}%
1384 \else
1385 \caption@KV@parindent{#1}%
1386 \fi}%
1387 % \end{macrocode}
1388 % \begin{macrocode}
1389 \let\caption@KV@parskip\KV@caption@parskip
1390 \DeclareCaptionOption{parskip}[]{%
1391 \ifx,#1,%
1392 \caption@Debug{Option `parskip' ignored}%
1393 \else
1394 \caption@KV@parskip{#1}%
1395 \fi}%
1396 % \end{macrocode}
1397 % \begin{macrocode}
1398 }
1399 % \end{macrocode}
1400 %
1401 % \subsection{Styles}
1402 %
1403 % \begin{macro}{\DeclareCaptionStyle}
1404 % \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
1405 % between arguments do make any harm}
1406 % |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
1407 % \begin{macrocode}
1408 \newcommand*\DeclareCaptionStyle[1]{%
1409 \@testopt{\caption@declarestyle{#1}}{}}
1410 \@onlypreamble\DeclareCaptionStyle
1411 % \end{macrocode}
1412 % \begin{macrocode}
1413 \def\caption@declarestyle#1[#2]#3{%
1414 \global\@namedef{caption@sls@#1}{#2}%
1415 \global\@namedef{caption@sty@#1}{#3}}
1416 \@onlypreamble\caption@declarestyle
1417 % \end{macrocode}
1418 % \end{macro}
1419 %
1420 % \changes{v1.2a}{2008/01/20}{Option \opt{style*=} added}
1421 % \changes{v1.2b}{2008/05/06}{Option \opt{slc=} added}
1422 % \begin{macrocode}
1423 \DeclareCaptionOption{style}{\caption@setstyle{#1}}
1424 \DeclareCaptionOption{style*}{\caption@setstyle*{#1}}
1425 \DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}}
1426 \DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}}
1427 % \end{macrocode}
1428 %
1429 % \begin{macro}{\caption@setstyle}
1430 % \changes{v1.0e}{2005/06/01}{Starred variant added}
1431 % \changes{v1.1}{2007/07/29}{Recursive style definitions should work now}
1432 % \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
1433 % \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
1434 % |\caption@setstyle|\marg{name}\\
1435 % |\caption@setstyle*|\marg{name}\par
1436 % Selecting a caption style means saving the additional
1437 % \meta{single-line-list-of-KV} (this will be done by |\caption@sls|),
1438 % resetting the caption options to the base ones (this will be done using
1439 % |\caption@resetstyle|) and executing the \meta{list-of-KV} options
1440 % (this will be done using |\caption@setup|).\par
1441 % The starred version will give no error message if the given style is not
1442 % defined.
1443 % \begin{macrocode}
1444 \newcommand*\caption@setstyle{%
1445 \caption@teststar\caption@@setstyle\@gobble\@firstofone}
1446 % \end{macrocode}
1447 % \begin{macrocode}
1448 \newcommand*\caption@@setstyle[2]{%
1449 \@ifundefined{caption@sty@#2}%
1450 {#1{\caption@Error{Undefined style `#2'}}}%
1451 {\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname
1452 \ifx\caption@setstyle@flag\@undefined
1453 \let\caption@setstyle@flag\relax
1454 \caption@resetstyle
1455 \caption@xsetup\caption@sty
1456 \let\caption@setstyle@flag\@undefined
1457 \else
1458 \caption@xsetup\caption@sty
1459 \fi
1460 \expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
1461 \expandafter\caption@l@addto@list\expandafter\caption@opt@singleline
1462 \expandafter{\caption@sls}}}
1463 % \end{macrocode}
1464 % \end{macro}
1465 %
1466 % \begin{macro}{\caption@resetstyle}
1467 % \changes{v1.1}{2007/02/04}{%
1468 % This macro renamed from \cs{caption@setdefault} to \cs{caption@resetstyle}}
1469 % \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
1470 % \changes{v1.2}{2007/11/17}{Usage of \texttt{size=} added}
1471 % \changes{v1.2b}{2008/05/06}{Usage of \texttt{rule} added}
1472 % This resets (nearly) all caption options to the base ones.
1473 % \emph{Note that this does not touch the skips and the positioning!}
1474 % \begin{macrocode}
1475 \newcommand*\caption@resetstyle{%
1476 \caption@setup{%
1477 format=plain,labelformat=default,labelsep=colon,textformat=simple,%
1478 justification=justified,font=,size=,labelfont=,textfont=,%
1479 margin=0pt,minmargin=0,maxmargin=0,%
1480 indent=0pt,parindent=0pt,hangindent=0pt,%
1481 slc,rule,strut}%
1482 \caption@clearsetup{singleline}}
1483 % \end{macrocode}
1484 % \end{macro}
1485 %
1486 % \changes{v1.0c}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
1487 % \changes{v1.1}{2007/02/04}{Caption style `default' renamed to `base', and a new `default' added}
1488 % \changes{v1.1}{2007/03/31}{\opt{format=plain} added to caption style \opt{default}}
1489 % \changes{v1.1c}{2007/10/14}{\opt{format=plain} removed from caption style \opt{default}}
1490 % Currently there are two pre-defined styles, called `base' \& `default'.
1491 % The first one is a perfect match to the behavior of |\@makecaption| offered
1492 % by the standard \LaTeX\ document classes (and was called `default' in
1493 % \thispackage\ \version{1.0}), the second one matches the document
1494 % class actually used.
1495 % \begin{macrocode}
1496 \DeclareCaptionStyle{base}[indent=0pt,justification=centering]{}
1497 \DeclareCaptionStyle{default}[indent=0pt,justification=centering]{%
1498 format=default,labelsep=default,textformat=default,%
1499 justification=default,font=default,labelfont=default,textfont=default}
1500 % \end{macrocode}
1501 %
1502 % \subsection{Formats}
1503 %
1504 % \begin{macro}{\DeclareCaptionFormat}
1505 % \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
1506 % between arguments do make any harm}
1507 % \changes{v1.0c}{2005/02/09}{Starred variant added}
1508 % \changes{v1.1c}{2007/10/15}{Optional argument added}
1509 % |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\
1510 % |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par
1511 % The starred form causes the code being typeset in vertical (instead of
1512 % horizontal) mode, but does not support the |indention=| option.
1513 % \begin{macrocode}
1514 \newcommand*\DeclareCaptionFormat{%
1515 \caption@teststar\caption@declareformat\@gobble\@firstofone}
1516 \@onlypreamble\DeclareCaptionFormat
1517 % \end{macrocode}
1518 % \begin{macrocode}
1519 \newcommand*\caption@declareformat[2]{%
1520 \@dblarg{\caption@@declareformat#1{#2}}}
1521 \@onlypreamble\caption@declareformat
1522 % \end{macrocode}
1523 % \begin{macrocode}
1524 \long\def\caption@@declareformat#1#2[#3]#4{%
1525 \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
1526 \global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}%
1527 \global\long\@namedef{caption@fmt@#2}##1##2##3{#4}}
1528 \@onlypreamble\caption@@declareformat
1529 % \end{macrocode}
1530 % \end{macro}
1531 %
1532 % \begin{macrocode}
1533 \DeclareCaptionOption{format}{\caption@setformat{#1}}
1534 % \end{macrocode}
1535 %
1536 % \begin{macro}{\caption@setformat}
1537 % |\caption@setformat|\marg{name}\par
1538 % Selecting a caption format simply means saving the code (in |\caption@fmt|)
1539 % and if the code should be used in horizontal or vertical mode (|\caption@ifh|).
1540 % \begin{macrocode}
1541 \newcommand*\caption@setformat[1]{%
1542 \@ifundefined{caption@fmt@#1}%
1543 {\caption@Error{Undefined format `#1'}}%
1544 {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
1545 \expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname
1546 \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
1547 % \end{macrocode}
1548 % \end{macro}
1549 %
1550 % \begin{macro}{\DeclareCaptionDefaultFormat}
1551 % \changes{v1.2a}{2008/01/31}{This macro added}
1552 % \begin{macrocode}
1553 \newcommand*\DeclareCaptionDefaultFormat[1]{%
1554 \expandafter\def\expandafter\caption@fmt@default\expandafter
1555 {\csname caption@fmt@#1\endcsname}%
1556 \expandafter\def\expandafter\caption@slfmt@default\expandafter
1557 {\csname caption@slfmt@#1\endcsname}%
1558 \expandafter\def\expandafter\caption@ifh@default\expandafter
1559 {\csname caption@ifh@#1\endcsname}}
1560 \@onlypreamble\DeclareCaptionDefaultFormat
1561 % \end{macrocode}
1562 % \end{macro}
1563 %
1564 % \changes{v1.0a}{2004/01/23}{%
1565 % Caption format \opt{default} renamed to \opt{normal}}
1566 % \changes{v1.0e}{2005/05/12}{%
1567 % Caption format \opt{normal} renamed to \opt{@normal}}
1568 % \changes{v1.0f}{2005/08/25}{%
1569 % Caption format \opt{@normal} renamed to \opt{plain} and documented}
1570 % \changes{v1.1c}{2007/10/14}{%
1571 % Single-line variant of caption format \opt{hang} added}
1572 % There are two pre-defined formats, called `plain' and `hang'.
1573 % \begin{macrocode}
1574 \DeclareCaptionFormat{plain}{#1#2#3\par}
1575 % \end{macrocode}
1576 % \begin{macrocode}
1577 \DeclareCaptionFormat{hang}[#1#2#3\par]{%
1578 \caption@ifin@list\caption@lsepcrlist\caption@lsepname
1579 {\caption@Error{%
1580 The option `labelsep=\caption@lsepname' does not work\MessageBreak
1581 with `format=hang'}}%
1582 {\@hangfrom{#1#2}%
1583 \advance\caption@parindent\hangindent
1584 \advance\caption@hangindent\hangindent
1585 \caption@@par#3\par}}
1586 % \end{macrocode}
1587 %
1588 % \changes{v1.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{plain}}
1589 % \changes{v1.0d}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added}
1590 % `default' usually maps to `plain'.
1591 % \begin{macrocode}
1592 \DeclareCaptionDefaultFormat{plain}
1593 % \end{macrocode}
1594 %
1595 % \subsection{Label formats}
1596 %
1597 % \begin{macro}{\DeclareCaptionLabelFormat}
1598 % \changes{v1.0a}{2004/01/17}{%
1599 % Pass through argument \#2 so extra spaces between arguments do make any harm}
1600 % |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
1601 % \begin{macrocode}
1602 \newcommand*\DeclareCaptionLabelFormat[2]{%
1603 \global\@namedef{caption@lfmt@#1}##1##2{#2}}
1604 \@onlypreamble\DeclareCaptionLabelFormat
1605 % \end{macrocode}
1606 % \end{macro}
1607 %
1608 % \begin{macrocode}
1609 \DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
1610 % \end{macrocode}
1611 %
1612 % \begin{macro}{\caption@setlabelformat}
1613 % |\caption@setlabelformat|\marg{name}\par
1614 % Selecting a caption label format simply means saving the code (in |\caption@lfmt|).
1615 % \begin{macrocode}
1616 \newcommand*\caption@setlabelformat[1]{%
1617 \@ifundefined{caption@lfmt@#1}%
1618 {\caption@Error{Undefined label format `#1'}}%
1619 {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
1620 % \end{macrocode}
1621 % \end{macro}
1622 %
1623 % \changes{v1.2}{2007/12/16}{Caption label format \opt{brace} added}
1624 % There are four pre-defined label formats, called `empty', `simple',
1625 % `parens', and `brace'.
1626 % \begin{macrocode}
1627 \DeclareCaptionLabelFormat{empty}{}
1628 \DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
1629 \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
1630 \DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)}
1631 % \end{macrocode}
1632 %
1633 % `default' usually maps to `simple'.
1634 % \begin{macrocode}
1635 \def\caption@lfmt@default{\caption@lfmt@simple}
1636 % \end{macrocode}
1637 %
1638 % \subsection{Label separators}
1639 %
1640 % \begin{macro}{\DeclareCaptionLabelSeparator}
1641 % \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
1642 % between arguments do make any harm}
1643 % \changes{v1.0f}{2005/08/25}{Starred variant added}
1644 % \changes{v1.1}{2007/07/13}{Test for CR added}
1645 % \changes{v1.3}{2011/08/06}{Test for CR revised}
1646 % |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
1647 % |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par
1648 % The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|.
1649 % \begin{macrocode}
1650 \newcommand\DeclareCaptionLabelSeparator{%
1651 \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone}
1652 \@onlypreamble\DeclareCaptionLabelSeparator
1653 % \end{macrocode}
1654 % \begin{macrocode}
1655 \newcommand\caption@declarelabelseparator[3]{%
1656 \global\@namedef{caption@iflf@#2}{#1}%
1657 \global\long\@namedef{caption@lsep@#2}{#3}%
1658 \caption@@declarelabelseparator{#2}#3\\\@nil}
1659 \@onlypreamble\caption@declarelabelseparator
1660 % \end{macrocode}
1661 % \begin{macrocode}
1662 \long\def\caption@@declarelabelseparator#1#2\\#3\@nil{%
1663 \def\@tempa{#3}\ifx\@tempa\@empty \else
1664 \caption@g@addto@list\caption@lsepcrlist{#1}%
1665 \fi}
1666 \@onlypreamble\caption@@declarelabelseparator
1667 % \end{macrocode}
1668 % \end{macro}
1669 %
1670 % \begin{macrocode}
1671 \DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
1672 \DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
1673 % \end{macrocode}
1674 %
1675 % \begin{macro}{\caption@setlabelseparator}
1676 % |\caption@setlabelseparator|\marg{name}\par
1677 % Selecting a caption label separator simply means saving the code (in |\caption@lsep|).
1678 % \begin{macrocode}
1679 \newcommand*\caption@setlabelseparator[1]{%
1680 \@ifundefined{caption@lsep@#1}%
1681 {\caption@Error{Undefined label separator `#1'}}%
1682 {\edef\caption@lsepname{#1}%
1683 \expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
1684 \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
1685 % \end{macrocode}
1686 % \end{macro}
1687 %
1688 % \changes{v1.0e}{2005/06/11}{Bugfix 05-03-23: Caption label separator
1689 % \opt{newline} implementation changed from \cs{newline} to \cs{\textbackslash}}
1690 % \changes{v1.0f}{2005/08/24}{Caption label separator \opt{endash} added}
1691 % There are seven pre-defined label separators, called `none', `colon', `period', `space',
1692 % `quad', `newline', and `endash'.
1693 % \begin{macrocode}
1694 \DeclareCaptionLabelSeparator{none}{}
1695 \DeclareCaptionLabelSeparator{colon}{: }
1696 \DeclareCaptionLabelSeparator{period}{. }
1697 \DeclareCaptionLabelSeparator{space}{ }
1698 \DeclareCaptionLabelSeparator*{quad}{\quad}
1699 \DeclareCaptionLabelSeparator*{newline}{\\}
1700 \DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
1701 % \end{macrocode}
1702 %
1703 % \begin{macro}{\caption@setdefaultlabelsep}
1704 % \changes{v1.2d}{2009/03/29}{This macro added}
1705 % \begin{macrocode}
1706 \newcommand*\caption@setdefaultlabelsep[1]{%
1707 \ifx\caption@lsep\caption@lsep@default
1708 \caption@set@default@labelsep{#1}%
1709 \caption@setlabelseparator{default}%
1710 \else
1711 \caption@set@default@labelsep{#1}%
1712 \fi}
1713 % \end{macrocode}
1714 % \begin{macrocode}
1715 \newcommand*\caption@set@default@labelsep[1]{%
1716 \def\caption@lsep@default{\@nameuse{caption@lsep@#1}}%
1717 \def\caption@iflf@default{\@nameuse{caption@iflf@#1}}}
1718 % \end{macrocode}
1719 % \end{macro}
1720 %
1721 % `default' usually maps to `colon'.
1722 % \begin{macrocode}
1723 \caption@set@default@labelsep{colon}
1724 % \end{macrocode}
1725 %
1726 % \subsection{Text formats}
1727 %
1728 % \begin{macro}{\DeclareCaptionTextFormat}
1729 % \changes{v1.0j}{2007/02/18}{This macro added}
1730 % |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1}
1731 % \begin{macrocode}
1732 \newcommand*\DeclareCaptionTextFormat[2]{%
1733 \global\long\@namedef{caption@tfmt@#1}##1{#2}}
1734 \@onlypreamble\DeclareCaptionTextFormat
1735 % \end{macrocode}
1736 % \end{macro}
1737 %
1738 % \changes{v1.0c}{2005/02/12}{Option \opt{strut=} added}
1739 % \begin{macrocode}
1740 \DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
1741 \DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}}
1742 % \end{macrocode}
1743 %
1744 % \begin{macro}{\caption@settextformat}
1745 % \changes{v1.0j}{2007/02/18}{This macro added}
1746 % |\caption@settextformat|\marg{name}\par
1747 % Selecting a caption text format simply means saving the code (in |\caption@tfmt|).
1748 % \begin{macrocode}
1749 \newcommand*\caption@settextformat[1]{%
1750 \@ifundefined{caption@tfmt@#1}%
1751 {\caption@Error{Undefined text format `#1'}}%
1752 {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
1753 % \end{macrocode}
1754 % \end{macro}
1755 %
1756 % There are three pre-defined text formats, called `empty', `simple' and `period'.
1757 % \changes{v1.4}{2011/10/05}{Pre-defined text format `empty' added}
1758 % \begin{macrocode}
1759 \DeclareCaptionTextFormat{empty}{}
1760 \DeclareCaptionTextFormat{simple}{#1}
1761 \DeclareCaptionTextFormat{period}{#1.}
1762 % \end{macrocode}
1763 %
1764 % `default' usually maps to `simple'.
1765 % \begin{macrocode}
1766 \def\caption@tfmt@default{\caption@tfmt@simple}
1767 % \end{macrocode}
1768 %
1769 % \subsection{Fonts}
1770 %
1771 % \begin{macro}{\DeclareCaptionFont}
1772 % \changes{v1.0a}{2004/01/22}{%
1773 % Bugfix: Multi token arguments are allowed now}
1774 % \changes{v1.1}{2007/05/07}{%
1775 % Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now}
1776 % |\DeclareCaptionFont|\marg{name}\marg{code}
1777 % \begin{macrocode}
1778 \newcommand*\DeclareCaptionFont[2]{%
1779 \define@key{caption@fnt}{#1}[]{\l@addto@macro\caption@fnt{#2}}}
1780 \@onlypreamble\DeclareCaptionFont
1781 % \end{macrocode}
1782 % \end{macro}
1783 %
1784 % \begin{macro}{\DeclareCaptionDefaultFont}
1785 % \changes{v1.1}{2006/05/14}{This macro added}
1786 % \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionFont} to \cs{DeclareCaptionDefaultFont}}
1787 % |\DeclareCaptionDefaultFont|\marg{name}\marg{code}
1788 % \begin{macrocode}
1789 \newcommand*\DeclareCaptionDefaultFont[2]{%
1790 \global\@namedef{caption#1@default}{#2}}
1791 \@onlypreamble\DeclareCaptionDefaultFont
1792 % \end{macrocode}
1793 % \end{macro}
1794 %
1795 % \begin{macrocode}
1796 \DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
1797 \DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}}
1798 \DeclareCaptionDefaultFont{font}{}
1799 % \end{macrocode}
1800 % \begin{macrocode}
1801 \DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
1802 \DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}}
1803 \DeclareCaptionDefaultFont{labelfont}{}
1804 % \end{macrocode}
1805 % \begin{macrocode}
1806 \DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
1807 \DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}}
1808 \DeclareCaptionDefaultFont{textfont}{}
1809 % \end{macrocode}
1810 %
1811 % \begin{macro}{\caption@setfont}
1812 % \changes{v1.0j}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument}
1813 % \changes{v1.1}{2006/05/14}{Support of \cs{DeclareDefaultCaptionFont} added}
1814 % |\caption@setfont|\marg{name}\marg{keyval-list of names}\par
1815 % Selecting a caption font means saving all the code snippets
1816 % in |\caption|\meta{name}.
1817 % \begin{macrocode}
1818 \newcommand*\caption@setfont[1]{%
1819 \expandafter\let\csname caption#1\endcsname\@empty
1820 \caption@addtofont{#1}}
1821 % \end{macrocode}
1822 % \end{macro}
1823 %
1824 % \begin{macro}{\caption@addtofont}
1825 % \changes{v1.2}{2007/11/17}{This macro added}
1826 % |\caption@addtofont|\marg{name}\marg{keyval-list of names}\par
1827 % Like |\caption@setfont|, but adds the code snippets to |\caption|\meta{name}.\par
1828 % Because we use |\setkeys| recursive here we need to do this inside an
1829 % extra group.
1830 % \begin{macrocode}
1831 \newcommand*\caption@addtofont[2]{%
1832 \begingroup
1833 \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname
1834 \define@key{caption@fnt}{default}[]{%
1835 \l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}%
1836 \caption@setkeys[caption]{caption@fnt}{#2}%
1837 \global\let\caption@tempa\caption@fnt
1838 \endgroup
1839 \expandafter\let\csname caption#1\endcsname\caption@tempa}
1840 % \end{macrocode}
1841 % \end{macro}
1842 %
1843 % \begin{macro}{\caption@font}
1844 % \changes{v1.1}{2007/05/07}{This macro added}
1845 % |\caption@font|\marg{keyval-list of names}\\
1846 % |\caption@font*|\marg{keyval-code}\par
1847 % Sets the given font, e.g.~|\caption@font{small,it}|
1848 % is equivalent to |\small\itshape|.
1849 % \begin{macrocode}
1850 \newcommand*\caption@font{%
1851 \caption@teststar\caption@@font\@firstofone
1852 {\caption@setkeys[caption]{caption@fnt}}}
1853 \newcommand*\caption@@font[2]{%
1854 \begingroup
1855 \def\caption@fnt{\endgroup}%
1856 #1{#2}%
1857 \caption@fnt}
1858 % \end{macrocode}
1859 % \end{macro}
1860 %
1861 % These are the pre-defined font code snippets.
1862 %
1863 % \changes{v1.1}{2007/05/07}{Color font support added}
1864 % \begin{macrocode}
1865 \DeclareCaptionFont{normalcolor}{\normalcolor}
1866 \DeclareCaptionFont{color}{\color{#1}}
1867 % \end{macrocode}
1868 %
1869 % \begin{macrocode}
1870 \DeclareCaptionFont{normalfont}{\normalfont}
1871 \DeclareCaptionFont{up}{\upshape}
1872 \DeclareCaptionFont{it}{\itshape}
1873 \DeclareCaptionFont{sl}{\slshape}
1874 \DeclareCaptionFont{sc}{\scshape}
1875 \DeclareCaptionFont{md}{\mdseries}
1876 \DeclareCaptionFont{bf}{\bfseries}
1877 \DeclareCaptionFont{rm}{\rmfamily}
1878 \DeclareCaptionFont{sf}{\sffamily}
1879 \DeclareCaptionFont{tt}{\ttfamily}
1880 % \end{macrocode}
1881 %
1882 % \begin{macrocode}
1883 \DeclareCaptionFont{scriptsize}{\scriptsize}
1884 \DeclareCaptionFont{footnotesize}{\footnotesize}
1885 \DeclareCaptionFont{small}{\small}
1886 \DeclareCaptionFont{normalsize}{\normalsize}
1887 \DeclareCaptionFont{large}{\large}
1888 \DeclareCaptionFont{Large}{\Large}
1889 % \end{macrocode}
1890 %
1891 % \changes{v1.3}{2011/01/01}{\package{sansmath} package support added}
1892 % \begin{macrocode}
1893 \DeclareCaptionFont{sansmath}{\sansmath}
1894 % \end{macrocode}
1895 %
1896 % \changes{v1.0n}{2007/04/02}{\package{setspace} package support added}
1897 % \changes{v1.2d}{2009/10/09}{Bugfix 09-05-18: \package{setspace} package support revised}
1898 % \begin{macrocode}
1899 \DeclareCaptionFont{singlespacing}{%
1900 \caption@ifundefined\setspace@singlespace{}{%
1901 \setstretch\setspace@singlespace}}% normally 1
1902 \DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
1903 \DeclareCaptionFont{doublespacing}{\doublespacing}
1904 \DeclareCaptionFont{stretch}{\setstretch{#1}}
1905 % \end{macrocode}
1906 %
1907 % \begin{macrocode}
1908 %\DeclareCaptionFont{normal}{%
1909 % \caption@font{normalcolor,normalfont,normalsize,singlespacing}
1910 \DeclareCaptionFont{normal}{%
1911 \caption@font*{%
1912 \KV@caption@fnt@normalcolor\@unused
1913 \KV@caption@fnt@normalfont\@unused
1914 \KV@caption@fnt@normalsize\@unused
1915 \KV@caption@fnt@singlespacing\@unused}}
1916 % \end{macrocode}
1917 %
1918 % \changes{v1.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
1919 % The old versions \version{1.x} of \thispackage\ offered this
1920 % command to setup the font size used for captions. We still do
1921 % so old documents will work fine.
1922 % \begin{macrocode}
1923 \DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
1924 \DeclareCaptionDefaultFont{size}{}
1925 % \end{macrocode}
1926 %
1927 % \subsection{Justifications}
1928 %
1929 % \begin{macro}{\DeclareCaptionJustification}
1930 % \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
1931 % between arguments do make any harm}
1932 % \changes{v1.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}}
1933 % |\DeclareCaptionJustification|\marg{name}\marg{code}
1934 % \begin{macrocode}
1935 \newcommand*\DeclareCaptionJustification[2]{%
1936 \global\@namedef{caption@hj@#1}{#2}% for compatibility to v1.0
1937 \DeclareCaptionFont{#1}{#2}}
1938 \@onlypreamble\DeclareCaptionJustification
1939 % \end{macrocode}
1940 % \end{macro}
1941 %
1942 % \begin{macro}{\DeclareCaptionDefaultJustification}
1943 % \changes{v1.1}{2007/07/03}{This macro added}
1944 % \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionJustification} to \cs{DeclareCaptionDefaultJustification}}
1945 % |\DeclareCaptionDefaultJustification|\marg{code}
1946 % \begin{macrocode}
1947 \newcommand*\DeclareCaptionDefaultJustification[1]{%
1948 \global\@namedef{caption@hj@default}{#1}% for compatibility to v1.0
1949 \DeclareCaptionDefaultFont{@hj}{#1}}
1950 \@onlypreamble\DeclareCaptionDefaultJustification
1951 % \end{macrocode}
1952 % \end{macro}
1953 %
1954 % \begin{macrocode}
1955 \DeclareCaptionOption{justification}{\caption@setjustification{#1}}
1956 \DeclareCaptionDefaultJustification{}
1957 % \end{macrocode}
1958 %
1959 % \begin{macro}{\caption@setjustification}
1960 % \changes{v1.1}{2007/07/03}{Mapped to \cs{caption@setfont}}
1961 % |\caption@setjustification|\marg{name}\par
1962 % Selecting a caption justification simply means saving the code (in |\caption@hj|).
1963 % \begin{macrocode}
1964 \newcommand*\caption@setjustification{\caption@setfont{@hj}}
1965 % \end{macrocode}
1966 % \end{macro}
1967 %
1968 % These are the pre-defined justification code snippets.
1969 % \begin{macrocode}
1970 \DeclareCaptionJustification{justified}{}
1971 \DeclareCaptionJustification{centering}{\centering}
1972 \DeclareCaptionJustification{centerfirst}{\centerfirst}
1973 \DeclareCaptionJustification{centerlast}{\centerlast}
1974 \DeclareCaptionJustification{raggedleft}{\raggedleft}
1975 \DeclareCaptionJustification{raggedright}{\raggedright}
1976 % \end{macrocode}
1977 %
1978 % \begin{macro}{\centerfirst}
1979 % \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
1980 % \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}}
1981 % Please blame Frank Mittelbach for the code of |\centerfirst| |:-)|
1982 % \begin{macrocode}
1983 \providecommand\centerfirst{%
1984 \let\\\@centercr
1985 \edef\caption@normaladjust{%
1986 \leftskip\the\leftskip
1987 \rightskip\the\rightskip
1988 \parfillskip\the\parfillskip\relax}%
1989 \leftskip\z@\@plus -1fil%
1990 \rightskip\z@\@plus 1fil%
1991 \parfillskip\z@skip
1992 \noindent\hskip\z@\@plus 2fil%
1993 \@setpar{\@@par\@restorepar\caption@normaladjust}}
1994 % \end{macrocode}
1995 % \end{macro}
1996 %
1997 % \begin{macro}{\centerlast}
1998 % \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
1999 % \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}}
2000 % This is based on code from Anne Br\"uggemann-Klein\cite{Anne}
2001 % \begin{macrocode}
2002 \providecommand\centerlast{%
2003 \let\\\@centercr
2004 \leftskip\z@\@plus 1fil%
2005 \rightskip\z@\@plus -1fil%
2006 \parfillskip\z@\@plus 2fil\relax}
2007 % \end{macrocode}
2008 % \end{macro}
2009 %
2010 % \subsubsection{The ragged2e package}
2011 % \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support}
2012 %
2013 % We also support the upper-case commands offered by the \package{ragged2e}
2014 % package.
2015 % Note that these just map to their lower-case variants if the
2016 % \package{ragged2e} package is not available.
2017 % \begin{macrocode}
2018 \DeclareCaptionJustification{Centering}{%
2019 \caption@ragged\Centering\centering}
2020 \DeclareCaptionJustification{RaggedLeft}{%
2021 \caption@ragged\RaggedLeft\raggedleft}
2022 \DeclareCaptionJustification{RaggedRight}{%
2023 \caption@ragged\RaggedRight\raggedright}
2024 % \end{macrocode}
2025 %
2026 % \begin{macro}{\caption@ragged}
2027 % \changes{v1.0n}{2007/04/07}{The `ragged2e' package will now only been
2028 % loaded when needed}
2029 % \changes{v1.0o}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced
2030 % by \cs{caption@Debug}}
2031 % \changes{v1.1}{2007/04/16}{A different warning will be given on first \LaTeX\ run}
2032 % |\caption@ragged| will be basically defined as
2033 % \begin{quote}
2034 % |\AtBeginDocument{\IfFileExists{ragged2e.sty}%|\\
2035 % | {\RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}%|\\
2036 % | {\let\caption@ragged\@secondoftwo}}|
2037 % \end{quote}
2038 % but with an additional warning if the ragged2e package is not loaded (yet).
2039 % (This warning will be type out only one time per option, that's why
2040 % we need the |caption\string#1| stuff.)
2041 % Furthermore we load the \package{ragged2e} package, if needed and available.
2042 % \begin{macrocode}
2043 \newcommand*\caption@ragged{%
2044 \caption@Debug{We need ragged2e}%
2045 \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}%
2046 \global\let\caption@ragged\caption@@ragged
2047 \caption@ragged}
2048 % \end{macrocode}
2049 % \begin{macrocode}
2050 \caption@AtBeginDocument{%
2051 \@ifundefined{caption@r@ragged2e}{%
2052 \newcommand*\caption@@ragged{%
2053 \caption@Warning{%
2054 `ragged2e' support has been changed.\MessageBreak
2055 Rerun to get captions right}%
2056 \global\let\caption@ragged\@secondoftwo % suppress further warnings
2057 \caption@ragged}%
2058 }{%
2059 \caption@Debug{We load ragged2e}%
2060 \IfFileExists{ragged2e.sty}{%
2061 \RequirePackage{ragged2e}%
2062 \let\caption@@ragged\@firstoftwo
2063 }{%
2064 \newcommand*\caption@@ragged[2]{%
2065 \@ifundefined{caption\string#1}{%
2066 \caption@Warning{%
2067 `ragged2e' package not loaded, therefore\MessageBreak
2068 substituting \string#2 for \string#1\MessageBreak}%
2069 \global\@namedef{caption\string#1}}{}%
2070 #2}%
2071 }%
2072 }}
2073 % \end{macrocode}
2074 % \begin{macrocode}
2075 % \end{macrocode}
2076 % \end{macro}
2077 %
2078 % \subsection{Vertical spaces before and after captions}
2079 %
2080 % \begin{macro}{\abovecaptionskip}
2081 % \begin{macro}{\belowcaptionskip}
2082 % Usually these skips are defined within the document class, but some
2083 % document classes don't do so.
2084 % \begin{macrocode}
2085 \caption@ifundefined\abovecaptionskip{%
2086 \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
2087 \caption@ifundefined\belowcaptionskip{%
2088 \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
2089 % \end{macrocode}
2090 % \end{macro}
2091 % \end{macro}
2092 %
2093 % \changes{v1.0c}{2005/02/12}{Option \opt{skip=} added}
2094 % \begin{macrocode}
2095 \DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
2096 \DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
2097 \DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
2098 % \end{macrocode}
2099 %
2100 % \begin{macro}{\caption@rule}
2101 % \changes{v1.2b}{2008/05/06}{This macro added}
2102 % |\caption@rule|\par
2103 % Draws an invisible rule to adjust the ``skip'' setting.
2104 % \begin{macrocode}
2105 \newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax}
2106 % \end{macrocode}
2107 % \begin{macrocode}
2108 \newcommand*\caption@hrule{\hrule\@height\z@}
2109 % \end{macrocode}
2110 % \end{macro}
2111 %
2112 % \changes{v1.2b}{2008/05/06}{Option \opt{rule=} added}
2113 % \begin{macrocode}
2114 \DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}}
2115 % \end{macrocode}
2116 %
2117 % \subsection{Positioning}
2118 %
2119 % These macros handle the right position of the caption.
2120 % Note that the position is actually \emph{not} controlled by the
2121 % \package{caption3} kernel options, but by the user (or a specific package
2122 % like the \package{float} package) instead.
2123 % The user can put the |\caption| command wherever he likes! So this stuff
2124 % is only to give us a \emph{hint} where to put the right skips, the user
2125 % usually has to take care for himself that this hint actually matches the
2126 % right position.
2127 %
2128 % \begin{macrocode}
2129 \DeclareCaptionOption{position}{\caption@setposition{#1}}
2130 % \end{macrocode}
2131 %
2132 % \begin{macro}{\caption@setposition}
2133 % \changes{v1.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b},
2134 % \opt{below}, and \opt{a} are allowed, too}
2135 % \changes{v1.0c}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
2136 % |\caption@setposition|\marg{position}\par
2137 % Selecting the caption position means that we put |\caption@position| to
2138 % the right value. \emph{Please do \textbf{not} use the internal macro
2139 % \cs{caption@position} in your own package or document, but use the wrapper
2140 % macro \cs{caption@iftop} instead.}
2141 % \begin{macrocode}
2142 \newcommand*\caption@setposition[1]{%
2143 \caption@ifinlist{#1}{d,default}{%
2144 \let\caption@position\caption@defaultpos
2145 }{\caption@ifinlist{#1}{t,top,above}{%
2146 \let\caption@position\@firstoftwo
2147 }{\caption@ifinlist{#1}{b,bottom,below}{%
2148 \let\caption@position\@secondoftwo
2149 }{\caption@ifinlist{#1}{a,auto}{%
2150 \let\caption@position\@undefined
2151 }{%
2152 \caption@Error{Undefined position `#1'}%
2153 }}}}}
2154 % \end{macrocode}
2155 % \end{macro}
2156 %
2157 % \begin{macro}{\caption@defaultpos}
2158 % \changes{v1.1}{2007/05/08}{Default position changed from `bottom' to `auto'}
2159 % The default `position' is `auto', this means that \thispackage\ will try
2160 % to guess the current position of the caption.
2161 % (But in many cases, for example in |longtable|s, this is doomed to fail!)\par
2162 % The setting `bottom' correspondents to the |\@makecaption| implementation
2163 % in the standard \LaTeX\ document classes, but `auto' should give better
2164 % results in most cases.
2165 % \begin{macrocode}
2166 %\caption@setdefaultpos{a}% default = auto
2167 \let\caption@defaultpos\@undefined
2168 % \end{macrocode}
2169 % \end{macro}
2170 %
2171 % \begin{macro}{\caption@iftop}
2172 % \changes{v1.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
2173 % \changes{v1.0c}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
2174 % \changes{v1.1}{2007/05/08}{Position will be fixed to `bottom' if `auto'}
2175 % |\caption@iftop|\marg{true-code}\marg{false-code}\par
2176 % (If the |position=| is set to |auto| we assume a |bottom| position here.)
2177 % \begin{macrocode}
2178 \newcommand*\caption@iftop{%
2179 \ifx\caption@position\@undefined
2180 \let\caption@position\@secondoftwo
2181 % = \caption@setposition b%
2182 \fi
2183 \caption@position}
2184 % \end{macrocode}
2185 % \end{macro}
2186 %
2187 % \begin{macro}{\caption@fixposition}
2188 % \changes{v1.0b}{2004/05/16}{%
2189 % Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
2190 % |\caption@fixposition|\par
2191 % This macro checks if the `position' is set to `auto'.
2192 % If yes, |\caption@autoposition| will be called to
2193 % set |\caption@position| to a proper value we can actually use.
2194 % \begin{macrocode}
2195 \newcommand*\caption@fixposition{%
2196 \ifx\caption@position\@undefined
2197 \caption@autoposition
2198 \fi}
2199 % \end{macrocode}
2200 % \end{macro}
2201 %
2202 % \begin{macro}{\caption@autoposition}
2203 % \changes{v1.0a}{2004/01/23}{\cs{ifvmode} added}
2204 % |\caption@autoposition|\par
2205 % We guess the current position of the caption by checking |\prevdepth|.\par
2206 % A different solution would be setting the |\spacefactor| to something
2207 % not much less than 1000 (for example 994) in |\caption@start| and
2208 % checking this value here by |\ifnum\spacefactor=994|.
2209 % (It's implemented in the \package{threeparttable}
2210 % package\cite{threeparttable} this way.)\par
2211 % Another idea would be checking |\@ifminipage|, but since some packages
2212 % typeset the caption within a simple |\vbox| this does not seem to be a
2213 % good one.
2214 % \begin{macrocode}
2215 \newcommand*\caption@autoposition{%
2216 \ifvmode
2217 \edef\caption@tempa{\the\prevdepth}%
2218 \caption@Debug{\protect\prevdepth=\caption@tempa}%
2219 \ifdim\prevdepth>-\p@
2220 \let\caption@position\@secondoftwo
2221 \else
2222 \let\caption@position\@firstoftwo
2223 \fi
2224 % = \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}%
2225 \else
2226 \caption@Debug{no \protect\prevdepth}%
2227 \let\caption@position\@secondoftwo
2228 % = \caption@setposition b%
2229 \fi}
2230 % \end{macrocode}
2231 % \end{macro}
2232 % \begin{macro}{\caption@setautoposition}
2233 % \changes{v1.1}{2007/06/10}{This macro added}
2234 % |\caption@setautoposition|\marg{position}\par
2235 % replaces the above algorithm by a different one (or a fixed position setting).
2236 % \begin{macrocode}
2237 \newcommand*\caption@setautoposition[1]{%
2238 \def\caption@autoposition{\caption@setposition{#1}}}
2239 % \end{macrocode}
2240 % \end{macro}
2241 %
2242 % \subsection{Hooks}
2243 %
2244 % \begin{macro}{\AtBeginCaption}
2245 % \begin{macro}{\AtEndCaption}
2246 % |\AtBeginCaption| \marg{code}\\
2247 % |\AtEndCaption| \marg{code}\par
2248 % These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|.
2249 % \begin{macrocode}
2250 \newcommand*\caption@beginhook{}
2251 \newcommand*\caption@endhook{}
2252 \newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook}
2253 \newcommand*\AtEndCaption{\l@addto@macro\caption@endhook}
2254 % \end{macrocode}
2255 % \end{macro}
2256 % \end{macro}
2257 %
2258 % \subsection{Lists}
2259 %
2260 % \changes{v1.0b}{2004/05/16}{Option \opt{listof=} added}
2261 % \changes{v1.2}{2007/11/17}{Option \opt{list=} added}
2262 % \begin{macrocode}
2263 \DeclareCaptionOption{list}[1]{\caption@setlist{#1}}
2264 \DeclareCaptionOption{listof}[1]{\caption@setlist{#1}}
2265 % \end{macrocode}
2266 %
2267 % \begin{macro}{\caption@setlist}
2268 % \changes{v1.2a}{2008/03/20}{This macro added}
2269 % |\caption@setlist|\marg{boolean}
2270 % \begin{macrocode}
2271 \newcommand*\caption@setlist{\caption@set@bool\caption@iflist}
2272 % \end{macrocode}
2273 % \end{macro}
2274 %
2275 % \changes{v1.4}{2011/08/30}{Option \opt{listtype=} added}
2276 % \changes{v1.4}{2011/08/30}{Option \opt{listtype+=} added}
2277 % \begin{macrocode}
2278 \DeclareCaptionOption{listtype}{\caption@setlisttype{#1}}
2279 \DeclareCaptionOption{listtype+}{\caption@setlisttype@ext{#1}}
2280 % \end{macrocode}
2281 %
2282 % \begin{macro}{\caption@setlisttype}
2283 % \changes{v1.4}{2011/08/30}{This macro added}
2284 % |\caption@setlisttype|\marg{type}
2285 % \begin{macrocode}
2286 \newcommand*\caption@setlisttype{%
2287 \caption@setlisttype@ext{}%
2288 \caption@@setlisttype\caption@listtype}
2289 % \end{macrocode}
2290 % \begin{macrocode}
2291 \newcommand*\caption@@setlisttype[2]{%
2292 \edef#1{#2}%
2293 \ifx#1\@empty \let#1\@undefined \fi}
2294 % \end{macrocode}
2295 % \end{macro}
2296 % \begin{macro}{\caption@setlisttype@ext}
2297 % \changes{v1.4}{2011/08/30}{This macro added}
2298 % |\caption@setlisttype@ext|\marg{type extension}
2299 % \begin{macrocode}
2300 \newcommand*\caption@setlisttype@ext{%
2301 \caption@@setlisttype\caption@listtype@ext}
2302 % \end{macrocode}
2303 % \end{macro}
2304 %
2305 % \begin{macro}{\DeclareCaptionListFormat}
2306 % \changes{v1.1}{2004/07/15}{This macro added}
2307 % \changes{v1.2}{2007/11/17}{Renamed from \cs{DeclareCaptionListOfFormat} to \cs{DeclareCaptionListFormat}}
2308 % |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2}
2309 % \begin{macrocode}
2310 \newcommand*\DeclareCaptionListFormat[2]{%
2311 \global\@namedef{caption@lstfmt@#1}##1##2{#2}}
2312 \@onlypreamble\DeclareCaptionListFormat
2313 % \end{macrocode}
2314 % \end{macro}
2315 %
2316 % \changes{v1.1}{2007/07/15}{Option \opt{listofformat=} added}
2317 % \changes{v1.2}{2007/11/17}{Option \opt{listofformat=} renamed to \opt{listformat=}}
2318 % \begin{macrocode}
2319 \DeclareCaptionOption{listformat}{\caption@setlistformat{#1}}
2320 % \end{macrocode}
2321 %
2322 % \begin{macro}{\caption@setlistformat}
2323 % \changes{v1.1}{2004/07/15}{This macro added}
2324 % \changes{v1.2}{2007/11/17}{Renamed from \cs{caption@setlistofformat} to \cs{caption@setlistformat}}
2325 % |\caption@setlistformat|\marg{name}\par
2326 % Selecting a caption list format simply means saving the code (in |\caption@lstfmt|).
2327 % \begin{macrocode}
2328 \newcommand*\caption@setlistformat[1]{%
2329 \@ifundefined{caption@lstfmt@#1}%
2330 {\caption@Error{Undefined list format `#1'}}%
2331 {\expandafter\let\expandafter\caption@lstfmt
2332 \csname caption@lstfmt@#1\endcsname}}
2333 % \end{macrocode}
2334 % \end{macro}
2335 %
2336 % There are five pre-defined list formats, taken from the \package{subfig} package.
2337 % \begin{macrocode}
2338 \DeclareCaptionListFormat{empty}{}
2339 \DeclareCaptionListFormat{simple}{#1#2}
2340 \DeclareCaptionListFormat{parens}{#1(#2)}
2341 \DeclareCaptionListFormat{subsimple}{#2}
2342 \DeclareCaptionListFormat{subparens}{(#2)}
2343 % \end{macrocode}
2344 %
2345 % \begin{macro}{\caption@setdefaultlistformat}
2346 % \changes{v1.2d}{2009/03/29}{This macro added}
2347 % \begin{macrocode}
2348 \newcommand*\caption@setdefaultlistformat[1]{%
2349 \ifx\caption@lstfmt\caption@lstfmt@default
2350 \caption@set@default@listformat{#1}%
2351 \caption@setlistformat{default}%
2352 \else
2353 \caption@set@default@listformat{#1}%
2354 \fi}
2355 % \end{macrocode}
2356 % \begin{macrocode}
2357 \newcommand*\caption@set@default@listformat[1]{%
2358 \def\caption@lstfmt@default{\@nameuse{caption@lstfmt@#1}}}
2359 % \end{macrocode}
2360 % \end{macro}
2361 %
2362 % `default' usually maps to `subsimple'.
2363 % \begin{macrocode}
2364 \caption@set@default@listformat{subsimple}
2365 % \end{macrocode}
2366 %
2367 % \subsection{Debug option}
2368 % \changes{v1.0k}{2007/03/04}{Debug option added}
2369 %
2370 % \begin{macrocode}
2371 \DeclareCaptionOption{debug}[1]{%
2372 \caption@set@bool\caption@ifdebug{#1}%
2373 \caption@ifdebug
2374 {\let\caption@Debug\caption@Info}%
2375 {\let\caption@Debug\@gobble}}
2376 % \end{macrocode}
2377 % \begin{macrocode}
2378 \DeclareOption{debug}{\setkeys{caption}{debug}}
2379 % \end{macrocode}
2380 % \begin{macrocode}
2381 \setkeys{caption}{debug=0}
2382 % \end{macrocode}
2383 %
2384 % \subsection{Document classes \& Babel support}
2385 %
2386 % \subsubsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes}
2387 %
2388 % \begin{macrocode}
2389 \caption@CheckCommand\@makecaption{%
2390 % article|report|book [2005/09/16 v1.4f Standard LaTeX document class]
2391 \long\def\@makecaption#1#2{%
2392 \vskip\abovecaptionskip
2393 \sbox\@tempboxa{#1: #2}%
2394 \ifdim \wd\@tempboxa >\hsize
2395 #1: #2\par
2396 \else
2397 \global \@minipagefalse
2398 \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
2399 \fi
2400 \vskip\belowcaptionskip}}
2401 % \end{macrocode}
2402 %
2403 % \subsubsection{The \AmS{} \& \SmF{} classes}
2404 % \changes{v1.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added}
2405 %
2406 % \begin{macro}{\caption@ifamsclass}
2407 % \begin{macrocode}
2408 \providecommand*\caption@ifamsclass{%
2409 \caption@ifundefined\@captionheadfont\@gobble\@firstofone}
2410 \@onlypreamble\caption@ifamsclass
2411 % \end{macrocode}
2412 % \end{macro}
2413 %
2414 % \begin{macrocode}
2415 \caption@ifamsclass{%
2416 % \end{macrocode}
2417 % \begin{macrocode}
2418 \caption@CheckCommand\@makecaption{%
2419 % amsart|amsproc|amsbook [2004/08/06 v2.20]
2420 \long\def\@makecaption#1#2{%
2421 \setbox\@tempboxa\vbox{\color@setgroup
2422 \advance\hsize-2\captionindent\noindent
2423 \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
2424 {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}%
2425 \unskip\kern-2\captionindent\par
2426 \global\setbox\@ne\lastbox\color@endgroup}%
2427 \ifhbox\@ne % the normal case
2428 \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
2429 \fi
2430 \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
2431 \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
2432 \else % tempboxa contained more than one line
2433 \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip
2434 \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
2435 \fi
2436 \ifnum\@tempcnta<64 % if the float IS a figure...
2437 \addvspace\abovecaptionskip
2438 \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
2439 \else % if the float IS NOT a figure...
2440 \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
2441 \nobreak
2442 \vskip\belowcaptionskip
2443 \fi
2444 \relax
2445 }}
2446 % \end{macrocode}
2447 % \begin{macrocode}
2448 \caption@CheckCommand\@makecaption{%
2449 % smfart|smfbook [1999/11/15 v1.2f Classe LaTeX pour les articles publies par la SMF]
2450 \long\def\@makecaption#1#2{%
2451 \ifdim\captionindent>.1\hsize \captionindent.1\hsize \fi
2452 \setbox\@tempboxa\vbox{\color@setgroup
2453 \advance\hsize-2\captionindent\noindent
2454 \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
2455 {\@cdr#2\@nil}{\@addpunct{.}\@captionfont\upshape\enspace#2}%
2456 \unskip\kern-2\captionindent\par
2457 \global\setbox\@ne\lastbox\color@endgroup}%
2458 \ifhbox\@ne % the normal case
2459 \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
2460 \fi
2461 \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
2462 \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
2463 \@tempdima\wd\@ne\advance\@tempdima-\captionindent
2464 \wd\@ne\@tempdima
2465 \else % tempboxa contained more than one line
2466 \setbox\@ne\vbox{\rightskip=0pt plus\captionindent\relax
2467 \unvbox\@tempboxa\parskip\z@skip
2468 \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
2469 \fi
2470 \ifnum\@tempcnta<64 % if the float IS a figure...
2471 \addvspace\abovecaptionskip
2472 \noindent\kern\captionindent\box\@ne
2473 \else % if the float IS NOT a figure...
2474 \noindent\kern\captionindent\box\@ne
2475 \nobreak
2476 \vskip\belowcaptionskip
2477 \fi
2478 \relax
2479 }}
2480 % \end{macrocode}
2481 % \begin{macrocode}
2482 \let\captionmargin\captionindent % set to 3pc by AMS class
2483 \begingroup\edef\@tempa{\endgroup
2484 \noexpand\caption@g@addto@list\noexpand\caption@sty@default
2485 {margin=\the\captionmargin
2486 \caption@ifundefined\smf@makecaption{}{,maxmargin=.1\linewidth}}}
2487 \@tempa
2488 \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin}
2489 \DeclareCaptionLabelSeparator{default}{.\enspace}
2490 \DeclareCaptionDefaultFont{font}{\@captionfont}
2491 \DeclareCaptionDefaultFont{labelfont}{\@captionheadfont}
2492 \DeclareCaptionDefaultFont{textfont}{\@captionfont\upshape}
2493 \captionsetup[figure]{position=b}
2494 \captionsetup[table]{position=t}
2495 % \end{macrocode}
2496 % \begin{macrocode}
2497 }
2498 % \end{macrocode}
2499 %
2500 % \subsubsection{The beamer class (Part one)}
2501 % \changes{v1.1}{2007/03/10}{beamer class support added}
2502 % \changes{v1.3}{2011/08/06}{beamer class support revised}
2503 %
2504 % \begin{macro}{\caption@ifbeamerclass}
2505 % \begin{macrocode}
2506 \providecommand*\caption@ifbeamerclass{%
2507 \@ifclassloaded{beamer}\@firstofone\@gobble}
2508 \@onlypreamble\caption@ifbeamerclass
2509 % \end{macrocode}
2510 % \end{macro}
2511 %
2512 % \begin{macrocode}
2513 \caption@ifbeamerclass{%
2514 % \end{macrocode}
2515 % \begin{macrocode}
2516 \caption@CheckCommand\beamer@makecaption{%
2517 % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
2518 \long\def\beamer@makecaption#1#2{%
2519 \def\insertcaptionname{\csname#1name\endcsname}%
2520 \def\insertcaptionnumber{\csname the#1\endcsname}%
2521 \def\insertcaption{#2}%
2522 \nobreak\vskip\abovecaptionskip\nobreak
2523 \sbox\@tempboxa{\usebeamertemplate**{caption}}%
2524 \ifdim \wd\@tempboxa >\hsize
2525 \usebeamertemplate**{caption}\par
2526 \else
2527 \global \@minipagefalse
2528 \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
2529 \fi
2530 \nobreak\vskip\belowcaptionskip\nobreak}}
2531 % \end{macrocode}
2532 % \begin{macro}{\caption@ifbeamertemplate}
2533 % \begin{macrocode}
2534 \newcommand*\caption@ifbeamertemplate[1]{%
2535 \begingroup
2536 \let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
2537 \@nameuse{beamer@@tmpop@caption@#1}%
2538 \ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
2539 \endgroup\expandafter\@firstoftwo
2540 \else
2541 \endgroup\expandafter\@secondoftwo
2542 \fi}
2543 % \end{macrocode}
2544 % \end{macro}
2545 % \begin{macrocode}
2546 \DeclareCaptionLabelFormat{default}{%
2547 #1\caption@ifbeamertemplate{numbered}{~#2}{}}
2548 \caption@declarelabelseparator
2549 {\caption@ifbeamertemplate{caption name own line}\@gobble\@firstofone}
2550 {default}
2551 {\caption@ifbeamertemplate{caption name own line}{\\}{: }}
2552 \DeclareCaptionDefaultFont{font}{%
2553 \usebeamerfont*{caption}%
2554 \usebeamercolor[fg]{caption}}
2555 \DeclareCaptionDefaultFont{labelfont}{%
2556 \usebeamercolor[fg]{caption name}%
2557 \usebeamerfont*{caption name}}
2558 \DeclareCaptionDefaultJustification{\raggedright}
2559 \DeclareOption{beamerclass}{%
2560 \renewcommand\caption@ifslc{%
2561 \caption@ifbeamertemplate{caption name own line}\@secondoftwo\@firstoftwo}
2562 % Since the beamer class do not offer a `list of figures' we switch this support off.
2563 \captionsetup{list=0}}
2564 \PassOptionsToPackage{beamerclass}{caption3}
2565 % \end{macrocode}
2566 %
2567 % If the \package{beamer} document class is used, we offer a beamer
2568 % template called `caption3' which can be used with option `beamer' or
2569 % |\setbeamertemplate{caption}[caption3]|.\par
2570 % (Note that this is of no use when the \package{caption} package is used, too.)
2571 % \begin{macrocode}
2572 \defbeamertemplate{caption}{caption3}{%
2573 \caption@make\insertcaptionname\insertcaptionnumber\insertcaption}
2574 % \end{macrocode}
2575 % \begin{macrocode}
2576 \DeclareOption{beamer}{%
2577 % \usebeamertemplate**{caption} will set font
2578 \DeclareCaptionDefaultFont{font}{}%
2579 \setbeamertemplate{caption}[caption3]}
2580 % \end{macrocode}
2581 % \begin{macrocode}
2582 %
2583 % \begin{macrocode]
2584 }
2585 % \end{macrocode}
2586 %
2587 % \subsubsection{The KOMA-Script classes}
2588 % \changes{v1.1}{2007/03/31}{\KOMAScript\ classes support added}
2589 %
2590 % \begin{macro}{\caption@ifkomaclass}
2591 % \begin{macrocode}
2592 \providecommand*\caption@ifkomaclass{%
2593 \caption@ifundefined\scr@caption\@gobble\@firstofone}
2594 \@onlypreamble\caption@ifkomaclass
2595 % \end{macrocode}
2596 % \end{macro}
2597 %
2598 % \begin{macrocode}
2599 \caption@ifkomaclass{%
2600 % \end{macrocode}
2601 % \begin{macrocode}
2602 \caption@CheckCommand\@makecaption{%
2603 % scrartcl|scrreprt|scrbook [2007/03/07 v2.97a KOMA-Script document class]
2604 \long\def\@makecaption#1#2{%
2605 \if@captionabove
2606 \vskip\belowcaptionskip
2607 \else
2608 \vskip\abovecaptionskip
2609 \fi
2610 \@@makecaption\@firstofone{#1}{#2}%
2611 \if@captionabove
2612 \vskip\abovecaptionskip
2613 \else
2614 \vskip\belowcaptionskip
2615 \fi}}
2616 % \end{macrocode}
2617 % \begin{macrocode}
2618 \DeclareCaptionFormat{default}[#1#2#3\par]{%
2619 \ifdofullc@p
2620 \caption@ifin@list\caption@lsepcrlist\caption@lsepname
2621 {\caption@Error{%
2622 The option `labelsep=\caption@lsepname' does not work\MessageBreak
2623 with \noexpand\setcaphanging (which is set by default)}}%
2624 {\caption@fmt@hang{#1}{#2}{#3}}%
2625 \else
2626 #1#2%
2627 \ifdim\cap@indent<\z@
2628 \par
2629 \noindent\hspace*{-\cap@indent}%
2630 \else\if@capbreak
2631 \par
2632 \fi\fi
2633 #3\par
2634 \fi}
2635 \DeclareCaptionLabelSeparator{default}{\captionformat}
2636 \DeclareCaptionDefaultFont{font}{\scr@fnt@caption}
2637 \DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel}
2638 % \end{macrocode}
2639 % \begin{macrocode}
2640 }
2641 % \end{macrocode}
2642 %
2643 % \subsubsection{The \NTG{} Dutch classes}
2644 % \changes{v1.1}{2007/04/06}{NTG classes support added}
2645 %
2646 % \begin{macro}{\caption@ifntgclass}
2647 % \begin{macrocode}
2648 \providecommand*\caption@ifntgclass{%
2649 \caption@ifundefined\CaptionFonts\@gobble\@firstofone}
2650 \@onlypreamble\caption@ifntgclass
2651 % \end{macrocode}
2652 % \end{macro}
2653 %
2654 % \begin{macrocode}
2655 \caption@ifntgclass{%
2656 % \end{macrocode}
2657 % \begin{macrocode}
2658 \caption@CheckCommand\@makecaption{%
2659 % artikel|rapport|boek [2004/06/07 v2.1a NTG LaTeX document class]
2660 \long\def\@makecaption#1#2{%
2661 \vskip\abovecaptionskip
2662 \sbox\@tempboxa{{\CaptionLabelFont#1:} \CaptionTextFont#2}%
2663 \ifdim \wd\@tempboxa >\hsize
2664 {\CaptionLabelFont#1:} \CaptionTextFont#2\par
2665 \else
2666 \global \@minipagefalse
2667 \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
2668 \fi
2669 \vskip\belowcaptionskip}}
2670 % \end{macrocode}
2671 % \begin{macrocode}
2672 \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont}
2673 \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont}
2674 % \end{macrocode}
2675 % \begin{macrocode}
2676 }
2677 % \end{macrocode}
2678 %
2679 % \subsubsection{The thesis class}
2680 % \changes{v1.2a}{2008/01/31}{thesis class support added}
2681 % \changes{v1.2e}{2009/11/15}{Bugfix 09-11-14: thesis class support revised}
2682 %
2683 % \begin{macro}{\caption@ifthesisclass}
2684 % \begin{macrocode}
2685 \providecommand*\caption@ifthesisclass{%
2686 \caption@ifundefined\cph@font
2687 {\@gobble}%
2688 {\caption@ifundefined\cpb@font\@gobble\@firstofone}}
2689 % \end{macrocode}
2690 % \end{macro}
2691 %
2692 % \begin{macrocode}
2693 \caption@ifthesisclass{%
2694 % \end{macrocode}
2695 % \begin{macrocode}
2696 \caption@CheckCommand\@makecaption{%
2697 % thesis.cls 1996/25/01 1.0g LaTeX document class (wm).
2698 \long\def\@makecaption#1#2{%
2699 \vskip\abovecaptionskip
2700 \setbox\@tempboxa\hbox{{\cph@font #1:} {\cpb@font #2}}%
2701 \ifdim \wd\@tempboxa >\hsize
2702 \@hangfrom{\cph@font #1: }{\cpb@font #2\par}%
2703 \else
2704 \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
2705 \fi
2706 \vskip\belowcaptionskip}}
2707 % \end{macrocode}
2708 % \begin{macrocode}
2709 \DeclareCaptionDefaultFormat{hang}
2710 \DeclareCaptionDefaultFont{labelfont}{\cph@font}
2711 \DeclareCaptionDefaultFont{textfont}{\cpb@font}
2712 % \end{macrocode}
2713 % \begin{macrocode}
2714 }
2715 % \end{macrocode}
2716 %
2717 % \subsubsection{The frenchb Babel option}
2718 % \changes{v1.1}{2006/05/14}{\package{frenchb} package support added}
2719 %
2720 % \begin{macrocode}
2721 \caption@ifundefined\FB@makecaption{}{%
2722 % \end{macrocode}
2723 % \begin{macrocode}
2724 \caption@CheckCommand\@makecaption{%
2725 % frenchb.ldf [2005/02/06 v1.6g French support from the babel system]
2726 % frenchb.ldf [2007/10/05 v2.0e French support from the babel system]
2727 \long\def\@makecaption#1#2{%
2728 \vskip\abovecaptionskip
2729 \sbox\@tempboxa{#1\CaptionSeparator #2}%
2730 \ifdim \wd\@tempboxa >\hsize
2731 #1\CaptionSeparator #2\par
2732 \else
2733 \global \@minipagefalse
2734 \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
2735 \fi
2736 \vskip\belowcaptionskip}}
2737 % \end{macrocode}
2738 % \begin{macrocode}
2739 \ifx\@makecaption\STD@makecaption
2740 \DeclareCaptionLabelSeparator{default}{\CaptionSeparator}
2741 \def\caption@frenchb{% supress frenchb warning
2742 \let\STD@makecaption\@makecaption
2743 \let\FB@makecaption\@makecaption}
2744 \else
2745 \ifx\@makecaption\@undefined\else
2746 \caption@InfoNoLine{%
2747 The definition of \protect\@makecaption\space
2748 has been changed,\MessageBreak
2749 frenchb will NOT customize it}%
2750 \fi
2751 \fi
2752 % \end{macrocode}
2753 % \begin{macrocode}
2754 }
2755 % \end{macrocode}
2756 %
2757 % \subsubsection{The frenchle/pro package}
2758 % \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added}
2759 %
2760 % \begin{macrocode}
2761 \caption@ifundefined\frenchTeXmods{}{%
2762 % \end{macrocode}
2763 % \begin{macrocode}
2764 \caption@CheckCommand\@makecaption{%
2765 % french(le).sty [2006/10/03 The french(le) package /V5,9991/]
2766 % french(le).sty [2007/06/28 The french(le) package /V5,9994/]
2767 \def\@makecaption#1#2{%
2768 \ifFTY%
2769 \def\@secondofmany##1##2\void{##2}%
2770 \def\@tempa{\@secondofmany#2\void}%
2771 \ifx\@tempa\empty%
2772 \let\captionseparator\empty%
2773 \fi%
2774 \@mcORI{#1}{\relax\captionfont{#2}}%
2775 \else
2776 \@mcORI{#1}{#2}%
2777 \fi}}%
2778 % \end{macrocode}
2779 % \begin{macrocode}
2780 \caption@CheckCommand\@makecaption{%
2781 % french(le).sty [2007/02/11 The french(le) package /V5,9993/]
2782 \def\@makecaption#1#2{%
2783 \ifFTY%
2784 \def\@secondofmany##1##2\void{##2}%
2785 \protected@edef\@tempa{\@secondofmany#2\void}%
2786 \ifx\@tempa\empty%
2787 \let\captionseparator\empty%
2788 \fi%
2789 \@mcORI{#1}{\relax\captionfont{#2}}%
2790 \else
2791 \@mcORI{#1}{#2}%
2792 \fi}}%
2793 % \end{macrocode}
2794 % \begin{macrocode}
2795 \DeclareCaptionDefaultFont{textfont}{\itshape}%
2796 \DeclareCaptionLabelSeparator{default}{\captionseparator\space}%
2797 % \end{macrocode}
2798 % \begin{macrocode}
2799 }
2800 % \end{macrocode}
2801 %
2802 % \subsubsection{The hungarian and magyar Babel option}
2803 % \changes{v1.3}{2009/03/29}{\package{magyar} package support added}
2804 % \changes{v1.3a}{2011/08/12}{\package{magyar} package support revised}
2805 %
2806 % \begin{macrocode}
2807 \DeclareCaptionListFormat{subperiod}{#2.}
2808 % \end{macrocode}
2809 %
2810 % \begin{macrocode}
2811 \caption@ifundefined\hunnewlabel{}{%
2812 \caption@CheckCommand\@makecaption{%
2813 % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system]
2814 \def\@makecaption#1#2{%
2815 \vskip\abovecaptionskip
2816 \sbox\@tempboxa{#1. #2}%
2817 \ifdim \wd\@tempboxa >\hsize
2818 {#1. #2\csname par\endcsname}
2819 \else
2820 \global \@minipagefalse
2821 \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
2822 \fi
2823 \vskip\belowcaptionskip}}}
2824 % \end{macrocode}
2825 %
2826 % \begin{macrocode}
2827 \def\caption@tempa#1{\@ifundefined{extras#1}{}{%
2828 \expandafter\addto\csname extras#1\endcsname{%
2829 % change default labelsep and listformat
2830 \caption@setdefaultlabelsep{period}%
2831 \caption@setdefaultlistformat{subperiod}}%
2832 \expandafter\addto\csname noextras#1\endcsname{%
2833 % change default labelsep and listformat
2834 \caption@setdefaultlabelsep{colon}%
2835 \caption@setdefaultlistformat{subsimple}}%
2836 % \end{macrocode}
2837 % \begin{macrocode}
2838 }}
2839 % \end{macrocode}
2840 % \begin{macrocode}
2841 \caption@tempa{hungarian}
2842 \caption@tempa{magyar}
2843 % \end{macrocode}
2844 %
2845 % \subsubsection{Unknown document class (or package)}
2846 % \changes{v1.1}{2007/04/10}{Check of document class added}
2847 %
2848 % \begin{macrocode}
2849 \caption@IfCheckCommand{%
2850 \caption@setbool{documentclass}{1}%
2851 }{%
2852 \caption@setbool{documentclass}{0}%
2853 \caption@InfoNoLine{%
2854 Unknown document class (or package),\MessageBreak
2855 standard defaults will be used}%
2856 \caption@Debug{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}%
2857 }
2858 % \end{macrocode}
2859 %
2860 % \subsection{Execution of options}
2861 %
2862 % \begin{macrocode}
2863 \captionsetup{style=default,position=default,%
2864 list,listformat=default,twoside=\if@twoside 1\else 0\fi}
2865 % \end{macrocode}
2866 % \begin{macrocode}
2867 \ProcessOptions*
2868 % \end{macrocode}
2869 %
2870 % \subsection{Making an `List of' entry}
2871 %
2872 % \begin{macro}{\caption@addcontentsline}
2873 % \changes{v1.1}{2007/07/01}{This macro added}
2874 % \changes{v1.3}{2010/10/26}{Error check added}
2875 % \changes{v1.3}{2011/06/24}{Split into two macros}
2876 % \changes{v1.4}{2011/08/19}{Split into three macros}
2877 % \changes{v1.4}{2011/08/30}{Support for option \opt{listtype=} added}
2878 % |\caption@addcontentsline|\marg{type}\marg{list entry}\par
2879 % Makes an entry in the list-of-whatever, if requested,
2880 % i.e.~the argument \meta{list entry} is not empty and
2881 % |listof=| was set to |true|.
2882 % \begin{macrocode}
2883 \newcommand\caption@addcontentsline[2]{%
2884 \caption@ifcontentsline{#2}{%
2885 \begingroup
2886 \let\@tempa\@gobble
2887 \caption@ifundefined\caption@listtype
2888 {\edef\caption@listtype{#1}}%
2889 {\let\@tempa\@firstofone}%
2890 \caption@ifundefined\caption@listtype@ext
2891 {}%
2892 {\edef\caption@listtype{\caption@listtype\caption@listtype@ext}%
2893 \let\@tempa\@firstofone}%
2894 \@tempa
2895 {\caption@Debug{addcontentsline: #1 => \caption@listtype}%
2896 % \caption@setoptions*\caption@listtype
2897 \@namedef{the\caption@listtype}{\@nameuse{the#1}}}%
2898 \expandafter\caption@@addcontentsline\expandafter{\caption@listtype}{#2}%
2899 \endgroup}}
2900 % \end{macrocode}
2901 % \begin{macrocode}
2902 \newcommand\caption@@addcontentsline[2]{%
2903 {\let\\\space
2904 \@ifundefined{ext@#1}%
2905 {\caption@Error{No float type '#1' defined}}%
2906 {\caption@@@addcontentsline
2907 {\csname ext@#1\endcsname}%
2908 {#1}%
2909 {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}%
2910 {\ignorespaces #2}}}}
2911 % \end{macrocode}
2912 % \begin{macrocode}
2913 \newcommand*\caption@@@addcontentsline[4]{%
2914 \addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}}
2915 % \end{macrocode}
2916 % \begin{macrocode}
2917 \newcommand\caption@ifcontentsline[1]{%
2918 \caption@iflist
2919 {\def\@tempa{#1}}%
2920 {\let\@tempa\@empty}%
2921 \ifx\@tempa\@empty
2922 \expandafter\@gobble
2923 \else
2924 \expandafter\@firstofone
2925 \fi}
2926 % \end{macrocode}
2927 % \end{macro}
2928 %
2929 % \subsection{Typesetting the caption}
2930 %
2931 % \begin{macro}{\ifcaption@star}
2932 % If the starred form of |\caption| is used, this will be set to |true|.
2933 % (It will be reset to |false| at the end of |\caption@@make|.)
2934 % \begin{macrocode}
2935 \newif\ifcaption@star
2936 % \end{macrocode}
2937 % \end{macro}
2938 %
2939 % \begin{macro}{\caption@fnum}
2940 % \changes{v1.1}{2007/08/21}{This macro added}
2941 % |\caption@fnum|\marg{float type}\par
2942 % Typesets the caption label; as replacement for |\fnum@|\meta{float type}.
2943 % \begin{macrocode}
2944 \newcommand*\caption@fnum[1]{\caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}}
2945 % \end{macrocode}
2946 % \end{macro}
2947 %
2948 % \begin{macro}{\caption@make}
2949 % |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\par
2950 % Typesets the caption.
2951 % \begin{macrocode}
2952 \newcommand\caption@make[2]{\caption@@make{\caption@lfmt{#1}{#2}}}
2953 % \end{macrocode}
2954 % \end{macro}
2955 %
2956 % \begin{macro}{\caption@@make}
2957 % \changes{v1.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
2958 % \changes{v1.0c}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of
2959 % \cs{captionmargin} resp. \cs{captionwidth}; check for \cs{z@} added}
2960 % \changes{v1.0c}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end
2961 % of caption added}
2962 % \changes{v1.0c}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
2963 % \changes{v1.0c}{2005/02/12}{Single-line-check moved up so it can affect margins now}
2964 % \changes{v1.0c}{2005/02/09}{Improvement: \cs{caption@ifh} added}
2965 % \changes{v1.0c}{2005/02/09}{Bugfix: \cs{leavevmode} added}
2966 % \changes{v1.0f}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
2967 % \changes{v1.0g}{2005/12/04}{Uses \cs{caption@slc} now}
2968 % \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside
2969 % single-line-check replaced by \cs{relax}}
2970 % \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be
2971 % typeset in horizontal mode}
2972 % \changes{v1.0i}{2006/05/13}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox}}
2973 % \changes{v1.0j}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v1.0h, re-added}
2974 % \changes{v1.0n}{2007/04/03}{Usage of \cs{caption@ifoddpage} added}
2975 % \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} moved below single-line-check}
2976 % \changes{v1.1e}{2007/10/28}{\cs{caption@stepcounter} added}
2977 % |\caption@@make|\marg{caption label}\marg{caption text}
2978 % \begin{macrocode}
2979 \newcommand\caption@@make[2]{%
2980 \begingroup
2981 \caption@stepcounter
2982 \caption@beginhook
2983 % \end{macrocode}
2984 %
2985 % Check margin, if |\caption@minmargin| or |\caption@maxmargin| is set
2986 % \begin{macrocode}
2987 % TODO: Move this to \caption@calcmargin!?
2988 \ifx\caption@maxmargin\@undefined \else
2989 \ifdim\captionmargin>\caption@maxmargin\relax
2990 \captionmargin\caption@maxmargin\relax
2991 \fi
2992 \fi
2993 \ifx\caption@minmargin\@undefined \else
2994 \ifdim\captionmargin<\caption@minmargin\relax
2995 \captionmargin\caption@minmargin\relax
2996 \fi
2997 \fi
2998 % \end{macrocode}
2999 %
3000 % Special single-line treatment (option |singlelinecheck=|)
3001 % \begin{macrocode}
3002 \caption@ifslc{\caption@slc{#1}{#2}\captionwidth\relax}{}%
3003 % \end{macrocode}
3004 %
3005 % Typeset the left margin (option |margin=|)
3006 % \begin{macrocode}
3007 \caption@calcmargin
3008 \@tempdima\captionmargin
3009 \ifdim\captionmargin@=\z@ \else
3010 \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}%
3011 \fi
3012 \caption@ifh{\advance\@tempdima\caption@indent}%
3013 \hspace\@tempdima
3014 % \end{macrocode}
3015 %
3016 % We actually use a |\vbox| of width |\captionwidth - \caption@indent|
3017 % to typeset the caption.
3018 % \Note{\cs{captionindent} is \emph{not} supported if the caption format
3019 % was defined with \cs{DeclareCaptionFormat*}.}
3020 % \begin{macrocode}
3021 \@tempdima\captionwidth
3022 \caption@ifh{\advance\@tempdima-\caption@indent}%
3023 \caption@parbox\@tempdima{%
3024 % \end{macrocode}
3025 %
3026 % Typeset the indention (option |indention=|)\\
3027 % {\small Bugfix 04-05-05:
3028 % |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots}
3029 % \begin{macrocode}
3030 \caption@ifh{%
3031 \ifdim\caption@indent=\z@
3032 \leavevmode
3033 \else
3034 \hskip-\caption@indent
3035 \fi}%
3036 % \end{macrocode}
3037 %
3038 % Typeset the caption itself and close the |\caption@parbox|
3039 % \begin{macrocode}
3040 \caption@@@make{#1}{#2}}%
3041 % \end{macrocode}
3042 %
3043 % Typeset the right margin (option |margin=|)
3044 % \begin{macrocode}
3045 \@tempdima\captionmargin
3046 \ifdim\captionmargin@=\z@ \else
3047 \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}%
3048 \fi
3049 \hspace\@tempdima
3050 % \end{macrocode}
3051 %
3052 % \begin{macrocode}
3053 \caption@endhook
3054 \endgroup
3055 % \end{macrocode}
3056 %
3057 % \begin{macrocode}
3058 \global\caption@starfalse}
3059 % \end{macrocode}
3060 % \end{macro}
3061 %
3062 % \begin{macro}{\caption@calcmargin}
3063 % \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by
3064 % \cs{ifdim}\cs{captionwidth=}\cs{z@}}
3065 % \changes{v1.0g}{2006/01/12}{Improvement: Takes care of list environment now}
3066 % \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore),
3067 % use \cs{linewidth} instead of \cs{hsize}}
3068 % |\caption@calcmargin|\par
3069 % Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
3070 % values.
3071 % \begin{macrocode}
3072 \newcommand*\caption@calcmargin{%
3073 \caption@calcmargin@hook
3074 \ifdim\captionwidth=\z@
3075 \captionwidth\linewidth
3076 \advance\captionwidth by -2\captionmargin
3077 \advance\captionwidth by -\captionmargin@
3078 \else
3079 \captionmargin\linewidth
3080 \advance\captionmargin by -\captionwidth
3081 \divide\captionmargin by 2
3082 \captionmargin@\z@
3083 \fi
3084 % \end{macrocode}
3085 % \begin{macrocode}
3086 \caption@Debug{%
3087 \string\hsize=\the\hsize,
3088 \string\linewidth=\the\linewidth,\MessageBreak
3089 \string\leftmargin=\the\leftmargin,
3090 \string\rightmargin=\the\rightmargin,\MessageBreak
3091 \string\margin=\the\captionmargin,
3092 \string\margin@=\the\captionmargin@,
3093 \string\width=\the\captionwidth}%
3094 % \end{macrocode}
3095 % \begin{macrocode}
3096 }
3097 % \end{macrocode}
3098 % \end{macro}
3099 %
3100 % \begin{macro}{\caption@slc}
3101 % \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} added}
3102 % \changes{v1.1}{2007/07/29}{\cs{caption@setup}\cs{caption@sls} added after \cs{begingroup}}
3103 % \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} added}
3104 % \changes{v1.1c}{2007/10/14}{Support of \cs{caption@slfmt} added}
3105 % \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
3106 % \changes{v1.3}{2010/09/04}{Split into \cs{caption@slc} and \cs{caption@@slc}}
3107 % |\caption@slc|\marg{label}\marg{text}\marg{width}\marg{extra code}\par
3108 % This one does the single-line-check.
3109 % \begin{macrocode}
3110 \newcommand\caption@slc[4]{%
3111 \caption@@slc{#1}{#2}{#3}{\caption@singleline#4}{}}
3112 % \end{macrocode}
3113 % \begin{macrocode}
3114 \newcommand\caption@@slc[5]{%
3115 \caption@Debug{Begin SLC}%
3116 \begingroup
3117 \caption@singleline
3118 \let\caption@hj\@empty
3119 \caption@calcmargin % calculate #3 if necessary
3120 \caption@prepareslc
3121 \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
3122 \ifdim\wd\@tempboxa>#3%
3123 \endgroup
3124 #5%
3125 \else
3126 \endgroup
3127 #4%
3128 \fi
3129 \caption@Debug{End SLC}}
3130 % \end{macrocode}
3131 % \begin{macrocode}
3132 \newcommand*\caption@singleline{%
3133 \caption@xsetup\caption@opt@singleline
3134 \let\caption@fmt\caption@slfmt}
3135 % \end{macrocode}
3136 % \end{macro}
3137 %
3138 % \begin{macro}{\caption@prepareslc}
3139 % \changes{v1.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
3140 % \changes{v1.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
3141 % \changes{v1.0c}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added}
3142 % \changes{v1.0f}{2005/07/09}{Support of \package{endnotes} package added}
3143 % \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} moved to \cs{caption@slc}}
3144 % \changes{v1.1}{2007/06/13}{Redefinition of \cs{(H@)refstepcounter} added}
3145 % \changes{v1.1}{2007/08/12}{Redefinition of \cs{label} improved}
3146 % \changes{v1.1c}{2007/10/06}{Definition of \cs{caption@l@stepcounter} added}
3147 % |\caption@prepareslc|\par
3148 % \changes{v1.3}{2011/07/07}{Bugfix 11-07-06: Redefinition of \cs{footnote} and \cs{footnotemark} added, redefinition of \cs{stepcounter} and \cs{refstepcounter} dropped}
3149 % \changes{v1.4a}{2011/10/21}{Redefinition of \cs{pagenote} from \textsf{memoir} document class added}
3150 % \changes{v1.4a}{2011/10/22}{Redefinition of \cs{footnote} revised}
3151 % Re-define anything which would disturb the single-line-check.
3152 % \begin{macrocode}
3153 \newcommand*\caption@prepareslc{%
3154 \let\label\caption@gobble
3155 % \end{macrocode}
3156 % \begin{macrocode}
3157 \let\caption@footnotemark@ORI\footnotemark
3158 \def\footnote{\caption@withoptargs\caption@footnote}%
3159 \def\footnotemark{\caption@withoptargs\caption@footnotemark}%
3160 \let\@footnotetext\caption@gobble
3161 % \end{macrocode}
3162 % \begin{macrocode}
3163 \let\@endnotetext\caption@gobble
3164 % \end{macrocode}
3165 % \begin{macrocode}
3166 \let\pagenote\caption@gobble
3167 % \end{macrocode}
3168 % \begin{macrocode}
3169 }
3170 % \end{macrocode}
3171 % \begin{macrocode}
3172 \newcommand\caption@footnote[2]{%
3173 \caption@footnotemark{#1}}
3174 \newcommand\caption@footnotemark[1]{%
3175 \begingroup
3176 \let\stepcounter\caption@l@stepcounter
3177 \caption@footnotemark@ORI#1%
3178 \endgroup}
3179 % \end{macrocode}
3180 % \begin{macrocode}
3181 \newcommand*\caption@l@stepcounter[1]{%
3182 \advance\csname c@#1\endcsname\@ne\relax}
3183 % \end{macrocode}
3184 % \end{macro}
3185 %
3186 % \begin{macro}{\caption@parbox}
3187 % \changes{v1.0i}{2006/05/13}{We define \cs{caption@parbox} instead of
3188 % \cs{caption@start/endbox}}
3189 % \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{caption@parbox} changed from
3190 % \cs{parbox-t} to \cs{parbox-b}}
3191 % \changes{v1.2}{2007/11/11}{Renamed from \cs{captionbox} to \cs{caption@parbox}}
3192 % |\caption@parbox|\marg{width}\marg{contents}\par
3193 % This macro defines the box which surrounds the caption paragraph.
3194 % \begin{macrocode}
3195 \newcommand*\caption@parbox{\parbox[b]}
3196 % \end{macrocode}
3197 % \end{macro}
3198 %
3199 % \begin{macro}{\caption@applyfont}
3200 % \changes{v1.3}{2010/09/04}{This macro added}
3201 % |\caption@applyfont|\par
3202 % This macro executes the font relevant macros, i.e. by default
3203 % the options set by |justification=|, |font=|, and |size=|.
3204 % \begin{macrocode}
3205 \newcommand*\caption@applyfont{%
3206 \caption@hj\captionfont\captionsize}
3207 % \end{macrocode}
3208 % \end{macro}
3209 %
3210 % \begin{macro}{\caption@@@make}
3211 % \changes{v1.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
3212 % \changes{v1.0c}{2005/02/12}{Bugfix 04-12-16: Use some kind of
3213 % \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
3214 % \changes{v1.0c}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
3215 % \changes{v1.0d}{2005/05/05}{Use \cs{caption@ifempty};
3216 % \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
3217 % \changes{v1.0d}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
3218 % \changes{v1.0f}{2005/08/24}{Check for empty label added}
3219 % \changes{v1.0f}{2005/08/25}{\cs{caption@iflf} added}
3220 % \changes{v1.0j}{2007/02/18}{Usage of \cs{caption@tfmt} added}
3221 % \changes{v1.1}{2007/05/07}{Bugfix: \cs{ifhmode} added to \cs{@finalstrut}}
3222 % \changes{v1.2}{2007/11/17}{Made option \opt{size=} stronger than \opt{font=}}
3223 % \changes{v1.3}{2010/09/04}{Uses \cs{caption@applyfont} now}
3224 % \changes{v1.3}{2010/11/01}{Bugfix: If the caption text is empty, the text format will be set to \opt{simple} now}
3225 % |\caption@@@make|\marg{caption label}\marg{caption text}\par
3226 % This one finally typesets the caption paragraph, without margin and indention.
3227 % \begin{macrocode}
3228 \newcommand\caption@@@make[2]{%
3229 % \end{macrocode}
3230 %
3231 % If the label is empty, we use no caption label separator.
3232 % \begin{macrocode}
3233 \sbox\@tempboxa{#1}%
3234 \ifdim\wd\@tempboxa=\z@
3235 \let\caption@lsep\relax
3236 % \@capbreakfalse
3237 \fi
3238 % \end{macrocode}
3239 %
3240 % If the text is empty, we use no caption label separator, too.
3241 % (And no text format either.)
3242 % \begin{macrocode}
3243 \caption@ifempty{#2}{%
3244 \let\caption@lsep\@empty
3245 \let\caption@tfmt\@firstofone
3246 % \@capbreakfalse
3247 % \let\caption@ifstrut\@secondoftwo
3248 }%
3249 % \end{macrocode}
3250 %
3251 % Take care that |\caption@parindent| and |\caption@hangindent| will be used
3252 % to typeset the paragraph.
3253 % \begin{macrocode}
3254 \@setpar{\@@par\caption@@par}\caption@@par
3255 % \end{macrocode}
3256 %
3257 % Finally typeset the caption.
3258 % \begin{macrocode}
3259 \caption@applyfont
3260 \caption@fmt
3261 {\ifcaption@star\else{\captionlabelfont#1}\fi}%
3262 {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}%
3263 {{\captiontextfont
3264 \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
3265 \nobreak\hskip\z@skip % enable hyphenation
3266 \caption@tfmt{#2}%
3267 % \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
3268 \caption@ifstrut{\ifhmode\@finalstrut\strutbox\fi}{}%
3269 \par}}}
3270 % \end{macrocode}
3271 % \end{macro}
3272 %
3273 % \begin{macro}{\caption@ifempty}
3274 % \changes{v1.0d}{2005/05/05}{This macro added}
3275 % \changes{v1.1}{2007/07/04}{Re-defines itself now}
3276 % \changes{v1.2a}{2007/01/22}{Revised so \cs{label} will be detected, too}
3277 % \changes{v1.2b}{2008/08/02}{Revised so \cs{index} and \cs{glossary} will be detected, too}
3278 % |\caption@ifempty|\marg{text}\marg{true} (\emph{no} \meta{false})\par
3279 % This one tests if the \meta{text} is actually empty.
3280 % \Note{This will be done without expanding the text,
3281 % therefore this is far away from being bullet-proof.}
3282 % \Note{This macro is re-defining itself so only
3283 % the first test (in a group) will actually be done.}
3284 % \begin{macrocode}
3285 \newcommand\caption@ifempty[1]{%
3286 \caption@if@empty{#1}%
3287 \caption@ifempty\@unused}
3288 % \end{macrocode}
3289 % \begin{macrocode}
3290 \newcommand\caption@if@empty[1]{%
3291 \def\caption@tempa{#1}%
3292 \ifx\caption@tempa\@empty
3293 \let\caption@ifempty\@secondoftwo
3294 \else
3295 \expandafter\def\expandafter\caption@tempa\expandafter{%
3296 \caption@car#1\caption@if@empty\caption@nil}%
3297 \def\caption@tempb{\caption@if@empty}%
3298 \ifx\caption@tempa\caption@tempb
3299 \let\caption@ifempty\@secondoftwo
3300 \else
3301 \def\caption@tempb{\ignorespaces}%
3302 \ifx\caption@tempa\caption@tempb
3303 \expandafter\caption@if@empty\expandafter{\@gobble#1}%
3304 \else
3305 \def\caption@tempb{\label}%
3306 \ifx\caption@tempa\caption@tempb
3307 \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
3308 \else
3309 \def\caption@tempb{\index}%
3310 \ifx\caption@tempa\caption@tempb
3311 \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
3312 \else
3313 \def\caption@tempb{\glossary}%
3314 \ifx\caption@tempa\caption@tempb
3315 \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
3316 \else
3317 \let\caption@ifempty\@gobbletwo
3318 \fi
3319 \fi
3320 \fi
3321 \fi
3322 \fi
3323 \fi}
3324 % \end{macrocode}
3325 % \begin{macrocode}
3326 \long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long
3327 % \end{macrocode}
3328 % \end{macro}
3329 %
3330 % \begin{macro}{\caption@@par}
3331 % \changes{v1.0f}{2005/08/22}{Made this definition global}
3332 % |\caption@@par|\par
3333 % This command will be executed with every |\par| inside the caption.
3334 % \begin{macrocode}
3335 \newcommand*\caption@@par{%
3336 \parindent\caption@parindent\hangindent\caption@hangindent}%
3337 % \end{macrocode}
3338 % \end{macro}
3339 %
3340 % \subsection{Types \& sub-types}
3341 %
3342 % \begin{macro}{\DeclareCaptionType}
3343 % \changes{v1.1}{2007/08/12}{This macro added}
3344 % \changes{v1.1a}{2007/09/07}{Three optional arguments added}
3345 % \changes{v1.2}{2007/12/06}{Renamed from \cs{DeclareFloatingEnvironment} to \cs{DeclareCaptionType}}
3346 % \changes{v1.2}{2007/12/21}{Optional argument revised, uses key-value syntax now}
3347 % \changes{v1.2b}{2008/04/13}{Uses \cs{caption@within@default} now}
3348 % \changes{v1.2b}{2008/08/02}{Support of \cs{float@exts} and \cs{float@addtolists} added}
3349 % \changes{v1.2e}{2010/01/09}{Usage of \cs{caption@DeclareWithinOption} added}
3350 % \changes{v1.3}{2011/08/06}{Definition of \cs{listofXXXes} added}
3351 % \changes{v1.4a}{2011/10/29}{Outsourced as \package{newfloat} package}
3352 % |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name}
3353 % \begin{macrocode}
3354 \newcommand*\DeclareCaptionType{%
3355 \RequirePackage{newfloat}%
3356 \DeclareFloatingEnvironment}
3357 \@onlypreamble\DeclareCaptionType
3358 % \end{macrocode}
3359 % \end{macro}
3360 %
3361 % \begin{macro}{\caption@ForEachType}
3362 % \changes{v1.4a}{2011/10/29}{This macro added}
3363 % |\caption@ForEachType|\marg{code}
3364 % will execute the given code for all (known) floating environments.
3365 % \begin{macrocode}
3366 \newcommand\caption@ForEachType[1]{%
3367 \caption@ifundefined\ForEachFloatingEnvironment
3368 {\def\@elt##1{#1}%
3369 \caption@ifundefined\c@figure\@gobble\@elt{figure}%
3370 \caption@ifundefined\c@table\@gobble\@elt{table}%
3371 \let\@elt\relax
3372 \newfloat@addtohook{#1}}%
3373 {\ForEachFloatingEnvironment{#1}}}
3374 % \end{macrocode}
3375 % \begin{macrocode}
3376 \providecommand\newfloat@addtohook[1]{%
3377 \toks@=\expandafter{\newfloat@hook{##1}#1}%
3378 \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%
3379 \@tempa}
3380 % \end{macrocode}
3381 % \begin{macrocode}
3382 \providecommand*\newfloat@hook[1]{}
3383 % \end{macrocode}
3384 % \end{macro}
3385 %
3386 % \begin{macro}{\@stpelt}
3387 % We patch \cs{@stpelt} so a list of `connected' counters will be reset, too.
3388 % (Like \cs{stepcounter} does in |ltcounts.dtx|.)
3389 % \begin{macrocode}
3390 \newcommand*\caption@patch@stpelt{%
3391 \let\caption@stpelt\@stpelt
3392 \def\@stpelt##1{%
3393 \caption@stpelt{##1}%
3394 \begingroup
3395 \let\@elt\caption@stpelt
3396 \csname caption@cl@##1\endcsname
3397 \endgroup}%
3398 \let\caption@patch@stpelt\relax}
3399 \@onlypreamble\caption@patch@stpelt
3400 % \end{macrocode}
3401 % \end{macro}
3402 %
3403 % \begin{macro}{\caption@addtoreset}
3404 % \changes{v1.2d}{2009/10/09}{This macro added}
3405 % Like \cs{@addtoreset} from |ltcounts.dtx|
3406 % \begin{macrocode}
3407 \newcommand*\caption@addtoreset[2]{%
3408 \caption@patch@stpelt
3409 \@ifundefined{caption@cl@#2}{\@namedef{caption@cl@#2}{}}{}%
3410 \expandafter\@cons\csname caption@cl@#2\endcsname{{#1}}}
3411 \@onlypreamble\caption@addtoreset
3412 % \end{macrocode}
3413 % \end{macro}
3414 %
3415 % \begin{macro}{\caption@removefromreset}
3416 % \changes{v1.2d}{2009/10/09}{This macro added}
3417 % Like \cs{@removefromreset} from |remreset.sty|
3418 % \begin{macrocode}
3419 \newcommand*\caption@removefromreset[2]{%
3420 \begingroup
3421 \expandafter\let\csname c@#1\endcsname\caption@removefromreset
3422 \def\@elt##1{%
3423 \expandafter\ifx\csname c@##1\endcsname\caption@removefromreset
3424 \else
3425 \noexpand\@elt{##1}%
3426 \fi}%
3427 \expandafter\xdef\csname caption@cl@#2\endcsname{%
3428 \csname caption@cl@#2\endcsname}%
3429 \endgroup}
3430 \@onlypreamble\caption@removefromreset
3431 % \end{macrocode}
3432 % \end{macro}
3433 %
3434 % \begin{macro}{\DeclareCaptionSubType}
3435 % \changes{v1.2}{2007/11/16}{This macro added}
3436 % \changes{v1.2a}{2008/03/11}{Bugfix: \cs{subfigurename} will be defined now}
3437 % \changes{v1.2d}{2009/10/09}{Bugfix 08-10-01: Usage of \cs{caption@addtoreset} added}
3438 % \changes{v1.3}{2011/01/01}{\cs{@dottedlofline} will be defined \& used now}
3439 % \changes{v1.4}{2011/10/09}{Support of the titletoc package added}
3440 % |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\
3441 % |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\par
3442 % The starred variant provides the numbering format
3443 % \meta{type}|.|\meta{subtype} while the non-starred variant simply
3444 % uses \meta{subtype}.
3445 % \begin{macrocode}
3446 \newcommand*\DeclareCaptionSubType{%
3447 \caption@teststar\caption@declaresubtype\@firstoftwo\@secondoftwo}
3448 \@onlypreamble\DeclareCaptionSubType
3449 % \end{macrocode}
3450 % \begin{macrocode}
3451 \newcommand*\caption@declaresubtype[1]{%
3452 \@testopt{\caption@@declaresubtype{#1}}{alph}}
3453 \@onlypreamble\caption@declaresubtype
3454 % \end{macrocode}
3455 % \begin{macrocode}
3456 \def\caption@@declaresubtype#1[#2]#3{%
3457 \@ifundefined{c@#3}%
3458 {\caption@Error{No float type '#3' defined}}%
3459 % \end{macrocode}
3460 % \begin{macrocode}
3461 {\@ifundefined{c@sub#3}%
3462 {\caption@Debug{New subtype `sub#3'}%
3463 \newcounter{sub#3}%
3464 \caption@addtoreset{sub#3}{#3}%
3465 \@namedef{ext@sub#3}{\csname ext@#3\endcsname}%
3466 \caption@declaresublistentry{#3}%
3467 \@cons\caption@subtypelist{{#3}}}%
3468 {\caption@Debug{Modify caption `sub#3'}}%
3469 % \end{macrocode}
3470 % Support of \package{titletoc} package
3471 % \begin{macrocode}
3472 \caption@ifundefined\contentsuse{}{%
3473 \contentsuse{sub#3}{\csname ext@sub#3\endcsname}}%
3474 % \end{macrocode}
3475 % \begin{macrocode}
3476 \@namedef{sub#3name}{}%
3477 \@namedef{sub#3autorefname}{\csname #3name\endcsname}%
3478 #1% is \@firstoftwo in star form, and \@secondoftwo otherwise
3479 {\@namedef{p@sub#3}{}%
3480 \@namedef{thesub#3}{\csname the#3\endcsname.\@nameuse{#2}{sub#3}}}%
3481 {\@namedef{p@sub#3}{\csname the#3\endcsname}%
3482 \@namedef{thesub#3}{\@nameuse{#2}{sub#3}}}%
3483 \@namedef{theHsub#3}{\csname theH#3\endcsname.\arabic{sub#3}}%
3484 }}
3485 % \end{macrocode}
3486 % \begin{macrocode}
3487 \@onlypreamble\caption@@declaresubtype
3488 % \end{macrocode}
3489 % \begin{macrocode}
3490 \newcommand*\caption@declaresublistentry{%
3491 \caption@ifundefined\l@chapter
3492 {\caption@@declaresublistentry\l@subsubsection}%
3493 {\caption@@declaresublistentry\l@subsection}}
3494 \@onlypreamble\caption@declaresublistentry
3495 % \end{macrocode}
3496 % \begin{macrocode}
3497 \newcommand*\caption@@declaresublistentry[2]{%
3498 \ifx#1\@undefined
3499 \caption@@@declaresublistentry\relax\@dottedtocline\caption@nil{#2}%
3500 \else
3501 \expandafter\caption@@@declaresublistentry#1{}{}\@dottedtocline\caption@nil{#2}%
3502 \fi}
3503 \@onlypreamble\caption@@declaresublistentry
3504 % \end{macrocode}
3505 % \begin{macrocode}
3506 \long\def\caption@@@declaresublistentry#1\@dottedtocline#2\caption@nil#3{%
3507 \def\@tempa{#1}%
3508 % Does \l@(sub)subsection start with \@dottedtocline?
3509 \ifx\@tempa\@empty
3510 % Yes
3511 \caption@@@@declaresublistentry{#3}#2\caption@nil
3512 \else
3513 % No
3514 \caption@@@@declaresublistentry{#3}@{3.8em}{3.2em}\caption@nil
3515 \fi}
3516 \@onlypreamble\caption@@@declaresublistentry
3517 % \end{macrocode}
3518 % \begin{macrocode}
3519 \def\caption@@@@declaresublistentry#1#2#3#4#5\caption@nil{%
3520 \expandafter\caption@@@@@declaresublistentry\expandafter
3521 {\csname @dotted\csname ext@#1\endcsname line\endcsname}{#1}{#3}{#4}}
3522 \@onlypreamble\caption@@@@declaresublistentry
3523 % \end{macrocode}
3524 % \begin{macrocode}
3525 \newcommand*\caption@@@@@declaresublistentry[4]{%
3526 \@namedef{l@sub#2}{#1{2}{#3}{#4}}%
3527 \caption@@@@@@declaresublistentry#1{c@\csname ext@#2\endcsname depth}}
3528 \@onlypreamble\caption@@@@@declaresublistentry
3529 % \end{macrocode}
3530 % \begin{macrocode}
3531 \newcommand*\caption@@@@@@declaresublistentry[2]{
3532 \ifx#1\relax
3533 \def#1##1{%
3534 \def\next{\@dottedtocline{##1}}%
3535 \@ifundefined{#2}{}{%
3536 \ifnum ##1>\@nameuse{#2}\relax
3537 \let\next\@gobblefour
3538 \fi}%
3539 \next}%
3540 \fi}
3541 \@onlypreamble\caption@@@@@@declaresublistentry
3542 % \end{macrocode}
3543 % \end{macro}
3544 %
3545 % \begin{macro}{\caption@subtypelist}
3546 % An \cs{@elt}-list containing the subtypes defined
3547 % with |\Declare|\x|Caption|\x|Sub|\x|Type|.
3548 % \begin{macrocode}
3549 \newcommand*\caption@subtypelist{}
3550 % \end{macrocode}
3551 % \end{macro}
3552 %
3553 % \begin{macro}{\caption@For}
3554 % \changes{v1.1a}{2007/09/07}{This macro added}
3555 % \changes{v1.2}{2007/11/16}{Renamed from \cs{ForFloatingEnvironments} to \cs{caption@For}}
3556 % |\caption@For|\marg{elt-list}\marg{code with \#1}\\
3557 % |\caption@For*|\marg{elt-list}\marg{code with \#1}
3558 % \begin{macrocode}
3559 \newcommand*\caption@For{\caption@withoptargs\caption@@For}
3560 %\@onlypreamble\caption@For
3561 % \end{macrocode}
3562 % \begin{macrocode}
3563 \newcommand\caption@@For[3]{%
3564 \caption@AtBeginDocument#1{%
3565 \def\@elt##1{#3}%
3566 \@nameuse{caption@#2}%
3567 \let\@elt\relax}}%
3568 %\@onlypreamble\caption@@For
3569 % \end{macrocode}
3570 % \end{macro}
3571 %
3572 % \subsection{subfig package adaptions}
3573 % \changes{v1.1}{2007/07/07}{Several adaptions to the \package{subfig} package added}
3574 % \changes{v1.4a}{2011/11/01}{Bugfix 11-11-01: Test for the subfig package revised}
3575 %
3576 % Since the \package{subfig} package is not maintained anymore,
3577 % we have to make several adaptions to \thispackage~\version{1.1} here.
3578 % Please note that we only support the version $1.3$ of the \package{subfig} package here.
3579 % So older versions do not work with this version of \thispackage, and newer
3580 % versions are expected to be adapted.
3581 % \begin{macrocode}
3582 \caption@AtBeginDocument{%
3583 \def\@tempa{2005/06/28 ver: 1.3 subfig package}%
3584 \expandafter\ifx\csname [email protected]\endcsname\@tempa
3585 \caption@InfoNoLine{subfig package v1.3 is loaded}%
3586 % \end{macrocode}
3587 % \begin{macrocode}
3588 \let\caption@setfloattype\@gobble
3589 \let\@dottedxxxline\sf@NEW@dottedxxxline
3590 \let\sf@subfloat\sf@NEW@subfloat
3591 % \end{macrocode}
3592 % \begin{macrocode}
3593 \fi
3594 \let\sf@NEW@dottedxxxline\@undefined
3595 \let\sf@NEW@subfloat\@undefined}
3596 % \end{macrocode}
3597 % \begin{macrocode}
3598 \def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{%
3599 \begingroup
3600 \caption@setfloattype{#1}%
3601 \caption@setoptions{subfloat}%
3602 \caption@setoptions{sub#1}%
3603 \ifnum #3>\@nameuse{c@#2depth}\else
3604 \@dottedtocline{\z@}{#4}{#5}{#6}{#7}%
3605 \fi
3606 \endgroup}
3607 % \end{macrocode}
3608 % \begin{macrocode}
3609 \def\sf@NEW@subfloat{%
3610 \begingroup
3611 \caption@setfloattype\@captype
3612 \sf@ifpositiontop{%
3613 \maincaptiontoptrue
3614 }{%
3615 \maincaptiontopfalse
3616 }%
3617 \caption@setoptions{subfloat}%
3618 \caption@setoptions{sub\@captype}%
3619 \let\sf@oldlabel=\label
3620 \let\label=\subfloat@label
3621 \ifmaincaptiontop\else
3622 \advance\@nameuse{c@\@captype}\@ne
3623 \fi
3624 \refstepcounter{sub\@captype}%
3625 \setcounter{sub\@captype @save}{\value{sub\@captype}}%
3626 \@ifnextchar [% %] match left bracket
3627 {\sf@@subfloat}%
3628 {\sf@@subfloat[\@empty]}}
3629 % \end{macrocode}
3630 %
3631 % \iffalse
3632 %</package>
3633 % \fi
3634 %
3635 % \clearpage
3636 % \begin{thebibliography}{99}
3637 % \bibitem{Anne}
3638 % Anne Br\"uggemann-Klein:\\
3639 % \emph{Einf\"uhrung in die Dokumentverarbeitung},\\
3640 % B.G. Teubner, Stuttgart, 1989
3641 %
3642 % \bibitem{hyperref}
3643 % Sebastian Rahtz \& Heiko Oberdiek:\\
3644 % \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/hyperref/}%
3645 % {\emph{Hypertext marks in \LaTeX}},\\
3646 % November 12, 2007
3647 %
3648 % \bibitem{refcount}
3649 % Heiko Oberdiek:\\
3650 % \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/oberdiek/refcount.pdf}%
3651 % {\emph{The refcount package}},\\
3652 % 2006/02/20
3653 %
3654 % \bibitem{threeparttable}
3655 % Donald Arseneau:\\
3656 % \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/misc/}%
3657 % {\emph{Three part tables: title, tabular environment, notes}},\\
3658 % 2003/06/13
3659 % \end{thebibliography}
3660 %
3661 % \iffalse
3662 % --------------------------------------------------------------------------- %
3663 % \fi
3664 %
3665 % \clearpage
3666 % \Finale
3667 %
3668 \endinput