Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % This is file `caption.dtx'.
4 %
5 % Copyright (C) 1994-2007 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,
22 % caption2.dtx, and anleitung.tex and the derived files
23 % caption.sty, caption2.sty, caption3.sty, and manual.tex.
24 %
25 % \fi
26 % \CheckSum{2179}
27 %
28 % \iffalse
29 %<*driver>
30 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
31 \documentclass{ltxdoc}
32 \setlength\parindent{0pt}
33 \setlength\parskip{\smallskipamount}
34 %
35 \newcommand\NEWfeature{\NEW{New feature}}
36 \newcommand\NEWdescription{\NEW{New description}}
37 \newcommand\NEW[2]{\hskip 1sp \marginpar{\footnotesize\sffamily\raggedleft#1\\#2}}
38 %
39 \font\manual=manfnt
40 \newcommand\DANGER{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{\manual\char127}}}}
41 %
42 \ifx\pdfoutput\undefined\else
43 \ifcase\pdfoutput\else
44 \usepackage{mathptmx,courier}
45 \usepackage[scaled=0.90]{helvet}
46 \addtolength\marginparwidth{15pt}
47 \fi
48 \fi
49 %
50 %\usepackage[french,USenglish]{babel}
51 \usepackage{color,setspace}
52 %
53 %\usepackage{float}
54 \usepackage{longtable}
55 %\usepackage[raggedright]{sidecap}
56 %
57 \usepackage{caption}[2005/08/24]
58 \DeclareCaptionLabelSeparator{endash}{\space\textendash\space}
59 \usepackage{hypdoc}
60 %
61 \DeclareCaptionFont{red}{\color{red}}
62 \DeclareCaptionFont{green}{\color{green}}
63 \DeclareCaptionFont{blue}{\color{blue}}
64 %
65 \DeclareCaptionLabelSeparator{period-newline}{. \\}
66 \DeclareCaptionStyle{period-newline}[labelsep=period]{labelsep=period-newline}
67 \DeclareCaptionStyle{period-newline2}[labelsep=period,justification=centering]{labelsep=period-newline}
68 \DeclareCaptionStyle{period-newline3}[labelsep=period]{labelsep=period-newline,justification=centering}
69 \DeclareCaptionFormat{reverse}{#3#2#1}
70 \DeclareCaptionFormat{llap}{\llap{#1#2}#3\par}
71 \DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)}
72 \DeclareCaptionLabelSeparator{fill}{\hfill}
73 %
74 \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
75 M\kern.05em A\kern.1em-\kern.1em Script}}
76 %
77 %<+driver>\OnlyDescription
78 %
79 \begin{document}
80 \DocInput{caption.dtx}
81 \end{document}
82 %</driver>
83 % \fi
84 %
85 % \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
86 % \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
87 % \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
88 % \let\package\puresf\def\thispackage{\package{caption}}
89 % \let\env\purett \let\opt\purett
90 %
91 % \newcommand*\version[2][]{$v#2$}
92 %
93 % \newenvironment{Options}[1]%
94 % {\list{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}%
95 % \settowidth{\labelwidth}{\texttt{#1\space}}%
96 % \setlength{\leftmargin}{\labelwidth}%
97 % \addtolength{\leftmargin}{\labelsep}}}%
98 % {\endlist}
99 %
100 % \newenvironment{Example}%
101 % {\ifvmode\else\unskip\par\fi
102 % \minipage{\linewidth}\smallskip}%
103 % {\smallskip\endminipage}
104 % \newcommand\example[3][figure]{%
105 % \begingroup
106 % \captionsetup{#2}%
107 % \captionof{#1}[]{#3}%
108 % \endgroup}
109 %
110 % \GetFileInfo{caption.sty}
111 % \title{Typesetting captions with the
112 % \thispackage\ package\thanks{This package has version number
113 % \fileversion, last revised \filedate.}}
114 % \author{Axel Sommerfeldt\\\href{mailto:[email protected]}{\texttt{[email protected]}}}
115 % \date{2007/04/09}
116 % \maketitle
117 %
118 % \begin{abstract}
119 % The \thispackage\ package offers customization of captions
120 % in floating environments such |figure| and |table| and cooperates with
121 % many other packages.\footnote{A complete re-work of the user interface
122 % done with Steven D. Cochran and Frank Mittelbach has lead to
123 % this new enhanced version 3.0.}
124 % \end{abstract}
125 %
126 % \tableofcontents
127 %
128 % \newcommand\figuretext{^^A
129 % White sand beaches. The pink smoothness of the conch shell. A sea abundant
130 % with possibilities. Duty-free shops filled with Europe's finest gifts and
131 % perfumes. Play your favorite game of golf amidst the tropical greens on one
132 % of the many championship courses.}
133 %
134 % \iffalse
135 % --------------------------------------------------------------------------- %
136 % \fi
137 %
138 % \section{Introduction}
139 %
140 % Within the standard \LaTeX\ classes captions haven't received the attention
141 % they deserve. Simply typeset as an ordinary paragraph there is no
142 % remarkable visual difference from the rest of the text, like here:
143 %
144 % \example{belowskip=\abovecaptionskip}{\figuretext}
145 %
146 % There should be possibilities to change this; for example, it would be nice
147 % if you could make the text of the caption a little bit smaller as the normal
148 % text, add an extra margin, typeset the caption label with the same font
149 % family and shape as your headings etc. Just like this one:
150 %
151 % \example{belowskip=\abovecaptionskip,size=small,margin=10pt,labelfont=bf,labelsep=endash}{\figuretext}
152 %
153 % You can do this easily with this package as there are many ready-to-use
154 % caption formatting options, but you are free to define your very own stuff, too.
155 %
156 % \iffalse
157 % --------------------------------------------------------------------------- %
158 % \fi
159 %
160 % \pagebreak[4]
161 % \section{Using the package}
162 % \label{usage}
163 %
164 % \DescribeMacro{\usepackage}
165 % Insert
166 % \begin{quote}
167 % |\usepackage|\oarg{options}|{caption}[|\texttt{\filedate}|]|
168 % \end{quote}
169 % into the preamble of your document, i.e.~the part of your document
170 % between |\documentclass| and |\begin{document}|.
171 % The options control how your captions will look like; e.g.,
172 % \begin{quote}
173 % |\usepackage[margin=10pt,font=small,labelfont=bf]{caption}|
174 % \end{quote}
175 % would result in captions looking like the second one in the introduction.
176 %
177 % \DescribeMacro{\captionsetup}
178 % For a later change of options the \thispackage\ package provides the command
179 % \begin{quote}
180 % |\captionsetup|\oarg{float type}\marg{options}
181 % \end{quote}
182 % So
183 % \begin{quote}
184 % |\usepackage[margin=10pt,font=small,labelfont=bf]{caption}|
185 % \end{quote}
186 % and
187 % \begin{quote}
188 % |\usepackage{caption}|\\
189 % |\captionsetup{margin=10pt,font=small,labelfont=bf}|
190 % \end{quote}
191 % are equal in their results.
192 %
193 % It's good to know that |\captionsetup| has an effect on the current
194 % environment only. So if you want to change some settings for the
195 % current |figure| or |table| only, just place the |\captionsetup| command
196 % inside the |figure| or |table| right before the |\caption| command.
197 % For example
198 % \begin{quote}
199 % |\begin{figure}|\\
200 % | |\ldots\\
201 % | \captionsetup{singlelinecheck=off}|\\
202 % | \caption{|\ldots|}|\\
203 % |\end{figure}|
204 % \end{quote}
205 % switches the single-line-check off, but only for this |figure| so all
206 % the other captions remain untouched.
207 %
208 % (For a description of the optional parameter \meta{float type} see
209 % section \ref{misc}: \textit{``Useful stuff''}.)
210 %
211 % \iffalse
212 % --------------------------------------------------------------------------- %
213 % \fi
214 %
215 % \pagebreak[3]
216 % \section{Options}
217 %
218 % \def\OptionLabel{RaggedRight}
219 % \def\UserDefined{\ldots}
220 % \makeatletter
221 % \newcommand*\Section{\@ifstar{\@Section\relax}{\@Section{section}}}
222 % \newcommand*\@Section[3]{#1 \ref{#2}: \textit{``#3''}}
223 % \makeatother
224 % \newcommand*\See[1]{{\small (See #1)}}
225 % \newcommand*\SeeUserDefined[1][]{%
226 % \See{\Section{declare}{Do it yourself}#1}}
227 %
228 % \iffalse
229 % --------------------------------------------------------------------------- %
230 % \fi
231 %
232 % \subsection{Formatting}
233 %
234 % \DescribeMacro{format=}
235 % A figure or table caption mainly consits of three parts: the caption label,
236 % which says if this object is a `Figure' or `Table' and what number is
237 % associated with it, the caption text itself, which is normally a short
238 % description of contents, and the caption separator which separates the text
239 % from the label.
240 %
241 % The \textit{caption format} determines how this information will be presented;
242 % it is specified with the option
243 % \begin{quote}
244 % |format=|\meta{format name}\quad ,
245 % \end{quote}
246 % having the name of the caption format as its argument.
247 %
248 % There are two standard caption formats:
249 % \iffalse
250 % \footnote{You have the option to
251 % define your own ones, too. See section \ref{declare}:
252 % \textit{``Do it yourself!''} for details.}
253 % \fi
254 %
255 % \begin{Options}{\OptionLabel}
256 % \item[plain]\NEWdescription{v3.0h}
257 % Typesets the captions as a normal paragraph.
258 % (This is the default behaviour, it
259 % is adapted from the standard \LaTeX\ document classes.)
260 %
261 % \item[hang]
262 % Indents the caption text, so it will `hang' under the first line of the text.
263 %
264 % \item[\UserDefined]
265 % Own formats can be defined using |\DeclareCaptionFormat|.
266 % \SeeUserDefined
267 % \end{Options}
268 %
269 % \begin{Example}
270 % An example: Specifying the option
271 % \begin{quote}
272 % |format=hang|
273 % \end{quote}
274 % yields captions like this:
275 % \example{format=hang}{\figuretext}
276 % \end{Example}
277 %
278 % \DescribeMacro{indention=}
279 % For both formats (\texttt{plain} and \texttt{hang}) you can setup an extra
280 % indention starting at the second line of the caption. You do this with the
281 % option
282 % \begin{quote}
283 % |indention=|\meta{amount}.
284 % \end{quote}
285 %
286 % Two examples:
287 %
288 % \begin{Example}
289 % \begin{quote}
290 % |format=plain,indention=.5cm|
291 % \end{quote}
292 % \captionsetup{aboveskip=0pt}
293 % \example{format=plain,indention=.5cm}{\figuretext}
294 % \end{Example}
295 %
296 % \begin{Example}
297 % \begin{quote}
298 % |format=hang,indention=-0.5cm|
299 % \end{quote}
300 % \captionsetup{aboveskip=0pt}
301 % \example{format=hang,indention=-0.5cm}{\figuretext}
302 % \end{Example}
303 %
304 % \pagebreak[3]
305 % \DescribeMacro{labelformat=}
306 % With the option
307 % \nopagebreak[3]
308 % \begin{quote}
309 % |labelformat=|\meta{label format name}
310 % \end{quote}
311 % \NEWdescription{v3.0e}
312 % you specify how the caption label will be typeset.
313 % There are four standard caption label formats:
314 %
315 % \begin{Options}{\OptionLabel}
316 % \item[default]
317 % The caption label will be typeset as specified by the document class,
318 % usually this means the name and the number (like \texttt{simple}).
319 % (This is the default behaviour.)
320 %
321 % \item[empty]
322 % The caption label will be empty. (This option makes sense when used
323 % together with other options like \texttt{labelsep=none}.)
324 %
325 % \item[simple]
326 % The caption label will be typeset as a name and a number.
327 %
328 % \item[parens]
329 % The number of the caption label will be typeset in parentheses.
330 %
331 % \item[\UserDefined]
332 % Own label formats can be defined using |\DeclareCaptionLabelFormat|.
333 % \SeeUserDefined
334 % \end{Options}
335 %
336 % \begin{Example}
337 % An example: Using the options
338 % \begin{quote}
339 % |labelformat=parens,labelsep=quad|
340 % \end{quote}
341 % gives captions like this one:
342 % \example{labelformat=parens,labelsep=quad}{\figuretext}
343 % \end{Example}
344 %
345 % \DescribeMacro{labelsep=}
346 % With the option
347 % \begin{quote}
348 % |labelsep=|\meta{label separator name}
349 % \end{quote}
350 % you specify what caption separator will be used.
351 % You can choose one of the following:
352 %
353 % \begin{Options}{\OptionLabel}
354 % \item[none]
355 % There is no caption separator. (This option makes sense when used
356 % together with other options like \texttt{labelformat=empty}.)
357 %
358 % \item[colon]
359 % The caption label and text will be separated by a colon and a space.
360 % (This is the default one.)
361 %
362 % \item[period]
363 % The caption label and text will be separated by a period and a space.
364 %
365 % \item[space]
366 % The caption label and text will be separated by a single space.
367 %
368 % \item[quad]
369 % The caption label and text will be separated by a |\quad|.
370 %
371 % \item[newline]
372 % The caption label and text will be separated by a line break (|\\|).
373 %
374 % \item[endash]\NEWfeature{v3.0h}
375 % The caption label and text will be separated by an en-dash,
376 % surrounded by spaces (| -- |).
377 %
378 % \item[\UserDefined]
379 % Own separators can be defined using |\DeclareCaptionLabelSeparator|.
380 % \SeeUserDefined
381 % \end{Options}
382 %
383 % Three examples:
384 % \begin{Example}
385 % \begin{quote}
386 % |labelsep=period|
387 % \end{quote}
388 % \captionsetup{aboveskip=0pt}
389 % \example{labelsep=period}{\figuretext}
390 % \end{Example}
391 %
392 % \begin{Example}
393 % \begin{quote}
394 % |labelsep=newline,singlelinecheck=false|
395 % \end{quote}
396 % \captionsetup{aboveskip=0pt}
397 % \example{labelsep=newline,singlelinecheck=false}{\figuretext}
398 % \end{Example}
399 %
400 % \begin{Example}
401 % \begin{quote}
402 % |labelsep=endash|
403 % \end{quote}
404 % \captionsetup{aboveskip=0pt}
405 % \example{labelsep=endash}{\figuretext}
406 % \end{Example}
407 %
408 % \iffalse
409 % --------------------------------------------------------------------------- %
410 % \fi
411 %
412 % \subsection{Justification}
413 % \label{justification}
414 %
415 % \DescribeMacro{justification=}
416 % As addition to the caption format you could also specify a
417 % \emph{caption justification}; it is specified with the option
418 % \begin{quote}
419 % |justification=|\meta{justification name}\quad.
420 % \end{quote}
421 %
422 % You can choose one of the following:
423 %
424 % \begin{Options}{\OptionLabel}
425 % \item[justified]
426 % Typesets the caption as a normal paragraph. (This is the default.)
427 %
428 % \item[centering]
429 % Each line of the caption will be centered.
430 %
431 % \iffalse
432 % \item[Centering]
433 % Each line of the caption will be centered, too.
434 % But this time the command |\Centering| of the \package{ragged2e} package
435 % will be used to achieve this. This difference is that this time the word
436 % breaking algorithm of \TeX\ will work inside the caption.
437 % \fi
438 %
439 % \item[centerlast]
440 % The last line of each paragraph of the caption text will be centered.
441 %
442 % \item[centerfirst]
443 % Only the first line of the caption will be centered.
444 %
445 % \item[raggedright]
446 % Each line of the caption will be moved to the left margin.
447 %
448 % \iffalse
449 % \item[RaggedRight]
450 % Each line of the caption will be moved to the left margin using
451 % the command |\RaggedRight| from the \package{ragged2e} package.
452 % \fi
453 % \item[RaggedRight]
454 % Each line of the caption will be moved to the left margin, too.
455 % But this time the command |\RaggedRight| of the \package{ragged2e} package
456 % will be used to achieve this. The main difference is that the word
457 % breaking algorithm of \TeX\ will work inside captions.
458 %
459 % \item[raggedleft]
460 % Each line of the caption will be moved to the right margin.
461 %
462 % \iffalse
463 % \item[RaggedLeft]
464 % Each line of the caption will be moved to the right margin using
465 % the command |\RaggedLeft| from the \package{ragged2e} package.
466 % \fi
467 %
468 % \item[\UserDefined]
469 % Own justifications can be defined using |\DeclareCaptionJustification|.
470 % \SeeUserDefined
471 % \end{Options}
472 %
473 % Three examples:
474 % \begin{Example}
475 % \begin{quote}
476 % |justification=centerlast|
477 % \end{quote}
478 % \captionsetup{aboveskip=0pt}
479 % \example{justification=centerlast}{\figuretext}
480 % \end{Example}
481 %
482 % \begin{Example}
483 % \begin{quote}
484 % |format=hang,justification=raggedright|
485 % \end{quote}
486 % \captionsetup{aboveskip=0pt}
487 % \example{format=hang,justification=raggedright}{\figuretext}
488 % \end{Example}
489 %
490 % \begin{Example}
491 % \begin{quote}
492 % |labelsep=newline,justification=centering|
493 % \end{quote}
494 % \captionsetup{aboveskip=0pt}
495 % \example{belowskip=\abovecaptionskip,labelsep=newline,justification=centering}{\figuretext}
496 % \end{Example}
497 %
498 % \DescribeMacro{singlelinecheck=}
499 % The standard \LaTeX\ document classes (|article|, |report|, and |book|)
500 % automatically center a caption if it fits in one single line:
501 %
502 % \example{belowskip=\abovecaptionskip}{A short caption.}
503 %
504 % \DANGER
505 % The \thispackage\ package adapts this behaviour and therefore usually
506 % ignores the justification you have set with |justification=| in such case.
507 % But you can switch this special treatment of such short captions off
508 % with the option
509 % \begin{quote}
510 % |singlelinecheck=|\meta{bool}\quad.
511 % \end{quote}
512 % Using |false|, |no|, |off| or |0| for \meta{bool} switches the
513 % extra centering off:
514 % \begin{quote}
515 % |singlelinecheck=false|
516 % \end{quote}
517 % Doing so the above short caption would look like
518 %
519 % \begingroup
520 % \captionsetup{type=figure}
521 % \ContinuedFloat
522 % \endgroup
523 % \example{belowskip=\abovecaptionskip,singlelinecheck=false}{A short caption.}
524 %
525 % You switch the extra centering on again by using |true|, |yes|, |on| or |1|
526 % for \meta{bool}. (The default is on.)
527 %
528 % \iffalse
529 % --------------------------------------------------------------------------- %
530 % \fi
531 %
532 % \subsection{Fonts}
533 % \label{fonts}
534 %
535 % \DescribeMacro{font=}
536 % \DescribeMacro{labelfont=}
537 % \DescribeMacro{textfont=}
538 % There are three font options which affects different parts of the caption:
539 % One affecting the whole caption (|font|), one which only affects the caption
540 % label and separator (|labelfont|) and at least one which only affects the
541 % caption text (|textfont|).
542 % You set them up using the options
543 % \begin{quote}\begin{tabular}{@{}r@{}ll}
544 % |font=| & \marg{font options} & ,\\
545 % |labelfont=| & \marg{font options} & , and\\
546 % |textfont=| & \marg{font options} & .\\
547 % \end{tabular}\end{quote}
548 %
549 % And these are the available font options:
550 %
551 % \begin{Options}{\OptionLabel}
552 % \item[scriptsize] {\scriptsize Very small size}
553 % \item[footnotesize] {\footnotesize The size usually used for footnotes}
554 % \item[small] {\small Small size}
555 % \item[normalsize] {\normalsize Normal size}
556 % \item[large] {\large Large size}
557 % \item[Large] {\Large Even larger size}
558 %
559 % \item[up] {\upshape Upright shape}
560 % \item[it] {\itshape Italic shape}
561 % \item[sl] {\slshape Slanted shape}
562 % \item[sc] {\scshape Small Caps shape}
563 %
564 % \item[md] {\mdseries Medium series}
565 % \item[bf] {\bfseries Bold series}
566 %
567 % \item[rm] {\rmfamily Roman family}
568 % \item[sf] {\sffamily Sans Serif family}
569 % \item[tt] {\ttfamily Typewriter family}
570 %
571 % \item[\UserDefined]
572 % Own font options can be defined using |\DeclareCaptionFont|.
573 % \SeeUserDefined
574 % \end{Options}
575 %
576 % If you use only one of these options you can omit the braces;
577 % e.g., the options
578 % \iffalse
579 % \begin{quote}
580 % \fi
581 % |font={small}|
582 % \iffalse
583 % \end{quote}
584 % \fi
585 % and
586 % \iffalse
587 % \begin{quote}
588 % \fi
589 % |font=small|
590 % \iffalse
591 % \end{quote}
592 % \fi
593 % will give the same result.
594 %
595 % Two examples:
596 % \begin{Example}
597 % \begin{quote}
598 % |font={small,it},labelfont=bf|
599 % \end{quote}
600 % \captionsetup{aboveskip=0pt}
601 % \example{font={small,it},labelfont=bf}{\figuretext}
602 % \end{Example}
603 %
604 % \begin{Example}
605 % \begin{quote}
606 % |font=small,labelfont=bf,textfont=it|
607 % \end{quote}
608 % \captionsetup{aboveskip=0pt}
609 % \example{font=small,labelfont=bf,textfont=it}{\figuretext}
610 % \end{Example}
611 %
612 % \iffalse
613 % --------------------------------------------------------------------------- %
614 % \fi
615 %
616 % \subsection{Margins and further paragraph options}
617 % \label{margins}
618 %
619 % \DescribeMacro{margin=}
620 % \DescribeMacro{width=}
621 % For all captions you can specify \emph{either} an extra margin \emph{or}
622 % a fixed width. You do this by using the options
623 % \begin{quote}\begin{tabular}{@{}r@{}ll}
624 % |margin=| & \meta{amount} & \emph{or}\\
625 % |width=| & \meta{amount} & \\
626 % \end{tabular}\end{quote}
627 % Nevertheless what option you use, the left and right margin will be the
628 % same.
629 %
630 % Two examples will illustrating this:
631 % \begin{Example}
632 % \begin{quote}
633 % |margin=10pt|
634 % \end{quote}
635 % \captionsetup{aboveskip=0pt}
636 % \example{margin=10pt}{\figuretext}
637 % \end{Example}
638 %
639 % \begin{Example}
640 % \begin{quote}
641 % |width=.75\textwidth|
642 % \end{quote}
643 % \captionsetup{aboveskip=0pt}
644 % \example{width=.75\textwidth}{\figuretext}
645 % \end{Example}
646 %
647 % \DescribeMacro{parskip=}
648 % This option is useful for captions containing more than one paragraph.
649 % It specifies the extra vertical space inserted between them:
650 % \begin{quote}
651 % |parskip=|\meta{amount}
652 % \end{quote}
653 % One example:
654 % \begin{Example}
655 % \begin{quote}
656 % |margin=10pt,parskip=5pt|
657 % \end{quote}
658 % \captionsetup{aboveskip=0pt}
659 % \example{margin=10pt,parskip=5pt}{
660 % First paragraph of the caption. This one contains some test, just to
661 % show how these options affect the layout of the caption.
662 %
663 % Second paragraph of the caption. This one contains some text, too, to
664 % show how these options affect the layout of the caption.}
665 % \end{Example}
666 %
667 % \DescribeMacro{hangindent=}
668 % The option
669 % \begin{quote}
670 % |hangindent=|\meta{amount}
671 % \end{quote}
672 % is for setting up a hanging indention starting from the second line of each
673 % paragraph. If the caption contains just a single paragraph, using this option
674 % leads to the same result as the option |indention=| you already know about.
675 % But if the caption contains multiple paragraphs you will notice the difference:
676 %
677 % \begin{Example}
678 % \begin{quote}
679 % |format=hang,indention=-.5cm|
680 % \end{quote}
681 % \captionsetup{aboveskip=0pt}
682 % \example{format=hang,indention=-.5cm}{
683 % First paragraph of the caption. This one contains some test, just to
684 % show how these options affect the layout of the caption.
685 %
686 % Second paragraph of the caption. This one contains some text, too, to
687 % show how these options affect the layout of the caption.}
688 % \end{Example}
689 %
690 % \begin{Example}
691 % \begin{quote}
692 % |format=hang,hangindent=-.5cm|
693 % \end{quote}
694 % \captionsetup{aboveskip=0pt}
695 % \example{format=hang,hangindent=-.5cm}{
696 % First paragraph of the caption. This one contains some test, just to
697 % show how these options affect the layout of the caption.
698 %
699 % Second paragraph of the caption. This one contains some text, too, to
700 % show how these options affect the layout of the caption.}
701 % \end{Example}
702 %
703 % \iffalse
704 % --------------------------------------------------------------------------- %
705 % \fi
706 %
707 % \subsection{Styles}
708 % \label{style}
709 %
710 % \DescribeMacro{style=}
711 % A suitable combination of caption options is called \emph{caption style}.
712 % You can compare them more or less to page styles which you set up with
713 % |\pagestyle|: The caption style provides all settings for a whole caption layout.
714 %
715 % You switch to an already defined caption style with the option
716 % \begin{quote}
717 % |style=|\meta{style name}\quad.
718 % \end{quote}
719 % The \thispackage\ package usually defines only the style |default| which
720 % puts all options you already know about to the default ones.
721 % This means that specifying the option
722 % \begin{quote}
723 % |style=default|
724 % \end{quote}
725 % has the same effect as specifying all these options:
726 % \begin{quote}
727 % |format=default,labelformat=default,labelsep=default,|\\
728 % |justification=default,font=default,labelfont=default,|\\
729 % |textfont=default,margin=0pt,indention=0pt,parindent=0pt|\\
730 % |hangindent=0pt,singlelinecheck=true|
731 % \end{quote}
732 %
733 % Own caption styles can be defined using |\DeclareCaptionStyle|.
734 % \SeeUserDefined
735 %
736 % \iffalse
737 % --------------------------------------------------------------------------- %
738 % \fi
739 %
740 % \subsection{Skips}
741 %
742 % \DescribeMacro{aboveskip=}
743 % \DescribeMacro{belowskip=}
744 % The spaces above and below the caption are controlled by the skips
745 % |\abovecaptionskip| and |\belowcaptionskip|. The standard \LaTeX\ document
746 % classes |article|, |report| and |book| set |\abovecaptionskip| to |10pt|
747 % and |\belowcaptionskip| to |0pt|.
748 %
749 % \pagebreak[3]
750 % Both skips can be changed with the command |\setlength|, but you can
751 % use these options, too:
752 % \nopagebreak[3]
753 % \begin{quote}\begin{tabular}{@{}r@{}ll}
754 % |aboveskip=| & \meta{amount} & and\\
755 % |belowskip=| & \meta{amount} & .\\
756 % \end{tabular}\end{quote}
757 %
758 % \DescribeMacro{position=}
759 % Using |\abovecaptionskip| and |\belowcaptionskip| has a major design flaw:
760 % If the caption is typeset \emph{above} (and not \emph{below}) the figure
761 % or table they are not set up very useful at default, because there will be
762 % some extra space above the caption but no space between the caption and the
763 % figure or table itself. (Remember: |\belowcaptionskip| is usually set to |0pt|.)
764 %
765 % Please compare the spacing in these small tables:
766 % \begin{Example}
767 % \begin{minipage}[c]{.5\linewidth}
768 % \iffalse
769 % \captionsetup{aboveskip=0pt}%
770 % \fi
771 % \captionof{table}{A table}
772 % \centering\begin{tabular}{ll}
773 % A & B \\
774 % C & D \\
775 % \end{tabular}
776 % \end{minipage}
777 % \begin{minipage}[c]{.5\linewidth}
778 % \centering\begin{tabular}{ll}
779 % A & B \\
780 % C & D \\
781 % \end{tabular}
782 % \captionof{table}{A table}
783 % \end{minipage}
784 % \end{Example}
785 %
786 % But you can fix this by using the option |position=|: It specifies how the
787 % spacing above and below the caption will be used:
788 % \begin{quote}
789 % |position=top|\quad(or |position=above|)
790 % \end{quote}
791 % tells the \thispackage\ package to use the spacing useful for caption
792 % \emph{above} the figure or table and
793 % \begin{quote}
794 % |position=bottom|\quad(or |position=below|)
795 % \end{quote}
796 % tells the \thispackage\ package to use the spacing useful for captions
797 % \emph{below} the figure or table. (The last one is the default setting
798 % except for |longtable|s.)
799 %
800 % So adding an extra |\captionsetup{position=top}| to the left example
801 % table gives you proper spacing around both captions:
802 % \begin{Example}
803 % \begin{minipage}[c]{.5\linewidth}
804 % \captionsetup{position=top}
805 % \captionof{table}{A table}
806 % \centering\begin{tabular}{ll}
807 % A & B \\
808 % C & D \\
809 % \end{tabular}
810 % \end{minipage}
811 % \begin{minipage}[c]{.5\linewidth}
812 % \centering\begin{tabular}{ll}
813 % A & B \\
814 % C & D \\
815 % \end{tabular}
816 % \captionof{table}{A table}
817 % \end{minipage}
818 % \end{Example}
819 %
820 % (Technically speaking |\abovecaptionskip| and |\belowcaptionskip| will
821 % be swapped if you specify the option |position=top|, so in both cases
822 % |\abovecaptionskip| will be used between the caption and the figure or
823 % table itself.)
824 %
825 % This option is especially useful when used together with the optional
826 % argument of the |\captionsetup| command.
827 % \See{\Section{misc}{Useful stuff} for details}\par
828 % For example
829 % \begin{quote}
830 % |\captionsetup[table]{position=top}|
831 % \end{quote}
832 % causes all captions within tables to be treated as captions \emph{above}
833 % the table (regarding spacing around it).
834 % \DescribeMacro{tableposition=}
835 % \NEWfeature{v3.0a}
836 % Because this is a very common setting the \thispackage\ package offers
837 % an abbreviating option for the use with |\usepackage|:
838 % \begin{quote}
839 % |\usepackage[|\ldots|,tableposition=top]{caption}|\footnote{Please
840 % note that this is \emph{not} sufficient when using a
841 % \KOMAScript\ document class, you need to use the \emph{global}
842 % option |tablecaptionabove|, too.}
843 % \end{quote}
844 % is equivalent to
845 % \begin{quote}
846 % |\usepackage[|\ldots|]{caption}|\\
847 % |\captionsetup[table]{position=top}|
848 % \end{quote}
849 %
850 % \iffalse
851 % --------------------------------------------------------------------------- %
852 % \fi
853 %
854 % \pagebreak[3]
855 % \section{Useful stuff}
856 % \label{misc}
857 %
858 % \DescribeMacro{\caption}
859 % The command
860 % \nopagebreak[3]
861 % \begin{quote}
862 % |\caption|\oarg{lst\_entry}\marg{heading}
863 % \end{quote}
864 % \nopagebreak[3]
865 % typesets the caption inside a floating environment like |figure| or |table|.
866 % Well, you already know this, but the \thispackage\ package offers an extension:
867 % If you leave the argument \meta{lst\_entry} empty, no entry in the list of
868 % figures or tables will be made. For example:
869 % \begin{quote}
870 % |\caption[]{A figure without entry in the list of figures.}|
871 % \end{quote}
872 %
873 % \DescribeMacro{\caption*}
874 % The \package{longtable} package defines the command |\caption*| which
875 % typesets the caption without label and without entry in the list of tables.
876 % An example:
877 % \begin{quote}
878 % |\begin{longtable}{cc}|\\
879 % | \caption*{A table}\\|\\
880 % | A & B \\|\\
881 % | C & D \\|\\
882 % |\end{longtable}|
883 % \end{quote}
884 % looks like
885 % \begin{longtable}{cc}
886 % \caption*{A table}\\
887 % A & B \\
888 % C & D \\
889 % \end{longtable}
890 %
891 % This package offers this feature, too, so you can use this command now within
892 % every floating environment like |figure| or |table|, like:
893 % \begin{quote}
894 % |\begin{table}|\\
895 % | \caption*{A table}|\\
896 % | \begin{tabular}{cc}|\\
897 % | A & B \\|\\
898 % | C & D \\|\\
899 % | \end{tabular}|\\
900 % |\end{table}|
901 % \end{quote}
902 %
903 % \DescribeMacro{\captionof}
904 % \DescribeMacro{\captionof*}
905 % Sometimes you want to typeset a caption \emph{outside} a floating environment,
906 % putting a figure within a |minipage| for instance. For this purpose the
907 % \thispackage\ package offers the command
908 % \begin{quote}
909 % |\captionof|\marg{float type}\oarg{lst\_entry}\marg{heading}\quad.
910 % \end{quote}
911 % Note that the first argument, the \meta{float type}, is mandatory here, because
912 % the |\captionof| command needs to know which name to put into the caption label
913 % (e.g. ``Figure'' or ``Table'') and in which list to put the contents entry.
914 % An example:
915 % \begin{quote}
916 % |\captionof{figure}{A figure}|\\
917 % |\captionof{table}{A table}|
918 % \end{quote}
919 % typesets captions like this:
920 % \begin{Example}
921 % \captionof{figure}{A figure}
922 % \captionsetup{belowskip=\abovecaptionskip}
923 % \captionof{table}{A table}
924 % \end{Example}
925 %
926 % The star variant |\captionof*| has the same behaviour as the |\caption*| command:
927 % it typesets the caption without label and without entry to the list of figures
928 % or tables.
929 %
930 % Please use both |\captionof| and |\captionof*| only \emph{inside} environments
931 % (like |minipage| or |\parbox|), otherwise a page break can appear between content
932 % and caption. Furthermore some strange effects could occur (e.g., wrong spacing
933 % around captions).
934 %
935 % \DescribeMacro{\ContinuedFloat}
936 % Sometimes you want to split figures or tables without giving them
937 % their own reference number. This is what the command
938 % \begin{quote}
939 % |\ContinuedFloat|
940 % \end{quote}
941 % is for; it should be used as first command inside the floating environment.
942 % It prevents the increment of the relevant counter (usually done by |\caption|)
943 % so a figure or table with a |\ContinuedFloat| in it gets the same reference
944 % number as the figure or table before.
945 %
946 % An example:
947 % \begin{quote}
948 % |\begin{table}|\\
949 % |\caption{A table}|\\
950 % \ldots\\
951 % |\end{table}|\\
952 % \ldots\\
953 % |\begin{table}\ContinuedFloat|\\
954 % |\caption{A table (cont.)}|\\
955 % \ldots\\
956 % |\end{table}|
957 % \end{quote}
958 % gives the following result:
959 % \begin{Example}
960 % \makeatletter\def\@captype{table}\makeatother
961 % \caption[]{A table}
962 % \centerline{\ldots}
963 % \ContinuedFloat
964 % \captionsetup{aboveskip=0pt}
965 % \caption[]{A table (cont.)}
966 % \end{Example}
967 %
968 % \DescribeMacro{\captionsetup}
969 % We already know the |\captionsetup| command (see \Section{usage}
970 % {Using the package}), but this time we get enlighten about
971 % its optional argument \meta{float type}.
972 %
973 % Remember, the syntax of this command is
974 % \begin{quote}
975 % |\captionsetup|\oarg{float type}\marg{options}\quad.
976 % \end{quote}
977 %
978 % If a \meta{float type} gets specified, all the \meta{options} don't
979 % change anything at this time. Instead they only get marked for a later use,
980 % when a caption inside of a floating environment of the particular type
981 % \meta{float type} gets typeset.
982 % For example
983 % \begin{quote}
984 % |\captionsetup[figure]|\marg{options}
985 % \end{quote}
986 % forces captions within a |figure| environment to use the given \meta{options}.
987 %
988 % Here comes an example to illustrate this:
989 % \begin{quote}
990 % |\captionsetup{font=small}|\\
991 % |\captionsetup[figure]{labelfont=bf}|
992 % \end{quote}
993 % gives captions like this:
994 % \begin{Example}
995 % \captionsetup{font=small}
996 % \captionsetup[figure]{labelfont=bf}
997 % \captionof{figure}[]{A figure}
998 % \captionsetup{belowskip=\abovecaptionskip}
999 % \captionof{table}[]{A table}
1000 % \end{Example}
1001 %
1002 % As you see the command |\captionsetup[figure]{labelfont=bf}| only changed
1003 % the font of the figure caption labels, not touching all other ones.
1004 %
1005 % \DescribeMacro{\clearcaptionsetup}
1006 % If you want to get rid of these parameters marked for an automatic use within
1007 % a particular environment you can use the command
1008 % \begin{quote}
1009 % |\clearcaptionsetup|\marg{float type}\quad.
1010 % \end{quote}
1011 %
1012 % For example |\clearcaptionsetup{figure}| would clear the extra handling in the
1013 % example above:
1014 % \begin{Example}
1015 % \captionsetup{font=small}
1016 % \captionof{figure}[]{A figure}
1017 % \captionsetup{belowskip=\abovecaptionskip}
1018 % \captionof{table}[]{A table}
1019 % \end{Example}
1020 %
1021 % As \meta{float type} you can usually give one of these two only:
1022 % |figure| or |table|.
1023 % But as we will see later some \LaTeX\ packages (like the
1024 % \package{float}, \package{longtable}, and \package{sidecap} package
1025 % for example) offer additional floating environments and these two
1026 % commands can also be used with them.
1027 %
1028 % \iffalse
1029 % --------------------------------------------------------------------------- %
1030 % \fi
1031 %
1032 % \pagebreak[3]
1033 % \section{Do it yourself!}
1034 % \label{declare}
1035 %
1036 % A family of commands is provided to allow users to define their own formats.
1037 % This enables information on separators, justification, fonts, and styles to
1038 % be associated with a name and kept in one place
1039 % (these commands need to appear in the document preamble,
1040 % this is the part between |\documentclass| and |\begin{document}|).
1041 %
1042 % \pagebreak[2]
1043 % \DescribeMacro{\DeclareCaptionFormat}
1044 % You can define your own caption formats using the command
1045 % \begin{quote}
1046 % |\DeclareCaptionFormat|\marg{name}\marg{code using \#1, \#2 and \#3}\quad.
1047 % \end{quote}
1048 % At usage the system replaces \#1 with the caption label, \#2 with the
1049 % separator and \#3 with the text. So the standard format |plain| is
1050 % pre-defined by the \thispackage\ package as
1051 % \begin{quote}
1052 % |\DeclareCaptionFormat{plain}{#1#2#3\par}|
1053 % \end{quote}
1054 %
1055 % \DescribeMacro{\DeclareCaptionLabelFormat}
1056 % Likewise you can define your own caption label formats:
1057 % \begin{quote}
1058 % |\DeclareCaptionLabelFormat|\marg{name}\marg{code using \#1 and \#2}
1059 % \end{quote}
1060 % At usage \#1 gets replaced with the name (e.g. ``figure'') and \#2
1061 % gets replaced with the reference number (e.g. ``12'').
1062 %
1063 % \DescribeMacro{\bothIfFirst}
1064 % \DescribeMacro{\bothIfSecond}
1065 % If you define your own caption label formats and use the \package{subfig}
1066 % package\cite{subfig}, you should take care of empty caption label names.
1067 % For this purpose the commands
1068 % \begin{quote}
1069 % |\bothIfFirst|\marg{first arg}\marg{second arg}\quad and\\
1070 % |\bothIfSecond|\marg{first arg}\marg{second arg}
1071 % \end{quote}
1072 % are offered. |\bothIfFirst| tests if the first argument exists (means: is
1073 % not empty), |\bothIfSecond| tests if the second argument exists. If yes,
1074 % both arguments get typeset, otherwise none of them.
1075 %
1076 % For example the standard label format |simple| is \emph{not} defined as
1077 % \begin{quote}
1078 % |\DeclareCaptionLabelFormat{simple}{#1 #2}|\quad,
1079 % \end{quote}
1080 % because this could cause an extra space if \#1 is empty. Instead |simple|
1081 % is defined as
1082 % \begin{quote}
1083 % |\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{ }#2}|\quad,
1084 % \end{quote}
1085 % causing the space to appear only if the label name is present.
1086 %
1087 % \pagebreak[3]
1088 % \DescribeMacro{\DeclareCaptionLabelSeparator}
1089 % You can define your own caption label separators with
1090 % \nopagebreak[3]
1091 % \begin{quote}
1092 % |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\quad.
1093 % \end{quote}
1094 % \nopagebreak[3]
1095 % Again an easy example taken from the \thispackage\ package itself:
1096 % \nopagebreak[3]
1097 % \begin{quote}
1098 % |\DeclareCaptionLabelSeparator{colon}{: }|
1099 % \end{quote}
1100 % \pagebreak[3]
1101 %
1102 % \DescribeMacro{\DeclareCaptionJustification}
1103 % You can define your own caption justifications with
1104 % \begin{quote}
1105 % |\DeclareCaptionJustification|\marg{name}\marg{code}\quad.
1106 % \end{quote}
1107 % The \meta{code} simply gets typeset just before the caption.
1108 % E.g.~using the justification |raggedright|, which is defined as
1109 % \begin{quote}
1110 % |\DeclareCaptionJustification{raggedright}{\raggedright}|\quad,
1111 % \end{quote}
1112 % lets captions with all lines moved to the left margin.
1113 %
1114 % \DescribeMacro{\DeclareCaptionFont}
1115 % You can define your own caption fonts with
1116 % \begin{quote}
1117 % |\DeclareCaptionFont|\marg{name}\marg{code}\quad.
1118 % \end{quote}
1119 % For example this package defines the options |small| and |bf| as
1120 % \begin{quote}
1121 % |\DeclareCaptionFont{small}{\small}|\quad and\\
1122 % |\DeclareCaptionFont{bf}{\bfseries}|\quad.
1123 % \end{quote}
1124 % The line spacing could be customized using the \package{setspace} package,
1125 % for example:\NEWdescription{v3.0h}
1126 % \begin{quote}
1127 % |\usepackage{setspace}|\\
1128 % \iffalse
1129 % |\DeclareCaptionFont{singlespacing}{\setstretch{1}}|\quad\footnote{%
1130 % \emph{Note:} Using \cs{singlespacing} does not work here since it contains
1131 % a \cs{vskip} command.}\\
1132 % |\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}|\\
1133 % |\DeclareCaptionFont{doublespacing}{\doublespacing}|\\
1134 % \fi
1135 % |\captionsetup{font={onehalfspacing,small},labelfont=bf}|
1136 % \end{quote}
1137 % \example{font={onehalfspacing,small},labelfont=bf,singlelinecheck=off}\figuretext
1138 % An example which brings color into life:
1139 % \begin{quote}
1140 % |\usepackage{color}|\\
1141 % |\DeclareCaptionFont{red}{\color{red}}|\\
1142 % |\DeclareCaptionFont{green}{\color{green}}|\\
1143 % |\DeclareCaptionFont{blue}{\color{blue}}|\\
1144 % |\captionsetup{labelfont=blue,textfont=green}|
1145 % \end{quote}
1146 % \example{labelfont=blue,textfont=green,singlelinecheck=off}\figuretext
1147 %
1148 % \DescribeMacro{\DeclareCaptionStyle}
1149 % You can define your own caption styles with
1150 % \begin{quote}
1151 % |\DeclareCaptionStyle|\marg{name}\oarg{additional options}\marg{options}
1152 % \end{quote}
1153 % Remember, caption styles are just a collection of suitable options, saved
1154 % under a given name. You can wake up these options at any time with the
1155 % option |style=|\meta{style name}.
1156 %
1157 % All caption styles are based on the default set of options. (See \Section
1158 % {style}{Styles} for a complete list.) So you only need
1159 % to specify options which are different to them.
1160 %
1161 % If you specify \meta{additional options} they get used in addition when
1162 % the caption fits into a single line and this check was not disabled with
1163 % the option |singlelinecheck=off|.
1164 %
1165 % Again a very easy example taken from the core of this package: The
1166 % caption style |default| is pre-defined as
1167 % \begin{quote}
1168 % |\DeclareCaptionStyle{default}[justification=centering]{}|\quad.
1169 % \end{quote}
1170 %
1171 % \iffalse
1172 % --------------------------------------------------------------------------- %
1173 % \fi
1174 %
1175 % \subsection{Further Examples}
1176 %
1177 % If you would like to have a colon \emph{and} a line break as caption
1178 % separator you could define it this way:
1179 % \begin{quote}
1180 % |\DeclareCaptionLabelSeparator{period-newline}{. \\}|
1181 % \end{quote}
1182 % Selecting this separator with |\captionsetup{labelsep=period-newline}| you
1183 % get captions like this:
1184 % \begin{Example}
1185 % \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt}
1186 % \captionsetup{aboveskip=0pt,type=figure}
1187 % \caption[]{\figuretext}
1188 % \end{Example}
1189 %
1190 % For short captions---which fit into one single line---this separator
1191 % may not be satisfying, even when the automatically centering process
1192 % is switched off (with |singlelinecheck=off|):
1193 % \begin{Example}
1194 % \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt,singlelinecheck=0}
1195 % \captionsetup{aboveskip=0pt,type=figure}
1196 % \caption[]{A figure.}
1197 % \end{Example}
1198 %
1199 % An own caption style which selects another caption separator automatically
1200 % puts this right:
1201 % \begin{quote}
1202 % |\DeclareCaptionStyle{period-newline}%|\\
1203 % | [labelsep=period]{labelsep=period-newline}|
1204 % \end{quote}
1205 % \begin{Example}
1206 % \captionsetup{style=period-newline,labelfont=bf,margin=10pt}
1207 % \captionsetup{aboveskip=0pt,type=figure}
1208 % \ContinuedFloat
1209 % \caption[]{A figure.}
1210 % \end{Example}
1211 % If you would like to keep the centering of these captions instead, an
1212 % appropriate definition would be something like
1213 % \begin{quote}
1214 % |\DeclareCaptionStyle{period-newline}%|\\
1215 % | [labelsep=period,justification=centering]%|\\
1216 % | {labelsep=period-newline}|\quad.
1217 % \end{quote}
1218 % Using this definition short captions look like
1219 % \begin{Example}
1220 % \captionsetup{style=period-newline2,labelfont=bf,margin=10pt}
1221 % \captionsetup{aboveskip=0pt,type=figure}
1222 % \ContinuedFloat
1223 % \caption[]{A figure.}
1224 % \end{Example}
1225 % while long ones still have a line break after the caption label.
1226 %
1227 % Slightly changed, you also get centered captions if they are longer than
1228 % one line:
1229 % \begin{quote}
1230 % |\DeclareCaptionStyle{period-newline}%|\\
1231 % | [labelsep=period]%|\\
1232 % | {labelsep=period-newline,justification=centering}|
1233 % \end{quote}
1234 % \begin{Example}
1235 % \captionsetup{style=period-newline3,labelfont=bf,margin=10pt}
1236 % \captionsetup{aboveskip=0pt,type=figure}
1237 % \caption[]{\figuretext}
1238 % \end{Example}
1239 %
1240 % \bigskip\pagebreak[3]
1241 % Another example: You want captions to look like this:
1242 % \begin{Example}
1243 % \captionsetup{format=reverse,labelformat=fullparens,labelsep=fill,font=small,labelfont=it}
1244 % \captionsetup{aboveskip=0pt}
1245 % \captionof{figure}[]{\figuretext}
1246 % \end{Example}
1247 % \pagebreak[2]
1248 % You could do it this way:
1249 % \nopagebreak[3]
1250 % {\leftmargini=10pt
1251 % \begin{quote}
1252 % |\DeclareCaptionFormat{reverse}{#3#2#1}|\\
1253 % |\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)}|\\
1254 % |\DeclareCaptionLabelSeparator{fill}{\hfill}|\\
1255 % |\captionsetup{format=reverse,labelformat=fullparens,|\\
1256 % | labelsep=fill,font=small,labelfont=it}|
1257 % \end{quote}}
1258 %
1259 % \bigskip\pagebreak[3]
1260 % Another example: The caption text should go into the left margin; a possible
1261 % solution would be:
1262 % {\leftmargini=10pt
1263 % \begin{quote}
1264 % |\DeclareCaptionFormat{llap}{\llap{#1#2}#3\par}|\\
1265 % |\captionsetup{format=llap,labelsep=quad,singlelinecheck=no}|
1266 % \end{quote}}
1267 % As a result you would get captions like this:
1268 % \begin{Example}
1269 % \captionsetup{format=llap,singlelinecheck=no,labelsep=quad}
1270 % \captionsetup{aboveskip=0pt}
1271 % \captionof{figure}[]{\figuretext}
1272 % \end{Example}
1273 %
1274 % \iffalse
1275 % --------------------------------------------------------------------------- %
1276 % \fi
1277 %
1278 % \pagebreak[3]
1279 % \section{Using non-standard document classes}
1280 %
1281 % \NEWdescription{v3.0p}
1282 % The \thispackage\ package was developed using the standard document classes
1283 % |article|, |report| and |book|, it also works with the Dutch document classes
1284 % |artikel|, |rapport| and |boek|. It is \emph{incompatible} with all other
1285 % document classes, except the ones based on one of the above.
1286 %
1287 % If you are unsure if your document class is supported or not, it's better
1288 % \emph{not} to use this package. You could try if your document will compile
1289 % fine with the \thispackage\ package anyway, but you should watch carefully
1290 % if side-effects occur, i.e. the look and feel of your captions should
1291 % \emph{not} change if you just include the caption package without options.
1292 % (If it does, you can carry on, but you should be warned that the output
1293 % could change with upcoming versions of the \thispackage\ package.)
1294 % If this is fine, you can start setting options with
1295 % |\usepackage[|\ldots|]{caption}| or |\captionsetup| and keep your fingers
1296 % crossed.
1297 %
1298 % The upcoming version \version{3.1} of the \thispackage\ package will be
1299 % adapted to several document classes, e.g. the \package{beamer} class and
1300 % the \KOMAScript\ ones. It's planned for release during Summer 2007.
1301 %
1302 % \iffalse
1303 % --------------------------------------------------------------------------- %
1304 % \fi
1305 %
1306 % \section{Compatibility to other packages}
1307 % \label{packages}
1308 %
1309 % The \thispackage\ package contains special adaptations to other packages,
1310 % so the captions should always look like you have specified them to look like.
1311 %
1312 % These are the packages the \thispackage\ package is adapted to:
1313 %
1314 % \begin{tabular}{ll}
1315 % |float| & Gives you the possibility to define new floating environments\\
1316 % |listings| & Typesets source code listings\\
1317 % |longtable| & Typesets tables spanned over multiple pages\\
1318 % |rotating| & Supports rotated figures and tables\\
1319 % |sidecap| & Offers captions \emph{beside} figures or tables\\
1320 % |supertabular| & Typesets tables spanned over multiple pages\\
1321 % \end{tabular}
1322 %
1323 % \NEWfeature{v3.0b}
1324 % If you use one of the above packages together with the {\thispackage} package
1325 % you get the additional possibility to set up captions with
1326 % \begin{quote}|\captionsetup|\oarg{environment}\marg{options}\quad,\end{quote}
1327 % where \meta{environment} stands for any environment the above packages offer.
1328 % (Please note that this do not work with the |sideways| environments offered by
1329 % the \package{rotating} package.)
1330 % For example
1331 % \begin{quote}|\captionsetup[lstlisting]{labelfont=bf}|\end{quote}
1332 % forces captions inside the |lstlisting| environment to have bold labels.
1333 %
1334 % If a certain support is not desired you can switch it off using the
1335 % \thispackage\ package option
1336 % \begin{quote}
1337 % |\usepackage[|\ldots|,|\meta{package}|=no]{caption}|\quad.
1338 % \end{quote}
1339 % For example specifying the option |float=no| means you don't like the
1340 % \thispackage\ package to support the \package{float} package.
1341 % (Note: You can specify these options only within the |\usepackage| command,
1342 % especially \emph{not} at a later time with |\captionsetup|.)
1343 %
1344 % For further information about the packages mentioned above please take a look
1345 % at the documentation belonging to them or buy yourself
1346 % The \LaTeX\ Companion\cite{companion}.
1347 %
1348 % \iffalse
1349 % --------------------------------------------------------------------------- %
1350 % \fi
1351 %
1352 % \subsection{The \package{float} package}
1353 % \label{float}
1354 %
1355 % A very useful feature is provided by the \package{float} package\cite{float}:
1356 % It offers the float placement specifier |H| which is much more restrictive
1357 % than the specifier |h| offered by \LaTeX. While the latter one is only a
1358 % recommendation to \LaTeX\ to set the float ``here'', the |H| forces the
1359 % float to appear exactly at the spot where it occurs in your input file
1360 % and nowhere else.
1361 %
1362 % Furthermore it offers different styles for floating environments, these
1363 % styles are |plain|, |plaintop|, |ruled|, and |boxed|.
1364 % You can link one of these styles to either new floating environments or
1365 % to one of the existing environments |figure| and |table|.
1366 %
1367 % If you are using the \thispackage\ package together with the \package{float}
1368 % package a caption style called |ruled| gets defined automatically:
1369 % \begin{quote}
1370 % |\DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space}|
1371 % \end{quote}
1372 % This style represents the caption layout in |ruled| styled floats.
1373 % For you as an end user this means that captions within |ruled| floats will
1374 % always look like this, nevertheless what generic caption options do you
1375 % specify:
1376 %
1377 % \ifx\floatstyle\undefined
1378 %
1379 % \begin{Example}
1380 % \hrule height.8pt depth0pt \kern2pt
1381 % \vbox{\strut{\bfseries Program 7.1}
1382 % The first program. This hasn't got anything to do with the package
1383 % but is included as an example. Note the \texttt{ruled} float style.}
1384 % \kern2pt\hrule\kern2pt
1385 % \begin{verbatim}
1386 % #include <stdio.h>
1387 %
1388 % int main(int argc, char **argv)
1389 % {
1390 % for (int i = 0; i < argc; ++i)
1391 % printf("argv[%d] = %s\n", i, argv[i]);
1392 % return 0;
1393 % }
1394 % \end{verbatim}
1395 % \kern2pt\hrule\relax
1396 % \end{Example}
1397 %
1398 % \else
1399 %
1400 % \floatstyle{ruled}
1401 % \newfloat{Program}{tbp}{lop}[section]
1402 % \floatname{Program}{Program}
1403 %
1404 % \begin{Program}[H]
1405 % \begin{verbatim}
1406 % #include <stdio.h>
1407 %
1408 % int main(int argc, char **argv)
1409 % {
1410 % for (int i = 0; i < argc; ++i)
1411 % printf("argv[%d] = %s\n", i, argv[i]);
1412 % return 0;
1413 % }
1414 % \end{verbatim}
1415 % \caption{The first program. This hasn't got anything to do with the package
1416 % but is included as an example. Note the \texttt{ruled} float style.}
1417 % \end{Program}
1418 %
1419 % \fi
1420 %
1421 % If you want a different layout for |ruled| captions you have to define
1422 % your own one using the command
1423 % \begin{quote}
1424 % |\DeclareCaptionStyle{ruled}|\marg{options}\quad.
1425 % \end{quote}
1426 %
1427 % This mechanism also works with all other float styles. If you want a special
1428 % caption layout---for |plain| or |boxed| floats for example---you can simply define
1429 % a suitable caption style with the same name as the float style.
1430 %
1431 % \textbf{Note:} For successful cooperation you need the float package
1432 % version 1.3 or newer.
1433 %
1434 % \iffalse
1435 % --------------------------------------------------------------------------- %
1436 % \fi
1437 %
1438 % \subsection{The \package{listings} package}
1439 % \label{listings}
1440 %
1441 % \NEWdescription{v3.0b}
1442 % The \package{listings} package\cite{listings} is a source code printer for \LaTeX.
1443 % You can typeset stand alone files as well as listings with an environment
1444 % similar to \texttt{verbatim} as well as you can print code snippets using
1445 % a command similar to |\verb|.
1446 % Many parameters control the output and if your preferred programming
1447 % language isn't already supported, you can make your own definition.
1448 %
1449 % \textbf{Note:} For successful cooperation you need the listings package
1450 % version 1.2 or higher. You'll get an error message when using an
1451 % older version!
1452 %
1453 % \iffalse
1454 % --------------------------------------------------------------------------- %
1455 % \fi
1456 %
1457 % \subsection{The \package{longtable} package}
1458 % \label{longtable}
1459 %
1460 % The \package{longtable} package\cite{longtable} offers the environment
1461 % |longtable| which behaves similar to the |tabular| environment, but
1462 % the table itself can span multiple pages.
1463 %
1464 % \textbf{Note:} For successful cooperation you need the longtable package
1465 % version 3.15 or newer.
1466 %
1467 % \iffalse
1468 % --------------------------------------------------------------------------- %
1469 % \fi
1470 %
1471 % \subsection{The \package{rotating} package}
1472 % \label{rotating}
1473 %
1474 % The \package{rotating} package\cite{rotating} offers the floating
1475 % environments \texttt{sideways\-figure} and \texttt{sideways\-table}
1476 % which are just like normal figures and tables but rotated by 90 degree.
1477 % Furthermore they always use a full page on their own.
1478 %
1479 % \iffalse
1480 % --------------------------------------------------------------------------- %
1481 % \fi
1482 %
1483 % \subsection{The \package{sidecap} package}
1484 % \label{sidecap}
1485 %
1486 % \NEWdescription{v3.0b}
1487 % The \package{sidecap} package\cite{sidecap} offers the floating
1488 % environments |SCfigure| and |SCtable| which are like normal figures
1489 % and tables but the caption will be put \emph{beside} the contents.
1490 %
1491 % The \package{sidecap} package offers it's own options for justification.
1492 % If set, they will override the one specified with the caption option
1493 % |justification=| for captions beside their contents.
1494 %
1495 % \DescribeMacro{listof=}
1496 % Using the \package{sidecap} package you will probably notice that
1497 % suppressing the entry in the list of figures or tables with
1498 % |\caption[]{|\ldots|}| won't work inside these environments.
1499 % This is caused by the implementation design of the \package{sidecap}
1500 % package, but you can use |\captionsetup{listof=false}| inside the
1501 % figure or table as an alternative here.
1502 %
1503 % \ifx\SCfigure\undefined
1504 %
1505 % \begin{Example}
1506 % \newsavebox\scbox
1507 % \begin{lrbox}{\scbox}
1508 % \setlength{\unitlength}{.75cm}
1509 % \setlength{\fboxsep}{0pt}
1510 % \fbox{\begin{picture}(4,4)
1511 % \put(1,3){\circle{1}}
1512 % \put(3,3){\circle{1}}
1513 % \put(2,2){\circle{1}}
1514 % \put(1,1){\circle{1}}
1515 % \put(3,1){\circle{1}}
1516 % \end{picture}}
1517 % \end{lrbox}
1518 % \newlength\scboxwidth
1519 % \setlength\scboxwidth{\wd\scbox}
1520 % \makebox[\linewidth][c]{
1521 % \parbox[b]{\scboxwidth}{\unhbox\scbox}
1522 % \hspace\marginparsep
1523 % \parbox[b]{1.5\scboxwidth}{
1524 % \captionsetup{justification=raggedright,labelfont=bf}
1525 % \captionof{figure}[]{A small example with the caption beside the figure.}
1526 % }
1527 % }
1528 % \end{Example}
1529 %
1530 % \else
1531 %
1532 % \captionsetup{labelfont=bf}
1533 % \begin{SCfigure}[1.5][!ht]
1534 % \setlength{\unitlength}{.75cm}
1535 % \setlength{\fboxsep}{0pt}
1536 % \fbox{\begin{picture}(4,4)
1537 % \put(1,3){\circle{1}}
1538 % \put(3,3){\circle{1}}
1539 % \put(2,2){\circle{1}}
1540 % \put(1,1){\circle{1}}
1541 % \put(3,1){\circle{1}}
1542 % \end{picture}}
1543 % \iffalse
1544 % \captionsetup{labelfont=bf}
1545 % \fi
1546 % \caption[]{A small example with the caption beside the figure.}
1547 % \end{SCfigure}
1548 % \captionsetup{labelfont=default}
1549 %
1550 % \fi
1551 %
1552 % \iffalse
1553 % --------------------------------------------------------------------------- %
1554 % \fi
1555 %
1556 % \subsection{The \package{supertabular} package}
1557 % \label{supertabular}
1558 %
1559 % The \package{supertabular} package\cite{supertabular} offers the environment
1560 % |supertabular| which is quite similar to the |longtable| environment provided
1561 % by the \package{longtable} package. Both offers the typesetting of tables
1562 % which can span multiple pages. For a detailed discussion about the
1563 % differences between these powerful packages please take a look at
1564 % The \LaTeX\ Companion\cite{companion}.
1565 %
1566 % \iffalse
1567 % --------------------------------------------------------------------------- %
1568 % \fi
1569 %
1570 % \subsection{Known incompatibilities}
1571 %
1572 % \NEWdescription{v3.0b}
1573 % Using the \thispackage\ package together with one of the following packages
1574 % is not recommended; usually this would cause unwanted side effects or even
1575 % errors:
1576 % \begin{quote}
1577 % \package{ccaption}, \package{ftcap}, \package{hvfloat}, and
1578 % \package{nonfloat}
1579 % \end{quote}
1580 %
1581 % \iffalse
1582 % --------------------------------------------------------------------------- %
1583 % \fi
1584 %
1585 % \section{Compatibility to older versions}
1586 % \label{compatibility}
1587 %
1588 % \subsection{The \thispackage\ package version $1.x$}
1589 %
1590 % This version of the \thispackage\ package still supports the old options
1591 % and commands provided by the version $1.x$ of this package. So there
1592 % shouldn't occur any problems compiling old documents, but please don't mix
1593 % old options and commands with the new ones. This isn't supported and can
1594 % cause ugly side effects.
1595 %
1596 % Here comes a short oversight of the obsolete options and commands and how
1597 % they have been replaced within this version of the \thispackage\ package:
1598 %
1599 % {\small\begin{longtable}{ll}
1600 % \thispackage\ \version{1.x} & \thispackage\ \version{3.x}\\
1601 % \hline
1602 % \endhead
1603 % |normal| & |format=plain|\\
1604 % |hang| & |format=hang|\\
1605 % |isu| & |format=hang|\\
1606 % |center| & |justification=centering|\\
1607 % |centerlast| & |justification=centerlast|\\
1608 % \iffalse
1609 % |anne| & |justification=centerlast|\\
1610 % \fi
1611 % |nooneline| & |singlelinecheck=off|\\
1612 % |scriptsize| & |font=scriptsize|\\
1613 % |footnotesize| & |font=footnotesize|\\
1614 % |small| & |font=small|\\
1615 % |normalsize| & |font=normalsize|\\
1616 % |large| & |font=large|\\
1617 % |Large| & |font=Large|\\
1618 % |up| & |labelfont=up|\\
1619 % |it| & |labelfont=it|\\
1620 % |sl| & |labelfont=sl|\\
1621 % |sc| & |labelfont=sc|\\
1622 % |md| & |labelfont=md|\\
1623 % |bf| & |labelfont=bf|\\
1624 % |rm| & |labelfont=rm|\\
1625 % |sf| & |labelfont=sf|\\
1626 % |tt| & |labelfont=tt|\\
1627 % \end{longtable}}
1628 %
1629 % Beside the options for setting up the desired font there were also
1630 % the commands |\captionsize| resp.~|\captionfont| and |\captionlabelfont|
1631 % who could be redefined with |\renewcommand| and allowed an alternate and
1632 % more flexible way to change the font used for captions.
1633 % This mechanism was replaced by the commands
1634 % \begin{quote}
1635 % |\DeclareCaptionFont{|\ldots|}{|\ldots|}|\qquad and\\
1636 % |\captionsetup{font=|\ldots|,labelfont=|\ldots|}|\qquad.
1637 % \end{quote}\SeeUserDefined
1638 %
1639 % Setting the margin for captions was done in \version{1.x} with
1640 % \begin{quote}
1641 % |\setlength{\captionmargin}{|\ldots|}|\quad.
1642 % \end{quote}
1643 % This was replaced by
1644 % \begin{quote}
1645 % |\captionsetup{margin=|\ldots|}|\qquad.
1646 % \end{quote}
1647 % \See{\Section{margins}{Margins and further paragraph options}}
1648 %
1649 % For example the old-style code
1650 % \begin{quote}
1651 % |\usepackage[hang,bf]{caption}|\\
1652 % |\renewcommand\captionfont{\small\sffamily}|\\
1653 % |\setlength\captionmargin{10pt}|
1654 % \end{quote}
1655 % will still work fine, but should be written today as
1656 % \begin{quote}
1657 % |\usepackage[format=hang,labelfont=bf,font={small,sf},|\\
1658 % | margin=10pt]{caption}|
1659 % \end{quote}
1660 % or
1661 % \begin{quote}
1662 % |\usepackage{caption}|\\
1663 % |\captionsetup{format=hang,labelfont=bf,font={small,sf},|\\
1664 % | margin=10pt}|\qquad.
1665 % \end{quote}
1666 %
1667 % The quite exotic option |ruled| which allowed a partial usage of
1668 % the caption settings for |ruled| floats defined with the
1669 % \package{float} package will be emulated by this version of the
1670 % caption package, too.
1671 % But using this option is not recommended anymore since this
1672 % version of the \thispackage\ package offers a more flexible way
1673 % for changing the captions of these floating environments:
1674 % \begin{quote}
1675 % |\DeclareCaptionStyle{ruled}{|\ldots|}|
1676 % \end{quote}
1677 % resp.
1678 % \begin{quote}
1679 % |\captionsetup[ruled]{|\ldots|}|\qquad.
1680 % \end{quote}
1681 % \SeeUserDefined[, \Section*{misc}{Useful stuff}, and
1682 % \Section*{float}{The \package{float} package}]
1683 %
1684 % \subsection{The \package{caption2} package version $2.x$}
1685 %
1686 % Although they do very similar stuff, the packages \package{caption} and
1687 % its experimental and now obsolete variant \package{caption2} have a
1688 % very different implementation design.
1689 % Therefore a full compatibility could not be offered.
1690 % For that reason you will still find a file called |caption2.sty| in
1691 % this package distribution, so old documents using the \package{caption2}
1692 % package will still compile fine.
1693 %
1694 % Newly created documents should use the actual version of the
1695 % \thispackage\ package instead. In most cases it's sufficient to replace
1696 % the command
1697 % \begin{quote}
1698 % |\usepackage[...]{caption2}|
1699 % \end{quote}
1700 % by
1701 % \begin{quote}
1702 % |\usepackage[...]{caption}|\qquad.
1703 % \end{quote}
1704 % But some options and commands will not be emulated, so you can get
1705 % error messages afterwards. This section will hopefully help you removing
1706 % these errors. If you have problems migrating from \package{caption2}
1707 % to \package{caption} please don't hesitate to send me an e-mail asking
1708 % for help.
1709 %
1710 % In addition to the obsolete options shown in the last section
1711 % these ones will be emulated, too:
1712 %
1713 % {\small\begin{longtable}{ll}
1714 % \package{caption2} \version{2.x} & \thispackage\ \version{3.x}\\
1715 % \hline
1716 % \endhead
1717 % |flushleft| & |justification=raggedright|\\
1718 % |flushright| & |justification=raggedleft|\\
1719 % |oneline| & |singlelinecheck=on|\\
1720 % \end{longtable}}
1721 %
1722 % Setting the margin for captions was done in \version{2.x} with
1723 % \begin{quote}\leavevmode\hbox{%
1724 % |\setcaptionmargin{|\ldots|}| resp.
1725 % |\setcaptionwidth{|\ldots|}|\quad.
1726 % }\end{quote}
1727 % This was replaced by
1728 % \begin{quote}\leavevmode\hbox{%
1729 % |\captionsetup{margin=|\ldots|}| resp.
1730 % |\captionsetup{width=|\ldots|}|\quad.
1731 % }\end{quote}
1732 % \See{\Section{margins}{Margins and further paragraph options}}
1733 %
1734 % Setting an indention was done in \version{2.x} with
1735 % \begin{quote}
1736 % |\captionstyle{indent}|\\
1737 % |\setlength\captionindent{|\ldots|}|\quad.
1738 % \end{quote}
1739 % This is now done with
1740 % \begin{quote}
1741 % |\captionsetup{format=plain,indention=|\ldots|}|\quad.
1742 % \end{quote}
1743 %
1744 % The so-called single-line-check was controlled by the commands
1745 % |\oneline|\-|captions|\-|false| (for switching the check off) and
1746 % |\oneline|\-|captions|\-|true| (for switching the check on).
1747 % This was replaced by
1748 % |\captionsetup{|\discretionary{}{}{}|singlelinecheck=|\discretionary{}{}{}|off}|
1749 % resp.
1750 % |\captionsetup{|\discretionary{}{}{}|singlelinecheck=|\discretionary{}{}{}|on}|.
1751 % \See{\Section{justification}{Justification}}
1752 %
1753 % The commands
1754 % \begin{quote}
1755 % |\captionlabeldelim|, |\captionlabelsep|, |\captionstyle|,\\
1756 % |\defcaptionstyle|, |\newcaptionstyle|, and |\renewcaptionstyle|
1757 % \end{quote}
1758 % do not have a simple replacement and therefore will not be emulated
1759 % by this version of the \thispackage\ package. (So using them will
1760 % cause error messages.) Rewriting such code is not always easy and
1761 % straight-ahead, but by conscientious reading of this manual you should
1762 % find appropriate options and commands instead.
1763 %
1764 % \iffalse
1765 % ... (some examples)
1766 % \fi
1767 %
1768 % The \version{2.x} option |ignoreLTcapwidth| do not have a replacement, too.
1769 % But in most cases you can simply drop using that option because
1770 % in this version of the \thispackage\ package the value of |\LTcapwidth|
1771 % will be ignored anyway (unless you set it to a different value than the
1772 % default one).
1773 % \See{\Section{longtable}{The \package{longtable} package}}
1774 %
1775 % \iffalse
1776 % --------------------------------------------------------------------------- %
1777 % \fi
1778 %
1779 % \pagebreak[4]
1780 % \section{Further reading}
1781 %
1782 % I recommend the following documents for further reading:
1783 %
1784 % \begin{itemize}
1785 % \item
1786 % The \TeX\ FAQ - Frequently asked questions about \TeX\ and \LaTeX :
1787 % \begin{quote}\url{http://faq.tug.org/}\end{quote}
1788 %
1789 % \item
1790 % A French FAQ can be found at
1791 % \begin{quote}\url{http://www.grappa.univ-lille3.fr/FAQ-LaTeX/}\end{quote}
1792 %
1793 % \item
1794 % \textsf{epslatex} from Keith Reckdahl contains many tips around
1795 % including graphics in \LaTeXe\ documents.
1796 % You will find this document in the directory
1797 % \begin{quote}\url{ftp://ftp.ctan.org/pub/tex/info/epslatex/}\end{quote}
1798 % \end{itemize}
1799 %
1800 % \iffalse
1801 % --------------------------------------------------------------------------- %
1802 % \fi
1803 %
1804 % \section{Thanks}
1805 %
1806 % I would like to thank Katja Melzner,
1807 % Steven D. Cochran, Frank Mittelbach,
1808 % David Carlisle, Carsten Heinz, Olga Lapko, and Keith Reckdahl.
1809 % Thanks a lot for all your help, ideas, patience, spirit, and support!
1810 %
1811 % Also I would like to thank
1812 % Harald Harders,
1813 % Peter L\"offler,
1814 % Peng Yu,
1815 % Alexander Zimmermann,
1816 % Matthias Pospiech,
1817 % J\"urgen Wieferink,
1818 % Christoph Bartoschek,
1819 % Uwe St\"ohr,
1820 % Ralf Stubner,
1821 % Geoff Vallis,
1822 % Florian Keiler,
1823 % J\"urgen G\"obel,
1824 % Uwe Siart,
1825 % Sang-Heon Shim,
1826 % Henrik Lundell,
1827 % David Byers,
1828 % William Asquith,
1829 % and
1830 % Prof.~Dr.~Dirk Hoffmann,
1831 % who all helped to make this package a better one.
1832 %
1833 % \iffalse
1834 % --------------------------------------------------------------------------- %
1835 % \fi
1836 %
1837 % \StopEventually{\begin{thebibliography}{9}
1838 % \bibitem{companion}
1839 % Frank Mittelbach and Michel Goossens:
1840 % \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},
1841 % \newblock Addison-Wesley, 2004.
1842 %
1843 % \bibitem{float}
1844 % Anselm Lingnau:
1845 % \emph{An Improved Environment for Floats},
1846 % 2001/11/08
1847 %
1848 % \bibitem{floatrow}
1849 % Olga Lapko:
1850 % \emph{The floatrow package documentation},
1851 % 2005/05/22
1852 %
1853 % \bibitem{hyperref}
1854 % Sebastian Rahtz \& Heiko Oberdiek:
1855 % \emph{Hypertext marks in \LaTeX},
1856 % 2007/01/25
1857 %
1858 % \bibitem{hypcap}
1859 % Heiko Oberdiek:
1860 % \emph{The hypcap package -- Adjusting anchors of captions}
1861 % 2007/02/19
1862 %
1863 % \bibitem{listings}
1864 % Carsten Heinz:
1865 % \emph{The Listings Package},
1866 % 2004/02/13
1867 %
1868 % \bibitem{longtable}
1869 % David Carlisle:
1870 % \emph{The longtable package},
1871 % 2000/10/22
1872 %
1873 % \bibitem{rotating}
1874 % Sebastian Rahtz and Leonor Barroca:
1875 % \emph{A style option for rotated objects in \LaTeX},
1876 % 1997/09/26
1877 %
1878 % \bibitem{sidecap}
1879 % Rolf Niepraschk und Hubert G\"a\ss lein:
1880 % \emph{The sidecap package},
1881 % 2003/06/06
1882 %
1883 % \bibitem{subfig}
1884 % Steven D. Cochran:
1885 % \emph{The subfig package},
1886 % 2005/07/05
1887 %
1888 % \bibitem{supertabular}
1889 % Johannes Braams und Theo Jurriens:
1890 % \emph{The supertabular environment},
1891 % 2002/07/19
1892 %
1893 % \bibitem{Anne}
1894 % Anne Br\"uggemann-Klein:
1895 % \emph{Einf\"uhrung in die Dokumentverarbeitung},
1896 % B.G. Teubner, Stuttgart, 1989
1897 % \end{thebibliography}}
1898 %
1899 % \iffalse
1900 % --------------------------------------------------------------------------- %
1901 % \fi
1902 %
1903 % \DoNotIndex{\\,\_,\ ,\@@par}
1904 % \DoNotIndex{\@classoptionslist,\@currext,\@currname}
1905 % \DoNotIndex{\@ehc,\@ehd,\@empty,\@expandtwoargs}
1906 % \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
1907 % \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
1908 % \DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined,\@latex@error}
1909 % \DoNotIndex{\@namedef,\@nameuse}
1910 % \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
1911 % \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
1912 % \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
1913 % \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
1914 % \DoNotIndex{\p@,\z@}
1915 % \DoNotIndex{\active,\addtocounter,\addtolength,\advance}
1916 % \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
1917 % \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
1918 % \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
1919 % \DoNotIndex{\fi,\footnotesize,\global}
1920 % \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
1921 % \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
1922 % \DoNotIndex{\ifx,\ignorespaces,\itshape}
1923 % \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
1924 % \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
1925 % \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
1926 % \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
1927 % \DoNotIndex{\normalsize,\or,\par,\parbox,\parfillskip}
1928 % \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\providecommand}
1929 % \DoNotIndex{\quad}
1930 % \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
1931 % \DoNotIndex{\rightskip,\rmfamily}
1932 % \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
1933 % \DoNotIndex{\small,\string,\space,\strut}
1934 % \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
1935 % \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
1936 % \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
1937 % \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
1938 % \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
1939 % \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
1940 % \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
1941 % \DoNotIndex{\ProcessOptions,\ProvidesPackage}
1942 %
1943 % \iffalse
1944 % --------------------------------------------------------------------------- %
1945 % \fi
1946 %
1947 % \clearpage
1948 % \setlength{\parskip}{0pt plus 1pt}
1949 %
1950 % \section{The Implementation}
1951 %
1952 % \changes{v1.0}{1994/10/27}{First release}
1953 % \changes{v1.1}{1994/11/03}{New captiontype \cs{centerlast}}
1954 % \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
1955 % \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
1956 % \changes{v1.4}{1995/01/30}{New option \cs{nooneline}}
1957 % \changes{v1.4b}{1995/04/05}{Bugfix release}
1958 % \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
1959 % \changes{v3.0d}{2004/11/28}{Split into two packages: \package{caption} \& \package{caption3}}
1960 % \changes{v3.0l}{2007/01/20}{Usage of \cs{PackageError} replaced by \cs{caption@error}}
1961 %
1962 % The \package{caption} package consists of two parts -- the kernel
1963 % (|caption3.sty|) and the main package (|caption.sty|).
1964 %
1965 % The kernel provides all the user commands and internal macros which are
1966 % necessary for typesetting captions and setting parameters regarding these.
1967 % While the standard \LaTeX\ document classes provides an internal command
1968 % called |\@makecaption| and no options to control its behavior (except the
1969 % vertical skips above and below the caption itself), we provide similar
1970 % commands called |\caption@make| and |\caption@@make|, but with a lot of
1971 % options which can be selected with |\captionsetup|.
1972 % Loading the kernel part do not change the output of a \LaTeX\ document
1973 % -- it just provides functionality which can be used by \LaTeXe\ packages
1974 % which typesets captions, like the \package{caption} package or the
1975 % \package{subfig} package.
1976 %
1977 % The \package{caption} package itself redefines the \LaTeX\ commands
1978 % |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
1979 % |\caption@@make|, giving the user the possibility to control the captions of
1980 % the floating environments |figure| and |table|. Furthermore it does similar
1981 % to the caption stuff coming from other packages (like the \package{longtable}
1982 % or \package{supertabular} package):
1983 % Mapping the appropriate internal commands (like |\LT@makecaption| or
1984 % |\ST@caption|) to the ones offered by the \package{caption} kernel.
1985 % So you can think of the \package{caption} package as a layer package, it
1986 % simply provides adaptation layers between the caption stuff coming from
1987 % \LaTeXe\ itself or a \LaTeXe\ package and the caption stuff offered by the
1988 % \package{caption} kernel.
1989 %
1990 % \iffalse
1991 % --------------------------------------------------------------------------- %
1992 % \fi
1993 %
1994 % \subsection{Kernel}
1995 % \iffalse
1996 %<*kernel>
1997 % \fi
1998 %
1999 % \subsubsection*{Identification}
2000 %
2001 % \begin{macrocode}
2002 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
2003 \ProvidesPackage{caption3}[2007/04/11 v1.0q caption3 kernel (AR)]
2004 % \end{macrocode}
2005 %
2006 % \subsubsection*{Generic helpers}
2007 %
2008 % \begin{macro}{\@nameundef}
2009 % This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel.
2010 % We use it to remove the definition of some commands and keyval options after
2011 % |\begin{document}| (to save \TeX\ memory) and to remove caption options defined
2012 % with |\captionsetup|\oarg{type}.
2013 % \begin{macrocode}
2014 \providecommand*\@nameundef[1]{%
2015 \expandafter\let\csname #1\endcsname\@undefined}
2016 % \end{macrocode}
2017 % \end{macro}
2018 %
2019 % \begin{macro}{\l@addto@macro}
2020 % The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which
2021 % globally adds commands to any existising macro, like in |\AtBeginDocument|.
2022 % This is the same but it works local, not global
2023 % (using \cs{edef} instead of \cs{xdef}).
2024 % \begin{macrocode}
2025 \providecommand{\l@addto@macro}[2]{%
2026 \begingroup
2027 \toks@\expandafter{#1#2}%
2028 \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
2029 \@tempa}
2030 % \end{macrocode}
2031 % \end{macro}
2032 %
2033 % \begin{macro}{\bothIfFirst}
2034 % \begin{macro}{\bothIfSecond}
2035 % |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond|
2036 % tests if the second argument is not empty. If yes both arguments get
2037 % typeset, otherwise none of them.
2038 % \begin{macrocode}
2039 \def\bothIfFirst#1#2{%
2040 \protected@edef\caption@tempa{#1}%
2041 \ifx\caption@tempa\@empty\else
2042 #1#2%
2043 \fi}
2044 % \end{macrocode}
2045 % \begin{macrocode}
2046 \def\bothIfSecond#1#2{%
2047 \protected@edef\caption@tempa{#2}%
2048 \ifx\caption@tempa\@empty\else
2049 #1#2%
2050 \fi}
2051 % \end{macrocode}
2052 % \end{macro}
2053 % \end{macro}
2054 %
2055 % \begin{macro}{\caption@ifinlist}
2056 % This helper macro checks if the first argument is in the comma separated
2057 % list which is offered as second argument. So for example
2058 % \begin{quote}
2059 % |\caption@ifinlist{frank}{axel,frank,steven}{yes}{no}|
2060 % \end{quote}
2061 % would expand to |yes|.
2062 % \begin{macrocode}
2063 \def\caption@ifinlist#1#2{%
2064 \let\next\@secondoftwo
2065 \edef\caption@tempa{#1}%
2066 \@for\caption@tempb:={#2}\do{%
2067 \ifx\caption@tempa\caption@tempb
2068 \let\next\@firstoftwo
2069 \fi}%
2070 \next}
2071 % \end{macrocode}
2072 % \end{macro}
2073 %
2074 % \begin{macro}{\caption@setbool}
2075 % \begin{macro}{\caption@ifbool}
2076 % \begin{macro}{\caption@undefbool}
2077 % For setting and testing boolean options we offer these three helper macros:
2078 % \begin{quote}
2079 % |\caption@setbool|\marg{name}\marg{value}\\
2080 % | |(with |value = false/true/no/yes/off/on/0/1|)\\
2081 % |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\
2082 % |\caption@undefbool|\marg{name}
2083 % \end{quote}
2084 % \begin{macrocode}
2085 \def\caption@setbool#1#2{%
2086 \caption@ifinlist{#2}{1,true,yes,on}{%
2087 \expandafter\let\csname caption@if#1\endcsname\@firstoftwo
2088 }{\caption@ifinlist{#2}{0,false,no,off}{%
2089 \expandafter\let\csname caption@if#1\endcsname\@secondoftwo
2090 }{%
2091 \caption@Error{Undefined boolean value `#2'}%
2092 }}}
2093 % \end{macrocode}
2094 % \begin{macrocode}
2095 \def\caption@ifbool#1{\@nameuse{caption@if#1}}
2096 % \end{macrocode}
2097 % \begin{macrocode}
2098 \def\caption@undefbool#1{\@nameundef{caption@if#1}}
2099 % \end{macrocode}
2100 % \end{macro}
2101 % \end{macro}
2102 % \end{macro}
2103 %
2104 % \begin{macro}{\caption@newcounter}
2105 % \changes{v3.0p}{2007/04/08}{\cs{caption@XXXcounter} added}
2106 % \begin{macro}{\caption@setcounter}
2107 % \begin{macro}{\caption@addtocounter}
2108 % \begin{macro}{\caption@stepcounter}
2109 % To save counter space we use commands instead of counters.
2110 % \begin{macrocode}
2111 \def\caption@newcounter#1{\gdef#1{0}}
2112 \def\caption@setcounter#1#2{\xdef#1{#2}}
2113 \def\caption@addtocounter#1#2{%
2114 \begingroup
2115 \@tempcnta#1%
2116 \advance\@tempcnta#2%
2117 \xdef#1{\the\@tempcnta}%
2118 \endgroup}
2119 \def\caption@stepcounter#1{\caption@addtocounter#1\@ne}
2120 % \end{macrocode}
2121 % \end{macro}
2122 % \end{macro}
2123 % \end{macro}
2124 % \end{macro}
2125 %
2126 % \subsubsection*{Errors}
2127 %
2128 % \begin{macro}{\caption@Error}
2129 % \changes{v3.0l}{2007/01/20}{This macro added}
2130 % \changes{v3.0q}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}}
2131 % This is mainly identical to |\PackageError{caption}{#1}{\caption@eh}|.
2132 % \begin{macrocode}
2133 \newcommand\caption@Package{caption}
2134 \newcommand*\caption@Error[1]{%
2135 \PackageError\caption@Package{#1}\caption@eh}
2136 % \end{macrocode}
2137 % \end{macro}
2138 %
2139 % \begin{macro}{\caption@eh}
2140 % At the moment we only offer this simple error message as generic helper
2141 % for the user.
2142 % \begin{macrocode}
2143 \newcommand\caption@eh{%
2144 If you do not understand this error, please take a closer look\MessageBreak
2145 at the documentation of the `\caption@Package' package.\MessageBreak
2146 \@ehc}
2147 % \end{macrocode}
2148 % \end{macro}
2149 %
2150 % \subsubsection*{Using the keyval package}
2151 %
2152 % We need the \package{keyval} package for option handling, so we load it here.
2153 % \begin{macrocode}
2154 \RequirePackage{keyval}[1997/11/10]
2155 % \end{macrocode}
2156 %
2157 % \begin{macro}{\undefine@key}
2158 % This helper macro is the opposite of |\define@key|, it removes a keyval
2159 % definition.
2160 % \begin{macrocode}
2161 \providecommand*\undefine@key[2]{%
2162 \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
2163 % \end{macrocode}
2164 % \end{macro}
2165 %
2166 % \begin{macro}{\DeclareCaptionOption}
2167 % |\DeclareCaptionOption|\marg{option}\marg{code}\\
2168 % |\DeclareCaptionOption*|\marg{option}\marg{code}\par
2169 % We declare our options using these commands (instead of using
2170 % |\DeclareOption| offered by \LaTeXe), so the keyval package is used.
2171 % The starred form makes the option available during the lifetime of the
2172 % current package only, so they can be used with |\usepackage|, but
2173 % \emph{not} with |\captionsetup| later on.
2174 % \begin{macrocode}
2175 \newcommand\DeclareCaptionOption{%
2176 \@ifstar{\caption@declareoption\AtEndOfPackage}%
2177 {\caption@declareoption\@gobble}}
2178 \newcommand*\caption@declareoption[2]{%
2179 #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}}
2180 \@onlypreamble\DeclareCaptionOption
2181 \@onlypreamble\caption@declareoption
2182 % \end{macrocode}
2183 % \end{macro}
2184 %
2185 % \begin{macro}{\captionsetup}
2186 % \changes{v3.0a}{2004/01/17}{Bugfix: Missing \% added}
2187 % |\captionsetup|\oarg{type}\marg{keyval-list of options}\par
2188 % If the optional argument `type' is specified, we simply save or append
2189 % the option list, otherwise we `execute' it with |\setkeys|.
2190 % \begin{macrocode}
2191 \newcommand\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup}
2192 \newcommand\caption@typ@{caption@typ@} % This saves 74 words of TeX memory
2193 \def\caption@setuptype[#1]#2{%
2194 \@ifundefined{\caption@typ@#1}%
2195 {\@namedef{\caption@typ@#1}{#2}}%
2196 {\expandafter\l@addto@macro\csname\caption@typ@#1\endcsname{,#2}}}
2197 \newcommand\caption@setup{\caption@setkeys{caption}}
2198 % \end{macrocode}
2199 % \end{macro}
2200 %
2201 % \begin{macro}{\caption@setkeys}
2202 % \changes{v3.0i}{2006/01/03}{This macro added}
2203 % \changes{v3.0l}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added}
2204 % \changes{v3.0l}{2007/01/30}{Optional argument added}
2205 % \changes{v3.0p}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter}
2206 % This one simply calls |\setkeys|\marg{package}\marg{args} but lets the
2207 % error messages refer to the \meta{package} package instead of the
2208 % \package{keyval} package.
2209 % \begin{macrocode}
2210 \newcommand*\caption@setkeys{%
2211 \@dblarg\caption@@setkeys}
2212 % \end{macrocode}
2213 % \begin{macrocode}
2214 \long\def\caption@@setkeys[#1]#2#3{%
2215 \ifnum\caption@keydepth=0\relax
2216 \let\caption@KV@errx\KV@errx
2217 \let\caption@KV@err\KV@err
2218 \let\KV@errx\caption@Error
2219 \let\KV@err\caption@Error
2220 \fi
2221 \caption@stepcounter\caption@keydepth
2222 %
2223 \def\caption@Package{#1}%
2224 \caption@Debug{\protect\setkeys{#2}{#3}}%
2225 \setkeys{#2}{#3}%
2226 \def\caption@Package{caption}%
2227 %
2228 \caption@addtocounter\caption@keydepth\m@ne
2229 \ifnum\caption@keydepth=0\relax
2230 \let\KV@errx\caption@KV@errx
2231 \let\KV@err\caption@KV@err
2232 \fi}
2233 % \end{macrocode}
2234 % \begin{macrocode}
2235 \caption@newcounter\caption@keydepth
2236 % \end{macrocode}
2237 % \end{macro}
2238 %
2239 % \begin{macro}{\caption@settype}
2240 % \changes{v3.0i}{2006/01/03}{Optional argument added}
2241 % \changes{v3.0j}{2006/01/26}{Revised}
2242 % \changes{v3.0l}{2007/01/30}{Optional argument removed}
2243 % |\caption@settype|\marg{type}\par
2244 % Caption options which have been saved with |\captionsetup|\oarg{type} can
2245 % be executed using this command.
2246 % (It simply executes the saved option list, if there is any.)
2247 % \begin{macrocode}
2248 \newcommand*\caption@settype[1]{%
2249 \@ifundefined{\caption@typ@#1}{}{%
2250 \caption@esetup{\csname\caption@typ@#1\endcsname}}}
2251 % \end{macrocode}
2252 % \end{macro}
2253 %
2254 % \begin{macro}{\caption@esetup}
2255 % |\caption@esetup|\marg{keyval-list of options}\par
2256 % To execute a keyval-list of options saved within a macro we
2257 % need this special version of |\caption@setup| which expands the
2258 % argument first.
2259 % \begin{macrocode}
2260 \newcommand*\caption@esetup[1]{%
2261 \edef\caption@tempa{\noexpand\caption@setup{#1}}%
2262 \caption@tempa}
2263 % \end{macrocode}
2264 % \end{macro}
2265 %
2266 % \begin{macro}{\clearcaptionsetup}
2267 % |\clearcaptionsetup|\marg{type}\par
2268 % This removes the saved option list associated with \meta{type}.
2269 % \begin{macrocode}
2270 \newcommand*\clearcaptionsetup[1]{\@nameundef{\caption@typ@#1}}
2271 % \end{macrocode}
2272 % \end{macro}
2273 %
2274 % \begin{macro}{\showcaptionsetup}
2275 % \changes{v3.0e}{2005/05/03}{Optimized for memory usage}
2276 % |\showcaptionsetup|\oarg{package}\marg{type}\par
2277 % This comes for debugging issues: It shows the saved option list which
2278 % is associated with \meta{type}.
2279 % \begin{macrocode}
2280 \newcommand*\showcaptionsetup[2][\@firstofone]{%
2281 \GenericWarning{}{%
2282 #1 Caption Info: KV list on `#2'\MessageBreak
2283 #1 Caption Data: (%
2284 \@ifundefined{\caption@typ@#2}{%
2285 % empty -- print nothing
2286 }{%
2287 \@nameuse{\caption@typ@#2}%
2288 }%
2289 )}}
2290 % \end{macrocode}
2291 % \end{macro}
2292 %
2293 % \begin{macro}{\caption@ProcessOptions}
2294 % \changes{v3.0a}{2004/01/23}{Bugfix, see \purett{news:[email protected]} for details}
2295 % \changes{v3.0i}{2006/01/03}{Improvement, uses \cs{caption@setkeys} instead of \cs{setkeys}}
2296 % \changes{v3.0j}{2006/02/23}{Bugfix, now processes only those global options which have a default value}
2297 % \changes{v3.0l}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to \cs{caption@ProcessOptions} and moved from the package to the kernel}
2298 % We process our options using the keyval package, so we use this one
2299 % instead of |\ProcessOptions| offered by \LaTeXe.
2300 % (This code was taken from the \package{hyperref} package and improved.)
2301 % \begin{macrocode}
2302 \newcommand*\caption@ProcessOptions[1]{%
2303 \let\@tempc\relax
2304 % \end{macrocode}
2305 %
2306 % \begin{macrocode}
2307 \let\caption@tempa\@empty
2308 \@for\CurrentOption:=\@classoptionslist\do{%
2309 \@ifundefined{KV@#1@\CurrentOption}{%
2310 }{%
2311 \@ifundefined{KV@#1@\CurrentOption @default}{%
2312 \PackageInfo{#1}{Global option `\CurrentOption' ignored}%
2313 }{%
2314 \PackageInfo{#1}{Global option `\CurrentOption' processed}%
2315 \edef\caption@tempa{\caption@tempa,\CurrentOption,}%
2316 \@expandtwoargs\@removeelement\CurrentOption
2317 \@unusedoptionlist\@unusedoptionlist
2318 }%
2319 }%
2320 }%
2321 \edef\caption@tempa{%
2322 \noexpand\caption@setkeys{#1}{%
2323 \caption@tempa\@ptionlist{\@currname.\@currext}%
2324 }%
2325 }%
2326 \caption@tempa
2327 % \end{macrocode}
2328 %
2329 % \begin{macrocode}
2330 \let\CurrentOption\@empty
2331 \AtEndOfPackage{\let\@unprocessedoptions\relax}}
2332 \@onlypreamble\caption@ProcessOptions
2333 % \end{macrocode}
2334 % \end{macro}
2335 %
2336 % \subsubsection*{Margin resp. width}
2337 % \changes{v3.0p}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}}
2338 % \changes{v3.0p}{2007/04/03}{Option `twoside' added to kernel}
2339 %
2340 % \begin{macro}{\captionmargin}
2341 % \begin{macro}{\captionwidth}
2342 % |\captionmargin| and |\captionwidth| contain the extra margin
2343 % resp. the total width used for captions. Please never set these values in
2344 % a direct way, they are just accessible in user documents to provide
2345 % compatibility to |caption.sty| \version{1.x}.\par
2346 % Note that we can only set one value at a time, `margin' \emph{or} `width'.
2347 % If |\captionwidth| is not zero we will take this value afterwards,
2348 % otherwise |\captionmargin| and |\captionmargin@|.
2349 % \begin{macrocode}
2350 \newdimen\captionmargin
2351 \newdimen\captionmargin@
2352 \newdimen\captionwidth
2353 % \end{macrocode}
2354 % \end{macro}
2355 % \end{macro}
2356 %
2357 % \begin{macrocode}
2358 \DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
2359 \DeclareCaptionOption{width}{\setcaptionwidth{#1}}
2360 \DeclareCaptionOption{twoside}[1]{\caption@setbool{twoside}{#1}}
2361 % \end{macrocode}
2362 %
2363 % \begin{macro}{\setcaptionmargin}
2364 % |\setcaptionmargin|\marg{amount}
2365 % \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
2366 % \changes{v3.0h}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take left+right margin}
2367 % |\setcaptionmargin|\marg{amount}\par
2368 % Please never use this in user documents, it's just there to
2369 % provide compatibility to |caption2.sty| \version{2.x}.
2370 % \begin{macrocode}
2371 \newcommand*\setcaptionmargin[1]{%
2372 \captionwidth\z@
2373 \caption@@setmargin#1,#1,\@nil\@@}
2374 \def\caption@@setmargin#1,#2,#3\@@{%
2375 \setlength\captionmargin{#1}%
2376 \setlength\captionmargin@{#2}%
2377 \advance\captionmargin@ by -\captionmargin}
2378 % \end{macrocode}
2379 % \end{macro}
2380 %
2381 % \begin{macro}{\setcaptionwidth}
2382 % |\setcaptionwidth|\marg{amount}
2383 % \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
2384 % |\setcaptionwidth|\marg{amount}\par
2385 % Please never use this in user documents, it's just there to
2386 % provide compatibility to |caption2.sty| \version{2.x}.
2387 % \begin{macrocode}
2388 \newcommand\setcaptionwidth{%
2389 \setlength\captionwidth}
2390 % \end{macrocode}
2391 % \end{macro}
2392 %
2393 % \begin{macro}{\caption@count}
2394 % \changes{v3.0p}{2007/04/03}{This counter added}
2395 % This counter numbers the captions. It will be used inside |\caption@ifoddpage| only.
2396 % \begin{macrocode}
2397 \caption@newcounter\caption@count
2398 % \end{macrocode}
2399 % \end{macro}
2400 %
2401 % \begin{macro}{\caption@newlabel}
2402 % \changes{v3.0p}{2007/04/03}{This macro added}
2403 % This command is a modified version of |\newlabel| from \LaTeX2e.
2404 % It will be written to the \texttt{.aux} file to
2405 % pass label information from one run to another.
2406 % It will be used inside |\caption@ifoddpage| and |\caption@ragged|.
2407 % \begin{macrocode}
2408 \newcommand*\caption@newlabel{\@newl@bel{caption}}
2409 % \end{macrocode}
2410 % \end{macro}
2411 %
2412 % \begin{macro}{\caption@thepage}
2413 % \changes{v3.0p}{2007/04/03}{This macro added}
2414 % This command is a modified version of |\thepage| from \LaTeX2e.
2415 % It will be used inside |\caption@ifoddpage| only.
2416 % \begin{macrocode}
2417 \newcommand*\caption@thepage{\the\c@page}
2418 % \end{macrocode}
2419 % \end{macro}
2420 %
2421 % \begin{macro}{\caption@ifoddpage}
2422 % \changes{v3.0p}{2007/04/03}{This macro added}
2423 % \emph{Note:} This macro re-defines itself so the \texttt{.aux} file will
2424 % only be used once per group.
2425 % \begin{macrocode}
2426 \def\caption@ifoddpage{%
2427 \caption@iftwoside{%
2428 % \end{macrocode}
2429 % |\refstepcounter{caption@count}|
2430 % \begin{macrocode}
2431 \caption@stepcounter\caption@count
2432 % \end{macrocode}
2433 % |\label{\the\caption@count}|
2434 % \begin{macrocode}
2435 \protected@write\@auxout{\let\caption@thepage\relax}%
2436 {\string\caption@newlabel{\caption@count}{\caption@thepage}}%
2437 % \end{macrocode}
2438 % |\edef\caption@thepage{\pageref{\the\caption@count}}|
2439 % \begin{macrocode}
2440 \expandafter\ifx\csname caption@\caption@count\endcsname\relax
2441 \G@refundefinedtrue % => 'There are undefined references.'
2442 \PackageWarning{caption3}{Reference on page \thepage \space undefined}%
2443 \else
2444 \expandafter\let\expandafter\caption@thepage
2445 \csname caption@\caption@count\endcsname
2446 \fi
2447 % \end{macrocode}
2448 % |\ifodd\caption@thepage|\ldots
2449 % \begin{macrocode}
2450 \ifodd\caption@thepage
2451 \let\caption@ifoddpage\@firstoftwo
2452 \else
2453 \let\caption@ifoddpage\@secondoftwo
2454 \fi
2455 }{\let\caption@ifoddpage\@firstoftwo}%
2456 % \end{macrocode}
2457 % \begin{macrocode}
2458 \caption@ifoddpage}
2459 % \end{macrocode}
2460 % \end{macro}
2461 %
2462 % \subsubsection*{Indentions}
2463 %
2464 % \begin{macro}{\captionindent}
2465 % \begin{macro}{\captionparindent}
2466 % \begin{macro}{\captionhangindent}
2467 % These are the indentions we support.
2468 % \begin{macrocode}
2469 \newdimen\captionindent
2470 \newdimen\captionparindent
2471 \newdimen\captionhangindent
2472 % \end{macrocode}
2473 % \end{macro}
2474 % \end{macro}
2475 % \end{macro}
2476 %
2477 % \changes{v3.0b}{2004/05/16}{Defaults added for options \opt{parindent=} and \opt{hangindent=}}
2478 % \changes{v3.0h}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption} replaced by \cs{caption@@par}}
2479 % \changes{v3.0h}{2005/08/22}{Undocumented defaults for \opt{parindent=}, \opt{hangindent=},
2480 % and \opt{parskip=} removed}
2481 % \begin{macrocode}
2482 \DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}% obsolete!
2483 \DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}}
2484 \DeclareCaptionOption{hangindent}{\setlength\captionhangindent{#1}}
2485 \DeclareCaptionOption{parindent}{\setlength\captionparindent{#1}}
2486 \DeclareCaptionOption{parskip}{\l@addto@macro\caption@@par{\setlength\parskip{#1}}}
2487 % \end{macrocode}
2488 %
2489 % \changes{v3.0h}{2005/08/22}{Increased compatibility to KOMA-Script: A special version of options
2490 % `parindent' and `parskip' added}
2491 % \changes{v3.0i}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of `parskip' and `parindent' options
2492 % revised and moved into caption kernel}
2493 % \changes{v3.0j}{2006/02/23}{KOMA-Script variants of `parskip' and `parindent' are obsolete now, removed}
2494 % \changes{v3.0o}{2007/03/30}{KOMA-Script variants of `parskip' and `parindent' re-added, since they
2495 % still collide with the actual version of subfig (Sigh!)}
2496 %
2497 % \begin{macrocode}
2498 \@ifundefined{scr@caption}{}{%
2499 % \end{macrocode}
2500 %
2501 % There is an option clash between the \KOMAScript\ document classes
2502 % and the \package{caption} kernel,
2503 % both define the options |parindent| and |parskip| but with different meaning.
2504 % Furthermore the ones defined by the \package{caption} kernel take a
2505 % value as parameter but the \KOMAScript\ ones do not.
2506 % So we need special versions of the options |parindent| and |parskip| here,
2507 % ones who determine if a value is given (and therefore should be treated as
2508 % our option) or not (and therefore should be ignored by us).
2509 %
2510 % \begin{macrocode}
2511 \let\caption@KV@parindent\KV@caption@parindent
2512 \DeclareCaptionOption{parindent}[]{%
2513 \def\caption@tempa{#1}%
2514 \ifx\caption@tempa\@empty
2515 \PackageInfo{caption3}{Option `parindent' ignored}%
2516 \else
2517 \caption@KV@parindent{#1}%
2518 \fi}%
2519 % \end{macrocode}
2520 %
2521 % \begin{macrocode}
2522 \let\caption@KV@parskip\KV@caption@parskip
2523 \DeclareCaptionOption{parskip}[]{%
2524 \def\caption@tempa{#1}%
2525 \ifx\caption@tempa\@empty
2526 \PackageInfo{caption3}{Option `parskip' ignored}%
2527 \else
2528 \caption@KV@parskip{#1}%
2529 \fi}%
2530 % \end{macrocode}
2531 %
2532 % \begin{macrocode}
2533 }
2534 % \end{macrocode}
2535 %
2536 % \subsubsection*{Styles}
2537 %
2538 % \begin{macro}{\DeclareCaptionStyle}
2539 % \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
2540 % |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
2541 % \begin{macrocode}
2542 \newcommand*\DeclareCaptionStyle[1]{%
2543 \@ifnextchar[{\caption@declarestyle{#1}}{\caption@declarestyle{#1}[]}}
2544 \def\caption@declarestyle#1[#2]#3{%
2545 \global\@namedef{caption@sls@#1}{#2}%
2546 \global\@namedef{caption@sty@#1}{#3}}
2547 \@onlypreamble\DeclareCaptionStyle
2548 \@onlypreamble\caption@declarestyle
2549 % \end{macrocode}
2550 % \end{macro}
2551 %
2552 % \begin{macrocode}
2553 \DeclareCaptionOption{style}{\caption@setstyle{#1}}
2554 % \end{macrocode}
2555 %
2556 % \begin{macro}{\caption@setstyle}
2557 % \changes{v3.0f}{2005/06/01}{Starred variant added}
2558 % |\caption@setstyle|\marg{name}\\
2559 % |\caption@setstyle*|\marg{name}\par
2560 % Selecting a caption style means saving the additional
2561 % \meta{single-line-list-of-KV} (this will be done by |\caption@sls|),
2562 % resetting the caption options to the default ones (this will be done using
2563 % |\caption@setdefault|) and executing the \meta{list-of-KV} options
2564 % (this will be done using |\caption@esetup|).\par
2565 % The starred version will give no error message if the given style is not
2566 % defined.
2567 % \begin{macrocode}
2568 \newcommand\caption@setstyle{%
2569 \@ifstar{\caption@@setstyle\@gobble}{\caption@@setstyle\@firstofone}}
2570 \newcommand*\caption@@setstyle[2]{%
2571 \@ifundefined{caption@sty@#2}%
2572 {#1{\caption@Error{Undefined caption style `#2'}}}%
2573 {\expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
2574 \caption@setdefault\caption@esetup{\csname caption@sty@#2\endcsname}}}
2575 % \end{macrocode}
2576 % \end{macro}
2577 %
2578 % \begin{macro}{\caption@setdefault}
2579 % This resets (nearly) all caption options to the default ones.
2580 % \emph{Note that this does not touch the skips and the positioning!}
2581 % \begin{macrocode}
2582 \newcommand\caption@setdefault{\captionsetup{%
2583 format=default,labelformat=default,labelsep=default,textformat=default,%
2584 justification=default,font=default,labelfont=default,textfont=default,%
2585 margin=0pt,indent=0pt,parindent=0pt,hangindent=0pt,%
2586 singlelinecheck=1,strut=1}}
2587 % \end{macrocode}
2588 % \end{macro}
2589 %
2590 % \changes{v3.0d}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
2591 % Currently there is only one pre-defined style, called `default'.
2592 % It's a perfect match to the behaviour of |\@makecaption| offered by the
2593 % standard \LaTeX\ document classes:
2594 % If the caption fits in one single line, it is typeset centered.
2595 %
2596 % \begin{macrocode}
2597 \DeclareCaptionStyle{default}[indent=0pt,justification=centering]{}
2598 % \end{macrocode}
2599 %
2600 % \subsubsection*{Formats}
2601 %
2602 % \begin{macro}{\DeclareCaptionFormat}
2603 % \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
2604 % \changes{v3.0d}{2005/02/09}{Starred variant added}
2605 % |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\
2606 % |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par
2607 % The starred form causes the code being typeset in vertical (instead of
2608 % horizontal) mode, but does not support the |indention=| option.
2609 % \begin{macrocode}
2610 \newcommand\DeclareCaptionFormat{%
2611 \@ifstar{\caption@declareformat\@gobble}%
2612 {\caption@declareformat\@firstofone}}
2613 \newcommand\caption@declareformat[3]{%
2614 \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
2615 \global\long\@namedef{caption@fmt@#2}##1##2##3{#3}}
2616 \@onlypreamble\DeclareCaptionFormat
2617 \@onlypreamble\caption@declareformat
2618 % \end{macrocode}
2619 % \end{macro}
2620 %
2621 % \begin{macrocode}
2622 \DeclareCaptionOption{format}{\caption@setformat{#1}}
2623 % \end{macrocode}
2624 %
2625 % \begin{macro}{\caption@setformat}
2626 % |\caption@setformat|\marg{name}\par
2627 % Selecting a caption format simply means saving the code (in |\caption@fmt|)
2628 % and if the code should be used in horizontal or vertical mode (|\caption@ifh|).
2629 % \begin{macrocode}
2630 \newcommand*\caption@setformat[1]{%
2631 \@ifundefined{caption@fmt@#1}%
2632 {\caption@Error{Undefined caption format `#1'}}%
2633 {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
2634 \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
2635 % \end{macrocode}
2636 % \end{macro}
2637 %
2638 % \changes{v3.0a}{2004/01/23}{Caption format \opt{default} renamed to \opt{normal}}
2639 % \changes{v3.0f}{2005/05/12}{Caption format \opt{normal} renamed to \opt{@normal}}
2640 % \changes{v3.0h}{2005/08/25}{Caption format \opt{@normal} renamed to \opt{plain} and documented}
2641 % There are two pre-defined formats, called `plain' and `hang'.
2642 %
2643 % \begin{macrocode}
2644 \DeclareCaptionFormat{plain}{#1#2#3\par}
2645 \DeclareCaptionFormat{hang}{%
2646 \@hangfrom{#1#2}%
2647 \advance\captionparindent\hangindent
2648 \advance\captionhangindent\hangindent
2649 \caption@@par
2650 #3\par}
2651 % \end{macrocode}
2652 %
2653 % \changes{v3.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{normal}}
2654 % \changes{v3.0e}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added}
2655 % `default' usually maps to `plain'.
2656 %
2657 % \begin{macrocode}
2658 \def\caption@fmt@default{\caption@fmt@plain}
2659 \def\caption@ifh@default{\caption@ifh@plain}
2660 % \end{macrocode}
2661 %
2662 % \subsubsection*{Label formats}
2663 %
2664 % \begin{macro}{\DeclareCaptionLabelFormat}
2665 % \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
2666 % |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
2667 % \begin{macrocode}
2668 \newcommand*\DeclareCaptionLabelFormat[2]{%
2669 \global\@namedef{caption@lfmt@#1}##1##2{#2}}
2670 \@onlypreamble\DeclareCaptionLabelFormat
2671 % \end{macrocode}
2672 % \end{macro}
2673 %
2674 % \begin{macrocode}
2675 \DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
2676 % \end{macrocode}
2677 %
2678 % \begin{macro}{\caption@setlabelformat}
2679 % |\caption@setlabelformat|\marg{name}\par
2680 % Selecting a caption label format simply means saving the code (in |\caption@lfmt|).
2681 % \begin{macrocode}
2682 \newcommand*\caption@setlabelformat[1]{%
2683 \@ifundefined{caption@lfmt@#1}%
2684 {\caption@Error{Undefined caption label format `#1'}}%
2685 {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
2686 % \end{macrocode}
2687 % \end{macro}
2688 %
2689 % There are three pre-defined label formats, called `empty', `simple', and `parens'.
2690 %
2691 % \begin{macrocode}
2692 \DeclareCaptionLabelFormat{empty}{}
2693 \DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
2694 \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
2695 % \end{macrocode}
2696 %
2697 % `default' usually maps to `simple'.
2698 %
2699 % \begin{macrocode}
2700 \def\caption@lfmt@default{\caption@lfmt@simple}
2701 % \end{macrocode}
2702 %
2703 % \subsubsection*{Label separators}
2704 %
2705 % \begin{macro}{\DeclareCaptionLabelSeparator}
2706 % \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
2707 % \changes{v3.0h}{2005/08/25}{Starred variant added}
2708 % |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
2709 % |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par
2710 % The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|.
2711 % \begin{macrocode}
2712 \newcommand\DeclareCaptionLabelSeparator{%
2713 \@ifstar{\caption@declarelabelseparator\@gobble}%
2714 {\caption@declarelabelseparator\@firstofone}}
2715 \newcommand\caption@declarelabelseparator[3]{%
2716 \global\expandafter\let\csname caption@iflf@#2\endcsname#1%
2717 \global\long\@namedef{caption@lsep@#2}{#3}}
2718 \@onlypreamble\DeclareCaptionLabelSeparator
2719 \@onlypreamble\caption@declarelabelseparator
2720 % \end{macrocode}
2721 % \end{macro}
2722 %
2723 % \begin{macrocode}
2724 \DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
2725 \DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
2726 % \end{macrocode}
2727 %
2728 % \begin{macro}{\caption@setlabelseparator}
2729 % |\caption@setlabelseparator|\marg{name}\par
2730 % Selecting a caption label separator simply means saving the code (in |\caption@lsep|).
2731 % \begin{macrocode}
2732 \newcommand*\caption@setlabelseparator[1]{%
2733 \@ifundefined{caption@lsep@#1}%
2734 {\caption@Error{Undefined caption label separator `#1'}}%
2735 {\expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
2736 \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
2737 % \end{macrocode}
2738 % \end{macro}
2739 %
2740 % \changes{v3.0f}{2005/06/11}{Bugfix 05-03-23: Caption label separator \opt{newline} implementation
2741 % changed from \cs{newline} to \cs{\textbackslash}}
2742 % \changes{v3.0h}{2005/08/24}{Caption label separator \opt{endash} added}
2743 % There are seven pre-defined label separators, called `none', `colon', `period', `space',
2744 % `quad', `newline', and `endash'.
2745 %
2746 % \begin{macrocode}
2747 \DeclareCaptionLabelSeparator{none}{}
2748 \DeclareCaptionLabelSeparator{colon}{: }
2749 \DeclareCaptionLabelSeparator{period}{. }
2750 \DeclareCaptionLabelSeparator{space}{ }
2751 \DeclareCaptionLabelSeparator*{quad}{\quad}
2752 \DeclareCaptionLabelSeparator*{newline}{\\}
2753 \DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
2754 % \end{macrocode}
2755 %
2756 % `default' usually maps to `colon'.
2757 %
2758 % \begin{macrocode}
2759 \def\caption@lsep@default{\caption@lsep@colon}
2760 \def\caption@iflf@default{\caption@iflf@colon}
2761 % \end{macrocode}
2762 %
2763 % \subsubsection*{Text formats}
2764 %
2765 % \begin{macro}{\DeclareCaptionTextFormat}
2766 % \changes{v3.0l}{2007/02/18}{This macro added}
2767 % |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1}
2768 % \begin{macrocode}
2769 \newcommand*\DeclareCaptionTextFormat[2]{%
2770 \global\long\@namedef{caption@tfmt@#1}##1{#2}}
2771 \@onlypreamble\DeclareCaptionTextFormat
2772 % \end{macrocode}
2773 % \end{macro}
2774 %
2775 % \begin{macrocode}
2776 \DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
2777 % \end{macrocode}
2778 %
2779 % \begin{macro}{\caption@settextformat}
2780 % \changes{v3.0l}{2007/02/18}{This macro added}
2781 % |\caption@settextformat|\marg{name}\par
2782 % Selecting a caption text format simply means saving the code (in |\caption@tfmt|).
2783 % \begin{macrocode}
2784 \newcommand*\caption@settextformat[1]{%
2785 \@ifundefined{caption@tfmt@#1}%
2786 {\caption@Error{Undefined caption text format `#1'}}%
2787 {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
2788 % \end{macrocode}
2789 % \end{macro}
2790 %
2791 % There are two pre-defined text formats, called `simple' and `period'.
2792 %
2793 % \begin{macrocode}
2794 \DeclareCaptionTextFormat{simple}{#1}
2795 \DeclareCaptionTextFormat{period}{#1.}
2796 % \end{macrocode}
2797 %
2798 % `default' usually maps to `simple'.
2799 %
2800 % \begin{macrocode}
2801 \def\caption@tfmt@default{\caption@tfmt@simple}
2802 % \end{macrocode}
2803 %
2804 % \subsubsection*{Justifications}
2805 %
2806 % \begin{macro}{\DeclareCaptionJustification}
2807 % \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
2808 % |\DeclareCaptionJustification|\marg{name}\marg{code}
2809 % \begin{macrocode}
2810 \newcommand*\DeclareCaptionJustification[2]{%
2811 \global\@namedef{caption@hj@#1}{#2}}
2812 %\newcommand\DeclareCaptionJustification{\DeclareCaptionFont}
2813 \@onlypreamble\DeclareCaptionJustification
2814 % \end{macrocode}
2815 % \end{macro}
2816 %
2817 % \begin{macrocode}
2818 \DeclareCaptionOption{justification}{\caption@setjustification{#1}}
2819 % \end{macrocode}
2820 %
2821 % \begin{macro}{\caption@setjustification}
2822 % |\caption@setjustification|\marg{name}\par
2823 % Selecting a caption justification simply means saving the code (in |\caption@hj|).
2824 % \begin{macrocode}
2825 \newcommand*\caption@setjustification[1]{%
2826 \@ifundefined{caption@hj@#1}%
2827 {\caption@Error{Undefined caption justification `#1'}}%
2828 {\expandafter\let\expandafter\caption@hj\csname caption@hj@#1\endcsname}}
2829 %\newcommand\caption@setjustification{\caption@setfont{@hj}}
2830 % \end{macrocode}
2831 % \end{macro}
2832 %
2833 % These are the pre-defined justification code snippets.
2834 %
2835 % \begin{macrocode}
2836 \DeclareCaptionJustification{justified}{}
2837 \DeclareCaptionJustification{centering}{\centering}
2838 \DeclareCaptionJustification{centerfirst}{\centerfirst}
2839 \DeclareCaptionJustification{centerlast}{\centerlast}
2840 \DeclareCaptionJustification{raggedleft}{\raggedleft}
2841 \DeclareCaptionJustification{raggedright}{\raggedright}
2842 % \end{macrocode}
2843 %
2844 % `default' usually maps to `justified'.
2845 %
2846 % \begin{macrocode}
2847 \def\caption@hj@default{\caption@hj@justified}
2848 % \end{macrocode}
2849 %
2850 % \begin{macro}{\centerfirst}
2851 % \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
2852 % \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}}
2853 % Please blame Frank Mittelbach for |\caption@centerfirst| |:-)|
2854 % \begin{macrocode}
2855 \providecommand\centerfirst{%
2856 \let\\\@centercr
2857 \edef\caption@normaladjust{%
2858 \leftskip\the\leftskip
2859 \rightskip\the\rightskip
2860 \parfillskip\the\parfillskip\relax}%
2861 \leftskip\z@\@plus -1fil%
2862 \rightskip\z@\@plus 1fil%
2863 \parfillskip\z@skip
2864 \noindent\hskip\z@\@plus 2fil%
2865 \@setpar{\@@par\@restorepar\caption@normaladjust}}
2866 % \end{macrocode}
2867 % \end{macro}
2868 %
2869 % \begin{macro}{\centerlast}
2870 % \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
2871 % \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}}
2872 % This is based on code from Anne Br\"uggemann-Klein\cite{Anne}
2873 % \begin{macrocode}
2874 \providecommand\centerlast{%
2875 \let\\\@centercr
2876 \leftskip\z@\@plus 1fil%
2877 \rightskip\z@\@plus -1fil%
2878 \parfillskip\z@\@plus 2fil\relax}
2879 % \end{macrocode}
2880 % \end{macro}
2881 %
2882 % \changes{v3.0b}{2004/05/16}{Improved \package{ragged2e} package support}
2883 % We also support the upper-case commands offered by the \package{ragged2e}
2884 % package.
2885 % Note that these just map to their lower-case variants if the
2886 % \package{ragged2e} package is not available.
2887 % \begin{macrocode}
2888 \DeclareCaptionJustification{Centering}{%
2889 \caption@ragged\Centering\centering}
2890 \DeclareCaptionJustification{RaggedLeft}{%
2891 \caption@ragged\RaggedLeft\raggedleft}
2892 \DeclareCaptionJustification{RaggedRight}{%
2893 \caption@ragged\RaggedRight\raggedright}
2894 % \end{macrocode}
2895 %
2896 % \begin{macro}{\caption@ragged}
2897 % \changes{v3.0p}{2007/04/07}{The `ragged2e' package will now only been loaded when needed}
2898 % \changes{v3.0q}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced by \cs{caption@Debug}}
2899 % \changes{v3.0q}{2007/04/16}{Warnung will be suppressed on first \LaTeX\ run}
2900 % |\caption@ragged| will be basically defined as\par
2901 % |\AtBeginDocument{\IfFileExists{ragged2e.sty}%|\\
2902 % | {\RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}%|\\
2903 % | {\let\caption@ragged\@secondoftwo}}|\par
2904 % but with an additional warning if the ragged2e package is not loaded (yet).
2905 % (This warning will be typeout only one time per option, that's why
2906 % we need the |caption\string#1| stuff.)
2907 % Furthermore we load the \package{ragged2e} package, if needed and available.
2908 % \begin{macrocode}
2909 \newcommand*\caption@ragged{%
2910 \caption@Debug{We need ragged2e}%
2911 \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}%
2912 \global\let\caption@ragged\caption@@ragged
2913 \caption@@ragged}
2914 % \end{macrocode}
2915 % \begin{macrocode}
2916 \newcommand*\caption@@ragged[2]{%
2917 \@ifundefined{caption\string#1}{%
2918 \PackageWarning{caption3}{%
2919 `ragged2e' package not loaded, therefore\MessageBreak
2920 substituting \string#2 for \string#1\MessageBreak}%
2921 \global\@namedef{caption\string#1}}{}%
2922 #2}
2923 % \end{macrocode}
2924 % \begin{macrocode}
2925 \AtBeginDocument{%
2926 \@ifundefined{caption@ragged2e}{%
2927 \let\caption@@ragged\@secondoftwo % suppress warning above
2928 }{%
2929 \caption@Debug{We load ragged2e}%
2930 \IfFileExists{ragged2e.sty}{%
2931 \RequirePackage{ragged2e}\let\caption@@ragged\@firstoftwo}{}%
2932 }}
2933 % \end{macrocode}
2934 % \end{macro}
2935 %
2936 % \subsubsection*{Fonts}
2937 %
2938 % \begin{macro}{\DeclareCaptionFont}
2939 % \changes{v3.0a}{2004/01/22}{Bugfix: Multi token arguments are allowed now}
2940 % |\DeclareCaptionFont|\marg{name}\marg{code}
2941 % \begin{macrocode}
2942 \newcommand\DeclareCaptionFont[2]{%
2943 \define@key{caption@fnt}{#1}[]{\g@addto@macro\caption@tempa{#2}}}
2944 \@onlypreamble\DeclareCaptionFont
2945 % \end{macrocode}
2946 % \end{macro}
2947 %
2948 % \begin{macrocode}
2949 \DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
2950 \DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
2951 \DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
2952 % \end{macrocode}
2953 %
2954 % \begin{macro}{\caption@setfont}
2955 % \changes{v3.0l}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument}
2956 % |\caption@setfont|\marg{name}\marg{keyval-list of names}\par
2957 % Selecting a caption font means saving all the code snippets
2958 % (in |\caption#1|).
2959 % Because we use |\setkeys| recursive here we need to do this inside an
2960 % extra group and collect all the code snippets in |\caption@tempa| first.
2961 % \begin{macrocode}
2962 \newcommand*\caption@setfont[2]{%
2963 \let\caption@tempa\@empty
2964 \begingroup
2965 % \define@key{caption@fnt}{default}[]{%
2966 % \global\expandafter\let\expandafter\caption@tempa
2967 % \csname caption#1@default\endcsname}%
2968 \caption@setkeys[caption]{caption@fnt}{#2}%
2969 \endgroup
2970 \expandafter\let\csname caption#1\endcsname\caption@tempa}
2971 % \end{macrocode}
2972 % \end{macro}
2973 %
2974 % \begin{macrocode}
2975 \DeclareCaptionFont{default}{}
2976 % \end{macrocode}
2977 %
2978 % These are the pre-defined font code snippets.
2979 %
2980 % \begin{macrocode}
2981 \DeclareCaptionFont{scriptsize}{\scriptsize}
2982 \DeclareCaptionFont{footnotesize}{\footnotesize}
2983 \DeclareCaptionFont{small}{\small}
2984 \DeclareCaptionFont{normalsize}{\normalsize}
2985 \DeclareCaptionFont{large}{\large}
2986 \DeclareCaptionFont{Large}{\Large}
2987 % \end{macrocode}
2988 %
2989 % \begin{macrocode}
2990 \DeclareCaptionFont{up}{\upshape}
2991 \DeclareCaptionFont{it}{\itshape}
2992 \DeclareCaptionFont{sl}{\slshape}
2993 \DeclareCaptionFont{sc}{\scshape}
2994 \DeclareCaptionFont{md}{\mdseries}
2995 \DeclareCaptionFont{bf}{\bfseries}
2996 \DeclareCaptionFont{rm}{\rmfamily}
2997 \DeclareCaptionFont{sf}{\sffamily}
2998 \DeclareCaptionFont{tt}{\ttfamily}
2999 % \end{macrocode}
3000 %
3001 % \subsubsection*{\package{setspace} package support}
3002 % \changes{v3.0p}{2007/04/02}{\package{setspace} package support added to kernel}
3003 %
3004 % \begin{macrocode}
3005 \DeclareCaptionFont{singlespacing}{\setstretch{\setspace@singlespace}}% normally 1
3006 \DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
3007 \DeclareCaptionFont{doublespacing}{\doublespacing}
3008 % \end{macrocode}
3009 %
3010 % \begin{macro}{\captionsize}
3011 % \changes{v3.0a}{2004/01/23}{Implementation changed from \cs{captionfont} to \cs{@empty}}
3012 % \changes{v3.0c}{2004/07/16}{Use \cs{providecommand} instead of \cs{newcommand} in respect of the memoir class}
3013 % The old versions \version{1.x} of the \package{caption} package offered this
3014 % command to setup the font size used for captions. We still do
3015 % so old documents will work fine.
3016 % \begin{macrocode}
3017 \providecommand\captionsize{}
3018 % \end{macrocode}
3019 % \end{macro}
3020 %
3021 % \changes{v3.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
3022 % \begin{macrocode}
3023 \DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
3024 % \end{macrocode}
3025 %
3026 % \subsubsection*{Vertical spaces before and after captions}
3027 %
3028 % \begin{macro}{\abovecaptionskip}
3029 % \begin{macro}{\belowcaptionskip}
3030 % Usually these skips are defined within the document class, but some
3031 % document classes don't do so.
3032 % \begin{macrocode}
3033 \@ifundefined{abovecaptionskip}{%
3034 \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
3035 \@ifundefined{belowcaptionskip}{%
3036 \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
3037 % \end{macrocode}
3038 % \end{macro}
3039 % \end{macro}
3040 %
3041 % \changes{v3.0d}{2005/02/12}{Option \opt{skip=} added}
3042 % \begin{macrocode}
3043 \DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
3044 \DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
3045 \DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
3046 % \end{macrocode}
3047 %
3048 % \subsubsection*{Positioning}
3049 %
3050 % These macros handle the right position of the caption.
3051 % Note that the position is actually \emph{not} controlled by the
3052 % \package{caption} kernel options, but by the user (or a specific package
3053 % like the \package{float} package) instead.
3054 % The user can put the |\caption| command wherever he likes! So this stuff
3055 % is only to give us a \emph{hint} where to put the right skips, the user
3056 % usually has to take care for himself that this hint actually matches the
3057 % right position.
3058 % The user can also try out the experimental setting |position=auto| which
3059 % means that the \package{caption} package should try to guess the actual
3060 % position of the caption for himself. (But in many cases, for example in
3061 % |longtable|s, this is doomed to fail, so it's not documented in the
3062 % user part of the documentation.)
3063 %
3064 % \begin{macrocode}
3065 \DeclareCaptionOption{position}{\caption@setposition{#1}}
3066 % \end{macrocode}
3067 %
3068 % \begin{macro}{\caption@setposition}
3069 % \changes{v3.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b},
3070 % \opt{below}, and \opt{a} are allowed, too}
3071 % \changes{v3.0d}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
3072 % |\caption@setposition|\marg{position}\par
3073 % Selecting the caption position means that we put |\caption@position| to
3074 % the right value. \emph{Please do \textbf{not} use the internal macro
3075 % \cs{caption@position} in your own package or document, but use the wrapper
3076 % macro \cs{caption@iftop} instead.}
3077 % \begin{macrocode}
3078 \newcommand*\caption@setposition[1]{%
3079 \caption@ifinlist{#1}{d,default}{%
3080 \def\caption@position{\caption@defaultpos}%
3081 }{\caption@ifinlist{#1}{t,top,above}{%
3082 \let\caption@position\@firstoftwo
3083 }{\caption@ifinlist{#1}{b,bottom,below}{%
3084 \let\caption@position\@secondoftwo
3085 }{\caption@ifinlist{#1}{a,auto}{%
3086 \let\caption@position\@undefined
3087 }{%
3088 \caption@Error{Undefined caption position `#1'}%
3089 }}}}}
3090 % \end{macrocode}
3091 % \end{macro}
3092 %
3093 % \begin{macro}{\caption@defaultpos}
3094 % The default `position' is usually `bottom', this means that the (larger)
3095 % skip will be typeset above the caption.
3096 % This correspondents to the |\@makecaption| implementation in the standard
3097 % \LaTeX\ document classes.
3098 % \begin{macrocode}
3099 %\caption@setdefaultpos{b}% default = bottom
3100 \let\caption@defaultpos\@secondoftwo
3101 % \end{macrocode}
3102 % \end{macro}
3103 %
3104 % \begin{macro}{\caption@iftop}
3105 % \changes{v3.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
3106 % \changes{v3.0d}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
3107 % |\caption@iftop|\marg{true-code}\marg{false-code}\par
3108 % (If the |position=| is set to |auto| we assume a |bottom| position.)
3109 % \begin{macrocode}
3110 \newcommand\caption@iftop{%
3111 \ifx\caption@position\@undefined
3112 \expandafter\@secondoftwo
3113 \else
3114 \expandafter\caption@position
3115 \fi}
3116 % \end{macrocode}
3117 % \end{macro}
3118 %
3119 % \begin{macro}{\caption@fixposition}
3120 % \changes{v3.0b}{2004/05/16}{Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
3121 % |\caption@fixposition|\par
3122 % This macro checks if the `position' is set to `auto'.
3123 % If yes, |\caption@autoposition| will be called to
3124 % set |\caption@position| to a proper value we can actually use.
3125 % \begin{macrocode}
3126 \newcommand\caption@fixposition{%
3127 \ifx\caption@position\@undefined
3128 \caption@autoposition
3129 \fi}
3130 % \end{macrocode}
3131 % \end{macro}
3132 %
3133 % \begin{macro}{\caption@autoposition}
3134 % \changes{v3.0a}{2004/01/23}{\cs{ifvmode} added}
3135 % |\caption@autoposition|\par
3136 % We guess the actual position of the caption by checking |\prevdepth|.
3137 % \begin{macrocode}
3138 \newcommand\caption@autoposition{%
3139 \ifvmode
3140 \edef\caption@tempa{\the\prevdepth}%
3141 \caption@Debug{\protect\prevdepth=\caption@tempa}%
3142 % \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}%
3143 \ifdim\prevdepth>-\p@
3144 \let\caption@position\@secondoftwo
3145 \else
3146 \let\caption@position\@firstoftwo
3147 \fi
3148 \else
3149 \caption@Debug{no \protect\prevdepth}%
3150 % \caption@setposition{b}%
3151 \let\caption@position\@secondoftwo
3152 \fi}
3153 % \end{macrocode}
3154 % \end{macro}
3155 %
3156 % \subsubsection*{Hooks}
3157 %
3158 % \begin{macro}{\AtBeginCaption}
3159 % \begin{macro}{\AtEndCaption}
3160 % |\AtBeginCaption| \marg{code}\\
3161 % |\AtEndCaption| \marg{code}\par
3162 % These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|.
3163 % \begin{macrocode}
3164 \newcommand\caption@beginhook{}
3165 \newcommand\caption@endhook{}
3166 \newcommand\AtBeginCaption{\l@addto@macro\caption@beginhook}
3167 \newcommand\AtEndCaption{\l@addto@macro\caption@endhook}
3168 % \end{macrocode}
3169 % \end{macro}
3170 % \end{macro}
3171 %
3172 % \subsubsection*{Miscellaneous options}
3173 %
3174 % \changes{v3.0b}{2004/05/16}{Option \opt{listof=} added}
3175 % \changes{v3.0d}{2005/02/12}{Option \opt{strut=} added}
3176 % \begin{macrocode}
3177 \DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}}
3178 \DeclareCaptionOption{singlelinecheck}{\caption@setbool{slc}{#1}}
3179 \DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}}
3180 % \end{macrocode}
3181 %
3182 % \subsubsection*{Debug option}
3183 % \changes{v3.0m}{2007/03/04}{Debug option added to kernel}
3184 %
3185 % \begin{macrocode}
3186 \DeclareCaptionOption{debug}[1]{%
3187 \caption@setbool{debug}{#1}%
3188 \caption@ifdebug{%
3189 \def\caption@Debug{\PackageInfo{caption3}}%
3190 }{%
3191 \let\caption@Debug\@gobble
3192 }}
3193 \setkeys{caption}{debug=0}
3194 % \end{macrocode}
3195 %
3196 % \subsubsection*{Initialization of parameters}
3197 %
3198 % \begin{macrocode}
3199 \captionsetup{style=default,position=default,listof=1,%
3200 twoside=\if@twoside 1\else 0\fi}
3201 % \end{macrocode}
3202 %
3203 % \begin{macro}{\ifcaption@star}
3204 % If the starred form of |\caption| is used, this will be set to |true|.
3205 % (It will be reset to |false| at the end of |\caption@@make|.)
3206 % \begin{macrocode}
3207 \newif\ifcaption@star
3208 % \end{macrocode}
3209 % \end{macro}
3210 %
3211 % \subsubsection*{Typesetting the caption}
3212 %
3213 % \begin{macro}{\caption@make}
3214 % |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}
3215 % \begin{macrocode}
3216 \newcommand\caption@make[2]{%
3217 \caption@@make{\caption@lfmt{#1}{#2}}}
3218 % \end{macrocode}
3219 % \end{macro}
3220 %
3221 % \begin{macro}{\caption@@make}
3222 % \changes{v3.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
3223 % \changes{v3.0d}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of \cs{captionmargin} resp. \cs{captionwidth};
3224 % check for \cs{z@} added}
3225 % \changes{v3.0d}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end of caption added}
3226 % \changes{v3.0d}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
3227 % \changes{v3.0d}{2005/02/12}{Single-line-check moved up so it can affect margins now}
3228 % \changes{v3.0d}{2005/02/09}{Improvement: \cs{caption@ifh} added}
3229 % \changes{v3.0d}{2005/02/09}{Bugfix: \cs{leavevmode} added}
3230 % \changes{v3.0h}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
3231 % \changes{v3.0i}{2005/12/04}{Uses \cs{caption@slc}}
3232 % \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside single-line-check replaced by \cs{relax}}
3233 % \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be typeset in horizontal mode}
3234 % \changes{v3.0k}{2006/05/13}{Uses \cs{captionbox} instead of \cs{caption@start/endbox}}
3235 % \changes{v3.0l}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v3.0j, re-added}
3236 % \changes{v3.0p}{2007/04/03}{Usage of \cs{caption@ifoddpage} added}
3237 % |\caption@@make|\marg{caption label}\marg{caption text}
3238 % \begin{macrocode}
3239 \newcommand\caption@@make[2]{%
3240 \begingroup
3241 \caption@beginhook
3242 \caption@calcmargin
3243 % \end{macrocode}
3244 %
3245 % Special single-line treatment (option |singlelinecheck=|)
3246 %
3247 % \begin{macrocode}
3248 \caption@ifslc{\ifx\caption@sls\@empty\else
3249 \caption@slc{#1}{#2}\captionwidth\relax
3250 \fi}{}%
3251 % \end{macrocode}
3252 %
3253 % Typeset the left margin (option |margin=|)
3254 %
3255 % \begin{macrocode}
3256 \@tempdima\captionmargin
3257 \ifdim\captionmargin@=\z@\else
3258 \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}%
3259 \fi
3260 \caption@ifh{\advance\@tempdima\captionindent}%
3261 \hskip\@tempdima
3262 % \end{macrocode}
3263 %
3264 % We actually use a |\vbox| of width |\captionwidth - \captionindent|
3265 % to typeset the caption
3266 % (Note: |\captionindent| is \emph{not} supported if the caption format
3267 % was defined with |\DeclareCaptionFormat*|.)
3268 %
3269 % \begin{macrocode}
3270 \@tempdima\captionwidth
3271 \caption@ifh{\advance\@tempdima by -\captionindent}%
3272 \captionbox\@tempdima{%
3273 % \end{macrocode}
3274 %
3275 % Typeset the indention (option |indention=|)\\
3276 % Bugfix 04-05-05: |\hskip-\captionindent| replaced by |\ifdim\captionindent=\z@|\ldots
3277 %
3278 % \begin{macrocode}
3279 \caption@ifh{%
3280 \ifdim\captionindent=\z@
3281 \leavevmode
3282 \else
3283 \hskip-\captionindent
3284 \fi}%
3285 % \end{macrocode}
3286 %
3287 % Typeset the caption itself and close the |\captionbox|
3288 %
3289 % \begin{macrocode}
3290 \caption@@@make{#1}{#2}}%
3291 % \end{macrocode}
3292 %
3293 % Typeset the right margin (option |margin=|)
3294 %
3295 % \begin{macrocode}
3296 \@tempdima\captionmargin
3297 \ifdim\captionmargin@=\z@\else
3298 \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}%
3299 \fi
3300 \hskip\@tempdima
3301 % \end{macrocode}
3302 %
3303 % \begin{macrocode}
3304 \caption@endhook
3305 \endgroup
3306 % \end{macrocode}
3307 %
3308 % \begin{macrocode}
3309 \global\caption@starfalse}
3310 % \end{macrocode}
3311 % \end{macro}
3312 %
3313 % \begin{macro}{\caption@calcmargin}
3314 % Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
3315 % values.
3316 % \changes{v3.0h}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by \cs{ifdim}\cs{captionwidth=}\cs{z@}}
3317 % \changes{v3.0i}{2006/01/12}{Improvement: Takes care of list environment now}
3318 % \begin{macrocode}
3319 \newcommand\caption@calcmargin{%
3320 % \end{macrocode}
3321 % \emph{Note:} Inside a |list| environment |\linewidth| do not contain
3322 % the proper value, because |\@caption| calls |\@parboxrestore| which
3323 % resets |\linewidth| to |\hsize|. Therefore we have to calculate the
3324 % proper line width on our own in this case.
3325 % \begin{macrocode}
3326 \@tempdima\hsize
3327 \ifnum\@listdepth>0\relax
3328 \advance\@tempdima by -\leftmargin
3329 \advance\@tempdima by -\rightmargin
3330 \fi
3331 % \end{macrocode}
3332 % \begin{macrocode}
3333 \ifdim\captionwidth=\z@
3334 \captionwidth\@tempdima
3335 \advance\captionwidth by -2\captionmargin
3336 \advance\captionwidth by -\captionmargin@
3337 \else
3338 \captionmargin\@tempdima
3339 \advance\captionmargin by -\captionwidth
3340 \divide\captionmargin by 2
3341 \captionmargin@\z@
3342 \fi
3343 % \end{macrocode}
3344 % \begin{macrocode}
3345 \caption@Debug{%
3346 \protect\hsize=\the\hsize,
3347 \protect\margin=\the\captionmargin,
3348 \protect\marginx=\the\captionmargin@,
3349 \protect\width=\the\captionwidth}%
3350 % \end{macrocode}
3351 % \begin{macrocode}
3352 }
3353 % \end{macrocode}
3354 % \end{macro}
3355 %
3356 % \begin{macro}{\caption@slc}
3357 % This one does the single-line-check.
3358 % \begin{macrocode}
3359 \newcommand\caption@slc[4]{%
3360 \caption@startslc
3361 \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
3362 \ifdim\wd\@tempboxa >#3%
3363 \caption@endslc
3364 \else
3365 \caption@endslc
3366 \caption@esetup\caption@sls
3367 #4%
3368 \fi}
3369 % \end{macrocode}
3370 % \end{macro}
3371 %
3372 % \begin{macro}{\caption@startslc}
3373 % \changes{v3.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
3374 % \changes{v3.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
3375 % \changes{v3.0d}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added}
3376 % \changes{v3.0h}{2005/07/09}{Support of \package{endnotes} package added}
3377 % Re-define anything which would disturb the single-line-check.
3378 % \begin{macrocode}
3379 \newcommand\caption@startslc{%
3380 \begingroup
3381 \let\label\@gobble
3382 \let\@footnotetext\@gobble\let\@endnotetext\@gobble
3383 \def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}%
3384 \let\caption@hj\relax}
3385 % \end{macrocode}
3386 % \end{macro}
3387 %
3388 % \begin{macro}{\caption@endslc}
3389 % This ends the single-line-check.
3390 % \begin{macrocode}
3391 \newcommand\caption@endslc{%
3392 \endgroup}
3393 % \end{macrocode}
3394 % \end{macro}
3395 %
3396 % \begin{macro}{\captionbox}
3397 % \changes{v3.0k}{2006/05/13}{We define \cs{captionbox} instead of \cs{caption@start/endbox}}
3398 % \changes{v3.0n}{2006/03/09}{Bugfix 07-03-09: \cs{captionbox} changed from \cs{parbox-t} to \cs{parbox-b}}
3399 % This macro defines the box which surrounds the caption paragraph.
3400 % \begin{macrocode}
3401 \newcommand\captionbox{\parbox[b]}
3402 % \end{macrocode}
3403 % \end{macro}
3404 %
3405 % \begin{macro}{\caption@@@make}
3406 % \changes{v3.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
3407 % \changes{v3.0d}{2005/02/12}{Bugfix 04-12-16: Use some kind of \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
3408 % \changes{v3.0d}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
3409 % \changes{v3.0e}{2005/05/05}{Use \cs{caption@ifempty}; \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
3410 % \changes{v3.0e}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
3411 % \changes{v3.0h}{2005/08/24}{Check for empty label added}
3412 % \changes{v3.0h}{2005/08/25}{\cs{caption@iflf} added}
3413 % \changes{v3.0l}{2007/02/18}{Usage of \cs{caption@tfmt} added}
3414 % |\caption@@@make|\marg{caption label}\marg{caption text}\par
3415 % This one finally typesets the caption paragraph, without margin and indention.
3416 % \begin{macrocode}
3417 \newcommand\caption@@@make[2]{%
3418 % \end{macrocode}
3419 %
3420 % If the label is empty, we use no caption label separator.
3421 %
3422 % \begin{macrocode}
3423 \sbox\@tempboxa{#1}%
3424 \ifdim\wd\@tempboxa=\z@
3425 \let\caption@lsep\relax
3426 \fi
3427 % \end{macrocode}
3428 %
3429 % If the text is empty, we use no caption label separator, too.
3430 %
3431 % \begin{macrocode}
3432 \caption@ifempty{#2}{%
3433 \let\caption@lsep\relax
3434 % \let\caption@ifstrut\@secondoftwo
3435 }%
3436 % \end{macrocode}
3437 %
3438 % Take care that |\captionparindent| and |\captionhangindent| will be used
3439 % to typeset the paragraph.
3440 %
3441 % \begin{macrocode}
3442 \@setpar{\@@par\caption@@par}\caption@@par
3443 % \end{macrocode}
3444 %
3445 % Finally the caption will be typeset.
3446 %
3447 % \begin{macrocode}
3448 \caption@hj\captionsize\captionfont\caption@fmt
3449 {\ifcaption@star\else{\captionlabelfont#1}\fi}%
3450 {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}%
3451 {{\captiontextfont
3452 \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
3453 \nobreak\hskip\z@skip
3454 \caption@tfmt{#2}%
3455 % \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
3456 \caption@ifstrut{\@finalstrut\strutbox}{}%
3457 \par}}}
3458 % \end{macrocode}
3459 % \end{macro}
3460 %
3461 % \begin{macro}{\caption@ifempty}
3462 % \changes{v3.0e}{2005/05/05}{This macro added}
3463 % |\caption@ifempty|\marg{text}\marg{if-clause}\par
3464 % This one tests if the \meta{text} is actually empty.\par
3465 % \emph{Note:} This will be done without expanding the text, therefore this
3466 % is far away from being bullet-proof.
3467 % \begin{macrocode}
3468 \newcommand\caption@ifempty[1]{%
3469 \def\caption@tempa{#1}%
3470 \def\caption@tempb{\ignorespaces}%
3471 \ifx\caption@tempa\caption@tempb
3472 \let\caption@tempa\@empty
3473 \fi
3474 \ifx\caption@tempa\@empty
3475 \expandafter\@firstofone
3476 \else
3477 \expandafter\@gobble
3478 \fi}
3479 % \end{macrocode}
3480 % \end{macro}
3481 %
3482 % \begin{macro}{\caption@@par}
3483 % \changes{v3.0h}{2005/08/22}{Made this definition global}
3484 % |\caption@@par|\par
3485 % This command will be executed with every |\par| inside the caption.
3486 % \begin{macrocode}
3487 \newcommand*\caption@@par{%
3488 \parindent\captionparindent\hangindent\captionhangindent}%
3489 % \end{macrocode}
3490 % \end{macro}
3491 %
3492 % \iffalse
3493 %</kernel>
3494 % \fi
3495 %
3496 % \iffalse
3497 % --------------------------------------------------------------------------- %
3498 % \fi
3499 %
3500 % \subsection{Main package}
3501 % \iffalse
3502 %<*package>
3503 % \fi
3504 %
3505 % \subsubsection*{Identification}
3506 %
3507 % \begin{macrocode}
3508 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
3509 \ProvidesPackage{caption}[2022/07/10 v3.0r Customising captions (AR)]
3510 % \end{macrocode}
3511 %
3512 % \subsubsection*{Loading the kernel}
3513 %
3514 % \begin{macrocode}
3515 \RequirePackage{caption3}[=2007/01/31] % needs v1.0l or newer
3516 % \end{macrocode}
3517 %
3518 % \subsection*{Check against the obsolete \package{caption2} package}
3519 % \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
3520 %
3521 % \begin{macrocode}
3522 \@ifpackageloaded{caption2}{%
3523 \caption@Error{You can't use both the caption *and* caption2 package}%
3524 \endinput
3525 }{}
3526 % \end{macrocode}
3527 %
3528 % \subsubsection*{Option for configuration files}
3529 %
3530 % \begin{macrocode}
3531 \DeclareCaptionOption{config}[caption]{%
3532 \InputIfFileExists{#1.cfg}{\typeout{*** Local configuration file
3533 #1.cfg used ***}}%
3534 {\PackageWarning{caption}{Configuration
3535 file #1.cfg not found}}}
3536 % \end{macrocode}
3537 %
3538 % \subsubsection*{Options for |figure| and |table|}
3539 %
3540 % \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
3541 % \begin{macrocode}
3542 \DeclareCaptionOption*{figureposition}{\captionsetup[figure]{position=#1}}
3543 \DeclareCaptionOption*{tableposition}{\captionsetup[table]{position=#1}}
3544 % \end{macrocode}
3545 %
3546 % \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
3547 % \begin{macrocode}
3548 \DeclareCaptionOption*{figurename}{\captionsetup[figure]{name=#1}}
3549 \DeclareCaptionOption*{tablename}{\captionsetup[table]{name=#1}}
3550 % \end{macrocode}
3551 %
3552 % \subsubsection*{caption \version{1.x} compatibility options}
3553 %
3554 % \begin{macrocode}
3555 \DeclareCaptionOption*{normal}[]{\caption@setformat{normal}}
3556 \DeclareCaptionOption*{isu}[]{\caption@setformat{hang}}
3557 \DeclareCaptionOption*{hang}[]{\caption@setformat{hang}}
3558 \DeclareCaptionOption*{center}[]{\caption@setjustification{centering}}
3559 \DeclareCaptionOption*{anne}[]{\caption@setjustification{centerlast}}
3560 \DeclareCaptionOption*{centerlast}[]{\caption@setjustification{centerlast}}
3561 % \end{macrocode}
3562 %
3563 % \begin{macrocode}
3564 \DeclareCaptionOption*{scriptsize}[]{\def\captionfont{\scriptsize}}
3565 \DeclareCaptionOption*{footnotesize}[]{\def\captionfont{\footnotesize}}
3566 \DeclareCaptionOption*{small}[]{\def\captionfont{\small}}
3567 \DeclareCaptionOption*{normalsize}[]{\def\captionfont{\normalsize}}
3568 \DeclareCaptionOption*{large}[]{\def\captionfont{\large}}
3569 \DeclareCaptionOption*{Large}[]{\def\captionfont{\Large}}
3570 % \end{macrocode}
3571 %
3572 % \begin{macrocode}
3573 \DeclareCaptionOption*{up}[]{\l@addto@macro\captionlabelfont\upshape}
3574 \DeclareCaptionOption*{it}[]{\l@addto@macro\captionlabelfont\itshape}
3575 \DeclareCaptionOption*{sl}[]{\l@addto@macro\captionlabelfont\slshape}
3576 \DeclareCaptionOption*{sc}[]{\l@addto@macro\captionlabelfont\scshape}
3577 \DeclareCaptionOption*{md}[]{\l@addto@macro\captionlabelfont\mdseries}
3578 \DeclareCaptionOption*{bf}[]{\l@addto@macro\captionlabelfont\bfseries}
3579 \DeclareCaptionOption*{rm}[]{\l@addto@macro\captionlabelfont\rmfamily}
3580 \DeclareCaptionOption*{sf}[]{\l@addto@macro\captionlabelfont\sffamily}
3581 \DeclareCaptionOption*{tt}[]{\l@addto@macro\captionlabelfont\ttfamily}
3582 % \end{macrocode}
3583 %
3584 % \begin{macrocode}
3585 \DeclareCaptionOption*{nooneline}[]{\caption@setbool{slc}{0}}
3586 % \end{macrocode}
3587 %
3588 % \begin{macrocode}
3589 \caption@setbool{ruled}{0}
3590 \DeclareCaptionOption*{ruled}[]{\caption@setbool{ruled}{1}}
3591 % \end{macrocode}
3592 %
3593 % \subsubsection*{Some caption2 \version{2.x} compatibility options}
3594 % \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
3595 %
3596 % \begin{macrocode}
3597 \DeclareCaptionOption*{flushleft}[]{\caption@setjustification{raggedright}}
3598 \DeclareCaptionOption*{flushright}[]{\caption@setjustification{raggedleft}}
3599 \DeclareCaptionOption*{oneline}[]{\caption@setbool{slc}{1}}
3600 \DeclareCaptionOption*{ignoreLTcapwidth}[]{}
3601 % \end{macrocode}
3602 %
3603 % \subsubsection*{Some \KOMAScript\ compatibility options}
3604 % \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added}
3605 %
3606 % \begin{macrocode}
3607 \DeclareCaptionOption*{onelinecaption}[]{\caption@setbool{slc}{1}}
3608 \DeclareCaptionOption*{noonelinecaption}[]{\caption@setbool{slc}{0}}
3609 \DeclareCaptionOption*{tablecaptionabove}[]{\captionsetup[table]{position=t}}
3610 \DeclareCaptionOption*{tablecaptionbelow}[]{\captionsetup[table]{position=b}}
3611 % \end{macrocode}
3612 %
3613 % \subsubsection*{Generic package support}
3614 %
3615 % \begin{macro}{\caption@declarepackage}
3616 % |\caption@declarepackage|\marg{package name}\par
3617 % Each single package support can be switched on or off by using the
3618 % appropriate option. By default all of them are enabled.
3619 % \begin{macrocode}
3620 \newcommand*\caption@declarepackage[1]{%
3621 \caption@setbool{pkt@#1}{1}%
3622 \DeclareCaptionOption*{#1}{\caption@setbool{pkt@#1}{##1}}}
3623 \AtEndOfPackage{\let\caption@declarepackage\@undefined}
3624 % \end{macrocode}
3625 % \end{macro}
3626 %
3627 % \begin{macro}{\caption@ifpackage}
3628 % \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added, so no extra check is needed}
3629 % |\caption@ifpackage|\marg{package name}\marg{package macro}\marg{code}\par
3630 % If a certain package support is requested the appropriate code will
3631 % be used. `Requested' means that the option belonging to it is set to
3632 % |true| and the macro called \meta{package macro} is defined.
3633 % (If \meta{package macro} is not yet defined we use |\AtBeginDocument|
3634 % here, so the package could be loaded after this package, too.)
3635 % \begin{macrocode}
3636 \newcommand\caption@ifpackage[3]{%
3637 % \end{macrocode}
3638 % \begin{macrocode}
3639 \edef\caption@tempa{%
3640 \caption@ifbool{pkt@#1}%
3641 {\@ifundefined{#2}{AtBeginDocument}{firstofone}}%
3642 {gobble}}%
3643 \caption@Info{#1=\caption@ifbool{pkt@#1}{1}{0} %
3644 (\@ifundefined{#2}{not }{}loaded->\caption@tempa)}%
3645 % \end{macrocode}
3646 % \begin{macrocode}
3647 \caption@ifbool{pkt@#1}{%
3648 \@ifundefined{#2}%
3649 {\let\caption@tempa\AtBeginDocument}%
3650 {\let\caption@tempa\@firstofone}%
3651 }{%
3652 \let\caption@tempa\@gobble
3653 }%
3654 \caption@tempa{\@ifundefined{#2}{}{#3}}%
3655 % \end{macrocode}
3656 %
3657 % \begin{macrocode}
3658 \caption@undefbool{pkt@#1}}
3659 \AtEndOfPackage{\let\caption@ifpackage\@undefined}
3660 % \end{macrocode}
3661 % \end{macro}
3662 %
3663 % You can also switch the caption support off using the package option
3664 % |caption=false|.
3665 % This may look strange, but there are certain circumstances where this could
3666 % be useful.
3667 % Such a situation might be the usage of the \package{subfig} package without
3668 % disturbing the main caption code of the document class.\par
3669 % \emph{Note: This mechanism is obsolete now, it has been superseeded by the
3670 % \package{subfig} package option {\rm|caption=false|} which causes that only the
3671 % caption kernel \package{caption3} is loaded.}
3672 %
3673 % \begin{macrocode}
3674 \caption@declarepackage{caption}
3675 % \end{macrocode}
3676 %
3677 % These are the packages we support:
3678 %
3679 % \begin{macrocode}
3680 \caption@declarepackage{float}
3681 \caption@declarepackage{floatrow}
3682 \caption@declarepackage{hyperref}
3683 \caption@declarepackage{hypcap}
3684 \caption@declarepackage{listings}
3685 \caption@declarepackage{longtable}
3686 \caption@declarepackage{picins}
3687 \caption@declarepackage{rotating}
3688 \caption@declarepackage{sidecap}
3689 \caption@declarepackage{supertabular}
3690 % \end{macrocode}
3691 %
3692 % \subsubsection*{Processing of options}
3693 %
3694 % \changes{v3.0m}{2007/03/04}{Verbose option added to package}
3695 % \begin{macrocode}
3696 \DeclareCaptionOption{verbose}[1]{%
3697 \caption@setbool{verbose}{#1}%
3698 \caption@ifverbose{%
3699 \def\caption@Info{\PackageInfo{caption}}%
3700 }{%
3701 \let\caption@Info\@gobble
3702 }}
3703 \setkeys{caption}{verbose=0}
3704 % \end{macrocode}
3705 %
3706 % \begin{macrocode}
3707 \caption@ProcessOptions{caption}
3708 % \end{macrocode}
3709 %
3710 % If the option |caption=false| was given we stop processing this file
3711 % immediately.
3712 % \begin{macrocode}
3713 \caption@ifbool{pkt@caption}{}{\endinput}
3714 \caption@undefbool{pkt@caption}
3715 % \end{macrocode}
3716 %
3717 % \subsubsection*{Useful stuff}
3718 %
3719 % \begin{macro}{\captionof}
3720 % |\captionof|(|*|)\marg{type}\oarg{lst\_entry}\marg{heading}
3721 % \begin{macrocode}
3722 \def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}}
3723 \newcommand*\caption@of[2]{\def\@captype{#2}#1}
3724 % \end{macrocode}
3725 % \end{macro}
3726 %
3727 % Note: Like |\captionof| the option |type=| should only be used inside a
3728 % group or environment and does not check if the argument is a valid
3729 % floating environment or not.
3730 %
3731 % \changes{v3.0d}{2004/08/03}{Option \opt{name=} added}
3732 % \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
3733 % \begin{macrocode}
3734 \DeclareCaptionOption{name}{\caption@setfloatname\@captype{#1}}
3735 \DeclareCaptionOption{type}{\def\@captype{#1}}
3736 % \end{macrocode}
3737 %
3738 % \begin{macro}{\ContinuedFloat}
3739 % \changes{v3.0f}{2005/06/11}{Call of \cs{caption@ContinuedFloat} added}
3740 % \changes{v3.0i}{2005/11/12}{Optional argument and call of \cs{caption@@ContinuedFloat} added}
3741 % |\ContinuedFloat|\oarg{type}\par
3742 % This mainly decreases the appropriate counter by $-1$.
3743 % \begin{macrocode}
3744 \providecommand\ContinuedFloat{%
3745 \@ifnextchar[%]
3746 \@ContinuedFloat
3747 {\ifx\@captype\@undefined
3748 \@latex@error{\noexpand\ContinuedFloat outside float}\@ehd
3749 \else
3750 \@ContinuedFloat[\@captype]%
3751 \fi}}
3752 \def\@ContinuedFloat[#1]{%
3753 \addtocounter{#1}\m@ne
3754 \caption@ContinuedFloat{#1}%
3755 \caption@@ContinuedFloat{#1}}
3756 % \end{macrocode}
3757 % \end{macro}
3758 %
3759 % \begin{macro}{\caption@ContinuedFloat}
3760 % \begin{macro}{\caption@resetContinuedFloat}
3761 % |\caption@ContinuedFloat|\marg{type}\par
3762 % |\caption@resetContinuedFloat|\marg{type}\par
3763 % The first one will be called inside |\ContinuedFloat|, the second one
3764 % inside |\caption|. Usually they do nothing but this changes if the
3765 % \package{hyperref} package is loaded. (See \package{hyperref} package
3766 % support for details.)
3767 % \begin{macrocode}
3768 \let\caption@ContinuedFloat\@gobble
3769 \let\caption@resetContinuedFloat\@gobble
3770 % \end{macrocode}
3771 % \end{macro}
3772 % \end{macro}
3773 %
3774 % \begin{macro}{\caption@@ContinuedFloat}
3775 % This hook is for foreign packages which link themself into |\ContinuedFloat|,
3776 % for example the \package{subfig} package\cite{subfig}.
3777 % \begin{macrocode}
3778 \providecommand*\caption@@ContinuedFloat[1]{}
3779 % \end{macrocode}
3780 % \end{macro}
3781 %
3782 % \subsubsection*{Internal helpers}
3783 %
3784 % \begin{macro}{\caption@begin}
3785 % \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed by \cs{caption@setfloattype}}
3786 % \changes{v3.0e}{2005/04/12}{Check for default label format added}
3787 % \changes{v3.0f}{2005/06/11}{Call of \cs{caption@resetContinuedFloat} added}
3788 % Our handling of |\caption| will always be surrounded by
3789 % |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
3790 % |\caption@begin|\marg{type} performs these tasks:
3791 % \begin{itemize}
3792 % \item Call |\caption@resetContinuedFloat| (see above)
3793 % and start a new group
3794 % \item Execute the options set with |\captionsetup|\oarg{type}
3795 % \item Define |\fnum@|\meta{type} if the caption label format is set
3796 % to non-default
3797 % \item Override the |position=| setting, if necessary
3798 % (for example if set to |auto| or used inside a |supertabular|)
3799 % \end{itemize}
3800 % \begin{macrocode}
3801 \newcommand*\caption@begin[1]{%
3802 \caption@resetContinuedFloat{#1}%
3803 \begingroup
3804 % \end{macrocode}
3805 % \begin{macrocode}
3806 \caption@setfloattype{#1}%
3807 % \end{macrocode}
3808 %
3809 % \begin{macrocode}
3810 \ifx\caption@lfmt\caption@lfmt@default\else
3811 \@namedef{fnum@#1}{%
3812 \caption@lfmt{\caption@floatname{#1}}{\@nameuse{the#1}}}%
3813 \fi
3814 % \end{macrocode}
3815 %
3816 % \begin{macrocode}
3817 \caption@fixposition
3818 \global\let\caption@fixedposition\caption@position}
3819 % \end{macrocode}
3820 % \end{macro}
3821 %
3822 % \begin{macro}{\caption@beginex}
3823 % \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
3824 % \changes{v3.0h}{2005/09/16}{Bugfix: Made this macro and \cs{addcontentsline} \cs{long}}
3825 % \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
3826 % |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\\
3827 % performs the same tasks as |\caption@begin| and additionally:
3828 % Redefine |\addcontentsline| if no list-of entry is requested, that
3829 % means either the argument \meta{list entry} is empty or |listof=| was
3830 % set to |false|.
3831 % \begin{macrocode}
3832 \newcommand\caption@beginex[3]{%
3833 \caption@begin{#1}%
3834 % \end{macrocode}
3835 %
3836 % \begin{macrocode}
3837 \caption@iflof%
3838 {\def\caption@tempa{#2}}%
3839 {\let\caption@tempa\@empty}%
3840 \ifx\caption@tempa\@empty
3841 \long\def\addcontentsline##1##2##3{}% There is no \@gobblethree...
3842 \fi
3843 % \end{macrocode}
3844 %
3845 % \begin{macrocode}
3846 \caption@ifempty{#3}{\let\caption@ifempty\@secondoftwo}%
3847 % \end{macrocode}
3848 %
3849 % \begin{macrocode}
3850 }
3851 % \end{macrocode}
3852 % \end{macro}
3853 %
3854 % \begin{macro}{\caption@end}
3855 % |\caption@end| closes the group.
3856 % \begin{macrocode}
3857 \newcommand*\caption@end{%
3858 \endgroup
3859 % \end{macrocode}
3860 %
3861 % \begin{macrocode}
3862 \let\caption@position\caption@fixedposition}
3863 % \end{macrocode}
3864 % \end{macro}
3865 %
3866 % \begin{macro}{\caption@setfloattype}
3867 % \changes{v3.0a}{2004/01/23}{This macro added}
3868 % |\caption@setfloattype|\marg{type}\\
3869 % sets up the right float type within |\@caption|, |\LT@makecaption| etc.
3870 % Usually this is equivalent to |\caption@settype| but I made it an own macro so
3871 % I can extend it later on, for example if the \package{float} or
3872 % \package{sidecap} package is loaded.
3873 % \begin{macrocode}
3874 \let\caption@setfloattype\caption@settype
3875 % \end{macrocode}
3876 % \end{macro}
3877 %
3878 % \begin{macro}{\caption@letfloattype}
3879 % \changes{v3.0b}{2004/05/16}{This macro added}
3880 % \changes{v3.0e}{2005/05/05}{Argument \meta{extra code} added}
3881 % |\caption@letfloattype|\marg{type}\marg{extra code}\\
3882 % redefines |\caption@setfloattype| so it does not only
3883 % |\caption@settype|\marg{type} but two additional tasks:
3884 % Executing extra code given as second argument and
3885 % execute options with |\caption@settype{#1}| afterwards.\par
3886 % You can find an example of its usage in the \package{longtable}
3887 % support, where this macro is called so
3888 % |\captionsetup[longtable]{|\ldots|}| can be used to setup options
3889 % for longtables which have a higher priority than the options which
3890 % have been setup with |\captionsetup[table]{|\ldots|}| or
3891 % |\setlength\LTcapwidth{|\ldots|}|.
3892 % \begin{macrocode}
3893 \newcommand*\caption@letfloattype[2]{%
3894 \def\caption@setfloattype##1{%
3895 \caption@settype{##1}#2\caption@settype{#1}}}
3896 % \end{macrocode}
3897 % \end{macro}
3898 %
3899 % \changes{v3.0a}{2004/01/23}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
3900 % \changes{v3.0h}{2005/10/06}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
3901 % \changes{v3.0d}{2004/08/03}{\cs{caption@setfloatname} added}
3902 %
3903 % \begin{macro}{\caption@floatname}
3904 % |\caption@floatname|\marg{type}\par
3905 % Usually all float names (which partly build the caption label)
3906 % follow the same naming convention. But some packages (for example
3907 % the \package{float} package) do not, so we use this wrapper macro which
3908 % can be changed later on.
3909 % \begin{macrocode}
3910 \newcommand*\caption@floatname[1]{\@nameuse{#1name}}
3911 \newcommand*\caption@setfloatname[1]{\@namedef{#1name}}
3912 % \end{macrocode}
3913 % \end{macro}
3914 %
3915 % \subsubsection*{Caption support}
3916 %
3917 % \iffalse\begin{quote}
3918 % \small\emph{Note:}
3919 % Our aim is patching the existing |\caption| code so changes done by other
3920 % packages will not get lost. We do similar in our \package{float},
3921 % \package{hyperref}, and \package{hypcap} support so get the disadvantage
3922 % of having ugly code with some negative side-effects, like the non-working
3923 % |\caption{}| feature when the \package{french(le)} or \package{hyperref}
3924 % package is loaded.
3925 % \end{quote}\fi
3926 %
3927 % Some packages (like the \package{hyperref} package for example) redefines
3928 % |\caption| and |\@caption|, too, but without chaining to their previous
3929 % definitions. So we have to use |\AtBeginDocument| here, so we can make sure
3930 % our definition don't get lost.
3931 %
3932 % \begin{macrocode}
3933 \AtBeginDocument{%
3934 % \end{macrocode}
3935 %
3936 % We only patch |\caption| and |\@caption| if the \package{captcont} package
3937 % (which brings it's own definition of |\caption*|) is not used.
3938 % It does not make much sense using the actual version of the \package{caption}
3939 % package with the \package{captcont} package, but this was different in the
3940 % old (\version{1.x}) days so we take care to be backward compatible.
3941 %
3942 % \begin{macrocode}
3943 \@ifundefined{cc@caption}{%
3944 \@ifundefined{caption@old}{%
3945 % \end{macrocode}
3946 %
3947 % \begin{macro}{\caption}
3948 % \iffalse\changes{v3.0}{2003/07/18}{Bugfix: \cs{global} added, so this works with sidecap}\fi
3949 % \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
3950 % \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
3951 % \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
3952 % Here comes our definition of |\caption| and |\caption*|.
3953 % (We set |\caption@startrue| globally so it works with the \package{sidecap} package, too.)
3954 % \begin{macrocode}
3955 \let\caption@old\caption
3956 \def\caption{\caption@caption\caption@old}%
3957 \def\caption@caption#1{%
3958 \@ifstar{\ContinuedFloat\global\caption@startrue#1[]}{#1}}%
3959 % \end{macrocode}
3960 % \end{macro}
3961 %
3962 % \begin{macro}{\@caption}
3963 % Our definition of |\@caption| simply calls the old definition,
3964 % nested by |\caption@beginex| and |\caption@end|.
3965 % \begin{macrocode}
3966 \let\caption@@old\@caption
3967 \long\def\@caption#1[#2]#3{%
3968 \caption@beginex{#1}{#2}{#3}%
3969 \caption@@old{#1}[{#2}]{#3}%
3970 \caption@end}%
3971 % \end{macrocode}
3972 % \end{macro}
3973 %
3974 % \begin{macrocode}
3975 }{}}{%
3976 % \end{macrocode}
3977 %
3978 % \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: \package{captcont} support fixed}
3979 % Minimum \package{captcont} package support:\\
3980 % We define |\caption@caption| here so it's there but does not make any harm.
3981 %
3982 % \begin{macrocode}
3983 \caption@Info{captcont package v2.0 detected}%
3984 \def\caption@caption#1{#1}%
3985 }%
3986 }
3987 % \end{macrocode}
3988 %
3989 % \begin{macro}{\@makecaption}
3990 % |\@makecaption|\marg{label}\marg{text}\par
3991 % The original code (from |latex/base/classes.dtx|):
3992 % \begin{verbatim}
3993 % \long\def\@makecaption#1#2{%
3994 % \vskip\abovecaptionskip
3995 % \sbox\@tempboxa{#1: #2}%
3996 % \ifdim \wd\@tempboxa >\hsize
3997 % #1: #2\par
3998 % \else
3999 % \global \@minipagefalse
4000 % \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
4001 % \fi
4002 % \vskip\belowcaptionskip}
4003 % \end{verbatim}
4004 % We do basically the same, but take care of the |position=| setting
4005 % and use |\caption@@make| from the \package{caption} kernel to actually
4006 % typeset the caption.
4007 % \begin{macrocode}
4008 \renewcommand\@makecaption[2]{%
4009 \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
4010 \caption@@make{#1}{#2}%
4011 \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}}
4012 % \end{macrocode}
4013 % \end{macro}
4014 %
4015 % \subsubsection*{\package{\KOMAScript} classes support}
4016 % \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added}
4017 % \changes{v3.0h}{2005/08/22}{\cs{PackageInfo} added to \KOMAScript\ support}
4018 % \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added}
4019 % \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised}
4020 % \changes{v3.0q}{2007/04/16}{\KOMAScript\ compatibility revised}
4021 %
4022 % \begin{macrocode}
4023 \@ifundefined{scr@caption}{}{%
4024 \caption@Info{KOMA-Script class detected}
4025 \AtBeginDocument{\let\scr@caption\caption}
4026 % \end{macrocode}
4027 %
4028 % \begin{macro}{\onelinecaptionsfalse}
4029 % \begin{macro}{\onelinecaptionstrue}
4030 % \begin{macrocode}
4031 \def\onelinecaptionstrue{\caption@setbool{slc}{1}}
4032 \def\onelinecaptionsfalse{\caption@setbool{slc}{0}}
4033 % \end{macrocode}
4034 % \end{macro}
4035 % \end{macro}
4036 %
4037 % \begin{macro}{\captionabove}
4038 % \begin{macro}{\captionbelow}
4039 % \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21: \cs{let}\cs{caption@setposition}\cs{@gobble} added}
4040 % \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed}
4041 % Original code:
4042 % \begin{verbatim}
4043 % \newcommand{\captionabove}{\@captionabovetrue\scr@caption}
4044 % \newcommand{\captionbelow}{\@captionabovefalse\scr@caption}
4045 % \end{verbatim}
4046 % \begin{macrocode}
4047 \def\captionabove{%
4048 \caption@setposition{t}\let\caption@setposition\@gobble
4049 \scr@caption}
4050 \def\captionbelow{%
4051 \caption@setposition{b}\let\caption@setposition\@gobble
4052 \scr@caption}
4053 % \end{macrocode}
4054 % \end{macro}
4055 % \end{macro}
4056 %
4057 % \begin{macrocode}
4058 }
4059 % \end{macrocode}
4060 %
4061 % \subsubsection*{\package{french(le)} package support}
4062 % \changes{v3.0h}{2005/10/03}{Minimum adaptation to \package{french(le)} added}
4063 %
4064 % \begin{macrocode}
4065 \AtBeginDocument{\@ifundefined{f@ffrench}{}{%
4066 \caption@Info{french(le) package detected}%
4067 % \end{macrocode}
4068 %
4069 % If |\GOfrench| is defined as |\relax| all the re-definitions regarding
4070 % captions have already been done, so we can do our patches immediately.
4071 % Otherwise we must add our stuff to |\GOfrench|.
4072 %
4073 % \begin{macrocode}
4074 \@ifundefined{GOfrench}%
4075 {\let\caption@tempa\@firstofone}%
4076 {\def\caption@tempa{\g@addto@macro\GOfrench}}%
4077 \caption@tempa{%
4078 % \end{macrocode}
4079 %
4080 % \begin{macro}{\@cnORI}
4081 % We update the definition of |\@cnORI| so it actually reflects
4082 % our definition of |\caption|.
4083 % \begin{macrocode}
4084 \let\@cnORI\caption
4085 % \end{macrocode}
4086 % \end{macro}
4087 %
4088 % \begin{macro}{\@tablescaption}
4089 % The \package{french(le)} package sets |\caption| to |\@tablescaption| at
4090 % |\begin{table}| for special treatment of footnotes.
4091 % Therefore we have to patch |\@tablescaption| so |\caption*| will work
4092 % inside the |table| environment.
4093 % \begin{macrocode}
4094 \let\caption@tablescaption\@tablescaption
4095 \def\@tablescaption{\caption@caption\caption@tablescaption}%
4096 % \end{macrocode}
4097 % \end{macro}
4098 %
4099 % \begin{macro}{\f@ffrench}
4100 % \begin{macro}{\f@tfrench}
4101 % |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
4102 % when used in french mode. These contain additional code which typesets
4103 % the caption separator |\captionseparator| instead of the usual colon.
4104 % Because this breaks with our |\@makecaption| code we have to remove
4105 % this additional code here.
4106 % \begin{macrocode}
4107 \let\@eatDP\@undefined
4108 \let\caption@tempa\@empty
4109 \ifx\f@ffrench\fnum@figure
4110 \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
4111 \fi
4112 \ifx\f@tfrench\fnum@table
4113 \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
4114 \fi
4115 \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
4116 \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
4117 \caption@tempa
4118 % \end{macrocode}
4119 % \end{macro}
4120 % \end{macro}
4121 %
4122 % \begin{macrocode}
4123 }}}
4124 % \end{macrocode}
4125 %
4126 % \subsubsection*{\package{float} package support}
4127 % \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
4128 % \iffalse
4129 % (This is a more straight-ahead implementation, but it only works with v1.3
4130 % now, so v1.2 is no longer supported. The old code including documentation
4131 % can be found in caption-30f-050530.zip)
4132 % \fi
4133 %
4134 % The \package{float} package usually do not use the \LaTeX\ kernel command
4135 % |\@caption| to typeset the caption but |\float@caption| instead.
4136 % (|\@caption| will only be used if the float is re-styled with
4137 % |\restylefloat*|.)
4138 %
4139 % The main two things |\float@caption| is doing different are:
4140 % \begin{itemize}
4141 % \item The caption will be typeset inside a savebox called |\@floatcapt| so
4142 % it can be placed above or below the float contents afterwards.
4143 % \item |\@makecaption| will not be used to finally typeset the caption.
4144 % Instead |\@fs@capt| will be used which definition is part of the float
4145 % style.
4146 % (Note that |\@fs@capt| will not typeset any vertical space above or below
4147 % the caption; instead this space will be typeset by the float style code
4148 % itself.)
4149 % \end{itemize}
4150 %
4151 % So our main goal is to re-define |\float@caption| so our macro
4152 % |\caption@@make| will be used instead of |\@fs@capt|.
4153 %
4154 % To allow different caption styles for different float styles we will also
4155 % determine the current float style (e.g. `ruled') at run time and select
4156 % a caption style (and additional settings) with the same name, if defined.
4157 %
4158 % \begin{macro}{\caption@setfloatposition}
4159 % First of all we provide a macro which converts |\@fs@iftopcapt| (which
4160 % is part of a float style and controls where the caption will be typeset,
4161 % above or below the float contents) to our |position=| setting. Since the
4162 % spacing above and below the caption will be done by the float style and
4163 % \emph{not} by us this sounds quite useless. But in fact it isn't, since some
4164 % packages based on the \package{caption} package (like the \package{subfig}
4165 % package) could have an interest for this information and therefore use the
4166 % |\caption@iftop| macro we provide in our kernel. Furthermore we need this
4167 % information for ourself in |\captionof| which uses |\@makecaption| to
4168 % finally typeset the caption with skips.
4169 % \begin{macrocode}
4170 \def\caption@setfloatposition{%
4171 \caption@setposition{\@fs@iftopcapt t\else b\fi}}
4172 % \end{macrocode}
4173 % \end{macro}
4174 %
4175 % \begin{macrocode}
4176 \caption@ifpackage{float}{@float@setevery}{%
4177 \caption@Info{float package v1.3 (or newer) detected}%
4178 % \end{macrocode}
4179 %
4180 % Since |\float@caption| puts the float contents into a savebox we need
4181 % a special version of |\captionof| which `unfolds' this box afterwards,
4182 % so the caption actually gets typeset. Furthermore we have to typeset
4183 % the spacing above and below the caption for ourself, since this space is
4184 % not part of the box.
4185 %
4186 % Please note that this version of |\captionof| only works \emph{outside}
4187 % floating environments defined with the float package, so for example
4188 % a |\captionof{Program}| used within a `standard' |figure| or a
4189 % |minipage| will work fine, but not within a re-styled |figure| or
4190 % an |Example| environment defined with |\newfloat|.
4191 % (We don't check for this so you'll get wired errors if you try to do so!)
4192 %
4193 % \begin{macro}{\caption@of@float}
4194 % Usually no special action is necessary, so we define |\caption@of@float|
4195 % to |\@gobble|. We will redefine it later on to |\@firstofone| to activate
4196 % the code which `unfolds' the savebox.
4197 % \begin{macrocode}
4198 \let\caption@of@float\@gobble
4199 % \end{macrocode}
4200 % \end{macro}
4201 %
4202 % \begin{macro}{\caption@of}
4203 % If the float is defined by the float package (which means |\fst@|\meta{type}
4204 % is defined) we activate the special treatment for such captions typeset
4205 % with |\captionof|. Furthermore we `execute' this float style, so
4206 % |\@fs@iftopcapt| is set to its proper value.
4207 % \begin{macrocode}
4208 \renewcommand*\caption@of[2]{%
4209 \@ifundefined{fst@#2}{}{%
4210 \let\caption@of@float\@firstofone
4211 \@nameuse{fst@#2}\@float@setevery{#2}}%
4212 \def\@captype{#2}#1}%
4213 % \end{macrocode}
4214 % \end{macro}
4215 %
4216 % \begin{macro}{\float@caption}
4217 % \changes{v3.0h}{2005/08/23}{Bugfix 05-08-12: \cs{captionof} sets hyperref anchor now}
4218 % Our version of |\float@caption| nearly looks like our version of |\@caption|.
4219 % The main differences are that |\@fs@capt| will be replaced by our |\caption@@make|
4220 % and that the savebox called |\@floatcapt| will be unfolded if requested by
4221 % |\captionof|. (see above)
4222 % \begin{macrocode}
4223 \let\caption@@float\float@caption
4224 \long\def\float@caption#1[#2]#3{%
4225 \caption@beginex{#1}{#2}{#3}%
4226 \let\@fs@capt\caption@@make
4227 \caption@@float{#1}[{#2}]{#3}%
4228 % \end{macrocode}
4229 %
4230 % \begin{macrocode}
4231 \caption@of@float{%
4232 % \end{macrocode}
4233 % If the \package{hyperref} package is loaded, we need to set the appropriate
4234 % anchor for ourself. To do so without adding extra vertical space we need
4235 % to save (and restore) |\prevdepth| and switch off the interline skip.
4236 % \begin{macrocode}
4237 \@ifundefined{hyper@@anchor}{}{%
4238 \begingroup
4239 \@tempdima\prevdepth
4240 \nointerlineskip
4241 \let\leavevmode\relax
4242 \hyper@@anchor\@currentHref\relax
4243 \prevdepth\@tempdima
4244 \endgroup}%
4245 % \end{macrocode}
4246 %
4247 % \begin{macrocode}
4248 \def\caption@@make##1##2{\unvbox\@floatcapt}%
4249 \@makecaption{}{}}%
4250 % \end{macrocode}
4251 %
4252 % \begin{macrocode}
4253 \caption@end}%
4254 % \end{macrocode}
4255 % \end{macro}
4256 %
4257 % \begin{macro}{\@float@setevery}
4258 % |\@float@setevery|\marg{float type} is provided by the \package{float} package;
4259 % it's called every time a floating environment defined with |\newfloat| or
4260 % |\restylefloat| begins.
4261 % We use this hook to do some adaptations and to setup the proper caption style
4262 % (if defined) and additional settings declared with
4263 % |\captionsetup|\oarg{float style}.
4264 % \begin{macrocode}
4265 \let\caption@float@setevery\@float@setevery
4266 \def\@float@setevery#1{%
4267 % \end{macrocode}
4268 %
4269 % \LaTeX{} and most packages use |\|\meta{type}|name|
4270 % to provide a macro for the float name -- for example the command
4271 % |\figurename| will usually contain the name of the floating environment
4272 % |figure|:
4273 % \begin{quote}
4274 % |\newcommand\figurename{Figure}|
4275 % \end{quote}
4276 %
4277 % But the \package{float} package don't follow this naming convention,
4278 % it uses |\fname@|\meta{type} instead. So we have to adapt
4279 % |\caption@floatname| here, so our captions will be still ok.
4280 %
4281 % \begin{macrocode}
4282 \def\caption@floatname##1{\@nameuse{fname@#1}}%
4283 \def\caption@setfloatname##1{\@namedef{fname@#1}}%
4284 % \end{macrocode}
4285 %
4286 % Both |\newfloat| and |\restylefloat| save the \emph{actual} definition of
4287 % |\@caption| or |\float@caption| in |\@float@c@|\meta{captype} with |\let|
4288 % (instead of using |\def|), so redefinitions of |\@caption| (and of course
4289 % our redefinition of |\float@caption|) will never been used if the
4290 % |\newfloat| or |\restylefloat| command takes place in front of the
4291 % redefinitions provided by the \package{caption} or other packages like the
4292 % \package{hyperref} package.
4293 %
4294 % So here we determine if the user has used |\restylefloat| or
4295 % |\restylefloat*| and bring |\@float@c@|\meta{captype} up-to-date.
4296 % This is quite easy: If |\@float@c@|\meta{captype} is the same as the
4297 % original or our own definition of |\float@caption|, the user has used
4298 % |\restylefloat| (and |\float@caption| should be used), otherwise
4299 % we assume he has used |\restylefloat*| (and |\@caption| should be used).
4300 % (This test will fail if some other package re-defines |\float@caption|,
4301 % too, so we have to assume that we are the only one.)
4302 %
4303 % \begin{macrocode}
4304 \expandafter\let\expandafter\caption@tempa\csname @float@c@#1\endcsname
4305 \ifx\caption@tempa\float@caption
4306 \else\ifx\caption@tempa\@caption
4307 \else\ifx\caption@tempa\caption@@float
4308 \caption@Info{\protect\@float@c@#1\space := \protect\float@caption}%
4309 \expandafter\let\csname @float@c@#1\endcsname\float@caption
4310 \else
4311 \caption@Info{\protect\@float@c@#1\space := \protect\@caption}%
4312 \expandafter\let\csname @float@c@#1\endcsname\@caption
4313 \fi\fi\fi
4314 % \end{macrocode}
4315 %
4316 % If the floating environment is defined with |\newfloat| or |\restylefloat|
4317 % (and \emph{not} with |\restylefloat*|), |\@float@c@|\meta{type}
4318 % will now be identical to |\float@caption|.
4319 %
4320 % \begin{macrocode}
4321 \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
4322 % \end{macrocode}
4323 %
4324 % First of all we set the caption position to it's proper value.
4325 % (See above definition of |\caption@setfloatposition|)
4326 %
4327 % \begin{macrocode}
4328 \caption@setfloatposition
4329 % \end{macrocode}
4330 %
4331 % Now we'll have to determine the current float style.
4332 % This is not so easy because the only hint provided by the \package{float}
4333 % package is the macro |\fst@|\meta{float type} which points to the macro
4334 % which represents the float style.
4335 % So for example after
4336 % \begin{quote}
4337 % |\floatstyle{ruled}|\\
4338 % |\newfloat{Program}{tbp}{lop}|
4339 % \end{quote}
4340 % |\fst@Program| will be defined as
4341 % \begin{quote}
4342 % |\def\fst@Program{\fs@ruled}|\quad.
4343 % \end{quote}
4344 %
4345 % So here is what we do: We copy |\fst@|\meta{float type} to |\caption@fst| and
4346 % make it a string so we can gobble the first four tokens (= |\fs@|), so only the
4347 % the name of the float style is left.
4348 %
4349 % \begin{macrocode}
4350 \expandafter\let\expandafter\caption@fst\csname fst@#1\endcsname
4351 \edef\caption@fst{\noexpand\string\expandafter\noexpand\caption@fst}%
4352 \edef\caption@fst{\noexpand\@gobblefour\caption@fst}%
4353 % \edef\caption@fst{\caption@fst}%
4354 % \end{macrocode}
4355 %
4356 % |\caption@fst| now contains the float style (e.g. `ruled')
4357 % so we can use it to set the corresponding style (if defined) and additional options.
4358 %
4359 % \begin{macrocode}
4360 \caption@setstyle*\caption@fst
4361 \caption@settype\caption@fst
4362 % \end{macrocode}
4363 %
4364 % \begin{macrocode}
4365 \fi
4366 % \end{macrocode}
4367 %
4368 % \begin{macrocode}
4369 \caption@float@setevery{#1}}%
4370 % \end{macrocode}
4371 % \end{macro}
4372 %
4373 % \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
4374 %
4375 % \begin{macro}{\fs@plaintop}
4376 % \begin{macro}{\fs@boxed}
4377 % The float styles |plaintop| and |boxed| don't use our skip which can be set
4378 % with |skip=| : |plaintop| uses |\belowcaptionskip| instead of
4379 % |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|.
4380 % So we patch the according float style macros here to change this.
4381 % \begin{macrocode}
4382 \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
4383 \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
4384 % \end{macrocode}
4385 % \end{macro}
4386 % \end{macro}
4387 %
4388 % \begin{macrocode}
4389 }
4390 % \end{macrocode}
4391 %
4392 % The skip between `boxed' floats and their caption defaults to |2pt|.
4393 %
4394 % \begin{macrocode}
4395 \captionsetup[boxed]{skip=2pt}
4396 % \end{macrocode}
4397 %
4398 % \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
4399 % \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
4400 % To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
4401 % `ruled' with appropriate options. But if the package option |ruled| was
4402 % specified, we setup some caption parameters to emulate the behaviour
4403 % of the \package{caption} package \version{1.x} option |ruled| instead:
4404 % The current caption settings will be used, but without margin and without
4405 % `single-line-check'.
4406 % \begin{macrocode}
4407 \caption@ifbool{ruled}{%
4408 \captionsetup[ruled]{margin=0pt,singlelinecheck=0}%
4409 }{%
4410 \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
4411 }
4412 \caption@undefbool{ruled}
4413 % \end{macrocode}
4414 %
4415 % \subsubsection*{\package{floatrow} package support}
4416 % \changes{v3.0f}{2005/06/01}{Support of the \package{floatrow} package added}
4417 %
4418 % The \package{floatrow} package is already adapted for usage with the
4419 % \package{caption} package. So the main work has already been done by
4420 % Mrs.Lapko, there are only two little things we have to take care about:
4421 %
4422 % \begin{macrocode}
4423 \caption@ifpackage{floatrow}{flrow@setlist}{%
4424 \caption@Info{floatrow package v0.1f (or newer) detected}%
4425 % \end{macrocode}
4426 %
4427 % \begin{macro}{\caption@of}
4428 % Captions typeset with |\captionof| should have the correct layout,
4429 % so we have to `activate' this layout here with |\flrow@setlist|.
4430 % \par{\small (Please note that this version of |\captionof| has the same
4431 % restrictions than the |\captionof| offered for floating environments
4432 % defined with the \package{float} package, see above.)}
4433 % \begin{macrocode}
4434 \renewcommand*\caption@of[2]{%
4435 \def\@captype{#2}\flrow@setlist{{#2}}#1}%
4436 % \end{macrocode}
4437 % \end{macro}
4438 %
4439 % \begin{macro}{\caption@floatname}
4440 % The \package{floatrow} package follows the same naming convention
4441 % as the \package{float} package; so we have to adapt |\caption@floatname|
4442 % here, too.
4443 % \begin{macrocode}
4444 \renewcommand*\caption@floatname[1]{%
4445 \@nameuse{\@ifundefined{fname@#1}{#1name}{fname@#1}}}%
4446 \renewcommand*\caption@setfloatname[1]{%
4447 \@namedef{\@ifundefined{fname@#1}{#1name}{fname@#1}}}%
4448 % \end{macrocode}
4449 % \end{macro}
4450 %
4451 % \begin{macrocode}
4452 }
4453 % \end{macrocode}
4454 %
4455 % \subsubsection*{\package{hyperref} package support}
4456 % \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
4457 %
4458 % When the \package{hyperref} package is used we have the problem
4459 % that the usage of |\ContinuedFloat| will create duplicate
4460 % hyperlinks -- both |\@currentHlabel| and |\@currentHref| will be the same
4461 % for the main float and the continued ones. So we have to make sure
4462 % unique labels and references will be created each time. We do this
4463 % by extending |\theHfigure| and |\theHtable|, so for continued floats
4464 % the scheme
4465 % \begin{quote}\meta{type}|.|\meta{type \#}|.|\meta{continue \#}\end{quote}
4466 % will be used instead of
4467 % \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
4468 % \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
4469 % \par{\small Note: This does not help if |\Hy@naturalnamestrue| is set.}
4470 %
4471 % \begin{macrocode}
4472 \caption@ifpackage{hyperref}{theHfigure}{%
4473 \caption@Info{hyperref package v6.74m (or newer) detected}%
4474 % \end{macrocode}
4475 %
4476 % \begin{macro}{\caption@ContinuedFloat}
4477 % \changes{v3.0g}{2005/06/28}{Bugfix: \cs{newcounter} replaced by \cs{newcount}}
4478 % \changes{v3.0p}{2007/04/08}{\cs{newcount} replaced by \cs{caption@newcounter}}
4479 % If |\theH|\meta{type} is defined, we extend it with |.|\meta{continue \#}.
4480 % Furthermore we set |\caption@resetContinuedFloat| to |\@gobble| so the
4481 % continuation counter will not be reset to zero inside |\caption|.
4482 % \begin{macrocode}
4483 \def\caption@ContinuedFloat#1{%
4484 \@ifundefined{theH#1}{}{%
4485 \@ifundefined{CF@#1}{%
4486 \expandafter\caption@newcounter\csname CF@#1\endcsname
4487 \caption@resetContinuedFloat{#1}}{}%
4488 \expandafter\caption@stepcounter\csname CF@#1\endcsname
4489 \expandafter\l@addto@macro\csname theH#1\endcsname{%
4490 .\csname CF@#1\endcsname}%
4491 \let\caption@resetContinuedFloat\@gobble
4492 }}%
4493 % \end{macrocode}
4494 % \end{macro}
4495 %
4496 % \begin{macro}{\caption@resetContinuedFloat}
4497 % If a continuation counter is defined, we reset it.
4498 % \begin{macrocode}
4499 \def\caption@resetContinuedFloat#1{%
4500 \@ifundefined{CF@#1}{}{%
4501 \expandafter\caption@setcounter\csname CF@#1\endcsname0}}%
4502 % \end{macrocode}
4503 % \end{macro}
4504 %
4505 % \begin{macrocode}
4506 }
4507 % \end{macrocode}
4508 %
4509 % \subsubsection*{\package{hypcap} package support}
4510 % \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
4511 % \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} v1.6}
4512 % \changes{v3.0p}{2007/04/09}{Adapted to \package{hypcap} v1.7}
4513 %
4514 % When the \package{hypcap} package is used the following problems occur:
4515 % \begin{enumerate}
4516 % \item The \package{hypcap} package uses |\capstart|, |\hc@caption|, and
4517 % |\hc@@caption| instead of |\caption| and |\@caption|.\footnote{This issue
4518 % was fixed in \package{hypcap} \version{1.7}}
4519 % So we have to patch these macros, too.
4520 % \item |\caption| will be saved to |\hc@org@caption| when the
4521 % \package{hypcap} package is loaded.
4522 % We have to change this so our definition of |\caption| will always be
4523 % used.
4524 % \item Both, |\capstart| and |\hc@@caption|, call |\hyper@makecurrent|.
4525 % But since we offer |\ContinuedFloat| the float counters could have changed
4526 % between these both calls! So we fix this by saving the \package{hyperref}
4527 % reference (= |\@currentHref|) in |\capstart| and restoring it later on in
4528 % |\hc@@caption|.
4529 % \par{\small (This also fixes the problem that \package{hypcap} does not
4530 % work if |\Hy@hypertexnamesfalse| is set.\footnote{This issue was fixed
4531 % in \package{hypcap} \version{1.6}} This come in handy; we set
4532 % it locally to avoid duplicated \package{hyperref} labels which could
4533 % occur if |\ContinuedFloat| will be used.)}
4534 % \item |\capstart| will call |\H@refstepcounter| to increase the float
4535 % number. This collides with a following |\ContinuedFloat|, too, so we have
4536 % to move this call from here to |\caption|. (Since we set
4537 % |\Hy@hypertexnamesfalse| we can do this without problems.)
4538 % \end{enumerate}
4539 %
4540 % \begin{macrocode}
4541 \caption@ifpackage{hypcap}{hc@caption}{%
4542 \caption@Info{hypcap package v1.0 (or newer) detected}%
4543 % \end{macrocode}
4544 %
4545 % \begin{macro}{\capstart}
4546 % \changes{v3.0l}{2007/02/20}{\cs{caption@currentHref} renamed to \cs{hc@currentHref}}
4547 % Here comes our version of |\capstart|:
4548 % \begin{macrocode}
4549 \let\caption@capstart\capstart
4550 \def\capstart{%
4551 % \end{macrocode}
4552 % First of all we update |\hc@org@caption| to correct the problem that the
4553 % \package{hypcap} package has saved an older definition of |\caption|.
4554 % \begin{macrocode}
4555 \let\hc@org@caption\caption
4556 % \end{macrocode}
4557 % Since we don't know the float counter yet (it could be changed with
4558 % |\ContinuedFloat| afterwards!) we make sure |\H@refstepcounter| will
4559 % not be used and |\Hy@hypertexnamesfalse| is set, so unique
4560 % \package{hyperref} labels will be generated by the original
4561 % definition of |\capstart|.
4562 % Afterwards we save the reference which was generated by
4563 % |\hyper@makecurrent|.
4564 % \begin{macrocode}
4565 \begingroup
4566 \let\H@refstepcounter\@gobble
4567 \Hy@hypertexnamesfalse
4568 \caption@capstart
4569 \@ifundefined{hc@hyperref}{}{% hypcap v1.7
4570 \global\advance\csname c@\@captype\endcsname\@ne}%
4571 \global\let\hc@currentHref\@currentHref
4572 \endgroup
4573 % \end{macrocode}
4574 %
4575 % The \package{hypcap} package restores the previous definition of |\caption|
4576 % inside |\hc@@caption|. But since we will call this inside a group later on
4577 % (making this restauration non-working), we have to make this for ourself
4578 % inside |\caption|.
4579 % (This would not be necessary if \package{hypcap} would do this inside
4580 % |\hc@caption| instead of |\hc@@caption|.)\par
4581 % Additionally we increase the float counter here (since we have suppressed this
4582 % in |\capstart|) and use |\caption@caption| here, so |\caption*| will work as
4583 % expected.
4584 % (This is surrounded by |\hc@hyperref| so it does not make any harm when used
4585 % with \package{hypcap} \version{1.7}.)
4586 % \begin{macrocode}
4587 \@ifundefined{hc@hyperref}%
4588 {\let\next\@firstofone}{\let\next\hc@hyperref}% hypcap v1.7
4589 \next{\def\caption{%
4590 \let\caption\hc@org@caption
4591 \H@refstepcounter\@captype
4592 \@ifundefined{hc@hyperref}{}{% hypcap v1.7
4593 \global\advance\csname c@\@captype\endcsname\m@ne}%
4594 \caption@caption\hc@caption}}%
4595 % \end{macrocode}
4596 % \begin{macrocode}
4597 }%
4598 % \end{macrocode}
4599 % \end{macro}
4600 %
4601 % \begin{macro}{\hc@@caption}
4602 % Here comes our version of |\hc@@caption|:
4603 % \begin{macrocode}
4604 \let\caption@hc@@caption\hc@@caption
4605 \long\def\hc@@caption#1[#2]#3{%
4606 \caption@beginex{#1}{#2}{#3}%
4607 % \end{macrocode}
4608 %
4609 % Beside the usual |\caption@begin| and |\caption@end| stuff (to support local
4610 % options etc.) we make sure our saved \package{hyperref} reference will be
4611 % used.
4612 % \begin{macrocode}
4613 \let\caption@hyper@makecurrent\hyper@makecurrent
4614 \def\hyper@makecurrent\@captype{%
4615 \let\hyper@makecurrent\caption@hyper@makecurrent
4616 \global\let\@currentHref\hc@currentHref}%
4617 % \end{macrocode}
4618 %
4619 % \begin{macrocode}
4620 \caption@hc@@caption{#1}[{#2}]{#3}%
4621 \caption@end}%
4622 % \end{macrocode}
4623 % \end{macro}
4624 %
4625 % \begin{macrocode}
4626 }
4627 % \end{macrocode}
4628 %
4629 % \subsubsection*{\package{listings} package support}
4630 % \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
4631 %
4632 % \begin{macrocode}
4633 \caption@ifpackage{listings}{lst@MakeCaption}{%
4634 \caption@Info{listings package v1.2 (or newer) detected}%
4635 % \end{macrocode}
4636 %
4637 % \begin{macro}{\lst@MakeCaption}
4638 % To support the \package{listings} package we need to redefine
4639 % |\lst@MakeCaption| so the original stuff is nested with
4640 % |\caption@begin| and |\caption@end|.
4641 % \begin{macrocode}
4642 \let\caption@lst@MakeCaption\lst@MakeCaption
4643 \def\lst@MakeCaption#1{%
4644 % \end{macrocode}
4645 %
4646 % If the |position=| is set to |auto|, we take over the |captionpos=| setting
4647 % from the \package{listings} package.
4648 % Note that we won't do this otherwise, so \package{listings} settings like
4649 % |abovecaptionskip=0pt,belowcaptionskip=10pt,captionpos=t| will \emph{not}
4650 % cause different outputs with or without the \package{caption} package loaded.
4651 % \begin{macrocode}
4652 \def\caption@autoposition{\caption@setposition{#1}}%
4653 % \end{macrocode}
4654 %
4655 % \begin{macrocode}
4656 \caption@begin{lstlisting}%
4657 \caption@lst@MakeCaption{#1}%
4658 \caption@end}%
4659 % \end{macrocode}
4660 % \end{macro}
4661 %
4662 % \begin{macrocode}
4663 }
4664 % \end{macrocode}
4665 %
4666 % \subsubsection*{\package{longtable} package support}
4667 %
4668 % \begin{macrocode}
4669 \caption@ifpackage{longtable}{LT@makecaption}{%
4670 \caption@Info{longtable package v3.15 (or newer) detected}%
4671 % \end{macrocode}
4672 %
4673 % \begin{macro}{\LT@makecaption}
4674 % \changes{v3.0d}{2004/08/10}{Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
4675 % \changes{v3.0e}{2005/05/05}{Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
4676 % \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
4677 % |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
4678 % Original code:
4679 % \begin{verbatim}
4680 % \def\LT@makecaption#1#2#3{%
4681 % \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
4682 % % Based on article class "\@makecaption", "#1" is "\@gobble" in star
4683 % % form, and "\@firstofone" otherwise.
4684 % \sbox\@tempboxa{#1{#2: }#3}%
4685 % \ifdim\wd\@tempboxa>\hsize
4686 % #1{#2: }#3%
4687 % \else
4688 % \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
4689 % \fi
4690 % \endgraf\vskip\baselineskip}%
4691 % \hss}}}
4692 % \end{verbatim}
4693 % \begin{macrocode}
4694 \def\LT@makecaption#1#2#3{%
4695 \caption@LT@make{%
4696 % \end{macrocode}
4697 %
4698 % We set |\ifcaption@star| according the 1st argument.
4699 % \begin{macrocode}
4700 \caption@startrue#1\caption@starfalse
4701 % \end{macrocode}
4702 %
4703 % If |\LTcapwidth| is not set to its default value |4in| we assume
4704 % that it shall overwrite our own setting.
4705 % (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
4706 % \begin{macrocode}
4707 \caption@letfloattype{longtable}{%
4708 \ifdim\LTcapwidth=4in \else
4709 \setcaptionwidth\LTcapwidth
4710 \fi}%
4711 % \end{macrocode}
4712 %
4713 % The default |position=| setting for longtables is |top|.
4714 % (This emulates the standard behaviour of the \package{longtable} package
4715 % which has no skip above the caption but a skip below it.)
4716 % \begin{macrocode}
4717 % \caption@setdefaultpos{t}%
4718 \let\caption@defaultpos\@firstoftwo
4719 % \end{macrocode}
4720 %
4721 % |position=auto| is a bad idea for longtables, but we do our very best.
4722 % This works quite well for captions inside the longtable contents, but
4723 % not for captions inside the longtable (end)foot.
4724 % \begin{macrocode}
4725 \def\caption@autoposition{%
4726 \caption@setposition{\ifcase\LT@rows t\else b\fi}}%
4727 % \end{macrocode}
4728 %
4729 % \begin{macrocode}
4730 \caption@begin{table}%
4731 % \end{macrocode}
4732 %
4733 % The following skip has the purpose to correct the height of the
4734 % |\parbox[t]|. Usually it's the height of the very first line, but
4735 % because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
4736 % it's always |0pt|.
4737 % (A different idea would be typesetting the first skip outside the longtable
4738 % column with |\noalign{\vskip|\ldots|}|, but this means we have to move
4739 % |\caption@begin| to some other place because it does not work in tabular
4740 % mode\ldots)
4741 % \begin{macrocode}
4742 \vskip-\ht\strutbox
4743 % \end{macrocode}
4744 %
4745 % This should look familiar. We do our skips and use |\caption@@make| to
4746 % typeset the caption itself.
4747 % \begin{macrocode}
4748 \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
4749 \caption@@make{#2}{#3}\endgraf
4750 \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}%
4751 \caption@end}}%
4752 % \end{macrocode}
4753 % \end{macro}
4754 %
4755 % \begin{macro}{\caption@LT@make}
4756 % Typesets the caption as centered |\multicolumn|\ldots
4757 % \begin{macrocode}
4758 \newcommand\caption@LT@make[1]{%
4759 \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{#1}\hss}}}%
4760 % \end{macrocode}
4761 % \end{macro}
4762 %
4763 % \begin{macrocode}
4764 }
4765 % \end{macrocode}
4766 %
4767 % \subsubsection*{\package{picins} package support}
4768 % \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
4769 %
4770 % \begin{macrocode}
4771 \caption@ifpackage{picins}{piccaption}{%
4772 \caption@Info{picins package v3.0 (or newer) detected}%
4773 % \end{macrocode}
4774 %
4775 % \begin{macro}{\piccaption}
4776 % Original code:
4777 % \begin{verbatim}
4778 % \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
4779 % \end{verbatim}
4780 % \begin{macrocode}
4781 \def\piccaption{\@dblarg\@piccaption}
4782 % \def\piccaption{\caption@caption{\@dblarg\@piccaption}}
4783 % \end{macrocode}
4784 % \end{macro}
4785 %
4786 % {\itshape TODO: Make |\piccaption[]{|\ldots|}| and |\piccaption{}| work}
4787 %
4788 % \begin{macrocode}
4789 }
4790 % \end{macrocode}
4791 %
4792 % \subsubsection*{\package{rotating} package support}
4793 %
4794 % \begin{macrocode}
4795 \caption@ifpackage{rotating}{@rotcaption}{%
4796 \caption@Info{rotating package v2.0 (or newer) detected}%
4797 % \end{macrocode}
4798 %
4799 % \begin{macro}{\rotcaption}
4800 % \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@caption} removed}
4801 % \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
4802 % Make |\rotcaption*| work.
4803 % \begin{macrocode}
4804 \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
4805 % \let\@rotcaption\@undefined
4806 % \end{macrocode}
4807 % \end{macro}
4808 %
4809 % \begin{macro}{\rotcaptionof}
4810 % \changes{v3.0i}{2005/12/07}{New}
4811 % Make |\rotcaptionof(*)| work.
4812 % \begin{macrocode}
4813 \def\rotcaptionof{%
4814 \@ifstar{\caption@of{\rotcaption*}}{\caption@of\rotcaption}}%
4815 % \end{macrocode}
4816 % \end{macro}
4817 %
4818 % \begin{macro}{\@makerotcaption}
4819 % \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
4820 % \changes{v3.0m}{2007/03/04}{Uses \cs{captionbox} instead of \cs{caption@start/endbox} now}
4821 % Original (bugfixed) code:
4822 % \begin{verbatim}
4823 % \long\def\@makerotcaption#1#2{%
4824 % \setbox\@tempboxa\hbox{#1: #2}%
4825 % \ifdim \wd\@tempboxa > .8\vsize
4826 % \rotatebox{90}{%
4827 % \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
4828 % }%\par % <== \par removed (AR)
4829 % \else%
4830 % \rotatebox{90}{\box\@tempboxa}%
4831 % \fi
4832 % \nobreak\hspace{12pt}% <== \nobreak added (AR)
4833 % }
4834 % \end{verbatim}
4835 % Our version emulates this behaviour, but if |width=| is set,
4836 % the rotated caption is always typeset as |minipage|.
4837 % (Note that |margin=| is not supported here.)
4838 % \begin{macrocode}
4839 \long\def\@makerotcaption#1#2{%
4840 % \end{macrocode}
4841 %
4842 % \begin{macrocode}
4843 \ifdim\captionwidth=\z@
4844 \setcaptionwidth{.8\textheight}%
4845 \caption@slc{#1}{#2}{.8\vsize}{%
4846 \let\caption@makerot\caption@@make
4847 \setcaptionmargin\z@
4848 % \setlength\captionindent\z@
4849 % \long\def\captionbox##1##2{\hbox{\hsize=.8\textheight\relax##2}}%
4850 % (not needed because \rotatebox uses an \hbox anyway)
4851 \let\captionbox\@secondoftwo}%
4852 \caption@setbool{slc}{0}% been there, done that
4853 \fi
4854 % \end{macrocode}
4855 %
4856 % \begin{macrocode}
4857 \rotatebox{90}{\caption@makerot{#1}{#2}}%
4858 \nobreak\hspace{12pt}}%
4859 % \end{macrocode}
4860 %
4861 % \begin{macrocode}
4862 \newcommand\caption@makerot[2]{%
4863 \begin{minipage}\captionwidth\caption@@make{#1}{#2}\end{minipage}}%
4864 % \end{macrocode}
4865 % \end{macro}
4866 %
4867 % \begin{macrocode}
4868 }
4869 % \end{macrocode}
4870 %
4871 % \subsubsection*{\package{sidecap} package support}
4872 %
4873 % \begin{macrocode}
4874 \caption@ifpackage{sidecap}{endSC@FLOAT}{%
4875 \caption@Info{sidecap package v1.4d (or newer) detected}%
4876 % \end{macrocode}
4877 %
4878 % \begin{macro}{\SC@caption}
4879 % \changes{v3.0d}{2004/11/28}{Bugfix: Definition of \cs{@captype} added}
4880 % \changes{v3.0e}{2005/05/05}{Bugfix: Empty captions are handled correctly now}
4881 % \changes{v3.0e}{2005/05/05}{Priority of options fixed}
4882 % \changes{v3.0h}{2005/10/03}{Bugfix: Always use \cs{AtBeginDocument} to set \cs{SC@caption}}
4883 % First of all, we let sidecap use an actual definition of |\caption|.\\
4884 % (This is only required for version 1.5d of the sidecap package.)
4885 % \begin{macrocode}
4886 \@ifundefined{caption@caption}%
4887 {\let\caption@tempa\AtBeginDocument}%
4888 {\let\caption@tempa\@firstofone}%
4889 \caption@tempa{\let\SC@caption=\caption}%
4890 % \end{macrocode}
4891 % \end{macro}
4892 %
4893 % \begin{macro}{\SC@zfloat}
4894 % \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
4895 % \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@caption} removed}
4896 % \changes{v3.0r}{2022/07/10}{\cs{ignorespaces} appended}
4897 % This macro will be called at the start of the environment, here is a good
4898 % opportunity to do some adaptations to |\caption| and |\caption|\-|setup|.
4899 % \begin{macrocode}
4900 \let\caption@SC@zfloat\SC@zfloat
4901 \def\SC@zfloat#1#2#3[#4]{%
4902 % \end{macrocode}
4903 %
4904 % Note: |#2| is either |figure| or |table| and will be stored to |\SC@captype|
4905 % by the original version of |\SC@zfloat|.
4906 % \begin{macrocode}
4907 \caption@SC@zfloat{#1}{#2}{#3}[#4]%
4908 % \end{macrocode}
4909 %
4910 % Since the sidecap package uses our |\caption| code outside the
4911 % floating environment the regular |\caption|\-|setup| will not work.
4912 % So we need a special version here which saves the given argument list
4913 % which will be executed later on.
4914 % \begin{macrocode}
4915 \global\let\SC@CAPsetup\@empty
4916 \def\captionsetup##1{\g@addto@macro\SC@CAPsetup{,##1}}%
4917 % \end{macrocode}
4918 %
4919 % Make |\caption*| work.
4920 % \begin{macrocode}
4921 \let\caption@SC\caption
4922 % \def\caption{\renewcommand\captionsetup[1]{}\caption@caption\caption@SC}%
4923 \def\caption{\caption@caption\caption@SC}%
4924 % \end{macrocode}
4925 %
4926 % Since the original definition of |\SC@zfloat| ends with |\begin{lrbox}| which ends with |\ignore|\-|spaces|,
4927 % we do have to end our re-definition of |\SC@zfloat| with |\ignore|\-|spaces| as well.
4928 % \begin{macrocode}
4929 \ignorespaces}%
4930 % \end{macrocode}
4931 % \end{macro}
4932 %
4933 % \begin{macro}{\endSC@FLOAT}
4934 % \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
4935 % This macro will be called at the end of the environment, here we need to
4936 % setup our stuff before the \package{sidecap} package actually typesets
4937 % its caption.
4938 % \begin{macrocode}
4939 \let\caption@endSC@FLOAT\endSC@FLOAT
4940 \def\endSC@FLOAT{%
4941 % \end{macrocode}
4942 %
4943 % Note that |\@captype| isn't defined so far, this will be done inside
4944 % the original definition of |\endSC@FLOAT|.
4945 % But we define |\@captype| already here to make |\captionsetup| work
4946 % with |\@captype|-based options (like |type=|).
4947 % \begin{macrocode}
4948 \let\@captype\SC@captype
4949 % \end{macrocode}
4950 %
4951 % Here we execute the options set with |\captionsetup| inside this environment.
4952 % \begin{macrocode}
4953 \caption@esetup\SC@CAPsetup
4954 % \end{macrocode}
4955 %
4956 % Before we can typeset the caption we need to set the margin to zero
4957 % because any extra margin would only be disturbing here.\par
4958 % (We don't need to take care about the caption position because
4959 % the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
4960 % to a skip of zero anyway.)\par
4961 % Furthermore |\SC@justify| will override the caption justification, if set.
4962 % The usage of |\SC@justify| differs from version to version of the
4963 % \package{sidecap} package:\par
4964 % \begin{tabular}{ll}
4965 % Version 1.4: & |\SC@justify| is not defined\\
4966 % Version 1.5: & |\SC@justify| is |\relax| when not set\\
4967 % Version 1.6: & |\SC@justify| is |\@empty| when not set\\
4968 % \end{tabular}
4969 % \begin{macrocode}
4970 \caption@letfloattype{SC\@captype}{%
4971 \@listdepth\z@
4972 \setcaptionmargin\z@
4973 \@ifundefined{SC@justify}{}{%
4974 \ifx\SC@justify\@empty\else
4975 \let\caption@hj\SC@justify
4976 \let\SC@justify\@empty
4977 \fi}}%
4978 % \end{macrocode}
4979 %
4980 % We adapt |\caption@ifempty| so |\caption{}| will work within these
4981 % environments, too.
4982 % \begin{macrocode}
4983 \long\def\caption@ifempty##1{%
4984 \ifx\SC@CAPtext\@empty
4985 \expandafter\@firstofone
4986 \else
4987 \expandafter\@gobble
4988 \fi}%
4989 % \end{macrocode}
4990 %
4991 % \iffalse % Does not work anyway...
4992 % Furthermore we adapt |\caption@ifnocontentsline| so |\caption[]{|\ldots|}|
4993 % will work within these environments, too.
4994 % \begin{macrocode}
4995 % \long\def\caption@ifnocontentsline##1{%
4996 % \ifx\SC@OPTCAPtext\@empty
4997 % \expandafter\@firstofone
4998 % \else
4999 % \expandafter\@gobble
5000 % \fi}%
5001 % \end{macrocode}
5002 % \fi
5003 %
5004 % Finally we call the original definition of |\endSC@FLOAT| which will
5005 % call our version of |\caption| to typeset the caption.
5006 % \begin{macrocode}
5007 \caption@endSC@FLOAT}%
5008 % \end{macrocode}
5009 % \end{macro}
5010 %
5011 % \begin{macrocode}
5012 }
5013 % \end{macrocode}
5014 %
5015 % \subsubsection*{\package{supertabular} package support}
5016 %
5017 % \begin{macro}{\caption@setSTposition}
5018 % The |position=| setting will be overwritten by the
5019 % \package{supertabular} package: If |\topcaption| is used,
5020 % the position will be |top| automatically, |bottom| otherwise.
5021 % \begin{macrocode}
5022 \def\caption@setSTposition{%
5023 \caption@setposition{\if@topcaption t\else b\fi}}
5024 % \end{macrocode}
5025 % \end{macro}
5026 %
5027 % \begin{macrocode}
5028 \caption@ifpackage{supertabular}{ST@caption}{%
5029 \caption@Info{supertabular package detected}%
5030 % \end{macrocode}
5031 %
5032 % \begin{macro}{\tablecaption}
5033 % \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
5034 % Make |\topcaption*| and |\bottomcaption*| work.
5035 % \begin{macrocode}
5036 \let\caption@tablecaption\tablecaption
5037 \def\tablecaption{\caption@caption\caption@tablecaption}%
5038 % \end{macrocode}
5039 % \end{macro}
5040 %
5041 % \begin{macro}{\ST@caption}
5042 % \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
5043 % Original code:
5044 % \begin{verbatim}
5045 % \long\def\ST@caption#1[#2]#3{\par%
5046 % \addcontentsline{\csname ext@#1\endcsname}{#1}%
5047 % {\protect\numberline{%
5048 % \csname the#1\endcsname}{\ignorespaces #2}}
5049 % \begingroup
5050 % \@parboxrestore
5051 % \normalsize
5052 % \if@topcaption \vskip -10\p@ \fi
5053 % \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
5054 % \if@topcaption \vskip 10\p@ \fi
5055 % \endgroup}
5056 % \end{verbatim}
5057 % \begin{macrocode}
5058 \long\def\ST@caption#1[#2]#3{\par%
5059 \caption@letfloattype{supertabular}{}%
5060 \let\caption@fixposition\caption@setSTposition
5061 \caption@beginex{#1}{#2}{#3}%
5062 \addcontentsline{\csname ext@#1\endcsname}{#1}%
5063 {\protect\numberline{%
5064 \csname the#1\endcsname}{\ignorespaces #2}}%
5065 \@parboxrestore
5066 \normalsize
5067 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
5068 \caption@end}%
5069 % \end{macrocode}
5070 % \end{macro}
5071 %
5072 % \begin{macrocode}
5073 }
5074 % \end{macrocode}
5075 %
5076 % \iffalse
5077 %</package>
5078 % \fi
5079 %
5080 % \clearpage
5081 % \Finale
5082 %
5083 \endinput