summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/fallback
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/fallback')
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v1/caption.dtx489
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v2.0/caption2.dtx606
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v2.1/caption2.dtx1329
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.0/caption.dtx5077
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.1/caption.dtx7985
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.2/caption.dtx4521
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.2/caption3.dtx3668
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.3/caption.dtx4968
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.3/caption3.dtx4176
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.4/caption.dtx4538
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.4/caption3.dtx4231
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.5/caption.dtx4292
-rw-r--r--Master/texmf-dist/source/latex/caption/fallback/v3.5/caption3.dtx4680
13 files changed, 50560 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v1/caption.dtx b/Master/texmf-dist/source/latex/caption/fallback/v1/caption.dtx
new file mode 100644
index 00000000000..5d84d0cc957
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v1/caption.dtx
@@ -0,0 +1,489 @@
+% \iffalse
+% caption.dtx - The caption package
+% (c) 1994-95 Axel Sommerfeldt (axel@hp1.ang-physik.uni-kiel.de)
+%
+% --------------------------------------------------------------------------
+%
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.2
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.2 or later is part of all distributions of LaTeX
+% version 1999/12/01 or later.
+%
+%<*driver>
+\documentclass{ltxdoc}
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{\smallskipamount}
+\usepackage[hang,small,bf]{caption}[1995/01/30]
+\setlength{\captionmargin}{20pt}
+\begin{document}
+ \DocInput{caption.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \providecommand{\LaTeXcomp}{The \LaTeX{} Companion}
+% \newcommand{\purerm}[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand{\puresf}[1]{{\upshape\mdseries\sffamily #1}}
+% \newenvironment{Options}[1]%
+% {\begin{list}{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}%
+% \settowidth{\labelwidth}{\texttt{#1\space}}%
+% \setlength{\leftmargin}{\labelwidth}%
+% \addtolength{\leftmargin}{\labelsep}}}%
+% {\end{list}}
+%
+% \def\packageversion{1.4b}
+% \def\packagedate{1995/04/05}
+% \changes{v1.0}{27 Oct 94}{First release}
+% \changes{v1.2}{28 Nov 94}{Works now with the {\tt figure*} and {\tt table*} environments, too}
+%
+% \title{The \puresf{caption} package\thanks{This package has version number
+% \packageversion, last revised \packagedate.}}
+% \author{Axel Sommerfeldt\\\texttt{axel@hp1.ang-physik.uni-kiel.de}}
+% \date{1995/04/05}
+% \maketitle
+%
+% \begin{abstract}
+% The \textsf{caption} package provides many ways to customise the captions
+% in floating environments such |figure| and |table|.
+% The |\rotcaption| command and the |sidewaysfigure| and |sidewaystable|
+% environments provided by the \textsf{rotating} package from S.~Rahtz and
+% L.~Barroca are also supported.
+% The \textsf{caption} package also cooperates with the \textsf{float}
+% package written by A.~Lingnau and the \textsf{subfigure} package written by
+% S.D.~Cochran.
+% \end{abstract}
+%
+% \section{The user interface}
+% \changes{v1.1}{3 Nov 94}{New captiontype: {\tt centerlast}}
+% \changes{v1.4}{30 Jan 95}{New option: {\tt nooneline}}
+%
+% To use this package just type
+% \begin{quote}
+% |\usepackage|\oarg{options}|{caption}|
+% \end{quote}
+% in the preamble of your document,
+% where the following options are supported:
+% \begin{quote}\begin{Options}{scriptsize\purerm{, \ldots,\ }Large}
+% \item[normal]
+% provides `normal' captions, this is the default
+% \item[hang \purerm{or} isu]
+% provides captions with hanging indention
+% \item[center]
+% provides captions where each line is centered
+% \item[centerlast]
+% provides captions where the last line of the paragraph is centered
+% \item[nooneline]
+% if a caption fits on \emph{one} line on the page, it will be centered.
+% If you don't like this behaviour, just select this option.
+% \item[scriptsize\purerm{, \ldots,\ }Large]
+% sets the font size of the captions
+% \item[\vbox{\hbox{up{\rm,} it{\rm,} sl{\rm,} sc{\rm,}}
+% \hbox{md{\rm,} bf{\rm,} rm{\rm,} sf{\rm, or} tt}}]
+% sets the font attribute of the caption labels.
+% \item[ruled] supports ruled floats of the \textsf{float} package, see
+% section \ref{sec:float} for details
+% \end{Options}\end{quote}
+%
+% \changes{v1.4}{29 Jan 95}{{\tt\protect\bslash captionsize} changed to {\tt\protect\bslash captionfont}}
+% \DescribeMacro{\captionfont}
+% \DescribeMacro{\captionlabelfont}
+% To setup the font size and attributes of the captions, this package also provides
+% the commands |\captionfont| and |\captionlabelfont| to allow a more
+% flexible way to customize the captions than the above options could do.
+% |\captionfont| is called before each caption, |\captionlabelfont| is
+% called just before the label of the caption, so the whole caption
+% will be created as
+% \begin{quote}
+% |{\captionfont{\captionlabelfont |\meta{label}|: }|\meta{caption}|}| \quad.
+% \end{quote}
+% Note that these commands are used by the options, e.g.\ the options
+% |small| and |sf| are identical to
+% \begin{quote} |\renewcommand{\captionfont}{\small}| \quad and\\
+% |\renewcommand{\captionlabelfont}{\sffamily}| \quad. \end{quote}
+%
+% \DescribeMacro{\captionmargin}
+% Furthermore there is a new length |\captionmargin| to setup an extra left and
+% right margin for the captions, e.g.\ the command
+% \begin{quote} |\setlength{\captionmargin}{10pt}| \end{quote}
+% sets this margin to 10pt.
+%
+% \DescribeMacro{\abovecaptionskip}
+% \DescribeMacro{\belowcaptionskip}
+% The lengths |\abovecaptionskip| and |\belowcaptionskip| contain the amount of
+% white space to leave above and below the caption.
+% |\abovecaptionskip| is preset (in the \textsf{article}, \textsf{report} and
+% \textsf{book} document class) to 10pt, |\belowcaptionskip| to 0pt.
+%
+% \subsection{The \puresf{rotating}, \puresf{float} and \puresf{subfigure} package}
+% \changes{v1.2}{28 Nov 94}{Support of the {\sf float} package}
+% \label{sec:float}
+%
+% If you want to use this package together with the \textsf{rotating}\cite{rotating},
+% \textsf{float}\cite{float} and/or the \textsf{subfigure} package, you have to
+% input this package \emph{after} the other ones, like
+% \begin{quote}
+% |\usepackage{float,rotating,subfigure}|\\
+% |\usepackage[centerlast,small,sc]{caption}|
+% \end{quote}
+% The \textsf{caption} package now redefines the |sidewaysfigure| and
+% |sidewaystable| environments and the |\rotcaption| command provided
+% by the \textsf{rotating} package from S.~Rahtz and L.~Barroca.
+% Note that the |\captionmargin| does not affect the |\rotcaption| command.
+%
+% It also redefines the captions of the |plain| and |boxed| styled floats
+% provided by the \textsf{float} package from A.~Lingnau.
+% |ruled| floats are not supported by default, but you can change this via
+% setting the option |ruled|.
+% Note that the |\captionmargin| is not supported in ruled floats.
+%
+% \changes{v1.3}{8 Jan 95}{Support of {\tt\protect\bslash captionlabelfont} in subcaptions}
+% If the \textsf{subfigure} package from S.D.~Cochran is detected, the options
+% |scriptsize|, \ldots, |large| will redefine |\subcapsize| in an adequate way.
+% If you redefine |\captionfont| by yourself and use the \textsf{subfigure}
+% package, you also have to redefine |\subcapsize| by yourself.
+% Also the commands |\@thesubfigure| and |\@thesubtable| will be redefined to
+% use the |\captionlabelfont| command, please take this into consideration if
+% you redefine |\@thesubfigure| or |\@thesubtable| by yourself.
+% E.g.\ a adequate version of the second example in |subfigure.sty| will be:
+% \begin{verbatim}
+% \renewcommand{\thesubfigure}{\thefigure.\arabic{subfigure}}
+% \makeatletter
+% \renewcommand{\@thesubfigure}{{\captionlabelfont\thesubfigure:}\space}
+% \renewcommand{\p@subfigure}{}
+% \makeatother
+% ...
+% \end{verbatim}
+%
+% \changes{v1.4b}{5 Apr 95}{Adapted to version 2.8 of the rotating package}
+% This package cooperates with the version 2.8 (1995/04/02) of the
+% \textsf{rotating} package, version 1.2c (1995/03/29) of the \textsf{float}
+% package and version 1.6 (1993/05/13) of the \textsf{subfigure} package,
+% but will hopefully work with future versions, too.
+%
+% \section{Example}
+% Here's an example figure which was produced with the following code in the
+% preamble of this document:
+% \begin{quote}
+% |\usepackage[hang,small,bf]{caption}|\\
+% |\setlength{\captionmargin}{20pt}|
+% \end{quote}
+% \begin{figure}[!ht]
+% \centerline{EXAMPLE FIGURE}
+% \caption[Huba]{This is an example caption with a small font and a sans serif label.
+% The hang option was used. There is a left and right margin of 20pt.}
+% \end{figure}
+%
+% \StopEventually{
+% \begin{thebibliography}{9}
+% \bibitem{rotating}
+% Sebastian Rahtz and Leonor Barroca:
+% \emph{A style option for rotated objects in \LaTeX},
+% 1994/10/02
+% \bibitem{float}
+% Anselm Lingnau:
+% \emph{An Improved Environment for Floats},
+% 1995/03/25
+% \bibitem{A-W:GMS94}
+% Michel Goossens, Frank Mittelbach and Alexander Samarin:
+% \newblock {\em The {\LaTeX} Companion},
+% \newblock Addison-Wesley, Reading, Massachusetts, 1994.
+% \bibitem{Anne}
+% Anne Br\"uggemann-Klein:
+% \emph{Einf\"uhrung in die Dokumentverarbeitung},
+% B.G. Teubner, Stuttgart, 1989
+% \bibitem{Kopka-E}
+% Helmut Kopka:
+% \emph{\LaTeX -- Erweiterungsm\"oglichkeiten},
+% 3. \"uberarbeitete Auf\/lage, Addison-Wesley, Bonn, 1991
+% \end{thebibliography}
+% }
+% \setlength{\parskip}{0pt plus 1pt}
+%
+% \CheckSum{295}
+% \DoNotIndex{\\,\_,\ }
+% \DoNotIndex{\p@}
+% \DoNotIndex{\active,\addtolength,\begin,\bfseries}
+% \DoNotIndex{\catcode,\def,\else,\empty,\end,\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hspace,\ifcase,\ifdim,\ifx,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftskip,\let,\linewidth}
+% \DoNotIndex{\mdseries,\newcommand,\newlength,\newsavebox,\noindent,\normalsize}
+% \DoNotIndex{\or,\par,\parbox,\parfillskip,\renewcommand,\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setlength,\sffamily,\slshape,\small,\space}
+% \DoNotIndex{\textheight,\typeout,\ttfamily,\undefined,\upshape,\usebox}
+% \DoNotIndex{\vsize,\vskip,\wd}
+% \DoNotIndex{\AtBeginDocument,\DeclareOption,\ExecuteOptions,\NeedsTeXFormat}
+% \DoNotIndex{\ProcessOptions,\ProvidesPackage}
+%
+% \section{The code}
+% \iffalse
+%<*package>
+% \fi
+%
+% \subsection{Identification}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\ProvidesPackage{caption}[1995/04/05 v1.4b caption package (AS)]
+% \end{macrocode}
+%
+% \subsection{Initial code}
+% \begin{macro}{\captionfont}
+% \begin{macro}{\captionlabelfont}
+% \begin{macro}{\captionmargin}
+% |\captionsize| is defined for backward compatibility with v1.3
+% of this package.
+% \begin{macrocode}
+\newcommand{\captionsize}{}
+\newcommand{\captionfont}{\captionsize}
+\newcommand{\captionlabelfont}{}
+\newlength{\captionmargin}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% Here are the different basic types of captions implemented:
+% \begin{macro}{\as@normalcaption}
+% \changes{v1.4a}{12 Feb 95}{{\tt\protect\bslash par} added}
+% The `normal' caption
+% \begin{macrocode}
+\newcommand{\as@normalcaption}[2]{%
+ #1 #2\par}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\as@isucaption}
+% \changes{v1.4}{27 Jan 95}{{\tt\protect\bslash leavevmode} added}
+% The `iso' or `hang' caption;
+% this code was taken from \LaTeXcomp\cite[p155]{A-W:GMS94} and modified
+% \iffalse
+% \hangindent\wd\as@captionbox\noindent\usebox{\as@captionbox}#2}
+% \fi
+% \begin{macrocode}
+\newcommand{\as@isucaption}[2]{%
+ \sbox{\as@captionbox}{#1\space}%
+ \addtolength{\as@captionwidth}{-\wd\as@captionbox}%
+ \usebox{\as@captionbox}\parbox[t]{\as@captionwidth}{\leavevmode#2}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\as@centercaption}
+% \changes{v1.4a}{12 Feb 95}{{\tt center} environment changed to {\tt\protect\bslash centering}}
+% The `center' caption
+% \begin{macrocode}
+\newcommand{\as@centercaption}[2]{%
+ \parbox[t]{\as@captionwidth}{{\centering#1 #2\par}}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\as@annecaption}
+% \changes{v1.4a}{12 Feb 95}{{\tt\protect\bslash par} added}
+% The `centerlast' caption; the idea how to do this was taken from Br\"uggemann-Klein\cite{Anne},
+% it is also mentioned in Kopka\cite[p227]{Kopka-E}
+% \begin{macrocode}
+\newcommand{\as@annecaption}[2]{%
+ \addtolength{\leftskip}{0pt plus 1fil}%
+ \addtolength{\rightskip}{0pt plus -1fil}%
+ \setlength{\parfillskip}{0pt plus 2fil}%
+ #1 #2\par}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\as@shortcaption}
+% Short captions are centered by default
+% \begin{macrocode}
+\let\as@shortcaption\as@centercaption
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Detection of the \puresf{subfigure} package}
+% \begin{macro}{\as@subcapsize}
+% \begin{macro}{\@thesubfigure}
+% \begin{macro}{\@thesubtable}
+% If the \textsf{subfigure} package is loaded, a little message will be typeout
+% and |\as@subcapsize| -- which sets the size of the subcaptions -- will be
+% defined. Also |\@thesubfigure| and |\@thesubtable| will be redefined here to
+% support the |\captionlabelfont| in subcaptions, too (thanks to Kevin Ruland for
+% this idea!).
+% If you don't like this behaviour, just load the |caption| package \emph{after}
+% the |subfigure| package (and eventually redefine the |\subcapsize| by yourself)
+% or redefine |\@thesubfigure| and |\@thesubtable| after loading the |caption|
+% package as shown in the documentation of the \textsf{subfigure} package.
+% \begin{macrocode}
+\ifx\thesubfigure\undefined
+ \newcommand{\as@subcapsize}[1]{}
+\else%
+ \typeout{\space\space\space\space\space\space\space\space\space
+ `subfigure' package detected}
+ \let\as@subcapsize\subcapsize
+ \renewcommand{\@thesubfigure}{{\captionlabelfont\thesubfigure}\space}
+ \renewcommand{\@thesubtable}{{\captionlabelfont\thesubtable}\space}
+\fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Declaration of options}
+% There are four different types of captions supported: |normal|,
+% |isu|, |center| and |centerlast|. |hang| is exactly the same as |isu|.
+% \begin{macrocode}
+\DeclareOption{normal}{\let\as@caption\as@normalcaption}
+\DeclareOption{isu}{\let\as@caption\as@isucaption}
+\DeclareOption{hang}{\ExecuteOptions{isu}}
+\DeclareOption{center}{\let\as@caption\as@centercaption}
+\DeclareOption{anne}{\let\as@caption\as@annecaption}
+\DeclareOption{centerlast}{\ExecuteOptions{anne}}
+% \end{macrocode}
+% If option |nooneline| is set, only-one-line captions will behave like normal
+% ones.
+% \begin{macrocode}
+\DeclareOption{nooneline}{\AtBeginDocument{\let\as@shortcaption\as@caption}}
+% \end{macrocode}
+% There are options for six different font sizes available, they also
+% redefine the |\subcapsize| provided by the \textsf{subfigure} package
+% (if detected).
+% \begin{macrocode}
+\DeclareOption{scriptsize}{%
+ \renewcommand{\captionsize}{\scriptsize}
+ \as@subcapsize{\scriptsize}}
+\DeclareOption{footnotesize}{%
+ \renewcommand{\captionsize}{\footnotesize}
+ \as@subcapsize{\scriptsize}}
+\DeclareOption{small}{%
+ \renewcommand{\captionsize}{\small}
+ \as@subcapsize{\footnotesize}}
+\DeclareOption{normalsize}{%
+ \renewcommand{\captionsize}{\normalsize}
+ \as@subcapsize{\footnotesize}}
+\DeclareOption{large}{%
+ \renewcommand{\captionsize}{\large}
+ \as@subcapsize{\normalsize}}
+\DeclareOption{Large}{%
+ \renewcommand{\captionsize}{\Large}
+ \as@subcapsize{\large}}
+% \end{macrocode}
+% There are nine options available to set the font attributes of the caption labels.
+% \begin{macrocode}
+\DeclareOption{up}{\renewcommand{\captionlabelfont}{\upshape}}
+\DeclareOption{it}{\renewcommand{\captionlabelfont}{\itshape}}
+\DeclareOption{sl}{\renewcommand{\captionlabelfont}{\slshape}}
+\DeclareOption{sc}{\renewcommand{\captionlabelfont}{\scshape}}
+\DeclareOption{md}{\renewcommand{\captionlabelfont}{\mdseries}}
+\DeclareOption{bf}{\renewcommand{\captionlabelfont}{\bfseries}}
+\DeclareOption{rm}{\renewcommand{\captionlabelfont}{\rmfamily}}
+\DeclareOption{sf}{\renewcommand{\captionlabelfont}{\sffamily}}
+\DeclareOption{tt}{\renewcommand{\captionlabelfont}{\ttfamily}}
+% \end{macrocode}
+% If the option |ruled| is set, the captions of ruled floats provided
+% by the \textsf{float} package will also be supported.
+% \begin{macrocode}
+\DeclareOption{ruled}{\newcommand\as@ruled{}}
+% \end{macrocode}
+%
+% \subsection{Execution of options}
+% The `normal' type of caption is preselected.
+% \begin{macrocode}
+\ExecuteOptions{normal}
+\ProcessOptions
+% \end{macrocode}
+%
+% \subsection{Main code}
+% \begin{macro}{\as@captionbox}
+% \begin{macro}{\as@captionwidth}
+% \begin{macro}{\as@makecaption}
+% \begin{macro}{\@makecaption}
+% \changes{v1.4}{30 Jan 95}{{\tt center} environment changed to {\tt\protect\bslash as@shortcaption}}
+% \changes{v1.4a}{12 Feb 95}{{\tt\protect\bslash par} removed}
+% And now \ldots\ it's \ldots\ the new |\@makecaption| code!
+% \begin{macrocode}
+\newsavebox{\as@captionbox}
+\newlength{\as@captionwidth}
+\newcommand{\as@makecaption}[2]{%
+ \setlength{\leftskip}{\captionmargin}%
+ \setlength{\rightskip}{\captionmargin}%
+ \addtolength{\as@captionwidth}{-2\captionmargin}%
+ \captionfont%
+ \sbox{\as@captionbox}{{\captionlabelfont #1:} #2}%
+ \ifdim \wd\as@captionbox >\as@captionwidth
+ \as@caption{{\captionlabelfont #1:}}{#2}%
+ \else%
+ \as@shortcaption{{\captionlabelfont #1:}}{#2}%
+ \fi}
+\renewcommand{\@makecaption}[2]{%
+ \vskip\abovecaptionskip%
+ \setlength{\as@captionwidth}{\linewidth}%
+ \as@makecaption{#1}{#2}%
+ \vskip\belowcaptionskip}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Support of the \puresf{rotating} package}
+% \begin{macro}{\@makercaption}
+% \changes{v1.4b}{5 Apr 95}{{\tt\protect\bslash @makercaption} removed}
+% \begin{macro}{\@makerotcaption}
+% If the \textsf{rotating} package is loaded, the command |\@makerotcaption|
+% (for support of |\rotcaption|) will be
+% redefined here. The code was taken from the \textsf{rotating} package
+% \cite{rotating} itself and adapted.
+% \begin{macrocode}
+\ifx\@makerotcaption\undefined
+\else
+ \typeout{\space\space\space\space\space\space\space\space\space
+ `rotating' package detected}
+% \let\@makercaption\undefined
+ \renewcommand{\@makerotcaption}[2]{%
+ \captionfont%
+ \sbox{\as@captionbox}{{\captionlabelfont #1:} #2}%
+ \ifdim \wd\as@captionbox > .8\vsize
+ \rotatebox{90}{%
+ \setlength{\as@captionwidth}{.8\textheight}%
+ \begin{minipage}{\as@captionwidth}%
+ \as@caption{{\captionlabelfont #1:}}{#2}%
+ \end{minipage}}\par
+ \else%
+ \rotatebox{90}{\usebox{\as@captionbox}}%
+ \fi
+ \hspace{12pt}}
+\fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Support of the \puresf{float} package}
+% \begin{macro}{\floatc@plain}
+% \begin{macro}{\floatc@ruled}
+% \changes{v1.3}{8 Jan 95}{{\tt\protect\bslash as@normalcaption} changed to {\tt\protect\bslash as@caption}}
+% \changes{v1.4a}{12 Feb 95}{{\tt\protect\bslash par} removed}
+% If the \textsf{float} package is loaded, the command |\floatc@plain|
+% (and the command |\floatc@ruled| if the option |ruled| is given)
+% will be redefined here.
+% \begin{macrocode}
+\ifx\floatc@plain\undefined
+\else
+ \typeout{\space\space\space\space\space\space\space\space\space
+ `float' package detected}
+ \renewcommand\floatc@plain[2]{%
+ \setlength{\as@captionwidth}{\linewidth}%
+ \as@makecaption{#1}{#2}}
+ \ifx\as@ruled\undefined
+ \else
+ \renewcommand\floatc@ruled[2]{%
+ \setlength{\as@captionwidth}{\linewidth}%
+ \captionfont%
+ \as@caption{{\captionlabelfont #1:}}{#2}}
+ \fi
+\fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \Finale
+%
+\endinput
+
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v2.0/caption2.dtx b/Master/texmf-dist/source/latex/caption/fallback/v2.0/caption2.dtx
new file mode 100644
index 00000000000..339aa29a8fd
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v2.0/caption2.dtx
@@ -0,0 +1,606 @@
+% \iffalse
+% caption.dtx - The caption package
+% (c) 1994-95 Axel Sommerfeldt (axel@hp1.ang-physik.uni-kiel.de)
+%
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\documentclass{ltxdoc}
+\newlength\artparindent
+\setlength\artparindent{\parindent}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+\usepackage{caption2}[1995/10/09]
+\IfFileExists{ltxdoc.cfg}{}{\OnlyDescription\RecordChanges\CodelineIndex}
+\begin{document}
+ \DocInput{caption2.dtx}
+ \IfFileExists{ltxdoc.cfg}{}{\PrintChanges\PrintIndex}
+\end{document}
+%</driver>
+% \fi
+%
+% \providecommand{\LaTeXcomp}{The \LaTeX{} Companion}
+% \newcommand{\purerm}[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand{\puresf}[1]{{\upshape\mdseries\sffamily #1}}
+% \newenvironment{Options}[1]%
+% {\begin{list}{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}%
+% \settowidth{\labelwidth}{\texttt{#1\space}}%
+% \setlength{\leftmargin}{\labelwidth}%
+% \addtolength{\leftmargin}{\labelsep}}}%
+% {\end{list}}
+%
+% \def\packageversion{2.0(BETA)}
+% \def\packagedate{1995/10/09}
+% \changes{v1.0}{27 Oct 94}{First release}
+% \changes{v1.2}{28 Nov 94}{Works now with the {\tt figure*} and {\tt table*}
+% environments, too}
+% \changes{v2.0}{ 9 Oct 95}{Totally rewritten; many new commands and features}
+%
+% \title{The \puresf{caption} package\thanks{This package has version number
+% \packageversion, last revised \packagedate.}}
+% \author{Axel Sommerfeldt\\
+% {\small axel@hp1.ang-physik.uni-kiel.de}}
+% \date{1995/10/09}
+% \maketitle
+%
+% \begin{abstract}
+% The \textsf{caption} package provides many ways to customise the captions
+% in floating environments such |figure|, |table|, |sidewaysfigure|, and
+% |sidewaystable|.
+% The following \LaTeXe\ packages are supported:
+% float, longtable, and subfigure.
+% But it works fine with the following packages as well:
+% floatfig, rotating, supertabular, and wrapfig.
+% \end{abstract}
+%
+% \section{Documentation? What documentation?}
+% I'm sorry to say this, but there is no documentation provided with the
+% new version of this package, yet. And it's still beta. I hope I can
+% eleminate both circumstances in the near future; at the moment my spare time
+% is very very very limited, so I decided to make this beta public.
+%
+% This new version is nearly compatible with the lastest official release
+% (version 1.4b), so you can use the old documentation so far.
+% Here is what differs this version from version 1.4b:
+%
+% \begin{itemize}
+% \item
+% If the caption package will detect a loaded float package, it will
+% \emph{not} redefine the boxed style of floats anymore. If you want to
+% have the old behaviour, you have to specify the new option |boxed| to
+% the caption2 package.
+% \item
+% Anything said about the subfigure package in the old doc isn't
+% true anymore; the caption package is now adapted to the new version
+% 2.0 of this package. Especially the caption package will \emph{not}
+% redefine |\@thesubfigure| and |\@thesubtable| anymore and it will
+% \emph{not} set |\subcapsize| -- you have to do this now for yourself
+% if you want to, e.g.\ with the following code:
+% \begin{quote}
+% |\usepackage[normalsize]{subfigure}|\\
+% |\usepackage[large]{caption}|
+% \end{quote}
+%
+% So you can load the caption2 package \emph{before} loading the subfigure
+% package now without problems, in fact this is recommend now. Don't care
+% about what the old doc or the doc of the subfigure package is telling you!
+% \end{itemize}
+%
+% As a summary, the new caption package won't lead into different results
+% of your documents just because of loading it (without options).
+%
+% If you are really interested in the (many!) new features of this totally
+% rewritten package, take a look in the provided test document (test2.tex)
+% to get a idea of the new commands and possibilities.
+% And feel yourself free to write a email to me, if any questions occur.
+%
+% \subsection{Just a few notes\dots}
+% If you use the new command |\setcaptionwidth| to set the absolut width of a
+% caption, you are not allowed to change |\captionmargin| anymore!
+% Instead, use the new command |\setcaptionmargin| to do this.
+%
+% Longtables will still take care of |\LTcapwidth|, even if you are setting
+% your own width via |\setcaptionwidth| or |\setcaptionmargin|. To get rid
+% of this, use the following code just after loading the caption2 package:
+% \begin{quote}
+% |\dummycaptionstyle{longtable}{}|
+% \end{quote}
+% or just specify the new package option |longtable|.
+%
+% This package was developed and tested with following versions of the
+% other packages:
+% \begin{quote}\begin{tabular}{lll}
+% package & version & date \\\hline
+% float & 1.2c & 1995/03/29 \\
+% longtable & 3.15 & 1995/06/15 \\
+% rotating & 2.9 & 1995/04/07 \\
+% subfigure & 2.0 & 1995/03/06 \\
+% \end{tabular}\end{quote}
+%
+% Maybe it will work with older versions, maybe not\dots
+%
+% BTW:
+% If you are interested in rotated versions (like |sidewaysfigure| or
+% |sidewaystable|) of new floats (defined with the float package), take a look
+% at the rotfloat package, which comes from a very talented young man with a
+% very german style of writing english docs (if he ever writes any!) and a
+% very big mouth - myself |:-)|
+%
+% \section{Thanks}
+% I would like to thank David Carlisle for his help writing the longtable
+% support; without the changes in his package this wouldn't become possible.
+%
+% \changes{v1.1}{ 3 Nov 94}{New captiontype: {\tt centerlast}}
+% \changes{v1.4}{30 Jan 95}{New option: {\tt nooneline}}
+% \changes{v1.4}{29 Jan 95}{{\tt\protect\bslash captionsize} changed to
+% {\tt\protect\bslash captionfont}}
+% \changes{v1.2}{28 Nov 94}{Support of the {\sf float} package}
+% \changes{v1.3}{ 8 Jan 95}{Support of {\tt\protect\bslash captionlabelfont} in
+% subcaptions}
+% \changes{v1.4b}{5 Apr 95}{Adapted to version 2.8 of the rotating package}
+% \changes{v2.0}{ 9 Oct 95}{support of the longtable package}
+%
+% \StopEventually{
+% \begin{thebibliography}{9}
+% \bibitem{float}
+% Anselm Lingnau:
+% \textsl{An Improved Environment for Floats},
+% 1995/03/25
+% \bibitem{rotating}
+% Sebastian Rahtz and Leonor Barroca:
+% \textsl{A style option for rotated objects in \LaTeX},
+% 1994/10/02
+% \bibitem{rotfloat}
+% Axel Sommerfeldt:
+% \textsl{The rotfloat package},
+% 1995/03/30
+% \bibitem{subfigure}
+% Steven Douglas Cochran:
+% \textsl{The subfigure package},
+% 1995/03/06
+% \bibitem{A-W:GMS94}
+% Michel Goossens, Frank Mittelbach and Alexander Samarin:
+% \newblock \textsl{The {\LaTeX} Companion},
+% \newblock Addison-Wesley, Reading, Massachusetts, 1994.
+% \bibitem{Anne}
+% Anne Br\"uggemann-Klein:
+% \textsl{Einf\"uhrung in die Dokumentverarbeitung},
+% B.G. Teubner, Stuttgart, 1989
+% \bibitem{Kopka-E}
+% Helmut Kopka:
+% \textsl{\LaTeX -- Erweiterungsm\"oglichkeiten},
+% 3. \"uberarbeitete Auf\/lage, Addison-Wesley, Bonn, 1991
+% \end{thebibliography}
+% }
+% \setlength{\parskip}{0pt plus 1pt}
+%
+% \CheckSum{647}
+% \DoNotIndex{\\,\_,\ }
+% \DoNotIndex{\@gobble,\@ifundefined,\@namedef,\@nameuse,\@tempdima}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtolength,\advance,\begin,\bfseries}
+% \DoNotIndex{\catcode,\centering,\csname,\def,\divide}
+% \DoNotIndex{\else,\empty,\end,\endcsname,\endgraf,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifx,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftskip,\let,\linewidth}
+% \DoNotIndex{\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newif,\newsavebox,\noindent}
+% \DoNotIndex{\normalsize,\or}
+% \DoNotIndex{\par,\parbox,\parfillskip,\protect}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\rightskip}
+% \DoNotIndex{\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setlength,\sffamily,\slshape,\small}
+% \DoNotIndex{\space,\strut}
+% \DoNotIndex{\textheight,\typeout,\ttfamily,\undefined,\upshape,\usebox}
+% \DoNotIndex{\vsize,\vskip,\wd}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\InputIfFileExists,\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageWarningNoLine,\ProcessOptions}
+% \DoNotIndex{\ProvidesPackage}
+%
+% \clearpage
+% \section{The (not well documented) code}
+% \iffalse
+%<*package>
+% \fi
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption2}[1995/10/09 v2.0 caption package (AS)]
+%
+% package detection message
+\let\caption@message\undefined
+\newcommand*\caption@package[1]{%
+ \ifx\caption@message\undefined
+ \message{\space\space\space\space\space\space\space\space\space
+ packages detected:}
+ \let\caption@message\empty
+ \fi
+ \message{#1}}
+%
+% `internal' stuff
+\newlength\realcaptionwidth
+\newsavebox\captionbox
+%
+% Code initialisation, `normal' stuff
+\newcommand*\captionsize{}
+\newcommand*\captionfont{\captionsize}
+\newcommand*\captionlabelfont{}
+\newcommand*\captionlabeldelim{:}
+\newdimen\captionlabelsep
+ \sbox\captionbox{ }
+ \setlength\captionlabelsep{\wd\captionbox}
+\newdimen\captionmargin
+\newdimen\captionwidth
+% only used by captionstyle `indent', but can be used in user-defines styles
+\newdimen\captionindent
+\newif\ifonelinecaptions
+\newif\iftakecaptionwidth
+%
+%\newcommand*\setcaptionfont[1]{%
+% \def\captionfont{#1}}
+%\newcommand*\setcaptionlabelfont[1]{%
+% \def\captionlabelfont{#1}}
+\newcommand*\setcaptionmargin[1]{%
+ \setlength\captionmargin{#1}%
+ \takecaptionwidthfalse}
+\newcommand*\setcaptionwidth[1]{%
+ \setlength\captionwidth{#1}%
+ \takecaptionwidthtrue}
+%
+% \newcaptionstyle, \renewcaptionstyle & \defcaptionstyle
+\newcommand\newcaptionstyle[2]{%
+ \expandafter\ifx\csname caption@@#1\endcsname\relax
+ \defcaptionstyle{#1}{#2}%
+ \else
+ \PackageError{caption}{Caption style `#1' already defined}{}%
+ \fi}
+\newcommand\renewcaptionstyle[2]{%
+ \expandafter\ifx\csname caption@@#1\endcsname\relax
+ \PackageError{caption}{Caption style `#1' undefined}{}%
+ \else
+ \defcaptionstyle{#1}{#2}%
+ \fi}
+\newcommand\defcaptionstyle[2]{%
+ \@namedef{caption@@#1}{#2}}
+\newcommand*\dummycaptionstyle[2]{%
+ \defcaptionstyle{#1}{%
+ \expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname%
+ \csname caption@@#1\endcsname
+ \PackageError{caption}{You can't use the caption style `#1' directy}{%
+ The caption style `#1' is only a dummy and does not really exists.%
+ \MessageBreak You have to redefine it (with \protect\renewcaptionstyle)
+ before you can select\MessageBreak it with \protect\captionstyle.}%
+ \else
+ #2\usecaptionstyle{\caption@style}%
+ \fi}}
+%
+% preimplemented types of captions, all with a label and text,
+% separated by \captionlabeldelim
+\newcaptionstyle{normal}{\caption@make{normal}}
+\newcaptionstyle{center}{\caption@make{center}}
+\newcaptionstyle{flushleft}{\caption@make{flushleft}}
+\newcaptionstyle{flushright}{\caption@make{flushright}}
+\newcaptionstyle{centerlast}{\caption@make{centerlast}}
+\newcaptionstyle{hang}{\caption@make{hang}}
+\newcaptionstyle{indent}{\caption@make{indent}}
+%
+% \captionstyle
+\newcommand*\captionstyle[1]{%
+ \expandafter\ifx\csname caption@@#1\endcsname\relax
+ \PackageError{caption}{Undefined caption style `#1'}{}%
+ \else
+ \def\caption@style{#1}%
+ \fi}
+%
+% Options
+\DeclareOption{normal}{\captionstyle{normal}}
+\DeclareOption{center}{\captionstyle{center}}
+\DeclareOption{flushleft}{\captionstyle{flushleft}}
+\DeclareOption{flushright}{\captionstyle{flushright}}
+\DeclareOption{centerlast}{\captionstyle{centerlast}}
+\DeclareOption{anne}{\ExecuteOptions{centerlast}}
+\DeclareOption{hang}{\captionstyle{hang}}
+\DeclareOption{isu}{\ExecuteOptions{hang}}
+\DeclareOption{indent}{\captionstyle{indent}}
+%
+\DeclareOption{oneline}{\onelinecaptionstrue}
+\DeclareOption{nooneline}{\onelinecaptionsfalse}
+%
+\DeclareOption{scriptsize}{\renewcommand*\captionsize{\scriptsize}}
+\DeclareOption{footnotesize}{\renewcommand*\captionsize{\footnotesize}}
+\DeclareOption{small}{\renewcommand*\captionsize{\small}}
+\DeclareOption{normalsize}{\renewcommand*\captionsize{\normalsize}}
+\DeclareOption{large}{\renewcommand*\captionsize{\large}}
+\DeclareOption{Large}{\renewcommand*\captionsize{\Large}}
+%
+\DeclareOption{up}{\renewcommand*\captionlabelfont{\upshape}}
+\DeclareOption{it}{\renewcommand*\captionlabelfont{\itshape}}
+\DeclareOption{sl}{\renewcommand*\captionlabelfont{\slshape}}
+\DeclareOption{sc}{\renewcommand*\captionlabelfont{\scshape}}
+\DeclareOption{md}{\renewcommand*\captionlabelfont{\mdseries}}
+\DeclareOption{bf}{\renewcommand*\captionlabelfont{\bfseries}}
+\DeclareOption{rm}{\renewcommand*\captionlabelfont{\rmfamily}}
+\DeclareOption{sf}{\renewcommand*\captionlabelfont{\sffamily}}
+\DeclareOption{tt}{\renewcommand*\captionlabelfont{\ttfamily}}
+%
+\DeclareOption{boxed}{\AtEndOfPackage{%
+ \ifx\caption@@ruled\undefined
+ \PackageWarningNoLine{caption}{%
+ Option `boxed' is set but there is no `float' package\MessageBreak
+ around here, so this option will be totally ignored}
+ \else
+ \dummycaptionstyle{boxed}{}%
+ \fi}}
+\DeclareOption{ruled}{\AtEndOfPackage{%
+ \ifx\caption@@ruled\undefined
+ \PackageWarningNoLine{caption}{%
+ Option `ruled' is set but there is no `float' package\MessageBreak
+ around here, so this option will be totally ignored}
+ \else
+ \dummycaptionstyle{ruled}{\onelinecaptionsfalse\setcaptionmargin{0pt}}%
+ \fi}}
+%
+\DeclareOption{longtable}{\AtEndOfPackage{%
+ \ifx\caption@@longtable\undefined
+ \PackageWarningNoLine{caption}{%
+ Option `longtable' is set but there is no `longtable' package\MessageBreak
+ around here, so this option will be totally ignored}
+ \else
+ \dummycaptionstyle{longtable}{}%
+ \fi}}
+%
+\DeclareOption*{\AtEndOfPackage{%
+ \InputIfFileExists{\CurrentOption.caption}{}{%
+ \PackageError{caption}{File `\CurrentOption.caption' not found}{%
+ You selected the unknown package option `\CurrentOption', so I
+ thought you want to\MessageBreak
+ input the definition file `\CurrentOption.caption' here
+ -- but there is no one!}}}}
+%
+\ExecuteOptions{normal,oneline}
+\ProcessOptions
+%
+% \@makecaption
+\renewcommand\@makecaption[2]{%
+ \vskip\abovecaptionskip
+ \realcaptionwidth\linewidth
+ \def\captionlabel{#1}%
+ \def\captiontext{#2}%
+ \usecaptionstyle{\caption@style}%
+ \vskip\belowcaptionskip}
+%
+% Helpers for caption style authors
+\newcommand*\caption@canterr[1]{%
+ \PackageError{caption}{You can't use \protect#1
+ in normal text}{The usage of \protect#1 is only
+ allowed inside code declared with\MessageBreak \protect\defcaptionstyle,
+ \protect\newcaptionstyle \space or \protect\renewcaptionstyle.}}
+\newcommand\onelinecaption[2]{%
+ \ifx\captiontext\undefined
+ \caption@canterr{\onelinecaption}%
+ \else
+ \def\caption@temp{#2}%
+ \ifonelinecaptions
+ \sbox\captionbox{#1}%
+ \ifdim\wd\captionbox >\realcaptionwidth
+ \caption@temp
+ \else
+ {\centering\usebox{\captionbox}\par}%
+ \fi
+ \else
+ \caption@temp
+ \fi
+ \let\caption@temp\undefined
+ \fi}
+\newcommand*\usecaptionmargin{%
+ \ifx\captiontext\undefined
+ \caption@canterr{\usecaptionmargin}%
+ \else
+ \iftakecaptionwidth
+ \leftskip\realcaptionwidth
+ \advance\leftskip by -\captionwidth
+ \divide\leftskip by 2
+ \rightskip\leftskip
+ \realcaptionwidth\captionwidth
+ \else
+ \leftskip\captionmargin
+ \rightskip\captionmargin
+ \advance\realcaptionwidth by -2\captionmargin
+ \fi
+ \fi}
+\newcommand*\usecaptionstyle[1]{%
+ \ifx\captiontext\undefined
+ \caption@canterr{\usecaptionstyle}%
+ \else
+ \@ifundefined{caption@@#1}%
+ {\PackageError{caption}{Caption style `#1' undefined}{}}%
+ {\@nameuse{caption@@#1}}
+ \fi}
+%
+% equal code for normal, center, centerlast, hang, and indent
+\newcommand*\caption@make[1]{%
+ \usecaptionmargin\captionfont
+ \def\caption@label{%
+ {\captionlabelfont\captionlabel\captionlabeldelim}%
+ \hskip\captionlabelsep}%
+ \onelinecaption{\caption@label\captiontext}%
+ {\@nameuse{caption@@@#1}}}
+%
+% the preimplemented caption styles
+\newcommand*\caption@@@normal{%
+ \caption@label\captiontext\par}
+\newcommand*\caption@@@center{%
+ \parbox[t]{\realcaptionwidth}{\centering
+ \caption@label\captiontext\par}}%
+\newcommand*\caption@@@flushleft{%
+ \parbox[t]{\realcaptionwidth}{\raggedright
+ \caption@label\captiontext\par}}%
+\newcommand*\caption@@@flushright{%
+ \parbox[t]{\realcaptionwidth}{\raggedleft
+ \caption@label\captiontext\par}}%
+\newcommand*\caption@@@centerlast{%
+ \advance\leftskip by 0pt plus 1fil%
+ \advance\rightskip by 0pt plus -1fil%
+ \parfillskip0pt plus 2fil%
+ \caption@label\captiontext\par}
+\newcommand*\caption@@@hang{%
+ \sbox\captionbox{\caption@label}%
+ \hangindent\wd\captionbox\noindent
+ \usebox\captionbox\captiontext\par}
+\newcommand*\caption@@@indent{%
+ \hangindent\captionindent\noindent
+ \caption@label\captiontext\par}
+% \end{macrocode}
+%
+% \subsection*{Support of the float package}
+% \begin{macrocode}
+\ifx\floatc@plain\undefined
+\else
+ \caption@package{float}
+%
+% interface float package -> caption package
+ \newcommand\caption@floatc[3]{%
+ \realcaptionwidth\linewidth
+ \def\captionlabel{#2}%
+ \def\captiontext{#3}%
+ \usecaptionstyle{#1}}
+%
+% floatstyle plain verwendet jetzt den gesetzten captionstyle
+ \renewcommand\floatc@plain{\caption@floatc{\caption@style}}
+%
+% floatstyle boxed auch (kann aber mit \renewcaptionstyle geaendert werden)
+ \dummycaptionstyle{boxed}{\def\captionlabelfont{\bfseries}}
+ \newcommand\floatc@boxed{\caption@floatc{boxed}}
+% jetzt muessen wir nur noch dafuer sorgen, dass es auch (statt floatc@plain)
+% in \fs@boxed verwendet wird...
+ \let\caption@boxed\fs@boxed
+ \renewcommand\fs@boxed{\let\floatc@plain\floatc@boxed\caption@boxed}
+%
+% floatstyle ruled, dies geht zum Glueck wieder geradeaus
+ \newcaptionstyle{ruled}{{\bfseries\captionlabel} \captiontext\par}
+ \renewcommand*\floatc@ruled{\caption@floatc{ruled}}
+%
+\fi
+% \end{macrocode}
+%
+% \subsection*{Support of the longtable package}
+% \begin{macrocode}
+\ifx\LT@makecaption\undefined
+\else
+ \caption@package{longtable}
+ \dummycaptionstyle{longtable}{\setcaptionwidth\LTcapwidth}
+ \renewcommand\LT@makecaption[3]{%
+ \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\linewidth{%
+ \realcaptionwidth\linewidth
+ \ifx#1\@gobble
+ \def\captionlabel{}%
+ \def\captionlabeldelim{}%
+ \captionlabelsep\z@
+ \else
+ \def\captionlabel{#2}%
+ \fi
+ \def\captiontext{#3}%
+ \usecaptionstyle{longtable}%
+ \endgraf\vskip\baselineskip}%
+ \hss}}}
+\fi
+% \end{macrocode}
+%
+% \subsection*{Support of the subfigure package}
+% \begin{macrocode}
+\newcommand*\addtosubcaption[1]{}
+\@ifundefined{@makesubfigurecaption}{}{%
+ \caption@package{subfigure}
+% \end{macrocode}
+%
+% \begin{macro}{\subcapsize}
+% \begin{macrocode}
+ \newcommand*\subcapstyle[1]{%
+ \expandafter\ifx\csname caption@@#1\endcsname\relax
+ \PackageError{caption}{Undefined caption style `#1'}{}%
+ \else
+ \def\caption@substyle{#1}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% Detection of |\caption@substyle|.
+% \begin{macrocode}
+ \subcapstyle{normal}
+ \ifsubcaphang
+ \subcapstyle{hang}
+ \fi
+ \ifsubcapcenter
+ \subcapstyle{center}
+ \fi
+ \ifsubcapcenterlast
+ \subcapstyle{centerlast}
+ \fi
+% \end{macrocode}
+%
+% NOTE: \cs{subfigcapmargin} is \emph{not} a length, it's a command.
+% So we make \cs{subfigcapwidth} also a command!
+% \begin{macrocode}
+ \newif\iftakesubfigcapwidth
+ \newcommand*\subfigcapwidth{0pt}
+% only used by captionstyle `indent', but can be used in user-defines styles
+ \newlength\subcapindent
+% \end{macrocode}
+%
+% \begin{macro}{\setsubcapmargin}
+% \begin{macro}{\setsubcapwidth}
+% \begin{macrocode}
+ \newcommand*\setsubcapmargin[1]{%
+ \renewcommand*\subcapfigmargin{#1}%
+ \takesubfigcapwidthfalse}
+ \newcommand*\setsubcapwidth[1]{%
+ \renewcommand*\subcapfigwidth{#1}%
+ \takesubfigcapwidthtrue}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ \renewcommand\@makesubfigurecaption[2]{%
+ \realcaptionwidth\@tempdima
+ \def\captionlabel{#1}%
+ \def\captiontext{#2}%
+ \let\captionfont\subcapsize
+ \let\captionlabelfont\relax
+ \let\captionlabeldelim\empty
+ \captionlabelsep0pt
+ \ifsubcapnooneline\onelinecaptionsfalse\else\onelinecaptionstrue\fi
+ \iftakesubfigcapwidth\takecaptionwidthtrue\else\takecaptionwidthfalse\fi
+ \setlength\captionmargin{\subfigcapmargin}%
+ \setlength\captionwidth{\subfigcapwidth}%
+ \captionindent\subcapindent
+ \hbox{\parbox[t]\@tempdima{\strut\usecaptionstyle{\caption@substyle}}}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \renewcommand*\addtosubcaption[1]{%
+ \let\caption@makesubfigurecaption\@makesubfigurecaption
+ \renewcommand\@makesubfigurecaption[2]{%
+ #1\caption@makesubfigurecaption}
+ \let\@makesubtablecaption\@makesubfigurecaption}}
+% \end{macrocode}
+%
+% \subsection*{Cleaning up}
+% \begin{macrocode}
+\ifx\caption@message\undefined
+\else\message{^^J}\let\caption@message\undefined\fi
+\let\caption@package\undefined
+\let\caption@subcapsize\undefined
+% \end{macrocode}
+% \clearpage
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \Finale
+%
+\endinput
+
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v2.1/caption2.dtx b/Master/texmf-dist/source/latex/caption/fallback/v2.1/caption2.dtx
new file mode 100644
index 00000000000..23c1f26b862
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v2.1/caption2.dtx
@@ -0,0 +1,1329 @@
+% \iffalse meta-comment
+%
+% This is file `caption2.dtx'.
+%
+% Copyright (C) 1994-2005 Axel Sommerfeldt (caption@sommerfee.de)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files caption.ins, caption.dtx,
+% caption2.dtx, caption.xml, and anleitung.tex and the derived files
+% caption.sty, caption2.sty, caption3.sty, and manual.tex.
+%
+% \fi
+% \CheckSum{843}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+\ifx\pdfoutput\undefined\else
+ \ifcase\pdfoutput\else
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \fi
+\fi
+%
+\usepackage{caption2}[2004/04/16]
+%
+%<+driver>\OnlyDescription
+%
+\begin{document}
+ \DocInput{caption2.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*{\purerm}[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand*{\puresf}[1]{{\upshape\mdseries\sffamily #1}}
+% \newcommand*{\purett}[1]{{\upshape\mdseries\ttfamily #1}}
+% \let\package\puresf\def\thispackage{\package{caption2}}
+% \let\env\purett \let\opt\purett
+%
+% \GetFileInfo{caption2.sty}
+% \title{The \thispackage\ package\thanks{This package has version number
+% \fileversion, last revised \filedate.}}
+% \author{Axel Sommerfeldt\\\texttt{caption@sommerfee.de}}
+% \date{2005/11/02}
+% \maketitle
+%
+% \changes{v2.0}{ 9 Oct 95}{New experimental version: Many new commands and features}
+% \changes{v2.0}{ 9 Oct 95}{Support of the longtable package added}
+% \changes{v2.1}{20 Feb 02}{Revised: New commands and options}
+% \changes{v2.1}{26 Feb 02}{Adapted to version 2.1 of the subfigure package}
+% \changes{v2.1a}{12 Nov 03}{Some minor bug fixes and improved compatibility to v2.0}
+% \changes{v2.1b}{16 Apr 04}{Some minor bug fixes and improved compatibility to v2.0}
+% \changes{v2.1c}{10 May 04}{Some minor bug fixes and improved compatibility to v2.0}
+% \changes{v2.1d}{ 3 Oct 05}{Some superfluous brackets removed; warning added}
+%
+% \providecommand\LaTeXcomp{The \LaTeX{} Companion}
+%
+% \section*{This package is obsolete!}
+%
+% The \package{caption2} package used to be an experimental side-version of
+% the regular \package{caption} package. It was made public as beta test version
+% without documentation in 1995 because of the demand for new features and
+% adaptations to other packages like the \package{longtable} and
+% \package{subfigure} package.
+%
+% Even in the next years I found no time to reintegrate some of the
+% well-tried features into the regular \package{caption} package. So I
+% decided to release a version $2.1$ of the \package{caption2} package in 2002
+% instead, which included some minor bug fixes and adaptations to the new
+% version $2.1$ of the \package{subfigure} package. Furthermore I started
+% to write a documentation for this package, but unfortunately did not get
+% very far with this\ldots
+%
+% In 2003 I finally found some (more) time, so a new regular release $3.0$
+% of the \package{caption} package could be build with massive help from
+% Frank Mittelbach\cite{A-W:GMS94} and Steven Cochran\cite{subfigure}.
+% It was released in December 2003 and superseded the neglected
+% \package{caption2} package.
+%
+% {\small (In parallel, Steven Cochran released the \package{subfig} package which
+% superseded the \package{subfigure} package.)}
+%
+% So please don't use this package for new documents. It's old, it's obsolete
+% and it starts to begin smell bad!
+% Please ignore all hints in books or other documents which try to tell you
+% that the \package{caption2} package should be used instead of the
+% \package{caption} package -- these hints are outdated since December 2003.
+%
+% \section*{How to migrate to the regular \package{caption} package?}
+%
+% Usually replacing \package{caption2} by \package{caption} is sufficient
+% because the \package{caption} package emulates most of the options and
+% commands of the \package{caption2} package.
+% If you get some errors or wired results afterwards, please take a closer
+% look at the \package{caption} package documentation which will hopefully
+% help you clearing these problems.
+% If all this should fail you can write me an e-mail asking for help.
+%
+% \section*{What will happen to this package?}
+%
+% The \package{caption2} package is still some kind of supported, that means
+% it will be part of future releases and bugs will still be fixed so existing
+% documents using this package will still compile.
+% But it will \emph{not} be enhanced in the future or adapted to future versions
+% of foreign packages.
+%
+% This means migrating to the actual \package{caption} package should not be
+% necessary for old documents.
+%
+% \StopEventually{}
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@classoptionslist,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined,\@latex@error}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempb,\@tempc}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\bgroup,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\egroup,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\if,\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\providecommand}
+% \DoNotIndex{\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\undefined,\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\ProcessOptions,\ProvidesPackage}
+%
+% \clearpage
+%
+% \section{The Implementation}
+% \iffalse
+%<*package>
+% \fi
+%
+% \subsection{Identificaton}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption2}[2005/10/03 v2.1d Customising captions (AS)]
+%\PackageWarning{caption2}{THIS PACKAGE IS OBSOLETE, PLEASE USE caption INSTEAD}
+% \end{macrocode}
+%
+% \subsection{Preliminary declarations}
+%
+% \begin{macro}{\captionfont}
+% \begin{macro}{\captionlabelfont}
+% \cs{captionfont} and \cs{captionlabelfont} will hold the font specifications for the caption.
+% \begin{macrocode}
+\newcommand*\captionfont{}
+\newcommand*\captionlabelfont{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\captionlabeldelim}
+% \begin{macro}{\captionlabelsep}
+% \cs{captionlabeldelim} \& \cs{captionlabelsep} will hold the iterim
+% space between caption label and text.
+% (\cs{captionlabeldelim} will be typeset within \cs{captionlabelfont},
+% \cs{captionlabelsep} not.)
+% \begin{macrocode}
+\newcommand*\captionlabeldelim{}
+\newcommand*\captionlabelsep{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\captionsize}
+% The macro \cs{captionsize} is obsolete since v1.4 of the \textsf{caption} package,
+% but we still support it to provide backward compatibility.
+% \begin{macrocode}
+\newcommand*\captionsize{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionmargin}
+% \begin{macro}{\captionwidth}
+% \begin{macro}{\ifcaptionwidth}
+% Either \cs{captionmargin} (with specifies an extra margin) or \cs{captionwidth}
+% (with specifies an explicit width) can be set, therefore we need the flag \cs{ifcaptionwidth}
+% to determine with parameter we should pay attention to.
+% \begin{macrocode}
+\newdimen\captionmargin
+\newdimen\captionwidth
+\newif\ifcaptionwidth
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\captionindent}
+% \cs{captionindent} will be used in caption style \texttt{indent} and specifies the indention
+% after the first line.
+% \begin{macrocode}
+\newdimen\captionindent
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifcaptionlabel}
+% \begin{macro}{\ifonelinecaptions}
+% \begin{macro}{\ifignoreLTcapwidth}
+% More flags. If \cs{ifcaptionlabel} is not set the caption label should be suppressed;
+% we need this flag to support the \cs{caption*} command.
+% If \cs{ifonelinecaptions} is set we support the \LaTeX\ base style 'one line captions',
+% that means the caption will be typeset centered if it fits to one line.
+% If \cs{ifignoreLTcapwidth} is set we ignore the \cs{LTcapwidth} of \textsf{longtable}.
+% \changes{v2.1}{20 Feb 02}{New ifs \cs{ifcaptionlabel} and \cs{ifignoreLTcapwidth}}
+% \begin{macrocode}
+\newif\ifcaptionlabel\captionlabeltrue
+\newif\ifonelinecaptions
+\newif\ifignoreLTcapwidth
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionmargin}
+% \begin{macro}{\setcaptionwidth}
+% User-friendly commands to set the caption margin resp.\ width.
+% Note that they additionally set the \cs{ifcaptionwidth} flag.
+% \begin{macrocode}
+\newcommand*\setcaptionmargin{%
+ \captionwidthfalse
+ \setlength\captionmargin}
+\newcommand*\setcaptionwidth{%
+ \captionwidthtrue
+ \setlength\captionwidth}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\normalcaptionparams}
+% \cs{normalcaptionparams} resets all caption related parameters to it's normal default values.
+% \cs{captionfont} will be set to \cs{captionsize} so setting the obsolete \cs{captionsize} will still work.
+% Same story with \cs{captiondelim} and the obsolete \cs{captionlabeldelim}.
+% \changes{v2.1}{29 Jan 02}{New command \cs{normalcaptionparams}}
+% \begin{macrocode}
+\newcommand*\normalcaptionparams{%
+ \let\captionsize\@empty
+ \renewcommand*\captionfont{\captionsize}%
+ \let\captionlabelfont\@empty
+ \renewcommand*\captionlabeldelim{:}%
+ \renewcommand*\captionlabelsep{\space}%
+ \setcaptionmargin\z@\setlength\captionindent\z@
+ \onelinecaptionstrue}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@eh}
+% Some commands will produce an error message, use this as help text.
+% \begin{macrocode}
+\newcommand*\caption@eh{%
+ If you do not understand this error, please take a closer look\MessageBreak
+ at the documentation of the `caption2' package.\MessageBreak
+ \@ehc}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\defcaptionstyle}
+% \begin{macro}{\newcaptionstyle}
+% \begin{macro}{\renewcaptionstyle}
+% These macros will define a new caption style. \cs{newcaptionstyle} and \cs{renewcaptionstyle}
+% will additionally check if the caption style already exists or not.
+% \begin{macrocode}
+\newcommand*\defcaptionstyle[1]{%
+ \@namedef{caption@@#1}}
+%
+\newcommand*\newcaptionstyle[1]{%
+ \expandafter\ifx\csname caption@@#1\endcsname\relax
+ \expandafter\defcaptionstyle
+ \else
+ \PackageError{caption2}{Caption style `#1' already defined}{\caption@eh}%
+ \expandafter\@gobbletwo
+ \fi
+ {#1}}
+%
+\newcommand*\renewcaptionstyle[1]{%
+ \expandafter\ifx\csname caption@@#1\endcsname\relax
+ \PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}%
+ \expandafter\@gobbletwo
+ \else
+ \expandafter\defcaptionstyle
+ \fi
+ {#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\dummycaptionstyle}
+% This macro will also define a new caption style, but a one which is based on the
+% actual set caption style. Therefore you can't set a caption style made with this
+% command with \cs{captionstyle} -- we check this to avoid an endless recursion.
+% \begin{macrocode}
+\newcommand*\dummycaptionstyle[2]{%
+ \defcaptionstyle{#1}{%
+ \expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname%
+ \csname caption@@#1\endcsname
+ \PackageError{caption2}{You can't use the caption style `#1' directy}{%
+ The caption style `#1' is only a dummy and does not really exists.%
+ \MessageBreak You have to redefine it (with \protect\renewcaptionstyle)
+ before you can select\MessageBreak it with \protect\captionstyle.
+ \space\caption@eh}%
+ \else
+ #2\usecaptionstyle\caption@style
+ \fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionstyle}
+% \cs{captionstyle} sets the actual caption style. It includes a check if the given caption
+% style is defined or not.
+% \begin{macrocode}
+\newcommand*\captionstyle[1]{%
+ \expandafter\ifx\csname caption@@#1\endcsname\relax
+ \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}%
+ \else
+ \def\caption@style{#1}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{style `normal'}
+% \begin{macro}{style `center'}
+% \begin{macro}{style `centerlast'}
+% \begin{macro}{style `flushleft'}
+% \begin{macro}{style `flushright'}
+% \begin{macro}{style `hang'}
+% \begin{macro}{style `indent'}
+% The predefined caption styles `normal', `center', `flushleft', `flushright', `centerlast',
+% `hang', `hang+X', and `indent'. Because they are quite similar they all are based on the macro
+% \cs{caption@make}.
+% \begin{macrocode}
+\newcaptionstyle{normal}{\caption@make{normal}}
+\newcaptionstyle{center}{\caption@make{center}}
+\newcaptionstyle{centerlast}{\caption@make{centerlast}}
+\newcaptionstyle{flushleft}{\caption@make{flushleft}}
+\newcaptionstyle{flushright}{\caption@make{flushright}}
+\newcaptionstyle{hang}{\caption@make{hang}}
+\newcaptionstyle{hang+center}{\caption@make{hang@center}}
+\newcaptionstyle{hang+centerlast}{\caption@make{hang@centerlast}}
+\newcaptionstyle{hang+flushleft}{\caption@make{hang@flushleft}}
+\newcaptionstyle{indent}{\caption@make{indent}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecaption}
+% Our predefined caption styles. \cs{caption@makecaption} takes the style
+% name as parameter, it does the common stuff and calls a macro
+% (build out of the style name) to do the uncommon stuff if neccessary.
+% \changes{v2.1}{26 Feb 02}{Renamed from \cs{caption@make} to \cs{caption@makecaption}}
+% \changes{v2.1b}{16 Apr 04}{We offer and use \cs{caption@make}, again}
+% \changes{v2.1c}{10 May 04}{Bugfix: Extra \cs{par} added}
+% \begin{macrocode}
+\newcommand*\caption@makecaption[1]{%
+ \usecaptionmargin
+%
+ \ifcaptionlabel
+ \def\caption@label{%
+ {\captionlabelfont\captionlabel\captionlabeldelim}\captionlabelsep}%
+ \else
+ \let\caption@label\@empty
+ \fi
+%
+ \captionfont
+ \onelinecaption
+ {\caption@label\captiontext}%
+ {\parbox[b]\captionlinewidth{\strut\@nameuse{caption@@@#1}\par}\par}}
+\newcommand*\caption@make{\caption@makecaption}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.1}{26 Feb 02}{Removed all extra parboxes from caption styles}
+% \changes{v2.1a}{12 Nov 03}{\ldots and put the parbox into \cs{caption@makecaption} instead}
+%
+% \begin{macro}{\caption@@@normal}
+% The `normal' caption style. Just typeset caption (label \& text) as paragraph.
+% \begin{macrocode}
+\newcommand*\caption@@@normal{%
+ \caption@label\captiontext}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@center}
+% The `center' caption style. Typeset the caption centered within a parbox.
+% \begin{macrocode}
+\newcommand*\caption@@@center{%
+ \centering\caption@label\captiontext}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@centerlast}
+% The `centerlast' caption style.
+% The idea how to do this was taken from Br\"uggemann-Klein\cite{Anne},
+% it is also mentioned in Kopka\cite[p227]{Kopka-E}.
+% \begin{macrocode}
+\newcommand*\caption@centerlast{%
+ \advance\leftskip by 0pt plus 1fil%
+ \advance\rightskip by 0pt plus -1fil%
+ \parfillskip0pt plus 2fil\relax}
+%
+\newcommand*\caption@@@centerlast{%
+ \caption@centerlast\caption@label\captiontext}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@flushleft}
+% The `flushleft' caption style. Typeset the caption raggedright within a parbox.
+% \begin{macrocode}
+\newcommand*\caption@@@flushleft{%
+ \raggedright\caption@label\captiontext}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@flushright}
+% The `flushright' caption style. Typeset the caption raggedleft within a parbox.
+% \begin{macrocode}
+\newcommand*\caption@@@flushright{%
+ \raggedleft\caption@label\captiontext}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@hang}
+% \begin{macro}{\caption@hangplus}
+% The `hang' caption style.
+% This code was taken from \LaTeXcomp\cite[p155]{A-W:GMS94} and modified.
+% \begin{macrocode}
+\newcommand*\caption@@@hang{%
+ \sbox\@tempboxa{\caption@label}%
+ \hangindent\wd\@tempboxa\noindent
+ \usebox\@tempboxa\caption@hangplus\captiontext}
+%
+\newcommand*\caption@hangplus{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@hang@center}
+% The `hang+flushleft' caption style.
+% \begin{macrocode}
+\newcommand*\caption@@@hang@center{%
+ \let\caption@hangplus\centering\caption@@@hang}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@hang@centerlast}
+% The `hang+flushleft' caption style.
+% \begin{macrocode}
+\newcommand*\caption@@@hang@centerlast{%
+ \let\caption@hangplus\caption@centerlast\caption@@@hang}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@hang@flushleft}
+% The `hang+flushleft' caption style.
+% \begin{macrocode}
+\newcommand*\caption@@@hang@flushleft{%
+ \let\caption@hangplus\raggedright\caption@@@hang}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@indent}
+% The `indent' caption style. Is is quite like the `hang' style but the
+% indention is given as \cs{captionindent}.
+% \begin{macrocode}
+\newcommand*\caption@@@indent{%
+ \hangindent\captionindent\noindent
+ \caption@label\captiontext}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Options}
+%
+% \begin{macro}{normal}
+% \begin{macro}{center}
+% \begin{macro}{centerlast,anne}
+% \begin{macro}{flushleft}
+% \begin{macro}{flushright}
+% \begin{macro}{hang,isu}
+% \begin{macro}{indent}
+% These options will set the caption style.
+% (`normal' is the default one.)
+%
+% The options `anne' and `isu' are for
+% backward compatibility only.
+% \begin{macrocode}
+\DeclareOption{normal}{\captionstyle{normal}}
+\DeclareOption{center}{\captionstyle{center}}
+\DeclareOption{centerlast}{\captionstyle{centerlast}}
+\DeclareOption{flushleft}{\captionstyle{flushleft}}
+\DeclareOption{flushright}{\captionstyle{flushright}}
+\DeclareOption{anne}{\ExecuteOptions{centerlast}}
+\DeclareOption{hang}{\captionstyle{hang}}
+\DeclareOption{hang+center}{\captionstyle{hang+center}}
+\DeclareOption{hang+centerlast}{\captionstyle{hang+centerlast}}
+\DeclareOption{hang+flushleft}{\captionstyle{hang+flushleft}}
+\DeclareOption{isu}{\ExecuteOptions{hang}}
+\DeclareOption{indent}{\captionstyle{indent}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{scriptsize}
+% \begin{macro}{footnotesize}
+% \begin{macro}{small}
+% \begin{macro}{normalsize}
+% \begin{macro}{large,Large}
+% These options will set the caption size. We use \cs{g@addto@macro} so more that one
+% option can be set.
+% \begin{macrocode}
+\DeclareOption{scriptsize}{\g@addto@macro\captionsize\scriptsize}
+\DeclareOption{footnotesize}{\g@addto@macro\captionsize\footnotesize}
+\DeclareOption{small}{\g@addto@macro\captionsize\small}
+\DeclareOption{normalsize}{\g@addto@macro\captionsize\normalsize}
+\DeclareOption{large}{\g@addto@macro\captionsize\large}
+\DeclareOption{Large}{\g@addto@macro\captionsize\Large}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{up,it,sl,sc}
+% \begin{macro}{md,bf}
+% \begin{macro}{rm,sf,tt}
+% These options will set the caption label.
+% \begin{macrocode}
+\DeclareOption{up}{\g@addto@macro\captionlabelfont\upshape}
+\DeclareOption{it}{\g@addto@macro\captionlabelfont\itshape}
+\DeclareOption{sl}{\g@addto@macro\captionlabelfont\slshape}
+\DeclareOption{sc}{\g@addto@macro\captionlabelfont\scshape}
+\DeclareOption{md}{\g@addto@macro\captionlabelfont\mdseries}
+\DeclareOption{bf}{\g@addto@macro\captionlabelfont\bfseries}
+\DeclareOption{rm}{\g@addto@macro\captionlabelfont\rmfamily}
+\DeclareOption{sf}{\g@addto@macro\captionlabelfont\sffamily}
+\DeclareOption{tt}{\g@addto@macro\captionlabelfont\ttfamily}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{oneline}
+% \begin{macro}{nooneline}
+% These options will set the `oneline' flag.
+% (`oneline' is the default.)
+% \begin{macrocode}
+\DeclareOption{oneline}{\onelinecaptionstrue}
+\DeclareOption{nooneline}{\onelinecaptionsfalse}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@package}
+% A helper macro, a value of 1 within parameter \#2 will activate the support
+% of the package given in parameter \#1, a value of 0 will deactivate it.
+% \begin{macrocode}
+\newcommand*\caption@package[1]{\@namedef{caption@pkt@#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{float}
+% \begin{macro}{longtable}
+% \begin{macro}{subfigure}
+% \changes{v2.1}{19 Feb 02}{New options for interaction with other packages}
+% These options will enable or suppress the support of the packages
+% \textsf{float}, \textsf{longtable}, and \textsf{subfigure}.
+% \begin{macrocode}
+\DeclareOption{float}{\caption@twozerofalse\caption@package{float}{1}}
+\DeclareOption{longtable}{\caption@twozerofalse\caption@package{longtable}{1}}
+\DeclareOption{subfigure}{\caption@twozerofalse\caption@package{subfigure}{1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{none}
+% \begin{macro}{all}
+% These options will enable or suppress the support of all the above packages.
+% \begin{macrocode}
+\DeclareOption{none}{\caption@twozerofalse
+ \caption@package{float}{0}\caption@package{longtable}{0}%
+ \caption@package{subfigure}{0}}
+\DeclareOption{all}{\ExecuteOptions{float,longtable,subfigure}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{ruled}
+% \begin{macro}{boxed}
+% The option `ruled' introduced in \textsf{caption} v1.2 is obsolete now, but
+% we will still support it. The option `boxed' was introduced in version 2.0
+% and is obsolete now, too.
+% \begin{macrocode}
+\newif\ifcaption@ruled
+\DeclareOption{ruled}{\caption@ruledtrue}
+\DeclareOption{boxed}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{ignoreLTcapwidth}
+% This option will make the caption code ignore the setting of \cs{LTcapwidth}
+% and use the setting of \cs{setcaptionmargin} or \cs{setcaptionwidth} instead.
+% \begin{macrocode}
+\DeclareOption{ignoreLTcapwidth}{\ignoreLTcapwidthtrue}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{debug}
+% This option will put additional debug information in the log file.
+% \begin{macrocode}
+\DeclareOption{debug}{\caption@debugtrue}
+% \end{macrocode}
+% \end{macro}
+%
+% That's it! Now set the default values and start processing the options.
+% (If \cs{caption@twozero} is set to true (default) we will emulate the package
+% load algorithm of \textsf{caption} v2.0: If the package is already loaded
+% patch it, otherwise do nothing.)
+% \changes{v2.1}{19 Feb 02}{\cs{ProcessOptions} changed to \cs{ProcessOptions*}}
+% \begin{macrocode}
+\newif\ifcaption@debug
+\newif\ifcaption@twozero
+\normalcaptionparams
+\ExecuteOptions{none,normal}
+\caption@twozerotrue
+\ProcessOptions*
+\ifcaption@twozero
+ \PackageInfo{caption2}{Running in caption2 v2.0 compatibility mode}
+\fi
+% \end{macrocode}
+%
+% \subsection{More declarations}
+%
+% \begin{macro}{\captionof}
+% \begin{macro}{\captionof*}
+% \cs{captionof} resp.\ \cs{captionof*} will just set \cs{@captype} and do the normal
+% \cs{caption} resp.\ \cs{caption*}, so we can also typeset captions outside floating
+% environments.
+% \changes{v2.1}{19 Feb 02}{New commands \cs{captionof} and \cs{captionof*}}
+% \begin{macrocode}
+\def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}}
+\newcommand*\caption@of[2]{\def\@captype{#2}#1}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\abovecaptionskip}
+% \begin{macro}{\belowcaptionskip}
+% Not all document classes define \cs{abovecaptionskip} and \cs{belowcaptionskip}
+% (like \textsf{ucthesis}), so we do it here if not already done.
+% \changes{v2.1}{19 Feb 02}{\cs{abovecaptionskip} and \cs{belowcaptionskip} will be defined if neccessary}
+% \begin{macrocode}
+\@ifundefined{abovecaptionskip}{%
+ \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
+\@ifundefined{belowcaptionskip}{%
+ \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\captionlinewidth}
+% \changes{v2.1}{26 Feb 02}{Renamed from \cs{realcaptionwidth} to \cs{captionlinewidth}}
+% \changes{v2.1a}{12 Nov 03}{We offer \cs{realcaptionwidth}, again}
+% \begin{macro}{\captionlabel}
+% \begin{macro}{\captiontext}
+% These values are only set and used within the caption code itself.
+% \cs{captionlinewidth} will be set to the given vertical space for the caption,
+% normally this is \cs{linewidth}. (This value was called \cs{realcaptionwidth}
+% within \thispackage\ \mbox{2.0}, so we will offer this, too.)
+%
+% \cs{captionlabel} and \cs{captiontext} will be set to the caption label
+% resp.\ the caption text.
+% (Because \cs{captionlabel} and \cs{captiontext} will be locally defined with
+% \cs{def} we do not need to define them here.)
+% \begin{macrocode}
+\newdimen\captionlinewidth
+\newdimen\realcaptionwidth
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\usecaptionmargin}
+% A helper macro for caption style authors:
+% It calculates \cs{leftskip} and \cs{rightskip} out of
+% \cs{captionlinewidth} and \cs{captionmargin} resp.\ \cs{captionwidth}.
+% Also \cs{captionlinewidth} will be corrected to the appropriate value.
+% \begin{macrocode}
+\newcommand*\usecaptionmargin{%
+ \ifcaptionwidth
+ \leftskip\captionlinewidth
+ \advance\leftskip by -\captionwidth
+ \divide\leftskip by 2
+ \rightskip\leftskip
+ \captionlinewidth\captionwidth
+ \else
+ \leftskip\captionmargin
+ \rightskip\captionmargin
+ \advance\captionlinewidth by -2\captionmargin
+ \fi
+ \realcaptionwidth\captionlinewidth}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\onelinecaption}
+% This macro definition helps setting captions the \LaTeX\ base classes way:
+% If \cs{ifonelinecaptions} is set and the 1st argument fits within \cs{captionlinewidth},
+% we typeset it centered -- otherway we typeset the 2nd argument.
+% (We use the savebox \cs{@tempboxa} as helper for this.)
+% \begin{macrocode}
+\newcommand\onelinecaption[1]{%
+ \let\next\@firstofone
+ \ifonelinecaptions
+ \sbox\@tempboxa{#1}%
+ \ifdim\wd\@tempboxa >\captionlinewidth
+ \else
+ \def\next{{\centering\usebox\@tempboxa\par}\@gobble}%
+ \fi
+ \fi\next}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\usecaptionstyle}
+% First we check if we are inside a caption -- if \cs{captiontext} is undefined we are not.
+% If we are we call the appropriate caption definition.
+%
+% \changes{v2.1b}{16 Apr 04}{Missing percent added (and extra space removed)}
+% \begin{macrocode}
+\newcommand*\usecaptionstyle[1]{%
+ \@ifundefined{captiontext}{%
+ \PackageError{caption2}{You can't use \protect#1
+ in normal text}{The usage of \protect#1 is only
+ allowed inside code declared with\MessageBreak \protect\defcaptionstyle,
+ \protect\newcaptionstyle \space or \protect\renewcaptionstyle.
+ \space\caption@eh}
+ }{%
+ \@ifundefined{caption@@#1}%
+ {\PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}}%
+ {\@nameuse{caption@@#1}}%
+ }}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makecaption}
+% This is the heart of the \thispackage\ package -- the redefinition of the
+% core caption code. It was taken from the \LaTeXe\ standard classes and modified.
+% It's very easy -- apart from using \cs{abovecaptionskip} and \cs{belowcaptionskip}
+% we just set \cs{captionlinewidth}, \cs{captionlabel} and \cs{captiontext}
+% to its appropriate values and using the code of the actual caption style via
+% \cs{usecaptionstyle}.
+% \begin{macrocode}
+\renewcommand\@makecaption[2]{%
+ \vskip\abovecaptionskip
+ \captionlinewidth\hsize
+ \realcaptionwidth\hsize
+ \def\captionlabel{#1}%
+ \def\captiontext{#2}%
+ \usecaptionstyle\caption@style
+ \vskip\belowcaptionskip}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Support of other packages}
+%
+% \begin{macro}{\caption@package}
+% This macro will execute the code needed to support the package
+% named within argument \#1. The parameter \#2 is the command
+% which shows if the package is loaded -- it is defined, it is
+% already loaded, otherwise not. The parameter \#3 contains code
+% which will be executed if no support is required -- this is for
+% cleanup purposes. The final parameter \#4 contains the code itself.
+% \changes{v2.1c}{9 May 04}{Compatibility warning removed}
+% \begin{macrocode}
+\renewcommand*\caption@package[3]{%
+ \if1\@nameuse{caption@pkt@#1}%
+ \@ifundefined{#2}%
+ {\let\next\AtBeginDocument}%
+ {\let\next\@firstofone}%
+ \else\ifcaption@twozero
+ \@ifundefined{#2}%
+ {#3\let\next\@gobble}%
+ {\let\next\@firstofone}%
+ \else
+ #3\let\next\@gobble
+ \fi\fi
+ \expandafter\let\csname caption@pkt@#1\endcsname\undefined
+ \ifcaption@debug
+ \ifx\next\@gobble\PackageInfo{caption2}{#1 => gobble}%
+ \else\ifx\next\@firstofone\PackageInfo{caption2}{#1 => firstofone}%
+ \else\ifx\next\AtBeginDocument\PackageInfo{caption2}{#1 => AtBeginDocument}%
+ \fi\fi\fi
+ \fi
+ \next}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Support of the \puresf{float} package}
+%
+% \begin{macrocode}
+\caption@package{float}{floatc@plain}{}{%
+ \ifx\floatc@plain\relax
+ \PackageWarning{caption2}{%
+ Option `float' was set but there is no float package loaded}
+ \else
+ \PackageInfo{caption2}{float package v1.2 (or newer) detected}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@floatc}
+% First we define a helper macro to typeset the caption via \cs{usecaptionstyle},
+% the 1st parameter is the caption style name,
+% the 2nd and 3rd are the caption label and text.
+%
+% \textsf{caption2} has the goal not to modify the output just by
+% loading it (without options), therefore we have to be tricky here to
+% support \cs{@fs@cfont} which is in fact the same as our \cs{captionlabelfont}.
+% So we test if a \cs{captionlabelfont} has been set by the user -- if not
+% \cs{@fs@cfont} will be used, otherwise \cs{captionlabelfont}.
+%
+% \changes{v2.1b}{19 Mar 04}{\cs{realcaptionwidth}$=$\cs{hsize} was missing here}
+% \begin{macrocode}
+ \newcommand\caption@floatc[3]{%
+ \ifx\captionlabelfont\@empty
+ \let\captionlabelfont\@fs@cfont
+ \fi
+ \captionlinewidth\hsize
+ \realcaptionwidth\hsize
+ \def\captionlabel{#2}%
+ \def\captiontext{#3}%
+ \usecaptionstyle{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\floatc@plain}
+% Now we can redefine the caption code of the \textsf{float} package.
+% Here we redefine \cs{floatc@plain} to use our caption code, so
+% \texttt{plain} and \texttt{boxed} float types will use the actual
+% caption style set by the user.
+% \begin{macrocode}
+ \renewcommand*\floatc@plain{\caption@floatc{\caption@style}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\floatc@ruled}
+% The support of the \texttt{ruled} float type is a little
+% more complex. First we define a caption style `ruled' so the end-user
+% can change this caption style afterwards. If the (obsolete) option
+% `ruled' is set, we define it in a \textsf{caption} v1.x compatible way,
+% otherwise we define it in a \textsf{float} compatible way.
+%
+% Then we redefine \cs{floatc@ruled} so the caption style `ruled' will
+% be used.
+% \begin{macrocode}
+ \ifcaption@ruled
+ \dummycaptionstyle{ruled}{\onelinecaptionsfalse\setcaptionmargin{\z@}}%
+ \else
+ \newcaptionstyle{ruled}{%
+ \ifcaptionlabel
+ {\@fs@cfont\captionlabel}\space%
+ \fi\captiontext\par}%
+ \fi
+%
+ \renewcommand*\floatc@ruled{\caption@floatc{ruled}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@of}
+% Typesetting captions outside floats is not so easy with redefined floats,
+% because
+% \begin{itemize}
+% \item The caption code of the \textsf{float} package needs not only
+% \cs{@captype} defined, but \cs{@fs@capt} (the command which will typeset the
+% caption itself) either.
+% \item The caption is only saved within a \cs{vbox}, so the \textsf{float}
+% package can typeset the caption later at it's float style specific place
+% (that means at top or at the bottom of the float).
+% \end{itemize}
+%
+% Here is the new code: First we check if it's a restyled float by checking if
+% \cs{fst@<floattype>} is defined. If yes, we use this command (it will define
+% \cs{@fs@capt}).
+% Then we execute \cs{@float@setevery}, if it exists (that means we are
+% dealing with the \textsf{float} package 1.3 or newer here).
+% Now comes the basic trick:
+% We redefine the caption typesetting command \cs{@fs@capt}, so it will close
+% the \cs{vbox}, typeset the caption outside the vbox and finally start the
+% group again so the original \cs{@fs@capt} is happy with closing the group.
+%
+% \begin{macrocode}
+ \renewcommand*\caption@of[2]{\def\@captype{#2}%
+ \@ifundefined{fst@#2}{}{%
+ \@nameuse{fst@#2}%
+ \@ifundefined{@float@setevery}{}{\@float@setevery{#2}}%
+ \let\caption@fs@capt\@fs@capt
+ \let\@fs@capt\caption@of@float}%
+ #1}
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \newcommand\caption@of@float[2]{\egroup
+ \vskip\abovecaptionskip
+ \normalsize\caption@fs@capt{#1}{#2}%
+ \vskip\belowcaptionskip
+ \bgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \fi}
+% \end{macrocode}
+%
+% \subsubsection{Support of the \puresf{longtable} package}
+%
+% \begin{macrocode}
+\caption@package{longtable}{LT@makecaption}{}{%
+ \ifx\LT@makecaption\relax
+ \PackageWarning{caption2}{%
+ Option `longtable' was set but there is no longtable package loaded}
+ \else
+ \PackageInfo{caption2}{longtable package v3.15 (or newer) detected}
+% \end{macrocode}
+%
+% \begin{macro}{\LT@makecaption}
+% David Carlisle was so kind to introduce a macro called
+% \cs{LT@makecaption} in version 3.15 of the \textsf{longtable}
+% package which typeset the caption and can be easily redefined.
+%
+% This is the original definition:
+% \begin{quote}
+% |\def\LT@makecaption#1#2#3{%|\\
+% | \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%|\\
+% | |$\langle$\textit{typeset} |#1{#2: }#3| \textit{as caption}$\rangle$\\
+% | \endgraf\vskip\baselineskip}%|\\
+% | \hss}}}|
+% \end{quote}
+%
+% So we do here:
+% First we define a new (dummy) caption style `longtable',
+% than we redefine \cs{LT@makecaption} so this style will be used.
+% (Remember: |#1| is |\@gobble| in star form of |\caption|,
+% and |\@firstofone| otherwise.)
+% \begin{macrocode}
+ \dummycaptionstyle{longtable}{}
+%
+ \renewcommand\LT@makecaption[3]{%
+ \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{%
+ \ifignoreLTcapwidth
+ \else
+ \setcaptionwidth\LTcapwidth
+ \fi
+ \captionlinewidth\hsize
+ \realcaptionwidth\hsize
+ \captionlabelfalse#1\captionlabeltrue
+ \def\captionlabel{#2}%
+ \def\captiontext{#3}%
+ \usecaptionstyle{longtable}%
+ \endgraf\vskip\baselineskip}%
+ \hss}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \fi}
+% \end{macrocode}
+%
+% \subsubsection{Support of the \puresf{subfigure} package}
+%
+% Some of the following code will not work within \cs{if},
+% because of the (yet) undefined \cs{if}\textit{xxx}s. So we simply define
+% the critical code within the helper commands \cs{setsubcapstyle}
+% and \cs{caption@makesubcaption} already here.
+%
+% \begin{macro}{\setsubcapstyle}
+% This sets the subcaptionstyle to a appropriate value.
+%
+% If \cs{ifsubcapraggedright} is undefined (it was introduced
+% into v2.1 of the \textsf{subfigure} package) we define it first.
+% \begin{macrocode}
+\newcommand*\setsubcapstyle{%
+ \@ifundefined{subcapraggedrightfalse}{%
+ \newif\ifsubcapraggedright}{}%
+ \ifsubcaphang
+ \ifsubcapcenter
+ \subcapstyle{hang+center}%
+ \else\ifsubcapcenterlast
+ \subcapstyle{hang+centerlast}%
+ \else\ifsubcapraggedright
+ \subcapstyle{hang+flushleft}%
+ \else
+ \subcapstyle{hang}%
+ \fi\fi\fi
+ \else\ifsubcapcenter
+ \subcapstyle{center}%
+ \else\ifsubcapcenterlast
+ \subcapstyle{centerlast}%
+ \else\ifsubcapraggedright
+ \subcapstyle{flushleft}%
+ \else
+ \subcapstyle{normal}%
+ \fi\fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makesubcaption}
+% This will typeset the subcaption.
+% We just set all our \cs{caption}\textit{xxx} values to
+% the values of \cs{subcap}\textit{xxx} and typeset the
+% caption like \textsf{subfigure} within a \cs{hbox},
+% but with the help of \cs{usecaptionstyle}.
+%
+% But this is not as easy as it seems. We typeset the caption like this:
+% \begin{quote}
+% |\captionfont|\\
+% | {\capionlabelfont\captionlabel\captionlabeldelim}%|\\
+% |\captionlabelsep\captiontext|
+% \end{quote}
+% Within \textsf{subfigure} 2.0 the caption will be set quite similar to:
+% \begin{quote}
+% |\subcapsize|\\
+% | {\subcaplabelfont\captionlabel}%|\\
+% |\space\captiontext|
+% \end{quote}
+% But within \textsf{subfigure} 2.1 this has changed to:
+% \begin{quote}
+% |\subcapsize|\\
+% | {\subcaplabelfont\captionlabel}%|\\
+% |\hskip\subfiglabelskip|\\
+% | {\subcapfont\captiontext}}|
+% \end{quote}
+% So we have to be tricky here: We set \cs{captionlabelfont} to \cs{normalfont} plus
+% \cs{subcapsize} \& \cs{subcaplabelfont}, so the font setting in \cs{captionfont}
+% will not affect the caption label in subfigure captions.
+%
+% Note that \cs{hfil} has changed to \cs{hss} from subfigure 2.0 to 2.1,
+% so we use \cs{caption@subfig@hss} instead. (We will define this later on.)
+% \begin{macrocode}
+\newcommand\caption@makesubcaption[2]{%
+ \renewcommand*\captionfont{\subcapsize\subcapfont}%
+ \renewcommand*\captionlabelfont{\normalfont\subcapsize\subcaplabelfont}%
+ \let\captionlabeldelim\subcaplabeldelim
+ \let\captionlabelsep\subcaplabelsep
+ \ifsubfigcapwidth\captionwidthtrue\else\captionwidthfalse\fi
+ \setlength\captionmargin\subfigcapmargin
+ \setlength\captionwidth\subfigcapwidth
+ \captionindent\subcapindent
+ \ifsubcapnooneline\onelinecaptionsfalse\else\onelinecaptionstrue\fi
+ \hbox to\@tempdima{%
+ \caption@subfig@hss\parbox[t]\@tempdima{%
+ \captionlinewidth\@tempdima
+ \realcaptionwidth\@tempdima
+ \captionlabeltrue
+ \def\captionlabel{#1}%
+ \def\captiontext{\ignorespaces #2}%
+ \usecaptionstyle\caption@substyle}%
+ \caption@subfig@hss}}
+% \end{macrocode}
+% \end{macro}
+%
+% If the subfigure support is not needed, we throw
+% the helper macros in the garbage can.
+%
+% \begin{macrocode}
+\caption@package{subfigure}{@makesubfigurecaption}{%
+ \let\setsubcapstyle\undefined
+ \let\caption@makesubcaption\undefined}{%
+ \ifx\@makesubfigurecaption\relax
+ \PackageWarning{caption2}{%
+ Option `subfigure' was set but there is no subfigure package loaded}
+ \let\setsubcapstyle\undefined
+ \let\caption@makesubcaption\undefined
+ \else
+% \end{macrocode}
+%
+% Some stuff has changed from version 2.0 to 2.1 of the
+% \textsf{subfigure} package, so we make a branch here.
+% If \cs{subcapfont} is undefined we assume v2.0,
+% otherwise we assume v2.1 or newer.
+%
+% \begin{macrocode}
+ \ifx\subcapfont\undefined
+ \PackageInfo{caption2}{subfigure package v2.0 detected}
+% \end{macrocode}
+%
+% \begin{macro}{\subcapfont}
+% We define \cs{subcapfont} here so we can use it later
+% in common code for \textsf{subfigure} v2.0 and v2.1 (or newer).
+% \begin{macrocode}
+ \let\subcapfont\@empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\subfigcapwidth}
+% \begin{macro}{\setsubcapmargin}
+% \begin{macro}{\setsubcapwidth}
+% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and
+% \cs{setcaptionwidth} we define \cs{subfigcapwidth},
+% \cs{setsubcapmargin}, and \cs{setsubcapwidth}.
+%
+% Note: \cs{subfigcapmargin} is a command in v2.0 of \textsf{subfigure}.
+% So we make \cs{subfigcapwidth} a command, too.
+% \begin{macrocode}
+ \newcommand*\subfigcapwidth{\z@}
+ \newcommand*\setsubcapmargin{%
+ \subfigcapwidthfalse
+ \renewcommand*\subfigcapmargin}
+ \newcommand*\setsubcapwidth{%
+ \subfigcapwidthtrue
+ \renewcommand*\subfigcapwidth}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\subcaplabelsep}
+% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}.
+% \begin{macrocode}
+ \newcommand*\subcaplabelsep{\space}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subfig@hss}
+% This will be uses within the caption code itself.
+% \begin{macrocode}
+ \let\caption@subfig@hss\hfil
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \else
+ \PackageInfo{caption2}{subfigure package v2.1 (or newer) detected}
+% \end{macrocode}
+%
+% \begin{macro}{\subfigcapwidth}
+% \begin{macro}{\setsubcapmargin}
+% \begin{macro}{\setsubcapwidth}
+% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and
+% \cs{setcaptionwidth} we define \cs{subfigcapwidth},
+% \cs{setsubcapmargin}, and \cs{setsubcapwidth}.
+%
+% Note: \cs{subfigcapmargin} is a length in v2.1 of \textsf{subfigure}.
+% So we make \cs{subfigcapwidth} a length, too.
+% \begin{macrocode}
+ \newdimen\subfigcapwidth
+ \newcommand*\setsubcapmargin{%
+ \subfigcapwidthfalse
+ \setlength\subfigcapmargin}
+ \newcommand*\setsubcapwidth{%
+ \subfigcapwidthtrue
+ \setlength\subfigcapwidth}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\subcaplabelsep}
+% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}.
+% \begin{macrocode}
+ \newcommand*\subcaplabelsep{\hskip\subfiglabelskip}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subfig@hss}
+% This will be uses within the caption code itself.
+% \begin{macrocode}
+ \let\caption@subfig@hss\hss
+% \end{macrocode}
+%
+% \end{macro}
+% \begin{macrocode}
+ \fi
+% \end{macrocode}
+%
+% Here starts the common code for \textsf{subfigure} v2.0 and v2.1.
+%
+% \begin{macro}{\ifsubfigcapwidth}
+% \begin{macro}{\subcapindent}
+% \begin{macro}{\subcaplabeldelim}
+% Analogous to \cs{ifcaptionwidth}, \cs{captionindent} \& \cs{captionlabeldelim}
+% we define \cs{ifsubfigcapwidth}, \cs{subcapindent} \& \cs{subcaplabeldelim}
+% \begin{macrocode}
+ \newif\ifsubfigcapwidth
+ \newdimen\subcapindent
+ \newcommand*\subcaplabeldelim{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\subcapstyle}
+% Analogous to \cs{captionstyle} we define \cs{subcapstyle}
+% and set it (via \cs{setsubcapstyle}) to a appropriate value.
+% \begin{macrocode}
+ \newcommand*\subcapstyle[1]{%
+ \expandafter\ifx\csname caption@@#1\endcsname\relax
+ \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}%
+ \else
+ \def\caption@substyle{#1}%
+ \fi}
+ \setsubcapstyle
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@thesubfigure}
+% \begin{macro}{\@thesubtable}
+% The \textsf{subfigure} package makes use of \cs{subcaplabelfont} and
+% \cs{subfiglabelskip} within its \cs{@thesub}\textit{xxx} macros.
+% This is totally in contrast to the way the \textsf{caption2} package
+% handle these settings. So we redefine the \cs{@thesub}\textit{xxx}
+% to be just the plain label and nothing else.
+%
+% \begin{macrocode}
+ \renewcommand*\@thesubfigure{\thesubfigure}
+ \renewcommand*\@thesubtable{\thesubtable}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@makesubfigurecaption}
+% \begin{macro}{\@makesubtablecaption}
+% Now we are ready to redefine \cs{@makesubfigurecaption}.
+% \begin{macrocode}
+ \let\@makesubfigurecaption\caption@makesubcaption
+ \let\@makesubtablecaption\caption@makesubcaption
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ \fi}
+% \end{macrocode}
+%
+% That's all folks!
+%
+% \begin{macrocode}
+\let\caption@package\undefined
+% \end{macrocode}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \begin{thebibliography}{9}
+% \bibitem{float}
+% Anselm Lingnau:
+% \textsl{An Improved Environment for Floats},
+% 2001/11/08
+% \bibitem{longtable}
+% David Carlisle:
+% \textsl{The longtable package},
+% 2000/10/22
+% \bibitem{rotating}
+% Sebastian Rahtz and Leonor Barroca:
+% \textsl{A style option for rotated objects in \LaTeX},
+% 1997/09/26
+% \bibitem{subfigure}
+% Steven Douglas Cochran:
+% \textsl{The subfigure package},
+% 2002/02/14
+% \bibitem{A-W:GMS94}
+% Michel Goossens, Frank Mittelbach and Alexander Samarin:
+% \newblock \textsl{The {\LaTeX} Companion},
+% \newblock Addison-Wesley, Reading, Massachusetts, 1994.
+% \bibitem{Anne}
+% Anne Br\"uggemann-Klein:
+% \textsl{Einf\"uhrung in die Dokumentverarbeitung},
+% B.G. Teubner, Stuttgart, 1989
+% \bibitem{Kopka-E}
+% Helmut Kopka:
+% \textsl{\LaTeX -- Erweiterungsm\"oglichkeiten},
+% 3. \"uberarbeitete Auf\/lage, Addison-Wesley, Bonn, 1991
+% \end{thebibliography}
+%
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.0/caption.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.0/caption.dtx
new file mode 100644
index 00000000000..7f7b4a49d1b
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.0/caption.dtx
@@ -0,0 +1,5077 @@
+% \iffalse meta-comment
+%
+% This is file `caption.dtx'.
+%
+% Copyright (C) 1994-2007 Axel Sommerfeldt (caption@sommerfee.de)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files caption.ins, caption.dtx,
+% caption2.dtx, and anleitung.tex and the derived files
+% caption.sty, caption2.sty, caption3.sty, and manual.tex.
+%
+% \fi
+% \CheckSum{2178}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+\newcommand\NEWfeature{\NEW{New feature}}
+\newcommand\NEWdescription{\NEW{New description}}
+\newcommand\NEW[2]{\hskip 1sp \marginpar{\footnotesize\sffamily\raggedleft#1\\#2}}
+%
+\font\manual=manfnt
+\newcommand\DANGER{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{\manual\char127}}}}
+%
+\ifx\pdfoutput\undefined\else
+ \ifcase\pdfoutput\else
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+ \fi
+\fi
+%
+%\usepackage[french,USenglish]{babel}
+\usepackage{color,setspace}
+%
+%\usepackage{float}
+\usepackage{longtable}
+%\usepackage[raggedright]{sidecap}
+%
+\usepackage{caption}[2005/08/24]
+\DeclareCaptionLabelSeparator{endash}{\space\textendash\space}
+\usepackage{hyperref}
+%
+\DeclareCaptionFont{red}{\color{red}}
+\DeclareCaptionFont{green}{\color{green}}
+\DeclareCaptionFont{blue}{\color{blue}}
+%
+\DeclareCaptionLabelSeparator{period-newline}{. \\}
+\DeclareCaptionStyle{period-newline}[labelsep=period]{labelsep=period-newline}
+\DeclareCaptionStyle{period-newline2}[labelsep=period,justification=centering]{labelsep=period-newline}
+\DeclareCaptionStyle{period-newline3}[labelsep=period]{labelsep=period-newline,justification=centering}
+\DeclareCaptionFormat{reverse}{#3#2#1}
+\DeclareCaptionFormat{llap}{\llap{#1#2}#3\par}
+\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)}
+\DeclareCaptionLabelSeparator{fill}{\hfill}
+%
+\DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
+ M\kern.05em A\kern.1em-\kern.1em Script}}
+%
+%<+driver>\OnlyDescription
+%
+\begin{document}
+ \DocInput{caption.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
+% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
+% \let\package\puresf\def\thispackage{\package{caption}}
+% \let\env\purett \let\opt\purett
+%
+% \newcommand*\version[2][]{$v#2$}
+%
+% \newenvironment{Options}[1]%
+% {\list{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}%
+% \settowidth{\labelwidth}{\texttt{#1\space}}%
+% \setlength{\leftmargin}{\labelwidth}%
+% \addtolength{\leftmargin}{\labelsep}}}%
+% {\endlist}
+%
+% \newenvironment{Example}%
+% {\ifvmode\else\unskip\par\fi
+% \minipage{\linewidth}\smallskip}%
+% {\smallskip\endminipage}
+% \newcommand\example[3][figure]{%
+% \begingroup
+% \captionsetup{#2}%
+% \captionof{#1}[]{#3}%
+% \endgroup}
+%
+% \GetFileInfo{caption.sty}
+% \title{Typesetting captions with the
+% \thispackage\ package\thanks{This package has version number
+% \fileversion, last revised \filedate.}}
+% \author{Axel Sommerfeldt\\\href{mailto:caption@sommerfee.de}{\texttt{caption@sommerfee.de}}}
+% \date{2007/04/09}
+% \maketitle
+%
+% \begin{abstract}
+% The \thispackage\ package offers customization of captions
+% in floating environments such |figure| and |table| and cooperates with
+% many other packages.\footnote{A complete re-work of the user interface
+% done with Steven D. Cochran and Frank Mittelbach has lead to
+% this new enhanced version 3.0.}
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \newcommand\figuretext{^^A
+% White sand beaches. The pink smoothness of the conch shell. A sea abundant
+% with possibilities. Duty-free shops filled with Europe's finest gifts and
+% perfumes. Play your favorite game of golf amidst the tropical greens on one
+% of the many championship courses.}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \section{Introduction}
+%
+% Within the standard \LaTeX\ classes captions haven't received the attention
+% they deserve. Simply typeset as an ordinary paragraph there is no
+% remarkable visual difference from the rest of the text, like here:
+%
+% \example{belowskip=\abovecaptionskip}{\figuretext}
+%
+% There should be possibilities to change this; for example, it would be nice
+% if you could make the text of the caption a little bit smaller as the normal
+% text, add an extra margin, typeset the caption label with the same font
+% family and shape as your headings etc. Just like this one:
+%
+% \example{belowskip=\abovecaptionskip,size=small,margin=10pt,labelfont=bf,labelsep=endash}{\figuretext}
+%
+% You can do this easily with this package as there are many ready-to-use
+% caption formatting options, but you are free to define your very own stuff, too.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \pagebreak[4]
+% \section{Using the package}
+% \label{usage}
+%
+% \DescribeMacro{\usepackage}
+% Insert
+% \begin{quote}
+% |\usepackage|\oarg{options}|{caption}[|\texttt{\filedate}|]|
+% \end{quote}
+% into the preamble of your document, i.e.~the part of your document
+% between |\documentclass| and |\begin{document}|.
+% The options control how your captions will look like; e.g.,
+% \begin{quote}
+% |\usepackage[margin=10pt,font=small,labelfont=bf]{caption}|
+% \end{quote}
+% would result in captions looking like the second one in the introduction.
+%
+% \DescribeMacro{\captionsetup}
+% For a later change of options the \thispackage\ package provides the command
+% \begin{quote}
+% |\captionsetup|\oarg{float type}\marg{options}
+% \end{quote}
+% So
+% \begin{quote}
+% |\usepackage[margin=10pt,font=small,labelfont=bf]{caption}|
+% \end{quote}
+% and
+% \begin{quote}
+% |\usepackage{caption}|\\
+% |\captionsetup{margin=10pt,font=small,labelfont=bf}|
+% \end{quote}
+% are equal in their results.
+%
+% It's good to know that |\captionsetup| has an effect on the current
+% environment only. So if you want to change some settings for the
+% current |figure| or |table| only, just place the |\captionsetup| command
+% inside the |figure| or |table| right before the |\caption| command.
+% For example
+% \begin{quote}
+% |\begin{figure}|\\
+% | |\ldots\\
+% | \captionsetup{singlelinecheck=off}|\\
+% | \caption{|\ldots|}|\\
+% |\end{figure}|
+% \end{quote}
+% switches the single-line-check off, but only for this |figure| so all
+% the other captions remain untouched.
+%
+% (For a description of the optional parameter \meta{float type} see
+% section \ref{misc}: \textit{``Useful stuff''}.)
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \pagebreak[3]
+% \section{Options}
+%
+% \def\OptionLabel{RaggedRight}
+% \def\UserDefined{\ldots}
+% \makeatletter
+% \newcommand*\Section{\@ifstar{\@Section\relax}{\@Section{section}}}
+% \newcommand*\@Section[3]{#1 \ref{#2}: \textit{``#3''}}
+% \makeatother
+% \newcommand*\See[1]{{\small (See #1)}}
+% \newcommand*\SeeUserDefined[1][]{%
+% \See{\Section{declare}{Do it yourself}#1}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Formatting}
+%
+% \DescribeMacro{format=}
+% A figure or table caption mainly consits of three parts: the caption label,
+% which says if this object is a `Figure' or `Table' and what number is
+% associated with it, the caption text itself, which is normally a short
+% description of contents, and the caption separator which separates the text
+% from the label.
+%
+% The \textit{caption format} determines how this information will be presented;
+% it is specified with the option
+% \begin{quote}
+% |format=|\meta{format name}\quad ,
+% \end{quote}
+% having the name of the caption format as its argument.
+%
+% There are two standard caption formats:
+% \iffalse
+% \footnote{You have the option to
+% define your own ones, too. See section \ref{declare}:
+% \textit{``Do it yourself!''} for details.}
+% \fi
+%
+% \begin{Options}{\OptionLabel}
+% \item[plain]\NEWdescription{v3.0h}
+% Typesets the captions as a normal paragraph.
+% (This is the default behaviour, it
+% is adapted from the standard \LaTeX\ document classes.)
+%
+% \item[hang]
+% Indents the caption text, so it will `hang' under the first line of the text.
+%
+% \item[\UserDefined]
+% Own formats can be defined using |\DeclareCaptionFormat|.
+% \SeeUserDefined
+% \end{Options}
+%
+% \begin{Example}
+% An example: Specifying the option
+% \begin{quote}
+% |format=hang|
+% \end{quote}
+% yields captions like this:
+% \example{format=hang}{\figuretext}
+% \end{Example}
+%
+% \DescribeMacro{indention=}
+% For both formats (\texttt{plain} and \texttt{hang}) you can setup an extra
+% indention starting at the second line of the caption. You do this with the
+% option
+% \begin{quote}
+% |indention=|\meta{amount}.
+% \end{quote}
+%
+% Two examples:
+%
+% \begin{Example}
+% \begin{quote}
+% |format=plain,indention=.5cm|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{format=plain,indention=.5cm}{\figuretext}
+% \end{Example}
+%
+% \begin{Example}
+% \begin{quote}
+% |format=hang,indention=-0.5cm|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{format=hang,indention=-0.5cm}{\figuretext}
+% \end{Example}
+%
+% \pagebreak[3]
+% \DescribeMacro{labelformat=}
+% With the option
+% \nopagebreak[3]
+% \begin{quote}
+% |labelformat=|\meta{label format name}
+% \end{quote}
+% \NEWdescription{v3.0e}
+% you specify how the caption label will be typeset.
+% There are four standard caption label formats:
+%
+% \begin{Options}{\OptionLabel}
+% \item[default]
+% The caption label will be typeset as specified by the document class,
+% usually this means the name and the number (like \texttt{simple}).
+% (This is the default behaviour.)
+%
+% \item[empty]
+% The caption label will be empty. (This option makes sense when used
+% together with other options like \texttt{labelsep=none}.)
+%
+% \item[simple]
+% The caption label will be typeset as a name and a number.
+%
+% \item[parens]
+% The number of the caption label will be typeset in parentheses.
+%
+% \item[\UserDefined]
+% Own label formats can be defined using |\DeclareCaptionLabelFormat|.
+% \SeeUserDefined
+% \end{Options}
+%
+% \begin{Example}
+% An example: Using the options
+% \begin{quote}
+% |labelformat=parens,labelsep=quad|
+% \end{quote}
+% gives captions like this one:
+% \example{labelformat=parens,labelsep=quad}{\figuretext}
+% \end{Example}
+%
+% \DescribeMacro{labelsep=}
+% With the option
+% \begin{quote}
+% |labelsep=|\meta{label separator name}
+% \end{quote}
+% you specify what caption separator will be used.
+% You can choose one of the following:
+%
+% \begin{Options}{\OptionLabel}
+% \item[none]
+% There is no caption separator. (This option makes sense when used
+% together with other options like \texttt{labelformat=empty}.)
+%
+% \item[colon]
+% The caption label and text will be separated by a colon and a space.
+% (This is the default one.)
+%
+% \item[period]
+% The caption label and text will be separated by a period and a space.
+%
+% \item[space]
+% The caption label and text will be separated by a single space.
+%
+% \item[quad]
+% The caption label and text will be separated by a |\quad|.
+%
+% \item[newline]
+% The caption label and text will be separated by a line break (|\\|).
+%
+% \item[endash]\NEWfeature{v3.0h}
+% The caption label and text will be separated by an en-dash,
+% surrounded by spaces (| -- |).
+%
+% \item[\UserDefined]
+% Own separators can be defined using |\DeclareCaptionLabelSeparator|.
+% \SeeUserDefined
+% \end{Options}
+%
+% Three examples:
+% \begin{Example}
+% \begin{quote}
+% |labelsep=period|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{labelsep=period}{\figuretext}
+% \end{Example}
+%
+% \begin{Example}
+% \begin{quote}
+% |labelsep=newline,singlelinecheck=false|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{labelsep=newline,singlelinecheck=false}{\figuretext}
+% \end{Example}
+%
+% \begin{Example}
+% \begin{quote}
+% |labelsep=endash|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{labelsep=endash}{\figuretext}
+% \end{Example}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Justification}
+% \label{justification}
+%
+% \DescribeMacro{justification=}
+% As addition to the caption format you could also specify a
+% \emph{caption justification}; it is specified with the option
+% \begin{quote}
+% |justification=|\meta{justification name}\quad.
+% \end{quote}
+%
+% You can choose one of the following:
+%
+% \begin{Options}{\OptionLabel}
+% \item[justified]
+% Typesets the caption as a normal paragraph. (This is the default.)
+%
+% \item[centering]
+% Each line of the caption will be centered.
+%
+% \iffalse
+% \item[Centering]
+% Each line of the caption will be centered, too.
+% But this time the command |\Centering| of the \package{ragged2e} package
+% will be used to achieve this. This difference is that this time the word
+% breaking algorithm of \TeX\ will work inside the caption.
+% \fi
+%
+% \item[centerlast]
+% The last line of each paragraph of the caption text will be centered.
+%
+% \item[centerfirst]
+% Only the first line of the caption will be centered.
+%
+% \item[raggedright]
+% Each line of the caption will be moved to the left margin.
+%
+% \iffalse
+% \item[RaggedRight]
+% Each line of the caption will be moved to the left margin using
+% the command |\RaggedRight| from the \package{ragged2e} package.
+% \fi
+% \item[RaggedRight]
+% Each line of the caption will be moved to the left margin, too.
+% But this time the command |\RaggedRight| of the \package{ragged2e} package
+% will be used to achieve this. The main difference is that the word
+% breaking algorithm of \TeX\ will work inside captions.
+%
+% \item[raggedleft]
+% Each line of the caption will be moved to the right margin.
+%
+% \iffalse
+% \item[RaggedLeft]
+% Each line of the caption will be moved to the right margin using
+% the command |\RaggedLeft| from the \package{ragged2e} package.
+% \fi
+%
+% \item[\UserDefined]
+% Own justifications can be defined using |\DeclareCaptionJustification|.
+% \SeeUserDefined
+% \end{Options}
+%
+% Three examples:
+% \begin{Example}
+% \begin{quote}
+% |justification=centerlast|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{justification=centerlast}{\figuretext}
+% \end{Example}
+%
+% \begin{Example}
+% \begin{quote}
+% |format=hang,justification=raggedright|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{format=hang,justification=raggedright}{\figuretext}
+% \end{Example}
+%
+% \begin{Example}
+% \begin{quote}
+% |labelsep=newline,justification=centering|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{belowskip=\abovecaptionskip,labelsep=newline,justification=centering}{\figuretext}
+% \end{Example}
+%
+% \DescribeMacro{singlelinecheck=}
+% The standard \LaTeX\ document classes (|article|, |report|, and |book|)
+% automatically center a caption if it fits in one single line:
+%
+% \example{belowskip=\abovecaptionskip}{A short caption.}
+%
+% \DANGER
+% The \thispackage\ package adapts this behaviour and therefore usually
+% ignores the justification you have set with |justification=| in such case.
+% But you can switch this special treatment of such short captions off
+% with the option
+% \begin{quote}
+% |singlelinecheck=|\meta{bool}\quad.
+% \end{quote}
+% Using |false|, |no|, |off| or |0| for \meta{bool} switches the
+% extra centering off:
+% \begin{quote}
+% |singlelinecheck=false|
+% \end{quote}
+% Doing so the above short caption would look like
+%
+% \begingroup
+% \captionsetup{type=figure}
+% \ContinuedFloat
+% \endgroup
+% \example{belowskip=\abovecaptionskip,singlelinecheck=false}{A short caption.}
+%
+% You switch the extra centering on again by using |true|, |yes|, |on| or |1|
+% for \meta{bool}. (The default is on.)
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Fonts}
+% \label{fonts}
+%
+% \DescribeMacro{font=}
+% \DescribeMacro{labelfont=}
+% \DescribeMacro{textfont=}
+% There are three font options which affects different parts of the caption:
+% One affecting the whole caption (|font|), one which only affects the caption
+% label and separator (|labelfont|) and at least one which only affects the
+% caption text (|textfont|).
+% You set them up using the options
+% \begin{quote}\begin{tabular}{@{}r@{}ll}
+% |font=| & \marg{font options} & ,\\
+% |labelfont=| & \marg{font options} & , and\\
+% |textfont=| & \marg{font options} & .\\
+% \end{tabular}\end{quote}
+%
+% And these are the available font options:
+%
+% \begin{Options}{\OptionLabel}
+% \item[scriptsize] {\scriptsize Very small size}
+% \item[footnotesize] {\footnotesize The size usually used for footnotes}
+% \item[small] {\small Small size}
+% \item[normalsize] {\normalsize Normal size}
+% \item[large] {\large Large size}
+% \item[Large] {\Large Even larger size}
+%
+% \item[up] {\upshape Upright shape}
+% \item[it] {\itshape Italic shape}
+% \item[sl] {\slshape Slanted shape}
+% \item[sc] {\scshape Small Caps shape}
+%
+% \item[md] {\mdseries Medium series}
+% \item[bf] {\bfseries Bold series}
+%
+% \item[rm] {\rmfamily Roman family}
+% \item[sf] {\sffamily Sans Serif family}
+% \item[tt] {\ttfamily Typewriter family}
+%
+% \item[\UserDefined]
+% Own font options can be defined using |\DeclareCaptionFont|.
+% \SeeUserDefined
+% \end{Options}
+%
+% If you use only one of these options you can omit the braces;
+% e.g., the options
+% \iffalse
+% \begin{quote}
+% \fi
+% |font={small}|
+% \iffalse
+% \end{quote}
+% \fi
+% and
+% \iffalse
+% \begin{quote}
+% \fi
+% |font=small|
+% \iffalse
+% \end{quote}
+% \fi
+% will give the same result.
+%
+% Two examples:
+% \begin{Example}
+% \begin{quote}
+% |font={small,it},labelfont=bf|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{font={small,it},labelfont=bf}{\figuretext}
+% \end{Example}
+%
+% \begin{Example}
+% \begin{quote}
+% |font=small,labelfont=bf,textfont=it|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{font=small,labelfont=bf,textfont=it}{\figuretext}
+% \end{Example}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Margins and further paragraph options}
+% \label{margins}
+%
+% \DescribeMacro{margin=}
+% \DescribeMacro{width=}
+% For all captions you can specify \emph{either} an extra margin \emph{or}
+% a fixed width. You do this by using the options
+% \begin{quote}\begin{tabular}{@{}r@{}ll}
+% |margin=| & \meta{amount} & \emph{or}\\
+% |width=| & \meta{amount} & \\
+% \end{tabular}\end{quote}
+% Nevertheless what option you use, the left and right margin will be the
+% same.
+%
+% Two examples will illustrating this:
+% \begin{Example}
+% \begin{quote}
+% |margin=10pt|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{margin=10pt}{\figuretext}
+% \end{Example}
+%
+% \begin{Example}
+% \begin{quote}
+% |width=.75\textwidth|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{width=.75\textwidth}{\figuretext}
+% \end{Example}
+%
+% \DescribeMacro{parskip=}
+% This option is useful for captions containing more than one paragraph.
+% It specifies the extra vertical space inserted between them:
+% \begin{quote}
+% |parskip=|\meta{amount}
+% \end{quote}
+% One example:
+% \begin{Example}
+% \begin{quote}
+% |margin=10pt,parskip=5pt|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{margin=10pt,parskip=5pt}{
+% First paragraph of the caption. This one contains some test, just to
+% show how these options affect the layout of the caption.
+%
+% Second paragraph of the caption. This one contains some text, too, to
+% show how these options affect the layout of the caption.}
+% \end{Example}
+%
+% \DescribeMacro{hangindent=}
+% The option
+% \begin{quote}
+% |hangindent=|\meta{amount}
+% \end{quote}
+% is for setting up a hanging indention starting from the second line of each
+% paragraph. If the caption contains just a single paragraph, using this option
+% leads to the same result as the option |indention=| you already know about.
+% But if the caption contains multiple paragraphs you will notice the difference:
+%
+% \begin{Example}
+% \begin{quote}
+% |format=hang,indention=-.5cm|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{format=hang,indention=-.5cm}{
+% First paragraph of the caption. This one contains some test, just to
+% show how these options affect the layout of the caption.
+%
+% Second paragraph of the caption. This one contains some text, too, to
+% show how these options affect the layout of the caption.}
+% \end{Example}
+%
+% \begin{Example}
+% \begin{quote}
+% |format=hang,hangindent=-.5cm|
+% \end{quote}
+% \captionsetup{aboveskip=0pt}
+% \example{format=hang,hangindent=-.5cm}{
+% First paragraph of the caption. This one contains some test, just to
+% show how these options affect the layout of the caption.
+%
+% Second paragraph of the caption. This one contains some text, too, to
+% show how these options affect the layout of the caption.}
+% \end{Example}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Styles}
+% \label{style}
+%
+% \DescribeMacro{style=}
+% A suitable combination of caption options is called \emph{caption style}.
+% You can compare them more or less to page styles which you set up with
+% |\pagestyle|: The caption style provides all settings for a whole caption layout.
+%
+% You switch to an already defined caption style with the option
+% \begin{quote}
+% |style=|\meta{style name}\quad.
+% \end{quote}
+% The \thispackage\ package usually defines only the style |default| which
+% puts all options you already know about to the default ones.
+% This means that specifying the option
+% \begin{quote}
+% |style=default|
+% \end{quote}
+% has the same effect as specifying all these options:
+% \begin{quote}
+% |format=default,labelformat=default,labelsep=default,|\\
+% |justification=default,font=default,labelfont=default,|\\
+% |textfont=default,margin=0pt,indention=0pt,parindent=0pt|\\
+% |hangindent=0pt,singlelinecheck=true|
+% \end{quote}
+%
+% Own caption styles can be defined using |\DeclareCaptionStyle|.
+% \SeeUserDefined
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Skips}
+%
+% \DescribeMacro{aboveskip=}
+% \DescribeMacro{belowskip=}
+% The spaces above and below the caption are controlled by the skips
+% |\abovecaptionskip| and |\belowcaptionskip|. The standard \LaTeX\ document
+% classes |article|, |report| and |book| set |\abovecaptionskip| to |10pt|
+% and |\belowcaptionskip| to |0pt|.
+%
+% \pagebreak[3]
+% Both skips can be changed with the command |\setlength|, but you can
+% use these options, too:
+% \nopagebreak[3]
+% \begin{quote}\begin{tabular}{@{}r@{}ll}
+% |aboveskip=| & \meta{amount} & and\\
+% |belowskip=| & \meta{amount} & .\\
+% \end{tabular}\end{quote}
+%
+% \DescribeMacro{position=}
+% Using |\abovecaptionskip| and |\belowcaptionskip| has a major design flaw:
+% If the caption is typeset \emph{above} (and not \emph{below}) the figure
+% or table they are not set up very useful at default, because there will be
+% some extra space above the caption but no space between the caption and the
+% figure or table itself. (Remember: |\belowcaptionskip| is usually set to |0pt|.)
+%
+% Please compare the spacing in these small tables:
+% \begin{Example}
+% \begin{minipage}[c]{.5\linewidth}
+% \iffalse
+% \captionsetup{aboveskip=0pt}%
+% \fi
+% \captionof{table}{A table}
+% \centering\begin{tabular}{ll}
+% A & B \\
+% C & D \\
+% \end{tabular}
+% \end{minipage}
+% \begin{minipage}[c]{.5\linewidth}
+% \centering\begin{tabular}{ll}
+% A & B \\
+% C & D \\
+% \end{tabular}
+% \captionof{table}{A table}
+% \end{minipage}
+% \end{Example}
+%
+% But you can fix this by using the option |position=|: It specifies how the
+% spacing above and below the caption will be used:
+% \begin{quote}
+% |position=top|\quad(or |position=above|)
+% \end{quote}
+% tells the \thispackage\ package to use the spacing useful for caption
+% \emph{above} the figure or table and
+% \begin{quote}
+% |position=bottom|\quad(or |position=below|)
+% \end{quote}
+% tells the \thispackage\ package to use the spacing useful for captions
+% \emph{below} the figure or table. (The last one is the default setting
+% except for |longtable|s.)
+%
+% So adding an extra |\captionsetup{position=top}| to the left example
+% table gives you proper spacing around both captions:
+% \begin{Example}
+% \begin{minipage}[c]{.5\linewidth}
+% \captionsetup{position=top}
+% \captionof{table}{A table}
+% \centering\begin{tabular}{ll}
+% A & B \\
+% C & D \\
+% \end{tabular}
+% \end{minipage}
+% \begin{minipage}[c]{.5\linewidth}
+% \centering\begin{tabular}{ll}
+% A & B \\
+% C & D \\
+% \end{tabular}
+% \captionof{table}{A table}
+% \end{minipage}
+% \end{Example}
+%
+% (Technically speaking |\abovecaptionskip| and |\belowcaptionskip| will
+% be swapped if you specify the option |position=top|, so in both cases
+% |\abovecaptionskip| will be used between the caption and the figure or
+% table itself.)
+%
+% This option is especially useful when used together with the optional
+% argument of the |\captionsetup| command.
+% \See{\Section{misc}{Useful stuff} for details}\par
+% For example
+% \begin{quote}
+% |\captionsetup[table]{position=top}|
+% \end{quote}
+% causes all captions within tables to be treated as captions \emph{above}
+% the table (regarding spacing around it).
+% \DescribeMacro{tableposition=}
+% \NEWfeature{v3.0a}
+% Because this is a very common setting the \thispackage\ package offers
+% an abbreviating option for the use with |\usepackage|:
+% \begin{quote}
+% |\usepackage[|\ldots|,tableposition=top]{caption}|\footnote{Please
+% note that this is \emph{not} sufficient when using a
+% \KOMAScript\ document class, you need to use the \emph{global}
+% option |tablecaptionabove|, too.}
+% \end{quote}
+% is equivalent to
+% \begin{quote}
+% |\usepackage[|\ldots|]{caption}|\\
+% |\captionsetup[table]{position=top}|
+% \end{quote}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \pagebreak[3]
+% \section{Useful stuff}
+% \label{misc}
+%
+% \DescribeMacro{\caption}
+% The command
+% \nopagebreak[3]
+% \begin{quote}
+% |\caption|\oarg{lst\_entry}\marg{heading}
+% \end{quote}
+% \nopagebreak[3]
+% typesets the caption inside a floating environment like |figure| or |table|.
+% Well, you already know this, but the \thispackage\ package offers an extension:
+% If you leave the argument \meta{lst\_entry} empty, no entry in the list of
+% figures or tables will be made. For example:
+% \begin{quote}
+% |\caption[]{A figure without entry in the list of figures.}|
+% \end{quote}
+%
+% \DescribeMacro{\caption*}
+% The \package{longtable} package defines the command |\caption*| which
+% typesets the caption without label and without entry in the list of tables.
+% An example:
+% \begin{quote}
+% |\begin{longtable}{cc}|\\
+% | \caption*{A table}\\|\\
+% | A & B \\|\\
+% | C & D \\|\\
+% |\end{longtable}|
+% \end{quote}
+% looks like
+% \begin{longtable}{cc}
+% \caption*{A table}\\
+% A & B \\
+% C & D \\
+% \end{longtable}
+%
+% This package offers this feature, too, so you can use this command now within
+% every floating environment like |figure| or |table|, like:
+% \begin{quote}
+% |\begin{table}|\\
+% | \caption*{A table}|\\
+% | \begin{tabular}{cc}|\\
+% | A & B \\|\\
+% | C & D \\|\\
+% | \end{tabular}|\\
+% |\end{table}|
+% \end{quote}
+%
+% \DescribeMacro{\captionof}
+% \DescribeMacro{\captionof*}
+% Sometimes you want to typeset a caption \emph{outside} a floating environment,
+% putting a figure within a |minipage| for instance. For this purpose the
+% \thispackage\ package offers the command
+% \begin{quote}
+% |\captionof|\marg{float type}\oarg{lst\_entry}\marg{heading}\quad.
+% \end{quote}
+% Note that the first argument, the \meta{float type}, is mandatory here, because
+% the |\captionof| command needs to know which name to put into the caption label
+% (e.g. ``Figure'' or ``Table'') and in which list to put the contents entry.
+% An example:
+% \begin{quote}
+% |\captionof{figure}{A figure}|\\
+% |\captionof{table}{A table}|
+% \end{quote}
+% typesets captions like this:
+% \begin{Example}
+% \captionof{figure}{A figure}
+% \captionsetup{belowskip=\abovecaptionskip}
+% \captionof{table}{A table}
+% \end{Example}
+%
+% The star variant |\captionof*| has the same behaviour as the |\caption*| command:
+% it typesets the caption without label and without entry to the list of figures
+% or tables.
+%
+% Please use both |\captionof| and |\captionof*| only \emph{inside} environments
+% (like |minipage| or |\parbox|), otherwise a page break can appear between content
+% and caption. Furthermore some strange effects could occur (e.g., wrong spacing
+% around captions).
+%
+% \DescribeMacro{\ContinuedFloat}
+% Sometimes you want to split figures or tables without giving them
+% their own reference number. This is what the command
+% \begin{quote}
+% |\ContinuedFloat|
+% \end{quote}
+% is for; it should be used as first command inside the floating environment.
+% It prevents the increment of the relevant counter (usually done by |\caption|)
+% so a figure or table with a |\ContinuedFloat| in it gets the same reference
+% number as the figure or table before.
+%
+% An example:
+% \begin{quote}
+% |\begin{table}|\\
+% |\caption{A table}|\\
+% \ldots\\
+% |\end{table}|\\
+% \ldots\\
+% |\begin{table}\ContinuedFloat|\\
+% |\caption{A table (cont.)}|\\
+% \ldots\\
+% |\end{table}|
+% \end{quote}
+% gives the following result:
+% \begin{Example}
+% \makeatletter\def\@captype{table}\makeatother
+% \caption[]{A table}
+% \centerline{\ldots}
+% \ContinuedFloat
+% \captionsetup{aboveskip=0pt}
+% \caption[]{A table (cont.)}
+% \end{Example}
+%
+% \DescribeMacro{\captionsetup}
+% We already know the |\captionsetup| command (see \Section{usage}
+% {Using the package}), but this time we get enlighten about
+% its optional argument \meta{float type}.
+%
+% Remember, the syntax of this command is
+% \begin{quote}
+% |\captionsetup|\oarg{float type}\marg{options}\quad.
+% \end{quote}
+%
+% If a \meta{float type} gets specified, all the \meta{options} don't
+% change anything at this time. Instead they only get marked for a later use,
+% when a caption inside of a floating environment of the particular type
+% \meta{float type} gets typeset.
+% For example
+% \begin{quote}
+% |\captionsetup[figure]|\marg{options}
+% \end{quote}
+% forces captions within a |figure| environment to use the given \meta{options}.
+%
+% Here comes an example to illustrate this:
+% \begin{quote}
+% |\captionsetup{font=small}|\\
+% |\captionsetup[figure]{labelfont=bf}|
+% \end{quote}
+% gives captions like this:
+% \begin{Example}
+% \captionsetup{font=small}
+% \captionsetup[figure]{labelfont=bf}
+% \captionof{figure}[]{A figure}
+% \captionsetup{belowskip=\abovecaptionskip}
+% \captionof{table}[]{A table}
+% \end{Example}
+%
+% As you see the command |\captionsetup[figure]{labelfont=bf}| only changed
+% the font of the figure caption labels, not touching all other ones.
+%
+% \DescribeMacro{\clearcaptionsetup}
+% If you want to get rid of these parameters marked for an automatic use within
+% a particular environment you can use the command
+% \begin{quote}
+% |\clearcaptionsetup|\marg{float type}\quad.
+% \end{quote}
+%
+% For example |\clearcaptionsetup{figure}| would clear the extra handling in the
+% example above:
+% \begin{Example}
+% \captionsetup{font=small}
+% \captionof{figure}[]{A figure}
+% \captionsetup{belowskip=\abovecaptionskip}
+% \captionof{table}[]{A table}
+% \end{Example}
+%
+% As \meta{float type} you can usually give one of these two only:
+% |figure| or |table|.
+% But as we will see later some \LaTeX\ packages (like the
+% \package{float}, \package{longtable}, and \package{sidecap} package
+% for example) offer additional floating environments and these two
+% commands can also be used with them.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \pagebreak[3]
+% \section{Do it yourself!}
+% \label{declare}
+%
+% A family of commands is provided to allow users to define their own formats.
+% This enables information on separators, justification, fonts, and styles to
+% be associated with a name and kept in one place
+% (these commands need to appear in the document preamble,
+% this is the part between |\documentclass| and |\begin{document}|).
+%
+% \pagebreak[2]
+% \DescribeMacro{\DeclareCaptionFormat}
+% You can define your own caption formats using the command
+% \begin{quote}
+% |\DeclareCaptionFormat|\marg{name}\marg{code using \#1, \#2 and \#3}\quad.
+% \end{quote}
+% At usage the system replaces \#1 with the caption label, \#2 with the
+% separator and \#3 with the text. So the standard format |plain| is
+% pre-defined by the \thispackage\ package as
+% \begin{quote}
+% |\DeclareCaptionFormat{plain}{#1#2#3\par}|
+% \end{quote}
+%
+% \DescribeMacro{\DeclareCaptionLabelFormat}
+% Likewise you can define your own caption label formats:
+% \begin{quote}
+% |\DeclareCaptionLabelFormat|\marg{name}\marg{code using \#1 and \#2}
+% \end{quote}
+% At usage \#1 gets replaced with the name (e.g. ``figure'') and \#2
+% gets replaced with the reference number (e.g. ``12'').
+%
+% \DescribeMacro{\bothIfFirst}
+% \DescribeMacro{\bothIfSecond}
+% If you define your own caption label formats and use the \package{subfig}
+% package\cite{subfig}, you should take care of empty caption label names.
+% For this purpose the commands
+% \begin{quote}
+% |\bothIfFirst|\marg{first arg}\marg{second arg}\quad and\\
+% |\bothIfSecond|\marg{first arg}\marg{second arg}
+% \end{quote}
+% are offered. |\bothIfFirst| tests if the first argument exists (means: is
+% not empty), |\bothIfSecond| tests if the second argument exists. If yes,
+% both arguments get typeset, otherwise none of them.
+%
+% For example the standard label format |simple| is \emph{not} defined as
+% \begin{quote}
+% |\DeclareCaptionLabelFormat{simple}{#1 #2}|\quad,
+% \end{quote}
+% because this could cause an extra space if \#1 is empty. Instead |simple|
+% is defined as
+% \begin{quote}
+% |\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{ }#2}|\quad,
+% \end{quote}
+% causing the space to appear only if the label name is present.
+%
+% \pagebreak[3]
+% \DescribeMacro{\DeclareCaptionLabelSeparator}
+% You can define your own caption label separators with
+% \nopagebreak[3]
+% \begin{quote}
+% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\quad.
+% \end{quote}
+% \nopagebreak[3]
+% Again an easy example taken from the \thispackage\ package itself:
+% \nopagebreak[3]
+% \begin{quote}
+% |\DeclareCaptionLabelSeparator{colon}{: }|
+% \end{quote}
+% \pagebreak[3]
+%
+% \DescribeMacro{\DeclareCaptionJustification}
+% You can define your own caption justifications with
+% \begin{quote}
+% |\DeclareCaptionJustification|\marg{name}\marg{code}\quad.
+% \end{quote}
+% The \meta{code} simply gets typeset just before the caption.
+% E.g.~using the justification |raggedright|, which is defined as
+% \begin{quote}
+% |\DeclareCaptionJustification{raggedright}{\raggedright}|\quad,
+% \end{quote}
+% lets captions with all lines moved to the left margin.
+%
+% \DescribeMacro{\DeclareCaptionFont}
+% You can define your own caption fonts with
+% \begin{quote}
+% |\DeclareCaptionFont|\marg{name}\marg{code}\quad.
+% \end{quote}
+% For example this package defines the options |small| and |bf| as
+% \begin{quote}
+% |\DeclareCaptionFont{small}{\small}|\quad and\\
+% |\DeclareCaptionFont{bf}{\bfseries}|\quad.
+% \end{quote}
+% The line spacing could be customized using the \package{setspace} package,
+% for example:\NEWdescription{v3.0h}
+% \begin{quote}
+% |\usepackage{setspace}|\\
+% \iffalse
+% |\DeclareCaptionFont{singlespacing}{\setstretch{1}}|\quad\footnote{%
+% \emph{Note:} Using \cs{singlespacing} does not work here since it contains
+% a \cs{vskip} command.}\\
+% |\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}|\\
+% |\DeclareCaptionFont{doublespacing}{\doublespacing}|\\
+% \fi
+% |\captionsetup{font={onehalfspacing,small},labelfont=bf}|
+% \end{quote}
+% \example{font={onehalfspacing,small},labelfont=bf,singlelinecheck=off}\figuretext
+% An example which brings color into life:
+% \begin{quote}
+% |\usepackage{color}|\\
+% |\DeclareCaptionFont{red}{\color{red}}|\\
+% |\DeclareCaptionFont{green}{\color{green}}|\\
+% |\DeclareCaptionFont{blue}{\color{blue}}|\\
+% |\captionsetup{labelfont=blue,textfont=green}|
+% \end{quote}
+% \example{labelfont=blue,textfont=green,singlelinecheck=off}\figuretext
+%
+% \DescribeMacro{\DeclareCaptionStyle}
+% You can define your own caption styles with
+% \begin{quote}
+% |\DeclareCaptionStyle|\marg{name}\oarg{additional options}\marg{options}
+% \end{quote}
+% Remember, caption styles are just a collection of suitable options, saved
+% under a given name. You can wake up these options at any time with the
+% option |style=|\meta{style name}.
+%
+% All caption styles are based on the default set of options. (See \Section
+% {style}{Styles} for a complete list.) So you only need
+% to specify options which are different to them.
+%
+% If you specify \meta{additional options} they get used in addition when
+% the caption fits into a single line and this check was not disabled with
+% the option |singlelinecheck=off|.
+%
+% Again a very easy example taken from the core of this package: The
+% caption style |default| is pre-defined as
+% \begin{quote}
+% |\DeclareCaptionStyle{default}[justification=centering]{}|\quad.
+% \end{quote}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Further Examples}
+%
+% If you would like to have a colon \emph{and} a line break as caption
+% separator you could define it this way:
+% \begin{quote}
+% |\DeclareCaptionLabelSeparator{period-newline}{. \\}|
+% \end{quote}
+% Selecting this separator with |\captionsetup{labelsep=period-newline}| you
+% get captions like this:
+% \begin{Example}
+% \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt}
+% \captionsetup{aboveskip=0pt,type=figure}
+% \caption[]{\figuretext}
+% \end{Example}
+%
+% For short captions---which fit into one single line---this separator
+% may not be satisfying, even when the automatically centering process
+% is switched off (with |singlelinecheck=off|):
+% \begin{Example}
+% \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt,singlelinecheck=0}
+% \captionsetup{aboveskip=0pt,type=figure}
+% \caption[]{A figure.}
+% \end{Example}
+%
+% An own caption style which selects another caption separator automatically
+% puts this right:
+% \begin{quote}
+% |\DeclareCaptionStyle{period-newline}%|\\
+% | [labelsep=period]{labelsep=period-newline}|
+% \end{quote}
+% \begin{Example}
+% \captionsetup{style=period-newline,labelfont=bf,margin=10pt}
+% \captionsetup{aboveskip=0pt,type=figure}
+% \ContinuedFloat
+% \caption[]{A figure.}
+% \end{Example}
+% If you would like to keep the centering of these captions instead, an
+% appropriate definition would be something like
+% \begin{quote}
+% |\DeclareCaptionStyle{period-newline}%|\\
+% | [labelsep=period,justification=centering]%|\\
+% | {labelsep=period-newline}|\quad.
+% \end{quote}
+% Using this definition short captions look like
+% \begin{Example}
+% \captionsetup{style=period-newline2,labelfont=bf,margin=10pt}
+% \captionsetup{aboveskip=0pt,type=figure}
+% \ContinuedFloat
+% \caption[]{A figure.}
+% \end{Example}
+% while long ones still have a line break after the caption label.
+%
+% Slightly changed, you also get centered captions if they are longer than
+% one line:
+% \begin{quote}
+% |\DeclareCaptionStyle{period-newline}%|\\
+% | [labelsep=period]%|\\
+% | {labelsep=period-newline,justification=centering}|
+% \end{quote}
+% \begin{Example}
+% \captionsetup{style=period-newline3,labelfont=bf,margin=10pt}
+% \captionsetup{aboveskip=0pt,type=figure}
+% \caption[]{\figuretext}
+% \end{Example}
+%
+% \bigskip\pagebreak[3]
+% Another example: You want captions to look like this:
+% \begin{Example}
+% \captionsetup{format=reverse,labelformat=fullparens,labelsep=fill,font=small,labelfont=it}
+% \captionsetup{aboveskip=0pt}
+% \captionof{figure}[]{\figuretext}
+% \end{Example}
+% \pagebreak[2]
+% You could do it this way:
+% \nopagebreak[3]
+% {\leftmargini=10pt
+% \begin{quote}
+% |\DeclareCaptionFormat{reverse}{#3#2#1}|\\
+% |\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)}|\\
+% |\DeclareCaptionLabelSeparator{fill}{\hfill}|\\
+% |\captionsetup{format=reverse,labelformat=fullparens,|\\
+% | labelsep=fill,font=small,labelfont=it}|
+% \end{quote}}
+%
+% \bigskip\pagebreak[3]
+% Another example: The caption text should go into the left margin; a possible
+% solution would be:
+% {\leftmargini=10pt
+% \begin{quote}
+% |\DeclareCaptionFormat{llap}{\llap{#1#2}#3\par}|\\
+% |\captionsetup{format=llap,labelsep=quad,singlelinecheck=no}|
+% \end{quote}}
+% As a result you would get captions like this:
+% \begin{Example}
+% \captionsetup{format=llap,singlelinecheck=no,labelsep=quad}
+% \captionsetup{aboveskip=0pt}
+% \captionof{figure}[]{\figuretext}
+% \end{Example}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \pagebreak[3]
+% \section{Using non-standard document classes}
+%
+% \NEWdescription{v3.0p}
+% The \thispackage\ package was developed using the standard document classes
+% |article|, |report| and |book|, it also works with the Dutch document classes
+% |artikel|, |rapport| and |boek|. It is \emph{incompatible} with all other
+% document classes, except the ones based on one of the above.
+%
+% If you are unsure if your document class is supported or not, it's better
+% \emph{not} to use this package. You could try if your document will compile
+% fine with the \thispackage\ package anyway, but you should watch carefully
+% if side-effects occur, i.e. the look and feel of your captions should
+% \emph{not} change if you just include the caption package without options.
+% (If it does, you can carry on, but you should be warned that the output
+% could change with upcoming versions of the \thispackage\ package.)
+% If this is fine, you can start setting options with
+% |\usepackage[|\ldots|]{caption}| or |\captionsetup| and keep your fingers
+% crossed.
+%
+% The upcoming version \version{3.1} of the \thispackage\ package will be
+% adapted to several document classes, e.g. the \package{beamer} class and
+% the \KOMAScript\ ones. It's planned for release during Summer 2007.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \section{Compatibility to other packages}
+% \label{packages}
+%
+% The \thispackage\ package contains special adaptations to other packages,
+% so the captions should always look like you have specified them to look like.
+%
+% These are the packages the \thispackage\ package is adapted to:
+%
+% \begin{tabular}{ll}
+% |float| & Gives you the possibility to define new floating environments\\
+% |listings| & Typesets source code listings\\
+% |longtable| & Typesets tables spanned over multiple pages\\
+% |rotating| & Supports rotated figures and tables\\
+% |sidecap| & Offers captions \emph{beside} figures or tables\\
+% |supertabular| & Typesets tables spanned over multiple pages\\
+% \end{tabular}
+%
+% \NEWfeature{v3.0b}
+% If you use one of the above packages together with the {\thispackage} package
+% you get the additional possibility to set up captions with
+% \begin{quote}|\captionsetup|\oarg{environment}\marg{options}\quad,\end{quote}
+% where \meta{environment} stands for any environment the above packages offer.
+% (Please note that this do not work with the |sideways| environments offered by
+% the \package{rotating} package.)
+% For example
+% \begin{quote}|\captionsetup[lstlisting]{labelfont=bf}|\end{quote}
+% forces captions inside the |lstlisting| environment to have bold labels.
+%
+% If a certain support is not desired you can switch it off using the
+% \thispackage\ package option
+% \begin{quote}
+% |\usepackage[|\ldots|,|\meta{package}|=no]{caption}|\quad.
+% \end{quote}
+% For example specifying the option |float=no| means you don't like the
+% \thispackage\ package to support the \package{float} package.
+% (Note: You can specify these options only within the |\usepackage| command,
+% especially \emph{not} at a later time with |\captionsetup|.)
+%
+% For further information about the packages mentioned above please take a look
+% at the documentation belonging to them or buy yourself
+% The \LaTeX\ Companion\cite{companion}.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{The \package{float} package}
+% \label{float}
+%
+% A very useful feature is provided by the \package{float} package\cite{float}:
+% It offers the float placement specifier |H| which is much more restrictive
+% than the specifier |h| offered by \LaTeX. While the latter one is only a
+% recommendation to \LaTeX\ to set the float ``here'', the |H| forces the
+% float to appear exactly at the spot where it occurs in your input file
+% and nowhere else.
+%
+% Furthermore it offers different styles for floating environments, these
+% styles are |plain|, |plaintop|, |ruled|, and |boxed|.
+% You can link one of these styles to either new floating environments or
+% to one of the existing environments |figure| and |table|.
+%
+% If you are using the \thispackage\ package together with the \package{float}
+% package a caption style called |ruled| gets defined automatically:
+% \begin{quote}
+% |\DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space}|
+% \end{quote}
+% This style represents the caption layout in |ruled| styled floats.
+% For you as an end user this means that captions within |ruled| floats will
+% always look like this, nevertheless what generic caption options do you
+% specify:
+%
+% \ifx\floatstyle\undefined
+%
+% \begin{Example}
+% \hrule height.8pt depth0pt \kern2pt
+% \vbox{\strut{\bfseries Program 7.1}
+% The first program. This hasn't got anything to do with the package
+% but is included as an example. Note the \texttt{ruled} float style.}
+% \kern2pt\hrule\kern2pt
+% \begin{verbatim}
+% #include <stdio.h>
+%
+% int main(int argc, char **argv)
+% {
+% for (int i = 0; i < argc; ++i)
+% printf("argv[%d] = %s\n", i, argv[i]);
+% return 0;
+% }
+% \end{verbatim}
+% \kern2pt\hrule\relax
+% \end{Example}
+%
+% \else
+%
+% \floatstyle{ruled}
+% \newfloat{Program}{tbp}{lop}[section]
+% \floatname{Program}{Program}
+%
+% \begin{Program}[H]
+% \begin{verbatim}
+% #include <stdio.h>
+%
+% int main(int argc, char **argv)
+% {
+% for (int i = 0; i < argc; ++i)
+% printf("argv[%d] = %s\n", i, argv[i]);
+% return 0;
+% }
+% \end{verbatim}
+% \caption{The first program. This hasn't got anything to do with the package
+% but is included as an example. Note the \texttt{ruled} float style.}
+% \end{Program}
+%
+% \fi
+%
+% If you want a different layout for |ruled| captions you have to define
+% your own one using the command
+% \begin{quote}
+% |\DeclareCaptionStyle{ruled}|\marg{options}\quad.
+% \end{quote}
+%
+% This mechanism also works with all other float styles. If you want a special
+% caption layout---for |plain| or |boxed| floats for example---you can simply define
+% a suitable caption style with the same name as the float style.
+%
+% \textbf{Note:} For successful cooperation you need the float package
+% version 1.3 or newer.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{The \package{listings} package}
+% \label{listings}
+%
+% \NEWdescription{v3.0b}
+% The \package{listings} package\cite{listings} is a source code printer for \LaTeX.
+% You can typeset stand alone files as well as listings with an environment
+% similar to \texttt{verbatim} as well as you can print code snippets using
+% a command similar to |\verb|.
+% Many parameters control the output and if your preferred programming
+% language isn't already supported, you can make your own definition.
+%
+% \textbf{Note:} For successful cooperation you need the listings package
+% version 1.2 or higher. You'll get an error message when using an
+% older version!
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{The \package{longtable} package}
+% \label{longtable}
+%
+% The \package{longtable} package\cite{longtable} offers the environment
+% |longtable| which behaves similar to the |tabular| environment, but
+% the table itself can span multiple pages.
+%
+% \textbf{Note:} For successful cooperation you need the longtable package
+% version 3.15 or newer.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{The \package{rotating} package}
+% \label{rotating}
+%
+% The \package{rotating} package\cite{rotating} offers the floating
+% environments \texttt{sideways\-figure} and \texttt{sideways\-table}
+% which are just like normal figures and tables but rotated by 90 degree.
+% Furthermore they always use a full page on their own.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{The \package{sidecap} package}
+% \label{sidecap}
+%
+% \NEWdescription{v3.0b}
+% The \package{sidecap} package\cite{sidecap} offers the floating
+% environments |SCfigure| and |SCtable| which are like normal figures
+% and tables but the caption will be put \emph{beside} the contents.
+%
+% The \package{sidecap} package offers it's own options for justification.
+% If set, they will override the one specified with the caption option
+% |justification=| for captions beside their contents.
+%
+% \DescribeMacro{listof=}
+% Using the \package{sidecap} package you will probably notice that
+% suppressing the entry in the list of figures or tables with
+% |\caption[]{|\ldots|}| won't work inside these environments.
+% This is caused by the implementation design of the \package{sidecap}
+% package, but you can use |\captionsetup{listof=false}| inside the
+% figure or table as an alternative here.
+%
+% \ifx\SCfigure\undefined
+%
+% \begin{Example}
+% \newsavebox\scbox
+% \begin{lrbox}{\scbox}
+% \setlength{\unitlength}{.75cm}
+% \setlength{\fboxsep}{0pt}
+% \fbox{\begin{picture}(4,4)
+% \put(1,3){\circle{1}}
+% \put(3,3){\circle{1}}
+% \put(2,2){\circle{1}}
+% \put(1,1){\circle{1}}
+% \put(3,1){\circle{1}}
+% \end{picture}}
+% \end{lrbox}
+% \newlength\scboxwidth
+% \setlength\scboxwidth{\wd\scbox}
+% \makebox[\linewidth][c]{
+% \parbox[b]{\scboxwidth}{\unhbox\scbox}
+% \hspace\marginparsep
+% \parbox[b]{1.5\scboxwidth}{
+% \captionsetup{justification=raggedright,labelfont=bf}
+% \captionof{figure}[]{A small example with the caption beside the figure.}
+% }
+% }
+% \end{Example}
+%
+% \else
+%
+% \captionsetup{labelfont=bf}
+% \begin{SCfigure}[1.5][!ht]
+% \setlength{\unitlength}{.75cm}
+% \setlength{\fboxsep}{0pt}
+% \fbox{\begin{picture}(4,4)
+% \put(1,3){\circle{1}}
+% \put(3,3){\circle{1}}
+% \put(2,2){\circle{1}}
+% \put(1,1){\circle{1}}
+% \put(3,1){\circle{1}}
+% \end{picture}}
+% \iffalse
+% \captionsetup{labelfont=bf}
+% \fi
+% \caption[]{A small example with the caption beside the figure.}
+% \end{SCfigure}
+% \captionsetup{labelfont=default}
+%
+% \fi
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{The \package{supertabular} package}
+% \label{supertabular}
+%
+% The \package{supertabular} package\cite{supertabular} offers the environment
+% |supertabular| which is quite similar to the |longtable| environment provided
+% by the \package{longtable} package. Both offers the typesetting of tables
+% which can span multiple pages. For a detailed discussion about the
+% differences between these powerful packages please take a look at
+% The \LaTeX\ Companion\cite{companion}.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Known incompatibilities}
+%
+% \NEWdescription{v3.0b}
+% Using the \thispackage\ package together with one of the following packages
+% is not recommended; usually this would cause unwanted side effects or even
+% errors:
+% \begin{quote}
+% \package{ccaption}, \package{ftcap}, \package{hvfloat}, and
+% \package{nonfloat}
+% \end{quote}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \section{Compatibility to older versions}
+% \label{compatibility}
+%
+% \subsection{The \thispackage\ package version $1.x$}
+%
+% This version of the \thispackage\ package still supports the old options
+% and commands provided by the version $1.x$ of this package. So there
+% shouldn't occur any problems compiling old documents, but please don't mix
+% old options and commands with the new ones. This isn't supported and can
+% cause ugly side effects.
+%
+% Here comes a short oversight of the obsolete options and commands and how
+% they have been replaced within this version of the \thispackage\ package:
+%
+% {\small\begin{longtable}{ll}
+% \thispackage\ \version{1.x} & \thispackage\ \version{3.x}\\
+% \hline
+% \endhead
+% |normal| & |format=plain|\\
+% |hang| & |format=hang|\\
+% |isu| & |format=hang|\\
+% |center| & |justification=centering|\\
+% |centerlast| & |justification=centerlast|\\
+% \iffalse
+% |anne| & |justification=centerlast|\\
+% \fi
+% |nooneline| & |singlelinecheck=off|\\
+% |scriptsize| & |font=scriptsize|\\
+% |footnotesize| & |font=footnotesize|\\
+% |small| & |font=small|\\
+% |normalsize| & |font=normalsize|\\
+% |large| & |font=large|\\
+% |Large| & |font=Large|\\
+% |up| & |labelfont=up|\\
+% |it| & |labelfont=it|\\
+% |sl| & |labelfont=sl|\\
+% |sc| & |labelfont=sc|\\
+% |md| & |labelfont=md|\\
+% |bf| & |labelfont=bf|\\
+% |rm| & |labelfont=rm|\\
+% |sf| & |labelfont=sf|\\
+% |tt| & |labelfont=tt|\\
+% \end{longtable}}
+%
+% Beside the options for setting up the desired font there were also
+% the commands |\captionsize| resp.~|\captionfont| and |\captionlabelfont|
+% who could be redefined with |\renewcommand| and allowed an alternate and
+% more flexible way to change the font used for captions.
+% This mechanism was replaced by the commands
+% \begin{quote}
+% |\DeclareCaptionFont{|\ldots|}{|\ldots|}|\qquad and\\
+% |\captionsetup{font=|\ldots|,labelfont=|\ldots|}|\qquad.
+% \end{quote}\SeeUserDefined
+%
+% Setting the margin for captions was done in \version{1.x} with
+% \begin{quote}
+% |\setlength{\captionmargin}{|\ldots|}|\quad.
+% \end{quote}
+% This was replaced by
+% \begin{quote}
+% |\captionsetup{margin=|\ldots|}|\qquad.
+% \end{quote}
+% \See{\Section{margins}{Margins and further paragraph options}}
+%
+% For example the old-style code
+% \begin{quote}
+% |\usepackage[hang,bf]{caption}|\\
+% |\renewcommand\captionfont{\small\sffamily}|\\
+% |\setlength\captionmargin{10pt}|
+% \end{quote}
+% will still work fine, but should be written today as
+% \begin{quote}
+% |\usepackage[format=hang,labelfont=bf,font={small,sf},|\\
+% | margin=10pt]{caption}|
+% \end{quote}
+% or
+% \begin{quote}
+% |\usepackage{caption}|\\
+% |\captionsetup{format=hang,labelfont=bf,font={small,sf},|\\
+% | margin=10pt}|\qquad.
+% \end{quote}
+%
+% The quite exotic option |ruled| which allowed a partial usage of
+% the caption settings for |ruled| floats defined with the
+% \package{float} package will be emulated by this version of the
+% caption package, too.
+% But using this option is not recommended anymore since this
+% version of the \thispackage\ package offers a more flexible way
+% for changing the captions of these floating environments:
+% \begin{quote}
+% |\DeclareCaptionStyle{ruled}{|\ldots|}|
+% \end{quote}
+% resp.
+% \begin{quote}
+% |\captionsetup[ruled]{|\ldots|}|\qquad.
+% \end{quote}
+% \SeeUserDefined[, \Section*{misc}{Useful stuff}, and
+% \Section*{float}{The \package{float} package}]
+%
+% \subsection{The \package{caption2} package version $2.x$}
+%
+% Although they do very similar stuff, the packages \package{caption} and
+% its experimental and now obsolete variant \package{caption2} have a
+% very different implementation design.
+% Therefore a full compatibility could not be offered.
+% For that reason you will still find a file called |caption2.sty| in
+% this package distribution, so old documents using the \package{caption2}
+% package will still compile fine.
+%
+% Newly created documents should use the actual version of the
+% \thispackage\ package instead. In most cases it's sufficient to replace
+% the command
+% \begin{quote}
+% |\usepackage[...]{caption2}|
+% \end{quote}
+% by
+% \begin{quote}
+% |\usepackage[...]{caption}|\qquad.
+% \end{quote}
+% But some options and commands will not be emulated, so you can get
+% error messages afterwards. This section will hopefully help you removing
+% these errors. If you have problems migrating from \package{caption2}
+% to \package{caption} please don't hesitate to send me an e-mail asking
+% for help.
+%
+% In addition to the obsolete options shown in the last section
+% these ones will be emulated, too:
+%
+% {\small\begin{longtable}{ll}
+% \package{caption2} \version{2.x} & \thispackage\ \version{3.x}\\
+% \hline
+% \endhead
+% |flushleft| & |justification=raggedright|\\
+% |flushright| & |justification=raggedleft|\\
+% |oneline| & |singlelinecheck=on|\\
+% \end{longtable}}
+%
+% Setting the margin for captions was done in \version{2.x} with
+% \begin{quote}\leavevmode\hbox{%
+% |\setcaptionmargin{|\ldots|}| resp.
+% |\setcaptionwidth{|\ldots|}|\quad.
+% }\end{quote}
+% This was replaced by
+% \begin{quote}\leavevmode\hbox{%
+% |\captionsetup{margin=|\ldots|}| resp.
+% |\captionsetup{width=|\ldots|}|\quad.
+% }\end{quote}
+% \See{\Section{margins}{Margins and further paragraph options}}
+%
+% Setting an indention was done in \version{2.x} with
+% \begin{quote}
+% |\captionstyle{indent}|\\
+% |\setlength\captionindent{|\ldots|}|\quad.
+% \end{quote}
+% This is now done with
+% \begin{quote}
+% |\captionsetup{format=plain,indention=|\ldots|}|\quad.
+% \end{quote}
+%
+% The so-called single-line-check was controlled by the commands
+% |\oneline|\-|captions|\-|false| (for switching the check off) and
+% |\oneline|\-|captions|\-|true| (for switching the check on).
+% This was replaced by
+% |\captionsetup{|\discretionary{}{}{}|singlelinecheck=|\discretionary{}{}{}|off}|
+% resp.
+% |\captionsetup{|\discretionary{}{}{}|singlelinecheck=|\discretionary{}{}{}|on}|.
+% \See{\Section{justification}{Justification}}
+%
+% The commands
+% \begin{quote}
+% |\captionlabeldelim|, |\captionlabelsep|, |\captionstyle|,\\
+% |\defcaptionstyle|, |\newcaptionstyle|, and |\renewcaptionstyle|
+% \end{quote}
+% do not have a simple replacement and therefore will not be emulated
+% by this version of the \thispackage\ package. (So using them will
+% cause error messages.) Rewriting such code is not always easy and
+% straight-ahead, but by conscientious reading of this manual you should
+% find appropriate options and commands instead.
+%
+% \iffalse
+% ... (some examples)
+% \fi
+%
+% The \version{2.x} option |ignoreLTcapwidth| do not have a replacement, too.
+% But in most cases you can simply drop using that option because
+% in this version of the \thispackage\ package the value of |\LTcapwidth|
+% will be ignored anyway (unless you set it to a different value than the
+% default one).
+% \See{\Section{longtable}{The \package{longtable} package}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \pagebreak[4]
+% \section{Further reading}
+%
+% I recommend the following documents for further reading:
+%
+% \begin{itemize}
+% \item
+% The \TeX\ FAQ - Frequently asked questions about \TeX\ and \LaTeX :
+% \begin{quote}\url{http://faq.tug.org/}\end{quote}
+%
+% \item
+% A French FAQ can be found at
+% \begin{quote}\url{http://www.grappa.univ-lille3.fr/FAQ-LaTeX/}\end{quote}
+%
+% \item
+% \textsf{epslatex} from Keith Reckdahl contains many tips around
+% including graphics in \LaTeXe\ documents.
+% You will find this document in the directory
+% \begin{quote}\url{ftp://ftp.ctan.org/pub/tex/info/epslatex/}\end{quote}
+% \end{itemize}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \section{Thanks}
+%
+% I would like to thank Katja Melzner,
+% Steven D. Cochran, Frank Mittelbach,
+% David Carlisle, Carsten Heinz, Olga Lapko, and Keith Reckdahl.
+% Thanks a lot for all your help, ideas, patience, spirit, and support!
+%
+% Also I would like to thank
+% Harald Harders,
+% Peter L\"offler,
+% Peng Yu,
+% Alexander Zimmermann,
+% Matthias Pospiech,
+% J\"urgen Wieferink,
+% Christoph Bartoschek,
+% Uwe St\"ohr,
+% Ralf Stubner,
+% Geoff Vallis,
+% Florian Keiler,
+% J\"urgen G\"obel,
+% Uwe Siart,
+% Sang-Heon Shim,
+% Henrik Lundell,
+% David Byers,
+% William Asquith,
+% and
+% Prof.~Dr.~Dirk Hoffmann,
+% who all helped to make this package a better one.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \StopEventually{\begin{thebibliography}{9}
+% \bibitem{companion}
+% Frank Mittelbach and Michel Goossens:
+% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},
+% \newblock Addison-Wesley, 2004.
+%
+% \bibitem{float}
+% Anselm Lingnau:
+% \emph{An Improved Environment for Floats},
+% 2001/11/08
+%
+% \bibitem{floatrow}
+% Olga Lapko:
+% \emph{The floatrow package documentation},
+% 2005/05/22
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:
+% \emph{Hypertext marks in \LaTeX},
+% 2007/01/25
+%
+% \bibitem{hypcap}
+% Heiko Oberdiek:
+% \emph{The hypcap package -- Adjusting anchors of captions}
+% 2007/02/19
+%
+% \bibitem{listings}
+% Carsten Heinz:
+% \emph{The Listings Package},
+% 2004/02/13
+%
+% \bibitem{longtable}
+% David Carlisle:
+% \emph{The longtable package},
+% 2000/10/22
+%
+% \bibitem{rotating}
+% Sebastian Rahtz and Leonor Barroca:
+% \emph{A style option for rotated objects in \LaTeX},
+% 1997/09/26
+%
+% \bibitem{sidecap}
+% Rolf Niepraschk und Hubert G\"a\ss lein:
+% \emph{The sidecap package},
+% 2003/06/06
+%
+% \bibitem{subfig}
+% Steven D. Cochran:
+% \emph{The subfig package},
+% 2005/07/05
+%
+% \bibitem{supertabular}
+% Johannes Braams und Theo Jurriens:
+% \emph{The supertabular environment},
+% 2002/07/19
+%
+% \bibitem{Anne}
+% Anne Br\"uggemann-Klein:
+% \emph{Einf\"uhrung in die Dokumentverarbeitung},
+% B.G. Teubner, Stuttgart, 1989
+% \end{thebibliography}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@classoptionslist,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined,\@latex@error}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\providecommand}
+% \DoNotIndex{\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \setlength{\parskip}{0pt plus 1pt}
+%
+% \section{The Implementation}
+%
+% \changes{v1.0}{1994/10/27}{First release}
+% \changes{v1.1}{1994/11/03}{New captiontype \cs{centerlast}}
+% \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
+% \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
+% \changes{v1.4}{1995/01/30}{New option \cs{nooneline}}
+% \changes{v1.4b}{1995/04/05}{Bugfix release}
+% \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v3.0d}{2004/11/28}{Split into two packages: \package{caption} \& \package{caption3}}
+% \changes{v3.0l}{2007/01/20}{Usage of \cs{PackageError} replaced by \cs{caption@error}}
+%
+% The \package{caption} package consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% The kernel provides all the user commands and internal macros which are
+% necessary for typesetting captions and setting parameters regarding these.
+% While the standard \LaTeX\ document classes provides an internal command
+% called |\@makecaption| and no options to control its behavior (except the
+% vertical skips above and below the caption itself), we provide similar
+% commands called |\caption@make| and |\caption@@make|, but with a lot of
+% options which can be selected with |\captionsetup|.
+% Loading the kernel part do not change the output of a \LaTeX\ document
+% -- it just provides functionality which can be used by \LaTeXe\ packages
+% which typesets captions, like the \package{caption} package or the
+% \package{subfig} package.
+%
+% The \package{caption} package itself redefines the \LaTeX\ commands
+% |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
+% |\caption@@make|, giving the user the possibility to control the captions of
+% the floating environments |figure| and |table|. Furthermore it does similar
+% to the caption stuff coming from other packages (like the \package{longtable}
+% or \package{supertabular} package):
+% Mapping the appropriate internal commands (like |\LT@makecaption| or
+% |\ST@caption|) to the ones offered by the \package{caption} kernel.
+% So you can think of the \package{caption} package as a layer package, it
+% simply provides adaptation layers between the caption stuff coming from
+% \LaTeXe\ itself or a \LaTeXe\ package and the caption stuff offered by the
+% \package{caption} kernel.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Kernel}
+% \iffalse
+%<*kernel>
+% \fi
+%
+% \subsubsection*{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption3}[2007/04/11 v1.0q caption3 kernel (AR)]
+% \end{macrocode}
+%
+% \subsubsection*{Generic helpers}
+%
+% \begin{macro}{\@nameundef}
+% This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel.
+% We use it to remove the definition of some commands and keyval options after
+% |\begin{document}| (to save \TeX\ memory) and to remove caption options defined
+% with |\captionsetup|\oarg{type}.
+% \begin{macrocode}
+\providecommand*\@nameundef[1]{%
+ \expandafter\let\csname #1\endcsname\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@addto@macro}
+% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which
+% globally adds commands to any existising macro, like in |\AtBeginDocument|.
+% This is the same but it works local, not global
+% (using \cs{edef} instead of \cs{xdef}).
+% \begin{macrocode}
+\providecommand{\l@addto@macro}[2]{%
+ \begingroup
+ \toks@\expandafter{#1#2}%
+ \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bothIfFirst}
+% \begin{macro}{\bothIfSecond}
+% |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond|
+% tests if the second argument is not empty. If yes both arguments get
+% typeset, otherwise none of them.
+% \begin{macrocode}
+\def\bothIfFirst#1#2{%
+ \protected@edef\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty\else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\def\bothIfSecond#1#2{%
+ \protected@edef\caption@tempa{#2}%
+ \ifx\caption@tempa\@empty\else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifinlist}
+% This helper macro checks if the first argument is in the comma separated
+% list which is offered as second argument. So for example
+% \begin{quote}
+% |\caption@ifinlist{frank}{axel,frank,steven}{yes}{no}|
+% \end{quote}
+% would expand to |yes|.
+% \begin{macrocode}
+\def\caption@ifinlist#1#2{%
+ \let\next\@secondoftwo
+ \edef\caption@tempa{#1}%
+ \@for\caption@tempb:={#2}\do{%
+ \ifx\caption@tempa\caption@tempb
+ \let\next\@firstoftwo
+ \fi}%
+ \next}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setbool}
+% \begin{macro}{\caption@ifbool}
+% \begin{macro}{\caption@undefbool}
+% For setting and testing boolean options we offer these three helper macros:
+% \begin{quote}
+% |\caption@setbool|\marg{name}\marg{value}\\
+% | |(with |value = false/true/no/yes/off/on/0/1|)\\
+% |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\
+% |\caption@undefbool|\marg{name}
+% \end{quote}
+% \begin{macrocode}
+\def\caption@setbool#1#2{%
+ \caption@ifinlist{#2}{1,true,yes,on}{%
+ \expandafter\let\csname caption@if#1\endcsname\@firstoftwo
+ }{\caption@ifinlist{#2}{0,false,no,off}{%
+ \expandafter\let\csname caption@if#1\endcsname\@secondoftwo
+ }{%
+ \caption@Error{Undefined boolean value `#2'}%
+ }}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@ifbool#1{\@nameuse{caption@if#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@undefbool#1{\@nameundef{caption@if#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@newcounter}
+% \changes{v3.0p}{2007/04/08}{\cs{caption@XXXcounter} added}
+% \begin{macro}{\caption@setcounter}
+% \begin{macro}{\caption@addtocounter}
+% \begin{macro}{\caption@stepcounter}
+% To save counter space we use commands instead of counters.
+% \begin{macrocode}
+\def\caption@newcounter#1{\gdef#1{0}}
+\def\caption@setcounter#1#2{\xdef#1{#2}}
+\def\caption@addtocounter#1#2{%
+ \begingroup
+ \@tempcnta#1%
+ \advance\@tempcnta#2%
+ \xdef#1{\the\@tempcnta}%
+ \endgroup}
+\def\caption@stepcounter#1{\caption@addtocounter#1\@ne}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection*{Errors}
+%
+% \begin{macro}{\caption@Error}
+% \changes{v3.0l}{2007/01/20}{This macro added}
+% \changes{v3.0q}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}}
+% This is mainly identical to |\PackageError{caption}{#1}{\caption@eh}|.
+% \begin{macrocode}
+\newcommand\caption@Package{caption}
+\newcommand*\caption@Error[1]{%
+ \PackageError\caption@Package{#1}\caption@eh}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@eh}
+% At the moment we only offer this simple error message as generic helper
+% for the user.
+% \begin{macrocode}
+\newcommand\caption@eh{%
+ If you do not understand this error, please take a closer look\MessageBreak
+ at the documentation of the `\caption@Package' package.\MessageBreak
+ \@ehc}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{Using the keyval package}
+%
+% We need the \package{keyval} package for option handling, so we load it here.
+% \begin{macrocode}
+\RequirePackage{keyval}[1997/11/10]
+% \end{macrocode}
+%
+% \begin{macro}{\undefine@key}
+% This helper macro is the opposite of |\define@key|, it removes a keyval
+% definition.
+% \begin{macrocode}
+\providecommand*\undefine@key[2]{%
+ \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOption}
+% |\DeclareCaptionOption|\marg{option}\marg{code}\\
+% |\DeclareCaptionOption*|\marg{option}\marg{code}\par
+% We declare our options using these commands (instead of using
+% |\DeclareOption| offered by \LaTeXe), so the keyval package is used.
+% The starred form makes the option available during the lifetime of the
+% current package only, so they can be used with |\usepackage|, but
+% \emph{not} with |\captionsetup| later on.
+% \begin{macrocode}
+\newcommand\DeclareCaptionOption{%
+ \@ifstar{\caption@declareoption\AtEndOfPackage}%
+ {\caption@declareoption\@gobble}}
+\newcommand*\caption@declareoption[2]{%
+ #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}}
+\@onlypreamble\DeclareCaptionOption
+\@onlypreamble\caption@declareoption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionsetup}
+% \changes{v3.0a}{2004/01/17}{Bugfix: Missing \% added}
+% |\captionsetup|\oarg{type}\marg{keyval-list of options}\par
+% If the optional argument `type' is specified, we simply save or append
+% the option list, otherwise we `execute' it with |\setkeys|.
+% \begin{macrocode}
+\newcommand\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup}
+\newcommand\caption@typ@{caption@typ@} % This saves 74 words of TeX memory
+\def\caption@setuptype[#1]#2{%
+ \@ifundefined{\caption@typ@#1}%
+ {\@namedef{\caption@typ@#1}{#2}}%
+ {\expandafter\l@addto@macro\csname\caption@typ@#1\endcsname{,#2}}}
+\newcommand\caption@setup{\caption@setkeys{caption}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setkeys}
+% \changes{v3.0i}{2006/01/03}{This macro added}
+% \changes{v3.0l}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added}
+% \changes{v3.0l}{2007/01/30}{Optional argument added}
+% \changes{v3.0p}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter}
+% This one simply calls |\setkeys|\marg{package}\marg{args} but lets the
+% error messages refer to the \meta{package} package instead of the
+% \package{keyval} package.
+% \begin{macrocode}
+\newcommand*\caption@setkeys{%
+ \@dblarg\caption@@setkeys}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@setkeys[#1]#2#3{%
+ \ifnum\caption@keydepth=0\relax
+ \let\caption@KV@errx\KV@errx
+ \let\caption@KV@err\KV@err
+ \let\KV@errx\caption@Error
+ \let\KV@err\caption@Error
+ \fi
+ \caption@stepcounter\caption@keydepth
+%
+ \def\caption@Package{#1}%
+ \caption@Debug{\protect\setkeys{#2}{#3}}%
+ \setkeys{#2}{#3}%
+ \def\caption@Package{caption}%
+%
+ \caption@addtocounter\caption@keydepth\m@ne
+ \ifnum\caption@keydepth=0\relax
+ \let\KV@errx\caption@KV@errx
+ \let\KV@err\caption@KV@err
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@newcounter\caption@keydepth
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@settype}
+% \changes{v3.0i}{2006/01/03}{Optional argument added}
+% \changes{v3.0j}{2006/01/26}{Revised}
+% \changes{v3.0l}{2007/01/30}{Optional argument removed}
+% |\caption@settype|\marg{type}\par
+% Caption options which have been saved with |\captionsetup|\oarg{type} can
+% be executed using this command.
+% (It simply executes the saved option list, if there is any.)
+% \begin{macrocode}
+\newcommand*\caption@settype[1]{%
+ \@ifundefined{\caption@typ@#1}{}{%
+ \caption@esetup{\csname\caption@typ@#1\endcsname}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@esetup}
+% |\caption@esetup|\marg{keyval-list of options}\par
+% To execute a keyval-list of options saved within a macro we
+% need this special version of |\caption@setup| which expands the
+% argument first.
+% \begin{macrocode}
+\newcommand*\caption@esetup[1]{%
+ \edef\caption@tempa{\noexpand\caption@setup{#1}}%
+ \caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\clearcaptionsetup}
+% |\clearcaptionsetup|\marg{type}\par
+% This removes the saved option list associated with \meta{type}.
+% \begin{macrocode}
+\newcommand*\clearcaptionsetup[1]{\@nameundef{\caption@typ@#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\showcaptionsetup}
+% \changes{v3.0e}{2005/05/03}{Optimized for memory usage}
+% |\showcaptionsetup|\oarg{package}\marg{type}\par
+% This comes for debugging issues: It shows the saved option list which
+% is associated with \meta{type}.
+% \begin{macrocode}
+\newcommand*\showcaptionsetup[2][\@firstofone]{%
+ \GenericWarning{}{%
+ #1 Caption Info: KV list on `#2'\MessageBreak
+ #1 Caption Data: (%
+ \@ifundefined{\caption@typ@#2}{%
+ % empty -- print nothing
+ }{%
+ \@nameuse{\caption@typ@#2}%
+ }%
+ )}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ProcessOptions}
+% \changes{v3.0a}{2004/01/23}{Bugfix, see \purett{news:400D360C.9678329F@gmx.net} for details}
+% \changes{v3.0i}{2006/01/03}{Improvement, uses \cs{caption@setkeys} instead of \cs{setkeys}}
+% \changes{v3.0j}{2006/02/23}{Bugfix, now processes only those global options which have a default value}
+% \changes{v3.0l}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to \cs{caption@ProcessOptions} and moved from the package to the kernel}
+% We process our options using the keyval package, so we use this one
+% instead of |\ProcessOptions| offered by \LaTeXe.
+% (This code was taken from the \package{hyperref} package and improved.)
+% \begin{macrocode}
+\newcommand*\caption@ProcessOptions[1]{%
+ \let\@tempc\relax
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\caption@tempa\@empty
+ \@for\CurrentOption:=\@classoptionslist\do{%
+ \@ifundefined{KV@#1@\CurrentOption}{%
+ }{%
+ \@ifundefined{KV@#1@\CurrentOption @default}{%
+ \PackageInfo{#1}{Global option `\CurrentOption' ignored}%
+ }{%
+ \PackageInfo{#1}{Global option `\CurrentOption' processed}%
+ \edef\caption@tempa{\caption@tempa,\CurrentOption,}%
+ \@expandtwoargs\@removeelement\CurrentOption
+ \@unusedoptionlist\@unusedoptionlist
+ }%
+ }%
+ }%
+ \edef\caption@tempa{%
+ \noexpand\caption@setkeys{#1}{%
+ \caption@tempa\@ptionlist{\@currname.\@currext}%
+ }%
+ }%
+ \caption@tempa
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\CurrentOption\@empty
+ \AtEndOfPackage{\let\@unprocessedoptions\relax}}
+\@onlypreamble\caption@ProcessOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{Margin resp. width}
+% \changes{v3.0p}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}}
+% \changes{v3.0p}{2007/04/03}{Option `twoside' added to kernel}
+%
+% \begin{macro}{\captionmargin}
+% \begin{macro}{\captionwidth}
+% |\captionmargin| and |\captionwidth| contain the extra margin
+% resp. the total width used for captions. Please never set these values in
+% a direct way, they are just accessible in user documents to provide
+% compatibility to |caption.sty| \version{1.x}.\par
+% Note that we can only set one value at a time, `margin' \emph{or} `width'.
+% If |\captionwidth| is not zero we will take this value afterwards,
+% otherwise |\captionmargin| and |\captionmargin@|.
+% \begin{macrocode}
+\newdimen\captionmargin
+\newdimen\captionmargin@
+\newdimen\captionwidth
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
+\DeclareCaptionOption{width}{\setcaptionwidth{#1}}
+\DeclareCaptionOption{twoside}[1]{\caption@setbool{twoside}{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\setcaptionmargin}
+% |\setcaptionmargin|\marg{amount}
+% \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
+% \changes{v3.0h}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take left+right margin}
+% |\setcaptionmargin|\marg{amount}\par
+% Please never use this in user documents, it's just there to
+% provide compatibility to |caption2.sty| \version{2.x}.
+% \begin{macrocode}
+\newcommand*\setcaptionmargin[1]{%
+ \captionwidth\z@
+ \caption@@setmargin#1,#1,\@nil\@@}
+\def\caption@@setmargin#1,#2,#3\@@{%
+ \setlength\captionmargin{#1}%
+ \setlength\captionmargin@{#2}%
+ \advance\captionmargin@ by -\captionmargin}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionwidth}
+% |\setcaptionwidth|\marg{amount}
+% \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
+% |\setcaptionwidth|\marg{amount}\par
+% Please never use this in user documents, it's just there to
+% provide compatibility to |caption2.sty| \version{2.x}.
+% \begin{macrocode}
+\newcommand\setcaptionwidth{%
+ \setlength\captionwidth}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@count}
+% \changes{v3.0p}{2007/04/03}{This counter added}
+% This counter numbers the captions. It will be used inside |\caption@ifoddpage| only.
+% \begin{macrocode}
+\caption@newcounter\caption@count
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@newlabel}
+% \changes{v3.0p}{2007/04/03}{This macro added}
+% This command is a modified version of |\newlabel| from \LaTeX2e.
+% It will be written to the \texttt{.aux} file to
+% pass label information from one run to another.
+% It will be used inside |\caption@ifoddpage| and |\caption@ragged|.
+% \begin{macrocode}
+\newcommand*\caption@newlabel{\@newl@bel{caption}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@thepage}
+% \changes{v3.0p}{2007/04/03}{This macro added}
+% This command is a modified version of |\thepage| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| only.
+% \begin{macrocode}
+\newcommand*\caption@thepage{\the\c@page}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifoddpage}
+% \changes{v3.0p}{2007/04/03}{This macro added}
+% \emph{Note:} This macro re-defines itself so the \texttt{.aux} file will
+% only be used once per group.
+% \begin{macrocode}
+\def\caption@ifoddpage{%
+ \caption@iftwoside{%
+% \end{macrocode}
+% |\refstepcounter{caption@count}|
+% \begin{macrocode}
+ \caption@stepcounter\caption@count
+% \end{macrocode}
+% |\label{\the\caption@count}|
+% \begin{macrocode}
+ \protected@write\@auxout{\let\caption@thepage\relax}%
+ {\string\caption@newlabel{\caption@count}{\caption@thepage}}%
+% \end{macrocode}
+% |\edef\caption@thepage{\pageref{\the\caption@count}}|
+% \begin{macrocode}
+ \expandafter\ifx\csname caption@\caption@count\endcsname\relax
+ \G@refundefinedtrue % => 'There are undefined references.'
+ \PackageWarning{caption3}{Reference on page \thepage \space undefined}%
+ \else
+ \expandafter\let\expandafter\caption@thepage
+ \csname caption@\caption@count\endcsname
+ \fi
+% \end{macrocode}
+% |\ifodd\caption@thepage|\ldots
+% \begin{macrocode}
+ \ifodd\caption@thepage
+ \let\caption@ifoddpage\@firstoftwo
+ \else
+ \let\caption@ifoddpage\@secondoftwo
+ \fi
+ }{\let\caption@ifoddpage\@firstoftwo}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifoddpage}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{Indentions}
+%
+% \begin{macro}{\captionindent}
+% \begin{macro}{\captionparindent}
+% \begin{macro}{\captionhangindent}
+% These are the indentions we support.
+% \begin{macrocode}
+\newdimen\captionindent
+\newdimen\captionparindent
+\newdimen\captionhangindent
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v3.0b}{2004/05/16}{Defaults added for options \opt{parindent=} and \opt{hangindent=}}
+% \changes{v3.0h}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption} replaced by \cs{caption@@par}}
+% \changes{v3.0h}{2005/08/22}{Undocumented defaults for \opt{parindent=}, \opt{hangindent=},
+% and \opt{parskip=} removed}
+% \begin{macrocode}
+\DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}% obsolete!
+\DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}}
+\DeclareCaptionOption{hangindent}{\setlength\captionhangindent{#1}}
+\DeclareCaptionOption{parindent}{\setlength\captionparindent{#1}}
+\DeclareCaptionOption{parskip}{\l@addto@macro\caption@@par{\setlength\parskip{#1}}}
+% \end{macrocode}
+%
+% \changes{v3.0h}{2005/08/22}{Increased compatibility to KOMA-Script: A special version of options
+% `parindent' and `parskip' added}
+% \changes{v3.0i}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of `parskip' and `parindent' options
+% revised and moved into caption kernel}
+% \changes{v3.0j}{2006/02/23}{KOMA-Script variants of `parskip' and `parindent' are obsolete now, removed}
+% \changes{v3.0o}{2007/03/30}{KOMA-Script variants of `parskip' and `parindent' re-added, since they
+% still collide with the actual version of subfig (Sigh!)}
+%
+% \begin{macrocode}
+\@ifundefined{scr@caption}{}{%
+% \end{macrocode}
+%
+% There is an option clash between the \KOMAScript\ document classes
+% and the \package{caption} kernel,
+% both define the options |parindent| and |parskip| but with different meaning.
+% Furthermore the ones defined by the \package{caption} kernel take a
+% value as parameter but the \KOMAScript\ ones do not.
+% So we need special versions of the options |parindent| and |parskip| here,
+% ones who determine if a value is given (and therefore should be treated as
+% our option) or not (and therefore should be ignored by us).
+%
+% \begin{macrocode}
+ \let\caption@KV@parindent\KV@caption@parindent
+ \DeclareCaptionOption{parindent}[]{%
+ \def\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty
+ \PackageInfo{caption3}{Option `parindent' ignored}%
+ \else
+ \caption@KV@parindent{#1}%
+ \fi}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\caption@KV@parskip\KV@caption@parskip
+ \DeclareCaptionOption{parskip}[]{%
+ \def\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty
+ \PackageInfo{caption3}{Option `parskip' ignored}%
+ \else
+ \caption@KV@parskip{#1}%
+ \fi}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{Styles}
+%
+% \begin{macro}{\DeclareCaptionStyle}
+% \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
+% |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionStyle[1]{%
+ \@ifnextchar[{\caption@declarestyle{#1}}{\caption@declarestyle{#1}[]}}
+\def\caption@declarestyle#1[#2]#3{%
+ \global\@namedef{caption@sls@#1}{#2}%
+ \global\@namedef{caption@sty@#1}{#3}}
+\@onlypreamble\DeclareCaptionStyle
+\@onlypreamble\caption@declarestyle
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{style}{\caption@setstyle{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setstyle}
+% \changes{v3.0f}{2005/06/01}{Starred variant added}
+% |\caption@setstyle|\marg{name}\\
+% |\caption@setstyle*|\marg{name}\par
+% Selecting a caption style means saving the additional
+% \meta{single-line-list-of-KV} (this will be done by |\caption@sls|),
+% resetting the caption options to the default ones (this will be done using
+% |\caption@setdefault|) and executing the \meta{list-of-KV} options
+% (this will be done using |\caption@esetup|).\par
+% The starred version will give no error message if the given style is not
+% defined.
+% \begin{macrocode}
+\newcommand\caption@setstyle{%
+ \@ifstar{\caption@@setstyle\@gobble}{\caption@@setstyle\@firstofone}}
+\newcommand*\caption@@setstyle[2]{%
+ \@ifundefined{caption@sty@#2}%
+ {#1{\caption@Error{Undefined caption style `#2'}}}%
+ {\expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
+ \caption@setdefault\caption@esetup{\csname caption@sty@#2\endcsname}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setdefault}
+% This resets (nearly) all caption options to the default ones.
+% \emph{Note that this does not touch the skips and the positioning!}
+% \begin{macrocode}
+\newcommand\caption@setdefault{\captionsetup{%
+ format=default,labelformat=default,labelsep=default,textformat=default,%
+ justification=default,font=default,labelfont=default,textfont=default,%
+ margin=0pt,indent=0pt,parindent=0pt,hangindent=0pt,%
+ singlelinecheck=1,strut=1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0d}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
+% Currently there is only one pre-defined style, called `default'.
+% It's a perfect match to the behaviour of |\@makecaption| offered by the
+% standard \LaTeX\ document classes:
+% If the caption fits in one single line, it is typeset centered.
+%
+% \begin{macrocode}
+\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{}
+% \end{macrocode}
+%
+% \subsubsection*{Formats}
+%
+% \begin{macro}{\DeclareCaptionFormat}
+% \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
+% \changes{v3.0d}{2005/02/09}{Starred variant added}
+% |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\
+% |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par
+% The starred form causes the code being typeset in vertical (instead of
+% horizontal) mode, but does not support the |indention=| option.
+% \begin{macrocode}
+\newcommand\DeclareCaptionFormat{%
+ \@ifstar{\caption@declareformat\@gobble}%
+ {\caption@declareformat\@firstofone}}
+\newcommand\caption@declareformat[3]{%
+ \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
+ \global\long\@namedef{caption@fmt@#2}##1##2##3{#3}}
+\@onlypreamble\DeclareCaptionFormat
+\@onlypreamble\caption@declareformat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{format}{\caption@setformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setformat}
+% |\caption@setformat|\marg{name}\par
+% Selecting a caption format simply means saving the code (in |\caption@fmt|)
+% and if the code should be used in horizontal or vertical mode (|\caption@ifh|).
+% \begin{macrocode}
+\newcommand*\caption@setformat[1]{%
+ \@ifundefined{caption@fmt@#1}%
+ {\caption@Error{Undefined caption format `#1'}}%
+ {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
+ \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0a}{2004/01/23}{Caption format \opt{default} renamed to \opt{normal}}
+% \changes{v3.0f}{2005/05/12}{Caption format \opt{normal} renamed to \opt{@normal}}
+% \changes{v3.0h}{2005/08/25}{Caption format \opt{@normal} renamed to \opt{plain} and documented}
+% There are two pre-defined formats, called `plain' and `hang'.
+%
+% \begin{macrocode}
+\DeclareCaptionFormat{plain}{#1#2#3\par}
+\DeclareCaptionFormat{hang}{%
+ \@hangfrom{#1#2}%
+ \advance\captionparindent\hangindent
+ \advance\captionhangindent\hangindent
+ \caption@@par
+ #3\par}
+% \end{macrocode}
+%
+% \changes{v3.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{normal}}
+% \changes{v3.0e}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added}
+% `default' usually maps to `plain'.
+%
+% \begin{macrocode}
+\def\caption@fmt@default{\caption@fmt@plain}
+\def\caption@ifh@default{\caption@ifh@plain}
+% \end{macrocode}
+%
+% \subsubsection*{Label formats}
+%
+% \begin{macro}{\DeclareCaptionLabelFormat}
+% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
+% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionLabelFormat[2]{%
+ \global\@namedef{caption@lfmt@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionLabelFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelformat}
+% |\caption@setlabelformat|\marg{name}\par
+% Selecting a caption label format simply means saving the code (in |\caption@lfmt|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelformat[1]{%
+ \@ifundefined{caption@lfmt@#1}%
+ {\caption@Error{Undefined caption label format `#1'}}%
+ {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are three pre-defined label formats, called `empty', `simple', and `parens'.
+%
+% \begin{macrocode}
+\DeclareCaptionLabelFormat{empty}{}
+\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
+\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+%
+% \begin{macrocode}
+\def\caption@lfmt@default{\caption@lfmt@simple}
+% \end{macrocode}
+%
+% \subsubsection*{Label separators}
+%
+% \begin{macro}{\DeclareCaptionLabelSeparator}
+% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
+% \changes{v3.0h}{2005/08/25}{Starred variant added}
+% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
+% |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par
+% The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|.
+% \begin{macrocode}
+\newcommand\DeclareCaptionLabelSeparator{%
+ \@ifstar{\caption@declarelabelseparator\@gobble}%
+ {\caption@declarelabelseparator\@firstofone}}
+\newcommand\caption@declarelabelseparator[3]{%
+ \global\expandafter\let\csname caption@iflf@#2\endcsname#1%
+ \global\long\@namedef{caption@lsep@#2}{#3}}
+\@onlypreamble\DeclareCaptionLabelSeparator
+\@onlypreamble\caption@declarelabelseparator
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
+\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelseparator}
+% |\caption@setlabelseparator|\marg{name}\par
+% Selecting a caption label separator simply means saving the code (in |\caption@lsep|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelseparator[1]{%
+ \@ifundefined{caption@lsep@#1}%
+ {\caption@Error{Undefined caption label separator `#1'}}%
+ {\expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
+ \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0f}{2005/06/11}{Bugfix 05-03-23: Caption label separator \opt{newline} implementation
+% changed from \cs{newline} to \cs{\textbackslash}}
+% \changes{v3.0h}{2005/08/24}{Caption label separator \opt{endash} added}
+% There are seven pre-defined label separators, called `none', `colon', `period', `space',
+% `quad', `newline', and `endash'.
+%
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{none}{}
+\DeclareCaptionLabelSeparator{colon}{: }
+\DeclareCaptionLabelSeparator{period}{. }
+\DeclareCaptionLabelSeparator{space}{ }
+\DeclareCaptionLabelSeparator*{quad}{\quad}
+\DeclareCaptionLabelSeparator*{newline}{\\}
+\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
+% \end{macrocode}
+%
+% `default' usually maps to `colon'.
+%
+% \begin{macrocode}
+\def\caption@lsep@default{\caption@lsep@colon}
+\def\caption@iflf@default{\caption@iflf@colon}
+% \end{macrocode}
+%
+% \subsubsection*{Text formats}
+%
+% \begin{macro}{\DeclareCaptionTextFormat}
+% \changes{v3.0l}{2007/02/18}{This macro added}
+% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionTextFormat[2]{%
+ \global\long\@namedef{caption@tfmt@#1}##1{#2}}
+\@onlypreamble\DeclareCaptionTextFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@settextformat}
+% \changes{v3.0l}{2007/02/18}{This macro added}
+% |\caption@settextformat|\marg{name}\par
+% Selecting a caption text format simply means saving the code (in |\caption@tfmt|).
+% \begin{macrocode}
+\newcommand*\caption@settextformat[1]{%
+ \@ifundefined{caption@tfmt@#1}%
+ {\caption@Error{Undefined caption text format `#1'}}%
+ {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are two pre-defined text formats, called `simple' and `period'.
+%
+% \begin{macrocode}
+\DeclareCaptionTextFormat{simple}{#1}
+\DeclareCaptionTextFormat{period}{#1.}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+%
+% \begin{macrocode}
+\def\caption@tfmt@default{\caption@tfmt@simple}
+% \end{macrocode}
+%
+% \subsubsection*{Justifications}
+%
+% \begin{macro}{\DeclareCaptionJustification}
+% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
+% |\DeclareCaptionJustification|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionJustification[2]{%
+ \global\@namedef{caption@hj@#1}{#2}}
+%\newcommand\DeclareCaptionJustification{\DeclareCaptionFont}
+\@onlypreamble\DeclareCaptionJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{justification}{\caption@setjustification{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setjustification}
+% |\caption@setjustification|\marg{name}\par
+% Selecting a caption justification simply means saving the code (in |\caption@hj|).
+% \begin{macrocode}
+\newcommand*\caption@setjustification[1]{%
+ \@ifundefined{caption@hj@#1}%
+ {\caption@Error{Undefined caption justification `#1'}}%
+ {\expandafter\let\expandafter\caption@hj\csname caption@hj@#1\endcsname}}
+%\newcommand\caption@setjustification{\caption@setfont{@hj}}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined justification code snippets.
+%
+% \begin{macrocode}
+\DeclareCaptionJustification{justified}{}
+\DeclareCaptionJustification{centering}{\centering}
+\DeclareCaptionJustification{centerfirst}{\centerfirst}
+\DeclareCaptionJustification{centerlast}{\centerlast}
+\DeclareCaptionJustification{raggedleft}{\raggedleft}
+\DeclareCaptionJustification{raggedright}{\raggedright}
+% \end{macrocode}
+%
+% `default' usually maps to `justified'.
+%
+% \begin{macrocode}
+\def\caption@hj@default{\caption@hj@justified}
+% \end{macrocode}
+%
+% \begin{macro}{\centerfirst}
+% \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}}
+% Please blame Frank Mittelbach for |\caption@centerfirst| |:-)|
+% \begin{macrocode}
+\providecommand\centerfirst{%
+ \let\\\@centercr
+ \edef\caption@normaladjust{%
+ \leftskip\the\leftskip
+ \rightskip\the\rightskip
+ \parfillskip\the\parfillskip\relax}%
+ \leftskip\z@\@plus -1fil%
+ \rightskip\z@\@plus 1fil%
+ \parfillskip\z@skip
+ \noindent\hskip\z@\@plus 2fil%
+ \@setpar{\@@par\@restorepar\caption@normaladjust}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\centerlast}
+% \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}}
+% This is based on code from Anne Br\"uggemann-Klein\cite{Anne}
+% \begin{macrocode}
+\providecommand\centerlast{%
+ \let\\\@centercr
+ \leftskip\z@\@plus 1fil%
+ \rightskip\z@\@plus -1fil%
+ \parfillskip\z@\@plus 2fil\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0b}{2004/05/16}{Improved \package{ragged2e} package support}
+% We also support the upper-case commands offered by the \package{ragged2e}
+% package.
+% Note that these just map to their lower-case variants if the
+% \package{ragged2e} package is not available.
+% \begin{macrocode}
+\DeclareCaptionJustification{Centering}{%
+ \caption@ragged\Centering\centering}
+\DeclareCaptionJustification{RaggedLeft}{%
+ \caption@ragged\RaggedLeft\raggedleft}
+\DeclareCaptionJustification{RaggedRight}{%
+ \caption@ragged\RaggedRight\raggedright}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@ragged}
+% \changes{v3.0p}{2007/04/07}{The `ragged2e' package will now only been loaded when needed}
+% \changes{v3.0q}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced by \cs{caption@Debug}}
+% \changes{v3.0q}{2007/04/16}{Warnung will be suppressed on first \LaTeX\ run}
+% |\caption@ragged| will be basically defined as\par
+% |\AtBeginDocument{\IfFileExists{ragged2e.sty}%|\\
+% | {\RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}%|\\
+% | {\let\caption@ragged\@secondoftwo}}|\par
+% but with an additional warning if the ragged2e package is not loaded (yet).
+% (This warning will be typeout only one time per option, that's why
+% we need the |caption\string#1| stuff.)
+% Furthermore we load the \package{ragged2e} package, if needed and available.
+% \begin{macrocode}
+\newcommand*\caption@ragged{%
+ \caption@Debug{We need ragged2e}%
+ \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}%
+ \global\let\caption@ragged\caption@@ragged
+ \caption@@ragged}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@ragged[2]{%
+ \@ifundefined{caption\string#1}{%
+ \PackageWarning{caption3}{%
+ `ragged2e' package not loaded, therefore\MessageBreak
+ substituting \string#2 for \string#1\MessageBreak}%
+ \global\@namedef{caption\string#1}}{}%
+ #2}
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{%
+ \@ifundefined{caption@ragged2e}{%
+ \let\caption@@ragged\@secondoftwo % suppress warning above
+ }{%
+ \caption@Debug{We load ragged2e}%
+ \IfFileExists{ragged2e.sty}{%
+ \RequirePackage{ragged2e}\let\caption@@ragged\@firstoftwo}{}%
+ }}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{Fonts}
+%
+% \begin{macro}{\DeclareCaptionFont}
+% \changes{v3.0a}{2004/01/22}{Bugfix: Multi token arguments are allowed now}
+% |\DeclareCaptionFont|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand\DeclareCaptionFont[2]{%
+ \define@key{caption@fnt}{#1}[]{\g@addto@macro\caption@tempa{#2}}}
+\@onlypreamble\DeclareCaptionFont
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
+\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
+\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setfont}
+% \changes{v3.0l}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument}
+% |\caption@setfont|\marg{name}\marg{keyval-list of names}\par
+% Selecting a caption font means saving all the code snippets
+% (in |\caption#1|).
+% Because we use |\setkeys| recursive here we need to do this inside an
+% extra group and collect all the code snippets in |\caption@tempa| first.
+% \begin{macrocode}
+\newcommand*\caption@setfont[2]{%
+ \let\caption@tempa\@empty
+ \begingroup
+% \define@key{caption@fnt}{default}[]{%
+% \global\expandafter\let\expandafter\caption@tempa
+% \csname caption#1@default\endcsname}%
+ \caption@setkeys[caption]{caption@fnt}{#2}%
+ \endgroup
+ \expandafter\let\csname caption#1\endcsname\caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{default}{}
+% \end{macrocode}
+%
+% These are the pre-defined font code snippets.
+%
+% \begin{macrocode}
+\DeclareCaptionFont{scriptsize}{\scriptsize}
+\DeclareCaptionFont{footnotesize}{\footnotesize}
+\DeclareCaptionFont{small}{\small}
+\DeclareCaptionFont{normalsize}{\normalsize}
+\DeclareCaptionFont{large}{\large}
+\DeclareCaptionFont{Large}{\Large}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{up}{\upshape}
+\DeclareCaptionFont{it}{\itshape}
+\DeclareCaptionFont{sl}{\slshape}
+\DeclareCaptionFont{sc}{\scshape}
+\DeclareCaptionFont{md}{\mdseries}
+\DeclareCaptionFont{bf}{\bfseries}
+\DeclareCaptionFont{rm}{\rmfamily}
+\DeclareCaptionFont{sf}{\sffamily}
+\DeclareCaptionFont{tt}{\ttfamily}
+% \end{macrocode}
+%
+% \subsubsection*{\package{setspace} package support}
+% \changes{v3.0p}{2007/04/02}{\package{setspace} package support added to kernel}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{singlespacing}{\setstretch{\setspace@singlespace}}% normally 1
+\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
+\DeclareCaptionFont{doublespacing}{\doublespacing}
+% \end{macrocode}
+%
+% \begin{macro}{\captionsize}
+% \changes{v3.0a}{2004/01/23}{Implementation changed from \cs{captionfont} to \cs{@empty}}
+% \changes{v3.0c}{2004/07/16}{Use \cs{providecommand} instead of \cs{newcommand} in respect of the memoir class}
+% The old versions \version{1.x} of the \package{caption} package offered this
+% command to setup the font size used for captions. We still do
+% so old documents will work fine.
+% \begin{macrocode}
+\providecommand\captionsize{}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
+% \begin{macrocode}
+\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
+% \end{macrocode}
+%
+% \subsubsection*{Vertical spaces before and after captions}
+%
+% \begin{macro}{\abovecaptionskip}
+% \begin{macro}{\belowcaptionskip}
+% Usually these skips are defined within the document class, but some
+% document classes don't do so.
+% \begin{macrocode}
+\@ifundefined{abovecaptionskip}{%
+ \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
+\@ifundefined{belowcaptionskip}{%
+ \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v3.0d}{2005/02/12}{Option \opt{skip=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
+\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
+\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
+% \end{macrocode}
+%
+% \subsubsection*{Positioning}
+%
+% These macros handle the right position of the caption.
+% Note that the position is actually \emph{not} controlled by the
+% \package{caption} kernel options, but by the user (or a specific package
+% like the \package{float} package) instead.
+% The user can put the |\caption| command wherever he likes! So this stuff
+% is only to give us a \emph{hint} where to put the right skips, the user
+% usually has to take care for himself that this hint actually matches the
+% right position.
+% The user can also try out the experimental setting |position=auto| which
+% means that the \package{caption} package should try to guess the actual
+% position of the caption for himself. (But in many cases, for example in
+% |longtable|s, this is doomed to fail, so it's not documented in the
+% user part of the documentation.)
+%
+% \begin{macrocode}
+\DeclareCaptionOption{position}{\caption@setposition{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setposition}
+% \changes{v3.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b},
+% \opt{below}, and \opt{a} are allowed, too}
+% \changes{v3.0d}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
+% |\caption@setposition|\marg{position}\par
+% Selecting the caption position means that we put |\caption@position| to
+% the right value. \emph{Please do \textbf{not} use the internal macro
+% \cs{caption@position} in your own package or document, but use the wrapper
+% macro \cs{caption@iftop} instead.}
+% \begin{macrocode}
+\newcommand*\caption@setposition[1]{%
+ \caption@ifinlist{#1}{d,default}{%
+ \def\caption@position{\caption@defaultpos}%
+ }{\caption@ifinlist{#1}{t,top,above}{%
+ \let\caption@position\@firstoftwo
+ }{\caption@ifinlist{#1}{b,bottom,below}{%
+ \let\caption@position\@secondoftwo
+ }{\caption@ifinlist{#1}{a,auto}{%
+ \let\caption@position\@undefined
+ }{%
+ \caption@Error{Undefined caption position `#1'}%
+ }}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defaultpos}
+% The default `position' is usually `bottom', this means that the (larger)
+% skip will be typeset above the caption.
+% This correspondents to the |\@makecaption| implementation in the standard
+% \LaTeX\ document classes.
+% \begin{macrocode}
+%\caption@setdefaultpos{b}% default = bottom
+\let\caption@defaultpos\@secondoftwo
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftop}
+% \changes{v3.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
+% \changes{v3.0d}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
+% |\caption@iftop|\marg{true-code}\marg{false-code}\par
+% (If the |position=| is set to |auto| we assume a |bottom| position.)
+% \begin{macrocode}
+\newcommand\caption@iftop{%
+ \ifx\caption@position\@undefined
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\caption@position
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fixposition}
+% \changes{v3.0b}{2004/05/16}{Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
+% |\caption@fixposition|\par
+% This macro checks if the `position' is set to `auto'.
+% If yes, |\caption@autoposition| will be called to
+% set |\caption@position| to a proper value we can actually use.
+% \begin{macrocode}
+\newcommand\caption@fixposition{%
+ \ifx\caption@position\@undefined
+ \caption@autoposition
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@autoposition}
+% \changes{v3.0a}{2004/01/23}{\cs{ifvmode} added}
+% |\caption@autoposition|\par
+% We guess the actual position of the caption by checking |\prevdepth|.
+% \begin{macrocode}
+\newcommand\caption@autoposition{%
+ \ifvmode
+ \edef\caption@tempa{\the\prevdepth}%
+ \caption@Debug{\protect\prevdepth=\caption@tempa}%
+% \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}%
+ \ifdim\prevdepth>-\p@
+ \let\caption@position\@secondoftwo
+ \else
+ \let\caption@position\@firstoftwo
+ \fi
+ \else
+ \caption@Debug{no \protect\prevdepth}%
+% \caption@setposition{b}%
+ \let\caption@position\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{Hooks}
+%
+% \begin{macro}{\AtBeginCaption}
+% \begin{macro}{\AtEndCaption}
+% |\AtBeginCaption| \marg{code}\\
+% |\AtEndCaption| \marg{code}\par
+% These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|.
+% \begin{macrocode}
+\newcommand\caption@beginhook{}
+\newcommand\caption@endhook{}
+\newcommand\AtBeginCaption{\l@addto@macro\caption@beginhook}
+\newcommand\AtEndCaption{\l@addto@macro\caption@endhook}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection*{Miscellaneous options}
+%
+% \changes{v3.0b}{2004/05/16}{Option \opt{listof=} added}
+% \changes{v3.0d}{2005/02/12}{Option \opt{strut=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}}
+\DeclareCaptionOption{singlelinecheck}{\caption@setbool{slc}{#1}}
+\DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}}
+% \end{macrocode}
+%
+% \subsubsection*{Debug option}
+% \changes{v3.0m}{2007/03/04}{Debug option added to kernel}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{debug}[1]{%
+ \caption@setbool{debug}{#1}%
+ \caption@ifdebug{%
+ \def\caption@Debug{\PackageInfo{caption3}}%
+ }{%
+ \let\caption@Debug\@gobble
+ }}
+\setkeys{caption}{debug=0}
+% \end{macrocode}
+%
+% \subsubsection*{Initialization of parameters}
+%
+% \begin{macrocode}
+\captionsetup{style=default,position=default,listof=1,%
+ twoside=\if@twoside 1\else 0\fi}
+% \end{macrocode}
+%
+% \begin{macro}{\ifcaption@star}
+% If the starred form of |\caption| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@@make|.)
+% \begin{macrocode}
+\newif\ifcaption@star
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{Typesetting the caption}
+%
+% \begin{macro}{\caption@make}
+% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}
+% \begin{macrocode}
+\newcommand\caption@make[2]{%
+ \caption@@make{\caption@lfmt{#1}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@make}
+% \changes{v3.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
+% \changes{v3.0d}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of \cs{captionmargin} resp. \cs{captionwidth};
+% check for \cs{z@} added}
+% \changes{v3.0d}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end of caption added}
+% \changes{v3.0d}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
+% \changes{v3.0d}{2005/02/12}{Single-line-check moved up so it can affect margins now}
+% \changes{v3.0d}{2005/02/09}{Improvement: \cs{caption@ifh} added}
+% \changes{v3.0d}{2005/02/09}{Bugfix: \cs{leavevmode} added}
+% \changes{v3.0h}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
+% \changes{v3.0i}{2005/12/04}{Uses \cs{caption@slc}}
+% \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside single-line-check replaced by \cs{relax}}
+% \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be typeset in horizontal mode}
+% \changes{v3.0k}{2006/05/13}{Uses \cs{captionbox} instead of \cs{caption@start/endbox}}
+% \changes{v3.0l}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v3.0j, re-added}
+% \changes{v3.0p}{2007/04/03}{Usage of \cs{caption@ifoddpage} added}
+% |\caption@@make|\marg{caption label}\marg{caption text}
+% \begin{macrocode}
+\newcommand\caption@@make[2]{%
+ \begingroup
+ \caption@beginhook
+ \caption@calcmargin
+% \end{macrocode}
+%
+% Special single-line treatment (option |singlelinecheck=|)
+%
+% \begin{macrocode}
+ \caption@ifslc{\ifx\caption@sls\@empty\else
+ \caption@slc{#1}{#2}\captionwidth\relax
+ \fi}{}%
+% \end{macrocode}
+%
+% Typeset the left margin (option |margin=|)
+%
+% \begin{macrocode}
+ \@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@\else
+ \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}%
+ \fi
+ \caption@ifh{\advance\@tempdima\captionindent}%
+ \hskip\@tempdima
+% \end{macrocode}
+%
+% We actually use a |\vbox| of width |\captionwidth - \captionindent|
+% to typeset the caption
+% (Note: |\captionindent| is \emph{not} supported if the caption format
+% was defined with |\DeclareCaptionFormat*|.)
+%
+% \begin{macrocode}
+ \@tempdima\captionwidth
+ \caption@ifh{\advance\@tempdima by -\captionindent}%
+ \captionbox\@tempdima{%
+% \end{macrocode}
+%
+% Typeset the indention (option |indention=|)\\
+% Bugfix 04-05-05: |\hskip-\captionindent| replaced by |\ifdim\captionindent=\z@|\ldots
+%
+% \begin{macrocode}
+ \caption@ifh{%
+ \ifdim\captionindent=\z@
+ \leavevmode
+ \else
+ \hskip-\captionindent
+ \fi}%
+% \end{macrocode}
+%
+% Typeset the caption itself and close the |\captionbox|
+%
+% \begin{macrocode}
+ \caption@@@make{#1}{#2}}%
+% \end{macrocode}
+%
+% Typeset the right margin (option |margin=|)
+%
+% \begin{macrocode}
+ \@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@\else
+ \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}%
+ \fi
+ \hskip\@tempdima
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@endhook
+ \endgroup
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \global\caption@starfalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@calcmargin}
+% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
+% values.
+% \changes{v3.0h}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by \cs{ifdim}\cs{captionwidth=}\cs{z@}}
+% \changes{v3.0i}{2006/01/12}{Improvement: Takes care of list environment now}
+% \begin{macrocode}
+\newcommand\caption@calcmargin{%
+% \end{macrocode}
+% \emph{Note:} Inside a |list| environment |\linewidth| do not contain
+% the proper value, because |\@caption| calls |\@parboxrestore| which
+% resets |\linewidth| to |\hsize|. Therefore we have to calculate the
+% proper line width on our own in this case.
+% \begin{macrocode}
+ \@tempdima\hsize
+ \ifnum\@listdepth>0\relax
+ \advance\@tempdima by -\leftmargin
+ \advance\@tempdima by -\rightmargin
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \ifdim\captionwidth=\z@
+ \captionwidth\@tempdima
+ \advance\captionwidth by -2\captionmargin
+ \advance\captionwidth by -\captionmargin@
+ \else
+ \captionmargin\@tempdima
+ \advance\captionmargin by -\captionwidth
+ \divide\captionmargin by 2
+ \captionmargin@\z@
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{%
+ \protect\hsize=\the\hsize,
+ \protect\margin=\the\captionmargin,
+ \protect\marginx=\the\captionmargin@,
+ \protect\width=\the\captionwidth}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@slc}
+% This one does the single-line-check.
+% \begin{macrocode}
+\newcommand\caption@slc[4]{%
+ \caption@startslc
+ \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
+ \ifdim\wd\@tempboxa >#3%
+ \caption@endslc
+ \else
+ \caption@endslc
+ \caption@esetup\caption@sls
+ #4%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@startslc}
+% \changes{v3.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
+% \changes{v3.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
+% \changes{v3.0d}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added}
+% \changes{v3.0h}{2005/07/09}{Support of \package{endnotes} package added}
+% Re-define anything which would disturb the single-line-check.
+% \begin{macrocode}
+\newcommand\caption@startslc{%
+ \begingroup
+ \let\label\@gobble
+ \let\@footnotetext\@gobble\let\@endnotetext\@gobble
+ \def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}%
+ \let\caption@hj\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@endslc}
+% This ends the single-line-check.
+% \begin{macrocode}
+\newcommand\caption@endslc{%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionbox}
+% \changes{v3.0k}{2006/05/13}{We define \cs{captionbox} instead of \cs{caption@start/endbox}}
+% \changes{v3.0n}{2006/03/09}{Bugfix 07-03-09: \cs{captionbox} changed from \cs{parbox-t} to \cs{parbox-b}}
+% This macro defines the box which surrounds the caption paragraph.
+% \begin{macrocode}
+\newcommand\captionbox{\parbox[b]}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@make}
+% \changes{v3.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
+% \changes{v3.0d}{2005/02/12}{Bugfix 04-12-16: Use some kind of \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
+% \changes{v3.0d}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
+% \changes{v3.0e}{2005/05/05}{Use \cs{caption@ifempty}; \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
+% \changes{v3.0e}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
+% \changes{v3.0h}{2005/08/24}{Check for empty label added}
+% \changes{v3.0h}{2005/08/25}{\cs{caption@iflf} added}
+% \changes{v3.0l}{2007/02/18}{Usage of \cs{caption@tfmt} added}
+% |\caption@@@make|\marg{caption label}\marg{caption text}\par
+% This one finally typesets the caption paragraph, without margin and indention.
+% \begin{macrocode}
+\newcommand\caption@@@make[2]{%
+% \end{macrocode}
+%
+% If the label is empty, we use no caption label separator.
+%
+% \begin{macrocode}
+ \sbox\@tempboxa{#1}%
+ \ifdim\wd\@tempboxa=\z@
+ \let\caption@lsep\relax
+ \fi
+% \end{macrocode}
+%
+% If the text is empty, we use no caption label separator, too.
+%
+% \begin{macrocode}
+ \caption@ifempty{#2}{%
+ \let\caption@lsep\relax
+% \let\caption@ifstrut\@secondoftwo
+ }%
+% \end{macrocode}
+%
+% Take care that |\captionparindent| and |\captionhangindent| will be used
+% to typeset the paragraph.
+%
+% \begin{macrocode}
+ \@setpar{\@@par\caption@@par}\caption@@par
+% \end{macrocode}
+%
+% Finally the caption will be typeset.
+%
+% \begin{macrocode}
+ \caption@hj\captionsize\captionfont\caption@fmt
+ {\ifcaption@star\else{\captionlabelfont#1}\fi}%
+ {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}%
+ {{\captiontextfont
+ \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
+ \nobreak\hskip\z@skip
+ \caption@tfmt{#2}%
+% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
+ \caption@ifstrut{\@finalstrut\strutbox}{}%
+ \par}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty}
+% \changes{v3.0e}{2005/05/05}{This macro added}
+% |\caption@ifempty|\marg{text}\marg{if-clause}\par
+% This one tests if the \meta{text} is actually empty.\par
+% \emph{Note:} This will be done without expanding the text, therefore this
+% is far away from being bullet-proof.
+% \begin{macrocode}
+\newcommand\caption@ifempty[1]{%
+ \def\caption@tempa{#1}%
+ \def\caption@tempb{\ignorespaces}%
+ \ifx\caption@tempa\caption@tempb
+ \let\caption@tempa\@empty
+ \fi
+ \ifx\caption@tempa\@empty
+ \expandafter\@firstofone
+ \else
+ \expandafter\@gobble
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@par}
+% \changes{v3.0h}{2005/08/22}{Made this definition global}
+% |\caption@@par|\par
+% This command will be executed with every |\par| inside the caption.
+% \begin{macrocode}
+\newcommand*\caption@@par{%
+ \parindent\captionparindent\hangindent\captionhangindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \iffalse
+%</kernel>
+% \fi
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \subsection{Main package}
+% \iffalse
+%<*package>
+% \fi
+%
+% \subsubsection*{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption}[2007/04/16 v3.0q Customising captions (AR)]
+% \end{macrocode}
+%
+% \subsubsection*{Loading the kernel}
+%
+% \begin{macrocode}
+\RequirePackage{caption3}[=2007/01/31] % needs v1.0l or newer
+% \end{macrocode}
+%
+% \subsection*{Check against the obsolete \package{caption2} package}
+% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
+%
+% \begin{macrocode}
+\@ifpackageloaded{caption2}{%
+ \caption@Error{You can't use both the caption *and* caption2 package}%
+ \endinput
+}{}
+% \end{macrocode}
+%
+% \subsubsection*{Option for configuration files}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{config}[caption]{%
+ \InputIfFileExists{#1.cfg}{\typeout{*** Local configuration file
+ #1.cfg used ***}}%
+ {\PackageWarning{caption}{Configuration
+ file #1.cfg not found}}}
+% \end{macrocode}
+%
+% \subsubsection*{Options for |figure| and |table|}
+%
+% \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
+% \begin{macrocode}
+\DeclareCaptionOption*{figureposition}{\captionsetup[figure]{position=#1}}
+\DeclareCaptionOption*{tableposition}{\captionsetup[table]{position=#1}}
+% \end{macrocode}
+%
+% \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
+% \begin{macrocode}
+\DeclareCaptionOption*{figurename}{\captionsetup[figure]{name=#1}}
+\DeclareCaptionOption*{tablename}{\captionsetup[table]{name=#1}}
+% \end{macrocode}
+%
+% \subsubsection*{caption \version{1.x} compatibility options}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{normal}[]{\caption@setformat{normal}}
+\DeclareCaptionOption*{isu}[]{\caption@setformat{hang}}
+\DeclareCaptionOption*{hang}[]{\caption@setformat{hang}}
+\DeclareCaptionOption*{center}[]{\caption@setjustification{centering}}
+\DeclareCaptionOption*{anne}[]{\caption@setjustification{centerlast}}
+\DeclareCaptionOption*{centerlast}[]{\caption@setjustification{centerlast}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{scriptsize}[]{\def\captionfont{\scriptsize}}
+\DeclareCaptionOption*{footnotesize}[]{\def\captionfont{\footnotesize}}
+\DeclareCaptionOption*{small}[]{\def\captionfont{\small}}
+\DeclareCaptionOption*{normalsize}[]{\def\captionfont{\normalsize}}
+\DeclareCaptionOption*{large}[]{\def\captionfont{\large}}
+\DeclareCaptionOption*{Large}[]{\def\captionfont{\Large}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{up}[]{\l@addto@macro\captionlabelfont\upshape}
+\DeclareCaptionOption*{it}[]{\l@addto@macro\captionlabelfont\itshape}
+\DeclareCaptionOption*{sl}[]{\l@addto@macro\captionlabelfont\slshape}
+\DeclareCaptionOption*{sc}[]{\l@addto@macro\captionlabelfont\scshape}
+\DeclareCaptionOption*{md}[]{\l@addto@macro\captionlabelfont\mdseries}
+\DeclareCaptionOption*{bf}[]{\l@addto@macro\captionlabelfont\bfseries}
+\DeclareCaptionOption*{rm}[]{\l@addto@macro\captionlabelfont\rmfamily}
+\DeclareCaptionOption*{sf}[]{\l@addto@macro\captionlabelfont\sffamily}
+\DeclareCaptionOption*{tt}[]{\l@addto@macro\captionlabelfont\ttfamily}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{nooneline}[]{\caption@setbool{slc}{0}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\caption@setbool{ruled}{0}
+\DeclareCaptionOption*{ruled}[]{\caption@setbool{ruled}{1}}
+% \end{macrocode}
+%
+% \subsubsection*{Some caption2 \version{2.x} compatibility options}
+% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{flushleft}[]{\caption@setjustification{raggedright}}
+\DeclareCaptionOption*{flushright}[]{\caption@setjustification{raggedleft}}
+\DeclareCaptionOption*{oneline}[]{\caption@setbool{slc}{1}}
+\DeclareCaptionOption*{ignoreLTcapwidth}[]{}
+% \end{macrocode}
+%
+% \subsubsection*{Some \KOMAScript\ compatibility options}
+% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{onelinecaption}[]{\caption@setbool{slc}{1}}
+\DeclareCaptionOption*{noonelinecaption}[]{\caption@setbool{slc}{0}}
+\DeclareCaptionOption*{tablecaptionabove}[]{\captionsetup[table]{position=t}}
+\DeclareCaptionOption*{tablecaptionbelow}[]{\captionsetup[table]{position=b}}
+% \end{macrocode}
+%
+% \subsubsection*{Generic package support}
+%
+% \begin{macro}{\caption@declarepackage}
+% |\caption@declarepackage|\marg{package name}\par
+% Each single package support can be switched on or off by using the
+% appropriate option. By default all of them are enabled.
+% \begin{macrocode}
+\newcommand*\caption@declarepackage[1]{%
+ \caption@setbool{pkt@#1}{1}%
+ \DeclareCaptionOption*{#1}{\caption@setbool{pkt@#1}{##1}}}
+\AtEndOfPackage{\let\caption@declarepackage\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifpackage}
+% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added, so no extra check is needed}
+% |\caption@ifpackage|\marg{package name}\marg{package macro}\marg{code}\par
+% If a certain package support is requested the appropriate code will
+% be used. `Requested' means that the option belonging to it is set to
+% |true| and the macro called \meta{package macro} is defined.
+% (If \meta{package macro} is not yet defined we use |\AtBeginDocument|
+% here, so the package could be loaded after this package, too.)
+% \begin{macrocode}
+\newcommand\caption@ifpackage[3]{%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@tempa{%
+ \caption@ifbool{pkt@#1}%
+ {\@ifundefined{#2}{AtBeginDocument}{firstofone}}%
+ {gobble}}%
+ \caption@Info{#1=\caption@ifbool{pkt@#1}{1}{0} %
+ (\@ifundefined{#2}{not }{}loaded->\caption@tempa)}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifbool{pkt@#1}{%
+ \@ifundefined{#2}%
+ {\let\caption@tempa\AtBeginDocument}%
+ {\let\caption@tempa\@firstofone}%
+ }{%
+ \let\caption@tempa\@gobble
+ }%
+ \caption@tempa{\@ifundefined{#2}{}{#3}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@undefbool{pkt@#1}}
+\AtEndOfPackage{\let\caption@ifpackage\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% You can also switch the caption support off using the package option
+% |caption=false|.
+% This may look strange, but there are certain circumstances where this could
+% be useful.
+% Such a situation might be the usage of the \package{subfig} package without
+% disturbing the main caption code of the document class.\par
+% \emph{Note: This mechanism is obsolete now, it has been superseeded by the
+% \package{subfig} package option {\rm|caption=false|} which causes that only the
+% caption kernel \package{caption3} is loaded.}
+%
+% \begin{macrocode}
+\caption@declarepackage{caption}
+% \end{macrocode}
+%
+% These are the packages we support:
+%
+% \begin{macrocode}
+\caption@declarepackage{float}
+\caption@declarepackage{floatrow}
+\caption@declarepackage{hyperref}
+\caption@declarepackage{hypcap}
+\caption@declarepackage{listings}
+\caption@declarepackage{longtable}
+\caption@declarepackage{picins}
+\caption@declarepackage{rotating}
+\caption@declarepackage{sidecap}
+\caption@declarepackage{supertabular}
+% \end{macrocode}
+%
+% \subsubsection*{Processing of options}
+%
+% \changes{v3.0m}{2007/03/04}{Verbose option added to package}
+% \begin{macrocode}
+\DeclareCaptionOption{verbose}[1]{%
+ \caption@setbool{verbose}{#1}%
+ \caption@ifverbose{%
+ \def\caption@Info{\PackageInfo{caption}}%
+ }{%
+ \let\caption@Info\@gobble
+ }}
+\setkeys{caption}{verbose=0}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\caption@ProcessOptions{caption}
+% \end{macrocode}
+%
+% If the option |caption=false| was given we stop processing this file
+% immediately.
+% \begin{macrocode}
+\caption@ifbool{pkt@caption}{}{\endinput}
+\caption@undefbool{pkt@caption}
+% \end{macrocode}
+%
+% \subsubsection*{Useful stuff}
+%
+% \begin{macro}{\captionof}
+% |\captionof|(|*|)\marg{type}\oarg{lst\_entry}\marg{heading}
+% \begin{macrocode}
+\def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}}
+\newcommand*\caption@of[2]{\def\@captype{#2}#1}
+% \end{macrocode}
+% \end{macro}
+%
+% Note: Like |\captionof| the option |type=| should only be used inside a
+% group or environment and does not check if the argument is a valid
+% floating environment or not.
+%
+% \changes{v3.0d}{2004/08/03}{Option \opt{name=} added}
+% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{name}{\caption@setfloatname\@captype{#1}}
+\DeclareCaptionOption{type}{\def\@captype{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\ContinuedFloat}
+% \changes{v3.0f}{2005/06/11}{Call of \cs{caption@ContinuedFloat} added}
+% \changes{v3.0i}{2005/11/12}{Optional argument and call of \cs{caption@@ContinuedFloat} added}
+% |\ContinuedFloat|\oarg{type}\par
+% This mainly decreases the appropriate counter by $-1$.
+% \begin{macrocode}
+\providecommand\ContinuedFloat{%
+ \@ifnextchar[%]
+ \@ContinuedFloat
+ {\ifx\@captype\@undefined
+ \@latex@error{\noexpand\ContinuedFloat outside float}\@ehd
+ \else
+ \@ContinuedFloat[\@captype]%
+ \fi}}
+\def\@ContinuedFloat[#1]{%
+ \addtocounter{#1}\m@ne
+ \caption@ContinuedFloat{#1}%
+ \caption@@ContinuedFloat{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ContinuedFloat}
+% \begin{macro}{\caption@resetContinuedFloat}
+% |\caption@ContinuedFloat|\marg{type}\par
+% |\caption@resetContinuedFloat|\marg{type}\par
+% The first one will be called inside |\ContinuedFloat|, the second one
+% inside |\caption|. Usually they do nothing but this changes if the
+% \package{hyperref} package is loaded. (See \package{hyperref} package
+% support for details.)
+% \begin{macrocode}
+\let\caption@ContinuedFloat\@gobble
+\let\caption@resetContinuedFloat\@gobble
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@@ContinuedFloat}
+% This hook is for foreign packages which link themself into |\ContinuedFloat|,
+% for example the \package{subfig} package\cite{subfig}.
+% \begin{macrocode}
+\providecommand*\caption@@ContinuedFloat[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{Internal helpers}
+%
+% \begin{macro}{\caption@begin}
+% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed by \cs{caption@setfloattype}}
+% \changes{v3.0e}{2005/04/12}{Check for default label format added}
+% \changes{v3.0f}{2005/06/11}{Call of \cs{caption@resetContinuedFloat} added}
+% Our handling of |\caption| will always be surrounded by
+% |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
+% |\caption@begin|\marg{type} performs these tasks:
+% \begin{itemize}
+% \item Call |\caption@resetContinuedFloat| (see above)
+% and start a new group
+% \item Execute the options set with |\captionsetup|\oarg{type}
+% \item Define |\fnum@|\meta{type} if the caption label format is set
+% to non-default
+% \item Override the |position=| setting, if necessary
+% (for example if set to |auto| or used inside a |supertabular|)
+% \end{itemize}
+% \begin{macrocode}
+\newcommand*\caption@begin[1]{%
+ \caption@resetContinuedFloat{#1}%
+ \begingroup
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setfloattype{#1}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \ifx\caption@lfmt\caption@lfmt@default\else
+ \@namedef{fnum@#1}{%
+ \caption@lfmt{\caption@floatname{#1}}{\@nameuse{the#1}}}%
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@fixposition
+ \global\let\caption@fixedposition\caption@position}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@beginex}
+% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
+% \changes{v3.0h}{2005/09/16}{Bugfix: Made this macro and \cs{addcontentsline} \cs{long}}
+% \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
+% |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\\
+% performs the same tasks as |\caption@begin| and additionally:
+% Redefine |\addcontentsline| if no list-of entry is requested, that
+% means either the argument \meta{list entry} is empty or |listof=| was
+% set to |false|.
+% \begin{macrocode}
+\newcommand\caption@beginex[3]{%
+ \caption@begin{#1}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@iflof%
+ {\def\caption@tempa{#2}}%
+ {\let\caption@tempa\@empty}%
+ \ifx\caption@tempa\@empty
+ \long\def\addcontentsline##1##2##3{}% There is no \@gobblethree...
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@ifempty{#3}{\let\caption@ifempty\@secondoftwo}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@end}
+% |\caption@end| closes the group.
+% \begin{macrocode}
+\newcommand*\caption@end{%
+ \endgroup
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\caption@position\caption@fixedposition}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setfloattype}
+% \changes{v3.0a}{2004/01/23}{This macro added}
+% |\caption@setfloattype|\marg{type}\\
+% sets up the right float type within |\@caption|, |\LT@makecaption| etc.
+% Usually this is equivalent to |\caption@settype| but I made it an own macro so
+% I can extend it later on, for example if the \package{float} or
+% \package{sidecap} package is loaded.
+% \begin{macrocode}
+\let\caption@setfloattype\caption@settype
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@letfloattype}
+% \changes{v3.0b}{2004/05/16}{This macro added}
+% \changes{v3.0e}{2005/05/05}{Argument \meta{extra code} added}
+% |\caption@letfloattype|\marg{type}\marg{extra code}\\
+% redefines |\caption@setfloattype| so it does not only
+% |\caption@settype|\marg{type} but two additional tasks:
+% Executing extra code given as second argument and
+% execute options with |\caption@settype{#1}| afterwards.\par
+% You can find an example of its usage in the \package{longtable}
+% support, where this macro is called so
+% |\captionsetup[longtable]{|\ldots|}| can be used to setup options
+% for longtables which have a higher priority than the options which
+% have been setup with |\captionsetup[table]{|\ldots|}| or
+% |\setlength\LTcapwidth{|\ldots|}|.
+% \begin{macrocode}
+\newcommand*\caption@letfloattype[2]{%
+ \def\caption@setfloattype##1{%
+ \caption@settype{##1}#2\caption@settype{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0a}{2004/01/23}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
+% \changes{v3.0h}{2005/10/06}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
+% \changes{v3.0d}{2004/08/03}{\cs{caption@setfloatname} added}
+%
+% \begin{macro}{\caption@floatname}
+% |\caption@floatname|\marg{type}\par
+% Usually all float names (which partly build the caption label)
+% follow the same naming convention. But some packages (for example
+% the \package{float} package) do not, so we use this wrapper macro which
+% can be changed later on.
+% \begin{macrocode}
+\newcommand*\caption@floatname[1]{\@nameuse{#1name}}
+\newcommand*\caption@setfloatname[1]{\@namedef{#1name}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{Caption support}
+%
+% \iffalse\begin{quote}
+% \small\emph{Note:}
+% Our aim is patching the existing |\caption| code so changes done by other
+% packages will not get lost. We do similar in our \package{float},
+% \package{hyperref}, and \package{hypcap} support so get the disadvantage
+% of having ugly code with some negative side-effects, like the non-working
+% |\caption{}| feature when the \package{french(le)} or \package{hyperref}
+% package is loaded.
+% \end{quote}\fi
+%
+% Some packages (like the \package{hyperref} package for example) redefines
+% |\caption| and |\@caption|, too, but without chaining to their previous
+% definitions. So we have to use |\AtBeginDocument| here, so we can make sure
+% our definition don't get lost.
+%
+% \begin{macrocode}
+\AtBeginDocument{%
+% \end{macrocode}
+%
+% We only patch |\caption| and |\@caption| if the \package{captcont} package
+% (which brings it's own definition of |\caption*|) is not used.
+% It does not make much sense using the actual version of the \package{caption}
+% package with the \package{captcont} package, but this was different in the
+% old (\version{1.x}) days so we take care to be backward compatible.
+%
+% \begin{macrocode}
+ \@ifundefined{cc@caption}{%
+ \@ifundefined{caption@old}{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption}
+% \iffalse\changes{v3.0}{2003/07/18}{Bugfix: \cs{global} added, so this works with sidecap}\fi
+% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
+% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
+% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
+% Here comes our definition of |\caption| and |\caption*|.
+% (We set |\caption@startrue| globally so it works with the \package{sidecap} package, too.)
+% \begin{macrocode}
+ \let\caption@old\caption
+ \def\caption{\caption@caption\caption@old}%
+ \def\caption@caption#1{%
+ \@ifstar{\ContinuedFloat\global\caption@startrue#1[]}{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@caption}
+% Our definition of |\@caption| simply calls the old definition,
+% nested by |\caption@beginex| and |\caption@end|.
+% \begin{macrocode}
+ \let\caption@@old\@caption
+ \long\def\@caption#1[#2]#3{%
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@@old{#1}[{#2}]{#3}%
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}}{%
+% \end{macrocode}
+%
+% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: \package{captcont} support fixed}
+% Minimum \package{captcont} package support:\\
+% We define |\caption@caption| here so it's there but does not make any harm.
+%
+% \begin{macrocode}
+ \caption@Info{captcont package v2.0 detected}%
+ \def\caption@caption#1{#1}%
+ }%
+}
+% \end{macrocode}
+%
+% \begin{macro}{\@makecaption}
+% |\@makecaption|\marg{label}\marg{text}\par
+% The original code (from |latex/base/classes.dtx|):
+% \begin{verbatim}
+% \long\def\@makecaption#1#2{%
+% \vskip\abovecaptionskip
+% \sbox\@tempboxa{#1: #2}%
+% \ifdim \wd\@tempboxa >\hsize
+% #1: #2\par
+% \else
+% \global \@minipagefalse
+% \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+% \fi
+% \vskip\belowcaptionskip}
+% \end{verbatim}
+% We do basically the same, but take care of the |position=| setting
+% and use |\caption@@make| from the \package{caption} kernel to actually
+% typeset the caption.
+% \begin{macrocode}
+\renewcommand\@makecaption[2]{%
+ \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
+ \caption@@make{#1}{#2}%
+ \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{\package{\KOMAScript} classes support}
+% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added}
+% \changes{v3.0h}{2005/08/22}{\cs{PackageInfo} added to \KOMAScript\ support}
+% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added}
+% \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised}
+% \changes{v3.0q}{2007/04/16}{\KOMAScript\ compatibility revised}
+%
+% \begin{macrocode}
+\@ifundefined{scr@caption}{}{%
+ \caption@Info{KOMA-Script class detected}
+ \AtBeginDocument{\let\scr@caption\caption}
+% \end{macrocode}
+%
+% \begin{macro}{\onelinecaptionsfalse}
+% \begin{macro}{\onelinecaptionstrue}
+% \begin{macrocode}
+ \def\onelinecaptionstrue{\caption@setbool{slc}{1}}
+ \def\onelinecaptionsfalse{\caption@setbool{slc}{0}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\captionabove}
+% \begin{macro}{\captionbelow}
+% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21: \cs{let}\cs{caption@setposition}\cs{@gobble} added}
+% \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\captionabove}{\@captionabovetrue\scr@caption}
+% \newcommand{\captionbelow}{\@captionabovefalse\scr@caption}
+% \end{verbatim}
+% \begin{macrocode}
+ \def\captionabove{%
+ \caption@setposition{t}\let\caption@setposition\@gobble
+ \scr@caption}
+ \def\captionbelow{%
+ \caption@setposition{b}\let\caption@setposition\@gobble
+ \scr@caption}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{\package{french(le)} package support}
+% \changes{v3.0h}{2005/10/03}{Minimum adaptation to \package{french(le)} added}
+%
+% \begin{macrocode}
+\AtBeginDocument{\@ifundefined{f@ffrench}{}{%
+ \caption@Info{french(le) package detected}%
+% \end{macrocode}
+%
+% If |\GOfrench| is defined as |\relax| all the re-definitions regarding
+% captions have already been done, so we can do our patches immediately.
+% Otherwise we must add our stuff to |\GOfrench|.
+%
+% \begin{macrocode}
+ \@ifundefined{GOfrench}%
+ {\let\caption@tempa\@firstofone}%
+ {\def\caption@tempa{\g@addto@macro\GOfrench}}%
+ \caption@tempa{%
+% \end{macrocode}
+%
+% \begin{macro}{\@cnORI}
+% We update the definition of |\@cnORI| so it actually reflects
+% our definition of |\caption|.
+% \begin{macrocode}
+ \let\@cnORI\caption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@tablescaption}
+% The \package{french(le)} package sets |\caption| to |\@tablescaption| at
+% |\begin{table}| for special treatment of footnotes.
+% Therefore we have to patch |\@tablescaption| so |\caption*| will work
+% inside the |table| environment.
+% \begin{macrocode}
+ \let\caption@tablescaption\@tablescaption
+ \def\@tablescaption{\caption@caption\caption@tablescaption}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f@ffrench}
+% \begin{macro}{\f@tfrench}
+% |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
+% when used in french mode. These contain additional code which typesets
+% the caption separator |\captionseparator| instead of the usual colon.
+% Because this breaks with our |\@makecaption| code we have to remove
+% this additional code here.
+% \begin{macrocode}
+ \let\@eatDP\@undefined
+ \let\caption@tempa\@empty
+ \ifx\f@ffrench\fnum@figure
+ \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
+ \fi
+ \ifx\f@tfrench\fnum@table
+ \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
+ \fi
+ \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
+ \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
+ \caption@tempa
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+}}}
+% \end{macrocode}
+%
+% \subsubsection*{\package{float} package support}
+% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
+% \iffalse
+% (This is a more straight-ahead implementation, but it only works with v1.3
+% now, so v1.2 is no longer supported. The old code including documentation
+% can be found in caption-30f-050530.zip)
+% \fi
+%
+% The \package{float} package usually do not use the \LaTeX\ kernel command
+% |\@caption| to typeset the caption but |\float@caption| instead.
+% (|\@caption| will only be used if the float is re-styled with
+% |\restylefloat*|.)
+%
+% The main two things |\float@caption| is doing different are:
+% \begin{itemize}
+% \item The caption will be typeset inside a savebox called |\@floatcapt| so
+% it can be placed above or below the float contents afterwards.
+% \item |\@makecaption| will not be used to finally typeset the caption.
+% Instead |\@fs@capt| will be used which definition is part of the float
+% style.
+% (Note that |\@fs@capt| will not typeset any vertical space above or below
+% the caption; instead this space will be typeset by the float style code
+% itself.)
+% \end{itemize}
+%
+% So our main goal is to re-define |\float@caption| so our macro
+% |\caption@@make| will be used instead of |\@fs@capt|.
+%
+% To allow different caption styles for different float styles we will also
+% determine the current float style (e.g. `ruled') at run time and select
+% a caption style (and additional settings) with the same name, if defined.
+%
+% \begin{macro}{\caption@setfloatposition}
+% First of all we provide a macro which converts |\@fs@iftopcapt| (which
+% is part of a float style and controls where the caption will be typeset,
+% above or below the float contents) to our |position=| setting. Since the
+% spacing above and below the caption will be done by the float style and
+% \emph{not} by us this sounds quite useless. But in fact it isn't, since some
+% packages based on the \package{caption} package (like the \package{subfig}
+% package) could have an interest for this information and therefore use the
+% |\caption@iftop| macro we provide in our kernel. Furthermore we need this
+% information for ourself in |\captionof| which uses |\@makecaption| to
+% finally typeset the caption with skips.
+% \begin{macrocode}
+\def\caption@setfloatposition{%
+ \caption@setposition{\@fs@iftopcapt t\else b\fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifpackage{float}{@float@setevery}{%
+ \caption@Info{float package v1.3 (or newer) detected}%
+% \end{macrocode}
+%
+% Since |\float@caption| puts the float contents into a savebox we need
+% a special version of |\captionof| which `unfolds' this box afterwards,
+% so the caption actually gets typeset. Furthermore we have to typeset
+% the spacing above and below the caption for ourself, since this space is
+% not part of the box.
+%
+% Please note that this version of |\captionof| only works \emph{outside}
+% floating environments defined with the float package, so for example
+% a |\captionof{Program}| used within a `standard' |figure| or a
+% |minipage| will work fine, but not within a re-styled |figure| or
+% an |Example| environment defined with |\newfloat|.
+% (We don't check for this so you'll get wired errors if you try to do so!)
+%
+% \begin{macro}{\caption@of@float}
+% Usually no special action is necessary, so we define |\caption@of@float|
+% to |\@gobble|. We will redefine it later on to |\@firstofone| to activate
+% the code which `unfolds' the savebox.
+% \begin{macrocode}
+ \let\caption@of@float\@gobble
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@of}
+% If the float is defined by the float package (which means |\fst@|\meta{type}
+% is defined) we activate the special treatment for such captions typeset
+% with |\captionof|. Furthermore we `execute' this float style, so
+% |\@fs@iftopcapt| is set to its proper value.
+% \begin{macrocode}
+ \renewcommand*\caption@of[2]{%
+ \@ifundefined{fst@#2}{}{%
+ \let\caption@of@float\@firstofone
+ \@nameuse{fst@#2}\@float@setevery{#2}}%
+ \def\@captype{#2}#1}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@caption}
+% \changes{v3.0h}{2005/08/23}{Bugfix 05-08-12: \cs{captionof} sets hyperref anchor now}
+% Our version of |\float@caption| nearly looks like our version of |\@caption|.
+% The main differences are that |\@fs@capt| will be replaced by our |\caption@@make|
+% and that the savebox called |\@floatcapt| will be unfolded if requested by
+% |\captionof|. (see above)
+% \begin{macrocode}
+ \let\caption@@float\float@caption
+ \long\def\float@caption#1[#2]#3{%
+ \caption@beginex{#1}{#2}{#3}%
+ \let\@fs@capt\caption@@make
+ \caption@@float{#1}[{#2}]{#3}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@of@float{%
+% \end{macrocode}
+% If the \package{hyperref} package is loaded, we need to set the appropriate
+% anchor for ourself. To do so without adding extra vertical space we need
+% to save (and restore) |\prevdepth| and switch off the interline skip.
+% \begin{macrocode}
+ \@ifundefined{hyper@@anchor}{}{%
+ \begingroup
+ \@tempdima\prevdepth
+ \nointerlineskip
+ \let\leavevmode\relax
+ \hyper@@anchor\@currentHref\relax
+ \prevdepth\@tempdima
+ \endgroup}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \def\caption@@make##1##2{\unvbox\@floatcapt}%
+ \@makecaption{}{}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@float@setevery}
+% |\@float@setevery|\marg{float type} is provided by the \package{float} package;
+% it's called every time a floating environment defined with |\newfloat| or
+% |\restylefloat| begins.
+% We use this hook to do some adaptations and to setup the proper caption style
+% (if defined) and additional settings declared with
+% |\captionsetup|\oarg{float style}.
+% \begin{macrocode}
+ \let\caption@float@setevery\@float@setevery
+ \def\@float@setevery#1{%
+% \end{macrocode}
+%
+% \LaTeX{} and most packages use |\|\meta{type}|name|
+% to provide a macro for the float name -- for example the command
+% |\figurename| will usually contain the name of the floating environment
+% |figure|:
+% \begin{quote}
+% |\newcommand\figurename{Figure}|
+% \end{quote}
+%
+% But the \package{float} package don't follow this naming convention,
+% it uses |\fname@|\meta{type} instead. So we have to adapt
+% |\caption@floatname| here, so our captions will be still ok.
+%
+% \begin{macrocode}
+ \def\caption@floatname##1{\@nameuse{fname@#1}}%
+ \def\caption@setfloatname##1{\@namedef{fname@#1}}%
+% \end{macrocode}
+%
+% Both |\newfloat| and |\restylefloat| save the \emph{actual} definition of
+% |\@caption| or |\float@caption| in |\@float@c@|\meta{captype} with |\let|
+% (instead of using |\def|), so redefinitions of |\@caption| (and of course
+% our redefinition of |\float@caption|) will never been used if the
+% |\newfloat| or |\restylefloat| command takes place in front of the
+% redefinitions provided by the \package{caption} or other packages like the
+% \package{hyperref} package.
+%
+% So here we determine if the user has used |\restylefloat| or
+% |\restylefloat*| and bring |\@float@c@|\meta{captype} up-to-date.
+% This is quite easy: If |\@float@c@|\meta{captype} is the same as the
+% original or our own definition of |\float@caption|, the user has used
+% |\restylefloat| (and |\float@caption| should be used), otherwise
+% we assume he has used |\restylefloat*| (and |\@caption| should be used).
+% (This test will fail if some other package re-defines |\float@caption|,
+% too, so we have to assume that we are the only one.)
+%
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@tempa\csname @float@c@#1\endcsname
+ \ifx\caption@tempa\float@caption
+ \else\ifx\caption@tempa\@caption
+ \else\ifx\caption@tempa\caption@@float
+ \caption@Info{\protect\@float@c@#1\space := \protect\float@caption}%
+ \expandafter\let\csname @float@c@#1\endcsname\float@caption
+ \else
+ \caption@Info{\protect\@float@c@#1\space := \protect\@caption}%
+ \expandafter\let\csname @float@c@#1\endcsname\@caption
+ \fi\fi\fi
+% \end{macrocode}
+%
+% If the floating environment is defined with |\newfloat| or |\restylefloat|
+% (and \emph{not} with |\restylefloat*|), |\@float@c@|\meta{type}
+% will now be identical to |\float@caption|.
+%
+% \begin{macrocode}
+ \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
+% \end{macrocode}
+%
+% First of all we set the caption position to it's proper value.
+% (See above definition of |\caption@setfloatposition|)
+%
+% \begin{macrocode}
+ \caption@setfloatposition
+% \end{macrocode}
+%
+% Now we'll have to determine the current float style.
+% This is not so easy because the only hint provided by the \package{float}
+% package is the macro |\fst@|\meta{float type} which points to the macro
+% which represents the float style.
+% So for example after
+% \begin{quote}
+% |\floatstyle{ruled}|\\
+% |\newfloat{Program}{tbp}{lop}|
+% \end{quote}
+% |\fst@Program| will be defined as
+% \begin{quote}
+% |\def\fst@Program{\fs@ruled}|\quad.
+% \end{quote}
+%
+% So here is what we do: We copy |\fst@|\meta{float type} to |\caption@fst| and
+% make it a string so we can gobble the first four tokens (= |\fs@|), so only the
+% the name of the float style is left.
+%
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@fst\csname fst@#1\endcsname
+ \edef\caption@fst{\noexpand\string\expandafter\noexpand\caption@fst}%
+ \edef\caption@fst{\noexpand\@gobblefour\caption@fst}%
+% \edef\caption@fst{\caption@fst}%
+% \end{macrocode}
+%
+% |\caption@fst| now contains the float style (e.g. `ruled')
+% so we can use it to set the corresponding style (if defined) and additional options.
+%
+% \begin{macrocode}
+ \caption@setstyle*\caption@fst
+ \caption@settype\caption@fst
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@float@setevery{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
+%
+% \begin{macro}{\fs@plaintop}
+% \begin{macro}{\fs@boxed}
+% The float styles |plaintop| and |boxed| don't use our skip which can be set
+% with |skip=| : |plaintop| uses |\belowcaptionskip| instead of
+% |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|.
+% So we patch the according float style macros here to change this.
+% \begin{macrocode}
+ \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
+ \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% The skip between `boxed' floats and their caption defaults to |2pt|.
+%
+% \begin{macrocode}
+\captionsetup[boxed]{skip=2pt}
+% \end{macrocode}
+%
+% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
+% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
+% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
+% `ruled' with appropriate options. But if the package option |ruled| was
+% specified, we setup some caption parameters to emulate the behaviour
+% of the \package{caption} package \version{1.x} option |ruled| instead:
+% The current caption settings will be used, but without margin and without
+% `single-line-check'.
+% \begin{macrocode}
+\caption@ifbool{ruled}{%
+ \captionsetup[ruled]{margin=0pt,singlelinecheck=0}%
+}{%
+ \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
+}
+\caption@undefbool{ruled}
+% \end{macrocode}
+%
+% \subsubsection*{\package{floatrow} package support}
+% \changes{v3.0f}{2005/06/01}{Support of the \package{floatrow} package added}
+%
+% The \package{floatrow} package is already adapted for usage with the
+% \package{caption} package. So the main work has already been done by
+% Mrs.Lapko, there are only two little things we have to take care about:
+%
+% \begin{macrocode}
+\caption@ifpackage{floatrow}{flrow@setlist}{%
+ \caption@Info{floatrow package v0.1f (or newer) detected}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@of}
+% Captions typeset with |\captionof| should have the correct layout,
+% so we have to `activate' this layout here with |\flrow@setlist|.
+% \par{\small (Please note that this version of |\captionof| has the same
+% restrictions than the |\captionof| offered for floating environments
+% defined with the \package{float} package, see above.)}
+% \begin{macrocode}
+ \renewcommand*\caption@of[2]{%
+ \def\@captype{#2}\flrow@setlist{{#2}}#1}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@floatname}
+% The \package{floatrow} package follows the same naming convention
+% as the \package{float} package; so we have to adapt |\caption@floatname|
+% here, too.
+% \begin{macrocode}
+ \renewcommand*\caption@floatname[1]{%
+ \@nameuse{\@ifundefined{fname@#1}{#1name}{fname@#1}}}%
+ \renewcommand*\caption@setfloatname[1]{%
+ \@namedef{\@ifundefined{fname@#1}{#1name}{fname@#1}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{\package{hyperref} package support}
+% \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
+%
+% When the \package{hyperref} package is used we have the problem
+% that the usage of |\ContinuedFloat| will create duplicate
+% hyperlinks -- both |\@currentHlabel| and |\@currentHref| will be the same
+% for the main float and the continued ones. So we have to make sure
+% unique labels and references will be created each time. We do this
+% by extending |\theHfigure| and |\theHtable|, so for continued floats
+% the scheme
+% \begin{quote}\meta{type}|.|\meta{type \#}|.|\meta{continue \#}\end{quote}
+% will be used instead of
+% \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
+% \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
+% \par{\small Note: This does not help if |\Hy@naturalnamestrue| is set.}
+%
+% \begin{macrocode}
+\caption@ifpackage{hyperref}{theHfigure}{%
+ \caption@Info{hyperref package v6.74m (or newer) detected}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@ContinuedFloat}
+% \changes{v3.0g}{2005/06/28}{Bugfix: \cs{newcounter} replaced by \cs{newcount}}
+% \changes{v3.0p}{2007/04/08}{\cs{newcount} replaced by \cs{caption@newcounter}}
+% If |\theH|\meta{type} is defined, we extend it with |.|\meta{continue \#}.
+% Furthermore we set |\caption@resetContinuedFloat| to |\@gobble| so the
+% continuation counter will not be reset to zero inside |\caption|.
+% \begin{macrocode}
+ \def\caption@ContinuedFloat#1{%
+ \@ifundefined{theH#1}{}{%
+ \@ifundefined{CF@#1}{%
+ \expandafter\caption@newcounter\csname CF@#1\endcsname
+ \caption@resetContinuedFloat{#1}}{}%
+ \expandafter\caption@stepcounter\csname CF@#1\endcsname
+ \expandafter\l@addto@macro\csname theH#1\endcsname{%
+ .\csname CF@#1\endcsname}%
+ \let\caption@resetContinuedFloat\@gobble
+ }}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetContinuedFloat}
+% If a continuation counter is defined, we reset it.
+% \begin{macrocode}
+ \def\caption@resetContinuedFloat#1{%
+ \@ifundefined{CF@#1}{}{%
+ \expandafter\caption@setcounter\csname CF@#1\endcsname0}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{\package{hypcap} package support}
+% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
+% \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} v1.6}
+% \changes{v3.0p}{2007/04/09}{Adapted to \package{hypcap} v1.7}
+%
+% When the \package{hypcap} package is used the following problems occur:
+% \begin{enumerate}
+% \item The \package{hypcap} package uses |\capstart|, |\hc@caption|, and
+% |\hc@@caption| instead of |\caption| and |\@caption|.\footnote{This issue
+% was fixed in \package{hypcap} \version{1.7}}
+% So we have to patch these macros, too.
+% \item |\caption| will be saved to |\hc@org@caption| when the
+% \package{hypcap} package is loaded.
+% We have to change this so our definition of |\caption| will always be
+% used.
+% \item Both, |\capstart| and |\hc@@caption|, call |\hyper@makecurrent|.
+% But since we offer |\ContinuedFloat| the float counters could have changed
+% between these both calls! So we fix this by saving the \package{hyperref}
+% reference (= |\@currentHref|) in |\capstart| and restoring it later on in
+% |\hc@@caption|.
+% \par{\small (This also fixes the problem that \package{hypcap} does not
+% work if |\Hy@hypertexnamesfalse| is set.\footnote{This issue was fixed
+% in \package{hypcap} \version{1.6}} This come in handy; we set
+% it locally to avoid duplicated \package{hyperref} labels which could
+% occur if |\ContinuedFloat| will be used.)}
+% \item |\capstart| will call |\H@refstepcounter| to increase the float
+% number. This collides with a following |\ContinuedFloat|, too, so we have
+% to move this call from here to |\caption|. (Since we set
+% |\Hy@hypertexnamesfalse| we can do this without problems.)
+% \end{enumerate}
+%
+% \begin{macrocode}
+\caption@ifpackage{hypcap}{hc@caption}{%
+ \caption@Info{hypcap package v1.0 (or newer) detected}%
+% \end{macrocode}
+%
+% \begin{macro}{\capstart}
+% \changes{v3.0l}{2007/02/20}{\cs{caption@currentHref} renamed to \cs{hc@currentHref}}
+% Here comes our version of |\capstart|:
+% \begin{macrocode}
+ \let\caption@capstart\capstart
+ \def\capstart{%
+% \end{macrocode}
+% First of all we update |\hc@org@caption| to correct the problem that the
+% \package{hypcap} package has saved an older definition of |\caption|.
+% \begin{macrocode}
+ \let\hc@org@caption\caption
+% \end{macrocode}
+% Since we don't know the float counter yet (it could be changed with
+% |\ContinuedFloat| afterwards!) we make sure |\H@refstepcounter| will
+% not be used and |\Hy@hypertexnamesfalse| is set, so unique
+% \package{hyperref} labels will be generated by the original
+% definition of |\capstart|.
+% Afterwards we save the reference which was generated by
+% |\hyper@makecurrent|.
+% \begin{macrocode}
+ \begingroup
+ \let\H@refstepcounter\@gobble
+ \Hy@hypertexnamesfalse
+ \caption@capstart
+ \@ifundefined{hc@hyperref}{}{% hypcap v1.7
+ \global\advance\csname c@\@captype\endcsname\@ne}%
+ \global\let\hc@currentHref\@currentHref
+ \endgroup
+% \end{macrocode}
+%
+% The \package{hypcap} package restores the previous definition of |\caption|
+% inside |\hc@@caption|. But since we will call this inside a group later on
+% (making this restauration non-working), we have to make this for ourself
+% inside |\caption|.
+% (This would not be necessary if \package{hypcap} would do this inside
+% |\hc@caption| instead of |\hc@@caption|.)\par
+% Additionally we increase the float counter here (since we have suppressed this
+% in |\capstart|) and use |\caption@caption| here, so |\caption*| will work as
+% expected.
+% (This is surrounded by |\hc@hyperref| so it does not make any harm when used
+% with \package{hypcap} \version{1.7}.)
+% \begin{macrocode}
+ \@ifundefined{hc@hyperref}%
+ {\let\next\@firstofone}{\let\next\hc@hyperref}% hypcap v1.7
+ \next{\def\caption{%
+ \let\caption\hc@org@caption
+ \H@refstepcounter\@captype
+ \@ifundefined{hc@hyperref}{}{% hypcap v1.7
+ \global\advance\csname c@\@captype\endcsname\m@ne}%
+ \caption@caption\hc@caption}}%
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hc@@caption}
+% Here comes our version of |\hc@@caption|:
+% \begin{macrocode}
+ \let\caption@hc@@caption\hc@@caption
+ \long\def\hc@@caption#1[#2]#3{%
+ \caption@beginex{#1}{#2}{#3}%
+% \end{macrocode}
+%
+% Beside the usual |\caption@begin| and |\caption@end| stuff (to support local
+% options etc.) we make sure our saved \package{hyperref} reference will be
+% used.
+% \begin{macrocode}
+ \let\caption@hyper@makecurrent\hyper@makecurrent
+ \def\hyper@makecurrent\@captype{%
+ \let\hyper@makecurrent\caption@hyper@makecurrent
+ \global\let\@currentHref\hc@currentHref}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@hc@@caption{#1}[{#2}]{#3}%
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{\package{listings} package support}
+% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
+%
+% \begin{macrocode}
+\caption@ifpackage{listings}{lst@MakeCaption}{%
+ \caption@Info{listings package v1.2 (or newer) detected}%
+% \end{macrocode}
+%
+% \begin{macro}{\lst@MakeCaption}
+% To support the \package{listings} package we need to redefine
+% |\lst@MakeCaption| so the original stuff is nested with
+% |\caption@begin| and |\caption@end|.
+% \begin{macrocode}
+ \let\caption@lst@MakeCaption\lst@MakeCaption
+ \def\lst@MakeCaption#1{%
+% \end{macrocode}
+%
+% If the |position=| is set to |auto|, we take over the |captionpos=| setting
+% from the \package{listings} package.
+% Note that we won't do this otherwise, so \package{listings} settings like
+% |abovecaptionskip=0pt,belowcaptionskip=10pt,captionpos=t| will \emph{not}
+% cause different outputs with or without the \package{caption} package loaded.
+% \begin{macrocode}
+ \def\caption@autoposition{\caption@setposition{#1}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@begin{lstlisting}%
+ \caption@lst@MakeCaption{#1}%
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{\package{longtable} package support}
+%
+% \begin{macrocode}
+\caption@ifpackage{longtable}{LT@makecaption}{%
+ \caption@Info{longtable package v3.15 (or newer) detected}%
+% \end{macrocode}
+%
+% \begin{macro}{\LT@makecaption}
+% \changes{v3.0d}{2004/08/10}{Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
+% \changes{v3.0e}{2005/05/05}{Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
+% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
+% |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
+% Original code:
+% \begin{verbatim}
+% \def\LT@makecaption#1#2#3{%
+% \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
+% % Based on article class "\@makecaption", "#1" is "\@gobble" in star
+% % form, and "\@firstofone" otherwise.
+% \sbox\@tempboxa{#1{#2: }#3}%
+% \ifdim\wd\@tempboxa>\hsize
+% #1{#2: }#3%
+% \else
+% \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+% \fi
+% \endgraf\vskip\baselineskip}%
+% \hss}}}
+% \end{verbatim}
+% \begin{macrocode}
+ \def\LT@makecaption#1#2#3{%
+ \caption@LT@make{%
+% \end{macrocode}
+%
+% We set |\ifcaption@star| according the 1st argument.
+% \begin{macrocode}
+ \caption@startrue#1\caption@starfalse
+% \end{macrocode}
+%
+% If |\LTcapwidth| is not set to its default value |4in| we assume
+% that it shall overwrite our own setting.
+% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
+% \begin{macrocode}
+ \caption@letfloattype{longtable}{%
+ \ifdim\LTcapwidth=4in \else
+ \setcaptionwidth\LTcapwidth
+ \fi}%
+% \end{macrocode}
+%
+% The default |position=| setting for longtables is |top|.
+% (This emulates the standard behaviour of the \package{longtable} package
+% which has no skip above the caption but a skip below it.)
+% \begin{macrocode}
+% \caption@setdefaultpos{t}%
+ \let\caption@defaultpos\@firstoftwo
+% \end{macrocode}
+%
+% |position=auto| is a bad idea for longtables, but we do our very best.
+% This works quite well for captions inside the longtable contents, but
+% not for captions inside the longtable (end)foot.
+% \begin{macrocode}
+ \def\caption@autoposition{%
+ \caption@setposition{\ifcase\LT@rows t\else b\fi}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@begin{table}%
+% \end{macrocode}
+%
+% The following skip has the purpose to correct the height of the
+% |\parbox[t]|. Usually it's the height of the very first line, but
+% because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
+% it's always |0pt|.
+% (A different idea would be typesetting the first skip outside the longtable
+% column with |\noalign{\vskip|\ldots|}|, but this means we have to move
+% |\caption@begin| to some other place because it does not work in tabular
+% mode\ldots)
+% \begin{macrocode}
+ \vskip-\ht\strutbox
+% \end{macrocode}
+%
+% This should look familiar. We do our skips and use |\caption@@make| to
+% typeset the caption itself.
+% \begin{macrocode}
+ \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
+ \caption@@make{#2}{#3}\endgraf
+ \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}%
+ \caption@end}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@LT@make}
+% Typesets the caption as centered |\multicolumn|\ldots
+% \begin{macrocode}
+ \newcommand\caption@LT@make[1]{%
+ \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{#1}\hss}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{\package{picins} package support}
+% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
+%
+% \begin{macrocode}
+\caption@ifpackage{picins}{piccaption}{%
+ \caption@Info{picins package v3.0 (or newer) detected}%
+% \end{macrocode}
+%
+% \begin{macro}{\piccaption}
+% Original code:
+% \begin{verbatim}
+% \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
+% \end{verbatim}
+% \begin{macrocode}
+ \def\piccaption{\@dblarg\@piccaption}
+% \def\piccaption{\caption@caption{\@dblarg\@piccaption}}
+% \end{macrocode}
+% \end{macro}
+%
+% {\itshape TODO: Make |\piccaption[]{|\ldots|}| and |\piccaption{}| work}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{\package{rotating} package support}
+%
+% \begin{macrocode}
+\caption@ifpackage{rotating}{@rotcaption}{%
+ \caption@Info{rotating package v2.0 (or newer) detected}%
+% \end{macrocode}
+%
+% \begin{macro}{\rotcaption}
+% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@caption} removed}
+% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
+% Make |\rotcaption*| work.
+% \begin{macrocode}
+ \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
+% \let\@rotcaption\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\rotcaptionof}
+% \changes{v3.0i}{2005/12/07}{New}
+% Make |\rotcaptionof(*)| work.
+% \begin{macrocode}
+ \def\rotcaptionof{%
+ \@ifstar{\caption@of{\rotcaption*}}{\caption@of\rotcaption}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makerotcaption}
+% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
+% \changes{v3.0m}{2007/03/04}{Uses \cs{captionbox} instead of \cs{caption@start/endbox} now}
+% Original (bugfixed) code:
+% \begin{verbatim}
+% \long\def\@makerotcaption#1#2{%
+% \setbox\@tempboxa\hbox{#1: #2}%
+% \ifdim \wd\@tempboxa > .8\vsize
+% \rotatebox{90}{%
+% \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
+% }%\par % <== \par removed (AR)
+% \else%
+% \rotatebox{90}{\box\@tempboxa}%
+% \fi
+% \nobreak\hspace{12pt}% <== \nobreak added (AR)
+% }
+% \end{verbatim}
+% Our version emulates this behaviour, but if |width=| is set,
+% the rotated caption is always typeset as |minipage|.
+% (Note that |margin=| is not supported here.)
+% \begin{macrocode}
+ \long\def\@makerotcaption#1#2{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \ifdim\captionwidth=\z@
+ \setcaptionwidth{.8\textheight}%
+ \caption@slc{#1}{#2}{.8\vsize}{%
+ \let\caption@makerot\caption@@make
+ \setcaptionmargin\z@
+% \setlength\captionindent\z@
+% \long\def\captionbox##1##2{\hbox{\hsize=.8\textheight\relax##2}}%
+% (not needed because \rotatebox uses an \hbox anyway)
+ \let\captionbox\@secondoftwo}%
+ \caption@setbool{slc}{0}% been there, done that
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \rotatebox{90}{\caption@makerot{#1}{#2}}%
+ \nobreak\hspace{12pt}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \newcommand\caption@makerot[2]{%
+ \begin{minipage}\captionwidth\caption@@make{#1}{#2}\end{minipage}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{\package{sidecap} package support}
+%
+% \begin{macrocode}
+\caption@ifpackage{sidecap}{endSC@FLOAT}{%
+ \caption@Info{sidecap package v1.4d (or newer) detected}%
+% \end{macrocode}
+%
+% \begin{macro}{\SC@caption}
+% \changes{v3.0d}{2004/11/28}{Bugfix: Definition of \cs{@captype} added}
+% \changes{v3.0e}{2005/05/05}{Bugfix: Empty captions are handled correctly now}
+% \changes{v3.0e}{2005/05/05}{Priority of options fixed}
+% \changes{v3.0h}{2005/10/03}{Bugfix: Always use \cs{AtBeginDocument} to set \cs{SC@caption}}
+% First of all, we let sidecap use an actual definition of |\caption|.\\
+% (This is only required for version 1.5d of the sidecap package.)
+% \begin{macrocode}
+ \@ifundefined{caption@caption}%
+ {\let\caption@tempa\AtBeginDocument}%
+ {\let\caption@tempa\@firstofone}%
+ \caption@tempa{\let\SC@caption=\caption}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SC@zfloat}
+% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
+% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@caption} removed}
+% This macro will be called at the start of the environment, here is a good
+% opportunity to do some adaptations to |\caption| and |\captionsetup|.
+% \begin{macrocode}
+ \let\caption@SC@zfloat\SC@zfloat
+ \def\SC@zfloat#1#2#3[#4]{%
+% \end{macrocode}
+%
+% Note: |#2| is either |figure| or |table| and will be stored to |\SC@captype|
+% by the original version of |\SC@zfloat|.
+% \begin{macrocode}
+ \caption@SC@zfloat{#1}{#2}{#3}[#4]%
+% \end{macrocode}
+%
+% Since the sidecap package uses our |\caption| code outside the
+% floating environment the regular |\captionsetup| will not work.
+% So we need a special version here which saves the given argument list
+% which will be executed later on.
+% \begin{macrocode}
+ \global\let\SC@CAPsetup\@empty
+ \def\captionsetup##1{\g@addto@macro\SC@CAPsetup{,##1}}%
+% \end{macrocode}
+%
+% Make |\caption*| work.
+% \begin{macrocode}
+ \let\caption@SC\caption
+% \def\caption{\renewcommand\captionsetup[1]{}\caption@caption\caption@SC}%
+ \def\caption{\caption@caption\caption@SC}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\endSC@FLOAT}
+% \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
+% This macro will be called at the end of the environment, here we need to
+% setup our stuff before the \package{sidecap} package actually typesets
+% its caption.
+% \begin{macrocode}
+ \let\caption@endSC@FLOAT\endSC@FLOAT
+ \def\endSC@FLOAT{%
+% \end{macrocode}
+%
+% Note that |\@captype| isn't defined so far, this will be done inside
+% the original definition of |\endSC@FLOAT|.
+% But we define |\@captype| already here to make |\captionsetup| work
+% with |\@captype|-based options (like |type=|).
+% \begin{macrocode}
+ \let\@captype\SC@captype
+% \end{macrocode}
+%
+% Here we execute the options set with |\captionsetup| inside this environment.
+% \begin{macrocode}
+ \caption@esetup\SC@CAPsetup
+% \end{macrocode}
+%
+% Before we can typeset the caption we need to set the margin to zero
+% because any extra margin would only be disturbing here.\par
+% (We don't need to take care about the caption position because
+% the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
+% to a skip of zero anyway.)\par
+% Furthermore |\SC@justify| will override the caption justification, if set.
+% The usage of |\SC@justify| differs from version to version of the
+% \package{sidecap} package:\par
+% \begin{tabular}{ll}
+% Version 1.4: & |\SC@justify| is not defined\\
+% Version 1.5: & |\SC@justify| is |\relax| when not set\\
+% Version 1.6: & |\SC@justify| is |\@empty| when not set\\
+% \end{tabular}
+% \begin{macrocode}
+ \caption@letfloattype{SC\@captype}{%
+ \@listdepth\z@
+ \setcaptionmargin\z@
+ \@ifundefined{SC@justify}{}{%
+ \ifx\SC@justify\@empty\else
+ \let\caption@hj\SC@justify
+ \let\SC@justify\@empty
+ \fi}}%
+% \end{macrocode}
+%
+% We adapt |\caption@ifempty| so |\caption{}| will work within these
+% environments, too.
+% \begin{macrocode}
+ \long\def\caption@ifempty##1{%
+ \ifx\SC@CAPtext\@empty
+ \expandafter\@firstofone
+ \else
+ \expandafter\@gobble
+ \fi}%
+% \end{macrocode}
+%
+% \iffalse % Does not work anyway...
+% Furthermore we adapt |\caption@ifnocontentsline| so |\caption[]{|\ldots|}|
+% will work within these environments, too.
+% \begin{macrocode}
+% \long\def\caption@ifnocontentsline##1{%
+% \ifx\SC@OPTCAPtext\@empty
+% \expandafter\@firstofone
+% \else
+% \expandafter\@gobble
+% \fi}%
+% \end{macrocode}
+% \fi
+%
+% Finally we call the original definition of |\endSC@FLOAT| which will
+% call our version of |\caption| to typeset the caption.
+% \begin{macrocode}
+ \caption@endSC@FLOAT}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection*{\package{supertabular} package support}
+%
+% \begin{macro}{\caption@setSTposition}
+% The |position=| setting will be overwritten by the
+% \package{supertabular} package: If |\topcaption| is used,
+% the position will be |top| automatically, |bottom| otherwise.
+% \begin{macrocode}
+\def\caption@setSTposition{%
+ \caption@setposition{\if@topcaption t\else b\fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifpackage{supertabular}{ST@caption}{%
+ \caption@Info{supertabular package detected}%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \let\caption@tablecaption\tablecaption
+ \def\tablecaption{\caption@caption\caption@tablecaption}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
+% Original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% \if@topcaption \vskip 10\p@ \fi
+% \endgroup}
+% \end{verbatim}
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@letfloattype{supertabular}{}%
+ \let\caption@fixposition\caption@setSTposition
+ \caption@beginex{#1}{#2}{#3}%
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{%
+ \csname the#1\endcsname}{\ignorespaces #2}}%
+ \@parboxrestore
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.1/caption.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.1/caption.dtx
new file mode 100644
index 00000000000..4bc736fdb9c
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.1/caption.dtx
@@ -0,0 +1,7985 @@
+% \iffalse meta-comment
+%
+% This is file `caption.dtx'.
+%
+% Copyright (C) 1994-2010 Axel Sommerfeldt (caption@sommerfee.de)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files caption.ins, caption.dtx, caption2.dtx,
+% ltcaption.dtx, and subcaption.dtx, the derived files caption.sty,
+% caption2.sty, caption3.sty, ltcaption.sty, and subcaption.sty, and the
+% user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
+%
+% \fi
+% \CheckSum{7218}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{caption.drv}[2010/01/14 v3.1m Implementation of the caption package]
+\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+%\let\ORIsubsection\subsection
+%\def\subsection{\clearpage\ORIsubsection}
+%
+\makeatletter % make room for subsections like 2.16.14 in the TOC
+%\newcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
+\renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.6em}}
+\makeatother
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage[debug]{caption}[2009/10/09]
+%
+\DeclareRobustCommand*\eTeX{\texorpdfstring
+ {\leavevmode\hbox{$\varepsilon$}-\TeX}%
+ {e-TeX}}
+\DeclareRobustCommand*\AmS{\texorpdfstring
+ {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
+ {AMS}}
+\DeclareRobustCommand*\KOMAScript{\texorpdfstring
+ {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
+ {KOMA-Script}}
+\DeclareRobustCommand*\NTG{NTG}
+\DeclareRobustCommand*\SmF{SMF}
+%
+\begin{document}
+ \DocInput{caption.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
+% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
+% \let\class\puresf \let\package\puresf
+% \let\env\purett \let\opt\purett
+%
+% \def\thispackage{the \package{caption} package}
+% \def\Thispackage{The \package{caption} package}
+%
+% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+% \newcommand*\version[2][]{\textit{v#2}}
+% \newcommand*\x{\discretionary{-}{}{}}
+% \newcommand*\xx{\discretionary{}{}{}}
+%
+% \GetFileInfo{caption.drv}
+% \let\docdate\filedate
+% \GetFileInfo{caption.sty}
+%
+% \title{The Implementation of
+% \texorpdfstring{\thispackage\thanks{%^^A
+% This package has version number \fileversion, last revised \filedate.}}%^^A
+% {the caption package}}
+% \author{Axel Sommerfeldt\\
+% \href{mailto:caption@sommerfee.de}{\texttt{caption@sommerfee.de}}}
+% \date{\docdate}
+% \maketitle
+%
+% \begin{abstract}
+% \Thispackage\ consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% The kernel provides all the user commands and internal macros which are
+% necessary for typesetting captions and setting parameters regarding these.
+% While the standard \LaTeX\ document classes provide an internal command
+% called |\@makecaption| and no options to control its behavior (except the
+% vertical skips above and below the caption itself), we provide similar
+% commands called |\caption@make| and |\caption@@make|, but with a lot of
+% options which can be selected with |\captionsetup|.
+% Loading the kernel part do not change the output of a \LaTeX\ document
+% -- it just provides functionality which can be used by \LaTeXe\ packages
+% which typesets captions, for example the \package{caption} and
+% \package{subfig} packages.
+%
+% \Thispackage\ redefines the \LaTeX\ commands
+% |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
+% |\caption@@make|, giving the user the possibility to control the look \& feel
+% of the captions from floating environments like |figure| and |table|.
+% Furthermore it does similar to the caption stuff coming from other packages
+% (like the \package{longtable} or \package{supertabular} package):
+% Mapping the appropriate internal commands (like |\LT@makecaption| or
+% |\ST@caption|) to the ones offered by the \package{caption3} kernel.
+% So you can think of \thispackage\ as a layer package, it
+% simply provides adaptation layers between the caption stuff coming from
+% \LaTeXe\ or packages, and the caption stuff offered by the
+% \package{caption3} kernel.
+% \end{abstract}
+%
+% \section*{User manuals}
+%
+% This document is describing the code implementation only. The user
+% documentation can be found in
+% \nopagebreak\begin{quote}
+% \begin{tabular}{ll}
+% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/caption/caption-eng.pdf}%
+% {\texttt{caption-eng.pdf}} & The English documentation \\
+% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/caption/caption-rus.pdf}%
+% {\texttt{caption-rus.pdf}} & The Russian documentation\footnotemark \\
+% \href{ftp://dante.ctan.org/tex-archive/macros/latex/contrib/caption/caption-deu.pdf}%
+% {\texttt{caption-deu.pdf}} & The German documentation \\
+% \end{tabular}
+% \footnotetext{Thanks a lot to Olga Lapko for this translation}
+% \end{quote}
+%
+% \StopEventually{}
+% \clearpage
+% \tableofcontents
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+%
+% \changes{v1.0}{1994/10/27}{First release}
+% \changes{v1.1}{1994/11/03}{New option \cs{centerlast}}
+% \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
+% \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
+% \changes{v1.4}{1995/01/30}{New option \cs{nooneline}}
+% \changes{v1.4b}{1995/04/05}{Bugfix release}
+% \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v3.0d}{2004/11/28}{Split into two packages:
+% \package{caption} \& \package{caption3}}
+%
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \section{Kernel}
+% \iffalse
+%<*kernel>
+% \fi
+%
+% \subsection{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption3}[2010/01/14 v1.1m caption3 kernel (AR)]
+% \end{macrocode}
+%
+% \subsection{Generic helpers}
+%
+% \begin{macro}{\@nameundef}
+% This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel.
+% We use it to remove the definition of some commands and keyval options after
+% |\begin{document}| (to save \TeX\ memory) and to remove caption options defined
+% with |\captionsetup|\oarg{type}.
+% \begin{macrocode}
+\providecommand*\@nameundef[1]{%
+ \expandafter\let\csname #1\endcsname\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@addto@macro}
+% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which
+% globally adds tokens to existing macros, like in |\AtBeginDocument|.
+% This is the same but it works local, not global
+% (using \cs{edef} instead of \cs{xdef}).
+% \begin{macrocode}
+\providecommand\l@addto@macro[2]{%
+ \begingroup
+ \toks@\expandafter{#1#2}%
+ \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bothIfFirst}
+% \begin{macro}{\bothIfSecond}
+% |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond|
+% tests if the second argument is not empty. If yes both arguments get
+% typeset, otherwise none of them.
+% \begin{macrocode}
+\def\bothIfFirst#1#2{%
+ \protected@edef\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty \else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\def\bothIfSecond#1#2{%
+ \protected@edef\caption@tempa{#2}%
+ \ifx\caption@tempa\@empty \else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifinlist}
+% \changes{v3.1}{2007/07/29}{Rewritten}
+% This helper macro checks if the first argument is in the comma separated
+% list which is offered as second argument. So for example
+% \begin{quote}
+% |\caption@ifinlist{frank}{axel,frank,olga,steven}{yes}{no}|
+% \end{quote}
+% would expand to |yes|.
+% \begin{macrocode}
+\newcommand*\caption@ifinlist{%
+ \@expandtwoargs\caption@@ifinlist}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@ifinlist[2]{%
+ \begingroup
+ \def\@tempa##1,#1,##2\@nil{%
+ \endgroup
+ \ifx\relax##2\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}%
+ \@tempa,#2,#1,\@nil}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifin@list}
+% \changes{v3.1}{2007/08/12}{This macro added}
+% |\caption@ifin@list|\marg{cmd}\marg{list entry}\marg{yes}\marg{no}
+% \begin{macrocode}
+\newcommand*\caption@ifin@list[2]{%
+ \caption@ifempty@list#1%
+ {\@secondoftwo}%
+ {\@expandtwoargs\caption@@ifinlist{#2}{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@addto@list}
+% \changes{v3.1}{2007/07/29}{This macro added}
+% |\caption@g@addto@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@g@addto@list[2]{%
+ \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@addto@list}
+% \changes{v3.1}{2007/07/29}{This macro added}
+% |\caption@l@addto@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@l@addto@list[2]{%
+ \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@removefrom@list}
+% \changes{v3.1}{2007/07/29}{This macro added}
+% |\caption@g@removefrom@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@g@removefrom@list[2]{%
+ \caption@l@removefrom@list#1{#2}%
+ \global\let#1#1}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@removefrom@list}
+% \changes{v3.1}{2007/07/29}{This macro added}
+% |\caption@l@removefrom@list|\marg{cmd}\marg{list entry}\par
+% \Note[Caveat]{\meta{cmd} will be expanded during this process since
+% \cs{@removeelement} is using \cs{edef} to build the new list!}
+% \begin{macrocode}
+\newcommand*\caption@l@removefrom@list[2]{%
+ \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@for@list}
+% \changes{v3.1}{2007/07/29}{This macro added}
+% |\caption@for@list|\marg{cmd}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\caption@for@list[2]{%
+ \caption@ifempty@list#1{}{%
+ \def\caption@tempb##1{#2}%
+ \@for\caption@tempa:=#1\do{%
+ \expandafter\caption@tempb\expandafter{\caption@tempa}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty@list}
+% \changes{v3.1}{2007/07/29}{This macro added}
+% |\caption@ifempty@list|\marg{cmd}\marg{true}\marg{false}
+% \begin{macrocode}
+\newcommand*\caption@ifempty@list[1]{%
+ \ifx#1\@undefined
+ \expandafter\@firstoftwo
+ \else\ifx#1\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else\ifx#1\@empty
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak[3]
+% \begin{macro}{\caption@setbool}
+% \begin{macro}{\caption@set@bool}
+% \changes{v3.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added}
+% \begin{macro}{\caption@ifbool}
+% \begin{macro}{\caption@undefbool}
+% For setting and testing boolean options we offer these three helper macros:
+% \begin{quote}
+% |\caption@setbool|\marg{name}\marg{value}\\
+% | |(with |value = false/true/no/yes/off/on/0/1|)\\
+% |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\
+% |\caption@undefbool|\marg{name}
+% \end{quote}
+% \begin{macrocode}
+\newcommand*\caption@setbool[1]{%
+ \expandafter\caption@set@bool\csname caption@if#1\endcsname}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@bool[2]{%
+ \caption@ifinlist{#2}{1,true,yes,on}{%
+ \let#1\@firstoftwo
+ }{\caption@ifinlist{#2}{0,false,no,off}{%
+ \let#1\@secondoftwo
+ }{%
+ \caption@Error{Undefined boolean value `#2'}%
+ }}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@teststar}
+% \changes{v3.1}{2007/05/08}{This macro and its usage added}
+% \changes{v3.1e}{2007/10/28}{\cs{caption@teststar@} added}
+% |\caption@teststar|\marg{cmd}\marg{star arg}\marg{non-star arg}\\
+% |\caption@teststar@|\marg{cmd}\marg{star arg}\marg{non-star arg}
+% \begin{macrocode}
+\newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@teststar@[3]{%
+ \@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}}
+\AtBeginDocument{\let\caption@teststar@\caption@teststar}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifatletter{%
+ \ifnum\the\catcode`\@=11
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\AtBeginDocument{\let\caption@ifatletter\@secondoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@withoptargs}
+% \changes{v3.1}{2007/08/12}{This macro added}
+% |\caption@withoptargs|\marg{cmd}
+% \begin{macrocode}
+\newcommand*\caption@withoptargs[1]{%
+ \@ifstar
+ {\def\caption@tempa{*}\caption@@withoptargs#1}%
+ {\def\caption@tempa{}\caption@@withoptargs#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@withoptargs#1{%
+ \@ifnextchar[%]
+ {\caption@@@withoptargs#1}%
+ {\caption@@@@withoptargs#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@withoptargs#1[#2]{%
+ \l@addto@macro\caption@tempa{[{#2}]}%
+ \caption@@withoptargs#1}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@@withoptargs#1{%
+ \expandafter#1\expandafter{\caption@tempa}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@CheckCommand}
+% \changes{v3.1}{2007/04/10}{This macro added}
+% \begin{macro}{\caption@IfCheckCommand}
+% \changes{v3.1}{2007/04/10}{This macro added}
+% \changes{v3.1i}{2008/08/02}{Revised so \cs{next} is no longer used}
+% |\caption@CheckCommand|\marg{macro}\marg{definition of macro}\par
+% checks if a command already exists, with the same definition.
+% It can be used more-than-once to check if one of multiple definitions will
+% finally match.
+% (It redefines itself later on to |\@gobbletwo| if the two commands match
+% fine, making further checks harmless.)\par
+% |\caption@IfCheckCommand|\marg{true}\marg{false}\par
+% will execute the \meta{true} code if one match was finally given,
+% the \meta{false} code otherwise.
+% (It simply checks if |\caption@CheckCommand| is |\@gobbletwo| and
+% restores the starting definition of |\caption@CheckCommand|.)
+% \begin{macrocode}
+\newcommand\caption@DoCheckCommand[2]{%
+ \begingroup
+ \let\@tempa#1%
+ #2%
+ \ifx\@tempa#1%
+ \endgroup
+ \let\caption@CheckCommand\@gobbletwo
+ \else
+ \endgroup
+ \fi}
+\@onlypreamble\caption@DoCheckCommand
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@CheckCommand\caption@DoCheckCommand
+\@onlypreamble\caption@CheckCommand
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@IfCheckCommand{%
+ \ifx\caption@CheckCommand\@gobbletwo
+ \let\caption@CheckCommand\caption@DoCheckCommand
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\@onlypreamble\caption@IfCheckCommand
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@AtBeginDocument}
+% \changes{v3.1}{2007/04/13}{This macro and its usage added}
+% \changes{v3.1l}{2010/01/09}{Adapted to the combine document class}
+% |\caption@AtBeginDocument*|\marg{code}\\
+% Same as |\AtBeginDocument| but the execution of code
+% will be surrounded by two |\PackageInfo|s.
+% The starred variant causes the code to be executed after all code
+% specified using the non-starred variant.
+% \begin{macrocode}
+\let\caption@begindocumenthook\@empty
+\let\caption@@begindocumenthook\@empty
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@AtBeginDocument{%
+ \caption@teststar\g@addto@macro
+ \caption@@begindocumenthook\caption@begindocumenthook}
+%\@onlypreamble\caption@AtBeginDocument
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{%
+ \PackageInfo{caption}{Begin \noexpand\AtBeginDocument code\@gobble}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}%
+ \caption@begindocumenthook
+ \let\caption@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar\@firstofone\@firstofone}%
+ \caption@@begindocumenthook
+ \let\caption@@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \PackageInfo{caption}{End \noexpand\AtBeginDocument code\@gobble}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Errors}
+%
+% \begin{macro}{\caption@Warning}
+% \changes{v3.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% \begin{macro}{\caption@WarningNoLine}
+% \changes{v3.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% \begin{macro}{\caption@Error}
+% \changes{v3.0l}{2007/01/20}{This macro added, will now be used for errors}
+% \changes{v3.0q}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}}
+% \changes{v3.1b}{2007/09/18}{Usage of \cs{caption@Package} removed}
+% \begin{macro}{\caption@KV@err}
+% \changes{v3.1b}{2007/09/18}{This macro added}
+% |\caption@Error|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Warning[1]{%
+ \caption@WarningNoLine{#1\on@line}}
+\newcommand*\caption@WarningNoLine[1]{%
+ \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}}
+\newcommand*\caption@Error[1]{%
+ \PackageError{caption}{#1}\caption@eh}
+\let\caption@KV@err\caption@Error
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@wh}
+% \begin{macro}{\caption@eh}
+% At the moment we only offer these two simple warning resp. error helpers.
+% \begin{macrocode}
+\newcommand*\caption@wh{%
+ See the caption package documentation for explanation.}
+\newcommand*\caption@eh{%
+ If you do not understand this error, please take a closer look\MessageBreak
+ at the documentation of the `caption' package, especially the\MessageBreak
+ section about errors.\MessageBreak\@ehc}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Using the keyval package}
+%
+% We need the \package{keyval} package for option handling, so we load it here.
+% \begin{macrocode}
+\RequirePackage{keyval}[1997/11/10]
+% \end{macrocode}
+%
+% \begin{macro}{\undefine@key}
+% |\undefine@key|\marg{family}\marg{key}\par
+% This helper macro is the opposite of |\define@key|, it removes a keyval
+% definition.
+% \begin{macrocode}
+\providecommand*\undefine@key[2]{%
+ \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@onlypreamble@key}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1e}{2007/11/01}{\cs{KV@err} will be used now instead of \cs{@notprerr}}
+% |\onlypreamble@key|\marg{family}\marg{key}\par
+% Analogous to |\@onlypreamble| from \LaTeXe.
+% \begin{macrocode}
+\providecommand*\@preamble@keys{}
+\providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}}
+\@onlypreamble\@onlypreamble@key
+\@onlypreamble\@preamble@keys
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}%
+ \@preamble@keys
+ \let\@elt\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOption}
+% |\DeclareCaptionOption|\marg{option}\oarg{default value}\marg{code}\\
+% |\DeclareCaptionOption*|\marg{option}\oarg{default value}\marg{code}\par
+% We declare our options using these commands (instead of using
+% |\DeclareOption| offered by \LaTeXe), so the keyval package is used.
+% The starred form makes the option available during the lifetime of the
+% current package only, so they can be used with |\usepackage|, but
+% \emph{not} with |\captionsetup| later on.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOption{%
+ \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareoption[2]{%
+ #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}}
+\@onlypreamble\caption@declareoption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOptionNoValue}
+% \changes{v3.1c}{2007/10/06}{This macro added}
+% |\DeclareCaptionOptionNoValue|\marg{option}\marg{code}\\
+% |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\par
+% Same as \cs{DeclareCaptionOption} but issues an error if a value is given.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOptionNoValue{%
+ \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOptionNoValue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declareoption@novalue[3]{%
+ \caption@declareoption{#1}{#2}[\KV@err]{%
+ \caption@option@novalue{#2}{##1}{#3}}}
+\@onlypreamble\caption@declareoption@novalue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@option@novalue[2]{%
+ \ifx\KV@err#2%
+ \expandafter\@firstofone
+ \else
+ \KV@err{No value allowed for #1}%
+ \expandafter\@gobble
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifcaptionsetup@star}
+% \changes{v3.1g}{2008/01/12}{This macro added}
+% If the starred form of |\captionsetup| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@setkeys|.)
+% \begin{macrocode}
+\newif\ifcaptionsetup@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionsetup}
+% \changes{v3.0a}{2004/01/17}{Bugfix: Missing \% added}
+% \changes{v3.1}{2007/07/22}{Starred-variant added}
+% \changes{v3.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v3.1g}{2008/01/12}{\cs{ifcaptionsetup@star} will be set now}
+% |\captionsetup|\oarg{type}\marg{keyval-list of options}\\
+% |\captionsetup*|\oarg{type}\marg{keyval-list of options}\par
+% If the optional argument `type' is specified, we simply save or append
+% the option list, otherwise we `execute' it with |\setkeys|.
+% (The non-starred variant issues a warning if \meta{keyval-list of options}
+% is not used later on.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\captionsetup{%
+ \caption@teststar@\@captionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionsetup[1]{%
+ \captionsetup@startrue#1\captionsetup@starfalse
+ \@ifnextchar[\caption@setup@options\caption@setup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup{\caption@setkeys{caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@setup@options[#1]#2{%
+ \@bsphack
+ \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi
+ \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\clearcaptionsetup}
+% \changes{v3.1}{2007/07/29}{Optional argument added}
+% \changes{v3.1}{2007/08/17}{Starred variant added}
+% \changes{v3.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\clearcaptionsetup|\oarg{option}\marg{type}\\
+% |\clearcaptionsetup*|\oarg{option}\marg{type}\par
+% This removes the saved option list associated with \meta{type}.
+% If \meta{option} is given, only this option will be removed from the list.
+% (The starred variant does not issue warnings.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\clearcaptionsetup{%
+ \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@clearcaptionsetup[1]{%
+ \let\caption@tempa#1%
+ \@testopt\@@clearcaptionsetup{}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@@clearcaptionsetup[#1]#2{%
+ \@bsphack
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}%
+ {\ifx,#1,%
+ \caption@clearsetup{#2}%
+ \else
+ \caption@@removefromsetup{#1}{#2}%
+ \fi}%
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@clearsetup[1]{%
+ \caption@removefromoptlist{#1}%
+ \@nameundef{caption@opt@#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromsetup{%
+ \let\caption@tempa\@gobble
+ \caption@@removefromsetup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@removefromsetup[2]{%
+ \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname
+ \expandafter\let\csname caption@opt@#2\endcsname\@undefined
+ \def\@tempb##1=##2\@nil{##1}%
+ \edef\@tempc{#1}%
+ \@for\@tempa:=\@tempa\do{%
+ \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}%
+ \ifx\@tempd\@tempc
+ \let\caption@tempa\@gobble
+ \else
+ \expandafter\expandafter\expandafter\caption@l@addto@list
+ \expandafter\csname caption@opt@#2\expandafter\endcsname
+ \expandafter{\@tempa}%
+ \fi}%
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@removefromoptlist{#2}}{}%
+ \caption@tempa{\caption@Warning{%
+ Option `#1' was not in list `#2'\MessageBreak}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\showcaptionsetup}
+% \changes{v3.0e}{2005/05/03}{Optimized for memory usage}
+% \changes{v3.1}{2007/07/29}{Bugfix: Does not expand option list anymore}
+% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\showcaptionsetup|\oarg{package}\marg{type}\par
+% This comes for debugging issues: It shows the saved option list which
+% is associated with \meta{type}.
+% \begin{macrocode}
+\newcommand*\showcaptionsetup[2][\@firstofone]{%
+ \@bsphack
+ \GenericWarning{}{%
+ #1 Caption Info: Option list on `#2'\MessageBreak
+ #1 Caption Data: \@ifundefined{caption@opt@#2}{%
+ -none-%
+ }{%
+ {\expandafter\expandafter\expandafter\strip@prefix
+ \expandafter\meaning\csname caption@opt@#2\endcsname}%
+ }}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1}{2007/07/02}{Option \opt{options=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{options}{\caption@setoptions{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setoptions}
+% \changes{v3.0i}{2006/01/03}{Optional argument added}
+% \changes{v3.0j}{2006/01/26}{Revised}
+% \changes{v3.0l}{2007/01/30}{Optional argument removed}
+% \changes{v3.1}{2007/04/11}{Usage of \cs{clearcaptionsetup} added}
+% \changes{v3.1}{2007/05/09}{Renamed from \cs{caption@settype} to \cs{caption@setoptions}}
+% \changes{v3.1f}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% |\caption@setoptions|\marg{type or environment or\ldots}\par
+% Caption options which have been saved with |\captionsetup|\oarg{type} can
+% be executed by using this command.
+% It simply executes the saved option list (and clears it afterwards),
+% if there is any.
+% \begin{macrocode}
+\newcommand*\caption@setoptions[1]{%
+ \caption@Debug{options=#1}%
+ \expandafter\let\expandafter\caption@opt\csname caption@opt@#1\endcsname
+ \ifx\caption@opt\relax \else
+ \caption@xsetup\caption@opt
+ \caption@clearsetup{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtooptlist}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \begin{macro}{\caption@removefromoptlist}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1j}{2008/08/24}{Fatal typo corrected}
+% |\caption@addtooptlist|\marg{type}\\
+% |\caption@removefromoptlist|\marg{type}\par
+% Adds or removes an \meta{type} to the list of unused caption options.
+% Note that the catcodes of \meta{type} are sanitized here so removing
+% \meta{type} from the list do not fail when the \package{float} package
+% is used (since |\float@getstyle| gives a result which tokens have catcode
+% 12 $=$ ``other'').
+% \begin{macrocode}
+\newcommand*\caption@addtooptlist[1]{%
+ \@ifundefined{caption@opt@#1@lineno}{%
+ \caption@dooptlist\caption@g@addto@list{#1}%
+ \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}%
+ }{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromoptlist[1]{%
+ \caption@dooptlist\caption@g@removefrom@list{#1}%
+ \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@dooptlist[2]{%
+ \begingroup
+ \edef\@tempa{#2}\@onelevel@sanitize\@tempa
+ \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\AtEndDocument{%
+ \caption@for@list\caption@optlist{%
+ \caption@WarningNoLine{%
+ Unused \string\captionsetup[#1]
+ on input line \csname caption@opt@#1@lineno\endcsname}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@setkeys}
+% \changes{v3.0i}{2006/01/03}{This macro added}
+% \changes{v3.0l}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added}
+% \changes{v3.0l}{2007/01/30}{Optional argument added}
+% \changes{v3.0p}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter}
+% \changes{v3.1b}{2007/09/18}{Usage of \cs{caption@Package} removed, we use \cs{caption@KV@err} instead}
+% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v3.1g}{2008/01/12}{\cs{captionsetup@starfalse} added}
+% \changes{v3.1k}{2009/09/30}{Bugfix 09-09-29: Missing error handler will be defined automatically}
+% |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\par
+% This one simply calls |\setkeys|\marg{family}\marg{key-values}
+% but lets the error messages not refer to the \package{keyval} package,
+% but to the \meta{package} package instead.
+% \begin{macrocode}
+\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@setkeys[#1]#2#3{%
+ \@bsphack
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err
+ \expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx
+ \expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname
+ \ifx\KV@err\relax
+ \def\KV@err##1{\PackageError{#1}{##1}{%
+ See the #1 package documentation for explanation.}}%
+ \fi
+ \let\KV@errx\KV@err
+ \edef\caption@keydepth{\caption@keydepth i}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{\protect\setkeys{#2}{#3}}%
+ \setkeys{#2}{#3}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}%
+ \expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname
+ \expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@keydepth\@empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ExecuteOptions}
+% \changes{v3.1}{2007/07/15}{This macro added}
+% |\caption@ExecuteOptions|\marg{family}\marg{key-values}\par
+% We execute our options using the keyval interface, so we use this one
+% instead of |\ExecuteOptions| offered by \LaTeXe.
+% \begin{macrocode}
+\newcommand*\caption@ExecuteOptions[2]{%
+ \@expandtwoargs\caption@setkeys{#1}{#2}}%
+\@onlypreamble\caption@ExecuteOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ProcessOptions}
+% \changes{v3.0a}{2004/01/23}{Bugfix, see
+% \purett{news:400D360C.9678329F@gmx.net} for details}
+% \changes{v3.0i}{2006/01/03}{Improvement, uses \cs{caption@setkeys}
+% instead of \cs{setkeys}}
+% \changes{v3.0j}{2006/02/23}{Bugfix, now processes only those global
+% options which have a default value}
+% \changes{v3.0l}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to
+% \cs{caption@ProcessOptions} and moved from the package to the kernel}
+% \changes{v3.1}{2007/04/17}{Star variant added}
+% |\caption@ProcessOptions*|\marg{family}\par
+% We process our options using the keyval package, so we use this one
+% instead of |\ProcessOptions| offered by \LaTeXe.
+% The starred variant do not process the global options.
+% (This code was taken from the \package{hyperref} package\cite{hyperref}
+% \version{6.74} and improved.)
+% \begin{macrocode}
+\newcommand*\caption@ProcessOptions{%
+ \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone}
+\@onlypreamble\caption@ProcessOptions
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@ProcessOptions[2]{%
+ \let\@tempc\relax
+ \let\caption@tempa\@empty
+ #1{% \@firstofone -or- \@gobble
+ \@for\CurrentOption:=\@classoptionslist\do{%
+ \@ifundefined{KV@#2@\CurrentOption}{}{%
+ \@ifundefined{KV@#2@\CurrentOption @default}{%
+ \PackageInfo{#2}{Global option `\CurrentOption' ignored}%
+ }{%
+ \PackageInfo{#2}{Global option `\CurrentOption' processed}%
+ \edef\caption@tempa{\caption@tempa,\CurrentOption,}%
+ \@expandtwoargs\@removeelement\CurrentOption
+ \@unusedoptionlist\@unusedoptionlist
+ }%
+ }%
+ }%
+ \let\CurrentOption\@empty
+ }%
+ \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}%
+ \AtEndOfPackage{\let\@unprocessedoptions\relax}}
+\@onlypreamble\caption@@ProcessOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Margin resp. width}
+% \changes{v3.0p}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}}
+% \changes{v3.0p}{2007/04/03}{Option `twoside' added}
+% \changes{v3.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added}
+% \changes{v3.1f}{2007/11/10}{Option `oneside' added}
+%
+% \begin{macro}{\captionmargin}
+% \begin{macro}{\captionwidth}
+% |\captionmargin| and |\captionwidth| contain the extra margin
+% resp. the total width used for captions. Please never set these values in
+% a direct way, they are just accessible in user documents to provide
+% compatibility to \version{1.x}.\par
+% Note that we can only set one value at a time, `margin' \emph{or} `width'.
+% If |\captionwidth| is not zero we will take this value afterwards,
+% otherwise |\captionmargin| and |\captionmargin@|.
+% \begin{macrocode}
+\newdimen\captionmargin
+\newdimen\captionmargin@
+\newdimen\captionwidth
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
+\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}}
+\DeclareCaptionOption{width}{\setcaptionwidth{#1}}
+\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}}
+\DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}}
+\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\setcaptionmargin}
+% \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
+% \changes{v3.0h}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take
+% left+right margin}
+% \changes{v3.1}{2007/08/11}{Starred variant added}
+% \changes{v3.1}{2007/08/12}{\cs{setlength}\cs{captionmargin} \&
+% \cs{setlength}\cs{captionmargin@} swapped so
+% `\texttt{margin*=}\cs{captionmargin}' works in singleline options}
+% |\setcaptionmargin|\marg{amount}\\
+% |\setcaptionmargin*|\marg{amount}\par
+% Please never use them in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionmargin{%
+ \caption@teststar\caption@setmargin\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setmargin[2]{%
+ #1{\captionwidth\z@}%
+ \caption@@setmargin#2,#2,\@nil}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@setmargin#1,#2,#3\@nil{%
+ \setlength\captionmargin@{#2}%
+ \setlength\captionmargin{#1}%
+ \addtolength\captionmargin@{-\captionmargin}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionwidth}
+% \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
+% |\setcaptionwidth|\marg{amount}\par
+% Please never use this in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionwidth{%
+ \captionmargin\z@
+ \captionmargin@\z@
+ \setlength\captionwidth}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@counter}
+% \changes{v3.0p}{2007/04/03}{This counter added}
+% \changes{v3.1e}{2007/10/28}{Renamed to \cs{caption@thecounter}; \cs{caption@stepcounter} added}
+% This counter numbers the captions. At the moment it will be used inside
+% |\caption@ifoddpage| only.
+% \begin{macrocode}
+\newcommand*\caption@thecounter{0}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@stepcounter{%
+ \@tempcnta\caption@thecounter
+ \advance\@tempcnta\@ne
+ \xdef\caption@thecounter{\the\@tempcnta}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@newlabel}
+% \changes{v3.0p}{2007/04/03}{This macro added}
+% This command is a modified version of |\newlabel| from \LaTeX2e.
+% It will be written to the \texttt{.aux} file to
+% pass label information from one run to another.
+% (We use it inside |\caption@ifoddpage| and |\caption@ragged|.)
+% \begin{macrocode}
+\newcommand*\caption@newlabel{\@newl@bel{caption@r}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@thepage}
+% \changes{v3.0p}{2007/04/03}{This macro added}
+% This command is a modified version of |\thepage| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| only.
+% \begin{macrocode}
+\newcommand*\caption@thepage{\the\c@page}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@label}
+% \changes{v3.1}{2007/09/01}{This macro added}
+% \changes{v3.1f}{2007/12/03}{Definition of \cs{caption@newlabel} in AUX file added}
+% This command is a modified version of |\label| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
+% \begin{macrocode}
+\newcommand*\caption@label[1]{%
+ \caption@@label
+ \protected@write\@auxout{\let\caption@thepage\relax}%
+ {\string\caption@newlabel{#1}{\caption@thepage}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@label{%
+ \global\let\caption@@label\relax
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@newlabel[2]{}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@pageref}
+% \changes{v3.1}{2007/09/01}{This macro added}
+% \changes{v3.1k}{2009/10/09}{Uses \cs{@latex@warning} instead of \cs{caption@Warning} now}
+% This command is a modified version of |\pageref| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
+% \begin{macrocode}
+\newcommand*\caption@pageref[1]{%
+ \expandafter\ifx\csname caption@r@#1\endcsname\relax
+ \G@refundefinedtrue % => 'There are undefined references.'
+ \@latex@warning{Reference `#1' on page \thepage \space undefined}%
+ \else
+ \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifoddpage}
+% \changes{v3.0p}{2007/04/03}{This macro added}
+% \changes{v3.1e}{2007/10/28}{Incrementation of counter moved to \cs{caption@@make}}
+% At the moment this macro uses an own label\ldots ref mechanism,
+% but an alternative implementation method would be using the
+% \package{refcount} package\cite{refcount} and |\ifodd\getpagerefnumber{|\ldots|}|.
+% \Note{This macro re-defines itself so the \texttt{.aux} file will
+% only be used once per group.}
+% \begin{macrocode}
+\newcommand*\caption@ifoddpage{%
+ \caption@iftwoside{%
+ \caption@label\caption@thecounter
+ \caption@pageref\caption@thecounter
+ \ifodd\caption@thepage
+ \let\caption@ifoddpage\@firstoftwo
+ \else
+ \let\caption@ifoddpage\@secondoftwo
+ \fi
+ }{\let\caption@ifoddpage\@firstoftwo}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifoddpage}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setoptcmd}
+% \changes{v3.1}{2007/08/11}{This macro added}
+% |\caption@setoptcmd|\marg{cmd}\marg{off -or- value}
+% \begin{macrocode}
+\newcommand*\caption@setoptcmd[2]{%
+ \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Indentions}
+%
+% \begin{macro}{\caption@indent}
+% \changes{v3.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}}
+% \begin{macro}{\caption@parindent}
+% \begin{macro}{\caption@hangindent}
+% These are the indentions we support.
+% \begin{macrocode}
+\newdimen\caption@indent
+\newdimen\caption@parindent
+\newdimen\caption@hangindent
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v3.0b}{2004/05/16}{Defaults added for options \opt{parindent=}
+% and \opt{hangindent=}}
+% \changes{v3.0h}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption}
+% replaced by \cs{caption@@par}}
+% \changes{v3.0h}{2005/08/22}{Undocumented defaults for \opt{parindent=},
+% \opt{hangindent=}, and \opt{parskip=} removed}
+% \begin{macrocode}
+\DeclareCaptionOption{indent}[\leftmargini]{% obsolete!
+ \setlength\caption@indent{#1}}
+\DeclareCaptionOption{indention}[\leftmargini]{%
+ \setlength\caption@indent{#1}}
+\DeclareCaptionOption{parindent}{%
+ \setlength\caption@parindent{#1}}
+\DeclareCaptionOption{hangindent}{%
+ \setlength\caption@hangindent{#1}}
+\DeclareCaptionOption{parskip}{%
+ \l@addto@macro\caption@@par{\setlength\parskip{#1}}}
+% \end{macrocode}
+%
+% \changes{v3.0h}{2005/08/22}{Increased compatibility to KOMA-Script:
+% A special version of options `parindent' and `parskip' added}
+% \changes{v3.0i}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of
+% `parskip' and `parindent' options revised and moved into caption kernel}
+% \changes{v3.0j}{2006/02/23}{KOMA-Script variants of `parskip' and
+% `parindent' are obsolete now, removed}
+% \changes{v3.0o}{2007/03/30}{KOMA-Script variants of `parskip' and
+% `parindent' re-added, since they still collide with the current
+% version of the subfig package (Sigh!)}
+%
+% There is an option clash between the \KOMAScript\ document classes
+% and the \package{caption} kernel, both define the options |parindent| and
+% |parskip| but with different meaning.
+% Furthermore the ones defined by the \package{caption} kernel take a
+% value as parameter but the \KOMAScript\ ones do not.
+% So we need special versions of the options |parindent| and |parskip| here
+% which determine if a value is given (and therefore should be treated as
+% our option) or not (and therefore should be ignored by us).\footnote{%^^A
+% This problem was completely solved due a change of \cs{caption@ProcessOptions}
+% in \thispackage\ \version{3.0j}, but we still need this workaround since
+% these options would otherwise still collide with the current version $1.3$
+% of the \package{subfig} package (Sigh!)}
+% \begin{macrocode}
+\providecommand*\caption@ifkomaclass{%
+ \@ifundefined{scr@caption}\@gobble\@firstofone}
+\@onlypreamble\caption@ifkomaclass
+% \end{macrocode}
+% \begin{macrocode}
+\caption@ifkomaclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KV@parindent\KV@caption@parindent
+ \DeclareCaptionOption{parindent}[]{%
+ \ifx,#1,%
+ \caption@Debug{Option `parindent' ignored}%
+ \else
+ \caption@KV@parindent{#1}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KV@parskip\KV@caption@parskip
+ \DeclareCaptionOption{parskip}[]{%
+ \ifx,#1,%
+ \caption@Debug{Option `parskip' ignored}%
+ \else
+ \caption@KV@parskip{#1}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{Styles}
+%
+% \begin{macro}{\DeclareCaptionStyle}
+% \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
+% between arguments do make any harm}
+% |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionStyle[1]{%
+ \@testopt{\caption@declarestyle{#1}}{}}
+\@onlypreamble\DeclareCaptionStyle
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@declarestyle#1[#2]#3{%
+ \global\@namedef{caption@sls@#1}{#2}%
+ \global\@namedef{caption@sty@#1}{#3}}
+\@onlypreamble\caption@declarestyle
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1g}{2008/01/20}{Option \opt{style*=} added}
+% \changes{v3.1i}{2008/05/06}{Option \opt{slc=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{style}{\caption@setstyle{#1}}
+\DeclareCaptionOption{style*}{\caption@setstyle*{#1}}
+\DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}}
+\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setstyle}
+% \changes{v3.0f}{2005/06/01}{Starred variant added}
+% \changes{v3.1}{2007/07/29}{Recursive style definitions should work now}
+% \changes{v3.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v3.1f}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% |\caption@setstyle|\marg{name}\\
+% |\caption@setstyle*|\marg{name}\par
+% Selecting a caption style means saving the additional
+% \meta{single-line-list-of-KV} (this will be done by |\caption@sls|),
+% resetting the caption options to the base ones (this will be done using
+% |\caption@resetstyle|) and executing the \meta{list-of-KV} options
+% (this will be done using |\caption@setup|).\par
+% The starred version will give no error message if the given style is not
+% defined.
+% \begin{macrocode}
+\newcommand*\caption@setstyle{%
+ \caption@teststar\caption@@setstyle\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setstyle[2]{%
+ \@ifundefined{caption@sty@#2}%
+ {#1{\caption@Error{Undefined style `#2'}}}%
+ {\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname
+ \ifx\caption@setstyle@flag\@undefined
+ \let\caption@setstyle@flag\relax
+ \caption@resetstyle
+ \caption@xsetup\caption@sty
+ \let\caption@setstyle@flag\@undefined
+ \else
+ \caption@xsetup\caption@sty
+ \fi
+ \expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
+ \expandafter\caption@l@addto@list\expandafter\caption@opt@singleline
+ \expandafter{\caption@sls}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetstyle}
+% \changes{v3.1}{2007/02/04}{%
+% This macro renamed from \cs{caption@setdefault} to \cs{caption@resetstyle}}
+% \changes{v3.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v3.1f}{2007/11/17}{Usage of \texttt{size=} added}
+% \changes{v3.1i}{2008/05/06}{Usage of \texttt{rule} added}
+% This resets (nearly) all caption options to the base ones.
+% \emph{Note that this does not touch the skips and the positioning!}
+% \begin{macrocode}
+\newcommand*\caption@resetstyle{%
+ \caption@setup{%
+ format=plain,labelformat=default,labelsep=colon,textformat=simple,%
+ justification=justified,font=,size=,labelfont=,textfont=,%
+ margin=0pt,minmargin=0,maxmargin=0,%
+ indent=0pt,parindent=0pt,hangindent=0pt,%
+ slc,rule,strut}%
+ \caption@clearsetup{singleline}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0d}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
+% \changes{v3.1}{2007/02/04}{Caption style `default' renamed to `base', and a new `default' added}
+% \changes{v3.1}{2007/03/31}{\opt{format=plain} added to caption style \opt{default}}
+% \changes{v3.1c}{2007/10/14}{\opt{format=plain} removed from caption style \opt{default}}
+% Currently there are two pre-defined styles, called `base' \& `default'.
+% The first one is a perfect match to the behavior of |\@makecaption| offered
+% by the standard \LaTeX\ document classes (and was called `default' in
+% \thispackage\ \version{3.0}), the second one matches the document
+% class actually used.
+% \begin{macrocode}
+\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{}
+\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{%
+ format=default,labelsep=default,textformat=default,%
+ justification=default,font=default,labelfont=default,textfont=default}
+% \end{macrocode}
+%
+% \subsection{Formats}
+%
+% \begin{macro}{\DeclareCaptionFormat}
+% \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
+% between arguments do make any harm}
+% \changes{v3.0d}{2005/02/09}{Starred variant added}
+% \changes{v3.1c}{2007/10/15}{Optional argument added}
+% |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\
+% |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par
+% The starred form causes the code being typeset in vertical (instead of
+% horizontal) mode, but does not support the |indention=| option.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFormat{%
+ \caption@teststar\caption@declareformat\@gobble\@firstofone}
+\@onlypreamble\DeclareCaptionFormat
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareformat[2]{%
+ \@dblarg{\caption@@declareformat#1{#2}}}
+\@onlypreamble\caption@declareformat
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@declareformat#1#2[#3]#4{%
+ \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
+ \global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}%
+ \global\long\@namedef{caption@fmt@#2}##1##2##3{#4}}
+\@onlypreamble\caption@@declareformat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{format}{\caption@setformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setformat}
+% |\caption@setformat|\marg{name}\par
+% Selecting a caption format simply means saving the code (in |\caption@fmt|)
+% and if the code should be used in horizontal or vertical mode (|\caption@ifh|).
+% \begin{macrocode}
+\newcommand*\caption@setformat[1]{%
+ \@ifundefined{caption@fmt@#1}%
+ {\caption@Error{Undefined format `#1'}}%
+ {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
+ \expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname
+ \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultFormat}
+% \changes{v3.1g}{2008/01/31}{This macro added}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultFormat[1]{%
+ \expandafter\def\expandafter\caption@fmt@default\expandafter
+ {\csname caption@fmt@#1\endcsname}%
+ \expandafter\def\expandafter\caption@slfmt@default\expandafter
+ {\csname caption@slfmt@#1\endcsname}%
+ \expandafter\def\expandafter\caption@ifh@default\expandafter
+ {\csname caption@ifh@#1\endcsname}}
+\@onlypreamble\DeclareCaptionDefaultFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0a}{2004/01/23}{%
+% Caption format \opt{default} renamed to \opt{normal}}
+% \changes{v3.0f}{2005/05/12}{%
+% Caption format \opt{normal} renamed to \opt{@normal}}
+% \changes{v3.0h}{2005/08/25}{%
+% Caption format \opt{@normal} renamed to \opt{plain} and documented}
+% \changes{v3.1c}{2007/10/14}{%
+% Single-line variant of caption format \opt{hang} added}
+% There are two pre-defined formats, called `plain' and `hang'.
+% \begin{macrocode}
+\DeclareCaptionFormat{plain}{#1#2#3\par}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionFormat{hang}[#1#2#3\par]{%
+ \caption@ifin@list\caption@lsepcrlist\caption@lsepname
+ {\caption@Error{%
+ The option `labelsep=\caption@lsepname' does not work\MessageBreak
+ with `format=hang'}}%
+ {\@hangfrom{#1#2}%
+ \advance\caption@parindent\hangindent
+ \advance\caption@hangindent\hangindent
+ \caption@@par#3\par}}
+% \end{macrocode}
+%
+% \changes{v3.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{plain}}
+% \changes{v3.0e}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added}
+% `default' usually maps to `plain'.
+% \begin{macrocode}
+\DeclareCaptionDefaultFormat{plain}
+% \end{macrocode}
+%
+% \subsection{Label formats}
+%
+% \begin{macro}{\DeclareCaptionLabelFormat}
+% \changes{v3.0a}{2004/01/17}{%
+% Pass through argument \#2 so extra spaces between arguments do make any harm}
+% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionLabelFormat[2]{%
+ \global\@namedef{caption@lfmt@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionLabelFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelformat}
+% |\caption@setlabelformat|\marg{name}\par
+% Selecting a caption label format simply means saving the code (in |\caption@lfmt|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelformat[1]{%
+ \@ifundefined{caption@lfmt@#1}%
+ {\caption@Error{Undefined label format `#1'}}%
+ {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1f}{2007/12/16}{Caption label format \opt{brace} added}
+% There are four pre-defined label formats, called `empty', `simple',
+% `parens', and `brace'.
+% \begin{macrocode}
+\DeclareCaptionLabelFormat{empty}{}
+\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
+\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
+\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+% \begin{macrocode}
+\def\caption@lfmt@default{\caption@lfmt@simple}
+% \end{macrocode}
+%
+% \subsection{Label separators}
+%
+% \begin{macro}{\DeclareCaptionLabelSeparator}
+% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
+% between arguments do make any harm}
+% \changes{v3.0h}{2005/08/25}{Starred variant added}
+% \changes{v3.1}{2007/07/13}{Test for CR added}
+% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
+% |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par
+% The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|.
+% \begin{macrocode}
+\newcommand\DeclareCaptionLabelSeparator{%
+ \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone}
+\@onlypreamble\DeclareCaptionLabelSeparator
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declarelabelseparator[3]{%
+ \global\expandafter\let\csname caption@iflf@#2\endcsname#1%
+ \global\long\@namedef{caption@lsep@#2}{#3}%
+ \caption@@declarelabelseparator{#2}#3\\\@nil}
+\@onlypreamble\caption@declarelabelseparator
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@declarelabelseparator#1#2\\#3\@nil{%
+ \def\@tempa{#3}\ifx\@tempa\@empty \else
+ \caption@g@addto@list\caption@lsepcrlist{#1}%
+ \fi}
+\@onlypreamble\caption@@declarelabelseparator
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
+\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelseparator}
+% |\caption@setlabelseparator|\marg{name}\par
+% Selecting a caption label separator simply means saving the code (in |\caption@lsep|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelseparator[1]{%
+ \@ifundefined{caption@lsep@#1}%
+ {\caption@Error{Undefined label separator `#1'}}%
+ {\edef\caption@lsepname{#1}%
+ \expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
+ \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0f}{2005/06/11}{Bugfix 05-03-23: Caption label separator
+% \opt{newline} implementation changed from \cs{newline} to \cs{\textbackslash}}
+% \changes{v3.0h}{2005/08/24}{Caption label separator \opt{endash} added}
+% There are seven pre-defined label separators, called `none', `colon', `period', `space',
+% `quad', `newline', and `endash'.
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{none}{}
+\DeclareCaptionLabelSeparator{colon}{: }
+\DeclareCaptionLabelSeparator{period}{. }
+\DeclareCaptionLabelSeparator{space}{ }
+\DeclareCaptionLabelSeparator*{quad}{\quad}
+\DeclareCaptionLabelSeparator*{newline}{\\}
+\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setdefaultlabelsep}
+% \changes{v3.1k}{2009/03/29}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setdefaultlabelsep[1]{%
+ \ifx\caption@lsep\caption@lsep@default
+ \caption@set@default@labelsep{#1}%
+ \caption@setlabelseparator{default}%
+ \else
+ \caption@set@default@labelsep{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@default@labelsep[1]{%
+ \def\caption@lsep@default{\@nameuse{caption@lsep@#1}}%
+ \def\caption@iflf@default{\@nameuse{caption@iflf@#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `colon'.
+% \begin{macrocode}
+\caption@set@default@labelsep{colon}
+% \end{macrocode}
+%
+% \subsection{Text formats}
+%
+% \begin{macro}{\DeclareCaptionTextFormat}
+% \changes{v3.0l}{2007/02/18}{This macro added}
+% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionTextFormat[2]{%
+ \global\long\@namedef{caption@tfmt@#1}##1{#2}}
+\@onlypreamble\DeclareCaptionTextFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0d}{2005/02/12}{Option \opt{strut=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
+\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@settextformat}
+% \changes{v3.0l}{2007/02/18}{This macro added}
+% |\caption@settextformat|\marg{name}\par
+% Selecting a caption text format simply means saving the code (in |\caption@tfmt|).
+% \begin{macrocode}
+\newcommand*\caption@settextformat[1]{%
+ \@ifundefined{caption@tfmt@#1}%
+ {\caption@Error{Undefined text format `#1'}}%
+ {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are two pre-defined text formats, called `simple' and `period'.
+% \begin{macrocode}
+\DeclareCaptionTextFormat{simple}{#1}
+\DeclareCaptionTextFormat{period}{#1.}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+% \begin{macrocode}
+\def\caption@tfmt@default{\caption@tfmt@simple}
+% \end{macrocode}
+%
+% \subsection{Fonts}
+%
+% \begin{macro}{\DeclareCaptionFont}
+% \changes{v3.0a}{2004/01/22}{%
+% Bugfix: Multi token arguments are allowed now}
+% \changes{v3.1}{2007/05/07}{%
+% Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now}
+% |\DeclareCaptionFont|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFont[2]{%
+ \define@key{caption@fnt}{#1}[]{\l@addto@macro\caption@fnt{#2}}}
+\@onlypreamble\DeclareCaptionFont
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultFont}
+% \changes{v3.1}{2006/05/14}{This macro added}
+% \changes{v3.1g}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionFont} to \cs{DeclareCaptionDefaultFont}}
+% |\DeclareCaptionDefaultFont|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultFont[2]{%
+ \global\@namedef{caption#1@default}{#2}}
+\@onlypreamble\DeclareCaptionDefaultFont
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
+\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}}
+\DeclareCaptionDefaultFont{font}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
+\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}}
+\DeclareCaptionDefaultFont{labelfont}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
+\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}}
+\DeclareCaptionDefaultFont{textfont}{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setfont}
+% \changes{v3.0l}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument}
+% \changes{v3.1}{2006/05/14}{Support of \cs{DeclareDefaultCaptionFont} added}
+% |\caption@setfont|\marg{name}\marg{keyval-list of names}\par
+% Selecting a caption font means saving all the code snippets
+% in |\caption|\meta{name}.
+% \begin{macrocode}
+\newcommand*\caption@setfont[1]{%
+ \expandafter\let\csname caption#1\endcsname\@empty
+ \caption@addtofont{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtofont}
+% \changes{v3.1f}{2007/11/17}{This macro added}
+% |\caption@addtofont|\marg{name}\marg{keyval-list of names}\par
+% Like |\caption@setfont|, but adds the code snippets to |\caption|\meta{name}.\par
+% Because we use |\setkeys| recursive here we need to do this inside an
+% extra group.
+% \begin{macrocode}
+\newcommand*\caption@addtofont[2]{%
+ \begingroup
+ \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname
+ \define@key{caption@fnt}{default}[]{%
+ \l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}%
+ \caption@setkeys[caption]{caption@fnt}{#2}%
+ \global\let\caption@tempa\caption@fnt
+ \endgroup
+ \expandafter\let\csname caption#1\endcsname\caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@font}
+% \changes{v3.1}{2007/05/07}{This macro added}
+% |\caption@font|\marg{keyval-list of names}\\
+% |\caption@font*|\marg{keyval-code}\par
+% Sets the given font, e.g.~|\caption@font{small,it}|
+% is equivalent to |\small\itshape|.
+% \begin{macrocode}
+\newcommand*\caption@font{%
+ \caption@teststar\caption@@font\@firstofone
+ {\caption@setkeys[caption]{caption@fnt}}}
+\newcommand*\caption@@font[2]{%
+ \begingroup
+ \def\caption@fnt{\endgroup}%
+ #1{#2}%
+ \caption@fnt}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined font code snippets.
+%
+% \changes{v3.1}{2007/05/07}{Color font support added (kernel)}
+% \begin{macrocode}
+\DeclareCaptionFont{normalcolor}{\normalcolor}
+\DeclareCaptionFont{color}{\color{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{normalfont}{\normalfont}
+\DeclareCaptionFont{up}{\upshape}
+\DeclareCaptionFont{it}{\itshape}
+\DeclareCaptionFont{sl}{\slshape}
+\DeclareCaptionFont{sc}{\scshape}
+\DeclareCaptionFont{md}{\mdseries}
+\DeclareCaptionFont{bf}{\bfseries}
+\DeclareCaptionFont{rm}{\rmfamily}
+\DeclareCaptionFont{sf}{\sffamily}
+\DeclareCaptionFont{tt}{\ttfamily}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{scriptsize}{\scriptsize}
+\DeclareCaptionFont{footnotesize}{\footnotesize}
+\DeclareCaptionFont{small}{\small}
+\DeclareCaptionFont{normalsize}{\normalsize}
+\DeclareCaptionFont{large}{\large}
+\DeclareCaptionFont{Large}{\Large}
+% \end{macrocode}
+%
+% \changes{v3.0p}{2007/04/02}{\package{setspace} package support added (kernel)}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-05-18: \package{setspace} package support revised (kernel)}
+% \begin{macrocode}
+\DeclareCaptionFont{singlespacing}{%
+ \@ifundefined{setspace@singlespace}{}{%
+ \setstretch\setspace@singlespace}}% normally 1
+\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
+\DeclareCaptionFont{doublespacing}{\doublespacing}
+\DeclareCaptionFont{stretch}{\setstretch{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%\DeclareCaptionFont{normal}{%
+% \caption@font{normalcolor,normalfont,normalsize,singlespacing}
+\DeclareCaptionFont{normal}{%
+ \caption@font*{%
+ \KV@caption@fnt@normalcolor\@unused
+ \KV@caption@fnt@normalfont\@unused
+ \KV@caption@fnt@normalsize\@unused
+ \KV@caption@fnt@singlespacing\@unused}}
+% \end{macrocode}
+%
+% \changes{v3.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
+% The old versions \version{1.x} of \thispackage\ offered this
+% command to setup the font size used for captions. We still do
+% so old documents will work fine.
+% \begin{macrocode}
+\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
+\DeclareCaptionDefaultFont{size}{}
+% \end{macrocode}
+%
+% \subsection{Justifications}
+%
+% \begin{macro}{\DeclareCaptionJustification}
+% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
+% between arguments do make any harm}
+% \changes{v3.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}}
+% |\DeclareCaptionJustification|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionJustification[2]{%
+ \global\@namedef{caption@hj@#1}{#2}% for compatibility to v3.0
+ \DeclareCaptionFont{#1}{#2}}
+\@onlypreamble\DeclareCaptionJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultJustification}
+% \changes{v3.1}{2007/07/03}{This macro added}
+% \changes{v3.1g}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionJustification} to \cs{DeclareCaptionDefaultJustification}}
+% |\DeclareCaptionDefaultJustification|\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultJustification[1]{%
+ \global\@namedef{caption@hj@default}{#1}% for compatibility to v3.0
+ \DeclareCaptionDefaultFont{@hj}{#1}}
+\@onlypreamble\DeclareCaptionDefaultJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{justification}{\caption@setjustification{#1}}
+\DeclareCaptionDefaultJustification{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setjustification}
+% \changes{v3.1}{2007/07/03}{Mapped to \cs{caption@setfont}}
+% |\caption@setjustification|\marg{name}\par
+% Selecting a caption justification simply means saving the code (in |\caption@hj|).
+% \begin{macrocode}
+\newcommand*\caption@setjustification{\caption@setfont{@hj}}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined justification code snippets.
+% \begin{macrocode}
+\DeclareCaptionJustification{justified}{}
+\DeclareCaptionJustification{centering}{\centering}
+\DeclareCaptionJustification{centerfirst}{\centerfirst}
+\DeclareCaptionJustification{centerlast}{\centerlast}
+\DeclareCaptionJustification{raggedleft}{\raggedleft}
+\DeclareCaptionJustification{raggedright}{\raggedright}
+% \end{macrocode}
+%
+% \begin{macro}{\centerfirst}
+% \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}}
+% Please blame Frank Mittelbach for the code of |\centerfirst| |:-)|
+% \begin{macrocode}
+\providecommand\centerfirst{%
+ \let\\\@centercr
+ \edef\caption@normaladjust{%
+ \leftskip\the\leftskip
+ \rightskip\the\rightskip
+ \parfillskip\the\parfillskip\relax}%
+ \leftskip\z@\@plus -1fil%
+ \rightskip\z@\@plus 1fil%
+ \parfillskip\z@skip
+ \noindent\hskip\z@\@plus 2fil%
+ \@setpar{\@@par\@restorepar\caption@normaladjust}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\centerlast}
+% \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}}
+% This is based on code from Anne Br\"uggemann-Klein\cite{Anne}
+% \begin{macrocode}
+\providecommand\centerlast{%
+ \let\\\@centercr
+ \leftskip\z@\@plus 1fil%
+ \rightskip\z@\@plus -1fil%
+ \parfillskip\z@\@plus 2fil\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{The ragged2e package}
+% \changes{v3.0b}{2004/05/16}{Improved \package{ragged2e} package support}
+%
+% We also support the upper-case commands offered by the \package{ragged2e}
+% package.
+% Note that these just map to their lower-case variants if the
+% \package{ragged2e} package is not available.
+% \begin{macrocode}
+\DeclareCaptionJustification{Centering}{%
+ \caption@ragged\Centering\centering}
+\DeclareCaptionJustification{RaggedLeft}{%
+ \caption@ragged\RaggedLeft\raggedleft}
+\DeclareCaptionJustification{RaggedRight}{%
+ \caption@ragged\RaggedRight\raggedright}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@ragged}
+% \changes{v3.0p}{2007/04/07}{The `ragged2e' package will now only been
+% loaded when needed}
+% \changes{v3.0q}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced
+% by \cs{caption@Debug}}
+% \changes{v3.1}{2007/04/16}{A different warning will be given on first \LaTeX\ run}
+% |\caption@ragged| will be basically defined as
+% \begin{quote}
+% |\AtBeginDocument{\IfFileExists{ragged2e.sty}%|\\
+% | {\RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}%|\\
+% | {\let\caption@ragged\@secondoftwo}}|
+% \end{quote}
+% but with an additional warning if the ragged2e package is not loaded (yet).
+% (This warning will be type out only one time per option, that's why
+% we need the |caption\string#1| stuff.)
+% Furthermore we load the \package{ragged2e} package, if needed and available.
+% \begin{macrocode}
+\newcommand*\caption@ragged{%
+ \caption@Debug{We need ragged2e}%
+ \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}%
+ \global\let\caption@ragged\caption@@ragged
+ \caption@ragged}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \@ifundefined{caption@r@ragged2e}{%
+ \newcommand*\caption@@ragged{%
+ \caption@Warning{%
+ `ragged2e' support has been changed.\MessageBreak
+ Rerun to get captions right}%
+ \global\let\caption@ragged\@secondoftwo % suppress further warnings
+ \caption@ragged}%
+ }{%
+ \caption@Debug{We load ragged2e}%
+ \IfFileExists{ragged2e.sty}{%
+ \RequirePackage{ragged2e}%
+ \let\caption@@ragged\@firstoftwo
+ }{%
+ \newcommand*\caption@@ragged[2]{%
+ \@ifundefined{caption\string#1}{%
+ \caption@Warning{%
+ `ragged2e' package not loaded, therefore\MessageBreak
+ substituting \string#2 for \string#1\MessageBreak}%
+ \global\@namedef{caption\string#1}}{}%
+ #2}%
+ }%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Vertical spaces before and after captions}
+%
+% \begin{macro}{\abovecaptionskip}
+% \begin{macro}{\belowcaptionskip}
+% Usually these skips are defined within the document class, but some
+% document classes don't do so.
+% \begin{macrocode}
+\@ifundefined{abovecaptionskip}{%
+ \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
+\@ifundefined{belowcaptionskip}{%
+ \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v3.0d}{2005/02/12}{Option \opt{skip=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
+\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
+\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@rule}
+% \changes{v3.1i}{2008/05/06}{This macro added}
+% |\caption@rule|\par
+% Draws an invisible rule to adjust the ``skip'' setting.
+% \begin{macrocode}
+\newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@hrule{\hrule\@height\z@}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1i}{2008/05/06}{Option \opt{rule=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}}
+% \end{macrocode}
+%
+% \subsection{Positioning}
+%
+% These macros handle the right position of the caption.
+% Note that the position is actually \emph{not} controlled by the
+% \package{caption3} kernel options, but by the user (or a specific package
+% like the \package{float} package) instead.
+% The user can put the |\caption| command wherever he likes! So this stuff
+% is only to give us a \emph{hint} where to put the right skips, the user
+% usually has to take care for himself that this hint actually matches the
+% right position.
+%
+% \begin{macrocode}
+\DeclareCaptionOption{position}{\caption@setposition{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setposition}
+% \changes{v3.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b},
+% \opt{below}, and \opt{a} are allowed, too}
+% \changes{v3.0d}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
+% |\caption@setposition|\marg{position}\par
+% Selecting the caption position means that we put |\caption@position| to
+% the right value. \emph{Please do \textbf{not} use the internal macro
+% \cs{caption@position} in your own package or document, but use the wrapper
+% macro \cs{caption@iftop} instead.}
+% \begin{macrocode}
+\newcommand*\caption@setposition[1]{%
+ \caption@ifinlist{#1}{d,default}{%
+ \let\caption@position\caption@defaultpos
+ }{\caption@ifinlist{#1}{t,top,above}{%
+ \let\caption@position\@firstoftwo
+ }{\caption@ifinlist{#1}{b,bottom,below}{%
+ \let\caption@position\@secondoftwo
+ }{\caption@ifinlist{#1}{a,auto}{%
+ \let\caption@position\@undefined
+ }{%
+ \caption@Error{Undefined position `#1'}%
+ }}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defaultpos}
+% \changes{v3.1}{2007/05/08}{Default position changed from `bottom' to `auto'}
+% The default `position' is `auto', this means that \thispackage\ will try
+% to guess the current position of the caption.
+% (But in many cases, for example in |longtable|s, this is doomed to fail!)\par
+% The setting `bottom' correspondents to the |\@makecaption| implementation
+% in the standard \LaTeX\ document classes, but `auto' should give better
+% results in most cases.
+% \begin{macrocode}
+%\caption@setdefaultpos{a}% default = auto
+\let\caption@defaultpos\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftop}
+% \changes{v3.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
+% \changes{v3.0d}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
+% \changes{v3.1}{2007/05/08}{Position will be fixed to `bottom' if `auto'}
+% |\caption@iftop|\marg{true-code}\marg{false-code}\par
+% (If the |position=| is set to |auto| we assume a |bottom| position here.)
+% \begin{macrocode}
+\newcommand*\caption@iftop{%
+ \ifx\caption@position\@undefined
+ \let\caption@position\@secondoftwo
+% = \caption@setposition b%
+ \fi
+ \caption@position}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fixposition}
+% \changes{v3.0b}{2004/05/16}{%
+% Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
+% |\caption@fixposition|\par
+% This macro checks if the `position' is set to `auto'.
+% If yes, |\caption@autoposition| will be called to
+% set |\caption@position| to a proper value we can actually use.
+% \begin{macrocode}
+\newcommand*\caption@fixposition{%
+ \ifx\caption@position\@undefined
+ \caption@autoposition
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@autoposition}
+% \changes{v3.0a}{2004/01/23}{\cs{ifvmode} added}
+% |\caption@autoposition|\par
+% We guess the current position of the caption by checking |\prevdepth|.\par
+% A different solution would be setting the |\spacefactor| to something
+% not much less than 1000 (for example 994) in |\caption@start| and
+% checking this value here by |\ifnum\spacefactor=994|.
+% (It's implemented in the \package{threeparttable}
+% package\cite{threeparttable} this way.)\par
+% Another idea would be checking |\@ifminipage|, but since some packages
+% typeset the caption within a simple |\vbox| this does not seem to be a
+% good one.
+% \begin{macrocode}
+\newcommand*\caption@autoposition{%
+ \ifvmode
+ \edef\caption@tempa{\the\prevdepth}%
+ \caption@Debug{\protect\prevdepth=\caption@tempa}%
+ \ifdim\prevdepth>-\p@
+ \let\caption@position\@secondoftwo
+ \else
+ \let\caption@position\@firstoftwo
+ \fi
+% = \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}%
+ \else
+ \caption@Debug{no \protect\prevdepth}%
+ \let\caption@position\@secondoftwo
+% = \caption@setposition b%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@setautoposition}
+% \changes{v3.1}{2007/06/10}{This macro added}
+% |\caption@setautoposition|\marg{position}\par
+% replaces the above algorithm by a different one (or a fixed position setting).
+% \begin{macrocode}
+\newcommand*\caption@setautoposition[1]{%
+ \def\caption@autoposition{\caption@setposition{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Hooks}
+%
+% \begin{macro}{\AtBeginCaption}
+% \begin{macro}{\AtEndCaption}
+% |\AtBeginCaption| \marg{code}\\
+% |\AtEndCaption| \marg{code}\par
+% These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|.
+% \begin{macrocode}
+\newcommand*\caption@beginhook{}
+\newcommand*\caption@endhook{}
+\newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook}
+\newcommand*\AtEndCaption{\l@addto@macro\caption@endhook}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Lists}
+%
+% \changes{v3.0b}{2004/05/16}{Option \opt{listof=} added}
+% \changes{v3.1f}{2007/11/17}{Option \opt{list=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{list}[1]{\caption@setlist{#1}}
+\DeclareCaptionOption{listof}[1]{\caption@setlist{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlist}
+% \changes{v3.1g}{2008/03/20}{This macro added}
+% |\caption@setlist|\marg{boolean}
+% \begin{macrocode}
+\newcommand*\caption@setlist{\caption@set@bool\caption@iflist}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionListFormat}
+% \changes{v3.1}{2004/07/15}{This macro added}
+% \changes{v3.1f}{2007/11/17}{Renamed from \cs{DeclareCaptionListOfFormat} to \cs{DeclareCaptionListFormat}}
+% |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionListFormat[2]{%
+ \global\@namedef{caption@lstfmt@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionListFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1}{2007/07/15}{Option \opt{listofformat=} added}
+% \changes{v3.1f}{2007/11/17}{Option \opt{listofformat=} renamed to \opt{listformat=}}
+% \begin{macrocode}
+\DeclareCaptionOption{listformat}{\caption@setlistformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlistformat}
+% \changes{v3.1}{2004/07/15}{This macro added}
+% \changes{v3.1f}{2007/11/17}{Renamed from \cs{caption@setlistofformat} to \cs{caption@setlistformat}}
+% |\caption@setlistformat|\marg{name}\par
+% Selecting a caption list format simply means saving the code (in |\caption@lstfmt|).
+% \begin{macrocode}
+\newcommand*\caption@setlistformat[1]{%
+ \@ifundefined{caption@lstfmt@#1}%
+ {\caption@Error{Undefined list format `#1'}}%
+ {\expandafter\let\expandafter\caption@lstfmt
+ \csname caption@lstfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are five pre-defined list formats, taken from the \package{subfig} package.
+% \begin{macrocode}
+\DeclareCaptionListFormat{empty}{}
+\DeclareCaptionListFormat{simple}{#1#2}
+\DeclareCaptionListFormat{parens}{#1(#2)}
+\DeclareCaptionListFormat{subsimple}{#2}
+\DeclareCaptionListFormat{subparens}{(#2)}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setdefaultlistformat}
+% \changes{v3.1k}{2009/03/29}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setdefaultlistformat[1]{%
+ \ifx\caption@lstfmt\caption@lstfmt@default
+ \caption@set@default@listformat{#1}%
+ \caption@setlistformat{default}%
+ \else
+ \caption@set@default@listformat{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@default@listformat[1]{%
+ \def\caption@lstfmt@default{\@nameuse{caption@lstfmt@#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `subsimple'.
+% \begin{macrocode}
+\caption@set@default@listformat{subsimple}
+% \end{macrocode}
+%
+% \subsection{Debug option}
+% \changes{v3.0m}{2007/03/04}{Debug option added (kernel)}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{debug}[1]{%
+ \caption@set@bool\caption@ifdebug{#1}%
+ \caption@ifdebug
+ {\def\caption@Debug{\PackageInfo{caption}}}%
+ {\let\caption@Debug\@gobble}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareOption{debug}{\setkeys{caption}{debug}}
+% \end{macrocode}
+% \begin{macrocode}
+\setkeys{caption}{debug=0}
+% \end{macrocode}
+%
+% \subsection{Document classes \& Babel support}
+%
+% \subsubsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes}
+%
+% \begin{macrocode}
+\caption@CheckCommand\@makecaption{%
+ % article|report|book [2005/09/16 v1.4f Standard LaTeX document class]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+%
+% \subsubsection{The \AmS{} \& \SmF{} classes}
+% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added (kernel)}
+%
+% \begin{macrocode}
+\providecommand*\caption@ifamsclass{%
+ \@ifundefined{@captionheadfont}\@gobble\@firstofone}
+\@onlypreamble\caption@ifamsclass
+% \end{macrocode}
+% \begin{macrocode}
+\caption@ifamsclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % amsart|amsproc|amsbook [2004/08/06 v2.20]
+ \long\def\@makecaption#1#2{%
+ \setbox\@tempboxa\vbox{\color@setgroup
+ \advance\hsize-2\captionindent\noindent
+ \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
+ {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}%
+ \unskip\kern-2\captionindent\par
+ \global\setbox\@ne\lastbox\color@endgroup}%
+ \ifhbox\@ne % the normal case
+ \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
+ \fi
+ \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
+ \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
+ \else % tempboxa contained more than one line
+ \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip
+ \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
+ \fi
+ \ifnum\@tempcnta<64 % if the float IS a figure...
+ \addvspace\abovecaptionskip
+ \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
+ \else % if the float IS NOT a figure...
+ \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
+ \nobreak
+ \vskip\belowcaptionskip
+ \fi
+ \relax
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % smfart|smfbook [1999/11/15 v1.2f Classe LaTeX pour les articles publies par la SMF]
+ \long\def\@makecaption#1#2{%
+ \ifdim\captionindent>.1\hsize \captionindent.1\hsize \fi
+ \setbox\@tempboxa\vbox{\color@setgroup
+ \advance\hsize-2\captionindent\noindent
+ \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
+ {\@cdr#2\@nil}{\@addpunct{.}\@captionfont\upshape\enspace#2}%
+ \unskip\kern-2\captionindent\par
+ \global\setbox\@ne\lastbox\color@endgroup}%
+ \ifhbox\@ne % the normal case
+ \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
+ \fi
+ \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
+ \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
+ \@tempdima\wd\@ne\advance\@tempdima-\captionindent
+ \wd\@ne\@tempdima
+ \else % tempboxa contained more than one line
+ \setbox\@ne\vbox{\rightskip=0pt plus\captionindent\relax
+ \unvbox\@tempboxa\parskip\z@skip
+ \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
+ \fi
+ \ifnum\@tempcnta<64 % if the float IS a figure...
+ \addvspace\abovecaptionskip
+ \noindent\kern\captionindent\box\@ne
+ \else % if the float IS NOT a figure...
+ \noindent\kern\captionindent\box\@ne
+ \nobreak
+ \vskip\belowcaptionskip
+ \fi
+ \relax
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+ \let\captionmargin\captionindent % set to 3pc by AMS class
+ \begingroup\edef\@tempa{\endgroup
+ \noexpand\caption@g@addto@list\noexpand\caption@sty@default
+ {margin=\the\captionmargin
+ \@ifundefined{smf@makecaption}{}{,maxmargin=.1\linewidth}}}
+ \@tempa
+ \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin}
+ \DeclareCaptionLabelSeparator{default}{.\enspace}
+ \DeclareCaptionDefaultFont{font}{\@captionfont}
+ \DeclareCaptionDefaultFont{labelfont}{\@captionheadfont}
+ \DeclareCaptionDefaultFont{textfont}{\@captionfont\upshape}
+ \captionsetup[figure]{position=b}
+ \captionsetup[table]{position=t}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The beamer class}
+% \changes{v3.1}{2007/03/10}{beamer class support added (kernel)}
+%
+% \begin{macrocode}
+\providecommand*\caption@ifbeamerclass{%
+ \@ifclassloaded{beamer}\@firstofone\@gobble}
+\@onlypreamble\caption@ifbeamerclass
+% \end{macrocode}
+% \begin{macrocode}
+\caption@ifbeamerclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\beamer@makecaption{%
+ % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
+ \long\def\beamer@makecaption#1#2{%
+ \def\insertcaptionname{\csname#1name\endcsname}%
+ \def\insertcaptionnumber{\csname the#1\endcsname}%
+ \def\insertcaption{#2}%
+ \nobreak\vskip\abovecaptionskip\nobreak
+ \sbox\@tempboxa{\usebeamertemplate**{caption}}%
+ \ifdim \wd\@tempboxa >\hsize
+ \usebeamertemplate**{caption}\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \nobreak\vskip\belowcaptionskip\nobreak}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionLabelFormat{default}{#1}
+ \DeclareCaptionDefaultJustification{\raggedright}
+ \DeclareCaptionDefaultFont{font}{%
+ \usebeamerfont*{caption}%
+ \usebeamercolor[fg]{caption}}
+ \DeclareCaptionDefaultFont{labelfont}{%
+ \usebeamercolor[fg]{caption name}%
+ \usebeamerfont*{caption name}}
+% \end{macrocode}
+% If the \package{beamer} document class is used, we offer a beamer
+% template called `caption3' which can be used with option `beamer' or
+% |\setbeamertemplate{caption}[caption3]|.\par
+% (Note that this is of no use when \thispackage\ is used, too.)
+% \begin{macrocode}
+ \defbeamertemplate{caption}{caption3}{%
+ \caption@make\insertcaptionname\insertcaptionnumber\insertcaption}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareOption{beamer}{%
+ % \usebeamertemplate**{caption} will set font
+ \DeclareCaptionDefaultFont{font}{}%
+ \setbeamertemplate{caption}[caption3]}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The \KOMAScript{} classes}
+% \changes{v3.1}{2007/03/31}{\KOMAScript\ classes support added (kernel)}
+%
+% \begin{macrocode}
+\providecommand*\caption@ifkomaclass{%
+ \@ifundefined{scr@caption}\@gobble\@firstofone}
+\@onlypreamble\caption@ifkomaclass
+% \end{macrocode}
+% \begin{macrocode}
+\caption@ifkomaclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % scrartcl|scrreprt|scrbook [2007/03/07 v2.97a KOMA-Script document class]
+ \long\def\@makecaption#1#2{%
+ \if@captionabove
+ \vskip\belowcaptionskip
+ \else
+ \vskip\abovecaptionskip
+ \fi
+ \@@makecaption\@firstofone{#1}{#2}%
+ \if@captionabove
+ \vskip\abovecaptionskip
+ \else
+ \vskip\belowcaptionskip
+ \fi}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionFormat{default}[#1#2#3\par]{%
+ \ifdofullc@p
+ \caption@ifin@list\caption@lsepcrlist\caption@lsepname
+ {\caption@Error{%
+ The option `labelsep=\caption@lsepname' does not work\MessageBreak
+ with \noexpand\setcaphanging (which is set by default)}}%
+ {\caption@fmt@hang{#1}{#2}{#3}}%
+ \else
+ #1#2%
+ \ifdim\cap@indent<\z@
+ \par
+ \noindent\hspace*{-\cap@indent}%
+ \else\if@capbreak
+ \par
+ \fi\fi
+ #3\par
+ \fi}
+ \DeclareCaptionLabelSeparator{default}{\captionformat}
+ \DeclareCaptionDefaultFont{font}{\scr@fnt@caption}
+ \DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The \NTG{} Dutch classes}
+% \changes{v3.1}{2007/04/06}{NTG classes support added (kernel)}
+%
+% \begin{macrocode}
+\providecommand*\caption@ifntgclass{%
+ \@ifundefined{CaptionFonts}\@gobble\@firstofone}
+\@onlypreamble\caption@ifntgclass
+% \end{macrocode}
+% \begin{macrocode}
+\caption@ifntgclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % artikel|rapport|boek [2004/06/07 v2.1a NTG LaTeX document class]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{{\CaptionLabelFont#1:} \CaptionTextFont#2}%
+ \ifdim \wd\@tempboxa >\hsize
+ {\CaptionLabelFont#1:} \CaptionTextFont#2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont}
+ \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The thesis class}
+% \changes{v3.1g}{2008/01/31}{thesis class support added (kernel)}
+% \changes{v3.1l}{2009/11/15}{Bugfix 09-11-14: thesis class support revised (kernel)}
+%
+% \begin{macrocode}
+\providecommand*\caption@ifthesisclass{%
+ \@ifundefined{cph@font}{\@gobble}{\@ifundefined{cpb@font}\@gobble\@firstofone}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@ifthesisclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % thesis.cls 1996/25/01 1.0g LaTeX document class (wm).
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \setbox\@tempboxa\hbox{{\cph@font #1:} {\cpb@font #2}}%
+ \ifdim \wd\@tempboxa >\hsize
+ \@hangfrom{\cph@font #1: }{\cpb@font #2\par}%
+ \else
+ \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFormat{hang}
+ \DeclareCaptionDefaultFont{labelfont}{\cph@font}
+ \DeclareCaptionDefaultFont{textfont}{\cpb@font}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The frenchb Babel option}
+% \changes{v3.1}{2006/05/14}{\package{frenchb} package support added (kernel)}
+%
+% \begin{macrocode}
+\@ifundefined{FB@makecaption}{}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % frenchb.ldf [2005/02/06 v1.6g French support from the babel system]
+ % frenchb.ldf [2007/10/05 v2.0e French support from the babel system]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1\CaptionSeparator #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1\CaptionSeparator #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\@makecaption\STD@makecaption
+ \DeclareCaptionLabelSeparator{default}{\CaptionSeparator}
+ \def\caption@frenchb{% supress frenchb warning
+ \let\STD@makecaption\@makecaption
+ \let\FB@makecaption\@makecaption}
+ \else
+ \ifx\@makecaption\@undefined\else
+ \PackageInfo{caption}{%
+ The definition of \protect\@makecaption\space
+ has been changed,\MessageBreak
+ frenchb will NOT customize it}%
+ \fi
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The frenchle/pro package}
+% \changes{v3.1}{2006/05/14}{\package{frenchle/pro} package support added (kernel)}
+%
+% \begin{macrocode}
+\@ifundefined{frenchTeXmods}{}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % french(le).sty [2006/10/03 The french(le) package /V5,9991/]
+ % french(le).sty [2007/06/28 The french(le) package /V5,9994/]
+ \def\@makecaption#1#2{%
+ \ifFTY%
+ \def\@secondofmany##1##2\void{##2}%
+ \def\@tempa{\@secondofmany#2\void}%
+ \ifx\@tempa\empty%
+ \let\captionseparator\empty%
+ \fi%
+ \@mcORI{#1}{\relax\captionfont{#2}}%
+ \else
+ \@mcORI{#1}{#2}%
+ \fi}}
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % french(le).sty [2007/02/11 The french(le) package /V5,9993/]
+ \def\@makecaption#1#2{%
+ \ifFTY%
+ \def\@secondofmany##1##2\void{##2}%
+ \protected@edef\@tempa{\@secondofmany#2\void}%
+ \ifx\@tempa\empty%
+ \let\captionseparator\empty%
+ \fi%
+ \@mcORI{#1}{\relax\captionfont{#2}}%
+ \else
+ \@mcORI{#1}{#2}%
+ \fi}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{textfont}{\itshape}%
+ \DeclareCaptionLabelSeparator{default}{\captionseparator\space}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \iffalse
+% \subsubsection{The hungarian and magyar Babel option}
+% \changes{v3.2}{2009/03/29}{\package{magyar} package support added (kernel)}
+%
+% \begin{macrocode}
+\DeclareCaptionListFormat{subperiod}{#2.}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%%% \def\caption@tempa#1{\@ifundefined{extras#1}{}{%
+%%% \expandafter\addto\csname extras#1\endcsname{%
+%%% % reverse changes made by magyar.ldf
+%%% \let\@makecaption\caption@makecaption
+%%% \babel@save\@makecaption
+%%% \caption@redefine
+%%% \babel@save\@caption
+%%% % change default labelsep and listformat
+%%% \caption@setdefaultlabelsep{period}%
+%%% \caption@setdefaultlistformat{subperiod}}%
+%%% \expandafter\addto\csname noextras#1\endcsname{%
+%%% % change default labelsep and listformat
+%%% \caption@setdefaultlabelsep{colon}%
+%%% \caption@setdefaultlistformat{subsimple}}%
+%%% }}
+% \end{macrocode}
+% \begin{macrocode}
+%%% \caption@tempa{hungarian}
+%%% \caption@tempa{magyar}
+% \end{macrocode}
+% \fi
+%
+% \subsection{Execution of options}
+%
+% \begin{macrocode}
+\captionsetup{style=default,position=default,%
+ list,listformat=default,twoside=\if@twoside 1\else 0\fi}
+% \end{macrocode}
+% \begin{macrocode}
+\ProcessOptions*
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/04/10}{Check of document class added}
+% \begin{macrocode}
+\caption@IfCheckCommand{%
+ \caption@setbool{documentclass}{1}%
+}{%
+ \caption@setbool{documentclass}{0}%
+ \PackageInfo{caption}{%
+ Unknown document class (or package),\MessageBreak
+ standard defaults will be used}%
+ \caption@Debug{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}%
+}
+% \end{macrocode}
+%
+% \subsection{Making an `List of' entry}
+%
+% \begin{macro}{\caption@addcontentsline}
+% \changes{v3.1}{2007/07/01}{This macro added}
+% |\caption@addcontentsline|\marg{type}\marg{list entry}\par
+% Makes an entry in the list-of-whatever, if requested,
+% i.e.~the argument \meta{list entry} is not empty and
+% |listof=| was set to |true|.
+% \begin{macrocode}
+\newcommand*\caption@addcontentsline[2]{%
+ \caption@iflist
+ {\def\@tempa{#2}}%
+ {\let\@tempa\@empty}%
+ \ifx\@tempa\@empty \else
+ {\let\\\space
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline
+ {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}%
+ {\ignorespaces #2}}}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Typesetting the caption}
+%
+% \begin{macro}{\ifcaption@star}
+% If the starred form of |\caption| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@@make|.)
+% \begin{macrocode}
+\newif\ifcaption@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fnum}
+% \changes{v3.1}{2007/08/21}{This macro added}
+% |\caption@fnum|\marg{float type}\par
+% Typesets the caption label; as replacement for |\fnum@|\meta{float type}.
+% \begin{macrocode}
+\newcommand*\caption@fnum[1]{\caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@make}
+% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\par
+% Typesets the caption.
+% \begin{macrocode}
+\newcommand\caption@make[2]{\caption@@make{\caption@lfmt{#1}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@make}
+% \changes{v3.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
+% \changes{v3.0d}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of
+% \cs{captionmargin} resp. \cs{captionwidth}; check for \cs{z@} added}
+% \changes{v3.0d}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end
+% of caption added}
+% \changes{v3.0d}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
+% \changes{v3.0d}{2005/02/12}{Single-line-check moved up so it can affect margins now}
+% \changes{v3.0d}{2005/02/09}{Improvement: \cs{caption@ifh} added}
+% \changes{v3.0d}{2005/02/09}{Bugfix: \cs{leavevmode} added}
+% \changes{v3.0h}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
+% \changes{v3.0i}{2005/12/04}{Uses \cs{caption@slc} now}
+% \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside
+% single-line-check replaced by \cs{relax}}
+% \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be
+% typeset in horizontal mode}
+% \changes{v3.0k}{2006/05/13}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox}}
+% \changes{v3.0l}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v3.0j, re-added}
+% \changes{v3.0p}{2007/04/03}{Usage of \cs{caption@ifoddpage} added}
+% \changes{v3.1}{2007/07/29}{\cs{caption@calcmargin} moved below single-line-check}
+% \changes{v3.1e}{2007/10/28}{\cs{caption@stepcounter} added}
+% |\caption@@make|\marg{caption label}\marg{caption text}
+% \begin{macrocode}
+\newcommand\caption@@make[2]{%
+ \begingroup
+ \caption@stepcounter
+ \caption@beginhook
+% \end{macrocode}
+%
+% Check margin, if |\caption@minmargin| or |\caption@maxmargin| is set
+% \begin{macrocode}
+ \ifx\caption@maxmargin\@undefined \else
+ \ifdim\captionmargin>\caption@maxmargin\relax
+ \captionmargin\caption@maxmargin\relax
+ \fi
+ \fi
+ \ifx\caption@minmargin\@undefined \else
+ \ifdim\captionmargin<\caption@minmargin\relax
+ \captionmargin\caption@minmargin\relax
+ \fi
+ \fi
+% \end{macrocode}
+%
+% Special single-line treatment (option |singlelinecheck=|)
+% \begin{macrocode}
+ \caption@ifslc{\caption@slc{#1}{#2}\captionwidth\relax}{}%
+% \end{macrocode}
+%
+% Typeset the left margin (option |margin=|)
+% \begin{macrocode}
+ \caption@calcmargin
+ \@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}%
+ \fi
+ \caption@ifh{\advance\@tempdima\caption@indent}%
+ \hspace\@tempdima
+% \end{macrocode}
+%
+% We actually use a |\vbox| of width |\captionwidth - \caption@indent|
+% to typeset the caption.
+% \Note{\cs{captionindent} is \emph{not} supported if the caption format
+% was defined with \cs{DeclareCaptionFormat*}.}
+% \begin{macrocode}
+ \@tempdima\captionwidth
+ \caption@ifh{\advance\@tempdima-\caption@indent}%
+ \caption@parbox\@tempdima{%
+% \end{macrocode}
+%
+% Typeset the indention (option |indention=|)\\
+% {\small Bugfix 04-05-05:
+% |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots}
+% \begin{macrocode}
+ \caption@ifh{%
+ \ifdim\caption@indent=\z@
+ \leavevmode
+ \else
+ \hskip-\caption@indent
+ \fi}%
+% \end{macrocode}
+%
+% Typeset the caption itself and close the |\caption@parbox|
+% \begin{macrocode}
+ \caption@@@make{#1}{#2}}%
+% \end{macrocode}
+%
+% Typeset the right margin (option |margin=|)
+% \begin{macrocode}
+ \@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}%
+ \fi
+ \hspace\@tempdima
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@endhook
+ \endgroup
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \global\caption@starfalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@calcmargin}
+% \changes{v3.0h}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by
+% \cs{ifdim}\cs{captionwidth=}\cs{z@}}
+% \changes{v3.0i}{2006/01/12}{Improvement: Takes care of list environment now}
+% \changes{v3.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore),
+% use \cs{linewidth} instead of \cs{hsize}}
+% |\caption@calcmargin|\par
+% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
+% values.
+% \begin{macrocode}
+\newcommand*\caption@calcmargin{%
+ \ifdim\captionwidth=\z@
+ \captionwidth\linewidth
+ \advance\captionwidth by -2\captionmargin
+ \advance\captionwidth by -\captionmargin@
+ \else
+ \captionmargin\linewidth
+ \advance\captionmargin by -\captionwidth
+ \divide\captionmargin by 2
+ \captionmargin@\z@
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{%
+ \string\hsize=\the\hsize,
+ \string\linewidth=\the\linewidth,\MessageBreak
+ \string\leftmargin=\the\leftmargin,
+ \string\rightmargin=\the\rightmargin,\MessageBreak
+ \string\margin=\the\captionmargin,
+ \string\margin@=\the\captionmargin@,
+ \string\width=\the\captionwidth}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@slc}
+% \changes{v3.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} added}
+% \changes{v3.1}{2007/07/29}{\cs{caption@setup}\cs{caption@sls} added after \cs{begingroup}}
+% \changes{v3.1}{2007/07/29}{\cs{caption@calcmargin} added}
+% \changes{v3.1c}{2007/10/14}{Support of \cs{caption@slfmt} added}
+% \changes{v3.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% |\caption@slc|\marg{label}\marg{text}\marg{width}\marg{extra code}\par
+% This one does the single-line-check.
+% \begin{macrocode}
+\newcommand\caption@slc[4]{%
+ \caption@Debug{Begin SLC}%
+ \begingroup
+ \caption@singleline
+ \let\caption@hj\@empty
+ \caption@calcmargin % calculate #3 if necessary
+ \caption@prepareslc
+ \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
+ \ifdim\wd\@tempboxa>#3%
+ \endgroup
+ \else
+ \endgroup
+ \caption@singleline
+ #4%
+ \fi
+ \caption@Debug{End SLC}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@singleline{%
+ \caption@xsetup\caption@opt@singleline
+ \let\caption@fmt\caption@slfmt}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareslc}
+% \changes{v3.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
+% \changes{v3.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
+% \changes{v3.0d}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added}
+% \changes{v3.0h}{2005/07/09}{Support of \package{endnotes} package added}
+% \changes{v3.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} moved to \cs{caption@slc}}
+% \changes{v3.1}{2007/06/13}{Redefinition of \cs{(H@)refstepcounter} added}
+% \changes{v3.1}{2007/08/12}{Redefinition of \cs{label} improved}
+% \changes{v3.1c}{2007/10/06}{Definition of \cs{caption@l@stepcounter} added}
+% |\caption@prepareslc|\par
+% Re-define anything which would disturb the single-line-check.
+% \begin{macrocode}
+\newcommand*\caption@prepareslc{%
+ \let\@footnotetext\@gobble\let\@endnotetext\@gobble
+ \def\label{\caption@withoptargs\@gobbletwo}%
+ \let\stepcounter\caption@l@stepcounter
+ \let\refstepcounter\stepcounter\let\H@refstepcounter\stepcounter}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@l@stepcounter[1]{\advance\csname c@#1\endcsname\@ne\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@parbox}
+% \changes{v3.0k}{2006/05/13}{We define \cs{caption@parbox} instead of
+% \cs{caption@start/endbox}}
+% \changes{v3.0n}{2006/03/09}{Bugfix 07-03-09: \cs{caption@parbox} changed from
+% \cs{parbox-t} to \cs{parbox-b}}
+% \changes{v3.1f}{2007/11/11}{Renamed from \cs{captionbox} to \cs{caption@parbox}}
+% |\caption@parbox|\marg{width}\marg{contents}\par
+% This macro defines the box which surrounds the caption paragraph.
+% \begin{macrocode}
+\newcommand*\caption@parbox{\parbox[b]}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@make}
+% \changes{v3.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
+% \changes{v3.0d}{2005/02/12}{Bugfix 04-12-16: Use some kind of
+% \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
+% \changes{v3.0d}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
+% \changes{v3.0e}{2005/05/05}{Use \cs{caption@ifempty};
+% \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
+% \changes{v3.0e}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
+% \changes{v3.0h}{2005/08/24}{Check for empty label added}
+% \changes{v3.0h}{2005/08/25}{\cs{caption@iflf} added}
+% \changes{v3.0l}{2007/02/18}{Usage of \cs{caption@tfmt} added}
+% \changes{v3.1}{2007/05/07}{Bugfix: \cs{ifhmode} added to \cs{@finalstrut}}
+% \changes{v3.1f}{2007/11/17}{Made option \opt{size=} stronger than \opt{font=}}
+% |\caption@@@make|\marg{caption label}\marg{caption text}\par
+% This one finally typesets the caption paragraph, without margin and indention.
+% \begin{macrocode}
+\newcommand\caption@@@make[2]{%
+% \end{macrocode}
+%
+% If the label is empty, we use no caption label separator.
+% \begin{macrocode}
+ \sbox\@tempboxa{#1}%
+ \ifdim\wd\@tempboxa=\z@
+ \let\caption@lsep\relax
+% \@capbreakfalse
+ \fi
+% \end{macrocode}
+%
+% If the text is empty, we use no caption label separator, too.
+% \begin{macrocode}
+ \caption@ifempty{#2}{%
+ \let\caption@lsep\relax
+% \@capbreakfalse
+% \let\caption@ifstrut\@secondoftwo
+ }%
+% \end{macrocode}
+%
+% Take care that |\caption@parindent| and |\caption@hangindent| will be used
+% to typeset the paragraph.
+% \begin{macrocode}
+ \@setpar{\@@par\caption@@par}\caption@@par
+% \end{macrocode}
+%
+% Finally typeset the caption.
+% \begin{macrocode}
+ \caption@hj\captionfont\captionsize\caption@fmt
+ {\ifcaption@star\else{\captionlabelfont#1}\fi}%
+ {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}%
+ {{\captiontextfont
+ \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
+ \nobreak\hskip\z@skip % enable hyphenation
+ \caption@tfmt{#2}%
+% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
+ \caption@ifstrut{\ifhmode\@finalstrut\strutbox\fi}{}%
+ \par}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty}
+% \changes{v3.0e}{2005/05/05}{This macro added}
+% \changes{v3.1}{2007/07/04}{Re-defines itself now}
+% \changes{v3.1g}{2007/01/22}{Revised so \cs{label} will be detected, too}
+% \changes{v3.1i}{2008/08/02}{Revised so \cs{index} and \cs{glossary} will be detected, too}
+% |\caption@ifempty|\marg{text}\marg{true} (\emph{no} \meta{false})\par
+% This one tests if the \meta{text} is actually empty.
+% \Note{This will be done without expanding the text,
+% therefore this is far away from being bullet-proof.}
+% \Note{This macro is re-defining itself so only
+% the first test (in a group) will actually be done.}
+% \begin{macrocode}
+\newcommand\caption@ifempty[1]{%
+ \caption@if@empty{#1}%
+ \caption@ifempty\@unused}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@if@empty[1]{%
+ \def\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \expandafter\def\expandafter\caption@tempa\expandafter{%
+ \caption@car#1\caption@if@empty\caption@nil}%
+ \def\caption@tempb{\caption@if@empty}%
+ \ifx\caption@tempa\caption@tempb
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \def\caption@tempb{\ignorespaces}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobble#1}%
+ \else
+ \def\caption@tempb{\label}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\index}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\glossary}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \let\caption@ifempty\@gobbletwo
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@par}
+% \changes{v3.0h}{2005/08/22}{Made this definition global}
+% |\caption@@par|\par
+% This command will be executed with every |\par| inside the caption.
+% \begin{macrocode}
+\newcommand*\caption@@par{%
+ \parindent\caption@parindent\hangindent\caption@hangindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Types \& sub-types}
+%
+% \begin{macro}{\DeclareCaptionType}
+% \changes{v3.1}{2007/08/12}{This macro added}
+% \changes{v3.1a}{2007/09/07}{Three optional arguments added}
+% \changes{v3.1f}{2007/12/06}{Renamed from \cs{DeclareFloatingEnvironment} to \cs{DeclareCaptionType}}
+% \changes{v3.1f}{2007/12/21}{Optional argument revised, uses key-value syntax now}
+% \changes{v3.1i}{2008/04/13}{Uses \cs{caption@within@default} now}
+% \changes{v3.1i}{2008/08/02}{Support of \cs{float@exts} and \cs{float@addtolists} added}
+% \changes{v3.1l}{2010/01/09}{Usage of \cs{caption@DeclareWithinOption} added}
+% |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionType{%
+ \@testopt\@DeclareCaptionType{}}
+\@onlypreamble\DeclareCaptionType
+% \end{macrocode}
+% \begin{macrocode}
+\def\@DeclareCaptionType[#1]#2{%
+ \def\caption@type{#2}%
+ \caption@Debug{New type `#2'}%
+ \newcounter{#2}\@namedef{theH#2}{}%
+ \KV@caption@DCT@within\caption@within@default
+ \caption@DeclareWithinOption{#2}%
+ \KV@caption@DCT@placement{tbp}%
+ \@ifundefined{c@float@type}%
+ {\newcounter{float@type}%
+ \setcounter{float@type}{\@ifundefined{c@figure}14}}%
+ {}%
+ \caption@Debug{float type `#2'=\the\value{float@type}}%
+ \expandafter\xdef\csname ftype@#2\endcsname{\the\value{float@type}}%
+ \addtocounter{float@type}{\value{float@type}}%
+ \KV@caption@DCT@fileext{lo#2}%
+ \@namedef{fnum@#2}{\@nameuse{#2name}\nobreakspace\@nameuse{the#2}}%
+ \newenvironment{#2}{\@float{#2}}{\end@float}%
+ \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}%
+ \expandafter\newcommand\csname listof#2s\endcsname{\caption@listof{#2}}%
+ \@ifundefined{l@figure}%
+ {\@namedef{l@#2}{\@dottedtocline{1}{1.5em}{2.3em}}}%
+ {\expandafter\let\csname l@#2\endcsname\l@figure}%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\newcommand\csname #2name\endcsname{}%
+ \edef\@tempa{\def\noexpand\@tempa{\@car#2\@nil}}%
+ \uppercase\expandafter{\@tempa}%
+ \edef\@tempb{\noexpand\g@addto@macro\noexpand\@tempa{\@cdr#2\@nil}}%
+ \@tempb
+ \expandafter\let\csname #2name\endcsname\@tempa
+ \expandafter\newcommand\csname list#2name\endcsname{}%
+ \expandafter\xdef\csname list#2name\endcsname{List of \@tempa s}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@cons\caption@typelist{{#2}}%
+ \caption@setkeys[caption]{caption@DCT}{#1}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@ifundefined{float@exts}{\newtoks\float@exts}{}%
+ \let\float@do=\relax
+ \edef\@tempa{\noexpand\float@exts{\the\float@exts\float@do{\@nameuse{ext@#2}}}}%
+ \@tempa
+ \@ifundefined{float@addtolists}{%
+ \newcommand\float@addtolists[1]{%
+ \def\float@do####1{\addtocontents{####1}{##1}}\the\float@exts}%
+ \@ifundefined{@chapter}{}{\caption@PatchChapter}}{}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@ifnextchar[\@@DeclareCaptionType\relax}
+\@onlypreamble\@DeclareCaptionType
+% \end{macrocode}
+% \begin{macrocode}
+\def\@@DeclareCaptionType[#1]{%
+ \KV@caption@DCT@name{#1}%
+ \@ifnextchar[\@@@DeclareCaptionType\relax}
+\@onlypreamble\@@DeclareCaptionType
+% \end{macrocode}
+% \begin{macrocode}
+\def\@@@DeclareCaptionType[#1]{%
+ \KV@caption@DCT@listname{#1}}
+\@onlypreamble\@@@DeclareCaptionType
+% \end{macrocode}
+% \begin{macrocode}
+\let\DeclareFloatingEnvironment\DeclareCaptionType % old command name
+\@onlypreamble\DeclareFloatingEnvironment
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@within@default}
+% \changes{v3.1i}{2008/04/13}{This macro added}
+% The default `within' value.
+% \begin{macrocode}
+\newcommand*\caption@within@default{\@ifundefined{c@chapter}{none}{chapter}}
+\@onlypreamble\caption@within@default
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@listof}
+% \changes{v3.1f}{2007/12/21}{This macro added}
+% |\caption@listof|\marg{float type}
+% \begin{macrocode}
+\newcommand*\caption@listof[1]{%
+ \begingroup
+ \expandafter\let\expandafter\listfigurename\csname list#1name\endcsname
+ \expandafter\let\expandafter\ext@figure\csname ext@#1\endcsname
+ \let\caption@ORI@starttoc\@starttoc
+ \renewcommand*\@starttoc[1]{%
+ \expandafter\caption@ORI@starttoc\expandafter{\ext@figure}}%
+ \listoffigures
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@typelist}
+% An \cs{@elt}-list containing the caption types defined
+% with |\Declare|\x|Caption|\x|Type|.
+% \begin{macrocode}
+\newcommand*\caption@typelist{}
+% \end{macrocode}
+% \end{macro}
+%
+% The available \meta{options} are:
+% |fileext=|\meta{file extension},
+% |listname=|\meta{list name},
+% |name=|\meta{prosa name},
+% |placement=|\meta{htbp},
+% |within=|\meta{none,chapter,section}, and
+% |without|.
+% \begin{macrocode}
+\define@key{caption@DCT}{fileext}{\@namedef{ext@\caption@type}{#1}}
+\@onlypreamble@key{caption@DCT}{fileext}
+\define@key{caption@DCT}{listname}{\@namedef{list\caption@type name}{#1}}
+\@onlypreamble@key{caption@DCT}{listname}
+\define@key{caption@DCT}{name}{\@namedef{\caption@type name}{#1}}
+\@onlypreamble@key{caption@DCT}{name}
+\define@key{caption@DCT}{placement}{\@namedef{fps@\caption@type}{#1}}
+\@onlypreamble@key{caption@DCT}{placement}
+\define@key{caption@DCT}{within}{%
+ \@ifundefined{c@chapter}{}{\@removefromreset\caption@type{chapter}}%
+ \@removefromreset\caption@type{section}%
+ \begingroup
+ \caption@setkeys[caption]{caption@within}{#1}%
+ \endgroup}
+%\@onlypreamble@key{caption@DCT}{within}
+\define@key{caption@DCT}{without}{\KV@caption@DCT@within{none}}
+%\@onlypreamble@key{caption@DCT}{without}
+% \end{macrocode}
+% \changes{v3.1k}{2009/03/29}{Bugfix 08-09-25: \texttt{within=section} fixed}
+% \begin{macrocode}
+\define@key{caption@within}{none}[]{%
+ \caption@within{}{}}
+%\@onlypreamble@key{caption@within}{none}
+\define@key{caption@within}{section}[]{%
+ \@addtoreset\caption@type{section}%
+ \caption@within{\ifnum\c@section>\z@ \thesection.\fi}{\theHsection.}}
+%\@onlypreamble@key{caption@within}{section}
+\@ifundefined{c@chapter}{}{%
+ \define@key{caption@within}{chapter}[]{%
+ \@addtoreset\caption@type{chapter}%
+ \caption@within{\ifnum\c@chapter>\z@ \thechapter.\fi}{\theHchapter.}}
+}% \@onlypreamble@key{caption@within}{chapter}}
+% \end{macrocode}
+% \begin{macro}{\caption@within}
+% \changes{v3.1f}{2007/12/21}{This macro added}
+% |\caption@within|\marg{thecode}\marg{theHcode}
+% \begin{macrocode}
+\newcommand*\caption@within{%
+ \expandafter\caption@within@\expandafter{\caption@type}}
+%\@onlypreamble\caption@within
+\newcommand*\caption@within@[3]{%
+ \global\@namedef{the#1}{#2\arabic{#1}}%
+ \@ifundefined{theH#1}\caption@AtBeginDocument\@firstofone
+ {\global\@namedef{theH#1}{#3\arabic{#1}}}}
+%\@onlypreamble\caption@within@
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@removefromreset}
+% \changes{v3.1f}{2007/12/21}{This macro added}
+% This code was taken from the \package{remreset} package
+% which is part of the `carlisle' package bundle.
+% (Copyright 1997 David Carlisle)
+% \begin{macrocode}
+\providecommand*\@removefromreset[2]{{%
+ \expandafter\let\csname c@#1\endcsname\@removefromreset
+ \def\@elt##1{%
+ \expandafter\ifx\csname c@##1\endcsname\@removefromreset
+ \else
+ \noexpand\@elt{##1}%
+ \fi}%
+ \expandafter\xdef\csname cl@#2\endcsname{%
+ \csname cl@#2\endcsname}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@PatchChapter}
+% \changes{v3.1i}{2008/08/02}{This macro added}
+% We try to patch \cs{@chapter} so \cs{float@addtolists} will be supported.
+% (Note: The \KOMAScript\ classes already support \cs{float@addtolists}.)
+% \begin{macrocode}
+\newcommand*\caption@PatchChapter{%
+ \providecommand*\@chapterlistsgap{10\p@}%
+% \end{macrocode}
+% \begin{macrocode}
+ % report.cls [2005/09/16 v1.4f Standard LaTeX document class]
+ \caption@patch@chapter{report}{%
+ \ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}##1}%
+ \else
+ \addcontentsline{toc}{chapter}{##1}%
+ \fi
+ \chaptermark{##1}%
+ \addtocontents{lof}{\protect\addvspace{10\p@}}%
+ \addtocontents{lot}{\protect\addvspace{10\p@}}%
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]%
+ \else
+ \@makechapterhead{##2}%
+ \@afterheading
+ \fi
+ }{%
+ \ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}##1}%
+ \else
+ \addcontentsline{toc}{chapter}{##1}%
+ \fi
+ \chaptermark{##1}%
+ \ifdim \@chapterlistsgap>\z@
+ \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
+ \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
+ \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
+ \fi
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]%
+ \else
+ \@makechapterhead{##2}%
+ \@afterheading
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ % book.cls [2005/09/16 v1.4f Standard LaTeX document class]
+ \caption@patch@chapter{book}{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}##1}%
+ \else
+ \addcontentsline{toc}{chapter}{##1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{##1}%
+ \fi
+ \chaptermark{##1}%
+ \addtocontents{lof}{\protect\addvspace{10\p@}}%
+ \addtocontents{lot}{\protect\addvspace{10\p@}}%
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]%
+ \else
+ \@makechapterhead{##2}%
+ \@afterheading
+ \fi
+ }{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}##1}%
+ \else
+ \addcontentsline{toc}{chapter}{##1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{##1}%
+ \fi
+ \chaptermark{##1}%
+ \ifdim \@chapterlistsgap>\z@
+ \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
+ \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
+ \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
+ \fi
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]%
+ \else
+ \@makechapterhead{##2}%
+ \@afterheading
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ % amsbook.cls [2004/08/06 v2.20]
+ % smfbook.cls [1999/11/15 v1.2f Classe LaTeX pour les monographies editees par la SMF]
+ \caption@patch@chapter{ams/smfbook}{%
+ \refstepcounter{chapter}%
+ \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
+ \else \let\@secnumber\thechapter \fi
+ \typeout{\chaptername\space\@secnumber}%
+ \def\@toclevel{0}%
+ \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{##2}%
+ \else \@tocwriteb\tocchapter{chapter}{##2}\fi
+ \chaptermark{##1}%
+ \addtocontents{lof}{\protect\addvspace{10\p@}}%
+ \addtocontents{lot}{\protect\addvspace{10\p@}}%
+ \@makechapterhead{##2}\@afterheading
+ }{%
+ \refstepcounter{chapter}%
+ \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
+ \else \let\@secnumber\thechapter \fi
+ \typeout{\chaptername\space\@secnumber}%
+ \def\@toclevel{0}%
+ \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{##2}%
+ \else \@tocwriteb\tocchapter{chapter}{##2}\fi
+ \chaptermark{##1}%
+ \ifdim \@chapterlistsgap>\z@
+ \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
+ \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
+ \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
+ \fi
+ \@makechapterhead{##2}\@afterheading}%
+% \end{macrocode}
+% \begin{macrocode}
+ % scrreprt/scrbook.cls
+ \@ifundefined{KOMAClassName}{}{%
+ \caption@Debug{document class `\KOMAClassName' detected}%
+ \let\caption@patch@chapter\@gobblethree}%
+% \end{macrocode}
+% \begin{macrocode}
+ % rapport1/3.cls [2004/06/07 v2.1a NTG LaTeX document class]
+ \caption@patch@chapter{rapport}{%
+ \ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}\toc@font0 ##1}%
+ \else
+ \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
+ \fi
+ \chaptermark{##1}%
+ \addtocontents{lof}{\protect\addvspace{10\p@}}%
+ \addtocontents{lot}{\protect\addvspace{10\p@}}%
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]%
+ \else
+ \@makechapterhead{##2}%
+ \@afterheading
+ \fi
+ }{%
+ \ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}\toc@font0 ##1}%
+ \else
+ \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
+ \fi
+ \chaptermark{##1}%
+ \ifdim \@chapterlistsgap>\z@
+ \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
+ \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
+ \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
+ \fi
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]%
+ \else
+ \@makechapterhead{##2}%
+ \@afterheading
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ % boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class]
+ \caption@patch@chapter{boek}{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}\toc@font0 ##1}%
+ \else
+ \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
+ \fi
+ \chaptermark{##1}%
+ \addtocontents{lof}{\protect\addvspace{10\p@}}%
+ \addtocontents{lot}{\protect\addvspace{10\p@}}%
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]%
+ \else
+ \@makechapterhead{##2}%
+ \@afterheading
+ \fi
+ }{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}\toc@font0 ##1}%
+ \else
+ \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{\toc@font0 ##1}%
+ \fi
+ \chaptermark{##1}%
+ \ifdim \@chapterlistsgap>\z@
+ \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
+ \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
+ \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
+ \fi
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]%
+ \else
+ \@makechapterhead{##2}%
+ \@afterheading
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ % thesis.cls [1996/25/01 1.0g LaTeX document class (wm).]
+ \caption@patch@chapter{thesis}{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \refstepcounter{chapter}%
+ \typeout{\chaptername\space\thechapter.}
+ \if@thema
+ \ifx\@shortauthor\@empty
+ \addcontentsline{toc}{chapter}{%
+ \protect\numberline{\thechapter.}##1}%
+ \else
+ \addcontentsline{toc}{chapter}{%
+ \protect\numberline{\thechapter.}%
+ \@shortauthor\hfill\mbox{}\vskip\normallineskip ##1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{%
+ \protect\numberline{\thechapter.}##1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{##1}
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{##1}
+ \fi
+ \chaptermark{##1}
+ \addtocontents{lof}{\protect\addvspace{10pt}}
+ \addtocontents{lot}{\protect\addvspace{10pt}}
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]
+ \else
+ \@makechapterhead{##2}
+ \@afterheading
+ \fi
+ }{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \refstepcounter{chapter}%
+ \typeout{\chaptername\space\thechapter.}%
+ \if@thema
+ \ifx\@shortauthor\@empty
+ \addcontentsline{toc}{chapter}{%
+ \protect\numberline{\thechapter.}##1}%
+ \else
+ \addcontentsline{toc}{chapter}{%
+ \protect\numberline{\thechapter.}%
+ \@shortauthor\hfill\mbox{}\vskip\normallineskip ##1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{%
+ \protect\numberline{\thechapter.}##1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{##1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{##1}%
+ \fi
+ \chaptermark{##1}%
+ \ifdim \@chapterlistsgap>\z@
+ \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}%
+ \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}%
+ \float@addtolists{\protect\addvspace{\@chapterlistsgap}}%
+ \fi
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{##2}]%
+ \else
+ \@makechapterhead{##2}%
+ \@afterheading
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\caption@patch@chapter\@gobblethree \else
+ \caption@Debug{%
+ Unsupported document class detected,\MessageBreak
+ or \noexpand\@chapter was redefined by another package}%
+ \fi
+ \let\caption@PatchChapter\@undefined}
+%\@onlypreamble\caption@PatchChapter
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@patch@chapter[3]{%
+ \begingroup
+% \let\if@twocolumn\iffalse
+ \let\if@mainmatter\iffalse
+ \let\if@thema\iffalse
+ \def\@tempa[##1]##2{#2}%
+ \ifx\@tempa\@chapter
+ \caption@Debug{document class `#1' detected}%
+ \gdef\@chapter[##1]##2{#3}%
+ \global\let\caption@patch@chapter\@gobblethree
+ \fi
+ \endgroup}
+%\@onlypreamble\caption@patch@chapter
+% \end{macrocode}
+% \begin{macrocode}
+\long\def \@gobblethree #1#2#3{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@stpelt}
+% We patch \cs{@stpelt} so a list of `connected' counters will be reset, too.
+% (Like \cs{stepcounter} does in |ltcounts.dtx|.)
+% \begin{macrocode}
+\newcommand*\caption@patch@stpelt{%
+ \let\caption@stpelt\@stpelt
+ \def\@stpelt##1{%
+ \caption@stpelt{##1}%
+ \begingroup
+ \let\@elt\caption@stpelt
+ \csname caption@cl@##1\endcsname
+ \endgroup}%
+ \let\caption@patch@stpelt\relax}
+\@onlypreamble\caption@patch@stpelt
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtoreset}
+% \changes{v3.1k}{2009/10/09}{This macro added}
+% Like \cs{@addtoreset} from |ltcounts.dtx|
+% \begin{macrocode}
+\newcommand*\caption@addtoreset[2]{%
+ \caption@patch@stpelt
+ \@ifundefined{caption@cl@#2}{\@namedef{caption@cl@#2}{}}{}%
+ \expandafter\@cons\csname caption@cl@#2\endcsname{{#1}}}
+\@onlypreamble\caption@addtoreset
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtoreset}
+% \changes{v3.1k}{2009/10/09}{This macro added}
+% Like \cs{@removefromreset} from |remreset.sty|
+% \begin{macrocode}
+\newcommand*\caption@removefromreset[2]{%
+ \begingroup
+ \expandafter\let\csname c@#1\endcsname\caption@removefromreset
+ \def\@elt##1{%
+ \expandafter\ifx\csname c@##1\endcsname\caption@removefromreset
+ \else
+ \noexpand\@elt{##1}%
+ \fi}%
+ \expandafter\xdef\csname caption@cl@#2\endcsname{%
+ \csname caption@cl@#2\endcsname}%
+ \endgroup}
+\@onlypreamble\caption@removefromreset
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionSubType}
+% \changes{v3.1f}{2007/11/16}{This macro added}
+% \changes{v3.1g}{2008/03/11}{Bugfix: \cs{subfigurename} will be defined now}
+% \changes{v3.1k}{2009/10/09}{Bugfix 08-10-01: Usage of \cs{caption@addtoreset} added}
+% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\
+% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\par
+% The starred variant provides the numbering format
+% \meta{type}|.|\meta{subtype} while the non-starred variant simply
+% uses \meta{subtype}.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionSubType{%
+ \caption@teststar\@DeclareCaptionSubType\@firstoftwo\@secondoftwo}
+\@onlypreamble\DeclareCaptionSubType
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@DeclareCaptionSubType[1]{%
+ \@testopt{\@@DeclareCaptionSubType{#1}}{alph}}
+\@onlypreamble\@DeclareCaptionSubType
+% \end{macrocode}
+% \begin{macrocode}
+\def\@@DeclareCaptionSubType#1[#2]#3{%
+ \@ifundefined{c@#3}%
+ {\caption@Error{No float type '#3' defined}}%
+% \end{macrocode}
+% \begin{macrocode}
+ {\@ifundefined{c@sub#3}%
+ {\caption@Debug{New subtype `sub#3'}%
+ \newcounter{sub#3}%
+ \caption@addtoreset{sub#3}{#3}%
+ \@namedef{ext@sub#3}{\csname ext@#3\endcsname}%
+ \@ifundefined{l@chapter}%
+ {\edef\@tempa{\expandafter\expandafter\expandafter\noexpand
+ \expandafter\@car\l@subsubsection\@nil}%
+ \def\@tempb{\@dottedtocline}%
+ \ifx\@tempa\@tempb % \l@subsubsection starts with \@dottedtocline
+ \expandafter\edef\csname l@sub#3\endcsname{%
+ \noexpand\@dottedtocline{2}%
+ \expandafter\expandafter\expandafter\noexpand
+ \expandafter\@gobbletwo\l@subsubsection}%
+ \else
+ \@namedef{l@sub#3}{\@dottedtocline{2}{3.8em}{3.2em}}%
+ \fi}%
+ {\expandafter\let\csname l@sub#3\endcsname\l@subsection}%
+ \@cons\caption@subtypelist{{#3}}}%
+ {\caption@Debug{Modify caption `sub#3'}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@namedef{sub#3name}{}%
+ \@namedef{sub#3autorefname}{\csname #3name\endcsname}%
+ #1% is \@firstoftwo in star form, and \@secondoftwo otherwise
+ {\@namedef{p@sub#3}{}%
+ \@namedef{thesub#3}{\csname the#3\endcsname.\@nameuse{#2}{sub#3}}}%
+ {\@namedef{p@sub#3}{\csname the#3\endcsname}%
+ \@namedef{thesub#3}{\@nameuse{#2}{sub#3}}}%
+ \@namedef{theHsub#3}{\csname theH#3\endcsname.\arabic{sub#3}}%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\@@DeclareCaptionSubType
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@subtypelist}
+% An \cs{@elt}-list containing the subtypes defined
+% with |\Declare|\x|Caption|\x|Sub|\x|Type|.
+% \begin{macrocode}
+\newcommand*\caption@subtypelist{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@For}
+% \changes{v3.1a}{2007/09/07}{This macro added}
+% \changes{v3.1f}{2007/11/16}{Renamed from \cs{ForFloatingEnvironments} to \cs{caption@For}}
+% |\caption@For|\marg{elt-list}\marg{code with \#1}\\
+% |\caption@For*|\marg{elt-list}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\caption@For{\caption@withoptargs\caption@@For}
+%\@onlypreamble\caption@For
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@For[3]{%
+ \caption@AtBeginDocument#1{%
+ \def\@elt##1{#3}%
+ \@nameuse{caption@#2}%
+ \let\@elt\relax}}%
+%\@onlypreamble\caption@@For
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{subfig package adaptions}
+% \changes{v3.1}{2007/07/07}{Several adaptions to the \package{subfig} package added}
+%
+% We have to make several adaptions to \thispackage~\version{3.1} here.
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\@tempa{\@ifstar\sf@@subref\sf@subref}%
+ \ifx\subref\@tempa
+ \PackageInfo{caption3}{subfig package 1.2 or 1.3 is loaded\@gobble}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@setfloattype\@gobble
+ \let\@dottedxxxline\sf@NEW@dottedxxxline
+ \let\sf@subfloat\sf@NEW@subfloat
+% \end{macrocode}
+% \begin{macrocode}
+ \fi
+ \let\sf@NEW@dottedxxxline\@undefined
+ \let\sf@NEW@subfloat\@undefined}
+% \end{macrocode}
+% \begin{macrocode}
+\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{%
+ \begingroup
+ \caption@setfloattype{#1}%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub#1}%
+ \ifnum #3>\@nameuse{c@#2depth}\else
+ \@dottedtocline{\z@}{#4}{#5}{#6}{#7}%
+ \fi
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\def\sf@NEW@subfloat{%
+ \begingroup
+ \caption@setfloattype\@captype
+ \sf@ifpositiontop{%
+ \maincaptiontoptrue
+ }{%
+ \maincaptiontopfalse
+ }%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub\@captype}%
+ \let\sf@oldlabel=\label
+ \let\label=\subfloat@label
+ \ifmaincaptiontop\else
+ \advance\@nameuse{c@\@captype}\@ne
+ \fi
+ \refstepcounter{sub\@captype}%
+ \setcounter{sub\@captype @save}{\value{sub\@captype}}%
+ \@ifnextchar [% %] match left bracket
+ {\sf@@subfloat}%
+ {\sf@@subfloat[\@empty]}}
+% \end{macrocode}
+%
+% \iffalse
+%</kernel>
+% \fi
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \section{Main package}
+% \iffalse
+%<*package>
+% \fi
+%
+% \subsection{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption}[2010/01/09 v3.1m Customizing captions (AR)]
+%\@ifundefined{PackageRedefines}{}{\PackageRedefines{caption}{caption}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@Info}
+% \Note{The \cs{@gobble} at the end of the 2nd argument of
+% \cs{PackageInfo} suppresses the line number info.
+% See TLC2\cite{TLC2}, A.4.7, p885 for details.}
+% \begin{macrocode}
+\newcommand*\caption@Info[1]{\PackageInfo{caption}{#1\@gobble}}
+\@onlypreamble\caption@Info
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Loading the kernel}
+%
+% \begin{macrocode}
+\RequirePackage{caption3}[=2008/08/24] % needs v1.1j or newer
+% \end{macrocode}
+%
+% \subsection{Check against incompatible document classes}
+%
+% \begin{macrocode}
+\caption@ifbool{documentclass}{}{%
+ \caption@WarningNoLine{%
+ Unsupported document class (or package) detected,\MessageBreak
+ usage of the caption package is not recommended}%
+ \caption@Info{\string\@makecaption\space=\space\meaning\@makecaption}%
+}
+% \end{macrocode}
+%
+% \subsection{Check against incompatible packages}
+%
+% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
+% \begin{macrocode}
+\@ifpackageloaded{caption2}{%
+ \caption@Error{%
+ You can't use both, the (obsolete) caption2 *and*\MessageBreak
+ the (current) caption package}%
+ \endinput
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{ftcap} package added}
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{nonfloat} package added}
+% \changes{v3.1}{2007/06/18}{Check against incompatible \package{topcapt} package added}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}%
+ \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}%
+ \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}}
+% \end{macrocode}
+% \begin{macro}{\caption@DisablePositionOption}
+% \changes{v3.1g}{2008/03/20}{\texttt{position=b} added}
+% \changes{v3.1h}{2008/03/29}{%
+% Name changed from \cs{caption@IncompatiblePackage} to \cs{caption@DisablePositionOption};
+% moved from package to kernel; disables the `position' option now instead of issuing a warning}
+% |\caption@DisablePositionOption|\marg{package}\par
+% disables the `position' option.
+% \begin{macrocode}
+\newcommand*\caption@DisablePositionOption[1]{%
+ \caption@Info{%
+ `#1' package detected; setting `position=b' for compatibility reasons}%
+ \caption@setposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{position}{%
+ \caption@Error{Usage of the `position' option is incompatible\MessageBreak
+ to the `#1' package}}}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@DisablePositionOption
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Declaration of options}
+%
+% \subsubsection{Options for figure and table}
+%
+% \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figureposition}{%
+ \captionsetup*[figure]{position=#1}}
+\@onlypreamble@key{caption}{figureposition}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{tableposition}{%
+ \captionsetup*[table]{position=#1}}
+\@onlypreamble@key{caption}{tableposition}
+% \end{macrocode}
+%
+% \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
+% \changes{v3.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written}
+% \changes{v3.1f}{2007/11/18}{Options \opt{figurename} and \opt{tablename} are now
+% available after the document preamble, too.}
+% \changes{v3.1f}{2007/11/18}{Option \opt{name} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}}
+\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}}
+\DeclareCaptionOption{name}{\caption@setname\@captype{#1}}
+% \end{macrocode}
+%
+% \changes{v3.1g}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}}
+\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@SetName}
+% \changes{v3.1}{2007/07/04}{This macro added}
+% \changes{v3.1f}{2007/11/18}{After-preamble variant added}
+% \changes{v3.1g}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}}
+% \changes{v3.1i}{2008/08/02}{Bugfix: Works now without \cs{addto}, too}
+% |\caption@SetName|\marg{cmd}\marg{value}
+% \begin{macrocode}
+\newcommand*\caption@SetName[2]{%
+ \caption@setname{#1}{#2}%
+ \begingroup
+ \@ifundefined{languagename}{}{%
+ \@ifundefined{captions\languagename}{}{%
+ \expandafter\g@addto@macro\csname captions\languagename\endcsname
+ {\caption@setname{#1}{#2}}}}%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setname[2]{\@namedef{#1name}{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument{\let\caption@SetName\caption@setname}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1f}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added}
+% \changes{v3.1i}{2008/04/13}{Option \opt{within} added}
+% \changes{v3.1l}{2010/01/09}{The \opt{within} options are now available within the document, too}
+% \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined floats
+% declared with \cs{DeclareCaptionType}, too}
+%
+% \begin{macro}{\caption@DeclareWithinOption}
+% \changes{v3.1l}{2010/01/09}{This macro and its usage added}
+% \begin{macrocode}
+\newcommand*\caption@DeclareWithinOption[1]{%
+ \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}%
+ \DeclareCaptionOption{#1without}{\caption@Within{#1}{none}}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\caption@DeclareWithinOption{figure}
+\caption@DeclareWithinOption{table}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{within}{%
+ \@ifundefined{c@figure}{}{\caption@Within{figure}{#1}}%
+ \@ifundefined{c@table}{}{\caption@Within{table}{#1}}%
+ \caption@For{typelist}{\caption@Within{##1}{#1}}%
+ \def\caption@within@default{#1}}
+\DeclareCaptionOption{without}{\KV@caption@within{none}}
+% \end{macrocode}
+% \begin{macro}{\caption@within}
+% \changes{v3.1}{2007/12/21}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@Within[1]{\def\caption@type{#1}\KV@caption@DCT@within}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Miscellaneous options}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{config}[caption]{%
+ \InputIfFileExists{#1.cfg}%
+ {\typeout{*** Local configuration file #1.cfg used ***}}%
+ {\caption@Warning{Configuration file #1.cfg not found}}}
+% \end{macrocode}
+%
+% \changes{v3.1f}{2007/11/28}{Option \opt{@minipage=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{@minipage}{%
+ \caption@ifinlist{#1}{auto,default}%
+ {\let\caption@if@minipage\@gobbletwo}%
+ {\caption@set@bool\caption@if@minipage{#1}}}
+\captionsetup{@minipage=default}
+% \end{macrocode}
+%
+% \subsubsection{caption v1.x compatibility options}
+% \changes{v3.1}{2007/07/21}{Option `compatibility' added}
+% \changes{v3.1}{2007/09/01}{caption v1.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v1.x$ compatibility options}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{compatibility}[1]{\caption@setbool{compatibility}{#1}}
+\@onlypreamble@key{caption}{compatibility}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{normal}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{isu}{%
+ \caption@setformat{hang}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{hang}{%
+ \caption@setformat{hang}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{center}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centering}}
+\DeclareCaptionOptionNoValue*{anne}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centerlast}}
+\DeclareCaptionOptionNoValue*{centerlast}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centerlast}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}}
+\DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}}
+\DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}}
+\DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}}
+\DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}}
+\DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{up}{\l@addto@macro\captionlabelfont\upshape}
+\DeclareCaptionOptionNoValue*{it}{\l@addto@macro\captionlabelfont\itshape}
+\DeclareCaptionOptionNoValue*{sl}{\l@addto@macro\captionlabelfont\slshape}
+\DeclareCaptionOptionNoValue*{sc}{\l@addto@macro\captionlabelfont\scshape}
+\DeclareCaptionOptionNoValue*{md}{\l@addto@macro\captionlabelfont\mdseries}
+\DeclareCaptionOptionNoValue*{bf}{\l@addto@macro\captionlabelfont\bfseries}
+\DeclareCaptionOptionNoValue*{rm}{\l@addto@macro\captionlabelfont\rmfamily}
+\DeclareCaptionOptionNoValue*{sf}{\l@addto@macro\captionlabelfont\sffamily}
+\DeclareCaptionOptionNoValue*{tt}{\l@addto@macro\captionlabelfont\ttfamily}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{nooneline}{\caption@setbool{slc}{0}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\caption@setbool{ruled}{0}
+\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}}
+% \end{macrocode}
+%
+% \subsubsection{caption2 v2.x compatibility options}
+% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
+% \changes{v3.1}{2007/09/01}{caption2 v2.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v2.x$ compatibility options}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{flushleft}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{raggedright}}
+\DeclareCaptionOptionNoValue*{flushright}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{raggedleft}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{oneline}{\caption@setbool{slc}{1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{%
+ \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}}
+% \end{macrocode}
+%
+% \subsubsection{Obsolete caption v3.0 options}
+% \changes{v3.1}{2007/05/07}{Package option \opt{caption} marked as obsolete,
+% gives error now}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{caption}{%
+ \caption@setbool{temp}{#1}%
+ \caption@ifbool{temp}{}{%
+ \caption@Error{%
+ The package option `caption=#1' is obsolete.\MessageBreak
+ Please pass this option to the subfig package instead\MessageBreak
+ and do *not* load the caption package anymore}}}
+% \end{macrocode}
+%
+% \subsubsection{fltpage package support options}
+%
+% \changes{v3.1}{2007/09/01}{Options `FPlist' \& `FPref' added}
+% With these options is controlled where the list-of entry and |\ref| resp.
+% |\pageref| or |\autoref| will link to.
+% Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent,
+% but compatible to the usual behaviour of the \package{fltpage} package.
+% \begin{macrocode}
+\DeclareCaptionOption{FPlist}[1]{\caption@setFPoption{list}{#1}}
+\DeclareCaptionOption{FPref}[1]{\caption@setFPoption{ref}{#1}}
+\@onlypreamble@key{caption}{FPlist}
+\@onlypreamble@key{caption}{FPref}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setFPoption[2]{%
+ \edef\caption@tempa{\@car#2\@nil}%
+ \caption@setbool{FP#1cap}{\if c\caption@tempa 1\else 0\fi}}
+\@onlypreamble\caption@setFPoption
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{FPlist=caption,FPref=figure}
+% \end{macrocode}
+%
+% \subsubsection{hyperref package support options}
+%
+% \changes{v3.1}{2007/06/21}{Options `hypcap' \& `hypcapspace' added}
+% With |hypcap=off| one can turn the \package{hypcap} support off
+% (default is |on|).
+% \begin{macrocode}
+\DeclareCaptionOption{hypcap}[1]{\caption@setbool{hypcap}{#1}}
+\DeclareCaptionOption{hypcapspace}{\def\caption@hypcapspace{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{hypcap=1,hypcapspace=.5\baselineskip}
+% \end{macrocode}
+%
+% \subsection{\AmS{} \& \SmF{} document classes support}
+% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ document classes support added (package)}
+%
+% \begin{macrocode}
+\caption@ifamsclass{%
+ \caption@Info{AMS or SMF document class}%
+% \end{macrocode}
+% \begin{macrocode}
+ \setlength\belowcaptionskip{0pt}% set to 12pt by AMS class
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{\KOMAScript{} document classes support}
+% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added (package)}
+% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added (package)}
+% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added (package)}
+% \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised (package)}
+% \changes{v3.1}{2007/03/17}{\KOMAScript\ compatibility options removed (package)}
+% \changes{v3.1}{2007/04/05}{\KOMAScript\ compatibility revised \& enhanced (package)}
+%
+% \begin{macrocode}
+\caption@ifkomaclass{%
+ \caption@Info{KOMA-Script document class}%
+% \end{macrocode}
+%
+% Here we emulate the caption related commands and take over the caption
+% related settings from the \KOMAScript\ classes.
+%
+% \begin{macro}{\@tablecaptionabovetrue}
+% \begin{macro}{\@tablecaptionabovefalse}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \begin{macrocode}
+ \g@addto@macro\@tablecaptionabovetrue{\captionsetup*[table]{position=t}}
+ \g@addto@macro\@tablecaptionabovefalse{\captionsetup*[table]{position=b}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ \if@tablecaptionabove
+ \@tablecaptionabovetrue
+ \else
+ \@tablecaptionabovefalse
+ \fi
+% \end{macrocode}
+%
+% \begin{macro}{\onelinecaptionstrue}
+% \begin{macro}{\onelinecaptionsfalse}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \begin{macrocode}
+ \g@addto@macro\onelinecaptionstrue{\let\caption@ifslc\@firstoftwo}
+ \g@addto@macro\onelinecaptionsfalse{\let\caption@ifslc\@secondoftwo}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ \ifonelinecaptions
+ \onelinecaptionstrue
+ \else
+ \onelinecaptionsfalse
+ \fi
+% \end{macrocode}
+%
+% \begin{macro}{\@captionabovetrue}
+% \begin{macro}{\@captionabovefalse}
+% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21:
+% \cs{let}\cs{caption@setposition}\cs{@gobble} added}
+% \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed}
+% \changes{v3.1}{2007/03/31}{We redefine \cs{captionabovetrue/false} now
+% instead of \cs{captionabove/below}}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \changes{v3.1k}{2009/10/09}{\opt{figureposition} and \opt{tableposition} will issue a warning now}
+% Please note that these are stronger than the \opt{position} setting, therefore we
+% override the options \opt{figureposition} and \opt{tableposition} to typeout a warning.
+% \begin{macrocode}
+ \g@addto@macro\@captionabovetrue{\let\caption@position\@firstoftwo}
+ \g@addto@macro\@captionabovefalse{\let\caption@position\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{figureposition}{%
+ \caption@WarningNoLine{Option `figureposition=#1' has no effect\MessageBreak
+ when used with a KOMA script document class}}
+ \DeclareCaptionOption{tableposition}{%
+ \caption@WarningNoLine{Option `tableposition=#1' has no effect\MessageBreak
+ when used with a KOMA script document class}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\setcapindent}
+% \begin{macrocode}
+ \let\caption@KOMA@setcapindent\@setcapindent
+ \renewcommand*\@setcapindent[1]{%
+ \caption@KOMA@setcapindent{#1}\caption@setcapindent}
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KOMA@@setcapindent\@@setcapindent
+ \renewcommand*\@@setcapindent[1]{%
+ \caption@KOMA@@setcapindent{#1}\caption@setcapindent}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapindent{%
+ \captionsetup{indent=\ifdim\cap@indent<\z@\z@\else\cap@indent\fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \@ifundefined{cap@indent}{}{\caption@setcapindent}
+% \end{macrocode}
+%
+% \begin{macro}{\setcapwidth}
+% \Note{The optional argument of \cs{setcapwidth} if not supported (yet),
+% so we issue a warning if used.
+% (Since this does not seem to have an negative effect when used
+% by the \texttt{captionbeside} environment, we suppress the warning here.)}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@setcapwidth
+ \csname\string\setcapwidth\endcsname
+ \@namedef{\string\setcapwidth}[#1]#2{%
+ \caption@KOMA@setcapwidth[#1]{#2}\caption@setcapwidth{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapwidth[1]{%
+ \ifx\\#1\\\else
+ \@ifundefined{cap@margin}{}{%
+ \def\@tempa{captionbeside}%
+ \ifx\@tempa\@currenvir\else\caption@Warning{%
+ Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}%
+ \fi}%
+ \fi
+ \captionsetup{width=\cap@width}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \def\caption@tempa{\hsize}%
+ \ifx\caption@tempa\cap@width \else
+ \caption@setcapwidth{?}
+ \fi
+% \end{macrocode}
+%
+% \begin{macro}{\setcapmargin}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@setcapmargin
+ \csname\string\@setcapmargin\endcsname
+ \@namedef{\string\@setcapmargin}[#1]#2{%
+ \caption@KOMA@setcapmargin[#1]{#2}\caption@setcapmargin}
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@@setcapmargin
+ \csname\string\@@setcapmargin\endcsname
+ \@namedef{\string\@@setcapmargin}[#1]#2{%
+ \caption@KOMA@@setcapmargin[#1]{#2}\caption@setcapmargin}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapmargin{%
+ \begingroup
+ \let\onelinecaptionsfalse\relax
+ \def\@twoside{0}%
+ \def\if@twoside{\def\@twoside{1}\iffalse}%
+ \cap@margin
+ \def\@tempa{\endgroup}%
+ \ifx\cap@left\hfill\else\ifx\cap@right\hfill\else
+ \def\hspace##1##{\@firstofone}%
+ \edef\@tempa{\endgroup
+ \noexpand\captionsetup{%
+ twoside=\@twoside,slc=0,%
+ margin={\cap@left,\cap@right}}}%
+ \fi\fi
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \ifx\cap@margin\relax \else
+ \caption@setcapmargin
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{Processing of options}
+%
+% \changes{v3.0m}{2007/03/04}{Verbose option added (package)}
+% \changes{v3.1}{2007/07/02}{Verbose option removed from package}
+%
+% \changes{v3.1}{2007/03/17}{We do not process global options anymore}
+% \begin{macrocode}
+\caption@ProcessOptions*{caption}
+% \end{macrocode}
+%
+% \subsection{\cs{captionof} and \cs{captionlistentry}}
+%
+% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
+% \changes{v3.1}{2007/06/25}{Option \opt{type*=} added}
+% \changes{v3.1f}{2007/11/16}{Option \opt{subtype} \& \opt{subtype*} added}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{type}{\caption@settype{#1}}%
+ \DeclareCaptionOption{type*}{\caption@settype*{#1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{subtype}[sub\@captype]{\caption@setsubtype{#1}}%
+ \DeclareCaptionOption{subtype*}[sub\@captype]{\caption@setsubtype*{#1}}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \emph{Important Note:}
+% Like |\captionof| the option |type=| should only be used inside a
+% group, box, or environment and does not check if the argument is a valid
+% floating environment or not.
+%
+% \begin{macro}{\caption@settype}
+% \changes{v3.1}{2007/05/09}{This macro added}
+% \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added}
+% \changes{v3.1d}{2007/10/23}{Error message for \cs{caption@checkgrouplevel} revised}
+% \changes{v3.1f}{2007/11/16}{\cs{caption@setsubtype} added}
+% \changes{v3.1f}{2007/12/03}{Crappy \cs{caption@iftypewarning} replaced}
+% \changes{v3.1g}{2008/01/12}{Usage of \cs{ifcaptionsetup@star} added}
+% |\caption@settype*|\marg{type}\par
+% sets |\@captype| and executes the options associated with it
+% (using |\caption@setoptions|).
+% Furthermore we check |\currentgrouplevel| (if avail),
+% redefine |\@currentlabel| so a |\label| before |\caption| will result
+% in a hint instead of a wrong reference, and
+% use the macro |\caption@|(|sub|)|typehook| (which will be used by our
+% \package{float} package support).\par
+% The non-starred version sets a \package{hyperref} anchor additionally
+% (if |hypcap=true| and the \package{hypcap} package is not loaded).
+% \begin{macrocode}
+\newcommand*\caption@settype{%
+ \caption@@settype{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setsubtype{%
+ \caption@iftype
+ {\caption@@settype{sub}}%
+ {\caption@Error{Option `subtype=' outside float}}}%
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@settype[1]{%
+ \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@settype[3]{%
+% #1 = "" or "sub"
+% #2 = \@firstoftwo in star form, \@secondoftwo otherwise
+% #3 = <type>, e.g. "figure" or "table"
+ \@ifundefined{c@#3}%
+ {\caption@Error{No float type '#3' defined}}%
+ {\caption@Debug{#1type=#3}%
+ \caption@checkgrouplevel{#1}{%
+ \captionsetup{#1type#2*\@empty=...}#2{ or
+ \@backslashchar#1captionof}{}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@tempa{#3}%
+ \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else
+ \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi
+ \fi
+ \expandafter\let\csname @#1captype\endcsname\caption@tempa
+% \end{macrocode}
+% \begin{macrocode}
+ \@nameuse{caption@#1typehook}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setoptions{#3}%
+ \ifx\caption@opt\relax
+ \@nameundef{caption@#1type@warning}%
+ \else
+ \@namedef{caption@#1type@warning}{\caption@Warning{%
+ The #1caption type was already set to
+ `\csname @#1captype\endcsname'\MessageBreak}}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ifrefstepcounter\@secondoftwo
+ #2{}{%
+ \let\@currentlabel\caption@undefinedlabel
+% \let\@currentHlabel\@undefined
+ \ifx\caption@ORI@label\@undefined
+ \let\caption@ORI@label\label
+ \let\label\caption@xlabel
+ \fi
+ \caption@start}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@typehook}
+% Hook, will be extended later on, e.g.~by our \package{float} package
+% support.
+% \begin{macrocode}
+\newcommand*\caption@typehook{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftype}
+% \changes{v3.1}{2007/04/11}{This macro and its usage added}
+% Since we often need to check if |\@captype| is defined (means: we
+% are inside a floating environment) this helper macro was introduced.
+% \begin{macrocode}
+\newcommand*\caption@iftype{%
+ \@ifundefined{@captype}{\let\@captype\@undefined\@secondoftwo}\@firstoftwo}
+% \end{macrocode}
+% \iffalse
+% \newcommand*\caption@iftype{%
+% \begingroup
+% \@ifundefined{@captype}%
+% {\aftergroup\@secondoftwo}%
+% {\aftergroup\@firstoftwo}%
+% \endgroup}
+% \fi
+% \end{macro}
+%
+% \begin{macro}{\caption@checkgrouplevel}
+% \changes{v3.1}{2007/07/15}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)}
+% Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done
+% inside a group or not -- in the latter case a warning message will
+% be issued. (needs \eTeX)
+% \begin{macrocode}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname currentgrouplevel\endcsname\relax
+ \caption@Debug{TeX engine: TeX}
+ \let\caption@checkgrouplevel\@gobbletwo
+\else
+ \caption@Debug{TeX engine: e-TeX}
+ \newcommand*\caption@checkgrouplevel[2]{%
+ \@ifundefined{#1caption@grouplevel}{%
+ \@ifundefined{caption@grouplevel}{\let\caption@grouplevel\z@}{}%
+ \ifnum\currentgrouplevel>\caption@grouplevel\relax
+ \expandafter\edef\csname #1caption@grouplevel\endcsname{%
+ \the\currentgrouplevel}%
+ \else
+ \caption@Warning{\string#2\MessageBreak outside box or environment}%
+ \fi
+ }{}}
+\fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@undefinedlabel}
+% \changes{v3.1}{2007/07/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/22}{Contents changed to \texttt{??}}
+% \changes{v3.1i}{2008/04/13}{Contents changed to \cs{caption@xref}(\ldots)}
+% \changes{v3.1k}{2009/03/30}{Bugfix 08-12-08: \cs{caption@xref} is robust now}
+% This label will be used for |\currentlabel| inside (floating) environments
+% as default. (see above)
+% \iffalse\Note{All commands used have to be robust here.}\fi
+% \begin{macrocode}
+\newcommand*\caption@undefinedlabel{%
+ \protect\caption@xref{\caption@labelname}{\on@line}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareRobustCommand*\caption@xref[2]{%
+ \caption@WarningNoLine{\noexpand\label before \string\caption#2}%
+ \@setref\relax\@undefined{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@labelname{??}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@xlabel}
+% \changes{v3.1b}{2007/09/22}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/11}{Revised}
+% \changes{v3.1i}{2008/04/13}{Bugfix: \cs{pageref} should always work now}
+% The new code of |\label| inside floating environments.
+% |\label| will be redefined using |\caption@withoptargs|, so
+% |#1| are the optional arguments (if any), and
+% |#2| is the mandatory argument here.
+% \begin{macrocode}
+\newcommand*\caption@xlabel[1]{%
+ \caption@@xlabel
+ \def\caption@labelname{#1}%
+ \caption@ORI@label{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@xlabel{%
+ \global\let\caption@@xlabel\@empty
+ \@bsphack
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@xref[2]{%
+ \string\@setref\string\relax\string\@undefined{\string##1}}}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionof}
+% \changes{v3.1}{2007/05/09}{Uses \cs{caption@settype} instead of \cs{def}\cs{@captype}}
+% \changes{v3.1c}{2007/09/22}{Bugfix: Redefinition of \cs{caption@setfloatcapt} removed}
+% \changes{v3.1e}{2007/10/30}{Better compatibility: Will be defined with \cs{AtBeginDocument} now}
+% |\captionof|\marg{type}\oarg{lst\_entry}\marg{heading}\\
+% |\captionof*|\oarg{lst\_entry}\marg{heading}\par
+% \Note{This will be defined with \cs{AtBeginDocument} so
+% \cs{usepackage}\csmarg{caption,capt-of} will still work.
+% (Compatibility to \version{1.x})}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\captionof{\caption@teststar\caption@of{\caption*}\caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@of[2]{\caption@settype*{#2}#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionlistentry}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v3.1g}{2008/01/20}{Starred variant added}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% |\captionlistentry|\oarg{float type}\marg{list entry}\\
+% |\captionlistentry*|\oarg{float type}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\captionlistentry{%
+ \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionlistentry[1]{%
+ \@testopt{\caption@listentry{#1}}\@captype}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@listentry#1[#2]#3{%
+ \@bsphack
+ #1{\caption@gettitle{#3}}%
+ {\caption@refstepcounter{#2}%
+ \caption@makecurrent{#2}{#3}}%
+ \caption@addcontentsline{#2}{#3}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{ContinuedFloat}}
+%
+% \begin{macro}{\ContinuedFloat}
+% \changes{v3.0f}{2005/06/11}{%
+% Call of \cs{caption@ContinuedFloat} added}
+% \changes{v3.0i}{2005/11/12}{%
+% Optional argument and call of \cs{caption@@ContinuedFloat} added}
+% \changes{v3.0g}{2005/06/28}{%
+% Bugfix: \cs{newcounter} replaced by \cs{newcount}}
+% \changes{v3.1}{2007/07/02}{Format of \package{hyperref} extension changed}
+% \changes{v3.1}{2007/07/07}{\cs{caption@setoptions} added}
+% \changes{v3.1g}{2008/01/29}{Starred variant and hook \cs{sf@ContinuedFloat} added}
+% |\ContinuedFloat|\\
+% |\ContinuedFloat*|\par
+% This mainly decrements the appropriate counter and increments the
+% continuation counter instead.
+% Furthermore we set |\caption@resetContinuedFloat| to |\@gobble| so the
+% continuation counter will not be reset to zero inside |\caption@refstepcounter|.
+% Please forget about the optional argument, it was never working well, is
+% incompatible to the \package{subfig} package, but is still there for
+% compatibility reasons.
+% \Note{The definition of \cs{ContinuedFloat} itself is compatible
+% to the one inside the \package{subfig} package, except for the
+% starred variant and the optional argument.}
+% When the \package{hyperref} package is used we have the problem
+% that the usage of |\ContinuedFloat| will create duplicate
+% hyper links -- |\@currentHref| will be the same for the main float and
+% the continued ones. So we have to make sure unique labels and references
+% will be created each time. We do this by extending |\theHfigure| and
+% |\theHtable|, so for continued floats the scheme
+% \begin{quote}\meta{type}|.|\meta{type \#}|\alph{|\meta{continued \#}|}|\end{quote}
+% will be used instead of
+% \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
+% \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
+% \Note{This does not help if the \package{hyperref} package option
+% \texttt{naturalnames=true} is set.}
+% \begin{macrocode}
+\def\ContinuedFloat{%
+ \@ifnextchar[\@Continued@Float\@ContinuedFloat}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@Continued@Float[#1]{\addtocounter{#1}\m@ne}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@ContinuedFloat{%
+ \caption@iftype
+ {\addtocounter\@captype\m@ne
+ \caption@ContinuedFloat\@captype}%
+ {\caption@Error{\noexpand\ContinuedFloat outside float}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@ContinuedFloat#1{%
+ \@ifstar{\caption@Continued@Float@{#1}}{\caption@Continued@Float{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@Continued@Float@{%
+ \addtocounter\@captype\@ne
+ \@stpelt{ContinuedFloat}\stepcounter{ContinuedFloat}%
+ \def\caption@resetContinuedFloat##1{\xdef\caption@CFtype{##1}}%
+ \caption@@ContinuedFloat}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@Continued@Float#1{%
+ \edef\caption@tempa{#1}%
+ \ifx\caption@tempa\caption@CFtype
+ \stepcounter{ContinuedFloat}%
+ \let\caption@resetContinuedFloat\@gobble
+ \caption@@ContinuedFloat{#1}%
+ \sf@ContinuedFloat{#1}%
+ \else
+ \caption@Error{Continued `#1' after `\caption@CFtype'}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@ContinuedFloat#1{%
+ \expandafter\l@addto@macro\csname the#1\endcsname\theContinuedFloat
+ \@ifundefined{theH#1}{}{%
+ \expandafter\l@addto@macro\csname theH#1\endcsname{%
+ \@alph\c@ContinuedFloat}}%
+ \caption@setoptions{ContinuedFloat}%
+ \caption@setoptions{continued#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\sf@ContinuedFloat[1]{}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@CFtype{??}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\theContinuedFloat}
+% Its preset to \cs{@empty}, so usually the continuation counter is not
+% included in the caption label or references.
+% \begin{macrocode}
+\newcounter{ContinuedFloat}
+\let\theContinuedFloat\@empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetContinuedFloat}
+% |\caption@resetContinuedFloat|\marg{type}\par
+% If a continuation counter is defined, we reset it.
+% (This one will be called inside |\@caption|.)
+% \begin{macrocode}
+\newcommand*\caption@resetContinuedFloat[1]{%
+ \@stpelt{ContinuedFloat}\xdef\caption@CFtype{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Internal helpers}
+%
+% \begin{macro}{\caption@refstepcounter}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% Resets the continuation counter, increments the float (i.e. |figure| or
+% |table|) counter, and sets the |refstepcounter| flag.
+% \begin{macrocode}
+\newcommand*\caption@refstepcounter[1]{%
+ \caption@resetContinuedFloat{#1}%
+ \caption@@refstepcounter{#1}%
+ \let\caption@ifrefstepcounter\@firstoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@refstepcounter{\refstepcounter}
+\let\caption@ifrefstepcounter\@secondoftwo
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@dblarg}
+% \changes{v3.1}{2007/02/05}{This macro added}
+% \changes{v3.1f}{2007/12/06}{Bugfix 07-12-06: Changed so it works without \cs{kernel@ifnextchar}
+% (which was introduced in \LaTeXe\ 2004/01/23), too}
+% A |\relax| was added compared to |\@dblarg| so |\caption{}| will be
+% expanded to |\caption[\relax]{}| (and not to |\caption[]{}|).
+% \begin{macrocode}
+\@ifundefined{kernel@ifnextchar}%
+ {\newcommand\caption@dblarg[1]{\@ifnextchar[{#1}{\caption@xdblarg{#1}}}}%
+ {\newcommand\caption@dblarg[1]{\kernel@ifnextchar[{#1}{\caption@xdblarg{#1}}}}%
+\newcommand\caption@xdblarg[2]{#1[{#2\relax}]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@begin}
+% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed to \cs{caption@setfloattype}}
+% \changes{v3.0e}{2005/04/12}{Check for default label format added}
+% \changes{v3.0f}{2005/06/11}{Usage of \cs{caption@resetContinuedFloat} added}
+% \changes{v3.1}{2007/05/09}{Usage of \cs{caption@setfloattype} \&
+% \cs{caption@resetContinuedFloat} removed}
+% Our handling of |\caption| will always be surrounded by
+% |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
+% |\caption@begin|\marg{type} performs these tasks:
+% \begin{enumerate}
+% \item[1.] Start a new group.
+% \item[2.] Define |\fnum@|\meta{type} if the caption label format is set
+% to non-default.
+% \item[3.] Override the |position=| setting, if necessary.
+% (for example if set to |auto| or used inside a |supertabular|)
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand*\caption@begin[1]{%
+ \begingroup
+ \caption@setfnum{#1}%
+ \caption@fixposition
+ \global\let\caption@fixedposition\caption@position}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@beginex}
+% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
+% \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
+% \changes{v3.1}{2007/07/01}{Makes lst-entry now instead of redefining \cs{addcontentsline}}
+% |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par
+% performs the same tasks as |\caption@begin| and additionally:
+% \begin{enumerate}
+% \item[4.] Make an entry in the list-of-whatever.
+% \item[5.] Set |\caption@ifempty| according argument \meta{heading}.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand\caption@beginex[3]{%
+ \caption@begin{#1}%
+ \caption@addcontentsline{#1}{#2}%
+ \caption@ifempty{#3}{}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@end}
+% |\caption@end| closes the group.
+% \begin{macrocode}
+\newcommand*\caption@end{%
+ \endgroup
+ \let\caption@position\caption@fixedposition}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0a}{2004/01/23}{%
+% Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
+% \changes{v3.0h}{2005/10/06}{%
+% Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
+%
+% \begin{macro}{\caption@setfnum}
+% \changes{v3.1}{2007/03/10}{This macro added}
+% |\caption@setfnum|\marg{type}\\
+% redefines |\fnum@|\meta{type} according the caption label format
+% set with |labelformat=|. But if |labelformat=default| is set,
+% |\fnum@|\meta{type} will not be overwritten by us.
+% \begin{macrocode}
+\newcommand*\caption@setfnum[1]{%
+ \@ifundefined{fnum@#1}{\iftrue}{\ifx\caption@lfmt\caption@lfmt@default\else}%
+ \@namedef{fnum@#1}{\caption@fnum{#1}}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@boxrestore}
+% \changes{v3.1}{2007/03/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added}
+% The original code (from |latex/base/ltboxes.dtx|):
+% \begin{verbatim}
+% \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}
+% \def\@arrayparboxrestore{%
+% \let\if@nobreak\iffalse
+% \let\if@noskipsec\iffalse
+% \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+% \parindent\z@ \parskip\z@skip
+% \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+% \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+% \parfillskip\@flushglue \lineskip\normallineskip
+% \baselineskip\normalbaselineskip
+% \sloppy}
+% \end{verbatim}%^^A
+% This one will be used by |\@caption| instead of |\@parboxrestore|.
+% \begin{macrocode}
+\newcommand*\caption@boxrestore{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parindent\z@ \parskip\z@skip
+ \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+ \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+ \parfillskip\@flushglue \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \sloppy
+ \let\\\@normalcr
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@normalsize}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This one will be used by |\@caption| instead of |\normalsize|.\par
+% Its code is equivalent to
+% \begin{quote}
+% |\caption@font{normal}%|
+% \end{quote}
+% but executes faster (since the starred form of |\caption@font|
+% does not use |\setkeys| internally).
+% \begin{macrocode}
+\newcommand*\caption@normalsize{%
+ \caption@font*{\KV@caption@fnt@normal\@unused}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setfloatcapt}
+% Needed for support of the \package{float} package, where the caption will
+% not be typeset directly, but catched in a |\vbox| called |\@floatcapt|
+% instead.
+% \begin{macrocode}
+\let\caption@setfloatcapt\@firstofone
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% \begin{macro}{\caption@makeanchor}
+% \begin{macro}{\caption@start}
+% \begin{macro}{\caption@@start}
+% \begin{macro}{\caption@freezeHref}
+% \begin{macro}{\caption@defrostHref}
+% All these are needed for support of the \package{hyperref} package.
+% \begin{macrocode}
+\newcommand*\caption@makecurrent[2]{}
+\let\caption@makeanchor\@firstofone
+\let\caption@start\relax
+\let\caption@@start\relax
+\let\caption@freezeHref\relax
+\let\caption@defrostHref\relax
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@gettitle}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This one is needed for support of the \package{nameref} package.
+% \begin{macrocode}
+\newcommand\caption@gettitle[1]{%
+ \@ifundefined{NR@gettitle}%
+ {\def\@currentlabelname{#1}}%
+ {\NR@gettitle{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{caption}, \cs{@caption}, and \cs{@makecaption}}
+%
+% \begin{macro}{\caption@caption}
+% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
+% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
+% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% Here comes our definition of |\caption| and |\caption*|.
+% Beside the support of the starred variant this code was adapted to the
+% various packages we support.
+% We are using |\caption@dblarg| instead of |\@dblarg| so |\caption{}|
+% (with an empty arg.) will produce a list-of entry, but |\caption[]{}|
+% won't.
+% \begin{macrocode}
+\def\caption@caption{%
+ \caption@iftype
+ {\caption@checkgrouplevel\@empty\caption
+ \caption@star
+ {\caption@refstepcounter\@captype}%
+ {\caption@dblarg{\@caption\@captype}}}%
+ {\caption@Error{\noexpand\caption outside float}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@star}
+% \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}}
+% A helper macro which processes the optional |*| after |\caption|.
+% \Note{We set \cs{caption@startrue} globally so it works with the
+% \package{sidecap} package, too.}
+% \begin{macrocode}
+\newcommand*\caption@star[2]{%
+ \@ifstar{\global\caption@startrue#2[]}{#1#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@caption}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% \changes{v3.1f}{2007/11/28}{Bugfix: Handling of \texttt{@minipage} flag added}
+% \changes{v3.1f}{2007/11/28}{Support of option \opt{@minipage} added}
+% \changes{v3.1g}{2008/03/16}{Internal: Uses \cs{caption@prepareanchor} now}
+% As above, our version has been adapted to the packages we support.
+% Additionally our code is nested by |\caption@beginex| \&
+% |\caption@end| instead of |\begingroup| \& |\endgroup|.
+% Furthermore we use |\caption@boxrestore| instead of |\@parboxrestore|
+% so this code also works correctly inside list-based environments
+% like |wide| \& |addmargin|. (This, and the fact that we use
+% |\linewidth| instead of |\hsize| inside |\@makecaption|, solves
+% \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2472}%^^A
+% {\LaTeX\ PR \texttt{latex/2472}}.)
+% \begin{macrocode}
+\long\def\caption@@caption#1[#2]#3{%
+% \end{macrocode}
+% \begin{macrocode}
+ \ifcaption@star \else
+ \caption@prepareanchor{#1}{#2}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \par
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@setfloatcapt{%
+ \caption@boxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \caption@normalsize
+ \ifcaption@star
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \@makecaption{\csname fnum@#1\endcsname}%
+ {\ignorespaces\caption@makeanchor{#3}}\par
+ \caption@if@minipage\@minipagetrue\@minipagefalse}%
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareanchor}
+% \changes{v3.1g}{2008/03/16}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@prepareanchor[2]{%
+ \caption@makecurrent{#1}{#2}%
+ \caption@ifhypcap\caption@@start{}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecaption}
+% \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added}
+% |\@makecaption|\marg{label}\marg{text}\par
+% We do basically the same as the original code (from the standard
+% \LaTeX\ document classes), but take care of the |position=| setting
+% and use |\caption@@make| from the \package{caption} kernel to finally
+% typeset the caption.
+% \begin{macrocode}
+\long\def\caption@makecaption#1#2{%
+ \caption@iftop
+ {\vskip\belowcaptionskip}%
+ {\caption@rule\vskip\abovecaptionskip}%
+ \caption@@make{#1}{#2}%
+ \caption@iftop
+ {\vskip\abovecaptionskip\caption@rule}%
+ {\vskip\belowcaptionskip}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@redefine}
+% \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now}
+% We only redefine |\caption| and |\@caption| if the current definitions
+% are well known, so documents written in the old (\package{caption}
+% package \version{1.x}) days (where |\caption| \& |\@caption| were not
+% redefined by us) will still compile fine.
+% For example the usage of the \package{captcont} package, which brings
+% it's own definition of |\caption*|, was quite common these days.
+% \begin{macrocode}
+\newcommand*\caption@redefine{}
+\g@addto@macro\caption@redefine{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@setbool{incompatible}{0}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
+ \def\caption{
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside figure or table}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
+ \renewcommand\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \let\@tempf\@caption
+ \expandafter\ifx\csname @float@c@\@captype\endcsname\relax\else
+ \expandafter\expandafter\let
+ \expandafter\@tempf\csname @float@c@\@captype\endcsname
+ \fi
+ \fi
+ \@dblarg{\@tempf\@captype}}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
+ % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
+ % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \H@refstepcounter\@captype
+ \@ifundefined{fst@\@captype}{%
+ \let\Hy@tempa\@caption
+ }{%
+ \let\Hy@tempa\Hy@float@caption
+ }%
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\Hy@tempa\@captype}}%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \H@refstepcounter\@captype
+ \let\Hy@tempa\@caption
+ \@ifundefined{float@caption}{%
+ }{%
+ \expandafter\ifx\csname @float@c@\@captype\endcsname\float@caption
+ \let\Hy@tempa\Hy@float@caption
+ \fi
+ }%
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\Hy@tempa\@captype}}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@IfCheckCommand{}{%
+ \caption@Info{%
+ Incompatible package detected (regarding \string\caption).\MessageBreak
+ \string\caption\space=\space\meaning\caption}%
+ \caption@setbool{incompatible}{1}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
+ \long\def\@caption#1[#2]#3{%
+ \par
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
+ \long\def\@caption#1[#2]#3{% second argument ignored
+ \par\nobreak
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \beamer@makecaption{#1}{\ignorespaces #3}\par\nobreak
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+% \caption@CheckCommand\float@caption{%
+% % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
+% \long\def\float@caption#1[#2]#3{%
+% \addcontentsline{\@nameuse{ext@#1}}{#1}%
+% {\protect\numberline{\@nameuse{the#1}}{\ignorespaces #2}}
+% \global\setbox\@floatcapt\vbox\bgroup\@parboxrestore
+% \normalsize\@fs@capt{\@nameuse{fnum@#1}}{\ignorespaces #3}%
+% \@ifnextchar[{\float@ccon}{\egroup}}%
+% \long\def\float@ccon[#1]{#1\par\egroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \hyper@makecurrent{\@captype}%
+ \def\@currentlabelname{#2}%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \hyper@@anchor{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
+ \fi
+ }%
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
+ % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
+ % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\let\@currentHref\hc@currentHref
+ \else
+ \hyper@makecurrent{\@captype}%
+ \fi
+ \def\@currentlabelname{#2}%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\@capstartfalse
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
+ \else
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \hyper@@anchor{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
+ \fi
+ }%
+ \fi
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2009/11/27 v6.79k Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\let\@currentHref\hc@currentHref
+ \else
+ \hyper@makecurrent{\@captype}%
+ \fi
+ \def\@currentlabelname{#2}%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\@capstartfalse
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
+ \else
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
+ }%
+ #3%
+ \fi
+ }%
+ \fi
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2009/12/09 v6.79m Hypertext links for LaTeX]
+ % hyperref.sty [2009/12/28 v6.79z Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\let\@currentHref\hc@currentHref
+ \else
+ \hyper@makecurrent{\@captype}%
+ \fi
+ \@ifundefined{NR@gettitle}{%
+ \def\@currentlabelname{#2}%
+ }{%
+ \NR@gettitle{#2}%
+ }%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\@capstartfalse
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
+ \else
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{%
+ \@currentHref
+ }{\relax}%
+ }%
+ #3%
+ \fi
+ }%
+ \fi
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % nameref.sty [2006/12/27 v2.28 Cross-referencing by name of section]
+ \long\def\@caption#1[#2]{%
+ \def\@currentlabelname{#2}%
+ \NR@@caption{#1}[{#2}]%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % nameref.sty [2009/11/27 v2.32 Cross-referencing by name of section]
+ \long\def\@caption#1[#2]{%
+ \NR@gettitle{#2}%
+ \NR@@caption{#1}[{#2}]%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % subfigure.sty [2002/07/30 v2.1.4 subfigure package]
+ \long\def\@caption#1[#2]#3{%
+ \@ifundefined{if#1topcap}%
+ {\subfig@oldcaption{#1}[{#2}]{#3}}%
+ {\@nameuse{if#1topcap}%
+ \@listsubcaptions{#1}%
+ \subfig@oldcaption{#1}[{#2}]{#3}%
+ \else
+ \subfig@oldcaption{#1}[{#2}]{#3}%
+ \@listsubcaptions{#1}%
+ \fi}}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % subfig.sty [2005/06/28 ver: 1.3 subfig package]
+ \def\@caption{\caption@}%
+% \long\def\caption@#1[#2]#3{%
+% \@ifundefined{caption@setfloattype}%
+% \caption@settype
+% \caption@setfloattype
+% \@captype
+% \sf@ifpositiontop{%
+% \@listsubcaptions{#1}%
+% \sf@old@caption{#1}[{#2}]{#3}%
+% }{%
+% \sf@old@caption{#1}[{#2}]{#3}%
+% \@listsubcaptions{#1}%
+% }}%
+ }%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@IfCheckCommand{}{%
+ \caption@Info{%
+ Incompatible package detected (regarding \string\@caption).\MessageBreak
+ \string\@caption\space=\space\meaning\@caption}%
+ \caption@setbool{incompatible}{1}}%
+% \end{macrocode}
+%
+% The option |compatibility=| will override the compatibility mode.
+% \begin{macrocode}
+ \@ifundefined{caption@ifcompatibility}%
+ {\let\caption@ifcompatibility\caption@ifincompatible
+ \let\caption@tempa\caption@WarningNoLine}%
+ {\let\caption@tempa\@gobble}% suppress warning
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@ifcompatibility{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@tempa{%
+ \noexpand\caption will not be redefined since it's already\MessageBreak
+ redefined by a document class or package which is\MessageBreak
+ unknown to the caption package}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{}%
+% \end{macrocode}
+%
+% |\ContinuedFloat| is not supported in compatibility mode.
+% \begin{macrocode}
+ \renewcommand*\caption@ContinuedFloat[1]{%
+ \caption@Error{Not available in compatibility mode}}%
+% \end{macrocode}
+%
+% |\caption@start| is not supported in compatibility mode.
+% \begin{macrocode}
+ \caption@AtBeginDocument*{%
+ \let\caption@start\relax
+ \@ifundefined{caption@ORI@capstart}{}{%
+ \caption@Debug{%
+ Restore hypcap definition of \string\capstart\@gobble}%
+ \let\capstart\caption@ORI@capstart}%
+ \@ifundefined{caption@ORI@float@makebox}{}{%
+ \caption@Debug{%
+ Restore hyperref redefinition of \string\float@makebox\@gobble}%
+ \let\float@makebox\caption@ORI@float@makebox}%
+ }%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@star}
+% We redefine |\caption@star| here so it does not make any harm.
+% \begin{macrocode}
+ \renewcommand*\caption@star[2]{#1#2}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@ifincompatible{%
+ \caption@WarningNoLine{%
+ Forced redefinition of \noexpand\caption since the\MessageBreak
+ unsupported(!) package option `compatibility=false'\MessageBreak
+ was given}%
+ }{}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption}
+% \begin{macro}{\@caption}
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{%
+ \let\caption\caption@caption
+ \let\@caption\caption@@caption}%
+ \caption@redefine
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@AtBeginDocument*{%
+ \let\caption@ORI@capstart\@undefined
+ \let\caption@ORI@float@makebox\@undefined}%
+% \end{macrocode}
+%
+% \begin{macro}{\@xfloat}
+% \changes{v3.1}{2007/05/09}{This re-definition added}
+% \changes{v3.1b}{2007/09/22}{Will now be redefined in compatibility mode, too}
+% We redefine |\@xfloat| so inside floating environments our
+% type-specific options will be used, a \package{hyperref}
+% anchor will be set etc.
+% \begin{macrocode}
+ \let\caption@ORI@xfloat\@xfloat
+ \def\@xfloat#1[#2]{%
+ \caption@ORI@xfloat{#1}[#2]%
+ \caption@settype{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% Some packages (like the \package{hyperref} package for example) redefines
+% |\caption| and |\@caption|, too.
+% So we have to use |\AtBeginDocument| here, so we can make sure
+% our definition is the one which will be valid at last.
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@redefine}
+% \end{macrocode}
+%
+% \begin{macro}{\@makecaption}
+% \begin{macrocode}
+\let\@makecaption\caption@makecaption
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Support for sub-captions}
+% \changes{v3.1f}{2007/11/16}{Support for sub-captions added}
+%
+% \begin{macro}{\caption@DeclareSubType}
+% |\caption@DeclareSub| initializes the usage of \cs{caption}
+% in sub-floats.
+% \begin{macrocode}
+\def\caption@DeclareSubType sub#1\@nil{%
+ \caption@Debug{Initializing subtype for `#1'\@gobble}%
+ \@namedef{caption@c@#1}{0}%
+ \@namedef{caption@beginsub#1}{\caption@beginsubfloat{#1}}}
+\@onlypreamble\caption@DeclareSubType
+% \end{macrocode}
+% \end{macro}
+%
+% Initialize the sub-captions defined with \cs{DeclareCaptionSubType}\ldots
+% \begin{macrocode}
+\caption@For*{subtypelist}{\caption@DeclareSubType sub#1\@nil}
+% \end{macrocode}
+%
+% Initialize the sub-captions defined with \cs{newsubfloat}\cite{subfig}\ldots
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \@ifundefined{sf@counterlist}{}{%
+ \@for\sf@temp:=\sf@counterlist\do{%
+ \expandafter\caption@DeclareSubType\sf@temp\@nil}}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@subtypehook}
+% \changes{v3.1g}{2008/03/20}{Redefinition of \cs{caption@setlist} added}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-08-12b: \cs{@makecaption} will now be restored here, too}
+% Hook, will be used inside \cs{caption@setsubtype}.
+% \begin{macrocode}
+\newcommand*\caption@subtypehook{%
+ \ifx\caption\caption@subcaption \else
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifrefstepcounter{}{%
+ % no \caption or \subcaption in this (floating) environment yet
+ \caption@Debug{Increment \@captype\ counter =\the\value\@captype}%
+ \caption@l@stepcounter\@captype
+ \let\addcontentsline\caption@addsubcontentsline}%
+% \end{macrocode}
+% \begin{macrocode}
+ \ifnum\csname caption@c@\@captype\endcsname=\value\@captype \else
+ \caption@Debug{Reset sub\@captype\ counter}%
+ \expandafter\xdef\csname caption@c@\@captype\endcsname{%
+ \the\value\@captype}%
+ \@stpelt\@subcaptype
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \c@ContinuedFloat=0\relax
+ \let\caption@resetContinuedFloat\@gobble
+ \let\caption@addcontentsline\caption@kernel@addcontentsline
+ \let\caption@setfloatcapt\@firstofone
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@clearmargin
+ \caption@iflist{}{\let\caption@setlist\@gobble}%
+ \caption@setoptions{sub}%
+ \caption@setoptions{subfloat}% for subfig-package compatibility
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption\caption@subcaption
+ \let\@makecaption\caption@makecaption
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subcaption}
+% Makes a sub-caption.
+% \begin{macrocode}
+\newcommand*\caption@subcaption{%
+ \caption@iftype
+ {\caption@checkgrouplevel{sub}\subcaption
+ \caption@star
+ {\caption@refstepcounter\@subcaptype}%
+ {\caption@dblarg{\@caption\@subcaptype}}}%
+ {\caption@Error{\noexpand\subcaption outside float}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addcontentsline}
+% \changes{v3.1g}{2008/01/12}{Argument of \cs{caption@addsubcontentslines} removed}
+% \changes{v3.1i}{2008/08/02}{Argument of \cs{caption@addsubcontentslines} re-added}
+% We extend |\caption@addcontentsline| so it handles sub-captions, too.
+% \Note{\cs{sf@ifpositiontop} \& \cs{@listsubcaptions} are defined by the
+% \package{subfigure} \& \package{subfig} packages.}
+% \begin{macrocode}
+\let\caption@kernel@addcontentsline\caption@addcontentsline
+\renewcommand*\caption@addcontentsline[2]{%
+ \sf@ifpositiontop{\@listsubcaptions{#1}}{}%
+ \caption@kernel@addcontentsline{#1}{#2}%
+ \sf@ifpositiontop{}{\@listsubcaptions{#1}}%
+ \caption@addsubcontentslines{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentslines[1]{%
+ \begingroup
+ \caption@subcontentslines
+ \endgroup
+ \caption@clearsubcontentslines}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \@ifundefined{sf@ifpositiontop}{\let\sf@ifpositiontop\@gobbletwo}{}%
+ \caption@clearsubcontentslines
+ \g@addto@macro\caption@typehook{\caption@checksubcontentslines}%
+ \AtEndDocument{\caption@checksubcontentslines}}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@addsubcontentsline}
+% \changes{v3.1i}{2008/08/02}{Bugfix 08-07-28:
+% \cs{label}, \cs{index}, and \cs{glossary} are allowed inside the list entry now}
+% Add a pending sub-caption list entry.
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentsline[3]{%
+ \begingroup
+ \let\label\@gobble \let\index\@gobble \let\glossary\@gobble
+ \protected@edef\@tempa{\endgroup
+ \noexpand\g@addto@macro\noexpand\caption@subcontentslines{%
+ \noexpand\@namedef{the#2}{\csname the#2\endcsname}%
+ \ifx\@currentHref\@undefined \else
+ \noexpand\def\noexpand\@currentHref{\@currentHref}%
+ \fi
+ \protect\addcontentsline{#1}{#2}{#3}}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checksubcontentslines}
+% \changes{v3.1g}{2008/01/07}{Bugfix: Uses \cs{caption@Error} instead of \cs{subcaption@Error} now}
+% Checks if the list of pending sub-captions is empty, if not,
+% a warning will be issued.
+% \begin{macrocode}
+\newcommand*\caption@checksubcontentslines{%
+ \ifx\caption@subcontentslines\@empty \else
+ \caption@Error{%
+ Something's wrong--perhaps a missing \protect\caption\MessageBreak
+ in the last figure or table}%
+ \caption@clearsubcontentslines
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clearsubcontentslines}
+% Clear pending sub-caption list entries.
+% \begin{macrocode}
+\newcommand*\caption@clearsubcontentslines{%
+ \global\let\caption@subcontentslines\@empty}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Document class \& Babel package support}
+%
+% \subsubsection{The \AmS{} \& \SmF{} classes}
+% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added (package)}
+%
+% \begin{macrocode}
+\@ifundefined{smf@makecaption}{}{\let\smf@makecaption\@makecaption}
+% \end{macrocode}
+%
+% \subsubsection{The beamer class}
+% \changes{v3.1}{2007/03/10}{beamer class support added (package)}
+%
+% \begin{macrocode}
+\@ifclassloaded{beamer}{%
+ \caption@Info{beamer document class}%
+% \end{macrocode}
+%
+% Since the beamer class do not offer a `list of figures' we switch
+% this support in \thispackage\ off.
+% \begin{macrocode}
+ \captionsetup{list=false}
+ \DeclareCaptionOption{list}[1]{}
+ \DeclareCaptionOption{listof}[1]{}
+% \end{macrocode}
+%
+% \begin{macro}{\figure}
+% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
+% \begin{macro}{\table}
+% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
+% We redefine |figure| \& |table| so our type-specific options will be used,
+% a \package{hyperref} anchor will be set etc.
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@ORI@figure
+ \csname\string\figure\endcsname
+ \@namedef{\string\figure}[#1]{%
+ \caption@ORI@figure[#1]%
+ \caption@settype{figure}}
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@ORI@table
+ \csname\string\table\endcsname
+ \@namedef{\string\table}[#1]{%
+ \caption@ORI@table[#1]%
+ \caption@settype{table}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The \KOMAScript{} classes}
+%
+% \KOMAScript\ contains the code
+% |\AtBeginDocument{\let\scr@caption\caption}|
+% so we need to update |\scr@caption| here, too.
+%
+% \begin{macrocode}
+\@ifundefined{scr@caption}{}{%
+ \caption@AtBeginDocument{\let\scr@caption\caption}}
+% \end{macrocode}
+%
+% \subsubsection{The frenchb Babel option}
+% \changes{v3.1}{2006/05/14}{Adaptation to \package{frenchb} added (package)}
+%
+% Suppress
+% ``Package |frenchb.ldf| Warning: The definition of |\@makecaption| has been
+% changed, frenchb will NOT customize it.''
+% (but only if we emulate this customization)
+% \begin{macrocode}
+\@nameuse{caption@frenchb}\@nameundef{caption@frenchb}
+% \end{macrocode}
+%
+% \subsubsection{The frenchle/pro package}
+% \changes{v3.0h}{2005/10/03}{Adaptation to \package{frenchle/pro} added (package)}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{\@ifundefined{frenchTeXmods}{}{%
+ \caption@Info{frenchle/pro package is loaded}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\captionfont@ORI\captionfont
+ \let\captionlabelfont@ORI\captionlabelfont
+ \let\@makecaption@ORI\@makecaption
+% \end{macrocode}
+
+% If |\GOfrench| is defined as |\relax| all the re-definitions regarding
+% captions have already been done, so we can do our patches immediately.
+% Otherwise we must add our stuff to |\GOfrench|.
+% \begin{macrocode}
+ \@ifundefined{GOfrench}%
+ {\let\caption@tempa\@firstofone}%
+ {\def\caption@tempa{\g@addto@macro\GOfrench}}%
+ \caption@tempa{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\captionfont\captionfont@ORI
+ \let\captionfont@ORI\@undefined
+ \let\captionlabelfont\captionlabelfont@ORI
+ \let\captionlabelfont@ORI\@undefined
+ \let\@makecaption\@makecaption@ORI
+ \let\@makecaption@ORI\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\@cnORI}
+% We update the definition of |\@cnORI| so it actually reflects
+% our definition of |\caption|.
+% \begin{macrocode}
+ \let\@cnORI\caption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@tablescaption}
+% The \package{frenchle/pro} package sets |\caption| to |\@tablescaption| at
+% |\begin{table}| for special treatment of footnotes.
+% Therefore we have to patch |\@tablescaption| so |\caption*| will work
+% inside the |table| environment.
+% \begin{macrocode}
+ \let\caption@tcORI\@tablescaption
+ \def\@tablescaption{\caption@star\relax\caption@tcORI}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f@ffrench}
+% \begin{macro}{\f@tfrench}
+% |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
+% when used in French mode. These contain additional code which typesets
+% the caption separator |\captionseparator| instead of the usual colon.
+% Because this breaks with our |\@makecaption| code we have to remove
+% this additional code here.
+% \begin{macrocode}
+ \let\@eatDP\@undefined
+ \let\caption@tempa\@empty
+ \ifx\f@ffrench\fnum@figure
+ \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
+ \fi
+ \ifx\f@tfrench\fnum@table
+ \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
+ \fi
+ \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
+ \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
+ \caption@tempa
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ }%
+}}
+% \end{macrocode}
+%
+% \subsection{Package support}
+% \changes{v3.1}{2007/04/11}{Package options `float', `longtable' etc.
+% are not supported anymore, removed}
+%
+% \begin{macro}{\caption@IfPackageLoaded}
+% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added,
+% so no extra check is needed}
+% \changes{v3.1}{2007/07/04}{Re-written \& renamed from \cs{caption@ifpackage}
+% to \cs{caption@IfPackageLoaded}}
+% |\caption@IfPackageLoaded|\marg{package}\oarg{version}\marg{true}\marg{false}\par
+% Some kind of combination of |\@ifpackageloaded| and |\@ifpackagelater|.
+% If the \meta{package} is not loaded yet, the check will be (re-)done
+% |\AtBeginDocument|, so the \meta{package} could be loaded later on, too.
+% \begin{macrocode}
+\newcommand\caption@IfPackageLoaded[1]{%
+ \@testopt{\caption@@IfPackageLoaded{#1}}{}}
+\@onlypreamble\caption@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@IfPackageLoaded#1[#2]#3#4{%
+ \@ifpackageloaded{#1}\@firstofone{%
+ \caption@Debug{#1 package is not loaded (yet)\@gobble}%
+ \caption@AtBeginDocument}{%
+ \caption@@ifpackageloaded{#1}[#2]{#3}{#4}}}
+\@onlypreamble\caption@@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@ifpackageloaded[1]{%
+ \@testopt{\caption@@ifpackageloaded{#1}}{}}
+\@onlypreamble\caption@ifpackageloaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@ifpackageloaded#1[#2]{%
+ \@ifpackageloaded{#1}{%
+ \caption@Info{#1 package is loaded}%
+ \@ifpackagelater{#1}{#2}\@firstoftwo{%
+ \caption@Error{%
+ For a successful cooperation we need at least version\MessageBreak
+ `#2' of package #1,\MessageBreak
+ but only version\MessageBreak
+ `\csname ver@#1.\@pkgextension\endcsname'\MessageBreak
+ is available}%
+ \@secondoftwo}%
+ }{\@secondoftwo}}
+\@onlypreamble\caption@@ifpackageloaded
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clearmargin}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This macro will be used by some package support stuff where the usual
+% margin setting is not welcome, e.g. in the \package{sidecap} package.
+% \begin{macrocode}
+\newcommand*\caption@clearmargin{%
+ \setcaptionmargin\z@
+ \let\caption@minmargin\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@setbool{needfreeze}{0}
+\caption@AtBeginDocument*{%
+ \caption@ifneedfreeze{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@freeze}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} \& \cs{@caption} revised for enhanced compatibility}
+% \changes{v3.1c}{2007/10/06}{Bugfix: Made \cs{@caption} long}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1g}{2008/01/29}{Starred variants of \cs{ContinuedFloat} and \cs{captionsetup} added}
+% |\caption@freeze*|\par
+% Used by the \package{fltpage} \& \package{sidecap} package support.
+% \begin{macrocode}
+ \newcommand*\caption@freeze{%
+ \caption@teststar\caption@@freeze\@gobble\@firstofone}%
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@@freeze[1]{%
+ \global\let\caption@SCcontinued\relax
+ \global\let\caption@SCsetup\@undefined
+ \global\let\caption@SClentry\@undefined
+ \global\let\caption@SCtext\@undefined
+ \global\let\caption@SClabel\@undefined
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ORI@ContinuedFloat\ContinuedFloat
+ \def\ContinuedFloat{%
+ \caption@withoptargs\caption@SC@ContinuedFloat}%
+ \def\caption@SC@ContinuedFloat##1{%
+ \let\caption@ORI@setcounter\setcounter
+ \let\caption@ORI@addtocounter\addtocounter
+ \def\setcounter####1####2{\csname c@####1\endcsname####2\relax}%
+ \def\addtocounter####1####2{\advance\csname c@####1\endcsname ####2\relax}%
+ \caption@ORI@ContinuedFloat##1%
+ \global\let\caption@SCcontinued\caption@ORI@ContinuedFloat
+ \let\setcounter\caption@ORI@setcounter
+ \let\addtocounter\caption@ORI@addtocounter}%
+ \let\caption@ORI@setup\captionsetup
+ \def\captionsetup{%
+ \caption@withoptargs\caption@SC@setup}%
+ \def\caption@SC@setup##1##2{%
+ \caption@g@addto@list\caption@SCsetup{##2}%
+ \caption@ORI@setup##1{##2}}%
+ \let\caption@ORI\caption
+ \def\caption{%
+ \def\caption{\caption@Error{%
+ Only one \noexpand\caption can be placed in this environment}}%
+ \let\captionsetup\caption@setup
+ \let\caption@@refstepcounter\caption@l@stepcounter
+ \caption@ORI}%
+ \long\def\@caption##1[##2]##3{%
+ \@bsphack
+ \gdef\caption@SClentry{##2}%
+ \gdef\caption@SCtext{##3}%
+ \@esphack}%
+ #1{% is \@gobble in star form, and \@firstofone otherwise
+ \def\label##1{\@bsphack\gdef\caption@SClabel{##1}\@esphack}}%
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrost}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1g}{2008/01/30}{\cs{caption@defrost@setup} added}
+% |\caption@defrost|
+% \begin{macrocode}
+ \newcommand*\caption@defrost{%
+ \ifx\caption@ORI@ContinuedFloat\@undefined
+ \caption@defrost@setup
+ \ifx\caption@SCtext\@undefined \else
+ \expandafter\expandafter\expandafter\caption
+ \expandafter\expandafter\expandafter[%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\caption@SClentry\expandafter}\expandafter]%
+ \expandafter{\caption@SCtext}%
+ \fi
+ \ifx\caption@SClabel\@undefined \else
+ \expandafter\label\expandafter{\caption@SClabel}%
+ \fi
+ \else
+ \caption@Error{Internal Error:\MessageBreak
+ \noexpand\caption@defrost in same group as \string\caption@freeze}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@defrost@setup{%
+ \caption@SCcontinued
+ \ifx\caption@SCsetup\@undefined \else
+ \expandafter\captionsetup\expandafter{\caption@SCsetup}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@undefbool{needfreeze}}
+% \end{macrocode}
+%
+% \subsubsection{The float package}
+% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
+% \iffalse
+% (This is a more straight-ahead implementation, but it only works with v1.3
+% now, so v1.2 is no longer supported. The old code including documentation
+% can be found in caption-30f-050530.zip)
+% \fi
+%
+% The \package{float} package usually do not use the \LaTeX\ kernel command
+% |\@caption| to typeset the caption but |\float@caption| instead.
+% (|\@caption| will only be used if the float is re-styled with
+% |\restylefloat*|.)
+%
+% The main two things |\float@caption| is doing different are:
+% \begin{itemize}
+% \item The caption will be typeset inside a |\savebox| called |\@floatcapt|
+% so it can be placed above or below the float contents afterwards.
+% \item |\@makecaption| will not be used to finally typeset the caption.
+% Instead |\@fs@capt| will be used which definition is part of the float
+% style.
+% (Note that |\@fs@capt| will not typeset any vertical space above or below
+% the caption; instead this space will be typeset by the float style code
+% itself.)
+% \end{itemize}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{%
+ \@ifpackageloaded{floatrow}{%
+ \caption@ifpackageloaded{floatrow}[2007/08/24 v0.2a]{}{}%
+ }{%
+% \end{macrocode}
+%
+% \iffalse
+% \begin{macro}{\caption@of}
+% If the float is defined by the float package (which means |\fst@|\meta{type}
+% is defined) we `execute' this float style, so |\@fs@iftopcapt| is set to its
+% proper value.
+% Furthermore we undo the re-definition of |\caption@setfloatcapt| which was
+% done by |\float@dostyle|.
+% \begin{macrocode}
+% \renewcommand*\caption@of[2]{%
+% \float@ifstyle{#2}{%
+% \float@dostyle{#2}%
+% \let\caption@setfloatcapt\@firstofone}{}%
+% \caption@settype*{#2}#1}%
+% \end{macrocode}
+% \end{macro}
+% \fi
+%
+% \begin{macro}{\@float@setevery}
+% \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added
+% to redefinition of \cs{caption@setfloatcapt}}
+% |\@float@setevery|\marg{float type} is provided by the \package{float}
+% package; it's called every time a floating environment defined with
+% |\newfloat| or |\restylefloat| begins.
+% We use this hook to do some adaptations and to setup the proper caption
+% style (if defined) and additional settings declared with
+% |\captionsetup|\oarg{float style}.
+% \begin{macrocode}
+ \let\caption@ORI@float@setevery\@float@setevery
+ \def\@float@setevery#1{%
+ \float@ifcaption{#1}{%
+% \end{macrocode}
+%
+% First of all we set the caption position to it's proper value by
+% converting |\@fs@iftopcapt| (which is part of a float style and
+% controls where the caption will be typeset, above or below the float
+% contents) to our |position=| setting.
+% Since the spacing above and below the caption will be done by the float
+% style and \emph{not} by us this sounds quite useless. But in fact it isn't,
+% since some packages based on \thispackage\ (like the \package{subfig}
+% package) could have an interest for this information and therefore use the
+% |\caption@iftop| macro we provide in our kernel. Furthermore we need this
+% information for ourself in |\captionof| which uses |\@makecaption| to
+% finally typeset the caption with skips.
+% \begin{macrocode}
+ \caption@setposition{\@fs@iftopcapt t\else b\fi}%
+% \end{macrocode}
+%
+% Afterward we redefine |\caption@setfloatcapt| (which will be used inside
+% |\@caption|) so the caption will be set inside the box |\@floatcapt|,
+% without extra vertical space.
+% \begin{macrocode}
+ \renewcommand\caption@setfloatcapt[1]{%
+ \let\@makecaption\caption@@make
+ \global\setbox\@floatcapt\vbox{%
+ \color@begingroup ##1\color@endgroup}}%
+% \end{macrocode}
+%
+% To allow different caption styles for different float styles we also
+% determine the current float style (e.g. `ruled') and select
+% a caption style (and additional settings) with the same name, if defined.
+% \begin{macrocode}
+ \float@getstyle\float@style{#1}%
+ \caption@setstyle*\float@style
+ \caption@setoptions\float@style
+% \end{macrocode}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@freezeHref % will be defrosted in \float@makebox
+ \caption@ORI@float@setevery{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@typehook}
+% \changes{v3.1}{2007/07/08}{float package hook added}
+% \LaTeX\ and almost every other packages use
+% |\|\meta{type}|name|
+% to provide a macro for the type resp.~environment name -- for example
+% the command |\figurename| will usually contain the name of the floating
+% environment |figure|:
+% \begin{quote}
+% |\newcommand\figurename{Figure}|
+% \end{quote}
+% But the \package{float} package doesn't follow this common naming
+% convention:
+% For floats defined with |\newfloat| it uses |\fname@|\meta{type} instead,
+% which breaks with our code (and with |\autoref| and some other things as
+% well).
+% So we have to map the \package{float} package name to the common one here.\par
+% \Note{If the float was not defined with \cs{newfloat} but with
+% \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.}
+% \begin{macrocode}
+ \g@addto@macro\caption@typehook{%
+ \expandafter\ifx\csname #1name\endcsname\relax
+ \expandafter\let\csname #1name\expandafter\endcsname
+ \csname fname@#1\endcsname
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
+% \begin{macro}{\fs@plaintop}
+% \begin{macro}{\fs@boxed}
+% Since the float styles |plaintop| and |boxed| don't use |\abovecaptionskip|
+% which could be set with |skip=| (|plaintop| uses |\belowcaptionskip| instead of
+% |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|)
+% we patch the according float style macros here to change this.
+% \begin{macrocode}
+ \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
+ \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\float@ifstyle}
+% \changes{v3.1}{2007/06/10}{This macro added}
+% |\float@ifstyle|\marg{type}\marg{if-clause}\marg{else-clause}\par
+% Checks if the given \meta{type} (e.g.~|figure|) is associated with a
+% float style (e.g.~|boxed|).
+% \begin{macrocode}
+ \providecommand*\float@ifstyle[1]{%
+ \expandafter\ifx\csname fst@#1\endcsname\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@getstyle}
+% \changes{v3.1}{2007/06/10}{This macro added}
+% |\float@getstyle|\marg{cmd}\marg{type}\par
+% Determining the float style is not so easy because the only hint
+% provided by the \package{float} package is the macro
+% |\fst@|\meta{float type} which points to the macro which represents the
+% float style. So for example after
+% \begin{quote}
+% |\floatstyle{ruled}|\\
+% |\newfloat{Program}{tbp}{lop}|
+% \end{quote}
+% |\fst@Program| will be defined as
+% \begin{quote}
+% |\def\fst@Program{\fs@ruled}|\quad.
+% \end{quote}\par
+% So here is what we do: We make the first level expansion of
+% |\fst@|\meta{float type} a string so we can gobble the first four tokens
+% (= |\fs@|), so only the the name of the float style is left.\par
+% \emph{TODO:} We need to convert the catcodes here.
+% \begin{macrocode}
+ \providecommand*\float@getstyle[2]{%
+ \edef#1{%
+ \noexpand\expandafter\noexpand\@gobblefour\noexpand\string
+ \expandafter\expandafter\expandafter\noexpand
+ \csname fst@#2\endcsname}%
+ \edef#1{#1}%
+ \caption@Debug{floatstyle{#2} = `#1'}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@setstyle}
+% \changes{v3.1}{2007/06/10}{This macro added}
+% |\float@setstyle|\marg{type}\marg{style}\par
+% Sets or changes the float style associated with \meta{type}.
+% \begin{macrocode}
+ \providecommand*\float@setstyle[2]{%
+ \expandafter\edef\csname fst@#1\endcsname{%
+ \expandafter\noexpand\csname fs@#2\endcsname}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@dostyle}
+% \changes{v3.1}{2007/07/23}{This macro added}
+% |\float@dostyle|\marg{type}
+% \begin{macrocode}
+ \providecommand*\float@dostyle[1]{%
+ \@nameuse{fst@#1}\@float@setevery{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@ifcaption}
+% \changes{v3.1}{2007/06/23}{This macro added}
+% |\float@ifcaption|\marg{type}\marg{if-clause}\marg{else-clause}\par
+% Here we determine if the user has used |\newfloat| resp.~|\restylefloat|,
+% or |\restylefloat*|.
+% This is quite easy: If |\@float@c@|\meta{captype} is the same as
+% |\float@caption|, the user has used |\newfloat| or |\restylefloat|,
+% otherwise we assume he has used |\restylefloat*|.
+% (This test will fail if some package re-defines |\float@caption|,
+% so we have to assume that there is no one.)
+% \begin{macrocode}
+ \providecommand*\float@ifcaption[1]{%
+ \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}}{%
+ \providecommand*\float@ifstyle[1]{\@secondoftwo}%
+ \providecommand*\float@ifcaption[1]{\@secondoftwo}%
+% \clearcaptionsetup{boxed}% used by the floatrow package?
+}
+% \end{macrocode}
+%
+% The skip between `boxed' floats and their caption defaults to |2pt|.
+%
+% \begin{macrocode}
+\captionsetup[boxed]{skip=2pt} % do not issue a warning when not used
+% \end{macrocode}
+%
+% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
+% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
+% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
+% `ruled' with appropriate options. But if the package option |ruled| was
+% specified, we setup some caption parameters to emulate the behavior
+% of \thispackage\ \version{1.x} option |ruled| instead, i.e.,
+% the current caption settings will be used, but without margin and without
+% `single-line-check'.
+% \begin{macrocode}
+\caption@ifbool{ruled}{%
+ \captionsetup[ruled]{margin=0pt,minmargin=0,slc=0}%
+}{%
+ \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
+}
+\caption@undefbool{ruled}
+% \end{macrocode}
+%
+% \subsubsection{The floatflt package}
+% \changes{v3.1}{2007/06/10}{Support of the \package{floatflt} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{floatflt}[1996/02/27 v1.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\floatingfigure}
+% We patch |\floatingfigure| so |\caption@floatflt| will be used.
+% \begin{macrocode}
+ \let\caption@ORI@floatingfigure\floatingfigure
+ \def\floatingfigure{%
+ \caption@floatflt{figure}%
+ \caption@ORI@floatingfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\floatingtable}
+% Same with |\floatingtable|\ldots
+% \begin{macrocode}
+ \let\caption@ORI@floatingtable\floatingtable
+ \def\floatingtable{%
+ \caption@floatflt{table}%
+% \caption@setautoposition b%
+ \caption@ORI@floatingtable}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@floatflt}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Here we do two things:
+% \begin{enumerate}
+% \item We use |\caption@setoptions{floating|\meta{type}|}| so
+% |\captionsetup[floating|\meta{type}|]{|\ldots|}| is supported.
+% \item |\linewidth| must be set correctly.
+% Usually this is done by |\@parboxrestore| inside |\@caption|,
+% but since we use |\@caption@boxrestore| we have to map this to
+% |\@parboxrestore| instead.
+% \end{enumerate}
+% \begin{macrocode}
+ \newcommand*\caption@floatflt[1]{%
+ \caption@settype{#1}%
+ \caption@clearmargin
+ \caption@setoptions{floating#1}%
+ \let\caption@boxrestore\@parboxrestore}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \iffalse
+% \subsubsection{The floatrow package}
+% \changes{v3.0f}{2005/06/01}{Support of the \package{floatrow} package added}
+%
+% \begin{macrocode}
+%\caption@IfPackageLoaded{floatrow}[2007/07/01 v0.1p]{%
+% \end{macrocode}
+%
+% The \package{floatrow} package is already adapted for usage with
+% \thispackage. So the main work has already been done by
+% Mrs.~Lapko, there is only one little thing we have to take care about:
+%
+% \begin{macro}{\caption@of}
+% Captions typeset with |\captionof| should have the correct layout,
+% therefore we have to `activate' this layout here with |\flrow@setlist|.
+% \begin{macrocode}
+% \renewcommand*\caption@of[2]{%
+% \flrow@setlist{{#2}}% TODO: always do this?
+% \caption@settype*{#2}#1}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%}{}
+% \end{macrocode}
+% \fi
+%
+% \subsubsection{The fltpage package}
+% \changes{v3.1}{2007/07/22}{Support of the \package{fltpage} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\FP@helpNote}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@helpNote}[2]{%
+% \typeout{FP#1 is inserted on page \pageref{#2}!}}%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand\FP@helpNote[2]{%
+ \begingroup % save \caption@thepage
+ \caption@pageref{#2}%
+ \typeout{FP#1 is inserted on page \caption@thepage!}%
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatBegin}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-09-11: Missing \cs{ignorespaces} added}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatBegin}[1]{%
+% \gdef\@captype{#1}%
+% \global\let\FP@savedCaptionCommand\caption%
+% \global\let\FP@savedLabelCommand\label%
+% \ifthenelse{\equal{\@captype}{figure}}
+% {\global\let\old@Fnum\fnum@figure}%
+% {\global\let\old@Fnum\fnum@table}%
+% \let\FP@LabelText\@empty%
+% \let\FP@CaptionText\@empty%
+% \let\FP@optionalCaptionText\@empty%
+% \renewcommand\label[1]{\gdef\FP@LabelText{##1}}%
+% \renewcommand\caption[2][]{%
+% \gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}%
+% \begin{lrbox}{\FP@floatCorpusBOX}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatBegin[1]{%
+ \def\@captype{#1}%
+ \let\FP@LabelText\@empty
+ \begin{lrbox}{\FP@floatCorpusBOX}%
+ \caption@ifFPrefcap
+ {\caption@freeze\relax}%
+ {\def\label##1{\@bsphack\gdef\FP@LabelText{##1}\@esphack}%
+ \caption@freeze*}%
+ \ignorespaces}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatEnd}
+% \changes{v3.1g}{2008/01/30}{Some minor bugfixes}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatEnd}{%
+% \end{lrbox}%
+% \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
+% \stepcounter{FP@\@captype C}%
+% \FP@savedLabelCommand{\FP@positionLabel}%
+% \FP@helpNote{\@captype}{\FP@positionLabel}%
+% \FP@float
+% {\FP@positionLabel}% location label test
+% {\begin{\@captype}[p!]
+% \usebox{\FP@floatCorpusBOX}%
+% \refstepcounter{\@captype}%
+% \ifthenelse{\equal{\FP@LabelText}{\@empty}}
+% {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
+% \end{\@captype}}
+% {\addtocounter{\@captype}{-1}}
+% {\begin{\@captype}[b!]%
+% \ifthenelse{\equal{\FP@guide}{\@empty}}%
+% {}{\ifthenelse{\equal{\@captype}{figure}}%
+% {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}%
+% {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}%
+% \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \FP@separatorCaption%
+% \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
+% {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%
+% {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]%
+% {\expandafter\protect\FP@CaptionText}}%
+% \end{\@captype}}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatEnd{%
+ \end{lrbox}%
+% \end{macrocode}
+% \begin{macrocode}
+ \stepcounter{FP@\@captype C}%
+ \caption@label\FP@positionLabel
+ \FP@helpNote\@captype\FP@positionLabel
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\FP@RestoreCounter{%
+ \noexpand\setcounter{\@captype}{\the\value\@captype}%
+ \noexpand\setcounter{ContinuedFloat}{\the\value{ContinuedFloat}}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \FP@float
+ {\FP@positionLabel}% location label test
+ {\begin\@captype[p!]%
+ \usebox\FP@floatCorpusBOX
+ \caption@defrost@setup
+ \caption@ifFPlistcap
+ {\caption@refstepcounter\@captype
+ \expandafter\caption@makecurrent\expandafter\@captype
+ \expandafter{\caption@SClentry}}%
+ {\expandafter\captionlistentry\expandafter{\caption@SClentry}}%
+ \caption@makeanchor\relax
+ \ifx\FP@LabelText\@empty \else
+ \expandafter\label\expandafter{\FP@LabelText}%
+ \fi
+ \end\@captype}%
+ {\FP@RestoreCounter
+ \@ifundefined{theH\@captype}{}{%
+ \expandafter\l@addto@macro\csname theH\@captype\endcsname{.FP}}}%
+ {\begin\@captype[b!]%
+ \let\FP@savedSetfnumCommand\caption@setfnum
+ \def\caption@setfnum##1{%
+ \FP@savedSetfnumCommand{##1}%
+ \ifx\FP@guide\@empty \else
+ \expandafter\l@addto@macro\csname fnum@##1\endcsname{\ {\FP@guide}}%
+ \fi}%
+ \setlength\abovecaptionskip{2pt plus 2pt minus 1pt}% length above caption
+ \setlength\belowcaptionskip{2pt plus 2pt minus 1pt}% length below caption
+ \caption@setoptions{FP\@captype}%
+ \FP@separatorCaption
+ \caption@ifFPlistcap{}{\let\caption@addcontentsline\@gobbletwo}%
+ \caption@defrost
+ \end\@captype}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1a}{2007/09/07}{\cs{DeclareFloatingEnvironment} defines FP-variant, too}
+% \changes{v3.1k}{2009/09/28}{Bugfix regarding newly defined \package{fltpage} environments}
+% \begin{macrocode}
+ \caption@For{typelist}{%
+ \newcounter{FP@#1C}%
+ \newenvironment{FP#1}{\FP@floatBegin{#1}}{\FP@floatEnd}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{%
+ \let\caption@ifFPlistcap\@undefined
+ \let\caption@ifFPrefcap\@undefined
+}
+% \end{macrocode}
+%
+% \subsubsection{The hyperref package}
+% \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
+% \changes{v3.1}{2007/03/09}{Usage of \cs{hyper@makecurrent} instead of
+% \cs{theHfigure} as indicator for \package{hyperref} package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{%
+ \@ifundefined{hyper@makecurrent}{% hyperref has stopped early
+ \caption@WarningNoLine{%
+ Hyperref support is turned off\MessageBreak
+ because hyperref has stopped early}%
+ }{%
+ \g@addto@macro\caption@prepareslc{\measuring@true}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@@refstepcounter}
+% We redefine |\caption@@refstepcounter| so |\H@refstepcounter| will be used
+% instead of |\refstepcounter| inside |\caption| \& |\captionlistentry|.
+% \begin{macrocode}
+ \renewcommand*\caption@@refstepcounter{\H@refstepcounter}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% We redefine |\caption@makecurrent| so a \package{hyperref} label
+% will be defined inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand*\caption@makecurrent[2]{%
+ \caption@makecurrentHref{#1}%
+ \caption@Debug{hyperref current=\@currentHref}%
+ \caption@gettitle{#2}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@makecurrentHref{\hyper@makecurrent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makeanchor}
+% \changes{v3.1l}{2010/01/09}{Adapted to the current hyperref package}
+% We redefine |\caption@makeanchor| so a \package{hyperref} anchor
+% will be set inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand\caption@makeanchor[1]{%
+ \caption@Debug{hyperref anchor: \@currentHref}%
+ % If we cannot have nesting, the anchor is empty.
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#1}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
+ }#1%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \g@addto@macro\caption@prepareslc{\let\caption@makeanchor\@firstofone}%
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{The hypcap option}
+%
+% \begin{macro}{\if@capstart}
+% Like the \package{hypcap} package we define the switch |\if@capstart|, too.
+% \begin{macrocode}
+ \newif\if@capstart
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@start}
+% \changes{v3.0l}{2007/02/20}{%
+% \cs{caption@currentHref} renamed to \cs{hc@currentHref}}
+% \changes{v3.1}{2007/06/21}{%
+% This macro renamed from \cs{capstart} to \cs{caption@start} and revised}
+% While the \package{hypcap} package defines a macro called |\capstart|
+% our variant is called |\caption@start| and is controlled by the option
+% |hypcap=||false|/|true|.
+% \begin{macrocode}
+ \def\caption@start{\caption@ifhypcap\caption@start@\relax}%
+ \def\caption@start@{%
+% \end{macrocode}
+% Generate the \package{hyperref} label and set the \package{hyperref} anchor,
+% usually (if |hypcap=false|) both is done inside |\@caption|.
+% \begin{macrocode}
+ \caption@makestart\@captype
+ \caption@startanchor\@currentHref
+% \end{macrocode}
+% Prevent |\@caption| from generating a new \package{hyperref} label,
+% use the label we save in |\hc@currentHref| instead.
+% (We also support the |@capstart| flag from the \package{hypcap} package.)
+% \begin{macrocode}
+ \global\@capstarttrue
+ \let\hc@currentHref\@currentHref
+ \def\caption@makecurrentHref##1{%
+ \global\@capstartfalse
+ \global\let\@currentHref\hc@currentHref}%
+% \end{macrocode}
+% Prevent |\@caption| from generating a \package{hyperref} anchor since this
+% has already been done.
+% \begin{macrocode}
+ \let\caption@makeanchor\@firstofone
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makestart}
+% \changes{v3.1c}{2007/09/30}{\cs{@currentHref} will be extended by \texttt{caption}
+% instead of \texttt{xxx} now}
+% |\caption@makestart|\marg{type}
+% defines a \package{hyperref} anchor inside |\caption@start|.\par
+% Since we offer |\ContinuedFloat| the float counter can change between
+% `now' and |\caption|, i.e., we simply don't know the figure or table counter
+% yet and therefore we are not able to generate the `right' \package{hyperref}
+% label.
+% Two different solutions of this problem came into my mind:
+% \begin{enumerate}
+% \item I could use the aux file for this purpose.\par
+% -or-
+% \item I set |hypertexnames=false| locally.
+% Furthermore I use |#1.caption.|\meta{counter} (instead of |#1.|\meta{counter})
+% as naming scheme for |\@currentHref| to avoid conflicts with other hyper
+% links which are generated with |hypertexnames=true|.
+% \end{enumerate}
+% The first idea has the advantage that the `right' anchor name will be
+% generated, but one needs an additional \LaTeX\ run if figures or tables
+% will be inserted or removed.\par
+% The second idea has the advantage that it's very easy to implement, but
+% has some side-effects, e.g. the anchor names don't follow the figure or
+% table label names anymore.\par
+% Since I'm lazy I implemented the second idea, maybe I will revise this
+% later on.
+% \begin{macrocode}
+ \newcommand*\caption@makestart[1]{%
+ \begingroup
+ \Hy@hypertexnamesfalse
+% \gdef\@currentHlabel{}%
+ \hyper@makecurrent{#1.caption}%
+ \endgroup
+ \caption@Debug{hypcap start=\@currentHref}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@startanchor}
+% \changes{v3.1b}{2007/09/17}{Bugfix 06-09-17: We use \cs{caption@anchor} instead of \cs{hyper@@anchor}}
+% \changes{v3.1g}{2008/03/16}{Warning about TeX mode replaced with debug info}
+% |\caption@startanchor|\marg{Href}
+% sets a \package{hyperref} anchor inside |\caption@start|.\par
+% This code was taken from the \package{hypcap} package\cite{hypcap} and adapted.
+% \Note{Since \cs{hyper@@anchor}\marg{Href}\csmarg{\string\relax} can cause
+% a change from vertical mode to horizontal mode (design flaw in
+% \package{hyperref} package!?), and since the workaround
+% \cs{let}\cs{leavevmode}\cs{relax} which can be found in the
+% \package{hypcap} package is not always sufficient
+% (for example with ``Direct pdfmark support'' and \texttt{breaklinks=true}),
+% we use \cs{caption@anchor} instead of \cs{hyper@@anchor} here.}
+% \begin{macrocode}
+ \newcommand*\caption@startanchor[1]{%
+ \ifvmode\begingroup
+ \caption@Debug{hypcap anchor: #1 (vertical mode)}%
+ \@tempdima\prevdepth
+ \nointerlineskip
+ \vspace*{-\caption@hypcapspace}%
+ \caption@anchor{#1}%
+ \vspace*{\caption@hypcapspace}%
+ \prevdepth\@tempdima
+ \endgroup\else
+ \caption@Debug{hypcap anchor: #1 (horizontal mode)}%
+ \caption@anchor{#1}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@anchor}
+% \changes{v3.1c}{2007/10/17}{Workaround 07-10-17: We use \cs{caption@raisedlink} instead of \cs{Hy@raisedlink} now}
+% |\caption@anchor|\marg{Href} sets a \package{hyperref} anchor.
+% \begin{macrocode}
+ \newcommand*\caption@anchor[1]{%
+ \ifmeasuring@ \else
+ \caption@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}%
+ \fi}%
+% \end{macrocode}
+% \Note{Since \cs{Hy@raisedlink} change \cs{@tempdima} we surrounded it by \cs{ifvmode},
+% suppressing ``\texttt{LaTeX Warning: Float too large for page by 1.0pt}'' in \texttt{sideways} floats.
+% (This is not necessary since \package{hyperref} \version{6.77}.)}
+% \begin{macrocode}
+ \ifx\HyperRaiseLinkLength\@tempdima
+ \def\caption@raisedlink#1{\ifvmode#1\else\Hy@raisedlink{#1}\fi}%
+ \else
+ \let\caption@raisedlink\Hy@raisedlink
+ \fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@start}
+% Will be used by |\caption@freezeHref|. Apart from that we issue a warning
+% if we expect a saved \package{hyperref} label coming from |\caption@start|,
+% but there isn't any.
+% \begin{macrocode}
+ \def\caption@@start{%
+ \@ifundefined{hc@currentHref}{%
+ \caption@Warning{%
+ The option `hypcap=true' will be ignored for this\MessageBreak
+ particular \string\caption}}{}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@freezeHref}
+% Suppress |\caption@start| from generating a \package{hyperref} label and
+% setting a \package{hyperref} anchor. Instead if |\@caption| generates a
+% \package{hyperref} label, it will be stored in |\caption@currentHref|.
+% Furthermore we need to redefine |\caption@setfloatcapt| so no
+% \package{hyperref} anchor will be placed in |\@caption|.
+% \iffalse
+% (Since |\caption@setfloatcapt| will be set to |\@firstofone| inside
+% |\subcaption| there is no need to add its restauration to
+% |\caption@subtypehook|.)
+% \fi
+% \begin{macrocode}
+ \def\caption@freezeHref{%
+ \let\caption@ORI@start\caption@start
+ \def\caption@start{\let\caption@start\caption@ORI@start}%
+% \end{macrocode}
+% \begin{macrocode}
+% \let\caption@ORI@@start\caption@@start
+% \l@addto@macro\caption@subtypehook{%
+% \let\caption@@start\caption@ORI@@start}%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\let\caption@currentHref\@undefined
+ \def\caption@@start{\global\let\caption@currentHref\@currentHref}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ORI@setfloatcapt\caption@setfloatcapt
+ \renewcommand*\caption@setfloatcapt{%
+ \ifx\caption@currentHref\@undefined \else
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \caption@ORI@setfloatcapt}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrostHref}
+% If there is a freezed |\@currentHref|, we set the \package{hyperref}
+% anchor here.
+% \begin{macrocode}
+ \def\caption@defrostHref{%
+ \ifx\caption@currentHref\@undefined \else
+ \caption@startanchor\caption@currentHref
+ \global\let\caption@currentHref\@undefined
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@makebox}
+% Do our own redefinition of |\float@makebox|, if it was redefined by
+% the \package{hyperref} package.
+% \begin{macrocode}
+ \@ifundefined{HyOrg@float@makebox}{}{%
+ \caption@Debug{%
+ Redefining \noexpand\float@makebox (again)\@gobble}%
+ \let\caption@ORI@float@makebox\float@makebox % save for compatibility mode
+ \renewcommand\float@makebox[1]{%
+ \HyOrg@float@makebox{#1\relax \caption@defrostHref}}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}}{}
+% \end{macrocode}
+%
+% \subsubsection{The hypcap package}
+% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
+% \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} \version{1.6}}
+% \changes{v3.1e}{2007/11/04}{\package{hypcap} support adapted to \package{hyperref} \version{6.77}}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hypcap}{% v1.0
+ \ifx\caption@start\relax \else % hyperref hasn't stopped early
+% \end{macrocode}
+%
+% If the \package{hypcap} package was loaded, we give up our own
+% hyperlink placement algorithm and give the control over the placement
+% to the \package{hypcap} package instead.
+%
+% \begin{macro}{\capstart}
+% \changes{v3.1k}{2009/10/09}{Support of \cs{ifcapstart} (\package{hypcap} package \version{1.10}) added}
+% We do this simply by mapping |\capstart| to |\caption@start@|,
+% although our code does not behave exactly like the original one:
+% The original |\capstart| has an effect on the next |\caption|
+% only but our version affects \emph{all} |\caption|s in the same
+% environment, at least unless a new |\capstart| will be placed.
+% \begin{macrocode}
+ \let\caption@ORI@capstart\capstart % save for compatibility mode
+ \@ifundefined{capstarttrue}% check for v1.10 of hypcap package
+ {\def\capstart{\caption@start@}}%
+ {\def\capstart{\ifcapstart\caption@start@\fi}}%
+ \let\caption@start\relax
+ \let\caption@@start\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@hypcapspace}
+% Furthermore we map our |\caption@hypcapspace| to |\hypcapspace|
+% offered by the \package{hypcap} package.
+% \begin{macrocode}
+ \caption@set@bool\caption@ifhypcap 1%
+ \renewcommand*\caption@hypcapspace{\hypcapspace}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \fi}{}
+% \end{macrocode}
+%
+% \subsubsection{The listings package}
+% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{%
+% \end{macrocode}
+%
+% \begin{macro}{\lst@MakeCaption}
+% \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now}
+% \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added}
+% To support the \package{listings} package we need to redefine
+% |\lst@MakeCaption| so the original stuff is nested with
+% |\caption@begin| and |\caption@end| etc.
+% \Note{This macro is always called twice (with `t' resp. `b' as
+% parameter), therefore we need an extra group here.}
+% \begin{macrocode}
+ \let\caption@ORI@lst@MakeCaption\lst@MakeCaption
+ \def\lst@MakeCaption#1{% #1 is `t' or `b'
+ \begingroup
+% \end{macrocode}
+% First of all, we set |position=#1| and if it was set to `top',
+% we swap the skips so the default behavior of the \package{listings} package
+% will not be changed. (Note that the \package{listings} package has set its
+% own |\abovecaptionskip| \& |\belowcaptionskip| values prior to calling
+% \cs{lst@MakeCaption}.)
+% \begin{macrocode}
+ \caption@setposition{#1}%
+ \caption@iftop{%
+ \@tempdima\belowcaptionskip
+ \belowcaptionskip\abovecaptionskip
+ \abovecaptionskip\@tempdima}{}%
+% \end{macrocode}
+% Workaround for issue with wrong skips (should be examined further)
+% \begin{macrocode}
+ \caption@setup{rule=0}%
+% \end{macrocode}
+% Afterwards we set the local `lstlisting' options.
+% \begin{macrocode}
+ \caption@setoptions{lstlisting}%
+% \end{macrocode}
+% If the |position=| is now set to |auto|, we take over the |captionpos=|
+% setting from the \package{listings} package.
+% \begin{macrocode}
+ \caption@setautoposition{#1}%
+% \end{macrocode}
+% At the end we do similar stuff as in our \cs{@caption} code.
+% \begin{macrocode}
+ \caption@begin{lstlisting}%
+ \caption@ORI@lst@MakeCaption{#1}%
+ \caption@end
+% \end{macrocode}
+% \begin{macrocode}
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lst@makecaption}
+% \begin{macro}{\lst@maketitle}
+% Wrapper macros for typesetting the |caption=| resp. |title=| value.
+% \begin{macrocode}
+ \def\lst@makecaption{\caption@starfalse\@makecaption}%
+ \def\lst@maketitle{\caption@startrue\@makecaption\@empty}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ext@lstlisting}
+% \changes{v3.1}{2007/03/03}{This macro added}
+% Since the \package{listings} package do not define |\ext@lstlisting|,
+% but we needed it when |\captionof{lstlisting}| will be done by the end user,
+% we define it here.
+% \begin{macrocode}
+ \providecommand*\ext@lstlisting{lol}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1a}{2007/07/13}{Bugfix 07-09-13: \cs{lst@@caption} will not be re-defined anymore}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The longtable package}
+%
+% \begin{macro}{\LTcaptype}
+% \changes{v3.1}{2007/07/06}{This macro and its support added}
+% |\LTcaptype| is preset to |table|.
+% \begin{macrocode}
+\providecommand*\LTcaptype{table}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{%
+% \end{macrocode}
+% \begin{macrocode}
+ \RequirePackage{ltcaption}[=2007/09/01]%
+ \let\LT@@makecaption\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\LT@array}
+% \changes{v3.1}{2007/07/22}{This redefinition added}
+% \changes{v3.1a}{2007/09/14}{Bugfix 07-09-14: Redefinition of \cs{@captionabovetrue} \& \cs{@captionabovefalse} added}
+% \changes{v3.1a}{2007/09/16}{Bugfix: This redefinition will always be done \cs{AtBeginDocument}}
+% \changes{v3.1g}{2008/01/20}{Bugfix in \cs{captionlistentry}: Table counter will not be incremented anymore, \cs{nameref} works}
+% We redefine |\LT@array| here to get |\captionsetup|\marg{options}
+% working inside |longtable|s.
+% \Note{Since the \package{hyperref} package patches \cs{LT@array} as well
+% and since this only works with the original definition of \cs{LT@array},
+% we have to do this after the \package{hyperref} package,
+% i.e.~\cs{AtBeginDocument}.}
+% \begin{macrocode}
+ \caption@AtBeginDocument{%
+ \let\caption@ORI@LT@array\LT@array
+ \renewcommand*\LT@array{%
+% \end{macrocode}
+% |\captionsetup| for longtable:
+% \begin{macrocode}
+ \global\let\caption@opt@@longtable\@undefined
+ \def\captionsetup{%
+ \noalign\bgroup
+ \@ifstar\@captionsetup\@captionsetup}% gobble *
+ \def\@captionsetup##1{\LT@captionsetup{##1}\egroup}%
+ \def\LT@captionsetup##1{%
+ \captionsetup@startrue\caption@setup@options[@longtable]{##1}%
+ \global\let\caption@opt@@longtable\caption@opt@@longtable}%
+% \end{macrocode}
+% |\captionabove| \& |\captionbelow| for longtable: (\KOMAScript\ document class)
+% \begin{macrocode}
+ \def\@captionabovetrue{\LT@captionsetup{position=t}}%
+ \def\@captionabovefalse{\LT@captionsetup{position=b}}%
+% \end{macrocode}
+% |\captionlistentry| for longtable:
+% \begin{macrocode}
+ \def\captionlistentry{%
+ \noalign\bgroup
+ \@ifstar{\egroup\LT@captionlistentry}% gobble *
+ {\egroup\LT@captionlistentry}}%
+ \def\LT@captionlistentry##1{%
+ \caption@listentry\@firstoftwo[\LTcaptype]{##1}}%
+% \end{macrocode}
+% |\ContinuedFloat| for longtable:\\
+% {\small(Commented out, since it's not deeply tested and quite useless anyway)}
+% \Note{\package{hyperref} versions $<$ v6.76j uses $2\times$ \cs{hyper@makecurrent}}
+% \begin{macrocode}
+% \caption@ifhypcap{%
+% \let\caption@ORI@hyper@makecurrent\hyper@makecurrent
+% \def\hyper@makecurrent##1{%
+% \let\hyper@makecurrent\caption@ORI@hyper@makecurrent
+% \caption@makestart{##1}%
+%% \let\Hy@LT@currentHlabel\@currentHlabel
+% \let\Hy@LT@currentHref\@currentHref
+% \def\hyper@makecurrent####1{%
+%% \let\@currentHlabel\Hy@LT@currentHlabel
+% \let\@currentHref\Hy@LT@currentHref}}%
+% \let\caption@ORI@ContinuedFloat\ContinuedFloat
+% \def\ContinuedFloat{\noalign{%
+% \gdef\caption@setContinuedFloat{%
+% \let\caption@resetContinuedFloat\@gobble}%
+% \def\caption@setoptions####1{%
+% \g@addto@macro\caption@setContinuedFloat{%
+% \caption@setoptions{####1}}}%
+% \let\@captype\LTcaptype
+% \caption@ORI@ContinuedFloat}}%
+% }{%
+% \def\ContinuedFloat{\noalign{%
+% \caption@Error{%
+% \noexpand\ContinuedFloat inside longtables\MessageBreak
+% is only available with `hypcap=true'}}}%
+% }%
+% \global\let\caption@setContinuedFloat\@empty
+ \def\ContinuedFloat{\noalign{%
+ \caption@Error{\noexpand\ContinuedFloat outside float}}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ORI@LT@array}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@c@ption}
+% \changes{v3.1g}{2008/01/22}{Made it \cs{long}}
+% The original implementation:
+% \begin{verbatim}
+% \def\LT@c@ption#1[#2]#3{%
+% \LT@makecaption#1\fnum@table{#3}%
+% \def\@tempa{#2}%
+% \ifx\@tempa\@empty\else
+% {\let\\\space
+% \addcontentsline{lot}{table}{\protect\numberline{\thetable}{#2}}}%
+% \fi}
+% \end{verbatim}%^^A
+% Our implementation uses |\LTcaptype| instead of |{table}|:
+% \begin{macrocode}
+ \long\def\LT@c@ption#1[#2]#3{%
+ \LT@makecaption#1{\csname fnum@\LTcaptype\endcsname}{#3}%
+ \LT@captionlistentry{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@makecaption}
+% \changes{v3.0d}{2004/08/10}{%
+% Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
+% \changes{v3.0e}{2005/05/05}{%
+% Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
+% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
+% |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
+% \smallskip
+% The original definition:
+% \begin{verbatim}
+% \def\LT@makecaption#1#2#3{%
+% \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
+% % Based on article class "\@makecaption", "#1" is "\@gobble" in star
+% % form, and "\@firstofone" otherwise.
+% \sbox\@tempboxa{#1{#2: }#3}%
+% \ifdim\wd\@tempboxa>\hsize
+% #1{#2: }#3%
+% \else
+% \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+% \fi
+% \endgraf\vskip\baselineskip}%
+% \hss}}}
+% \end{verbatim}%^^A
+% Our definition:
+% \begin{macrocode}
+ \renewcommand\LT@makecaption[3]{%
+ \caption@LT@make{%
+% \end{macrocode}
+%
+% If |\LTcapwidth| is not set to its default value |4in| we assume
+% that it shall overwrite our own setting.
+% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
+% \begin{macrocode}
+ \caption@settype*\LTcaptype
+ \ifdim\LTcapwidth=4in \else
+ \setcaptionwidth\LTcapwidth
+ \fi
+ \caption@setoptions{longtable}%
+% \caption@setContinuedFloat
+ \caption@setoptions{@longtable}%
+% \end{macrocode}
+%
+% \iffalse
+% The default |position=| setting for longtables is |top|.
+% (This emulates the standard behavior of the \package{longtable} package
+% which has no skip above the caption but a skip below it.)
+% \fi
+%
+% |position=auto| is a bad idea for longtables, but we do our very best.
+% This works quite well for captions inside the longtable contents, but
+% not for captions inside the longtable (end)foot.
+% \Note{This should be `top' if unclear!}
+% \begin{macrocode}
+ \caption@setautoposition{\ifcase\LT@rows t\else b\fi}%
+% \end{macrocode}
+%
+% We set |\ifcaption@star| according the 1st argument.
+% \begin{macrocode}
+ \caption@startrue#1\caption@starfalse
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/05/05}{\cs{caption@normalsize} added}
+% \begin{macrocode}
+ \caption@resetContinuedFloat\LTcaptype
+ \caption@begin\LTcaptype
+ \caption@normalsize
+% \end{macrocode}
+%
+% The following skip has the purpose to correct the height of the
+% |\parbox[t]|. Usually it's the height of the very first line, but
+% because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
+% it's always |0pt|.\par
+% (A different idea would be typesetting the first skip outside the longtable
+% column with |\noalign{\vskip|\ldots|}|, but this means we have to move
+% |\caption@begin| to some other place because it does not work in tabular
+% mode. And at the moment I have no idea on how to do this in an elegant
+% way\ldots)
+% \begin{macrocode}
+ \vskip-\ht\strutbox
+% \end{macrocode}
+%
+% The following code should look familiar. We do our skips and use
+% |\caption@@make| to typeset the caption itself.
+% \begin{macrocode}
+ \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
+ \caption@@make{#2}{#3}\endgraf
+ \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}%
+ \caption@end}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The picinpar package}
+% \changes{v3.1}{2007/06/13}{Support of the \package{picinpar} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picinpar}{%
+% \end{macrocode}
+%
+% \begin{macro}{\figwindow}
+% \begin{macro}{\tabwindow}
+% The \package{picinpar} package comes with its own caption code
+% (|\wincaption|, |\@wincaption|, |\@makewincaption|, \ldots)
+% so we redefine |\figwindow| \& |\tabwindow| to use |\caption| instead.
+% \begin{macrocode}
+ \long\def\figwindow[#1,#2,#3,#4] {%
+ \caption@window{figure}%
+ \caption@setoptions{figwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\tabwindow[#1,#2,#3,#4] {%
+ \caption@window{table}%
+ \caption@setoptions{tabwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@window}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Beside calling |\caption@settype| we redefine |\caption@boxrestore|
+% (as in \package{floatflt} \& \package{picins} package support)
+% and |\@makecaption| (as in \package{float} package support) here.
+% \begin{macrocode}
+ \newcommand*\caption@window[1]{%
+ \let\caption@boxrestore\@parboxrestore
+ \let\@makecaption\caption@@make
+ \caption@setautoposition b%
+ \caption@settype{#1}%
+ \caption@clearmargin}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@wincaption}
+% \changes{v3.1d}{2007/10/25}{Missing \% added}
+% This one finally typesets the caption using |\caption|.
+% \begin{macrocode}
+ \newcommand\caption@wincaption[1]{%
+% \end{macrocode}
+% This will be done twice for every |figwindow| \& |tabwindow| caption --
+% on the first run |\picwd| is |0pt|, on the second run |\picwd| is |\hsize|.
+% \begin{macrocode}
+ \ifdim\picwd=\z@
+ \let\caption@makecurrent\@gobbletwo
+ \let\caption@@start\relax
+ \caption@prepareslc
+ \fi
+% \end{macrocode}
+% The argument |#1| could contain simply the caption text
+% (e.g.~|A figure caption|), but it could also contain an optional argument,
+% the \meta{lst\_entry}
+% (e.g.~|[An| |entry| |to| |the| |LOF]||{A| |figure| |caption}|).
+% Therefore we have to test if |#1| begins with~|[| or not; furthermore we
+% support a starred variant -- as in |\caption*| -- so we test for~|*|, too.
+% \begin{macrocode}
+ \edef\@tempa{\expandafter\noexpand\@car#1\@nil}%
+ \if\@tempa*%
+ \let\@tempa\@firstofone
+ \else\if\@tempa[%]
+ \let\@tempa\@firstofone
+ \else
+ \let\@tempa\@empty
+ \fi\fi
+ \expandafter\caption\@tempa{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The picins package}
+% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
+%
+% \begin{macro}{\piccaptiontype}
+% |\piccaptiontype|\marg{type}\par
+% We offer this macro for changing the \meta{type} of the caption, so the user
+% doesn't have to redefine |\@captype|, as proposed in the \package{picins}
+% documentation.
+% \Note{We define this macro here so it can be used in the
+% preamble of the document, even when \thispackage\ was loaded prior to the
+% \package{picins} package.}
+% \begin{macrocode}
+\newcommand*\piccaptiontype[1]{\def\@piccaptype{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picins}{%
+% \end{macrocode}
+%
+% Initial set |\@piccaptype| and undefine |\@captype| which was set to
+% |figure| by the \package{picins} package.
+% \begin{macrocode}
+ \@ifundefined{@piccaptype}{%
+ \caption@iftype{%
+ \let\@piccaptype\@captype
+ }{%
+ \def\@piccaptype{figure}%
+ }%
+ }{}%
+ \let\@captype\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\piccaption}
+% The original code:
+% \begin{verbatim}
+% \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
+% \end{verbatim}%^^A
+% Our code uses |\caption@star| so |\piccaption*| works,
+% and |\caption@dblarg| so |\piccaption{}| works correctly.
+% \begin{macrocode}
+ \def\piccaption{\caption@star\relax{\caption@dblarg\@piccaption}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\make@piccaption}
+% \changes{v3.1}{2007/12/06}{Bugfix: \cs{caption@clearmargin} will always be used now}
+% The original code:
+% \begin{verbatim}
+% \def\make@piccaption{%
+% [...]
+% \setbox\@TEXT=\vbox{\hsize\hsiz@\caption[\sh@rtf@rm]{\capti@nt@xt}}%
+% }
+% \end{verbatim}%^^A
+% In our code we have to correct several things:
+% \begin{enumerate}
+% \item |\@captype| must be defined, since we have removed the global
+% definition.
+% \item We use |\caption@setoptions{parpic}| so
+% |\captionsetup[parpic]{|\ldots|}| is supported.
+% \item |\linewidth| must be set correctly.
+% Usually this is done by |\@parboxrestore| inside |\@caption|,
+% but since we use |\@caption@boxrestore| we have to map this to
+% |\@parboxrestore| instead.
+% \item The two arguments of |\caption| (|\sh@rtf@rm| \& |\capti@nt@xt|)
+% should be expanded on first level so |\caption[]{|\ldots|}| and
+% |\caption[|\ldots|]{}| work correctly.
+% \end{enumerate}
+% \begin{macrocode}
+ \let\caption@ORI@make@piccaption\make@piccaption
+ \def\make@piccaption{%
+ \let\caption@ORI\caption
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\caption[##1]##2{%
+ \caption@freezeHref % will be defrosted in \ivparpic
+ \caption@settype\@piccaptype
+% \ifnum\c@piccaptionpos>2\relax
+ \caption@clearmargin
+% \else
+% \captionwidth\z@ % do not use "width=" setting
+% \fi
+ \caption@setoptions{parpic}%
+ \let\caption@boxrestore\@parboxrestore
+ \caption@setautoposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\expandafter\expandafter\caption@ORI
+ \expandafter\expandafter\expandafter[%
+ \expandafter\expandafter\expandafter{%
+ \expandafter##1\expandafter}\expandafter]\expandafter{##2}}%
+% \end{macrocode}
+% {\footnotesize\begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\begingroup|\\
+% | \toks0\expandafter{##1}| |\toks2\expandafter{##2}|\\
+% | \edef\x{\endgroup|\\
+% | \noexpand\caption@ORI[{\the\toks0}]{\the\toks2}}|\\
+% | \x|
+% \end{quote}
+% \begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\edef\x{%|\\
+% | \noexpand\caption@ORI[{\unexpanded\expandafter{##1}}]%|\\
+% | {\unexpanded\expandafter{##2}}}|\\
+% |\x|
+% \end{quote}}
+% \begin{macrocode}
+ \caption@ORI@make@piccaption
+ \let\caption\caption@ORI}%
+% \end{macrocode}
+% \end{macro}
+%
+
+% \begin{macro}{\ivparpic}
+% We need to set our \package{hyperref} anchor here.
+% Not bullet-proof since we have to redefine |\noindent| here!
+% \begin{macrocode}
+ \let\caption@ORI@ivparpic\ivparpic
+ \def\ivparpic(#1,#2)(#3,#4)[#5][#6]#7{%
+ \let\caption@ORI@noindent\noindent
+ \def\noindent{%
+ \caption@defrostHref
+ \let\noindent\caption@ORI@noindent
+ \noindent}%
+ \caption@ORI@ivparpic(#1,#2)(#3,#4)[#5][#6]{#7}%
+ \let\noindent\caption@ORI@noindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\piccaptiontype\@undefined
+}
+% \end{macrocode}
+%
+% \subsubsection{The rotating package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{rotating}[1995/08/22 v2.10]{%
+% \end{macrocode}
+%
+% \begin{macro}{\rotcaption}
+% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@star} removed}
+% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
+% Make |\rotcaption*| work.
+% \begin{macrocode}
+ \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
+% \let\@rotcaption\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\rotcaptionof}
+% \changes{v3.0i}{2005/12/07}{New}
+% Make |\rotcaptionof(*)| work.
+% \begin{macrocode}
+ \def\rotcaptionof{%
+ \caption@teststar\caption@of{\rotcaption*}\rotcaption}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makerotcaption}
+% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
+% \changes{v3.0m}{2007/03/04}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox} now}
+% Original (bugfixed) code:
+% \begin{verbatim}
+% \long\def\@makerotcaption#1#2{%
+% \setbox\@tempboxa\hbox{#1: #2}%
+% \ifdim \wd\@tempboxa > .8\vsize
+% \rotatebox{90}{%
+% \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
+% }%\par % <== \par removed (AR)
+% \else%
+% \rotatebox{90}{\box\@tempboxa}%
+% \fi
+% \nobreak\hspace{12pt}% <== \nobreak added (AR)
+% }
+% \end{verbatim}%^^A
+% Our version emulates this behavior, but if |width=| is set,
+% the rotated caption is always typeset as |minipage|.
+% (Note that |margin=| is not supported here.)
+% \begin{macrocode}
+ \long\def\@makerotcaption#1#2{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \ifdim\captionwidth=\z@
+ \setcaptionwidth{.8\textheight}%
+ \caption@slc{#1}{#2}{.8\vsize}{%
+ \let\caption@makerot\caption@@make
+ \caption@clearmargin
+% \long\def\caption@parbox##1##2{\hbox{\hsize=.8\textheight\relax##2}}%
+% (not needed because \rotatebox uses an \hbox anyway)
+ \let\caption@parbox\@secondoftwo}%
+ \caption@set@bool\caption@ifslc0% been there, done that
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \rotatebox{90}{\caption@makerot{#1}{#2}}%
+ \nobreak\hspace{12pt}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \newcommand\caption@makerot[2]{%
+ \begin{minipage}\captionwidth\caption@@make{#1}{#2}\end{minipage}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1a}{2007/09/07}{\cs{DeclareFloatingEnvironment} defines sideways-variant, too}
+% \begin{macrocode}
+ \caption@For{typelist}{%
+ \newenvironment{sideways#1}{\@rotfloat{#1}}{\end@rotfloat}%
+ \newenvironment{sideways#1*}{\@rotdblfloat{#1}}{\end@rotdblfloat}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The sidecap package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{sidecap}[1999/05/11 v1.4d]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\SC@caption}
+% \changes{v3.0d}{2004/11/28}{Bugfix: Definition of \cs{@captype} added}
+% \changes{v3.0e}{2005/05/05}{Bugfix: Empty captions are handled correctly now}
+% \changes{v3.0e}{2005/05/05}{Priority of options fixed}
+% \changes{v3.0h}{2005/10/03}{Bugfix: Always use \cs{AtBeginDocument} to set \cs{SC@caption}}
+% First of all, we let \package{sidecap} use a current definition of |\caption|.\\
+% (This is only required for version 1.5d of the \package{sidecap} package.)
+% \begin{macrocode}
+ \caption@AtBeginDocument{\let\SC@caption=\caption}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SC@zfloat}
+% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
+% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@star} removed}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} will be saved \& restored now}
+% This macro will be called at the start of the environment, here is a good
+% opportunity to do some adaptations to |\caption| and |\captionsetup|.
+% \begin{macrocode}
+ \let\caption@ORI@SC@zfloat\SC@zfloat
+ \def\SC@zfloat#1#2#3[#4]{%
+% \end{macrocode}
+% First we use the original definition, but save \& restore \cs{caption}
+% so \cs{caption@freeze} will work correctly.
+% \begin{macrocode}
+ \let\caption@ORI\caption
+ \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]%
+ \let\caption\caption@ORI
+% \end{macrocode}
+% Since the sidecap package uses our |\caption| code outside the
+% environment the regular |\captionsetup| will not work.
+% So we need a special version here which saves the given argument list
+% which will be executed later on.
+% Furthermore we need to make |\caption*| work.
+% \begin{macrocode}
+ \caption@settype*{#2}%
+ \caption@freeze*}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\endSC@FLOAT}
+% \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
+% \changes{v3.1}{2007/05/05}{Call of \cs{caption@setoptions}\arg{SCfloat} added}
+% This macro will be called at the end of the environment, here we need to
+% setup our stuff before the \package{sidecap} package actually typesets
+% its caption.
+% \begin{macrocode}
+ \let\caption@ORI@endSC@FLOAT\endSC@FLOAT
+ \def\endSC@FLOAT{%
+% \end{macrocode}
+% \Note{\cs{@captype} isn't defined here, this will be done inside
+% the original definition of \cs{endSC@FLOAT}. But \cs{SC@captype} is
+% defined and can be used here, if needed.}
+% \begin{macrocode}
+ \let\caption@ORI@settype\caption@settype
+ \def\caption@settype##1{% will be done in \@xfloat
+ \caption@ORI@settype*{##1}% do not change \@currentlabel
+ \caption@setSC@justify
+%%% \caption@setoptions{SCfloat}%
+ \caption@setoptions{SC\@captype}%
+ \caption@start}%
+% \end{macrocode}
+% Before we can typeset the caption we need to set the margin to zero
+% because any extra margin would only be disturbing here.\par
+% (We don't need to take care about the caption position because
+% the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
+% to a skip of zero anyway.)\par
+% Furthermore |\SC@justify| will override the caption justification, if set.
+% The usage of |\SC@justify| differs from version to version of the
+% \package{sidecap} package:\par
+% \begin{tabular}{ll}
+% Version 1.4: & |\SC@justify| is not defined\\
+% Version 1.5: & |\SC@justify| is |\relax| when not set\\
+% Version 1.6: & |\SC@justify| is |\@empty| when not set\\
+% \end{tabular}
+% \begin{macrocode}
+ \def\caption@setSC@justify{%
+ \caption@clearmargin
+ \@ifundefined{SC@justify}{}{%
+ \ifx\SC@justify\@empty \else
+ \let\caption@hj\SC@justify
+ \let\SC@justify\@empty
+ \fi}}%
+% \end{macrocode}
+% Make the original definition of |\endSC@FLOAT| to use our caption
+% stuff instead of its own.
+% \Note{At this point the \package{sidecap} definition of \cs{caption} is valid,
+% not the regular one!}
+% \begin{macrocode}
+ \let\caption\SC@orig@caption
+ \def\SC@orig@caption[##1]##2{\caption@defrost}%
+% \end{macrocode}
+% Finally we call the original definition of |\endSC@FLOAT|.
+% \begin{macrocode}
+ \caption@setSC@justify % for compatibility mode
+ \caption@ORI@endSC@FLOAT}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1a}{2007/09/07}{\cs{DeclareFloatingEnvironment} defines SC-variant, too}
+% \changes{v3.1f}{2007/12/23}{Bugfix in definition of SC-variant}
+% \begin{macrocode}
+ \newcommand*\caption@For@SC[2]{%
+ \def#1{b}% = \sidecaptionvpos{#2}{b} (v1.6)
+ \newenvironment{SC#2}%
+ {\SC@float[#1]{#2}}{\endSC@float}%
+ \newenvironment{SC#2*}%
+ {\SC@dblfloat[#1]{#2}}{\endSC@dblfloat}}%
+ \@onlypreamble\caption@For@SC
+ \caption@For{typelist}{%
+ \expandafter\caption@For@SC\csname SC@#1@vpos\endcsname{#1}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The subfigure package}
+% \changes{v3.1}{2007/04/06}{subfigure package support added (package)}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{subfigure}[2002/01/23 v2.1]{%
+% \end{macrocode}
+%
+% \begin{macro}{\sf@ifpositiontop}
+% \changes{v3.1a}{2007/09/15}{Bugfix 07-09-15: Check for \cs{@captype} added}
+% If the \package{subfigure} package is loaded, we map |\sf@ifpositiontop|
+% to |\iffiguretopcap| resp. |\iftabletopcap|, so the \package{subfigure}
+% \version{2.1} options \opt{figbotcap} etc. will still work.
+% \begin{macrocode}
+ \def\sf@ifpositiontop{%
+ \ifx\@captype\@undefined
+ \expandafter\@gobbletwo
+ \else\ifx\@captype\relax
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\expandafter\sf@if@position@top
+ \fi\fi}
+% \end{macrocode}
+% \begin{macrocode}
+ \def\sf@if@position@top{%
+ \@ifundefined{if\@captype topcap}%
+ {\@gobbletwo}%
+ {\@nameuse{if\@captype topcap}%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The supertabular and xtab packages}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{supertabular}[2002/07/19 v4.1e]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
+% \changes{v3.1h}{2008/04/01}{Bugfix: Star variant does not increment table counter anymore}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1h}{2008/04/01}{Made \cs{nameref} \& \cs{autoref} work}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[#1]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
+% \changes{v3.1h}{2008/04/01}{Bugfix: \cs{@currentlabelname} will be set now}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% \if@topcaption \vskip 10\p@ \fi
+% \endgroup}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{supertabular}%
+% \end{macrocode}
+% The |position=| setting will be overwritten by the
+% \package{supertabular} package: If |\topcaption| was used,
+% the position will be |top| automatically, |bottom| otherwise.
+% \begin{macrocode}
+ \def\caption@fixposition{%
+ \caption@setposition{\if@topcaption t\else b\fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@boxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1h}{2008/04/01}{Support of the xtab package added}
+% \begin{macrocode}
+\caption@IfPackageLoaded{xtab}[2000/04/09 v2.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[#1]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \@initisotab
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}%
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% %% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% %% \if@topcaption \vskip 10\p@ \fi
+% \endgroup
+% \global\advance\ST@pageleft -\PWSTcapht
+% \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{xtabular}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@fixposition{%
+ \caption@setposition{\if@topcaption t\else b\fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@initisotab
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@boxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end
+ \global\advance\ST@pageleft -\PWSTcapht
+ \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The threeparttable package}
+% \changes{v3.1}{2007/05/08}{Support of the \package{threeparttable} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{threeparttable}[2003/06/13 v3.0]{%
+% \end{macrocode}
+%
+% \begin{macro}{\threeparttable}
+% Unfortunately |\@captype| is not set when |\TPT@common| will be used,
+% so we have to redefine |\threeparttable| and |\measuredfigure| instead.
+% \begin{macrocode}
+ \let\caption@ORI@threeparttable\threeparttable
+ \renewcommand*\threeparttable{%
+ \caption@settype{table}%
+ \caption@setposition a% ?
+ \caption@clearmargin
+ \caption@setoptions{threeparttable}%
+ \caption@ORI@threeparttable}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\measuredfigure}
+% Same here\ldots
+% \begin{macrocode}
+ \let\caption@ORI@measuredfigure\measuredfigure
+ \renewcommand*\measuredfigure{%
+ \caption@settype{figure}%
+ \caption@setposition a% ?
+ \caption@clearmargin
+ \caption@setoptions{measuredfigure}%
+ \caption@ORI@measuredfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\TPT@caption}
+% The original code:
+% \begin{verbatim}
+% \def\TPT@caption#1[#2]#3{\gdef\TPT@docapt
+% {\par\global\let\TPT@docapt\@undefined \TPT@LA@caption{#1}[{#2}]%
+% {\strut\ignorespaces#3\ifhmode\unskip\@finalstrut\strutbox\fi}}%
+% \ifx\TPT@hsize\@empty \let\label\TPT@gatherlabel \abovecaptionskip\z@skip
+% \else \TPT@docapt \fi \ignorespaces}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \def\TPT@caption#1[#2]#3{%
+ \gdef\TPT@docapt{%
+ \global\let\TPT@docapt\@undefined
+ \caption@setautoposition\caption@TPT@position
+ \TPT@LA@caption{#1}[{#2}]{#3}}%
+ \ifx\TPT@hsize\@empty
+ \let\label\TPT@gatherlabel % Bug: does not work for measuredfigures
+ \gdef\caption@TPT@position{t}%
+ \g@addto@macro\TPT@docapt\caption@TPT@eatvskip
+ \else
+ \def\caption@TPT@position{b}%
+ \TPT@docapt
+ \fi
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ %\newcommand*\caption@TPT@eatvskip{\vskip-.2\baselineskip}%
+ \def\caption@TPT@eatvskip#1\vskip{#1\@tempdima=}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The wrapfig package}
+% \changes{v3.1}{2007/05/05}{Support of the \package{wrapfig} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{wrapfig}{% ver 3.3 (Oct 12, 1999)
+% \end{macrocode}
+%
+% \begin{macro}{\float@ifstyle}
+% \changes{v3.1}{2007/06/10}{This macro added}
+% |\float@ifstyle|\marg{type}\marg{if-clause}\marg{else-clause}\par
+% (see \package{float} package support for details)
+% \begin{macrocode}
+ \providecommand*\float@ifstyle[1]{%
+ \expandafter\ifx\csname fst@#1\endcsname\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@restylewrapfloat}
+% This one redefines the |wrap#1| environment, e.g.~|wrapfigure|.
+% Our code uses |\caption@setoptions{wrapfigure}| so
+% |\captionsetup[wrapfigure]{|\ldots|}| will work.\par
+% But first we check if our redefinition was already done, this could
+% happen inside |\float@restyle| when the \package{wrapfig} support of
+% the \package{float} package was not installed successfully, so it has
+% not redefined |\wrap#1| there.
+% \begin{macrocode}
+ \newcommand*\caption@restylewrapfloat[1]{%
+ \expandafter\ifx\csname caption@OUR@wrap#1\expandafter\endcsname
+ \csname wrap#1\endcsname
+ \caption@Error{%
+ For a successful cooperation of the `wrapfig' package\MessageBreak
+ with the `float' package you should load the `wrapfig'\MessageBreak
+ package *after* the `float' package}%
+ \else
+ \expandafter\let\csname caption@ORI@wrap#1\expandafter\endcsname
+ \csname wrap#1\endcsname
+ \@namedef{wrap#1}{\caption@wrapfloat{#1}}%
+ \expandafter\let\csname caption@OUR@wrap#1\expandafter\endcsname
+ \csname wrap#1\endcsname
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@wrapfloat}
+% \begin{macrocode}
+ \newcommand*\caption@wrapfloat[1]{%
+ \caption@settype*{#1}%
+ \float@ifstyle{#1}{%
+ \ifx\WF@floatstyhook\@undefined
+ \caption@Error{%
+ For a successful cooperation of the `wrapfig' package\MessageBreak
+ with the `float' package you should use at least\MessageBreak
+ `wrapfig' version 3.6}%
+ \else
+ \float@dostyle{#1}%
+ \fi}{}%
+ \caption@clearmargin
+%%% \caption@setoptions{wrapfloat}%
+ \caption@setoptions{wrap#1}%
+ \@nameuse{caption@ORI@wrap#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% Now we redefine the \package{wrapfig} environments we know about.\par
+% If someone has placed a |\newfloat| right between |\usepackage{wrapfig}|
+% and |\usepackage{caption}| (or loads \thispackage\ first, so all these
+% patches will be done with |\AtBeginDocument|) we have bad luck since the
+% \package{float} package do not offer a list of (re)styled floats.
+% (This would finally lead to an error in |\caption@setfloatcapt|.)
+%
+% \begin{macrocode}
+ \caption@restylewrapfloat{figure}%
+ \caption@restylewrapfloat{table}%
+% \end{macrocode}
+%
+% \changes{v3.1a}{2007/09/07}{\cs{DeclareFloatingEnvironment} defines wrap-variant, too}
+% \begin{macrocode}
+ \caption@For{typelist}{%
+ \newenvironment{wrap#1}{\wrapfloat{#1}}{\endwrapfloat}%
+ \caption@restylewrapfloat{#1}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \ifx\WF@floatstyhook\@undefined \else % wrapfig v3.6
+% \end{macrocode}
+%
+% \begin{macro}{\float@restyle}
+% If the \package{wrapfig} package \version{3.6} is used, we patch
+% |\float@restyle| (if defined), too, so new or restyled floats will be
+% handled correctly, too.
+% \begin{macrocode}
+ \@ifundefined{float@restyle}{}{%
+ \toks@=\expandafter{\float@restyle{#1}% (env may or may not be defined)
+ \caption@restylewrapfloat{#1}}%
+ \edef\@tempa{\def\noexpand\float@restyle##1{\the\toks@}}%
+ \@tempa}% perform redefinitions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\wrapfloat}
+% An additional check of the package load order:
+% If both, neither the \package{wrapfig} package nor \thispackage\ haven't
+% catch |\float@restyle|, we finally splash down at |\wrapfloat|.
+% \begin{macrocode}
+ \let\caption@ORI@wrapfloat\wrapfloat
+ \def\wrapfloat#1{%
+ \float@ifstyle{#1}{%
+ \caption@Error{%
+ For a successful cooperation of the `wrapfig' package\MessageBreak
+ with the `float' package you should load the `wrapfig'\MessageBreak
+ package *right after* the `float' package}}{}%
+ \caption@ORI@wrapfloat{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \fi % wrapfig v3.6
+% \end{macrocode}
+%
+% \begin{macro}{\WF@rapt}
+% We place our \package{hyperref} anchor here.\par
+% Original code:
+% \begin{verbatim}
+% \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+% \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+% \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+% \ifdim\hsize>\z@ \@parboxrestore \else
+% \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+% \ignorespaces \fi}
+% \end{verbatim}%^^A
+% Our code:
+% \begin{macrocode}
+ \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+ \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+ \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+ \caption@start
+ \ifdim\hsize>\z@ \@parboxrestore \else
+ \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+ \ignorespaces \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \begin{thebibliography}{99}
+% \bibitem{TLC2}
+% Frank Mittelbach and Michel Goossens:\\
+% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\
+% \newblock Addison-Wesley, 2004.
+%
+% \bibitem{beamer}
+% Till Tantau:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/beamer/}%
+% {\emph{User Guide to the Beamer Class, Version 3.07}},\\
+% March 11, 2007
+%
+% \bibitem{KOMAScript}
+% Markus Kohm \& Jens-Uwe-Morawski:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/koma-script/}%
+% {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\
+% 2007-01-09
+%
+% \bibitem{NTG}
+% Victor Eijkhout:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/ntgclass/}%
+% {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\
+% 3 September 1989
+%
+% \bibitem{float}
+% Anselm Lingnau:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/float/}%
+% {\emph{An Improved Environment for Floats}},\\
+% 2001/11/08
+%
+% \bibitem{floatflt}
+% Mats Dahlgren:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/floatflt/}%
+% {\emph{Welcome to the floatflt package}},\\
+% 1998/06/05
+%
+% \bibitem{floatrow}
+% Olga Lapko:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/floatrow/}%
+% {\emph{The floatrow package documentation}},\\
+% 2007/08/24
+%
+% \bibitem{fltpage}
+% Sebastian Gross:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/fltpage/}%
+% {\emph{Welcome to the beta test of fltpage package!}},\\
+% 1998/11/13
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/hyperref/}%
+% {\emph{Hypertext marks in \LaTeX}},\\
+% November 12, 2007
+%
+% \bibitem{hypcap}
+% Heiko Oberdiek:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/oberdiek/}%
+% {\emph{The hypcap package -- Adjusting anchors of captions}},\\
+% 2007/04/09
+%
+% \bibitem{listings}
+% Carsten Heinz \& Brooks Moses:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/listings/}%
+% {\emph{The Listings Package}},\\
+% 2007/02/22
+%
+% \bibitem{longtable}
+% David Carlisle:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/required/tools/}%
+% {\emph{The longtable package}},\\
+% 2004/02/01
+%
+% \bibitem{picinpar}
+% Friedhelm Sowa:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex209/contrib/picinpar/}%
+% {\emph{Pictures in Paragraphs}},\\
+% July 13, 1993
+%
+% \bibitem{picins}
+% Joachim Bleser and Edmund Lang:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex209/contrib/picins/}%
+% {\emph{PicIns-Benutzerhandbuch Version 3.0}},\\
+% September~1992
+%
+% \bibitem{rotating}
+% Sebastian Rahtz and Leonor Barroca:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/rotating/}%
+% {\emph{A style option for rotated objects in \LaTeX}},\\
+% 1997/09/26
+%
+% \bibitem{sidecap}
+% Rolf Niepraschk \& Hubert G\"a\ss lein:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/sidecap/}%
+% {\emph{The sidecap package}},\\
+% 2003/06/06
+%
+% \bibitem{subfigure}
+% Steven D. Cochran:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/subfigure/}%
+% {\emph{The subfigure package}},\\
+% 2002/07/02
+%
+% \bibitem{subfig}
+% Steven D. Cochran:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/subfig/}%
+% {\emph{The subfig package}},\\
+% 2005/07/05
+%
+% \bibitem{supertabular}
+% Johannes Braams and Theo Jurriens:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/supertabular/}%
+% {\emph{The supertabular environment}},\\
+% 2002/07/19
+%
+% \bibitem{threeparttable}
+% Donald Arseneau:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/misc/}%
+% {\emph{Three part tables: title, tabular environment, notes}},\\
+% 2003/06/13
+%
+% \bibitem{wrapfig}
+% Donald Arseneau:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/wrapfig/}%
+% {\emph{WRAPFIG.STY ver 3.6}},\\
+% 2003/01/31
+%
+% \bibitem{xtab}
+% Peter Wilson:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/xtab/}%
+% {\emph{The xtab package}},\\
+% 2004/05/24
+%
+% \bibitem{Anne}
+% Anne Br\"uggemann-Klein:\\
+% \emph{Einf\"uhrung in die Dokumentverarbeitung},\\
+% B.G. Teubner, Stuttgart, 1989
+%
+% \bibitem{refcount}
+% Heiko Oberdiek:\\
+% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/oberdiek/refcount.pdf}%
+% {\emph{The refcount package}},\\
+% 2006/02/20
+% \end{thebibliography}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.2/caption.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.2/caption.dtx
new file mode 100644
index 00000000000..7f31da44f24
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.2/caption.dtx
@@ -0,0 +1,4521 @@
+% \iffalse meta-comment
+%
+% This is file `caption.dtx'.
+%
+% Copyright (C) 1994-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files caption.ins, caption.dtx, caption2.dtx,
+% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx,
+% the derived files caption.sty, caption2.sty, caption3.sty,
+% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty,
+% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
+%
+% \fi
+% \CheckSum{3534}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{caption.drv}[2011/08/06 v3.2 Implementation of the caption package]
+\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+\makeatletter % make room for subsections like 2.16.14 in the TOC
+%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
+\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
+\makeatother
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage[debug]{caption}[2010/09/01]
+%
+\DeclareRobustCommand*\eTeX{\texorpdfstring
+ {\leavevmode\hbox{$\varepsilon$}-\TeX}%
+ {e-TeX}}
+\DeclareRobustCommand*\AmS{\texorpdfstring
+ {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
+ {AMS}}
+\DeclareRobustCommand*\KOMAScript{\texorpdfstring
+ {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
+ {KOMA-Script}}
+\DeclareRobustCommand*\NTG{NTG}
+\DeclareRobustCommand*\SmF{SMF}
+%
+\begin{document}
+ \DocInput{caption.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
+% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
+% \let\class\puresf \let\package\puresf
+% \let\env\purett \let\opt\purett
+%
+% \def\thispackage{the \package{caption} package}
+% \def\Thispackage{The \package{caption} package}
+%
+% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+% \newcommand*\version[2][]{\textit{v#2}}
+% \newcommand*\x{\discretionary{-}{}{}}
+% \newcommand*\xx{\discretionary{}{}{}}
+%
+% \GetFileInfo{caption.drv}
+% \let\docdate\filedate
+% \GetFileInfo{caption.sty}
+%
+% \title{The Implementation of
+% \texorpdfstring{\thispackage\thanks{%^^A
+% This package has version number \fileversion, last revised \filedate.}}%^^A
+% {the caption package}}
+% \author{Axel Sommerfeldt\\
+% \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}}
+% \date{\docdate}
+% \maketitle
+%
+% \begin{abstract}
+% \Thispackage\ consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% \Thispackage\ redefines the \LaTeX\ commands
+% |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
+% |\caption@@make|, giving the user the possibility to control the look \& feel
+% of the captions from floating environments like |figure| and |table|.
+% Furthermore it does similar to the caption stuff coming from other packages
+% (like the \package{longtable} or \package{supertabular} package):
+% Mapping the appropriate internal commands (like |\LT@makecaption| or
+% |\ST@caption|) to the ones offered by the \package{caption3} kernel.
+% So you can think of \thispackage\ as a layer package, it
+% simply provides adaptation layers between the caption stuff coming from
+% \LaTeXe\ or packages, and the caption stuff offered by the
+% \package{caption3} kernel.
+% \end{abstract}
+%
+% \section*{User manuals}
+%
+% This document is describing the code implementation only. The user
+% documentation can be found in
+% \nopagebreak\begin{quote}
+% \begin{tabular}{ll}
+% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/caption/caption-eng.pdf}%
+% {\texttt{caption-eng.pdf}} & The English documentation \\
+% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/caption/caption-rus.pdf}%
+% {\texttt{caption-rus.pdf}} & The Russian documentation\footnotemark \\
+% \href{ftp://dante.ctan.org/tex-archive/macros/latex/contrib/caption/caption-deu.pdf}%
+% {\texttt{caption-deu.pdf}} & The German documentation \\
+% \end{tabular}
+% \footnotetext{Thanks a lot to Olga Lapko for this translation}
+% \end{quote}
+%
+% \StopEventually{}
+% \clearpage
+% \tableofcontents
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
+%
+% \changes{v1.0}{1994/10/27}{First release}
+% \changes{v1.1}{1994/11/03}{New option \texttt{centerlast}}
+% \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
+% \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
+% \changes{v1.4}{1995/01/30}{New option \texttt{nooneline}}
+% \changes{v1.4b}{1995/04/05}{Bugfix release}
+% \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v3.0d}{2004/11/28}{Split into two packages:
+% \package{caption} \& \package{caption3}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \let\subsubsection\subsection
+% \let\subsection\section
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \subsection{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption}[2011/11/10 v3.2e Customizing captions (AR)]
+%\@ifundefined{PackageRedefines}{}{\PackageRedefines{caption}{caption}}
+% \end{macrocode}
+%
+% \subsection{Loading the kernel}
+%
+% \begin{macrocode}
+\RequirePackage{caption3}[=2011/08/30] % needs v1.4 or newer
+% \end{macrocode}
+%
+% \subsection{Check against incompatible document classes}
+%
+% \begin{macrocode}
+\caption@ifbool{documentclass}{}{%
+ \caption@WarningNoLine{%
+ Unsupported document class (or package) detected,\MessageBreak
+ usage of the caption package is not recommended}%
+ \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption}%
+}
+% \end{macrocode}
+%
+% \subsection{Check against incompatible packages}
+%
+% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
+% \begin{macrocode}
+\@ifpackageloaded{caption2}{%
+ \caption@Error{%
+ You can't use both, the (obsolete) caption2 *and*\MessageBreak
+ the (current) caption package}%
+ \endinput
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{ftcap} package added}
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{nonfloat} package added}
+% \changes{v3.1}{2007/06/18}{Check against incompatible \package{topcapt} package added}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}%
+ \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}%
+ \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}}
+% \end{macrocode}
+% \begin{macro}{\caption@DisablePositionOption}
+% \changes{v3.1g}{2008/03/20}{\texttt{position=b} added}
+% \changes{v3.1h}{2008/03/29}{%
+% Name changed from \cs{caption@IncompatiblePackage} to \cs{caption@DisablePositionOption};
+% moved from package to kernel; disables the `position' option now instead of issuing a warning}
+% |\caption@DisablePositionOption|\marg{package}\par
+% disables the `position' option.
+% \begin{macrocode}
+\newcommand*\caption@DisablePositionOption[1]{%
+ \caption@InfoNoLine{%
+ `#1' package detected; setting `position=b' for compatibility reasons}%
+ \caption@setposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{position}{%
+ \caption@Error{Usage of the `position' option is incompatible\MessageBreak
+ to the `#1' package}}}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@DisablePositionOption
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Declaration of options}
+%
+% \subsubsection{Options for figure and table}
+%
+% \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figureposition}{%
+ \captionsetup*[figure]{position=#1}}
+\@onlypreamble@key{caption}{figureposition}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{tableposition}{%
+ \captionsetup*[table]{position=#1}}
+\@onlypreamble@key{caption}{tableposition}
+% \end{macrocode}
+%
+% \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
+% \changes{v3.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written}
+% \changes{v3.1f}{2007/11/18}{Options \opt{figurename} and \opt{tablename} are now
+% available after the document preamble, too.}
+% \changes{v3.1f}{2007/11/18}{Option \opt{name} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}}
+\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}}
+\DeclareCaptionOption{name}{\caption@setname\@captype{#1}}
+% \end{macrocode}
+%
+% \changes{v3.1g}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}}
+\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@SetName}
+% \changes{v3.1}{2007/07/04}{This macro added}
+% \changes{v3.1f}{2007/11/18}{After-preamble variant added}
+% \changes{v3.1g}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}}
+% \changes{v3.1i}{2008/08/02}{Bugfix: Works now without \cs{addto}, too}
+% \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package}
+% |\caption@SetName|\marg{cmd}\marg{value}
+% \begin{macrocode}
+\newcommand*\caption@SetName{%
+ \RequirePackage{newfloat}%
+ \newfloat@setname}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setname[2]{\@namedef{#1name}{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument{\let\caption@SetName\caption@setname}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1f}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added}
+% \changes{v3.1i}{2008/04/13}{Option \opt{within} added}
+% \changes{v3.1l}{2010/01/09}{The \opt{within} options are now available within the document, too}
+% \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined
+% floats declared with \cs{DeclareCaptionType}, too}
+%
+% \begin{macro}{\caption@DeclareWithinOption}
+% \changes{v3.1l}{2010/01/09}{This macro and its usage added}
+% \begin{macrocode}
+\newcommand*\caption@DeclareWithinOption[1]{%
+ \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}%
+ \DeclareCaptionOptionNoValue{#1without}{\caption@Within{#1}{none}}}
+\@onlypreamble\caption@DeclareWithinOption
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\caption@DeclareWithinOption{figure}
+\caption@DeclareWithinOption{table}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{within}{%
+ \RequirePackage{newfloat}%
+ \newfloatsetup{within=#1}}
+\DeclareCaptionOptionNoValue{without}{%
+ \RequirePackage{newfloat}%
+ \newfloatsetup{without}}
+% \end{macrocode}
+% \begin{macro}{\caption@Within}
+% \changes{v3.1}{2007/12/21}{This macro added}
+% \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package}
+% \begin{macrocode}
+\newcommand*\caption@Within{%
+ \RequirePackage{newfloat}%
+ \newfloat@setwithin}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Miscellaneous options}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{config}[caption]{%
+ \InputIfFileExists{#1.cfg}%
+ {\typeout{*** Local configuration file #1.cfg used ***}}%
+ {\caption@Warning{Configuration file #1.cfg not found}}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setparboxrestore}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% |\caption@setparboxrestore|\marg{\purett{partial} or \purett{full}}
+% \begin{macrocode}
+\newcommand*\caption@setparboxrestore[1]{%
+ \caption@ifinlist{#1}{full}{%
+ \caption@setfullparboxrestore
+ }{\caption@ifinlist{#1}{default,light,partial}{%
+ \let\caption@parboxrestore\@secondoftwo
+ }{%
+ \caption@Error{Undefined parboxrestore `#1'}%
+ }}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setfullparboxrestore}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% |\caption@setfullparboxrestore|\par
+% This is an abbreviation for |\caption@setparboxrestore{full}|.
+% \begin{macrocode}
+\newcommand*\caption@setfullparboxrestore{%
+ \let\caption@parboxrestore\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.2}{2010/11/07}{Option \opt{parboxrestore} added}
+% \begin{macrocode}
+\DeclareCaptionOption{parboxrestore}{\caption@setparboxrestore{#1}}
+\captionsetup{parboxrestore=default}
+% \end{macrocode}
+%
+% \changes{v3.1f}{2007/11/28}{Option \opt{@minipage=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{@minipage}{%
+ \caption@ifinlist{#1}{auto,default}%
+ {\let\caption@if@minipage\@gobbletwo}%
+ {\caption@set@bool\caption@if@minipage{#1}}}
+\captionsetup{@minipage=default}
+% \end{macrocode}
+%
+% \subsubsection{caption v1.x compatibility options}
+% \changes{v3.1}{2007/07/21}{Option `compatibility' added}
+% \changes{v3.1}{2007/09/01}{caption v1.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v1.x$ compatibility options}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{compatibility}[1]{\caption@setbool{compatibility}{#1}}
+\@onlypreamble@key{caption}{compatibility}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{normal}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{isu}{%
+ \caption@setformat{hang}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{hang}{%
+ \caption@setformat{hang}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{center}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centering}}
+\DeclareCaptionOptionNoValue*{anne}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centerlast}}
+\DeclareCaptionOptionNoValue*{centerlast}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centerlast}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}}
+\DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}}
+\DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}}
+\DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}}
+\DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}}
+\DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{up}{\l@addto@macro\captionlabelfont\upshape}
+\DeclareCaptionOptionNoValue*{it}{\l@addto@macro\captionlabelfont\itshape}
+\DeclareCaptionOptionNoValue*{sl}{\l@addto@macro\captionlabelfont\slshape}
+\DeclareCaptionOptionNoValue*{sc}{\l@addto@macro\captionlabelfont\scshape}
+\DeclareCaptionOptionNoValue*{md}{\l@addto@macro\captionlabelfont\mdseries}
+\DeclareCaptionOptionNoValue*{bf}{\l@addto@macro\captionlabelfont\bfseries}
+\DeclareCaptionOptionNoValue*{rm}{\l@addto@macro\captionlabelfont\rmfamily}
+\DeclareCaptionOptionNoValue*{sf}{\l@addto@macro\captionlabelfont\sffamily}
+\DeclareCaptionOptionNoValue*{tt}{\l@addto@macro\captionlabelfont\ttfamily}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{nooneline}{\caption@setbool{slc}{0}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\caption@setbool{ruled}{0}
+\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}}
+% \end{macrocode}
+%
+% \subsubsection{caption2 v2.x compatibility options}
+% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
+% \changes{v3.1}{2007/09/01}{caption2 v2.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v2.x$ compatibility options}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{flushleft}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{raggedright}}
+\DeclareCaptionOptionNoValue*{flushright}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{raggedleft}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{oneline}{\caption@setbool{slc}{1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{%
+ \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}}
+% \end{macrocode}
+%
+% \subsubsection{Obsolete caption v3.0 options}
+% \changes{v3.1}{2007/05/07}{Package option \opt{caption} marked as obsolete,
+% gives error now}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{caption}{%
+ \caption@setbool{temp}{#1}%
+ \caption@ifbool{temp}{}{%
+ \caption@Error{%
+ The package option `caption=#1' is obsolete.\MessageBreak
+ Please pass this option to the subfig package instead\MessageBreak
+ and do *not* load the caption package anymore}}}
+% \end{macrocode}
+%
+% \subsubsection{fltpage package support options}
+%
+% \changes{v3.1}{2007/09/01}{Options `FPlist' \& `FPref' added}
+% With these options is controlled where the list-of entry and |\ref| resp.
+% |\pageref| or |\autoref| will link to.
+% Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent,
+% but compatible to the usual behaviour of the \package{fltpage} package.
+% \begin{macrocode}
+\DeclareCaptionOption{FPlist}[1]{\caption@setFPoption{list}{#1}}
+\DeclareCaptionOption{FPref}[1]{\caption@setFPoption{ref}{#1}}
+\@onlypreamble@key{caption}{FPlist}
+\@onlypreamble@key{caption}{FPref}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setFPoption[2]{%
+ \edef\caption@tempa{\@car#2\@nil}%
+ \caption@setbool{FP#1cap}{\if c\caption@tempa 1\else 0\fi}}
+\@onlypreamble\caption@setFPoption
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{FPlist=caption,FPref=figure}
+% \end{macrocode}
+%
+% \subsubsection{hyperref package support options}
+%
+% \changes{v3.1}{2007/06/21}{Options `hypcap' \& `hypcapspace' added}
+% With |hypcap=off| one can turn the \package{hypcap} support off
+% (default is |on|).
+% \begin{macrocode}
+\DeclareCaptionOption{hypcap}[1]{\caption@setbool{hypcap}{#1}}
+\DeclareCaptionOption{hypcapspace}{\def\caption@hypcapspace{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{hypcap=1,hypcapspace=.5\baselineskip}
+% \end{macrocode}
+%
+% \subsection{\AmS{} \& \SmF{} document classes support}
+% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ document classes support added}
+%
+% \begin{macrocode}
+\caption@ifamsclass{%
+ \caption@InfoNoLine{AMS or SMF document class}%
+% \end{macrocode}
+% \begin{macrocode}
+ \setlength\belowcaptionskip{0pt}% set to 12pt by AMS class
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{\KOMAScript{} document classes support}
+% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added}
+% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added}
+% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added}
+% \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised}
+% \changes{v3.1}{2007/03/17}{\KOMAScript\ compatibility options removed}
+% \changes{v3.1}{2007/04/05}{\KOMAScript\ compatibility revised \& enhanced}
+%
+% \begin{macrocode}
+\caption@ifkomaclass{%
+ \caption@InfoNoLine{KOMA-Script document class}%
+% \end{macrocode}
+%
+% Here we emulate the caption related commands and take over the caption
+% related settings from the \KOMAScript\ classes.
+%
+% \begin{macro}{\@tablecaptionabovetrue}
+% \begin{macro}{\@tablecaptionabovefalse}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \begin{macrocode}
+ \g@addto@macro\@tablecaptionabovetrue{\captionsetup*[table]{position=t}}
+ \g@addto@macro\@tablecaptionabovefalse{\captionsetup*[table]{position=b}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ \if@tablecaptionabove
+ \@tablecaptionabovetrue
+ \else
+ \@tablecaptionabovefalse
+ \fi
+% \end{macrocode}
+%
+% \begin{macro}{\onelinecaptionstrue}
+% \begin{macro}{\onelinecaptionsfalse}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \begin{macrocode}
+ \g@addto@macro\onelinecaptionstrue{\let\caption@ifslc\@firstoftwo}
+ \g@addto@macro\onelinecaptionsfalse{\let\caption@ifslc\@secondoftwo}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ \ifonelinecaptions
+ \onelinecaptionstrue
+ \else
+ \onelinecaptionsfalse
+ \fi
+% \end{macrocode}
+%
+% \begin{macro}{\@captionabovetrue}
+% \begin{macro}{\@captionabovefalse}
+% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21:
+% \cs{let}\cs{caption@setposition}\cs{@gobble} added}
+% \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed}
+% \changes{v3.1}{2007/03/31}{We redefine \cs{captionabovetrue/false} now
+% instead of \cs{captionabove/below}}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \changes{v3.1k}{2009/10/09}{\opt{figureposition} and \opt{tableposition} will issue a warning now}
+% Please note that these are stronger than the \opt{position} setting, therefore we
+% override the options \opt{figureposition} and \opt{tableposition} to typeout a warning.
+% \begin{macrocode}
+ \g@addto@macro\@captionabovetrue{\let\caption@position\@firstoftwo}
+ \g@addto@macro\@captionabovefalse{\let\caption@position\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{figureposition}{%
+ \caption@WarningNoLine{Option `figureposition=#1' has no effect\MessageBreak
+ when used with a KOMA script document class}}
+ \DeclareCaptionOption{tableposition}{%
+ \caption@WarningNoLine{Option `tableposition=#1' has no effect\MessageBreak
+ when used with a KOMA script document class}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\setcapindent}
+% \begin{macrocode}
+ \let\caption@KOMA@setcapindent\@setcapindent
+ \renewcommand*\@setcapindent[1]{%
+ \caption@KOMA@setcapindent{#1}\caption@setcapindent}
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KOMA@@setcapindent\@@setcapindent
+ \renewcommand*\@@setcapindent[1]{%
+ \caption@KOMA@@setcapindent{#1}\caption@setcapindent}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapindent{%
+ \captionsetup{indent=\ifdim\cap@indent<\z@\z@\else\cap@indent\fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \caption@ifundefined\cap@indent{}{\caption@setcapindent}
+% \end{macrocode}
+%
+% \begin{macro}{\setcapwidth}
+% \Note{The optional argument of \cs{setcapwidth} if not supported (yet),
+% so we issue a warning if used.
+% (Since this does not seem to have an negative effect when used
+% by the \texttt{captionbeside} environment, we suppress the warning here.)}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@setcapwidth
+ \csname\string\setcapwidth\endcsname
+ \@namedef{\string\setcapwidth}[#1]#2{%
+ \caption@KOMA@setcapwidth[#1]{#2}\caption@setcapwidth{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapwidth[1]{%
+ \ifx\\#1\\\else
+ \caption@ifundefined\cap@margin{}{%
+ \def\@tempa{captionbeside}%
+ \ifx\@tempa\@currenvir\else\caption@Warning{%
+ Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}%
+ \fi}%
+ \fi
+ \captionsetup{width=\cap@width}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \def\caption@tempa{\hsize}%
+ \ifx\caption@tempa\cap@width \else
+ \caption@setcapwidth{?}
+ \fi
+% \end{macrocode}
+%
+% \begin{macro}{\setcapmargin}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@setcapmargin
+ \csname\string\@setcapmargin\endcsname
+ \@namedef{\string\@setcapmargin}[#1]#2{%
+ \caption@KOMA@setcapmargin[#1]{#2}\caption@setcapmargin}
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@@setcapmargin
+ \csname\string\@@setcapmargin\endcsname
+ \@namedef{\string\@@setcapmargin}[#1]#2{%
+ \caption@KOMA@@setcapmargin[#1]{#2}\caption@setcapmargin}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapmargin{%
+ \begingroup
+ \let\onelinecaptionsfalse\relax
+ \def\@twoside{0}%
+ \def\if@twoside{\def\@twoside{1}\iffalse}%
+ \cap@margin
+ \def\@tempa{\endgroup}%
+ \ifx\cap@left\hfill\else\ifx\cap@right\hfill\else
+ \def\hspace##1##{\@firstofone}%
+ \edef\@tempa{\endgroup
+ \noexpand\captionsetup{%
+ twoside=\@twoside,slc=0,%
+ margin={\cap@left,\cap@right}}}%
+ \fi\fi
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \ifx\cap@margin\relax \else
+ \caption@setcapmargin
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{Processing of options}
+%
+% \changes{v3.0m}{2007/03/04}{Verbose option added}
+% \changes{v3.1}{2007/07/02}{Verbose option removed from package}
+%
+% \changes{v3.1}{2007/03/17}{We do not process global options anymore}
+% \begin{macrocode}
+\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}
+\caption@ProcessOptions*{caption}
+% \end{macrocode}
+%
+% \subsection{\cs{caption}, \cs{@caption}, and \cs{@makecaption}}
+%
+% \begin{macro}{\caption@caption}
+% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
+% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
+% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% \changes{v3.2c}{2011/09/04}{Support of \cs{donemaincaptiontrue} from \textsf{memoir} document class added}
+% Here comes our definition of |\caption| and |\caption*|.
+% Beside the support of the starred variant this code was adapted to the
+% various packages we support.
+% We are using |\caption@dblarg| instead of |\@dblarg| so |\caption{}|
+% (with an empty arg.) will produce a list-of entry, but |\caption[]{}|
+% won't.
+% \begin{macrocode}
+\def\caption@caption{%
+ \caption@iftype
+ {\caption@checkgrouplevel\@empty\caption
+ \caption@star
+ {\@nameuse{donemaincaptiontrue}%
+ \caption@refstepcounter\@captype}%
+ {\caption@dblarg{\@caption\@captype}}}%
+ {\caption@Error{\noexpand\caption outside float}%
+ \caption@gobble}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@star}
+% \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}}
+% \changes{v3.2c}{2011/08/21}{\cs{global} removed}
+% A helper macro which processes the optional |*| after |\caption|.
+% \begin{macrocode}
+\newcommand*\caption@star[2]{%
+ \@ifstar{\caption@startrue#2[]}{#1#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@caption}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% \changes{v3.1f}{2007/11/28}{Bugfix: Handling of \texttt{@minipage} flag added}
+% \changes{v3.1f}{2007/11/28}{Support of option \opt{@minipage} added}
+% \changes{v3.1g}{2008/03/16}{Internal: Uses \cs{caption@prepareanchor} now}
+% \changes{v3.2d}{2011/10/21}{Adapted to the \textsf{memoir} document class}
+% As above, our version has been adapted to the packages we support.
+% Additionally our code is nested by |\caption@beginex| \&
+% |\caption@end| instead of |\begingroup| \& |\endgroup|.
+% Furthermore we use |\caption@boxrestore| instead of |\@parboxrestore|
+% so this code also works correctly inside list-based environments
+% like |wide| \& |addmargin|. (This, and the fact that we use
+% |\linewidth| instead of |\hsize| inside |\@makecaption|, solves
+% \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2472}%^^A
+% {\LaTeX\ PR \texttt{latex/2472}}.)
+% \begin{macrocode}
+\long\def\caption@@caption#1[#2]#3{%
+% \end{macrocode}
+% \begin{macrocode}
+ \ifcaption@star \else
+ \caption@prepareanchor{#1}{#2}%
+ \M@gettitle{#2}%
+ \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \par
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@setfloatcapt{%
+ \caption@boxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \caption@normalsize
+ \ifcaption@star
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \@makecaption{\csname fnum@#1\endcsname}%
+ {\ignorespaces\caption@makeanchor{#3}}\par
+ \caption@if@minipage\@minipagetrue\@minipagefalse}%
+ \caption@end}
+% \end{macrocode}
+% \textsf{memoir} document class stuff:
+% \begin{macrocode}
+\providecommand\M@gettitle[1]{}
+\providecommand\memcaptioninfo[4]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareanchor}
+% \changes{v3.1g}{2008/03/16}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@prepareanchor[2]{%
+ \caption@makecurrent{#1}{#2}%
+ \caption@ifhypcap\caption@@start{}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecaption}
+% \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added}
+% |\@makecaption|\marg{label}\marg{text}\par
+% We do basically the same as the original code (from the standard
+% \LaTeX\ document classes), but take care of the |position=| setting
+% and use |\caption@@make| from the \package{caption} kernel to finally
+% typeset the caption.
+% \begin{macrocode}
+\long\def\caption@makecaption#1#2{%
+ \caption@iftop
+ {\vskip\belowcaptionskip}%
+ {\caption@rule\vskip\abovecaptionskip}%
+ \caption@@make{#1}{#2}%
+ \caption@iftop
+ {\vskip\abovecaptionskip\caption@rule}%
+ {\vskip\belowcaptionskip}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@redefine}
+% \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now}
+% We only redefine |\caption| and |\@caption| if the current definitions
+% are well known, so documents written in the old (\package{caption}
+% package \version{1.x}) days (where |\caption| \& |\@caption| were not
+% redefined by us) will still compile fine.
+% For example the usage of the \package{captcont} package, which brings
+% it's own definition of |\caption*|, was quite common these days.
+% \begin{macrocode}
+\newcommand*\caption@redefine{}
+\g@addto@macro\caption@redefine{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@setbool{incompatible}{0}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
+ \def\caption{
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside figure or table}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
+ \renewcommand\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \let\@tempf\@caption
+ \expandafter\ifx\csname @float@c@\@captype\endcsname\relax\else
+ \expandafter\expandafter\let
+ \expandafter\@tempf\csname @float@c@\@captype\endcsname
+ \fi
+ \fi
+ \@dblarg{\@tempf\@captype}}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
+ % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
+ % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \H@refstepcounter\@captype
+ \@ifundefined{fst@\@captype}{%
+ \let\Hy@tempa\@caption
+ }{%
+ \let\Hy@tempa\Hy@float@caption
+ }%
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\Hy@tempa\@captype}}%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \H@refstepcounter\@captype
+ \let\Hy@tempa\@caption
+ \@ifundefined{float@caption}{%
+ }{%
+ \expandafter\ifx\csname @float@c@\@captype\endcsname\float@caption
+ \let\Hy@tempa\Hy@float@caption
+ \fi
+ }%
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\Hy@tempa\@captype}}%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % memhfixc.sty [2010/08/17 v1.15 nameref/hyperref package fixes for memoir class]
+ % \let\m@moldhypcaption\caption
+ \renewcommand{\caption}{\donemaincaptiontrue\m@moldhypcaption}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@IfCheckCommand{}{%
+ \caption@InfoNoLine{%
+ Incompatible package detected (regarding \string\caption).\MessageBreak
+ \string\caption\space=\space\meaning\caption}%
+ \caption@setbool{incompatible}{1}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
+ \long\def\@caption#1[#2]#3{%
+ \par
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
+ \long\def\@caption#1[#2]#3{% second argument ignored
+ \par\nobreak
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \beamer@makecaption{#1}{\ignorespaces #3}\par\nobreak
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system]
+ \long\def\@caption#1[#2]#3{%
+ \csname par\endcsname
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname.}{\ignorespaces #2}}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}%
+ {\ignorespaces #3}\csname par\endcsname
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+% \caption@CheckCommand\float@caption{%
+% % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
+% \long\def\float@caption#1[#2]#3{%
+% \addcontentsline{\@nameuse{ext@#1}}{#1}%
+% {\protect\numberline{\@nameuse{the#1}}{\ignorespaces #2}}
+% \global\setbox\@floatcapt\vbox\bgroup\@parboxrestore
+% \normalsize\@fs@capt{\@nameuse{fnum@#1}}{\ignorespaces #3}%
+% \@ifnextchar[{\float@ccon}{\egroup}}%
+% \long\def\float@ccon[#1]{#1\par\egroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \hyper@makecurrent{\@captype}%
+ \def\@currentlabelname{#2}%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \hyper@@anchor{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
+ \fi
+ }%
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
+ % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
+ % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\let\@currentHref\hc@currentHref
+ \else
+ \hyper@makecurrent{\@captype}%
+ \fi
+ \def\@currentlabelname{#2}%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\@capstartfalse
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
+ \else
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \hyper@@anchor{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
+ \fi
+ }%
+ \fi
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2009/11/27 v6.79k Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\let\@currentHref\hc@currentHref
+ \else
+ \hyper@makecurrent{\@captype}%
+ \fi
+ \def\@currentlabelname{#2}%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\@capstartfalse
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
+ \else
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
+ }%
+ #3%
+ \fi
+ }%
+ \fi
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2009/12/09 v6.79m Hypertext links for LaTeX]
+ % hyperref.sty [2009/12/28 v6.79z Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\let\@currentHref\hc@currentHref
+ \else
+ \hyper@makecurrent{\@captype}%
+ \fi
+ \@ifundefined{NR@gettitle}{%
+ \def\@currentlabelname{#2}%
+ }{%
+ \NR@gettitle{#2}%
+ }%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\@capstartfalse
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
+ \else
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{%
+ \@currentHref
+ }{\relax}%
+ }%
+ #3%
+ \fi
+ }%
+ \fi
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % nameref.sty [2006/12/27 v2.28 Cross-referencing by name of section]
+ \long\def\@caption#1[#2]{%
+ \def\@currentlabelname{#2}%
+ \NR@@caption{#1}[{#2}]%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % nameref.sty [2009/11/27 v2.32 Cross-referencing by name of section]
+ \long\def\@caption#1[#2]{%
+ \NR@gettitle{#2}%
+ \NR@@caption{#1}[{#2}]%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % subfigure.sty [2002/07/30 v2.1.4 subfigure package]
+ \long\def\@caption#1[#2]#3{%
+ \@ifundefined{if#1topcap}%
+ {\subfig@oldcaption{#1}[{#2}]{#3}}%
+ {\@nameuse{if#1topcap}%
+ \@listsubcaptions{#1}%
+ \subfig@oldcaption{#1}[{#2}]{#3}%
+ \else
+ \subfig@oldcaption{#1}[{#2}]{#3}%
+ \@listsubcaptions{#1}%
+ \fi}}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % subfig.sty [2005/06/28 ver: 1.3 subfig package]
+ \def\@caption{\caption@}%
+% \long\def\caption@#1[#2]#3{%
+% \@ifundefined{caption@setfloattype}%
+% \caption@settype
+% \caption@setfloattype
+% \@captype
+% \sf@ifpositiontop{%
+% \@listsubcaptions{#1}%
+% \sf@old@caption{#1}[{#2}]{#3}%
+% }{%
+% \sf@old@caption{#1}[{#2}]{#3}%
+% \@listsubcaptions{#1}%
+% }}%
+ }%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@IfCheckCommand{}{%
+ \caption@InfoNoLine{%
+ Incompatible package detected (regarding \string\@caption).\MessageBreak
+ \string\@caption\space=\space\meaning\@caption}%
+ \caption@setbool{incompatible}{1}}%
+% \end{macrocode}
+%
+% The option |compatibility=| will override the compatibility mode.
+% \begin{macrocode}
+ \caption@ifundefined\caption@ifcompatibility
+ {\let\caption@ifcompatibility\caption@ifincompatible
+ \let\caption@tempa\caption@WarningNoLine}%
+ {\let\caption@tempa\@gobble}% suppress warning
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@ifcompatibility{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@tempa{%
+ \noexpand\caption will not be redefined since it's already\MessageBreak
+ redefined by a document class or package which is\MessageBreak
+ unknown to the caption package}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{}%
+% \end{macrocode}
+%
+% |\ContinuedFloat| is not supported in compatibility mode.
+% \begin{macrocode}
+ \renewcommand*\caption@ContinuedFloat[1]{%
+ \caption@Error{Not available in compatibility mode}}%
+% \end{macrocode}
+%
+% |\caption@start| is not supported in compatibility mode.
+% \begin{macrocode}
+ \caption@AtBeginDocument*{%
+ \let\caption@start\relax
+ \caption@ifundefined\caption@ORI@capstart{}{%
+ \caption@Debug{%
+ Restore hypcap definition of \string\capstart\@gobble}%
+ \let\capstart\caption@ORI@capstart}%
+ \caption@ifundefined\caption@ORI@float@makebox{}{%
+ \caption@Debug{%
+ Restore hyperref redefinition of \string\float@makebox\@gobble}%
+ \let\float@makebox\caption@ORI@float@makebox}%
+ }%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@star}
+% We redefine |\caption@star| here so it does not make any harm.
+% \begin{macrocode}
+ \renewcommand*\caption@star[2]{#1#2}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@ifincompatible{%
+ \caption@WarningNoLine{%
+ Forced redefinition of \noexpand\caption since the\MessageBreak
+ unsupported(!) package option `compatibility=false'\MessageBreak
+ was given}%
+ }{}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption}
+% \begin{macro}{\@caption}
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{%
+ \let\caption\caption@caption
+ \let\@caption\caption@@caption}%
+ \caption@redefine
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@AtBeginDocument*{%
+ \let\caption@ORI@capstart\@undefined
+ \let\caption@ORI@float@makebox\@undefined}%
+% \end{macrocode}
+%
+% \begin{macro}{\@xfloat}
+% \changes{v3.1}{2007/05/09}{This re-definition added}
+% \changes{v3.1b}{2007/09/22}{Will now be redefined in compatibility mode, too}
+% We redefine |\@xfloat| so inside floating environments our
+% type-specific options will be used, a \package{hyperref}
+% anchor will be set etc.
+% \begin{macrocode}
+ \let\caption@ORI@xfloat\@xfloat
+ \def\@xfloat#1[#2]{%
+ \caption@ORI@xfloat{#1}[#2]%
+ \caption@settype{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% Some packages (like the \package{hyperref} package for example) redefines
+% |\caption| and |\@caption|, too.
+% So we have to use |\AtBeginDocument| here, so we can make sure
+% our definition is the one which will be valid at last.
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@redefine}
+% \end{macrocode}
+%
+% \begin{macro}{\@makecaption}
+% \begin{macrocode}
+\let\@makecaption\caption@makecaption
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{captionof} and \cs{captionlistentry}}
+%
+% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
+% \changes{v3.1}{2007/06/25}{Option \opt{type*=} added}
+% \changes{v3.1f}{2007/11/16}{Option \opt{subtype} \& \opt{subtype*} added}
+% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Option \opt{type=} uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{type}{\setcaptiontype{#1}}%
+ \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOptionNoValue{subtype}{\setcaptionsubtype\relax}%
+ \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \emph{Important Note:}
+% Like |\captionof| the option |type=| should only be used inside a
+% group, box, or environment and does not check if the argument is a valid
+% floating environment or not.
+%
+% \begin{macro}{\setcaptiontype}
+% \changes{v3.2}{2010/10/24}{This macro added}
+% Like |\captionsetup{type=xxx}|, but also works if \cs{captionsetup} was redefined.
+% \begin{macrocode}
+\newcommand\setcaptiontype{%
+ \caption@boxrestore@mini
+ \caption@settype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionsubtype}
+% \changes{v3.2a}{2011/08/15}{This macro added}
+% Same, but sets the sub-type.
+% \begin{macrocode}
+\newcommand\setcaptionsubtype{%
+ \caption@iftype
+ \caption@setsubtype
+ {\caption@Error{\noexpand\setcaptionsubtype outside float}}}%
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@setsubtype{%
+ \@ifstar
+ {\caption@@settype{sub}*{sub\@captype}}%
+ {\caption@@settype{sub}{sub\@captype}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@settype}
+% \changes{v3.1}{2007/05/09}{This macro added}
+% \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added}
+% \changes{v3.1d}{2007/10/23}{Error message for \cs{caption@checkgrouplevel} revised}
+% \changes{v3.1f}{2007/11/16}{\cs{caption@setsubtype} added}
+% \changes{v3.1f}{2007/12/03}{Crappy \cs{caption@iftypewarning} replaced}
+% \changes{v3.1g}{2008/01/12}{Usage of \cs{ifcaptionsetup@star} added}
+% \changes{v3.2}{2010/10/26}{Error message moved from here to \cs{caption@refstepcounter}}
+% |\caption@settype*|\marg{type}\par
+% sets |\@captype| and executes the options associated with it
+% (using |\caption@setoptions|).
+% Furthermore we check |\currentgrouplevel| (if avail),
+% redefine |\@currentlabel| so a |\label| before |\caption| will result
+% in a hint instead of a wrong reference, and
+% use the macro |\caption@|(|sub|)|typehook| (which will be used by our
+% \package{float} package support).\par
+% The non-starred version sets a \package{hyperref} anchor additionally
+% (if |hypcap=true| and the \package{hypcap} package is not loaded).
+% \begin{macrocode}
+\newcommand*\caption@settype{%
+ \caption@@settype{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@settype[1]{%
+ \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@settype[3]{%
+% #1 = "" or "sub"
+% #2 = \@firstoftwo in star form, \@secondoftwo otherwise
+% #3 = <type>, e.g. "figure" or "table"
+ \caption@Debug{#1type=#3}%
+ \caption@checkgrouplevel{#1}{%
+ \captionsetup{#1type#2*\@empty=...}#2{ or
+ \@backslashchar#1captionof}{}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@tempa{#3}%
+ \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else
+ \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi
+ \fi
+ \expandafter\let\csname @#1captype\endcsname\caption@tempa
+% \end{macrocode}
+% \begin{macrocode}
+ \@nameuse{caption@#1typehook}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setoptions{#3}%
+ \ifx\caption@opt\relax
+ \@nameundef{caption@#1type@warning}%
+ \else
+ \@namedef{caption@#1type@warning}{\caption@Warning{%
+ The #1caption type was already set to
+ `\csname @#1captype\endcsname'\MessageBreak}}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ifrefstepcounter\@secondoftwo
+ #2{}{%
+ \let\@currentlabel\caption@undefinedlabel
+% \let\@currentHlabel\@undefined
+ \ifx\caption@x@label\@undefined
+ \let\caption@x@label\label
+ \let\label\caption@xlabel
+ \fi
+ \caption@start}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@typehook}
+% Hook, will be extended later on, e.g.~by our \package{float} package
+% support.
+% \begin{macrocode}
+\newcommand*\caption@typehook{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftype}
+% \changes{v3.1}{2007/04/11}{This macro and its usage added}
+% Since we often need to check if |\@captype| is defined (means: we
+% are inside a floating environment) this helper macro was introduced.
+% \begin{macrocode}
+\newcommand*\caption@iftype{%
+ \caption@ifundefined\@captype\@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checkgrouplevel}
+% \changes{v3.1}{2007/07/15}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)}
+% Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done
+% inside a group or not -- in the latter case a warning message will
+% be issued. (needs \eTeX)
+% \begin{macrocode}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname currentgrouplevel\endcsname\relax
+ \caption@Debug{TeX engine: TeX}
+ \let\caption@checkgrouplevel\@gobbletwo
+\else
+ \caption@Debug{TeX engine: e-TeX}
+ \newcommand*\caption@checkgrouplevel[2]{%
+ \@ifundefined{#1caption@grouplevel}{%
+ \caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}%
+ \ifnum\currentgrouplevel>\caption@grouplevel\relax
+ \expandafter\edef\csname #1caption@grouplevel\endcsname{%
+ \the\currentgrouplevel}%
+ \else
+ \caption@Warning{\string#2\MessageBreak outside box or environment}%
+ \fi
+ }{}}
+\fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@undefinedlabel}
+% \changes{v3.1}{2007/07/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/22}{Contents changed to \texttt{??}}
+% \changes{v3.1i}{2008/04/13}{Contents changed to \cs{caption@xref}(\ldots)}
+% \changes{v3.1k}{2009/03/30}{Bugfix 08-12-08: \cs{caption@xref} is robust now}
+% \changes{v3.2c}{2011/09/13}{Text changed from `before' to `without proper'}
+% This label will be used for |\currentlabel| inside (floating) environments
+% as default. (see above)
+% \iffalse\Note{All commands used have to be robust here.}\fi
+% \begin{macrocode}
+\newcommand*\caption@undefinedlabel{%
+ \protect\caption@xref{\caption@labelname}{\on@line}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareRobustCommand*\caption@xref[2]{%
+ \caption@WarningNoLine{\noexpand\label without proper \string\caption#2}%
+ \@setref\relax\@undefined{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@labelname{??}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@xlabel}
+% \changes{v3.1b}{2007/09/22}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/11}{Revised}
+% \changes{v3.1i}{2008/04/13}{Bugfix: \cs{pageref} should always work now}
+% \changes{v3.2c}{2011/08/19}{Works with optional arguments now, too}
+% The new code of |\label| inside floating environments.
+% |\label| will be redefined using |\caption@withoptargs|, so
+% |#1| are the optional arguments (if any), and
+% |#2| is the mandatory argument here.
+% \begin{macrocode}
+\newcommand*\caption@xlabel{%
+ \caption@withoptargs\caption@@xlabel}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@xlabel[2]{%
+ \caption@@@xlabel
+ \def\caption@labelname{#2}%
+ \caption@x@label#1{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@xlabel{%
+ \global\let\caption@@@xlabel\@empty
+ \@bsphack
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@xref[2]{%
+ \string\@setref\string\relax\string\@undefined{\string##1}}}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionof}
+% \changes{v3.1}{2007/05/09}{Uses \cs{caption@settype} instead of \cs{def}\cs{@captype}}
+% \changes{v3.1c}{2007/09/22}{Bugfix: Redefinition of \cs{caption@setfloatcapt} removed}
+% \changes{v3.1e}{2007/10/30}{Better compatibility: Will be defined with \cs{AtBeginDocument} now}
+% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
+% |\captionof|\marg{type}\oarg{lst\_entry}\marg{heading}\\
+% |\captionof*|\oarg{lst\_entry}\marg{heading}\par
+% \Note{This will be defined with \cs{AtBeginDocument} so
+% \cs{usepackage}\csmarg{caption,capt-of} will still work.
+% (Compatibility to \version{1.x})}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\captionof{\caption@teststar\caption@of{\caption*}\caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@of[2]{\setcaptiontype*{#2}#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionlistentry}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v3.1g}{2008/01/20}{Starred variant added}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% |\captionlistentry|\oarg{float type}\marg{list entry}\\
+% |\captionlistentry*|\oarg{float type}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\captionlistentry{%
+ \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionlistentry[1]{%
+ \@testopt{\caption@listentry{#1}}\@captype}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@listentry#1[#2]#3{%
+ \@bsphack
+ #1{\caption@gettitle{#3}}%
+ {\caption@refstepcounter{#2}%
+ \caption@makecurrent{#2}{#3}}%
+ \caption@addcontentsline{#2}{#3}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{captionbox}}
+%
+% \begin{macro}{\captionbox}
+% \changes{v3.2}{2010/12/17}{This macro added}
+% \changes{v3.2a}{2011/08/16}{\cs{captionsetup} replaces with \cs{captionbox@settype} and \cs{caption@setposition}}
+% A |\parbox| with contents and caption, separated by an invisible |\hrule|.
+% \begin{macrocode}
+\newcommand*\captionbox{%
+ \let\captionbox@settype\@gobble
+ \caption@withoptargs\caption@box}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@box[2]{%
+ \@testopt{\caption@ibox{#1}{#2}}{\wd\@tempboxa}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@ibox#1#2[#3]{%
+ \@testopt{\caption@iibox{#1}{#2}{#3}}\captionbox@hj@default}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iibox#1#2#3[#4]#5{%
+ \setbox\@tempboxa\hbox{#5}%
+ \begingroup
+ \captionbox@settype*% set \caption@position
+ \caption@iftop{%
+ \endgroup
+ \parbox[t]{#3}{%
+ \captionbox@settype\relax
+ \caption@setposition t%
+ \vbox{\caption#1{#2}}%
+ \captionbox@hrule
+ \csname caption@hj@#4\endcsname
+ \unhbox\@tempboxa}%
+ }{%
+ \endgroup
+ \parbox[b]{#3}{%
+ \captionbox@settype\relax
+ \caption@setposition b%
+ \csname caption@hj@#4\endcsname
+ \unhbox\@tempboxa
+ \captionbox@hrule
+ \vtop{\caption#1{#2}}}%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\captionbox@hj@default{c}
+\newcommand*\captionbox@hrule{\hrule\@height\z@\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@hj@c{\centering}
+\providecommand*\caption@hj@l{\raggedright}
+\providecommand*\caption@hj@r{\raggedleft}
+\providecommand*\caption@hj@s{}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{ContinuedFloat}}
+%
+% \begin{macro}{\ContinuedFloat}
+% \changes{v3.0f}{2005/06/11}{%
+% Call of \cs{caption@ContinuedFloat} added}
+% \changes{v3.0i}{2005/11/12}{%
+% Optional argument and call of \cs{caption@@ContinuedFloat} added}
+% \changes{v3.0g}{2005/06/28}{%
+% Bugfix: \cs{newcounter} replaced by \cs{newcount}}
+% \changes{v3.1}{2007/07/02}{Format of \package{hyperref} extension changed}
+% \changes{v3.1}{2007/07/07}{\cs{caption@setoptions} added}
+% \changes{v3.1g}{2008/01/29}{Starred variant and hook \cs{sf@ContinuedFloat} added}
+% |\ContinuedFloat|\\
+% |\ContinuedFloat*|\par
+% This mainly decrements the appropriate counter and increments the
+% continuation counter instead.
+% Furthermore we set |\caption@resetContinuedFloat| to |\@gobble| so the
+% continuation counter will not be reset to zero inside |\caption@refstepcounter|.
+% Please forget about the optional argument, it was never working well, is
+% incompatible to the \package{subfig} package, but is still there for
+% compatibility reasons.
+% \Note{The definition of \cs{ContinuedFloat} itself is compatible
+% to the one inside the \package{subfig} package, except for the
+% starred variant and the optional argument.}
+% When the \package{hyperref} package is used we have the problem
+% that the usage of |\ContinuedFloat| will create duplicate
+% hyper links -- |\@currentHref| will be the same for the main float and
+% the continued ones. So we have to make sure unique labels and references
+% will be created each time. We do this by extending |\theHfigure| and
+% |\theHtable|, so for continued floats the scheme
+% \begin{quote}\meta{type}|.|\meta{type \#}|\alph{|\meta{continued \#}|}|\end{quote}
+% will be used instead of
+% \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
+% \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
+% \Note{This does not help if the \package{hyperref} package option
+% \texttt{naturalnames=true} is set.}
+% \begin{macrocode}
+\def\ContinuedFloat{%
+ \@ifnextchar[\@Continued@Float\@ContinuedFloat}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@Continued@Float[#1]{\addtocounter{#1}\m@ne}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@ContinuedFloat{%
+ \caption@iftype
+ {\addtocounter\@captype\m@ne
+ \caption@ContinuedFloat\@captype}%
+ {\caption@Error{\noexpand\ContinuedFloat outside float}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@ContinuedFloat#1{%
+ \@ifstar{\caption@Continued@Float@{#1}}{\caption@Continued@Float{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@Continued@Float@{%
+ \addtocounter\@captype\@ne
+ \@stpelt{ContinuedFloat}\stepcounter{ContinuedFloat}%
+ \def\caption@resetContinuedFloat##1{\xdef\caption@CFtype{##1}}%
+ \caption@@ContinuedFloat}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@Continued@Float#1{%
+ \edef\caption@tempa{#1}%
+ \ifx\caption@tempa\caption@CFtype
+ \stepcounter{ContinuedFloat}%
+ \let\caption@resetContinuedFloat\@gobble
+ \caption@@ContinuedFloat{#1}%
+ \sf@ContinuedFloat{#1}%
+ \else
+ \caption@Error{Continued `#1' after `\caption@CFtype'}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@ContinuedFloat#1{%
+ \expandafter\l@addto@macro\csname the#1\endcsname\theContinuedFloat
+ \@ifundefined{theH#1}{}{%
+ \expandafter\l@addto@macro\csname theH#1\endcsname{%
+ \@alph\c@ContinuedFloat}}%
+ \caption@setoptions{ContinuedFloat}%
+ \caption@setoptions{continued#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\sf@ContinuedFloat[1]{}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@CFtype{??}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\theContinuedFloat}
+% Its preset to \cs{@empty}, so usually the continuation counter is not
+% included in the caption label or references.
+% \begin{macrocode}
+\newcounter{ContinuedFloat}
+\let\theContinuedFloat\@empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetContinuedFloat}
+% |\caption@resetContinuedFloat|\marg{type}\par
+% If a continuation counter is defined, we reset it.
+% (This one will be called inside |\@caption|.)
+% \begin{macrocode}
+\newcommand*\caption@resetContinuedFloat[1]{%
+ \@stpelt{ContinuedFloat}\xdef\caption@CFtype{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phantomcaption}
+% \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added}
+% |\phantomcaption|\par
+% Use this one for figures with subcaptions but without main caption.
+% \begin{macrocode}
+\newcommand\phantomcaption{%
+ \caption@iftype
+ {\caption@refstepcounter\@captype}%
+ {\caption@Error{\noexpand\phantomcaption outside float}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Internal helpers}
+%
+% \begin{macro}{\caption@refstepcounter}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% \changes{v3.2}{2010/10/26}{Error message moved from \cs{caption@@@settype} to here}
+% Resets the continuation counter, increments the float (i.e. |figure| or
+% |table|) counter, and sets the |refstepcounter| flag.
+% \begin{macrocode}
+\newcommand*\caption@refstepcounter[1]{%
+ \@ifundefined{c@#1}%
+ {\caption@Error{No float type '#1' defined}}%
+ {\caption@resetContinuedFloat{#1}%
+ \caption@@refstepcounter{#1}%
+ \let\caption@ifrefstepcounter\@firstoftwo}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@refstepcounter{\refstepcounter}
+\let\caption@ifrefstepcounter\@secondoftwo
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@dblarg}
+% \changes{v3.1}{2007/02/05}{This macro added}
+% \changes{v3.1f}{2007/12/06}{Bugfix 07-12-06: Changed so it works without \cs{kernel@ifnextchar}
+% (which was introduced in \LaTeXe\ 2004/01/23), too}
+% A |\relax| was added compared to |\@dblarg| so |\caption{}| will be
+% expanded to |\caption[\relax]{}| (and not to |\caption[]{}|).
+% \begin{macrocode}
+\caption@ifundefined\kernel@ifnextchar
+ {\newcommand\caption@dblarg[1]{\@ifnextchar[{#1}{\caption@xdblarg{#1}}}}%
+ {\newcommand\caption@dblarg[1]{\kernel@ifnextchar[{#1}{\caption@xdblarg{#1}}}}%
+\newcommand\caption@xdblarg[2]{#1[{#2\relax}]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@begin}
+% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed to \cs{caption@setfloattype}}
+% \changes{v3.0e}{2005/04/12}{Check for default label format added}
+% \changes{v3.0f}{2005/06/11}{Usage of \cs{caption@resetContinuedFloat} added}
+% \changes{v3.1}{2007/05/09}{Usage of \cs{caption@setfloattype} \&
+% \cs{caption@resetContinuedFloat} removed}
+% Our handling of |\caption| will always be surrounded by
+% |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
+% |\caption@begin|\marg{type} performs these tasks:
+% \begin{enumerate}
+% \item[1.] Start a new group.
+% \item[2.] Define |\fnum@|\meta{type} if the caption label format is set
+% to non-default.
+% \item[3.] Override the |position=| setting, if necessary.
+% (for example if set to |auto| or used inside a |supertabular|)
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand*\caption@begin[1]{%
+ \begingroup
+ \caption@setfnum{#1}%
+ \caption@fixposition
+ \global\let\caption@fixedposition\caption@position}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@beginex}
+% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
+% \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
+% \changes{v3.1}{2007/07/01}{Makes lst-entry now instead of redefining \cs{addcontentsline}}
+% \changes{v3.2}{2010/10/26}{Bugfix 09-05-15: Setting of \cs{lst@@caption} added}
+% |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par
+% performs the same tasks as |\caption@begin| and additionally:
+% \begin{enumerate}
+% \item[4.] Set |\lst@@caption|, so |\fnum@lstlisting| will include a numbering.
+% \item[5.] Make an entry in the list-of-whatever.
+% \item[6.] Set |\caption@ifempty| according argument \meta{heading}.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand\caption@beginex[3]{%
+ \caption@begin{#1}%
+ \let\lst@@caption\relax
+ \caption@addcontentsline{#1}{#2}%
+ \caption@ifempty{#3}{}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@end}
+% |\caption@end| closes the group.
+% \begin{macrocode}
+\newcommand*\caption@end{%
+ \endgroup
+ \let\caption@position\caption@fixedposition}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0a}{2004/01/23}{%
+% Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
+% \changes{v3.0h}{2005/10/06}{%
+% Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
+%
+% \begin{macro}{\caption@setfnum}
+% \changes{v3.1}{2007/03/10}{This macro added}
+% |\caption@setfnum|\marg{type}\\
+% redefines |\fnum@|\meta{type} according the caption label format
+% set with |labelformat=|. But if |labelformat=default| is set,
+% |\fnum@|\meta{type} will not be overwritten by us.
+% \begin{macrocode}
+\newcommand*\caption@setfnum[1]{%
+ \@ifundefined{fnum@#1}{\iftrue}{\ifx\caption@lfmt\caption@lfmt@default\else}%
+ \@namedef{fnum@#1}{\caption@fnum{#1}}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@boxrestore}
+% \changes{v3.1}{2007/03/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added}
+% \changes{v3.2}{2010/11/07}{Support of option \opt{parboxrestore} added}
+% The original code (from |latex/base/ltboxes.dtx|):
+% \begin{verbatim}
+% \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}
+% \def\@arrayparboxrestore{%
+% \let\if@nobreak\iffalse
+% \let\if@noskipsec\iffalse
+% \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+% \parindent\z@ \parskip\z@skip
+% \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+% \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+% \parfillskip\@flushglue \lineskip\normallineskip
+% \baselineskip\normalbaselineskip
+% \sloppy}
+% \end{verbatim}%^^A
+% This one will be used by |\@caption| instead of |\@parboxrestore|.
+% \begin{macrocode}
+\newcommand*\caption@boxrestore{%
+ \caption@parboxrestore{\@parboxrestore}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parindent\z@ \parskip\z@skip
+ \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+ \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+ \parfillskip\@flushglue \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \sloppy
+ \let\\\@normalcr
+ }}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@boxrestore@mini}
+% \changes{v3.2}{2010/10/24}{This macro added}
+% Resets \cs{par} so the very first \cs{par} in \cs{@caption} behaves quite the same as in floating environments.
+% Will be used by \cs{setcaptiontype}.
+% \begin{macrocode}
+\newcommand\caption@boxrestore@mini{%
+ \let\par\@@par
+ \parindent\z@ \parskip\z@skip
+ \sloppy}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@normalsize}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This one will be used by |\@caption| instead of |\normalsize|.\par
+% Its code is equivalent to
+% \begin{quote}
+% |\caption@font{normal}%|
+% \end{quote}
+% but executes faster (since the starred form of |\caption@font|
+% does not use |\setkeys| internally).
+% \begin{macrocode}
+\newcommand*\caption@normalsize{%
+ \caption@font*{\KV@caption@fnt@normal\@unused}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setfloatcapt}
+% Needed for support of the \package{float} package, where the caption will
+% not be typeset directly, but catched in a |\vbox| called |\@floatcapt|
+% instead.
+% \begin{macrocode}
+\let\caption@setfloatcapt\@firstofone
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% \begin{macro}{\caption@makeanchor}
+% \begin{macro}{\caption@start}
+% \begin{macro}{\caption@@start}
+% \begin{macro}{\caption@freezeHref}
+% \begin{macro}{\caption@defrostHref}
+% All these are needed for support of the \package{hyperref} package.
+% \begin{macrocode}
+\newcommand*\caption@makecurrent[2]{}
+\let\caption@makeanchor\@firstofone
+\let\caption@start\relax
+\let\caption@@start\relax
+\let\caption@freezeHref\relax
+\let\caption@defrostHref\relax
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@gettitle}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This one is needed for support of the \package{nameref} package.
+% \begin{macrocode}
+\newcommand\caption@gettitle[1]{%
+ \caption@ifundefined\NR@gettitle
+ {\def\@currentlabelname{#1}}%
+ {\NR@gettitle{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Support for sub-captions}
+% \changes{v3.1f}{2007/11/16}{Support for sub-captions added}
+%
+% \begin{macro}{\caption@DeclareSubType}
+% |\caption@DeclareSub| initializes the usage of \cs{caption}
+% in sub-floats.
+% \begin{macrocode}
+\def\caption@DeclareSubType sub#1\@nil{%
+ \caption@Debug{Initializing subtype for `#1'\@gobble}%
+ \@namedef{caption@c@#1}{0}%
+ \@namedef{caption@beginsub#1}{\caption@beginsubfloat{#1}}}
+\@onlypreamble\caption@DeclareSubType
+% \end{macrocode}
+% \end{macro}
+%
+% Initialize the sub-captions defined with \cs{DeclareCaptionSubType}\ldots
+% \begin{macrocode}
+\caption@For*{subtypelist}{\caption@DeclareSubType sub#1\@nil}
+% \end{macrocode}
+%
+% Initialize the sub-captions defined with \cs{newsubfloat}\cite{subfig}\ldots
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \caption@ifundefined\sf@counterlist{}{%
+ \@for\sf@temp:=\sf@counterlist\do{%
+ \expandafter\caption@DeclareSubType\sf@temp\@nil}}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@subtypehook}
+% \changes{v3.1g}{2008/03/20}{Redefinition of \cs{caption@setlist} added}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-08-12b: \cs{@makecaption} will now be restored here, too}
+% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
+% \changes{v3.2a}{2011/08/17}{Redefinition of \cs{phantomcaption} added}
+% \changes{v3.2a}{2011/08/17}{Usage of \cs{caption@warmup} added}
+% \changes{v3.2c}{2011/09/30}{Bugfix 11-09-26: Usage of \cs{if@subfloatrow} added}
+% Hook, will be used inside \cs{caption@setsubtype}.\par
+% (Note: If we are inside an |sub|\-|float|\-|row| environment we have to keep
+% the |\@make|\-|caption| code of the \package{floatrow} package intact.)
+% \begin{macrocode}
+\newcommand*\caption@subtypehook{%
+ \ifx\caption\caption@subcaption \else
+ \caption@warmup
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifrefstepcounter{}{%
+ % no \caption or \subcaption in this (floating) environment yet
+ \caption@Debug{Increment \@captype\ counter =\the\value\@captype}%
+ \caption@l@stepcounter\@captype
+ \let\caption@@@addcontentsline\caption@addsubcontentsline}%
+% \end{macrocode}
+% \begin{macrocode}
+ \ifnum\csname caption@c@\@captype\endcsname=\value\@captype \else
+ \caption@Debug{Reset sub\@captype\ counter}%
+ \expandafter\xdef\csname caption@c@\@captype\endcsname{%
+ \the\value\@captype}%
+ \@stpelt\@subcaptype
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \c@ContinuedFloat=0\relax
+ \let\caption@resetContinuedFloat\@gobble
+ \let\caption@addcontentsline\caption@kernel@addcontentsline
+ \let\caption@setfloatcapt\@firstofone
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@clearmargin
+ \caption@iflist{}{\let\caption@setlist\@gobble}%
+ \caption@setoptions{sub}%
+ \caption@setoptions{subfloat}% for subfig-package compatibility
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption\caption@subcaption
+ \let\phantomcaption\caption@subphantom
+ \if@subfloatrow
+ \caption@Debug{Keeping \string\@makecaption}%
+ \else
+ \let\@makecaption\caption@makecaption
+ \fi
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\if@subfloatrow}
+% \changes{v3.2c}{2011/09/30}{This macro added}
+% This macro tests if we are inside an |sub|\-|float|\-|row| or |sub|\-|float|\-|row*| environment.
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \caption@ifundefined\@subfloatrowtrue
+ {\newif\if@subfloatrow
+ \caption@ifundefined\subfloatrow{}%
+ {\caption@Debug{Patching subfloatrow environment}%
+ \g@addto@macro\capsubrowsettings{\@subfloatrowtrue}%
+ \g@addto@macro\killfloatstyle{%
+ \ifx\c@FRobj\c@FRsobj\@subfloatrowtrue\fi}}}%
+ {\caption@Debug{\string\if@subfloatrow is already defined}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subcaption}
+% Makes a sub-caption.
+% \begin{macrocode}
+\newcommand*\caption@subcaption{%
+ \caption@checkgrouplevel{sub}\subcaption
+ \caption@star
+ {\caption@refstepcounter\@subcaptype}%
+ {\caption@dblarg{\@caption\@subcaptype}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subphantom}
+% \changes{v3.2a}{2011/08/17}{This macro added}
+% Same as |\phantomcaption|, but for sub-captions.
+% \begin{macrocode}
+\newcommand*\caption@subphantom{%
+ \caption@checkgrouplevel{sub}\phantomsubcaption
+ \caption@refstepcounter\@subcaptype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addcontentsline}
+% \changes{v3.1g}{2008/01/12}{Argument of \cs{caption@addsubcontentslines} removed}
+% \changes{v3.1i}{2008/08/02}{Argument of \cs{caption@addsubcontentslines} re-added}
+% We extend |\caption@addcontentsline| so it handles sub-captions, too.
+% \Note{\cs{sf@ifpositiontop} \& \cs{@listsubcaptions} are defined by the
+% \package{subfigure} \& \package{subfig} packages.}
+% \begin{macrocode}
+\let\caption@kernel@addcontentsline\caption@addcontentsline
+\renewcommand\caption@addcontentsline[2]{%
+ \sf@ifpositiontop{\@listsubcaptions{#1}}{}%
+ \caption@kernel@addcontentsline{#1}{#2}%
+ \sf@ifpositiontop{}{\@listsubcaptions{#1}}%
+ \caption@addsubcontentslines{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentslines[1]{%
+ \begingroup
+ \caption@subcontentslines
+ \endgroup
+ \caption@clearsubcontentslines}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addsubcontentsline}
+% \changes{v3.1i}{2008/08/02}{Bugfix 08-07-28:
+% \cs{label}, \cs{index}, and \cs{glossary} are allowed inside the list entry now}
+% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
+% \changes{v3.2c}{2011/08/19}{Uses \cs{caption@gobble} instead of \cs{@gobble} now}
+% Add a pending sub-caption list entry.
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentsline[4]{%
+ \begingroup
+ \let\label\caption@gobble \let\index\caption@gobble \let\glossary\caption@gobble
+ \protected@edef\@tempa{\endgroup
+ \noexpand\g@addto@macro\noexpand\caption@subcontentslines{%
+ \noexpand\@namedef{the#2}{\csname the#2\endcsname}%
+ \ifx\@currentHref\@undefined \else
+ \noexpand\def\noexpand\@currentHref{\@currentHref}%
+ \fi
+ \protect\caption@@@addcontentsline{#1}{#2}{#3}{#4}}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checksubcontentslines}
+% \changes{v3.1g}{2008/01/07}{Bugfix: Uses \cs{caption@Error} instead of \cs{subcaption@Error} now}
+% Checks if the list of pending sub-captions is empty, if not,
+% a warning will be issued.
+% \begin{macrocode}
+\newcommand*\caption@checksubcontentslines{%
+ \ifx\caption@subcontentslines\@empty \else
+ \caption@Error{%
+ Something's wrong--perhaps a missing \protect\caption\MessageBreak
+ in the last figure or table}%
+ \caption@clearsubcontentslines
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clearsubcontentslines}
+% Clear pending sub-caption list entries.
+% \begin{macrocode}
+\newcommand*\caption@clearsubcontentslines{%
+ \global\let\caption@subcontentslines\@empty}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \caption@ifundefined\sf@ifpositiontop{\let\sf@ifpositiontop\@gobbletwo}{}%
+ \caption@clearsubcontentslines
+ \g@addto@macro\caption@typehook{\caption@checksubcontentslines}%
+ \AtEndDocument{\caption@checksubcontentslines}}%
+% \end{macrocode}
+%
+% \subsection{Document class \& Babel package support}
+%
+% \subsubsection{The \AmS{} \& \SmF{} classes}
+% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added}
+%
+% \begin{macrocode}
+\caption@ifundefined\smf@makecaption{}{\let\smf@makecaption\@makecaption}
+% \end{macrocode}
+%
+% \subsubsection{The beamer class}
+% \changes{v3.1}{2007/03/10}{beamer class support added}
+%
+% \begin{macrocode}
+\@ifclassloaded{beamer}{%
+ \caption@InfoNoLine{beamer document class}%
+% \end{macrocode}
+%
+% \begin{macro}{\figure}
+% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
+% \begin{macro}{\table}
+% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
+% We redefine |figure| \& |table| so our type-specific options will be used etc.
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@ORI@figure
+ \csname\string\figure\endcsname
+ \@namedef{\string\figure}[#1]{%
+ \caption@ORI@figure[#1]%
+ \caption@settype{figure}}
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@ORI@table
+ \csname\string\table\endcsname
+ \@namedef{\string\table}[#1]{%
+ \caption@ORI@table[#1]%
+ \caption@settype{table}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The \KOMAScript{} classes}
+%
+% \KOMAScript\ contains the code
+% |\AtBeginDocument{\let\scr@caption\caption}|
+% so we need to update |\scr@caption| here, too.
+%
+% \begin{macrocode}
+\caption@ifundefined\scr@caption{}{%
+ \caption@AtBeginDocument{\let\scr@caption\caption}}
+% \end{macrocode}
+%
+% \subsubsection{The frenchb Babel option}
+% \changes{v3.1}{2006/05/14}{Adaptation to \package{frenchb} added}
+%
+% Suppress
+% ``Package |frenchb.ldf| Warning: The definition of |\@makecaption| has been
+% changed, frenchb will NOT customize it.''
+% (but only if we emulate this customization)
+% \begin{macrocode}
+\@nameuse{caption@frenchb}\@nameundef{caption@frenchb}
+% \end{macrocode}
+%
+% \subsubsection{The frenchle/pro package}
+% \changes{v3.0h}{2005/10/03}{Adaptation to \package{frenchle/pro} added}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@ifundefined\frenchTeXmods{}{%
+ \caption@InfoNoLine{frenchle/pro package is loaded}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\captionfont@ORI\captionfont
+ \let\captionlabelfont@ORI\captionlabelfont
+ \let\@makecaption@ORI\@makecaption
+% \end{macrocode}
+
+% If |\GOfrench| is defined as |\relax| all the re-definitions regarding
+% captions have already been done, so we can do our patches immediately.
+% Otherwise we must add our stuff to |\GOfrench|.
+% \begin{macrocode}
+ \caption@ifundefined\GOfrench
+ {\let\caption@tempa\@firstofone}%
+ {\def\caption@tempa{\g@addto@macro\GOfrench}}%
+ \caption@tempa{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\captionfont\captionfont@ORI
+ \let\captionfont@ORI\@undefined
+ \let\captionlabelfont\captionlabelfont@ORI
+ \let\captionlabelfont@ORI\@undefined
+ \let\@makecaption\@makecaption@ORI
+ \let\@makecaption@ORI\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\@cnORI}
+% We update the definition of |\@cnORI| so it actually reflects
+% our definition of |\caption|.
+% \begin{macrocode}
+ \let\@cnORI\caption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@tablescaption}
+% The \package{frenchle/pro} package sets |\caption| to |\@tablescaption| at
+% |\begin{table}| for special treatment of footnotes.
+% Therefore we have to patch |\@tablescaption| so |\caption*| will work
+% inside the |table| environment.
+% \begin{macrocode}
+ \let\caption@tcORI\@tablescaption
+ \def\@tablescaption{\caption@star\relax\caption@tcORI}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f@ffrench}
+% \begin{macro}{\f@tfrench}
+% |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
+% when used in French mode. These contain additional code which typesets
+% the caption separator |\captionseparator| instead of the usual colon.
+% Because this breaks with our |\@makecaption| code we have to remove
+% this additional code here.
+% \begin{macrocode}
+ \let\@eatDP\@undefined
+ \let\caption@tempa\@empty
+ \ifx\f@ffrench\fnum@figure
+ \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
+ \fi
+ \ifx\f@tfrench\fnum@table
+ \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
+ \fi
+ \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
+ \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
+ \caption@tempa
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ }%
+}}
+% \end{macrocode}
+%
+% \subsubsection{The hungarian and magyar Babel option}
+% \changes{v3.2}{2009/03/29}{\package{magyar} package support added}
+%
+% \begin{macrocode}
+\def\caption@tempa#1{%
+ \@ifundefined{extras#1}\caption@AtBeginDocument\@firstofone{%
+ \@ifundefined{extras#1}{}{%
+ \caption@InfoNoLine{#1 babel option is loaded}%
+ \expandafter\addto\csname extras#1\endcsname{%
+ % reverse changes made by magyar.ldf
+ \let\@makecaption\caption@makecaption
+ \babel@save\@makecaption
+ \caption@redefine
+ \babel@save\@caption}%
+ }}}
+\caption@tempa{hungarian}%
+\caption@tempa{magyar}%
+% \end{macrocode}
+%
+% \subsection{Package support}
+% \changes{v3.1}{2007/04/11}{Package options `float', `longtable' etc.
+% are not supported anymore, removed}
+%
+% \begin{macro}{\caption@IfPackageLoaded}
+% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added,
+% so no extra check is needed}
+% \changes{v3.1}{2007/07/04}{Re-written \& renamed from \cs{caption@ifpackage}
+% to \cs{caption@IfPackageLoaded}}
+% |\caption@IfPackageLoaded|\marg{package}\oarg{version}\marg{true}\marg{false}\par
+% Some kind of combination of |\@ifpackageloaded| and |\@ifpackagelater|.
+% If the \meta{package} is not loaded yet, the check will be (re-)done
+% |\AtBeginDocument|, so the \meta{package} could be loaded later on, too.
+% \begin{macrocode}
+\newcommand\caption@IfPackageLoaded[1]{%
+ \@testopt{\caption@@IfPackageLoaded{#1}}{}}
+\@onlypreamble\caption@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@IfPackageLoaded#1[#2]#3#4{%
+ \@ifpackageloaded{#1}\@firstofone{%
+ \caption@Debug{#1 package is not loaded (yet)\@gobble}%
+ \caption@AtBeginDocument}{%
+ \caption@@ifpackageloaded{#1}[#2]{#3}{#4}}}
+\@onlypreamble\caption@@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@ifpackageloaded[1]{%
+ \@testopt{\caption@@ifpackageloaded{#1}}{}}
+\@onlypreamble\caption@ifpackageloaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@ifpackageloaded#1[#2]{%
+ \@ifpackageloaded{#1}{%
+ \caption@InfoNoLine{#1 package is loaded}%
+ \@ifpackagelater{#1}{#2}\@firstoftwo{%
+ \caption@Error{%
+ For a successful cooperation we need at least version\MessageBreak
+ `#2' of package #1,\MessageBreak
+ but only version\MessageBreak
+ `\csname ver@#1.\@pkgextension\endcsname'\MessageBreak
+ is available}%
+ \@secondoftwo}%
+ }{\@secondoftwo}}
+\@onlypreamble\caption@@ifpackageloaded
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clearmargin}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This macro will be used by some package support stuff where the usual
+% margin setting is not welcome, e.g. in the \package{sidecap} package.
+% \begin{macrocode}
+\newcommand*\caption@clearmargin{%
+ \setcaptionmargin\z@
+ \let\caption@minmargin\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@setbool{needfreeze}{0}
+\caption@AtBeginDocument*{%
+ \caption@ifneedfreeze{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@freeze}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} \& \cs{@caption} revised for enhanced compatibility}
+% \changes{v3.1c}{2007/10/06}{Bugfix: Made \cs{@caption} long}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1g}{2008/01/29}{Starred variants of \cs{ContinuedFloat} and \cs{captionsetup} added}
+% \changes{v3.2}{2010/10/26}{Bugfix 10-09-01a: Uses \cs{ignorespaces} instead of `space hack' again}
+% \changes{v3.2a}{2011/08/17}{Starred variant of \cs{caption@freeze} removed}
+% \changes{v3.2b}{2011/08/18}{Redefines \cs{caption@setup} instead of \cs{captionsetup} now}
+% \changes{v3.2b}{2011/08/18}{Redefinition of \cs{label} revised}
+% \changes{v3.2c}{2011/08/21}{Revised}
+% |\caption@freeze|\par
+% Used by the \package{fltpage} \& \package{sidecap} package support.
+% \begin{macrocode}
+ \newcommand*\caption@freeze{%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@ContinuedFloat\ContinuedFloat
+ \def\ContinuedFloat{%
+ \caption@withoptargs\caption@SC@ContinuedFloat}%
+ \def\caption@SC@ContinuedFloat##1{%
+ \caption@@freeze{\ContinuedFloat##1}%
+ \let\caption@frozen@setcounter\setcounter
+ \let\caption@frozen@addtocounter\addtocounter
+ \def\setcounter####1####2{\csname c@####1\endcsname####2\relax}%
+ \def\addtocounter####1####2{\advance\csname c@####1\endcsname ####2\relax}%
+ \caption@frozen@ContinuedFloat##1%
+ \let\setcounter\caption@frozen@setcounter
+ \let\addtocounter\caption@frozen@addtocounter}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@setup\caption@setup
+ \def\caption@setup##1{%
+ \caption@@freeze{\caption@setup{##1}}%
+ \caption@frozen@setup{##1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@caption\caption
+ \def\caption{%
+ \def\caption{%
+ \caption@Error{%
+ Only one \noexpand\caption can be placed in this environment}%
+ \caption@gobble}%
+ \@ifstar
+ {\caption@SC@caption*}%
+ {\let\caption@frozen@refstepcounter\caption@@refstepcounter
+ \let\caption@@refstepcounter\caption@l@stepcounter
+ \caption@refstepcounter\@captype
+ \let\caption@@refstepcounter\caption@frozen@refstepcounter
+ \let\@currentlabel\caption@SClabel
+ \caption@withoptargs\caption@SC@caption}}%
+ \long\def\caption@SC@caption##1##2{%
+ \caption@@freeze{\caption##1{##2}}%
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@label\label
+ \def\label{%
+ \caption@withoptargs\caption@SC@label}%
+ \def\caption@SC@label##1##2{%
+ \ifx\@currentlabel\caption@SClabel
+ \@bsphack
+ \caption@freeze@label{##1}{##2}%
+ \@esphack
+ \else
+ \caption@frozen@label##1{##2}%
+ \fi}%
+ \def\caption@SClabel{\caption@undefinedlabel}%
+ \def\caption@freeze@label##1##2{%
+ \caption@@freeze{\label##1{##2}}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\let\caption@frozen@content\@empty
+ \long\def\caption@@freeze{%
+ \g@addto@macro\caption@frozen@content}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@warmup{%
+ \let\ContinuedFloat\caption@frozen@ContinuedFloat
+ \let\caption@setup\caption@frozen@setup
+ \let\caption\caption@frozen@caption
+ \let\label\caption@frozen@label}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrost}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1g}{2008/01/30}{\cs{caption@defrost@setup} added}
+% \changes{v3.2c}{2011/08/21}{Adapted to changes of \cs{caption@freeze}}
+% \changes{v3.2c}{2011/08/21}{\cs{caption@defrost@setup} removed}
+% |\caption@defrost|
+% \begin{macrocode}
+ \newcommand*\caption@defrost{%
+ \ifx\caption@frozen@caption\@undefined
+ \caption@frozen@content
+ \else
+ \caption@Error{Internal Error:\MessageBreak
+ \noexpand\caption@defrost in same group as \string\caption@freeze}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@undefbool{needfreeze}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@warmup}
+% \changes{v3.2a}{2011/08/17}{This macro added}
+% |\caption@warmup|
+% \begin{macrocode}
+\let\caption@warmup\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{The float package}
+% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
+% \iffalse
+% (This is a more straight-ahead implementation, but it only works with v1.3
+% now, so v1.2 is no longer supported. The old code including documentation
+% can be found in caption-30f-050530.zip)
+% \fi
+%
+% The \package{float} package usually do not use the \LaTeX\ kernel command
+% |\@caption| to typeset the caption but |\float@caption| instead.
+% (|\@caption| will only be used if the float is re-styled with
+% |\restylefloat*|.)
+%
+% The main two things |\float@caption| is doing different are:
+% \begin{itemize}
+% \item The caption will be typeset inside a |\savebox| called |\@floatcapt|
+% so it can be placed above or below the float contents afterwards.
+% \item |\@makecaption| will not be used to finally typeset the caption.
+% Instead |\@fs@capt| will be used which definition is part of the float
+% style.
+% (Note that |\@fs@capt| will not typeset any vertical space above or below
+% the caption; instead this space will be typeset by the float style code
+% itself.)
+% \end{itemize}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{%
+ \@ifpackageloaded{floatrow}{%
+ \caption@ifpackageloaded{floatrow}[2007/08/24 v0.2a]{}{}%
+ }{%
+% \end{macrocode}
+%
+% \begin{macro}{\@float@setevery}
+% \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added
+% to redefinition of \cs{caption@setfloatcapt}}
+% |\@float@setevery|\marg{float type} is provided by the \package{float}
+% package; it's called every time a floating environment defined with
+% |\newfloat| or |\restylefloat| begins.
+% We use this hook to do some adaptations and to setup the proper caption
+% style (if defined) and additional settings declared with
+% |\captionsetup|\oarg{float style}.
+% \begin{macrocode}
+ \let\caption@ORI@float@setevery\@float@setevery
+ \def\@float@setevery#1{%
+ \float@ifcaption{#1}{%
+% \end{macrocode}
+%
+% First of all we set the caption position to it's proper value by
+% converting |\@fs@iftopcapt| (which is part of a float style and
+% controls where the caption will be typeset, above or below the float
+% contents) to our |position=| setting.
+% Since the spacing above and below the caption will be done by the float
+% style and \emph{not} by us this sounds quite useless. But in fact it isn't,
+% since some packages based on \thispackage\ (like the \package{subfig}
+% package) could have an interest for this information and therefore use the
+% |\caption@iftop| macro we provide in our kernel. Furthermore we need this
+% information for ourself in |\captionof| which uses |\@makecaption| to
+% finally typeset the caption with skips.
+% \begin{macrocode}
+ \caption@setposition{\@fs@iftopcapt t\else b\fi}%
+% \end{macrocode}
+%
+% Afterward we redefine |\caption@setfloatcapt| (which will be used inside
+% |\@caption|) so the caption will be set inside the box |\@floatcapt|,
+% without extra vertical space.
+% \begin{macrocode}
+ \renewcommand\caption@setfloatcapt[1]{%
+ \let\@makecaption\caption@@make
+ \global\setbox\@floatcapt\vbox{%
+ \color@begingroup ##1\color@endgroup}}%
+% \end{macrocode}
+%
+% To allow different caption styles for different float styles we also
+% determine the current float style (e.g. `ruled') and select
+% a caption style (and additional settings) with the same name, if defined.
+% \begin{macrocode}
+ \float@getstyle\float@style{#1}%
+ \caption@setstyle*\float@style
+ \caption@setoptions\float@style
+% \end{macrocode}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@freezeHref % will be defrosted in \float@makebox
+ \caption@ORI@float@setevery{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@typehook}
+% \changes{v3.1}{2007/07/08}{float package hook added}
+% \LaTeX\ and almost every other packages use
+% |\|\meta{type}|name|
+% to provide a macro for the type resp.~environment name -- for example
+% the command |\figurename| will usually contain the name of the floating
+% environment |figure|:
+% \begin{quote}
+% |\newcommand\figurename{Figure}|
+% \end{quote}
+% But the \package{float} package doesn't follow this common naming
+% convention:
+% For floats defined with |\newfloat| it uses |\fname@|\meta{type} instead,
+% which breaks with our code (and with |\autoref| and some other things as
+% well).
+% So we have to map the \package{float} package name to the common one here.\par
+% \Note{If the float was not defined with \cs{newfloat} but with
+% \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.}
+% \begin{macrocode}
+ \g@addto@macro\caption@typehook{%
+ \expandafter\ifx\csname #1name\endcsname\relax
+ \expandafter\let\csname #1name\expandafter\endcsname
+ \csname fname@#1\endcsname
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
+% \begin{macro}{\fs@plaintop}
+% \begin{macro}{\fs@boxed}
+% Since the float styles |plaintop| and |boxed| don't use |\abovecaptionskip|
+% which could be set with |skip=| (|plaintop| uses |\belowcaptionskip| instead of
+% |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|)
+% we patch the according float style macros here to change this.
+% \begin{macrocode}
+ \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
+ \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\float@getstyle}
+% \changes{v3.1}{2007/06/10}{This macro added}
+% |\float@getstyle|\marg{cmd}\marg{type}\par
+% Determining the float style is not so easy because the only hint
+% provided by the \package{float} package is the macro
+% |\fst@|\meta{float type} which points to the macro which represents the
+% float style. So for example after
+% \begin{quote}
+% |\floatstyle{ruled}|\\
+% |\newfloat{Program}{tbp}{lop}|
+% \end{quote}
+% |\fst@Program| will be defined as
+% \begin{quote}
+% |\def\fst@Program{\fs@ruled}|\quad.
+% \end{quote}\par
+% So here is what we do: We make the first level expansion of
+% |\fst@|\meta{float type} a string so we can gobble the first four tokens
+% (= |\fs@|), so only the the name of the float style is left.\par
+% \emph{TODO:} We need to convert the catcodes here.
+% \begin{macrocode}
+ \providecommand*\float@getstyle[2]{%
+ \edef#1{%
+ \noexpand\expandafter\noexpand\@gobblefour\noexpand\string
+ \expandafter\expandafter\expandafter\noexpand
+ \csname fst@#2\endcsname}%
+ \edef#1{#1}%
+ \caption@Debug{floatstyle{#2} = `#1'}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@ifcaption}
+% \changes{v3.1}{2007/06/23}{This macro added}
+% |\float@ifcaption|\marg{type}\marg{if-clause}\marg{else-clause}\par
+% Here we determine if the user has used |\newfloat| resp.~|\restylefloat|,
+% or |\restylefloat*|.
+% This is quite easy: If |\@float@c@|\meta{captype} is the same as
+% |\float@caption|, the user has used |\newfloat| or |\restylefloat|,
+% otherwise we assume he has used |\restylefloat*|.
+% (This test will fail if some package re-defines |\float@caption|,
+% so we have to assume that there is no one.)
+% \begin{macrocode}
+ \providecommand*\float@ifcaption[1]{%
+ \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}}{%
+ \providecommand*\float@ifcaption[1]{\@secondoftwo}%
+% \clearcaptionsetup{boxed}% used by the floatrow package?
+}
+% \end{macrocode}
+%
+% The skip between `boxed' floats and their caption defaults to |2pt|.
+%
+% \begin{macrocode}
+\captionsetup[boxed]{skip=2pt} % do not issue a warning when not used
+% \end{macrocode}
+%
+% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
+% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
+% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
+% `ruled' with appropriate options. But if the package option |ruled| was
+% specified, we setup some caption parameters to emulate the behavior
+% of \thispackage\ \version{1.x} option |ruled| instead, i.e.,
+% the current caption settings will be used, but without margin and without
+% `single-line-check'.
+% \begin{macrocode}
+\caption@ifbool{ruled}{%
+ \captionsetup[ruled]{margin=0pt,minmargin=0,slc=0}%
+}{%
+ \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
+}
+\caption@undefbool{ruled}
+% \end{macrocode}
+%
+% \subsubsection{The floatflt package}
+% \changes{v3.1}{2007/06/10}{Support of the \package{floatflt} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{floatflt}[1996/02/27 v1.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\floatingfigure}
+% We patch |\floatingfigure| so |\caption@floatflt| will be used.
+% \begin{macrocode}
+ \let\caption@ORI@floatingfigure\floatingfigure
+ \def\floatingfigure{%
+ \caption@floatflt{figure}%
+ \caption@ORI@floatingfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\floatingtable}
+% Same with |\floatingtable|\ldots
+% \begin{macrocode}
+ \let\caption@ORI@floatingtable\floatingtable
+ \def\floatingtable{%
+ \caption@floatflt{table}%
+% \caption@setautoposition b%
+ \caption@ORI@floatingtable}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@floatflt}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Here we do two things:
+% \begin{enumerate}
+% \item We use |\caption@set|\-|options{|\-|floating|\meta{type}|}| so
+% |\caption|\-|setup[|\-|floating|\meta{type}|]{|\ldots|}| is supported.
+% \item |\line|\-|width| must be set correctly.
+% Usually this is done by |\@par|\-|box|\-|restore| inside |\@caption|,
+% but since we use |\@caption@box|\-|restore| we have to map this to
+% |\@par|\-|box|\-|restore| instead.
+% \end{enumerate}
+% \begin{macrocode}
+ \newcommand*\caption@floatflt[1]{%
+ \caption@settype{#1}%
+ \caption@clearmargin
+ \caption@setfullparboxrestore
+ \caption@setoptions{floating#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The fltpage package}
+% \changes{v3.1}{2007/07/22}{Support of the \package{fltpage} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\FP@positionLabel}
+% \changes{v3.2c}{2011/08/28}{This redefinition added}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@positionLabel}{%
+% FP\@captype-\number\value{FP@\@captype C}-pos}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand\FP@positionLabel{%
+ FP\FP@captype-\number\value{FP@\FP@captype C}-pos}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@helpNote}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@helpNote}[2]{%
+% \typeout{FP#1 is inserted on page \pageref{#2}!}}%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand\FP@helpNote[2]{%
+ \begingroup % save \caption@thepage
+ \caption@pageref{#2}%
+ \typeout{FP#1 is inserted on page \caption@thepage!}%
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatBegin}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-09-11: Missing \cs{ignorespaces} added}
+% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatBegin}[1]{%
+% \gdef\@captype{#1}%
+% \global\let\FP@savedCaptionCommand\caption%
+% \global\let\FP@savedLabelCommand\label%
+% \ifthenelse{\equal{\@captype}{figure}}
+% {\global\let\old@Fnum\fnum@figure}%
+% {\global\let\old@Fnum\fnum@table}%
+% \let\FP@LabelText\@empty%
+% \let\FP@CaptionText\@empty%
+% \let\FP@optionalCaptionText\@empty%
+% \renewcommand\label[1]{\gdef\FP@LabelText{##1}}%
+% \renewcommand\caption[2][]{%
+% \gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}%
+% \begin{lrbox}{\FP@floatCorpusBOX}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatBegin[1]{%
+ \def\FP@captype{#1}%
+ \begin{lrbox}{\FP@floatCorpusBOX}%
+ \caption@settype*{#1}%
+ \caption@freeze
+ \global\let\FP@Label\@empty
+ \caption@ifFPrefcap
+ {}%
+ {\def\caption@freeze@label##1##2{%
+ \g@addto@macro\FP@Label{\FP@label##1{##2}}}}%
+ \ignorespaces}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatEnd}
+% \changes{v3.1g}{2008/01/30}{Some minor bugfixes}
+% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatEnd}{%
+% \end{lrbox}%
+% \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
+% \stepcounter{FP@\@captype C}%
+% \FP@savedLabelCommand{\FP@positionLabel}%
+% \FP@helpNote{\@captype}{\FP@positionLabel}%
+% \FP@float
+% {\FP@positionLabel}% location label test
+% {\begin{\@captype}[p!]
+% \usebox{\FP@floatCorpusBOX}%
+% \refstepcounter{\@captype}%
+% \ifthenelse{\equal{\FP@LabelText}{\@empty}}
+% {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
+% \end{\@captype}}
+% {\addtocounter{\@captype}{-1}}
+% {\begin{\@captype}[b!]%
+% \ifthenelse{\equal{\FP@guide}{\@empty}}%
+% {}{\ifthenelse{\equal{\@captype}{figure}}%
+% {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}%
+% {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}%
+% \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \FP@separatorCaption%
+% \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
+% {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%
+% {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]%
+% {\expandafter\protect\FP@CaptionText}}%
+% \end{\@captype}}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatEnd{%
+ \end{lrbox}%
+% \end{macrocode}
+% \begin{macrocode}
+ \stepcounter{FP@\FP@captype C}%
+ \caption@label\FP@positionLabel
+ \FP@helpNote\FP@captype\FP@positionLabel
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\FP@RestoreCounter{%
+ \noexpand\setcounter{\FP@captype}{\the\value\FP@captype}%
+ \noexpand\setcounter{ContinuedFloat}{\the\value{ContinuedFloat}}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \FP@float
+ {\FP@positionLabel}% location label test
+ {\begin\FP@captype[p!]%
+ \usebox\FP@floatCorpusBOX
+ \let\caption@SClentry\@empty
+ \def\caption{\caption@dblarg{\@caption\@captype}}%
+ \long\def\@caption##1[##2]##3{\def\caption@SClentry{##2}}%
+ \let\FP@label\label
+ \let\label\caption@gobble
+ \caption@defrost
+ \caption@ifFPlistcap
+ {\caption@refstepcounter\@captype
+ \expandafter\caption@makecurrent\expandafter\@captype
+ \expandafter{\caption@SClentry}}%
+ {\ifx\caption@SClentry\@empty \else
+ \expandafter\captionlistentry\expandafter{\caption@SClentry}%
+ \fi}%
+ \caption@makeanchor\relax
+ \FP@Label
+ \end\FP@captype}%
+ {\FP@RestoreCounter
+ \@ifundefined{theH\FP@captype}{}{%
+ \expandafter\l@addto@macro\csname theH\FP@captype\endcsname{.FP}}}%
+ {\begin\FP@captype[b!]%
+ \let\FP@savedSetfnumCommand\caption@setfnum
+ \def\caption@setfnum##1{%
+ \FP@savedSetfnumCommand{##1}%
+ \ifx\FP@guide\@empty \else
+ \expandafter\l@addto@macro\csname fnum@##1\endcsname{\ {\FP@guide}}%
+ \fi}%
+ \setlength\abovecaptionskip{2pt plus 2pt minus 1pt}% length above caption
+ \setlength\belowcaptionskip{2pt plus 2pt minus 1pt}% length below caption
+ \caption@setoptions{FP\@captype}%
+ \FP@separatorCaption
+ \caption@ifFPlistcap{}{\let\caption@addcontentsline\@gobbletwo}%
+ \caption@defrost
+ \end\FP@captype}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\caption@ifFPlistcap\@undefined
+ \let\caption@ifFPrefcap\@undefined
+}
+% \end{macrocode}
+%
+% \subsubsection{The hyperref package}
+% \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
+% \changes{v3.1}{2007/03/09}{Usage of \cs{hyper@makecurrent} instead of
+% \cs{theHfigure} as indicator for \package{hyperref} package}
+% \changes{v3.2}{2011/07/30}{Test if \package{hyperref} has stopped early revised}
+% \changes{v3.2c}{2011/08/24}{Test if \package{hyperref} has stopped early adapted to current version of \package{hyperref} package: Usage of \cs{IfHyperBoolean} added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{%
+ % Test if hyperref has stopped early
+ \caption@ifundefined\IfHyperBoolean{%
+ \caption@set@bool\caption@ifhyp@stoppedearly0%
+ \caption@ifundefined\H@refstepcounter
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
+ \caption@ifundefined\hyper@makecurrent
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
+ \caption@ifundefined\measuring@true
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{}}}%
+ }{%
+ \def\caption@ifhyp@stoppedearly{\IfHyperBoolean{stoppedearly}}%
+ }%
+ \caption@ifhyp@stoppedearly{% hyperref has stopped early
+ \caption@InfoNoLine{%
+ Hyperref support is turned off\MessageBreak
+ because hyperref has stopped early}%
+ }{%
+ \g@addto@macro\caption@prepareslc{\measuring@true}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@@refstepcounter}
+% We redefine |\caption@@refstepcounter| so |\H@refstepcounter| will be used
+% instead of |\refstepcounter| inside |\caption| \& |\captionlistentry|.
+% \begin{macrocode}
+ \renewcommand*\caption@@refstepcounter{\H@refstepcounter}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% We redefine |\caption@makecurrent| so a \package{hyperref} label
+% will be defined inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand*\caption@makecurrent[2]{%
+ \caption@makecurrentHref{#1}%
+ \caption@Debug{hyperref current=\@currentHref}%
+ \caption@gettitle{#2}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@makecurrentHref{\hyper@makecurrent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makeanchor}
+% \changes{v3.1l}{2010/01/09}{Adapted to the current hyperref package}
+% We redefine |\caption@makeanchor| so a \package{hyperref} anchor
+% will be set inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand\caption@makeanchor[1]{%
+ \caption@Debug{hyperref anchor: \@currentHref}%
+ % If we cannot have nesting, the anchor is empty.
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#1}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
+ }#1%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \g@addto@macro\caption@prepareslc{\let\caption@makeanchor\@firstofone}%
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{The hypcap option}
+%
+% \begin{macro}{\if@capstart}
+% Like the \package{hypcap} package we define the switch |\if@capstart|, too.
+% \begin{macrocode}
+ \newif\if@capstart
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@start}
+% \changes{v3.0l}{2007/02/20}{%
+% \cs{caption@currentHref} renamed to \cs{hc@currentHref}}
+% \changes{v3.1}{2007/06/21}{%
+% This macro renamed from \cs{capstart} to \cs{caption@start} and revised}
+% While the \package{hypcap} package defines a macro called |\capstart|
+% our variant is called |\caption@start| and is controlled by the option
+% |hypcap=||false|/|true|.
+% \begin{macrocode}
+ \def\caption@start{\caption@ifhypcap\caption@start@\relax}%
+ \def\caption@start@{%
+% \end{macrocode}
+% Generate the \package{hyperref} label and set the \package{hyperref} anchor,
+% usually (if |hypcap=false|) both is done inside |\@caption|.
+% \begin{macrocode}
+ \caption@makestart\@captype
+ \caption@startanchor\@currentHref
+% \end{macrocode}
+% Prevent |\@caption| from generating a new \package{hyperref} label,
+% use the label we save in |\hc@currentHref| instead.
+% (We also support the |@capstart| flag from the \package{hypcap} package.)
+% \begin{macrocode}
+ \global\@capstarttrue
+ \let\hc@currentHref\@currentHref
+ \def\caption@makecurrentHref##1{%
+ \global\@capstartfalse
+ \global\let\@currentHref\hc@currentHref}%
+% \end{macrocode}
+% Prevent |\@caption| from generating a \package{hyperref} anchor since this
+% has already been done.
+% \begin{macrocode}
+ \let\caption@makeanchor\@firstofone
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makestart}
+% \changes{v3.1c}{2007/09/30}{\cs{@currentHref} will be extended by \texttt{caption}
+% instead of \texttt{xxx} now}
+% |\caption@makestart|\marg{type}
+% defines a \package{hyperref} anchor inside |\caption@start|.\par
+% Since we offer |\ContinuedFloat| the float counter can change between
+% `now' and |\caption|, i.e., we simply don't know the figure or table counter
+% yet and therefore we are not able to generate the `right' \package{hyperref}
+% label.
+% Two different solutions of this problem came into my mind:
+% \begin{enumerate}
+% \item I could use the aux file for this purpose.\par
+% -or-
+% \item I set |hypertexnames=false| locally.
+% Furthermore I use |#1.caption.|\meta{counter} (instead of |#1.|\meta{counter})
+% as naming scheme for |\@currentHref| to avoid conflicts with other hyper
+% links which are generated with |hypertexnames=true|.
+% \end{enumerate}
+% The first idea has the advantage that the `right' anchor name will be
+% generated, but one needs an additional \LaTeX\ run if figures or tables
+% will be inserted or removed.\par
+% The second idea has the advantage that it's very easy to implement, but
+% has some side-effects, e.g. the anchor names don't follow the figure or
+% table label names anymore.\par
+% Since I'm lazy I implemented the second idea, maybe I will revise this
+% later on.
+% \begin{macrocode}
+ \newcommand*\caption@makestart[1]{%
+ \begingroup
+ \Hy@hypertexnamesfalse
+% \gdef\@currentHlabel{}%
+ \hyper@makecurrent{#1.caption}%
+ \endgroup
+ \caption@Debug{hypcap start=\@currentHref}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@startanchor}
+% \changes{v3.1b}{2007/09/17}{Bugfix 06-09-17: We use \cs{caption@anchor} instead of \cs{hyper@@anchor}}
+% \changes{v3.1g}{2008/03/16}{Warning about TeX mode replaced with debug info}
+% |\caption@startanchor|\marg{Href}
+% sets a \package{hyperref} anchor inside |\caption@start|.\par
+% This code was taken from the \package{hypcap} package\cite{hypcap} and adapted.
+% \Note{Since \cs{hyper@@anchor}\marg{Href}\csmarg{\string\relax} can cause
+% a change from vertical mode to horizontal mode (design flaw in
+% \package{hyperref} package!?), and since the workaround
+% \cs{let}\cs{leavevmode}\cs{relax} which can be found in the
+% \package{hypcap} package is not always sufficient
+% (for example with ``Direct pdfmark support'' and \texttt{breaklinks=true}),
+% we use \cs{caption@anchor} instead of \cs{hyper@@anchor} here.}
+% \begin{macrocode}
+ \newcommand*\caption@startanchor[1]{%
+ \ifvmode\begingroup
+ \caption@Debug{hypcap anchor: #1 (vertical mode)}%
+ \@tempdima\prevdepth
+ \nointerlineskip
+ \vspace*{-\caption@hypcapspace}%
+ \caption@anchor{#1}%
+ \vspace*{\caption@hypcapspace}%
+ \prevdepth\@tempdima
+ \endgroup\else
+ \caption@Debug{hypcap anchor: #1 (horizontal mode)}%
+ \caption@anchor{#1}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@anchor}
+% \changes{v3.1c}{2007/10/17}{Workaround 07-10-17: We use \cs{caption@raisedlink} instead of \cs{Hy@raisedlink} now}
+% |\caption@anchor|\marg{Href} sets a \package{hyperref} anchor.
+% \begin{macrocode}
+ \newcommand*\caption@anchor[1]{%
+ \ifmeasuring@ \else
+ \caption@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}%
+ \fi}%
+% \end{macrocode}
+% \Note{Since \cs{Hy@raisedlink} change \cs{@tempdima} we surrounded it by \cs{ifvmode},
+% suppressing ``\texttt{LaTeX Warning: Float too large for page by 1.0pt}'' in \texttt{sideways} floats.
+% (This is not necessary since \package{hyperref} \version{6.77}.)}
+% \begin{macrocode}
+ \ifx\HyperRaiseLinkLength\@tempdima
+ \def\caption@raisedlink#1{\ifvmode#1\else\Hy@raisedlink{#1}\fi}%
+ \else
+ \let\caption@raisedlink\Hy@raisedlink
+ \fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@start}
+% Will be used by |\caption@freezeHref|. Apart from that we issue a warning
+% if we expect a saved \package{hyperref} label coming from |\caption@start|,
+% but there isn't any.
+% \begin{macrocode}
+ \def\caption@@start{%
+ \caption@ifundefined\hc@currentHref{%
+ \caption@Warning{%
+ The option `hypcap=true' will be ignored for this\MessageBreak
+ particular \string\caption}}{}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@freezeHref}
+% Suppress |\caption@start| from generating a \package{hyperref} label and
+% setting a \package{hyperref} anchor. Instead if |\@caption| generates a
+% \package{hyperref} label, it will be stored in |\caption@currentHref|.
+% Furthermore we need to redefine |\caption@setfloatcapt| so no
+% \package{hyperref} anchor will be placed in |\@caption|.
+% \iffalse
+% (Since |\caption@setfloatcapt| will be set to |\@firstofone| inside
+% |\subcaption| there is no need to add its restauration to
+% |\caption@subtypehook|.)
+% \fi
+% \begin{macrocode}
+ \def\caption@freezeHref{%
+ \let\caption@ORI@start\caption@start
+ \def\caption@start{\let\caption@start\caption@ORI@start}%
+% \end{macrocode}
+% \begin{macrocode}
+% \let\caption@ORI@@start\caption@@start
+% \l@addto@macro\caption@subtypehook{%
+% \let\caption@@start\caption@ORI@@start}%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\let\caption@currentHref\@undefined
+ \def\caption@@start{\global\let\caption@currentHref\@currentHref}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ORI@setfloatcapt\caption@setfloatcapt
+ \renewcommand*\caption@setfloatcapt{%
+ \ifx\caption@currentHref\@undefined \else
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \caption@ORI@setfloatcapt}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrostHref}
+% If there is a freezed |\@currentHref|, we set the \package{hyperref}
+% anchor here.
+% \begin{macrocode}
+ \def\caption@defrostHref{%
+ \ifx\caption@currentHref\@undefined \else
+ \caption@startanchor\caption@currentHref
+ \global\let\caption@currentHref\@undefined
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@makebox}
+% Do our own redefinition of |\float@makebox|, if it was redefined by
+% the \package{hyperref} package.
+% \begin{macrocode}
+ \caption@ifundefined\HyOrg@float@makebox{}{%
+ \caption@Debug{%
+ Redefining \noexpand\float@makebox (again)\@gobble}%
+ \let\caption@ORI@float@makebox\float@makebox % save for compatibility mode
+ \renewcommand\float@makebox[1]{%
+ \HyOrg@float@makebox{#1\relax \caption@defrostHref}}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }}{}
+% \end{macrocode}
+%
+% \subsubsection{The hypcap package}
+% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
+% \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} \version{1.6}}
+% \changes{v3.1e}{2007/11/04}{\package{hypcap} support adapted to \package{hyperref} \version{6.77}}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hypcap}{% v1.0
+ \ifx\caption@start\relax \else % hyperref hasn't stopped early
+% \end{macrocode}
+%
+% If the \package{hypcap} package was loaded, we give up our own
+% hyperlink placement algorithm and give the control over the placement
+% to the \package{hypcap} package instead.
+%
+% \begin{macro}{\capstart}
+% \changes{v3.1k}{2009/10/09}{Support of \cs{ifcapstart} (\package{hypcap} package \version{1.10}) added}
+% We do this simply by mapping |\capstart| to |\caption@start@|,
+% although our code does not behave exactly like the original one:
+% The original |\capstart| has an effect on the next |\caption|
+% only but our version affects \emph{all} |\caption|s in the same
+% environment, at least unless a new |\capstart| will be placed.
+% \begin{macrocode}
+ \let\caption@ORI@capstart\capstart % save for compatibility mode
+ \caption@ifundefined\capstarttrue % check for v1.10 of hypcap package
+ {\def\capstart{\caption@start@}}%
+ {\def\capstart{\ifcapstart\caption@start@\fi}}%
+ \let\caption@start\relax
+ \let\caption@@start\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@hypcapspace}
+% Furthermore we map our |\caption@hypcapspace| to |\hypcapspace|
+% offered by the \package{hypcap} package.
+% \begin{macrocode}
+ \caption@set@bool\caption@ifhypcap 1%
+ \renewcommand*\caption@hypcapspace{\hypcapspace}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \fi}{}
+% \end{macrocode}
+%
+% \subsubsection{The listings package}
+% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{%
+% \end{macrocode}
+%
+% \begin{macro}{\lst@MakeCaption}
+% \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now}
+% \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added}
+% \changes{v3.2}{2010/10/26}{Bugfix 10-07-20a: Set \cs{hsize} to \cs{linewidth}, if necessary}
+% To support the \package{listings} package we need to redefine
+% |\lst@MakeCaption| so the original stuff is nested with
+% |\caption@begin| and |\caption@end| etc.
+% \Note{This macro is always called twice (with `t' resp. `b' as
+% parameter), therefore we need an extra group here.}
+% \begin{macrocode}
+ \let\caption@ORI@lst@MakeCaption\lst@MakeCaption
+ \def\lst@MakeCaption#1{% #1 is `t' or `b'
+ \begingroup
+% \end{macrocode}
+% Workaround for bug in \package{listings} package:
+% If |\hsize| seems not to be set correctly, we set it to |\linewidth|.
+% \begin{macrocode}
+ \ifdim\hsize>\linewidth
+ \hsize\linewidth
+ \fi
+% \end{macrocode}
+% First of all, we set |position=#1| and if it was set to `top',
+% we swap the skips so the default behavior of the \package{listings} package
+% will not be changed. (Note that the \package{listings} package has set its
+% own |\abovecaptionskip| \& |\belowcaptionskip| values prior to calling
+% \cs{lst@MakeCaption}.)
+% \begin{macrocode}
+ \caption@setposition{#1}%
+ \caption@iftop{%
+ \@tempdima\belowcaptionskip
+ \belowcaptionskip\abovecaptionskip
+ \abovecaptionskip\@tempdima}{}%
+% \end{macrocode}
+% Workaround for issue with wrong skips (should be examined further)
+% \begin{macrocode}
+ \caption@setup{rule=0}%
+% \end{macrocode}
+% Afterwards we set the local `lstlisting' options.
+% \begin{macrocode}
+ \caption@setoptions{lstlisting}%
+% \end{macrocode}
+% If the |position=| is now set to |auto|, we take over the |captionpos=|
+% setting from the \package{listings} package.
+% \begin{macrocode}
+ \caption@setautoposition{#1}%
+% \end{macrocode}
+% At the end we do similar stuff as in our \cs{@caption} code.
+% \begin{macrocode}
+ \caption@begin{lstlisting}%
+ \caption@ORI@lst@MakeCaption{#1}%
+ \caption@end
+% \end{macrocode}
+% \begin{macrocode}
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lst@makecaption}
+% \begin{macro}{\lst@maketitle}
+% Wrapper macros for typesetting the |caption=| resp. |title=| value.
+% \begin{macrocode}
+ \def\lst@makecaption{\caption@starfalse\@makecaption}%
+ \def\lst@maketitle{\caption@startrue\@makecaption\@empty}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ext@lstlisting}
+% \changes{v3.1}{2007/03/03}{This macro added}
+% Since the \package{listings} package do not define |\ext@lstlisting|
+% but we needed it when |\captionof{lstlisting}| will be done by the end user,
+% we define it here.
+% \begin{macrocode}
+ \providecommand*\ext@lstlisting{lol}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1a}{2007/07/13}{Bugfix 07-09-13: \cs{lst@@caption} will not be re-defined anymore}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The longtable package}
+%
+% \begin{macro}{\LTcaptype}
+% \changes{v3.1}{2007/07/06}{This macro and its support added}
+% |\LTcaptype| is preset to |table|.
+% \begin{macrocode}
+\providecommand*\LTcaptype{table}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{%
+% \end{macrocode}
+% \begin{macrocode}
+ \RequirePackage{ltcaption}[=2007/09/01]%
+ \let\LT@@makecaption\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\LT@array}
+% \changes{v3.1}{2007/07/22}{This redefinition added}
+% \changes{v3.1a}{2007/09/14}{Bugfix 07-09-14: Redefinition of \cs{@captionabovetrue} \& \cs{@captionabovefalse} added}
+% \changes{v3.1a}{2007/09/16}{Bugfix: This redefinition will always be done \cs{AtBeginDocument}}
+% \changes{v3.1g}{2008/01/20}{Bugfix in \cs{captionlistentry}: Table counter will not be incremented anymore, \cs{nameref} works}
+% We redefine |\LT@array| here to get |\captionsetup|\marg{options}
+% working inside |longtable|s.
+% \Note{Since the \package{hyperref} package patches \cs{LT@array} as well
+% and since this only works with the original definition of \cs{LT@array},
+% we have to do this after the \package{hyperref} package,
+% i.e.~\cs{AtBeginDocument}.}
+% \begin{macrocode}
+ \caption@AtBeginDocument{%
+ \let\caption@ORI@LT@array\LT@array
+ \renewcommand*\LT@array{%
+% \end{macrocode}
+% |\captionsetup| for longtable:
+% \begin{macrocode}
+ \global\let\caption@opt@@longtable\@undefined
+ \def\captionsetup{%
+ \noalign\bgroup
+ \@ifstar\@captionsetup\@captionsetup}% gobble *
+ \def\@captionsetup##1{\LT@captionsetup{##1}\egroup}%
+ \def\LT@captionsetup##1{%
+ \captionsetup@startrue\caption@setup@options[@longtable]{##1}%
+ \global\let\caption@opt@@longtable\caption@opt@@longtable}%
+% \end{macrocode}
+% |\captionabove| \& |\captionbelow| for longtable: (\KOMAScript\ document class)
+% \begin{macrocode}
+ \def\@captionabovetrue{\LT@captionsetup{position=t}}%
+ \def\@captionabovefalse{\LT@captionsetup{position=b}}%
+% \end{macrocode}
+% |\captionlistentry| for longtable:
+% \begin{macrocode}
+ \def\captionlistentry{%
+ \noalign\bgroup
+ \@ifstar{\egroup\LT@captionlistentry}% gobble *
+ {\egroup\LT@captionlistentry}}%
+ \def\LT@captionlistentry##1{%
+ \caption@listentry\@firstoftwo[\LTcaptype]{##1}}%
+% \end{macrocode}
+% |\ContinuedFloat| for longtable:\\
+% {\small(Commented out, since it's not deeply tested and quite useless anyway)}
+% \Note{\package{hyperref} versions $<$ v6.76j uses $2\times$ \cs{hyper@makecurrent}}
+% \begin{macrocode}
+% \caption@ifhypcap{%
+% \let\caption@ORI@hyper@makecurrent\hyper@makecurrent
+% \def\hyper@makecurrent##1{%
+% \let\hyper@makecurrent\caption@ORI@hyper@makecurrent
+% \caption@makestart{##1}%
+%% \let\Hy@LT@currentHlabel\@currentHlabel
+% \let\Hy@LT@currentHref\@currentHref
+% \def\hyper@makecurrent####1{%
+%% \let\@currentHlabel\Hy@LT@currentHlabel
+% \let\@currentHref\Hy@LT@currentHref}}%
+% \let\caption@ORI@ContinuedFloat\ContinuedFloat
+% \def\ContinuedFloat{\noalign{%
+% \gdef\caption@setContinuedFloat{%
+% \let\caption@resetContinuedFloat\@gobble}%
+% \def\caption@setoptions####1{%
+% \g@addto@macro\caption@setContinuedFloat{%
+% \caption@setoptions{####1}}}%
+% \let\@captype\LTcaptype
+% \caption@ORI@ContinuedFloat}}%
+% }{%
+% \def\ContinuedFloat{\noalign{%
+% \caption@Error{%
+% \noexpand\ContinuedFloat inside longtables\MessageBreak
+% is only available with `hypcap=true'}}}%
+% }%
+% \global\let\caption@setContinuedFloat\@empty
+ \def\ContinuedFloat{\noalign{%
+ \caption@Error{\noexpand\ContinuedFloat outside float}}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ORI@LT@array}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@c@ption}
+% \changes{v3.1g}{2008/01/22}{Made it \cs{long}}
+% The original implementation:
+% \begin{verbatim}
+% \def\LT@c@ption#1[#2]#3{%
+% \LT@makecaption#1\fnum@table{#3}%
+% \def\@tempa{#2}%
+% \ifx\@tempa\@empty\else
+% {\let\\\space
+% \addcontentsline{lot}{table}{\protect\numberline{\thetable}{#2}}}%
+% \fi}
+% \end{verbatim}%^^A
+% Our implementation uses |\LTcaptype| instead of |{table}|:
+% \begin{macrocode}
+ \long\def\LT@c@ption#1[#2]#3{%
+ \LT@makecaption#1{\csname fnum@\LTcaptype\endcsname}{#3}%
+ \LT@captionlistentry{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@makecaption}
+% \changes{v3.0d}{2004/08/10}{%
+% Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
+% \changes{v3.0e}{2005/05/05}{%
+% Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
+% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
+% |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
+% \smallskip
+% The original definition:
+% \begin{verbatim}
+% \def\LT@makecaption#1#2#3{%
+% \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
+% % Based on article class "\@makecaption", "#1" is "\@gobble" in star
+% % form, and "\@firstofone" otherwise.
+% \sbox\@tempboxa{#1{#2: }#3}%
+% \ifdim\wd\@tempboxa>\hsize
+% #1{#2: }#3%
+% \else
+% \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+% \fi
+% \endgraf\vskip\baselineskip}%
+% \hss}}}
+% \end{verbatim}%^^A
+% Our definition:
+% \begin{macrocode}
+ \renewcommand\LT@makecaption[3]{%
+ \caption@LT@make{%
+% \end{macrocode}
+%
+% If |\LTcapwidth| is not set to its default value |4in| we assume
+% that it shall overwrite our own setting.
+% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
+% \begin{macrocode}
+ \caption@settype*\LTcaptype
+ \ifdim\LTcapwidth=4in \else
+ \setcaptionwidth\LTcapwidth
+ \fi
+ \caption@setoptions{longtable}%
+% \caption@setContinuedFloat
+ \caption@setoptions{@longtable}%
+% \end{macrocode}
+%
+% \iffalse
+% The default |position=| setting for longtables is |top|.
+% (This emulates the standard behavior of the \package{longtable} package
+% which has no skip above the caption but a skip below it.)
+% \fi
+%
+% |position=auto| is a bad idea for longtables, but we do our very best.
+% This works quite well for captions inside the longtable contents, but
+% not for captions inside the longtable (end)foot.
+% \Note{This should be `top' if unclear!}
+% \begin{macrocode}
+ \caption@setautoposition{\ifcase\LT@rows t\else b\fi}%
+% \end{macrocode}
+%
+% We set |\ifcaption@star| according the 1st argument.
+% \begin{macrocode}
+ \caption@startrue#1\caption@starfalse
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/05/05}{\cs{caption@normalsize} added}
+% \begin{macrocode}
+ \caption@resetContinuedFloat\LTcaptype
+ \caption@begin\LTcaptype
+ \caption@normalsize
+% \end{macrocode}
+%
+% The following skip has the purpose to correct the height of the
+% |\parbox[t]|. Usually it's the height of the very first line, but
+% because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
+% it's always |0pt|.\par
+% (A different idea would be typesetting the first skip outside the longtable
+% column with |\noalign{\vskip|\ldots|}|, but this means we have to move
+% |\caption@begin| to some other place because it does not work in tabular
+% mode. And at the moment I have no idea on how to do this in an elegant
+% way\ldots)
+% \begin{macrocode}
+ \vskip-\ht\strutbox
+% \end{macrocode}
+%
+% The following code should look familiar. We do our skips and use
+% |\caption@@make| to typeset the caption itself.
+% \begin{macrocode}
+ \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
+ \caption@@make{#2}{#3}\endgraf
+ \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}%
+ \caption@end}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The picinpar package}
+% \changes{v3.1}{2007/06/13}{Support of the \package{picinpar} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picinpar}{%
+% \end{macrocode}
+%
+% \begin{macro}{\figwindow}
+% \begin{macro}{\tabwindow}
+% The \package{picinpar} package comes with its own caption code
+% (|\wincaption|, |\@wincaption|, |\@makewincaption|, \ldots)
+% so we redefine |\figwindow| \& |\tabwindow| to use |\caption| instead.
+% \begin{macrocode}
+ \long\def\figwindow[#1,#2,#3,#4] {%
+ \caption@window{figure}%
+ \caption@setoptions{figwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\tabwindow[#1,#2,#3,#4] {%
+ \caption@window{table}%
+ \caption@setoptions{tabwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@window}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Beside calling |\caption@settype| we redefine |\caption@boxrestore|
+% (as in \package{floatflt} \& \package{picins} package support)
+% and |\@makecaption| (as in \package{float} package support) here.
+% \begin{macrocode}
+ \newcommand*\caption@window[1]{%
+ \let\@makecaption\caption@@make
+ \caption@setautoposition b%
+ \caption@settype{#1}%
+ \caption@clearmargin
+ \caption@setfullparboxrestore}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@wincaption}
+% \changes{v3.1d}{2007/10/25}{Missing \% added}
+% This one finally typesets the caption using |\caption|.
+% \begin{macrocode}
+ \newcommand\caption@wincaption[1]{%
+% \end{macrocode}
+% This will be done twice for every |figwindow| \& |tabwindow| caption --
+% on the first run |\picwd| is |0pt|, on the second run |\picwd| is |\hsize|.
+% \begin{macrocode}
+ \ifdim\picwd=\z@
+ \let\caption@makecurrent\@gobbletwo
+ \let\caption@@start\relax
+ \caption@prepareslc
+ \fi
+% \end{macrocode}
+% The argument |#1| could contain simply the caption text
+% (e.g.~|A figure caption|), but it could also contain an optional argument,
+% the \meta{lst\_entry}
+% (e.g.~|[An| |entry| |to| |the| |LOF]||{A| |figure| |caption}|).
+% Therefore we have to test if |#1| begins with~|[| or not; furthermore we
+% support a starred variant -- as in |\caption*| -- so we test for~|*|, too.
+% \begin{macrocode}
+ \edef\@tempa{\expandafter\noexpand\@car#1\@nil}%
+ \if\@tempa*%
+ \let\@tempa\@firstofone
+ \else\if\@tempa[%]
+ \let\@tempa\@firstofone
+ \else
+ \let\@tempa\@empty
+ \fi\fi
+ \expandafter\caption\@tempa{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The picins package}
+% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
+%
+% \begin{macro}{\piccaptiontype}
+% |\piccaptiontype|\marg{type}\par
+% We offer this macro for changing the \meta{type} of the caption, so the user
+% doesn't have to redefine |\@captype|, as proposed in the \package{picins}
+% documentation.
+% \Note{We define this macro here so it can be used in the
+% preamble of the document, even when \thispackage\ was loaded prior to the
+% \package{picins} package.}
+% \begin{macrocode}
+\newcommand*\piccaptiontype[1]{\def\@piccaptype{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picins}{%
+% \end{macrocode}
+%
+% Initial set |\@piccaptype| and undefine |\@captype| which was set to
+% |figure| by the \package{picins} package.
+% \begin{macrocode}
+ \caption@ifundefined\@piccaptype{%
+ \caption@iftype{%
+ \let\@piccaptype\@captype
+ }{%
+ \def\@piccaptype{figure}%
+ }%
+ }{}%
+ \let\@captype\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\piccaption}
+% The original code:
+% \begin{verbatim}
+% \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
+% \end{verbatim}%^^A
+% Our code uses |\caption@star| so |\piccaption*| works,
+% and |\caption@dblarg| so |\piccaption{}| works correctly.
+% \begin{macrocode}
+ \def\piccaption{\caption@star\relax{\caption@dblarg\@piccaption}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\make@piccaption}
+% \changes{v3.1}{2007/12/06}{Bugfix: \cs{caption@clearmargin} will always be used now}
+% The original code:
+% \begin{verbatim}
+% \def\make@piccaption{%
+% [...]
+% \setbox\@TEXT=\vbox{\hsize\hsiz@\caption[\sh@rtf@rm]{\capti@nt@xt}}%
+% }
+% \end{verbatim}%^^A
+% In our code we have to correct several things:
+% \begin{enumerate}
+% \item |\@captype| must be defined, since we have removed the global
+% definition.
+% \item We use |\caption@setoptions{parpic}| so
+% |\captionsetup[parpic]{|\ldots|}| is supported.
+% \item |\linewidth| must be set correctly.
+% Usually this is done by |\@parboxrestore| inside |\@caption|,
+% but since we use |\@caption@boxrestore| we have to map this to
+% |\@parboxrestore| instead.
+% \item The two arguments of |\caption| (|\sh@rtf@rm| \& |\capti@nt@xt|)
+% should be expanded on first level so |\caption[]{|\ldots|}| and
+% |\caption[|\ldots|]{}| work correctly.
+% \end{enumerate}
+% \begin{macrocode}
+ \let\caption@ORI@make@piccaption\make@piccaption
+ \def\make@piccaption{%
+ \let\caption@ORI\caption
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\caption[##1]##2{%
+ \caption@freezeHref % will be defrosted in \ivparpic
+ \caption@settype\@piccaptype
+% \ifnum\c@piccaptionpos>2\relax
+ \caption@clearmargin
+% \else
+% \captionwidth\z@ % do not use "width=" setting
+% \fi
+ \caption@setfullparboxrestore
+ \caption@setoptions{parpic}%
+ \caption@setautoposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\expandafter\expandafter\caption@ORI
+ \expandafter\expandafter\expandafter[%
+ \expandafter\expandafter\expandafter{%
+ \expandafter##1\expandafter}\expandafter]\expandafter{##2}}%
+% \end{macrocode}
+% {\footnotesize\begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\begingroup|\\
+% | \toks0\expandafter{##1}| |\toks2\expandafter{##2}|\\
+% | \edef\x{\endgroup|\\
+% | \noexpand\caption@ORI[{\the\toks0}]{\the\toks2}}|\\
+% | \x|
+% \end{quote}
+% \begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\edef\x{%|\\
+% | \noexpand\caption@ORI[{\unexpanded\expandafter{##1}}]%|\\
+% | {\unexpanded\expandafter{##2}}}|\\
+% |\x|
+% \end{quote}}
+% \begin{macrocode}
+ \caption@ORI@make@piccaption
+ \let\caption\caption@ORI}%
+% \end{macrocode}
+% \end{macro}
+%
+
+% \begin{macro}{\ivparpic}
+% We need to set our \package{hyperref} anchor here.
+% Not bullet-proof since we have to redefine |\noindent| here!
+% \begin{macrocode}
+ \let\caption@ORI@ivparpic\ivparpic
+ \def\ivparpic(#1,#2)(#3,#4)[#5][#6]#7{%
+ \let\caption@ORI@noindent\noindent
+ \def\noindent{%
+ \caption@defrostHref
+ \let\noindent\caption@ORI@noindent
+ \noindent}%
+ \caption@ORI@ivparpic(#1,#2)(#3,#4)[#5][#6]{#7}%
+ \let\noindent\caption@ORI@noindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\piccaptiontype\@undefined
+}
+% \end{macrocode}
+%
+% \subsubsection{The rotating package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{rotating}[1995/08/22 v2.10]{%
+% \end{macrocode}
+%
+% \begin{macro}{\rotcaption}
+% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@star} removed}
+% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
+% Make |\rotcaption*| work.
+% \begin{macrocode}
+ \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
+% \let\@rotcaption\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\rotcaptionof}
+% \changes{v3.0i}{2005/12/07}{New}
+% Make |\rotcaptionof(*)| work.
+% \begin{macrocode}
+ \def\rotcaptionof{%
+ \caption@teststar\caption@of{\rotcaption*}\rotcaption}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makerotcaption}
+% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
+% \changes{v3.0m}{2007/03/04}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox} now}
+% Original (bugfixed) code:
+% \begin{verbatim}
+% \long\def\@makerotcaption#1#2{%
+% \setbox\@tempboxa\hbox{#1: #2}%
+% \ifdim \wd\@tempboxa > .8\vsize
+% \rotatebox{90}{%
+% \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
+% }%\par % <== \par removed (AR)
+% \else%
+% \rotatebox{90}{\box\@tempboxa}%
+% \fi
+% \nobreak\hspace{12pt}% <== \nobreak added (AR)
+% }
+% \end{verbatim}%^^A
+% Our version emulates this behavior, but if |width=| is set,
+% the rotated caption is always typeset as |minipage|.
+% (Note that |margin=| is not supported here.)
+% \begin{macrocode}
+ \long\def\@makerotcaption#1#2{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \ifdim\captionwidth=\z@
+ \setcaptionwidth{.8\textheight}%
+ \caption@slc{#1}{#2}{.8\vsize}{%
+ \let\caption@makerot\caption@@make
+ \caption@clearmargin
+% \long\def\caption@parbox##1##2{\hbox{\hsize=.8\textheight\relax##2}}%
+% (not needed because \rotatebox uses an \hbox anyway)
+ \let\caption@parbox\@secondoftwo}%
+ \caption@set@bool\caption@ifslc0% been there, done that
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \rotatebox{90}{\caption@makerot{#1}{#2}}%
+ \nobreak\hspace{12pt}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \newcommand\caption@makerot[2]{%
+ \begin{minipage}\captionwidth\caption@@make{#1}{#2}\end{minipage}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The sidecap package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{sidecap}[2003/06/06 v1.6f]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\SC@zfloat}
+% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
+% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@star} removed}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} will be saved \& restored now}
+% \changes{v3.2a}{2011/08/17}{Bugfix: Uses \cs{caption@freeze} instead of \cs{caption@freeze*} now}
+% This macro will be called at the start of the environment, here is a good
+% opportunity to do some adaptations to |\caption| and |\captionsetup|.
+% \begin{macrocode}
+ \let\caption@ORI@SC@zfloat\SC@zfloat
+ \def\SC@zfloat#1#2#3[#4]{%
+% \end{macrocode}
+% First we use the original definition, but restore \cs{caption} and \cs{label}
+% so \cs{caption@freeze} and \cs{caption@warmup} will work correctly.
+% \begin{macrocode}
+ \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]%
+ \SC@RestoreCommands
+% \end{macrocode}
+% Since the sidecap package uses our |\caption| code outside the
+% environment the regular |\captionsetup| will not work.
+% So we need a special version here which saves the given argument list
+% which will be executed later on.
+% Furthermore we need to make |\caption*| work.
+% \begin{macrocode}
+ \caption@settype*{#2}%
+ \caption@freeze
+% \end{macrocode}
+% The sidecap package uses |\ifx\label\SC@label| to test if it is just inside a
+% |SC|\-|figure| or not. So we redefine |\SC@label| here so this test will still work.
+% \begin{macrocode}
+ \let\SC@label\label}%
+% \end{macrocode}
+% \begin{macrocode}
+ \providecommand*\SC@RestoreCommands{%
+ \let\caption=\SC@orig@caption \let\label=\SC@orig@label}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\endSC@FLOAT}
+% \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
+% \changes{v3.1}{2007/05/05}{Call of \cs{caption@setoptions}\arg{SCfloat} added}
+% This macro will be called at the end of the environment, here we need to
+% setup our stuff before the \package{sidecap} package actually typesets
+% its caption.
+% \begin{macrocode}
+ \let\caption@ORI@endSC@FLOAT\endSC@FLOAT
+ \def\endSC@FLOAT{%
+% \end{macrocode}
+% \Note{\cs{@captype} isn't defined here, this will be done inside
+% the original definition of \cs{endSC@FLOAT}. But \cs{SC@captype} is
+% defined and can be used here, if needed.}
+% \begin{macrocode}
+ \let\caption@ORI@settype\caption@settype
+ \def\caption@settype##1{% will be done in \@xfloat
+ \caption@ORI@settype*{##1}% do not change \@currentlabel
+ \caption@setSC@justify
+%%% \caption@setoptions{SCfloat}%
+ \caption@setoptions{SC\@captype}%
+ \caption@start}%
+% \end{macrocode}
+% Before we can typeset the caption we need to set the margin to zero
+% because any extra margin would only be disturbing here.\par
+% (We don't need to take care about the caption position because
+% the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
+% to a skip of zero anyway.)\par
+% Furthermore |\SC@justify| will override the caption justification, if set.
+% The usage of |\SC@justify| differs from version to version of the
+% \package{sidecap} package:\par
+% \begin{tabular}{ll}
+% Version 1.4: & |\SC@justify| is not defined\\
+% Version 1.5: & |\SC@justify| is |\relax| when not set\\
+% Version 1.6: & |\SC@justify| is |\@empty| when not set\\
+% \end{tabular}
+% \begin{macrocode}
+ \def\caption@setSC@justify{%
+ \caption@clearmargin
+ \ifx\SC@justify\@empty \else
+ \let\caption@hj\SC@justify
+ \let\SC@justify\@empty
+ \fi}%
+% \end{macrocode}
+% Make the original definition of |\endSC@FLOAT| to use our caption
+% stuff instead of its own.
+% \Note{At this point the \package{sidecap} definition of \cs{caption} is valid,
+% not the regular one!}
+% \begin{macrocode}
+ \let\caption\SC@orig@caption
+ \def\SC@orig@caption[##1]##2{\caption@defrost}%
+% \end{macrocode}
+% Finally we call the original definition of |\endSC@FLOAT|.
+% \begin{macrocode}
+ \caption@setSC@justify % for compatibility mode
+ \caption@ORI@endSC@FLOAT}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The subfigure package}
+% \changes{v3.1}{2007/04/06}{subfigure package support added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{subfigure}[2002/01/23 v2.1]{%
+% \end{macrocode}
+%
+% \begin{macro}{\sf@ifpositiontop}
+% \changes{v3.1a}{2007/09/15}{Bugfix 07-09-15: Check for \cs{@captype} added}
+% If the \package{subfigure} package is loaded, we map |\sf@ifpositiontop|
+% to |\iffiguretopcap| resp. |\iftabletopcap|, so the \package{subfigure}
+% \version{2.1} options \opt{figbotcap} etc. will still work.
+% \begin{macrocode}
+ \def\sf@ifpositiontop{%
+ \ifx\@captype\@undefined
+ \expandafter\@gobbletwo
+ \else\ifx\@captype\relax
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\expandafter\sf@if@position@top
+ \fi\fi}
+% \end{macrocode}
+% \begin{macrocode}
+ \def\sf@if@position@top{%
+ \@ifundefined{if\@captype topcap}%
+ {\@gobbletwo}%
+ {\@nameuse{if\@captype topcap}%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The supertabular and xtab packages}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{supertabular}[2002/07/19 v4.1e]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
+% \changes{v3.1h}{2008/04/01}{Bugfix: Star variant does not increment table counter anymore}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1h}{2008/04/01}{Made \cs{nameref} \& \cs{autoref} work}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[#1]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
+% \changes{v3.1h}{2008/04/01}{Bugfix: \cs{@currentlabelname} will be set now}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% \if@topcaption \vskip 10\p@ \fi
+% \endgroup}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{supertabular}%
+% \end{macrocode}
+% The |position=| setting will be overwritten by the
+% \package{supertabular} package: If |\topcaption| was used,
+% the position will be |top| automatically, |bottom| otherwise.
+% \begin{macrocode}
+ \def\caption@fixposition{%
+ \caption@setposition{\if@topcaption t\else b\fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@boxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1h}{2008/04/01}{Support of the xtab package added}
+% \begin{macrocode}
+\caption@IfPackageLoaded{xtab}[2000/04/09 v2.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[#1]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \@initisotab
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}%
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% %% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% %% \if@topcaption \vskip 10\p@ \fi
+% \endgroup
+% \global\advance\ST@pageleft -\PWSTcapht
+% \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{xtabular}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@fixposition{%
+ \caption@setposition{\if@topcaption t\else b\fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@initisotab
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@boxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end
+ \global\advance\ST@pageleft -\PWSTcapht
+ \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The threeparttable package}
+% \changes{v3.1}{2007/05/08}{Support of the \package{threeparttable} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{threeparttable}[2003/06/13 v3.0]{%
+% \end{macrocode}
+%
+% \begin{macro}{\threeparttable}
+% Unfortunately |\@captype| is not set when |\TPT@common| will be used,
+% so we have to redefine |\threeparttable| and |\measuredfigure| instead.
+% \begin{macrocode}
+ \let\caption@ORI@threeparttable\threeparttable
+ \renewcommand*\threeparttable{%
+ \caption@settype{table}%
+ \caption@setposition a% ?
+ \caption@clearmargin
+ \caption@setoptions{threeparttable}%
+ \caption@ORI@threeparttable}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\measuredfigure}
+% Same here\ldots
+% \begin{macrocode}
+ \let\caption@ORI@measuredfigure\measuredfigure
+ \renewcommand*\measuredfigure{%
+ \caption@settype{figure}%
+ \caption@setposition a% ?
+ \caption@clearmargin
+ \caption@setoptions{measuredfigure}%
+ \caption@ORI@measuredfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\TPT@caption}
+% The original code:
+% \begin{verbatim}
+% \def\TPT@caption#1[#2]#3{\gdef\TPT@docapt
+% {\par\global\let\TPT@docapt\@undefined \TPT@LA@caption{#1}[{#2}]%
+% {\strut\ignorespaces#3\ifhmode\unskip\@finalstrut\strutbox\fi}}%
+% \ifx\TPT@hsize\@empty \let\label\TPT@gatherlabel \abovecaptionskip\z@skip
+% \else \TPT@docapt \fi \ignorespaces}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \def\TPT@caption#1[#2]#3{%
+ \gdef\TPT@docapt{%
+ \global\let\TPT@docapt\@undefined
+ \caption@setautoposition\caption@TPT@position
+ \TPT@LA@caption{#1}[{#2}]{#3}}%
+ \ifx\TPT@hsize\@empty
+ \let\label\TPT@gatherlabel % Bug: does not work for measuredfigures
+ \gdef\caption@TPT@position{t}%
+ \g@addto@macro\TPT@docapt\caption@TPT@eatvskip
+ \else
+ \def\caption@TPT@position{b}%
+ \TPT@docapt
+ \fi
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ %\newcommand*\caption@TPT@eatvskip{\vskip-.2\baselineskip}%
+ \def\caption@TPT@eatvskip#1\vskip{#1\@tempdima=}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The wrapfig package}
+% \changes{v3.1}{2007/05/05}{Support of the \package{wrapfig} package added}
+% \changes{v3.2d}{2011/11/02}{Support of the \package{wrapfig} package rewritten}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{wrapfig}[2003/01/31 v3.6]{%
+% \end{macrocode}
+%
+% \begin{macro}{\wrapfloat}
+% \changes{v3.2d}{2011/11/02}{Redefinition of this macro added}
+% First of all we make the \package{wrapfig} package independent from the package
+% load order regarding the \package{float} package.
+% Since the usage of |\@float@set|\x|every| is missing in the code of the \package{wrapfig}
+% package (it should be in the redefinition of |\float@re|\x|style|, right after
+% |\@nameuse{fst@#1}|), we don't use it here, too,
+% especially since |\wrap|\x|float| will usually not be used when used with re-styled floats.
+% \begin{macrocode}
+ \renewcommand*\wrapfloat[1]{%
+ \def\@captype{#1}%
+ \@ifundefined{fst@#1}{}{%
+ \@nameuse{fst@#1}%
+% \@float@setevery{#1}%
+ \def\WF@floatstyhook{\let\@currbox\WF@box
+ \global\setbox\WF@box\float@makebox{\wd\WF@box}}}%
+ \@ifnextchar[\WF@wr{\WF@wr[]}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\WF@rapt}
+% \changes{v3.2d}{2011/11/02}{Usage of \cs{WF@captionstyhook} added}
+% Original code:
+% \begin{verbatim}
+% \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+% \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+% \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+% \ifdim\hsize>\z@ \@parboxrestore \else
+% \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+% \ignorespaces \fi}
+% \end{verbatim}%^^A
+% Our code has |\WF@captionstyhook| in addition:
+% \begin{macrocode}
+ \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+ \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+ \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+ \expandafter\WF@captionstyhook\expandafter{\@captype}% <= new
+ \ifdim\hsize>\z@ \@parboxrestore \else
+ \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+ \ignorespaces \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\WF@captionstyhook}
+% \changes{v3.2d}{2011/11/02}{This macro added}
+% \changes{v3.2e}{2011/11/10}{Bugfix 11-11-09: float package support fixed}
+% We place our \package{hyperref} anchor here, apply the `wrap' options etc.
+% Since the usage of |\@float@set|\x|every| is missing in the \package{wrapfig}
+% package we will catch it up here for making the necessary adaptions to the
+% \package{float} package.
+% \begin{macrocode}
+ \def\WF@captionstyhook#1{%
+ \let\@captype\@undefined
+ \@ifundefined{fst@#1}{}{\@float@setevery{#1}}%
+ \caption@settype{#1}%
+ \caption@clearmargin
+%%% \caption@setoptions{wrapfloat}%
+ \caption@setoptions{wrap#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \begin{thebibliography}{99}
+% \bibitem{TLC2}
+% Frank Mittelbach and Michel Goossens:\\
+% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\
+% \newblock Addison-Wesley, 2004.
+%
+% \bibitem{beamer}
+% Till Tantau:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/beamer/}%
+% {\emph{User Guide to the Beamer Class, Version 3.07}},\\
+% March 11, 2007
+%
+% \bibitem{KOMAScript}
+% Markus Kohm \& Jens-Uwe-Morawski:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/koma-script/}%
+% {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\
+% 2007-01-09
+%
+% \bibitem{NTG}
+% Victor Eijkhout:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/ntgclass/}%
+% {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\
+% 3 September 1989
+%
+% \bibitem{float}
+% Anselm Lingnau:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/float/}%
+% {\emph{An Improved Environment for Floats}},\\
+% 2001/11/08
+%
+% \bibitem{floatflt}
+% Mats Dahlgren:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/floatflt/}%
+% {\emph{Welcome to the floatflt package}},\\
+% 1998/06/05
+%
+% \bibitem{floatrow}
+% Olga Lapko:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/floatrow/}%
+% {\emph{The floatrow package documentation}},\\
+% 2007/08/24
+%
+% \bibitem{fltpage}
+% Sebastian Gross:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/fltpage/}%
+% {\emph{Welcome to the beta test of fltpage package!}},\\
+% 1998/11/13
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/hyperref/}%
+% {\emph{Hypertext marks in \LaTeX}},\\
+% November 12, 2007
+%
+% \bibitem{hypcap}
+% Heiko Oberdiek:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/oberdiek/}%
+% {\emph{The hypcap package -- Adjusting anchors of captions}},\\
+% 2007/04/09
+%
+% \bibitem{listings}
+% Carsten Heinz \& Brooks Moses:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/listings/}%
+% {\emph{The Listings Package}},\\
+% 2007/02/22
+%
+% \bibitem{longtable}
+% David Carlisle:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/required/tools/}%
+% {\emph{The longtable package}},\\
+% 2004/02/01
+%
+% \bibitem{picinpar}
+% Friedhelm Sowa:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex209/contrib/picinpar/}%
+% {\emph{Pictures in Paragraphs}},\\
+% July 13, 1993
+%
+% \bibitem{picins}
+% Joachim Bleser and Edmund Lang:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex209/contrib/picins/}%
+% {\emph{PicIns-Benutzerhandbuch Version 3.0}},\\
+% September~1992
+%
+% \bibitem{rotating}
+% Sebastian Rahtz and Leonor Barroca:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/rotating/}%
+% {\emph{A style option for rotated objects in \LaTeX}},\\
+% 1997/09/26
+%
+% \bibitem{sidecap}
+% Rolf Niepraschk \& Hubert G\"a\ss lein:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/sidecap/}%
+% {\emph{The sidecap package}},\\
+% 2003/06/06
+%
+% \bibitem{subfigure}
+% Steven D. Cochran:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/subfigure/}%
+% {\emph{The subfigure package}},\\
+% 2002/07/02
+%
+% \bibitem{subfig}
+% Steven D. Cochran:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/subfig/}%
+% {\emph{The subfig package}},\\
+% 2005/07/05
+%
+% \bibitem{supertabular}
+% Johannes Braams and Theo Jurriens:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/supertabular/}%
+% {\emph{The supertabular environment}},\\
+% 2002/07/19
+%
+% \bibitem{threeparttable}
+% Donald Arseneau:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/misc/}%
+% {\emph{Three part tables: title, tabular environment, notes}},\\
+% 2003/06/13
+%
+% \bibitem{wrapfig}
+% Donald Arseneau:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/wrapfig/}%
+% {\emph{WRAPFIG.STY ver 3.6}},\\
+% 2003/01/31
+%
+% \bibitem{xtab}
+% Peter Wilson:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/xtab/}%
+% {\emph{The xtab package}},\\
+% 2004/05/24
+% \end{thebibliography}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.2/caption3.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.2/caption3.dtx
new file mode 100644
index 00000000000..f61d0be0047
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.2/caption3.dtx
@@ -0,0 +1,3668 @@
+% \iffalse meta-comment
+%
+% This is file `caption3.dtx'.
+%
+% Copyright (C) 1994-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files caption.ins, caption.dtx, caption2.dtx,
+% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx,
+% the derived files caption.sty, caption2.sty, caption3.sty,
+% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty,
+% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
+%
+% \fi
+% \CheckSum{3390}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{caption3.drv}[2011/10/09 v1.4 Implementation of the caption kernel]
+\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+%\let\ORIsubsection\subsection
+%\def\subsection{\clearpage\ORIsubsection}
+%
+\makeatletter % make room for subsections like 2.16.14 in the TOC
+%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
+\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
+\makeatother
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage[debug]{caption3}[2011/07/01]
+%
+\DeclareRobustCommand*\eTeX{\texorpdfstring
+ {\leavevmode\hbox{$\varepsilon$}-\TeX}%
+ {e-TeX}}
+\DeclareRobustCommand*\AmS{\texorpdfstring
+ {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
+ {AMS}}
+\DeclareRobustCommand*\KOMAScript{\texorpdfstring
+ {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
+ {KOMA-Script}}
+\DeclareRobustCommand*\NTG{NTG}
+\DeclareRobustCommand*\SmF{SMF}
+%
+\begin{document}
+ \DocInput{caption3.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
+% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
+% \let\class\puresf \let\package\puresf
+% \let\env\purett \let\opt\purett
+%
+% \def\thispackage{the \package{caption} kernel}
+% \def\Thispackage{The \package{caption} kernel}
+%
+% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+% \newcommand*\version[2][]{\textit{v#2}}
+% \newcommand*\x{\discretionary{-}{}{}}
+% \newcommand*\xx{\discretionary{}{}{}}
+%
+% \GetFileInfo{caption3.drv}
+% \let\docdate\filedate
+% \GetFileInfo{caption3.sty}
+%
+% \title{The Implementation of
+% \texorpdfstring{\thispackage\thanks{%^^A
+% This package has version number \fileversion, last revised \filedate.}}%^^A
+% {the caption kernel}}
+% \author{Axel Sommerfeldt\\
+% \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}}
+% \date{\docdate}
+% \maketitle
+%
+% \begin{abstract}
+% \Thispackage\ consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% The kernel provides all the user commands and internal macros which are
+% necessary for typesetting captions and setting parameters regarding these.
+% While the standard \LaTeX\ document classes provide an internal command
+% called |\@makecaption| and no options to control its behavior (except the
+% vertical skips above and below the caption itself), we provide similar
+% commands called |\caption@make| and |\caption@@make|, but with a lot of
+% options which can be selected with |\captionsetup|.
+% Loading the kernel part do not change the output of a \LaTeX\ document
+% -- it just provides functionality which can be used by \LaTeXe\ packages
+% which typesets captions, for example the \package{caption} and
+% \package{subfig} packages.
+% \end{abstract}
+%
+% \StopEventually{}
+% \clearpage
+% \tableofcontents
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
+%
+% \changes{v1.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v1.0c}{2004/11/28}{Split into two packages:
+% \package{caption} \& \package{caption3}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \let\subsubsection\subsection
+% \let\subsection\section
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \subsection{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption3}[2011/11/01 v1.4a caption3 kernel (AR)]
+% \end{macrocode}
+%
+% \subsection{Generic helpers}
+%
+% \begin{macro}{\@nameundef}
+% This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel.
+% We use it to remove the definition of some commands and keyval options after
+% |\begin{document}| (to save \TeX\ memory) and to remove caption options defined
+% with |\captionsetup|\oarg{type}.
+% \begin{macrocode}
+\providecommand*\@nameundef[1]{%
+ \expandafter\let\csname #1\endcsname\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@addto@macro}
+% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which
+% globally adds tokens to existing macros, like in |\AtBeginDocument|.
+% This is the same but it works local, not global
+% (using \cs{edef} instead of \cs{xdef}).
+% \begin{macrocode}
+\providecommand\l@addto@macro[2]{%
+ \begingroup
+ \toks@\expandafter{#1#2}%
+ \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bothIfFirst}
+% \begin{macro}{\bothIfSecond}
+% |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond|
+% tests if the second argument is not empty. If yes both arguments get
+% typeset, otherwise none of them.
+% \begin{macrocode}
+\def\bothIfFirst#1#2{%
+ \protected@edef\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty \else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\def\bothIfSecond#1#2{%
+ \protected@edef\caption@tempa{#2}%
+ \ifx\caption@tempa\@empty \else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifundefined}
+% \changes{v1.3a}{2011/08/12}{This macro added}
+% \changes{v1.3b}{2011/08/18}{Made expandable}
+% Similar to \cs{@ifundefined} offered by the \LaTeX kernel, but does
+% not define the undefined macro as \cs{relax}.
+% \begin{macrocode}
+\newcommand*\caption@ifundefined[1]{%
+ \ifx#1\@undefined
+ \expandafter\@firstoftwo
+ \else\ifx#1\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifinlist}
+% \changes{v1.1}{2007/07/29}{Rewritten}
+% This helper macro checks if the first argument is in the comma separated
+% list which is offered as second argument. So for example
+% \begin{quote}
+% |\caption@ifinlist{frank}{axel,frank,olga,steven}{yes}{no}|
+% \end{quote}
+% would expand to |yes|.
+% \begin{macrocode}
+\newcommand*\caption@ifinlist{%
+ \@expandtwoargs\caption@@ifinlist}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@ifinlist[2]{%
+ \begingroup
+ \def\@tempa##1,#1,##2\@nil{%
+ \endgroup
+ \ifx\relax##2\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}%
+ \@tempa,#2,#1,\@nil}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifin@list}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% |\caption@ifin@list|\marg{cmd}\marg{list entry}\marg{yes}\marg{no}
+% \begin{macrocode}
+\newcommand*\caption@ifin@list[2]{%
+ \caption@ifempty@list#1%
+ {\@secondoftwo}%
+ {\@expandtwoargs\caption@@ifinlist{#2}{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@addto@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@g@addto@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@g@addto@list[2]{%
+ \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@addto@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@l@addto@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@l@addto@list[2]{%
+ \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@removefrom@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@g@removefrom@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@g@removefrom@list[2]{%
+ \caption@l@removefrom@list#1{#2}%
+ \global\let#1#1}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@removefrom@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@l@removefrom@list|\marg{cmd}\marg{list entry}\par
+% \Note[Caveat]{\meta{cmd} will be expanded during this process since
+% \cs{@removeelement} is using \cs{edef} to build the new list!}
+% \begin{macrocode}
+\newcommand*\caption@l@removefrom@list[2]{%
+ \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@for@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@for@list|\marg{cmd}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\caption@for@list[2]{%
+ \caption@ifempty@list#1{}{%
+ \def\caption@tempb##1{#2}%
+ \@for\caption@tempa:=#1\do{%
+ \expandafter\caption@tempb\expandafter{\caption@tempa}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@ifempty@list|\marg{cmd}\marg{true}\marg{false}
+% \begin{macrocode}
+\newcommand*\caption@ifempty@list[1]{%
+ \ifx#1\@undefined
+ \expandafter\@firstoftwo
+ \else\ifx#1\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else\ifx#1\@empty
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak[3]
+% \begin{macro}{\caption@setbool}
+% \begin{macro}{\caption@set@bool}
+% \changes{v1.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added}
+% \begin{macro}{\caption@ifbool}
+% \begin{macro}{\caption@undefbool}
+% For setting and testing boolean options we offer these three helper macros:
+% \begin{quote}
+% |\caption@setbool|\marg{name}\marg{value}\\
+% | |(with |value = false/true/no/yes/off/on/0/1|)\\
+% |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\
+% |\caption@undefbool|\marg{name}
+% \end{quote}
+% \begin{macrocode}
+\newcommand*\caption@setbool[1]{%
+ \expandafter\caption@set@bool\csname caption@if#1\endcsname}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@bool[2]{%
+ \caption@ifinlist{#2}{1,true,yes,on}{%
+ \let#1\@firstoftwo
+ }{\caption@ifinlist{#2}{0,false,no,off}{%
+ \let#1\@secondoftwo
+ }{%
+ \caption@Error{Undefined boolean value `#2'}%
+ }}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@teststar}
+% \changes{v1.1}{2007/05/08}{This macro and its usage added}
+% \changes{v1.1e}{2007/10/28}{\cs{caption@teststar@} added}
+% |\caption@teststar|\marg{cmd}\marg{star arg}\marg{non-star arg}\\
+% |\caption@teststar@|\marg{cmd}\marg{star arg}\marg{non-star arg}
+% \begin{macrocode}
+\newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@teststar@[3]{%
+ \@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}}
+\AtBeginDocument{\let\caption@teststar@\caption@teststar}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifatletter{%
+ \ifnum\the\catcode`\@=11
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\AtBeginDocument{\let\caption@ifatletter\@secondoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@withoptargs}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% |\caption@withoptargs|\marg{cmd}
+% \begin{macrocode}
+\newcommand*\caption@withoptargs[1]{%
+ \@ifstar
+ {\def\caption@tempa{*}\caption@@withoptargs#1}%
+ {\def\caption@tempa{}\caption@@withoptargs#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@withoptargs#1{%
+ \@ifnextchar[%]
+ {\caption@@@withoptargs#1}%
+ {\caption@@@@withoptargs#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@withoptargs#1[#2]{%
+ \l@addto@macro\caption@tempa{[{#2}]}%
+ \caption@@withoptargs#1}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@@withoptargs#1{%
+ \expandafter#1\expandafter{\caption@tempa}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@gobble}
+% \changes{v1.4}{2011/08/19}{This macro added}
+% |\caption@gobble*|\oarg{arg}\oarg{\ldots}\marg{arg}\par
+% Same as |\@gobble|, but gobbles optional arguments as well.
+% \begin{macrocode}
+\DeclareRobustCommand*\caption@gobble{%
+ \caption@withoptargs\@gobbletwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@CheckCommand}
+% \changes{v1.1}{2007/04/10}{This macro added}
+% \begin{macro}{\caption@IfCheckCommand}
+% \changes{v1.1}{2007/04/10}{This macro added}
+% \changes{v1.2b}{2008/08/02}{Revised so \cs{next} is no longer used}
+% |\caption@CheckCommand|\marg{macro}\marg{definition of macro}\par
+% checks if a command already exists, with the same definition.
+% It can be used more-than-once to check if one of multiple definitions will
+% finally match.
+% (It redefines itself later on to |\@gobbletwo| if the two commands match
+% fine, making further checks harmless.)\par
+% |\caption@IfCheckCommand|\marg{true}\marg{false}\par
+% will execute the \meta{true} code if one match was finally given,
+% the \meta{false} code otherwise.
+% (It simply checks if |\caption@CheckCommand| is |\@gobbletwo| and
+% restores the starting definition of |\caption@CheckCommand|.)
+% \begin{macrocode}
+\newcommand\caption@DoCheckCommand[2]{%
+ \begingroup
+ \let\@tempa#1%
+ #2%
+ \ifx\@tempa#1%
+ \endgroup
+ \let\caption@CheckCommand\@gobbletwo
+ \else
+ \endgroup
+ \fi}
+\@onlypreamble\caption@DoCheckCommand
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@CheckCommand\caption@DoCheckCommand
+\@onlypreamble\caption@CheckCommand
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@IfCheckCommand{%
+ \ifx\caption@CheckCommand\@gobbletwo
+ \let\caption@CheckCommand\caption@DoCheckCommand
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\@onlypreamble\caption@IfCheckCommand
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@AtBeginDocument}
+% \changes{v1.1}{2007/04/13}{This macro and its usage added}
+% \changes{v1.2e}{2010/01/09}{Adapted to the combine document class}
+% |\caption@AtBeginDocument*|\marg{code}\\
+% Same as |\AtBeginDocument| but the execution of code
+% will be surrounded by two |\PackageInfo|s.
+% The starred variant causes the code to be executed after all code
+% specified using the non-starred variant.
+% \begin{macrocode}
+\let\caption@begindocumenthook\@empty
+\let\caption@@begindocumenthook\@empty
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@AtBeginDocument{%
+ \caption@teststar\g@addto@macro
+ \caption@@begindocumenthook\caption@begindocumenthook}
+%\@onlypreamble\caption@AtBeginDocument
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{%
+ \caption@InfoNoLine{Begin \noexpand\AtBeginDocument code}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}%
+ \caption@begindocumenthook
+ \let\caption@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar\@firstofone\@firstofone}%
+ \caption@@begindocumenthook
+ \let\caption@@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@InfoNoLine{End \noexpand\AtBeginDocument code}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Information, Warnings, and Errors}
+%
+% \begin{macro}{\caption@Info}
+% \changes{v1.3}{2010/10/25}{Moved from package to kernel}
+% |\caption@Info|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Info[1]{%
+ \PackageInfo{caption}{#1}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@InfoNoLine}
+% \changes{v1.3}{2010/10/25}{Moved from package to kernel}
+% |\caption@InfoNoLine|\marg{message}\\
+% \Note{The \cs{@gobble} at the end of the 2nd argument of
+% \cs{PackageInfo} suppresses the line number info.
+% See TLC2\cite{TLC2}, A.4.7, p885 for details.}
+% \begin{macrocode}
+\newcommand*\caption@InfoNoLine[1]{%
+ \PackageInfo{caption}{#1\@gobble}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@Warning}
+% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% |\caption@Warning|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Warning[1]{%
+ \caption@WarningNoLine{#1\on@line}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@WarningNoLine}
+% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% |\caption@WarningNoLine|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@WarningNoLine[1]{%
+ \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@wh{%
+ See the caption package documentation for explanation.}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@Error}
+% \changes{v1.0j}{2007/01/20}{This macro added, will now be used for errors}
+% \changes{v1.0o}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}}
+% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed}
+% |\caption@Error|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Error[1]{%
+ \PackageError{caption}{#1}\caption@eh}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@eh{%
+ If you do not understand this error, please take a closer look\MessageBreak
+ at the documentation of the `caption' package, especially the\MessageBreak
+ section about errors.\MessageBreak\@ehc}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@KV@err}
+% \changes{v1.1b}{2007/09/18}{This macro added}
+% \begin{macrocode}
+\let\caption@KV@err\caption@Error
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Using the keyval package}
+%
+% We need the \package{keyval} package for option handling, so we load it here.
+% \begin{macrocode}
+\RequirePackage{keyval}[1997/11/10]
+% \end{macrocode}
+%
+% \begin{macro}{\undefine@key}
+% |\undefine@key|\marg{family}\marg{key}\par
+% This helper macro is the opposite of |\define@key|, it removes a keyval
+% definition.
+% \begin{macrocode}
+\providecommand*\undefine@key[2]{%
+ \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@onlypreamble@key}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \changes{v1.1e}{2007/11/01}{\cs{KV@err} will be used now instead of \cs{@notprerr}}
+% |\onlypreamble@key|\marg{family}\marg{key}\par
+% Analogous to |\@onlypreamble| from \LaTeXe.
+% \begin{macrocode}
+\providecommand*\@preamble@keys{}
+\providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}}
+\@onlypreamble\@onlypreamble@key
+\@onlypreamble\@preamble@keys
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}%
+ \@preamble@keys
+ \let\@elt\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOption}
+% |\DeclareCaptionOption|\marg{option}\oarg{default value}\marg{code}\\
+% |\DeclareCaptionOption*|\marg{option}\oarg{default value}\marg{code}\par
+% We declare our options using these commands (instead of using
+% |\DeclareOption| offered by \LaTeXe), so the keyval package is used.
+% The starred form makes the option available during the lifetime of the
+% current package only, so they can be used with |\usepackage|, but
+% \emph{not} with |\captionsetup| later on.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOption{%
+ \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareoption[2]{%
+ #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}}
+\@onlypreamble\caption@declareoption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOptionNoValue}
+% \changes{v1.1c}{2007/10/06}{This macro added}
+% |\DeclareCaptionOptionNoValue|\marg{option}\marg{code}\\
+% |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\par
+% Same as \cs{DeclareCaptionOption} but issues an error if a value is given.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOptionNoValue{%
+ \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOptionNoValue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declareoption@novalue[3]{%
+ \caption@declareoption{#1}{#2}[\KV@err]{%
+ \caption@option@novalue{#2}{##1}{#3}}}
+\@onlypreamble\caption@declareoption@novalue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@option@novalue[2]{%
+ \ifx\KV@err#2%
+ \expandafter\@firstofone
+ \else
+ \KV@err{No value allowed for #1}%
+ \expandafter\@gobble
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifcaptionsetup@star}
+% \changes{v1.2a}{2008/01/12}{This macro added}
+% If the starred form of |\captionsetup| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@setkeys|.)
+% \begin{macrocode}
+\newif\ifcaptionsetup@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionsetup}
+% \changes{v1.0a}{2004/01/17}{Bugfix: Missing \% added}
+% \changes{v1.1}{2007/07/22}{Starred-variant added}
+% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v1.2a}{2008/01/12}{\cs{ifcaptionsetup@star} will be set now}
+% |\captionsetup|\oarg{type}\marg{keyval-list of options}\\
+% |\captionsetup*|\oarg{type}\marg{keyval-list of options}\par
+% If the optional argument `type' is specified, we simply save or append
+% the option list, otherwise we `execute' it with |\setkeys|.
+% (The non-starred variant issues a warning if \meta{keyval-list of options}
+% is not used later on.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\captionsetup{%
+ \caption@teststar@\@captionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionsetup[1]{%
+ \captionsetup@startrue#1\captionsetup@starfalse
+ \@ifnextchar[\caption@setup@options\caption@setup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup{\caption@setkeys{caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@setup@options[#1]#2{%
+ \@bsphack
+ \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi
+ \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\clearcaptionsetup}
+% \changes{v1.1}{2007/07/29}{Optional argument added}
+% \changes{v1.1}{2007/08/17}{Starred variant added}
+% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\clearcaptionsetup|\oarg{option}\marg{type}\\
+% |\clearcaptionsetup*|\oarg{option}\marg{type}\par
+% This removes the saved option list associated with \meta{type}.
+% If \meta{option} is given, only this option will be removed from the list.
+% (The starred variant does not issue warnings.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\clearcaptionsetup{%
+ \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@clearcaptionsetup[1]{%
+ \let\caption@tempa#1%
+ \@testopt\@@clearcaptionsetup{}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@@clearcaptionsetup[#1]#2{%
+ \@bsphack
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}%
+ {\ifx,#1,%
+ \caption@clearsetup{#2}%
+ \else
+ \caption@@removefromsetup{#1}{#2}%
+ \fi}%
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@clearsetup[1]{%
+ \caption@removefromoptlist{#1}%
+ \@nameundef{caption@opt@#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromsetup{%
+ \let\caption@tempa\@gobble
+ \caption@@removefromsetup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@removefromsetup[2]{%
+ \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname
+ \expandafter\let\csname caption@opt@#2\endcsname\@undefined
+ \def\@tempb##1=##2\@nil{##1}%
+ \edef\@tempc{#1}%
+ \@for\@tempa:=\@tempa\do{%
+ \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}%
+ \ifx\@tempd\@tempc
+ \let\caption@tempa\@gobble
+ \else
+ \expandafter\expandafter\expandafter\caption@l@addto@list
+ \expandafter\csname caption@opt@#2\expandafter\endcsname
+ \expandafter{\@tempa}%
+ \fi}%
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@removefromoptlist{#2}}{}%
+ \caption@tempa{\caption@Warning{%
+ Option `#1' was not in list `#2'\MessageBreak}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\showcaptionsetup}
+% \changes{v1.0d}{2005/05/03}{Optimized for memory usage}
+% \changes{v1.1}{2007/07/29}{Bugfix: Does not expand option list anymore}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\showcaptionsetup|\oarg{package}\marg{type}\par
+% This comes for debugging issues: It shows the saved option list which
+% is associated with \meta{type}.
+% \begin{macrocode}
+\newcommand*\showcaptionsetup[2][\@firstofone]{%
+ \@bsphack
+ \GenericWarning{}{%
+ #1 Caption Info: Option list on `#2'\MessageBreak
+ #1 Caption Data: \@ifundefined{caption@opt@#2}{%
+ -none-%
+ }{%
+ {\expandafter\expandafter\expandafter\strip@prefix
+ \expandafter\meaning\csname caption@opt@#2\endcsname}%
+ }}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.1}{2007/07/02}{Option \opt{options=} added}
+% \changes{v1.3}{2010/09/05}{Option \opt{options*=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{options}{\caption@setoptions{#1}}
+\DeclareCaptionOption{options*}{\caption@setoptions*{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setoptions}
+% \changes{v1.0g}{2006/01/03}{Optional argument added}
+% \changes{v1.0h}{2006/01/26}{Revised}
+% \changes{v1.0j}{2007/01/30}{Optional argument removed}
+% \changes{v1.1}{2007/04/11}{Usage of \cs{clearcaptionsetup} added}
+% \changes{v1.1}{2007/05/09}{Renamed from \cs{caption@settype} to \cs{caption@setoptions}}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% \changes{v1.3}{2010/09/05}{Starred variant added}
+% |\caption@setoptions*|\marg{type or environment or\ldots}\par
+% Caption options which have been saved with |\captionsetup|\oarg{type} can
+% be executed by using this command.
+% It simply executes the saved option list (and clears it afterwards),
+% if there is any. (The starred variant do not clear the option list.)
+% \begin{macrocode}
+\newcommand*\caption@setoptions{%
+ \caption@teststar\caption@set@options\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@options[2]{%
+ \caption@Debug{options=#2}%
+ \expandafter\let\expandafter\caption@opt\csname caption@opt@#2\endcsname
+ \ifx\caption@opt\relax \else
+ \caption@xsetup\caption@opt
+ #1{\caption@clearsetup{#2}}% #1 = \@firstofone -or- \@gobble
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtooptlist}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \begin{macro}{\caption@removefromoptlist}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \changes{v1.2c}{2008/08/24}{Fatal typo corrected}
+% |\caption@addtooptlist|\marg{type}\\
+% |\caption@removefromoptlist|\marg{type}\par
+% Adds or removes an \meta{type} to the list of unused caption options.
+% Note that the catcodes of \meta{type} are sanitized here so removing
+% \meta{type} from the list do not fail when the \package{float} package
+% is used (since |\float@getstyle| gives a result which tokens have catcode
+% 12 $=$ ``other'').
+% \begin{macrocode}
+\newcommand*\caption@addtooptlist[1]{%
+ \@ifundefined{caption@opt@#1@lineno}{%
+ \caption@dooptlist\caption@g@addto@list{#1}%
+ \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}%
+ }{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromoptlist[1]{%
+ \caption@dooptlist\caption@g@removefrom@list{#1}%
+ \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@dooptlist[2]{%
+ \begingroup
+ \edef\@tempa{#2}\@onelevel@sanitize\@tempa
+ \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\AtEndDocument{%
+ \caption@for@list\caption@optlist{%
+ \caption@WarningNoLine{%
+ Unused \string\captionsetup[#1]
+ on input line \csname caption@opt@#1@lineno\endcsname}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@setkeys}
+% \changes{v1.0g}{2006/01/03}{This macro added}
+% \changes{v1.0j}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added}
+% \changes{v1.0j}{2007/01/30}{Optional argument added}
+% \changes{v1.0n}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter}
+% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed, we use \cs{caption@KV@err} instead}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v1.2a}{2008/01/12}{\cs{captionsetup@starfalse} added}
+% \changes{v1.2d}{2009/09/30}{Bugfix 09-09-29: Missing error handler will be defined automatically}
+% \changes{v1.4}{2011/08/24}{Redefinition of \cs{XKV@err} added}
+% |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\par
+% This one simply calls |\setkeys|\marg{family}\marg{key-values}
+% but lets the error messages not refer to the \package{keyval} package,
+% but to the \meta{package} package instead.
+% \begin{macrocode}
+\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@setkeys[#1]#2#3{%
+ \@bsphack
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err
+ \expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx
+ \expandafter\let\csname ORI@XKV@err\caption@keydepth\endcsname\XKV@err
+ \edef\caption@keydepth{\caption@keydepth i}%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname
+ \ifx\KV@err\relax
+ \def\KV@err##1{\PackageError{#1}{##1}{%
+ See the #1 package documentation for explanation.}}%
+ \fi
+ \def\KV@errx{\KV@err}%
+ \def\XKV@err{\let\@tempa\XKV@tkey\KV@err}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{\protect\setkeys{#2}{#3}}%
+ \setkeys{#2}{#3}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}%
+ \expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname
+ \expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname
+ \expandafter\let\expandafter\XKV@err\csname ORI@XKV@err\caption@keydepth\endcsname
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@keydepth\@empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ExecuteOptions}
+% \changes{v1.1}{2007/07/15}{This macro added}
+% \changes{v1.3}{2010/09/04}{Depends on package now}
+% |\caption@ExecuteOptions|\marg{package}\marg{key-values}\par
+% We execute our options using the keyval interface, so we use this one
+% instead of |\ExecuteOptions| offered by \LaTeXe.
+% \begin{macrocode}
+\newcommand*\caption@ExecuteOptions[2]{%
+ \expandafter\@expandtwoargs\csname caption@setkeys@#1\endcsname{#1}{#2}}%
+\@onlypreamble\caption@ExecuteOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ProcessOptions}
+% \changes{v1.0a}{2004/01/23}{Bugfix, see
+% \purett{news:400D360C.9678329F@gmx.net} for details}
+% \changes{v1.0g}{2006/01/03}{Improvement, uses \cs{caption@setkeys}
+% instead of \cs{setkeys}}
+% \changes{v1.0h}{2006/02/23}{Bugfix, now processes only those global
+% options which have a default value}
+% \changes{v1.0j}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to
+% \cs{caption@ProcessOptions} and moved from the package to the kernel}
+% \changes{v1.1}{2007/04/17}{Star variant added}
+% |\caption@ProcessOptions*|\marg{package}\par
+% We process our options using the keyval package, so we use this one
+% instead of |\ProcessOptions| offered by \LaTeXe.
+% The starred variant do not process the global options.
+% (This code was taken from the \package{hyperref} package\cite{hyperref}
+% \version{6.74} and improved.)
+% \begin{macrocode}
+\newcommand*\caption@ProcessOptions{%
+ \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone}
+\@onlypreamble\caption@ProcessOptions
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@ProcessOptions[2]{%
+ \let\@tempc\relax
+ \let\caption@tempa\@empty
+ #1{% \@firstofone -or- \@gobble
+ \@for\CurrentOption:=\@classoptionslist\do{%
+ \@ifundefined{KV@#2@\CurrentOption}{}{%
+ \@ifundefined{KV@#2@\CurrentOption @default}{%
+ \PackageInfo{#2}{Global option `\CurrentOption' ignored}%
+ }{%
+ \PackageInfo{#2}{Global option `\CurrentOption' processed}%
+ \edef\caption@tempa{\caption@tempa\CurrentOption,}%
+ \@expandtwoargs\@removeelement\CurrentOption
+ \@unusedoptionlist\@unusedoptionlist
+ }%
+ }%
+ }%
+ \let\CurrentOption\@empty
+ }%
+ \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}%
+ \AtEndOfPackage{\let\@unprocessedoptions\relax}}
+\@onlypreamble\caption@@ProcessOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@SetupOptions}
+% \changes{v1.3}{2010/09/04}{This macro added}
+% |\caption@SetupOptions|\marg{package}\marg{code}\par
+% After calling this macro |\caption@ExecuteOptions| and
+% |\usepackage|\oarg{options}\marg{package}
+% will both be mapped to \meta{code} with \meta{package} and \meta{options}
+% as arguments |#1| and |#2|. (This helps avoiding ``Option clash'' errors.)
+% \begin{macrocode}
+\newcommand*\caption@packagelist{}
+\@onlypreamble\caption@packagelist
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@SetupOptions[2]{%
+ \@namedef{caption@setkeys@#1}##1##2{#2}%
+ \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname
+ \@cons\caption@packagelist{{#1}}}
+\@onlypreamble\caption@SetupOptions
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@onefilewithoptions\@onefilewithoptions
+\def\@onefilewithoptions#1[#2]{%
+ \begingroup
+ \def\@tempa{%
+ \endgroup
+ \caption@onefilewithoptions{#1}[{#2}]}%
+ \def\@tempb{#1}%
+ \def\@elt##1{%
+ \def\@tempc{##1}%
+ \ifx\@tempb\@tempc
+ \def\@tempa{%
+ \endgroup
+ \caption@ExecuteOptions{#1}{#2}%
+ \caption@onefilewithoptions{#1}[]}%
+ \fi}
+ \caption@packagelist
+ \@tempa}
+\@onlypreamble\caption@onefilewithoptions
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Margin resp. width}
+% \changes{v1.0n}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}}
+% \changes{v1.0n}{2007/04/03}{Option `twoside' added}
+% \changes{v1.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added}
+% \changes{v1.2}{2007/11/10}{Option `oneside' added}
+%
+% \begin{macro}{\captionmargin}
+% \begin{macro}{\captionwidth}
+% |\captionmargin| and |\captionwidth| contain the extra margin
+% resp. the total width used for captions. Please never set these values in
+% a direct way, they are just accessible in user documents to provide
+% compatibility to \version{1.x}.\par
+% Note that we can only set one value at a time, `margin' \emph{or} `width'.
+% If |\captionwidth| is not zero we will take this value afterwards,
+% otherwise |\captionmargin| and |\captionmargin@|.
+% \begin{macrocode}
+\newdimen\captionmargin
+\newdimen\captionmargin@
+\newdimen\captionwidth
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
+\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}}
+\DeclareCaptionOption{width}{\setcaptionwidth{#1}}
+\DeclareCaptionOption{width*}{\setcaptionwidth*{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{calcmargin}{\caption@setcalcmargin{#1}}
+\DeclareCaptionOption{calcmargin*}{\caption@setcalcmargin*{#1}}
+\DeclareCaptionOption{calcwidth}{\caption@setcalcwidth{#1}}
+\DeclareCaptionOption{calcwidth*}{\caption@setcalcwidth*{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}}
+\DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}}
+\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\setcaptionmargin}
+% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
+% \changes{v1.0f}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take
+% left+right margin}
+% \changes{v1.1}{2007/08/11}{Starred variant added}
+% \changes{v1.1}{2007/08/12}{\cs{setlength}\cs{captionmargin} \&
+% \cs{setlength}\cs{captionmargin@} swapped so
+% `\texttt{margin*=}\cs{captionmargin}' works in singleline options}
+% \changes{v1.3}{2010/11/07}{Support for option \opt{calcmargin} added}
+% |\setcaptionmargin|\marg{amount}\\
+% |\setcaptionmargin*|\marg{amount}\par
+% Please never use this in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionmargin{%
+ \caption@resetcalcmargin
+ \caption@setmargin}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setmargin{%
+ \caption@teststar\caption@@setmargin\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setmargin[2]{%
+ #1{\captionwidth\z@}%
+ \caption@@@setmargin#2,#2,\@nil}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@setmargin#1,#2,#3\@nil{%
+ \setlength\captionmargin@{#2}%
+ \setlength\captionmargin{#1}%
+ \addtolength\captionmargin@{-\captionmargin}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionwidth}
+% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
+% \changes{v1.3}{2010/11/07}{Starred variant added}
+% \changes{v1.3}{2010/11/07}{Support for option \opt{calcwidth} added}
+% |\setcaptionwidth|\marg{amount}\\
+% |\setcaptionwidth*|\marg{amount}\par
+% Please never use this in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionwidth{%
+ \caption@resetcalcmargin
+ \caption@setwidth}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setwidth{%
+ \caption@teststar\caption@@setwidth\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setwidth[2]{%
+ #1{\captionmargin\z@\captionmargin@\z@}%
+ \setlength\captionwidth{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetcalcmargin}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@resetcalcmargin{%
+ \let\caption@calcmargin@hook\@empty}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setcalcmargin}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setcalcmargin{%
+ \caption@teststar{\caption@@setcalcmargin\caption@setmargin}%
+ \@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setcalcmargin[3]{%
+ #2{\caption@resetcalcmargin
+ \l@addto@macro\caption@calcmargin@hook{#1{#3}}}%
+ {\l@addto@macro\caption@calcmargin@hook{#1*{#3}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setcalcwidth}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setcalcwidth{%
+ \caption@teststar{\caption@@setcalcmargin\caption@setwidth}%
+ \@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@counter}
+% \changes{v1.0n}{2007/04/03}{This counter added}
+% \changes{v1.1e}{2007/10/28}{Renamed to \cs{caption@thecounter}; \cs{caption@stepcounter} added}
+% This counter numbers the captions. At the moment it will be used inside
+% |\caption@ifoddpage| only.
+% \begin{macrocode}
+\newcommand*\caption@thecounter{0}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@stepcounter{%
+ \@tempcnta\caption@thecounter
+ \advance\@tempcnta\@ne
+ \xdef\caption@thecounter{\the\@tempcnta}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@newlabel}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% This command is a modified version of |\newlabel| from \LaTeX2e.
+% It will be written to the \texttt{.aux} file to
+% pass label information from one run to another.
+% (We use it inside |\caption@ifoddpage| and |\caption@ragged|.)
+% \begin{macrocode}
+\newcommand*\caption@newlabel{\@newl@bel{caption@r}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@thepage}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% This command is a modified version of |\thepage| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| only.
+% \begin{macrocode}
+\newcommand*\caption@thepage{\the\c@page}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@label}
+% \changes{v1.1}{2007/09/01}{This macro added}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@newlabel} in AUX file added}
+% This command is a modified version of |\label| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
+% \begin{macrocode}
+\newcommand*\caption@label[1]{%
+ \caption@@label
+ \protected@write\@auxout{\let\caption@thepage\relax}%
+ {\string\caption@newlabel{#1}{\caption@thepage}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@label{%
+ \global\let\caption@@label\relax
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@newlabel[2]{}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@pageref}
+% \changes{v1.1}{2007/09/01}{This macro added}
+% \changes{v1.2d}{2009/10/09}{Uses \cs{@latex@warning} instead of \cs{caption@Warning} now}
+% This command is a modified version of |\pageref| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
+% \begin{macrocode}
+\newcommand*\caption@pageref[1]{%
+ \expandafter\ifx\csname caption@r@#1\endcsname\relax
+ \G@refundefinedtrue % => 'There are undefined references.'
+ \@latex@warning{Reference `#1' on page \thepage \space undefined}%
+ \else
+ \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifoddpage}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% \changes{v1.1e}{2007/10/28}{Incrementation of counter moved to \cs{caption@@make}}
+% At the moment this macro uses an own label\ldots ref mechanism,
+% but an alternative implementation method would be using the
+% \package{refcount} package\cite{refcount} and |\ifodd\getpagerefnumber{|\ldots|}|.
+% \Note{This macro re-defines itself so the \texttt{.aux} file will
+% only be used once per group.}
+% \begin{macrocode}
+\newcommand*\caption@ifoddpage{%
+ \caption@iftwoside{%
+ \caption@label\caption@thecounter
+ \caption@pageref\caption@thecounter
+ \ifodd\caption@thepage
+ \let\caption@ifoddpage\@firstoftwo
+ \else
+ \let\caption@ifoddpage\@secondoftwo
+ \fi
+ }{\let\caption@ifoddpage\@firstoftwo}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifoddpage}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setoptcmd}
+% \changes{v1.1}{2007/08/11}{This macro added}
+% |\caption@setoptcmd|\marg{cmd}\marg{off -or- value}
+% \begin{macrocode}
+\newcommand*\caption@setoptcmd[2]{%
+ \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Indentions}
+%
+% \begin{macro}{\caption@indent}
+% \changes{v1.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}}
+% \begin{macro}{\caption@parindent}
+% \begin{macro}{\caption@hangindent}
+% These are the indentions we support.
+% \begin{macrocode}
+\newdimen\caption@indent
+\newdimen\caption@parindent
+\newdimen\caption@hangindent
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v1.0b}{2004/05/16}{Defaults added for options \opt{parindent=}
+% and \opt{hangindent=}}
+% \changes{v1.0f}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption}
+% replaced by \cs{caption@@par}}
+% \changes{v1.0f}{2005/08/22}{Undocumented defaults for \opt{parindent=},
+% \opt{hangindent=}, and \opt{parskip=} removed}
+% \begin{macrocode}
+\DeclareCaptionOption{indent}[\leftmargini]{% obsolete!
+ \setlength\caption@indent{#1}}
+\DeclareCaptionOption{indention}[\leftmargini]{%
+ \setlength\caption@indent{#1}}
+\DeclareCaptionOption{parindent}{%
+ \setlength\caption@parindent{#1}}
+\DeclareCaptionOption{hangindent}{%
+ \setlength\caption@hangindent{#1}}
+\DeclareCaptionOption{parskip}{%
+ \l@addto@macro\caption@@par{\setlength\parskip{#1}}}
+% \end{macrocode}
+%
+% \changes{v1.0f}{2005/08/22}{Increased compatibility to KOMA-Script:
+% A special version of options `parindent' and `parskip' added}
+% \changes{v1.0g}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of
+% `parskip' and `parindent' options revised and moved into caption kernel}
+% \changes{v1.0h}{2006/02/23}{KOMA-Script variants of `parskip' and
+% `parindent' are obsolete now, removed}
+% \changes{v1.0m}{2007/03/30}{KOMA-Script variants of `parskip' and
+% `parindent' re-added, since they still collide with the current
+% version of the subfig package (Sigh!)}
+%
+% There is an option clash between the \KOMAScript\ document classes
+% and the \package{caption} kernel, both define the options |parindent| and
+% |parskip| but with different meaning.
+% Furthermore the ones defined by the \package{caption} kernel take a
+% value as parameter but the \KOMAScript\ ones do not.
+% So we need special versions of the options |parindent| and |parskip| here
+% which determine if a value is given (and therefore should be treated as
+% our option) or not (and therefore should be ignored by us).\footnote{%^^A
+% This problem was completely solved due a change of \cs{caption@ProcessOptions}
+% in \thispackage\ \version{1.0h}, but we still need this workaround since
+% these options would otherwise still collide with the current version $1.3$
+% of the \package{subfig} package (Sigh!)}
+% \begin{macrocode}
+\providecommand*\caption@ifkomaclass{%
+ \caption@ifundefined\scr@caption\@gobble\@firstofone}
+\@onlypreamble\caption@ifkomaclass
+% \end{macrocode}
+% \begin{macrocode}
+\caption@ifkomaclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KV@parindent\KV@caption@parindent
+ \DeclareCaptionOption{parindent}[]{%
+ \ifx,#1,%
+ \caption@Debug{Option `parindent' ignored}%
+ \else
+ \caption@KV@parindent{#1}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KV@parskip\KV@caption@parskip
+ \DeclareCaptionOption{parskip}[]{%
+ \ifx,#1,%
+ \caption@Debug{Option `parskip' ignored}%
+ \else
+ \caption@KV@parskip{#1}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{Styles}
+%
+% \begin{macro}{\DeclareCaptionStyle}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
+% between arguments do make any harm}
+% |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionStyle[1]{%
+ \@testopt{\caption@declarestyle{#1}}{}}
+\@onlypreamble\DeclareCaptionStyle
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@declarestyle#1[#2]#3{%
+ \global\@namedef{caption@sls@#1}{#2}%
+ \global\@namedef{caption@sty@#1}{#3}}
+\@onlypreamble\caption@declarestyle
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2a}{2008/01/20}{Option \opt{style*=} added}
+% \changes{v1.2b}{2008/05/06}{Option \opt{slc=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{style}{\caption@setstyle{#1}}
+\DeclareCaptionOption{style*}{\caption@setstyle*{#1}}
+\DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}}
+\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setstyle}
+% \changes{v1.0e}{2005/06/01}{Starred variant added}
+% \changes{v1.1}{2007/07/29}{Recursive style definitions should work now}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% |\caption@setstyle|\marg{name}\\
+% |\caption@setstyle*|\marg{name}\par
+% Selecting a caption style means saving the additional
+% \meta{single-line-list-of-KV} (this will be done by |\caption@sls|),
+% resetting the caption options to the base ones (this will be done using
+% |\caption@resetstyle|) and executing the \meta{list-of-KV} options
+% (this will be done using |\caption@setup|).\par
+% The starred version will give no error message if the given style is not
+% defined.
+% \begin{macrocode}
+\newcommand*\caption@setstyle{%
+ \caption@teststar\caption@@setstyle\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setstyle[2]{%
+ \@ifundefined{caption@sty@#2}%
+ {#1{\caption@Error{Undefined style `#2'}}}%
+ {\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname
+ \ifx\caption@setstyle@flag\@undefined
+ \let\caption@setstyle@flag\relax
+ \caption@resetstyle
+ \caption@xsetup\caption@sty
+ \let\caption@setstyle@flag\@undefined
+ \else
+ \caption@xsetup\caption@sty
+ \fi
+ \expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
+ \expandafter\caption@l@addto@list\expandafter\caption@opt@singleline
+ \expandafter{\caption@sls}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetstyle}
+% \changes{v1.1}{2007/02/04}{%
+% This macro renamed from \cs{caption@setdefault} to \cs{caption@resetstyle}}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.2}{2007/11/17}{Usage of \texttt{size=} added}
+% \changes{v1.2b}{2008/05/06}{Usage of \texttt{rule} added}
+% This resets (nearly) all caption options to the base ones.
+% \emph{Note that this does not touch the skips and the positioning!}
+% \begin{macrocode}
+\newcommand*\caption@resetstyle{%
+ \caption@setup{%
+ format=plain,labelformat=default,labelsep=colon,textformat=simple,%
+ justification=justified,font=,size=,labelfont=,textfont=,%
+ margin=0pt,minmargin=0,maxmargin=0,%
+ indent=0pt,parindent=0pt,hangindent=0pt,%
+ slc,rule,strut}%
+ \caption@clearsetup{singleline}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
+% \changes{v1.1}{2007/02/04}{Caption style `default' renamed to `base', and a new `default' added}
+% \changes{v1.1}{2007/03/31}{\opt{format=plain} added to caption style \opt{default}}
+% \changes{v1.1c}{2007/10/14}{\opt{format=plain} removed from caption style \opt{default}}
+% Currently there are two pre-defined styles, called `base' \& `default'.
+% The first one is a perfect match to the behavior of |\@makecaption| offered
+% by the standard \LaTeX\ document classes (and was called `default' in
+% \thispackage\ \version{1.0}), the second one matches the document
+% class actually used.
+% \begin{macrocode}
+\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{}
+\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{%
+ format=default,labelsep=default,textformat=default,%
+ justification=default,font=default,labelfont=default,textfont=default}
+% \end{macrocode}
+%
+% \subsection{Formats}
+%
+% \begin{macro}{\DeclareCaptionFormat}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
+% between arguments do make any harm}
+% \changes{v1.0c}{2005/02/09}{Starred variant added}
+% \changes{v1.1c}{2007/10/15}{Optional argument added}
+% |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\
+% |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par
+% The starred form causes the code being typeset in vertical (instead of
+% horizontal) mode, but does not support the |indention=| option.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFormat{%
+ \caption@teststar\caption@declareformat\@gobble\@firstofone}
+\@onlypreamble\DeclareCaptionFormat
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareformat[2]{%
+ \@dblarg{\caption@@declareformat#1{#2}}}
+\@onlypreamble\caption@declareformat
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@declareformat#1#2[#3]#4{%
+ \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
+ \global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}%
+ \global\long\@namedef{caption@fmt@#2}##1##2##3{#4}}
+\@onlypreamble\caption@@declareformat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{format}{\caption@setformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setformat}
+% |\caption@setformat|\marg{name}\par
+% Selecting a caption format simply means saving the code (in |\caption@fmt|)
+% and if the code should be used in horizontal or vertical mode (|\caption@ifh|).
+% \begin{macrocode}
+\newcommand*\caption@setformat[1]{%
+ \@ifundefined{caption@fmt@#1}%
+ {\caption@Error{Undefined format `#1'}}%
+ {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
+ \expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname
+ \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultFormat}
+% \changes{v1.2a}{2008/01/31}{This macro added}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultFormat[1]{%
+ \expandafter\def\expandafter\caption@fmt@default\expandafter
+ {\csname caption@fmt@#1\endcsname}%
+ \expandafter\def\expandafter\caption@slfmt@default\expandafter
+ {\csname caption@slfmt@#1\endcsname}%
+ \expandafter\def\expandafter\caption@ifh@default\expandafter
+ {\csname caption@ifh@#1\endcsname}}
+\@onlypreamble\DeclareCaptionDefaultFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0a}{2004/01/23}{%
+% Caption format \opt{default} renamed to \opt{normal}}
+% \changes{v1.0e}{2005/05/12}{%
+% Caption format \opt{normal} renamed to \opt{@normal}}
+% \changes{v1.0f}{2005/08/25}{%
+% Caption format \opt{@normal} renamed to \opt{plain} and documented}
+% \changes{v1.1c}{2007/10/14}{%
+% Single-line variant of caption format \opt{hang} added}
+% There are two pre-defined formats, called `plain' and `hang'.
+% \begin{macrocode}
+\DeclareCaptionFormat{plain}{#1#2#3\par}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionFormat{hang}[#1#2#3\par]{%
+ \caption@ifin@list\caption@lsepcrlist\caption@lsepname
+ {\caption@Error{%
+ The option `labelsep=\caption@lsepname' does not work\MessageBreak
+ with `format=hang'}}%
+ {\@hangfrom{#1#2}%
+ \advance\caption@parindent\hangindent
+ \advance\caption@hangindent\hangindent
+ \caption@@par#3\par}}
+% \end{macrocode}
+%
+% \changes{v1.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{plain}}
+% \changes{v1.0d}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added}
+% `default' usually maps to `plain'.
+% \begin{macrocode}
+\DeclareCaptionDefaultFormat{plain}
+% \end{macrocode}
+%
+% \subsection{Label formats}
+%
+% \begin{macro}{\DeclareCaptionLabelFormat}
+% \changes{v1.0a}{2004/01/17}{%
+% Pass through argument \#2 so extra spaces between arguments do make any harm}
+% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionLabelFormat[2]{%
+ \global\@namedef{caption@lfmt@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionLabelFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelformat}
+% |\caption@setlabelformat|\marg{name}\par
+% Selecting a caption label format simply means saving the code (in |\caption@lfmt|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelformat[1]{%
+ \@ifundefined{caption@lfmt@#1}%
+ {\caption@Error{Undefined label format `#1'}}%
+ {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2}{2007/12/16}{Caption label format \opt{brace} added}
+% There are four pre-defined label formats, called `empty', `simple',
+% `parens', and `brace'.
+% \begin{macrocode}
+\DeclareCaptionLabelFormat{empty}{}
+\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
+\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
+\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+% \begin{macrocode}
+\def\caption@lfmt@default{\caption@lfmt@simple}
+% \end{macrocode}
+%
+% \subsection{Label separators}
+%
+% \begin{macro}{\DeclareCaptionLabelSeparator}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
+% between arguments do make any harm}
+% \changes{v1.0f}{2005/08/25}{Starred variant added}
+% \changes{v1.1}{2007/07/13}{Test for CR added}
+% \changes{v1.3}{2011/08/06}{Test for CR revised}
+% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
+% |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par
+% The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|.
+% \begin{macrocode}
+\newcommand\DeclareCaptionLabelSeparator{%
+ \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone}
+\@onlypreamble\DeclareCaptionLabelSeparator
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declarelabelseparator[3]{%
+ \global\@namedef{caption@iflf@#2}{#1}%
+ \global\long\@namedef{caption@lsep@#2}{#3}%
+ \caption@@declarelabelseparator{#2}#3\\\@nil}
+\@onlypreamble\caption@declarelabelseparator
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@declarelabelseparator#1#2\\#3\@nil{%
+ \def\@tempa{#3}\ifx\@tempa\@empty \else
+ \caption@g@addto@list\caption@lsepcrlist{#1}%
+ \fi}
+\@onlypreamble\caption@@declarelabelseparator
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
+\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelseparator}
+% |\caption@setlabelseparator|\marg{name}\par
+% Selecting a caption label separator simply means saving the code (in |\caption@lsep|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelseparator[1]{%
+ \@ifundefined{caption@lsep@#1}%
+ {\caption@Error{Undefined label separator `#1'}}%
+ {\edef\caption@lsepname{#1}%
+ \expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
+ \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0e}{2005/06/11}{Bugfix 05-03-23: Caption label separator
+% \opt{newline} implementation changed from \cs{newline} to \cs{\textbackslash}}
+% \changes{v1.0f}{2005/08/24}{Caption label separator \opt{endash} added}
+% There are seven pre-defined label separators, called `none', `colon', `period', `space',
+% `quad', `newline', and `endash'.
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{none}{}
+\DeclareCaptionLabelSeparator{colon}{: }
+\DeclareCaptionLabelSeparator{period}{. }
+\DeclareCaptionLabelSeparator{space}{ }
+\DeclareCaptionLabelSeparator*{quad}{\quad}
+\DeclareCaptionLabelSeparator*{newline}{\\}
+\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setdefaultlabelsep}
+% \changes{v1.2d}{2009/03/29}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setdefaultlabelsep[1]{%
+ \ifx\caption@lsep\caption@lsep@default
+ \caption@set@default@labelsep{#1}%
+ \caption@setlabelseparator{default}%
+ \else
+ \caption@set@default@labelsep{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@default@labelsep[1]{%
+ \def\caption@lsep@default{\@nameuse{caption@lsep@#1}}%
+ \def\caption@iflf@default{\@nameuse{caption@iflf@#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `colon'.
+% \begin{macrocode}
+\caption@set@default@labelsep{colon}
+% \end{macrocode}
+%
+% \subsection{Text formats}
+%
+% \begin{macro}{\DeclareCaptionTextFormat}
+% \changes{v1.0j}{2007/02/18}{This macro added}
+% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionTextFormat[2]{%
+ \global\long\@namedef{caption@tfmt@#1}##1{#2}}
+\@onlypreamble\DeclareCaptionTextFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{Option \opt{strut=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
+\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@settextformat}
+% \changes{v1.0j}{2007/02/18}{This macro added}
+% |\caption@settextformat|\marg{name}\par
+% Selecting a caption text format simply means saving the code (in |\caption@tfmt|).
+% \begin{macrocode}
+\newcommand*\caption@settextformat[1]{%
+ \@ifundefined{caption@tfmt@#1}%
+ {\caption@Error{Undefined text format `#1'}}%
+ {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are three pre-defined text formats, called `empty', `simple' and `period'.
+% \changes{v1.4}{2011/10/05}{Pre-defined text format `empty' added}
+% \begin{macrocode}
+\DeclareCaptionTextFormat{empty}{}
+\DeclareCaptionTextFormat{simple}{#1}
+\DeclareCaptionTextFormat{period}{#1.}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+% \begin{macrocode}
+\def\caption@tfmt@default{\caption@tfmt@simple}
+% \end{macrocode}
+%
+% \subsection{Fonts}
+%
+% \begin{macro}{\DeclareCaptionFont}
+% \changes{v1.0a}{2004/01/22}{%
+% Bugfix: Multi token arguments are allowed now}
+% \changes{v1.1}{2007/05/07}{%
+% Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now}
+% |\DeclareCaptionFont|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFont[2]{%
+ \define@key{caption@fnt}{#1}[]{\l@addto@macro\caption@fnt{#2}}}
+\@onlypreamble\DeclareCaptionFont
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultFont}
+% \changes{v1.1}{2006/05/14}{This macro added}
+% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionFont} to \cs{DeclareCaptionDefaultFont}}
+% |\DeclareCaptionDefaultFont|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultFont[2]{%
+ \global\@namedef{caption#1@default}{#2}}
+\@onlypreamble\DeclareCaptionDefaultFont
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
+\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}}
+\DeclareCaptionDefaultFont{font}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
+\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}}
+\DeclareCaptionDefaultFont{labelfont}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
+\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}}
+\DeclareCaptionDefaultFont{textfont}{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setfont}
+% \changes{v1.0j}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument}
+% \changes{v1.1}{2006/05/14}{Support of \cs{DeclareDefaultCaptionFont} added}
+% |\caption@setfont|\marg{name}\marg{keyval-list of names}\par
+% Selecting a caption font means saving all the code snippets
+% in |\caption|\meta{name}.
+% \begin{macrocode}
+\newcommand*\caption@setfont[1]{%
+ \expandafter\let\csname caption#1\endcsname\@empty
+ \caption@addtofont{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtofont}
+% \changes{v1.2}{2007/11/17}{This macro added}
+% |\caption@addtofont|\marg{name}\marg{keyval-list of names}\par
+% Like |\caption@setfont|, but adds the code snippets to |\caption|\meta{name}.\par
+% Because we use |\setkeys| recursive here we need to do this inside an
+% extra group.
+% \begin{macrocode}
+\newcommand*\caption@addtofont[2]{%
+ \begingroup
+ \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname
+ \define@key{caption@fnt}{default}[]{%
+ \l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}%
+ \caption@setkeys[caption]{caption@fnt}{#2}%
+ \global\let\caption@tempa\caption@fnt
+ \endgroup
+ \expandafter\let\csname caption#1\endcsname\caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@font}
+% \changes{v1.1}{2007/05/07}{This macro added}
+% |\caption@font|\marg{keyval-list of names}\\
+% |\caption@font*|\marg{keyval-code}\par
+% Sets the given font, e.g.~|\caption@font{small,it}|
+% is equivalent to |\small\itshape|.
+% \begin{macrocode}
+\newcommand*\caption@font{%
+ \caption@teststar\caption@@font\@firstofone
+ {\caption@setkeys[caption]{caption@fnt}}}
+\newcommand*\caption@@font[2]{%
+ \begingroup
+ \def\caption@fnt{\endgroup}%
+ #1{#2}%
+ \caption@fnt}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined font code snippets.
+%
+% \changes{v1.1}{2007/05/07}{Color font support added}
+% \begin{macrocode}
+\DeclareCaptionFont{normalcolor}{\normalcolor}
+\DeclareCaptionFont{color}{\color{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{normalfont}{\normalfont}
+\DeclareCaptionFont{up}{\upshape}
+\DeclareCaptionFont{it}{\itshape}
+\DeclareCaptionFont{sl}{\slshape}
+\DeclareCaptionFont{sc}{\scshape}
+\DeclareCaptionFont{md}{\mdseries}
+\DeclareCaptionFont{bf}{\bfseries}
+\DeclareCaptionFont{rm}{\rmfamily}
+\DeclareCaptionFont{sf}{\sffamily}
+\DeclareCaptionFont{tt}{\ttfamily}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{scriptsize}{\scriptsize}
+\DeclareCaptionFont{footnotesize}{\footnotesize}
+\DeclareCaptionFont{small}{\small}
+\DeclareCaptionFont{normalsize}{\normalsize}
+\DeclareCaptionFont{large}{\large}
+\DeclareCaptionFont{Large}{\Large}
+% \end{macrocode}
+%
+% \changes{v1.3}{2011/01/01}{\package{sansmath} package support added}
+% \begin{macrocode}
+\DeclareCaptionFont{sansmath}{\sansmath}
+% \end{macrocode}
+%
+% \changes{v1.0n}{2007/04/02}{\package{setspace} package support added}
+% \changes{v1.2d}{2009/10/09}{Bugfix 09-05-18: \package{setspace} package support revised}
+% \begin{macrocode}
+\DeclareCaptionFont{singlespacing}{%
+ \caption@ifundefined\setspace@singlespace{}{%
+ \setstretch\setspace@singlespace}}% normally 1
+\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
+\DeclareCaptionFont{doublespacing}{\doublespacing}
+\DeclareCaptionFont{stretch}{\setstretch{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%\DeclareCaptionFont{normal}{%
+% \caption@font{normalcolor,normalfont,normalsize,singlespacing}
+\DeclareCaptionFont{normal}{%
+ \caption@font*{%
+ \KV@caption@fnt@normalcolor\@unused
+ \KV@caption@fnt@normalfont\@unused
+ \KV@caption@fnt@normalsize\@unused
+ \KV@caption@fnt@singlespacing\@unused}}
+% \end{macrocode}
+%
+% \changes{v1.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
+% The old versions \version{1.x} of \thispackage\ offered this
+% command to setup the font size used for captions. We still do
+% so old documents will work fine.
+% \begin{macrocode}
+\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
+\DeclareCaptionDefaultFont{size}{}
+% \end{macrocode}
+%
+% \subsection{Justifications}
+%
+% \begin{macro}{\DeclareCaptionJustification}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
+% between arguments do make any harm}
+% \changes{v1.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}}
+% |\DeclareCaptionJustification|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionJustification[2]{%
+ \global\@namedef{caption@hj@#1}{#2}% for compatibility to v1.0
+ \DeclareCaptionFont{#1}{#2}}
+\@onlypreamble\DeclareCaptionJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultJustification}
+% \changes{v1.1}{2007/07/03}{This macro added}
+% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionJustification} to \cs{DeclareCaptionDefaultJustification}}
+% |\DeclareCaptionDefaultJustification|\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultJustification[1]{%
+ \global\@namedef{caption@hj@default}{#1}% for compatibility to v1.0
+ \DeclareCaptionDefaultFont{@hj}{#1}}
+\@onlypreamble\DeclareCaptionDefaultJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{justification}{\caption@setjustification{#1}}
+\DeclareCaptionDefaultJustification{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setjustification}
+% \changes{v1.1}{2007/07/03}{Mapped to \cs{caption@setfont}}
+% |\caption@setjustification|\marg{name}\par
+% Selecting a caption justification simply means saving the code (in |\caption@hj|).
+% \begin{macrocode}
+\newcommand*\caption@setjustification{\caption@setfont{@hj}}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined justification code snippets.
+% \begin{macrocode}
+\DeclareCaptionJustification{justified}{}
+\DeclareCaptionJustification{centering}{\centering}
+\DeclareCaptionJustification{centerfirst}{\centerfirst}
+\DeclareCaptionJustification{centerlast}{\centerlast}
+\DeclareCaptionJustification{raggedleft}{\raggedleft}
+\DeclareCaptionJustification{raggedright}{\raggedright}
+% \end{macrocode}
+%
+% \begin{macro}{\centerfirst}
+% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}}
+% Please blame Frank Mittelbach for the code of |\centerfirst| |:-)|
+% \begin{macrocode}
+\providecommand\centerfirst{%
+ \let\\\@centercr
+ \edef\caption@normaladjust{%
+ \leftskip\the\leftskip
+ \rightskip\the\rightskip
+ \parfillskip\the\parfillskip\relax}%
+ \leftskip\z@\@plus -1fil%
+ \rightskip\z@\@plus 1fil%
+ \parfillskip\z@skip
+ \noindent\hskip\z@\@plus 2fil%
+ \@setpar{\@@par\@restorepar\caption@normaladjust}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\centerlast}
+% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}}
+% This is based on code from Anne Br\"uggemann-Klein\cite{Anne}
+% \begin{macrocode}
+\providecommand\centerlast{%
+ \let\\\@centercr
+ \leftskip\z@\@plus 1fil%
+ \rightskip\z@\@plus -1fil%
+ \parfillskip\z@\@plus 2fil\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{The ragged2e package}
+% \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support}
+%
+% We also support the upper-case commands offered by the \package{ragged2e}
+% package.
+% Note that these just map to their lower-case variants if the
+% \package{ragged2e} package is not available.
+% \begin{macrocode}
+\DeclareCaptionJustification{Centering}{%
+ \caption@ragged\Centering\centering}
+\DeclareCaptionJustification{RaggedLeft}{%
+ \caption@ragged\RaggedLeft\raggedleft}
+\DeclareCaptionJustification{RaggedRight}{%
+ \caption@ragged\RaggedRight\raggedright}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@ragged}
+% \changes{v1.0n}{2007/04/07}{The `ragged2e' package will now only been
+% loaded when needed}
+% \changes{v1.0o}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced
+% by \cs{caption@Debug}}
+% \changes{v1.1}{2007/04/16}{A different warning will be given on first \LaTeX\ run}
+% |\caption@ragged| will be basically defined as
+% \begin{quote}
+% |\AtBeginDocument{\IfFileExists{ragged2e.sty}%|\\
+% | {\RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}%|\\
+% | {\let\caption@ragged\@secondoftwo}}|
+% \end{quote}
+% but with an additional warning if the ragged2e package is not loaded (yet).
+% (This warning will be type out only one time per option, that's why
+% we need the |caption\string#1| stuff.)
+% Furthermore we load the \package{ragged2e} package, if needed and available.
+% \begin{macrocode}
+\newcommand*\caption@ragged{%
+ \caption@Debug{We need ragged2e}%
+ \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}%
+ \global\let\caption@ragged\caption@@ragged
+ \caption@ragged}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \@ifundefined{caption@r@ragged2e}{%
+ \newcommand*\caption@@ragged{%
+ \caption@Warning{%
+ `ragged2e' support has been changed.\MessageBreak
+ Rerun to get captions right}%
+ \global\let\caption@ragged\@secondoftwo % suppress further warnings
+ \caption@ragged}%
+ }{%
+ \caption@Debug{We load ragged2e}%
+ \IfFileExists{ragged2e.sty}{%
+ \RequirePackage{ragged2e}%
+ \let\caption@@ragged\@firstoftwo
+ }{%
+ \newcommand*\caption@@ragged[2]{%
+ \@ifundefined{caption\string#1}{%
+ \caption@Warning{%
+ `ragged2e' package not loaded, therefore\MessageBreak
+ substituting \string#2 for \string#1\MessageBreak}%
+ \global\@namedef{caption\string#1}}{}%
+ #2}%
+ }%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Vertical spaces before and after captions}
+%
+% \begin{macro}{\abovecaptionskip}
+% \begin{macro}{\belowcaptionskip}
+% Usually these skips are defined within the document class, but some
+% document classes don't do so.
+% \begin{macrocode}
+\caption@ifundefined\abovecaptionskip{%
+ \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
+\caption@ifundefined\belowcaptionskip{%
+ \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{Option \opt{skip=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
+\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
+\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@rule}
+% \changes{v1.2b}{2008/05/06}{This macro added}
+% |\caption@rule|\par
+% Draws an invisible rule to adjust the ``skip'' setting.
+% \begin{macrocode}
+\newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@hrule{\hrule\@height\z@}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2b}{2008/05/06}{Option \opt{rule=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}}
+% \end{macrocode}
+%
+% \subsection{Positioning}
+%
+% These macros handle the right position of the caption.
+% Note that the position is actually \emph{not} controlled by the
+% \package{caption3} kernel options, but by the user (or a specific package
+% like the \package{float} package) instead.
+% The user can put the |\caption| command wherever he likes! So this stuff
+% is only to give us a \emph{hint} where to put the right skips, the user
+% usually has to take care for himself that this hint actually matches the
+% right position.
+%
+% \begin{macrocode}
+\DeclareCaptionOption{position}{\caption@setposition{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setposition}
+% \changes{v1.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b},
+% \opt{below}, and \opt{a} are allowed, too}
+% \changes{v1.0c}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
+% |\caption@setposition|\marg{position}\par
+% Selecting the caption position means that we put |\caption@position| to
+% the right value. \emph{Please do \textbf{not} use the internal macro
+% \cs{caption@position} in your own package or document, but use the wrapper
+% macro \cs{caption@iftop} instead.}
+% \begin{macrocode}
+\newcommand*\caption@setposition[1]{%
+ \caption@ifinlist{#1}{d,default}{%
+ \let\caption@position\caption@defaultpos
+ }{\caption@ifinlist{#1}{t,top,above}{%
+ \let\caption@position\@firstoftwo
+ }{\caption@ifinlist{#1}{b,bottom,below}{%
+ \let\caption@position\@secondoftwo
+ }{\caption@ifinlist{#1}{a,auto}{%
+ \let\caption@position\@undefined
+ }{%
+ \caption@Error{Undefined position `#1'}%
+ }}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defaultpos}
+% \changes{v1.1}{2007/05/08}{Default position changed from `bottom' to `auto'}
+% The default `position' is `auto', this means that \thispackage\ will try
+% to guess the current position of the caption.
+% (But in many cases, for example in |longtable|s, this is doomed to fail!)\par
+% The setting `bottom' correspondents to the |\@makecaption| implementation
+% in the standard \LaTeX\ document classes, but `auto' should give better
+% results in most cases.
+% \begin{macrocode}
+%\caption@setdefaultpos{a}% default = auto
+\let\caption@defaultpos\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftop}
+% \changes{v1.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
+% \changes{v1.0c}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
+% \changes{v1.1}{2007/05/08}{Position will be fixed to `bottom' if `auto'}
+% |\caption@iftop|\marg{true-code}\marg{false-code}\par
+% (If the |position=| is set to |auto| we assume a |bottom| position here.)
+% \begin{macrocode}
+\newcommand*\caption@iftop{%
+ \ifx\caption@position\@undefined
+ \let\caption@position\@secondoftwo
+% = \caption@setposition b%
+ \fi
+ \caption@position}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fixposition}
+% \changes{v1.0b}{2004/05/16}{%
+% Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
+% |\caption@fixposition|\par
+% This macro checks if the `position' is set to `auto'.
+% If yes, |\caption@autoposition| will be called to
+% set |\caption@position| to a proper value we can actually use.
+% \begin{macrocode}
+\newcommand*\caption@fixposition{%
+ \ifx\caption@position\@undefined
+ \caption@autoposition
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@autoposition}
+% \changes{v1.0a}{2004/01/23}{\cs{ifvmode} added}
+% |\caption@autoposition|\par
+% We guess the current position of the caption by checking |\prevdepth|.\par
+% A different solution would be setting the |\spacefactor| to something
+% not much less than 1000 (for example 994) in |\caption@start| and
+% checking this value here by |\ifnum\spacefactor=994|.
+% (It's implemented in the \package{threeparttable}
+% package\cite{threeparttable} this way.)\par
+% Another idea would be checking |\@ifminipage|, but since some packages
+% typeset the caption within a simple |\vbox| this does not seem to be a
+% good one.
+% \begin{macrocode}
+\newcommand*\caption@autoposition{%
+ \ifvmode
+ \edef\caption@tempa{\the\prevdepth}%
+ \caption@Debug{\protect\prevdepth=\caption@tempa}%
+ \ifdim\prevdepth>-\p@
+ \let\caption@position\@secondoftwo
+ \else
+ \let\caption@position\@firstoftwo
+ \fi
+% = \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}%
+ \else
+ \caption@Debug{no \protect\prevdepth}%
+ \let\caption@position\@secondoftwo
+% = \caption@setposition b%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@setautoposition}
+% \changes{v1.1}{2007/06/10}{This macro added}
+% |\caption@setautoposition|\marg{position}\par
+% replaces the above algorithm by a different one (or a fixed position setting).
+% \begin{macrocode}
+\newcommand*\caption@setautoposition[1]{%
+ \def\caption@autoposition{\caption@setposition{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Hooks}
+%
+% \begin{macro}{\AtBeginCaption}
+% \begin{macro}{\AtEndCaption}
+% |\AtBeginCaption| \marg{code}\\
+% |\AtEndCaption| \marg{code}\par
+% These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|.
+% \begin{macrocode}
+\newcommand*\caption@beginhook{}
+\newcommand*\caption@endhook{}
+\newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook}
+\newcommand*\AtEndCaption{\l@addto@macro\caption@endhook}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Lists}
+%
+% \changes{v1.0b}{2004/05/16}{Option \opt{listof=} added}
+% \changes{v1.2}{2007/11/17}{Option \opt{list=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{list}[1]{\caption@setlist{#1}}
+\DeclareCaptionOption{listof}[1]{\caption@setlist{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlist}
+% \changes{v1.2a}{2008/03/20}{This macro added}
+% |\caption@setlist|\marg{boolean}
+% \begin{macrocode}
+\newcommand*\caption@setlist{\caption@set@bool\caption@iflist}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.4}{2011/08/30}{Option \opt{listtype=} added}
+% \changes{v1.4}{2011/08/30}{Option \opt{listtype+=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listtype}{\caption@setlisttype{#1}}
+\DeclareCaptionOption{listtype+}{\caption@setlisttype@ext{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlisttype}
+% \changes{v1.4}{2011/08/30}{This macro added}
+% |\caption@setlisttype|\marg{type}
+% \begin{macrocode}
+\newcommand*\caption@setlisttype{%
+ \caption@setlisttype@ext{}%
+ \caption@@setlisttype\caption@listtype}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setlisttype[2]{%
+ \edef#1{#2}%
+ \ifx#1\@empty \let#1\@undefined \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@setlisttype@ext}
+% \changes{v1.4}{2011/08/30}{This macro added}
+% |\caption@setlisttype@ext|\marg{type extension}
+% \begin{macrocode}
+\newcommand*\caption@setlisttype@ext{%
+ \caption@@setlisttype\caption@listtype@ext}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionListFormat}
+% \changes{v1.1}{2004/07/15}{This macro added}
+% \changes{v1.2}{2007/11/17}{Renamed from \cs{DeclareCaptionListOfFormat} to \cs{DeclareCaptionListFormat}}
+% |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionListFormat[2]{%
+ \global\@namedef{caption@lstfmt@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionListFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.1}{2007/07/15}{Option \opt{listofformat=} added}
+% \changes{v1.2}{2007/11/17}{Option \opt{listofformat=} renamed to \opt{listformat=}}
+% \begin{macrocode}
+\DeclareCaptionOption{listformat}{\caption@setlistformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlistformat}
+% \changes{v1.1}{2004/07/15}{This macro added}
+% \changes{v1.2}{2007/11/17}{Renamed from \cs{caption@setlistofformat} to \cs{caption@setlistformat}}
+% |\caption@setlistformat|\marg{name}\par
+% Selecting a caption list format simply means saving the code (in |\caption@lstfmt|).
+% \begin{macrocode}
+\newcommand*\caption@setlistformat[1]{%
+ \@ifundefined{caption@lstfmt@#1}%
+ {\caption@Error{Undefined list format `#1'}}%
+ {\expandafter\let\expandafter\caption@lstfmt
+ \csname caption@lstfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are five pre-defined list formats, taken from the \package{subfig} package.
+% \begin{macrocode}
+\DeclareCaptionListFormat{empty}{}
+\DeclareCaptionListFormat{simple}{#1#2}
+\DeclareCaptionListFormat{parens}{#1(#2)}
+\DeclareCaptionListFormat{subsimple}{#2}
+\DeclareCaptionListFormat{subparens}{(#2)}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setdefaultlistformat}
+% \changes{v1.2d}{2009/03/29}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setdefaultlistformat[1]{%
+ \ifx\caption@lstfmt\caption@lstfmt@default
+ \caption@set@default@listformat{#1}%
+ \caption@setlistformat{default}%
+ \else
+ \caption@set@default@listformat{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@default@listformat[1]{%
+ \def\caption@lstfmt@default{\@nameuse{caption@lstfmt@#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `subsimple'.
+% \begin{macrocode}
+\caption@set@default@listformat{subsimple}
+% \end{macrocode}
+%
+% \subsection{Debug option}
+% \changes{v1.0k}{2007/03/04}{Debug option added}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{debug}[1]{%
+ \caption@set@bool\caption@ifdebug{#1}%
+ \caption@ifdebug
+ {\let\caption@Debug\caption@Info}%
+ {\let\caption@Debug\@gobble}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareOption{debug}{\setkeys{caption}{debug}}
+% \end{macrocode}
+% \begin{macrocode}
+\setkeys{caption}{debug=0}
+% \end{macrocode}
+%
+% \subsection{Document classes \& Babel support}
+%
+% \subsubsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes}
+%
+% \begin{macrocode}
+\caption@CheckCommand\@makecaption{%
+ % article|report|book [2005/09/16 v1.4f Standard LaTeX document class]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+%
+% \subsubsection{The \AmS{} \& \SmF{} classes}
+% \changes{v1.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added}
+%
+% \begin{macro}{\caption@ifamsclass}
+% \begin{macrocode}
+\providecommand*\caption@ifamsclass{%
+ \caption@ifundefined\@captionheadfont\@gobble\@firstofone}
+\@onlypreamble\caption@ifamsclass
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifamsclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % amsart|amsproc|amsbook [2004/08/06 v2.20]
+ \long\def\@makecaption#1#2{%
+ \setbox\@tempboxa\vbox{\color@setgroup
+ \advance\hsize-2\captionindent\noindent
+ \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
+ {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}%
+ \unskip\kern-2\captionindent\par
+ \global\setbox\@ne\lastbox\color@endgroup}%
+ \ifhbox\@ne % the normal case
+ \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
+ \fi
+ \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
+ \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
+ \else % tempboxa contained more than one line
+ \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip
+ \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
+ \fi
+ \ifnum\@tempcnta<64 % if the float IS a figure...
+ \addvspace\abovecaptionskip
+ \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
+ \else % if the float IS NOT a figure...
+ \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
+ \nobreak
+ \vskip\belowcaptionskip
+ \fi
+ \relax
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % smfart|smfbook [1999/11/15 v1.2f Classe LaTeX pour les articles publies par la SMF]
+ \long\def\@makecaption#1#2{%
+ \ifdim\captionindent>.1\hsize \captionindent.1\hsize \fi
+ \setbox\@tempboxa\vbox{\color@setgroup
+ \advance\hsize-2\captionindent\noindent
+ \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
+ {\@cdr#2\@nil}{\@addpunct{.}\@captionfont\upshape\enspace#2}%
+ \unskip\kern-2\captionindent\par
+ \global\setbox\@ne\lastbox\color@endgroup}%
+ \ifhbox\@ne % the normal case
+ \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
+ \fi
+ \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
+ \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
+ \@tempdima\wd\@ne\advance\@tempdima-\captionindent
+ \wd\@ne\@tempdima
+ \else % tempboxa contained more than one line
+ \setbox\@ne\vbox{\rightskip=0pt plus\captionindent\relax
+ \unvbox\@tempboxa\parskip\z@skip
+ \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
+ \fi
+ \ifnum\@tempcnta<64 % if the float IS a figure...
+ \addvspace\abovecaptionskip
+ \noindent\kern\captionindent\box\@ne
+ \else % if the float IS NOT a figure...
+ \noindent\kern\captionindent\box\@ne
+ \nobreak
+ \vskip\belowcaptionskip
+ \fi
+ \relax
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+ \let\captionmargin\captionindent % set to 3pc by AMS class
+ \begingroup\edef\@tempa{\endgroup
+ \noexpand\caption@g@addto@list\noexpand\caption@sty@default
+ {margin=\the\captionmargin
+ \caption@ifundefined\smf@makecaption{}{,maxmargin=.1\linewidth}}}
+ \@tempa
+ \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin}
+ \DeclareCaptionLabelSeparator{default}{.\enspace}
+ \DeclareCaptionDefaultFont{font}{\@captionfont}
+ \DeclareCaptionDefaultFont{labelfont}{\@captionheadfont}
+ \DeclareCaptionDefaultFont{textfont}{\@captionfont\upshape}
+ \captionsetup[figure]{position=b}
+ \captionsetup[table]{position=t}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The beamer class (Part one)}
+% \changes{v1.1}{2007/03/10}{beamer class support added}
+% \changes{v1.3}{2011/08/06}{beamer class support revised}
+%
+% \begin{macro}{\caption@ifbeamerclass}
+% \begin{macrocode}
+\providecommand*\caption@ifbeamerclass{%
+ \@ifclassloaded{beamer}\@firstofone\@gobble}
+\@onlypreamble\caption@ifbeamerclass
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifbeamerclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\beamer@makecaption{%
+ % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
+ \long\def\beamer@makecaption#1#2{%
+ \def\insertcaptionname{\csname#1name\endcsname}%
+ \def\insertcaptionnumber{\csname the#1\endcsname}%
+ \def\insertcaption{#2}%
+ \nobreak\vskip\abovecaptionskip\nobreak
+ \sbox\@tempboxa{\usebeamertemplate**{caption}}%
+ \ifdim \wd\@tempboxa >\hsize
+ \usebeamertemplate**{caption}\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \nobreak\vskip\belowcaptionskip\nobreak}}
+% \end{macrocode}
+% \begin{macro}{\caption@ifbeamertemplate}
+% \begin{macrocode}
+\newcommand*\caption@ifbeamertemplate[1]{%
+ \begingroup
+ \let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
+ \@nameuse{beamer@@tmpop@caption@#1}%
+ \ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
+ \endgroup\expandafter\@firstoftwo
+ \else
+ \endgroup\expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+ \DeclareCaptionLabelFormat{default}{%
+ #1\caption@ifbeamertemplate{numbered}{~#2}{}}
+ \caption@declarelabelseparator
+ {\caption@ifbeamertemplate{caption name own line}\@gobble\@firstofone}
+ {default}
+ {\caption@ifbeamertemplate{caption name own line}{\\}{: }}
+ \DeclareCaptionDefaultFont{font}{%
+ \usebeamerfont*{caption}%
+ \usebeamercolor[fg]{caption}}
+ \DeclareCaptionDefaultFont{labelfont}{%
+ \usebeamercolor[fg]{caption name}%
+ \usebeamerfont*{caption name}}
+ \DeclareCaptionDefaultJustification{\raggedright}
+ \DeclareOption{beamerclass}{%
+ \renewcommand\caption@ifslc{%
+ \caption@ifbeamertemplate{caption name own line}\@secondoftwo\@firstoftwo}
+ % Since the beamer class do not offer a `list of figures' we switch this support off.
+ \captionsetup{list=0}}
+ \PassOptionsToPackage{beamerclass}{caption3}
+% \end{macrocode}
+%
+% If the \package{beamer} document class is used, we offer a beamer
+% template called `caption3' which can be used with option `beamer' or
+% |\setbeamertemplate{caption}[caption3]|.\par
+% (Note that this is of no use when the \package{caption} package is used, too.)
+% \begin{macrocode}
+ \defbeamertemplate{caption}{caption3}{%
+ \caption@make\insertcaptionname\insertcaptionnumber\insertcaption}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareOption{beamer}{%
+ % \usebeamertemplate**{caption} will set font
+ \DeclareCaptionDefaultFont{font}{}%
+ \setbeamertemplate{caption}[caption3]}
+% \end{macrocode}
+% \begin{macrocode}
+%
+% \begin{macrocode]
+}
+% \end{macrocode}
+%
+% \subsubsection{The KOMA-Script classes}
+% \changes{v1.1}{2007/03/31}{\KOMAScript\ classes support added}
+%
+% \begin{macro}{\caption@ifkomaclass}
+% \begin{macrocode}
+\providecommand*\caption@ifkomaclass{%
+ \caption@ifundefined\scr@caption\@gobble\@firstofone}
+\@onlypreamble\caption@ifkomaclass
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifkomaclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % scrartcl|scrreprt|scrbook [2007/03/07 v2.97a KOMA-Script document class]
+ \long\def\@makecaption#1#2{%
+ \if@captionabove
+ \vskip\belowcaptionskip
+ \else
+ \vskip\abovecaptionskip
+ \fi
+ \@@makecaption\@firstofone{#1}{#2}%
+ \if@captionabove
+ \vskip\abovecaptionskip
+ \else
+ \vskip\belowcaptionskip
+ \fi}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionFormat{default}[#1#2#3\par]{%
+ \ifdofullc@p
+ \caption@ifin@list\caption@lsepcrlist\caption@lsepname
+ {\caption@Error{%
+ The option `labelsep=\caption@lsepname' does not work\MessageBreak
+ with \noexpand\setcaphanging (which is set by default)}}%
+ {\caption@fmt@hang{#1}{#2}{#3}}%
+ \else
+ #1#2%
+ \ifdim\cap@indent<\z@
+ \par
+ \noindent\hspace*{-\cap@indent}%
+ \else\if@capbreak
+ \par
+ \fi\fi
+ #3\par
+ \fi}
+ \DeclareCaptionLabelSeparator{default}{\captionformat}
+ \DeclareCaptionDefaultFont{font}{\scr@fnt@caption}
+ \DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The \NTG{} Dutch classes}
+% \changes{v1.1}{2007/04/06}{NTG classes support added}
+%
+% \begin{macro}{\caption@ifntgclass}
+% \begin{macrocode}
+\providecommand*\caption@ifntgclass{%
+ \caption@ifundefined\CaptionFonts\@gobble\@firstofone}
+\@onlypreamble\caption@ifntgclass
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifntgclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % artikel|rapport|boek [2004/06/07 v2.1a NTG LaTeX document class]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{{\CaptionLabelFont#1:} \CaptionTextFont#2}%
+ \ifdim \wd\@tempboxa >\hsize
+ {\CaptionLabelFont#1:} \CaptionTextFont#2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont}
+ \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The thesis class}
+% \changes{v1.2a}{2008/01/31}{thesis class support added}
+% \changes{v1.2e}{2009/11/15}{Bugfix 09-11-14: thesis class support revised}
+%
+% \begin{macro}{\caption@ifthesisclass}
+% \begin{macrocode}
+\providecommand*\caption@ifthesisclass{%
+ \caption@ifundefined\cph@font
+ {\@gobble}%
+ {\caption@ifundefined\cpb@font\@gobble\@firstofone}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifthesisclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % thesis.cls 1996/25/01 1.0g LaTeX document class (wm).
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \setbox\@tempboxa\hbox{{\cph@font #1:} {\cpb@font #2}}%
+ \ifdim \wd\@tempboxa >\hsize
+ \@hangfrom{\cph@font #1: }{\cpb@font #2\par}%
+ \else
+ \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFormat{hang}
+ \DeclareCaptionDefaultFont{labelfont}{\cph@font}
+ \DeclareCaptionDefaultFont{textfont}{\cpb@font}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The frenchb Babel option}
+% \changes{v1.1}{2006/05/14}{\package{frenchb} package support added}
+%
+% \begin{macrocode}
+\caption@ifundefined\FB@makecaption{}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % frenchb.ldf [2005/02/06 v1.6g French support from the babel system]
+ % frenchb.ldf [2007/10/05 v2.0e French support from the babel system]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1\CaptionSeparator #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1\CaptionSeparator #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\@makecaption\STD@makecaption
+ \DeclareCaptionLabelSeparator{default}{\CaptionSeparator}
+ \def\caption@frenchb{% supress frenchb warning
+ \let\STD@makecaption\@makecaption
+ \let\FB@makecaption\@makecaption}
+ \else
+ \ifx\@makecaption\@undefined\else
+ \caption@InfoNoLine{%
+ The definition of \protect\@makecaption\space
+ has been changed,\MessageBreak
+ frenchb will NOT customize it}%
+ \fi
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The frenchle/pro package}
+% \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added}
+%
+% \begin{macrocode}
+\caption@ifundefined\frenchTeXmods{}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % french(le).sty [2006/10/03 The french(le) package /V5,9991/]
+ % french(le).sty [2007/06/28 The french(le) package /V5,9994/]
+ \def\@makecaption#1#2{%
+ \ifFTY%
+ \def\@secondofmany##1##2\void{##2}%
+ \def\@tempa{\@secondofmany#2\void}%
+ \ifx\@tempa\empty%
+ \let\captionseparator\empty%
+ \fi%
+ \@mcORI{#1}{\relax\captionfont{#2}}%
+ \else
+ \@mcORI{#1}{#2}%
+ \fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % french(le).sty [2007/02/11 The french(le) package /V5,9993/]
+ \def\@makecaption#1#2{%
+ \ifFTY%
+ \def\@secondofmany##1##2\void{##2}%
+ \protected@edef\@tempa{\@secondofmany#2\void}%
+ \ifx\@tempa\empty%
+ \let\captionseparator\empty%
+ \fi%
+ \@mcORI{#1}{\relax\captionfont{#2}}%
+ \else
+ \@mcORI{#1}{#2}%
+ \fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{textfont}{\itshape}%
+ \DeclareCaptionLabelSeparator{default}{\captionseparator\space}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The hungarian and magyar Babel option}
+% \changes{v1.3}{2009/03/29}{\package{magyar} package support added}
+% \changes{v1.3a}{2011/08/12}{\package{magyar} package support revised}
+%
+% \begin{macrocode}
+\DeclareCaptionListFormat{subperiod}{#2.}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\caption@ifundefined\hunnewlabel{}{%
+ \caption@CheckCommand\@makecaption{%
+ % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system]
+ \def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1. #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ {#1. #2\csname par\endcsname}
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\caption@tempa#1{\@ifundefined{extras#1}{}{%
+ \expandafter\addto\csname extras#1\endcsname{%
+ % change default labelsep and listformat
+ \caption@setdefaultlabelsep{period}%
+ \caption@setdefaultlistformat{subperiod}}%
+ \expandafter\addto\csname noextras#1\endcsname{%
+ % change default labelsep and listformat
+ \caption@setdefaultlabelsep{colon}%
+ \caption@setdefaultlistformat{subsimple}}%
+% \end{macrocode}
+% \begin{macrocode}
+}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@tempa{hungarian}
+\caption@tempa{magyar}
+% \end{macrocode}
+%
+% \subsubsection{Unknown document class (or package)}
+% \changes{v1.1}{2007/04/10}{Check of document class added}
+%
+% \begin{macrocode}
+\caption@IfCheckCommand{%
+ \caption@setbool{documentclass}{1}%
+}{%
+ \caption@setbool{documentclass}{0}%
+ \caption@InfoNoLine{%
+ Unknown document class (or package),\MessageBreak
+ standard defaults will be used}%
+ \caption@Debug{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}%
+}
+% \end{macrocode}
+%
+% \subsection{Execution of options}
+%
+% \begin{macrocode}
+\captionsetup{style=default,position=default,%
+ list,listformat=default,twoside=\if@twoside 1\else 0\fi}
+% \end{macrocode}
+% \begin{macrocode}
+\ProcessOptions*
+% \end{macrocode}
+%
+% \subsection{Making an `List of' entry}
+%
+% \begin{macro}{\caption@addcontentsline}
+% \changes{v1.1}{2007/07/01}{This macro added}
+% \changes{v1.3}{2010/10/26}{Error check added}
+% \changes{v1.3}{2011/06/24}{Split into two macros}
+% \changes{v1.4}{2011/08/19}{Split into three macros}
+% \changes{v1.4}{2011/08/30}{Support for option \opt{listtype=} added}
+% |\caption@addcontentsline|\marg{type}\marg{list entry}\par
+% Makes an entry in the list-of-whatever, if requested,
+% i.e.~the argument \meta{list entry} is not empty and
+% |listof=| was set to |true|.
+% \begin{macrocode}
+\newcommand\caption@addcontentsline[2]{%
+ \caption@ifcontentsline{#2}{%
+ \begingroup
+ \let\@tempa\@gobble
+ \caption@ifundefined\caption@listtype
+ {\edef\caption@listtype{#1}}%
+ {\let\@tempa\@firstofone}%
+ \caption@ifundefined\caption@listtype@ext
+ {}%
+ {\edef\caption@listtype{\caption@listtype\caption@listtype@ext}%
+ \let\@tempa\@firstofone}%
+ \@tempa
+ {\caption@Debug{addcontentsline: #1 => \caption@listtype}%
+% \caption@setoptions*\caption@listtype
+ \@namedef{the\caption@listtype}{\@nameuse{the#1}}}%
+ \expandafter\caption@@addcontentsline\expandafter{\caption@listtype}{#2}%
+ \endgroup}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@addcontentsline[2]{%
+ {\let\\\space
+ \@ifundefined{ext@#1}%
+ {\caption@Error{No float type '#1' defined}}%
+ {\caption@@@addcontentsline
+ {\csname ext@#1\endcsname}%
+ {#1}%
+ {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}%
+ {\ignorespaces #2}}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@addcontentsline[4]{%
+ \addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@ifcontentsline[1]{%
+ \caption@iflist
+ {\def\@tempa{#1}}%
+ {\let\@tempa\@empty}%
+ \ifx\@tempa\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Typesetting the caption}
+%
+% \begin{macro}{\ifcaption@star}
+% If the starred form of |\caption| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@@make|.)
+% \begin{macrocode}
+\newif\ifcaption@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fnum}
+% \changes{v1.1}{2007/08/21}{This macro added}
+% |\caption@fnum|\marg{float type}\par
+% Typesets the caption label; as replacement for |\fnum@|\meta{float type}.
+% \begin{macrocode}
+\newcommand*\caption@fnum[1]{\caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@make}
+% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\par
+% Typesets the caption.
+% \begin{macrocode}
+\newcommand\caption@make[2]{\caption@@make{\caption@lfmt{#1}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@make}
+% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of
+% \cs{captionmargin} resp. \cs{captionwidth}; check for \cs{z@} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end
+% of caption added}
+% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
+% \changes{v1.0c}{2005/02/12}{Single-line-check moved up so it can affect margins now}
+% \changes{v1.0c}{2005/02/09}{Improvement: \cs{caption@ifh} added}
+% \changes{v1.0c}{2005/02/09}{Bugfix: \cs{leavevmode} added}
+% \changes{v1.0f}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
+% \changes{v1.0g}{2005/12/04}{Uses \cs{caption@slc} now}
+% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside
+% single-line-check replaced by \cs{relax}}
+% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be
+% typeset in horizontal mode}
+% \changes{v1.0i}{2006/05/13}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox}}
+% \changes{v1.0j}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v1.0h, re-added}
+% \changes{v1.0n}{2007/04/03}{Usage of \cs{caption@ifoddpage} added}
+% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} moved below single-line-check}
+% \changes{v1.1e}{2007/10/28}{\cs{caption@stepcounter} added}
+% |\caption@@make|\marg{caption label}\marg{caption text}
+% \begin{macrocode}
+\newcommand\caption@@make[2]{%
+ \begingroup
+ \caption@stepcounter
+ \caption@beginhook
+% \end{macrocode}
+%
+% Check margin, if |\caption@minmargin| or |\caption@maxmargin| is set
+% \begin{macrocode}
+% TODO: Move this to \caption@calcmargin!?
+ \ifx\caption@maxmargin\@undefined \else
+ \ifdim\captionmargin>\caption@maxmargin\relax
+ \captionmargin\caption@maxmargin\relax
+ \fi
+ \fi
+ \ifx\caption@minmargin\@undefined \else
+ \ifdim\captionmargin<\caption@minmargin\relax
+ \captionmargin\caption@minmargin\relax
+ \fi
+ \fi
+% \end{macrocode}
+%
+% Special single-line treatment (option |singlelinecheck=|)
+% \begin{macrocode}
+ \caption@ifslc{\caption@slc{#1}{#2}\captionwidth\relax}{}%
+% \end{macrocode}
+%
+% Typeset the left margin (option |margin=|)
+% \begin{macrocode}
+ \caption@calcmargin
+ \@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}%
+ \fi
+ \caption@ifh{\advance\@tempdima\caption@indent}%
+ \hspace\@tempdima
+% \end{macrocode}
+%
+% We actually use a |\vbox| of width |\captionwidth - \caption@indent|
+% to typeset the caption.
+% \Note{\cs{captionindent} is \emph{not} supported if the caption format
+% was defined with \cs{DeclareCaptionFormat*}.}
+% \begin{macrocode}
+ \@tempdima\captionwidth
+ \caption@ifh{\advance\@tempdima-\caption@indent}%
+ \caption@parbox\@tempdima{%
+% \end{macrocode}
+%
+% Typeset the indention (option |indention=|)\\
+% {\small Bugfix 04-05-05:
+% |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots}
+% \begin{macrocode}
+ \caption@ifh{%
+ \ifdim\caption@indent=\z@
+ \leavevmode
+ \else
+ \hskip-\caption@indent
+ \fi}%
+% \end{macrocode}
+%
+% Typeset the caption itself and close the |\caption@parbox|
+% \begin{macrocode}
+ \caption@@@make{#1}{#2}}%
+% \end{macrocode}
+%
+% Typeset the right margin (option |margin=|)
+% \begin{macrocode}
+ \@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}%
+ \fi
+ \hspace\@tempdima
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@endhook
+ \endgroup
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \global\caption@starfalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@calcmargin}
+% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by
+% \cs{ifdim}\cs{captionwidth=}\cs{z@}}
+% \changes{v1.0g}{2006/01/12}{Improvement: Takes care of list environment now}
+% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore),
+% use \cs{linewidth} instead of \cs{hsize}}
+% |\caption@calcmargin|\par
+% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
+% values.
+% \begin{macrocode}
+\newcommand*\caption@calcmargin{%
+ \caption@calcmargin@hook
+ \ifdim\captionwidth=\z@
+ \captionwidth\linewidth
+ \advance\captionwidth by -2\captionmargin
+ \advance\captionwidth by -\captionmargin@
+ \else
+ \captionmargin\linewidth
+ \advance\captionmargin by -\captionwidth
+ \divide\captionmargin by 2
+ \captionmargin@\z@
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{%
+ \string\hsize=\the\hsize,
+ \string\linewidth=\the\linewidth,\MessageBreak
+ \string\leftmargin=\the\leftmargin,
+ \string\rightmargin=\the\rightmargin,\MessageBreak
+ \string\margin=\the\captionmargin,
+ \string\margin@=\the\captionmargin@,
+ \string\width=\the\captionwidth}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@slc}
+% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} added}
+% \changes{v1.1}{2007/07/29}{\cs{caption@setup}\cs{caption@sls} added after \cs{begingroup}}
+% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} added}
+% \changes{v1.1c}{2007/10/14}{Support of \cs{caption@slfmt} added}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.3}{2010/09/04}{Split into \cs{caption@slc} and \cs{caption@@slc}}
+% |\caption@slc|\marg{label}\marg{text}\marg{width}\marg{extra code}\par
+% This one does the single-line-check.
+% \begin{macrocode}
+\newcommand\caption@slc[4]{%
+ \caption@@slc{#1}{#2}{#3}{\caption@singleline#4}{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@slc[5]{%
+ \caption@Debug{Begin SLC}%
+ \begingroup
+ \caption@singleline
+ \let\caption@hj\@empty
+ \caption@calcmargin % calculate #3 if necessary
+ \caption@prepareslc
+ \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
+ \ifdim\wd\@tempboxa>#3%
+ \endgroup
+ #5%
+ \else
+ \endgroup
+ #4%
+ \fi
+ \caption@Debug{End SLC}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@singleline{%
+ \caption@xsetup\caption@opt@singleline
+ \let\caption@fmt\caption@slfmt}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareslc}
+% \changes{v1.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
+% \changes{v1.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
+% \changes{v1.0c}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added}
+% \changes{v1.0f}{2005/07/09}{Support of \package{endnotes} package added}
+% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} moved to \cs{caption@slc}}
+% \changes{v1.1}{2007/06/13}{Redefinition of \cs{(H@)refstepcounter} added}
+% \changes{v1.1}{2007/08/12}{Redefinition of \cs{label} improved}
+% \changes{v1.1c}{2007/10/06}{Definition of \cs{caption@l@stepcounter} added}
+% |\caption@prepareslc|\par
+% \changes{v1.3}{2011/07/07}{Bugfix 11-07-06: Redefinition of \cs{footnote} and \cs{footnotemark} added, redefinition of \cs{stepcounter} and \cs{refstepcounter} dropped}
+% \changes{v1.4a}{2011/10/21}{Redefinition of \cs{pagenote} from \textsf{memoir} document class added}
+% \changes{v1.4a}{2011/10/22}{Redefinition of \cs{footnote} revised}
+% Re-define anything which would disturb the single-line-check.
+% \begin{macrocode}
+\newcommand*\caption@prepareslc{%
+ \let\label\caption@gobble
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@footnotemark@ORI\footnotemark
+ \def\footnote{\caption@withoptargs\caption@footnote}%
+ \def\footnotemark{\caption@withoptargs\caption@footnotemark}%
+ \let\@footnotetext\caption@gobble
+% \end{macrocode}
+% \begin{macrocode}
+ \let\@endnotetext\caption@gobble
+% \end{macrocode}
+% \begin{macrocode}
+ \let\pagenote\caption@gobble
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@footnote[2]{%
+ \caption@footnotemark{#1}}
+\newcommand\caption@footnotemark[1]{%
+ \begingroup
+ \let\stepcounter\caption@l@stepcounter
+ \caption@footnotemark@ORI#1%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@l@stepcounter[1]{%
+ \advance\csname c@#1\endcsname\@ne\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@parbox}
+% \changes{v1.0i}{2006/05/13}{We define \cs{caption@parbox} instead of
+% \cs{caption@start/endbox}}
+% \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{caption@parbox} changed from
+% \cs{parbox-t} to \cs{parbox-b}}
+% \changes{v1.2}{2007/11/11}{Renamed from \cs{captionbox} to \cs{caption@parbox}}
+% |\caption@parbox|\marg{width}\marg{contents}\par
+% This macro defines the box which surrounds the caption paragraph.
+% \begin{macrocode}
+\newcommand*\caption@parbox{\parbox[b]}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@applyfont}
+% \changes{v1.3}{2010/09/04}{This macro added}
+% |\caption@applyfont|\par
+% This macro executes the font relevant macros, i.e. by default
+% the options set by |justification=|, |font=|, and |size=|.
+% \begin{macrocode}
+\newcommand*\caption@applyfont{%
+ \caption@hj\captionfont\captionsize}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@make}
+% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix 04-12-16: Use some kind of
+% \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
+% \changes{v1.0c}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
+% \changes{v1.0d}{2005/05/05}{Use \cs{caption@ifempty};
+% \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
+% \changes{v1.0d}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
+% \changes{v1.0f}{2005/08/24}{Check for empty label added}
+% \changes{v1.0f}{2005/08/25}{\cs{caption@iflf} added}
+% \changes{v1.0j}{2007/02/18}{Usage of \cs{caption@tfmt} added}
+% \changes{v1.1}{2007/05/07}{Bugfix: \cs{ifhmode} added to \cs{@finalstrut}}
+% \changes{v1.2}{2007/11/17}{Made option \opt{size=} stronger than \opt{font=}}
+% \changes{v1.3}{2010/09/04}{Uses \cs{caption@applyfont} now}
+% \changes{v1.3}{2010/11/01}{Bugfix: If the caption text is empty, the text format will be set to \opt{simple} now}
+% |\caption@@@make|\marg{caption label}\marg{caption text}\par
+% This one finally typesets the caption paragraph, without margin and indention.
+% \begin{macrocode}
+\newcommand\caption@@@make[2]{%
+% \end{macrocode}
+%
+% If the label is empty, we use no caption label separator.
+% \begin{macrocode}
+ \sbox\@tempboxa{#1}%
+ \ifdim\wd\@tempboxa=\z@
+ \let\caption@lsep\relax
+% \@capbreakfalse
+ \fi
+% \end{macrocode}
+%
+% If the text is empty, we use no caption label separator, too.
+% (And no text format either.)
+% \begin{macrocode}
+ \caption@ifempty{#2}{%
+ \let\caption@lsep\@empty
+ \let\caption@tfmt\@firstofone
+% \@capbreakfalse
+% \let\caption@ifstrut\@secondoftwo
+ }%
+% \end{macrocode}
+%
+% Take care that |\caption@parindent| and |\caption@hangindent| will be used
+% to typeset the paragraph.
+% \begin{macrocode}
+ \@setpar{\@@par\caption@@par}\caption@@par
+% \end{macrocode}
+%
+% Finally typeset the caption.
+% \begin{macrocode}
+ \caption@applyfont
+ \caption@fmt
+ {\ifcaption@star\else{\captionlabelfont#1}\fi}%
+ {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}%
+ {{\captiontextfont
+ \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
+ \nobreak\hskip\z@skip % enable hyphenation
+ \caption@tfmt{#2}%
+% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
+ \caption@ifstrut{\ifhmode\@finalstrut\strutbox\fi}{}%
+ \par}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty}
+% \changes{v1.0d}{2005/05/05}{This macro added}
+% \changes{v1.1}{2007/07/04}{Re-defines itself now}
+% \changes{v1.2a}{2007/01/22}{Revised so \cs{label} will be detected, too}
+% \changes{v1.2b}{2008/08/02}{Revised so \cs{index} and \cs{glossary} will be detected, too}
+% |\caption@ifempty|\marg{text}\marg{true} (\emph{no} \meta{false})\par
+% This one tests if the \meta{text} is actually empty.
+% \Note{This will be done without expanding the text,
+% therefore this is far away from being bullet-proof.}
+% \Note{This macro is re-defining itself so only
+% the first test (in a group) will actually be done.}
+% \begin{macrocode}
+\newcommand\caption@ifempty[1]{%
+ \caption@if@empty{#1}%
+ \caption@ifempty\@unused}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@if@empty[1]{%
+ \def\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \expandafter\def\expandafter\caption@tempa\expandafter{%
+ \caption@car#1\caption@if@empty\caption@nil}%
+ \def\caption@tempb{\caption@if@empty}%
+ \ifx\caption@tempa\caption@tempb
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \def\caption@tempb{\ignorespaces}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobble#1}%
+ \else
+ \def\caption@tempb{\label}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\index}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\glossary}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \let\caption@ifempty\@gobbletwo
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@par}
+% \changes{v1.0f}{2005/08/22}{Made this definition global}
+% |\caption@@par|\par
+% This command will be executed with every |\par| inside the caption.
+% \begin{macrocode}
+\newcommand*\caption@@par{%
+ \parindent\caption@parindent\hangindent\caption@hangindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Types \& sub-types}
+%
+% \begin{macro}{\DeclareCaptionType}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% \changes{v1.1a}{2007/09/07}{Three optional arguments added}
+% \changes{v1.2}{2007/12/06}{Renamed from \cs{DeclareFloatingEnvironment} to \cs{DeclareCaptionType}}
+% \changes{v1.2}{2007/12/21}{Optional argument revised, uses key-value syntax now}
+% \changes{v1.2b}{2008/04/13}{Uses \cs{caption@within@default} now}
+% \changes{v1.2b}{2008/08/02}{Support of \cs{float@exts} and \cs{float@addtolists} added}
+% \changes{v1.2e}{2010/01/09}{Usage of \cs{caption@DeclareWithinOption} added}
+% \changes{v1.3}{2011/08/06}{Definition of \cs{listofXXXes} added}
+% \changes{v1.4a}{2011/10/29}{Outsourced as \package{newfloat} package}
+% |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionType{%
+ \RequirePackage{newfloat}%
+ \DeclareFloatingEnvironment}
+\@onlypreamble\DeclareCaptionType
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ForEachType}
+% \changes{v1.4a}{2011/10/29}{This macro added}
+% |\caption@ForEachType|\marg{code}
+% will execute the given code for all (known) floating environments.
+% \begin{macrocode}
+\newcommand\caption@ForEachType[1]{%
+ \caption@ifundefined\ForEachFloatingEnvironment
+ {\def\@elt##1{#1}%
+ \caption@ifundefined\c@figure\@gobble\@elt{figure}%
+ \caption@ifundefined\c@table\@gobble\@elt{table}%
+ \let\@elt\relax
+ \newfloat@addtohook{#1}}%
+ {\ForEachFloatingEnvironment{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand\newfloat@addtohook[1]{%
+ \toks@=\expandafter{\newfloat@hook{##1}#1}%
+ \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%
+ \@tempa}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\newfloat@hook[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@stpelt}
+% We patch \cs{@stpelt} so a list of `connected' counters will be reset, too.
+% (Like \cs{stepcounter} does in |ltcounts.dtx|.)
+% \begin{macrocode}
+\newcommand*\caption@patch@stpelt{%
+ \let\caption@stpelt\@stpelt
+ \def\@stpelt##1{%
+ \caption@stpelt{##1}%
+ \begingroup
+ \let\@elt\caption@stpelt
+ \csname caption@cl@##1\endcsname
+ \endgroup}%
+ \let\caption@patch@stpelt\relax}
+\@onlypreamble\caption@patch@stpelt
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtoreset}
+% \changes{v1.2d}{2009/10/09}{This macro added}
+% Like \cs{@addtoreset} from |ltcounts.dtx|
+% \begin{macrocode}
+\newcommand*\caption@addtoreset[2]{%
+ \caption@patch@stpelt
+ \@ifundefined{caption@cl@#2}{\@namedef{caption@cl@#2}{}}{}%
+ \expandafter\@cons\csname caption@cl@#2\endcsname{{#1}}}
+\@onlypreamble\caption@addtoreset
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@removefromreset}
+% \changes{v1.2d}{2009/10/09}{This macro added}
+% Like \cs{@removefromreset} from |remreset.sty|
+% \begin{macrocode}
+\newcommand*\caption@removefromreset[2]{%
+ \begingroup
+ \expandafter\let\csname c@#1\endcsname\caption@removefromreset
+ \def\@elt##1{%
+ \expandafter\ifx\csname c@##1\endcsname\caption@removefromreset
+ \else
+ \noexpand\@elt{##1}%
+ \fi}%
+ \expandafter\xdef\csname caption@cl@#2\endcsname{%
+ \csname caption@cl@#2\endcsname}%
+ \endgroup}
+\@onlypreamble\caption@removefromreset
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionSubType}
+% \changes{v1.2}{2007/11/16}{This macro added}
+% \changes{v1.2a}{2008/03/11}{Bugfix: \cs{subfigurename} will be defined now}
+% \changes{v1.2d}{2009/10/09}{Bugfix 08-10-01: Usage of \cs{caption@addtoreset} added}
+% \changes{v1.3}{2011/01/01}{\cs{@dottedlofline} will be defined \& used now}
+% \changes{v1.4}{2011/10/09}{Support of the titletoc package added}
+% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\
+% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\par
+% The starred variant provides the numbering format
+% \meta{type}|.|\meta{subtype} while the non-starred variant simply
+% uses \meta{subtype}.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionSubType{%
+ \caption@teststar\caption@declaresubtype\@firstoftwo\@secondoftwo}
+\@onlypreamble\DeclareCaptionSubType
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declaresubtype[1]{%
+ \@testopt{\caption@@declaresubtype{#1}}{alph}}
+\@onlypreamble\caption@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@declaresubtype#1[#2]#3{%
+ \@ifundefined{c@#3}%
+ {\caption@Error{No float type '#3' defined}}%
+% \end{macrocode}
+% \begin{macrocode}
+ {\@ifundefined{c@sub#3}%
+ {\caption@Debug{New subtype `sub#3'}%
+ \newcounter{sub#3}%
+ \caption@addtoreset{sub#3}{#3}%
+ \@namedef{ext@sub#3}{\csname ext@#3\endcsname}%
+ \caption@declaresublistentry{#3}%
+ \@cons\caption@subtypelist{{#3}}}%
+ {\caption@Debug{Modify caption `sub#3'}}%
+% \end{macrocode}
+% Support of \package{titletoc} package
+% \begin{macrocode}
+ \caption@ifundefined\contentsuse{}{%
+ \contentsuse{sub#3}{\csname ext@sub#3\endcsname}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@namedef{sub#3name}{}%
+ \@namedef{sub#3autorefname}{\csname #3name\endcsname}%
+ #1% is \@firstoftwo in star form, and \@secondoftwo otherwise
+ {\@namedef{p@sub#3}{}%
+ \@namedef{thesub#3}{\csname the#3\endcsname.\@nameuse{#2}{sub#3}}}%
+ {\@namedef{p@sub#3}{\csname the#3\endcsname}%
+ \@namedef{thesub#3}{\@nameuse{#2}{sub#3}}}%
+ \@namedef{theHsub#3}{\csname theH#3\endcsname.\arabic{sub#3}}%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declaresublistentry{%
+ \caption@ifundefined\l@chapter
+ {\caption@@declaresublistentry\l@subsubsection}%
+ {\caption@@declaresublistentry\l@subsection}}
+\@onlypreamble\caption@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@declaresublistentry[2]{%
+ \ifx#1\@undefined
+ \caption@@@declaresublistentry\relax\@dottedtocline\caption@nil{#2}%
+ \else
+ \expandafter\caption@@@declaresublistentry#1{}{}\@dottedtocline\caption@nil{#2}%
+ \fi}
+\@onlypreamble\caption@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@@declaresublistentry#1\@dottedtocline#2\caption@nil#3{%
+ \def\@tempa{#1}%
+% Does \l@(sub)subsection start with \@dottedtocline?
+ \ifx\@tempa\@empty
+% Yes
+ \caption@@@@declaresublistentry{#3}#2\caption@nil
+ \else
+% No
+ \caption@@@@declaresublistentry{#3}@{3.8em}{3.2em}\caption@nil
+ \fi}
+\@onlypreamble\caption@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@@declaresublistentry#1#2#3#4#5\caption@nil{%
+ \expandafter\caption@@@@@declaresublistentry\expandafter
+ {\csname @dotted\csname ext@#1\endcsname line\endcsname}{#1}{#3}{#4}}
+\@onlypreamble\caption@@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@@declaresublistentry[4]{%
+ \@namedef{l@sub#2}{#1{2}{#3}{#4}}%
+ \caption@@@@@@declaresublistentry#1{c@\csname ext@#2\endcsname depth}}
+\@onlypreamble\caption@@@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@@@declaresublistentry[2]{
+ \ifx#1\relax
+ \def#1##1{%
+ \def\next{\@dottedtocline{##1}}%
+ \@ifundefined{#2}{}{%
+ \ifnum ##1>\@nameuse{#2}\relax
+ \let\next\@gobblefour
+ \fi}%
+ \next}%
+ \fi}
+\@onlypreamble\caption@@@@@@declaresublistentry
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subtypelist}
+% An \cs{@elt}-list containing the subtypes defined
+% with |\Declare|\x|Caption|\x|Sub|\x|Type|.
+% \begin{macrocode}
+\newcommand*\caption@subtypelist{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@For}
+% \changes{v1.1a}{2007/09/07}{This macro added}
+% \changes{v1.2}{2007/11/16}{Renamed from \cs{ForFloatingEnvironments} to \cs{caption@For}}
+% |\caption@For|\marg{elt-list}\marg{code with \#1}\\
+% |\caption@For*|\marg{elt-list}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\caption@For{\caption@withoptargs\caption@@For}
+%\@onlypreamble\caption@For
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@For[3]{%
+ \caption@AtBeginDocument#1{%
+ \def\@elt##1{#3}%
+ \@nameuse{caption@#2}%
+ \let\@elt\relax}}%
+%\@onlypreamble\caption@@For
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{subfig package adaptions}
+% \changes{v1.1}{2007/07/07}{Several adaptions to the \package{subfig} package added}
+% \changes{v1.4a}{2011/11/01}{Bugfix 11-11-01: Test for the subfig package revised}
+%
+% Since the \package{subfig} package is not maintained anymore,
+% we have to make several adaptions to \thispackage~\version{1.1} here.
+% Please note that we only support the version $1.3$ of the \package{subfig} package here.
+% So older versions do not work with this version of \thispackage, and newer
+% versions are expected to be adapted.
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\@tempa{2005/06/28 ver: 1.3 subfig package}%
+ \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa
+ \caption@InfoNoLine{subfig package v1.3 is loaded}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@setfloattype\@gobble
+ \let\@dottedxxxline\sf@NEW@dottedxxxline
+ \let\sf@subfloat\sf@NEW@subfloat
+% \end{macrocode}
+% \begin{macrocode}
+ \fi
+ \let\sf@NEW@dottedxxxline\@undefined
+ \let\sf@NEW@subfloat\@undefined}
+% \end{macrocode}
+% \begin{macrocode}
+\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{%
+ \begingroup
+ \caption@setfloattype{#1}%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub#1}%
+ \ifnum #3>\@nameuse{c@#2depth}\else
+ \@dottedtocline{\z@}{#4}{#5}{#6}{#7}%
+ \fi
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\def\sf@NEW@subfloat{%
+ \begingroup
+ \caption@setfloattype\@captype
+ \sf@ifpositiontop{%
+ \maincaptiontoptrue
+ }{%
+ \maincaptiontopfalse
+ }%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub\@captype}%
+ \let\sf@oldlabel=\label
+ \let\label=\subfloat@label
+ \ifmaincaptiontop\else
+ \advance\@nameuse{c@\@captype}\@ne
+ \fi
+ \refstepcounter{sub\@captype}%
+ \setcounter{sub\@captype @save}{\value{sub\@captype}}%
+ \@ifnextchar [% %] match left bracket
+ {\sf@@subfloat}%
+ {\sf@@subfloat[\@empty]}}
+% \end{macrocode}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \clearpage
+% \begin{thebibliography}{99}
+% \bibitem{Anne}
+% Anne Br\"uggemann-Klein:\\
+% \emph{Einf\"uhrung in die Dokumentverarbeitung},\\
+% B.G. Teubner, Stuttgart, 1989
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/hyperref/}%
+% {\emph{Hypertext marks in \LaTeX}},\\
+% November 12, 2007
+%
+% \bibitem{refcount}
+% Heiko Oberdiek:\\
+% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/oberdiek/refcount.pdf}%
+% {\emph{The refcount package}},\\
+% 2006/02/20
+%
+% \bibitem{threeparttable}
+% Donald Arseneau:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/misc/}%
+% {\emph{Three part tables: title, tabular environment, notes}},\\
+% 2003/06/13
+% \end{thebibliography}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.3/caption.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.3/caption.dtx
new file mode 100644
index 00000000000..721ca9c3719
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.3/caption.dtx
@@ -0,0 +1,4968 @@
+% \iffalse meta-comment
+%
+% This is file `caption.dtx'.
+%
+% Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files caption.ins, caption.dtx, caption2.dtx,
+% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx,
+% the derived files caption.sty, caption2.sty, caption3.sty,
+% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty,
+% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
+%
+% \fi
+% \CheckSum{3694}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{caption.drv}[2011/08/06 v3.3 Implementation of the caption package]
+\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+\makeatletter % make room for subsections like 2.16.14 in the TOC
+%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
+\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
+\makeatother
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage[debug]{caption}[2013/01/01]
+%
+\DeclareRobustCommand*\eTeX{\texorpdfstring
+ {\leavevmode\hbox{$\varepsilon$}-\TeX}%
+ {e-TeX}}
+\DeclareRobustCommand*\AmS{\texorpdfstring
+ {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
+ {AMS}}
+\DeclareRobustCommand*\KOMAScript{\texorpdfstring
+ {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
+ {KOMA-Script}}
+\DeclareRobustCommand*\NTG{NTG}
+\DeclareRobustCommand*\SmF{SMF}
+%
+\begin{document}
+ \DocInput{caption.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*\purerm[1]{\texorpdfstring{{\upshape\mdseries\rmfamily #1}}{#1}}
+% \newcommand*\puresf[1]{\texorpdfstring{{\upshape\mdseries\sffamily #1}}{#1}}
+% \newcommand*\purett[1]{\texorpdfstring{{\upshape\mdseries\ttfamily #1}}{#1}}
+% \let\class\puresf \let\package\puresf
+% \let\env\purett \let\opt\purett
+%
+% \def\thispackage{the \package{caption} package}
+% \def\Thispackage{The \package{caption} package}
+%
+% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+% \newcommand*\version[2][]{\textit{v#2}}
+%
+% \newcommand*\issue[1]{GitLab~\##1}
+%
+% \GetFileInfo{caption.drv}
+% \let\docdate\filedate
+% \GetFileInfo{caption.sty}
+%
+% \title{The Implementation of
+% \texorpdfstring{\thispackage\thanks{%^^A
+% This package has version number \fileversion, last revised \filedate.}}%^^A
+% {the caption package}}
+% \author{Axel Sommerfeldt\\
+% \url{https://gitlab.com/axelsommerfeldt/caption}}
+% \date{\docdate}
+% \maketitle
+%
+% \begin{abstract}
+% \Thispackage\ consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% \Thispackage\ redefines the \LaTeX\ commands
+% |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
+% |\caption@@make|, giving the user the possibility to control the look \& feel
+% of the captions from floating environments like |figure| and |table|.
+% Furthermore it does similar to the caption stuff coming from other packages
+% (like the \package{longtable} or \package{supertabular} package):
+% Mapping the appropriate internal commands (like |\LT@makecaption| or
+% |\ST@caption|) to the ones offered by the \package{caption3} kernel.
+% So you can think of \thispackage\ as a layer package, it
+% simply provides adaptation layers between the caption stuff coming from
+% \LaTeXe\ or packages, and the caption stuff offered by the
+% \package{caption3} kernel.
+% \end{abstract}
+%
+% \section*{User manuals}
+%
+% This document is describing the code implementation only. The user
+% documentation can be found in
+% \nopagebreak\begin{quote}
+% \begin{tabular}{ll}
+% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-eng.pdf}%
+% {\texttt{caption-eng.pdf}} & The English documentation \\
+% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-rus.pdf}%
+% {\texttt{caption-rus.pdf}} & The Russian documentation\footnotemark \\
+% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-deu.pdf}%
+% {\texttt{caption-deu.pdf}} & The German documentation \\
+% \end{tabular}
+% \footnotetext{Thanks a lot to Olga Lapko for this translation}
+% \end{quote}
+%
+% \StopEventually{}
+% \clearpage
+% \tableofcontents
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
+%
+% \changes{v1.0}{1994/10/27}{First release}
+% \changes{v1.1}{1994/11/03}{New option \texttt{centerlast}}
+% \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
+% \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
+% \changes{v1.4}{1995/01/30}{New option \texttt{nooneline}}
+% \changes{v1.4b}{1995/04/05}{Bugfix release}
+% \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v3.0d}{2004/11/28}{Split into two packages:
+% \package{caption} \& \package{caption3}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \let\subsubsection\subsection
+% \let\subsection\section
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \subsection{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption}[2019/09/01 v3.3d Customizing captions (AR)]
+% \end{macrocode}
+%
+% \subsection{Loading the kernel}
+%
+% \begin{macrocode}
+\RequirePackage{caption3}[=2019/09/01] % needs v1.8d or newer
+% \end{macrocode}
+%
+% \subsection{Check against incompatible document classes}
+%
+% \begin{macrocode}
+\caption@ifbool{documentclass}{}{%
+ \caption@WarningNoLine{%
+ Unsupported document class (or package) detected,\MessageBreak
+ usage of the caption package is not recommended}%
+ \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption}%
+}
+% \end{macrocode}
+%
+% \subsection{Check against incompatible packages}
+%
+% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
+% \begin{macrocode}
+\@ifpackageloaded{caption2}{%
+ \caption@Error{%
+ You can't use both, the (obsolete) caption2 *and*\MessageBreak
+ the (current) caption package}%
+ \endinput
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{ftcap} package added}
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{nonfloat} package added}
+% \changes{v3.1}{2007/06/18}{Check against incompatible \package{topcapt} package added}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}%
+ \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}%
+ \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}}
+% \end{macrocode}
+% \begin{macro}{\caption@DisablePositionOption}
+% \changes{v3.1g}{2008/03/20}{\texttt{position=b} added}
+% \changes{v3.1h}{2008/03/29}{%
+% Name changed from \cs{caption@IncompatiblePackage} to \cs{caption@DisablePositionOption};
+% moved from package to kernel; disables the `position' option now instead of issuing a warning}
+% |\caption@DisablePositionOption|\marg{package}\par
+% disables the `position' option.
+% \begin{macrocode}
+\newcommand*\caption@DisablePositionOption[1]{%
+ \caption@InfoNoLine{%
+ `#1' package detected; setting `position=b' for compatibility reasons}%
+ \caption@setposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{position}{%
+ \caption@Error{Usage of the `position' option is incompatible\MessageBreak
+ to the `#1' package}}}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@DisablePositionOption
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Declaration of options}
+%
+% \subsubsection{Options for figure and table}
+%
+% \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figureposition}{%
+ \captionsetup*[figure]{position=#1}}
+\@onlypreamble@key{caption}{figureposition}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{tableposition}{%
+ \captionsetup*[table]{position=#1}}
+\@onlypreamble@key{caption}{tableposition}
+% \end{macrocode}
+%
+% \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
+% \changes{v3.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written}
+% \changes{v3.1f}{2007/11/18}{Option \opt{name} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}}
+\@onlypreamble@key{caption}{figurename}
+\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}}
+\@onlypreamble@key{caption}{tablename}
+% \end{macrocode}
+%
+% \changes{v3.1g}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}}
+\@onlypreamble@key{caption}{listfigurename}
+\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}}
+\@onlypreamble@key{caption}{listtablename}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@SetName}
+% \changes{v3.1}{2007/07/04}{This macro added}
+% \changes{v3.1f}{2007/11/18}{After-preamble variant added}
+% \changes{v3.1g}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}}
+% \changes{v3.1i}{2008/08/02}{Bugfix: Works now without \cs{addto}, too}
+% \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package}
+% \changes{v3.2f}{2012/01/12}{Bugfix: Uses \cs{caption@NewFloat} now}
+% |\caption@SetName|\marg{float}\marg{name}
+% \begin{macrocode}
+\newcommand*\caption@SetName[2]{%
+ \caption@NewFloat{\newfloat@setname{#1}{#2}}}
+\@onlypreamble\caption@SetName
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{name}{\caption@setname\@captype{#1}}
+% \end{macrocode}
+% \begin{macro}{\caption@setname}
+% |\caption@setname|\marg{float}\marg{name}
+% \begin{macrocode}
+\newcommand*\caption@setname[2]{%
+ \@namedef{#1name}{#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1f}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added}
+% \changes{v3.1i}{2008/04/13}{Option \opt{within} added}
+% \changes{v3.1l}{2010/01/09}{The \opt{within} options are now available within the document, too}
+% \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined
+% floats declared with \cs{DeclareCaptionType}, too}
+%
+% \begin{macro}{\caption@DeclareWithinOption}
+% \changes{v3.1l}{2010/01/09}{This macro and its usage added}
+% |\caption@DeclareWithinOption|\marg{float}
+% declares the options \meta{float}\texttt{within} and \meta{float}\texttt{without},
+% e.g. \texttt{figurewithin} and \texttt{figurewithout}.
+% \begin{macrocode}
+\newcommand*\caption@DeclareWithinOption[1]{%
+ \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}%
+ \DeclareCaptionOptionNoValue{#1without}{\caption@Within{#1}{none}}}
+\@onlypreamble\caption@DeclareWithinOption
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\caption@DeclareWithinOption{figure}
+\caption@DeclareWithinOption{table}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{within}{%
+ \caption@NewFloat{\newfloatsetup{within=#1}}}
+\DeclareCaptionOptionNoValue{without}{%
+ \caption@NewFloat{\newfloatsetup{without}}}
+% \end{macrocode}
+% \begin{macro}{\caption@Within}
+% \changes{v3.1}{2007/12/21}{This macro added}
+% \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package}
+% \changes{v3.2f}{2012/01/12}{Bugfix: Uses \cs{caption@NewFloat} now}
+% |\caption@Within|\marg{float}\marg{value}
+% \begin{macrocode}
+\newcommand*\caption@Within[2]{%
+ \caption@NewFloat{\newfloat@setwithin{#1}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@NewFloat}
+% \changes{v3.2f}{2012/01/12}{This macro added}
+% |\caption@NewFloat|\marg{code}
+% loads the \package{newfloat} package and executes the given code afterwards.
+% Note: Since the \package{newfloat} package uses the crappy \package{keyval}
+% package, too, we need to save \& restore some macros here, otherwise this
+% recursion won't work properly.
+% {\itshape (TODO: Re-write \package{newfloat} so it uses \package{kvoptions} instead.)}
+% \begin{macrocode}
+\newcommand*\caption@NewFloat[1]{%
+ \let\KV@prefix@ORI\KV@prefix
+ \let\@tempc@ORI\@tempc
+ \caption@ifpackageloaded{newfloat}{#1}{}%
+ \let\@tempc\@tempc@ORI
+ \let\KV@prefix\KV@prefix@ORI}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Miscellaneous options}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{config}[caption]{%
+ \InputIfFileExists{#1.cfg}%
+ {\typeout{*** Local configuration file #1.cfg used ***}}%
+ {\caption@Warning{Configuration file #1.cfg not found}}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@selectlistentry}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% |\caption@selectlistentry|\marg{\purett{heading} or \purett{entry}}
+% \begin{macrocode}
+\newcommand*\caption@selectlistentry[1]{%
+ \caption@ifinlist{#1}{heading}{%
+ \let\caption@iflistheading\@firstoftwo
+ }{\caption@ifinlist{#1}{default,list-entry,entry}{%
+ \let\caption@iflistheading\@secondoftwo
+ }{%
+ \caption@Error{Undefined list-entry selection `#1'}%
+ }}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.3}{2012-03-25}{Option \opt{list-entry} added}
+% \begin{macrocode}
+\DeclareCaptionOption{list-entry}{\caption@selectlistentry{#1}}
+\captionsetup{list-entry=default}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setparboxrestore}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% |\caption@setparboxrestore|\marg{\purett{partial} or \purett{full}}
+% \begin{macrocode}
+\newcommand*\caption@setparboxrestore[1]{%
+ \caption@ifinlist{#1}{full}{%
+ \caption@setfullparboxrestore
+ }{\caption@ifinlist{#1}{default,light,partial}{%
+ \let\caption@parboxrestore\@secondoftwo
+ }{%
+ \caption@Error{Undefined parboxrestore `#1'}%
+ }}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setfullparboxrestore}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% |\caption@setfullparboxrestore|\par
+% This is an abbreviation for |\caption@setparboxrestore{full}|.
+% \begin{macrocode}
+\newcommand*\caption@setfullparboxrestore{%
+ \let\caption@parboxrestore\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.2}{2010/11/07}{Option \opt{parboxrestore} added}
+% \begin{macrocode}
+\DeclareCaptionOption{parboxrestore}{\caption@setparboxrestore{#1}}
+\captionsetup{parboxrestore=default}
+% \end{macrocode}
+%
+% \changes{v3.1f}{2007/11/28}{Option \opt{@minipage=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{@minipage}{%
+ \caption@ifinlist{#1}{auto,default}%
+ {\let\caption@if@minipage\@gobbletwo}%
+ {\caption@set@bool\caption@if@minipage{#1}}}
+\captionsetup{@minipage=default}
+% \end{macrocode}
+%
+% \subsubsection{caption v1.x compatibility options}
+% \changes{v3.1}{2007/07/21}{Option `compatibility' added}
+% \changes{v3.1}{2007/09/01}{caption v1.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v1.x$ compatibility options}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{compatibility}[1]{\caption@setbool{compatibility}{#1}}
+\@onlypreamble@key{caption}{compatibility}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{normal}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{isu}{%
+ \caption@setformat{hang}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{hang}{%
+ \caption@setformat{hang}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{center}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centering}}
+\DeclareCaptionOptionNoValue*{centerlast}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centerlast}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}}
+\DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}}
+\DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}}
+\DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}}
+\DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}}
+\DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{up}{\l@addto@macro\captionlabelfont\upshape}
+\DeclareCaptionOptionNoValue*{it}{\l@addto@macro\captionlabelfont\itshape}
+\DeclareCaptionOptionNoValue*{sl}{\l@addto@macro\captionlabelfont\slshape}
+\DeclareCaptionOptionNoValue*{sc}{\l@addto@macro\captionlabelfont\scshape}
+\DeclareCaptionOptionNoValue*{md}{\l@addto@macro\captionlabelfont\mdseries}
+\DeclareCaptionOptionNoValue*{bf}{\l@addto@macro\captionlabelfont\bfseries}
+\DeclareCaptionOptionNoValue*{rm}{\l@addto@macro\captionlabelfont\rmfamily}
+\DeclareCaptionOptionNoValue*{sf}{\l@addto@macro\captionlabelfont\sffamily}
+\DeclareCaptionOptionNoValue*{tt}{\l@addto@macro\captionlabelfont\ttfamily}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{nooneline}{\caption@setbool{slc}{0}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\caption@setbool{ruled}{0}
+\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}}
+% \end{macrocode}
+%
+% \subsubsection{caption2 v2.x compatibility options}
+% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
+% \changes{v3.1}{2007/09/01}{caption2 v2.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v2.x$ compatibility options}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{flushleft}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{raggedright}}
+\DeclareCaptionOptionNoValue*{flushright}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{raggedleft}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{oneline}{\caption@setbool{slc}{1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{%
+ \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}}
+% \end{macrocode}
+%
+% \subsubsection{Obsolete caption v3.0 options}
+% \changes{v3.1}{2007/05/07}{Package option \opt{caption} marked as obsolete,
+% gives error now}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{caption}{%
+ \caption@setbool{temp}{#1}%
+ \caption@ifbool{temp}{}{%
+ \caption@Error{%
+ The package option `caption=#1' is obsolete.\MessageBreak
+ Please pass this option to the subfig package instead\MessageBreak
+ and do *not* load the caption package anymore}}}
+% \end{macrocode}
+%
+% \subsubsection{fltpage package support options}
+%
+% \changes{v3.1}{2007/09/01}{Options `FPlist' \& `FPref' added}
+% With these options is controlled where the list-of entry and |\ref| resp.
+% |\pageref| or |\autoref| will link to.
+% Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent,
+% but compatible to the usual behaviour of the \package{fltpage} package.
+% \begin{macrocode}
+\DeclareCaptionOption{FPlist}[1]{\caption@setFPoption{list}{#1}}
+\DeclareCaptionOption{FPref}[1]{\caption@setFPoption{ref}{#1}}
+\@onlypreamble@key{caption}{FPlist}
+\@onlypreamble@key{caption}{FPref}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setFPoption[2]{%
+ \edef\caption@tempa{\@car#2\@nil}%
+ \caption@setbool{FP#1cap}{\if c\caption@tempa 1\else 0\fi}}
+\@onlypreamble\caption@setFPoption
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{FPlist=caption,FPref=figure}
+% \end{macrocode}
+%
+% \subsubsection{hyperref package support options}
+%
+% \changes{v3.1}{2007/06/21}{Options `hypcap' \& `hypcapspace' added}
+% With |hypcap=off| one can turn the \package{hypcap} support off
+% (default is |on|).
+% \begin{macrocode}
+\DeclareCaptionOption{hypcap}[1]{\caption@setbool{hypcap}{#1}}
+\DeclareCaptionOption{hypcapspace}{\def\caption@hypcapspace{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{hypcap=1,hypcapspace=.5\baselineskip}
+% \end{macrocode}
+%
+% \subsection{\AmS{} \& \SmF{} document classes support}
+% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ document classes support added}
+%
+% \begin{macrocode}
+\caption@ifamsclass{%
+ \caption@InfoNoLine{AMS or SMF document class}%
+% \end{macrocode}
+% \begin{macrocode}
+ \setlength\belowcaptionskip{0pt}% set to 12pt by AMS class
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{\KOMAScript{} document classes support}
+% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added}
+% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added}
+% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added}
+% \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised}
+% \changes{v3.1}{2007/03/17}{\KOMAScript\ compatibility options removed}
+% \changes{v3.1}{2007/04/05}{\KOMAScript\ compatibility revised \& enhanced}
+%
+% \begin{macrocode}
+\caption@ifkomaclass{%
+ \caption@InfoNoLine{KOMA-Script document class}%
+% \end{macrocode}
+%
+% Here we emulate the caption related commands and take over the caption
+% related settings from the \KOMAScript\ classes.
+%
+% \begin{macro}{\@tablecaptionabovetrue}
+% \begin{macro}{\@tablecaptionabovefalse}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \begin{macrocode}
+ \g@addto@macro\@tablecaptionabovetrue{\captionsetup*[table]{position=t}}
+ \g@addto@macro\@tablecaptionabovefalse{\captionsetup*[table]{position=b}}
+% \end{macrocode}
+% \begin{macrocode}
+ \if@tablecaptionabove
+ \@tablecaptionabovetrue
+ \else
+ \@tablecaptionabovefalse
+ \fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@figurecaptionabovetrue}
+% \begin{macro}{\@figurecaptionabovefalse}
+% \changes{v3.3}{2013/02/15}{Support of \cs{@figurecaptionabovetrue} added}
+% \begin{macrocode}
+ \caption@ifundefined\@figurecaptionabovetrue{}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \g@addto@macro\@figurecaptionabovetrue{\captionsetup*[figure]{position=t}}
+ \g@addto@macro\@figurecaptionabovefalse{\captionsetup*[figure]{position=b}}
+% \end{macrocode}
+% \begin{macrocode}
+ \if@figurecaptionabove
+ \@figurecaptionabovetrue
+ \else
+ \@figurecaptionabovefalse
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\onelinecaptionstrue}
+% \begin{macro}{\onelinecaptionsfalse}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \begin{macrocode}
+ \g@addto@macro\onelinecaptionstrue{\let\caption@ifslc\@firstoftwo}
+ \g@addto@macro\onelinecaptionsfalse{\let\caption@ifslc\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+ \ifonelinecaptions
+ \onelinecaptionstrue
+ \else
+ \onelinecaptionsfalse
+ \fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@captionabovetrue}
+% \begin{macro}{\@captionabovefalse}
+% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21:
+% \cs{let}\cs{caption@setposition}\cs{@gobble} added}
+% \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed}
+% \changes{v3.1}{2007/03/31}{We redefine \cs{captionabovetrue/false} now
+% instead of \cs{captionabove/below}}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \changes{v3.1k}{2009/10/09}{\opt{figureposition} and \opt{tableposition} will issue a warning now}
+% Please note that these are stronger than the \opt{position} setting, therefore we
+% override the options \opt{figureposition} and \opt{tableposition} to typeout a warning.
+% \begin{macrocode}
+ \g@addto@macro\@captionabovetrue{\let\caption@position\@firstoftwo}
+ \g@addto@macro\@captionabovefalse{\let\caption@position\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{figureposition}{%
+ \caption@WarningNoLine{Option `figureposition=#1' has no effect\MessageBreak
+ when used with a KOMA script document class}}
+ \DeclareCaptionOption{tableposition}{%
+ \caption@WarningNoLine{Option `tableposition=#1' has no effect\MessageBreak
+ when used with a KOMA script document class}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\setcapindent}
+% \begin{macrocode}
+ \let\caption@KOMA@setcapindent\@setcapindent
+ \renewcommand*\@setcapindent[1]{%
+ \caption@KOMA@setcapindent{#1}\caption@setcapindent}
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KOMA@@setcapindent\@@setcapindent
+ \renewcommand*\@@setcapindent[1]{%
+ \caption@KOMA@@setcapindent{#1}\caption@setcapindent}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapindent{%
+ \captionsetup{indent=\ifdim\cap@indent<\z@\z@\else\cap@indent\fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \caption@ifundefined\cap@indent{}{\caption@setcapindent}
+% \end{macrocode}
+%
+% \begin{macro}{\setcapwidth}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% \Note{The optional argument of \cs{setcapwidth} if not supported (yet),
+% so we issue a warning if used.
+% (Since this does not seem to have an negative effect when used
+% by the \texttt{captionbeside} environment, we suppress the warning here.)}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@setcapwidth
+ \csname\string\setcapwidth\endcsname
+ \@namedef{\string\setcapwidth}[#1]#2{%
+ \caption@KOMA@setcapwidth[{#1}]{#2}\caption@setcapwidth{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapwidth[1]{%
+ \ifx\\#1\\\else
+ \caption@ifundefined\cap@margin{}{%
+ \def\@tempa{captionbeside}%
+ \ifx\@tempa\@currenvir\else\caption@Warning{%
+ Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}%
+ \fi}%
+ \fi
+ \captionsetup{width=\cap@width}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \def\caption@tempa{\hsize}%
+ \ifx\caption@tempa\cap@width \else
+ \caption@setcapwidth{?}
+ \fi
+% \end{macrocode}
+%
+% \begin{macro}{\setcapmargin}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@setcapmargin
+ \csname\string\@setcapmargin\endcsname
+ \@namedef{\string\@setcapmargin}[#1]#2{%
+ \caption@KOMA@setcapmargin[{#1}]{#2}\caption@setcapmargin}
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@@setcapmargin
+ \csname\string\@@setcapmargin\endcsname
+ \@namedef{\string\@@setcapmargin}[#1]#2{%
+ \caption@KOMA@@setcapmargin[{#1}]{#2}\caption@setcapmargin}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapmargin{%
+ \begingroup
+ \let\onelinecaptionsfalse\relax
+ \def\@twoside{0}%
+ \def\if@twoside{\def\@twoside{1}\iffalse}%
+ \cap@margin
+ \def\@tempa{\endgroup}%
+ \ifx\cap@left\hfill\else\ifx\cap@right\hfill\else
+ \def\hspace##1##{\@firstofone}%
+ \edef\@tempa{\endgroup
+ \noexpand\captionsetup{%
+ twoside=\@twoside,slc=0,%
+ margin={\cap@left,\cap@right}}}%
+ \fi\fi
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \ifx\cap@margin\relax \else
+ \caption@setcapmargin
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{Processing of options}
+%
+% \changes{v3.0m}{2007/03/04}{Verbose option added}
+% \changes{v3.1}{2007/07/02}{Verbose option removed from package}
+%
+% \changes{v3.1}{2007/03/17}{We do not process global options anymore}
+% \begin{macrocode}
+\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}
+\caption@ProcessOptions*{caption}
+% \end{macrocode}
+%
+% \subsection{\cs{caption}, \cs{@caption}, and \cs{@makecaption}}
+%
+% \begin{macro}{\caption@ifflag}
+% \changes{v3.3}{2011/12/28}{This switch added}
+% \changes{v3.3}{2018/08/08}{Rewritten (and renamed) so a counter is used instead of a switch}
+% Since we support continued floats and sub-figures it's not an easy task
+% to manage the figure (and table) counter. (Especially since previous versions
+% of the caption package has proven that correcting a counter locally is not a good idea.)
+%
+% These three switches hold the
+% current status: |\caption@if|\-|flag{2}| is set if the caption was already
+% typeset (so the counter doesn't need to be incremented for sub-figures),
+% |\caption@if|\-|flag{4}| is set if there is already content which have
+% incremented the counter (so the counter doesn't need to be incremented
+% for the main caption, further sub-figures, and other stuff), and
+% |\caption@if|\-|flag{1}| is set if |\Continued|\-|Float| was given.
+%
+% In the past three boolean switches were used to store the flags, but since some
+% packages (like the \package{floatrow} and \package{tabu} package) try hard to keep
+% counter changes locally under certain circumstances, it seems a good idea to make
+% these flags a counter value, too.
+% \begin{macrocode}
+\newcounter{caption@flags}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifflag[1]{%
+ \@tempcnta\c@caption@flags
+ \divide\@tempcnta #1\relax
+ \ifodd\@tempcnta
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clrflags}
+% \changes{v3.3}{2018/08/08}{This macro added}
+% \begin{macro}{\caption@clrflag}
+% \changes{v3.3}{2013/04/14}{This macro added}
+% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
+% \begin{macro}{\caption@setflag}
+% \changes{v3.3}{2013/04/14}{This macro added}
+% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
+% Furthermore we introduce the macros \cs{caption@clrflag} and \cs{caption@setflag}
+% for clearing resp.~setting these flags.
+% \begin{macrocode}
+\newcommand*\caption@clrflags{%
+ \setcounter{caption@flags}\z@}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@clrflag[1]{%
+ \caption@ifflag{#1}{\caption@addtoflags{-#1}}{}}
+\newcommand*\caption@setflag[1]{%
+ \caption@ifflag{#1}{}{\caption@addtoflags{#1}}}
+\newcommand*\caption@addtoflags{%
+ \addtocounter{caption@flags}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@caption}
+% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
+% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
+% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% Here comes our definition of |\caption| and |\caption*|.
+% Beside the support of the starred variant this code was adapted to the
+% various packages we support.
+% We are using |\caption@dblarg| instead of |\@dblarg| so |\caption{}|
+% (with an empty arg.) will produce a list-of entry, but |\caption[]{}|
+% won't.
+% \begin{macrocode}
+\def\caption@caption{%
+ \caption@iftype
+ {\caption@checkgrouplevel\@empty\caption
+ \caption@star
+ {\caption@refstepcounter\@captype}%
+ {\caption@dblarg{\@caption\@captype}}}%
+ {\caption@Error{\noexpand\caption outside float}%
+ \caption@gobble}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@star}
+% \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}}
+% \changes{v3.2c}{2011/08/21}{\cs{global} removed}
+% A helper macro which processes the optional |*| after |\caption|.
+% \begin{macrocode}
+\newcommand*\caption@star[2]{%
+ \@ifstar{\caption@startrue#2[]}{#1#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@caption}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% \changes{v3.1f}{2007/11/28}{Bugfix: Handling of \texttt{@minipage} flag added}
+% \changes{v3.1f}{2007/11/28}{Support of option \opt{@minipage} added}
+% \changes{v3.1g}{2008/03/16}{Internal: Uses \cs{caption@prepareanchor} now}
+% \changes{v3.2d}{2011/10/21}{Adapted to the \textsf{memoir} document class}
+% \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved to \cs{caption@prepareanchor}}
+% \changes{v3.3}{2013/01/06}{Adapted to the \textsf{nag} package}
+% As above, our version has been adapted to the packages we support.
+% Additionally our code is nested by |\caption@beginex| \&
+% |\caption@end| instead of |\begingroup| \& |\endgroup|.
+% Furthermore we use |\caption@boxrestore| instead of |\@parboxrestore|
+% so this code also works correctly inside list-based environments
+% like |wide| \& |addmargin|. (This, and the fact that we use
+% |\linewidth| instead of |\hsize| inside |\@makecaption|, solves
+% \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2472}%^^A
+% {\LaTeX\ PR \texttt{latex/2472}}.)
+% \begin{macrocode}
+\long\def\caption@@caption#1[#2]#3{%
+% \end{macrocode}
+% \begin{macrocode}
+ \ifcaption@star \else
+ \caption@prepareanchor{#1}{#2}%
+ \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}%
+ \@nameuse{nag@hascaptiontrue}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \par
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@setfloatcapt{%
+ \caption@boxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \caption@normalsize
+ \ifcaption@star
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \@makecaption{\csname fnum@#1\endcsname}%
+ {\ignorespaces\caption@makeanchor{#3}}\par
+ \caption@if@minipage\@minipagetrue\@minipagefalse}%
+ \caption@end}
+% \end{macrocode}
+% \textsf{memoir} document class stuff:
+% \begin{macrocode}
+\providecommand\M@gettitle[1]{}
+\providecommand\memcaptioninfo[4]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareanchor}
+% \changes{v3.1g}{2008/03/16}{This macro added}
+% \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved from \cs{caption@@caption}}
+% \begin{macrocode}
+\newcommand*\caption@prepareanchor[2]{%
+ \caption@makecurrent{#1}{#2}%
+ \caption@ifhypcap\caption@@start\relax
+ \M@gettitle{#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecaption}
+% \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added}
+% |\@makecaption|\marg{label}\marg{text}\par
+% We do basically the same as the original code (from the standard
+% \LaTeX\ document classes), but take care of the |position=| setting
+% and use |\caption@@make| from the \package{caption} kernel to finally
+% typeset the caption.
+% \begin{macrocode}
+\long\def\caption@makecaption#1#2{%
+ \caption@make@above
+ \caption@@make{#1}{#2}%
+ \caption@make@below}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@make@above}
+% \begin{macro}{\caption@make@below}
+% \changes{v3.3a}{2019/04/02}{This macro added}
+% |\caption@make@above|\\
+% |\caption@make@below|\par
+% Typesets the stuff above resp.~below the caption, depending on |\caption@iftop|.
+% \begin{macrocode}
+\newcommand*\caption@make@above{%
+ \caption@iftop
+ \caption@belowskip
+ {\caption@rule\caption@aboveskip}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@make@below{%
+ \caption@iftop
+ {\caption@aboveskip\caption@rule}%
+ \caption@belowskip}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@aboveskip}
+% \begin{macro}{\caption@belowskip}
+% \changes{v3.3a}{2019/04/02}{This macro added}
+% |\caption@aboveskip|\\
+% |\caption@belowskip|\par
+% Typesets the skip above resp.~below the caption.
+% \begin{macrocode}
+\newcommand*\caption@aboveskip{%
+ \vskip\abovecaptionskip}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@belowskip{%
+ \vskip\belowcaptionskip}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@redefine}
+% \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now}
+% We only redefine |\caption| and |\@caption| if the current definitions
+% are well known, so documents written in the old (\package{caption}
+% package \version{1.x}) days (where |\caption| \& |\@caption| were not
+% redefined by us) will still compile fine.
+% For example the usage of the (now obsolete) \package{captcont} package,
+% which brings its own definition of |\caption*|, was quite common these days.
+% \begin{macrocode}
+\newcommand*\caption@redefine{}
+\g@addto@macro\caption@redefine{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@setbool{incompatible}{0}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
+ \def\caption{
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside figure or table}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % beamerbaselocalstructure.sty, Joseph Wright committed 4ac715c 2013-09-04
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside figure or table}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
+ \long\def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \let\@tempf\@caption
+ \expandafter\ifx\csname @float@c@\@captype\endcsname\relax\else
+ \expandafter\expandafter\let
+ \expandafter\@tempf\csname @float@c@\@captype\endcsname
+ \fi
+ \fi
+ \@dblarg{\@tempf\@captype}}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
+ % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
+ % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \H@refstepcounter\@captype
+ \@ifundefined{fst@\@captype}{%
+ \let\Hy@tempa\@caption
+ }{%
+ \let\Hy@tempa\Hy@float@caption
+ }%
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\Hy@tempa\@captype}}%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
+ \def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \H@refstepcounter\@captype
+ \let\Hy@tempa\@caption
+ \@ifundefined{float@caption}{%
+ }{%
+ \expandafter\ifx\csname @float@c@\@captype\endcsname\float@caption
+ \let\Hy@tempa\Hy@float@caption
+ \fi
+ }%
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\Hy@tempa\@captype}}%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\caption{%
+ % memhfixc.sty [2010/08/17 v1.15 nameref/hyperref package fixes for memoir class]
+ % \let\m@moldhypcaption\caption
+ \long\def\caption{\donemaincaptiontrue\m@moldhypcaption}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@IfCheckCommand{}{%
+ \caption@InfoNoLine{%
+ Incompatible package detected (regarding \string\caption).\MessageBreak
+ \string\caption\space=\space\meaning\caption}%
+ \caption@setbool{incompatible}{1}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
+ \long\def\@caption#1[#2]#3{%
+ \par
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
+ \long\def\@caption#1[#2]#3{% second argument ignored
+ \par\nobreak
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \beamer@makecaption{#1}{\ignorespaces #3}\par\nobreak
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % memhfixc.sty [2010/08/17 v1.15 nameref/hyperref package fixes for memoir class]
+ \long\def\@caption#1[#2]#3{%
+ \MNR@old@caption{#1}[{#2}]{#3}%
+ \def\@currentlabelname{#2}%
+ \M@gettitle{#2}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % arabicore.sty [2006/01/01 v1.0 Arabi Core switching commands (may still change)]
+ \long\def\@caption#1[#2]#3{%
+ \par
+ \addtocontents{\csname ext@#1\endcsname}{\xstring\select@language{\main@Arabi@language}}%
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}{\ignorespaces \if@rl{\textRL{#2}}\else\textLR{#2}\fi}}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces \if@rl{\textRL{#3}}\else\textLR{#3}\fi}\par
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % rlbabel.def [2005/03/30 v2.3h Right-to-Left support from the babel system Hebrew language support from the babel system]
+ \long\def\@caption#1[#2]#3{%
+ \par
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}%
+ {\ignorespaces #2}}%
+ \def\@fignm{figure}
+ \ifx#1\@fignm\addcontentsline{fol}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}%
+ {\ignorespaces #2}}\fi%
+ \def\@tblnm{table}
+ \ifx#1\@tblnm\addcontentsline{tol}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}%
+ {\ignorespaces #2}}\fi%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system]
+ \long\def\@caption#1[#2]#3{%
+ \csname par\endcsname
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname.}{\ignorespaces #2}}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}%
+ {\ignorespaces #3}\csname par\endcsname
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+% \caption@CheckCommand\float@caption{%
+% % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
+% \long\def\float@caption#1[#2]#3{%
+% \addcontentsline{\@nameuse{ext@#1}}{#1}%
+% {\protect\numberline{\@nameuse{the#1}}{\ignorespaces #2}}
+% \global\setbox\@floatcapt\vbox\bgroup\@parboxrestore
+% \normalsize\@fs@capt{\@nameuse{fnum@#1}}{\ignorespaces #3}%
+% \@ifnextchar[{\float@ccon}{\egroup}}%
+% \long\def\float@ccon[#1]{#1\par\egroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \hyper@makecurrent{\@captype}%
+ \def\@currentlabelname{#2}%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \hyper@@anchor{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
+ \fi
+ }%
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
+ % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
+ % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\let\@currentHref\hc@currentHref
+ \else
+ \hyper@makecurrent{\@captype}%
+ \fi
+ \def\@currentlabelname{#2}%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\@capstartfalse
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
+ \else
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \hyper@@anchor{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
+ \fi
+ }%
+ \fi
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2009/11/27 v6.79k Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\let\@currentHref\hc@currentHref
+ \else
+ \hyper@makecurrent{\@captype}%
+ \fi
+ \def\@currentlabelname{#2}%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\@capstartfalse
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
+ \else
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
+ }%
+ #3%
+ \fi
+ }%
+ \fi
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % hyperref.sty [2009/12/09 v6.79m Hypertext links for LaTeX]
+ % hyperref.sty [2009/12/28 v6.79z Hypertext links for LaTeX]
+ \long\def\@caption#1[#2]#3{%
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\let\@currentHref\hc@currentHref
+ \else
+ \hyper@makecurrent{\@captype}%
+ \fi
+ \@ifundefined{NR@gettitle}{%
+ \def\@currentlabelname{#2}%
+ }{%
+ \NR@gettitle{#2}%
+ }%
+ \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
+ \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
+ }%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \expandafter\ifx\csname if@capstart\expandafter\endcsname
+ \csname iftrue\endcsname
+ \global\@capstartfalse
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
+ \else
+ \@makecaption{\csname fnum@#1\endcsname}{%
+ \ignorespaces
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{%
+ \@currentHref
+ }{\relax}%
+ }%
+ #3%
+ \fi
+ }%
+ \fi
+ \par
+ \endgroup
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % nameref.sty [2006/12/27 v2.28 Cross-referencing by name of section]
+ \long\def\@caption#1[#2]{%
+ \def\@currentlabelname{#2}%
+ \NR@@caption{#1}[{#2}]%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % nameref.sty [2009/11/27 v2.32 Cross-referencing by name of section]
+ \long\def\@caption#1[#2]{%
+ \NR@gettitle{#2}%
+ \NR@@caption{#1}[{#2}]%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % subfigure.sty [2002/07/30 v2.1.4 subfigure package]
+ \long\def\@caption#1[#2]#3{%
+ \@ifundefined{if#1topcap}%
+ {\subfig@oldcaption{#1}[{#2}]{#3}}%
+ {\@nameuse{if#1topcap}%
+ \@listsubcaptions{#1}%
+ \subfig@oldcaption{#1}[{#2}]{#3}%
+ \else
+ \subfig@oldcaption{#1}[{#2}]{#3}%
+ \@listsubcaptions{#1}%
+ \fi}}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % subfig.sty [2005/06/28 ver: 1.3 subfig package]
+ \def\@caption{\caption@}%
+% \long\def\caption@#1[#2]#3{%
+% \@ifundefined{caption@setfloattype}%
+% \caption@settype
+% \caption@setfloattype
+% \@captype
+% \sf@ifpositiontop{%
+% \@listsubcaptions{#1}%
+% \sf@old@caption{#1}[{#2}]{#3}%
+% }{%
+% \sf@old@caption{#1}[{#2}]{#3}%
+% \@listsubcaptions{#1}%
+% }}%
+ }%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % chkfloat.sty [2012/08/19 v0.1 chkfloat: check for moved floats]
+ \def\@caption#1[#2]#3{\chkfloat@caption{#1}[#2]{#3}%
+ \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % chkfloat.sty [20??/??/?? v0.? chkfloat: check for moved floats]
+ \def\@caption#1[#2]#3{\chkfloat@caption{#1}[{#2}]{#3}%
+ \chkfloat@addcontentsline{#1}{#2}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@IfCheckCommand{}{%
+ \caption@InfoNoLine{%
+ Incompatible package detected (regarding \string\@caption).\MessageBreak
+ \string\@caption\space=\space\meaning\@caption}%
+ \caption@setbool{incompatible}{1}}%
+% \end{macrocode}
+%
+% The option |compatibility=| will override the compatibility mode.
+% \begin{macrocode}
+ \caption@ifundefined\caption@ifcompatibility
+ {\let\caption@ifcompatibility\caption@ifincompatible
+ \let\caption@tempa\caption@WarningNoLine}%
+ {\let\caption@tempa\@gobble}% suppress warning
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@ifcompatibility{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@tempa{%
+ \noexpand\caption will not be redefined since it's already\MessageBreak
+ redefined by a document class or package which is\MessageBreak
+ unknown to the caption package}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{}%
+% \end{macrocode}
+%
+% |\ContinuedFloat| is not supported in compatibility mode.
+% \begin{macrocode}
+ \renewcommand*\caption@ContinuedFloatX[1]{%
+ \caption@Error{Not available in compatibility mode}}%
+% \end{macrocode}
+%
+% |\caption@start| is not supported in compatibility mode.
+% \begin{macrocode}
+ \caption@AtBeginDocument*{%
+ \let\caption@start\relax
+ \caption@ifundefined\caption@ORI@capstart{}{%
+ \caption@Debug{%
+ Restore hypcap definition of \string\capstart\@gobble}%
+ \let\capstart\caption@ORI@capstart}%
+ }%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@star}
+% We redefine |\caption@star| here so it does not make any harm.
+% \begin{macrocode}
+ \renewcommand*\caption@star[2]{#1#2}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@ifincompatible{%
+ \caption@WarningNoLine{%
+ Forced redefinition of \noexpand\caption since the\MessageBreak
+ unsupported(!) package option `compatibility=false'\MessageBreak
+ was given}%
+ }{}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption}
+% \begin{macro}{\@caption}
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{%
+ \let\caption\caption@caption
+ \let\@caption\caption@@caption}%
+ \caption@redefine
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@AtBeginDocument*{%
+ \let\caption@ORI@capstart\@undefined}%
+% \end{macrocode}
+%
+% \begin{macro}{\@xfloat}
+% \changes{v3.1}{2007/05/09}{This re-definition added}
+% \changes{v3.1b}{2007/09/22}{Will now be redefined in compatibility mode, too}
+% We redefine |\@xfloat| so inside floating environments our
+% type-specific options will be used, a \package{hyperref}
+% anchor will be set etc.
+% \begin{macrocode}
+ \let\caption@ORI@xfloat\@xfloat
+ \def\@xfloat#1[#2]{%
+ \caption@ORI@xfloat{#1}[#2]%
+ \caption@settype{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% Some packages (like the \package{hyperref} package for example) redefines
+% |\caption| and |\@caption|, too.
+% So we have to use |\AtBeginDocument| here, so we can make sure
+% our definition is the one which will be valid at last.
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@redefine}
+% \end{macrocode}
+%
+% \begin{macro}{\@makecaption}
+% \begin{macrocode}
+\let\@makecaption\caption@makecaption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phantomcaption}
+% \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added}
+% |\phantomcaption|\par
+% Use this one for figures with subcaptions but without main caption.
+% \begin{macrocode}
+\newcommand\phantomcaption{%
+ \caption@iftype
+ {\caption@refstepcounter\@captype}%
+ {\caption@Error{\noexpand\phantomcaption outside float}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{captionof}}
+%
+% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
+% \changes{v3.1}{2007/06/25}{Option \opt{type*=} added}
+% \changes{v3.1f}{2007/11/16}{Option \opt{subtype} \& \opt{subtype*} added}
+% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Option \opt{type=} uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{type}{\setcaptiontype{#1}}%
+ \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOptionNoValue{subtype}{\setcaptionsubtype\relax}%
+ \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \emph{Important Note:}
+% Like |\captionof| the option |type=| should only be used inside a
+% group, box, or environment and does not check if the argument is a valid
+% floating environment or not.
+%
+% \begin{macro}{\setcaptiontype}
+% \changes{v3.2}{2010/10/24}{This macro added}
+% Like |\captionsetup{type=xxx}|, but also works if \cs{captionsetup} was redefined.
+% \begin{macrocode}
+\newcommand\setcaptiontype{%
+ \caption@boxrestore@mini
+ \caption@settype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionsubtype}
+% \changes{v3.2a}{2011/08/15}{This macro added}
+% Same, but sets the sub-type.
+% \begin{macrocode}
+\newcommand\setcaptionsubtype{%
+ \caption@iftype
+ \caption@setsubtype
+ {\caption@Error{\noexpand\setcaptionsubtype outside float}}}%
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@setsubtype{%
+ \@ifstar
+ {\caption@@settype{sub}*{sub\@captype}}%
+ {\caption@@settype{sub}{sub\@captype}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@settype}
+% \changes{v3.1}{2007/05/09}{This macro added}
+% \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added}
+% \changes{v3.1d}{2007/10/23}{Error message for \cs{caption@checkgrouplevel} revised}
+% \changes{v3.1f}{2007/11/16}{\cs{caption@setsubtype} added}
+% \changes{v3.1f}{2007/12/03}{Crappy \cs{caption@iftypewarning} replaced}
+% \changes{v3.1g}{2008/01/12}{Usage of \cs{ifcaptionsetup@star} added}
+% \changes{v3.2}{2010/10/26}{Error message moved from here to \cs{caption@refstepcounter}}
+% \changes{v3.3}{2011/12/28}{Resetting of \cs{ifcaption@caption} and \cs{ifcaption@subcaption} added}
+% |\caption@settype*|\marg{type}\par
+% sets |\@captype| and executes the options associated with it
+% (using |\caption@set|\-|options|).
+% Furthermore we check |\current|\-|group|\-|level| (if avail),
+% redefine |\@currentlabel| so a |\label| before |\caption| will result
+% in a hint instead of a wrong reference, and
+% use the macro |\caption@|(|sub|)|type|\-|hook| (which will be used by our
+% \package{float} package support).\par
+% The non-starred version sets a \package{hyperref} anchor additionally
+% (if |hypcap=|\-|true| and the \package{hypcap} package is not loaded).
+% \begin{macrocode}
+\newcommand*\caption@settype{%
+ \caption@clrflags
+ \caption@set@type}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@type{%
+ \caption@@settype{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@settype[1]{%
+ \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@settype[3]{%
+% #1 = "" or "sub"
+% #2 = \@firstoftwo in star form, \@secondoftwo otherwise
+% #3 = <type>, e.g. "figure" or "table"
+ \caption@Debug{#1type=#3}%
+ \caption@checkgrouplevel{#1}{%
+ \captionsetup{#1type#2*\@empty=...}#2{ or
+ \@backslashchar#1captionof}{}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@tempa{#3}%
+ \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else
+ \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi
+ \fi
+ \expandafter\let\csname @#1captype\endcsname\caption@tempa
+% \end{macrocode}
+% \begin{macrocode}
+ \@nameuse{caption@#1typehook}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setoptions{#3}%
+ \ifx\caption@opt\relax
+ \@nameundef{caption@#1type@warning}%
+ \else
+ \@namedef{caption@#1type@warning}{\caption@Warning{%
+ The #1caption type was already set to
+ `\csname @#1captype\endcsname'\MessageBreak}}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ #2{}{%
+ \let\@currentlabel\caption@undefinedlabel
+% \let\@currentHlabel\@undefined
+ \ifx\caption@x@label\@undefined
+ \let\caption@x@label\label
+ \let\label\caption@xlabel
+ \fi
+ \caption@start}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@typehook}
+% Hook which will be used inside |\caption@set|\-|type|.
+% It will be extended later on, e.g.~by our \package{float} package
+% support.
+% \begin{macrocode}
+\newcommand*\caption@typehook{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftype}
+% \changes{v3.1}{2007/04/11}{This macro and its usage added}
+% Since we often need to check if |\@captype| is defined (means: we
+% are inside a floating environment) this helper macro was introduced.
+% \begin{macrocode}
+\newcommand*\caption@iftype{%
+ \caption@ifundefined\@captype\@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checkgrouplevel}
+% \changes{v3.1}{2007/07/15}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)}
+% \changes{v3.3}{2013/04/21}{Uses \cs{caption@ifeTeX} now}
+% Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done
+% inside a group or not -- in the latter case a warning message will
+% be issued. (needs \eTeX)
+% \begin{macrocode}
+\caption@ifeTeX{%
+ \newcommand*\caption@checkgrouplevel[2]{%
+ \@ifundefined{#1caption@grouplevel}{%
+ \caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}%
+ \ifnum\currentgrouplevel>\caption@grouplevel\relax
+ \expandafter\edef\csname #1caption@grouplevel\endcsname{%
+ \the\currentgrouplevel}%
+ \else
+ \caption@Warning{\string#2\MessageBreak outside box or environment}%
+ \fi
+ }{}}%
+}{%
+ \let\caption@checkgrouplevel\@gobbletwo
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@undefinedlabel}
+% \changes{v3.1}{2007/07/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/22}{Contents changed to \texttt{??}}
+% \changes{v3.1i}{2008/04/13}{Contents changed to \cs{caption@xref}(\ldots)}
+% \changes{v3.1k}{2009/03/30}{Bugfix 08-12-08: \cs{caption@xref} is robust now}
+% \changes{v3.2c}{2011/09/13}{Text changed from `before' to `without proper'}
+% \changes{v3.3}{2016/02/21}{Text changed from `without proper \cs{caption}' to `without proper reference'}
+% This label will be used for |\currentlabel| inside (floating) environments
+% as default. (see above)
+% \iffalse\Note{All commands used have to be robust here.}\fi
+% \begin{macrocode}
+\newcommand*\caption@undefinedlabel{%
+ \protect\caption@xref{\caption@labelname}{\on@line}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareRobustCommand*\caption@xref[2]{%
+ \caption@WarningNoLine{\noexpand\label without proper reference#2}%
+ \@setref\relax\@undefined{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@labelname{??}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@xlabel}
+% \changes{v3.1b}{2007/09/22}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/11}{Revised}
+% \changes{v3.1i}{2008/04/13}{Bugfix: \cs{pageref} should always work now}
+% \changes{v3.2c}{2011/08/19}{Works with optional arguments now, too}
+% The new code of |\label| inside floating environments.
+% |\label| will be redefined using |\caption@withoptargs|, so
+% |#1| are the optional arguments (if any), and
+% |#2| is the mandatory argument here.
+% \begin{macrocode}
+\newcommand*\caption@xlabel{%
+ \caption@withoptargs\caption@@xlabel}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@xlabel[2]{%
+ \caption@@@xlabel
+ \def\caption@labelname{#2}%
+ \caption@x@label#1{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@xlabel{%
+ \global\let\caption@@@xlabel\@empty
+ \@bsphack
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@xref[2]{%
+ \string\@setref\string\relax\string\@undefined{\string##1}}}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionof}
+% \changes{v3.1}{2007/05/09}{Uses \cs{caption@settype} instead of \cs{def}\cs{@captype}}
+% \changes{v3.1c}{2007/09/22}{Bugfix: Redefinition of \cs{caption@setfloatcapt} removed}
+% \changes{v3.1e}{2007/10/30}{Better compatibility: Will be defined with \cs{AtBeginDocument} now}
+% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
+% |\captionof|\marg{type}\oarg{lst\_entry}\marg{heading}\\
+% |\captionof*|\oarg{lst\_entry}\marg{heading}\par
+% \Note{This will be defined with \cs{AtBeginDocument} so
+% \cs{usepackage}\csmarg{caption,capt-of} will still work.
+% (Compatibility to \version{1.x})}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\captionof{\caption@teststar\caption@of{\caption*}\caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@of[2]{\setcaptiontype*{#2}#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{captionlistentry}}
+%
+% \begin{macro}{\captionlistentry}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v3.1g}{2008/01/20}{Starred variant added}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% |\captionlistentry|\oarg{float type}\marg{list entry}\\
+% |\captionlistentry*|\oarg{float type}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\captionlistentry{%
+ \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionlistentry[1]{%
+ \@testopt{\caption@listentry{#1}}\@captype}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@listentry#1[#2]#3{%
+ \@bsphack
+ #1{\caption@gettitle{#3}}%
+ {\caption@refstepcounter{#2}%
+ \caption@makecurrent{#2}{#3}}%
+ \caption@addcontentsline{#2}{#3}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{captionbox}}
+%
+% \begin{macro}{\captionbox}
+% \changes{v3.2}{2010/12/17}{This macro added}
+% \changes{v3.2a}{2011/08/16}{\cs{captionsetup} replaces with \cs{captionbox@settype} and \cs{caption@setposition}}
+% \changes{v3.3}{2012/04/09}{Adapted to revised version of \cs{caption@withoptargs}}
+% \changes{v3.3}{2017/03/19}{When used with fixed witdh the content will not be hboxed anymore}
+% \changes{v3.3c}{2019/09/01}{Adapted so it could be used by \cs{subfloat} offered by \package{subcaption}}
+% A |\parbox| with contents and caption, separated by an invisible |\hrule|.
+% \begin{macrocode}
+\newcommand*\captionbox{%
+ \caption@withoptargs{\caption@ibox\@gobble}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@ibox[3]{%
+ \kernel@ifnextchar[%]
+ {\caption@iibox{#1}{#2}{#3}}%
+ {\caption@iibox@{#1}{#2}{#3}}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iibox#1#2#3[#4]{%
+ \@testopt{\caption@iiibox{#1}{#2}{#3}[{#4}]}\captionbox@hj@default}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iibox@#1#2#3#4{%
+ \setbox\@tempboxa\hbox{#4}%
+ \caption@iiibox{#1}{#2}{#3}[\wd\@tempboxa][\captionbox@hj@default]{\unhbox\@tempboxa}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iiibox#1{%
+ \caption@iiiibox{#1}\vbox\vtop}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iiiibox#1#2#3#4#5[#6][#7]#8{%
+ \begingroup
+ #1*% set \caption@position
+ \caption@iftop{%
+ \endgroup
+ \parbox[t]{#6}{%
+ #1\relax
+ \caption@setposition t%
+ #2{\caption#4{#5}}%
+ \captionbox@hrule
+ \csname caption@hj@#7\endcsname
+ #8}%
+ }{%
+ \endgroup
+ \parbox[b]{#6}{%
+ #1\relax
+ \caption@setposition b%
+ \csname caption@hj@#7\endcsname
+ #8%
+ \captionbox@hrule
+ #3{\caption#4{#5}}}%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\captionbox@hj@default{c}
+\newcommand*\captionbox@hrule{\hrule\@height\z@\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@hj@c{\centering}
+\providecommand*\caption@hj@l{\raggedright}
+\providecommand*\caption@hj@r{\raggedleft}
+\providecommand*\caption@hj@s{}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{ContinuedFloat}}
+%
+% \begin{macro}{\ContinuedFloat}
+% \changes{v3.0i}{2005/11/12}{Optional argument added}
+% \changes{v3.0g}{2005/06/28}{Bugfix: \cs{newcounter} replaced by \cs{newcount}}
+% \changes{v3.1}{2007/07/02}{Format of \package{hyperref} extension changed}
+% \changes{v3.1}{2007/07/07}{\cs{caption@setoptions} added}
+% \changes{v3.1g}{2008/01/29}{Starred variant added}
+% \changes{v3.2f}{2011/12/17}{Undocumented optional argument removed}
+% \changes{v3.3}{2011/12/28}{Uses \cs{ifcaption@ContinuedFloat} now}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@restorecounters} added}
+% \changes{v3.3}{2013/12/16}{Bugfix: Does not use \cs{caption@ContinuedFloat} anymore since this breaks \cs{ContinuedFloat} offered by the \package{subfig} package}
+% |\ContinuedFloat|\\
+% |\ContinuedFloat*|\par
+% This mainly sets the appropriate flag, increments the
+% continuation counter, and executes the given options.
+% Furthermore we set |\caption@reset|\-|Continued|\-|Float| to |\@gobble| so the
+% continuation counter will not be reset to zero inside |\caption@ref|\-|step|\-|counter|.\par
+% When the \package{hyperref} package is used we have the problem
+% that the usage of |\Continued|\-|Float| will create duplicate
+% hyper links -- |\@current|\-|Href| will be the same for the main float and
+% the continued ones. So we have to make sure unique labels and references
+% will be created each time. We do this by extending |\the|\-|H|\-|figure| and
+% |\the|\-|H|\-|table|, so for continued floats the scheme
+% \begin{quote}\meta{type}|.|\meta{type \#}|\alph{|\meta{continued \#}|}|\end{quote}
+% will be used instead of
+% \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
+% \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
+% \Note{This does not help if the \package{hyperref} package option
+% \texttt{naturalnames=true} is set.}
+% \begin{macrocode}
+\def\ContinuedFloat{%
+ \caption@iftype
+ {\caption@ContinuedFloatX\@captype}%
+ {\caption@Error{\noexpand\ContinuedFloat outside float}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ContinuedFloatX[1]{%
+ \@ifstar
+ {\caption@@refstepcounter\@captype
+ \caption@@ContinuedFloat{#1}}%
+ {\caption@Continued@Float{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@Continued@Float[1]{%
+ \edef\caption@tempa{#1}%
+ \ifx\caption@tempa\caption@CFtype
+ \caption@restorecounters
+ \caption@@ContinuedFloat{#1}%
+ \else
+ \caption@Error{Continued `#1' after `\caption@CFtype'}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@ContinuedFloat{%
+ \caption@setflag1% ContinuedFloat
+ \caption@@@ContinuedFloat}
+\newcommand*\caption@@@ContinuedFloat{%
+ \stepcounter{ContinuedFloat}%
+ \caption@@@@ContinuedFloat}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@ContinuedFloat[1]{%
+ \caption@setoptions{ContinuedFloat}%
+ \caption@setoptions{continued#1}%
+ \expandafter\l@addto@macro\csname the#1\endcsname\theContinuedFloat
+ \@ifundefined{theH#1}{}{%
+ \expandafter\l@addto@macro\csname theH#1\endcsname{%
+ \@alph\c@ContinuedFloat}}%
+ \let\caption@@@@ContinuedFloat\@gobble}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@CFtype{??}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\theContinuedFloat}
+% This one is preset to \cs{@empty}, so usually the continuation counter is not
+% included in the caption label or references.
+% \begin{macrocode}
+\newcounter{ContinuedFloat}
+\let\theContinuedFloat\@empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ContinuedFloat}
+% \changes{v3.0f}{2005/06/11}{This macro added}
+% \changes{v3.3}{2013/12/16}{Bugfix: Revised and defined with \cs{def} instead of \cs{newcommand}}
+% |\caption@ContinuedFloat|\marg{type}\par
+% This one is used by \cs{ContinuedFloat} offered by the \package{subfig} package.
+% \begin{macrocode}
+\def\caption@ContinuedFloat{%
+ \let\caption@resetContinuedFloat\@gobble
+ \caption@@@ContinuedFloat}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetContinuedFloat}
+% \changes{v3.2f}{2011/12/17}{Redefinition of \cs{ContinuedFloat} added}
+% |\caption@resetContinuedFloat|\marg{type}\par
+% If a continuation counter is defined, we reset it.
+% (This one will be called inside |\@caption|.)
+% \begin{macrocode}
+\newcommand*\caption@resetContinuedFloat[1]{%
+ \xdef\caption@CFtype{#1}%
+ \@stpelt{ContinuedFloat}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\donemaincaptionfalse}
+% Since the \class{memoir} document class resets the sub-caption
+% counter at |\@float|, right after |\done|\-|main|\-|caption|\-|false|,
+% we save all sub-caption counters at |\done|\-|main|\-|caption|\-|false|
+% so we can restore them using |\caption@restore|\-|counters|
+% inside |\Continued|\-|Float|.
+% \begin{macrocode}
+\caption@ifundefined\donemaincaptionfalse{}{%
+ \g@addto@macro\donemaincaptionfalse\caption@savesubcounters}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Internal helpers}
+%
+% \begin{macro}{\caption@refstepcounter}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% \changes{v3.2}{2010/10/26}{Error message moved from \cs{caption@@@settype} to here}
+% \changes{v3.2c}{2011/09/04}{Support of \cs{donemaincaptiontrue} from \textsf{memoir} document class added}
+% \changes{v3.3}{2011/12/28}{Usage of \cs{ifcaption@caption}, \cs{ifcaption@subcaption}, and \cs{ifcaption@ContinuedFloat} added}
+% Increments the float (i.e. |figure| or |table|) counter,
+% resets the continuation counter, and redefines itself to |\@gobble|.
+% \begin{macrocode}
+\newcommand*\caption@refstepcounter[1]{%
+ \@ifundefined{c@#1}%
+ {\caption@Error{No float type '#1' defined}}%
+ {\caption@ref@stepcounter{#1}%
+% \end{macrocode}
+% Set flag if this part of the figure (or table) contains a caption now.
+% (If |\caption@if|\-|top| is not set, |\caption| is at the bottom of this part,
+% therefore ending this part, so we set the flag to |false| in this case.)
+% \begin{macrocode}
+ \caption@fixposition
+ \caption@iftop\caption@setflag\caption@clrflag2% caption
+% \end{macrocode}
+% This part does not contain content (like sub-figures) yet,
+% so we set |\if|\-|caption@sub|\-|caption| to |false|.
+% \begin{macrocode}
+ \caption@clrflag4% subcaption
+% \end{macrocode}
+% Support of the \textsf{memoir} document class.
+% \begin{macrocode}
+ \@nameuse{donemaincaptiontrue}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ref@stepcounter{%
+ \caption@ifflag1{% ContinuedFloat
+ \let\caption@tempa\caption@@refcounter
+ \caption@clrflag1% ContinuedFloat
+ }{%
+ \let\caption@tempa\caption@@refstepcounter
+ \caption@ifflag2{}{% caption
+ \caption@ifflag4{% subcaption
+% Counter was already incremented by content, so we suppress \stepcounter{#1} here
+ \let\caption@tempa\caption@@refcounter
+ }{}%
+ }%
+ }%
+ \caption@tempa}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@refcounter[1]{%
+ \let\caption@stepcounter@ORI\stepcounter
+ \def\stepcounter##1{%
+ \def\caption@tempa{#1}%
+ \def\caption@tempb{##1}%
+ \ifx\caption@tempa\caption@tempb \else
+ \caption@stepcounter@ORI{##1}%
+ \fi}%
+ \caption@@@refstepcounter{#1}%
+ \let\stepcounter\caption@stepcounter@ORI}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@refstepcounter[1]{%
+ \caption@prepare@stepcounter{#1}{ref}%
+ \caption@@@refstepcounter{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@stepcounter[1]{%
+ \caption@prepare@stepcounter{#1}{}%
+ \caption@@@stepcounter{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@prepare@stepcounter[2]{%
+ \caption@addsubcontentslines{#2stepcounter}%
+ \caption@resetContinuedFloat{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@refstepcounter{\refstepcounter}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@stepcounter{\stepcounter}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@dblarg}
+% \changes{v3.1}{2007/02/05}{This macro added}
+% \changes{v3.1f}{2007/12/06}{Bugfix 07-12-06: Changed so it works without \cs{kernel@ifnextchar}
+% (which was introduced in \LaTeXe\ 2004/01/23), too}
+% \changes{v3.3}{2012/03/25}{Support of option \opt{list-entry} added}
+% A |\relax| was added compared to |\@dblarg| so |\caption{}| will be
+% expanded to |\caption[\relax]{}| (and not to |\caption[]{}|).
+% Furthermore support for option \opt{list-entry} was added.
+% \begin{macrocode}
+\@ifundefined{kernel@ifnextchar}{\let\kernel@ifnextchar\@ifnextchar}{}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@dblarg[1]{%
+ \kernel@ifnextchar[{\caption@ydblarg{#1}}{\caption@xdblarg{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@xdblarg[2]{%
+ #1[{#2\relax}]{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@ydblarg#1[#2]#3{%
+ \caption@iflistheading{#1[{#3}]{#3}}{#1[{#2}]{#3}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@begin}
+% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed to \cs{caption@setfloattype}}
+% \changes{v3.0e}{2005/04/12}{Check for default label format added}
+% \changes{v3.0f}{2005/06/11}{Usage of \cs{caption@resetContinuedFloat} added}
+% \changes{v3.1}{2007/05/09}{Usage of \cs{caption@setfloattype} \&
+% \cs{caption@resetContinuedFloat} removed}
+% \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} removed}
+% Our handling of |\caption| will always be surrounded by
+% |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
+% |\caption@begin|\marg{type} performs these tasks:
+% \begin{enumerate}
+% \item[1.] Override the |position=| setting, if necessary.
+% (for example if set to |auto| or used inside a |supertabular|)
+% \item[2.] Start a new group.
+% \item[3.] Define |\fnum@|\meta{type} if the caption label format is set
+% to non-default.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand*\caption@begin[1]{%
+ \caption@fixposition
+ \begingroup
+ \caption@setfnum{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@beginex}
+% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
+% \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
+% \changes{v3.1}{2007/07/01}{Makes lst-entry now instead of redefining \cs{addcontentsline}}
+% \changes{v3.2}{2010/10/26}{Bugfix 09-05-15: Setting of \cs{lst@@caption} added}
+% |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par
+% performs the same tasks as |\caption@begin| and additionally:
+% \begin{enumerate}
+% \item[4.] Set |\lst@@caption|, so |\fnum@lstlisting| will include a numbering.
+% \item[5.] Make an entry in the list-of-whatever.
+% \item[6.] Set |\caption@ifempty| according argument \meta{heading}.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand\caption@beginex[3]{%
+ \caption@begin{#1}%
+ \let\lst@@caption\relax
+ \caption@addcontentsline{#1}{#2}%
+ \caption@ifempty{#3}{}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@end}
+% \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} removed}
+% |\caption@end| closes the group.
+% \begin{macrocode}
+\newcommand*\caption@end{%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0a}{2004/01/23}{%
+% Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
+% \changes{v3.0h}{2005/10/06}{%
+% Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
+%
+% \begin{macro}{\caption@setfnum}
+% \changes{v3.1}{2007/03/10}{This macro added}
+% |\caption@setfnum|\marg{type}\\
+% redefines |\fnum@|\meta{type} according the caption label format
+% set with |labelformat=|. But if |labelformat=default| is set,
+% |\fnum@|\meta{type} will not be overwritten by us.
+% \begin{macrocode}
+\newcommand*\caption@setfnum[1]{%
+ \@ifundefined{fnum@#1}{\iftrue}{\ifx\caption@lfmt\caption@lfmt@default\else}%
+ \@namedef{fnum@#1}{\caption@fnum{#1}}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@boxrestore}
+% \changes{v3.1}{2007/03/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added}
+% \changes{v3.2}{2010/11/07}{Support of option \opt{parboxrestore} added}
+% The original code (from |latex/base/ltboxes.dtx|):
+% \begin{verbatim}
+% \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}
+% \def\@arrayparboxrestore{%
+% \let\if@nobreak\iffalse
+% \let\if@noskipsec\iffalse
+% \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+% \parindent\z@ \parskip\z@skip
+% \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+% \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+% \parfillskip\@flushglue \lineskip\normallineskip
+% \baselineskip\normalbaselineskip
+% \sloppy}
+% \end{verbatim}%^^A
+% This one will be used by |\@caption| instead of |\@parboxrestore|.
+% \begin{macrocode}
+\newcommand*\caption@boxrestore{%
+ \caption@parboxrestore{\@parboxrestore}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parindent\z@ \parskip\z@skip
+ \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+ \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+ \parfillskip\@flushglue \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \sloppy
+ \let\\\@normalcr
+ }}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@boxrestore@mini}
+% \changes{v3.2}{2010/10/24}{This macro added}
+% Resets \cs{par} so the very first \cs{par} in \cs{@caption} behaves quite the same as in floating environments.
+% Will be used by \cs{setcaptiontype}.
+% \begin{macrocode}
+\newcommand\caption@boxrestore@mini{%
+ \let\par\@@par
+ \parindent\z@ \parskip\z@skip
+ \sloppy}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@normalsize}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This one will be used by |\@caption| instead of |\normalsize|.\par
+% Its code is equivalent to
+% \begin{quote}
+% |\caption@font{normal}%|
+% \end{quote}
+% but executes faster (since the starred form of |\caption@font|
+% does not use |\setkeys| internally).
+% \begin{macrocode}
+\newcommand*\caption@normalsize{%
+ \caption@font*{\KV@caption@fnt@normal\@unused}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setfloatcapt}
+% Needed for support of the \package{float} package, where the caption will
+% not be typeset directly, but catched in a |\vbox| called |\@floatcapt|
+% instead.
+% \begin{macrocode}
+\let\caption@setfloatcapt\@firstofone
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% This one is needed for support of the \package{nameref} and \package{hyperref} package.
+% \changes{v3.2f}{2012/01/14}{Bugfix: Usage of \cs{caption@gettitle} added}
+% \begin{macrocode}
+\newcommand*\caption@makecurrent[1]{\caption@gettitle}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makeanchor}
+% \begin{macro}{\caption@start}
+% \begin{macro}{\caption@@start}
+% \begin{macro}{\caption@freezeHref}
+% \begin{macro}{\caption@defrostHref}
+% All these are needed for support of the \package{hyperref} package.
+% \begin{macrocode}
+\let\caption@makeanchor\@firstofone
+\let\caption@start\relax
+\let\caption@@start\relax
+\let\caption@freezeHref\relax
+\let\caption@defrostHref\relax
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@gettitle}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This one is needed for support of the \package{nameref} package.
+% \begin{macrocode}
+\newcommand\caption@gettitle[1]{%
+ \caption@ifundefined\NR@gettitle
+ {\def\@currentlabelname{#1}}%
+ {\NR@gettitle{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Support for sub-captions}
+% \changes{v3.1f}{2007/11/16}{Support for sub-captions added}
+%
+% \begin{macro}{\caption@DeclareSubType}
+% |\caption@DeclareSub| initializes the usage of \cs{caption}
+% in sub-floats.
+% \begin{macrocode}
+\def\caption@DeclareSubType sub#1\@nil{%
+ \caption@Debug{Initializing subtype for `#1'\@gobble}%
+ \@namedef{caption@beginsub#1}{\caption@beginsubfloat{#1}}}
+\@onlypreamble\caption@DeclareSubType
+% \end{macrocode}
+% \end{macro}
+%
+% Initialize the sub-captions defined with \cs{DeclareCaptionSubType}\ldots
+% \begin{macrocode}
+\caption@For*{subtypelist}{\caption@DeclareSubType sub#1\@nil}
+% \end{macrocode}
+%
+% Initialize the sub-captions defined with \cs{newsubfloat}\cite{subfig}\ldots
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \caption@ifundefined\sf@counterlist{}{%
+ \@for\sf@temp:=\sf@counterlist\do{%
+ \expandafter\caption@DeclareSubType\sf@temp\@nil}}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@subtypehook}
+% \changes{v3.1g}{2008/03/20}{Redefinition of \cs{caption@setlist} added}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-08-12b: \cs{@makecaption} will now be restored here, too}
+% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
+% \changes{v3.2a}{2011/08/17}{Redefinition of \cs{phantomcaption} added}
+% \changes{v3.2a}{2011/08/17}{Usage of \cs{caption@warmup} added}
+% \changes{v3.2c}{2011/09/30}{Bugfix 11-09-26: Usage of \cs{if@subfloatrow} added}
+% \changes{v3.3}{2011/12/28}{Bugfix 11-12-16: \cs{caption@l@stepcounter} replaced by \cs{stepcounter}}
+% \changes{v3.3}{2012/03/15}{Usage of \cs{caption@setbox} added}
+% \changes{v3.3}{2013/05/01}{Redefinition of \cs{caption@settype} added}
+% \changes{v3.3}{2013/06/17}{Missing redefinition of \cs{captionlistentry} added}
+% \changes{v3.3}{2018/09/06}{Adapted to the \package{chkfloat} package}
+% Hook, will be used inside \cs{caption@setsubtype}.\par
+% (Note: If we are inside an |sub|\-|float|\-|row| environment we have to keep
+% the |\@make|\-|caption| code of the \package{floatrow} package intact.)
+% \begin{macrocode}
+\newcommand*\caption@subtypehook{%
+ \ifx\caption\caption@subcaption \else
+ \caption@warmup
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifflag2{}{% caption
+% no \caption in this part of the (floating) environment yet
+ \let\caption@add@contentsline\caption@addsubcontentsline
+ \let\caption@addsubcontentslines\@gobble
+ \caption@ifflag4{}{% subcaption
+% no \subcaption in this part of the (floating) environment yet
+ \caption@ifflag1{% ContinuedFloat
+ \caption@clrflag1%
+ }{%
+ \caption@@stepcounter\@captype
+ }%
+ \caption@setflag4% subcaption
+ }%
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \c@ContinuedFloat=0\relax
+ \let\caption@setfloatcapt\@firstofone
+ \let\caption@chkfloat\@gobbletwo
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setbox{none}%
+ \caption@clearmargin
+ \caption@iflist{}{\let\caption@setlist\@gobble}%
+ \caption@setoptions{sub}%
+ \caption@setoptions{subfloat}% for subfig-package compatibility
+% \end{macrocode}
+% \begin{macrocode}
+% redefine \setcaptiontype
+ \def\caption@settype{\caption@withoptargs\caption@sub@settype}%
+ \def\caption@sub@settype##1##2{%
+ \def\caption@tempa{##2}%
+ \ifx\caption@tempa\@captype
+%%% \caption@setsubtype##1\relax
+ \else
+ \caption@Error{##2 inside \@subcaptype}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+% redefine \caption
+ \let\caption\caption@subcaption
+ \let\phantomcaption\caption@subphantom
+ \let\captionlistentry\caption@sublistentry
+% \let\@captype\@subcaptype
+ \let\caption@refstepcounter\caption@@@refstepcounter
+% \end{macrocode}
+% \begin{macrocode}
+% restore \@makecaption
+ \if@subfloatrow
+ \caption@Debug{Keeping \string\@makecaption}%
+ \else
+ \let\@makecaption\caption@makecaption
+ \fi
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\if@subfloatrow}
+% \changes{v3.2c}{2011/09/30}{This macro added}
+% This macro tests if we are inside an |sub|\-|float|\-|row| or |sub|\-|float|\-|row*| environment.
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \caption@ifundefined\@subfloatrowtrue
+ {\newif\if@subfloatrow
+ \caption@ifundefined\subfloatrow{}%
+ {\caption@Debug{Patching subfloatrow environment}%
+ \g@addto@macro\capsubrowsettings{\@subfloatrowtrue}%
+ \g@addto@macro\killfloatstyle{%
+ \ifx\c@FRobj\c@FRsobj\@subfloatrowtrue\fi}}}%
+ {\caption@Debug{\string\if@subfloatrow is already defined}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subcaption}
+% Makes a sub-caption.
+% \begin{macrocode}
+\newcommand*\caption@subcaption{%
+ \caption@checkgrouplevel{sub}\subcaption
+ \caption@star
+ {\caption@refstepcounter\@subcaptype}%
+ {\caption@dblarg{\@caption\@subcaptype}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subphantom}
+% \changes{v3.2a}{2011/08/17}{This macro added}
+% Same as |\phantomcaption|, but for sub-captions.
+% \begin{macrocode}
+\newcommand*\caption@subphantom{%
+ \caption@checkgrouplevel{sub}\phantomsubcaption
+ \caption@refstepcounter\@subcaptype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@sublistentry}
+% \changes{v3.3}{2013/06/17}{This macro added}
+% Same as |\captionlistentry|, but for sub-captions.
+% \begin{macrocode}
+\newcommand*\caption@sublistentry{%
+ \caption@teststar\@subcaptionlistentry\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@subcaptionlistentry[1]{%
+ \@testopt{\caption@listentry{#1}}\@subcaptype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{caption@clearsubcontentslines}
+% Clear pending sub-caption list entries.
+% \begin{macrocode}
+\newcommand*\caption@clearsubcontentslines{%
+ \global\let\caption@subcontentslines\@empty}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@clearsubcontentslines
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addsubcontentsline}
+% \changes{v3.1i}{2008/08/02}{Bugfix 08-07-28:
+% \cs{label}, \cs{index}, and \cs{glossary} are allowed inside the list entry now}
+% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
+% \changes{v3.2c}{2011/08/19}{Uses \cs{caption@gobble} instead of \cs{@gobble} now}
+% \changes{v3.3}{2012/01/15}{Debug message added}
+% \changes{v3.3}{2013/03/10}{A single \cs{protect} replaced by \cs{noexpand}}
+% Add a pending sub-caption list entry.
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentsline[4]{%
+ \caption@Debug{\string\caption@addsubcontentsline{#1}{#2}}%
+ \begingroup
+ \let\label\caption@gobble
+ \let\index\caption@gobble
+ \let\glossary\caption@gobble
+ \protected@edef\@tempa{\endgroup
+ \noexpand\g@addto@macro\noexpand\caption@subcontentslines{%
+ \noexpand\@namedef{the#2}{\csname the#2\endcsname}%
+ \ifx\@currentHref\@undefined \else
+ \noexpand\def\noexpand\@currentHref{\@currentHref}%
+ \fi
+ \noexpand\caption@@@addcontentsline{#1}{#2}{#3}{#4}}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\flushsubcaptionlistentries}
+% \changes{v3.3}{2012/01/15}{Renamed from \cs{caption@addsubcontentslines} to \cs{flushsubcaptionlistentries}}
+% \changes{v3.3}{2013/03/10}{Bugfix: Missing redefinition of \cs{caption@addsubcontentslines} added}
+% Writes pending sub-caption list entries.
+% \begin{macrocode}
+\newcommand*\flushsubcaptionlistentries{%
+ \caption@addsubcontentslines{user}}
+% \end{macrocode}
+% \begin{macrocode}
+\renewcommand*\caption@addsubcontentslines[1]{%
+ \caption@Debug{\string\flushsubcaptionlistentries (#1)}%
+ \begingroup
+ \caption@subcontentslines
+ \endgroup
+ \caption@clearsubcontentslines}
+% \end{macrocode}
+% We need to patch \cs{chapter} otherwise a vertical gap will be inserted into
+% the list prior pending sub-caption list entries.
+% We do this |\At|\-|Begin|\-|Document| so packages like \package{newfloat}
+% will not complain about an unknown document class.
+% \begin{macrocode}
+\AtBeginDocument{\caption@ifundefined\chapter{}{%
+ \let\caption@chapter@ORI\chapter
+ \def\chapter{%
+ \caption@addsubcontentslines{chapter}\caption@chapter@ORI}}}
+% \end{macrocode}
+% Same for \cs{appendix}.
+% \begin{macrocode}
+\AtBeginDocument{\caption@ifundefined\appendix{}{%
+ \let\caption@appendix@ORI\appendix
+ \def\appendix{%
+ \caption@addsubcontentslines{appendix}\caption@appendix@ORI}}}
+% \end{macrocode}
+% Flush the list of pending sub-caption list entries at the end of the document.
+% \begin{macrocode}
+\AtEndDocument{%
+ \caption@addsubcontentslines{AtEndDocument}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Document class \& Babel package support}
+%
+% \subsubsection{The \AmS{} \& \SmF{} classes}
+% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added}
+%
+% \begin{macrocode}
+\caption@ifundefined\smf@makecaption{}{\let\smf@makecaption\@makecaption}
+% \end{macrocode}
+%
+% \subsubsection{The beamer class}
+% \changes{v3.1}{2007/03/10}{beamer class support added}
+%
+% \begin{macrocode}
+\@ifclassloaded{beamer}{%
+ \caption@InfoNoLine{beamer document class}%
+% \end{macrocode}
+%
+% \begin{macro}{\figure}
+% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
+% \changes{v3.3d}{2019/09/01}{This re-definition for \class{beamer} document class revised}
+% We redefine |figure| so our type-specific options will be used etc.
+% \begin{macrocode}
+ \let\caption@ORI@figure\figure
+ \def\figure{\caption@settype{figure}\caption@ORI@figure}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\table}
+% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
+% \changes{v3.3d}{2019/09/01}{This re-definition for \class{beamer} document class revised}
+% We redefine |table| so our type-specific options will be used etc.
+% \begin{macrocode}
+ \let\caption@ORI@table\figure
+ \def\table{\caption@settype{table}\caption@ORI@table}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The \KOMAScript{} classes}
+%
+% \KOMAScript\ contains the code
+% |\AtBeginDocument{\let\scr@caption\caption}|
+% so we need to update |\scr@caption| here, too.
+%
+% \begin{macrocode}
+\caption@ifundefined\scr@caption{}{%
+ \caption@AtBeginDocument{\let\scr@caption\caption}}
+% \end{macrocode}
+%
+% \subsubsection{The frenchb Babel option}
+% \changes{v3.1}{2006/05/14}{Adaptation to \package{frenchb} added}
+%
+% Suppress
+% ``Package |frenchb.ldf| Warning: The definition of |\@makecaption| has been
+% changed, frenchb will NOT customize it.''
+% (but only if we emulate this customization)
+% \begin{macrocode}
+\@nameuse{caption@frenchb}\@nameundef{caption@frenchb}
+% \end{macrocode}
+%
+% \subsubsection{The frenchle/pro package}
+% \changes{v3.0h}{2005/10/03}{Adaptation to \package{frenchle/pro} added}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@ifundefined\frenchTeXmods{}{%
+ \caption@InfoNoLine{frenchle/pro package is loaded}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\captionfont@ORI\captionfont
+ \let\captionlabelfont@ORI\captionlabelfont
+ \let\@makecaption@ORI\@makecaption
+% \end{macrocode}
+
+% If |\GOfrench| is defined as |\relax| all the re-definitions regarding
+% captions have already been done, so we can do our patches immediately.
+% Otherwise we must add our stuff to |\GOfrench|.
+% \begin{macrocode}
+ \caption@ifundefined\GOfrench
+ {\let\caption@tempa\@firstofone}%
+ {\def\caption@tempa{\g@addto@macro\GOfrench}}%
+ \caption@tempa{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\captionfont\captionfont@ORI
+ \let\captionfont@ORI\@undefined
+ \let\captionlabelfont\captionlabelfont@ORI
+ \let\captionlabelfont@ORI\@undefined
+ \let\@makecaption\@makecaption@ORI
+ \let\@makecaption@ORI\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\@cnORI}
+% We update the definition of |\@cnORI| so it actually reflects
+% our definition of |\caption|.
+% \begin{macrocode}
+ \let\@cnORI\caption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@tablescaption}
+% The \package{frenchle/pro} package sets |\caption| to |\@tablescaption| at
+% |\begin{table}| for special treatment of footnotes.
+% Therefore we have to patch |\@tablescaption| so |\caption*| will work
+% inside the |table| environment.
+% \begin{macrocode}
+ \let\caption@tcORI\@tablescaption
+ \def\@tablescaption{\caption@star\relax\caption@tcORI}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f@ffrench}
+% \begin{macro}{\f@tfrench}
+% |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
+% when used in French mode. These contain additional code which typesets
+% the caption separator |\captionseparator| instead of the usual colon.
+% Because this breaks with our |\@makecaption| code we have to remove
+% this additional code here.
+% \begin{macrocode}
+ \let\@eatDP\@undefined
+ \let\caption@tempa\@empty
+ \ifx\f@ffrench\fnum@figure
+ \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
+ \fi
+ \ifx\f@tfrench\fnum@table
+ \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
+ \fi
+ \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
+ \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
+ \caption@tempa
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ }%
+}}
+% \end{macrocode}
+%
+% \subsubsection{The hungarian and magyar Babel option}
+% \changes{v3.2}{2009/03/29}{\package{magyar} package support added}
+% \changes{v3.3}{2018/08/26}{\package{magyar} package support revised}
+%
+% \begin{macrocode}
+\def\caption@tempa#1{%
+ \@ifpackagewith{babel}{#1}{%
+ \caption@InfoNoLine{#1 babel option is loaded}%
+ \expandafter\addto\csname extras#1\endcsname{%
+ % reverse changes made by magyar.ldf
+ \let\@makecaption\caption@makecaption
+ \babel@save\@makecaption
+ \caption@redefine
+ \babel@save\@caption}%
+ }{}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@tempa{hungarian}%
+\caption@tempa{magyar}%
+% \end{macrocode}
+%
+% \subsection{Package support}
+% \changes{v3.1}{2007/04/11}{Package options `float', `longtable' etc.
+% are not supported anymore, removed}
+%
+% \begin{macro}{\caption@IfPackageLoaded}
+% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added,
+% so no extra check is needed}
+% \changes{v3.1}{2007/07/04}{Re-written \& renamed from \cs{caption@ifpackage}
+% to \cs{caption@IfPackageLoaded}}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% |\caption@IfPackageLoaded|\marg{package}\oarg{version}\marg{true}\marg{false}\par
+% Some kind of combination of |\@ifpackageloaded| and |\@ifpackagelater|.
+% If the \meta{package} is not loaded yet, the check will be (re-)done
+% |\AtBeginDocument|, so the \meta{package} could be loaded later on, too.
+% \begin{macrocode}
+\newcommand\caption@IfPackageLoaded[1]{%
+ \@testopt{\caption@@IfPackageLoaded{#1}}{}}
+\@onlypreamble\caption@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@IfPackageLoaded#1[#2]#3#4{%
+ \@ifpackageloaded{#1}\@firstofone{%
+ \caption@Debug{#1 package is not loaded (yet)\@gobble}%
+ \caption@AtBeginDocument}{%
+ \caption@If@Package@Loaded{#1}[{#2}]{#3}{#4}}}
+\@onlypreamble\caption@@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@If@Package@Loaded#1[#2]{%
+ \@ifpackageloaded{#1}{%
+ \caption@InfoNoLine{#1 package is loaded}%
+ \@ifpackagelater{#1}{#2}\@firstoftwo{%
+ \caption@Error{%
+ For a successful cooperation we need at least version\MessageBreak
+ `#2' of package #1,\MessageBreak
+ but only version\MessageBreak
+ `\csname ver@#1.\@pkgextension\endcsname'\MessageBreak
+ is available}%
+ \@secondoftwo}%
+ }{\@secondoftwo}}
+\@onlypreamble\caption@If@Package@Loaded
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clearmargin}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This macro will be used by some package support stuff where the usual
+% margin setting is not welcome, e.g. in the \package{sidecap} package.
+% \begin{macrocode}
+\newcommand*\caption@clearmargin{%
+ \setcaptionmargin\z@
+ \let\caption@minmargin\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@setbool{needfreeze}{0}
+\caption@AtBeginDocument*{%
+ \caption@ifneedfreeze{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@freezetype}
+% \changes{v3.3}{2013/05/01}{This macro added}
+% |\caption@freezetype|\marg{type}\par
+% Used by the \package{fltpage} \& \package{sidecap} package support.
+% \begin{macrocode}
+ \newcommand*\caption@freezetype[1]{%
+ \caption@settype*{#1}%
+ \captionsetup*[sub]{hypcap=true}% Note: This is just a (q&d) workaround!
+ \caption@freeze}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@freeze}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} \& \cs{@caption} revised for enhanced compatibility}
+% \changes{v3.1c}{2007/10/06}{Bugfix: Made \cs{@caption} long}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1g}{2008/01/29}{Starred variants of \cs{ContinuedFloat} and \cs{captionsetup} added}
+% \changes{v3.2}{2010/10/26}{Bugfix 10-09-01a: Uses \cs{ignorespaces} instead of `space hack' again}
+% \changes{v3.2a}{2011/08/17}{Starred variant of \cs{caption@freeze} removed}
+% \changes{v3.2b}{2011/08/18}{Redefines \cs{caption@setup} instead of \cs{captionsetup} now}
+% \changes{v3.2b}{2011/08/18}{Redefinition of \cs{label} revised}
+% \changes{v3.2c}{2011/08/21}{Revised}
+% \changes{v3.3}{2013/01/06}{Adapted to new switch \cs{caption@caption} etc.}
+% |\caption@freeze|\par
+% Used by the \package{bicaption} package.
+% \begin{macrocode}
+ \newcommand*\caption@freeze{%
+ \let\caption@frozen@ContinuedFloat\ContinuedFloat
+ \def\ContinuedFloat{%
+ \caption@@freeze{\caption@@@@ContinuedFloat\@captype}%
+ \caption@frozen@ContinuedFloat}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@setup\caption@setup
+ \def\caption@setup##1{%
+ \caption@@freeze{\caption@setup{##1}}%
+ \caption@frozen@setup{##1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@caption\caption
+ \def\caption{%
+ \def\caption{%
+ \caption@Error{%
+ Only one \noexpand\caption can be placed in this environment}%
+ \caption@gobble}%
+ \@ifstar
+ {\caption@SC@caption*}%
+ {\let\@currentlabel\caption@SClabel
+ \caption@withoptargs\caption@SC@caption}}%
+ \long\def\caption@SC@caption##1##2{%
+ \caption@@freeze{\caption##1{##2}}%
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@label\label
+ \def\label{%
+ \caption@withoptargs\caption@SC@label}%
+ \def\caption@SC@label##1##2{%
+ \ifx\@currentlabel\caption@SClabel
+ \@bsphack
+ \caption@freeze@label{##1}{##2}%
+ \@esphack
+ \else
+ \caption@frozen@label##1{##2}%
+ \fi}%
+ \def\caption@SClabel{\caption@undefinedlabel}%
+ \def\caption@freeze@label##1##2{%
+ \caption@@freeze{\label##1{##2}}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\let\caption@frozen@content\@empty
+ \long\def\caption@@freeze{%
+ \g@addto@macro\caption@frozen@content}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@warmup{%
+ \let\ContinuedFloat\caption@frozen@ContinuedFloat
+ \let\caption@setup\caption@frozen@setup
+ \let\caption\caption@frozen@caption
+ \let\label\caption@frozen@label}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepare@defrost}
+% \changes{v3.3}{2013/01/06}{This macro added}
+% Prevent resetting the caption flags
+% \begin{macrocode}
+ \newcommand*\caption@prepare@defrost{%
+ \let\caption@settype\caption@set@type}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrost}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1g}{2008/01/30}{\cs{caption@defrost@setup} added}
+% \changes{v3.2c}{2011/08/21}{Adapted to changes of \cs{caption@freeze}}
+% \changes{v3.2c}{2011/08/21}{\cs{caption@defrost@setup} removed}
+% |\caption@defrost|
+% \begin{macrocode}
+ \newcommand*\caption@defrost{%
+ \ifx\caption@frozen@caption\@undefined
+ \caption@frozen@content
+ \else
+ \caption@Error{Internal Error:\MessageBreak
+ \noexpand\caption@defrost in same group as \string\caption@freeze}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@undefbool{needfreeze}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@warmup}
+% \changes{v3.2a}{2011/08/17}{This macro added}
+% |\caption@warmup|
+% \begin{macrocode}
+\let\caption@warmup\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{The chkfloat package}
+% \changes{v3.3}{2018/09/06}{Support of the \package{chkfloat} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{chkfloat}[2012/08/19 v0.1]{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@chkfloat}
+% \changes{v3.3}{2018/09/06}{This macro added}
+% \begin{macrocode}
+ \caption@ifundefined\chkfloat@addcontentsline{%
+ \renewcommand\caption@chkfloat[2]{%
+ \caption@ifundefined\chkfloat@page{}{%
+ \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}}}%
+ }{%
+ \renewcommand\caption@chkfloat{\chkfloat@addcontentsline}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+% \end{macrocode}
+%
+% \subsubsection{The float package}
+% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
+% \iffalse
+% (This is a more straight-ahead implementation, but it only works with v1.3
+% now, so v1.2 is no longer supported. The old code including documentation
+% can be found in caption-30f-050530.zip)
+% \fi
+%
+% The \package{float} package usually do not use the \LaTeX\ kernel command
+% |\@caption| to typeset the caption but |\float@caption| instead.
+% (|\@caption| will only be used if the float is re-styled with
+% |\restylefloat*|.)
+%
+% The main two things |\float@caption| is doing different are:
+% \begin{itemize}
+% \item The caption will be typeset inside a |\savebox| called |\@floatcapt|
+% so it can be placed above or below the float contents afterwards.
+% \item |\@makecaption| will not be used to finally typeset the caption.
+% Instead |\@fs@capt| will be used which definition is part of the float
+% style.
+% (Note that |\@fs@capt| will not typeset any vertical space above or below
+% the caption; instead this space will be typeset by the float style code
+% itself.)
+% \end{itemize}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{%
+ \@ifpackageloaded{floatrow}{%
+ \caption@If@Package@Loaded{floatrow}[2007/08/24 v0.2a]{}{}%
+ }{%
+% \end{macrocode}
+%
+% \begin{macro}{\@float@setevery}
+% \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added
+% to redefinition of \cs{caption@setfloatcapt}}
+% |\@float@setevery|\marg{float type} is provided by the \package{float}
+% package; it's called every time a floating environment defined with
+% |\newfloat| or |\restylefloat| begins.
+% We use this hook to do some adaptations and to setup the proper caption
+% style (if defined) and additional settings declared with
+% |\captionsetup|\oarg{float style}.
+% \begin{macrocode}
+ \let\caption@ORI@float@setevery\@float@setevery
+ \def\@float@setevery#1{%
+ \float@ifcaption{#1}{%
+% \end{macrocode}
+%
+% First of all we set the caption position to it's proper value by
+% converting |\@fs@iftopcapt| (which is part of a float style and
+% controls where the caption will be typeset, above or below the float
+% contents) to our |position=| setting.
+% Since the spacing above and below the caption will be done by the float
+% style and \emph{not} by us this sounds quite useless. But in fact it isn't,
+% since some packages based on \thispackage\ (like the \package{subfig}
+% package) could have an interest for this information and therefore use the
+% |\caption@iftop| macro we provide in our kernel. Furthermore we need this
+% information for ourself in |\captionof| which uses |\@makecaption| to
+% finally typeset the caption with skips.
+% \begin{macrocode}
+ \caption@setposition{\@fs@iftopcapt t\else b\fi}%
+% \end{macrocode}
+%
+% Afterward we redefine |\caption@setfloatcapt| (which will be used inside
+% |\@caption|) so the caption will be set inside the box |\@floatcapt|,
+% without extra vertical space.
+% \begin{macrocode}
+ \renewcommand\caption@setfloatcapt[1]{%
+ \let\@makecaption\caption@@make
+ \global\setbox\@floatcapt\vbox{%
+ \color@begingroup ##1\color@endgroup}}%
+% \end{macrocode}
+%
+% To allow different caption styles for different float styles we also
+% determine the current float style (e.g. `ruled') and select
+% a caption style (and additional settings) with the same name, if defined.
+% \begin{macrocode}
+ \float@getstyle\float@style{#1}%
+ \caption@setstyle*\float@style
+ \caption@setoptions\float@style
+% \end{macrocode}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@freezeHref % will be defrosted in \float@makebox
+ \caption@ORI@float@setevery{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@makebox}
+% \changes{v3.3}{2013/01/06}{Corrects wrong load order hyperref-float now}
+% \changes{v3.3}{2013/02/03}{Correction of wrong load order hyperref-float revised}
+% Redefine |\float@makebox| (only if we are not operating in compatibility mode).
+% \begin{macrocode}
+ \caption@AtBeginDocument{\caption@ifcompatibility{}{%
+% \end{macrocode}
+% If it was redefined by the \package{hyperref} package,
+% we need to build on the original definition (and not on the redefined one).
+% \begin{macrocode}
+ \caption@ifundefined\HyOrg@float@makebox
+ {\let\caption@ORI@float@makebox\float@makebox}%
+ {\let\caption@ORI@float@makebox\HyOrg@float@makebox}%
+ \renewcommand\float@makebox[1]{%
+ \caption@ORI@float@makebox{#1\relax \caption@defrostHref}}%
+% \end{macrocode}
+% \begin{macrocode}
+ }}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@typehook}
+% \changes{v3.1}{2007/07/08}{float package hook added}
+% \LaTeX\ and almost every other packages use
+% |\|\meta{type}|name|
+% to provide a macro for the type resp.~environment name -- for example
+% the command |\figurename| will usually contain the name of the floating
+% environment |figure|:
+% \begin{quote}
+% |\newcommand\figurename{Figure}|
+% \end{quote}
+% But the \package{float} package doesn't follow this common naming
+% convention:
+% For floats defined with |\newfloat| it uses |\fname@|\meta{type} instead,
+% which breaks with our code (and with |\autoref| and some other things as
+% well).
+% So we have to map the \package{float} package name to the common one here.\par
+% \Note{If the float was not defined with \cs{newfloat} but with
+% \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.}
+% \begin{macrocode}
+ \g@addto@macro\caption@typehook{%
+ \expandafter\ifx\csname #1name\endcsname\relax
+ \expandafter\let\csname #1name\expandafter\endcsname
+ \csname fname@#1\endcsname
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
+% \begin{macro}{\fs@plaintop}
+% \begin{macro}{\fs@boxed}
+% Since the float styles |plaintop| and |boxed| don't use |\abovecaptionskip|
+% which could be set with |skip=| (|plaintop| uses |\belowcaptionskip| instead of
+% |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|)
+% we patch the according float style macros here to change this.
+% \begin{macrocode}
+ \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
+ \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\float@getstyle}
+% \changes{v3.1}{2007/06/10}{This macro added}
+% |\float@getstyle|\marg{cmd}\marg{type}\par
+% Determining the float style is not so easy because the only hint
+% provided by the \package{float} package is the macro
+% |\fst@|\meta{float type} which points to the macro which represents the
+% float style. So for example after
+% \begin{quote}
+% |\floatstyle{ruled}|\\
+% |\newfloat{Program}{tbp}{lop}|
+% \end{quote}
+% |\fst@Program| will be defined as
+% \begin{quote}
+% |\def\fst@Program{\fs@ruled}|\quad.
+% \end{quote}\par
+% So here is what we do: We make the first level expansion of
+% |\fst@|\meta{float type} a string so we can gobble the first four tokens
+% (= |\fs@|), so only the the name of the float style is left.\par
+% \emph{TODO:} We need to convert the catcodes here.
+% \begin{macrocode}
+ \providecommand*\float@getstyle[2]{%
+ \edef#1{%
+ \noexpand\expandafter\noexpand\@gobblefour\noexpand\string
+ \expandafter\expandafter\expandafter\noexpand
+ \csname fst@#2\endcsname}%
+ \edef#1{#1}%
+ \caption@Debug{floatstyle{#2} = `#1'}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@ifcaption}
+% \changes{v3.1}{2007/06/23}{This macro added}
+% |\float@ifcaption|\marg{type}\marg{if-clause}\marg{else-clause}\par
+% Here we determine if the user has used |\newfloat| resp.~|\restylefloat|,
+% or |\restylefloat*|.
+% This is quite easy: If |\@float@c@|\meta{captype} is the same as
+% |\float@caption|, the user has used |\newfloat| or |\restylefloat|,
+% otherwise we assume he has used |\restylefloat*|.
+% (This test will fail if some package re-defines |\float@caption|,
+% so we have to assume that there is no one.)
+% \begin{macrocode}
+ \providecommand*\float@ifcaption[1]{%
+ \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}}{%
+ \providecommand*\float@ifcaption[1]{\@secondoftwo}%
+% \clearcaptionsetup{boxed}% used by the floatrow package?
+}
+% \end{macrocode}
+%
+% The skip between `boxed' floats and their caption defaults to |2pt|.
+%
+% \begin{macrocode}
+\captionsetup[boxed]{skip=2pt} % do not issue a warning when not used
+% \end{macrocode}
+%
+% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
+% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
+% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
+% `ruled' with appropriate options. But if the package option |ruled| was
+% specified, we setup some caption parameters to emulate the behavior
+% of \thispackage\ \version{1.x} option |ruled| instead, i.e.,
+% the current caption settings will be used, but without margin and without
+% `single-line-check'.
+% \begin{macrocode}
+\caption@ifbool{ruled}{%
+ \captionsetup[ruled]{margin=0pt,minmargin=0,slc=0}%
+}{%
+ \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
+}
+\caption@undefbool{ruled}
+% \end{macrocode}
+%
+% \subsubsection{The floatflt package}
+% \changes{v3.1}{2007/06/10}{Support of the \package{floatflt} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{floatflt}[1996/02/27 v1.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\floatingfigure}
+% We patch |\floatingfigure| so |\caption@floatflt| will be used.
+% \begin{macrocode}
+ \let\caption@ORI@floatingfigure\floatingfigure
+ \def\floatingfigure{%
+ \caption@floatflt{figure}%
+ \caption@ORI@floatingfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\floatingtable}
+% Same with |\floatingtable|\ldots
+% \begin{macrocode}
+ \let\caption@ORI@floatingtable\floatingtable
+ \def\floatingtable{%
+ \caption@floatflt{table}%
+% \caption@setautoposition b%
+ \caption@ORI@floatingtable}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@floatflt}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Here we do two things:
+% \begin{enumerate}
+% \item We use |\caption@set|\-|options{|\-|floating|\meta{type}|}| so
+% |\caption|\-|setup[|\-|floating|\meta{type}|]{|\ldots|}| is supported.
+% \item |\line|\-|width| must be set correctly.
+% Usually this is done by |\@par|\-|box|\-|restore| inside |\@caption|,
+% but since we use |\@caption@box|\-|restore| we have to map this to
+% |\@par|\-|box|\-|restore| instead.
+% \end{enumerate}
+% \begin{macrocode}
+ \newcommand*\caption@floatflt[1]{%
+ \caption@settype{#1}%
+ \caption@clearmargin
+ \caption@setfullparboxrestore
+ \caption@setoptions{floating#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The fltpage package}
+% \changes{v3.1}{2007/07/22}{Support of the \package{fltpage} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\FP@positionLabel}
+% \changes{v3.2c}{2011/08/28}{This redefinition added}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@positionLabel}{%
+% FP\@captype-\number\value{FP@\@captype C}-pos}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand\FP@positionLabel{%
+ FP\FP@captype-\number\value{FP@\FP@captype C}-pos}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@helpNote}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@helpNote}[2]{%
+% \typeout{FP#1 is inserted on page \pageref{#2}!}}%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand\FP@helpNote[2]{%
+ \begingroup % save \caption@thepage
+ \caption@pageref{#2}%
+ \typeout{FP#1 is inserted on page \caption@thepage!}%
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatBegin}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-09-11: Missing \cs{ignorespaces} added}
+% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
+% \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatBegin}[1]{%
+% \gdef\@captype{#1}%
+% \global\let\FP@savedCaptionCommand\caption%
+% \global\let\FP@savedLabelCommand\label%
+% \ifthenelse{\equal{\@captype}{figure}}
+% {\global\let\old@Fnum\fnum@figure}%
+% {\global\let\old@Fnum\fnum@table}%
+% \let\FP@LabelText\@empty%
+% \let\FP@CaptionText\@empty%
+% \let\FP@optionalCaptionText\@empty%
+% \renewcommand\label[1]{\gdef\FP@LabelText{##1}}%
+% \renewcommand\caption[2][]{%
+% \gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}%
+% \begin{lrbox}{\FP@floatCorpusBOX}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatBegin[1]{%
+ \def\FP@captype{#1}%
+ \begin{lrbox}{\FP@floatCorpusBOX}%
+ \minipage\hsize % changes from LR mode to vertical mode
+ \caption@freezetype{#1}%
+ \ignorespaces}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatEnd}
+% \changes{v3.1g}{2008/01/30}{Some minor bugfixes}
+% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
+% \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatEnd}{%
+% \end{lrbox}%
+% \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
+% \stepcounter{FP@\@captype C}%
+% \FP@savedLabelCommand{\FP@positionLabel}%
+% \FP@helpNote{\@captype}{\FP@positionLabel}%
+% \FP@float
+% {\FP@positionLabel}% location label test
+% {\begin{\@captype}[p!]
+% \usebox{\FP@floatCorpusBOX}%
+% \refstepcounter{\@captype}%
+% \ifthenelse{\equal{\FP@LabelText}{\@empty}}
+% {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
+% \end{\@captype}}
+% {\addtocounter{\@captype}{-1}}
+% {\begin{\@captype}[b!]%
+% \ifthenelse{\equal{\FP@guide}{\@empty}}%
+% {}{\ifthenelse{\equal{\@captype}{figure}}%
+% {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}%
+% {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}%
+% \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \FP@separatorCaption%
+% \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
+% {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%
+% {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]%
+% {\expandafter\protect\FP@CaptionText}}%
+% \end{\@captype}}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatEnd{%
+ \endminipage
+ \end{lrbox}%
+% \end{macrocode}
+% \begin{macrocode}
+ \stepcounter{FP@\FP@captype C}%
+ \caption@label\FP@positionLabel
+ \FP@helpNote\FP@captype\FP@positionLabel
+% \end{macrocode}
+% \begin{macrocode}
+ \FP@float
+ {\FP@positionLabel}% location label test
+ {\caption@prepare@defrost
+ \begin\FP@captype[p!]%
+ \usebox\FP@floatCorpusBOX
+ \end\FP@captype}%
+ {\@ifundefined{theH\FP@captype}{}{%
+ \expandafter\l@addto@macro\csname theH\FP@captype\endcsname{.FP}}}%
+ {\caption@prepare@defrost
+ \begin\FP@captype[b!]%
+ \let\FP@savedSetfnumCommand\caption@setfnum
+ \def\caption@setfnum##1{%
+ \FP@savedSetfnumCommand{##1}%
+ \ifx\FP@guide\@empty \else
+ \expandafter\l@addto@macro\csname fnum@##1\endcsname{\ {\FP@guide}}%
+ \fi}%
+ \setlength\abovecaptionskip{2pt plus 2pt minus 1pt}% length above caption
+ \setlength\belowcaptionskip{2pt plus 2pt minus 1pt}% length below caption
+ \caption@setoptions{FP\@captype}%
+ \FP@separatorCaption
+ \caption@defrost
+ \end\FP@captype}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\caption@ifFPlistcap\@undefined
+ \let\caption@ifFPrefcap\@undefined
+}
+% \end{macrocode}
+%
+% \subsubsection{The hyperref package}
+% \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
+% \changes{v3.1}{2007/03/09}{Usage of \cs{hyper@makecurrent} instead of
+% \cs{theHfigure} as indicator for \package{hyperref} package}
+% \changes{v3.2}{2011/07/30}{Test if \package{hyperref} has stopped early revised}
+% \changes{v3.2c}{2011/08/24}{Test if \package{hyperref} has stopped early adapted to current version of \package{hyperref} package: Usage of \cs{IfHyperBoolean} added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{%
+ % Test if hyperref has stopped early
+ \caption@ifundefined\IfHyperBoolean{%
+ \caption@set@bool\caption@ifhyp@stoppedearly0%
+ \caption@ifundefined\H@refstepcounter
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
+ \caption@ifundefined\hyper@makecurrent
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
+ \caption@ifundefined\measuring@true
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{}}}%
+ }{%
+ \def\caption@ifhyp@stoppedearly{\IfHyperBoolean{stoppedearly}}%
+ }%
+ \caption@ifhyp@stoppedearly{% hyperref has stopped early
+ \caption@InfoNoLine{%
+ Hyperref support is turned off\MessageBreak
+ because hyperref has stopped early}%
+ }{%
+ \g@addto@macro\caption@prepareslc{\measuring@true}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@@@refstepcounter}
+% We redefine |\caption@@refstepcounter| so |\H@refstepcounter| will be used
+% instead of |\refstepcounter| inside |\caption| \& |\captionlistentry|.
+% \begin{macrocode}
+ \renewcommand*\caption@@@refstepcounter{\H@refstepcounter}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% We redefine |\caption@makecurrent| so a \package{hyperref} label
+% will be defined inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand*\caption@makecurrent[2]{%
+ \caption@makecurrentHref{#1}%
+ \caption@Debug{hyperref current=\@currentHref}%
+ \caption@gettitle{#2}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@makecurrentHref{\hyper@makecurrent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makeanchor}
+% \changes{v3.1l}{2010/01/09}{Adapted to the current hyperref package}
+% We redefine |\caption@makeanchor| so a \package{hyperref} anchor
+% will be set inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand\caption@makeanchor[1]{%
+ \caption@Debug{hyperref anchor: \@currentHref}%
+ % If we cannot have nesting, the anchor is empty.
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#1}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
+ }#1%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \g@addto@macro\caption@prepareslc{\let\caption@makeanchor\@firstofone}%
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{The hypcap option}
+%
+% \begin{macro}{\if@capstart}
+% Like the \package{hypcap} package we define the switch |\if@capstart|, too.
+% \begin{macrocode}
+ \newif\if@capstart
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@start}
+% \changes{v3.0l}{2007/02/20}{%
+% \cs{caption@currentHref} renamed to \cs{hc@currentHref}}
+% \changes{v3.1}{2007/06/21}{%
+% This macro renamed from \cs{capstart} to \cs{caption@start} and revised}
+% While the \package{hypcap} package defines a macro called |\capstart|
+% our variant is called |\caption@start| and is controlled by the option
+% |hypcap=||false|/|true|.
+% \begin{macrocode}
+ \def\caption@start{\caption@ifhypcap\caption@start@\relax}%
+ \def\caption@start@{%
+% \end{macrocode}
+% Generate the \package{hyperref} label and set the \package{hyperref} anchor,
+% usually (if |hypcap=false|) both is done inside |\@caption|.
+% \begin{macrocode}
+ \caption@makestart\@captype
+ \caption@startanchor\@currentHref
+% \end{macrocode}
+% Prevent |\@caption| from generating a new \package{hyperref} label,
+% use the label we save in |\hc@currentHref| instead.
+% (We also support the |@capstart| flag from the \package{hypcap} package.)
+% \begin{macrocode}
+ \global\@capstarttrue
+ \let\hc@currentHref\@currentHref
+ \def\caption@makecurrentHref##1{%
+ \global\@capstartfalse
+ \global\let\@currentHref\hc@currentHref}%
+% \end{macrocode}
+% Prevent |\@caption| from generating a \package{hyperref} anchor since this
+% has already been done.
+% \begin{macrocode}
+ \let\caption@makeanchor\@firstofone
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makestart}
+% \changes{v3.1c}{2007/09/30}{\cs{@currentHref} will be extended by \texttt{caption}
+% instead of \texttt{xxx} now}
+% |\caption@makestart|\marg{type}
+% defines a \package{hyperref} anchor inside |\caption@start|.\par
+% Since we offer |\ContinuedFloat| the float counter can change between
+% `now' and |\caption|, i.e., we simply don't know the figure or table counter
+% yet and therefore we are not able to generate the `right' \package{hyperref}
+% label.
+% Two different solutions of this problem came into my mind:
+% \begin{enumerate}
+% \item I could use the aux file for this purpose.\par
+% -or-
+% \item I set |hypertexnames=false| locally.
+% Furthermore I use |#1.caption.|\meta{counter} (instead of |#1.|\meta{counter})
+% as naming scheme for |\@currentHref| to avoid conflicts with other hyper
+% links which are generated with |hypertexnames=true|.
+% \end{enumerate}
+% The first idea has the advantage that the `right' anchor name will be
+% generated, but one needs an additional \LaTeX\ run if figures or tables
+% will be inserted or removed.\par
+% The second idea has the advantage that it's very easy to implement, but
+% has some side-effects, e.g. the anchor names don't follow the figure or
+% table label names anymore.\par
+% Since I'm lazy I implemented the second idea, maybe I will revise this
+% later on.
+% \begin{macrocode}
+ \newcommand*\caption@makestart[1]{%
+ \begingroup
+ \Hy@hypertexnamesfalse
+% \gdef\@currentHlabel{}%
+ \hyper@makecurrent{#1.caption}%
+ \endgroup
+ \caption@Debug{hypcap start=\@currentHref}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@startanchor}
+% \changes{v3.1b}{2007/09/17}{Bugfix 06-09-17: We use \cs{caption@anchor} instead of \cs{hyper@@anchor}}
+% \changes{v3.1g}{2008/03/16}{Warning about TeX mode replaced with debug info}
+% |\caption@startanchor|\marg{Href}
+% sets a \package{hyperref} anchor inside |\caption@start|.\par
+% This code was taken from the \package{hypcap} package\cite{hypcap} and adapted.
+% \Note{Since \cs{hyper@@anchor}\marg{Href}\csmarg{\string\relax} can cause
+% a change from vertical mode to horizontal mode (design flaw in
+% \package{hyperref} package!?), and since the workaround
+% \cs{let}\cs{leavevmode}\cs{relax} which can be found in the
+% \package{hypcap} package is not always sufficient
+% (for example with ``Direct pdfmark support'' and \texttt{breaklinks=true}),
+% we use \cs{caption@anchor} instead of \cs{hyper@@anchor} here.}
+% \begin{macrocode}
+ \newcommand*\caption@startanchor[1]{%
+ \ifvmode\begingroup
+ \caption@Debug{hypcap anchor: #1 (vertical mode)}%
+ \@tempdima\prevdepth
+ \nointerlineskip
+ \vspace*{-\caption@hypcapspace}%
+ \caption@anchor{#1}%
+ \vspace*{\caption@hypcapspace}%
+ \prevdepth\@tempdima
+ \endgroup\else
+ \caption@Debug{hypcap anchor: #1 (horizontal mode)}%
+ \caption@anchor{#1}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@anchor}
+% \changes{v3.1c}{2007/10/17}{Workaround 07-10-17: We use \cs{caption@raisedlink} instead of \cs{Hy@raisedlink} now}
+% |\caption@anchor|\marg{Href} sets a \package{hyperref} anchor.
+% \begin{macrocode}
+ \newcommand*\caption@anchor[1]{%
+ \ifmeasuring@ \else
+ \caption@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}%
+ \fi}%
+% \end{macrocode}
+% \Note{Since \cs{Hy@raisedlink} change \cs{@tempdima} we surrounded it by \cs{ifvmode},
+% suppressing ``\texttt{LaTeX Warning: Float too large for page by 1.0pt}'' in \texttt{sideways} floats.
+% (This is not necessary since \package{hyperref} \version{6.77}.)}
+% \begin{macrocode}
+ \ifx\HyperRaiseLinkLength\@tempdima
+ \def\caption@raisedlink#1{\ifvmode#1\else\Hy@raisedlink{#1}\fi}%
+ \else
+ \let\caption@raisedlink\Hy@raisedlink
+ \fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@start}
+% Will be used by |\caption@freezeHref|. Apart from that we issue a warning
+% if we expect a saved \package{hyperref} label coming from |\caption@start|,
+% but there isn't any.
+% \begin{macrocode}
+ \def\caption@@start{%
+ \caption@ifundefined\hc@currentHref{%
+ \caption@Warning{%
+ The option `hypcap=true' will be ignored for this\MessageBreak
+ particular \string\caption}}{}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@freezeHref}
+% Suppress |\caption@start| from generating a \package{hyperref} label and
+% setting a \package{hyperref} anchor. Instead if |\@caption| generates a
+% \package{hyperref} label, it will be stored in |\caption@currentHref|.
+% Furthermore we need to redefine |\caption@setfloatcapt| so no
+% \package{hyperref} anchor will be placed in |\@caption|.
+% \iffalse
+% (Since |\caption@setfloatcapt| will be set to |\@firstofone| inside
+% |\subcaption| there is no need to add its restauration to
+% |\caption@subtypehook|.)
+% \fi
+% \begin{macrocode}
+ \def\caption@freezeHref{%
+ \let\caption@ORI@start\caption@start
+ \def\caption@start{\let\caption@start\caption@ORI@start}%
+% \end{macrocode}
+% \begin{macrocode}
+% \let\caption@ORI@@start\caption@@start
+% \l@addto@macro\caption@subtypehook{%
+% \let\caption@@start\caption@ORI@@start}%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\let\caption@currentHref\@undefined
+ \def\caption@@start{\global\let\caption@currentHref\@currentHref}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ORI@setfloatcapt\caption@setfloatcapt
+ \renewcommand*\caption@setfloatcapt{%
+ \ifx\caption@currentHref\@undefined \else
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \caption@ORI@setfloatcapt}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrostHref}
+% If there is a freezed |\@currentHref|, we set the \package{hyperref}
+% anchor here.
+% \begin{macrocode}
+ \def\caption@defrostHref{%
+ \ifx\caption@currentHref\@undefined \else
+ \caption@startanchor\caption@currentHref
+ \global\let\caption@currentHref\@undefined
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }}{}
+% \end{macrocode}
+%
+% \subsubsection{The hypcap package}
+% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
+% \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} \version{1.6}}
+% \changes{v3.1e}{2007/11/04}{\package{hypcap} support adapted to \package{hyperref} \version{6.77}}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hypcap}{% v1.0
+ \ifx\caption@start\relax \else % hyperref hasn't stopped early
+% \end{macrocode}
+%
+% If the \package{hypcap} package was loaded, we give up our own
+% hyperlink placement algorithm and give the control over the placement
+% to the \package{hypcap} package instead.
+%
+% \begin{macro}{\capstart}
+% \changes{v3.1k}{2009/10/09}{Support of \cs{ifcapstart} (\package{hypcap} package \version{1.10}) added}
+% We do this simply by mapping |\capstart| to |\caption@start@|,
+% although our code does not behave exactly like the original one:
+% The original |\capstart| has an effect on the next |\caption|
+% only but our version affects \emph{all} |\caption|s in the same
+% environment, at least unless a new |\capstart| will be placed.
+% \begin{macrocode}
+ \let\caption@ORI@capstart\capstart % save for compatibility mode
+ \caption@ifundefined\capstarttrue % check for v1.10 of hypcap package
+ {\def\capstart{\caption@start@}}%
+ {\def\capstart{\ifcapstart\caption@start@\fi}}%
+ \let\caption@start\relax
+ \let\caption@@start\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@hypcapspace}
+% Furthermore we map our |\caption@hypcapspace| to |\hypcapspace|
+% offered by the \package{hypcap} package.
+% \begin{macrocode}
+ \caption@set@bool\caption@ifhypcap 1%
+ \renewcommand*\caption@hypcapspace{\hypcapspace}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \fi}{}
+% \end{macrocode}
+%
+% \subsubsection{The listings package}
+% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{%
+% \end{macrocode}
+%
+% \begin{macro}{\lst@MakeCaption}
+% \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now}
+% \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added}
+% \changes{v3.2}{2010/10/26}{Bugfix 10-07-20a: Set \cs{hsize} to \cs{linewidth}, if necessary}
+% To support the \package{listings} package we need to redefine
+% |\lst@MakeCaption| so the original stuff is nested with
+% |\caption@begin| and |\caption@end| etc.
+% \Note{This macro is always called twice (with `t' resp. `b' as
+% parameter), therefore we need an extra group here.}
+% \begin{macrocode}
+ \let\caption@ORI@lst@MakeCaption\lst@MakeCaption
+ \def\lst@MakeCaption#1{% #1 is `t' or `b'
+ \begingroup
+% \end{macrocode}
+% Workaround for bug in \package{listings} package:
+% If |\hsize| seems not to be set correctly, we set it to |\linewidth|.
+% \changes{v3.3}{2018/04/30}{Bugfix from Ulrike Fischer applied, see also \url{https://github.com/axelsommerfeldt/caption/issues/1}}
+% \begin{macrocode}
+ \@tempdima\linewidth
+ \advance\@tempdima\lst@xleftmargin
+ \advance\@tempdima\lst@xrightmargin
+ \ifdim\hsize>\@tempdima
+ \hsize\@tempdima
+ \fi
+% \end{macrocode}
+% First of all, we set |position=#1| and if it was set to `top',
+% we swap the skips so the default behavior of the \package{listings} package
+% will not be changed. (Note that the \package{listings} package has set its
+% own |\abovecaptionskip| \& |\belowcaptionskip| values prior to calling
+% \cs{lst@MakeCaption}.)
+% \begin{macrocode}
+ \caption@setposition{#1}%
+ \caption@iftop{%
+ \@tempdima\belowcaptionskip
+ \belowcaptionskip\abovecaptionskip
+ \abovecaptionskip\@tempdima}{}%
+% \end{macrocode}
+% Workaround for issue with wrong skips (FIXME: should be examined further)
+% \begin{macrocode}
+ \caption@setup{rule=0}%
+% \end{macrocode}
+% Afterwards we set the local `lstlisting' options.
+% \begin{macrocode}
+ \caption@setoptions{lstlisting}%
+% \end{macrocode}
+% If the |position=| is now set to |auto|, we take over the |captionpos=|
+% setting from the \package{listings} package.
+% \begin{macrocode}
+ \caption@setautoposition{#1}%
+% \end{macrocode}
+% At the end we do similar stuff as in our \cs{@caption} code.
+% \begin{macrocode}
+ \caption@begin{lstlisting}%
+ \caption@ORI@lst@MakeCaption{#1}%
+ \caption@end
+% \end{macrocode}
+% \begin{macrocode}
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lst@makecaption}
+% \begin{macro}{\lst@maketitle}
+% Wrapper macros for typesetting the |caption=| resp. |title=| value.
+% \begin{macrocode}
+ \def\lst@makecaption{\caption@starfalse\@makecaption}%
+ \def\lst@maketitle{\caption@startrue\@makecaption\@empty}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ext@lstlisting}
+% \changes{v3.1}{2007/03/03}{This macro added}
+% Since the \package{listings} package do not define |\ext@lstlisting|
+% but we needed it when |\captionof{lstlisting}| will be done by the end user,
+% we define it here.
+% \begin{macrocode}
+ \providecommand*\ext@lstlisting{lol}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1a}{2007/07/13}{Bugfix 07-09-13: \cs{lst@@caption} will not be re-defined anymore}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The longtable package}
+%
+% \begin{macro}{\LTcaptype}
+% \changes{v3.1}{2007/07/06}{This macro and its support added}
+% |\LTcaptype| is preset to |table|.
+% \begin{macrocode}
+\providecommand*\LTcaptype{table}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{%
+% \end{macrocode}
+% \begin{macrocode}
+ \RequirePackage{ltcaption}[=2018/08/26]%
+ \let\LT@@makecaption\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\LT@array}
+% \changes{v3.1}{2007/07/22}{This redefinition added}
+% \changes{v3.1a}{2007/09/14}{Bugfix 07-09-14: Redefinition of \cs{@captionabovetrue} \& \cs{@captionabovefalse} added}
+% \changes{v3.1a}{2007/09/16}{Bugfix: This redefinition will always be done \cs{AtBeginDocument}}
+% \changes{v3.1g}{2008/01/20}{Bugfix in \cs{captionlistentry}: Table counter will not be incremented anymore, \cs{nameref} works}
+% \changes{v3.3}{2016/01/31}{Support for \cs{bicaption} added}
+% \changes{v3.3}{2018/10/05}{Definition of \cs{captionlistentry} fixed}
+% We redefine |\LT@array| here to get |\captionsetup|\marg{options}
+% working inside |longtable|s.
+% \Note{Since the \package{hyperref} package patches \cs{LT@array} as well
+% and since this only works with the original definition of \cs{LT@array},
+% we have to do this after the \package{hyperref} package,
+% i.e.~\cs{AtBeginDocument}.}
+% \begin{macrocode}
+ \caption@AtBeginDocument{%
+ \let\caption@ORI@LT@array\LT@array
+ \renewcommand*\LT@array{%
+% \end{macrocode}
+% |\captionsetup| for longtable:
+% \begin{macrocode}
+ \global\let\caption@opt@@longtable\@undefined
+ \def\captionsetup{%
+ \noalign\bgroup
+ \@ifstar\@captionsetup\@captionsetup}% gobble *
+ \def\@captionsetup##1{\LT@captionsetup{##1}\egroup}%
+ \def\LT@captionsetup##1{%
+ \captionsetup@startrue\caption@setup@options[@longtable]{##1}%
+ \global\let\caption@opt@@longtable\caption@opt@@longtable}%
+% \end{macrocode}
+% |\captionabove| \& |\captionbelow| for longtable: (\KOMAScript\ document class)
+% \begin{macrocode}
+ \def\@captionabovetrue{\LT@captionsetup{position=t}}%
+ \def\@captionabovefalse{\LT@captionsetup{position=b}}%
+% \end{macrocode}
+% |\captionlistentry| for longtable:
+% \begin{macrocode}
+ \def\captionlistentry{%
+ \noalign\bgroup
+ \@ifstar{\egroup\LT@listentry\LTcaptype}% gobble *
+ {\egroup\LT@listentry\LTcaptype}}%
+% \end{macrocode}
+% |\ContinuedFloat| for longtable:\\
+% {\small(Commented out, since it's not deeply tested and quite useless anyway)}
+% \Note{\package{hyperref} versions $<$ v6.76j uses $2\times$ \cs{hyper@makecurrent}}
+% \begin{macrocode}
+% \caption@ifhypcap{%
+% \let\caption@ORI@hyper@makecurrent\hyper@makecurrent
+% \def\hyper@makecurrent##1{%
+% \let\hyper@makecurrent\caption@ORI@hyper@makecurrent
+% \caption@makestart{##1}%
+%% \let\Hy@LT@currentHlabel\@currentHlabel
+% \let\Hy@LT@currentHref\@currentHref
+% \def\hyper@makecurrent####1{%
+%% \let\@currentHlabel\Hy@LT@currentHlabel
+% \let\@currentHref\Hy@LT@currentHref}}%
+% \let\caption@ORI@ContinuedFloat\ContinuedFloat
+% \def\ContinuedFloat{\noalign{%
+% \gdef\caption@setContinuedFloat{%
+% \let\caption@resetContinuedFloat\@gobble}%
+% \def\caption@setoptions####1{%
+% \g@addto@macro\caption@setContinuedFloat{%
+% \caption@setoptions{####1}}}%
+% \let\@captype\LTcaptype
+% \caption@ORI@ContinuedFloat}}%
+% }{%
+% \def\ContinuedFloat{\noalign{%
+% \caption@Error{%
+% \noexpand\ContinuedFloat inside longtables\MessageBreak
+% is only available with `hypcap=true'}}}%
+% }%
+% \global\let\caption@setContinuedFloat\@empty
+ \def\ContinuedFloat{\noalign{%
+ \caption@Error{\noexpand\ContinuedFloat outside float}}}%
+% \end{macrocode}
+% |\bicaption| for longtable:
+% \begin{macrocode}
+ \let\bicaption\LT@bicaption
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@ORI@LT@array}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@capti@n}
+% \changes{v3.3}{2016/02/01}{This re-definition added}
+% The original implementation:
+% \begin{verbatim}
+% \def\LT@capti@n{%
+% \@ifstar
+% {\egroup\LT@c@ption\@gobble[]}%
+% {\egroup\@xdblarg{\LT@c@ption\@firstofone}}}
+% \end{verbatim}%^^A
+% Our implementation uses |\caption@xdblarg| instead of |\@xdblarg|:
+% \begin{macrocode}
+ \def\LT@capti@n{%
+ \@ifstar
+ {\egroup\LT@c@ption\@gobble[]}%
+ {\egroup\caption@xdblarg{\LT@c@ption\@firstofone}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@makecaption}
+% \changes{v3.0d}{2004/08/10}{%
+% Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
+% \changes{v3.0e}{2005/05/05}{%
+% Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
+% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
+% \changes{v3.3}{2016/02/01}{Support for \cs{bicaption} via \cs{caption@LT@setup} added}
+% \changes{v3.3a}{2019/04/02}{Work-around for problem with \package{floatrow} added}
+% |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
+% \smallskip
+% The original definition:
+% \begin{verbatim}
+% \def\LT@makecaption#1#2#3{%
+% \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
+% % Based on article class "\@makecaption", "#1" is "\@gobble" in star
+% % form, and "\@firstofone" otherwise.
+% \sbox\@tempboxa{#1{#2: }#3}%
+% \ifdim\wd\@tempboxa>\hsize
+% #1{#2: }#3%
+% \else
+% \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+% \fi
+% \endgraf\vskip\baselineskip}%
+% \hss}}}
+% \end{verbatim}%^^A
+% Our definition:
+% \begin{macrocode}
+ \renewcommand\LT@makecaption[3]{%
+ \caption@LT@make{%
+ \caption@LT@settype\LTcaptype
+% \end{macrocode}
+%
+% |\caption@LT@setup| is re-defined inside the \package{bicaption} package
+% and contains the preparation of typesetting of the bilingual caption.
+% \begin{macrocode}
+ \caption@LT@setup
+% \end{macrocode}
+%
+% \iffalse
+% The default |position=| setting for longtables is |top|.
+% (This emulates the standard behavior of the \package{longtable} package
+% which has no skip above the caption but a skip below it.)
+% \fi
+%
+% |position=auto| is a bad idea for longtables, but we do our very best.
+% This works quite well for captions inside the longtable contents, but
+% not for captions inside the longtable (end)foot.
+% \Note{This should be `top' if unclear!}
+% \begin{macrocode}
+ \caption@setautoposition{\ifcase\LT@rows t\else b\fi}%
+% \end{macrocode}
+%
+% We set |\ifcaption@star| according the 1st argument.
+% \begin{macrocode}
+ \caption@startrue#1\caption@starfalse
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@prepare@stepcounter\LTcaptype{LT}%
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/05/05}{\cs{caption@normalsize} added}
+% \begin{macrocode}
+ \caption@begin\LTcaptype
+ \caption@normalsize
+% \end{macrocode}
+%
+% The following skip has the purpose to correct the height of the
+% |\parbox[t]|. Usually it's the height of the very first line, but
+% because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
+% it's always |0pt|.\par
+% (A different idea would be typesetting the first skip outside the longtable
+% column with |\noalign{\vskip|\ldots|}|, but this means we have to move
+% |\caption@begin| to some other place because it does not work in tabular
+% mode. And at the moment I have no idea on how to do this in an elegant
+% way\ldots)
+% \begin{macrocode}
+ \vskip-\ht\strutbox
+% \end{macrocode}
+%
+% Work-around for problem with \package{floatrow}:
+% The |\belowcaptionskip| disturbs the environment in which the caption is actually typeset (by creating extra, unwanted space),
+% so we supress this skip if the \package{floatrow} package is loaded.
+% (This fixes \issue{50})
+% \begin{macrocode}
+ \caption@ifundefined\FBifcaptop{}{%
+ \let\caption@belowskip\@empty}%
+% \end{macrocode}
+%
+% The following code should look familiar. We do our skips and use
+% |\caption@@make| to typeset the caption itself.
+% \begin{macrocode}
+ \caption@make@above
+ \caption@@make{#2}{#3}\endgraf
+ \caption@make@below
+ \caption@end}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@listentry}
+% \changes{v3.3}{2018/08/26}{This macro added}
+% \changes{v3.3}{2018/10/05}{Bugfix: \cs{ignorespaces} added}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% \begin{macrocode}
+ \renewcommand*\LT@listentry[2]{%
+ \begingroup
+ \caption@LT@settype{#1}%
+ \caption@listentry\@firstoftwo[{#1}]{#2}%
+ \endgroup\ignorespaces}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@LT@settype}
+% \changes{v3.3}{2018/08/26}{This macro added}
+% \changes{v3.3}{2018/10/05}{Uses argument no. 1 instead of \cs{LTcaptype}}
+% \begin{macrocode}
+ \newcommand*\caption@LT@settype[1]{%
+ \caption@settype*{#1}%
+% \end{macrocode}
+% If |\LTcapwidth| is not set to its default value |4in| we assume
+% that it shall overwrite our own setting.
+% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
+% \begin{macrocode}
+ \ifdim\LTcapwidth=4in \else
+ \setcaptionwidth\LTcapwidth
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setoptions{longtable}%
+% \caption@setContinuedFloat
+% \end{macrocode}
+% Finally set options applied by |\captionsetup| inside the longtable.
+% \begin{macrocode}
+ \caption@setoptions{@longtable}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@LT@setup}
+% \changes{v3.3}{2016/02/01}{This macro added}
+% Hook for stuff which prepares the typesetting of the \package{longtable} caption.
+% \begin{macrocode}
+\providecommand*\caption@LT@setup{}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{The picinpar package}
+% \changes{v3.1}{2007/06/13}{Support of the \package{picinpar} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picinpar}{%
+% \end{macrocode}
+%
+% \begin{macro}{\figwindow}
+% \begin{macro}{\tabwindow}
+% The \package{picinpar} package comes with its own caption code
+% (|\wincaption|, |\@wincaption|, |\@makewincaption|, \ldots)
+% so we redefine |\figwindow| \& |\tabwindow| to use |\caption| instead.
+% \begin{macrocode}
+ \long\def\figwindow[#1,#2,#3,#4] {%
+ \caption@window{figure}%
+ \caption@setoptions{figwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\tabwindow[#1,#2,#3,#4] {%
+ \caption@window{table}%
+ \caption@setoptions{tabwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@window}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Beside calling |\caption@settype| we redefine |\caption@boxrestore|
+% (as in \package{floatflt} \& \package{picins} package support)
+% and |\@makecaption| (as in \package{float} package support) here.
+% \begin{macrocode}
+ \newcommand*\caption@window[1]{%
+ \let\@makecaption\caption@@make
+ \caption@setautoposition b%
+ \caption@settype{#1}%
+ \caption@clearmargin
+ \caption@setfullparboxrestore}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@wincaption}
+% \changes{v3.1d}{2007/10/25}{Missing \% added}
+% \changes{v3.3}{2013/04/14}{\cs{caption@ContinuedFloattrue} added}
+% \changes{v3.3}{2018/10/06}{\cs{caption@ContinuedFloattrue} replaced by \cs{caption@setflag1}}
+% This one finally typesets the caption using |\caption|.
+% \begin{macrocode}
+ \newcommand\caption@wincaption[1]{%
+% \end{macrocode}
+% This will be done twice for every |figwindow| \& |tabwindow| caption --
+% on the first run |\picwd| is |0pt|, on the second run |\picwd| is |\hsize|.
+% \begin{macrocode}
+ \ifdim\picwd=\z@
+ \let\caption@makecurrent\@gobbletwo
+ \let\caption@@start\relax
+ \caption@prepareslc
+ \else
+ \caption@setflag1%
+ \fi
+% \end{macrocode}
+% The argument |#1| could contain simply the caption text
+% (e.g.~|A figure caption|), but it could also contain an optional argument,
+% the \meta{lst\_entry}
+% (e.g.~|[An| |entry| |to| |the| |LOF]||{A| |figure| |caption}|).
+% Therefore we have to test if |#1| begins with~|[| or not; furthermore we
+% support a starred variant -- as in |\caption*| -- so we test for~|*|, too.
+% \begin{macrocode}
+ \edef\@tempa{\expandafter\noexpand\@car#1\@nil}%
+ \if\@tempa*%
+ \let\@tempa\@firstofone
+ \else\if\@tempa[%]
+ \let\@tempa\@firstofone
+ \else
+ \let\@tempa\@empty
+ \fi\fi
+ \expandafter\caption\@tempa{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The picins package}
+% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
+%
+% \begin{macro}{\piccaptiontype}
+% |\piccaptiontype|\marg{type}\par
+% We offer this macro for changing the \meta{type} of the caption, so the user
+% doesn't have to redefine |\@captype|, as proposed in the \package{picins}
+% documentation.
+% \Note{We define this macro here so it can be used in the
+% preamble of the document, even when \thispackage\ was loaded prior to the
+% \package{picins} package.}
+% \begin{macrocode}
+\newcommand*\piccaptiontype[1]{\def\@piccaptype{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picins}{%
+% \end{macrocode}
+%
+% Initial set |\@piccaptype| and undefine |\@captype| which was set to
+% |figure| by the \package{picins} package.
+% \begin{macrocode}
+ \caption@ifundefined\@piccaptype{%
+ \caption@iftype{%
+ \let\@piccaptype\@captype
+ }{%
+ \def\@piccaptype{figure}%
+ }%
+ }{}%
+ \let\@captype\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\piccaption}
+% The original code:
+% \begin{verbatim}
+% \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
+% \end{verbatim}%^^A
+% Our code uses |\caption@star| so |\piccaption*| works,
+% and |\caption@dblarg| so |\piccaption{}| works correctly.
+% \begin{macrocode}
+ \def\piccaption{\caption@star\relax{\caption@dblarg\@piccaption}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\make@piccaption}
+% \changes{v3.1}{2007/12/06}{Bugfix: \cs{caption@clearmargin} will always be used now}
+% The original code:
+% \begin{verbatim}
+% \def\make@piccaption{%
+% [...]
+% \setbox\@TEXT=\vbox{\hsize\hsiz@\caption[\sh@rtf@rm]{\capti@nt@xt}}%
+% }
+% \end{verbatim}%^^A
+% In our code we have to correct several things:
+% \begin{enumerate}
+% \item |\@captype| must be defined, since we have removed the global
+% definition.
+% \item We use |\caption@setoptions{parpic}| so
+% |\captionsetup[parpic]{|\ldots|}| is supported.
+% \item |\linewidth| must be set correctly.
+% Usually this is done by |\@parboxrestore| inside |\@caption|,
+% but since we use |\@caption@boxrestore| we have to map this to
+% |\@parboxrestore| instead.
+% \item The two arguments of |\caption| (|\sh@rtf@rm| \& |\capti@nt@xt|)
+% should be expanded on first level so |\caption[]{|\ldots|}| and
+% |\caption[|\ldots|]{}| work correctly.
+% \end{enumerate}
+% \begin{macrocode}
+ \let\caption@ORI@make@piccaption\make@piccaption
+ \def\make@piccaption{%
+ \let\caption@ORI\caption
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\caption[##1]##2{%
+ \caption@freezeHref % will be defrosted in \ivparpic
+ \caption@settype\@piccaptype
+% \ifnum\c@piccaptionpos>2\relax
+ \caption@clearmargin
+% \else
+% \captionwidth\z@ % do not use "width=" setting
+% \fi
+ \caption@setfullparboxrestore
+ \caption@setoptions{parpic}%
+ \caption@setautoposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\expandafter\expandafter\caption@ORI
+ \expandafter\expandafter\expandafter[%
+ \expandafter\expandafter\expandafter{%
+ \expandafter##1\expandafter}\expandafter]\expandafter{##2}}%
+% \end{macrocode}
+% {\footnotesize\begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\begingroup|\\
+% | \toks0\expandafter{##1}| |\toks2\expandafter{##2}|\\
+% | \edef\x{\endgroup|\\
+% | \noexpand\caption@ORI[{\the\toks0}]{\the\toks2}}|\\
+% | \x|
+% \end{quote}
+% \begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\edef\x{%|\\
+% | \noexpand\caption@ORI[{\unexpanded\expandafter{##1}}]%|\\
+% | {\unexpanded\expandafter{##2}}}|\\
+% |\-|
+% \end{quote}}
+% \begin{macrocode}
+ \caption@ORI@make@piccaption
+ \let\caption\caption@ORI}%
+% \end{macrocode}
+% \end{macro}
+%
+
+% \begin{macro}{\ivparpic}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% We need to set our \package{hyperref} anchor here.
+% Not bullet-proof since we have to redefine |\noindent| here!
+% \begin{macrocode}
+ \let\caption@ORI@ivparpic\ivparpic
+ \def\ivparpic(#1,#2)(#3,#4)[#5][#6]#7{%
+ \let\caption@ORI@noindent\noindent
+ \def\noindent{%
+ \caption@defrostHref
+ \let\noindent\caption@ORI@noindent
+ \noindent}%
+ \caption@ORI@ivparpic(#1,#2)(#3,#4)[{#5}][{#6}]{#7}%
+ \let\noindent\caption@ORI@noindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\piccaptiontype\@undefined
+}
+% \end{macrocode}
+%
+% \subsubsection{The rotating package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{rotating}[1995/08/22 v2.10]{%
+% \end{macrocode}
+%
+% \begin{macro}{\rotcaption}
+% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@star} removed}
+% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
+% Make |\rotcaption*| work.
+% \begin{macrocode}
+ \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
+% \let\@rotcaption\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\rotcaptionof}
+% \changes{v3.0i}{2005/12/07}{New}
+% Make |\rotcaptionof(*)| work.
+% \begin{macrocode}
+ \def\rotcaptionof{%
+ \caption@teststar\caption@of{\rotcaption*}\rotcaption}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makerotcaption}
+% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
+% \changes{v3.0m}{2007/03/04}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox} now}
+% \changes{v3.3}{2012/12/26}{Rewritten (again)}
+% Original (bugfixed) code:
+% \begin{verbatim}
+% \long\def\@makerotcaption#1#2{%
+% \setbox\@tempboxa\hbox{#1: #2}%
+% \ifdim \wd\@tempboxa > .8\vsize
+% \rotatebox{90}{%
+% \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
+% }%\par % <== \par removed (AR)
+% \else%
+% \rotatebox{90}{\box\@tempboxa}%
+% \fi
+% \nobreak\hspace{12pt}% <== \nobreak added (AR)
+% }
+% \end{verbatim}%^^A
+% Our version emulates this behavior, but if |width=| is set,
+% the rotated caption is always typeset as |\parbox|.
+% (Note that |margin=| is not supported here.)
+% \begin{macrocode}
+ \long\def\@makerotcaption#1#2{%
+ \rotatebox{90}{%
+ \ifdim\captionwidth=\z@
+ \setcaptionwidth{.8\vsize}%
+ \l@addto@macro\caption@singleline{%
+ \caption@setup{parbox=none}}%
+ \fi
+ \let\caption@calcmargin\relax
+ \caption@@make{#1}{#2}}%
+ \nobreak\hspace{12pt}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The sidecap package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{sidecap}[2003/06/06 v1.6f]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\SC@zfloat}
+% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
+% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@star} removed}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} will be saved \& restored now}
+% \changes{v3.2a}{2011/08/17}{Bugfix: Uses \cs{caption@freeze} instead of \cs{caption@freeze*} now}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
+% This macro will be called at the start of the environment, here is a good
+% opportunity to do some adaptations to |\caption| and |\captionsetup|.
+% \begin{macrocode}
+ \let\caption@ORI@SC@zfloat\SC@zfloat
+ \def\SC@zfloat#1#2#3[#4]{%
+% \end{macrocode}
+% First we use the original definition, but restore \cs{caption} and \cs{label}
+% so \cs{caption@freeze} and \cs{caption@warmup} will work correctly.
+% \begin{macrocode}
+ \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]%
+ \SC@RestoreCommands
+% \end{macrocode}
+% Since the sidecap package uses our |\caption| code outside the
+% environment the regular |\captionsetup| will not work.
+% So we need a special version here which saves the given argument list
+% which will be executed later on.
+% Furthermore we need to make |\caption*| work.
+% \begin{macrocode}
+ \caption@freezetype{#2}%
+% \end{macrocode}
+% The sidecap package uses |\ifx\label\SC@label| to test if it is just inside a
+% |SC|\-|figure| or not. So we redefine |\SC@label| here so this test will still work.
+% \begin{macrocode}
+ \let\SC@label\label}%
+% \end{macrocode}
+% \begin{macrocode}
+ \providecommand*\SC@RestoreCommands{%
+ \let\caption=\SC@orig@caption \let\label=\SC@orig@label}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\endSC@FLOAT}
+% \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
+% \changes{v3.1}{2007/05/05}{Call of \cs{caption@setoptions}\arg{SCfloat} added}
+% This macro will be called at the end of the environment, here we need to
+% setup our stuff before the \package{sidecap} package actually typesets
+% its caption.
+% \begin{macrocode}
+ \let\caption@ORI@endSC@FLOAT\endSC@FLOAT
+ \def\endSC@FLOAT{%
+% \end{macrocode}
+% Before we can typeset the caption we need to set the margin to zero
+% because any extra margin would only be disturbing here.\par
+% (We don't need to take care about the caption position because
+% the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
+% to a skip of zero anyway.)\par
+% Furthermore |\SC@justify| will override the caption justification, if set.
+% The usage of |\SC@justify| differs from version to version of the
+% \package{sidecap} package:\par
+% \begin{tabular}{ll}
+% Version 1.4: & |\SC@justify| is not defined\\
+% Version 1.5: & |\SC@justify| is |\relax| when not set\\
+% Version 1.6: & |\SC@justify| is |\@empty| when not set\\
+% \end{tabular}
+% \begin{macrocode}
+ \def\caption@setSC@justify{%
+ \caption@clearmargin
+ \ifx\SC@justify\@empty \else
+ \let\caption@hj\SC@justify
+ \let\SC@justify\@empty
+ \fi}%
+% \end{macrocode}
+% Make the original definition of |\endSC@FLOAT| to use our caption
+% stuff instead of its own.
+% \Note{At this point the \package{sidecap} definition of \cs{caption} is valid,
+% not the regular one!}
+% \begin{macrocode}
+ \let\caption\SC@orig@caption
+ \def\SC@orig@caption[##1]##2{%
+ \caption@setSC@justify
+%%% \caption@setoptions{SC}%
+ \caption@setoptions{SC\@captype}%
+ \caption@defrost}%
+% \end{macrocode}
+% Finally we call the original definition of |\endSC@FLOAT|.
+% \begin{macrocode}
+ \caption@setSC@justify % for compatibility mode
+ \caption@prepare@defrost
+ \caption@ORI@endSC@FLOAT}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The subfigure package}
+% \changes{v3.1}{2007/04/06}{subfigure package support added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{subfigure}[2002/01/23 v2.1]{%
+% \end{macrocode}
+%
+% \begin{macro}{\sf@ifpositiontop}
+% \changes{v3.1a}{2007/09/15}{Bugfix 07-09-15: Check for \cs{@captype} added}
+% If the \package{subfigure} package is loaded, we map |\sf@ifpositiontop|
+% to |\iffiguretopcap| resp. |\iftabletopcap|, so the \package{subfigure}
+% \version{2.1} options \opt{figbotcap} etc. will still work.
+% \begin{macrocode}
+ \def\sf@ifpositiontop{%
+ \ifx\@captype\@undefined
+ \expandafter\@gobbletwo
+ \else\ifx\@captype\relax
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\expandafter\sf@if@position@top
+ \fi\fi}
+% \end{macrocode}
+% \begin{macrocode}
+ \def\sf@if@position@top{%
+ \@ifundefined{if\@captype topcap}%
+ {\@gobbletwo}%
+ {\@nameuse{if\@captype topcap}%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The supertabular and xtab packages}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{supertabular}[2002/07/19 v4.1e]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
+% \changes{v3.1h}{2008/04/01}{Bugfix: Star variant does not increment table counter anymore}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1h}{2008/04/01}{Made \cs{nameref} \& \cs{autoref} work}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[{#1}]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
+% \changes{v3.1h}{2008/04/01}{Bugfix: \cs{@currentlabelname} will be set now}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% \if@topcaption \vskip 10\p@ \fi
+% \endgroup}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{supertabular}%
+% \end{macrocode}
+% The |position=| setting will be overwritten by the
+% \package{supertabular} package: If |\topcaption| was used,
+% the position will be |top| automatically, |bottom| otherwise.
+% \begin{macrocode}
+ \def\caption@fixposition{%
+ \caption@setposition{\if@topcaption t\else b\fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@boxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1h}{2008/04/01}{Support of the xtab package added}
+% \begin{macrocode}
+\caption@IfPackageLoaded{xtab}[2000/04/09 v2.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[{#1}]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \@initisotab
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}%
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% %% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% %% \if@topcaption \vskip 10\p@ \fi
+% \endgroup
+% \global\advance\ST@pageleft -\PWSTcapht
+% \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{xtabular}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@fixposition{%
+ \caption@setposition{\if@topcaption t\else b\fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@initisotab
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@boxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end
+ \global\advance\ST@pageleft -\PWSTcapht
+ \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The threeparttable package}
+% \changes{v3.1}{2007/05/08}{Support of the \package{threeparttable} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{threeparttable}[2003/06/13 v3.0]{%
+% \end{macrocode}
+%
+% \begin{macro}{\threeparttable}
+% \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined}
+% Unfortunately |\@captype| is not set when |\TPT@common| will be used,
+% so we have to redefine |\threeparttable| and |\measuredfigure| instead.
+% \begin{macrocode}
+ \let\caption@ORI@threeparttable\threeparttable
+ \renewcommand*\threeparttable{%
+ \caption@settype{\@ifundefined{@captype}{table}{\@captype}}%
+%%% \caption@setposition a% ?
+ \caption@clearmargin
+ \caption@setoptions{threeparttable}%
+ \caption@ORI@threeparttable}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\measuredfigure}
+% \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined}
+% Same here\ldots
+% \begin{macrocode}
+ \let\caption@ORI@measuredfigure\measuredfigure
+ \renewcommand*\measuredfigure{%
+ \caption@settype{\@ifundefined{@captype}{figure}{\@captype}}%
+%%% \caption@setposition a% ?
+ \caption@clearmargin
+ \caption@setoptions{measuredfigure}%
+ \caption@ORI@measuredfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\TPT@caption}
+% The original code:
+% \begin{verbatim}
+% \def\TPT@caption#1[#2]#3{\gdef\TPT@docapt
+% {\par\global\let\TPT@docapt\@undefined \TPT@LA@caption{#1}[{#2}]%
+% {\strut\ignorespaces#3\ifhmode\unskip\@finalstrut\strutbox\fi}}%
+% \ifx\TPT@hsize\@empty \let\label\TPT@gatherlabel \abovecaptionskip\z@skip
+% \else \TPT@docapt \fi \ignorespaces}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \def\TPT@caption#1[#2]#3{%
+ \gdef\TPT@docapt{%
+ \global\let\TPT@docapt\@undefined
+ \caption@setautoposition\caption@TPT@position
+ \TPT@LA@caption{#1}[{#2}]{#3}}%
+ \ifx\TPT@hsize\@empty
+ \let\label\TPT@gatherlabel % Bug: does not work for measuredfigures
+ \gdef\caption@TPT@position{t}%
+ \g@addto@macro\TPT@docapt\caption@TPT@eatvskip
+ \else
+ \def\caption@TPT@position{b}%
+ \TPT@docapt
+ \fi
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ %\newcommand*\caption@TPT@eatvskip{\vskip-.2\baselineskip}%
+ \def\caption@TPT@eatvskip#1\vskip{#1\@tempdima=}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{The wrapfig package}
+% \changes{v3.1}{2007/05/05}{Support of the \package{wrapfig} package added}
+% \changes{v3.2d}{2011/11/02}{Support of the \package{wrapfig} package rewritten}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{wrapfig}[2003/01/31 v3.6]{%
+% \end{macrocode}
+%
+% \begin{macro}{\wrapfloat}
+% \changes{v3.2d}{2011/11/02}{Redefinition of this macro added}
+% First of all we make the \package{wrapfig} package independent from the package
+% load order regarding the \package{float} package.
+% Since the usage of |\@float@set|\-|every| is missing in the code of the \package{wrapfig}
+% package (it should be in the redefinition of |\float@re|\-|style|, right after
+% |\@nameuse{fst@#1}|), we don't use it here, too,
+% especially since |\wrap|\-|float| will usually not be used when used with re-styled floats.
+% \begin{macrocode}
+ \renewcommand*\wrapfloat[1]{%
+ \def\@captype{#1}%
+ \@ifundefined{fst@#1}{}{%
+ \@nameuse{fst@#1}%
+% \@float@setevery{#1}%
+ \def\WF@floatstyhook{\let\@currbox\WF@box
+ \global\setbox\WF@box\float@makebox{\wd\WF@box}}}%
+ \@ifnextchar[\WF@wr{\WF@wr[]}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\WF@rapt}
+% \changes{v3.2d}{2011/11/02}{Usage of \cs{WF@captionstyhook} added}
+% Original code:
+% \begin{verbatim}
+% \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+% \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+% \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+% \ifdim\hsize>\z@ \@parboxrestore \else
+% \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+% \ignorespaces \fi}
+% \end{verbatim}%^^A
+% Our code has |\WF@captionstyhook| in addition:
+% \begin{macrocode}
+ \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+ \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+ \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+ \expandafter\WF@captionstyhook\expandafter{\@captype}% <= new
+ \ifdim\hsize>\z@ \@parboxrestore \else
+ \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+ \ignorespaces \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\WF@captionstyhook}
+% \changes{v3.2d}{2011/11/02}{This macro added}
+% \changes{v3.2e}{2011/11/10}{Bugfix 11-11-09: float package support fixed}
+% We place our \package{hyperref} anchor here, apply the `wrap' options etc.
+% Since the usage of |\@float@set|\-|every| is missing in the \package{wrapfig}
+% package we will catch it up here for making the necessary adaptions to the
+% \package{float} package.
+% \begin{macrocode}
+ \def\WF@captionstyhook#1{%
+ \let\@captype\@undefined
+ \@ifundefined{fst@#1}{}{\@float@setevery{#1}}%
+ \caption@settype{#1}%
+ \caption@clearmargin
+%%% \caption@setoptions{wrap}%
+ \caption@setoptions{wrap#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \begin{thebibliography}{99}
+% \bibitem{beamer}
+% Till Tantau:\\
+% \href{http://www.ctan.org/pkg/beamer}%
+% {\emph{The beamer class, User Guide for version 3.25}},\\
+% December 26, 2012
+%
+% \bibitem{KOMAScript}
+% Markus Kohm \& Jens-Uwe-Morawski:\\
+% \href{http://www.ctan.org/pkg/koma-script}%
+% {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\
+% 2012-07-22
+%
+% \bibitem{NTG}
+% Victor Eijkhout:\\
+% \href{http://www.ctan.org/pkg/ntgclass}%
+% {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\
+% 3 September 1989
+%
+% \bibitem{float}
+% Anselm Lingnau:\\
+% \href{http://www.ctan.org/pkg/float}%
+% {\emph{An Improved Environment for Floats}},\\
+% 2001/11/08
+%
+% \bibitem{floatflt}
+% Mats Dahlgren:\\
+% \href{http://www.ctan.org/pkg/floatflt}%
+% {\emph{Welcome to the floatflt package}},\\
+% 1998/06/05
+%
+% \bibitem{floatrow}
+% Olga Lapko:\\
+% \href{http://www.ctan.org/pkg/floatrow}%
+% {\emph{The floatrow package documentation}},\\
+% 2009/08/02
+%
+% \bibitem{fltpage}
+% Sebastian Gross:\\
+% \href{http://www.ctan.org/pkg/fltpage}%
+% {\emph{Welcome to the beta test of fltpage package!}},\\
+% 1998/11/13
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/hyperref}%
+% {\emph{Hypertext marks in \LaTeX: a manual for hyperref}},\\
+% November 2012
+%
+% \bibitem{hypcap}
+% Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/oberdiek}%
+% {\emph{The hypcap package -- Adjusting anchors of captions}},\\
+% 2011/02/16
+%
+% \bibitem{listings}
+% Carsten Heinz \& Brooks Moses:\\
+% \href{http://www.ctan.org/pkg/listings}%
+% {\emph{The Listings Package}},\\
+% 2007/02/22
+%
+% \bibitem{longtable}
+% David Carlisle:\\
+% \href{http://www.ctan.org/pkg/longtable}%
+% {\emph{The longtable package}},\\
+% 2004/02/01
+%
+% \bibitem{picinpar}
+% Friedhelm Sowa:\\
+% \href{http://www.ctan.org/pkg/picinpar}%
+% {\emph{Pictures in Paragraphs}},\\
+% July 13, 1993
+%
+% \bibitem{picins}
+% Joachim Bleser and Edmund Lang:\\
+% \href{http://www.ctan.org/pkg/picins}%
+% {\emph{PicIns-Benutzerhandbuch Version 3.0}},\\
+% September~1992
+%
+% \bibitem{rotating}
+% Sebastian Rahtz and Leonor Barroca:\\
+% \href{http://www.ctan.org/pkg/rotating}%
+% {\emph{A style option for rotated objects in \LaTeX}},\\
+% 1997/09/26
+%
+% \bibitem{sidecap}
+% Rolf Niepraschk \& Hubert G\"a\ss lein:\\
+% \href{http://www.ctan.org/pkg/sidecap}%
+% {\emph{The sidecap package}},\\
+% 2003/06/06
+%
+% \bibitem{subfigure}
+% Steven D. Cochran:\\
+% \href{http://www.ctan.org/pkg/subfigure}%
+% {\emph{The subfigure package}},\\
+% 2005/03/15
+%
+% \bibitem{subfig}
+% Steven D. Cochran:\\
+% \href{http://www.ctan.org/pkg/subfig}%
+% {\emph{The subfig package}},\\
+% 2005/07/05
+%
+% \bibitem{supertabular}
+% Johannes Braams and Theo Jurriens:\\
+% \href{http://www.ctan.org/pkg/supertabular}%
+% {\emph{The supertabular environment}},\\
+% 2004/02/20
+%
+% \bibitem{threeparttable}
+% Donald Arseneau:\\
+% \href{http://www.ctan.org/pkg/threeparttable}%
+% {\emph{Three part tables: title, tabular environment, notes}},\\
+% March 5, 2010
+%
+% \bibitem{wrapfig}
+% Donald Arseneau:\\
+% \href{http://www.ctan.org/pkg/wrapfig}%
+% {\emph{WRAPFIG.STY ver 3.6}},\\
+% Jan 31, 2003
+%
+% \bibitem{xtab}
+% Peter Wilson:\\
+% \href{http://www.ctan.org/pkg/xtab}%
+% {\emph{The xtab package}},\\
+% 2011/07/31
+% \end{thebibliography}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.3/caption3.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.3/caption3.dtx
new file mode 100644
index 00000000000..bdffdcc66a1
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.3/caption3.dtx
@@ -0,0 +1,4176 @@
+% \iffalse meta-comment
+%
+% This is file `caption3.dtx'.
+%
+% Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files caption.ins, caption.dtx, caption2.dtx,
+% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx,
+% the derived files caption.sty, caption2.sty, caption3.sty,
+% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty,
+% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
+%
+% \fi
+% \CheckSum{3961}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{caption3.drv}[2015/09/15 v1.8 Implementation of the caption kernel]
+\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+%\let\ORIsubsection\subsection
+%\def\subsection{\clearpage\ORIsubsection}
+%
+\makeatletter % make room for subsections like 2.16.14 in the TOC
+%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
+\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
+\makeatother
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage[debug]{caption3}[2018/05/01]
+%
+\DeclareRobustCommand*\eTeX{\texorpdfstring
+ {\leavevmode\hbox{$\varepsilon$}-\TeX}%
+ {e-TeX}}
+\DeclareRobustCommand*\AmS{\texorpdfstring
+ {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
+ {AMS}}
+\DeclareRobustCommand*\KOMAScript{\texorpdfstring
+ {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
+ {KOMA-Script}}
+\DeclareRobustCommand*\NTG{NTG}
+\DeclareRobustCommand*\SmF{SMF}
+%
+\begin{document}
+ \DocInput{caption3.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
+% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
+% \let\class\puresf \let\package\puresf
+% \let\env\purett \let\opt\purett
+%
+% \def\thispackage{the \package{caption} kernel}
+% \def\Thispackage{The \package{caption} kernel}
+%
+% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+% \newcommand*\version[2][]{\textit{v#2}}
+%
+% \GetFileInfo{caption3.drv}
+% \let\docdate\filedate
+% \GetFileInfo{caption3.sty}
+%
+% \title{The Implementation of
+% \texorpdfstring{\thispackage\thanks{%^^A
+% This package has version number \fileversion, last revised \filedate.}}%^^A
+% {the caption kernel}}
+% \author{Axel Sommerfeldt\\
+% \url{https://gitlab.com/axelsommerfeldt/caption}}
+% \date{\docdate}
+% \maketitle
+%
+% \begin{abstract}
+% \Thispackage\ consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% The kernel provides all the user commands and internal macros which are
+% necessary for typesetting captions and setting parameters regarding these.
+% While the standard \LaTeX\ document classes provide an internal command
+% called |\@makecaption| and no options to control its behavior (except the
+% vertical skips above and below the caption itself), we provide similar
+% commands called |\caption@make| and |\caption@@make|, but with a lot of
+% options which can be selected with |\captionsetup|.
+% Loading the kernel part do not change the output of a \LaTeX\ document
+% -- it just provides functionality which can be used by \LaTeXe\ packages
+% which typesets captions, for example the \package{caption} and
+% \package{subfig} packages.
+% \end{abstract}
+%
+% \StopEventually{}
+% \clearpage
+% \tableofcontents
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
+%
+% \changes{v1.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v1.0c}{2004/11/28}{Split into two packages:
+% \package{caption} \& \package{caption3}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \let\subsubsection\subsection
+% \let\subsection\section
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \subsection{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption3}[2019/09/01 v1.8d caption3 kernel (AR)]
+% \end{macrocode}
+%
+% \subsection{Workaround for bug in package \package{arabtex}}
+% \package{arabtex} re-defines \cs{@gobble} as not-long so the packages of the
+% \package{caption} package bundle are doomed to fail.
+% Since this fatal bug won't be fixed in \package{arabtex} but we are dependent on a
+% proper definition of \cs{@gobble}, \cs{@firstofone}, \cs{@firstoftwo}, \cs{@secondoftwo}
+% and so on we fix this here. (Sigh!)
+% \begin{macrocode}
+\providecommand\caption@FixArabTeX{%
+ \def\caption@tempa##1{}%
+ \ifx\caption@tempa\@gobble
+ \PackageInfo{caption3}{Fixing ArabTeX}%
+ \long\def\@gobble##1{}%
+ \fi}
+% \end{macrocode}
+% Do the fix now and at |\begin{document}|, in case \package{arabtex} will be loaded after \package{caption}.
+% \begin{macrocode}
+\caption@FixArabTeX
+\AtBeginDocument{%
+ \caption@FixArabTeX
+ \let\caption@FixArabTeX\@undefined}
+% \end{macrocode}
+%
+% \subsection{Generic helpers}
+%
+% \begin{macro}{\@nameundef}
+% This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel.
+% We use it to remove the definition of some commands and keyval options after
+% |\begin{document}| (to save \TeX\ memory) and to remove caption options defined
+% with |\captionsetup|\oarg{type}.
+% \begin{macrocode}
+\providecommand*\@nameundef[1]{%
+ \expandafter\let\csname #1\endcsname\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@addto@macro}
+% \changes{v1.5}{2013/04/26}{Revised}
+% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which
+% globally adds tokens to existing macros, like in |\AtBeginDocument|.
+% This is the same but it works local, not global.
+% \begin{macrocode}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname currentgrouplevel\endcsname\relax
+ \PackageInfo{caption3}{TeX engine: TeX}
+ \let\caption@ifeTeX\@secondoftwo
+ \providecommand\l@addto@macro[2]{%
+ \begingroup
+ \toks@\expandafter{#1#2}%
+ \xdef\caption@addto@temp{\the\toks@}%
+ \endgroup
+ \let#1\caption@addto@temp}
+\else
+ \PackageInfo{caption3}{TeX engine: e-TeX}
+ \let\caption@ifeTeX\@firstoftwo
+ \providecommand\l@addto@macro[2]{%
+ \edef#1{\unexpanded\expandafter{#1#2}}}
+\fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bothIfFirst}
+% \begin{macro}{\bothIfSecond}
+% |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond|
+% tests if the second argument is not empty. If yes both arguments get
+% typeset, otherwise none of them.
+% \begin{macrocode}
+\def\bothIfFirst#1#2{%
+ \protected@edef\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty \else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\def\bothIfSecond#1#2{%
+ \protected@edef\caption@tempa{#2}%
+ \ifx\caption@tempa\@empty \else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifundefined}
+% \changes{v1.3a}{2011/08/12}{This macro added}
+% \changes{v1.3b}{2011/08/18}{Made expandable}
+% Similar to \cs{@ifundefined} offered by the \LaTeX kernel, but does
+% not define the undefined macro as \cs{relax}.
+% \begin{macrocode}
+\newcommand*\caption@ifundefined[1]{%
+ \ifx#1\@undefined
+ \expandafter\@firstoftwo
+ \else\ifx#1\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifinlist}
+% \changes{v1.1}{2007/07/29}{Rewritten}
+% This helper macro checks if the first argument is in the comma separated
+% list which is offered as second argument. So for example
+% \begin{quote}
+% |\caption@ifinlist{frank}{axel,frank,olga,steven}{yes}{no}|
+% \end{quote}
+% would expand to |yes|.
+% \begin{macrocode}
+\newcommand*\caption@ifinlist{%
+ \@expandtwoargs\caption@@ifinlist}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@ifinlist[2]{%
+ \begingroup
+ \def\@tempa##1,#1,##2\@nil{%
+ \endgroup
+ \ifx\relax##2\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}%
+ \@tempa,#2,#1,\@nil}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifin@list}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% |\caption@ifin@list|\marg{cmd}\marg{list entry}\marg{yes}\marg{no}
+% \begin{macrocode}
+\newcommand*\caption@ifin@list[2]{%
+ \caption@ifempty@list#1%
+ {\@secondoftwo}%
+ {\@expandtwoargs\caption@@ifinlist{#2}{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@addto@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@g@addto@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@g@addto@list[2]{%
+ \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@addto@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@l@addto@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@l@addto@list[2]{%
+ \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@removefrom@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@g@removefrom@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@g@removefrom@list[2]{%
+ \caption@l@removefrom@list#1{#2}%
+ \global\let#1#1}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@removefrom@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@l@removefrom@list|\marg{cmd}\marg{list entry}\par
+% \Note[Caveat]{\meta{cmd} will be expanded during this process since
+% \cs{@removeelement} is using \cs{edef} to build the new list!}
+% \begin{macrocode}
+\newcommand*\caption@l@removefrom@list[2]{%
+ \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@for@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@for@list|\marg{cmd}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\caption@for@list[2]{%
+ \caption@ifempty@list#1{}{%
+ \def\caption@tempb##1{#2}%
+ \@for\caption@tempa:=#1\do{%
+ \expandafter\caption@tempb\expandafter{\caption@tempa}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@ifempty@list|\marg{cmd}\marg{true}\marg{false}
+% \begin{macrocode}
+\newcommand*\caption@ifempty@list[1]{%
+ \ifx#1\@undefined
+ \expandafter\@firstoftwo
+ \else\ifx#1\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else\ifx#1\@empty
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak[3]
+% \begin{macro}{\caption@setbool}
+% \begin{macro}{\caption@set@bool}
+% \changes{v1.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added}
+% \begin{macro}{\caption@ifbool}
+% \begin{macro}{\caption@undefbool}
+% For setting and testing boolean options we offer these three helper macros:
+% \begin{quote}
+% |\caption@setbool|\marg{name}\marg{value}\\
+% | |(with |value = false/true/no/yes/off/on/0/1|)\\
+% |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\
+% |\caption@undefbool|\marg{name}
+% \end{quote}
+% \begin{macrocode}
+\newcommand*\caption@setbool[1]{%
+ \expandafter\caption@set@bool\csname caption@if#1\endcsname}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@bool[2]{%
+ \caption@ifinlist{#2}{1,true,yes,on}{%
+ \let#1\@firstoftwo
+ }{\caption@ifinlist{#2}{0,false,no,off}{%
+ \let#1\@secondoftwo
+ }{%
+ \caption@Error{Undefined boolean value `#2'}%
+ }}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@teststar}
+% \changes{v1.1}{2007/05/08}{This macro and its usage added}
+% \changes{v1.1e}{2007/10/28}{\cs{caption@teststar@} added}
+% |\caption@teststar|\marg{cmd}\marg{star arg}\marg{non-star arg}\\
+% |\caption@teststar@|\marg{cmd}\marg{star arg}\marg{non-star arg}
+% \begin{macrocode}
+\newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@teststar@[3]{%
+ \@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}}
+\AtBeginDocument{\let\caption@teststar@\caption@teststar}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifatletter{%
+ \ifnum\the\catcode`\@=11
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\AtBeginDocument{\let\caption@ifatletter\@secondoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@withoptargs}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% \changes{v1.5}{2012/04/09}{This macro revised}
+% |\caption@withoptargs|\marg{cmd}
+% \begin{macrocode}
+\newcommand*\caption@withoptargs[1]{%
+ \@ifstar
+ {\def\caption@tempa{*}\caption@@withoptargs{#1}}%
+ {\def\caption@tempa{}\caption@@withoptargs{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@withoptargs#1{%
+ \@ifnextchar[%]
+ {\caption@@@withoptargs{#1}}%
+ {\caption@@@@withoptargs{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@withoptargs#1[#2]{%
+ \l@addto@macro\caption@tempa{[{#2}]}%
+ \caption@@withoptargs{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@@withoptargs#1{%
+ \def\caption@tempb{#1}%
+ \expandafter\caption@tempb\expandafter{\caption@tempa}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@gobble}
+% \changes{v1.4}{2011/08/19}{This macro added}
+% |\caption@gobble*|\oarg{arg}\oarg{\ldots}\marg{arg}\par
+% Same as |\@gobble|, but gobbles optional arguments as well.
+% \begin{macrocode}
+\DeclareRobustCommand*\caption@gobble{%
+ \caption@withoptargs\@gobbletwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@CheckCommand}
+% \changes{v1.1}{2007/04/10}{This macro added}
+% \begin{macro}{\caption@IfCheckCommand}
+% \changes{v1.1}{2007/04/10}{This macro added}
+% \changes{v1.2b}{2008/08/02}{Revised so \cs{next} is no longer used}
+% \changes{v1.5}{2012/08/25}{Bugfix: Uses \cs{caption@tempa} instead of \cs{@tempa}}
+% |\caption@CheckCommand|\marg{macro}\marg{definition of macro}\par
+% checks if a command already exists, with the same definition.
+% It can be used more-than-once to check if one of multiple definitions will
+% finally match.
+% (It redefines itself later on to |\@gobbletwo| if the two commands match
+% fine, making further checks harmless.)\par
+% |\caption@IfCheckCommand|\marg{true}\marg{false}\par
+% will execute the \meta{true} code if one match was finally given,
+% the \meta{false} code otherwise.
+% (It simply checks if |\caption@CheckCommand| is |\@gobbletwo| and
+% restores the starting definition of |\caption@CheckCommand|.)
+% \begin{macrocode}
+\newcommand\caption@DoCheckCommand[2]{%
+ \begingroup
+ \let\caption@tempa#1%
+ #2%
+ \ifx\caption@tempa#1%
+ \endgroup
+ \let\caption@CheckCommand\@gobbletwo
+ \else
+ \endgroup
+ \fi}
+\@onlypreamble\caption@DoCheckCommand
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@CheckCommand\caption@DoCheckCommand
+\@onlypreamble\caption@CheckCommand
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@IfCheckCommand{%
+ \ifx\caption@CheckCommand\@gobbletwo
+ \let\caption@CheckCommand\caption@DoCheckCommand
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\@onlypreamble\caption@IfCheckCommand
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@AtBeginDocument}
+% \changes{v1.1}{2007/04/13}{This macro and its usage added}
+% \changes{v1.2e}{2010/01/09}{Adapted to the combine document class}
+% |\caption@AtBeginDocument*|\marg{code}\\
+% Same as |\AtBeginDocument| but the execution of code
+% will be surrounded by two |\PackageInfo|s.
+% The starred variant causes the code to be executed after all code
+% specified using the non-starred variant.
+% \begin{macrocode}
+\let\caption@begindocumenthook\@empty
+\let\caption@@begindocumenthook\@empty
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@AtBeginDocument{%
+ \caption@teststar\g@addto@macro
+ \caption@@begindocumenthook\caption@begindocumenthook}
+%\@onlypreamble\caption@AtBeginDocument
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{%
+ \caption@InfoNoLine{Begin \noexpand\AtBeginDocument code}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}%
+ \caption@begindocumenthook
+ \let\caption@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar\@firstofone\@firstofone}%
+ \caption@@begindocumenthook
+ \let\caption@@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@InfoNoLine{End \noexpand\AtBeginDocument code}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Information, Warnings, and Errors}
+%
+% \begin{macro}{\caption@Info}
+% \changes{v1.3}{2010/10/25}{Moved from package to kernel}
+% |\caption@Info|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Info[1]{%
+ \PackageInfo{caption}{#1}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@InfoNoLine}
+% \changes{v1.3}{2010/10/25}{Moved from package to kernel}
+% |\caption@InfoNoLine|\marg{message}\\
+% \Note{The \cs{@gobble} at the end of the 2nd argument of
+% \cs{PackageInfo} suppresses the line number info.
+% See TLC2\cite{TLC2}, A.4.7, p885 for details.}
+% \begin{macrocode}
+\newcommand*\caption@InfoNoLine[1]{%
+ \caption@Info{#1\@gobble}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@Warning}
+% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% |\caption@Warning|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Warning[1]{%
+ \caption@WarningNoLine{#1\on@line}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@WarningNoLine}
+% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% |\caption@WarningNoLine|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@WarningNoLine[1]{%
+ \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@wh{%
+ See the caption package documentation for explanation.}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@Error}
+% \changes{v1.0j}{2007/01/20}{This macro added, will now be used for errors}
+% \changes{v1.0o}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}}
+% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed}
+% |\caption@Error|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Error[1]{%
+ \PackageError{caption}{#1}\caption@eh}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@eh{%
+ If you do not understand this error, please take a closer look\MessageBreak
+ at the documentation of the `caption' package, especially the\MessageBreak
+ section about errors.\MessageBreak\@ehc}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@KV@err}
+% \changes{v1.1b}{2007/09/18}{This macro added}
+% \begin{macrocode}
+\let\caption@KV@err\caption@Error
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Using the keyval package}
+%
+% We need the \package{keyval} package for option handling, so we load it here.
+% \begin{macrocode}
+\RequirePackage{keyval}[1997/11/10]
+% \end{macrocode}
+%
+% \begin{macro}{\undefine@key}
+% |\undefine@key|\marg{family}\marg{key}\par
+% This helper macro is the opposite of |\define@key|, it removes a keyval
+% definition.
+% \begin{macrocode}
+\providecommand*\undefine@key[2]{%
+ \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@onlypreamble@key}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \changes{v1.1e}{2007/11/01}{\cs{KV@err} will be used now instead of \cs{@notprerr}}
+% |\onlypreamble@key|\marg{family}\marg{key}\par
+% Analogous to |\@onlypreamble| from \LaTeXe.
+% \begin{macrocode}
+\providecommand*\@preamble@keys{}
+\providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}}
+\@onlypreamble\@onlypreamble@key
+\@onlypreamble\@preamble@keys
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}%
+ \@preamble@keys
+ \let\@elt\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOption}
+% |\DeclareCaptionOption|\marg{option}\oarg{default value}\marg{code}\\
+% |\DeclareCaptionOption*|\marg{option}\oarg{default value}\marg{code}\par
+% We declare our options using these commands (instead of using
+% |\DeclareOption| offered by \LaTeXe), so the keyval package is used.
+% The starred form makes the option available during the lifetime of the
+% current package only, so they can be used with |\usepackage|, but
+% \emph{not} with |\captionsetup| later on.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOption{%
+ \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareoption[2]{%
+ #1{\undefine@key{caption}{#2}}\caption@declare@option{#2}}
+\@onlypreamble\caption@declareoption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declare@option{%
+ \define@key{caption}}
+%% no \@onlypreamble\caption@declare@option, will be used by \captionsetup
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOptionNoValue}
+% \changes{v1.1c}{2007/10/06}{This macro added}
+% |\DeclareCaptionOptionNoValue|\marg{option}\marg{code}\\
+% |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\par
+% Same as \cs{DeclareCaptionOption} but issues an error if a value is given.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOptionNoValue{%
+ \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOptionNoValue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declareoption@novalue[3]{%
+ \caption@declareoption{#1}{#2}[\KV@err]{%
+ \caption@option@novalue{#2}{##1}{#3}}}
+\@onlypreamble\caption@declareoption@novalue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@option@novalue[2]{%
+ \ifx\KV@err#2%
+ \expandafter\@firstofone
+ \else
+ \KV@err{No value allowed for #1}%
+ \expandafter\@gobble
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifcaptionsetup@star}
+% \changes{v1.2a}{2008/01/12}{This macro added}
+% If the starred form of |\captionsetup| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@setkeys|.)
+% \begin{macrocode}
+\newif\ifcaptionsetup@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionsetup}
+% \changes{v1.0a}{2004/01/17}{Bugfix: Missing \% added}
+% \changes{v1.1}{2007/07/22}{Starred-variant added}
+% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v1.2a}{2008/01/12}{\cs{ifcaptionsetup@star} will be set now}
+% \changes{v1.5}{2012/04/09}{Support of multiple optional arguments added}
+% |\captionsetup|\oarg{type}\ldots\marg{keyval-list of options}\\
+% |\captionsetup*|\oarg{type}\ldots\marg{keyval-list of options}\par
+% If the optional argument `type' is specified, we simply save or append
+% the option list, otherwise we `execute' it with |\setkeys|.
+% (The non-starred variant issues a warning if \meta{keyval-list of options}
+% is not used later on.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\captionsetup{%
+ \caption@teststar@\@captionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionsetup[1]{%
+ \captionsetup@startrue#1\captionsetup@starfalse
+ \@ifnextchar[\caption@setup@options\caption@setup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup{\caption@setkeys{caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@setup@options[#1]{%
+ \@ifnextchar[%
+ {\caption@stepthecounter
+ \caption@withoptargs{\@expandtwoargs
+ \caption@setup@options@i{#1}{@\caption@thecounter}}}%
+ {\caption@setup@options@{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup@options@i[4]{%
+ \caption@setup@options@{#1}{#2}%
+ \caption@declare@option{#2}[]{\captionsetup#3{#4}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup@options@[2]{%
+ \@bsphack
+ \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi
+ \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\clearcaptionsetup}
+% \changes{v1.1}{2007/07/29}{Optional argument added}
+% \changes{v1.1}{2007/08/17}{Starred variant added}
+% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\clearcaptionsetup|\oarg{option}\marg{type}\\
+% |\clearcaptionsetup*|\oarg{option}\marg{type}\par
+% This removes the saved option list associated with \meta{type}.
+% If \meta{option} is given, only this option will be removed from the list.
+% (The starred variant does not issue warnings.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\clearcaptionsetup{%
+ \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@clearcaptionsetup[1]{%
+ \let\caption@tempa#1%
+ \@testopt\@@clearcaptionsetup{}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@@clearcaptionsetup[#1]#2{%
+ \@bsphack
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}%
+ {\ifx,#1,%
+ \caption@clearsetup{#2}%
+ \else
+ \caption@@removefromsetup{#1}{#2}%
+ \fi}%
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@clearsetup[1]{%
+ \caption@removefromoptlist{#1}%
+ \@nameundef{caption@opt@#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromsetup{%
+ \let\caption@tempa\@gobble
+ \caption@@removefromsetup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@removefromsetup[2]{%
+ \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname
+ \expandafter\let\csname caption@opt@#2\endcsname\@undefined
+ \def\@tempb##1=##2\@nil{##1}%
+ \edef\@tempc{#1}%
+ \@for\@tempa:=\@tempa\do{%
+ \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}%
+ \ifx\@tempd\@tempc
+ \let\caption@tempa\@gobble
+ \else
+ \expandafter\expandafter\expandafter\caption@l@addto@list
+ \expandafter\csname caption@opt@#2\expandafter\endcsname
+ \expandafter{\@tempa}%
+ \fi}%
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@removefromoptlist{#2}}{}%
+ \caption@tempa{\caption@Warning{%
+ Option `#1' was not in list `#2'}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\showcaptionsetup}
+% \changes{v1.0d}{2005/05/03}{Optimized for memory usage}
+% \changes{v1.1}{2007/07/29}{Bugfix: Does not expand option list anymore}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\showcaptionsetup|\oarg{package}\marg{type}\par
+% This comes for debugging issues: It shows the saved option list which
+% is associated with \meta{type}.
+% \begin{macrocode}
+\newcommand*\showcaptionsetup[2][\@firstofone]{%
+ \@bsphack
+ \GenericWarning{}{%
+ #1 Caption Info: Option list on `#2'\MessageBreak
+ #1 Caption Data: \@ifundefined{caption@opt@#2}{%
+ -none-%
+ }{%
+ {\expandafter\expandafter\expandafter\strip@prefix
+ \expandafter\meaning\csname caption@opt@#2\endcsname}%
+ }}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.1}{2007/07/02}{Option \opt{options=} added}
+% \changes{v1.3}{2010/09/05}{Option \opt{options*=} added}
+% \changes{v1.4b}{2012/01/12}{Option \opt{options*=} removed}
+% \begin{macrocode}
+\DeclareCaptionOption{options}{\caption@setoptions{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setoptions}
+% \changes{v1.0g}{2006/01/03}{Optional argument added}
+% \changes{v1.0h}{2006/01/26}{Revised}
+% \changes{v1.0j}{2007/01/30}{Optional argument removed}
+% \changes{v1.1}{2007/04/11}{Usage of \cs{clearcaptionsetup} added}
+% \changes{v1.1}{2007/05/09}{Renamed from \cs{caption@settype} to \cs{caption@setoptions}}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% \changes{v1.3}{2010/09/05}{Starred variant added}
+% \changes{v1.4b}{2012/01/12}{Starred variant removed}
+% |\caption@setoptions|\marg{type or environment or\ldots}\par
+% Caption options which have been saved with |\captionsetup|\oarg{type} can
+% be executed by using this command.
+% It simply executes the saved option list (and clears it afterwards),
+% if there is any.
+% \iffalse
+% (The starred variant do not clear the option list.)
+% \fi
+% \begin{macrocode}
+\newcommand*\caption@setoptions[1]{%
+ \caption@Debug{options=#1}%
+ \expandafter\let\expandafter\caption@opt\csname caption@opt@#1\endcsname
+ \ifx\caption@opt\relax \else
+ \caption@xsetup\caption@opt
+ \caption@clearsetup{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtooptlist}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \begin{macro}{\caption@removefromoptlist}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \changes{v1.2c}{2008/08/24}{Fatal typo corrected}
+% |\caption@addtooptlist|\marg{type}\\
+% |\caption@removefromoptlist|\marg{type}\par
+% Adds or removes an \meta{type} to the list of unused caption options.
+% Note that the catcodes of \meta{type} are sanitized here so removing
+% \meta{type} from the list do not fail when the \package{float} package
+% is used (since |\float@getstyle| gives a result which tokens have catcode
+% 12 $=$ ``other'').
+% \begin{macrocode}
+\newcommand*\caption@addtooptlist[1]{%
+ \@ifundefined{caption@opt@#1@lineno}{%
+ \caption@dooptlist\caption@g@addto@list{#1}%
+ \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}%
+ }{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromoptlist[1]{%
+ \caption@dooptlist\caption@g@removefrom@list{#1}%
+ \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@dooptlist[2]{%
+ \begingroup
+ \edef\@tempa{#2}\@onelevel@sanitize\@tempa
+ \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\AtEndDocument{%
+ \caption@for@list\caption@optlist{%
+ \caption@WarningNoLine{%
+ Unused \string\captionsetup[#1]
+ on input line \csname caption@opt@#1@lineno\endcsname}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@setkeys}
+% \changes{v1.0g}{2006/01/03}{This macro added}
+% \changes{v1.0j}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added}
+% \changes{v1.0j}{2007/01/30}{Optional argument added}
+% \changes{v1.0n}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter}
+% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed, we use \cs{caption@KV@err} instead}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v1.2a}{2008/01/12}{\cs{captionsetup@starfalse} added}
+% \changes{v1.2d}{2009/09/30}{Bugfix 09-09-29: Missing error handler will be defined automatically}
+% \changes{v1.4}{2011/08/24}{Redefinition of \cs{XKV@err} added}
+% |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\par
+% This one simply calls |\setkeys|\marg{family}\marg{key-values}
+% but lets the error messages not refer to the \package{keyval} package,
+% but to the \meta{package} package instead.
+% \begin{macrocode}
+\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@setkeys[#1]#2#3{%
+ \@bsphack
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err
+ \expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx
+ \expandafter\let\csname ORI@XKV@err\caption@keydepth\endcsname\XKV@err
+ \edef\caption@keydepth{\caption@keydepth i}%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname
+ \ifx\KV@err\relax
+ \def\KV@err##1{\PackageError{#1}{##1}{%
+ See the #1 package documentation for explanation.}}%
+ \fi
+ \def\KV@errx{\KV@err}%
+ \def\XKV@err{\let\@tempa\XKV@tkey\KV@err}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{\protect\setkeys{#2}{#3}}%
+ \setkeys{#2}{#3}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}%
+ \expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname
+ \expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname
+ \expandafter\let\expandafter\XKV@err\csname ORI@XKV@err\caption@keydepth\endcsname
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@keydepth\@empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ExecuteOptions}
+% \changes{v1.1}{2007/07/15}{This macro added}
+% \changes{v1.3}{2010/09/04}{Depends on package now}
+% |\caption@ExecuteOptions|\marg{package}\marg{key-values}\par
+% We execute our options using the keyval interface, so we use this one
+% instead of |\ExecuteOptions| offered by \LaTeXe.
+% \begin{macrocode}
+\newcommand*\caption@ExecuteOptions[2]{%
+ \expandafter\@expandtwoargs\csname caption@setkeys@#1\endcsname{#1}{#2}}%
+\@onlypreamble\caption@ExecuteOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ProcessOptions}
+% \changes{v1.0a}{2004/01/23}{Bugfix, see
+% \purett{news:400D360C.9678329F@gmx.net} for details}
+% \changes{v1.0g}{2006/01/03}{Improvement, uses \cs{caption@setkeys}
+% instead of \cs{setkeys}}
+% \changes{v1.0h}{2006/02/23}{Bugfix, now processes only those global
+% options which have a default value}
+% \changes{v1.0j}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to
+% \cs{caption@ProcessOptions} and moved from the package to the kernel}
+% \changes{v1.1}{2007/04/17}{Star variant added}
+% |\caption@ProcessOptions*|\marg{package}\par
+% We process our options using the keyval package, so we use this one
+% instead of |\ProcessOptions| offered by \LaTeXe.
+% The starred variant do not process the global options.
+% (This code was taken from the \package{hyperref} package\cite{hyperref}
+% \version{6.74} and improved.)
+% \begin{macrocode}
+\newcommand*\caption@ProcessOptions{%
+ \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone}
+\@onlypreamble\caption@ProcessOptions
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@ProcessOptions[2]{%
+ \let\@tempc\relax
+ \let\caption@tempa\@empty
+ #1{% \@firstofone -or- \@gobble
+ \@for\CurrentOption:=\@classoptionslist\do{%
+ \@ifundefined{KV@#2@\CurrentOption}{}{%
+ \@ifundefined{KV@#2@\CurrentOption @default}{%
+ \PackageInfo{#2}{Global option `\CurrentOption' ignored}%
+ }{%
+ \PackageInfo{#2}{Global option `\CurrentOption' processed}%
+ \edef\caption@tempa{\caption@tempa\CurrentOption,}%
+ \@expandtwoargs\@removeelement\CurrentOption
+ \@unusedoptionlist\@unusedoptionlist
+ }%
+ }%
+ }%
+ \let\CurrentOption\@empty
+ }%
+ \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}%
+ \AtEndOfPackage{\let\@unprocessedoptions\relax}}
+\@onlypreamble\caption@@ProcessOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@SetupOptions}
+% \changes{v1.3}{2010/09/04}{This macro added}
+% |\caption@SetupOptions|\marg{package}\marg{code}\par
+% After calling this macro |\caption@ExecuteOptions| and
+% |\usepackage|\oarg{options}\marg{package}
+% will both be mapped to \meta{code} with \meta{package} and \meta{options}
+% as arguments |#1| and |#2|. (This helps avoiding ``Option clash'' errors.)
+% \begin{macrocode}
+\newcommand*\caption@packagelist{}
+\@onlypreamble\caption@packagelist
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@SetupOptions[2]{%
+ \@namedef{caption@setkeys@#1}##1##2{#2}%
+ \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname
+ \@cons\caption@packagelist{{#1}}}
+\@onlypreamble\caption@SetupOptions
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@onefilewithoptions\@onefilewithoptions
+\def\@onefilewithoptions#1[#2]{%
+ \begingroup
+ \def\@tempa{%
+ \endgroup
+ \caption@onefilewithoptions{#1}[{#2}]}%
+ \def\@tempb{#1}%
+ \def\@elt##1{%
+ \def\@tempc{##1}%
+ \ifx\@tempb\@tempc
+ \def\@tempa{%
+ \endgroup
+ \caption@ExecuteOptions{#1}{#2}%
+ \caption@onefilewithoptions{#1}[]}%
+ \fi}
+ \caption@packagelist
+ \@tempa}
+\@onlypreamble\caption@onefilewithoptions
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Margin resp. width}
+% \changes{v1.0n}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}}
+% \changes{v1.0n}{2007/04/03}{Option `twoside' added}
+% \changes{v1.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added}
+% \changes{v1.2}{2007/11/10}{Option `oneside' added}
+%
+% \begin{macro}{\captionmargin}
+% \begin{macro}{\captionwidth}
+% |\captionmargin| and |\captionwidth| contain the extra margin
+% resp. the total width used for captions. Please never set these values in
+% a direct way, they are just accessible in user documents to provide
+% compatibility to \version{1.x}.\par
+% Note that we can only set one value at a time, `margin' \emph{or} `width'.
+% If |\captionwidth| is not zero we will take this value afterwards,
+% otherwise |\captionmargin| and |\captionmargin@|.
+% \begin{macrocode}
+\newdimen\captionmargin
+\newdimen\captionmargin@
+\newdimen\captionwidth
+\newdimen\caption@tempdima
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
+\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}}
+\DeclareCaptionOption{width}{\setcaptionwidth{#1}}
+\DeclareCaptionOption{width*}{\setcaptionwidth*{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{calcmargin}{\caption@setcalcmargin{#1}}
+\DeclareCaptionOption{calcmargin*}{\caption@setcalcmargin*{#1}}
+\DeclareCaptionOption{calcwidth}{\caption@setcalcwidth{#1}}
+\DeclareCaptionOption{calcwidth*}{\caption@setcalcwidth*{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}}
+\DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}}
+\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\setcaptionmargin}
+% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
+% \changes{v1.0f}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take
+% left+right margin}
+% \changes{v1.1}{2007/08/11}{Starred variant added}
+% \changes{v1.1}{2007/08/12}{\cs{setlength}\cs{captionmargin} \&
+% \cs{setlength}\cs{captionmargin@} swapped so
+% `\texttt{margin*=}\cs{captionmargin}' works in singleline options}
+% \changes{v1.3}{2010/11/07}{Support for option \opt{calcmargin} added}
+% |\setcaptionmargin|\marg{amount}\\
+% |\setcaptionmargin*|\marg{amount}\par
+% Please never use this in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionmargin{%
+ \caption@resetcalcmargin
+ \caption@setmargin}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setmargin{%
+ \caption@teststar\caption@@setmargin\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setmargin[2]{%
+ #1{\captionwidth\z@}%
+ \caption@@@setmargin#2,#2,\@nil}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@setmargin#1,#2,#3\@nil{%
+ \setlength\captionmargin@{#2}%
+ \setlength\captionmargin{#1}%
+ \addtolength\captionmargin@{-\captionmargin}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionwidth}
+% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
+% \changes{v1.3}{2010/11/07}{Starred variant added}
+% \changes{v1.3}{2010/11/07}{Support for option \opt{calcwidth} added}
+% |\setcaptionwidth|\marg{amount}\\
+% |\setcaptionwidth*|\marg{amount}\par
+% Please never use this in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionwidth{%
+ \caption@resetcalcmargin
+ \caption@setwidth}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setwidth{%
+ \caption@teststar\caption@@setwidth\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setwidth[2]{%
+ #1{\captionmargin\z@\captionmargin@\z@}%
+ \setlength\captionwidth{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetcalcmargin}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@resetcalcmargin{%
+ \let\caption@calcmargin@hook\@empty}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setcalcmargin}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setcalcmargin{%
+ \caption@teststar{\caption@@setcalcmargin\caption@setmargin}%
+ \@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setcalcmargin[3]{%
+ #2{\caption@resetcalcmargin
+ \l@addto@macro\caption@calcmargin@hook{#1{#3}}}%
+ {\l@addto@macro\caption@calcmargin@hook{#1*{#3}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setcalcwidth}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setcalcwidth{%
+ \caption@teststar{\caption@@setcalcmargin\caption@setwidth}%
+ \@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@counter}
+% \changes{v1.0n}{2007/04/03}{This counter added}
+% \changes{v1.1e}{2007/10/28}{Renamed to \cs{caption@thecounter}; \cs{caption@stepcounter} added}
+% \changes{v1.5}{2012/04/09}{\cs{caption@stepcounter} renamed to \cs{caption@stepthecounter}}
+% Internal counter. At the moment it will be used inside
+% |\caption@ifoddpage| only.
+% \begin{macrocode}
+\newcommand*\caption@thecounter{0}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@stepthecounter{%
+ \@tempcnta\caption@thecounter
+ \advance\@tempcnta\@ne
+ \xdef\caption@thecounter{\the\@tempcnta}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@newlabel}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% This command is a modified version of |\newlabel| from \LaTeX2e.
+% It will be written to the \texttt{.aux} file to
+% pass label information from one run to another.
+% (We use it inside |\caption@ifoddpage| and |\caption@ragged|.)
+% \begin{macrocode}
+\newcommand*\caption@newlabel{\@newl@bel{caption@r}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@thepage}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% This command is a modified version of |\thepage| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| only.
+% \begin{macrocode}
+\newcommand*\caption@thepage{\the\c@page}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@label}
+% \changes{v1.1}{2007/09/01}{This macro added}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@newlabel} in AUX file added}
+% This command is a modified version of |\label| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
+% \begin{macrocode}
+\newcommand*\caption@label[1]{%
+ \caption@@label
+ \protected@write\@auxout{\let\caption@thepage\relax}%
+ {\string\caption@newlabel{#1}{\caption@thepage}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@label{%
+ \global\let\caption@@label\relax
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@newlabel[2]{}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@pageref}
+% \changes{v1.1}{2007/09/01}{This macro added}
+% \changes{v1.2d}{2009/10/09}{Uses \cs{@latex@warning} instead of \cs{caption@Warning} now}
+% This command is a modified version of |\pageref| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
+% \begin{macrocode}
+\newcommand*\caption@pageref[1]{%
+ \expandafter\ifx\csname caption@r@#1\endcsname\relax
+ \G@refundefinedtrue % => 'There are undefined references.'
+ \@latex@warning{Reference `#1' on page \thepage \space undefined}%
+ \else
+ \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifoddpage}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% \changes{v1.1e}{2007/10/28}{Incrementation of counter moved to \cs{caption@@make}}
+% At the moment this macro uses an own label\ldots ref mechanism,
+% but an alternative implementation method would be using the
+% \package{refcount} package\cite{refcount} and |\ifodd\getpagerefnumber{|\ldots|}|.
+% \Note{This macro re-defines itself so the \texttt{.aux} file will
+% only be used once per group.}
+% \begin{macrocode}
+\newcommand*\caption@ifoddpage{%
+ \caption@iftwoside{%
+ \caption@label\caption@thecounter
+ \caption@pageref\caption@thecounter
+ \ifodd\caption@thepage
+ \let\caption@ifoddpage\@firstoftwo
+ \else
+ \let\caption@ifoddpage\@secondoftwo
+ \fi
+ }{\let\caption@ifoddpage\@firstoftwo}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifoddpage}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setoptcmd}
+% \changes{v1.1}{2007/08/11}{This macro added}
+% |\caption@setoptcmd|\marg{cmd}\marg{off -or- value}
+% \begin{macrocode}
+\newcommand*\caption@setoptcmd[2]{%
+ \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Indentions}
+%
+% \begin{macro}{\caption@indent}
+% \changes{v1.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}}
+% \begin{macro}{\caption@parindent}
+% \begin{macro}{\caption@hangindent}
+% These are the indentions we support.
+% \begin{macrocode}
+\newdimen\caption@indent
+\newdimen\caption@parindent
+\newdimen\caption@hangindent
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v1.0b}{2004/05/16}{Defaults added for options \opt{parindent=}
+% and \opt{hangindent=}}
+% \changes{v1.0f}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption}
+% replaced by \cs{caption@@par}}
+% \changes{v1.0f}{2005/08/22}{Undocumented defaults for \opt{parindent=},
+% \opt{hangindent=}, and \opt{parskip=} removed}
+% \begin{macrocode}
+\DeclareCaptionOption{indent}[\leftmargini]{% obsolete!
+ \setlength\caption@indent{#1}}
+\DeclareCaptionOption{indention}[\leftmargini]{%
+ \setlength\caption@indent{#1}}
+\DeclareCaptionOption{parindent}{%
+ \setlength\caption@parindent{#1}}
+\DeclareCaptionOption{hangindent}{%
+ \setlength\caption@hangindent{#1}}
+\DeclareCaptionOption{parskip}{%
+ \l@addto@macro\caption@@par{\setlength\parskip{#1}}}
+% \end{macrocode}
+%
+% \changes{v1.0f}{2005/08/22}{Increased compatibility to KOMA-Script:
+% A special version of options `parindent' and `parskip' added}
+% \changes{v1.0g}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of
+% `parskip' and `parindent' options revised and moved into caption kernel}
+% \changes{v1.0h}{2006/02/23}{KOMA-Script variants of `parskip' and
+% `parindent' are obsolete now, removed}
+% \changes{v1.0m}{2007/03/30}{KOMA-Script variants of `parskip' and
+% `parindent' re-added, since they still collide with the current
+% version of the subfig package (Sigh!)}
+%
+% There is an option clash between the \KOMAScript\ document classes
+% and the \package{caption} kernel, both define the options |parindent| and
+% |parskip| but with different meaning.
+% Furthermore the ones defined by the \package{caption} kernel take a
+% value as parameter but the \KOMAScript\ ones do not.
+% So we need special versions of the options |parindent| and |parskip| here
+% which determine if a value is given (and therefore should be treated as
+% our option) or not (and therefore should be ignored by us).\footnote{%^^A
+% This problem was completely solved due a change of \cs{caption@ProcessOptions}
+% in \thispackage\ \version{1.0h}, but we still need this workaround since
+% these options would otherwise still collide with the current version $1.3$
+% of the \package{subfig} package (Sigh!)}
+% \begin{macrocode}
+\providecommand*\caption@ifkomaclass{%
+ \caption@ifundefined\scr@caption\@gobble\@firstofone}
+\@onlypreamble\caption@ifkomaclass
+% \end{macrocode}
+% \begin{macrocode}
+\caption@ifkomaclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KV@parindent\KV@caption@parindent
+ \DeclareCaptionOption{parindent}[]{%
+ \ifx,#1,%
+ \caption@Debug{Option `parindent' ignored}%
+ \else
+ \caption@KV@parindent{#1}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KV@parskip\KV@caption@parskip
+ \DeclareCaptionOption{parskip}[]{%
+ \ifx,#1,%
+ \caption@Debug{Option `parskip' ignored}%
+ \else
+ \caption@KV@parskip{#1}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{Styles}
+%
+% \begin{macro}{\DeclareCaptionStyle}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
+% between arguments do make any harm}
+% |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionStyle[1]{%
+ \@testopt{\caption@declarestyle{#1}}{}}
+\@onlypreamble\DeclareCaptionStyle
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@declarestyle#1[#2]#3{%
+ \global\@namedef{caption@sls@#1}{#2}%
+ \global\@namedef{caption@sty@#1}{#3}}
+\@onlypreamble\caption@declarestyle
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2a}{2008/01/20}{Option \opt{style*=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{style}{\caption@setstyle{#1}}
+\DeclareCaptionOption{style*}{\caption@setstyle*{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setstyle}
+% \changes{v1.0e}{2005/06/01}{Starred variant added}
+% \changes{v1.1}{2007/07/29}{Recursive style definitions should work now}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% |\caption@setstyle|\marg{name}\\
+% |\caption@setstyle*|\marg{name}\par
+% Selecting a caption style means saving the additional
+% \meta{single-line-list-of-KV} (this will be done by |\caption@sls|),
+% resetting the caption options to the base ones (this will be done using
+% |\caption@resetstyle|) and executing the \meta{list-of-KV} options
+% (this will be done using |\caption@setup|).\par
+% The starred version will give no error message if the given style is not
+% defined.
+% \begin{macrocode}
+\newcommand*\caption@setstyle{%
+ \caption@teststar\caption@@setstyle\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setstyle[2]{%
+ \@ifundefined{caption@sty@#2}%
+ {#1{\caption@Error{Undefined style `#2'}}}%
+ {\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname
+ \ifx\caption@setstyle@flag\@undefined
+ \let\caption@setstyle@flag\relax
+ \caption@resetstyle
+ \caption@xsetup\caption@sty
+ \let\caption@setstyle@flag\@undefined
+ \else
+ \caption@xsetup\caption@sty
+ \fi
+ \expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
+ \expandafter\caption@l@addto@list\expandafter\caption@opt@singleline
+ \expandafter{\caption@sls}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetstyle}
+% \changes{v1.1}{2007/02/04}{%
+% This macro renamed from \cs{caption@setdefault} to \cs{caption@resetstyle}}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.2}{2007/11/17}{Usage of \opt{size=} added}
+% \changes{v1.2b}{2008/05/06}{Usage of \opt{rule} added}
+% \changes{v1.5}{2012/03/15}{\opt{box=parbox} added}
+% \changes{v1.6}{2013/05/01}{\opt{box=none} added, \opt{box=parbox} changed to \opt{parbox=parbox}}
+% This resets (nearly) all caption options to the base ones.
+% \emph{Note that this does not touch the skips and the positioning!}
+% \begin{macrocode}
+\newcommand*\caption@resetstyle{%
+ \caption@setup{%
+ box=none,boxcolor=white,parbox=parbox,%
+ format=plain,labelformat=default,labelsep=colon,textformat=simple,%
+ justification=justified,font=,size=,labelfont=,textfont=,%
+ margin=0pt,minmargin=0,maxmargin=0,%
+ indent=0pt,parindent=0pt,hangindent=0pt,%
+ slc,rule,strut}%
+ \caption@clearsetup{singleline}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
+% \changes{v1.1}{2007/02/04}{Caption style `default' renamed to `base', and a new `default' added}
+% \changes{v1.1}{2007/03/31}{\opt{format=plain} added to caption style \opt{default}}
+% \changes{v1.1c}{2007/10/14}{\opt{format=plain} removed from caption style \opt{default}}
+% \changes{v1.5}{2012/03/15}{\opt{box=default} added to caption style \opt{default}}
+% Currently there are two pre-defined styles, called `base' \& `default'.
+% The first one is a perfect match to the behavior of |\@makecaption| offered
+% by the standard \LaTeX\ document classes (and was called `default' in
+% \thispackage\ \version{1.0}), the second one matches the document
+% class actually used.
+% \begin{macrocode}
+\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{}
+\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{%
+ box=default,format=default,labelsep=default,textformat=default,%
+ justification=default,font=default,labelfont=default,textfont=default}
+% \end{macrocode}
+%
+% \changes{v1.2b}{2008/05/06}{Option \opt{slc=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}}
+\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}}
+% \end{macrocode}
+%
+% \subsection{Boxes}
+%
+% \begin{macro}{\DeclareCaptionBox}
+% \changes{v1.5}{2012/03/15}{This macro added}
+% |\DeclareCaptionBox|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionBox[2]{%
+ \global\long\@namedef{caption@box@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionBox
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.5}{2012/03/15}{Option \opt{box=} added}
+% \changes{v1.6}{2013/05/01}{Option \opt{parbox=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{box}{\caption@setbox{#1}}
+\DeclareCaptionOption{parbox}{\caption@set@box\caption@parbox{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setbox}
+% |\caption@setbox|\marg{name}\par
+% Selecting a caption box simply means saving the code (in |\caption@box|).
+% \begin{macrocode}
+\newcommand*\caption@setbox{%
+ \caption@set@box\caption@box}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@box[2]{%
+ \@ifundefined{caption@box@#2}%
+ {\caption@Error{Undefined box `#2'}}%
+ {\expandafter\let\expandafter#1\csname caption@box@#2\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are four pre-defined boxes, called `empty', `none',
+% `parbox', and `colorbox'.
+% \changes{v1.0i}{2006/05/13}{We define \cs{captionbox} instead of
+% \cs{caption@start/endbox}}
+% \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{captionbox} changed from
+% \cs{parbox-t} to \cs{parbox-b}}
+% \changes{v1.2}{2007/11/11}{\cs{captionbox} renamed to \cs{caption@parbox}}
+% \changes{v1.5}{2012/03/15}{\cs{caption@parbox} adapted to \cs{DeclareCaptionBox}}
+% \changes{v1.6}{2013/05/02}{Option \opt{boxsep=} added}
+% \begin{macrocode}
+\DeclareCaptionBox{empty}{}
+\DeclareCaptionBox{none}{#2}
+\DeclareCaptionBox{parbox}{\parbox[b]{#1}{#2}}
+%\DeclareCaptionBox{colorbox}{%
+% \colorbox{\caption@boxcolor}{\caption@box@parbox{\dimexpr #1-2\fboxsep}{#2}}}
+\DeclareCaptionBox{colorbox}{\colorbox{\caption@boxcolor}{%
+ \setlength\caption@tempdima{#1}%
+ \addtolength\caption@tempdima{-2\fboxsep}%
+ \linewidth=\caption@tempdima\hsize=\caption@tempdima
+ #2}}
+\DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}}
+\DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}}
+% \end{macrocode}
+%
+% `default' usually maps to `none`.
+% \begin{macrocode}
+\def\caption@box@default{\caption@box@none}
+% \end{macrocode}
+%
+% \subsection{Formats}
+%
+% \begin{macro}{\DeclareCaptionFormat}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
+% between arguments do make any harm}
+% \changes{v1.0c}{2005/02/09}{Starred variant added}
+% \changes{v1.1c}{2007/10/15}{Optional argument added}
+% |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\
+% |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par
+% The starred form causes the code being typeset in vertical (instead of
+% horizontal) mode, but does not support the |indention=| option.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFormat{%
+ \caption@teststar\caption@declareformat\@gobble\@firstofone}
+\@onlypreamble\DeclareCaptionFormat
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareformat[2]{%
+ \@dblarg{\caption@@declareformat#1{#2}}}
+\@onlypreamble\caption@declareformat
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@declareformat#1#2[#3]#4{%
+ \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
+ \global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}%
+ \global\long\@namedef{caption@fmt@#2}##1##2##3{#4}}
+\@onlypreamble\caption@@declareformat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{format}{\caption@setformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setformat}
+% |\caption@setformat|\marg{name}\par
+% Selecting a caption format simply means saving the code (in |\caption@fmt|)
+% and if the code should be used in horizontal or vertical mode (|\caption@ifh|).
+% \begin{macrocode}
+\newcommand*\caption@setformat[1]{%
+ \@ifundefined{caption@fmt@#1}%
+ {\caption@Error{Undefined format `#1'}}%
+ {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
+ \expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname
+ \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultFormat}
+% \changes{v1.2a}{2008/01/31}{This macro added}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultFormat[1]{%
+ \expandafter\def\expandafter\caption@fmt@default\expandafter
+ {\csname caption@fmt@#1\endcsname}%
+ \expandafter\def\expandafter\caption@slfmt@default\expandafter
+ {\csname caption@slfmt@#1\endcsname}%
+ \expandafter\def\expandafter\caption@ifh@default\expandafter
+ {\csname caption@ifh@#1\endcsname}}
+\@onlypreamble\DeclareCaptionDefaultFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0a}{2004/01/23}{%
+% Caption format \opt{default} renamed to \opt{normal}}
+% \changes{v1.0e}{2005/05/12}{%
+% Caption format \opt{normal} renamed to \opt{@normal}}
+% \changes{v1.0f}{2005/08/25}{%
+% Caption format \opt{@normal} renamed to \opt{plain} and documented}
+% \changes{v1.1c}{2007/10/14}{%
+% Single-line variant of caption format \opt{hang} added}
+% There are two pre-defined formats, called `plain' and `hang'.
+% \begin{macrocode}
+\DeclareCaptionFormat{plain}{#1#2#3\par}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionFormat{hang}[#1#2#3\par]{%
+ \caption@ifin@list\caption@lsepcrlist\caption@lsepname
+ {\caption@Error{%
+ The option `labelsep=\caption@lsepname' does not work\MessageBreak
+ with `format=hang'}}%
+ {\@hangfrom{#1#2}%
+ \advance\caption@parindent\hangindent
+ \advance\caption@hangindent\hangindent
+ \caption@@par#3\par}}
+% \end{macrocode}
+%
+% \changes{v1.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{plain}}
+% \changes{v1.0d}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added}
+% `default' usually maps to `plain'.
+% \begin{macrocode}
+\DeclareCaptionDefaultFormat{plain}
+% \end{macrocode}
+%
+% \subsection{Label formats}
+%
+% \begin{macro}{\DeclareCaptionLabelFormat}
+% \changes{v1.0a}{2004/01/17}{%
+% Pass through argument \#2 so extra spaces between arguments do make any harm}
+% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionLabelFormat[2]{%
+ \global\@namedef{caption@lfmt@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionLabelFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelformat}
+% |\caption@setlabelformat|\marg{name}\par
+% Selecting a caption label format simply means saving the code (in |\caption@lfmt|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelformat[1]{%
+ \@ifundefined{caption@lfmt@#1}%
+ {\caption@Error{Undefined label format `#1'}}%
+ {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2}{2007/12/16}{Caption label format \opt{brace} added}
+% \changes{v1.7}{2015/09/16}{Caption label format \opt{autodot} added}
+% \changes{v1.7}{2016/05/22}{Caption label format \opt{autodot} fixed}
+% \changes{v1.8}{2016/05/22}{Caption label format \opt{unnumbered} added}
+% There are six pre-defined label formats, called `empty', `simple',
+% `parens', `brace', `autodot', and `unnumbered'.
+% \begin{macrocode}
+\DeclareCaptionLabelFormat{empty}{}
+\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
+\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
+\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)}
+\DeclareCaptionLabelFormat{autodot}{\bothIfFirst{#1}{\nobreakspace}#2\autodot}
+\DeclareCaptionLabelFormat{unnumbered}{#1}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+% \begin{macrocode}
+\def\caption@lfmt@default{\caption@lfmt@simple}
+% \end{macrocode}
+%
+% \subsection{Label separators}
+%
+% \begin{macro}{\DeclareCaptionLabelSeparator}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
+% between arguments do make any harm}
+% \changes{v1.0f}{2005/08/25}{Starred variant added}
+% \changes{v1.1}{2007/07/13}{Test for CR added}
+% \changes{v1.3}{2011/08/06}{Test for CR revised}
+% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
+% |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par
+% The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|.
+% \begin{macrocode}
+\newcommand\DeclareCaptionLabelSeparator{%
+ \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone}
+\@onlypreamble\DeclareCaptionLabelSeparator
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declarelabelseparator[3]{%
+ \global\@namedef{caption@iflf@#2}{#1}%
+ \global\long\@namedef{caption@lsep@#2}{#3}%
+ \caption@@declarelabelseparator{#2}#3\\\@nil}
+\@onlypreamble\caption@declarelabelseparator
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@declarelabelseparator#1#2\\#3\@nil{%
+ \def\@tempa{#3}\ifx\@tempa\@empty \else
+ \caption@g@addto@list\caption@lsepcrlist{#1}%
+ \fi}
+\@onlypreamble\caption@@declarelabelseparator
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
+\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelseparator}
+% |\caption@setlabelseparator|\marg{name}\par
+% Selecting a caption label separator simply means saving the code (in |\caption@lsep|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelseparator[1]{%
+ \@ifundefined{caption@lsep@#1}%
+ {\caption@Error{Undefined label separator `#1'}}%
+ {\edef\caption@lsepname{#1}%
+ \expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
+ \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0e}{2005/06/11}{Bugfix 05-03-23: Caption label separator
+% \opt{newline} implementation changed from \cs{newline} to \cs{\textbackslash}}
+% \changes{v1.0f}{2005/08/24}{Caption label separator \opt{endash} added}
+% There are seven pre-defined label separators, called `none', `colon', `period', `space',
+% `quad', `newline', and `endash'.
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{none}{}
+\DeclareCaptionLabelSeparator{colon}{: }
+\DeclareCaptionLabelSeparator{period}{. }
+\DeclareCaptionLabelSeparator{space}{ }
+\DeclareCaptionLabelSeparator*{quad}{\quad}
+\DeclareCaptionLabelSeparator*{newline}{\\}
+\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setdefaultlabelsep}
+% \changes{v1.2d}{2009/03/29}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setdefaultlabelsep[1]{%
+ \ifx\caption@lsep\caption@lsep@default
+ \caption@set@default@labelsep{#1}%
+ \caption@setlabelseparator{default}%
+ \else
+ \caption@set@default@labelsep{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@default@labelsep[1]{%
+ \def\caption@lsep@default{\@nameuse{caption@lsep@#1}}%
+ \def\caption@iflf@default{\@nameuse{caption@iflf@#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `colon'.
+% \begin{macrocode}
+\caption@set@default@labelsep{colon}
+% \end{macrocode}
+%
+% \subsection{Text formats}
+%
+% \begin{macro}{\DeclareCaptionTextFormat}
+% \changes{v1.0j}{2007/02/18}{This macro added}
+% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionTextFormat[2]{%
+ \global\long\@namedef{caption@tfmt@#1}##1{#2}}
+\@onlypreamble\DeclareCaptionTextFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{Option \opt{strut=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
+\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@settextformat}
+% \changes{v1.0j}{2007/02/18}{This macro added}
+% |\caption@settextformat|\marg{name}\par
+% Selecting a caption text format simply means saving the code (in |\caption@tfmt|).
+% \begin{macrocode}
+\newcommand*\caption@settextformat[1]{%
+ \@ifundefined{caption@tfmt@#1}%
+ {\caption@Error{Undefined text format `#1'}}%
+ {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are three pre-defined text formats, called `empty', `simple' and `period'.
+% \changes{v1.4}{2011/10/05}{Pre-defined text format `empty' added}
+% \changes{v1.7}{2015/09/16}{The text format `empty' now takes care of the \cs{label}}
+% \begin{macrocode}
+\DeclareCaptionTextFormat{empty}{%
+ \caption@get@label#1\caption@makeanchor{}\@nil
+ \caption@thelabel
+ \global\let\caption@thelabel\relax}
+\long\def\caption@get@label#1\caption@makeanchor#2#3\@nil{%
+ \def\caption@tempa{#2}%
+ \ifx\caption@tempa\@empty
+ \caption@getlabel#1\label{}\@nil
+ \else
+ \caption@getlabel#2\label{}\@nil
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionTextFormat{simple}{#1}
+\DeclareCaptionTextFormat{period}{#1.}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+% \begin{macrocode}
+\def\caption@tfmt@default{\caption@tfmt@simple}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@getlabel}
+% \changes{v1.0}{2011/09/03}{\cs{label} can have optional arguments now}
+% \changes{v1.7}{2015/09/16}{Moved from \package{bicaption} package to \package{caption3}}
+% \changes{v1.8d}{2019/09/01}{Bugfix: Global definition of \cs{caption@thelabel} added}
+% Gets the label command out of the (first) caption text and stores it to |\caption@thelabel|.
+% \begin{macrocode}
+\long\def\caption@getlabel#1\label#2#3\@nil{%
+ \def\@tempa{#2}%
+ \ifx\@tempa\@empty
+ \let\caption@thelabel\relax
+ \else
+ \def\@tempb{*}%
+ \ifx\@tempa\@tempb
+ \def\caption@thelabel{\label*}%
+ \caption@@getlabel#3\@nil
+ \else
+ \def\caption@thelabel{\label}%
+ \caption@@getlabel{#2}#3\@nil
+ \fi
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@getlabel#1#2\@nil{%
+ \def\@tempa{#1}%
+ \def\@tempb{[}%
+ \ifx\@tempa\@tempb
+ \caption@@@getlabel#1#2\@nil
+ \else
+ \l@addto@macro\caption@thelabel{{#1}}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@@getlabel[#1]#2\@nil{%
+ \l@addto@macro\caption@thelabel{[{#1}]}%
+ \caption@@getlabel#2\@nil}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@thelabel\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Fonts}
+%
+% \begin{macro}{\DeclareCaptionFont}
+% \changes{v1.0a}{2004/01/22}{%
+% Bugfix: Multi token arguments are allowed now}
+% \changes{v1.1}{2007/05/07}{%
+% Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now}
+% |\DeclareCaptionFont|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFont[2]{%
+ \define@key{caption@fnt}{#1}[]{\l@addto@macro\caption@fnt{#2}}}
+\@onlypreamble\DeclareCaptionFont
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultFont}
+% \changes{v1.1}{2006/05/14}{This macro added}
+% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionFont} to \cs{DeclareCaptionDefaultFont}}
+% |\DeclareCaptionDefaultFont|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultFont[2]{%
+ \global\@namedef{caption#1@default}{#2}}
+\@onlypreamble\DeclareCaptionDefaultFont
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
+\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}}
+\DeclareCaptionDefaultFont{font}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
+\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}}
+\DeclareCaptionDefaultFont{labelfont}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
+\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}}
+\DeclareCaptionDefaultFont{textfont}{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setfont}
+% \changes{v1.0j}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument}
+% \changes{v1.1}{2006/05/14}{Support of \cs{DeclareDefaultCaptionFont} added}
+% |\caption@setfont|\marg{name}\marg{keyval-list of names}\par
+% Selecting a caption font means saving all the code snippets
+% in |\caption|\meta{name}.
+% \begin{macrocode}
+\newcommand*\caption@setfont[1]{%
+ \expandafter\let\csname caption#1\endcsname\@empty
+ \caption@addtofont{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtofont}
+% \changes{v1.2}{2007/11/17}{This macro added}
+% |\caption@addtofont|\marg{name}\marg{keyval-list of names}\par
+% Like |\caption@setfont|, but adds the code snippets to |\caption|\meta{name}.\par
+% Because we use |\setkeys| recursive here we need to do this inside an
+% extra group.
+% \begin{macrocode}
+\newcommand*\caption@addtofont[2]{%
+ \begingroup
+ \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname
+ \define@key{caption@fnt}{default}[]{%
+ \l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}%
+ \caption@setkeys[caption]{caption@fnt}{#2}%
+ \global\let\caption@tempa\caption@fnt
+ \endgroup
+ \expandafter\let\csname caption#1\endcsname\caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@font}
+% \changes{v1.1}{2007/05/07}{This macro added}
+% |\caption@font|\marg{keyval-list of names}\\
+% |\caption@font*|\marg{keyval-code}\par
+% Sets the given font, e.g.~|\caption@font{small,it}|
+% is equivalent to |\small\itshape|.
+% \begin{macrocode}
+\newcommand*\caption@font{%
+ \caption@teststar\caption@@font\@firstofone
+ {\caption@setkeys[caption]{caption@fnt}}}
+\newcommand*\caption@@font[2]{%
+ \begingroup
+ \def\caption@fnt{\endgroup}%
+ #1{#2}%
+ \caption@fnt}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined font code snippets.
+%
+% \changes{v1.1}{2007/05/07}{Color font support added}
+% \begin{macrocode}
+\DeclareCaptionFont{normalcolor}{\normalcolor}
+\DeclareCaptionFont{color}{\color{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{normalfont}{\normalfont}
+\DeclareCaptionFont{up}{\upshape}
+\DeclareCaptionFont{it}{\itshape}
+\DeclareCaptionFont{sl}{\slshape}
+\DeclareCaptionFont{sc}{\scshape}
+\DeclareCaptionFont{md}{\mdseries}
+\DeclareCaptionFont{bf}{\bfseries}
+\DeclareCaptionFont{rm}{\rmfamily}
+\DeclareCaptionFont{sf}{\sffamily}
+\DeclareCaptionFont{tt}{\ttfamily}
+% \end{macrocode}
+%
+% \changes{v1.7}{2018/05/01}{Missing font sizes \texttt{tiny}, \texttt{LARGE}, \texttt{huge}, and \texttt{Huge} added}
+% \begin{macrocode}
+\DeclareCaptionFont{tiny}{\tiny}
+\DeclareCaptionFont{scriptsize}{\scriptsize}
+\DeclareCaptionFont{footnotesize}{\footnotesize}
+\DeclareCaptionFont{small}{\small}
+\DeclareCaptionFont{normalsize}{\normalsize}
+\DeclareCaptionFont{large}{\large}
+\DeclareCaptionFont{Large}{\Large}
+\DeclareCaptionFont{LARGE}{\LARGE}
+\DeclareCaptionFont{huge}{\huge}
+\DeclareCaptionFont{Huge}{\Huge}
+% \end{macrocode}
+%
+% \changes{v1.8}{2018/05/01}{Font size \texttt{smaller} added}
+% \begin{macrocode}
+\newcommand\caption@smaller{%
+ \ifx\@currsize\tiny
+ \relax
+ \else\ifx\@currsize\scriptsize
+ \tiny
+ \else\ifx\@currsize\footnotesize
+ \scriptsize
+ \else\ifx\@currsize\small
+ \footnotesize
+ \else\ifx\@currsize\normalsize
+ \small
+ \else\ifx\@currsize\large
+ \normalsize
+ \else\ifx\@currsize\Large
+ \large
+ \else\ifx\@currsize\LARGE
+ \Large
+ \else\ifx\@currsize\huge
+ \LARGE
+ \else\ifx\@currsize\Huge
+ \huge
+ \else
+ \caption@Warning{%
+ Cannot determine current font size.\MessageBreak
+ Try setting it with `size=' explicitly}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+\DeclareCaptionFont{smaller}{\caption@smaller}
+% \end{macrocode}
+%
+% \changes{v1.8}{2018/05/02}{Font size \texttt{larger} added}
+% \begin{macrocode}
+\newcommand\caption@larger{%
+ \ifx\@currsize\tiny
+ \scriptsize
+ \else\ifx\@currsize\scriptsize
+ \footnotesize
+ \else\ifx\@currsize\footnotesize
+ \small
+ \else\ifx\@currsize\small
+ \normalsize
+ \else\ifx\@currsize\normalsize
+ \large
+ \else\ifx\@currsize\large
+ \Large
+ \else\ifx\@currsize\Large
+ \LARGE
+ \else\ifx\@currsize\LARGE
+ \huge
+ \else\ifx\@currsize\huge
+ \Huge
+ \else\ifx\@currsize\Huge
+ \relax
+ \else
+ \caption@Warning{%
+ Cannot determine current font size.\MessageBreak
+ Try setting it with `size=' explicitly}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+\DeclareCaptionFont{larger}{\caption@larger}
+% \end{macrocode}
+%
+% \changes{v1.3}{2011/01/01}{\package{sansmath} package support added}
+% \begin{macrocode}
+\DeclareCaptionFont{sansmath}{\sansmath}
+% \end{macrocode}
+%
+% \changes{v1.0n}{2007/04/02}{\package{setspace} package support added}
+% \changes{v1.2d}{2009/10/09}{Bugfix 09-05-18: \package{setspace} package support revised}
+% \begin{macrocode}
+\DeclareCaptionFont{singlespacing}{%
+ \caption@ifundefined\setspace@singlespace{}{%
+ \setstretch\setspace@singlespace}}% normally 1
+\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
+\DeclareCaptionFont{doublespacing}{\doublespacing}
+\DeclareCaptionFont{stretch}{\setstretch{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%\DeclareCaptionFont{normal}{%
+% \caption@font{normalcolor,normalfont,normalsize,singlespacing}
+\DeclareCaptionFont{normal}{%
+ \caption@font*{%
+ \KV@caption@fnt@normalcolor\@unused
+ \KV@caption@fnt@normalfont\@unused
+ \KV@caption@fnt@normalsize\@unused
+ \KV@caption@fnt@singlespacing\@unused}}
+% \end{macrocode}
+%
+% \changes{v1.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
+% The old versions \version{1.x} of \thispackage\ offered this
+% command to setup the font size used for captions. We still do
+% so old documents will work fine.
+% \begin{macrocode}
+\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
+\DeclareCaptionDefaultFont{size}{}
+% \end{macrocode}
+%
+% \subsection{Justifications}
+%
+% \begin{macro}{\DeclareCaptionJustification}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
+% between arguments do make any harm}
+% \changes{v1.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}}
+% |\DeclareCaptionJustification|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionJustification[2]{%
+ \global\@namedef{caption@hj@#1}{#2}% for compatibility to v1.0
+ \DeclareCaptionFont{#1}{#2}}
+\@onlypreamble\DeclareCaptionJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultJustification}
+% \changes{v1.1}{2007/07/03}{This macro added}
+% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionJustification} to \cs{DeclareCaptionDefaultJustification}}
+% |\DeclareCaptionDefaultJustification|\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultJustification[1]{%
+ \global\@namedef{caption@hj@default}{#1}% for compatibility to v1.0
+ \DeclareCaptionDefaultFont{@hj}{#1}}
+\@onlypreamble\DeclareCaptionDefaultJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{justification}{\caption@setjustification{#1}}
+\DeclareCaptionDefaultJustification{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setjustification}
+% \changes{v1.1}{2007/07/03}{Mapped to \cs{caption@setfont}}
+% |\caption@setjustification|\marg{name}\par
+% Selecting a caption justification simply means saving the code (in |\caption@hj|).
+% \begin{macrocode}
+\newcommand*\caption@setjustification{\caption@setfont{@hj}}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined justification code snippets.
+% \begin{macrocode}
+\DeclareCaptionJustification{justified}{}
+\DeclareCaptionJustification{centering}{\centering}
+\DeclareCaptionJustification{centerfirst}{\centerfirst}
+\DeclareCaptionJustification{centerlast}{\centerlast}
+\DeclareCaptionJustification{raggedleft}{\raggedleft}
+\DeclareCaptionJustification{raggedright}{\raggedright}
+% \end{macrocode}
+%
+% \begin{macro}{\centerfirst}
+% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}}
+% Please blame Frank Mittelbach for the code of |\centerfirst| |:-)|
+% \begin{macrocode}
+\providecommand\centerfirst{%
+ \let\\\@centercr
+ \edef\caption@normaladjust{%
+ \leftskip\the\leftskip
+ \rightskip\the\rightskip
+ \parfillskip\the\parfillskip\relax}%
+ \leftskip\z@\@plus -1fil%
+ \rightskip\z@\@plus 1fil%
+ \parfillskip\z@skip
+ \noindent\hskip\z@\@plus 2fil%
+ \@setpar{\@@par\@restorepar\caption@normaladjust}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\centerlast}
+% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}}
+% This is based on code from Anne Br\"uggemann-Klein\cite{Anne}
+% \begin{macrocode}
+\providecommand\centerlast{%
+ \let\\\@centercr
+ \leftskip\z@\@plus 1fil%
+ \rightskip\z@\@plus -1fil%
+ \parfillskip\z@\@plus 2fil\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{The ragged2e package}
+% \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support}
+%
+% We also support the upper-case commands offered by the \package{ragged2e}
+% package.
+% Note that these just map to their lower-case variants if the
+% \package{ragged2e} package is not available.
+% \begin{macrocode}
+\DeclareCaptionJustification{Centering}{%
+ \caption@ragged\Centering\centering}
+\DeclareCaptionJustification{RaggedLeft}{%
+ \caption@ragged\RaggedLeft\raggedleft}
+\DeclareCaptionJustification{RaggedRight}{%
+ \caption@ragged\RaggedRight\raggedright}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@ragged}
+% \changes{v1.0n}{2007/04/07}{The `ragged2e' package will now only been
+% loaded when needed}
+% \changes{v1.0o}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced
+% by \cs{caption@Debug}}
+% \changes{v1.1}{2007/04/16}{A different warning will be given on first \LaTeX\ run}
+% \changes{v1.4f}{2012/01/12}{Uses \cs{caption@IfPackageLoaded} now}
+% |\caption@ragged|\marg{yes-code}\marg{no-code}
+% executes the \meta{yes-code} if the \package{ragged2e} package is loaded
+% and \meta{no-code} if not. Additionally it tries to load the \package{ragged2e}
+% package.
+% \begin{macrocode}
+\newcommand*\caption@ragged{\caption@ifpackageloaded{ragged2e}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifpackageloaded}
+% \changes{v1.4f}{2012/01/12}{This macro added}
+% |\caption@ifpackageloaded|\marg{package}\marg{yes-code}\marg{no-code}
+% executes the \meta{yes-code} if the given package is loaded
+% and \meta{no-code} if not. Additionally it tries to load the package.
+% \begin{macrocode}
+\newcommand*\caption@ifpackageloaded[1]{%
+ \@ifundefined{caption@ifpkg@#1}%
+ {\caption@RequirePackage{#1}%
+ \caption@pkg@true{#1}}%
+ {}%
+ \caption@ifpkg{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{\renewcommand*\caption@ifpackageloaded[1]{%
+ \@ifundefined{caption@ifpkg@#1}%
+ {\caption@addto@pkg@list{#1}%
+ \caption@pkg@false{#1}%
+ \caption@Warning{%
+ `#1' support has been changed.\MessageBreak
+ Rerun to get captions right}}%
+ {}%
+ \caption@ifpkg{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifpkg[1]{%
+ \csname caption@ifpkg@#1\endcsname}
+\newcommand*\caption@pkg@true[1]{%
+ \global\expandafter\let\csname caption@ifpkg@#1\endcsname\@firstoftwo}
+\newcommand*\caption@pkg@false[1]{%
+ \global\expandafter\let\csname caption@ifpkg@#1\endcsname\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@pkg@list{}
+\newcommand*\caption@addto@pkg@list[1]{%
+ \protected@write\@auxout{}{%
+ \string\@cons\string\caption@pkg@list{{#1}}}}
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{%
+ \def\caption@tempa{\endgroup}%
+ \begingroup
+ \def\@elt#1{%
+ \g@addto@macro\caption@tempa{%
+ \caption@RequirePackage{#1}%
+ \@namedef{caption@ifpkg@#1}{%
+ \caption@addto@pkg@list{#1}%
+ \caption@pkg@true{#1}%
+ \caption@ifpkg{#1}}}}%
+ \caption@pkg@list
+ \caption@tempa}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@RequirePackage[1]{%
+ \caption@Info{We need package `#1'}%
+ \RequirePackage{#1}}
+\@onlypreamble\caption@RequirePackage
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Vertical spaces before and after captions}
+%
+% \begin{macro}{\abovecaptionskip}
+% \begin{macro}{\belowcaptionskip}
+% Usually these skips are defined within the document class, but some
+% document classes don't do so.
+% \begin{macrocode}
+\caption@ifundefined\abovecaptionskip{%
+ \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
+\caption@ifundefined\belowcaptionskip{%
+ \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{Option \opt{skip=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
+\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
+\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@rule}
+% \changes{v1.2b}{2008/05/06}{This macro added}
+% |\caption@rule|\par
+% Draws an invisible rule to adjust the ``skip'' setting.
+% \begin{macrocode}
+\newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@hrule{\hrule\@height\z@}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2b}{2008/05/06}{Option \opt{rule=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}}
+% \end{macrocode}
+%
+% \subsection{Positioning}
+%
+% These macros handle the right position of the caption.
+% Note that the position is actually \emph{not} controlled by the
+% \package{caption3} kernel options, but by the user (or a specific package
+% like the \package{float} package) instead.
+% The user can put the |\caption| command wherever he likes! So this stuff
+% is only to give us a \emph{hint} where to put the right skips, the user
+% usually has to take care for himself that this hint actually matches the
+% right position.
+%
+% \begin{macrocode}
+\DeclareCaptionOption{position}{\caption@setposition{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setposition}
+% \changes{v1.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b},
+% \opt{below}, and \opt{a} are allowed, too}
+% \changes{v1.0c}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
+% |\caption@setposition|\marg{position}\par
+% Selecting the caption position means that we put |\caption@position| to
+% the right value. \emph{Please do \textbf{not} use the internal macro
+% \cs{caption@position} in your own package or document, but use the wrapper
+% macro \cs{caption@iftop} instead.}
+% \begin{macrocode}
+\newcommand*\caption@setposition[1]{%
+ \caption@ifinlist{#1}{d,default}{%
+ \let\caption@position\caption@defaultpos
+ }{\caption@ifinlist{#1}{t,top,above}{%
+ \let\caption@position\@firstoftwo
+ }{\caption@ifinlist{#1}{b,bottom,below}{%
+ \let\caption@position\@secondoftwo
+ }{\caption@ifinlist{#1}{a,auto}{%
+ \let\caption@position\@undefined
+ }{%
+ \caption@Error{Undefined position `#1'}%
+ }}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defaultpos}
+% \changes{v1.1}{2007/05/08}{Default position changed from `bottom' to `auto'}
+% The default `position' is `auto', this means that \thispackage\ will try
+% to guess the current position of the caption.
+% (But in many cases, for example in |longtable|s, this is doomed to fail!)\par
+% The setting `bottom' correspondents to the |\@makecaption| implementation
+% in the standard \LaTeX\ document classes, but `auto' should give better
+% results in most cases.
+% \begin{macrocode}
+%\caption@setdefaultpos{a}% default = auto
+\let\caption@defaultpos\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftop}
+% \changes{v1.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
+% \changes{v1.0c}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
+% \changes{v1.1}{2007/05/08}{Position will be fixed to `bottom' if `auto'}
+% |\caption@iftop|\marg{true-code}\marg{false-code}\par
+% (If the |position=| is set to |auto| we assume a |bottom| position here.)
+% \begin{macrocode}
+\newcommand*\caption@iftop{%
+ \ifx\caption@position\@undefined
+ \let\caption@position\@secondoftwo
+% = \caption@setposition b%
+ \fi
+ \caption@position}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fixposition}
+% \changes{v1.0b}{2004/05/16}{%
+% Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
+% |\caption@fixposition|\par
+% This macro checks if the `position' is set to `auto'.
+% If yes, |\caption@autoposition| will be called to
+% set |\caption@position| to a proper value we can actually use.
+% \begin{macrocode}
+\newcommand*\caption@fixposition{%
+ \ifx\caption@position\@undefined
+ \caption@autoposition
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@autoposition}
+% \changes{v1.0a}{2004/01/23}{\cs{ifvmode} added}
+% |\caption@autoposition|\par
+% We guess the current position of the caption by checking |\prevdepth|.\par
+% A different solution would be setting the |\spacefactor| to something
+% not much less than 1000 (for example 994) in |\caption@start| and
+% checking this value here by |\ifnum\spacefactor=994|.
+% (It's implemented in the \package{threeparttable}
+% package\cite{threeparttable} this way.)\par
+% Another idea would be checking |\@ifminipage|, but since some packages
+% typeset the caption within a simple |\vbox| this does not seem to be a
+% good one.
+% \begin{macrocode}
+\newcommand*\caption@autoposition{%
+ \ifvmode
+ \edef\caption@tempa{\the\prevdepth}%
+ \caption@Debug{\protect\prevdepth=\caption@tempa}%
+ \ifdim\prevdepth>-\p@
+ \let\caption@position\@secondoftwo
+ \else
+ \let\caption@position\@firstoftwo
+ \fi
+% = \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}%
+ \else
+ \caption@Debug{no \protect\prevdepth}%
+ \let\caption@position\@secondoftwo
+% = \caption@setposition b%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@setautoposition}
+% \changes{v1.1}{2007/06/10}{This macro added}
+% |\caption@setautoposition|\marg{position}\par
+% replaces the above algorithm by a different one (or a fixed position setting).
+% \begin{macrocode}
+\newcommand*\caption@setautoposition[1]{%
+ \def\caption@autoposition{\caption@setposition{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Hooks}
+%
+% \begin{macro}{\AtBeginCaption}
+% \begin{macro}{\AtEndCaption}
+% |\AtBeginCaption| \marg{code}\\
+% |\AtEndCaption| \marg{code}\par
+% These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|.
+% \begin{macrocode}
+\newcommand*\caption@beginhook{}
+\newcommand*\caption@endhook{}
+\newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook}
+\newcommand*\AtEndCaption{\l@addto@macro\caption@endhook}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Lists}
+%
+% \changes{v1.0b}{2004/05/16}{Option \opt{listof=} added}
+% \changes{v1.2}{2007/11/17}{Option \opt{list=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{list}[1]{\caption@setlist{#1}}
+\DeclareCaptionOption{listof}[1]{\caption@setlist{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlist}
+% \changes{v1.2a}{2008/03/20}{This macro added}
+% |\caption@setlist|\marg{boolean}
+% \begin{macrocode}
+\newcommand*\caption@setlist{\caption@set@bool\caption@iflist}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.4}{2011/08/30}{Option \opt{listtype=} added}
+% \changes{v1.4}{2011/08/30}{Option \opt{listtype+=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listtype}{\caption@setlisttype{#1}}
+\DeclareCaptionOption{listtype+}{\caption@setlisttype@ext{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlisttype}
+% \changes{v1.4}{2011/08/30}{This macro added}
+% |\caption@setlisttype|\marg{type}
+% \begin{macrocode}
+\newcommand*\caption@setlisttype{%
+ \caption@setlisttype@ext{}%
+ \caption@@setlisttype\caption@listtype}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setlisttype[2]{%
+ \edef#1{#2}%
+ \ifx#1\@empty \let#1\@undefined \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@setlisttype@ext}
+% \changes{v1.4}{2011/08/30}{This macro added}
+% |\caption@setlisttype@ext|\marg{type extension}
+% \begin{macrocode}
+\newcommand*\caption@setlisttype@ext{%
+ \caption@@setlisttype\caption@listtype@ext}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionListFormat}
+% \changes{v1.1}{2004/07/15}{This macro added}
+% \changes{v1.2}{2007/11/17}{Renamed from \cs{DeclareCaptionListOfFormat} to \cs{DeclareCaptionListFormat}}
+% |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionListFormat[2]{%
+ \global\@namedef{caption@lstfmt@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionListFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.1}{2007/07/15}{Option \opt{listofformat=} added}
+% \changes{v1.2}{2007/11/17}{Option \opt{listofformat=} renamed to \opt{listformat=}}
+% \begin{macrocode}
+\DeclareCaptionOption{listformat}{\caption@setlistformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlistformat}
+% \changes{v1.1}{2004/07/15}{This macro added}
+% \changes{v1.2}{2007/11/17}{Renamed from \cs{caption@setlistofformat} to \cs{caption@setlistformat}}
+% |\caption@setlistformat|\marg{name}\par
+% Selecting a caption list format simply means saving the code (in |\caption@lstfmt|).
+% \begin{macrocode}
+\newcommand*\caption@setlistformat[1]{%
+ \@ifundefined{caption@lstfmt@#1}%
+ {\caption@Error{Undefined list format `#1'}}%
+ {\expandafter\let\expandafter\caption@lstfmt
+ \csname caption@lstfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are five pre-defined list formats, taken from the \package{subfig} package.
+% \begin{macrocode}
+\DeclareCaptionListFormat{empty}{}
+\DeclareCaptionListFormat{simple}{#1#2}
+\DeclareCaptionListFormat{parens}{#1(#2)}
+\DeclareCaptionListFormat{subsimple}{#2}
+\DeclareCaptionListFormat{subparens}{(#2)}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setdefaultlistformat}
+% \changes{v1.2d}{2009/03/29}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setdefaultlistformat[1]{%
+ \ifx\caption@lstfmt\caption@lstfmt@default
+ \caption@set@default@listformat{#1}%
+ \caption@setlistformat{default}%
+ \else
+ \caption@set@default@listformat{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@default@listformat[1]{%
+ \def\caption@lstfmt@default{\@nameuse{caption@lstfmt@#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `subsimple'.
+% \begin{macrocode}
+\caption@set@default@listformat{subsimple}
+% \end{macrocode}
+%
+% \subsection{Debug option}
+% \changes{v1.0k}{2007/03/04}{Debug option added}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{debug}[1]{%
+ \caption@set@bool\caption@ifdebug{#1}%
+ \caption@ifdebug
+ {\let\caption@Debug\caption@Info}%
+ {\let\caption@Debug\@gobble}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareOption{debug}{\setkeys{caption}{debug}}
+% \end{macrocode}
+% \begin{macrocode}
+\setkeys{caption}{debug=0}
+% \end{macrocode}
+%
+% \subsection{Document classes \& Babel support}
+%
+% \subsubsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes}
+%
+% \begin{macrocode}
+\caption@CheckCommand\@makecaption{%
+ % article|report|book [2005/09/16 v1.4f Standard LaTeX document class]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+%
+% \subsubsection{The elsarticle classes}
+% \changes{v1.5}{2013/01/06}{elsarticle class support added}
+%
+% \begin{macro}{\caption@ifelsarticleclass}
+% \begin{macrocode}
+\providecommand*\caption@ifelsarticleclass{%
+ \@ifclassloaded{elsarticle}\@firstofone\@gobble}
+\@onlypreamble\caption@ifelsarticleclass
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifelsarticleclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % elsarticle.cls,v 1.20 2008-10-13 04:24:12 cvr Exp
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip\footnotesize
+ \sbox\@tempboxa{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{font}{\footnotesize}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The \AmS{} \& \SmF{} classes}
+% \changes{v1.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added}
+%
+% \begin{macro}{\caption@ifamsclass}
+% \begin{macrocode}
+\providecommand*\caption@ifamsclass{%
+ \caption@ifundefined\@captionheadfont\@gobble\@firstofone}
+\@onlypreamble\caption@ifamsclass
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifamsclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % amsart|amsproc|amsbook [2004/08/06 v2.20]
+ \long\def\@makecaption#1#2{%
+ \setbox\@tempboxa\vbox{\color@setgroup
+ \advance\hsize-2\captionindent\noindent
+ \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
+ {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}%
+ \unskip\kern-2\captionindent\par
+ \global\setbox\@ne\lastbox\color@endgroup}%
+ \ifhbox\@ne % the normal case
+ \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
+ \fi
+ \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
+ \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
+ \else % tempboxa contained more than one line
+ \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip
+ \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
+ \fi
+ \ifnum\@tempcnta<64 % if the float IS a figure...
+ \addvspace\abovecaptionskip
+ \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
+ \else % if the float IS NOT a figure...
+ \hbox to\hsize{\kern\captionindent\box\@ne\hss}%
+ \nobreak
+ \vskip\belowcaptionskip
+ \fi
+ \relax
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % smfart|smfbook [1999/11/15 v1.2f Classe LaTeX pour les articles publies par la SMF]
+ \long\def\@makecaption#1#2{%
+ \ifdim\captionindent>.1\hsize \captionindent.1\hsize \fi
+ \setbox\@tempboxa\vbox{\color@setgroup
+ \advance\hsize-2\captionindent\noindent
+ \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
+ {\@cdr#2\@nil}{\@addpunct{.}\@captionfont\upshape\enspace#2}%
+ \unskip\kern-2\captionindent\par
+ \global\setbox\@ne\lastbox\color@endgroup}%
+ \ifhbox\@ne % the normal case
+ \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
+ \fi
+ \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
+ \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
+ \@tempdima\wd\@ne\advance\@tempdima-\captionindent
+ \wd\@ne\@tempdima
+ \else % tempboxa contained more than one line
+ \setbox\@ne\vbox{\rightskip=0pt plus\captionindent\relax
+ \unvbox\@tempboxa\parskip\z@skip
+ \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
+ \fi
+ \ifnum\@tempcnta<64 % if the float IS a figure...
+ \addvspace\abovecaptionskip
+ \noindent\kern\captionindent\box\@ne
+ \else % if the float IS NOT a figure...
+ \noindent\kern\captionindent\box\@ne
+ \nobreak
+ \vskip\belowcaptionskip
+ \fi
+ \relax
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+ \let\captionmargin\captionindent % set to 3pc by AMS class
+ \begingroup\edef\@tempa{\endgroup
+ \noexpand\caption@g@addto@list\noexpand\caption@sty@default
+ {margin=\the\captionmargin
+ \caption@ifundefined\smf@makecaption{}{,maxmargin=.1\linewidth}}}
+ \@tempa
+ \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin}
+ \DeclareCaptionLabelSeparator{default}{.\enspace}
+ \DeclareCaptionDefaultFont{font}{\@captionfont}
+ \DeclareCaptionDefaultFont{labelfont}{\@captionheadfont}
+ \DeclareCaptionDefaultFont{textfont}{\@captionfont\upshape}
+ \captionsetup[figure]{position=b}
+ \captionsetup[table]{position=t}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The beamer class (Part one)}
+% \changes{v1.1}{2007/03/10}{\package{beamer} class support added}
+% \changes{v1.3}{2011/08/06}{\package{beamer} class support revised}
+% \changes{v1.5}{2013/04/27}{The \package{beamer} template \texttt{caption label separator} will be used now}
+% \changes{v1.7}{2016/05/22}{Re-definition of label format \texttt{simpleMagyar} added to \package{beamer} class support}
+% \changes{v1.7}{2018/04/15}{Re-definition of label format \texttt{simpleMagyar} revised}
+% \changes{v1.7}{2018/05/01}{Definition of \package{beamer} default label font revised}
+%
+% \begin{macro}{\caption@ifbeamerclass}
+% \begin{macrocode}
+\providecommand*\caption@ifbeamerclass{%
+ \@ifclassloaded{beamer}\@firstofone\@gobble}
+\@onlypreamble\caption@ifbeamerclass
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifbeamerclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\beamer@makecaption{%
+ % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
+ \long\def\beamer@makecaption#1#2{%
+ \def\insertcaptionname{\csname#1name\endcsname}%
+ \def\insertcaptionnumber{\csname the#1\endcsname}%
+ \def\insertcaption{#2}%
+ \nobreak\vskip\abovecaptionskip\nobreak
+ \sbox\@tempboxa{\usebeamertemplate**{caption}}%
+ \ifdim \wd\@tempboxa >\hsize
+ \usebeamertemplate**{caption}\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \nobreak\vskip\belowcaptionskip\nobreak}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@ifbeamertemplate}
+% |\caption@ifbeamertemplate|\marg{caption template name}\marg{yes-code}\marg{no-code}\\
+% tests if the given beamer caption template was selected by the user (or not).
+% \begin{macrocode}
+ \newcommand*\caption@ifbeamertemplate[1]{%
+ \begingroup
+ \let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
+ \@nameuse{beamer@@tmpop@caption@#1}%
+ \ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
+ \endgroup\expandafter\@firstoftwo
+ \else
+ \endgroup\expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \DeclareCaptionLabelFormat{default}{%
+ \caption@ifbeamertemplate{numbered}%
+ \caption@lfmt@simple
+ \caption@lfmt@unnumbered
+ {#1}{#2}}
+% \end{macrocode}
+% The \package{magyar} babel package redefines the current label format to a one called |simple|\-|Magyar|,
+% defined within |\@@magyar@caption|\-|fix| which will be executed |\At|\-|Begin|\-|Document|.
+% \begin{macrocode}
+ \DeclareCaptionLabelFormat{default@magyar}{%
+ \caption@ifbeamertemplate{numbered}%
+ \caption@lfmt@simple@magyar
+ \caption@lfmt@unnumbered
+ {#1}{#2}}
+ \@ifundefined{@@magyar@captionfix}\AtBeginDocument\@firstofone{%
+ \@ifundefined{@@magyar@captionfix}{}{%
+ \g@addto@macro\@@magyar@captionfix{%
+ \let\caption@lfmt@simple@magyar\caption@lfmt@simpleMagyar
+ \let\caption@lfmt@simpleMagyar\caption@lfmt@default@magyar}}}
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@declarelabelseparator
+ {\caption@ifbeamertemplate{caption name own line}\@gobble\@firstofone}
+ {default}
+ {\caption@ifbeamertemplate{caption name own line}{\\}%
+ {\usebeamertemplate{caption label separator}}}
+ \DeclareCaptionDefaultFont{font}{%
+ \usebeamerfont*{caption}%
+ \usebeamercolor[fg]{caption}}
+ \DeclareCaptionDefaultFont{labelfont}{%
+ \setbeamercolor*{caption}{}% avoid setting "caption" color additionally
+ \usebeamercolor[fg]{caption name}%
+ \setbeamerfont*{caption}{}% avoid setting "caption" font additionally
+ \usebeamerfont{caption name}}
+ \DeclareCaptionDefaultJustification{\raggedright}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareOption{beamerclass}{%
+ \renewcommand\caption@ifslc{%
+ \caption@ifbeamertemplate{caption name own line}\@secondoftwo\@firstoftwo}
+ % Since the beamer class do not offer a `list of figures' we switch this support off.
+ \captionsetup{list=0}}
+ \PassOptionsToPackage{beamerclass}{caption3}
+% \end{macrocode}
+%
+% If the \package{beamer} document class is used, we offer a beamer
+% template called `caption3' which can be used with option `beamer' or
+% |\setbeamertemplate{caption}[caption3]|.\par
+% (Note that this is of no use when the \package{caption} package is used, too.)
+% \begin{macrocode}
+ \defbeamertemplate{caption}{caption3}{%
+ \caption@make\insertcaptionname\insertcaptionnumber\insertcaption}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareOption{beamer}{%
+ % \usebeamertemplate**{caption} will set font
+ \DeclareCaptionDefaultFont{font}{}%
+ \setbeamertemplate{caption}[caption3]}
+% \end{macrocode}
+% \begin{macrocode}
+%
+% \begin{macrocode]
+}
+% \end{macrocode}
+%
+% \subsubsection{The KOMA-Script classes}
+% \changes{v1.1}{2007/03/31}{\KOMAScript\ classes support added}
+%
+% \begin{macro}{\caption@ifkomaclass}
+% \begin{macrocode}
+\providecommand*\caption@ifkomaclass{%
+ \caption@ifundefined\scr@caption\@gobble\@firstofone}
+\@onlypreamble\caption@ifkomaclass
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifkomaclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % scrartcl|scrreprt|scrbook [2007/03/07 v2.97a KOMA-Script document class]
+ \long\def\@makecaption#1#2{%
+ \if@captionabove
+ \vskip\belowcaptionskip
+ \else
+ \vskip\abovecaptionskip
+ \fi
+ \@@makecaption\@firstofone{#1}{#2}%
+ \if@captionabove
+ \vskip\abovecaptionskip
+ \else
+ \vskip\belowcaptionskip
+ \fi}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionFormat{default}[#1#2#3\par]{%
+ \ifdofullc@p
+ \caption@ifin@list\caption@lsepcrlist\caption@lsepname
+ {\caption@Error{%
+ The option `labelsep=\caption@lsepname' does not work\MessageBreak
+ with \noexpand\setcaphanging (which is set by default)}}%
+ {\caption@fmt@hang{#1}{#2}{#3}}%
+ \else
+ #1#2%
+ \ifdim\cap@indent<\z@
+ \par
+ \noindent\hspace*{-\cap@indent}%
+ \else\if@capbreak
+ \par
+ \fi\fi
+ #3\par
+ \fi}
+ \DeclareCaptionLabelSeparator{default}{\captionformat}
+ \DeclareCaptionDefaultFont{font}{\scr@fnt@caption}
+ \DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The \NTG{} Dutch classes}
+% \changes{v1.1}{2007/04/06}{NTG classes support added}
+%
+% \begin{macro}{\caption@ifntgclass}
+% \begin{macrocode}
+\providecommand*\caption@ifntgclass{%
+ \caption@ifundefined\CaptionFonts\@gobble\@firstofone}
+\@onlypreamble\caption@ifntgclass
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifntgclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % artikel|rapport|boek [2004/06/07 v2.1a NTG LaTeX document class]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{{\CaptionLabelFont#1:} \CaptionTextFont#2}%
+ \ifdim \wd\@tempboxa >\hsize
+ {\CaptionLabelFont#1:} \CaptionTextFont#2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont}
+ \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The thesis class}
+% \changes{v1.2a}{2008/01/31}{thesis class support added}
+% \changes{v1.2e}{2009/11/15}{Bugfix 09-11-14: thesis class support revised}
+%
+% \begin{macro}{\caption@ifthesisclass}
+% \begin{macrocode}
+\providecommand*\caption@ifthesisclass{%
+ \caption@ifundefined\cph@font
+ {\@gobble}%
+ {\caption@ifundefined\cpb@font\@gobble\@firstofone}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@ifthesisclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % thesis.cls 1996/25/01 1.0g LaTeX document class (wm).
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \setbox\@tempboxa\hbox{{\cph@font #1:} {\cpb@font #2}}%
+ \ifdim \wd\@tempboxa >\hsize
+ \@hangfrom{\cph@font #1: }{\cpb@font #2\par}%
+ \else
+ \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFormat{hang}
+ \DeclareCaptionDefaultFont{labelfont}{\cph@font}
+ \DeclareCaptionDefaultFont{textfont}{\cpb@font}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The arabic Babel option}
+% \changes{v1.8}{2018/05/20}{\package{arabic} babel package support added}
+%
+% \begin{macrocode}
+\caption@ifundefined\ArabiCoreLoaded{%
+% \end{macrocode}
+% \begin{macro}{\caption@rl}
+% \changes{v1.8}{2018/05/20}{This macro added}
+% \begin{macrocode}
+ \let\caption@rl\@firstofone
+}{%
+ \newcommand\caption@rl[1]{\if@rl\textRL{#1}\else\textLR{#1}\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+ \def\fnum@figure{\figurename\nobreakspace\thefigure}%
+ \def\fnum@table{\tablename\nobreakspace\thetable}%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionLabelSeparator{arabi}{ : }
+ \DeclareCaptionLabelSeparator{default}{%
+ \if@rl\caption@lsep@arabi\else\caption@lsep@colon\fi}
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % arabicore.sty [2006/01/01 v1.0 Arabi Core switching commands (may still change)]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1: #2}%
+ \sbox\@Arabitempboxa{\textRL{#2} : #1}%
+ \if@rl{
+ \ifdim \wd\@Arabitempboxa >\hsize
+ \textRL{#2} : #1\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@Arabitempboxa\hfil}%
+ \fi}\else{
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi}\fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The frenchb Babel option}
+% \changes{v1.1}{2006/05/14}{\package{frenchb} babel package support added}
+%
+% \begin{macrocode}
+\caption@ifundefined\FB@makecaption{}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % frenchb.ldf [2005/02/06 v1.6g French support from the babel system]
+ % frenchb.ldf [2007/10/05 v2.0e French support from the babel system]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1\CaptionSeparator #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1\CaptionSeparator #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\@makecaption\STD@makecaption
+ \DeclareCaptionLabelSeparator{default}{\CaptionSeparator}
+ \def\caption@frenchb{% supress frenchb warning
+ \let\STD@makecaption\@makecaption
+ \let\FB@makecaption\@makecaption}
+ \else
+ \ifx\@makecaption\@undefined\else
+ \caption@InfoNoLine{%
+ The definition of \protect\@makecaption\space
+ has been changed,\MessageBreak
+ frenchb will NOT customize it}%
+ \fi
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The frenchle/pro package}
+% \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added}
+%
+% \begin{macrocode}
+\caption@ifundefined\frenchTeXmods{}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % french(le).sty [2006/10/03 The french(le) package /V5,9991/]
+ % french(le).sty [2007/06/28 The french(le) package /V5,9994/]
+ \def\@makecaption#1#2{%
+ \ifFTY%
+ \def\@secondofmany##1##2\void{##2}%
+ \def\@tempa{\@secondofmany#2\void}%
+ \ifx\@tempa\empty%
+ \let\captionseparator\empty%
+ \fi%
+ \@mcORI{#1}{\relax\captionfont{#2}}%
+ \else
+ \@mcORI{#1}{#2}%
+ \fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % french(le).sty [2007/02/11 The french(le) package /V5,9993/]
+ \def\@makecaption#1#2{%
+ \ifFTY%
+ \def\@secondofmany##1##2\void{##2}%
+ \protected@edef\@tempa{\@secondofmany#2\void}%
+ \ifx\@tempa\empty%
+ \let\captionseparator\empty%
+ \fi%
+ \@mcORI{#1}{\relax\captionfont{#2}}%
+ \else
+ \@mcORI{#1}{#2}%
+ \fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{textfont}{\itshape}%
+ \DeclareCaptionLabelSeparator{default}{\captionseparator\space}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsubsection{The hebrew Babel option}
+% \changes{v1.8}{2018/08/26}{\package{hebrew} package support added}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@makecaption{%
+ % rlbabel.def [2005/03/30 v2.3h Right-to-Left support from the babel system Hebrew language support from the babel system]
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip%
+ \begin{center}%
+ #1: #2%
+ \end{center} \par%
+ \vskip\belowcaptionskip}}%
+% \end{macrocode}
+%
+% \subsubsection{The hungarian and magyar Babel option}
+% \changes{v1.3}{2009/03/29}{\package{magyar} package support added}
+% \changes{v1.3a}{2011/08/12}{\package{magyar} package support revised}
+% \changes{v1.8b}{2018/08/26}{\package{magyar} package support revised}
+%
+% \begin{macrocode}
+\DeclareCaptionListFormat{subperiod}{#2.}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\caption@ifundefined\hunnewlabel{}{%
+ \caption@CheckCommand\@makecaption{%
+ % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system]
+ \def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1. #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ {#1. #2\csname par\endcsname}
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\caption@tempa#1{%
+ \@ifpackagewith{babel}{#1}{%
+ \caption@InfoNoLine{#1 babel option is loaded}%
+ \expandafter\addto\csname extras#1\endcsname{%
+ % change default labelsep and listformat
+ \caption@setdefaultlabelsep{period}%
+ \caption@setdefaultlistformat{subperiod}}%
+ \expandafter\addto\csname noextras#1\endcsname{%
+ % change default labelsep and listformat
+ \caption@setdefaultlabelsep{colon}%
+ \caption@setdefaultlistformat{subsimple}}%
+ }{}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@tempa{hungarian}
+\caption@tempa{magyar}
+% \end{macrocode}
+%
+% TODO: babel-latvian/latvian.ldf
+%
+% \subsubsection{Unknown document class (or package)}
+% \changes{v1.1}{2007/04/10}{Check of document class added}
+%
+% \begin{macrocode}
+\caption@IfCheckCommand{%
+ \caption@setbool{documentclass}{1}%
+}{%
+ \caption@setbool{documentclass}{0}%
+ \caption@InfoNoLine{%
+ Unknown document class (or package),\MessageBreak
+ standard defaults will be used}%
+ \caption@Debug{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}%
+}
+% \end{macrocode}
+%
+% \subsection{Execution of options}
+%
+% \begin{macrocode}
+\captionsetup{style=default,position=default,%
+ list,listformat=default,twoside=\if@twoside 1\else 0\fi}
+% \end{macrocode}
+% \begin{macrocode}
+\ProcessOptions*
+% \end{macrocode}
+%
+% \subsection{Making an `List of' entry}
+%
+% \begin{macro}{\caption@addcontentsline}
+% \changes{v1.1}{2007/07/01}{This macro added}
+% \changes{v1.3}{2010/10/26}{Error check added}
+% \changes{v1.3}{2011/06/24}{Split into two macros}
+% \changes{v1.4}{2011/08/19}{Split into three macros}
+% \changes{v1.4}{2011/08/30}{Support for option \opt{listtype=} added}
+% \changes{v1.5}{2012/01/15}{Usage of \cs{caption@addsubcontentslines} added}
+% \changes{v1.7}{2015/09/15}{Argument \#3 which holds the environment name added to \cs{caption@lstfmt}}
+% \changes{v1.7}{2015/09/20}{Unfortunately \package{subfig} defines and uses \cs{caption@lstfmt} as well, so I replaced the third argument with \cs{captionlisttype}}
+% \changes{v1.8}{2018/09/06}{Adapted to the \package{chkfloat} package}
+% |\caption@addcontentsline|\marg{type}\marg{list entry}\par
+% Makes an entry in the list-of-whatever, if requested,
+% i.e.~the argument \meta{list entry} is not empty and
+% |listof=| was set to |true|.
+% \begin{macrocode}
+\newcommand\caption@addcontentsline[2]{%
+ \caption@ifcontentsline{#2}{%
+ \begingroup
+ \let\@tempa\@gobble
+ \caption@ifundefined\caption@listtype
+ {\edef\caption@listtype{#1}}%
+ {\let\@tempa\@firstofone}%
+ \caption@ifundefined\caption@listtype@ext
+ {}%
+ {\edef\caption@listtype{\caption@listtype\caption@listtype@ext}%
+ \let\@tempa\@firstofone}%
+ \@tempa
+ {\caption@Debug{addcontentsline: #1 => \caption@listtype}%
+% \caption@setoptions\caption@listtype
+ \@namedef{the\caption@listtype}{\@nameuse{the#1}}}%
+ \expandafter\caption@@addcontentsline\expandafter{\caption@listtype}{#2}%
+ \endgroup}%
+ \caption@addsubcontentslines{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@addcontentsline[2]{%
+ {\let\\\space
+ \@ifundefined{ext@#1}%
+ {\caption@Error{No float type '#1' defined}}%
+ {\def\captionlisttype{#1}%
+ \caption@add@contentsline
+ {\csname ext@#1\endcsname}%
+ {#1}%
+ {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}%
+ {\ignorespaces #2}%
+ \caption@chkfloat{#1}{#2}}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@add@contentsline{%
+ \caption@@@addcontentsline}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@addcontentsline[4]{%
+% \caption@ifundefined\main@Arabi@language{}%
+% {\addtocontents{#1}{\xstring\select@language{\main@Arabi@language}}}%
+ \addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@chkfloat\@gobbletwo
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@ifcontentsline[1]{%
+ \caption@iflist
+ {\def\@tempa{#1}}%
+ {\let\@tempa\@empty}%
+ \ifx\@tempa\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentslines[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Typesetting the caption}
+%
+% \begin{macro}{\ifcaption@star}
+% If the starred form of |\caption| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@@make|.)
+% \begin{macrocode}
+\newif\ifcaption@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fnum}
+% \changes{v1.1}{2007/08/21}{This macro added}
+% |\caption@fnum|\marg{float type}\par
+% Typesets the caption label; as replacement for |\fnum@|\meta{float type}.
+% \begin{macrocode}
+\newcommand*\caption@fnum[1]{\caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@make}
+% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\par
+% Typesets the caption.
+% \begin{macrocode}
+\newcommand\caption@make[2]{\caption@@make{\caption@lfmt{#1}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@make}
+% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of
+% \cs{captionmargin} resp. \cs{captionwidth}; check for \cs{z@} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end
+% of caption added}
+% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
+% \changes{v1.0c}{2005/02/12}{Single-line-check moved up so it can affect margins now}
+% \changes{v1.0c}{2005/02/09}{Improvement: \cs{caption@ifh} added}
+% \changes{v1.0c}{2005/02/09}{Bugfix: \cs{leavevmode} added}
+% \changes{v1.0f}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
+% \changes{v1.0g}{2005/12/04}{Uses \cs{caption@slc} now}
+% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside
+% single-line-check replaced by \cs{relax}}
+% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be
+% typeset in horizontal mode}
+% \changes{v1.0i}{2006/05/13}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox}}
+% \changes{v1.0j}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v1.0h, re-added}
+% \changes{v1.0n}{2007/04/03}{Usage of \cs{caption@ifoddpage} added}
+% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} moved below single-line-check}
+% \changes{v1.1e}{2007/10/28}{\cs{caption@stepcounter} added}
+% \changes{v1.5}{2012/03/15}{Uses \cs{caption@tempdima} instead of \cs{@tempdima}}
+% \changes{v1.5}{2012/12/26}{max-margin stuff moved to \cs{caption@calcmargin}}
+% \changes{v1.6}{2013/05/01}{Usage of \cs{caption@box} added}
+% \changes{v1.7}{2016/01/31}{Adapted to the \package{bicaption} package}
+% |\caption@@make|\marg{caption label}\marg{caption text}
+% \begin{macrocode}
+\newcommand\caption@@make[2]{%
+ \begingroup
+ \caption@@make@{#1}{#2}%
+ \endgroup
+ \caption@@make@epilogue}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@make@[2]{%
+ \caption@stepthecounter
+ \caption@beginhook
+% \end{macrocode}
+%
+% Typeset the outer box |\caption@box|
+% \begin{macrocode}
+ \caption@box\linewidth{%
+% \end{macrocode}
+%
+% Special single-line treatment (option |singlelinecheck=|)
+% \begin{macrocode}
+ \caption@ifslc{\caption@slc{#1}{#2}\caption@singleline\relax}{}%
+% \end{macrocode}
+%
+% Typeset the left margin (option |margin=|)
+% \begin{macrocode}
+ \caption@calcmargin
+ \caption@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{}{\advance\caption@tempdima\captionmargin@}%
+ \fi
+ \caption@ifh{\advance\caption@tempdima\caption@indent}%
+ \hspace\caption@tempdima
+% \end{macrocode}
+%
+% We actually use a |\vbox| of width |\captionwidth - \caption@indent|
+% to typeset the caption.
+% \Note{\cs{captionindent} is \emph{not} supported if the caption format
+% was defined with \cs{DeclareCaptionFormat*}.}
+% \begin{macrocode}
+ \caption@tempdima\captionwidth
+ \caption@ifh{\advance\caption@tempdima-\caption@indent}%
+ \caption@parbox\caption@tempdima{%
+% \end{macrocode}
+%
+% Typeset the indention (option |indention=|)\\
+% {\small Bugfix 04-05-05:
+% |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots}
+% \begin{macrocode}
+ \caption@ifh{%
+ \ifdim\caption@indent=\z@
+ \leavevmode
+ \else
+ \hskip-\caption@indent
+ \fi}%
+% \end{macrocode}
+%
+% Typeset the caption itself and close the |\caption@parbox|
+% \begin{macrocode}
+ \caption@@@make{#1}{#2}}%
+% \end{macrocode}
+%
+% Typeset the right margin (option |margin=|)
+% \begin{macrocode}
+ \caption@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{\advance\caption@tempdima\captionmargin@}{}%
+ \fi
+ \hspace\caption@tempdima
+% \end{macrocode}
+%
+% Close the outer box |\caption@box|
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@endhook}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@make@epilogue{%
+ \global\caption@starfalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@calcmargin}
+% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by
+% \cs{ifdim}\cs{captionwidth=}\cs{z@}}
+% \changes{v1.0g}{2006/01/12}{Improvement: Takes care of list environment now}
+% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore),
+% use \cs{linewidth} instead of \cs{hsize}}
+% \changes{v1.5}{2012/12/26}{max-margin stuff moved from \cs{caption@@make} to here}
+% |\caption@calcmargin|\par
+% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
+% values.
+% \begin{macrocode}
+\newcommand*\caption@calcmargin{%
+ \caption@calcmargin@hook
+% \end{macrocode}
+% Check margin, if |\caption@minmargin| or |\caption@maxmargin| is set
+% \begin{macrocode}
+ \ifx\caption@maxmargin\@undefined \else
+ \ifdim\captionmargin>\caption@maxmargin\relax
+ \captionmargin\caption@maxmargin\relax
+ \fi
+ \fi
+ \ifx\caption@minmargin\@undefined \else
+ \ifdim\captionmargin<\caption@minmargin\relax
+ \captionmargin\caption@minmargin\relax
+ \fi
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \ifdim\captionwidth=\z@
+ \captionwidth\linewidth
+ \advance\captionwidth by -2\captionmargin
+ \advance\captionwidth by -\captionmargin@
+ \else
+ \captionmargin\linewidth
+ \advance\captionmargin by -\captionwidth
+ \divide\captionmargin by 2
+ \captionmargin@\z@
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{%
+ \string\hsize=\the\hsize,
+ \string\linewidth=\the\linewidth,\MessageBreak
+ \string\leftmargin=\the\leftmargin,
+ \string\rightmargin=\the\rightmargin,\MessageBreak
+ \string\margin=\the\captionmargin,
+ \string\margin@=\the\captionmargin@,
+ \string\width=\the\captionwidth}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@slc}
+% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} added}
+% \changes{v1.1}{2007/07/29}{\cs{caption@setup}\cs{caption@sls} added after \cs{begingroup}}
+% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} added}
+% \changes{v1.1c}{2007/10/14}{Support of \cs{caption@slfmt} added}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.3}{2010/09/04}{Split into \cs{caption@slc} and \cs{caption@@slc}}
+% \changes{v1.5}{2012/12/26}{Merged into a single macro again}
+% \changes{v1.5}{2013/04/14}{Definition and usage of \cs{ifsinglelinecaption} added}
+% |\caption@slc|\marg{label}\marg{text}\marg{single-line-code}\marg{multi-line-code}\par
+% This one does the single-line-check.
+% \begin{macrocode}
+\newcommand\caption@slc[4]{%
+ \caption@Debug{Begin SLC}%
+ \singlelinecaptiontrue
+ \begingroup
+ \caption@singleline
+ \let\caption@hj\@empty
+ \caption@calcmargin % calculate \captionwidth
+ \caption@prepareslc
+ \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
+ \ifdim\wd\@tempboxa>\captionwidth
+ \endgroup
+ \singlelinecaptionfalse
+ #4%
+ \else
+ \endgroup
+ #3%
+ \fi
+ \caption@Debug{End SLC}}
+% \end{macrocode}
+% \begin{macrocode}
+\newif\ifsinglelinecaption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@singleline{%
+ \caption@xsetup\caption@opt@singleline
+ \let\caption@fmt\caption@slfmt}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareslc}
+% \changes{v1.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
+% \changes{v1.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
+% \changes{v1.0c}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added}
+% \changes{v1.0f}{2005/07/09}{Support of \package{endnotes} package added}
+% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} moved to \cs{caption@slc}}
+% \changes{v1.1}{2007/06/13}{Redefinition of \cs{(H@)refstepcounter} added}
+% \changes{v1.1}{2007/08/12}{Redefinition of \cs{label} improved}
+% \changes{v1.1c}{2007/10/06}{Definition of \cs{caption@l@stepcounter} added}
+% \changes{v1.3}{2011/07/07}{Bugfix 11-07-06: Redefinition of \cs{footnote} and \cs{footnotemark} added, redefinition of \cs{stepcounter} and \cs{refstepcounter} dropped}
+% \changes{v1.4a}{2011/10/21}{Redefinition of \cs{pagenote} from \textsf{memoir} document class added}
+% \changes{v1.4a}{2011/10/22}{Redefinition of \cs{footnote} revised}
+% \changes{v1.5}{2013/04/13}{Redefinition os \cs{glsunset} added}
+% \changes{v1.8}{2018/01/21}{Redefinition of \cs{endnote} added (thanks to Markus Kohm)}
+% \changes{v1.8}{2018/05/16}{Redefinition of \cs{acused} added}
+% \changes{v1.8}{2018/05/26}{Definition method changed so it can be pre-defined by other packages}
+% \changes{v1.8}{2018/05/27}{Redefinition of \cs{hypertarget} added}
+% |\caption@prepareslc|\par
+% Re-define anything which would disturb the single-line-check.
+% \begin{macrocode}
+\@ifundefined{caption@prepareslc}\def\g@addto@macro\caption@prepareslc{%
+ \let\label\caption@gobble
+ \let\hypertarget\@gobbletwo
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@footnotemark@ORI\footnotemark
+ \def\footnote{\caption@withoptargs\caption@footnote}%
+ \def\footnotemark{\caption@withoptargs\caption@footnotemark}%
+ \let\@footnotetext\caption@gobble
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@endnotemark@ORI\endnotemark
+ \def\endnote{\caption@withoptargs\caption@endnote}%
+ \def\endnotemark{\caption@withoptargs\caption@endnotemark}%
+ \let\@endnotetext\caption@gobble
+% \end{macrocode}
+% \begin{macrocode}
+ \let\pagenote\caption@gobble
+% \end{macrocode}
+% Adaption to the \package{acronym} package.\par
+% See also \url{https://tex.stackexchange.com/questions/428788}
+% \begin{macrocode}
+ \let\acused\@gobble
+ \let\AC@placelabel\@gobble
+% \end{macrocode}
+% Adaption to the \package{glossaries} package.\par
+% Please note that while this adaption is usually sufficient
+% it could give incorrect measuring results if \cs{gls} is both used
+% for the very first time and more than once (for a particular acronym).
+% The alternative would be using internal macros of the
+% \package{glossaries} package which I would like to avoid.\par
+% See also \url{https://tex.stackexchange.com/questions/108368}
+% \begin{macrocode}
+ \let\glsunset\@gobble
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@footnote[2]{%
+ \caption@footnotemark{#1}}
+\newcommand\caption@footnotemark[1]{%
+ \begingroup
+ \let\stepcounter\caption@l@stepcounter
+ \caption@footnotemark@ORI#1%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@endnote[2]{%
+ \caption@endnotemark{#1}}
+\newcommand\caption@endnotemark[1]{%
+ \begingroup
+ \let\stepcounter\caption@l@stepcounter
+ \caption@endnotemark@ORI#1
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@l@stepcounter[1]{%
+ \advance\csname c@#1\endcsname\@ne\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@applyfont}
+% \changes{v1.3}{2010/09/04}{This macro added}
+% |\caption@applyfont|\par
+% This macro executes the font relevant macros, i.e. by default
+% the options set by |justification=|, |font=|, and |size=|.
+% \begin{macrocode}
+\newcommand*\caption@applyfont{%
+ \caption@hj\captionfont\captionsize}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@make}
+% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix 04-12-16: Use some kind of
+% \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
+% \changes{v1.0c}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
+% \changes{v1.0d}{2005/05/05}{Use \cs{caption@ifempty};
+% \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
+% \changes{v1.0d}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
+% \changes{v1.0f}{2005/08/24}{Check for empty label added}
+% \changes{v1.0f}{2005/08/25}{\cs{caption@iflf} added}
+% \changes{v1.0j}{2007/02/18}{Usage of \cs{caption@tfmt} added}
+% \changes{v1.1}{2007/05/07}{Bugfix: \cs{ifhmode} added to \cs{@finalstrut}}
+% \changes{v1.2}{2007/11/17}{Made option \opt{size=} stronger than \opt{font=}}
+% \changes{v1.3}{2010/09/04}{Uses \cs{caption@applyfont} now}
+% \changes{v1.3}{2010/11/01}{Bugfix: If the caption text is empty, the text format will be set to \opt{simple} now}
+% \changes{v1.7}{2016/02/01}{Bugfix: \cs{relax} added before \cs{caption@lsep} so the label separator
+% will not be gobbled if the label font command ignores spaces, e.g. by usage of \cs{color}}
+% \changes{v1.8}{2018/09/12}{\cs{par} replaced by \cs{captiontextend}}
+% |\caption@@@make|\marg{caption label}\marg{caption text}\par
+% This one finally typesets the caption paragraph, without margin and indention.
+% \begin{macrocode}
+\newcommand\caption@@@make[2]{%
+% \end{macrocode}
+%
+% If the label is empty, we use no caption label separator.
+% \begin{macrocode}
+ \sbox\@tempboxa{#1}%
+ \ifdim\wd\@tempboxa=\z@
+ \let\caption@lsep\relax
+% \@capbreakfalse
+ \fi
+% \end{macrocode}
+%
+% If the text is empty, we use no caption label separator, too.
+% (And no text format either.)
+% \begin{macrocode}
+ \caption@ifempty{#2}{%
+ \let\caption@lsep\@empty
+ \let\caption@tfmt\@firstofone
+% \@capbreakfalse
+% \let\caption@ifstrut\@secondoftwo
+ }%
+% \end{macrocode}
+%
+% Take care that |\caption@parindent| and |\caption@hangindent| will be used
+% to typeset the paragraph.
+% \begin{macrocode}
+ \@setpar{\@@par\caption@@par}\caption@@par
+% \end{macrocode}
+%
+% Finally typeset the caption.
+% \begin{macrocode}
+ \caption@applyfont
+ \caption@fmt
+ {\ifcaption@star\else
+ \begingroup
+ \captionlabelfont
+ #1%
+ \endgroup
+ \fi}%
+ {\ifcaption@star\else
+ \begingroup
+ \caption@iflf\captionlabelfont
+ \relax\caption@lsep
+ \endgroup
+ \fi}%
+ {{\captiontextfont
+ \captiontextstart
+ \caption@ifstrut
+ {\vrule\@height\ht\strutbox\@width\z@}%
+ {}%
+ \nobreak\hskip\z@skip % enable hyphenation
+ \caption@tfmt{#2}%
+% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
+ \caption@ifstrut
+ {\ifhmode\@finalstrut\strutbox\fi}%
+ {}%
+ \captiontextend}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\captiontextstart{}
+\newcommand*\captiontextend{\par}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty}
+% \changes{v1.0d}{2005/05/05}{This macro added}
+% \changes{v1.1}{2007/07/04}{Re-defines itself now}
+% \changes{v1.2a}{2007/01/22}{Revised so \cs{label} will be detected, too}
+% \changes{v1.2b}{2008/08/02}{Revised so \cs{index} and \cs{glossary} will be detected, too}
+% |\caption@ifempty|\marg{text}\marg{true} (\emph{no} \meta{false})\par
+% This one tests if the \meta{text} is actually empty.
+% \Note{This will be done without expanding the text,
+% therefore this is far away from being bullet-proof.}
+% \Note{This macro is re-defining itself so only
+% the first test (in a group) will actually be done.}
+% \begin{macrocode}
+\newcommand\caption@ifempty[1]{%
+ \caption@if@empty{#1}%
+ \caption@ifempty\@unused}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@if@empty[1]{%
+ \def\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \expandafter\def\expandafter\caption@tempa\expandafter{%
+ \caption@car#1\caption@if@empty\caption@nil}%
+ \def\caption@tempb{\caption@if@empty}%
+ \ifx\caption@tempa\caption@tempb
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \def\caption@tempb{\ignorespaces}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobble#1}%
+ \else
+ \def\caption@tempb{\label}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\index}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\glossary}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \let\caption@ifempty\@gobbletwo
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@par}
+% \changes{v1.0f}{2005/08/22}{Made this definition global}
+% |\caption@@par|\par
+% This command will be executed with every |\par| inside the caption.
+% \begin{macrocode}
+\newcommand*\caption@@par{%
+ \parindent\caption@parindent\hangindent\caption@hangindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Types \& sub-types}
+%
+% \begin{macro}{\DeclareCaptionType}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% \changes{v1.1a}{2007/09/07}{Three optional arguments added}
+% \changes{v1.2}{2007/12/06}{Renamed from \cs{DeclareFloatingEnvironment} to \cs{DeclareCaptionType}}
+% \changes{v1.2}{2007/12/21}{Optional argument revised, uses key-value syntax now}
+% \changes{v1.2b}{2008/04/13}{Uses \cs{caption@within@default} now}
+% \changes{v1.2b}{2008/08/02}{Support of \cs{float@exts} and \cs{float@addtolists} added}
+% \changes{v1.2e}{2010/01/09}{Usage of \cs{caption@DeclareWithinOption} added}
+% \changes{v1.3}{2011/08/06}{Definition of \cs{listofXXXes} added}
+% \changes{v1.4a}{2011/10/29}{Outsourced as \package{newfloat} package}
+% |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionType{%
+ \RequirePackage{newfloat}%
+ \DeclareFloatingEnvironment}
+\@onlypreamble\DeclareCaptionType
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ForEachType}
+% \changes{v1.4a}{2011/10/29}{This macro added}
+% |\caption@ForEachType|\marg{code}
+% will execute the given code for all (known) floating environments.
+% \begin{macrocode}
+\newcommand\caption@ForEachType[1]{%
+ \caption@ifundefined\ForEachFloatingEnvironment
+ {\def\@elt##1{#1}%
+ \caption@ifundefined\c@figure\@gobble\@elt{figure}%
+ \caption@ifundefined\c@table\@gobble\@elt{table}%
+ \let\@elt\relax
+ \newfloat@addtohook{#1}}%
+ {\ForEachFloatingEnvironment{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand\newfloat@addtohook[1]{%
+ \toks@=\expandafter{\newfloat@hook{##1}#1}%
+ \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%
+ \@tempa}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\newfloat@hook[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionSubType}
+% \changes{v1.2}{2007/11/16}{This macro added}
+% \changes{v1.2a}{2008/03/11}{Bugfix: \cs{subfigurename} will be defined now}
+% \changes{v1.2d}{2009/10/09}{Bugfix 08-10-01: Usage of \cs{caption@addtoreset} added}
+% \changes{v1.3}{2011/01/01}{\cs{@dottedlofline} will be defined \& used now}
+% \changes{v1.4}{2011/10/09}{Support of the titletoc package added}
+% \changes{v1.5}{2011/12/29}{Usage of \cs{caption@addtoreset} replaced by \cs{@addtoreset}}
+% \changes{v1.5}{2013/01/10}{Bugfix: Definition of autoref string corrected}
+% \changes{v1.6}{2013/06/17}{Bugfix: \cs{c@tocdepth} will be set (locally) now}
+% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\
+% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\par
+% The starred variant provides the numbering format
+% \meta{type}|.|\meta{subtype} while the non-starred variant simply
+% uses \meta{subtype}.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionSubType{%
+ \caption@teststar\caption@declaresubtype\@firstoftwo\@secondoftwo}
+\@onlypreamble\DeclareCaptionSubType
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declaresubtype[1]{%
+ \@testopt{\caption@@declaresubtype{#1}}{alph}}
+\@onlypreamble\caption@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@declaresubtype#1[#2]#3{%
+ \@ifundefined{c@#3}%
+ {\caption@Error{No float type '#3' defined}}%
+% \end{macrocode}
+% \begin{macrocode}
+ {\@ifundefined{c@sub#3}%
+ {\caption@Debug{New subtype `sub#3'}%
+ \newcounter{sub#3}%
+ \@addtoreset{sub#3}{#3}%
+ \@namedef{ext@sub#3}{\csname ext@#3\endcsname}%
+ \caption@declaresublistentry{#3}%
+ \@cons\caption@subtypelist{{#3}}}%
+ {\caption@Debug{Modify caption `sub#3'}}%
+% \end{macrocode}
+% Support of \package{titletoc} package
+% \begin{macrocode}
+ \caption@ifundefined\contentsuse{}{%
+ \contentsuse{sub#3}{\csname ext@sub#3\endcsname}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@namedef{sub#3name}{}%
+ \@namedef{sub#3autorefname}{\csname #3autorefname\endcsname}%
+ #1% is \@firstoftwo in star form, and \@secondoftwo otherwise
+ {\@namedef{p@sub#3}{}%
+ \@namedef{thesub#3}{\csname the#3\endcsname.\@nameuse{#2}{sub#3}}}%
+ {\@namedef{p@sub#3}{\csname the#3\endcsname}%
+ \@namedef{thesub#3}{\@nameuse{#2}{sub#3}}}%
+ \@namedef{theHsub#3}{\csname theH#3\endcsname.\arabic{sub#3}}%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declaresublistentry{%
+ \caption@ifundefined\l@chapter
+ {\caption@@declaresublistentry\l@subsubsection}%
+ {\caption@@declaresublistentry\l@subsection}}
+\@onlypreamble\caption@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@declaresublistentry[2]{%
+ \ifx#1\@undefined
+ \caption@@@declaresublistentry\relax\@dottedtocline\caption@nil{#2}%
+ \else
+ \expandafter\caption@@@declaresublistentry#1{}{}\@dottedtocline\caption@nil{#2}%
+ \fi}
+\@onlypreamble\caption@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@@declaresublistentry#1\@dottedtocline#2\caption@nil#3{%
+ \def\@tempa{#1}%
+% Does \l@(sub)subsection start with \@dottedtocline?
+ \ifx\@tempa\@empty
+% Yes
+ \caption@@@@declaresublistentry{#3}#2\caption@nil
+ \else
+% No
+ \caption@@@@declaresublistentry{#3}@{3.8em}{3.2em}\caption@nil
+ \fi}
+\@onlypreamble\caption@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@@declaresublistentry#1#2#3#4#5\caption@nil{%
+ \expandafter\caption@@@@@declaresublistentry\expandafter
+ {\csname @dotted\csname ext@#1\endcsname line\endcsname}{#1}{#3}{#4}}
+\@onlypreamble\caption@@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@@declaresublistentry[4]{%
+ \@namedef{l@sub#2}{#1{2}{#3}{#4}}%
+ \expandafter\caption@@@@@@declaresublistentry
+ \expandafter#1\expandafter{\csname ext@#2\endcsname depth}}
+\@onlypreamble\caption@@@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@@@declaresublistentry[2]{
+ \ifx#1\relax
+ \def#1##1{%
+ \def\next{\@dottedtocline{##1}}%
+ \@ifundefined{c@#2}{}{%
+ \ifnum ##1>\@nameuse{c@#2}\relax
+ \let\next\@gobblefour
+ \else
+ \c@tocdepth=\@nameuse{c@#2}\relax
+ \fi}%
+ \next}%
+ \fi}
+\@onlypreamble\caption@@@@@@declaresublistentry
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subtypelist}
+% An \cs{@elt}-list containing the subtypes defined
+% with |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% \begin{macrocode}
+\newcommand*\caption@subtypelist{}
+% \end{macrocode}
+% \end{macro}
+%
+% Unfortunately the \class{memoir} document class resets the
+% \texttt{subfigure} resp.~\texttt{subtable} counter at the begin
+% of floating environments, i.e.~at |\@float|.
+% As a side-effect |\Continued|\-|Float| does not work correctly.
+% For that reason we need to introduce macros to save and restore
+% all sub-caption counters here.
+%
+% \begin{macro}{\caption@restorecounters}
+% \changes{v1.5}{2013/05/01}{This macro added}
+% |\caption@restore|\-|counters| restores all counters saved with
+% |\caption@save|\-|counter|.
+% \begin{macrocode}
+\newcommand*\caption@restorecounters{%
+ \caption@restore@counters
+ \global\let\caption@restore@counters\@empty}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@restore@counters{}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@savesubcounters}
+% \changes{v1.5}{2013/05/01}{This macro added}
+% |\caption@save|\-|sub|\-|counters| saves all sub-caption counters,
+% so they can be restored with |\caption@restore|\-|counters| later on.
+% \begin{macrocode}
+\newcommand*\caption@savesubcounters{%
+ \def\@elt##1{\caption@savecounter{sub##1}}%
+ \caption@subtypelist
+ \let\@elt\relax}%
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@savecounter[1]{%
+ \edef\caption@tempa{%
+ \noexpand\l@addto@macro\noexpand\caption@restore@counters
+ {\noexpand\setcounter{#1}{\number\value{#1}}}}%
+ \caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@For}
+% \changes{v1.1a}{2007/09/07}{This macro added}
+% \changes{v1.2}{2007/11/16}{Renamed from \cs{ForFloatingEnvironments} to \cs{caption@For}}
+% |\caption@For|\marg{elt-list}\marg{code with \#1}\\
+% |\caption@For*|\marg{elt-list}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\caption@For{\caption@withoptargs\caption@@For}
+%\@onlypreamble\caption@For
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@For[3]{%
+ \caption@AtBeginDocument#1{%
+ \def\@elt##1{#3}%
+ \@nameuse{caption@#2}%
+ \let\@elt\relax}}%
+%\@onlypreamble\caption@@For
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{subfig package adaptions}
+% \changes{v1.1}{2007/07/07}{Several adaptions to the \package{subfig} package added}
+% \changes{v1.4a}{2011/11/01}{Bugfix 11-11-01: Test for the \package{subfig} package revised}
+%
+% Since the \package{subfig} package is not maintained anymore,
+% we have to make several adaptions to \thispackage~\version{1.1} here.
+% Please note that we only support the version $1.3$ of the \package{subfig} package here.
+% So older versions do not work with this version of \thispackage, and newer
+% versions are expected to be adapted.
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\@tempa{2005/06/28 ver: 1.3 subfig package}%
+ \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa
+ \caption@InfoNoLine{subfig package v1.3 is loaded}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@setfloattype\@gobble
+ \let\@dottedxxxline\sf@NEW@dottedxxxline
+ \let\sf@subfloat\sf@NEW@subfloat
+% \end{macrocode}
+% \begin{macrocode}
+ \fi
+ \let\sf@NEW@dottedxxxline\@undefined
+ \let\sf@NEW@subfloat\@undefined}
+% \end{macrocode}
+%
+% \begin{macro}{\@dottedxxxline}
+% New version of |\@dottedxxxline|
+% \begin{macrocode}
+\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{%
+ \begingroup
+ \caption@setfloattype{#1}%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub#1}%
+ \ifnum #3>\@nameuse{c@#2depth}\else
+ \@dottedtocline{\z@}{#4}{#5}{#6}{#7}%
+ \fi
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sf@subfloat}
+% \changes{v1.4b}{2011/12/29}{Bugfix 11-12-23: Usage of \cs{caption@warmup} added}
+% New version of |\sf@subfloat|
+% \begin{macrocode}
+\def\sf@NEW@subfloat{%
+ \begingroup
+ \@nameuse{caption@warmup}%
+ \caption@setfloattype\@captype
+ \sf@ifpositiontop{%
+ \maincaptiontoptrue
+ }{%
+ \maincaptiontopfalse
+ }%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub\@captype}%
+ \let\sf@oldlabel=\label
+ \let\label=\subfloat@label
+ \ifmaincaptiontop\else
+ \advance\@nameuse{c@\@captype}\@ne
+ \fi
+ \refstepcounter{sub\@captype}%
+ \setcounter{sub\@captype @save}{\value{sub\@captype}}%
+ \@ifnextchar [% %] match left bracket
+ {\sf@@subfloat}%
+ {\sf@@subfloat[\@empty]}}
+% \end{macrocode}
+% \end{macro}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \clearpage
+% \begin{thebibliography}{99}
+% \bibitem{TLC2}
+% Frank Mittelbach and Michel Goossens:\\
+% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\
+% \newblock Addison-Wesley, 2004.
+%
+% \bibitem{Anne}
+% Anne Br\"uggemann-Klein:\\
+% \emph{Einf\"uhrung in die Dokumentverarbeitung},\\
+% B.G. Teubner, Stuttgart, 1989
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/hyperref}%
+% {\emph{Hypertext marks in \LaTeX}},\\
+% November 12, 2007
+%
+% \bibitem{refcount}
+% Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/refcount}%
+% {\emph{The refcount package}},\\
+% 2006/02/20
+%
+% \bibitem{threeparttable}
+% Donald Arseneau:\\
+% \href{http://www.ctan.org/pkg/threeparttable}%
+% {\emph{Three part tables: title, tabular environment, notes}},\\
+% 2003/06/13
+% \end{thebibliography}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.4/caption.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.4/caption.dtx
new file mode 100644
index 00000000000..2c9dc62be3b
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.4/caption.dtx
@@ -0,0 +1,4538 @@
+% \iffalse meta-comment
+%
+% This is file `caption.dtx'.
+%
+% Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files
+% caption.ins, caption.dtx, caption2.dtx, caption3.dtx,
+% bicaption.dtx, ltcaption.dtx, subcaption.dtx,
+% the derived files
+% caption.sty, caption2.sty, caption3.sty,
+% bicaption.sty, ltcaption.sty, subcaption.sty,
+% and the user manuals
+% caption-deu.tex, caption-eng.tex, caption-rus.tex.
+%
+% \fi
+% \CheckSum{2986}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{caption.drv}[2015/09/16 v3.4 Implementation of the caption package]
+\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+\makeatletter % make room for subsections like 2.16.14 in the TOC
+%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
+\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
+\makeatother
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage[debug]{caption}[2013/01/01]
+%
+\DeclareRobustCommand*\eTeX{\texorpdfstring
+ {\leavevmode\hbox{$\varepsilon$}-\TeX}%
+ {e-TeX}}
+\DeclareRobustCommand*\AmS{\texorpdfstring
+ {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
+ {AMS}}
+\DeclareRobustCommand*\KOMAScript{\texorpdfstring
+ {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
+ {KOMA-Script}}
+\DeclareRobustCommand*\NTG{NTG}
+\DeclareRobustCommand*\SmF{SMF}
+%
+\begin{document}
+ \DocInput{caption.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*\purerm[1]{\texorpdfstring{{\upshape\mdseries\rmfamily #1}}{#1}}
+% \newcommand*\puresf[1]{\texorpdfstring{{\upshape\mdseries\sffamily #1}}{#1}}
+% \newcommand*\purett[1]{\texorpdfstring{{\upshape\mdseries\ttfamily #1}}{#1}}
+% \let\class\puresf \let\package\puresf
+% \let\env\purett \let\opt\purett
+%
+% \def\thispackage{the \package{caption} package}
+% \def\Thispackage{The \package{caption} package}
+%
+% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+% \newcommand*\version[2][]{\textit{v#2}}
+%
+% \newcommand*\issue[1]{GitLab~\##1}
+%
+% \GetFileInfo{caption.sty}
+%
+% \title{The Implementation of
+% \texorpdfstring{\thispackage\thanks{%^^A
+% This package has version number \fileversion, last revised \filedate.}}%^^A
+% {the caption package}}
+% \author{Axel Sommerfeldt\\
+% \url{https://gitlab.com/axelsommerfeldt/caption}}
+% \date{\filedate}
+% \maketitle
+%
+% \begin{abstract}
+% \Thispackage\ consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% \Thispackage\ redefines the \LaTeX\ commands
+% |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
+% |\caption@@make|, giving the user the possibility to control the look \& feel
+% of the captions from floating environments like |figure| and |table|.
+% Furthermore it does similar to the caption stuff coming from other packages
+% (like the \package{longtable} or \package{supertabular} package):
+% Mapping the appropriate internal commands (like |\LT@makecaption| or
+% |\ST@caption|) to the ones offered by the \package{caption3} kernel.
+% So you can think of \thispackage\ as a layer package, it
+% simply provides adaptation layers between the caption stuff coming from
+% \LaTeXe\ or packages, and the caption stuff offered by the
+% \package{caption3} kernel.
+% \end{abstract}
+%
+% \section*{User manual}
+%
+% This document is describing the code implementation only.
+% The user documentation can be found in
+% \nopagebreak\begin{quote}
+% \begin{tabular}{ll}
+% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-eng.pdf}%
+% {\texttt{caption-eng.pdf}} & The English documentation \\
+% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-rus.pdf}%
+% {\texttt{caption-rus.pdf}} & The Russian documentation\footnotemark \\
+% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-deu.pdf}%
+% {\texttt{caption-deu.pdf}} & The German documentation \\
+% \end{tabular}
+% \footnotetext{Thanks a lot to Olga Lapko for this translation}
+% \end{quote}
+%
+% \StopEventually{}
+% \clearpage
+% \tableofcontents
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
+%
+% \changes{v1.0}{1994/10/27}{First release}
+% \changes{v1.1}{1994/11/03}{New option \texttt{centerlast}}
+% \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
+% \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
+% \changes{v1.4}{1995/01/30}{New option \texttt{nooneline}}
+% \changes{v1.4b}{1995/04/05}{Bugfix release}
+% \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v3.0d}{2004/11/28}{Split into two packages: \package{caption} \& \package{caption3}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \section{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+%\ProvidesPackage{caption}[2020/07/29 v3.4m Customizing captions (AR)]
+\ProvidesPackage{caption}[2020/09/28 v3.4n Customizing captions (AR)] % Backport of commit 43567491e5b075d661c080bca298f5428f289758 from 2020/09/28
+% \end{macrocode}
+%
+% \section{Loading the kernel}
+%
+% \begin{macrocode}
+\RequirePackage{caption3}[=2020/07/29] % needs v1.13 or newer
+% \end{macrocode}
+%
+% \section{Check against unknown document classes}
+%
+% \begin{macrocode}
+\caption@ifbool{documentclass}{}{%
+ \caption@WarningNoLine{%
+ Unknown document class (or package),\MessageBreak
+ standard defaults will be used}}
+% \end{macrocode}
+%
+% \section{Check against incompatible packages}
+%
+% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
+% \begin{macrocode}
+\@ifpackageloaded{caption2}{%
+ \caption@Error{%
+ You can't use both, the (obsolete) caption2 *and*\MessageBreak
+ the (current) caption package}%
+ \endinput
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{ftcap} package added}
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{nonfloat} package added}
+% \changes{v3.1}{2007/06/18}{Check against incompatible \package{topcapt} package added}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}%
+ \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}%
+ \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}}
+% \end{macrocode}
+% \begin{macro}{\caption@DisablePositionOption}
+% \changes{v3.1g}{2008/03/20}{\texttt{position=b} added}
+% \changes{v3.1h}{2008/03/29}{%
+% Name changed from \cs{caption@IncompatiblePackage} to \cs{caption@DisablePositionOption};
+% disables the `position' option now instead of issuing a warning}
+% |\caption@DisablePositionOption|\marg{package}\par
+% disables the `position' option.
+% \begin{macrocode}
+\newcommand*\caption@DisablePositionOption[1]{%
+ \caption@InfoNoLine{%
+ `#1' package detected; setting `position=b' for compatibility reasons}%
+ \caption@setposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{position}{%
+ \caption@Error{Usage of the `position' option is incompatible\MessageBreak
+ to the `#1' package}}}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@DisablePositionOption
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Declaration of options}
+%
+% \subsection{Miscellaneous options}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{config}[caption]{%
+ \InputIfFileExists{#1.cfg}%
+ {\typeout{*** Local configuration file #1.cfg used ***}}%
+ {\caption@Warning{Configuration file #1.cfg not found}}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@selectlistentry}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% |\caption@selectlistentry|\marg{\purett{heading} or \purett{entry}}
+% \begin{macrocode}
+\newcommand*\caption@selectlistentry[1]{%
+ \caption@ifinlist{#1}{heading}{%
+ \let\caption@iflistheading\@firstoftwo
+ }{\caption@ifinlist{#1}{default,list-entry,entry}{%
+ \let\caption@iflistheading\@secondoftwo
+ }{%
+ \caption@Error{Undefined list-entry selection `#1'}%
+ }}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.3}{2012-03-25}{Option \opt{list-entry} added}
+% \begin{macrocode}
+\DeclareCaptionOption{list-entry}{\caption@selectlistentry{#1}}
+\captionsetup{list-entry=default}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setparboxrestore}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% |\caption@setparboxrestore|\marg{\purett{partial} or \purett{full}}
+% \begin{macrocode}
+\newcommand*\caption@setparboxrestore[1]{%
+ \caption@ifinlist{#1}{full}{%
+ \caption@setfullparboxrestore
+ }{\caption@ifinlist{#1}{default,light,partial}{%
+ \let\caption@parboxrestore\@secondoftwo
+ }{%
+ \caption@Error{Undefined parboxrestore `#1'}%
+ }}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setfullparboxrestore}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% |\caption@setfullparboxrestore|\par
+% This is an abbreviation for |\caption@setparboxrestore{full}|.
+% \begin{macrocode}
+\newcommand*\caption@setfullparboxrestore{%
+ \let\caption@parboxrestore\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.2}{2010/11/07}{Option \opt{parboxrestore} added}
+% \begin{macrocode}
+\DeclareCaptionOption{parboxrestore}{\caption@setparboxrestore{#1}}
+\captionsetup{parboxrestore=default}
+% \end{macrocode}
+%
+% \changes{v3.1f}{2007/11/28}{Option \opt{@minipage=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{@minipage}{%
+ \caption@ifinlist{#1}{auto,default}%
+ {\let\caption@if@minipage\@gobbletwo}%
+ {\caption@set@bool\caption@if@minipage{#1}}}
+\captionsetup{@minipage=default}
+% \end{macrocode}
+%
+% \subsection{caption v1.x compatibility options}
+% \changes{v3.1}{2007/07/21}{Option `compatibility' added}
+% \changes{v3.1}{2007/09/01}{caption v1.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v1.x$ compatibility options}
+%
+% Currently we support |v1| and |v3| as values for the |compatibility=| option.
+% But since this used to be a boolean option is the past we still support any boolean value
+% for compatibility reasons.
+%
+% \begin{macrocode}
+\DeclareCaptionOption{compatibility}[v1]{%
+ \caption@ifinlist{#1}{v1,1,true,yes,on}{%
+ \let\caption@ifcompatibility\@firstoftwo
+ }{\caption@ifinlist{#1}{v3,3,0,false,no,off}{%
+ \let\caption@ifcompatibility\@secondoftwo
+ }{%
+ \caption@Error{Undefined compatibility value `#1'}%
+ }}}
+\@onlypreamble@key{caption}{compatibility}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@setbool{compatibility}{0} % default: Try not to be compatible to v1.x
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setincompatible}
+% \changes{v3.4}{2019/09/09}{This macro added}
+% |\caption@setincompatible|\marg{condition}\marg{message text}
+% \begin{macrocode}
+\newcommand*\caption@setincompatible[2]{%
+ #1{%
+ \caption@WarningNoLine{%
+ #2;\MessageBreak
+ Setting compatibility to v1}%
+ \caption@setbool{compatibility}{1}%
+ }{}}
+% \end{macrocode}
+% \end{macro}
+%
+% Check against incompatible packages which used to work fine with v1 of the `caption' package.
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@ifcompatibility{}{%
+% \end{macrocode}
+% The usage of the (now obsolete) \package{captcont} package,
+% which brings its own definition of |\caption*|, was quite common in the old days.
+% \begin{macrocode}
+ \caption@setincompatible{\@ifpackageloaded{captcont}}{captcont package is loaded}%
+% \end{macrocode}
+% To be continued\ldots
+% \begin{macrocode}
+}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{normal}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{isu}{%
+ \caption@setformat{hang}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{hang}{%
+ \caption@setformat{hang}%
+ \caption@setjustification{justified}}
+\DeclareCaptionOptionNoValue*{center}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centering}}
+\DeclareCaptionOptionNoValue*{centerlast}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{centerlast}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}}
+\DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}}
+\DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}}
+\DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}}
+\DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}}
+\DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{up}{\l@addto@macro\captionlabelfont\upshape}
+\DeclareCaptionOptionNoValue*{it}{\l@addto@macro\captionlabelfont\itshape}
+\DeclareCaptionOptionNoValue*{sl}{\l@addto@macro\captionlabelfont\slshape}
+\DeclareCaptionOptionNoValue*{sc}{\l@addto@macro\captionlabelfont\scshape}
+\DeclareCaptionOptionNoValue*{md}{\l@addto@macro\captionlabelfont\mdseries}
+\DeclareCaptionOptionNoValue*{bf}{\l@addto@macro\captionlabelfont\bfseries}
+\DeclareCaptionOptionNoValue*{rm}{\l@addto@macro\captionlabelfont\rmfamily}
+\DeclareCaptionOptionNoValue*{sf}{\l@addto@macro\captionlabelfont\sffamily}
+\DeclareCaptionOptionNoValue*{tt}{\l@addto@macro\captionlabelfont\ttfamily}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{nooneline}{\caption@setbool{slc}{0}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\caption@setbool{ruled}{0}
+\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}}
+% \end{macrocode}
+%
+% \subsection{caption2 v2.x compatibility options}
+% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
+% \changes{v3.1}{2007/09/01}{caption2 v2.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v2.x$ compatibility options}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{flushleft}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{raggedright}}
+\DeclareCaptionOptionNoValue*{flushright}{%
+ \caption@setformat{plain}%
+ \caption@setjustification{raggedleft}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{oneline}{\caption@setbool{slc}{1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{%
+ \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}}
+% \end{macrocode}
+%
+% \subsection{Obsolete caption v3.0 options}
+% \changes{v3.1}{2007/05/07}{Package option \opt{caption} marked as obsolete,
+% gives error now}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{caption}{%
+ \caption@setbool{temp}{#1}%
+ \caption@ifbool{temp}{}{%
+ \caption@Error{%
+ The package option `caption=#1' is obsolete.\MessageBreak
+ Please pass this option to the subfig package instead\MessageBreak
+ and do *not* load the caption package anymore}}}
+% \end{macrocode}
+%
+% \subsection{fltpage package support options}
+%
+% \changes{v3.1}{2007/09/01}{Options `FPlist' \& `FPref' added}
+% With these options is controlled where the list-of entry and |\ref| resp.
+% |\pageref| or |\autoref| will link to.
+% Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent,
+% but compatible to the usual behaviour of the \package{fltpage} package.
+% \begin{macrocode}
+\DeclareCaptionOption{FPlist}[1]{\caption@setFPoption{list}{#1}}
+\DeclareCaptionOption{FPref}[1]{\caption@setFPoption{ref}{#1}}
+\@onlypreamble@key{caption}{FPlist}
+\@onlypreamble@key{caption}{FPref}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setFPoption[2]{%
+ \edef\caption@tempa{\@car#2\@nil}%
+ \caption@setbool{FP#1cap}{\if c\caption@tempa 1\else 0\fi}}
+\@onlypreamble\caption@setFPoption
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{FPlist=caption,FPref=figure}
+% \end{macrocode}
+%
+% \subsection{hyperref package support options}
+%
+% \changes{v3.1}{2007/06/21}{Options `hypcap' \& `hypcapspace' added}
+% With |hypcap=off| one can turn the \package{hypcap} support off
+% (default is |on|).
+% \begin{macrocode}
+\DeclareCaptionOption{hypcap}[1]{\caption@setbool{hypcap}{#1}}
+\DeclareCaptionOption{hypcapspace}{\def\caption@hypcapspace{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{hypcap=1,hypcapspace=.5\baselineskip}
+% \end{macrocode}
+%
+% \section{\AmS{} \& \SmF{} document classes support}
+% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ document classes support added}
+%
+% \begin{macrocode}
+\caption@ifclassloaded{ams}{%
+ \caption@InfoNoLine{AMS or SMF document class}%
+% \end{macrocode}
+% \begin{macrocode}
+ \setlength\belowcaptionskip{0pt}% set to 12pt by AMS class
+% \end{macrocode}
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \section{\KOMAScript{} document classes support}
+% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added}
+% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added}
+% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added}
+% \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised}
+% \changes{v3.1}{2007/03/17}{\KOMAScript\ compatibility options removed}
+% \changes{v3.1}{2007/04/05}{\KOMAScript\ compatibility revised \& enhanced}
+%
+% \begin{macrocode}
+\caption@ifclassloaded{koma}{%
+ \caption@InfoNoLine{KOMA-Script document class}%
+% \end{macrocode}
+%
+% Here we emulate the caption related commands and take over the caption
+% related settings from the \KOMAScript\ classes.
+%
+% \begin{macro}{\@tablecaptionabovetrue}
+% \begin{macro}{\@tablecaptionabovefalse}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \begin{macrocode}
+ \g@addto@macro\@tablecaptionabovetrue{\captionsetup*[table]{position=t}}
+ \g@addto@macro\@tablecaptionabovefalse{\captionsetup*[table]{position=b}}
+% \end{macrocode}
+% \begin{macrocode}
+ \if@tablecaptionabove
+ \@tablecaptionabovetrue
+ \else
+ \@tablecaptionabovefalse
+ \fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@figurecaptionabovetrue}
+% \begin{macro}{\@figurecaptionabovefalse}
+% \changes{v3.3}{2013/02/15}{Support of \cs{@figurecaptionabovetrue} added}
+% \begin{macrocode}
+ \caption@ifdefined\@figurecaptionabovetrue{%
+% \end{macrocode}
+% \begin{macrocode}
+ \g@addto@macro\@figurecaptionabovetrue{\captionsetup*[figure]{position=t}}
+ \g@addto@macro\@figurecaptionabovefalse{\captionsetup*[figure]{position=b}}
+% \end{macrocode}
+% \begin{macrocode}
+ \if@figurecaptionabove
+ \@figurecaptionabovetrue
+ \else
+ \@figurecaptionabovefalse
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ }{}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\onelinecaptionstrue}
+% \begin{macro}{\onelinecaptionsfalse}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \begin{macrocode}
+ \g@addto@macro\onelinecaptionstrue{\let\caption@ifslc\@firstoftwo}
+ \g@addto@macro\onelinecaptionsfalse{\let\caption@ifslc\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+ \ifonelinecaptions
+ \onelinecaptionstrue
+ \else
+ \onelinecaptionsfalse
+ \fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@captionabovetrue}
+% \begin{macro}{\@captionabovefalse}
+% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21:
+% \cs{let}\cs{caption@setposition}\cs{@gobble} added}
+% \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed}
+% \changes{v3.1}{2007/03/31}{We redefine \cs{captionabovetrue/false} now
+% instead of \cs{captionabove/below}}
+% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
+% \changes{v3.1k}{2009/10/09}{\opt{figureposition} and \opt{tableposition} will issue a warning now}
+% \changes{v3.4}{2019/09/11}{\opt{figureposition} and \opt{tableposition} will now set the position anyway since it could be used by other packages}
+% Please note that these are stronger than the \opt{position} setting, therefore we
+% override the options \opt{figureposition} and \opt{tableposition} to typeout a warning.
+% \begin{macrocode}
+ \g@addto@macro\@captionabovetrue{\let\caption@position\@firstoftwo}
+ \g@addto@macro\@captionabovefalse{\let\caption@position\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{figureposition}{%
+ \caption@WarningNoLine{Option `figureposition=#1' has no effect\MessageBreak
+ when used with a KOMA script document class}%
+ \captionsetup*[figure]{position=#1}}
+ \DeclareCaptionOption{tableposition}{%
+ \caption@WarningNoLine{Option `tableposition=#1' has no effect\MessageBreak
+ when used with a KOMA script document class}%
+ \captionsetup*[table]{position=#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\setcapindent}
+% \begin{macrocode}
+ \let\caption@KOMA@setcapindent\@setcapindent
+ \renewcommand*\@setcapindent[1]{%
+ \caption@KOMA@setcapindent{#1}\caption@setcapindent}
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KOMA@@setcapindent\@@setcapindent
+ \renewcommand*\@@setcapindent[1]{%
+ \caption@KOMA@@setcapindent{#1}\caption@setcapindent}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapindent{%
+ \captionsetup{indent=\ifdim\cap@indent<\z@\z@\else\cap@indent\fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \caption@ifdefined\cap@indent{\caption@setcapindent}{}
+% \end{macrocode}
+%
+% \begin{macro}{\setcapwidth}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% \Note{The optional argument of \cs{setcapwidth} if not supported (yet),
+% so we issue a warning if used.
+% (Since this does not seem to have an negative effect when used
+% by the \texttt{captionbeside} environment, we suppress the warning here.)}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@setcapwidth
+ \csname\string\setcapwidth\endcsname
+ \@namedef{\string\setcapwidth}[#1]#2{%
+ \caption@KOMA@setcapwidth[{#1}]{#2}\caption@setcapwidth{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapwidth[1]{%
+ \ifx\\#1\\\else
+ \caption@ifdefined\cap@margin{%
+ \def\@tempa{captionbeside}%
+ \ifx\@tempa\@currenvir\else\caption@Warning{%
+ Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}%
+ \fi}{}%
+ \fi
+ \captionsetup{width=\cap@width}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \def\caption@tempa{\hsize}%
+ \ifx\caption@tempa\cap@width \else
+ \caption@setcapwidth{?}
+ \fi
+% \end{macrocode}
+%
+% \begin{macro}{\setcapmargin}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@setcapmargin
+ \csname\string\@setcapmargin\endcsname
+ \@namedef{\string\@setcapmargin}[#1]#2{%
+ \caption@KOMA@setcapmargin[{#1}]{#2}\caption@setcapmargin}
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\caption@KOMA@@setcapmargin
+ \csname\string\@@setcapmargin\endcsname
+ \@namedef{\string\@@setcapmargin}[#1]#2{%
+ \caption@KOMA@@setcapmargin[{#1}]{#2}\caption@setcapmargin}
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@setcapmargin{%
+ \begingroup
+ \let\onelinecaptionsfalse\relax
+ \def\@twoside{0}%
+ \def\if@twoside{\def\@twoside{1}\iffalse}%
+ \cap@margin
+ \def\@tempa{\endgroup}%
+ \ifx\cap@left\hfill\else\ifx\cap@right\hfill\else
+ \def\hspace##1##{\@firstofone}%
+ \edef\@tempa{\endgroup
+ \noexpand\captionsetup{%
+ twoside=\@twoside,slc=0,%
+ margin={\cap@left,\cap@right}}}%
+ \fi\fi
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \ifx\cap@margin\relax \else
+ \caption@setcapmargin
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \section{Processing of options}
+%
+% \changes{v3.0m}{2007/03/04}{Verbose option added}
+% \changes{v3.1}{2007/07/02}{Verbose option removed from package}
+%
+% \changes{v3.1}{2007/03/17}{We do not process global options anymore}
+% \begin{macrocode}
+\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}
+\caption@ProcessOptions*{caption}
+% \end{macrocode}
+%
+% \section{\cs{caption}, \cs{@caption}, and \cs{@makecaption}}
+%
+% \begin{macro}{\caption@ifflag}
+% \changes{v3.3}{2011/12/28}{This switch added}
+% \changes{v3.3}{2018/08/08}{Rewritten (and renamed) so a counter is used instead of a switch}
+% Since we support continued floats and sub-figures it's not an easy task
+% to manage the figure (and table) counter. (Especially since previous versions
+% of the caption package has proven that correcting a counter locally is not a good idea.)
+%
+% These three switches hold the
+% current status: |\caption@if|\-|flag{2}| is set if the caption was already
+% typeset (so the counter doesn't need to be incremented for sub-figures),
+% |\caption@if|\-|flag{4}| is set if there is already content which have
+% incremented the counter (so the counter doesn't need to be incremented
+% for the main caption, further sub-figures, and other stuff), and
+% |\caption@if|\-|flag{1}| is set if |\continued|\-|float| was given.
+%
+% In the past three boolean switches were used to store the flags, but since some
+% packages (like the \package{floatrow} and \package{tabu} package) try hard to keep
+% counter changes locally under certain circumstances, it seems a good idea to make
+% these flags a counter value, too.
+% \begin{macrocode}
+\newcounter{caption@flags}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifflag[1]{%
+ \@tempcnta\c@caption@flags
+ \divide\@tempcnta #1\relax
+ \ifodd\@tempcnta
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clrflags}
+% \changes{v3.3}{2018/08/08}{This macro added}
+% \begin{macro}{\caption@clrflag}
+% \changes{v3.3}{2013/04/14}{This macro added}
+% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
+% \begin{macro}{\caption@setflag}
+% \changes{v3.3}{2013/04/14}{This macro added}
+% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
+% Furthermore we introduce the macros \cs{caption@clrflag} and \cs{caption@setflag}
+% for clearing resp.~setting these flags.
+% \begin{macrocode}
+\newcommand*\caption@clrflags{%
+ \setcounter{caption@flags}\z@}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@clrflag[1]{%
+ \caption@ifflag{#1}{\caption@addtoflags{-#1}}{}}
+\newcommand*\caption@setflag[1]{%
+ \caption@ifflag{#1}{}{\caption@addtoflags{#1}}}
+\newcommand*\caption@addtoflags{%
+ \addtocounter{caption@flags}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@caption}
+% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
+% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
+% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% Here comes our definition of |\caption| and |\caption*|.
+% Beside the support of the starred variant this code was adapted to the
+% various packages we support.
+% We are using |\caption@dblarg| instead of |\@dblarg| so |\caption{}|
+% (with an empty arg.) will produce a list-of entry, but |\caption[]{}|
+% won't.
+% \begin{macrocode}
+\def\caption@caption{%
+ \caption@iftype
+ {\caption@checkgrouplevel\@empty\caption
+ \caption@star
+ {\caption@refstepcounter\@captype}%
+ {\caption@dblarg{\@caption\@captype}}}%
+ {\caption@Error{\noexpand\caption outside float}%
+ \caption@gobble}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@star}
+% \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}}
+% \changes{v3.2c}{2011/08/21}{\cs{global} removed}
+% A helper macro which processes the optional |*| after |\caption|.
+% \begin{macrocode}
+\newcommand*\caption@star[2]{%
+ \@ifstar{\caption@startrue#2[]}{#1#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@caption}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% \changes{v3.1f}{2007/11/28}{Bugfix: Handling of \texttt{@minipage} flag added}
+% \changes{v3.1f}{2007/11/28}{Support of option \opt{@minipage} added}
+% \changes{v3.1g}{2008/03/16}{Internal: Uses \cs{caption@prepareanchor} now}
+% \changes{v3.2d}{2011/10/21}{Adapted to the \textsf{memoir} document class}
+% \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved to \cs{caption@prepareanchor}}
+% \changes{v3.3}{2013/01/06}{Adapted to the \textsf{nag} package}
+% As above, our version has been adapted to the packages we support.
+% Additionally our code is nested by |\caption@beginex| \&
+% |\caption@end| instead of |\begingroup| \& |\endgroup|.
+% Furthermore we use |\caption@boxrestore| instead of |\@parboxrestore|
+% so this code also works correctly inside list-based environments
+% like |wide| \& |addmargin|. (This, and the fact that we use
+% |\linewidth| instead of |\hsize| inside |\@makecaption|, solves
+% \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2472}%^^A
+% {\LaTeX\ PR \texttt{latex/2472}}.)
+% \begin{macrocode}
+\long\def\caption@@caption#1[#2]#3{%
+% \end{macrocode}
+% \begin{macrocode}
+ \ifcaption@star \else
+ \caption@prepareanchor{#1}{#2}%
+ \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}%
+ \@nameuse{nag@hascaptiontrue}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \par
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@setfloatcapt{%
+ \caption@boxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \caption@normalsize
+ \ifcaption@star
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \@makecaption{\csname fnum@#1\endcsname}%
+ {\ignorespaces\caption@makeanchor{#3}}\par
+ \caption@if@minipage\@minipagetrue\@minipagefalse}%
+ \caption@end}
+% \end{macrocode}
+% \textsf{memoir} document class stuff:
+% \begin{macrocode}
+\providecommand\M@gettitle[1]{}
+\providecommand\memcaptioninfo[4]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareanchor}
+% \changes{v3.1g}{2008/03/16}{This macro added}
+% \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved from \cs{caption@@caption}}
+% \begin{macrocode}
+\newcommand*\caption@prepareanchor[2]{%
+ \caption@makecurrent{#1}{#2}%
+ \caption@ifhypcap\caption@@start\relax
+ \M@gettitle{#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecaption}
+% \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added}
+% |\@makecaption|\marg{label}\marg{text}\par
+% We do basically the same as the original code (from the standard
+% \LaTeX\ document classes), but take care of the |position=| setting
+% and use |\caption@@make| from the \package{caption} kernel to finally
+% typeset the caption.
+% \begin{macrocode}
+\long\def\caption@makecaption#1#2{%
+ \caption@make@above
+ \caption@@make{#1}{#2}%
+ \caption@make@below}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@make@above}
+% \begin{macro}{\caption@make@below}
+% \changes{v3.3a}{2019/04/02}{This macro added}
+% |\caption@make@above|\\
+% |\caption@make@below|\par
+% Typesets the stuff above resp.~below the caption, depending on |\caption@iftop|.
+% \begin{macrocode}
+\newcommand*\caption@make@above{%
+ \caption@iftop
+ \caption@belowskip
+ {\caption@rule\caption@aboveskip}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@make@below{%
+ \caption@iftop
+ {\caption@aboveskip\caption@rule}%
+ \caption@belowskip}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@aboveskip}
+% \begin{macro}{\caption@belowskip}
+% \changes{v3.3a}{2019/04/02}{This macro added}
+% |\caption@aboveskip|\\
+% |\caption@belowskip|\par
+% Typesets the skip above resp.~below the caption.
+% \begin{macrocode}
+\newcommand*\caption@aboveskip{%
+ \vskip\abovecaptionskip}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@belowskip{%
+ \vskip\belowcaptionskip}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@redefine}
+% \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now}
+% Prior to \version{3.4} we only redefined |\caption| and |\@caption| if the current definitions
+% were well known, so documents written in the old (\package{caption} package \version{1.x}) days
+% (where |\caption| \& |\@caption| were not redefined by us) still compiled fine.
+% This used to make sense when introducing \version{3.0} in the year 2003
+% but is simply overcautious and especially unwanted by the user nowadays.
+% So starting with \version{3.4} we only do not redefine |\caption| and |\@caption| if the
+% `compatibility' option is set to `v1'.
+% \begin{macrocode}
+\newcommand*\caption@redefine{}
+\g@addto@macro\caption@redefine{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifcompatibility{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@InfoNoLine{
+ \noexpand\caption will not be redefined since `compatibility' is set to v1}%
+% \end{macrocode}
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{}%
+% \end{macrocode}
+%
+% |\continuedfloat| is not supported in compatibility mode.
+% \begin{macrocode}
+ \renewcommand*\caption@continuedfloat[1]{%
+ \caption@Error{Not available in compatibility mode}}%
+% \end{macrocode}
+%
+% |\caption@start| is not supported in compatibility mode.
+% \begin{macrocode}
+ \caption@AtBeginDocument*{%
+ \let\caption@start\relax
+ \caption@ifdefined\caption@ORI@capstart{%
+ \caption@Debug{%
+ Restore hypcap definition of \string\capstart\@gobble}%
+ \let\capstart\caption@ORI@capstart}{}%
+ }%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@star}
+% We redefine |\caption@star| here so it does not make any harm.
+% \begin{macrocode}
+ \renewcommand*\caption@star[2]{#1#2}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption}
+% \begin{macro}{\@caption}
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{%
+ \let\caption\caption@caption
+ \let\@caption\caption@@caption}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@redefine
+ \caption@AtBeginDocument*{%
+ \let\caption@ORI@capstart\@undefined}%
+% \end{macrocode}
+%
+% \begin{macro}{\@xfloat}
+% \changes{v3.1}{2007/05/09}{This re-definition added}
+% \changes{v3.1b}{2007/09/22}{Will now be redefined in compatibility mode, too}
+% We redefine |\@xfloat| so inside floating environments our
+% type-specific options will be used, a \package{hyperref}
+% anchor will be set etc.
+% \begin{macrocode}
+ \let\caption@ORI@xfloat\@xfloat
+ \def\@xfloat#1[#2]{%
+ \caption@ORI@xfloat{#1}[#2]%
+ \caption@settype{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% Some packages (like the \package{hyperref} package for example) redefines
+% |\caption| and |\@caption|, too.
+% So we have to use |\AtBeginDocument| here, so we can make sure
+% our definition is the one which will be valid at last.
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@redefine}
+% \end{macrocode}
+%
+% \begin{macro}{\@makecaption}
+% \begin{macrocode}
+\let\@makecaption\caption@makecaption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phantomcaption}
+% \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added}
+% |\phantomcaption|\par
+% Use this one for figures with subcaptions but without main caption.
+% \begin{macrocode}
+\newcommand\phantomcaption{%
+ \caption@iftype
+ {\caption@refstepcounter\@captype}%
+ {\caption@Error{\noexpand\phantomcaption outside float}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \section{\cs{captionof}}
+%
+% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
+% \changes{v3.1}{2007/06/25}{Option \opt{type*=} added}
+% \changes{v3.1f}{2007/11/16}{Option \opt{subtype} \& \opt{subtype*} added}
+% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Option \opt{type=} uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{type}{\setcaptiontype{#1}}%
+ \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOptionNoValue{subtype}{\setcaptionsubtype\relax}%
+ \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \emph{Important Note:}
+% Like |\captionof| the option |type=| should only be used inside a
+% group, box, or environment and does not check if the argument is a valid
+% floating environment or not.
+%
+% \begin{macro}{\setcaptiontype}
+% \changes{v3.2}{2010/10/24}{This macro added}
+% \changes{v3.4e}{2020/01/02}{Check added if the subtype is defined}
+% Like |\captionsetup{type=xxx}|, but also works if \cs{captionsetup} was redefined.
+% \begin{macrocode}
+\newcommand\setcaptiontype{%
+ \caption@boxrestore@mini
+ \caption@settype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionsubtype}
+% \changes{v3.2a}{2011/08/15}{This macro added}
+% Same, but sets the sub-type.
+% \begin{macrocode}
+\newcommand\setcaptionsubtype{%
+ \caption@iftype
+ \caption@setsubtype
+ {\caption@Error{\noexpand\setcaptionsubtype outside float}}}%
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@setsubtype{%
+ \@ifstar
+ {\caption@@settype{sub}*{sub\@captype}}%
+ {\caption@@settype{sub}{sub\@captype}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@settype}
+% \changes{v3.1}{2007/05/09}{This macro added}
+% \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added}
+% \changes{v3.1d}{2007/10/23}{Error message for \cs{caption@checkgrouplevel} revised}
+% \changes{v3.1f}{2007/11/16}{\cs{caption@setsubtype} added}
+% \changes{v3.1f}{2007/12/03}{Crappy \cs{caption@iftypewarning} replaced}
+% \changes{v3.1g}{2008/01/12}{Usage of \cs{ifcaptionsetup@star} added}
+% \changes{v3.2}{2010/10/26}{Error message moved from here to \cs{caption@refstepcounter}}
+% \changes{v3.3}{2011/12/28}{Resetting of \cs{ifcaption@caption} and \cs{ifcaption@subcaption} added}
+% \changes{v3.4e}{2020/01/02}{Checks added to prevent misuse regading subtypes}
+% |\caption@settype*|\marg{type}\par
+% sets |\@captype| and executes the options associated with it
+% (using |\caption@set|\-|options|).
+% Furthermore we check |\current|\-|group|\-|level| (if avail),
+% redefine |\@currentlabel| so a |\label| before |\caption| will result
+% in a hint instead of a wrong reference, and
+% use the macro |\caption@|(|sub|)|type|\-|hook| (which will be used by our
+% \package{float} package support).\par
+% The non-starred version sets a \package{hyperref} anchor additionally
+% (if |hypcap=|\-|true| and the \package{hypcap} package is not loaded).
+% \begin{macrocode}
+\newcommand*\caption@settype{%
+ \caption@clrflags
+ \caption@set@type}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@type{%
+ \caption@@settype{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@settype[1]{%
+ \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@settype[3]{%
+% #1 = "" or "sub"
+% #2 = \@firstoftwo in star form, \@secondoftwo otherwise
+% #3 = <type>, e.g. "figure" or "subfigure"
+ \caption@Debug{#1type=#3}%
+ \@nameuse{caption@check#1type}{#3}%
+ {\caption@checkgrouplevel{#1}{%
+ \captionsetup{#1type#2*\@empty=...}#2{ or
+ \@backslashchar#1captionof}{}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@tempa{#3}%
+ \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else
+ \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi
+ \fi
+ \expandafter\let\csname @#1captype\endcsname\caption@tempa
+% \end{macrocode}
+% \begin{macrocode}
+ \@nameuse{caption@#1typehook}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setoptions{#3}%
+ \ifx\caption@opt\relax
+ \@nameundef{caption@#1type@warning}%
+ \else
+ \@namedef{caption@#1type@warning}{\caption@Warning{%
+ The #1type was already set to
+ `\csname @#1captype\endcsname'\MessageBreak}}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ #2{}{%
+ \let\@currentlabel\caption@undefinedlabel
+% \let\@currentHlabel\@undefined
+ \ifx\caption@x@label\@undefined
+ \let\caption@x@label\label
+ \let\label\caption@xlabel
+ \fi
+ \caption@start}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftype}
+% \changes{v3.1}{2007/04/11}{This macro and its usage added}
+% Since we often need to check if |\@captype| is defined (means: we
+% are inside a floating environment) this helper macro was introduced.
+% \begin{macrocode}
+\newcommand*\caption@iftype{\caption@ifdefined\@captype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checktype}
+% \changes{v3.4g}{2020/01/02}{This macro and its usage added}
+% \changes{v3.4m}{2020/07/29}{Check of \cs{sf@counterlist} from \package{subfig} package added}
+% |\caption@checktype|\marg{type}\marg{code}\par
+% is used by |\caption@settype| and should either expand the code or issue an error
+% if the given type is not a proper type, i.e. it is a sub-type instead (either defined by
+% |\DeclareCaptionSubType| or |\newsubfloat|\cite{subfig}).
+% \begin{macrocode}
+\newcommand*\caption@checktype[1]{%
+ \caption@ifsubtype{#1}\@firstoftwo{\caption@ifin@list\sf@counterlist{#1}}%
+ {\caption@Error{Should not be used with subtype `#1'}%
+ \@gobble}%
+ \@firstofone}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checksubtype}
+% \changes{v3.4g}{2020/01/02}{This macro and its usage added}
+% \changes{v3.4m}{2020/07/29}{Check of \cs{sf@counterlist} from \package{subfig} package added}
+% |\caption@checksubtype|\marg{type}\marg{code}\par
+% is used by |\caption@settype| and should either expand the code or issue an error
+% if the given type is not a proper sub-type, i.e. not defined by |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% Since the |sub|\-|float|\-|row| environment offered by the \package{floatrow} package\cite{floatrow}
+% is using |\caption|\-|setup{sub|\-|type}| even if the sub-type was defined by |\new|\-|sub|\-|float|
+% offered by \package{subfig}\cite{subfig}, we take a more relaxed view of things here and allow
+% those sub-types as well (but not without warning since we do not support this).
+% \begin{macrocode}
+\newcommand*\caption@checksubtype[1]{%
+ \caption@ifsubtype{#1}%
+ \@firstofone
+ {\caption@ifin@list\sf@counterlist{#1}%
+ {\caption@Warning{%
+ \noexpand\setcaptionsubtype without \string\DeclareCaptionSubType.\MessageBreak
+ This is not designed to work; you could try replacing\MessageBreak
+ the `subfig' package with `subcaption' to resolve\MessageBreak
+ this problem which occurred}%
+ \@firstofone}%
+ {\caption@Error{Undefined subtype `#1'}%
+ \@gobble}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checkgrouplevel}
+% \changes{v3.1}{2007/07/15}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)}
+% \changes{v3.3}{2013/04/21}{Uses \cs{caption@ifeTeX} now}
+% Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done
+% inside a group or not -- in the latter case a warning message will
+% be issued. (needs \eTeX)
+% \begin{macrocode}
+\caption@ifeTeX{%
+ \newcommand*\caption@checkgrouplevel[2]{%
+ \@ifundefined{#1caption@grouplevel}{%
+ \caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}%
+ \ifnum\currentgrouplevel>\caption@grouplevel\relax
+ \expandafter\edef\csname #1caption@grouplevel\endcsname{%
+ \the\currentgrouplevel}%
+ \else
+ \caption@Warning{\string#2\MessageBreak outside box or environment}%
+ \fi
+ }{}}%
+}{%
+ \let\caption@checkgrouplevel\@gobbletwo
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@undefinedlabel}
+% \changes{v3.1}{2007/07/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/22}{Contents changed to \texttt{??}}
+% \changes{v3.1i}{2008/04/13}{Contents changed to \cs{caption@xref}(\ldots)}
+% \changes{v3.1k}{2009/03/30}{Bugfix 08-12-08: \cs{caption@xref} is robust now}
+% \changes{v3.2c}{2011/09/13}{Text changed from `before' to `without proper'}
+% \changes{v3.3}{2016/02/21}{Text changed from `without proper \cs{caption}' to `without proper reference'}
+% This label will be used for |\currentlabel| inside (floating) environments
+% as default. (see above)
+% \iffalse\Note{All commands used have to be robust here.}\fi
+% \begin{macrocode}
+\newcommand*\caption@undefinedlabel{%
+ \protect\caption@xref{\caption@labelname}{\on@line}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareRobustCommand*\caption@xref[2]{%
+ \caption@WarningNoLine{\noexpand\label without proper reference#2}%
+ \@setref\relax\@undefined{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@labelname{??}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@xlabel}
+% \changes{v3.1b}{2007/09/22}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/11}{Revised}
+% \changes{v3.1i}{2008/04/13}{Bugfix: \cs{pageref} should always work now}
+% \changes{v3.2c}{2011/08/19}{Works with optional arguments now, too}
+% The new code of |\label| inside floating environments.
+% |\label| will be redefined using |\caption@withoptargs|, so
+% |#1| are the optional arguments (if any), and
+% |#2| is the mandatory argument here.
+% \begin{macrocode}
+\newcommand*\caption@xlabel{%
+ \caption@withoptargs\caption@@xlabel}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@xlabel[2]{%
+ \caption@@@xlabel
+ \def\caption@labelname{#2}%
+ \caption@x@label#1{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@xlabel{%
+ \global\let\caption@@@xlabel\@empty
+ \@bsphack
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@xref[2]{%
+ \string\@setref\string\relax\string\@undefined{\string##1}}}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionof}
+% \changes{v3.1}{2007/05/09}{Uses \cs{caption@settype} instead of \cs{def}\cs{@captype}}
+% \changes{v3.1c}{2007/09/22}{Bugfix: Redefinition of \cs{caption@setfloatcapt} removed}
+% \changes{v3.1e}{2007/10/30}{Better compatibility: Will be defined with \cs{AtBeginDocument} now}
+% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
+% |\captionof|\marg{type}\oarg{lst\_entry}\marg{heading}\\
+% |\captionof*|\oarg{lst\_entry}\marg{heading}\par
+% \Note{This will be defined with \cs{AtBeginDocument} so
+% \cs{usepackage}\csmarg{caption,capt-of} will still work.
+% (Compatibility to \version{1.x})}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\captionof{\caption@teststar\caption@of{\caption*}\caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@of[2]{\setcaptiontype*{#2}#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{\cs{captionlistentry}}
+%
+% \begin{macro}{\captionlistentry}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v3.1g}{2008/01/20}{Starred variant added}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% |\captionlistentry|\oarg{float type}\marg{list entry}\\
+% |\captionlistentry*|\oarg{float type}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\captionlistentry{%
+ \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionlistentry[1]{%
+ \@testopt{\caption@listentry{#1}}\@captype}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@listentry#1[#2]#3{%
+ \@bsphack
+ #1{\caption@gettitle{#3}}%
+ {\caption@refstepcounter{#2}%
+ \caption@makecurrent{#2}{#3}}%
+ \caption@addcontentsline{#2}{#3}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{\cs{captionbox}}
+%
+% \begin{macro}{\captionbox}
+% \changes{v3.2}{2010/12/17}{This macro added}
+% \changes{v3.2a}{2011/08/16}{\cs{captionsetup} replaces with \cs{captionbox@settype} and \cs{caption@setposition}}
+% \changes{v3.3}{2012/04/09}{Adapted to revised version of \cs{caption@withoptargs}}
+% \changes{v3.3}{2017/03/19}{When used with fixed witdh the content will not be hboxed anymore}
+% \changes{v3.3c}{2019/09/01}{Adapted so it could be used by \cs{subfloat} offered by \package{subcaption}}
+% \changes{v3.4l}{2020/07/29}{\cs{captionbox@hj@default} renamed to \cs{captionbox@innerpos@default}}
+% A |\parbox| with contents and caption, separated by an invisible |\hrule|.
+% \begin{macrocode}
+\newcommand*\captionbox{%
+ \caption@withoptargs{\caption@ibox\@gobble}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@ibox[3]{%
+ \kernel@ifnextchar[%]
+ {\caption@iibox{#1}{#2}{#3}}%
+ {\caption@iibox@{#1}{#2}{#3}}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iibox#1#2#3[#4]{%
+ \@testopt{\caption@iiibox{#1}{#2}{#3}[{#4}]}\captionbox@innerpos@default}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iibox@#1#2#3#4{%
+ \setbox\@tempboxa\hbox{#4}%
+ \caption@iiibox{#1}{#2}{#3}[\wd\@tempboxa][\captionbox@innerpos@default]{\unhbox\@tempboxa}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iiibox#1{%
+ \caption@iiiibox{#1}\vbox\vtop}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iiiibox#1#2#3#4#5[#6][#7]#8{%
+ \begingroup
+ #1*% set \caption@position
+ \caption@iftop{%
+ \endgroup
+ \parbox[t]{#6}{%
+ #1\relax
+ \caption@setposition t%
+ #2{\caption#4{#5}}%
+ \captionbox@hrule
+ \csname caption@hj@#7\endcsname
+ #8}%
+ }{%
+ \endgroup
+ \parbox[b]{#6}{%
+ #1\relax
+ \caption@setposition b%
+ \csname caption@hj@#7\endcsname
+ #8%
+ \captionbox@hrule
+ #3{\caption#4{#5}}}%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\captionbox@innerpos@default{c}
+\newcommand*\captionbox@hrule{\hrule\@height\z@\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@hj@c{\centering}
+\providecommand*\caption@hj@l{\raggedright}
+\providecommand*\caption@hj@r{\raggedleft}
+\providecommand*\caption@hj@s{}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{\cs{continuedfloat}}
+%
+% \begin{macro}{\continuedfloat}
+% \changes{v3.0i}{2005/11/12}{Optional argument added}
+% \changes{v3.0g}{2005/06/28}{Bugfix: \cs{newcounter} replaced by \cs{newcount}}
+% \changes{v3.1}{2007/07/02}{Format of \package{hyperref} extension changed}
+% \changes{v3.1}{2007/07/07}{\cs{caption@setoptions} added}
+% \changes{v3.1g}{2008/01/29}{Starred variant added}
+% \changes{v3.2f}{2011/12/17}{Undocumented optional argument removed}
+% \changes{v3.3}{2011/12/28}{Uses \cs{ifcaption@ContinuedFloat} now}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@restorecounters} added}
+% \changes{v3.3}{2013/12/16}{Bugfix: Does not use \cs{caption@ContinuedFloat} anymore since this breaks \cs{ContinuedFloat} offered by the \package{subfig} package}
+% \changes{v3.4}{2015/09/16}{Renamed from \cs{ContinuedFloat} to \cs{continuedfloat}}
+% |\continuedfloat|\\
+% |\continuedfloat*|\par
+% This mainly sets the appropriate flag, increments the
+% continuation counter, and executes the given options.
+% Furthermore we set |\caption@reset|\-|continued|\-|float| to |\@gobble| so the
+% continuation counter will not be reset to zero inside |\caption@ref|\-|step|\-|counter|.\par
+% When the \package{hyperref} package is used we have the problem
+% that the usage of |\continued|\-|float| will create duplicate
+% hyper links -- |\@current|\-|Href| will be the same for the main float and
+% the continued ones. So we have to make sure unique labels and references
+% will be created each time. We do this by extending |\the|\-|H|\-|figure| and
+% |\the|\-|H|\-|table|, so for continued floats the scheme
+% \begin{quote}\meta{type}|.|\meta{type \#}|\alph{|\meta{continued \#}|}|\end{quote}
+% will be used instead of
+% \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
+% \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
+% \Note{This does not help if the \package{hyperref} package option
+% \texttt{naturalnames=true} is set.}
+% \begin{macrocode}
+\def\continuedfloat{%
+ \caption@iftype
+ {\caption@continuedfloat\@captype}%
+ {\caption@Error{\noexpand\continuedfloat outside float}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@continuedfloat[1]{%
+ \@ifstar
+ {\caption@@refstepcounter\@captype
+ \caption@@continuedfloat{#1}}%
+ {\caption@continued@float{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@continued@float[1]{%
+ \edef\caption@tempa{#1}%
+ \ifx\caption@tempa\caption@CFtype
+ \caption@restorecounters
+ \caption@@continuedfloat{#1}%
+ \else
+ \caption@Error{Continued `#1' after `\caption@CFtype'}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@continuedfloat{%
+ \caption@setflag1% continued float
+ \caption@@@continuedfloat}
+\newcommand*\caption@@@continuedfloat{%
+ \stepcounter{continuedfloat}%
+ \caption@@@@continuedfloat}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@continuedfloat[1]{%
+ \caption@setoptions{ContinuedFloat}% for compatibility reasons
+ \caption@setoptions{continuedfloat}%
+ \caption@setoptions{continued#1}%
+ \expandafter\l@addto@macro\csname the#1\endcsname\thecontinuedfloat
+ \@ifundefined{theH#1}{}{%
+ \expandafter\l@addto@macro\csname theH#1\endcsname{%
+ \@alph\c@continuedfloat}}%
+ \let\caption@@@@continuedfloat\@gobble}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@CFtype{??}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thecontinuedfloat}
+% \changes{v3.4}{2015/09/16}{Renamed from \cs{theContinuedFloat} to \cs{thecontinuedfloat}}
+% This one is preset to \cs{@empty}, so usually the continuation counter is not
+% included in the caption label or references.
+% \begin{macrocode}
+\newcounter{continuedfloat}
+\let\c@ContinuedFloat\c@continuedfloat % defined for compatibility reasons
+\def\thecontinuedfloat{\theContinuedFloat}
+\let\theContinuedFloat\@empty % defined for compatibility reasons
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@reset@continuedfloat}
+% \changes{v3.2f}{2011/12/17}{Redefinition of \cs{continuedfloat} added}
+% |\caption@reset@continuedfloat|\marg{type}\par
+% If a continuation counter is defined, we reset it.
+% (This one will be called inside |\@caption|.)
+% \begin{macrocode}
+\newcommand*\caption@reset@continuedfloat[1]{%
+ \xdef\caption@CFtype{#1}%
+ \@stpelt{continuedfloat}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ContinuedFloat}
+% For compatibility reasons we still support |\Continued|\-|Float|.
+% \begin{macrocode}
+\def\ContinuedFloat{\continuedfloat} % defined for compatibility reasons
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ContinuedFloat}
+% \changes{v3.0f}{2005/06/11}{This macro added}
+% \changes{v3.3}{2013/12/16}{Bugfix: Revised and defined with \cs{def} instead of \cs{newcommand}}
+% |\caption@ContinuedFloat|\marg{type}\par
+% This one is used by \cs{ContinuedFloat} offered by the \package{subfig} package.
+% \begin{macrocode}
+\def\caption@ContinuedFloat{%
+ \let\caption@reset@continuedfloat\@gobble
+ \caption@@@continuedfloat}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\donemaincaptionfalse}
+% Since the \class{memoir} document class resets the sub-caption
+% counter at |\@float|, right after |\done|\-|main|\-|caption|\-|false|,
+% we save all sub-caption counters at |\done|\-|main|\-|caption|\-|false|
+% so we can restore them using |\caption@restore|\-|counters|
+% inside |\continued|\-|float|.
+% \begin{macrocode}
+\caption@ifdefined\donemaincaptionfalse{%
+ \g@addto@macro\donemaincaptionfalse\caption@savesubcounters}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Internal helpers}
+%
+% \begin{macro}{\caption@refstepcounter}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% \changes{v3.2}{2010/10/26}{Error message moved from \cs{caption@@@settype} to here}
+% \changes{v3.2c}{2011/09/04}{Support of \cs{donemaincaptiontrue} from \textsf{memoir} document class added}
+% \changes{v3.3}{2011/12/28}{Usage of \cs{ifcaption@caption}, \cs{ifcaption@subcaption}, and \cs{ifcaption@ContinuedFloat} added}
+% Increments the float (i.e. |figure| or |table|) counter,
+% resets the continuation counter, and redefines itself to |\@gobble|.
+% \begin{macrocode}
+\newcommand*\caption@refstepcounter[1]{%
+ \@ifundefined{c@#1}%
+ {\caption@Error{No float type '#1' defined}}%
+ {\caption@ref@stepcounter{#1}%
+% \end{macrocode}
+% Set flag if this part of the figure (or table) contains a caption now.
+% (If |\caption@if|\-|top| is not set, |\caption| is at the bottom of this part,
+% therefore ending this part, so we set the flag to |false| in this case.)
+% \begin{macrocode}
+ \caption@fixposition
+ \caption@iftop\caption@setflag\caption@clrflag2% caption
+% \end{macrocode}
+% This part does not contain content (like sub-figures) yet,
+% so we set |\if|\-|caption@sub|\-|caption| to |false|.
+% \begin{macrocode}
+ \caption@clrflag4% subcaption
+% \end{macrocode}
+% Support of the \textsf{memoir} document class.
+% \begin{macrocode}
+ \@nameuse{donemaincaptiontrue}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ref@stepcounter{%
+ \caption@ifflag1{% continued float
+ \let\caption@tempa\caption@@refcounter
+ \caption@clrflag1% continued float
+ }{%
+ \let\caption@tempa\caption@@refstepcounter
+ \caption@ifflag2{}{% caption
+ \caption@ifflag4{% subcaption
+% Counter was already incremented by content, so we suppress \stepcounter{#1} here
+ \let\caption@tempa\caption@@refcounter
+ }{}%
+ }%
+ }%
+ \caption@tempa}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@refcounter[1]{%
+ \let\caption@stepcounter@ORI\stepcounter
+ \def\stepcounter##1{%
+ \edef\caption@tempa{#1}% Backport of commit 43567491e5b075d661c080bca298f5428f289758 from 2020/09/28: \def -> \edef
+ \edef\caption@tempb{##1}% Backport of commit 43567491e5b075d661c080bca298f5428f289758 from 2020/09/28: \def -> \edef
+ \ifx\caption@tempa\caption@tempb \else
+ \caption@stepcounter@ORI{##1}%
+ \fi}%
+ \caption@@@refstepcounter{#1}%
+ \let\stepcounter\caption@stepcounter@ORI}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@refstepcounter[1]{%
+ \caption@prepare@stepcounter{#1}{ref}%
+ \caption@@@refstepcounter{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@stepcounter[1]{%
+ \caption@prepare@stepcounter{#1}{}%
+ \caption@@@stepcounter{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@prepare@stepcounter[2]{%
+ \caption@addsubcontentslines{#2stepcounter}%
+ \caption@reset@continuedfloat{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@refstepcounter{\refstepcounter}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@stepcounter{\stepcounter}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@dblarg}
+% \changes{v3.1}{2007/02/05}{This macro added}
+% \changes{v3.1f}{2007/12/06}{Bugfix 07-12-06: Changed so it works without \cs{kernel@ifnextchar}
+% (which was introduced in \LaTeXe\ 2004/01/23), too}
+% \changes{v3.3}{2012/03/25}{Support of option \opt{list-entry} added}
+% A |\relax| was added compared to |\@dblarg| so |\caption{}| will be
+% expanded to |\caption[\relax]{}| (and not to |\caption[]{}|).
+% Furthermore support for option \opt{list-entry} was added.
+% \begin{macrocode}
+\@ifundefined{kernel@ifnextchar}{\let\kernel@ifnextchar\@ifnextchar}{}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@dblarg[1]{%
+ \kernel@ifnextchar[{\caption@ydblarg{#1}}{\caption@xdblarg{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@xdblarg[2]{%
+ #1[{#2\relax}]{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@ydblarg#1[#2]#3{%
+ \caption@iflistheading{#1[{#3}]{#3}}{#1[{#2}]{#3}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@begin}
+% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed to \cs{caption@setfloattype}}
+% \changes{v3.0e}{2005/04/12}{Check for default label format added}
+% \changes{v3.0f}{2005/06/11}{Usage of \cs{caption@resetContinuedFloat} added}
+% \changes{v3.1}{2007/05/09}{Usage of \cs{caption@setfloattype} \& \cs{caption@resetContinuedFloat} removed}
+% \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} removed}
+% Our handling of |\caption| will always be surrounded by
+% |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
+% |\caption@begin|\marg{type} performs these tasks:
+% \begin{enumerate}
+% \item[1.] Override the |position=| setting, if necessary.
+% (for example if set to |auto| or used inside a |supertabular|)
+% \item[2.] Start a new group.
+% \item[3.] Define |\fnum@|\meta{type} if the caption label format is set
+% to non-default.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand*\caption@begin[1]{%
+ \caption@fixposition
+ \begingroup
+ \caption@setfnum{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@beginex}
+% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
+% \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
+% \changes{v3.1}{2007/07/01}{Makes lst-entry now instead of redefining \cs{addcontentsline}}
+% \changes{v3.2}{2010/10/26}{Bugfix 09-05-15: Setting of \cs{lst@@caption} added}
+% |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par
+% performs the same tasks as |\caption@begin| and additionally:
+% \begin{enumerate}
+% \item[4.] Set |\lst@@caption|, so |\fnum@lstlisting| will include a numbering.
+% \item[5.] Make an entry in the list-of-whatever.
+% \item[6.] Set |\caption@ifempty| according argument \meta{heading}.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand\caption@beginex[3]{%
+ \caption@begin{#1}%
+ \let\lst@@caption\relax
+ \caption@addcontentsline{#1}{#2}%
+ \caption@ifempty{#3}{}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@end}
+% \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} removed}
+% |\caption@end| closes the group.
+% \begin{macrocode}
+\newcommand*\caption@end{%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0a}{2004/01/23}{%
+% Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
+% \changes{v3.0h}{2005/10/06}{%
+% Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
+%
+% \begin{macro}{\caption@setfnum}
+% \changes{v3.1}{2007/03/10}{This macro added}
+% |\caption@setfnum|\marg{type}\\
+% redefines |\fnum@|\meta{type} according the caption label format
+% set with |labelformat=|. But if |labelformat=default| is set,
+% |\fnum@|\meta{type} will not be overwritten by us.
+% \begin{macrocode}
+\newcommand*\caption@setfnum[1]{%
+ \@ifundefined{fnum@#1}{\iftrue}{\ifx\caption@lfmt\caption@lfmt@default\else}%
+ \@namedef{fnum@#1}{\caption@fnum{#1}}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@boxrestore}
+% \changes{v3.1}{2007/03/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added}
+% \changes{v3.2}{2010/11/07}{Support of option \opt{parboxrestore} added}
+% The original code (from |latex/base/ltboxes.dtx|):
+% \begin{verbatim}
+% \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}
+% \def\@arrayparboxrestore{%
+% \let\if@nobreak\iffalse
+% \let\if@noskipsec\iffalse
+% \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+% \parindent\z@ \parskip\z@skip
+% \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+% \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+% \parfillskip\@flushglue \lineskip\normallineskip
+% \baselineskip\normalbaselineskip
+% \sloppy}
+% \end{verbatim}%^^A
+% This one will be used by |\@caption| instead of |\@parboxrestore|.
+% \begin{macrocode}
+\newcommand*\caption@boxrestore{%
+ \caption@parboxrestore{\@parboxrestore}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parindent\z@ \parskip\z@skip
+ \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+ \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+ \parfillskip\@flushglue \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \sloppy
+ \let\\\@normalcr
+ }}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@boxrestore@mini}
+% \changes{v3.2}{2010/10/24}{This macro added}
+% Resets \cs{par} so the very first \cs{par} in \cs{@caption} behaves quite the same as in floating environments.
+% Will be used by \cs{setcaptiontype}.
+% \begin{macrocode}
+\newcommand\caption@boxrestore@mini{%
+ \let\par\@@par
+ \parindent\z@ \parskip\z@skip
+ \sloppy}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@normalsize}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This one will be used by |\@caption| instead of |\normalsize|.\par
+% Its code is equivalent to
+% \begin{quote}
+% |\caption@font{normal}%|
+% \end{quote}
+% but executes faster (since the starred form of |\caption@font|
+% does not use |\setkeys| internally).
+% \begin{macrocode}
+\newcommand*\caption@normalsize{%
+ \caption@font*{\KV@caption@fnt@normal\@unused}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setfloatcapt}
+% Needed for support of the \package{float} package, where the caption will
+% not be typeset directly, but catched in a |\vbox| called |\@floatcapt|
+% instead.
+% \begin{macrocode}
+\let\caption@setfloatcapt\@firstofone
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% This one is needed for support of the \package{nameref} and \package{hyperref} package.
+% \changes{v3.2f}{2012/01/14}{Bugfix: Usage of \cs{caption@gettitle} added}
+% \begin{macrocode}
+\newcommand*\caption@makecurrent[1]{\caption@gettitle}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makeanchor}
+% \begin{macro}{\caption@start}
+% \begin{macro}{\caption@@start}
+% \begin{macro}{\caption@freezeHref}
+% \begin{macro}{\caption@defrostHref}
+% All these are needed for support of the \package{hyperref} package.
+% \begin{macrocode}
+\let\caption@makeanchor\@firstofone
+\let\caption@start\relax
+\let\caption@@start\relax
+\let\caption@freezeHref\relax
+\let\caption@defrostHref\relax
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@gettitle}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This one is needed for support of the \package{nameref} package.
+% \begin{macrocode}
+\newcommand\caption@gettitle[1]{%
+ \caption@ifdefined\NR@gettitle
+ {\NR@gettitle{#1}}%
+ {\def\@currentlabelname{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Support for sub-captions}
+% \changes{v3.1f}{2007/11/16}{Support for sub-captions added}
+%
+% \begin{macro}{\caption@subtypehook}
+% \changes{v3.1g}{2008/03/20}{Redefinition of \cs{caption@setlist} added}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-08-12b: \cs{@makecaption} will now be restored here, too}
+% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
+% \changes{v3.2a}{2011/08/17}{Redefinition of \cs{phantomcaption} added}
+% \changes{v3.2a}{2011/08/17}{Usage of \cs{caption@warmup} added}
+% \changes{v3.2c}{2011/09/30}{Bugfix 11-09-26: Usage of \cs{if@subfloatrow} added}
+% \changes{v3.3}{2011/12/28}{Bugfix 11-12-16: \cs{caption@l@stepcounter} replaced by \cs{stepcounter}}
+% \changes{v3.3}{2012/03/15}{Usage of \cs{caption@setbox} added}
+% \changes{v3.3}{2013/05/01}{Redefinition of \cs{caption@settype} added}
+% \changes{v3.3}{2013/06/17}{Missing redefinition of \cs{captionlistentry} added}
+% \changes{v3.3}{2018/09/06}{Adapted to the \package{chkfloat} package}
+% \changes{v3.4f}{2020/01/03}{Redefinition of \cs{@caption} added since it was redefined by the \env{threeparttable} environment}
+% Hook, will be used inside \cs{caption@setsubtype}.\par
+% (Note: If we are inside an |sub|\-|float|\-|row| environment we have to keep
+% the |\@make|\-|caption| code of the \package{floatrow} package intact.)
+% \begin{macrocode}
+\newcommand*\caption@subtypehook{%
+ \ifx\caption\caption@subcaption \else
+ \caption@warmup
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifflag2{}{% caption
+% no \caption in this part of the (floating) environment yet
+ \let\caption@add@contentsline\caption@addsubcontentsline
+ \let\caption@addsubcontentslines\@gobble
+ \caption@ifflag4{}{% subcaption
+% no \subcaption in this part of the (floating) environment yet
+ \caption@ifflag1{% continued float
+ \caption@clrflag1%
+ }{%
+ \caption@@stepcounter\@captype
+ }%
+ \caption@setflag4% subcaption
+ }%
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \c@continuedfloat=0\relax
+ \let\caption@setfloatcapt\@firstofone
+ \let\caption@chkfloat\@gobbletwo
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setbox{none}%
+ \caption@clearmargin
+ \caption@iflist{}{\let\caption@setlist\@gobble}%
+ \caption@setoptions{sub}%
+ \caption@setoptions{subfloat}% for subfig-package compatibility
+% \end{macrocode}
+% \begin{macrocode}
+% redefine \setcaptiontype
+ \def\caption@settype{\caption@withoptargs\caption@sub@settype}%
+ \def\caption@sub@settype##1##2{%
+ \edef\caption@tempa{##2}%
+ \ifx\caption@tempa\@captype
+%%% \caption@setsubtype##1\relax
+ \else
+ \caption@Error{##2 inside \@subcaptype}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+% redefine \caption
+ \let\caption\caption@subcaption
+ \let\@caption\caption@@caption
+ \let\phantomcaption\caption@subphantom
+ \let\captionlistentry\caption@sublistentry
+% \let\@captype\@subcaptype
+ \let\caption@refstepcounter\caption@@@refstepcounter
+% \end{macrocode}
+% \begin{macrocode}
+% restore \@makecaption
+ \if@subfloatrow
+ \caption@Debug{Keeping \string\@makecaption}%
+ \else
+ \let\@makecaption\caption@makecaption
+ \fi
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\if@subfloatrow}
+% \changes{v3.2c}{2011/09/30}{This macro added}
+% This macro tests if we are inside an |sub|\-|float|\-|row| or |sub|\-|float|\-|row*| environment.
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \caption@ifundefined\@subfloatrowtrue
+ {\newif\if@subfloatrow
+ \caption@ifundefined\subfloatrow{}%
+ {\caption@Debug{Patching subfloatrow environment}%
+ \g@addto@macro\capsubrowsettings{\@subfloatrowtrue}%
+ \g@addto@macro\killfloatstyle{%
+ \ifx\c@FRobj\c@FRsobj\@subfloatrowtrue\fi}}}%
+ {\caption@Debug{\string\if@subfloatrow is already defined}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subcaption}
+% Makes a sub-caption.
+% \begin{macrocode}
+\newcommand*\caption@subcaption{%
+ \caption@checkgrouplevel{sub}\subcaption
+ \caption@star
+ {\caption@refstepcounter\@subcaptype}%
+ {\caption@dblarg{\@caption\@subcaptype}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subphantom}
+% \changes{v3.2a}{2011/08/17}{This macro added}
+% Same as |\phantomcaption|, but for sub-captions.
+% \begin{macrocode}
+\newcommand*\caption@subphantom{%
+ \caption@checkgrouplevel{sub}\phantomsubcaption
+ \caption@refstepcounter\@subcaptype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@sublistentry}
+% \changes{v3.3}{2013/06/17}{This macro added}
+% Same as |\captionlistentry|, but for sub-captions.
+% \begin{macrocode}
+\newcommand*\caption@sublistentry{%
+ \caption@teststar\@subcaptionlistentry\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@subcaptionlistentry[1]{%
+ \@testopt{\caption@listentry{#1}}\@subcaptype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{caption@clearsubcontentslines}
+% Clear pending sub-caption list entries.
+% \begin{macrocode}
+\newcommand*\caption@clearsubcontentslines{%
+ \global\let\caption@subcontentslines\@empty}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@clearsubcontentslines
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addsubcontentsline}
+% \changes{v3.1i}{2008/08/02}{Bugfix 08-07-28:
+% \cs{label}, \cs{index}, and \cs{glossary} are allowed inside the list entry now}
+% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
+% \changes{v3.2c}{2011/08/19}{Uses \cs{caption@gobble} instead of \cs{@gobble} now}
+% \changes{v3.3}{2012/01/15}{Debug message added}
+% \changes{v3.3}{2013/03/10}{A single \cs{protect} replaced by \cs{noexpand}}
+% Add a pending sub-caption list entry.
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentsline[4]{%
+ \caption@Debug{\string\caption@addsubcontentsline{#1}{#2}}%
+ \begingroup
+ \let\label\caption@gobble
+ \let\index\caption@gobble
+ \let\glossary\caption@gobble
+ \protected@edef\@tempa{\endgroup
+ \noexpand\g@addto@macro\noexpand\caption@subcontentslines{%
+ \noexpand\@namedef{the#2}{\csname the#2\endcsname}%
+ \ifx\@currentHref\@undefined \else
+ \noexpand\def\noexpand\@currentHref{\@currentHref}%
+ \fi
+ \noexpand\caption@@@addcontentsline{#1}{#2}{#3}{#4}}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\flushsubcaptionlistentries}
+% \changes{v3.3}{2012/01/15}{Renamed from \cs{caption@addsubcontentslines} to \cs{flushsubcaptionlistentries}}
+% \changes{v3.3}{2013/03/10}{Bugfix: Missing redefinition of \cs{caption@addsubcontentslines} added}
+% Writes pending sub-caption list entries.
+% \begin{macrocode}
+\newcommand*\flushsubcaptionlistentries{%
+ \caption@addsubcontentslines{user}}
+% \end{macrocode}
+% \begin{macrocode}
+\renewcommand*\caption@addsubcontentslines[1]{%
+ \caption@Debug{\string\flushsubcaptionlistentries (#1)}%
+ \begingroup
+ \caption@subcontentslines
+ \endgroup
+ \caption@clearsubcontentslines}
+% \end{macrocode}
+% We need to patch \cs{chapter} otherwise a vertical gap will be inserted into
+% the list prior pending sub-caption list entries.
+% We do this |\At|\-|Begin|\-|Document| so packages like \package{newfloat}
+% will not complain about an unknown document class.
+% \begin{macrocode}
+\AtBeginDocument{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifdefined\chapter{%
+ \let\caption@chapter@ORI\chapter
+ \def\chapter{%
+ \caption@addsubcontentslines{chapter}\caption@chapter@ORI}}{}%
+% \end{macrocode}
+% Same for \cs{appendix}.
+% \begin{macrocode}
+ \caption@ifdefined\appendix{%
+ \let\caption@appendix@ORI\appendix
+ \def\appendix{%
+ \caption@addsubcontentslines{appendix}\caption@appendix@ORI}}{}%
+% \end{macrocode}
+% Flush the list of pending sub-caption list entries at the end of the document.
+% \begin{macrocode}
+ \caption@addsubcontentslines{AtEndDocument}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Document class \& Babel package support}
+%
+% \subsection{The \AmS{} \& \SmF{} classes}
+% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added}
+%
+% \begin{macrocode}
+\caption@ifdefined\smf@makecaption{\let\smf@makecaption\@makecaption}{}
+% \end{macrocode}
+%
+% \subsection{The beamer class}
+% \changes{v3.1}{2007/03/10}{beamer class support added}
+%
+% \begin{macrocode}
+\@ifclassloaded{beamer}{%
+ \caption@InfoNoLine{beamer document class}%
+% \end{macrocode}
+%
+% \begin{macro}{\figure}
+% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
+% \changes{v3.3d}{2019/09/01}{This re-definition for \class{beamer} document class revised}
+% We redefine |figure| so our type-specific options will be used etc.
+% \begin{macrocode}
+ \let\caption@ORI@figure\figure
+ \def\figure{\caption@settype{figure}\caption@ORI@figure}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\table}
+% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
+% \changes{v3.3d}{2019/09/01}{This re-definition for \class{beamer} document class revised}
+% \changes{v3.4a}{2019/10/18}{Bug fixed which was introduced in previous revision}
+% We redefine |table| so our type-specific options will be used etc.
+% \begin{macrocode}
+ \let\caption@ORI@table\table
+ \def\table{\caption@settype{table}\caption@ORI@table}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The \KOMAScript{} classes}
+%
+% \KOMAScript\ contains the code
+% |\AtBeginDocument{\let\scr@caption\caption}|
+% so we need to update |\scr@caption| here, too.
+%
+% \begin{macrocode}
+\caption@ifdefined\scr@caption{%
+ \caption@AtBeginDocument{\let\scr@caption\caption}}{}
+% \end{macrocode}
+%
+% \subsection{The frenchb Babel option}
+% \changes{v3.1}{2006/05/14}{Adaptation to \package{frenchb} added}
+%
+% Suppress
+% ``Package |frenchb.ldf| Warning: The definition of |\@makecaption| has been
+% changed, frenchb will NOT customize it.''
+% (but only if we emulate this customization)
+% \begin{macrocode}
+\@nameuse{caption@frenchb}\@nameundef{caption@frenchb}
+% \end{macrocode}
+%
+% \subsection{The frenchle/pro package}
+% \changes{v3.0h}{2005/10/03}{Adaptation to \package{frenchle/pro} added}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@ifdefined\frenchTeXmods{%
+ \caption@InfoNoLine{frenchle/pro package is loaded}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\captionfont@ORI\captionfont
+ \let\captionlabelfont@ORI\captionlabelfont
+ \let\@makecaption@ORI\@makecaption
+% \end{macrocode}
+
+% If |\GOfrench| is defined as |\relax| all the re-definitions regarding
+% captions have already been done, so we can do our patches immediately.
+% Otherwise we must add our stuff to |\GOfrench|.
+% \begin{macrocode}
+ \caption@ifdefined\GOfrench
+ {\def\caption@tempa{\g@addto@macro\GOfrench}}%
+ {\let\caption@tempa\@firstofone}%
+ \caption@tempa{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \let\captionfont\captionfont@ORI
+ \let\captionfont@ORI\@undefined
+ \let\captionlabelfont\captionlabelfont@ORI
+ \let\captionlabelfont@ORI\@undefined
+ \let\@makecaption\@makecaption@ORI
+ \let\@makecaption@ORI\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\@cnORI}
+% We update the definition of |\@cnORI| so it actually reflects
+% our definition of |\caption|.
+% \begin{macrocode}
+ \let\@cnORI\caption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@tablescaption}
+% The \package{frenchle/pro} package sets |\caption| to |\@tablescaption| at
+% |\begin{table}| for special treatment of footnotes.
+% Therefore we have to patch |\@tablescaption| so |\caption*| will work
+% inside the |table| environment.
+% \begin{macrocode}
+ \let\caption@tcORI\@tablescaption
+ \def\@tablescaption{\caption@star\relax\caption@tcORI}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\f@ffrench}
+% \begin{macro}{\f@tfrench}
+% |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
+% when used in French mode. These contain additional code which typesets
+% the caption separator |\captionseparator| instead of the usual colon.
+% Because this breaks with our |\@makecaption| code we have to remove
+% this additional code here.
+% \begin{macrocode}
+ \let\@eatDP\@undefined
+ \let\caption@tempa\@empty
+ \ifx\f@ffrench\fnum@figure
+ \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
+ \fi
+ \ifx\f@tfrench\fnum@table
+ \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
+ \fi
+ \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
+ \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
+ \caption@tempa
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ }%
+}{}}
+% \end{macrocode}
+%
+% \subsection{The hungarian and magyar Babel option}
+% \changes{v3.2}{2009/03/29}{\package{magyar} package support added}
+% \changes{v3.3}{2018/08/26}{\package{magyar} package support revised}
+%
+% \begin{macrocode}
+\def\caption@tempa#1{%
+ \@ifpackagewith{babel}{#1}{%
+ \caption@InfoNoLine{#1 babel option is loaded}%
+ \expandafter\addto\csname extras#1\endcsname{%
+ % reverse changes made by magyar.ldf
+ \let\@makecaption\caption@makecaption
+ \babel@save\@makecaption
+ \caption@redefine
+ \babel@save\@caption}%
+ }{}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@tempa{hungarian}%
+\caption@tempa{magyar}%
+% \end{macrocode}
+%
+% \section{Package support}
+% \changes{v3.1}{2007/04/11}{Package options `float', `longtable' etc.
+% are not supported anymore, removed}
+%
+% \begin{macro}{\caption@IfPackageLoaded}
+% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added,
+% so no extra check is needed}
+% \changes{v3.1}{2007/07/04}{Re-written \& renamed from \cs{caption@ifpackage}
+% to \cs{caption@IfPackageLoaded}}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% |\caption@IfPackageLoaded|\marg{package}\oarg{version}\marg{true}\marg{false}\par
+% Some kind of combination of |\@ifpackageloaded| and |\@ifpackagelater|.
+% If the \meta{package} is not loaded yet, the check will be (re-)done
+% |\AtBeginDocument|, so the \meta{package} could be loaded later on, too.
+% \begin{macrocode}
+\newcommand\caption@IfPackageLoaded[1]{%
+ \@testopt{\caption@@IfPackageLoaded{#1}}{}}
+\@onlypreamble\caption@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@IfPackageLoaded#1[#2]#3#4{%
+ \@ifpackageloaded{#1}\@firstofone{%
+ \caption@Debug{#1 package is not loaded (yet)\@gobble}%
+ \caption@AtBeginDocument}{%
+ \caption@If@Package@Loaded{#1}[{#2}]{#3}{#4}}}
+\@onlypreamble\caption@@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@If@Package@Loaded#1[#2]{%
+ \@ifpackageloaded{#1}{%
+ \caption@InfoNoLine{#1 package is loaded}%
+ \@ifpackagelater{#1}{#2}\@firstoftwo{%
+ \caption@Error{%
+ For a successful cooperation we need at least version\MessageBreak
+ `#2' of package #1,\MessageBreak
+ but only version\MessageBreak
+ `\csname ver@#1.\@pkgextension\endcsname'\MessageBreak
+ is available}%
+ \@secondoftwo}%
+ }{\@secondoftwo}}
+\@onlypreamble\caption@If@Package@Loaded
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clearmargin}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This macro will be used by some package support stuff where the usual
+% margin setting is not welcome, e.g. in the \package{sidecap} package.
+% \begin{macrocode}
+\newcommand*\caption@clearmargin{%
+ \setcaptionmargin\z@
+ \let\caption@minmargin\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@setbool{needfreeze}{0}
+\caption@AtBeginDocument*{%
+ \caption@ifneedfreeze{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@freezetype}
+% \changes{v3.3}{2013/05/01}{This macro added}
+% |\caption@freezetype|\marg{type}\par
+% Used by the \package{fltpage} \& \package{sidecap} package support.
+% \begin{macrocode}
+ \newcommand*\caption@freezetype[1]{%
+ \caption@settype*{#1}%
+ \captionsetup*[sub]{hypcap=true}% Note: This is just a (q&d) workaround!
+ \caption@freeze}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@freeze}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} \& \cs{@caption} revised for enhanced compatibility}
+% \changes{v3.1c}{2007/10/06}{Bugfix: Made \cs{@caption} long}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1g}{2008/01/29}{Starred variants of \cs{ContinuedFloat} and \cs{captionsetup} added}
+% \changes{v3.2}{2010/10/26}{Bugfix 10-09-01a: Uses \cs{ignorespaces} instead of `space hack' again}
+% \changes{v3.2a}{2011/08/17}{Starred variant of \cs{caption@freeze} removed}
+% \changes{v3.2b}{2011/08/18}{Redefines \cs{caption@setup} instead of \cs{captionsetup} now}
+% \changes{v3.2b}{2011/08/18}{Redefinition of \cs{label} revised}
+% \changes{v3.2c}{2011/08/21}{Revised}
+% \changes{v3.3}{2013/01/06}{Adapted to new switch \cs{caption@caption} etc.}
+% |\caption@freeze|\par
+% Used by the \package{bicaption} package.
+% \begin{macrocode}
+ \newcommand*\caption@freeze{%
+ \let\caption@frozen@continuedfloat\continuedfloat
+ \def\continuedfloat{%
+ \caption@@freeze{\caption@@@@continuedfloat\@captype}%
+ \caption@frozen@continuedfloat}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@setup\caption@setup
+ \def\caption@setup##1{%
+ \caption@@freeze{\caption@setup{##1}}%
+ \caption@frozen@setup{##1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@caption\caption
+ \def\caption{%
+ \def\caption{%
+ \caption@Error{%
+ Only one \noexpand\caption can be placed in this environment}%
+ \caption@gobble}%
+ \@ifstar
+ {\caption@SC@caption*}%
+ {\let\@currentlabel\caption@SClabel
+ \caption@withoptargs\caption@SC@caption}}%
+ \long\def\caption@SC@caption##1##2{%
+ \caption@@freeze{\caption##1{##2}}%
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@label\label
+ \def\label{%
+ \caption@withoptargs\caption@SC@label}%
+ \def\caption@SC@label##1##2{%
+ \ifx\@currentlabel\caption@SClabel
+ \@bsphack
+ \caption@freeze@label{##1}{##2}%
+ \@esphack
+ \else
+ \caption@frozen@label##1{##2}%
+ \fi}%
+ \def\caption@SClabel{\caption@undefinedlabel}%
+ \def\caption@freeze@label##1##2{%
+ \caption@@freeze{\label##1{##2}}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\let\caption@frozen@content\@empty
+ \long\def\caption@@freeze{%
+ \g@addto@macro\caption@frozen@content}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@warmup{%
+ \let\continuedfloat\caption@frozen@continuedfloat
+ \let\caption@setup\caption@frozen@setup
+ \let\caption\caption@frozen@caption
+ \let\label\caption@frozen@label}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepare@defrost}
+% \changes{v3.3}{2013/01/06}{This macro added}
+% Prevent resetting the caption flags
+% \begin{macrocode}
+ \newcommand*\caption@prepare@defrost{%
+ \let\caption@settype\caption@set@type}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrost}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1g}{2008/01/30}{\cs{caption@defrost@setup} added}
+% \changes{v3.2c}{2011/08/21}{Adapted to changes of \cs{caption@freeze}}
+% \changes{v3.2c}{2011/08/21}{\cs{caption@defrost@setup} removed}
+% |\caption@defrost|
+% \begin{macrocode}
+ \newcommand*\caption@defrost{%
+ \ifx\caption@frozen@caption\@undefined
+ \caption@frozen@content
+ \else
+ \caption@Error{Internal Error:\MessageBreak
+ \noexpand\caption@defrost in same group as \string\caption@freeze}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@undefbool{needfreeze}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@warmup}
+% \changes{v3.2a}{2011/08/17}{This macro added}
+% |\caption@warmup|
+% \begin{macrocode}
+\let\caption@warmup\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{The changepage package}
+% \changes{v3.4k}{2020/05/30}{Patch of the \package{changepage} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{changepage}[2008/07/23 memoir-v3.7k]{%
+% \end{macrocode}
+%
+% Both environments, \env{adjustwidth} and \env{adjustwidth*}, are starting a \env{list} \cs{item}.
+% But \cs{hsize} isn't set properly inside a \env{list} item, and therefore \cs{@makecaption}
+% (offered by document classes) doesn't work properly when used inside \env{adjustwidth}.
+% Therefore we try to detect the situation ``Are we inside a adjustwidth environment?''
+% inside \cs{@makecaption} and fix this. (Sigh!)
+%
+% We cannot simply set and test a flag here since our adjustment to \cs{hsize} should
+% not be done within a \cs{parbox} within a adjustwidth environment for example,
+% and therefore we store \cs{hsize} and \cs{linewidth}, and test \cs{hsize} and \cs{linewidth}
+% against the stored values instead. If they are equal we are (hopefully) quite save
+% to assume that we are now inside a plain \env{adjustwidth} environment and therefore need
+% to fix \cs{hsize} before typesetting the caption. (Deep sigh!)
+%
+% \begin{macro}{\caption@adjustwidth@hsize}
+% \begin{macro}{\caption@adjustwidth@linewidth}
+% \begin{macrocode}
+ \newdimen\caption@adjustwidth@hsize
+ \newdimen\caption@adjustwidth@linewidth
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@set@adjustwidth}
+% \changes{v3.4k}{2020/05/30}{This macro and its usage added}
+% Store the values of \cs{hsize} and \cs{linewidth}.
+% \begin{macrocode}
+ \providecommand*\caption@set@adjustwidth{%
+ \caption@adjustwidth@hsize\hsize
+ \caption@adjustwidth@linewidth\linewidth}%
+% \end{macrocode}
+% \begin{macrocode}
+ \providecommand*\caption@patch@changepage[1]{%
+ \expandafter\let\csname caption@#1\expandafter\endcsname\csname #1\endcsname
+ \expandafter\renewcommand\csname #1\endcsname[2]{%
+ \@nameuse{caption@#1}{##1}{##2}%
+ \caption@set@adjustwidth}}%
+ \caption@patch@changepage{adjustwidth}%
+ \caption@patch@changepage{adjustwidth*}%
+ \let\caption@patch@changepage\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@test@adjustwidth}
+% \changes{v3.4k}{2020/05/30}{This macro and its usage added}
+% Test if the values of \cs{hsize} and \cs{linewidth} are identical to
+% the ones stored in the \env{adjustwidth} environment.
+% If yes, set \cs{hsize} to the correct value.
+% \begin{macrocode}
+ \providecommand\caption@test@adjustwidth{%
+ \ifdim\hsize=\caption@adjustwidth@hsize
+ \ifdim\linewidth=\caption@adjustwidth@linewidth
+ \hsize=\linewidth
+ \fi
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \AtBeginCaption{\caption@test@adjustwidth}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+% \end{macrocode}
+%
+% \subsection{The chkfloat package}
+% \changes{v3.3}{2018/09/06}{Support of the \package{chkfloat} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{chkfloat}[2012/08/19 v0.1]{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@chkfloat}
+% \changes{v3.3}{2018/09/06}{This macro added}
+% \begin{macrocode}
+ \caption@ifdefined\chkfloat@addcontentsline{%
+ \renewcommand\caption@chkfloat{\chkfloat@addcontentsline}%
+ }{%
+ \renewcommand\caption@chkfloat[2]{%
+ \caption@ifdefined\chkfloat@page{%
+ \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}%
+ }{}}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+% \end{macrocode}
+%
+% \subsection{The float package}
+% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
+% \iffalse
+% (This is a more straight-ahead implementation, but it only works with v1.3
+% now, so v1.2 is no longer supported. The old code including documentation
+% can be found in caption-30f-050530.zip)
+% \fi
+%
+% The \package{float} package usually do not use the \LaTeX\ kernel command
+% |\@caption| to typeset the caption but |\float@caption| instead.
+% (|\@caption| will only be used if the float is re-styled with
+% |\restylefloat*|.)
+%
+% The main two things |\float@caption| is doing different are:
+% \begin{itemize}
+% \item The caption will be typeset inside a |\savebox| called |\@floatcapt|
+% so it can be placed above or below the float contents afterwards.
+% \item |\@makecaption| will not be used to finally typeset the caption.
+% Instead |\@fs@capt| will be used which definition is part of the float
+% style.
+% (Note that |\@fs@capt| will not typeset any vertical space above or below
+% the caption; instead this space will be typeset by the float style code
+% itself.)
+% \end{itemize}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{%
+ \@ifpackageloaded{floatrow}{%
+ \caption@If@Package@Loaded{floatrow}[2007/08/24 v0.2a]{}{}%
+ }{%
+% \end{macrocode}
+%
+% \begin{macro}{\@float@setevery}
+% \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added
+% to redefinition of \cs{caption@setfloatcapt}}
+% \changes{v3.4b}{2019/12/16}{Usage of \cs{caption@float@setname} added}
+% |\@float@setevery|\marg{float type} is provided by the \package{float}
+% package; it's called every time a floating environment defined with
+% |\newfloat| or |\restylefloat| begins.
+% We use this hook to do some adaptations and to setup the proper caption
+% style (if defined) and additional settings declared with
+% |\captionsetup|\oarg{float style}.
+% \begin{macrocode}
+ \let\caption@ORI@float@setevery\@float@setevery
+ \def\@float@setevery#1{%
+ \float@ifcaption{#1}{%
+% \end{macrocode}
+%
+% First of all we set the caption position to it's proper value by
+% converting |\@fs@iftopcapt| (which is part of a float style and
+% controls where the caption will be typeset, above or below the float
+% contents) to our |position=| setting.
+% Since the spacing above and below the caption will be done by the float
+% style and \emph{not} by us this sounds quite useless. But in fact it isn't,
+% since some packages based on \thispackage\ (like the \package{subfig}
+% package) could have an interest for this information and therefore use the
+% |\caption@iftop| macro we provide in our kernel. Furthermore we need this
+% information for ourself in |\captionof| which uses |\@makecaption| to
+% finally typeset the caption with skips.
+% \begin{macrocode}
+ \caption@setposition{\@fs@iftopcapt t\else b\fi}%
+% \end{macrocode}
+%
+% Afterward we redefine |\caption@setfloatcapt| (which will be used inside
+% |\@caption|) so the caption will be set inside the box |\@floatcapt|,
+% without extra vertical space.
+% \begin{macrocode}
+ \renewcommand\caption@setfloatcapt[1]{%
+ \let\@makecaption\caption@@make
+ \global\setbox\@floatcapt\vbox{%
+ \color@begingroup ##1\color@endgroup}}%
+% \end{macrocode}
+%
+% To allow different caption styles for different float styles we also
+% determine the current float style (e.g. `ruled') and select
+% a caption style (and additional settings) with the same name, if defined.
+% \begin{macrocode}
+ \float@getstyle\float@style{#1}%
+ \caption@setstyle*\float@style
+ \caption@setoptions\float@style
+% \end{macrocode}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@float@setname{#1}%
+ \caption@freezeHref % will be defrosted in \float@makebox
+ \caption@ORI@float@setevery{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@makebox}
+% \changes{v3.3}{2013/01/06}{Corrects wrong load order hyperref-float now}
+% \changes{v3.3}{2013/02/03}{Correction of wrong load order hyperref-float revised}
+% Redefine |\float@makebox| (only if we are not operating in compatibility mode).
+% \begin{macrocode}
+ \caption@AtBeginDocument{\caption@ifcompatibility{}{%
+% \end{macrocode}
+% If it was redefined by the \package{hyperref} package,
+% we need to build on the original definition (and not on the redefined one).
+% \begin{macrocode}
+ \caption@ifdefined\HyOrg@float@makebox
+ {\let\caption@ORI@float@makebox\HyOrg@float@makebox}%
+ {\let\caption@ORI@float@makebox\float@makebox}%
+ \renewcommand\float@makebox[1]{%
+ \caption@ORI@float@makebox{#1\relax \caption@defrostHref}}%
+% \end{macrocode}
+% \begin{macrocode}
+ }}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@float@setname}
+% \changes{v3.1}{2007/07/08}{float package hook added}
+% \changes{v3.4b}{2019/12/16}{Renamed from \cs{caption@typehook} to \cs{caption@float@setname}}
+% \LaTeX\ and almost every other packages use
+% |\|\meta{type}|name|
+% to provide a macro for the type resp.~environment name -- for example
+% the command |\figurename| will usually contain the name of the floating
+% environment |figure|:
+% \begin{quote}
+% |\newcommand\figurename{Figure}|
+% \end{quote}
+% But the \package{float} package doesn't follow this common naming
+% convention:
+% For floats defined with |\newfloat| it uses |\fname@|\meta{type} instead,
+% which breaks with our code (and with |\autoref| and some other things as
+% well).
+% So we have to map the \package{float} package name to the common one here.\par
+% \Note{If the float was not defined with \cs{newfloat} but with
+% \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.}
+% \begin{macrocode}
+ \newcommand*\caption@float@setname[1]{%
+ \expandafter\ifx\csname #1name\endcsname\relax
+ \expandafter\let\csname #1name\expandafter\endcsname
+ \csname fname@#1\endcsname
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
+% \begin{macro}{\fs@plaintop}
+% \begin{macro}{\fs@boxed}
+% Since the float styles |plaintop| and |boxed| don't use |\abovecaptionskip|
+% which could be set with |skip=| (|plaintop| uses |\belowcaptionskip| instead of
+% |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|)
+% we patch the according float style macros here to change this.
+% \begin{macrocode}
+ \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
+ \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\float@getstyle}
+% \changes{v3.1}{2007/06/10}{This macro added}
+% |\float@getstyle|\marg{cmd}\marg{type}\par
+% Determining the float style is not so easy because the only hint
+% provided by the \package{float} package is the macro
+% |\fst@|\meta{float type} which points to the macro which represents the
+% float style. So for example after
+% \begin{quote}
+% |\floatstyle{ruled}|\\
+% |\newfloat{Program}{tbp}{lop}|
+% \end{quote}
+% |\fst@Program| will be defined as
+% \begin{quote}
+% |\def\fst@Program{\fs@ruled}|\quad.
+% \end{quote}\par
+% So here is what we do: We make the first level expansion of
+% |\fst@|\meta{float type} a string so we can gobble the first four tokens
+% (= |\fs@|), so only the the name of the float style is left.\par
+% \emph{TODO:} We need to convert the catcodes here.
+% \begin{macrocode}
+ \providecommand*\float@getstyle[2]{%
+ \edef#1{%
+ \noexpand\expandafter\noexpand\@gobblefour\noexpand\string
+ \expandafter\expandafter\expandafter\noexpand
+ \csname fst@#2\endcsname}%
+ \edef#1{#1}%
+ \caption@Debug{floatstyle{#2} = `#1'}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@ifcaption}
+% \changes{v3.1}{2007/06/23}{This macro added}
+% |\float@ifcaption|\marg{type}\marg{if-clause}\marg{else-clause}\par
+% Here we determine if the user has used |\newfloat| resp.~|\restylefloat|,
+% or |\restylefloat*|.
+% This is quite easy: If |\@float@c@|\meta{captype} is the same as
+% |\float@caption|, the user has used |\newfloat| or |\restylefloat|,
+% otherwise we assume he has used |\restylefloat*|.
+% (This test will fail if some package re-defines |\float@caption|,
+% so we have to assume that there is no one.)
+% \begin{macrocode}
+ \providecommand*\float@ifcaption[1]{%
+ \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}}{%
+ \providecommand*\float@ifcaption[1]{\@secondoftwo}%
+% \clearcaptionsetup{boxed}% used by the floatrow package?
+}
+% \end{macrocode}
+%
+% The skip between `boxed' floats and their caption defaults to |2pt|.
+%
+% \begin{macrocode}
+\captionsetup[boxed]{skip=2pt} % do not issue a warning when not used
+% \end{macrocode}
+%
+% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
+% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
+% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
+% `ruled' with appropriate options. But if the package option |ruled| was
+% specified, we setup some caption parameters to emulate the behavior
+% of \thispackage\ \version{1.x} option |ruled| instead, i.e.,
+% the current caption settings will be used, but without margin and without
+% `single-line-check'.
+% \begin{macrocode}
+\caption@ifbool{ruled}{%
+ \captionsetup[ruled]{margin=0pt,minmargin=0,slc=0}%
+}{%
+ \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
+}
+\caption@undefbool{ruled}
+% \end{macrocode}
+%
+% \subsection{The floatflt package}
+% \changes{v3.1}{2007/06/10}{Support of the \package{floatflt} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{floatflt}[1996/02/27 v1.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\floatingfigure}
+% We patch |\floatingfigure| so |\caption@floatflt| will be used.
+% \begin{macrocode}
+ \let\caption@ORI@floatingfigure\floatingfigure
+ \def\floatingfigure{%
+ \caption@floatflt{figure}%
+ \caption@ORI@floatingfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\floatingtable}
+% Same with |\floatingtable|\ldots
+% \begin{macrocode}
+ \let\caption@ORI@floatingtable\floatingtable
+ \def\floatingtable{%
+ \caption@floatflt{table}%
+% \caption@setautoposition b%
+ \caption@ORI@floatingtable}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@floatflt}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Here we do two things:
+% \begin{enumerate}
+% \item We use |\caption@set|\-|options{|\-|floating|\meta{type}|}| so
+% |\caption|\-|setup[|\-|floating|\meta{type}|]{|\ldots|}| is supported.
+% \item |\line|\-|width| must be set correctly.
+% Usually this is done by |\@par|\-|box|\-|restore| inside |\@caption|,
+% but since we use |\@caption@box|\-|restore| we have to map this to
+% |\@par|\-|box|\-|restore| instead.
+% \end{enumerate}
+% \begin{macrocode}
+ \newcommand*\caption@floatflt[1]{%
+ \caption@settype{#1}%
+ \caption@clearmargin
+ \caption@setfullparboxrestore
+ \caption@setoptions{floating#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The fltpage package}
+% \changes{v3.1}{2007/07/22}{Support of the \package{fltpage} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\FP@positionLabel}
+% \changes{v3.2c}{2011/08/28}{This redefinition added}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@positionLabel}{%
+% FP\@captype-\number\value{FP@\@captype C}-pos}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand\FP@positionLabel{%
+ FP\FP@captype-\number\value{FP@\FP@captype C}-pos}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@helpNote}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@helpNote}[2]{%
+% \typeout{FP#1 is inserted on page \pageref{#2}!}}%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand\FP@helpNote[2]{%
+ \begingroup % save \caption@thepage
+ \caption@pageref{#2}%
+ \typeout{FP#1 is inserted on page \caption@thepage!}%
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatBegin}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-09-11: Missing \cs{ignorespaces} added}
+% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
+% \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatBegin}[1]{%
+% \gdef\@captype{#1}%
+% \global\let\FP@savedCaptionCommand\caption%
+% \global\let\FP@savedLabelCommand\label%
+% \ifthenelse{\equal{\@captype}{figure}}
+% {\global\let\old@Fnum\fnum@figure}%
+% {\global\let\old@Fnum\fnum@table}%
+% \let\FP@LabelText\@empty%
+% \let\FP@CaptionText\@empty%
+% \let\FP@optionalCaptionText\@empty%
+% \renewcommand\label[1]{\gdef\FP@LabelText{##1}}%
+% \renewcommand\caption[2][]{%
+% \gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}%
+% \begin{lrbox}{\FP@floatCorpusBOX}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatBegin[1]{%
+ \def\FP@captype{#1}%
+ \begin{lrbox}{\FP@floatCorpusBOX}%
+ \minipage\hsize % changes from LR mode to vertical mode
+ \caption@freezetype{#1}%
+ \ignorespaces}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatEnd}
+% \changes{v3.1g}{2008/01/30}{Some minor bugfixes}
+% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
+% \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatEnd}{%
+% \end{lrbox}%
+% \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
+% \stepcounter{FP@\@captype C}%
+% \FP@savedLabelCommand{\FP@positionLabel}%
+% \FP@helpNote{\@captype}{\FP@positionLabel}%
+% \FP@float
+% {\FP@positionLabel}% location label test
+% {\begin{\@captype}[p!]
+% \usebox{\FP@floatCorpusBOX}%
+% \refstepcounter{\@captype}%
+% \ifthenelse{\equal{\FP@LabelText}{\@empty}}
+% {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
+% \end{\@captype}}
+% {\addtocounter{\@captype}{-1}}
+% {\begin{\@captype}[b!]%
+% \ifthenelse{\equal{\FP@guide}{\@empty}}%
+% {}{\ifthenelse{\equal{\@captype}{figure}}%
+% {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}%
+% {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}%
+% \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \FP@separatorCaption%
+% \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
+% {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%
+% {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]%
+% {\expandafter\protect\FP@CaptionText}}%
+% \end{\@captype}}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatEnd{%
+ \endminipage
+ \end{lrbox}%
+% \end{macrocode}
+% \begin{macrocode}
+ \stepcounter{FP@\FP@captype C}%
+ \caption@label\FP@positionLabel
+ \FP@helpNote\FP@captype\FP@positionLabel
+% \end{macrocode}
+% \begin{macrocode}
+ \FP@float
+ {\FP@positionLabel}% location label test
+ {\caption@prepare@defrost
+ \begin\FP@captype[p!]%
+ \usebox\FP@floatCorpusBOX
+ \end\FP@captype}%
+ {\@ifundefined{theH\FP@captype}{}{%
+ \expandafter\l@addto@macro\csname theH\FP@captype\endcsname{.FP}}}%
+ {\caption@prepare@defrost
+ \begin\FP@captype[b!]%
+ \let\FP@savedSetfnumCommand\caption@setfnum
+ \def\caption@setfnum##1{%
+ \FP@savedSetfnumCommand{##1}%
+ \ifx\FP@guide\@empty \else
+ \expandafter\l@addto@macro\csname fnum@##1\endcsname{\ {\FP@guide}}%
+ \fi}%
+ \setlength\abovecaptionskip{2pt plus 2pt minus 1pt}% length above caption
+ \setlength\belowcaptionskip{2pt plus 2pt minus 1pt}% length below caption
+ \caption@setoptions{FP\@captype}%
+ \FP@separatorCaption
+ \caption@defrost
+ \end\FP@captype}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\caption@ifFPlistcap\@undefined
+ \let\caption@ifFPrefcap\@undefined
+}
+% \end{macrocode}
+%
+% \subsection{The hyperref package}
+% \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
+% \changes{v3.1}{2007/03/09}{Usage of \cs{hyper@makecurrent} instead of
+% \cs{theHfigure} as indicator for \package{hyperref} package}
+% \changes{v3.2}{2011/07/30}{Test if \package{hyperref} has stopped early revised}
+% \changes{v3.2c}{2011/08/24}{Test if \package{hyperref} has stopped early adapted to current version of \package{hyperref} package: Usage of \cs{IfHyperBoolean} added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{%
+ % Test if hyperref has stopped early
+ \caption@ifundefined\IfHyperBoolean{%
+ \caption@set@bool\caption@ifhyp@stoppedearly0%
+ \caption@ifundefined\H@refstepcounter
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
+ \caption@ifundefined\hyper@makecurrent
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
+ \caption@ifundefined\measuring@true
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{}}}%
+ }{%
+ \def\caption@ifhyp@stoppedearly{\IfHyperBoolean{stoppedearly}}%
+ }%
+ \caption@ifhyp@stoppedearly{% hyperref has stopped early
+ \caption@InfoNoLine{%
+ Hyperref support is turned off\MessageBreak
+ because hyperref has stopped early}%
+ }{%
+ \g@addto@macro\caption@prepareslc{\measuring@true}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@@@refstepcounter}
+% We redefine |\caption@@refstepcounter| so |\H@refstepcounter| will be used
+% instead of |\refstepcounter| inside |\caption| \& |\captionlistentry|.
+% \begin{macrocode}
+ \renewcommand*\caption@@@refstepcounter{\H@refstepcounter}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% We redefine |\caption@makecurrent| so a \package{hyperref} label
+% will be defined inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand*\caption@makecurrent[2]{%
+ \caption@makecurrentHref{#1}%
+ \caption@Debug{hyperref current=\@currentHref}%
+ \caption@gettitle{#2}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@makecurrentHref{\hyper@makecurrent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makeanchor}
+% \changes{v3.1l}{2010/01/09}{Adapted to the current hyperref package}
+% We redefine |\caption@makeanchor| so a \package{hyperref} anchor
+% will be set inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand\caption@makeanchor[1]{%
+ \caption@Debug{hyperref anchor: \@currentHref}%
+ % If we cannot have nesting, the anchor is empty.
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#1}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
+ }#1%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \g@addto@macro\caption@prepareslc{\let\caption@makeanchor\@firstofone}%
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{The hypcap option}
+%
+% \begin{macro}{\if@capstart}
+% Like the \package{hypcap} package we define the switch |\if@capstart|, too.
+% \begin{macrocode}
+ \newif\if@capstart
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@start}
+% \changes{v3.0l}{2007/02/20}{%
+% \cs{caption@currentHref} renamed to \cs{hc@currentHref}}
+% \changes{v3.1}{2007/06/21}{%
+% This macro renamed from \cs{capstart} to \cs{caption@start} and revised}
+% While the \package{hypcap} package defines a macro called |\capstart|
+% our variant is called |\caption@start| and is controlled by the option
+% |hypcap=||false|/|true|.
+% \begin{macrocode}
+ \def\caption@start{\caption@ifhypcap\caption@start@\relax}%
+ \def\caption@start@{%
+% \end{macrocode}
+% Generate the \package{hyperref} label and set the \package{hyperref} anchor,
+% usually (if |hypcap=false|) both is done inside |\@caption|.
+% \begin{macrocode}
+ \caption@makestart\@captype
+ \caption@startanchor\@currentHref
+% \end{macrocode}
+% Prevent |\@caption| from generating a new \package{hyperref} label,
+% use the label we save in |\hc@currentHref| instead.
+% (We also support the |@capstart| flag from the \package{hypcap} package.)
+% \begin{macrocode}
+ \global\@capstarttrue
+ \let\hc@currentHref\@currentHref
+ \def\caption@makecurrentHref##1{%
+ \global\@capstartfalse
+ \global\let\@currentHref\hc@currentHref}%
+% \end{macrocode}
+% Prevent |\@caption| from generating a \package{hyperref} anchor since this
+% has already been done.
+% \begin{macrocode}
+ \let\caption@makeanchor\@firstofone
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makestart}
+% \changes{v3.1c}{2007/09/30}{\cs{@currentHref} will be extended by \texttt{caption}
+% instead of \texttt{xxx} now}
+% |\caption@makestart|\marg{type}
+% defines a \package{hyperref} anchor inside |\caption@start|.\par
+% Since we offer |\continuedfloat| the float counter can change between
+% `now' and |\caption|, i.e., we simply don't know the figure or table counter
+% yet and therefore we are not able to generate the `right' \package{hyperref}
+% label.
+% Two different solutions of this problem came into my mind:
+% \begin{enumerate}
+% \item I could use the aux file for this purpose.\par
+% -or-
+% \item I set |hypertexnames=false| locally.
+% Furthermore I use |#1.caption.|\meta{counter} (instead of |#1.|\meta{counter})
+% as naming scheme for |\@currentHref| to avoid conflicts with other hyper
+% links which are generated with |hypertexnames=true|.
+% \end{enumerate}
+% The first idea has the advantage that the `right' anchor name will be
+% generated, but one needs an additional \LaTeX\ run if figures or tables
+% will be inserted or removed.\par
+% The second idea has the advantage that it's very easy to implement, but
+% has some side-effects, e.g. the anchor names don't follow the figure or
+% table label names anymore.\par
+% Since I'm lazy I implemented the second idea, maybe I will revise this
+% later on.
+% \begin{macrocode}
+ \newcommand*\caption@makestart[1]{%
+ \begingroup
+ \Hy@hypertexnamesfalse
+% \gdef\@currentHlabel{}%
+ \hyper@makecurrent{#1.caption}%
+ \endgroup
+ \caption@Debug{hypcap start=\@currentHref}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@startanchor}
+% \changes{v3.1b}{2007/09/17}{Bugfix 06-09-17: We use \cs{caption@anchor} instead of \cs{hyper@@anchor}}
+% \changes{v3.1g}{2008/03/16}{Warning about TeX mode replaced with debug info}
+% |\caption@startanchor|\marg{Href}
+% sets a \package{hyperref} anchor inside |\caption@start|.\par
+% This code was taken from the \package{hypcap} package\cite{hypcap} and adapted.
+% \Note{Since \cs{hyper@@anchor}\marg{Href}\csmarg{\string\relax} can cause
+% a change from vertical mode to horizontal mode (design flaw in
+% \package{hyperref} package!?), and since the workaround
+% \cs{let}\cs{leavevmode}\cs{relax} which can be found in the
+% \package{hypcap} package is not always sufficient
+% (for example with ``Direct pdfmark support'' and \texttt{breaklinks=true}),
+% we use \cs{caption@anchor} instead of \cs{hyper@@anchor} here.}
+% \begin{macrocode}
+ \newcommand*\caption@startanchor[1]{%
+ \ifvmode\begingroup
+ \caption@Debug{hypcap anchor: #1 (vertical mode)}%
+ \@tempdima\prevdepth
+ \nointerlineskip
+ \vspace*{-\caption@hypcapspace}%
+ \caption@anchor{#1}%
+ \vspace*{\caption@hypcapspace}%
+ \prevdepth\@tempdima
+ \endgroup\else
+ \caption@Debug{hypcap anchor: #1 (horizontal mode)}%
+ \caption@anchor{#1}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@anchor}
+% \changes{v3.1c}{2007/10/17}{Workaround 07-10-17: We use \cs{caption@raisedlink} instead of \cs{Hy@raisedlink} now}
+% |\caption@anchor|\marg{Href} sets a \package{hyperref} anchor.
+% \begin{macrocode}
+ \newcommand*\caption@anchor[1]{%
+ \ifmeasuring@ \else
+ \caption@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}%
+ \fi}%
+% \end{macrocode}
+% \Note{Since \cs{Hy@raisedlink} change \cs{@tempdima} we surrounded it by \cs{ifvmode},
+% suppressing ``\texttt{LaTeX Warning: Float too large for page by 1.0pt}'' in \texttt{sideways} floats.
+% (This is not necessary since \package{hyperref} \version{6.77}.)}
+% \begin{macrocode}
+ \ifx\HyperRaiseLinkLength\@tempdima
+ \def\caption@raisedlink#1{\ifvmode#1\else\Hy@raisedlink{#1}\fi}%
+ \else
+ \let\caption@raisedlink\Hy@raisedlink
+ \fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@start}
+% Will be used by |\caption@freezeHref|. Apart from that we issue a warning
+% if we expect a saved \package{hyperref} label coming from |\caption@start|,
+% but there isn't any.
+% \begin{macrocode}
+ \def\caption@@start{%
+ \caption@ifundefined\hc@currentHref{%
+ \caption@Warning{%
+ The option `hypcap=true' will be ignored for this\MessageBreak
+ particular \string\caption}}{}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@freezeHref}
+% Suppress |\caption@start| from generating a \package{hyperref} label and
+% setting a \package{hyperref} anchor. Instead if |\@caption| generates a
+% \package{hyperref} label, it will be stored in |\caption@currentHref|.
+% Furthermore we need to redefine |\caption@setfloatcapt| so no
+% \package{hyperref} anchor will be placed in |\@caption|.
+% \iffalse
+% (Since |\caption@setfloatcapt| will be set to |\@firstofone| inside
+% |\subcaption| there is no need to add its restauration to
+% |\caption@subtypehook|.)
+% \fi
+% \begin{macrocode}
+ \def\caption@freezeHref{%
+ \let\caption@ORI@start\caption@start
+ \def\caption@start{\let\caption@start\caption@ORI@start}%
+% \end{macrocode}
+% \begin{macrocode}
+% \let\caption@ORI@@start\caption@@start
+% \l@addto@macro\caption@subtypehook{%
+% \let\caption@@start\caption@ORI@@start}%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\let\caption@currentHref\@undefined
+ \def\caption@@start{\global\let\caption@currentHref\@currentHref}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ORI@setfloatcapt\caption@setfloatcapt
+ \renewcommand*\caption@setfloatcapt{%
+ \ifx\caption@currentHref\@undefined \else
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \caption@ORI@setfloatcapt}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrostHref}
+% If there is a freezed |\@currentHref|, we set the \package{hyperref}
+% anchor here.
+% \begin{macrocode}
+ \def\caption@defrostHref{%
+ \ifx\caption@currentHref\@undefined \else
+ \caption@startanchor\caption@currentHref
+ \global\let\caption@currentHref\@undefined
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }}{}
+% \end{macrocode}
+%
+% \subsection{The hypcap package}
+% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
+% \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} \version{1.6}}
+% \changes{v3.1e}{2007/11/04}{\package{hypcap} support adapted to \package{hyperref} \version{6.77}}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hypcap}{% v1.0
+ \ifx\caption@start\relax \else % hyperref hasn't stopped early
+% \end{macrocode}
+%
+% If the \package{hypcap} package was loaded, we give up our own
+% hyperlink placement algorithm and give the control over the placement
+% to the \package{hypcap} package instead.
+%
+% \begin{macro}{\capstart}
+% \changes{v3.1k}{2009/10/09}{Support of \cs{ifcapstart} (\package{hypcap} package \version{1.10}) added}
+% We do this simply by mapping |\capstart| to |\caption@start@|,
+% although our code does not behave exactly like the original one:
+% The original |\capstart| has an effect on the next |\caption|
+% only but our version affects \emph{all} |\caption|s in the same
+% environment, at least unless a new |\capstart| will be placed.
+% \begin{macrocode}
+ \let\caption@ORI@capstart\capstart % save for compatibility mode
+ \caption@ifundefined\capstarttrue % check for v1.10 of hypcap package
+ {\def\capstart{\caption@start@}}%
+ {\def\capstart{\ifcapstart\caption@start@\fi}}%
+ \let\caption@start\relax
+ \let\caption@@start\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@hypcapspace}
+% Furthermore we map our |\caption@hypcapspace| to |\hypcapspace|
+% offered by the \package{hypcap} package.
+% \begin{macrocode}
+ \caption@set@bool\caption@ifhypcap 1%
+ \renewcommand*\caption@hypcapspace{\hypcapspace}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \fi}{}
+% \end{macrocode}
+%
+% \subsection{The listings package}
+% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{%
+% \end{macrocode}
+%
+% \begin{macro}{\lst@MakeCaption}
+% \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now}
+% \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added}
+% \changes{v3.2}{2010/10/26}{Bugfix 10-07-20a: Set \cs{hsize} to \cs{linewidth}, if necessary}
+% \changes{v3.4c}{2020/01/01}{Ugly workaround for usage in lists added}
+% \changes{v3.4d}{2020/01/01}{Ugly workaround for usage in lists revised}
+% To support the \package{listings} package we need to redefine
+% |\lst@Make|\-|Caption| so the original stuff is nested with
+% |\caption@begin| and |\caption@end| etc.\par
+% We set a flag inside the "Init" hook of the \package{listings} package (where adaption of |\line|\-|width| etc.~takes place).
+% \begin{macrocode}
+ \caption@setbool{lst@Init}{0}%
+ \lst@AddToHook{Init}{\caption@setbool{lst@Init}{1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ORI@lst@MakeCaption\lst@MakeCaption
+ \def\lst@MakeCaption#1{% #1 is `t' or `b'
+% \end{macrocode}
+% This macro is always called twice by the \package{listings} package (with `t' resp. `b' as parameter),
+% therefore we need an extra group here.
+% \begin{macrocode}
+ \begingroup
+% \end{macrocode}
+% Inside lists the \package{listings} package ignores the left margin (|\@total|\-|left|\-|margin|) for captions.
+% We emulate this behaviour by adding a negative skip which will be typeset ahead of |\caption@box|.\par
+% Note: We only need to do this if the ``Init'' hook of the \package{listings} package wasn't called yet.
+% \begin{macrocode}
+ \caption@iflst@Init{}{%
+ \edef\caption@lst@leftskip{\noexpand\hskip-\the\@totalleftmargin\noexpand\relax}%
+ \l@addto@macro\caption@beginhook\caption@lst@leftskip}%
+% \end{macrocode}
+% We set |position=#1| and if it was set to `top',
+% we swap the skips so the default behavior of the \package{listings} package
+% will not be changed. (Note that the \package{listings} package has set its
+% own |\abovecaptionskip| \& |\belowcaptionskip| values prior to calling
+% \cs{lst@MakeCaption}.)
+% \begin{macrocode}
+ \caption@setposition{#1}%
+ \caption@iftop{%
+ \@tempdima\belowcaptionskip
+ \belowcaptionskip\abovecaptionskip
+ \abovecaptionskip\@tempdima}{}%
+% \end{macrocode}
+% Workaround for issue with wrong skips (FIXME: This should be examined further)
+% \begin{macrocode}
+ \caption@setup{rule=0}%
+% \end{macrocode}
+% Afterwards we set the local `lstlisting' options.
+% \begin{macrocode}
+ \caption@setoptions{lstlisting}%
+% \end{macrocode}
+% If the |position=| is now set to |auto|, we take over the |captionpos=|
+% setting from the \package{listings} package.
+% \begin{macrocode}
+ \caption@setautoposition{#1}%
+% \end{macrocode}
+% At the end we do similar stuff as in our \cs{@caption} code.
+% \begin{macrocode}
+ \caption@begin{lstlisting}%
+ \caption@ORI@lst@MakeCaption{#1}%
+ \caption@end
+% \end{macrocode}
+% \begin{macrocode}
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lst@makecaption}
+% \begin{macro}{\lst@maketitle}
+% Wrapper macros for typesetting the |caption=| resp. |title=| value.
+% \begin{macrocode}
+ \def\lst@makecaption{\caption@starfalse\@makecaption}%
+ \def\lst@maketitle{\caption@startrue\@makecaption\@empty}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ext@lstlisting}
+% \changes{v3.1}{2007/03/03}{This macro added}
+% Since the \package{listings} package do not define |\ext@lstlisting|
+% but we needed it when |\captionof{lstlisting}| will be done by the end user,
+% we define it here.
+% \begin{macrocode}
+ \providecommand*\ext@lstlisting{lol}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1a}{2007/07/13}{Bugfix 07-09-13: \cs{lst@@caption} will not be re-defined anymore}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The longtable package}
+%
+% \begin{macro}{\LTcaptype}
+% \changes{v3.1}{2007/07/06}{This macro and its support added}
+% |\LTcaptype| is preset to |table|.
+% \begin{macrocode}
+\providecommand*\LTcaptype{table}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{%
+% \end{macrocode}
+% \begin{macrocode}
+ \RequirePackage{ltcaption}[=2018/08/26]%
+ \let\LT@@makecaption\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\LT@array}
+% \changes{v3.1}{2007/07/22}{This redefinition added}
+% \changes{v3.1a}{2007/09/14}{Bugfix 07-09-14: Redefinition of \cs{@captionabovetrue} \& \cs{@captionabovefalse} added}
+% \changes{v3.1a}{2007/09/16}{Bugfix: This redefinition will always be done \cs{AtBeginDocument}}
+% \changes{v3.1g}{2008/01/20}{Bugfix in \cs{captionlistentry}: Table counter will not be incremented anymore, \cs{nameref} works}
+% \changes{v3.3}{2016/01/31}{Support for \cs{bicaption} added}
+% \changes{v3.3}{2018/10/05}{Definition of \cs{captionlistentry} fixed}
+% We redefine |\LT@array| here to get |\captionsetup|\marg{options}
+% working inside |longtable|s.
+% \Note{Since the \package{hyperref} package patches \cs{LT@array} as well
+% and since this only works with the original definition of \cs{LT@array},
+% we have to do this after the \package{hyperref} package,
+% i.e.~\cs{AtBeginDocument}.}
+% \begin{macrocode}
+ \caption@AtBeginDocument{%
+ \let\caption@ORI@LT@array\LT@array
+ \renewcommand*\LT@array{%
+% \end{macrocode}
+% |\captionsetup| for longtable:
+% \begin{macrocode}
+ \global\let\caption@opt@@longtable\@undefined
+ \def\captionsetup{%
+ \noalign\bgroup
+ \@ifstar\@captionsetup\@captionsetup}% gobble *
+ \def\@captionsetup##1{\LT@captionsetup{##1}\egroup}%
+ \def\LT@captionsetup##1{%
+ \captionsetup@startrue\caption@setup@options[@longtable]{##1}%
+ \global\let\caption@opt@@longtable\caption@opt@@longtable}%
+% \end{macrocode}
+% |\captionabove| \& |\captionbelow| for longtable: (\KOMAScript\ document class)
+% \begin{macrocode}
+ \def\@captionabovetrue{\LT@captionsetup{position=t}}%
+ \def\@captionabovefalse{\LT@captionsetup{position=b}}%
+% \end{macrocode}
+% |\captionlistentry| for longtable:
+% \begin{macrocode}
+ \def\captionlistentry{%
+ \noalign\bgroup
+ \@ifstar{\egroup\LT@listentry\LTcaptype}% gobble *
+ {\egroup\LT@listentry\LTcaptype}}%
+% \end{macrocode}
+% |\continuedfloat| for longtable:\\
+% {\small(Commented out, since it's not deeply tested and quite useless anyway)}
+% \Note{\package{hyperref} versions $<$ v6.76j uses $2\times$ \cs{hyper@makecurrent}}
+% \begin{macrocode}
+% \caption@ifhypcap{%
+% \let\caption@ORI@hyper@makecurrent\hyper@makecurrent
+% \def\hyper@makecurrent##1{%
+% \let\hyper@makecurrent\caption@ORI@hyper@makecurrent
+% \caption@makestart{##1}%
+%% \let\Hy@LT@currentHlabel\@currentHlabel
+% \let\Hy@LT@currentHref\@currentHref
+% \def\hyper@makecurrent####1{%
+%% \let\@currentHlabel\Hy@LT@currentHlabel
+% \let\@currentHref\Hy@LT@currentHref}}%
+% \let\caption@ORI@continuedfloat\continuedfloat
+% \def\continuedfloat{\noalign{%
+% \gdef\caption@setContinuedFloat{%
+% \let\caption@reset@continuedfloat\@gobble}%
+% \def\caption@setoptions####1{%
+% \g@addto@macro\caption@setContinuedFloat{%
+% \caption@setoptions{####1}}}%
+% \let\@captype\LTcaptype
+% \caption@ORI@ContinuedFloat}}%
+% }{%
+% \def\continuedfloat{\noalign{%
+% \caption@Error{%
+% \noexpand\continuedfloat inside longtables\MessageBreak
+% is only available with `hypcap=true'}}}%
+% }%
+% \global\let\caption@setContinuedFloat\@empty
+ \def\continuedfloat{\noalign{%
+ \caption@Error{\noexpand\continuedfloat outside float}}}%
+% \end{macrocode}
+% |\bicaption| for longtable:
+% \begin{macrocode}
+ \let\bicaption\LT@bicaption
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@ORI@LT@array}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@capti@n}
+% \changes{v3.3}{2016/02/01}{This re-definition added}
+% The original implementation:
+% \begin{verbatim}
+% \def\LT@capti@n{%
+% \@ifstar
+% {\egroup\LT@c@ption\@gobble[]}%
+% {\egroup\@xdblarg{\LT@c@ption\@firstofone}}}
+% \end{verbatim}%^^A
+% Our implementation uses |\caption@xdblarg| instead of |\@xdblarg|:
+% \begin{macrocode}
+ \def\LT@capti@n{%
+ \@ifstar
+ {\egroup\LT@c@ption\@gobble[]}%
+ {\egroup\caption@xdblarg{\LT@c@ption\@firstofone}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@makecaption}
+% \changes{v3.0d}{2004/08/10}{%
+% Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
+% \changes{v3.0e}{2005/05/05}{%
+% Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
+% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
+% \changes{v3.3}{2016/02/01}{Support for \cs{bicaption} via \cs{caption@LT@setup} added}
+% \changes{v3.3a}{2019/04/02}{Work-around for problem with \package{floatrow} added}
+% |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
+% \smallskip
+% The original definition:
+% \begin{verbatim}
+% \def\LT@makecaption#1#2#3{%
+% \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
+% % Based on article class "\@makecaption", "#1" is "\@gobble" in star
+% % form, and "\@firstofone" otherwise.
+% \sbox\@tempboxa{#1{#2: }#3}%
+% \ifdim\wd\@tempboxa>\hsize
+% #1{#2: }#3%
+% \else
+% \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+% \fi
+% \endgraf\vskip\baselineskip}%
+% \hss}}}
+% \end{verbatim}%^^A
+% Our definition:
+% \begin{macrocode}
+ \renewcommand\LT@makecaption[3]{%
+ \caption@LT@make{%
+ \caption@LT@settype\LTcaptype
+% \end{macrocode}
+%
+% |\caption@LT@setup| is re-defined inside the \package{bicaption} package
+% and contains the preparation of typesetting of the bilingual caption.
+% \begin{macrocode}
+ \caption@LT@setup
+% \end{macrocode}
+%
+% \iffalse
+% The default |position=| setting for longtables is |top|.
+% (This emulates the standard behavior of the \package{longtable} package
+% which has no skip above the caption but a skip below it.)
+% \fi
+%
+% |position=auto| is a bad idea for longtables, but we do our very best.
+% This works quite well for captions inside the longtable contents, but
+% not for captions inside the longtable (end)foot.
+% \Note{This should be `top' if unclear!}
+% \begin{macrocode}
+ \caption@setautoposition{\ifcase\LT@rows t\else b\fi}%
+% \end{macrocode}
+%
+% We set |\ifcaption@star| according the 1st argument.
+% \begin{macrocode}
+ \caption@startrue#1\caption@starfalse
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@prepare@stepcounter\LTcaptype{LT}%
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/05/05}{\cs{caption@normalsize} added}
+% \begin{macrocode}
+ \caption@begin\LTcaptype
+ \caption@normalsize
+% \end{macrocode}
+%
+% The following skip has the purpose to correct the height of the
+% |\parbox[t]|. Usually it's the height of the very first line, but
+% because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
+% it's always |0pt|.\par
+% (A different idea would be typesetting the first skip outside the longtable
+% column with |\noalign{\vskip|\ldots|}|, but this means we have to move
+% |\caption@begin| to some other place because it does not work in tabular
+% mode. And at the moment I have no idea on how to do this in an elegant
+% way\ldots)
+% \begin{macrocode}
+ \vskip-\ht\strutbox
+% \end{macrocode}
+%
+% Work-around for problem with \package{floatrow}:
+% The |\below|\-|caption|\-|skip| disturbs the environment in which the caption is actually typeset (by creating extra, unwanted space),
+% so we supress this skip if the \package{floatrow} package is loaded.
+% (This fixes \issue{50})
+% \begin{macrocode}
+ \caption@ifdefined\FBifcaptop{%
+ \let\caption@belowskip\@empty}{}%
+% \end{macrocode}
+%
+% The following code should look familiar. We do our skips and use
+% |\caption@@make| to typeset the caption itself.
+% \begin{macrocode}
+ \caption@make@above
+ \caption@@make{#2}{#3}\endgraf
+ \caption@make@below
+ \caption@end}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@listentry}
+% \changes{v3.3}{2018/08/26}{This macro added}
+% \changes{v3.3}{2018/10/05}{Bugfix: \cs{ignorespaces} added}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% \begin{macrocode}
+ \renewcommand*\LT@listentry[2]{%
+ \begingroup
+ \caption@LT@settype{#1}%
+ \caption@listentry\@firstoftwo[{#1}]{#2}%
+ \endgroup\ignorespaces}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@LT@settype}
+% \changes{v3.3}{2018/08/26}{This macro added}
+% \changes{v3.3}{2018/10/05}{Uses argument no. 1 instead of \cs{LTcaptype}}
+% \begin{macrocode}
+ \newcommand*\caption@LT@settype[1]{%
+ \caption@settype*{#1}%
+% \end{macrocode}
+% If |\LTcapwidth| is not set to its default value |4in| we assume
+% that it shall overwrite our own setting.
+% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
+% \begin{macrocode}
+ \ifdim\LTcapwidth=4in \else
+ \setcaptionwidth\LTcapwidth
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setoptions{longtable}%
+% \caption@setContinuedFloat
+% \end{macrocode}
+% Finally set options applied by |\captionsetup| inside the longtable.
+% \begin{macrocode}
+ \caption@setoptions{@longtable}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\flrow@setlist}
+% \changes{v3.4g}{2020/01/03}{Redefinition of this macro added}
+% The \package{floatrow} package uses |\flrow@setlist{{table}{longtable}}| inside its redefinition of |\LT@array| without setting |\@captype| first,
+% and this makes |\captionsetup[table]{name=...}| doomed to fail for longtables (``Undefined control sequence'').
+% Unfortunately we cannot easily patch |\LT@array| again to fix this bug in \package{floatrow} since it will be patched |\AtBeginDocument|.
+% Therefore we patch |\flrow@setlist| instead to catch and fix the bug on-the-fly.
+% \begin{macrocode}
+ \caption@AtBeginDocument{\caption@ifdefined\flrow@setlist@{%
+ \caption@InfoNoLine{Fixing longtable code of `floatrow' package}%
+ \let\caption@flrow@setlist@\flrow@setlist@
+ \renewcommand\flrow@setlist@[1]{%
+ \def\caption@tempa{{table}{longtable}}%
+ \def\caption@tempb{#1}%
+ \ifx\caption@tempa\caption@tempb
+ \def\@captype{table}%
+ \fi
+ \caption@flrow@setlist@{#1}}%
+ }{}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@LT@setup}
+% \changes{v3.3}{2016/02/01}{This macro added}
+% Hook for stuff which prepares the typesetting of the \package{longtable} caption.
+% \begin{macrocode}
+\providecommand*\caption@LT@setup{}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{The picinpar package}
+% \changes{v3.1}{2007/06/13}{Support of the \package{picinpar} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picinpar}{%
+% \end{macrocode}
+%
+% \begin{macro}{\figwindow}
+% \begin{macro}{\tabwindow}
+% The \package{picinpar} package comes with its own caption code
+% (|\wincaption|, |\@wincaption|, |\@makewincaption|, \ldots)
+% so we redefine |\figwindow| \& |\tabwindow| to use |\caption| instead.
+% \begin{macrocode}
+ \long\def\figwindow[#1,#2,#3,#4] {%
+ \caption@window{figure}%
+ \caption@setoptions{figwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\tabwindow[#1,#2,#3,#4] {%
+ \caption@window{table}%
+ \caption@setoptions{tabwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@window}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Beside calling |\caption@settype| we redefine |\caption@boxrestore|
+% (as in \package{floatflt} \& \package{picins} package support)
+% and |\@makecaption| (as in \package{float} package support) here.
+% \begin{macrocode}
+ \newcommand*\caption@window[1]{%
+ \let\@makecaption\caption@@make
+ \caption@setautoposition b%
+ \caption@settype{#1}%
+ \caption@clearmargin
+ \caption@setfullparboxrestore}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@wincaption}
+% \changes{v3.1d}{2007/10/25}{Missing \% added}
+% \changes{v3.3}{2013/04/14}{\cs{caption@ContinuedFloattrue} added}
+% \changes{v3.3}{2018/10/06}{\cs{caption@ContinuedFloattrue} replaced by \cs{caption@setflag1}}
+% This one finally typesets the caption using |\caption|.
+% \begin{macrocode}
+ \newcommand\caption@wincaption[1]{%
+% \end{macrocode}
+% This will be done twice for every |figwindow| \& |tabwindow| caption --
+% on the first run |\picwd| is |0pt|, on the second run |\picwd| is |\hsize|.
+% \begin{macrocode}
+ \ifdim\picwd=\z@
+ \let\caption@makecurrent\@gobbletwo
+ \let\caption@@start\relax
+ \caption@prepareslc
+ \else
+ \caption@setflag1%
+ \fi
+% \end{macrocode}
+% The argument |#1| could contain simply the caption text
+% (e.g.~|A figure caption|), but it could also contain an optional argument,
+% the \meta{lst\_entry}
+% (e.g.~|[An| |entry| |to| |the| |LOF]||{A| |figure| |caption}|).
+% Therefore we have to test if |#1| begins with~|[| or not; furthermore we
+% support a starred variant -- as in |\caption*| -- so we test for~|*|, too.
+% \begin{macrocode}
+ \edef\@tempa{\expandafter\noexpand\@car#1\@nil}%
+ \if\@tempa*%
+ \let\@tempa\@firstofone
+ \else\if\@tempa[%]
+ \let\@tempa\@firstofone
+ \else
+ \let\@tempa\@empty
+ \fi\fi
+ \expandafter\caption\@tempa{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The picins package}
+% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
+%
+% \begin{macro}{\piccaptiontype}
+% |\piccaptiontype|\marg{type}\par
+% We offer this macro for changing the \meta{type} of the caption, so the user
+% doesn't have to redefine |\@captype|, as proposed in the \package{picins}
+% documentation.
+% \Note{We define this macro here so it can be used in the
+% preamble of the document, even when \thispackage\ was loaded prior to the
+% \package{picins} package.}
+% \begin{macrocode}
+\newcommand*\piccaptiontype[1]{\def\@piccaptype{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picins}{%
+% \end{macrocode}
+%
+% Initial set |\@piccaptype| and undefine |\@captype| which was set to
+% |figure| by the \package{picins} package.
+% \begin{macrocode}
+ \caption@ifundefined\@piccaptype{%
+ \caption@iftype{%
+ \let\@piccaptype\@captype
+ }{%
+ \def\@piccaptype{figure}%
+ }%
+ }{}%
+ \let\@captype\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\piccaption}
+% The original code:
+% \begin{verbatim}
+% \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
+% \end{verbatim}%^^A
+% Our code uses |\caption@star| so |\piccaption*| works,
+% and |\caption@dblarg| so |\piccaption{}| works correctly.
+% \begin{macrocode}
+ \def\piccaption{\caption@star\relax{\caption@dblarg\@piccaption}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\make@piccaption}
+% \changes{v3.1}{2007/12/06}{Bugfix: \cs{caption@clearmargin} will always be used now}
+% The original code:
+% \begin{verbatim}
+% \def\make@piccaption{%
+% [...]
+% \setbox\@TEXT=\vbox{\hsize\hsiz@\caption[\sh@rtf@rm]{\capti@nt@xt}}%
+% }
+% \end{verbatim}%^^A
+% In our code we have to correct several things:
+% \begin{enumerate}
+% \item |\@captype| must be defined, since we have removed the global
+% definition.
+% \item We use |\caption@setoptions{parpic}| so
+% |\captionsetup[parpic]{|\ldots|}| is supported.
+% \item |\linewidth| must be set correctly.
+% Usually this is done by |\@parboxrestore| inside |\@caption|,
+% but since we use |\@caption@boxrestore| we have to map this to
+% |\@parboxrestore| instead.
+% \item The two arguments of |\caption| (|\sh@rtf@rm| \& |\capti@nt@xt|)
+% should be expanded on first level so |\caption[]{|\ldots|}| and
+% |\caption[|\ldots|]{}| work correctly.
+% \end{enumerate}
+% \begin{macrocode}
+ \let\caption@ORI@make@piccaption\make@piccaption
+ \def\make@piccaption{%
+ \let\caption@ORI\caption
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\caption[##1]##2{%
+ \caption@freezeHref % will be defrosted in \ivparpic
+ \caption@settype\@piccaptype
+% \ifnum\c@piccaptionpos>2\relax
+ \caption@clearmargin
+% \else
+% \captionwidth\z@ % do not use "width=" setting
+% \fi
+ \caption@setfullparboxrestore
+ \caption@setoptions{parpic}%
+ \caption@setautoposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\expandafter\expandafter\caption@ORI
+ \expandafter\expandafter\expandafter[%
+ \expandafter\expandafter\expandafter{%
+ \expandafter##1\expandafter}\expandafter]\expandafter{##2}}%
+% \end{macrocode}
+% {\footnotesize\begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\begingroup|\\
+% | \toks0\expandafter{##1}| |\toks2\expandafter{##2}|\\
+% | \edef\x{\endgroup|\\
+% | \noexpand\caption@ORI[{\the\toks0}]{\the\toks2}}|\\
+% | \x|
+% \end{quote}
+% \begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\edef\x{%|\\
+% | \noexpand\caption@ORI[{\unexpanded\expandafter{##1}}]%|\\
+% | {\unexpanded\expandafter{##2}}}|\\
+% |\-|
+% \end{quote}}
+% \begin{macrocode}
+ \caption@ORI@make@piccaption
+ \let\caption\caption@ORI}%
+% \end{macrocode}
+% \end{macro}
+%
+
+% \begin{macro}{\ivparpic}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% We need to set our \package{hyperref} anchor here.
+% Not bullet-proof since we have to redefine |\noindent| here!
+% \begin{macrocode}
+ \let\caption@ORI@ivparpic\ivparpic
+ \def\ivparpic(#1,#2)(#3,#4)[#5][#6]#7{%
+ \let\caption@ORI@noindent\noindent
+ \def\noindent{%
+ \caption@defrostHref
+ \let\noindent\caption@ORI@noindent
+ \noindent}%
+ \caption@ORI@ivparpic(#1,#2)(#3,#4)[{#5}][{#6}]{#7}%
+ \let\noindent\caption@ORI@noindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\piccaptiontype\@undefined
+}
+% \end{macrocode}
+%
+% \subsection{The rotating package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{rotating}[1995/08/22 v2.10]{%
+% \end{macrocode}
+%
+% \begin{macro}{\rotcaption}
+% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@star} removed}
+% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
+% Make |\rotcaption*| work.
+% \begin{macrocode}
+ \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
+% \let\@rotcaption\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\rotcaptionof}
+% \changes{v3.0i}{2005/12/07}{New}
+% Make |\rotcaptionof(*)| work.
+% \begin{macrocode}
+ \def\rotcaptionof{%
+ \caption@teststar\caption@of{\rotcaption*}\rotcaption}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makerotcaption}
+% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
+% \changes{v3.0m}{2007/03/04}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox} now}
+% \changes{v3.3}{2012/12/26}{Rewritten (again)}
+% Original (bugfixed) code:
+% \begin{verbatim}
+% \long\def\@makerotcaption#1#2{%
+% \setbox\@tempboxa\hbox{#1: #2}%
+% \ifdim \wd\@tempboxa > .8\vsize
+% \rotatebox{90}{%
+% \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
+% }%\par % <== \par removed (AR)
+% \else%
+% \rotatebox{90}{\box\@tempboxa}%
+% \fi
+% \nobreak\hspace{12pt}% <== \nobreak added (AR)
+% }
+% \end{verbatim}%^^A
+% Our version emulates this behavior, but if |width=| is set,
+% the rotated caption is always typeset as |\parbox|.
+% (Note that |margin=| is not supported here.)
+% \begin{macrocode}
+ \long\def\@makerotcaption#1#2{%
+ \rotatebox{90}{%
+ \ifdim\captionwidth=\z@
+ \setcaptionwidth{.8\vsize}%
+ \l@addto@macro\caption@singleline{%
+ \caption@setup{parbox=none}}%
+ \fi
+ \let\caption@calcmargin\relax
+ \caption@@make{#1}{#2}}%
+ \nobreak\hspace{12pt}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The sidecap package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{sidecap}[2003/06/06 v1.6f]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\SC@zfloat}
+% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
+% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@star} removed}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} will be saved \& restored now}
+% \changes{v3.2a}{2011/08/17}{Bugfix: Uses \cs{caption@freeze} instead of \cs{caption@freeze*} now}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
+% This macro will be called at the start of the environment, here is a good
+% opportunity to do some adaptations to |\caption| and |\captionsetup|.
+% \begin{macrocode}
+ \let\caption@ORI@SC@zfloat\SC@zfloat
+ \def\SC@zfloat#1#2#3[#4]{%
+% \end{macrocode}
+% First we use the original definition, but restore \cs{caption} and \cs{label}
+% so \cs{caption@freeze} and \cs{caption@warmup} will work correctly.
+% \begin{macrocode}
+ \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]%
+ \SC@RestoreCommands
+% \end{macrocode}
+% Since the sidecap package uses our |\caption| code outside the
+% environment the regular |\captionsetup| will not work.
+% So we need a special version here which saves the given argument list
+% which will be executed later on.
+% Furthermore we need to make |\caption*| work.
+% \begin{macrocode}
+ \caption@freezetype{#2}%
+% \end{macrocode}
+% The sidecap package uses |\ifx\label\SC@label| to test if it is just inside a
+% |SC|\-|figure| or not. So we redefine |\SC@label| here so this test will still work.
+% \begin{macrocode}
+ \let\SC@label\label}%
+% \end{macrocode}
+% \begin{macrocode}
+ \providecommand*\SC@RestoreCommands{%
+ \let\caption=\SC@orig@caption \let\label=\SC@orig@label}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\endSC@FLOAT}
+% \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
+% \changes{v3.1}{2007/05/05}{Call of \cs{caption@setoptions}\arg{SCfloat} added}
+% This macro will be called at the end of the environment, here we need to
+% setup our stuff before the \package{sidecap} package actually typesets
+% its caption.
+% \begin{macrocode}
+ \let\caption@ORI@endSC@FLOAT\endSC@FLOAT
+ \def\endSC@FLOAT{%
+% \end{macrocode}
+% Before we can typeset the caption we need to set the margin to zero
+% because any extra margin would only be disturbing here.\par
+% (We don't need to take care about the caption position because
+% the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
+% to a skip of zero anyway.)\par
+% Furthermore |\SC@justify| will override the caption justification, if set.
+% The usage of |\SC@justify| differs from version to version of the
+% \package{sidecap} package:\par
+% \begin{tabular}{ll}
+% Version 1.4: & |\SC@justify| is not defined\\
+% Version 1.5: & |\SC@justify| is |\relax| when not set\\
+% Version 1.6: & |\SC@justify| is |\@empty| when not set\\
+% \end{tabular}
+% \begin{macrocode}
+ \def\caption@setSC@justify{%
+ \caption@clearmargin
+ \ifx\SC@justify\@empty \else
+ \let\caption@hj\SC@justify
+ \let\SC@justify\@empty
+ \fi}%
+% \end{macrocode}
+% Make the original definition of |\endSC@FLOAT| to use our caption
+% stuff instead of its own.
+% \Note{At this point the \package{sidecap} definition of \cs{caption} is valid,
+% not the regular one!}
+% \begin{macrocode}
+ \let\caption\SC@orig@caption
+ \def\SC@orig@caption[##1]##2{%
+ \caption@setSC@justify
+%%% \caption@setoptions{SC}%
+ \caption@setoptions{SC\@captype}%
+ \caption@defrost}%
+% \end{macrocode}
+% Finally we call the original definition of |\endSC@FLOAT|.
+% \begin{macrocode}
+ \caption@setSC@justify % for compatibility mode
+ \caption@prepare@defrost
+ \caption@ORI@endSC@FLOAT}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The subfigure package}
+% \changes{v3.1}{2007/04/06}{subfigure package support added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{subfigure}[2002/01/23 v2.1]{%
+% \end{macrocode}
+%
+% \begin{macro}{\sf@ifpositiontop}
+% \changes{v3.1a}{2007/09/15}{Bugfix 07-09-15: Check for \cs{@captype} added}
+% If the \package{subfigure} package is loaded, we map |\sf@ifpositiontop|
+% to |\iffiguretopcap| resp. |\iftabletopcap|, so the \package{subfigure}
+% \version{2.1} options \opt{figbotcap} etc. will still work.
+% \begin{macrocode}
+ \def\sf@ifpositiontop{%
+ \ifx\@captype\@undefined
+ \expandafter\@gobbletwo
+ \else\ifx\@captype\relax
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\expandafter\sf@if@position@top
+ \fi\fi}
+% \end{macrocode}
+% \begin{macrocode}
+ \def\sf@if@position@top{%
+ \@ifundefined{if\@captype topcap}%
+ {\@gobbletwo}%
+ {\@nameuse{if\@captype topcap}%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The supertabular and xtab packages}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{supertabular}[2002/07/19 v4.1e]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
+% \changes{v3.1h}{2008/04/01}{Bugfix: Star variant does not increment table counter anymore}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1h}{2008/04/01}{Made \cs{nameref} \& \cs{autoref} work}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[{#1}]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
+% \changes{v3.1h}{2008/04/01}{Bugfix: \cs{@currentlabelname} will be set now}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% \if@topcaption \vskip 10\p@ \fi
+% \endgroup}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{supertabular}%
+% \end{macrocode}
+% The |position=| setting will be overwritten by the
+% \package{supertabular} package: If |\topcaption| was used,
+% the position will be |top| automatically, |bottom| otherwise.
+% \begin{macrocode}
+ \def\caption@fixposition{%
+ \caption@setposition{\if@topcaption t\else b\fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@boxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1h}{2008/04/01}{Support of the xtab package added}
+% \begin{macrocode}
+\caption@IfPackageLoaded{xtab}[2000/04/09 v2.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[{#1}]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \@initisotab
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}%
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% %% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% %% \if@topcaption \vskip 10\p@ \fi
+% \endgroup
+% \global\advance\ST@pageleft -\PWSTcapht
+% \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{xtabular}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@fixposition{%
+ \caption@setposition{\if@topcaption t\else b\fi}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@initisotab
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@boxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end
+ \global\advance\ST@pageleft -\PWSTcapht
+ \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The threeparttable package}
+% \changes{v3.1}{2007/05/08}{Support of the \package{threeparttable} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{threeparttable}[2003/06/13 v3.0]{%
+% \end{macrocode}
+%
+% \begin{macro}{\threeparttable}
+% \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined}
+% Unfortunately |\@captype| is not set when |\TPT@common| will be used,
+% so we have to redefine |\threeparttable| and |\measuredfigure| instead.
+% \begin{macrocode}
+ \let\caption@ORI@threeparttable\threeparttable
+ \renewcommand*\threeparttable{%
+ \caption@settype{\@ifundefined{@captype}{table}{\@captype}}%
+%%% \caption@setposition a% ?
+ \caption@clearmargin
+ \caption@setoptions{threeparttable}%
+ \caption@ORI@threeparttable}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\measuredfigure}
+% \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined}
+% Same here\ldots
+% \begin{macrocode}
+ \let\caption@ORI@measuredfigure\measuredfigure
+ \renewcommand*\measuredfigure{%
+ \caption@settype{\@ifundefined{@captype}{figure}{\@captype}}%
+%%% \caption@setposition a% ?
+ \caption@clearmargin
+ \caption@setoptions{measuredfigure}%
+ \caption@ORI@measuredfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\TPT@caption}
+% The original code:
+% \begin{verbatim}
+% \def\TPT@caption#1[#2]#3{\gdef\TPT@docapt
+% {\par\global\let\TPT@docapt\@undefined \TPT@LA@caption{#1}[{#2}]%
+% {\strut\ignorespaces#3\ifhmode\unskip\@finalstrut\strutbox\fi}}%
+% \ifx\TPT@hsize\@empty \let\label\TPT@gatherlabel \abovecaptionskip\z@skip
+% \else \TPT@docapt \fi \ignorespaces}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \def\TPT@caption#1[#2]#3{%
+ \gdef\TPT@docapt{%
+ \global\let\TPT@docapt\@undefined
+ \caption@setautoposition\caption@TPT@position
+ \TPT@LA@caption{#1}[{#2}]{#3}}%
+ \ifx\TPT@hsize\@empty
+ \let\label\TPT@gatherlabel % Bug: does not work for measuredfigures
+ \gdef\caption@TPT@position{t}%
+ \g@addto@macro\TPT@docapt\caption@TPT@eatvskip
+ \else
+ \def\caption@TPT@position{b}%
+ \TPT@docapt
+ \fi
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ %\newcommand*\caption@TPT@eatvskip{\vskip-.2\baselineskip}%
+ \def\caption@TPT@eatvskip#1\vskip{#1\@tempdima=}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The wrapfig package}
+% \changes{v3.1}{2007/05/05}{Support of the \package{wrapfig} package added}
+% \changes{v3.2d}{2011/11/02}{Support of the \package{wrapfig} package rewritten}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{wrapfig}[2003/01/31 v3.6]{%
+% \end{macrocode}
+%
+% \begin{macro}{\wrapfloat}
+% \changes{v3.2d}{2011/11/02}{Redefinition of this macro added}
+% First of all we make the \package{wrapfig} package independent from the package
+% load order regarding the \package{float} package.
+% Since the usage of |\@float@set|\-|every| is missing in the code of the \package{wrapfig}
+% package (it should be in the redefinition of |\float@re|\-|style|, right after
+% |\@nameuse{fst@#1}|), we don't use it here, too,
+% especially since |\wrap|\-|float| will usually not be used when used with re-styled floats.
+% \begin{macrocode}
+ \renewcommand*\wrapfloat[1]{%
+ \def\@captype{#1}%
+ \@ifundefined{fst@#1}{}{%
+ \@nameuse{fst@#1}%
+% \@float@setevery{#1}%
+ \def\WF@floatstyhook{\let\@currbox\WF@box
+ \global\setbox\WF@box\float@makebox{\wd\WF@box}}}%
+ \@ifnextchar[\WF@wr{\WF@wr[]}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\WF@rapt}
+% \changes{v3.2d}{2011/11/02}{Usage of \cs{WF@captionstyhook} added}
+% Original code:
+% \begin{verbatim}
+% \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+% \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+% \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+% \ifdim\hsize>\z@ \@parboxrestore \else
+% \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+% \ignorespaces \fi}
+% \end{verbatim}%^^A
+% Our code has |\WF@captionstyhook| in addition:
+% \begin{macrocode}
+ \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+ \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+ \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+ \expandafter\WF@captionstyhook\expandafter{\@captype}% <= new
+ \ifdim\hsize>\z@ \@parboxrestore \else
+ \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+ \ignorespaces \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\WF@captionstyhook}
+% \changes{v3.2d}{2011/11/02}{This macro added}
+% \changes{v3.2e}{2011/11/10}{Bugfix 11-11-09: float package support fixed}
+% We place our \package{hyperref} anchor here, apply the `wrap' options etc.
+% Since the usage of |\@float@set|\-|every| is missing in the \package{wrapfig}
+% package we will catch it up here for making the necessary adaptions to the
+% \package{float} package.
+% \begin{macrocode}
+ \def\WF@captionstyhook#1{%
+ \let\@captype\@undefined
+ \@ifundefined{fst@#1}{}{\@float@setevery{#1}}%
+ \caption@settype{#1}%
+ \caption@clearmargin
+%%% \caption@setoptions{wrap}%
+ \caption@setoptions{wrap#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \begin{thebibliography}{99}
+% \bibitem{beamer}
+% Till Tantau:\\
+% \href{http://www.ctan.org/pkg/beamer}%
+% {\emph{The beamer class, User Guide for version 3.25}},\\
+% December 26, 2012
+%
+% \bibitem{KOMAScript}
+% Markus Kohm \& Jens-Uwe-Morawski:\\
+% \href{http://www.ctan.org/pkg/koma-script}%
+% {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\
+% 2012-07-22
+%
+% \bibitem{NTG}
+% Victor Eijkhout:\\
+% \href{http://www.ctan.org/pkg/ntgclass}%
+% {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\
+% 3 September 1989
+%
+% \bibitem{float}
+% Anselm Lingnau:\\
+% \href{http://www.ctan.org/pkg/float}%
+% {\emph{An Improved Environment for Floats}},\\
+% 2001/11/08
+%
+% \bibitem{floatflt}
+% Mats Dahlgren:\\
+% \href{http://www.ctan.org/pkg/floatflt}%
+% {\emph{Welcome to the floatflt package}},\\
+% 1998/06/05
+%
+% \bibitem{floatrow}
+% Olga Lapko:\\
+% \href{http://www.ctan.org/pkg/floatrow}%
+% {\emph{The floatrow package documentation}},\\
+% 2009/08/02
+%
+% \bibitem{fltpage}
+% Sebastian Gross:\\
+% \href{http://www.ctan.org/pkg/fltpage}%
+% {\emph{Welcome to the beta test of fltpage package!}},\\
+% 1998/11/13
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/hyperref}%
+% {\emph{Hypertext marks in \LaTeX: a manual for hyperref}},\\
+% November 2012
+%
+% \bibitem{hypcap}
+% Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/oberdiek}%
+% {\emph{The hypcap package -- Adjusting anchors of captions}},\\
+% 2011/02/16
+%
+% \bibitem{listings}
+% Carsten Heinz \& Brooks Moses:\\
+% \href{http://www.ctan.org/pkg/listings}%
+% {\emph{The Listings Package}},\\
+% 2007/02/22
+%
+% \bibitem{longtable}
+% David Carlisle:\\
+% \href{http://www.ctan.org/pkg/longtable}%
+% {\emph{The longtable package}},\\
+% 2004/02/01
+%
+% \bibitem{picinpar}
+% Friedhelm Sowa:\\
+% \href{http://www.ctan.org/pkg/picinpar}%
+% {\emph{Pictures in Paragraphs}},\\
+% July 13, 1993
+%
+% \bibitem{picins}
+% Joachim Bleser and Edmund Lang:\\
+% \href{http://www.ctan.org/pkg/picins}%
+% {\emph{PicIns-Benutzerhandbuch Version 3.0}},\\
+% September~1992
+%
+% \bibitem{rotating}
+% Sebastian Rahtz and Leonor Barroca:\\
+% \href{http://www.ctan.org/pkg/rotating}%
+% {\emph{A style option for rotated objects in \LaTeX}},\\
+% 1997/09/26
+%
+% \bibitem{sidecap}
+% Rolf Niepraschk \& Hubert G\"a\ss lein:\\
+% \href{http://www.ctan.org/pkg/sidecap}%
+% {\emph{The sidecap package}},\\
+% 2003/06/06
+%
+% \bibitem{subfigure}
+% Steven D. Cochran:\\
+% \href{http://www.ctan.org/pkg/subfigure}%
+% {\emph{The subfigure package}},\\
+% 2005/03/15
+%
+% \bibitem{subfig}
+% Steven D. Cochran:\\
+% \href{http://www.ctan.org/pkg/subfig}%
+% {\emph{The subfig package}},\\
+% 2005/07/05
+%
+% \bibitem{supertabular}
+% Johannes Braams and Theo Jurriens:\\
+% \href{http://www.ctan.org/pkg/supertabular}%
+% {\emph{The supertabular environment}},\\
+% 2004/02/20
+%
+% \bibitem{threeparttable}
+% Donald Arseneau:\\
+% \href{http://www.ctan.org/pkg/threeparttable}%
+% {\emph{Three part tables: title, tabular environment, notes}},\\
+% March 5, 2010
+%
+% \bibitem{wrapfig}
+% Donald Arseneau:\\
+% \href{http://www.ctan.org/pkg/wrapfig}%
+% {\emph{WRAPFIG.STY ver 3.6}},\\
+% Jan 31, 2003
+%
+% \bibitem{xtab}
+% Peter Wilson:\\
+% \href{http://www.ctan.org/pkg/xtab}%
+% {\emph{The xtab package}},\\
+% 2011/07/31
+% \end{thebibliography}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.4/caption3.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.4/caption3.dtx
new file mode 100644
index 00000000000..2843145c183
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.4/caption3.dtx
@@ -0,0 +1,4231 @@
+% \iffalse meta-comment
+%
+% This is file `caption3.dtx'.
+%
+% Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files
+% caption.ins, caption.dtx, caption2.dtx, caption3.dtx,
+% bicaption.dtx, ltcaption.dtx, subcaption.dtx,
+% the derived files
+% caption.sty, caption2.sty, caption3.sty,
+% bicaption.sty, ltcaption.sty, subcaption.sty,
+% and the user manuals
+% caption-deu.tex, caption-eng.tex, caption-rus.tex.
+%
+% \fi
+% \CheckSum{3607}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{caption3.drv}[2019/09/10 v1.13 Implementation of the caption kernel]
+\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+\makeatletter % make room for subsections like 2.16.14 in the TOC
+%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
+\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
+\makeatother
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage{caption3}[2020/05/30]
+%
+\DeclareRobustCommand*\AmS{\texorpdfstring
+ {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
+ {AMS}}
+\DeclareRobustCommand*\KOMAScript{\texorpdfstring
+ {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
+ {KOMA-Script}}
+\DeclareRobustCommand*\NTG{NTG}
+\DeclareRobustCommand*\SmF{SMF}
+%
+\begin{document}
+ \DocInput{caption3.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
+% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
+% \let\class\puresf \let\package\puresf
+% \let\env\purett \let\opt\purett
+%
+% \def\thispackage{the \package{caption} kernel}
+% \def\Thispackage{The \package{caption} kernel}
+%
+% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+% \newcommand*\version[2][]{\textit{v#2}}
+%
+% \GetFileInfo{caption3.sty}
+%
+% \title{The Implementation of
+% \texorpdfstring{\thispackage\thanks{%^^A
+% This package has version number \fileversion, last revised \filedate.}}%^^A
+% {the caption kernel}}
+% \author{Axel Sommerfeldt\\
+% \url{https://gitlab.com/axelsommerfeldt/caption}}
+% \date{\filedate}
+% \maketitle
+%
+% \begin{abstract}
+% \Thispackage\ consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% The kernel provides all the user commands and internal macros which are
+% necessary for typesetting captions and setting parameters regarding these.
+% While the standard \LaTeX\ document classes provide an internal command
+% called |\@makecaption| and no options to control its behavior (except the
+% vertical skips above and below the caption itself), we provide similar
+% commands called |\caption@make| and |\caption@@make|, but with a lot of
+% options which can be selected with |\captionsetup|.
+% Loading the kernel part do not change the output of a \LaTeX\ document
+% -- it just provides functionality which can be used by \LaTeXe\ packages
+% which typesets captions, for example the \package{caption} and
+% \package{subfig} packages.
+% \end{abstract}
+%
+% \StopEventually{}
+% \clearpage
+% \tableofcontents
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
+%
+% \changes{v1.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v1.0c}{2004/11/28}{Split into two packages:
+% \package{caption} \& \package{caption3}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \section{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption3}[2020/07/29 v1.13 caption3 kernel (AR)]
+% \end{macrocode}
+%
+% \section{Workaround for bug in package \package{arabtex}}
+% \package{arabtex} re-defines \cs{@gobble} as not-long so the packages of the
+% \package{caption} package bundle are doomed to fail.
+% Since this fatal bug won't be fixed in \package{arabtex} but we are dependent on a
+% proper definition of \cs{@gobble}, \cs{@firstofone}, \cs{@firstoftwo}, \cs{@secondoftwo},
+% and so on we fix this here. (Sigh!)
+% \begin{macrocode}
+\providecommand\caption@FixArabTeX{%
+ \def\caption@tempa##1{}%
+ \ifx\caption@tempa\@gobble
+ \PackageInfo{caption3}{Fixing ArabTeX}%
+ \long\def\@gobble##1{}%
+ \fi}
+% \end{macrocode}
+% Do the fix now and at |\begin{document}|, in case \package{arabtex} will be loaded after \package{caption}.
+% \begin{macrocode}
+\caption@FixArabTeX
+\AtBeginDocument{%
+ \caption@FixArabTeX
+ \let\caption@FixArabTeX\@undefined}
+% \end{macrocode}
+%
+% \section{Generic helpers}
+%
+% \begin{macro}{\@nameundef}
+% This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel.
+% We use it to remove the definition of some commands and keyval options after
+% |\begin{document}| (to save \TeX\ memory) and to remove caption options defined
+% with |\captionsetup|\oarg{type}.
+% \begin{macrocode}
+\providecommand*\@nameundef[1]{%
+ \expandafter\let\csname #1\endcsname\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@addto@macro}
+% \changes{v1.5}{2013/04/26}{Revised}
+% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which
+% globally adds tokens to existing macros, like in |\AtBeginDocument|.
+% This is the same but it works local, not global.
+% \begin{macrocode}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname currentgrouplevel\endcsname\relax
+ \PackageInfo{caption3}{TeX engine: TeX}
+ \let\caption@ifeTeX\@secondoftwo
+ \providecommand\l@addto@macro[2]{%
+ \begingroup
+ \toks@\expandafter{#1#2}%
+ \xdef\caption@addto@temp{\the\toks@}%
+ \endgroup
+ \let#1\caption@addto@temp}
+\else
+ \PackageInfo{caption3}{TeX engine: e-TeX}
+ \let\caption@ifeTeX\@firstoftwo
+ \providecommand\l@addto@macro[2]{%
+ \edef#1{\unexpanded\expandafter{#1#2}}}
+\fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bothIfFirst}
+% \begin{macro}{\bothIfSecond}
+% |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond|
+% tests if the second argument is not empty. If yes both arguments get
+% typeset, otherwise none of them.
+% \begin{macrocode}
+\def\bothIfFirst#1#2{%
+ \protected@edef\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty \else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\def\bothIfSecond#1#2{%
+ \protected@edef\caption@tempa{#2}%
+ \ifx\caption@tempa\@empty \else
+ #1#2%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifundefined}
+% \changes{v1.3a}{2011/08/12}{This macro added}
+% \changes{v1.3b}{2011/08/18}{Made expandable}
+% Similar to \cs{@ifundefined} offered by the \LaTeX kernel,
+% but takes a macro as argument instead of a macro name.
+% \begin{macrocode}
+\newcommand*\caption@ifundefined[1]{%
+ \ifx#1\@undefined
+ \expandafter\@firstoftwo
+ \else\ifx#1\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifdefined}
+% \changes{v1.8e}{2018/05/11}{This macro added}
+% Similar to \cs{@ifundefined} offered by the \LaTeX kernel,
+% but takes a macro as argument instead of a macro name.
+% \begin{macrocode}
+\newcommand*\caption@ifdefined[1]{%
+ \ifx#1\@undefined
+ \expandafter\@secondoftwo
+ \else\ifx#1\relax
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \else
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifinlist}
+% \changes{v1.1}{2007/07/29}{Rewritten}
+% This helper macro checks if the first argument is in the comma separated
+% list which is offered as second argument. So for example
+% \begin{quote}
+% |\caption@ifinlist{frank}{axel,frank,olga,steven}{yes}{no}|
+% \end{quote}
+% would expand to |yes|.
+% \begin{macrocode}
+\newcommand*\caption@ifinlist{%
+ \@expandtwoargs\caption@@ifinlist}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@ifinlist[2]{%
+ \begingroup
+ \def\@tempa##1,#1,##2\@nil{%
+ \endgroup
+ \ifx\relax##2\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}%
+ \@tempa,#2,#1,\@nil}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifin@list}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% |\caption@ifin@list|\marg{cmd}\marg{list entry}\marg{yes}\marg{no}
+% \begin{macrocode}
+\newcommand*\caption@ifin@list[2]{%
+ \caption@ifempty@list#1%
+ {\@secondoftwo}%
+ {\@expandtwoargs\caption@@ifinlist{#2}{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@addto@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@g@addto@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@g@addto@list[2]{%
+ \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@addto@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@l@addto@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@l@addto@list[2]{%
+ \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@removefrom@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@g@removefrom@list|\marg{cmd}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\caption@g@removefrom@list[2]{%
+ \caption@l@removefrom@list#1{#2}%
+ \global\let#1#1}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@removefrom@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@l@removefrom@list|\marg{cmd}\marg{list entry}\par
+% \Note[Caveat]{\meta{cmd} will be expanded during this process since
+% \cs{@removeelement} is using \cs{edef} to build the new list!}
+% \begin{macrocode}
+\newcommand*\caption@l@removefrom@list[2]{%
+ \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@for@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@for@list|\marg{cmd}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\caption@for@list[2]{%
+ \caption@ifempty@list#1{}{%
+ \def\caption@tempb##1{#2}%
+ \@for\caption@tempa:=#1\do{%
+ \expandafter\caption@tempb\expandafter{\caption@tempa}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@ifempty@list|\marg{cmd}\marg{true}\marg{false}
+% \begin{macrocode}
+\newcommand*\caption@ifempty@list[1]{%
+ \ifx#1\@undefined
+ \expandafter\@firstoftwo
+ \else\ifx#1\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else\ifx#1\@empty
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak[3]
+% \begin{macro}{\caption@setbool}
+% \begin{macro}{\caption@set@bool}
+% \changes{v1.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added}
+% \begin{macro}{\caption@ifbool}
+% \begin{macro}{\caption@undefbool}
+% For setting and testing boolean options we offer these three helper macros:
+% \begin{quote}
+% |\caption@setbool|\marg{name}\marg{value}\\
+% | |(with |value = false/true/no/yes/off/on/0/1|)\\
+% |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\
+% |\caption@undefbool|\marg{name}
+% \end{quote}
+% \begin{macrocode}
+\newcommand*\caption@setbool[1]{%
+ \expandafter\caption@set@bool\csname caption@if#1\endcsname}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@bool[2]{%
+ \caption@ifinlist{#2}{1,true,yes,on}{%
+ \let#1\@firstoftwo
+ }{\caption@ifinlist{#2}{0,false,no,off}{%
+ \let#1\@secondoftwo
+ }{%
+ \caption@Error{Undefined boolean value `#2'}%
+ }}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@teststar}
+% \changes{v1.1}{2007/05/08}{This macro and its usage added}
+% \changes{v1.1e}{2007/10/28}{\cs{caption@teststar@} added}
+% |\caption@teststar|\marg{cmd}\marg{star arg}\marg{non-star arg}\\
+% |\caption@teststar@|\marg{cmd}\marg{star arg}\marg{non-star arg}
+% \begin{macrocode}
+\newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@teststar@[3]{%
+ \@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}}
+\AtBeginDocument{\let\caption@teststar@\caption@teststar}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifatletter{%
+ \ifnum\the\catcode`\@=11
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\AtBeginDocument{\let\caption@ifatletter\@secondoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@withoptargs}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% \changes{v1.5}{2012/04/09}{This macro revised}
+% |\caption@withoptargs|\marg{cmd}
+% \begin{macrocode}
+\newcommand*\caption@withoptargs[1]{%
+ \@ifstar
+ {\def\caption@tempa{*}\caption@@withoptargs{#1}}%
+ {\def\caption@tempa{}\caption@@withoptargs{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@withoptargs#1{%
+ \@ifnextchar[%]
+ {\caption@@@withoptargs{#1}}%
+ {\caption@@@@withoptargs{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@withoptargs#1[#2]{%
+ \l@addto@macro\caption@tempa{[{#2}]}%
+ \caption@@withoptargs{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@@withoptargs#1{%
+ \def\caption@tempb{#1}%
+ \expandafter\caption@tempb\expandafter{\caption@tempa}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@gobble}
+% \changes{v1.4}{2011/08/19}{This macro added}
+% |\caption@gobble*|\oarg{arg}\oarg{\ldots}\marg{arg}\par
+% Same as |\@gobble|, but gobbles optional arguments as well.
+% \begin{macrocode}
+\DeclareRobustCommand*\caption@gobble{%
+ \caption@withoptargs\@gobbletwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@AtBeginDocument}
+% \changes{v1.1}{2007/04/13}{This macro and its usage added}
+% \changes{v1.2e}{2010/01/09}{Adapted to the combine document class}
+% |\caption@AtBeginDocument*|\marg{code}\\
+% Same as |\AtBeginDocument| but the execution of code
+% will be surrounded by two |\PackageInfo|s.
+% The starred variant causes the code to be executed after all code
+% specified using the non-starred variant.
+% \begin{macrocode}
+\let\caption@begindocumenthook\@empty
+\let\caption@@begindocumenthook\@empty
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@AtBeginDocument{%
+ \caption@teststar\g@addto@macro
+ \caption@@begindocumenthook\caption@begindocumenthook}
+%\@onlypreamble\caption@AtBeginDocument
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{%
+ \caption@InfoNoLine{Begin \noexpand\AtBeginDocument code}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}%
+ \caption@begindocumenthook
+ \let\caption@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar\@firstofone\@firstofone}%
+ \caption@@begindocumenthook
+ \let\caption@@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@InfoNoLine{End \noexpand\AtBeginDocument code}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Information, Warnings, and Errors}
+%
+% \begin{macro}{\caption@Info}
+% \changes{v1.3}{2010/10/25}{Moved from package to kernel}
+% |\caption@Info|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Info[1]{%
+ \PackageInfo{caption}{#1}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@InfoNoLine}
+% \changes{v1.3}{2010/10/25}{Moved from package to kernel}
+% |\caption@InfoNoLine|\marg{message}\\
+% \Note{The \cs{@gobble} at the end of the 2nd argument of
+% \cs{PackageInfo} suppresses the line number info.
+% See TLC2\cite{TLC2}, A.4.7, p885 for details.}
+% \begin{macrocode}
+\newcommand*\caption@InfoNoLine[1]{%
+ \caption@Info{#1\@gobble}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@Warning}
+% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% |\caption@Warning|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Warning[1]{%
+ \caption@WarningNoLine{#1\on@line}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@WarningNoLine}
+% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% |\caption@WarningNoLine|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@WarningNoLine[1]{%
+ \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@wh{%
+ See the caption package documentation for explanation.}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@Error}
+% \changes{v1.0j}{2007/01/20}{This macro added, will now be used for errors}
+% \changes{v1.0o}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}}
+% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed}
+% |\caption@Error|\marg{message}
+% \begin{macrocode}
+\newcommand*\caption@Error[1]{%
+ \PackageError{caption}{#1}\caption@eh}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@eh{%
+ If you do not understand this error, please take a closer look\MessageBreak
+ at the documentation of the `caption' package, especially the\MessageBreak
+ section about errors.\MessageBreak\@ehc}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@KV@err}
+% \changes{v1.1b}{2007/09/18}{This macro added}
+% \begin{macrocode}
+\let\caption@KV@err\caption@Error
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Using the keyval package}
+%
+% We need the \package{keyval} package for option handling, so we load it here.
+% \begin{macrocode}
+\RequirePackage{keyval}[1997/11/10]
+% \end{macrocode}
+%
+% \begin{macro}{\undefine@key}
+% |\undefine@key|\marg{family}\marg{key}\par
+% This helper macro is the opposite of |\define@key|, it removes a keyval
+% definition.
+% \begin{macrocode}
+\providecommand*\undefine@key[2]{%
+ \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@onlypreamble@key}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \changes{v1.1e}{2007/11/01}{\cs{KV@err} will be used now instead of \cs{@notprerr}}
+% |\onlypreamble@key|\marg{family}\marg{key}\par
+% Analogous to |\@onlypreamble| from \LaTeXe.
+% \begin{macrocode}
+\providecommand*\@preamble@keys{}
+\providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}}
+\@onlypreamble\@onlypreamble@key
+\@onlypreamble\@preamble@keys
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}%
+ \@preamble@keys
+ \let\@elt\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOption}
+% |\DeclareCaptionOption|\marg{option}\oarg{default value}\marg{code}\\
+% |\DeclareCaptionOption*|\marg{option}\oarg{default value}\marg{code}\par
+% We declare our options using these commands (instead of using
+% |\DeclareOption| offered by \LaTeXe), so the keyval package is used.
+% The starred form makes the option available during the lifetime of the
+% current package only, so they can be used with |\usepackage|, but
+% \emph{not} with |\captionsetup| later on.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOption{%
+ \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareoption[2]{%
+ #1{\undefine@key{caption}{#2}}\caption@declare@option{#2}}
+\@onlypreamble\caption@declareoption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declare@option{%
+ \define@key{caption}}
+%% no \@onlypreamble\caption@declare@option, will be used by \captionsetup
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOptionNoValue}
+% \changes{v1.1c}{2007/10/06}{This macro added}
+% |\DeclareCaptionOptionNoValue|\marg{option}\marg{code}\\
+% |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\par
+% Same as \cs{DeclareCaptionOption} but issues an error if a value is given.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOptionNoValue{%
+ \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOptionNoValue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declareoption@novalue[3]{%
+ \caption@declareoption{#1}{#2}[\KV@err]{%
+ \caption@option@novalue{#2}{##1}{#3}}}
+\@onlypreamble\caption@declareoption@novalue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@option@novalue[2]{%
+ \ifx\KV@err#2%
+ \expandafter\@firstofone
+ \else
+ \KV@err{No value allowed for #1}%
+ \expandafter\@gobble
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifcaptionsetup@star}
+% \changes{v1.2a}{2008/01/12}{This macro added}
+% If the starred form of |\captionsetup| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@setkeys|.)
+% \begin{macrocode}
+\newif\ifcaptionsetup@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionsetup}
+% \changes{v1.0a}{2004/01/17}{Bugfix: Missing \% added}
+% \changes{v1.1}{2007/07/22}{Starred-variant added}
+% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v1.2a}{2008/01/12}{\cs{ifcaptionsetup@star} will be set now}
+% \changes{v1.5}{2012/04/09}{Support of multiple optional arguments added}
+% \changes{v1.8h}{2020/01/03}{Syntax check of saved options added}
+% |\captionsetup|\oarg{type}\ldots\marg{keyval-list of options}\\
+% |\captionsetup*|\oarg{type}\ldots\marg{keyval-list of options}\par
+% If the optional argument `type' is specified, we simply save or append
+% the option list, otherwise we `execute' it with |\setkeys|.
+% (The non-starred variant issues a warning if \meta{keyval-list of options}
+% is not used later on.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\captionsetup{%
+ \caption@teststar@\@captionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionsetup[1]{%
+ \captionsetup@startrue#1\captionsetup@starfalse
+ \@ifnextchar[%]
+ \caption@setup@options\caption@setup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup{\caption@setkeys{caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@setup@options[#1]{%
+ \@ifnextchar[%]
+ {\caption@stepthecounter
+ \caption@withoptargs{\@expandtwoargs
+ \caption@setup@options@i{#1}{@\caption@thecounter}}}%
+ {\caption@setup@options@{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup@options@i[4]{%
+ \caption@declare@option{#2}[]{\captionsetup#3{#4}}%
+ \caption@setup@options@{#1}{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup@options@[2]{%
+ \@bsphack
+ \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi
+ \caption@checkoptions{#2}%
+ \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checkoptions}
+% \changes{v1.8h}{2020/01/03}{This macro added}
+% Check the syntax of the given options by executing them inside a group.
+% \begin{macrocode}
+\newcommand*\caption@checkoptions[1]{%
+ \begingroup
+ \caption@prepare@optioncheck
+ \caption@setup{#1}%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@prepare@optioncheck{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\IfCaptionOptionCheck}
+% \changes{v1.10}{2020/05/10}{This macro added}
+% |\IfCaptionOptionCheck|\marg{yes-code}\marg{no-code}
+% executes the \meta{yes-code} if options are just checked for syntax, and \meta{no-code} if not.
+% \begin{macrocode}
+\let\IfCaptionOptionCheck\@secondoftwo
+% \end{macrocode}
+% \begin{macrocode}
+\g@addto@macro\caption@prepare@optioncheck{%
+ \let\IfCaptionOptionCheck\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\clearcaptionsetup}
+% \changes{v1.1}{2007/07/29}{Optional argument added}
+% \changes{v1.1}{2007/08/17}{Starred variant added}
+% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\clearcaptionsetup|\oarg{option}\marg{type}\\
+% |\clearcaptionsetup*|\oarg{option}\marg{type}\par
+% This removes the saved option list associated with \meta{type}.
+% If \meta{option} is given, only this option will be removed from the list.
+% (The starred variant does not issue warnings.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\clearcaptionsetup{%
+ \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@clearcaptionsetup[1]{%
+ \let\caption@tempa#1%
+ \@testopt\@@clearcaptionsetup{}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@@clearcaptionsetup[#1]#2{%
+ \@bsphack
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}%
+ {\ifx,#1,%
+ \caption@clearsetup{#2}%
+ \else
+ \caption@@removefromsetup{#1}{#2}%
+ \fi}%
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@clearsetup[1]{%
+ \caption@removefromoptlist{#1}%
+ \@nameundef{caption@opt@#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromsetup{%
+ \let\caption@tempa\@gobble
+ \caption@@removefromsetup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@removefromsetup[2]{%
+ \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname
+ \expandafter\let\csname caption@opt@#2\endcsname\@undefined
+ \def\@tempb##1=##2\@nil{##1}%
+ \edef\@tempc{#1}%
+ \@for\@tempa:=\@tempa\do{%
+ \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}%
+ \ifx\@tempd\@tempc
+ \let\caption@tempa\@gobble
+ \else
+ \expandafter\expandafter\expandafter\caption@l@addto@list
+ \expandafter\csname caption@opt@#2\expandafter\endcsname
+ \expandafter{\@tempa}%
+ \fi}%
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@removefromoptlist{#2}}{}%
+ \caption@tempa{\caption@Warning{%
+ Option `#1' was not in list `#2'}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\showcaptionsetup}
+% \changes{v1.0d}{2005/05/03}{Optimized for memory usage}
+% \changes{v1.1}{2007/07/29}{Bugfix: Does not expand option list anymore}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\showcaptionsetup|\oarg{package}\marg{type}\par
+% This comes for debugging issues: It shows the saved option list which
+% is associated with \meta{type}.
+% \begin{macrocode}
+\newcommand*\showcaptionsetup[2][\@firstofone]{%
+ \@bsphack
+ \GenericWarning{}{%
+ #1 Caption Info: Option list on `#2'\MessageBreak
+ #1 Caption Data: \@ifundefined{caption@opt@#2}{%
+ -none-%
+ }{%
+ {\expandafter\expandafter\expandafter\strip@prefix
+ \expandafter\meaning\csname caption@opt@#2\endcsname}%
+ }}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.1}{2007/07/02}{Option \opt{options=} added}
+% \changes{v1.3}{2010/09/05}{Option \opt{options*=} added}
+% \changes{v1.4b}{2012/01/12}{Option \opt{options*=} removed}
+% \begin{macrocode}
+\DeclareCaptionOption{options}{\caption@setoptions{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setoptions}
+% \changes{v1.0g}{2006/01/03}{Optional argument added}
+% \changes{v1.0h}{2006/01/26}{Revised}
+% \changes{v1.0j}{2007/01/30}{Optional argument removed}
+% \changes{v1.1}{2007/04/11}{Usage of \cs{clearcaptionsetup} added}
+% \changes{v1.1}{2007/05/09}{Renamed from \cs{caption@settype} to \cs{caption@setoptions}}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% \changes{v1.3}{2010/09/05}{Starred variant added}
+% \changes{v1.4b}{2012/01/12}{Starred variant removed}
+% |\caption@setoptions|\marg{type or environment or\ldots}\par
+% Caption options which have been saved with |\captionsetup|\oarg{type} can
+% be executed by using this command.
+% It simply executes the saved option list (and clears it afterwards),
+% if there is any.
+% \iffalse
+% (The starred variant do not clear the option list.)
+% \fi
+% \begin{macrocode}
+\newcommand*\caption@setoptions[1]{%
+ \caption@Debug{options=#1}%
+ \expandafter\let\expandafter\caption@opt\csname caption@opt@#1\endcsname
+ \ifx\caption@opt\relax \else
+ \caption@xsetup\caption@opt
+ \caption@clearsetup{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtooptlist}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \begin{macro}{\caption@removefromoptlist}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \changes{v1.2c}{2008/08/24}{Fatal typo corrected}
+% |\caption@addtooptlist|\marg{type}\\
+% |\caption@removefromoptlist|\marg{type}\par
+% Adds or removes an \meta{type} to the list of unused caption options.
+% Note that the catcodes of \meta{type} are sanitized here so removing
+% \meta{type} from the list do not fail when the \package{float} package
+% is used (since |\float@getstyle| gives a result which tokens have catcode
+% 12 $=$ ``other'').
+% \begin{macrocode}
+\newcommand*\caption@addtooptlist[1]{%
+ \@ifundefined{caption@opt@#1@lineno}{%
+ \caption@dooptlist\caption@g@addto@list{#1}%
+ \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}%
+ }{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromoptlist[1]{%
+ \caption@dooptlist\caption@g@removefrom@list{#1}%
+ \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@dooptlist[2]{%
+ \begingroup
+ \edef\@tempa{#2}\@onelevel@sanitize\@tempa
+ \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\AtEndDocument{%
+ \caption@for@list\caption@optlist{%
+ \caption@WarningNoLine{%
+ Unused \string\captionsetup[#1]
+ on input line \csname caption@opt@#1@lineno\endcsname}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@setkeys}
+% \changes{v1.0g}{2006/01/03}{This macro added}
+% \changes{v1.0j}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added}
+% \changes{v1.0j}{2007/01/30}{Optional argument added}
+% \changes{v1.0n}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter}
+% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed, we use \cs{caption@KV@err} instead}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v1.2a}{2008/01/12}{\cs{captionsetup@starfalse} added}
+% \changes{v1.2d}{2009/09/30}{Bugfix 09-09-29: Missing error handler will be defined automatically}
+% \changes{v1.4}{2011/08/24}{Redefinition of \cs{XKV@err} added}
+% |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\par
+% This one simply calls |\setkeys|\marg{family}\marg{key-values}
+% but lets the error messages not refer to the \package{keyval} package,
+% but to the \meta{package} package instead.
+% \begin{macrocode}
+\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@setkeys[#1]#2#3{%
+ \@bsphack
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err
+ \expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx
+ \expandafter\let\csname ORI@XKV@err\caption@keydepth\endcsname\XKV@err
+ \edef\caption@keydepth{\caption@keydepth i}%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname
+ \ifx\KV@err\relax
+ \def\KV@err##1{\PackageError{#1}{##1}{%
+ See the #1 package documentation for explanation.}}%
+ \fi
+ \def\KV@errx{\KV@err}%
+ \def\XKV@err{\let\@tempa\XKV@tkey\KV@err}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{\protect\setkeys{#2}{#3}}%
+ \setkeys{#2}{#3}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}%
+ \expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname
+ \expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname
+ \expandafter\let\expandafter\XKV@err\csname ORI@XKV@err\caption@keydepth\endcsname
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@keydepth\@empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ExecuteOptions}
+% \changes{v1.1}{2007/07/15}{This macro added}
+% \changes{v1.3}{2010/09/04}{Depends on package now}
+% |\caption@ExecuteOptions|\marg{package}\marg{key-values}\par
+% We execute our options using the keyval interface, so we use this one
+% instead of |\ExecuteOptions| offered by \LaTeXe.
+% \begin{macrocode}
+\newcommand*\caption@ExecuteOptions[2]{%
+ \expandafter\@expandtwoargs\csname caption@setkeys@#1\endcsname{#1}{#2}}%
+\@onlypreamble\caption@ExecuteOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ProcessOptions}
+% \changes{v1.0a}{2004/01/23}{Bugfix, see
+% \purett{news:400D360C.9678329F@gmx.net} for details}
+% \changes{v1.0g}{2006/01/03}{Improvement, uses \cs{caption@setkeys}
+% instead of \cs{setkeys}}
+% \changes{v1.0h}{2006/02/23}{Bugfix, now processes only those global
+% options which have a default value}
+% \changes{v1.0j}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to
+% \cs{caption@ProcessOptions} and moved from the package to the kernel}
+% \changes{v1.1}{2007/04/17}{Star variant added}
+% |\caption@ProcessOptions*|\marg{package}\par
+% We process our options using the keyval package, so we use this one
+% instead of |\ProcessOptions| offered by \LaTeXe.
+% The starred variant do not process the global options.
+% (This code was taken from the \package{hyperref} package\cite{hyperref}
+% \version{6.74} and improved.)
+% \begin{macrocode}
+\newcommand*\caption@ProcessOptions{%
+ \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone}
+\@onlypreamble\caption@ProcessOptions
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@ProcessOptions[2]{%
+ \let\@tempc\relax
+ \let\caption@tempa\@empty
+ #1{% \@firstofone -or- \@gobble
+ \@for\CurrentOption:=\@classoptionslist\do{%
+ \@ifundefined{KV@#2@\CurrentOption}{}{%
+ \@ifundefined{KV@#2@\CurrentOption @default}{%
+ \PackageInfo{#2}{Global option `\CurrentOption' ignored}%
+ }{%
+ \PackageInfo{#2}{Global option `\CurrentOption' processed}%
+ \edef\caption@tempa{\caption@tempa\CurrentOption,}%
+ \@expandtwoargs\@removeelement\CurrentOption
+ \@unusedoptionlist\@unusedoptionlist
+ }%
+ }%
+ }%
+ \let\CurrentOption\@empty
+ }%
+ \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}%
+ \AtEndOfPackage{\let\@unprocessedoptions\relax}}
+\@onlypreamble\caption@@ProcessOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@SetupOptions}
+% \changes{v1.3}{2010/09/04}{This macro added}
+% |\caption@SetupOptions|\marg{package}\marg{code}\par
+% After calling this macro |\caption@ExecuteOptions| and
+% |\usepackage|\oarg{options}\marg{package}
+% will both be mapped to \meta{code} with \meta{package} and \meta{options}
+% as arguments |#1| and |#2|. (This helps avoiding ``Option clash'' errors.)
+% \begin{macrocode}
+\newcommand\caption@SetupOptions[2]{%
+ \@namedef{caption@setkeys@#1}##1##2{#2}%
+ \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname
+ \@cons\caption@SetupOptions@list{{#1}}}
+\@onlypreamble\caption@SetupOptions
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@SetupOptions@list{}
+\@onlypreamble\caption@SetupOptions@list
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@onefilewithoptions\@onefilewithoptions
+\def\@onefilewithoptions#1[#2]{%
+ \begingroup
+ \def\@tempa{%
+ \endgroup
+ \caption@onefilewithoptions{#1}[{#2}]}%
+ \def\@tempb{#1}%
+ \def\@elt##1{%
+ \def\@tempc{##1}%
+ \ifx\@tempb\@tempc
+ \def\@tempa{%
+ \endgroup
+ \caption@ExecuteOptions{#1}{#2}%
+ \caption@onefilewithoptions{#1}[]}%
+ \fi}
+ \caption@SetupOptions@list
+ \@tempa}
+\@onlypreamble\caption@onefilewithoptions
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Margin resp. width}
+% \changes{v1.0n}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}}
+% \changes{v1.0n}{2007/04/03}{Option `twoside' added}
+% \changes{v1.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added}
+% \changes{v1.2}{2007/11/10}{Option `oneside' added}
+%
+% \begin{macro}{\captionmargin}
+% \begin{macro}{\captionwidth}
+% |\captionmargin| and |\captionwidth| contain the extra margin
+% resp. the total width used for captions. Please never set these values in
+% a direct way, they are just accessible in user documents to provide
+% compatibility to \version{1.x}.\par
+% Note that we can only set one value at a time, `margin' \emph{or} `width'.
+% If |\captionwidth| is not zero we will take this value afterwards,
+% otherwise |\captionmargin| and |\captionmargin@|.
+% \begin{macrocode}
+\newdimen\captionmargin
+\newdimen\captionmargin@
+\newdimen\captionwidth
+\newdimen\caption@tempdima
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
+\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}}
+\DeclareCaptionOption{width}{\setcaptionwidth{#1}}
+\DeclareCaptionOption{width*}{\setcaptionwidth*{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{calcmargin}{\caption@setcalcmargin{#1}}
+\DeclareCaptionOption{calcmargin*}{\caption@setcalcmargin*{#1}}
+\DeclareCaptionOption{calcwidth}{\caption@setcalcwidth{#1}}
+\DeclareCaptionOption{calcwidth*}{\caption@setcalcwidth*{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}}
+\DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}}
+\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\setcaptionmargin}
+% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
+% \changes{v1.0f}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take
+% left+right margin}
+% \changes{v1.1}{2007/08/11}{Starred variant added}
+% \changes{v1.1}{2007/08/12}{\cs{setlength}\cs{captionmargin} \&
+% \cs{setlength}\cs{captionmargin@} swapped so
+% `\texttt{margin*=}\cs{captionmargin}' works in singleline options}
+% \changes{v1.3}{2010/11/07}{Support for option \opt{calcmargin} added}
+% |\setcaptionmargin|\marg{amount}\\
+% |\setcaptionmargin*|\marg{amount}\par
+% Please never use this in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionmargin{%
+ \caption@resetcalcmargin
+ \caption@setmargin}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setmargin{%
+ \caption@teststar\caption@@setmargin\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setmargin[2]{%
+ #1{\captionwidth\z@}%
+ \caption@@@setmargin#2,#2,\@nil}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@setmargin#1,#2,#3\@nil{%
+ \setlength\captionmargin@{#2}%
+ \setlength\captionmargin{#1}%
+ \addtolength\captionmargin@{-\captionmargin}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionwidth}
+% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
+% \changes{v1.3}{2010/11/07}{Starred variant added}
+% \changes{v1.3}{2010/11/07}{Support for option \opt{calcwidth} added}
+% |\setcaptionwidth|\marg{amount}\\
+% |\setcaptionwidth*|\marg{amount}\par
+% Please never use this in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionwidth{%
+ \caption@resetcalcmargin
+ \caption@setwidth}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setwidth{%
+ \caption@teststar\caption@@setwidth\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setwidth[2]{%
+ #1{\captionmargin\z@\captionmargin@\z@}%
+ \setlength\captionwidth{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetcalcmargin}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@resetcalcmargin{%
+ \let\caption@calcmargin@hook\@empty}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setcalcmargin}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setcalcmargin{%
+ \caption@teststar{\caption@@setcalcmargin\caption@setmargin}%
+ \@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setcalcmargin[3]{%
+ #2{\caption@resetcalcmargin
+ \l@addto@macro\caption@calcmargin@hook{#1{#3}}}%
+ {\l@addto@macro\caption@calcmargin@hook{#1*{#3}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setcalcwidth}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setcalcwidth{%
+ \caption@teststar{\caption@@setcalcmargin\caption@setwidth}%
+ \@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@counter}
+% \changes{v1.0n}{2007/04/03}{This counter added}
+% \changes{v1.1e}{2007/10/28}{Renamed to \cs{caption@thecounter}; \cs{caption@stepcounter} added}
+% \changes{v1.5}{2012/04/09}{\cs{caption@stepcounter} renamed to \cs{caption@stepthecounter}}
+% Internal counter. At the moment it will be used inside
+% |\caption@ifoddpage| only.
+% \begin{macrocode}
+\newcommand*\caption@thecounter{0}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@stepthecounter{%
+ \@tempcnta\caption@thecounter
+ \advance\@tempcnta\@ne
+ \xdef\caption@thecounter{\the\@tempcnta}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@newlabel}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% This command is a modified version of |\newlabel| from \LaTeX2e.
+% It will be written to the \texttt{.aux} file to
+% pass label information from one run to another.
+% (We use it inside |\caption@ifoddpage| and |\caption@ragged|.)
+% \begin{macrocode}
+\newcommand*\caption@newlabel{\@newl@bel{caption@r}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@thepage}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% This command is a modified version of |\thepage| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| only.
+% \begin{macrocode}
+\newcommand*\caption@thepage{\the\c@page}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@label}
+% \changes{v1.1}{2007/09/01}{This macro added}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@newlabel} in AUX file added}
+% This command is a modified version of |\label| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
+% \begin{macrocode}
+\newcommand*\caption@label[1]{%
+ \caption@@label
+ \protected@write\@auxout{\let\caption@thepage\relax}%
+ {\string\caption@newlabel{#1}{\caption@thepage}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@label{%
+ \global\let\caption@@label\relax
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@newlabel[2]{}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@pageref}
+% \changes{v1.1}{2007/09/01}{This macro added}
+% \changes{v1.2d}{2009/10/09}{Uses \cs{@latex@warning} instead of \cs{caption@Warning} now}
+% This command is a modified version of |\pageref| from \LaTeX2e.
+% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|.
+% \begin{macrocode}
+\newcommand*\caption@pageref[1]{%
+ \expandafter\ifx\csname caption@r@#1\endcsname\relax
+ \G@refundefinedtrue % => 'There are undefined references.'
+ \@latex@warning{Reference `#1' on page \thepage \space undefined}%
+ \else
+ \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifoddpage}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% \changes{v1.1e}{2007/10/28}{Incrementation of counter moved to \cs{caption@@make}}
+% At the moment this macro uses an own label\ldots ref mechanism,
+% but an alternative implementation method would be using the
+% \package{refcount} package\cite{refcount} and |\ifodd\getpagerefnumber{|\ldots|}|.
+% \Note{This macro re-defines itself so the \texttt{.aux} file will
+% only be used once per group.}
+% \begin{macrocode}
+\newcommand*\caption@ifoddpage{%
+ \caption@iftwoside{%
+ \caption@label\caption@thecounter
+ \caption@pageref\caption@thecounter
+ \ifodd\caption@thepage
+ \let\caption@ifoddpage\@firstoftwo
+ \else
+ \let\caption@ifoddpage\@secondoftwo
+ \fi
+ }{\let\caption@ifoddpage\@firstoftwo}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifoddpage}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setoptcmd}
+% \changes{v1.1}{2007/08/11}{This macro added}
+% |\caption@setoptcmd|\marg{cmd}\marg{off -or- value}
+% \begin{macrocode}
+\newcommand*\caption@setoptcmd[2]{%
+ \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Indentions}
+%
+% \begin{macro}{\caption@indent}
+% \changes{v1.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}}
+% \begin{macro}{\caption@parindent}
+% \begin{macro}{\caption@hangindent}
+% These are the indentions we support.
+% \begin{macrocode}
+\newdimen\caption@indent
+\newdimen\caption@parindent
+\newdimen\caption@hangindent
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v1.0b}{2004/05/16}{Defaults added for options \opt{parindent=}
+% and \opt{hangindent=}}
+% \changes{v1.0f}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption}
+% replaced by \cs{caption@@par}}
+% \changes{v1.0f}{2005/08/22}{Undocumented defaults for \opt{parindent=},
+% \opt{hangindent=}, and \opt{parskip=} removed}
+% \begin{macrocode}
+\DeclareCaptionOption{indent}[\leftmargini]{% obsolete!
+ \setlength\caption@indent{#1}}
+\DeclareCaptionOption{indention}[\leftmargini]{%
+ \setlength\caption@indent{#1}}
+\DeclareCaptionOption{parindent}{%
+ \setlength\caption@parindent{#1}}
+\DeclareCaptionOption{hangindent}{%
+ \setlength\caption@hangindent{#1}}
+\DeclareCaptionOption{parskip}{%
+ \l@addto@macro\caption@@par{\setlength\parskip{#1}}}
+% \end{macrocode}
+%
+% \section{Styles}
+%
+% \begin{macro}{\DeclareCaptionStyle}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
+% between arguments do make any harm}
+% |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionStyle[1]{%
+ \@testopt{\caption@declarestyle{#1}}{}}
+\@onlypreamble\DeclareCaptionStyle
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@declarestyle#1[#2]#3{%
+ \global\@namedef{caption@sls@#1}{#2}%
+ \global\@namedef{caption@sty@#1}{#3}}
+\@onlypreamble\caption@declarestyle
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2a}{2008/01/20}{Option \opt{style*=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{style}{\caption@setstyle{#1}}
+\DeclareCaptionOption{style*}{\caption@setstyle*{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setstyle}
+% \changes{v1.0e}{2005/06/01}{Starred variant added}
+% \changes{v1.1}{2007/07/29}{Recursive style definitions should work now}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% |\caption@setstyle|\marg{name}\\
+% |\caption@setstyle*|\marg{name}\par
+% Selecting a caption style means saving the additional
+% \meta{single-line-list-of-KV} (this will be done by |\caption@sls|),
+% resetting the caption options to the base ones (this will be done using
+% |\caption@resetstyle|) and executing the \meta{list-of-KV} options
+% (this will be done using |\caption@setup|).\par
+% The starred version will give no error message if the given style is not
+% defined.
+% \begin{macrocode}
+\newcommand*\caption@setstyle{%
+ \caption@teststar\caption@@setstyle\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setstyle[2]{%
+ \@ifundefined{caption@sty@#2}%
+ {#1{\caption@Error{Undefined style `#2'}}}%
+ {\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname
+ \ifx\caption@setstyle@flag\@undefined
+ \let\caption@setstyle@flag\relax
+ \caption@resetstyle
+ \caption@xsetup\caption@sty
+ \let\caption@setstyle@flag\@undefined
+ \else
+ \caption@xsetup\caption@sty
+ \fi
+ \expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
+ \expandafter\caption@l@addto@list\expandafter\caption@opt@singleline
+ \expandafter{\caption@sls}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetstyle}
+% \changes{v1.1}{2007/02/04}{%
+% This macro renamed from \cs{caption@setdefault} to \cs{caption@resetstyle}}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.2}{2007/11/17}{Usage of \opt{size=} added}
+% \changes{v1.2b}{2008/05/06}{Usage of \opt{rule} added}
+% \changes{v1.5}{2012/03/15}{\opt{box=parbox} added}
+% \changes{v1.6}{2013/05/01}{\opt{box=none} added, \opt{box=parbox} changed to \opt{parbox=parbox}}
+% This resets (nearly) all caption options to the base ones.
+% \emph{Note that this does not touch the skips and the positioning!}
+% \begin{macrocode}
+\newcommand*\caption@resetstyle{%
+ \caption@setup{%
+ box=none,boxcolor=white,parbox=parbox,%
+ format=plain,labelformat=default,labelsep=colon,textformat=simple,%
+ justification=justified,font=,size=,labelfont=,textfont=,%
+ margin=0pt,minmargin=0,maxmargin=0,%
+ indent=0pt,parindent=0pt,hangindent=0pt,%
+ slc,rule,strut}%
+ \caption@clearsetup{singleline}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
+% \changes{v1.1}{2007/02/04}{Caption style `default' renamed to `base', and a new `default' added}
+% \changes{v1.1}{2007/03/31}{\opt{format=plain} added to caption style \opt{default}}
+% \changes{v1.1c}{2007/10/14}{\opt{format=plain} removed from caption style \opt{default}}
+% \changes{v1.5}{2012/03/15}{\opt{box=default} added to caption style \opt{default}}
+% Currently there are two pre-defined styles, called `base' \& `default'.
+% The first one is a perfect match to the behavior of |\@makecaption| offered
+% by the standard \LaTeX\ document classes (and was called `default' in
+% \thispackage\ \version{1.0}), the second one matches the document
+% class actually used.
+% \begin{macrocode}
+\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{}
+\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{%
+ box=default,format=default,labelsep=default,textformat=default,%
+ justification=default,font=default,labelfont=default,textfont=default}
+% \end{macrocode}
+%
+% \changes{v1.2b}{2008/05/06}{Option \opt{slc=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}}
+\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}}
+% \end{macrocode}
+%
+% \section{Boxes}
+%
+% \begin{macro}{\DeclareCaptionBox}
+% \changes{v1.5}{2012/03/15}{This macro added}
+% |\DeclareCaptionBox|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionBox[2]{%
+ \global\long\@namedef{caption@box@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionBox
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.5}{2012/03/15}{Option \opt{box=} added}
+% \changes{v1.6}{2013/05/01}{Option \opt{parbox=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{box}{\caption@setbox{#1}}
+\DeclareCaptionOption{parbox}{\caption@set@box\caption@parbox{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setbox}
+% |\caption@setbox|\marg{name}\par
+% Selecting a caption box simply means saving the code (in |\caption@box|).
+% \begin{macrocode}
+\newcommand*\caption@setbox{%
+ \caption@set@box\caption@box}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@box[2]{%
+ \@ifundefined{caption@box@#2}%
+ {\caption@Error{Undefined box `#2'}}%
+ {\expandafter\let\expandafter#1\csname caption@box@#2\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are four pre-defined boxes, called `empty', `none',
+% `parbox', and `colorbox'.
+% \changes{v1.0i}{2006/05/13}{We define \cs{captionbox} instead of
+% \cs{caption@start/endbox}}
+% \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{captionbox} changed from
+% \cs{parbox-t} to \cs{parbox-b}}
+% \changes{v1.2}{2007/11/11}{\cs{captionbox} renamed to \cs{caption@parbox}}
+% \changes{v1.5}{2012/03/15}{\cs{caption@parbox} adapted to \cs{DeclareCaptionBox}}
+% \changes{v1.6}{2013/05/02}{Option \opt{boxsep=} added}
+% \begin{macrocode}
+\DeclareCaptionBox{empty}{}
+\DeclareCaptionBox{none}{#2}
+\DeclareCaptionBox{parbox}{\parbox[b]{#1}{#2}}
+%\DeclareCaptionBox{colorbox}{%
+% \colorbox{\caption@boxcolor}{\caption@box@parbox{\dimexpr #1-2\fboxsep}{#2}}}
+\DeclareCaptionBox{colorbox}{\colorbox{\caption@boxcolor}{%
+ \setlength\caption@tempdima{#1}%
+ \addtolength\caption@tempdima{-2\fboxsep}%
+ \linewidth\caption@tempdima
+ \hsize\caption@tempdima
+ #2}}
+\DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}}
+\DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}}
+% \end{macrocode}
+%
+% `default' usually maps to `none`.
+% \begin{macrocode}
+\def\caption@box@default{\caption@box@none}
+% \end{macrocode}
+%
+% \section{Formats}
+%
+% \begin{macro}{\DeclareCaptionFormat}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces
+% between arguments do make any harm}
+% \changes{v1.0c}{2005/02/09}{Starred variant added}
+% \changes{v1.1c}{2007/10/15}{Optional argument added}
+% |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\
+% |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par
+% The starred form causes the code being typeset in vertical (instead of
+% horizontal) mode, but does not support the |indention=| option.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFormat{%
+ \caption@teststar\caption@declareformat\@gobble\@firstofone}
+\@onlypreamble\DeclareCaptionFormat
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareformat[2]{%
+ \@dblarg{\caption@@declareformat#1{#2}}}
+\@onlypreamble\caption@declareformat
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@declareformat#1#2[#3]#4{%
+ \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
+ \global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}%
+ \global\long\@namedef{caption@fmt@#2}##1##2##3{#4}}
+\@onlypreamble\caption@@declareformat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{format}{\caption@setformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setformat}
+% |\caption@setformat|\marg{name}\par
+% Selecting a caption format simply means saving the code (in |\caption@fmt|)
+% and if the code should be used in horizontal or vertical mode (|\caption@ifh|).
+% \begin{macrocode}
+\newcommand*\caption@setformat[1]{%
+ \@ifundefined{caption@fmt@#1}%
+ {\caption@Error{Undefined format `#1'}}%
+ {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
+ \expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname
+ \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultFormat}
+% \changes{v1.2a}{2008/01/31}{This macro added}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultFormat[1]{%
+ \expandafter\def\expandafter\caption@fmt@default\expandafter
+ {\csname caption@fmt@#1\endcsname}%
+ \expandafter\def\expandafter\caption@slfmt@default\expandafter
+ {\csname caption@slfmt@#1\endcsname}%
+ \expandafter\def\expandafter\caption@ifh@default\expandafter
+ {\csname caption@ifh@#1\endcsname}}
+\@onlypreamble\DeclareCaptionDefaultFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0a}{2004/01/23}{%
+% Caption format \opt{default} renamed to \opt{normal}}
+% \changes{v1.0e}{2005/05/12}{%
+% Caption format \opt{normal} renamed to \opt{@normal}}
+% \changes{v1.0f}{2005/08/25}{%
+% Caption format \opt{@normal} renamed to \opt{plain} and documented}
+% \changes{v1.1c}{2007/10/14}{%
+% Single-line variant of caption format \opt{hang} added}
+% There are two pre-defined formats, called `plain' and `hang'.
+% \begin{macrocode}
+\DeclareCaptionFormat{plain}{#1#2#3\par}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionFormat{hang}[#1#2#3\par]{%
+ \caption@ifin@list\caption@lsepcrlist\caption@lsepname
+ {\caption@Error{%
+ The option `labelsep=\caption@lsepname' does not work\MessageBreak
+ with `format=hang'}}%
+ {\@hangfrom{#1#2}%
+ \advance\caption@parindent\hangindent
+ \advance\caption@hangindent\hangindent
+ \caption@@par#3\par}}
+% \end{macrocode}
+%
+% \changes{v1.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{plain}}
+% \changes{v1.0d}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added}
+% `default' usually maps to `plain'.
+% \begin{macrocode}
+\DeclareCaptionDefaultFormat{plain}
+% \end{macrocode}
+%
+% \section{Label formats}
+%
+% \begin{macro}{\DeclareCaptionLabelFormat}
+% \changes{v1.0a}{2004/01/17}{%
+% Pass through argument \#2 so extra spaces between arguments do make any harm}
+% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionLabelFormat[2]{%
+ \global\@namedef{caption@lfmt@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionLabelFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelformat}
+% |\caption@setlabelformat|\marg{name}\par
+% Selecting a caption label format simply means saving the code (in |\caption@lfmt|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelformat[1]{%
+ \@ifundefined{caption@lfmt@#1}%
+ {\caption@Error{Undefined label format `#1'}}%
+ {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2}{2007/12/16}{Caption label format \opt{brace} added}
+% \changes{v1.7}{2015/09/16}{Caption label format \opt{autodot} added}
+% \changes{v1.7}{2016/05/22}{Caption label format \opt{autodot} fixed}
+% \changes{v1.8}{2016/05/22}{Caption label format \opt{unnumbered} added}
+% There are six pre-defined label formats, called `empty', `simple',
+% `parens', `brace', `autodot', and `unnumbered'.
+% \begin{macrocode}
+\DeclareCaptionLabelFormat{empty}{}
+\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
+\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
+\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)}
+\DeclareCaptionLabelFormat{autodot}{\bothIfFirst{#1}{\nobreakspace}#2\autodot}
+\DeclareCaptionLabelFormat{unnumbered}{#1}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+% \begin{macrocode}
+\def\caption@lfmt@default{\caption@lfmt@simple}
+% \end{macrocode}
+%
+% \section{Label separators}
+%
+% \begin{macro}{\DeclareCaptionLabelSeparator}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
+% between arguments do make any harm}
+% \changes{v1.0f}{2005/08/25}{Starred variant added}
+% \changes{v1.1}{2007/07/13}{Test for CR added}
+% \changes{v1.3}{2011/08/06}{Test for CR revised}
+% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
+% |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par
+% The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|.
+% \begin{macrocode}
+\newcommand\DeclareCaptionLabelSeparator{%
+ \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone}
+\@onlypreamble\DeclareCaptionLabelSeparator
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declarelabelseparator[3]{%
+ \global\@namedef{caption@iflf@#2}{#1}%
+ \global\long\@namedef{caption@lsep@#2}{#3}%
+ \caption@@declarelabelseparator{#2}#3\\\@nil}
+\@onlypreamble\caption@declarelabelseparator
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@declarelabelseparator#1#2\\#3\@nil{%
+ \def\@tempa{#3}\ifx\@tempa\@empty \else
+ \caption@g@addto@list\caption@lsepcrlist{#1}%
+ \fi}
+\@onlypreamble\caption@@declarelabelseparator
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
+\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlabelseparator}
+% |\caption@setlabelseparator|\marg{name}\par
+% Selecting a caption label separator simply means saving the code (in |\caption@lsep|).
+% \begin{macrocode}
+\newcommand*\caption@setlabelseparator[1]{%
+ \@ifundefined{caption@lsep@#1}%
+ {\caption@Error{Undefined label separator `#1'}}%
+ {\edef\caption@lsepname{#1}%
+ \expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
+ \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0e}{2005/06/11}{Bugfix 05-03-23: Caption label separator
+% \opt{newline} implementation changed from \cs{newline} to \cs{\textbackslash}}
+% \changes{v1.0f}{2005/08/24}{Caption label separator \opt{endash} added}
+% There are seven pre-defined label separators, called `none', `colon', `period', `space',
+% `quad', `newline', and `endash'.
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{none}{}
+\DeclareCaptionLabelSeparator{colon}{: }
+\DeclareCaptionLabelSeparator{period}{. }
+\DeclareCaptionLabelSeparator{space}{ }
+\DeclareCaptionLabelSeparator*{quad}{\quad}
+\DeclareCaptionLabelSeparator*{newline}{\captionnewline}
+\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
+% \end{macrocode}
+%
+% \begin{macro}{\captionnewline}
+% \changes{v1.12}{2020/05/30}{This macro added}
+% Will be used in the caption label separator |new|\-|line|,
+% and re-defined for |long|\-|table| environments.
+% \begin{macrocode}
+\newcommand*\captionnewline{\\}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setdefaultlabelsep}
+% \changes{v1.2d}{2009/03/29}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setdefaultlabelsep[1]{%
+ \ifx\caption@lsep\caption@lsep@default
+ \caption@set@default@labelsep{#1}%
+ \caption@setlabelseparator{default}%
+ \else
+ \caption@set@default@labelsep{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@default@labelsep[1]{%
+ \def\caption@lsep@default{\@nameuse{caption@lsep@#1}}%
+ \def\caption@iflf@default{\@nameuse{caption@iflf@#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `colon'.
+% \begin{macrocode}
+\caption@set@default@labelsep{colon}
+% \end{macrocode}
+%
+% \section{Text formats}
+%
+% \begin{macro}{\DeclareCaptionTextFormat}
+% \changes{v1.0j}{2007/02/18}{This macro added}
+% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionTextFormat[2]{%
+ \global\long\@namedef{caption@tfmt@#1}##1{#2}}
+\@onlypreamble\DeclareCaptionTextFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{Option \opt{strut=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
+\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@settextformat}
+% \changes{v1.0j}{2007/02/18}{This macro added}
+% |\caption@settextformat|\marg{name}\par
+% Selecting a caption text format simply means saving the code (in |\caption@tfmt|).
+% \begin{macrocode}
+\newcommand*\caption@settextformat[1]{%
+ \@ifundefined{caption@tfmt@#1}%
+ {\caption@Error{Undefined text format `#1'}}%
+ {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are three pre-defined text formats, called `empty', `simple' and `period'.
+% \changes{v1.4}{2011/10/05}{Pre-defined text format `empty' added}
+% \changes{v1.7}{2015/09/16}{The text format `empty' now takes care of the \cs{label}}
+% \begin{macrocode}
+\DeclareCaptionTextFormat{empty}{%
+ \caption@get@label#1\caption@makeanchor{}\@nil
+ \caption@thelabel
+ \global\let\caption@thelabel\relax}
+\long\def\caption@get@label#1\caption@makeanchor#2#3\@nil{%
+ \def\caption@tempa{#2}%
+ \ifx\caption@tempa\@empty
+ \caption@getlabel#1\label{}\@nil
+ \else
+ \caption@getlabel#2\label{}\@nil
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionTextFormat{simple}{#1}
+\DeclareCaptionTextFormat{period}{#1.}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+% \begin{macrocode}
+\def\caption@tfmt@default{\caption@tfmt@simple}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@getlabel}
+% \changes{v1.0}{2011/09/03}{\cs{label} can have optional arguments now}
+% \changes{v1.7}{2015/09/16}{Moved from \package{bicaption} package to \package{caption3}}
+% \changes{v1.8d}{2019/09/01}{Bugfix: Global definition of \cs{caption@thelabel} added}
+% Gets the label command out of the (first) caption text and stores it to |\caption@thelabel|.
+% \begin{macrocode}
+\long\def\caption@getlabel#1\label#2#3\@nil{%
+ \def\@tempa{#2}%
+ \ifx\@tempa\@empty
+ \let\caption@thelabel\relax
+ \else
+ \def\@tempb{*}%
+ \ifx\@tempa\@tempb
+ \def\caption@thelabel{\label*}%
+ \caption@@getlabel#3\@nil
+ \else
+ \def\caption@thelabel{\label}%
+ \caption@@getlabel{#2}#3\@nil
+ \fi
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@getlabel#1#2\@nil{%
+ \def\@tempa{#1}%
+ \def\@tempb{[}%
+ \ifx\@tempa\@tempb
+ \caption@@@getlabel#1#2\@nil
+ \else
+ \l@addto@macro\caption@thelabel{{#1}}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@@getlabel[#1]#2\@nil{%
+ \l@addto@macro\caption@thelabel{[{#1}]}%
+ \caption@@getlabel#2\@nil}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@thelabel\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Fonts}
+%
+% \begin{macro}{\DeclareCaptionFont}
+% \changes{v1.0a}{2004/01/22}{Bugfix: Multi token arguments are allowed now}
+% \changes{v1.1}{2007/05/07}{Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now}
+% \changes{v1.8h}{2020/01/03}{Check for \package{ragged2e} package related options added}
+% \changes{v1.10}{2020/05/10}{Optional argument \opt{package} added}
+% |\DeclareCaptionFont|\oarg{package}\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFont{%
+ \@ifnextchar[%]
+ \caption@declare@font
+ \caption@declarefont}
+\@onlypreamble\DeclareCaptionFont
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@declare@font[#1]#2{%
+ \global\@namedef{caption@fnt@#2@package}{#1}%
+ \caption@@declarefont{#2}}
+\@onlypreamble\caption@declare@font
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declarefont[1]{%
+ \global\@nameundef{caption@fnt@#1@package}%
+ \caption@@declarefont{#1}}
+\@onlypreamble\caption@declarefont
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@declarefont[2]{%
+ \define@key{caption@fnt}{#1}[]{\caption@addto@fnt{#1}{#2}}%
+ \caption@@@declarefont{#1}{#2}}
+\@onlypreamble\caption@@declarefont
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@declarefont[2]{}% will be used by \DeclareCaptionJustification
+\@onlypreamble\caption@@@declarefont
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@addto@fnt[2]{%
+ \expandafter\let\expandafter\caption@package\csname caption@fnt@#1@package\endcsname
+ \caption@ifdefined\caption@package
+ {\caption@requirepackage\caption@package{#1}}% load package, if necessary
+ {}%
+ \l@addto@macro\caption@fnt{#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultFont}
+% \changes{v1.1}{2006/05/14}{This macro added}
+% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionFont} to \cs{DeclareCaptionDefaultFont}}
+% |\DeclareCaptionDefaultFont|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultFont[2]{%
+ \global\@namedef{caption#1@default}{#2}}
+\@onlypreamble\DeclareCaptionDefaultFont
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
+\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}}
+\DeclareCaptionDefaultFont{font}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
+\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}}
+\DeclareCaptionDefaultFont{labelfont}{}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
+\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}}
+\DeclareCaptionDefaultFont{textfont}{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setfont}
+% \changes{v1.0j}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument}
+% \changes{v1.1}{2006/05/14}{Support of \cs{DeclareDefaultCaptionFont} added}
+% |\caption@setfont|\marg{name}\marg{keyval-list of names}\par
+% Selecting a caption font means saving all the code snippets
+% in |\caption|\meta{name}.
+% \begin{macrocode}
+\newcommand*\caption@setfont[1]{%
+ \expandafter\let\csname caption#1\endcsname\@empty
+ \caption@addtofont{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtofont}
+% \changes{v1.2}{2007/11/17}{This macro added}
+% |\caption@addtofont|\marg{name}\marg{keyval-list of names}\par
+% Like |\caption@setfont|, but adds the code snippets to |\caption|\meta{name}.\par
+% Because we use |\setkeys| recursive here we need to do this inside an
+% extra group.
+% \begin{macrocode}
+\newcommand*\caption@addtofont[2]{%
+ \begingroup
+ \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname
+ \define@key{caption@fnt}{default}[]{%
+ \l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}%
+ \caption@setkeys[caption]{caption@fnt}{#2}%
+ \global\let\caption@tempa\caption@fnt
+ \endgroup
+ \expandafter\let\csname caption#1\endcsname\caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@font}
+% \changes{v1.1}{2007/05/07}{This macro added}
+% |\caption@font|\marg{keyval-list of names}\\
+% |\caption@font*|\marg{keyval-code}\par
+% Sets the given font, e.g.~|\caption@font{small,it}|
+% is equivalent to |\small\itshape|.
+% \begin{macrocode}
+\newcommand*\caption@font{%
+ \caption@teststar\caption@@font\@firstofone
+ {\caption@setkeys[caption]{caption@fnt}}}
+\newcommand*\caption@@font[2]{%
+ \begingroup
+ \def\caption@fnt{\endgroup}%
+ #1{#2}%
+ \caption@fnt}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined font code snippets.
+%
+% \changes{v1.1}{2007/05/07}{Color font support added}
+% \begin{macrocode}
+\DeclareCaptionFont{normalcolor}{\normalcolor}
+\DeclareCaptionFont{color}{\color{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{normalfont}{\normalfont}
+\DeclareCaptionFont{up}{\upshape}
+\DeclareCaptionFont{it}{\itshape}
+\DeclareCaptionFont{sl}{\slshape}
+\DeclareCaptionFont{sc}{\scshape}
+\DeclareCaptionFont{md}{\mdseries}
+\DeclareCaptionFont{bf}{\bfseries}
+\DeclareCaptionFont{rm}{\rmfamily}
+\DeclareCaptionFont{sf}{\sffamily}
+\DeclareCaptionFont{tt}{\ttfamily}
+% \end{macrocode}
+%
+% \changes{v1.7}{2018/05/01}{Missing font sizes \texttt{tiny}, \texttt{LARGE}, \texttt{huge}, and \texttt{Huge} added}
+% \begin{macrocode}
+\DeclareCaptionFont{tiny}{\tiny}
+\DeclareCaptionFont{scriptsize}{\scriptsize}
+\DeclareCaptionFont{footnotesize}{\footnotesize}
+\DeclareCaptionFont{small}{\small}
+\DeclareCaptionFont{normalsize}{\normalsize}
+\DeclareCaptionFont{large}{\large}
+\DeclareCaptionFont{Large}{\Large}
+\DeclareCaptionFont{LARGE}{\LARGE}
+\DeclareCaptionFont{huge}{\huge}
+\DeclareCaptionFont{Huge}{\Huge}
+% \end{macrocode}
+%
+% \changes{v1.8}{2018/05/01}{Font size \texttt{smaller} added}
+% \begin{macrocode}
+\newcommand\caption@smaller{%
+ \ifx\@currsize\tiny
+ \relax
+ \else\ifx\@currsize\scriptsize
+ \tiny
+ \else\ifx\@currsize\footnotesize
+ \scriptsize
+ \else\ifx\@currsize\small
+ \footnotesize
+ \else\ifx\@currsize\normalsize
+ \small
+ \else\ifx\@currsize\large
+ \normalsize
+ \else\ifx\@currsize\Large
+ \large
+ \else\ifx\@currsize\LARGE
+ \Large
+ \else\ifx\@currsize\huge
+ \LARGE
+ \else\ifx\@currsize\Huge
+ \huge
+ \else
+ \caption@Warning{%
+ Cannot determine current font size.\MessageBreak
+ Try setting it with `size=' explicitly}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+\DeclareCaptionFont{smaller}{\caption@smaller}
+% \end{macrocode}
+%
+% \changes{v1.8}{2018/05/02}{Font size \texttt{larger} added}
+% \begin{macrocode}
+\newcommand\caption@larger{%
+ \ifx\@currsize\tiny
+ \scriptsize
+ \else\ifx\@currsize\scriptsize
+ \footnotesize
+ \else\ifx\@currsize\footnotesize
+ \small
+ \else\ifx\@currsize\small
+ \normalsize
+ \else\ifx\@currsize\normalsize
+ \large
+ \else\ifx\@currsize\large
+ \Large
+ \else\ifx\@currsize\Large
+ \LARGE
+ \else\ifx\@currsize\LARGE
+ \huge
+ \else\ifx\@currsize\huge
+ \Huge
+ \else\ifx\@currsize\Huge
+ \relax
+ \else
+ \caption@Warning{%
+ Cannot determine current font size.\MessageBreak
+ Try setting it with `size=' explicitly}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+\DeclareCaptionFont{larger}{\caption@larger}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{singlespacing}{}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%\DeclareCaptionFont{normal}{%
+% \caption@font{normalcolor,normalfont,normalsize,singlespacing}
+\DeclareCaptionFont{normal}{%
+ \caption@font*{%
+ \KV@caption@fnt@normalcolor\@unused
+ \KV@caption@fnt@normalfont\@unused
+ \KV@caption@fnt@normalsize\@unused
+ \KV@caption@fnt@singlespacing\@unused}}
+% \end{macrocode}
+%
+% \changes{v1.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
+% The old versions \version{1.x} of \thispackage\ offered this
+% command to setup the font size used for captions. We still do
+% so old documents will work fine.
+% \begin{macrocode}
+\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
+\DeclareCaptionDefaultFont{size}{}
+% \end{macrocode}
+%
+% \section{Justifications}
+%
+% \begin{macro}{\DeclareCaptionJustification}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces
+% between arguments do make any harm}
+% \changes{v1.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}}
+% |\DeclareCaptionJustification|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionJustification{%
+ \def\caption@@@declarefont##1##2{%
+ \global\@namedef{caption@hj@##1}{##2}% for compatibility to v1.0, needed by floatrow package
+ \let\caption@@@declarefont\@gobbletwo}%
+ \DeclareCaptionFont}
+\@onlypreamble\DeclareCaptionJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionDefaultJustification}
+% \changes{v1.1}{2007/07/03}{This macro added}
+% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionJustification} to \cs{DeclareCaptionDefaultJustification}}
+% |\DeclareCaptionDefaultJustification|\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionDefaultJustification[1]{%
+ \global\@namedef{caption@hj@default}{#1}% for compatibility to v1.0
+ \DeclareCaptionDefaultFont{@hj}{#1}}
+\@onlypreamble\DeclareCaptionDefaultJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{justification}{\caption@setjustification{#1}}
+\DeclareCaptionDefaultJustification{}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setjustification}
+% \changes{v1.1}{2007/07/03}{Mapped to \cs{caption@setfont}}
+% |\caption@setjustification|\marg{name}\par
+% Selecting a caption justification simply means saving the code (in |\caption@hj|).
+% \begin{macrocode}
+\newcommand*\caption@setjustification{\caption@setfont{@hj}}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined justification code snippets.
+% \begin{macrocode}
+\DeclareCaptionJustification{justified}{}
+\DeclareCaptionJustification{centering}{\centering}
+\DeclareCaptionJustification{centerfirst}{\centerfirst}
+\DeclareCaptionJustification{centerlast}{\centerlast}
+\DeclareCaptionJustification{raggedleft}{\raggedleft}
+\DeclareCaptionJustification{raggedright}{\raggedright}
+% \end{macrocode}
+%
+% \begin{macro}{\centerfirst}
+% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}}
+% Please blame Frank Mittelbach for the code of |\centerfirst| |:-)|
+% \begin{macrocode}
+\providecommand\centerfirst{%
+ \let\\\@centercr
+ \edef\caption@normaladjust{%
+ \leftskip\the\leftskip
+ \rightskip\the\rightskip
+ \parfillskip\the\parfillskip\relax}%
+ \leftskip\z@\@plus -1fil%
+ \rightskip\z@\@plus 1fil%
+ \parfillskip\z@skip
+ \noindent\hskip\z@\@plus 2fil%
+ \@setpar{\@@par\@restorepar\caption@normaladjust}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\centerlast}
+% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}}
+% This is based on code from Anne Br\"uggemann-Klein\cite{Anne}
+% \begin{macrocode}
+\providecommand\centerlast{%
+ \let\\\@centercr
+ \leftskip\z@\@plus 1fil%
+ \rightskip\z@\@plus -1fil%
+ \parfillskip\z@\@plus 2fil\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Vertical spaces before and after captions}
+%
+% \begin{macro}{\abovecaptionskip}
+% \begin{macro}{\belowcaptionskip}
+% Usually these skips are defined within the document class, but some
+% document classes don't do so.
+% \begin{macrocode}
+\caption@ifundefined\abovecaptionskip{%
+ \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
+\caption@ifundefined\belowcaptionskip{%
+ \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{Option \opt{skip=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
+\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
+\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@rule}
+% \changes{v1.2b}{2008/05/06}{This macro added}
+% |\caption@rule|\par
+% Draws an invisible rule to adjust the ``skip'' setting.
+% \begin{macrocode}
+\newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@hrule{\hrule\@height\z@}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2b}{2008/05/06}{Option \opt{rule=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}}
+% \end{macrocode}
+%
+% \section{Positioning}
+%
+% These macros handle the right position of the caption.
+% Note that the position is actually \emph{not} controlled by the
+% \package{caption3} kernel options, but by the user (or a specific package
+% like the \package{float} package) instead.
+% The user can put the |\caption| command wherever he likes! So this stuff
+% is only to give us a \emph{hint} where to put the right skips, the user
+% usually has to take care for himself that this hint actually matches the
+% right position.
+%
+% \begin{macrocode}
+\DeclareCaptionOption{position}{\caption@setposition{#1}}
+% \end{macrocode}
+% \changes{v1.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figureposition}{%
+ \captionsetup*[figure]{position=#1}}
+\@onlypreamble@key{caption}{figureposition}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{tableposition}{%
+ \captionsetup*[table]{position=#1}}
+\@onlypreamble@key{caption}{tableposition}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setposition}
+% \changes{v1.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b},
+% \opt{below}, and \opt{a} are allowed, too}
+% \changes{v1.0c}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
+% |\caption@setposition|\marg{position}\par
+% Selecting the caption position means that we put |\caption@position| to
+% the right value. \emph{Please do \textbf{not} use the internal macro
+% \cs{caption@position} in your own package or document, but use the wrapper
+% macro \cs{caption@iftop} instead.}
+% \begin{macrocode}
+\newcommand*\caption@setposition[1]{%
+ \caption@ifinlist{#1}{d,default}{%
+ \let\caption@position\caption@defaultpos
+ }{\caption@ifinlist{#1}{t,top,above}{%
+ \let\caption@position\@firstoftwo
+ }{\caption@ifinlist{#1}{b,bottom,below}{%
+ \let\caption@position\@secondoftwo
+ }{\caption@ifinlist{#1}{a,auto}{%
+ \let\caption@position\@undefined
+ }{%
+ \caption@Error{Undefined position `#1'}%
+ }}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defaultpos}
+% \changes{v1.1}{2007/05/08}{Default position changed from `bottom' to `auto'}
+% The default `position' is `auto', this means that \thispackage\ will try
+% to guess the current position of the caption.
+% (But in many cases, for example in |longtable|s, this is doomed to fail!)\par
+% The setting `bottom' correspondents to the |\@makecaption| implementation
+% in the standard \LaTeX\ document classes, but `auto' should give better
+% results in most cases.
+% \begin{macrocode}
+%\caption@setdefaultpos{a}% default = auto
+\let\caption@defaultpos\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftop}
+% \changes{v1.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
+% \changes{v1.0c}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
+% \changes{v1.1}{2007/05/08}{Position will be fixed to `bottom' if `auto'}
+% |\caption@iftop|\marg{true-code}\marg{false-code}\par
+% (If the |position=| is set to |auto| we assume a |bottom| position here.)
+% \begin{macrocode}
+\newcommand*\caption@iftop{%
+ \ifx\caption@position\@undefined
+ \let\caption@position\@secondoftwo
+% = \caption@setposition b%
+ \fi
+ \caption@position}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fixposition}
+% \changes{v1.0b}{2004/05/16}{%
+% Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
+% |\caption@fixposition|\par
+% This macro checks if the `position' is set to `auto'.
+% If yes, |\caption@autoposition| will be called to
+% set |\caption@position| to a proper value we can actually use.
+% \begin{macrocode}
+\newcommand*\caption@fixposition{%
+ \ifx\caption@position\@undefined
+ \caption@autoposition
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@autoposition}
+% \changes{v1.0a}{2004/01/23}{\cs{ifvmode} added}
+% |\caption@autoposition|\par
+% We guess the current position of the caption by checking |\prevdepth|.\par
+% A different solution would be setting the |\spacefactor| to something
+% not much less than 1000 (for example 994) in |\caption@start| and
+% checking this value here by |\ifnum\spacefactor=994|.
+% (It's implemented in the \package{threeparttable}
+% package\cite{threeparttable} this way.)\par
+% Another idea would be checking |\@ifminipage|, but since some packages
+% typeset the caption within a simple |\vbox| this does not seem to be a
+% good one.
+% \begin{macrocode}
+\newcommand*\caption@autoposition{%
+ \ifvmode
+ \edef\caption@tempa{\the\prevdepth}%
+ \caption@Debug{\protect\prevdepth=\caption@tempa}%
+ \ifdim\prevdepth>-\p@
+ \let\caption@position\@secondoftwo
+ \else
+ \let\caption@position\@firstoftwo
+ \fi
+% = \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}%
+ \else
+ \caption@Debug{no \protect\prevdepth}%
+ \let\caption@position\@secondoftwo
+% = \caption@setposition b%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@setautoposition}
+% \changes{v1.1}{2007/06/10}{This macro added}
+% |\caption@setautoposition|\marg{position}\par
+% replaces the above algorithm by a different one (or a fixed position setting).
+% \begin{macrocode}
+\newcommand*\caption@setautoposition[1]{%
+ \def\caption@autoposition{\caption@setposition{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Hooks}
+%
+% \begin{macro}{\AtBeginCaption}
+% \begin{macro}{\AtEndCaption}
+% |\AtBeginCaption| \marg{code}\\
+% |\AtEndCaption| \marg{code}\par
+% These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|.
+% \begin{macrocode}
+\newcommand*\caption@beginhook{}
+\newcommand*\caption@endhook{}
+\newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook}
+\newcommand*\AtEndCaption{\l@addto@macro\caption@endhook}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \section{Lists}
+%
+% \changes{v1.0b}{2004/05/16}{Option \opt{listof=} added}
+% \changes{v1.2}{2007/11/17}{Option \opt{list=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{list}[1]{\caption@setlist{#1}}
+\DeclareCaptionOption{listof}[1]{\caption@setlist{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlist}
+% \changes{v1.2a}{2008/03/20}{This macro added}
+% |\caption@setlist|\marg{boolean}
+% \begin{macrocode}
+\newcommand*\caption@setlist{\caption@set@bool\caption@iflist}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.4}{2011/08/30}{Option \opt{listtype=} added}
+% \changes{v1.4}{2011/08/30}{Option \opt{listtype+=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listtype}{\caption@setlisttype{#1}}
+\DeclareCaptionOption{listtype+}{\caption@setlisttype@ext{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlisttype}
+% \changes{v1.4}{2011/08/30}{This macro added}
+% |\caption@setlisttype|\marg{type}
+% \begin{macrocode}
+\newcommand*\caption@setlisttype{%
+ \caption@setlisttype@ext{}%
+ \caption@@setlisttype\caption@listtype}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setlisttype[2]{%
+ \edef#1{#2}%
+ \ifx#1\@empty \let#1\@undefined \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@setlisttype@ext}
+% \changes{v1.4}{2011/08/30}{This macro added}
+% |\caption@setlisttype@ext|\marg{type extension}
+% \begin{macrocode}
+\newcommand*\caption@setlisttype@ext{%
+ \caption@@setlisttype\caption@listtype@ext}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionListFormat}
+% \changes{v1.1}{2004/07/15}{This macro added}
+% \changes{v1.2}{2007/11/17}{Renamed from \cs{DeclareCaptionListOfFormat} to \cs{DeclareCaptionListFormat}}
+% |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionListFormat[2]{%
+ \global\@namedef{caption@lstfmt@#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionListFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.1}{2007/07/15}{Option \opt{listofformat=} added}
+% \changes{v1.2}{2007/11/17}{Option \opt{listofformat=} renamed to \opt{listformat=}}
+% \begin{macrocode}
+\DeclareCaptionOption{listformat}{\caption@setlistformat{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlistformat}
+% \changes{v1.1}{2004/07/15}{This macro added}
+% \changes{v1.2}{2007/11/17}{Renamed from \cs{caption@setlistofformat} to \cs{caption@setlistformat}}
+% |\caption@setlistformat|\marg{name}\par
+% Selecting a caption list format simply means saving the code (in |\caption@lstfmt|).
+% \begin{macrocode}
+\newcommand*\caption@setlistformat[1]{%
+ \@ifundefined{caption@lstfmt@#1}%
+ {\caption@Error{Undefined list format `#1'}}%
+ {\expandafter\let\expandafter\caption@lstfmt
+ \csname caption@lstfmt@#1\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+% There are five pre-defined list formats, taken from the \package{subfig} package.
+% \begin{macrocode}
+\DeclareCaptionListFormat{empty}{}
+\DeclareCaptionListFormat{simple}{#1#2}
+\DeclareCaptionListFormat{parens}{#1(#2)}
+\DeclareCaptionListFormat{subsimple}{#2}
+\DeclareCaptionListFormat{subparens}{(#2)}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setdefaultlistformat}
+% \changes{v1.2d}{2009/03/29}{This macro added}
+% \begin{macrocode}
+\newcommand*\caption@setdefaultlistformat[1]{%
+ \ifx\caption@lstfmt\caption@lstfmt@default
+ \caption@set@default@listformat{#1}%
+ \caption@setlistformat{default}%
+ \else
+ \caption@set@default@listformat{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@default@listformat[1]{%
+ \def\caption@lstfmt@default{\@nameuse{caption@lstfmt@#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `subsimple'.
+% \begin{macrocode}
+\caption@set@default@listformat{subsimple}
+% \end{macrocode}
+%
+% \section{Debug option}
+% \changes{v1.0k}{2007/03/04}{Debug option added}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{debug}[1]{%
+ \caption@set@bool\caption@ifdebug{#1}%
+ \caption@ifdebug
+ {\let\caption@Debug\caption@Info}%
+ {\let\caption@Debug\@gobble}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareOption{debug}{\setkeys{caption}{debug}}
+% \end{macrocode}
+% \begin{macrocode}
+\setkeys{caption}{debug=0}
+% \end{macrocode}
+%
+% \section{Document classes \& Babel support}
+%
+% \begin{macro}{\caption@ifdocumentclass}
+% Boolean switch which is set if the document class could be detected successfully,
+% i.e. |\caption@document|\-|class| is set to a proper value.
+% (If |\caption@document|\-|class| is already set, this flag will also be set.)
+% \begin{macrocode}
+\caption@setbool{documentclass}{1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@documentclass}
+% \changes{v1.8e}{2018/05/11}{This macro added}
+% Determine document class used.
+% Set |\caption@document|\-|class| by good-guessing, if not already set.
+% \begin{macrocode}
+\caption@ifundefined\caption@documentclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \@ifclassloaded{beamer}{%
+ \caption@InfoNoLine{beamer document class detected}%
+ \def\caption@documentclass{beamer}%
+% \end{macrocode}
+% \begin{macrocode}
+ }{\@ifclassloaded{elsarticle}{%
+ \caption@InfoNoLine{elsarticle document class detected}%
+ \def\caption@documentclass{elsarticle}%
+% \end{macrocode}
+% \begin{macrocode}
+ }{\@ifclassloaded{memoir}{%
+ \caption@InfoNoLine{memoir document class detected}%
+ \def\caption@documentclass{memoir}%
+% \end{macrocode}
+% \begin{macrocode}
+ }{\caption@ifdefined\scr@caption{%
+ \caption@InfoNoLine{KOMA-Script document class detected}%
+ \def\caption@documentclass{koma}%
+% \end{macrocode}
+% If |\@captionheadfont| is defined, we assume it's a AMS or SMF document class.
+% \begin{macrocode}
+ }{\caption@ifdefined\@captionheadfont{%
+ \caption@InfoNoLine{AMS or SMF document class detected}%
+ \def\caption@documentclass{ams}%
+% \end{macrocode}
+% If |\@CaptionFonts| is defined, we assume it's a NTG Dutch document class.
+% \begin{macrocode}
+ }{\caption@ifdefined\CaptionFonts{%
+ \caption@InfoNoLine{NTG document class detected}%
+ \def\caption@documentclass{ntg}%
+% \end{macrocode}
+% If |\cph@font| and |\cpb@font| are defined, we assume it's a NTG Dutch document class.
+% \begin{macrocode}
+ }{\caption@ifdefined\cph@font{%
+ \caption@ifdefined\cpb@font\@firstoftwo\@secondoftwo
+ }{%
+ \@secondoftwo
+ }{%
+ \caption@InfoNoLine{thesis document class detected}%
+ \def\caption@documentclass{thesis}%
+ }{%
+% \end{macrocode}
+% If the definition of |\@makecaption| matches the one from the standard \LaTeX\ document classes
+% |article|, |report|, or |book|, we assume it's either one of them or is compatible to them.
+% \begin{macrocode}
+ % article|report|book [2005/09/16 v1.4f Standard LaTeX document class]
+ \long\def\caption@tempa#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}}
+ \ifx\caption@tempa\@makecaption
+ \caption@InfoNoLine{Standard document class detected}%
+ \else
+% \end{macrocode}
+% Otherwise we are clueless and use standard default settings for the captions anyway.
+% (And we unset the |document|\-|class| flag to indicate that the content of |\caption@document|\-|class| is not correct.)
+% \begin{macrocode}
+ \caption@InfoNoLine{%
+ Unknown document class (or package),\MessageBreak
+ standard defaults will be used}%
+ \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}%
+ \caption@setbool{documentclass}{0}%
+ \fi
+ \def\caption@documentclass{base}%
+ }}}}}}%
+}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifclassloaded}
+% \changes{v1.8e}{2019/09/09}{This macro added}
+% |\caption@ifclassloaded|\marg{name}\marg{yes-code}\marg{no-code}
+% \begin{macrocode}
+\newcommand*\caption@ifclassloaded[1]{%
+ \edef\caption@tempa{#1}%
+ \ifx\caption@tempa\caption@documentclass
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes}
+%
+% Since this is the default, there is no extra work to be done here.
+%
+% \subsection{The elsarticle classes}
+% \changes{v1.5}{2013/01/06}{elsarticle class support added}
+%
+% \begin{macrocode}
+\caption@ifclassloaded{elsarticle}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{font}{\footnotesize}
+% \end{macrocode}
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The \AmS{} \& \SmF{} classes}
+% \changes{v1.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added}
+%
+% \begin{macrocode}
+\caption@ifclassloaded{ams}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\captionmargin\captionindent % set to 3pc by AMS class
+ \begingroup\edef\@tempa{\endgroup
+ \noexpand\caption@g@addto@list\noexpand\caption@sty@default
+ {margin=\the\captionmargin
+ \caption@ifdefined\smf@makecaption{,maxmargin=.1\linewidth}{}}}
+ \@tempa
+ \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin}
+ \DeclareCaptionLabelSeparator{default}{.\enspace}
+ \DeclareCaptionDefaultFont{font}{\@captionfont}
+ \DeclareCaptionDefaultFont{labelfont}{\@captionheadfont}
+ \DeclareCaptionDefaultFont{textfont}{\@captionfont\upshape}
+ \captionsetup[figure]{position=b}
+ \captionsetup[table]{position=t}
+% \end{macrocode}
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The beamer class (Part one)}
+% \changes{v1.1}{2007/03/10}{\package{beamer} class support added}
+% \changes{v1.3}{2011/08/06}{\package{beamer} class support revised}
+% \changes{v1.5}{2013/04/27}{The \package{beamer} template \texttt{caption label separator} will be used now}
+% \changes{v1.7}{2016/05/22}{Re-definition of label format \texttt{simpleMagyar} added to \package{beamer} class support}
+% \changes{v1.7}{2018/04/15}{Re-definition of label format \texttt{simpleMagyar} revised}
+% \changes{v1.7}{2018/05/01}{Definition of \package{beamer} default label font revised}
+%
+% \begin{macrocode}
+\caption@ifclassloaded{beamer}{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@ifbeamertemplate}
+% |\caption@ifbeamertemplate|\marg{caption template name}\marg{yes-code}\marg{no-code}\\
+% tests if the given beamer caption template was selected by the user (or not).
+% \begin{macrocode}
+ \newcommand*\caption@ifbeamertemplate[1]{%
+ \begingroup
+ \let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
+ \@nameuse{beamer@@tmpop@caption@#1}%
+ \ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
+ \endgroup\expandafter\@firstoftwo
+ \else
+ \endgroup\expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \DeclareCaptionLabelFormat{default}{%
+ \caption@ifbeamertemplate{numbered}%
+ \caption@lfmt@simple
+ \caption@lfmt@unnumbered
+ {#1}{#2}}
+% \end{macrocode}
+% The \package{magyar} babel package redefines the current label format to a one called |simple|\-|Magyar|,
+% defined within |\@@magyar@caption|\-|fix| which will be executed |\At|\-|Begin|\-|Document|.
+% \begin{macrocode}
+ \DeclareCaptionLabelFormat{default@magyar}{%
+ \caption@ifbeamertemplate{numbered}%
+ \caption@lfmt@simple@magyar
+ \caption@lfmt@unnumbered
+ {#1}{#2}}
+ \@ifundefined{@@magyar@captionfix}\AtBeginDocument\@firstofone{%
+ \@ifundefined{@@magyar@captionfix}{}{%
+ \g@addto@macro\@@magyar@captionfix{%
+ \let\caption@lfmt@simple@magyar\caption@lfmt@simpleMagyar
+ \let\caption@lfmt@simpleMagyar\caption@lfmt@default@magyar}}}
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@declarelabelseparator
+ {\caption@ifbeamertemplate{caption name own line}\@gobble\@firstofone}
+ {default}
+ {\caption@ifbeamertemplate{caption name own line}{\\}%
+ {\usebeamertemplate{caption label separator}}}
+ \DeclareCaptionDefaultFont{font}{%
+ \usebeamerfont*{caption}%
+ \usebeamercolor[fg]{caption}}
+ \DeclareCaptionDefaultFont{labelfont}{%
+ \setbeamercolor*{caption}{}% avoid setting "caption" color additionally
+ \usebeamercolor[fg]{caption name}%
+ \setbeamerfont*{caption}{}% avoid setting "caption" font additionally
+ \usebeamerfont{caption name}}
+ \DeclareCaptionDefaultJustification{\raggedright}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareOption{beamerclass}{%
+ \renewcommand\caption@ifslc{%
+ \caption@ifbeamertemplate{caption name own line}\@secondoftwo\@firstoftwo}
+ % Since the beamer class do not offer a `list of figures' we switch this support off.
+ \captionsetup{list=0}}
+ \PassOptionsToPackage{beamerclass}{caption3}
+% \end{macrocode}
+%
+% If the \package{beamer} document class is used, we offer a beamer
+% template called `caption3' which can be used with option `beamer' or
+% |\setbeamertemplate{caption}[caption3]|.\par
+% (Note that this is of no use when the \package{caption} package is used, too.)
+% \begin{macrocode}
+ \defbeamertemplate{caption}{caption3}{%
+ \caption@make\insertcaptionname\insertcaptionnumber\insertcaption}
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareOption{beamer}{%
+ % \usebeamertemplate**{caption} will set font
+ \DeclareCaptionDefaultFont{font}{}%
+ \setbeamertemplate{caption}[caption3]}
+% \end{macrocode}
+% \begin{macrocode}
+%
+% \begin{macrocode]
+}{}
+% \end{macrocode}
+%
+% \subsection{The KOMA-Script classes}
+% \changes{v1.1}{2007/03/31}{\KOMAScript\ classes support added}
+%
+% \begin{macrocode}
+\caption@ifclassloaded{koma}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionFormat{default}[#1#2#3\par]{%
+ \ifdofullc@p
+ \caption@ifin@list\caption@lsepcrlist\caption@lsepname
+ {\caption@Error{%
+ The option `labelsep=\caption@lsepname' does not work\MessageBreak
+ with \noexpand\setcaphanging (which is set by default)}}%
+ {\caption@fmt@hang{#1}{#2}{#3}}%
+ \else
+ #1#2%
+ \ifdim\cap@indent<\z@
+ \par
+ \noindent\hspace*{-\cap@indent}%
+ \else\if@capbreak
+ \par
+ \fi\fi
+ #3\par
+ \fi}
+ \DeclareCaptionLabelSeparator{default}{\captionformat}
+ \DeclareCaptionDefaultFont{font}{\scr@fnt@caption}
+ \DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel}
+% \end{macrocode}
+%
+% \changes{v1.0f}{2005/08/22}{Increased compatibility to KOMA-Script:
+% A special version of options `parindent' and `parskip' added}
+% \changes{v1.0g}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of
+% `parskip' and `parindent' options revised and moved into caption kernel}
+% \changes{v1.0h}{2006/02/23}{KOMA-Script variants of `parskip' and
+% `parindent' are obsolete now, removed}
+% \changes{v1.0m}{2007/03/30}{KOMA-Script variants of `parskip' and
+% `parindent' re-added, since they still collide with the current
+% version of the subfig package (Sigh!)}
+%
+% There is an option clash between the \KOMAScript\ document classes
+% and the \package{caption} kernel, both define the options |parindent| and
+% |parskip| but with different meaning.
+% Furthermore the ones defined by the \package{caption} kernel take a
+% value as parameter but the \KOMAScript\ ones do not.
+% So we need special versions of the options |parindent| and |parskip| here
+% which determine if a value is given (and therefore should be treated as
+% our option) or not (and therefore should be ignored by us).\footnote{%^^A
+% This problem was completely solved due a change of \cs{caption@ProcessOptions}
+% in \thispackage\ \version{1.0h}, but we still need this workaround since
+% these options would otherwise still collide with the current version $1.3$
+% of the \package{subfig} package (Sigh!)}
+% \begin{macrocode}
+ \let\caption@KV@parindent\KV@caption@parindent
+ \DeclareCaptionOption{parindent}[]{%
+ \ifx,#1,%
+ \caption@Debug{Option `parindent' ignored}%
+ \else
+ \caption@KV@parindent{#1}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@KV@parskip\KV@caption@parskip
+ \DeclareCaptionOption{parskip}[]{%
+ \ifx,#1,%
+ \caption@Debug{Option `parskip' ignored}%
+ \else
+ \caption@KV@parskip{#1}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The \NTG{} Dutch classes}
+% \changes{v1.1}{2007/04/06}{NTG classes support added}
+%
+% \begin{macrocode}
+\caption@ifclassloaded{ntg}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont}
+ \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont}
+% \end{macrocode}
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The thesis class}
+% \changes{v1.2a}{2008/01/31}{thesis class support added}
+% \changes{v1.2e}{2009/11/15}{Bugfix 09-11-14: thesis class support revised}
+%
+% \begin{macrocode}
+\caption@ifclassloaded{thesis}{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFormat{hang}
+ \DeclareCaptionDefaultFont{labelfont}{\cph@font}
+ \DeclareCaptionDefaultFont{textfont}{\cpb@font}
+% \end{macrocode}
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The arabic Babel option}
+% \changes{v1.8}{2018/05/20}{\package{arabic} babel package support added}
+%
+% \begin{macrocode}
+\caption@ifdefined\ArabiCoreLoaded{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@rl}
+% \changes{v1.8}{2018/05/20}{This macro added}
+% \begin{macrocode}
+ \newcommand\caption@rl[1]{\if@rl\textRL{#1}\else\textLR{#1}\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \def\fnum@figure{\figurename\nobreakspace\thefigure}%
+ \def\fnum@table{\tablename\nobreakspace\thetable}%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionLabelSeparator{arabi}{ : }
+ \DeclareCaptionLabelSeparator{default}{%
+ \if@rl\caption@lsep@arabi\else\caption@lsep@colon\fi}
+% \end{macrocode}
+% \begin{macrocode}
+}{%
+ \let\caption@rl\@firstofone
+}
+% \end{macrocode}
+%
+% \subsection{The frenchb Babel option}
+% \changes{v1.1}{2006/05/14}{\package{frenchb} babel package support added}
+%
+% \begin{macrocode}
+\caption@ifdefined\FB@makecaption{%
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\@makecaption\STD@makecaption
+ \DeclareCaptionLabelSeparator{default}{\CaptionSeparator}
+ \def\caption@frenchb{% supress frenchb warning
+ \let\STD@makecaption\@makecaption
+ \let\FB@makecaption\@makecaption}
+ \else
+ \ifx\@makecaption\@undefined\else
+ \caption@InfoNoLine{%
+ The definition of \protect\@makecaption\space
+ has been changed,\MessageBreak
+ frenchb will NOT customize it}%
+ \fi
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The frenchle/pro package}
+% \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added}
+%
+% \begin{macrocode}
+\caption@ifdefined\frenchTeXmods{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionDefaultFont{textfont}{\itshape}%
+ \DeclareCaptionLabelSeparator{default}{\captionseparator\space}%
+% \end{macrocode}
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The hungarian and magyar Babel option}
+% \changes{v1.3}{2009/03/29}{\package{magyar} package support added}
+% \changes{v1.3a}{2011/08/12}{\package{magyar} package support revised}
+% \changes{v1.8b}{2018/08/26}{\package{magyar} package support revised}
+%
+% \begin{macrocode}
+\DeclareCaptionListFormat{subperiod}{#2.}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\caption@tempa#1{%
+ \@ifpackagewith{babel}{#1}{%
+ \caption@InfoNoLine{#1 babel option is loaded}%
+ \expandafter\addto\csname extras#1\endcsname{%
+ % change default labelsep and listformat
+ \caption@setdefaultlabelsep{period}%
+ \caption@setdefaultlistformat{subperiod}}%
+ \expandafter\addto\csname noextras#1\endcsname{%
+ % change default labelsep and listformat
+ \caption@setdefaultlabelsep{colon}%
+ \caption@setdefaultlistformat{subsimple}}%
+ }{}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@tempa{hungarian}
+\caption@tempa{magyar}
+% \end{macrocode}
+%
+% TODO: babel-latvian/latvian.ldf
+%
+% \section{Package support}
+%
+% \begin{macro}{\caption@xpackage}
+% \changes{v1.11}{2020/05/10}{This macro added}
+% |\caption@xpackage|\marg{macro}\marg{package}\marg{option}
+% expands the given macro if the given package is not loaded.
+% (Note: We cannot use |\@ifpackageloaded| here since it's not available after |\AtBeginDocument|.)
+% \begin{macrocode}
+\newcommand*\caption@xpackage[2]{%
+ \expandafter\ifx\csname ver@#2.\caption@pkgextension\endcsname\relax
+ \expandafter\@firstofone
+ \else
+ \expandafter\@gobbletwo
+ \fi
+ {#1{#2}}}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@pkgextension\@pkgextension
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@loadpackage}
+% \changes{v1.11}{2020/05/10}{This macro added}
+% |\caption@loadpackage|\marg{package}\marg{caption option}
+% loads the given package immediately.
+% \begin{macrocode}
+\newcommand*\caption@loadpackage{%
+ \caption@xpackage\caption@@loadpackage}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@loadpackage[2]{%
+ \caption@Info{Option `#2' requires the `#1' package}%
+ \RequirePackage{#1}\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@requirepackage}
+% \changes{v1.10}{2020/05/10}{This macro added}
+% |\caption@requirepackage|\marg{package}\marg{caption option}
+% indicates that the given package option needs a package.
+% \begin{macrocode}
+\newcommand*\caption@requirepackage{%
+ \caption@xpackage\caption@@requirepackage}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@requirepackage[2]{%
+ \@cons\caption@packagelist{{#1}{#2}}}% load package later on
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@pkg@list}
+% \changes{v1.4b}{2012/01/12}{This macro added}
+% We used this in the past as list of packages loaded |\AtBeginDocument|.
+% (Note: Old |.aux| files could contain |\@cons|\-|\caption@pkg@list|\-|{{|\meta{package}|}}|,
+% so this macro should always be defined, even if we change the following code in the future.)
+% \begin{macrocode}
+\newcommand*\caption@pkg@list{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@packagelist}
+% \changes{v1.11}{2020/05/10}{This macro added}
+% We use this as list of packages loaded |\AtBeginDocument|.
+% \begin{macrocode}
+\newcommand*\caption@packagelist{}
+\@onlypreamble\caption@packagelist
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\caption@tempa{\endgroup}%
+ \begingroup
+ \def\@elt#1#2{%
+ \g@addto@macro\caption@tempa{%
+ \caption@loadpackage{#1}{#2}}}%
+ \caption@packagelist
+ \caption@tempa
+% \end{macrocode}
+% \begin{macrocode}
+ \renewcommand*\caption@@loadpackage[2]{%
+ \caption@Error{Option `#2' requires the `#1' package}}%
+ \let\caption@@requirepackage\caption@@loadpackage
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@usepackage}
+% \changes{v1.11}{2020/05/10}{This macro added}
+% |\caption@usepackage|\marg{package}\marg{option}\marg{code}
+% loads the given package and executes the given code.
+% (Note: Since the package might use the crappy \package{keyval}
+% package, too, we need to save \& restore some macros here, otherwise this
+% recursion won't work properly.)
+% \begin{macrocode}
+\newcommand*\caption@usepackage[3]{%
+ \IfCaptionOptionCheck
+ {\caption@requirepackage{#1}{#2}}%
+ {\let\KV@prefix@ORI\KV@prefix
+ \let\@tempc@ORI\@tempc
+ \caption@loadpackage{#1}{#2}%
+ #3%
+ \let\@tempc\@tempc@ORI
+ \let\KV@prefix\KV@prefix@ORI}}
+% \end{macro}
+%
+% \subsection{The newfloat package}
+%
+% \begin{macro}{\caption@newfloat}
+% \changes{v1.4b}{2012/01/12}{This macro added}
+% \changes{v1.8h}{2020/01/03}{Usage of \cs{caption@ifpackageloaded} replaced by \cs{RequirePackage}}
+% \changes{v1.11}{2020/05/10}{Usage of \cs{RequirePackage} replaced by \cs{caption@usepackage}}
+% |\caption@newfloat|\marg{option}\marg{code}
+% loads the \package{newfloat} package and executes the given code afterwards.
+% \begin{macrocode}
+\newcommand*\caption@newfloat{\caption@usepackage{newfloat}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
+% \changes{v1.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written}
+% \changes{v1.2}{2007/11/18}{Option \opt{name} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}}
+\@onlypreamble@key{caption}{figurename}
+\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}}
+\@onlypreamble@key{caption}{tablename}
+% \end{macrocode}
+%
+% \changes{v1.2a}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}}
+\@onlypreamble@key{caption}{listfigurename}
+\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}}
+\@onlypreamble@key{caption}{listtablename}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@SetName}
+% \changes{v1.1}{2007/07/04}{This macro added}
+% \changes{v1.2}{2007/11/18}{After-preamble variant added}
+% \changes{v1.2a}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}}
+% \changes{v1.2b}{2008/08/02}{Bugfix: Works now without \cs{addto}, too}
+% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package}
+% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now}
+% |\caption@SetName|\marg{float}\marg{name}
+% \begin{macrocode}
+\newcommand*\caption@SetName[2]{%
+ \caption@newfloat{#1name}{\newfloat@setname{#1}{#2}}}
+\@onlypreamble\caption@SetName
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{name}{%
+ \IfCaptionOptionCheck{}{\caption@setname\@captype{#1}}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setname}
+% |\caption@setname|\marg{float}\marg{name}
+% \begin{macrocode}
+\newcommand*\caption@setname[2]{%
+ \@namedef{#1name}{#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added}
+% \changes{v1.2e}{2010/01/09}{The \opt{within} options are now available within the document, too}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{figurewithin}{\caption@within{figure}{#1}}
+\DeclareCaptionOptionNoValue{figurewithout}{\caption@within{figure}{none}}
+\DeclareCaptionOption{tablewithin}{\caption@within{table}{#1}}
+\DeclareCaptionOptionNoValue{tablewithout}{\caption@within{table}{none}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@within}
+% \changes{v1.2}{2007/12/21}{This macro added}
+% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package}
+% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now}
+% |\caption@within|\marg{float}\marg{value}
+% \begin{macrocode}
+\newcommand*\caption@within[2]{%
+ \caption@newfloat{#1within}{\newfloat@setwithin{#1}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2b}{2008/04/13}{Option \opt{within} added}
+% \changes{v1.2e}{2010/01/09}{The global \opt{within} option will now affect user-defined floats declared with \cs{DeclareCaptionType}, too}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{within}{%
+ \caption@newfloat{within}{\newfloatsetup{within=#1}}}
+\DeclareCaptionOptionNoValue{without}{%
+ \caption@newfloat{without}{\newfloatsetup{without}}}
+% \end{macrocode}
+%
+% \subsection{The ragged2e package}
+% \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support}
+% \changes{v1.8h}{2020/01/03}{Revised \package{ragged2e} package support}
+% \changes{v1.9}{2020/05/05}{Enhanced \package{ragged2e} package support}
+% \changes{v1.10}{2020/05/10}{Revised \package{ragged2e} package support}
+%
+% We support the upper-case commands offered by the \package{ragged2e}
+% package.
+% \begin{macrocode}
+\DeclareCaptionJustification[ragged2e]{Justified}{\justifying}
+\DeclareCaptionJustification[ragged2e]{Centering}{\Centering}
+\DeclareCaptionJustification[ragged2e]{RaggedLeft}{\RaggedLeft}
+\DeclareCaptionJustification[ragged2e]{RaggedRight}{\RaggedRight}
+% \end{macrocode}
+%
+% \subsection{The sansmath package}
+% \changes{v1.3}{2011/01/01}{\package{sansmath} package support added}
+% \changes{v1.10}{2020/05/10}{\package{sansmath} package support revised}
+%
+% \begin{macrocode}
+\DeclareCaptionFont[sansmath]{sansmath}{\sansmath}
+% \end{macrocode}
+%
+% \subsection{The setspace package}
+% \changes{v1.0n}{2007/04/02}{\package{setspace} package support added}
+% \changes{v1.2d}{2009/10/09}{\package{setspace} package support revised}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{singlespacing}{%
+ \caption@ifdefined\setspace@singlespace{%
+ \setstretch\setspace@singlespace}{}}% normally 1
+\DeclareCaptionFont[setspace]{onehalfspacing}{\onehalfspacing}
+\DeclareCaptionFont[setspace]{doublespacing}{\doublespacing}
+\DeclareCaptionFont[setspace]{stretch}{\setstretch{#1}}
+% \end{macrocode}
+%
+% \subsection{The subfig package}
+% \changes{v1.1}{2007/07/07}{Several adaptions to the \package{subfig} package added}
+% \changes{v1.4a}{2011/11/01}{Test for the \package{subfig} package revised}
+%
+% Since the \package{subfig} package is not maintained anymore,
+% we have to make several adaptions to \thispackage~\version{1.1} here.
+% Please note that we only support the version $1.3$ of the \package{subfig} package here.
+% So older versions do not work with this version of \thispackage, and newer
+% versions are expected to be adapted.
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\@tempa{2005/06/28 ver: 1.3 subfig package}%
+ \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa
+ \caption@InfoNoLine{subfig package v1.3 is loaded}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@setfloattype\@gobble
+ \let\@dottedxxxline\sf@NEW@dottedxxxline
+ \let\sf@subfloat\sf@NEW@subfloat
+% \end{macrocode}
+% \begin{macrocode}
+ \fi
+ \let\sf@NEW@dottedxxxline\@undefined
+ \let\sf@NEW@subfloat\@undefined}
+% \end{macrocode}
+%
+% \begin{macro}{\@dottedxxxline}
+% New version of |\@dottedxxxline|
+% \begin{macrocode}
+\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{%
+ \begingroup
+ \caption@setfloattype{#1}%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub#1}%
+ \ifnum #3>\@nameuse{c@#2depth}\else
+ \@dottedtocline{\z@}{#4}{#5}{#6}{#7}%
+ \fi
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sf@subfloat}
+% \changes{v1.4b}{2011/12/29}{Bugfix 11-12-23: Usage of \cs{caption@warmup} added}
+% New version of |\sf@subfloat|
+% \begin{macrocode}
+\def\sf@NEW@subfloat{%
+ \begingroup
+ \@nameuse{caption@warmup}%
+ \caption@setfloattype\@captype
+ \sf@ifpositiontop{%
+ \maincaptiontoptrue
+ }{%
+ \maincaptiontopfalse
+ }%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub\@captype}%
+ \let\sf@oldlabel=\label
+ \let\label=\subfloat@label
+ \ifmaincaptiontop\else
+ \advance\@nameuse{c@\@captype}\@ne
+ \fi
+ \refstepcounter{sub\@captype}%
+ \setcounter{sub\@captype @save}{\value{sub\@captype}}%
+ \@ifnextchar [% %] match left bracket
+ {\sf@@subfloat}%
+ {\sf@@subfloat[\@empty]}}
+% \end{macrocode}
+% \end{macro}
+%
+% Make the \package{subfig} package documentation compile.
+% \begin{macrocode}
+%%\@ifl@aded{dtx}{subfig}{\caption@loadpackage{ragged2e}{}}{} % not needed
+\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}}
+\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}}
+% \end{macrocode}
+%
+% \section{Execution of options}
+%
+% \begin{macrocode}
+\captionsetup{style=default,position=default,%
+ list,listformat=default,twoside=\if@twoside 1\else 0\fi}
+% \end{macrocode}
+% \begin{macrocode}
+\ProcessOptions*
+% \end{macrocode}
+%
+% \section{Making an `List of' entry}
+%
+% \begin{macro}{\caption@addcontentsline}
+% \changes{v1.1}{2007/07/01}{This macro added}
+% \changes{v1.3}{2010/10/26}{Error check added}
+% \changes{v1.3}{2011/06/24}{Split into two macros}
+% \changes{v1.4}{2011/08/19}{Split into three macros}
+% \changes{v1.4}{2011/08/30}{Support for option \opt{listtype=} added}
+% \changes{v1.5}{2012/01/15}{Usage of \cs{caption@addsubcontentslines} added}
+% \changes{v1.7}{2015/09/15}{Argument \#3 which holds the environment name added to \cs{caption@lstfmt}}
+% \changes{v1.7}{2015/09/20}{Unfortunately \package{subfig} defines and uses \cs{caption@lstfmt} as well, so I replaced the third argument with \cs{captionlisttype}}
+% \changes{v1.8}{2018/09/06}{Adapted to the \package{chkfloat} package}
+% |\caption@addcontentsline|\marg{type}\marg{list entry}\par
+% Makes an entry in the list-of-whatever, if requested,
+% i.e.~the argument \meta{list entry} is not empty and
+% |listof=| was set to |true|.
+% \begin{macrocode}
+\newcommand\caption@addcontentsline[2]{%
+ \caption@ifcontentsline{#2}{%
+ \begingroup
+ \let\@tempa\@gobble
+ \caption@ifdefined\caption@listtype
+ {\let\@tempa\@firstofone}%
+ {\edef\caption@listtype{#1}}%
+ \caption@ifdefined\caption@listtype@ext
+ {\edef\caption@listtype{\caption@listtype\caption@listtype@ext}%
+ \let\@tempa\@firstofone}%
+ {}%
+ \@tempa
+ {\caption@Debug{addcontentsline: #1 => \caption@listtype}%
+% \caption@setoptions\caption@listtype
+ \@namedef{the\caption@listtype}{\@nameuse{the#1}}}%
+ \expandafter\caption@@addcontentsline\expandafter{\caption@listtype}{#2}%
+ \endgroup}%
+ \caption@addsubcontentslines{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@addcontentsline[2]{%
+ {\let\\\space
+ \@ifundefined{ext@#1}%
+ {\caption@Error{No float type '#1' defined}}%
+ {\def\captionlisttype{#1}%
+ \caption@add@contentsline
+ {\csname ext@#1\endcsname}%
+ {#1}%
+ {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}%
+ {\ignorespaces #2}%
+ \caption@chkfloat{#1}{#2}}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@add@contentsline{%
+ \caption@@@addcontentsline}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@addcontentsline[4]{%
+% \caption@ifdefined\main@Arabi@language
+% {\addtocontents{#1}{\xstring\select@language{\main@Arabi@language}}}{}%
+ \addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@chkfloat\@gobbletwo
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@ifcontentsline[1]{%
+ \caption@iflist
+ {\def\@tempa{#1}}%
+ {\let\@tempa\@empty}%
+ \ifx\@tempa\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentslines[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Typesetting the caption}
+%
+% \begin{macro}{\ifcaption@star}
+% If the starred form of |\caption| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@@make|.)
+% \begin{macrocode}
+\newif\ifcaption@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fnum}
+% \changes{v1.1}{2007/08/21}{This macro added}
+% |\caption@fnum|\marg{float type}\par
+% Typesets the caption label; as replacement for |\fnum@|\meta{float type}.
+% \begin{macrocode}
+\newcommand*\caption@fnum[1]{\caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@make}
+% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\par
+% Typesets the caption.
+% \begin{macrocode}
+\newcommand\caption@make[2]{\caption@@make{\caption@lfmt{#1}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@make}
+% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of
+% \cs{captionmargin} resp. \cs{captionwidth}; check for \cs{z@} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end
+% of caption added}
+% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
+% \changes{v1.0c}{2005/02/12}{Single-line-check moved up so it can affect margins now}
+% \changes{v1.0c}{2005/02/09}{Improvement: \cs{caption@ifh} added}
+% \changes{v1.0c}{2005/02/09}{Bugfix: \cs{leavevmode} added}
+% \changes{v1.0f}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
+% \changes{v1.0g}{2005/12/04}{Uses \cs{caption@slc} now}
+% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside
+% single-line-check replaced by \cs{relax}}
+% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be
+% typeset in horizontal mode}
+% \changes{v1.0i}{2006/05/13}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox}}
+% \changes{v1.0j}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v1.0h, re-added}
+% \changes{v1.0n}{2007/04/03}{Usage of \cs{caption@ifoddpage} added}
+% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} moved below single-line-check}
+% \changes{v1.1e}{2007/10/28}{\cs{caption@stepcounter} added}
+% \changes{v1.5}{2012/03/15}{Uses \cs{caption@tempdima} instead of \cs{@tempdima}}
+% \changes{v1.5}{2012/12/26}{max-margin stuff moved to \cs{caption@calcmargin}}
+% \changes{v1.6}{2013/05/01}{Usage of \cs{caption@box} added}
+% \changes{v1.7}{2016/01/31}{Adapted to the \package{bicaption} package}
+% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}}
+% |\caption@@make|\marg{caption label}\marg{caption text}
+% \begin{macrocode}
+\newcommand\caption@@make[2]{%
+ \begingroup
+ \caption@@make@{#1}{#2}%
+ \endgroup
+ \caption@@make@epilogue}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@make@[2]{%
+ \caption@stepthecounter
+ \caption@beginhook
+% \end{macrocode}
+%
+% Typeset the outer box |\caption@box|
+% \begin{macrocode}
+ \caption@box\hsize{%
+% \end{macrocode}
+%
+% Special single-line treatment (option |singlelinecheck=|)
+% \begin{macrocode}
+ \caption@ifslc{\caption@slc{#1}{#2}\caption@singleline\relax}{}%
+% \end{macrocode}
+%
+% Typeset the left margin (option |margin=|)
+% \begin{macrocode}
+ \caption@calcmargin
+ \caption@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{}{\advance\caption@tempdima\captionmargin@}%
+ \fi
+ \caption@ifh{\advance\caption@tempdima\caption@indent}%
+ \hspace\caption@tempdima
+% \end{macrocode}
+%
+% We actually use a |\vbox| of width |\captionwidth - \caption@indent|
+% to typeset the caption.
+% \Note{\cs{captionindent} is \emph{not} supported if the caption format
+% was defined with \cs{DeclareCaptionFormat*}.}
+% \begin{macrocode}
+ \caption@tempdima\captionwidth
+ \caption@ifh{\advance\caption@tempdima-\caption@indent}%
+ \caption@parbox\caption@tempdima{%
+% \end{macrocode}
+%
+% Typeset the indention (option |indention=|)\\
+% {\small Bugfix 04-05-05:
+% |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots}
+% \begin{macrocode}
+ \caption@ifh{%
+ \ifdim\caption@indent=\z@
+ \leavevmode
+ \else
+ \hskip-\caption@indent
+ \fi}%
+% \end{macrocode}
+%
+% Typeset the caption itself and close the |\caption@parbox|
+% \begin{macrocode}
+ \caption@@@make{#1}{#2}}%
+% \end{macrocode}
+%
+% Typeset the right margin (option |margin=|)
+% \begin{macrocode}
+ \caption@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{\advance\caption@tempdima\captionmargin@}{}%
+ \fi
+ \hspace\caption@tempdima
+% \end{macrocode}
+%
+% Close the outer box |\caption@box|
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@endhook}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@make@epilogue{%
+ \global\caption@starfalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@calcmargin}
+% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by \cs{ifdim}\cs{captionwidth=}\cs{z@}}
+% \changes{v1.0g}{2006/01/12}{Improvement: Takes care of list environment now}
+% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore), use \cs{linewidth} instead of \cs{hsize}}
+% \changes{v1.5}{2012/12/26}{max-margin stuff moved from \cs{caption@@make} to here}
+% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}}
+% |\caption@calcmargin|\par
+% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
+% values.
+% \begin{macrocode}
+\newcommand*\caption@calcmargin{%
+ \caption@calcmargin@hook
+% \end{macrocode}
+% Check margin, if |\caption@minmargin| or |\caption@maxmargin| is set
+% \begin{macrocode}
+ \ifx\caption@maxmargin\@undefined \else
+ \ifdim\captionmargin>\caption@maxmargin\relax
+ \captionmargin\caption@maxmargin\relax
+ \fi
+ \fi
+ \ifx\caption@minmargin\@undefined \else
+ \ifdim\captionmargin<\caption@minmargin\relax
+ \captionmargin\caption@minmargin\relax
+ \fi
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \ifdim\captionwidth=\z@
+ \captionwidth\hsize
+ \advance\captionwidth by -2\captionmargin
+ \advance\captionwidth by -\captionmargin@
+ \else
+ \captionmargin\hsize
+ \advance\captionmargin by -\captionwidth
+ \divide\captionmargin by 2
+ \captionmargin@\z@
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{%
+ \string\hsize=\the\hsize,
+ \string\captionwidth=\the\captionwidth,\MessageBreak
+ \string\captionmargin=\the\captionmargin,
+ \string\captionmargin@=\the\captionmargin@}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@slc}
+% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} added}
+% \changes{v1.1}{2007/07/29}{\cs{caption@setup}\cs{caption@sls} added after \cs{begingroup}}
+% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} added}
+% \changes{v1.1c}{2007/10/14}{Support of \cs{caption@slfmt} added}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.3}{2010/09/04}{Split into \cs{caption@slc} and \cs{caption@@slc}}
+% \changes{v1.5}{2012/12/26}{Merged into a single macro again}
+% \changes{v1.5}{2013/04/14}{Definition and usage of \cs{ifsinglelinecaption} added}
+% |\caption@slc|\marg{label}\marg{text}\marg{single-line-code}\marg{multi-line-code}\par
+% This one does the single-line-check.
+% \begin{macrocode}
+\newcommand\caption@slc[4]{%
+ \caption@Debug{Begin SLC}%
+ \singlelinecaptiontrue
+ \begingroup
+ \caption@singleline
+ \let\caption@hj\@empty
+ \caption@calcmargin % calculate \captionwidth
+ \caption@prepareslc
+ \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
+ \ifdim\wd\@tempboxa>\captionwidth
+ \endgroup
+ \singlelinecaptionfalse
+ #4%
+ \else
+ \endgroup
+ #3%
+ \fi
+ \caption@Debug{End SLC}}
+% \end{macrocode}
+% \begin{macrocode}
+\newif\ifsinglelinecaption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@singleline{%
+ \caption@xsetup\caption@opt@singleline
+ \let\caption@fmt\caption@slfmt}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareslc}
+% \changes{v1.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
+% \changes{v1.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
+% \changes{v1.0c}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added}
+% \changes{v1.0f}{2005/07/09}{Support of \package{endnotes} package added}
+% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} moved to \cs{caption@slc}}
+% \changes{v1.1}{2007/06/13}{Redefinition of \cs{(H@)refstepcounter} added}
+% \changes{v1.1}{2007/08/12}{Redefinition of \cs{label} improved}
+% \changes{v1.1c}{2007/10/06}{Definition of \cs{caption@l@stepcounter} added}
+% \changes{v1.3}{2011/07/07}{Bugfix 11-07-06: Redefinition of \cs{footnote} and \cs{footnotemark} added, redefinition of \cs{stepcounter} and \cs{refstepcounter} dropped}
+% \changes{v1.4a}{2011/10/21}{Redefinition of \cs{pagenote} from \textsf{memoir} document class added}
+% \changes{v1.4a}{2011/10/22}{Redefinition of \cs{footnote} revised}
+% \changes{v1.5}{2013/04/13}{Redefinition os \cs{glsunset} added}
+% \changes{v1.8}{2018/01/21}{Redefinition of \cs{endnote} added (thanks to Markus Kohm)}
+% \changes{v1.8}{2018/05/16}{Redefinition of \cs{acused} added}
+% \changes{v1.8}{2018/05/26}{Definition method changed so it can be pre-defined by other packages}
+% \changes{v1.8}{2018/05/27}{Redefinition of \cs{hypertarget} added}
+% \changes{v1.12b}{2020/07/20}{Special adaption to \class{beamer} added}
+% |\caption@prepareslc|\par
+% Re-define anything which would disturb the single-line-check.
+% \begin{macrocode}
+\providecommand*\caption@prepareslc{}
+\g@addto@macro\caption@prepareslc{%
+ \let\label\caption@gobble
+ \let\hypertarget\@gobbletwo
+% \end{macrocode}
+% We re-define \cs{footnote} so
+% \begin{enumerate}
+% \item The footnote counter will not be increased twice (but still the correct footnote mark will be used within the single-line-check)
+% \item The footnote text will not be evaluated twice
+% \end{enumerate}
+% \begin{macrocode}
+ \let\caption@footnote@ORI\footnote
+ \def\footnote{\caption@withoptargs\caption@footnote}%
+ \let\caption@footnotemark@ORI\footnotemark
+ \def\footnotemark{\caption@withoptargs\caption@footnotemark}%
+ \let\caption@footnotetext@ORI\@footnotetext
+ \let\@footnotetext\caption@gobble
+% \end{macrocode}
+% Same for \cs{endnote}
+% \begin{macrocode}
+ \let\caption@endnote@ORI\endnote
+ \def\endnote{\caption@withoptargs\caption@endnote}%
+ \let\caption@endnotemark@ORI\endnotemark
+ \def\endnotemark{\caption@withoptargs\caption@endnotemark}%
+ \let\caption@endnotetext@ORI\@endnotetext
+ \let\@endnotetext\caption@gobble
+% \end{macrocode}
+% \begin{macrocode}
+ \let\pagenote\caption@gobble
+% \end{macrocode}
+% Adaption to the \package{acronym} package\par
+% See also \url{https://tex.stackexchange.com/questions/428788}
+% \begin{macrocode}
+ \let\acused\@gobble
+ \let\AC@placelabel\@gobble
+% \end{macrocode}
+% Adaption to the \package{glossaries} package.\par
+% Please note that while this adaption is usually sufficient
+% it could give incorrect measuring results if \cs{gls} is both used
+% for the very first time and more than once (for a particular acronym).
+% The alternative would be using internal macros of the
+% \package{glossaries} package which I would like to avoid.\par
+% See also \url{https://tex.stackexchange.com/questions/108368}
+% \begin{macrocode}
+ \let\glsunset\@gobble
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@footnote[2]{%
+ \caption@footnotemark{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@footnotemark[1]{%
+ \begingroup
+ \let\stepcounter\caption@l@stepcounter
+ \caption@footnotemark@ORI#1\relax
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@endnote[2]{%
+ \caption@endnotemark{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@endnotemark[1]{%
+ \begingroup
+ \let\stepcounter\caption@l@stepcounter
+ \caption@endnotemark@ORI#1\relax
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@l@stepcounter[1]{%
+ \advance\csname c@#1\endcsname\@ne\relax}
+% \end{macrocode}
+% The patch above assumes that the optional arguments of \cs{footnote} and
+% \cs{footnotemark} match. Since this is not the case in \class{beamer} based documents,
+% and since \class{beamer} extents the syntax of \cs{footnote} in a special way,
+% we need a special patch here.\par
+% \emph{Note:} For this patch we assume that \cs{footnote} will always end with the usage of
+% \cs{beamer@footnotetext}. (Unfortunately \cs{footnote} is defined too monolithic
+% in \class{beamer} to offer a less dirty patch.)
+% \begin{macrocode}
+\caption@ifclassloaded{beamer}{%
+ \g@addto@macro\caption@prepareslc{%
+ \def\footnote{%
+ \begingroup
+ \let\stepcounter\caption@l@stepcounter
+ \renewcommand<>\beamer@framefootnotetext[1]{%
+ \endgroup}%
+ \let\@footnotetext\beamer@framefootnotetext
+ \caption@footnote@ORI}}}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@applyfont}
+% \changes{v1.3}{2010/09/04}{This macro added}
+% |\caption@applyfont|\par
+% This macro executes the font relevant macros, i.e. by default
+% the options set by |justification=|, |font=|, and |size=|.
+% \begin{macrocode}
+\newcommand*\caption@applyfont{%
+ \caption@hj\captionfont\captionsize}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@make}
+% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix 04-12-16: Use some kind of
+% \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
+% \changes{v1.0c}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
+% \changes{v1.0d}{2005/05/05}{Use \cs{caption@ifempty};
+% \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
+% \changes{v1.0d}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
+% \changes{v1.0f}{2005/08/24}{Check for empty label added}
+% \changes{v1.0f}{2005/08/25}{\cs{caption@iflf} added}
+% \changes{v1.0j}{2007/02/18}{Usage of \cs{caption@tfmt} added}
+% \changes{v1.1}{2007/05/07}{Bugfix: \cs{ifhmode} added to \cs{@finalstrut}}
+% \changes{v1.2}{2007/11/17}{Made option \opt{size=} stronger than \opt{font=}}
+% \changes{v1.3}{2010/09/04}{Uses \cs{caption@applyfont} now}
+% \changes{v1.3}{2010/11/01}{Bugfix: If the caption text is empty, the text format will be set to \opt{simple} now}
+% \changes{v1.7}{2016/02/01}{Bugfix: \cs{relax} added before \cs{caption@lsep} so the label separator
+% will not be gobbled if the label font command ignores spaces, e.g. by usage of \cs{color}}
+% \changes{v1.8}{2018/09/12}{\cs{par} replaced by \cs{captiontextend}}
+% |\caption@@@make|\marg{caption label}\marg{caption text}\par
+% This one finally typesets the caption paragraph, without margin and indention.
+% \begin{macrocode}
+\newcommand\caption@@@make[2]{%
+% \end{macrocode}
+%
+% If the label is empty, we use no caption label separator.
+% \begin{macrocode}
+ \sbox\@tempboxa{#1}%
+ \ifdim\wd\@tempboxa=\z@
+ \let\caption@lsep\relax
+% \@capbreakfalse
+ \fi
+% \end{macrocode}
+%
+% If the text is empty, we use no caption label separator, too.
+% (And no text format either.)
+% \begin{macrocode}
+ \caption@ifempty{#2}{%
+ \let\caption@lsep\@empty
+ \let\caption@tfmt\@firstofone
+% \@capbreakfalse
+% \let\caption@ifstrut\@secondoftwo
+ }%
+% \end{macrocode}
+%
+% Take care that |\caption@parindent| and |\caption@hangindent| will be used
+% to typeset the paragraph.
+% \begin{macrocode}
+ \@setpar{\@@par\caption@@par}\caption@@par
+% \end{macrocode}
+%
+% Finally typeset the caption.
+% \begin{macrocode}
+ \caption@applyfont
+ \caption@fmt
+ {\ifcaption@star\else
+ \begingroup
+ \captionlabelfont
+ #1%
+ \endgroup
+ \fi}%
+ {\ifcaption@star\else
+ \begingroup
+ \caption@iflf\captionlabelfont
+ \relax\caption@lsep
+ \endgroup
+ \fi}%
+ {{\captiontextfont
+ \captiontextstart
+ \caption@ifstrut
+ {\vrule\@height\ht\strutbox\@width\z@}%
+ {}%
+ \nobreak\hskip\z@skip % enable hyphenation
+ \caption@tfmt{#2}%
+% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
+ \caption@ifstrut
+ {\ifhmode\@finalstrut\strutbox\fi}%
+ {}%
+ \captiontextend}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\captiontextstart{}
+\newcommand*\captiontextend{\par}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty}
+% \changes{v1.0d}{2005/05/05}{This macro added}
+% \changes{v1.1}{2007/07/04}{Re-defines itself now}
+% \changes{v1.2a}{2007/01/22}{Revised so \cs{label} will be detected, too}
+% \changes{v1.2b}{2008/08/02}{Revised so \cs{index} and \cs{glossary} will be detected, too}
+% |\caption@ifempty|\marg{text}\marg{true} (\emph{no} \meta{false})\par
+% This one tests if the \meta{text} is actually empty.
+% \Note{This will be done without expanding the text,
+% therefore this is far away from being bullet-proof.}
+% \Note{This macro is re-defining itself so only
+% the first test (in a group) will actually be done.}
+% \begin{macrocode}
+\newcommand\caption@ifempty[1]{%
+ \caption@if@empty{#1}%
+ \caption@ifempty\@unused}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@if@empty[1]{%
+ \def\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \expandafter\def\expandafter\caption@tempa\expandafter{%
+ \caption@car#1\caption@if@empty\caption@nil}%
+ \def\caption@tempb{\caption@if@empty}%
+ \ifx\caption@tempa\caption@tempb
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \def\caption@tempb{\ignorespaces}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobble#1}%
+ \else
+ \def\caption@tempb{\label}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\index}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\glossary}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \let\caption@ifempty\@gobbletwo
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@par}
+% \changes{v1.0f}{2005/08/22}{Made this definition global}
+% |\caption@@par|\par
+% This command will be executed with every |\par| inside the caption.
+% \begin{macrocode}
+\newcommand*\caption@@par{%
+ \parindent\caption@parindent\hangindent\caption@hangindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Types \& sub-types}
+%
+% \begin{macro}{\DeclareCaptionType}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% \changes{v1.1a}{2007/09/07}{Three optional arguments added}
+% \changes{v1.2}{2007/12/06}{Renamed from \cs{DeclareFloatingEnvironment} to \cs{DeclareCaptionType}}
+% \changes{v1.2}{2007/12/21}{Optional argument revised, uses key-value syntax now}
+% \changes{v1.2b}{2008/04/13}{Uses \cs{caption@within@default} now}
+% \changes{v1.2b}{2008/08/02}{Support of \cs{float@exts} and \cs{float@addtolists} added}
+% \changes{v1.2e}{2010/01/09}{Usage of \cs{caption@DeclareWithinOption} added}
+% \changes{v1.3}{2011/08/06}{Definition of \cs{listofXXXes} added}
+% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package}
+% |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionType{%
+ \caption@loadpackage{newfloat}{}%
+ \DeclareFloatingEnvironment}
+\@onlypreamble\DeclareCaptionType
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ForEachCaptionType}
+% \changes{v1.4a}{2011/10/29}{This macro added}
+% \changes{v1.13}{2020/07/29}{Renamed from \cs{caption@ForEachType} to \cs{ForEachCaptionType} and starred variant added}
+% |\ForEachCaptionType|\marg{code with \#1}\\
+% |\ForEachCaptionType*|\marg{code with \#1}\par
+% will execute the given code for each (known) floating environment.
+% The starred variant will only work for already existing environments,
+% i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment|
+% (offered by the \package{newfloat} package).
+% \begin{macrocode}
+\newcommand*\ForEachCaptionType{%
+ \@ifstar
+ {\caption@foreach@type\@gobble}%
+ {\caption@foreach@type\@iden}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@foreach@type[2]{%
+ \caption@ifdefined\ForEachFloatingEnvironment
+ {\ForEachFloatingEnvironment*{#2}}%
+ {\def\@elt##1{#2}%
+ \caption@ifdefined\c@figure\@elt\@gobble{figure}%
+ \caption@ifdefined\c@table\@elt\@gobble{table}%
+ \let\@elt\relax}%
+ #1{\newfloat@addtohook{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\newfloat@addtohook}
+% |\newfloat@addtohook|\marg{code with \#1}\par
+% adds code to the hook called in |\Declare|\-|Floating|\-|Environment|.\par
+% Note: We use |\provide|\-|command| instead of |\new|\-|command| here since the
+% exact same code is defined in the \package{newfloat} package.
+% \begin{macrocode}
+\providecommand\newfloat@addtohook[1]{%
+ \toks@=\expandafter{\newfloat@hook{##1}#1}%
+ \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\newfloat@hook}
+% Hook used in |\Declare|\-|Floating|\-|Environment|.
+% \begin{macrocode}
+\providecommand*\newfloat@hook[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionSubType}
+% \changes{v1.2}{2007/11/16}{This macro added}
+% \changes{v1.2a}{2008/03/11}{Bugfix: \cs{subfigurename} will be defined now}
+% \changes{v1.2d}{2009/10/09}{Bugfix 08-10-01: Usage of \cs{caption@addtoreset} added}
+% \changes{v1.3}{2011/01/01}{\cs{@dottedlofline} will be defined \& used now}
+% \changes{v1.4}{2011/10/09}{Support of the titletoc package added}
+% \changes{v1.5}{2011/12/29}{Usage of \cs{caption@addtoreset} replaced by \cs{@addtoreset}}
+% \changes{v1.5}{2013/01/10}{Bugfix: Definition of autoref string corrected}
+% \changes{v1.6}{2013/06/17}{Bugfix: \cs{c@tocdepth} will be set (locally) now}
+% \changes{v1.8g}{2020/01/02}{Check revised if the sub-type is already defined or not}
+% \changes{v1.13}{2020/07/28}{Uses \cs{caption@l@addto@list} instead of \cs{@cons} now}
+% \changes{v1.13}{2020/07/29}{Usage of \cs{caption@subtype@hook} added}
+% \changes{v1.13}{2020/07/29}{We don't re-use existing counters anymore (This was a bad idea anyway)}
+% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\
+% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\par
+% The starred variant provides the numbering format
+% \meta{type}|.|\meta{subtype} while the non-starred variant simply
+% uses \meta{subtype}.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionSubType{%
+ \caption@teststar\caption@declaresubtype\@firstoftwo\@secondoftwo}
+\@onlypreamble\DeclareCaptionSubType
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declaresubtype[1]{%
+ \@testopt{\caption@@declaresubtype{#1}}{alph}}
+\@onlypreamble\caption@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@declaresubtype#1[#2]#3{%
+ \@ifundefined{c@#3}%
+ {\caption@Error{No float type '#3' defined}}%
+ {\caption@@@declaresubtype{#1}{#2}{#3}{sub#3}}}
+\@onlypreamble\caption@@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@declaresubtype[4]{%
+% \end{macrocode}
+% \begin{macrocode}
+% Check if the sub-type was already defined by |\Declare|\-|Sub|\-|Type|.
+% If not, define the counter and list entry.
+% \begin{macrocode}
+ \caption@ifin@list\caption@subtypelist{#4}%
+ {\caption@Debug{Modify subtype `#4'}}%
+ {\caption@Debug{New subtype `#4'}%
+ \newcounter{#4}[#3]%
+ \@namedef{ext@#4}{\csname ext@#3\endcsname}%
+ \caption@declaresublistentry{#3}%
+ \caption@l@addto@list\caption@subtypelist{#4}%
+ \caption@subtype@hook{#4}}%
+% \end{macrocode}
+% Support of \package{titletoc} package
+% \begin{macrocode}
+ \caption@ifdefined\contentsuse{%
+ \contentsuse{#4}{\csname ext@#4\endcsname}}{}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@namedef{#4name}{}%
+ \@namedef{#4autorefname}{\csname #3autorefname\endcsname}%
+ #1% is \@firstoftwo in star form, and \@secondoftwo otherwise
+ {\@namedef{p@#4}{}%
+ \@namedef{the#4}{\csname the#3\endcsname.\@nameuse{#2}{#4}}}%
+ {\@namedef{p@#4}{\csname the#3\endcsname}%
+ \@namedef{the#4}{\@nameuse{#2}{#4}}}%
+ \@namedef{theH#4}{\csname theH#3\endcsname.\arabic{#4}}}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@@@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declaresublistentry{%
+ \caption@ifdefined\l@chapter
+ {\caption@@declaresublistentry\l@subsection}%
+ {\caption@@declaresublistentry\l@subsubsection}}
+\@onlypreamble\caption@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@declaresublistentry[2]{%
+ \ifx#1\@undefined
+ \caption@@@declaresublistentry\relax\@dottedtocline\caption@nil{#2}%
+ \else
+ \expandafter\caption@@@declaresublistentry#1{}{}\@dottedtocline\caption@nil{#2}%
+ \fi}
+\@onlypreamble\caption@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@@declaresublistentry#1\@dottedtocline#2\caption@nil#3{%
+ \def\@tempa{#1}%
+% Does \l@(sub)subsection start with \@dottedtocline?
+ \ifx\@tempa\@empty
+% Yes
+ \caption@@@@declaresublistentry{#3}#2\caption@nil
+ \else
+% No
+ \caption@@@@declaresublistentry{#3}@{3.8em}{3.2em}\caption@nil
+ \fi}
+\@onlypreamble\caption@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@@declaresublistentry#1#2#3#4#5\caption@nil{%
+ \expandafter\caption@@@@@declaresublistentry\expandafter
+ {\csname @dotted\csname ext@#1\endcsname line\endcsname}{#1}{#3}{#4}}
+\@onlypreamble\caption@@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@@declaresublistentry[4]{%
+ \@namedef{l@sub#2}{#1{2}{#3}{#4}}%
+ \expandafter\caption@@@@@@declaresublistentry
+ \expandafter#1\expandafter{\csname ext@#2\endcsname depth}}
+\@onlypreamble\caption@@@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@@@declaresublistentry[2]{
+ \ifx#1\relax
+ \def#1##1{%
+ \def\next{\@dottedtocline{##1}}%
+ \@ifundefined{c@#2}{}{%
+ \ifnum ##1>\@nameuse{c@#2}\relax
+ \let\next\@gobblefour
+ \else
+ \c@tocdepth=\@nameuse{c@#2}\relax
+ \fi}%
+ \next}%
+ \fi}
+\@onlypreamble\caption@@@@@@declaresublistentry
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subtypelist}
+% A list containing the sub-types defined with |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% \begin{macrocode}
+\newcommand*\caption@subtypelist{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifsubtype}
+% \changes{v1.8g}{2020/01/02}{This macro added}
+% \changes{v1.13}{2020/07/28}{Uses \cs{caption@ifin@list} now}
+% This macro checks if the given subtype was defined
+% with |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% \begin{macrocode}
+\newcommand*\caption@ifsubtype{%
+ \caption@ifin@list\caption@subtypelist}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ForEachCaptionSubType}
+% \changes{v1.13}{2020/07/29}{This macro added as replacement for \cs{caption@For}}
+% |\ForEachCaptionSubType|\marg{code with \#1}\\
+% |\ForEachCaptionSubType*|\marg{code with \#1}\par
+% will execute the given code for each (known) sub-type.
+% The starred variant will only work for already existing sub-types,
+% i.e.~no hook will be placed inside |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% \begin{macrocode}
+\newcommand*\ForEachCaptionSubType{%
+ \@ifstar
+ {\caption@foreach@subtype\@gobble}%
+ {\caption@foreach@subtype\@iden}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@foreach@subtype[2]{%
+ \caption@for@list\caption@subtypelist{#2}%
+ #1{\caption@addto@subtype@hook{#2}}}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand\caption@addto@subtype@hook[1]{%
+ \toks@=\expandafter{\caption@subtype@hook{##1}#1}%
+ \edef\@tempa{\def\noexpand\caption@subtype@hook####1{\the\toks@}}%
+ \@tempa}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@subtype@hook[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% Unfortunately the \class{memoir} document class resets the
+% \texttt{subfigure} resp.~\texttt{subtable} counter at the begin
+% of floating environments, i.e.~at |\@float|.
+% As a side-effect |\continued|\-|float| does not work correctly.
+% For that reason we need to introduce macros to save and restore
+% all sub-caption counters here.
+%
+% \begin{macro}{\caption@savesubcounters}
+% \changes{v1.5}{2013/05/01}{This macro added}
+% \changes{v1.13}{2020/07/28}{Uses \cs{caption@for@list} now for iterating the list}
+% |\caption@save|\-|sub|\-|counters| saves all sub-caption counters,
+% so they can be restored with |\caption@restore|\-|counters| later on.
+% \begin{macrocode}
+\newcommand*\caption@savesubcounters{%
+ \caption@for@list\caption@subtypelist{\caption@savecounter{##1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@savecounter}
+% \changes{v1.5}{2013/05/01}{This macro added}
+% |\caption@save|\-|counter|\marg{counter} saves the given counter,
+% so it can be restored with |\caption@restore|\-|counters| later on.
+% \begin{macrocode}
+\newcommand*\caption@savecounter[1]{%
+ \edef\caption@tempa{%
+ \noexpand\l@addto@macro\noexpand\caption@restore@counters
+ {\noexpand\setcounter{#1}{\number\value{#1}}}}%
+ \caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@restorecounters}
+% \changes{v1.5}{2013/05/01}{This macro added}
+% |\caption@restore|\-|counters| restores all counters saved with
+% |\caption@save|\-|counter|.
+% \begin{macrocode}
+\newcommand*\caption@restorecounters{%
+ \caption@restore@counters
+ \global\let\caption@restore@counters\@empty}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@restore@counters{}
+% \end{macrocode}
+% \end{macro}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \clearpage
+% \begin{thebibliography}{99}
+% \bibitem{TLC2}
+% Frank Mittelbach and Michel Goossens:\\
+% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\
+% \newblock Addison-Wesley, 2004.
+%
+% \bibitem{Anne}
+% Anne Br\"uggemann-Klein:\\
+% \emph{Einf\"uhrung in die Dokumentverarbeitung},\\
+% B.G. Teubner, Stuttgart, 1989
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/hyperref}%
+% {\emph{Hypertext marks in \LaTeX}},\\
+% November 12, 2007
+%
+% \bibitem{refcount}
+% Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/refcount}%
+% {\emph{The refcount package}},\\
+% 2006/02/20
+%
+% \bibitem{threeparttable}
+% Donald Arseneau:\\
+% \href{http://www.ctan.org/pkg/threeparttable}%
+% {\emph{Three part tables: title, tabular environment, notes}},\\
+% 2003/06/13
+% \end{thebibliography}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.5/caption.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.5/caption.dtx
new file mode 100644
index 00000000000..c573255554c
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.5/caption.dtx
@@ -0,0 +1,4292 @@
+% \iffalse meta-comment
+%
+% This is file `caption.dtx'.
+%
+% Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files
+% caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx,
+% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx,
+% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx,
+% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx,
+% the derived files
+% caption.sty, caption-light.sty, caption2.sty, caption3.sty,
+% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto,
+% caption-koma.sto, caption-memoir.sto, caption-ntg.sto,
+% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty,
+% and the user manuals
+% caption-deu.tex, caption-eng.tex, caption-rus.tex.
+%
+% \fi
+% \CheckSum{2692}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{caption.drv}[2020/10/11 v3.5 Implementation of the caption package]
+\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+\makeatletter % make room for subsections like 2.16.14 in the TOC
+%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
+\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
+\makeatother
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage[debug]{caption}[2013/01/01]
+%
+\DeclareRobustCommand*\eTeX{\texorpdfstring
+ {\leavevmode\hbox{$\varepsilon$}-\TeX}%
+ {e-TeX}}
+%
+\begin{document}
+ \DocInput{caption.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \newcommand*\purerm[1]{\texorpdfstring{{\upshape\mdseries\rmfamily #1}}{#1}}
+% \newcommand*\puresf[1]{\texorpdfstring{{\upshape\mdseries\sffamily #1}}{#1}}
+% \newcommand*\purett[1]{\texorpdfstring{{\upshape\mdseries\ttfamily #1}}{#1}}
+% \let\class\puresf \let\package\puresf
+% \let\env\purett \let\opt\purett
+%
+% \def\thispackage{the \package{caption} package}
+% \def\Thispackage{The \package{caption} package}
+%
+% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+% \newcommand*\version[2][]{v$#2$}
+%
+% \newcommand*\issue[1]{GitLab~\##1}
+%
+% \GetFileInfo{caption.drv}
+% \let\docdate\filedate
+% \let\docversion\fileversion
+% \GetFileInfo{caption.sty}
+%
+% \title{The Implementation of
+% \texorpdfstring{\thispackage\thanks{%^^A
+% This package has version number \docversion.}}%^^A
+% {the caption package}}
+% \author{Axel Sommerfeldt\\
+% \url{https://gitlab.com/axelsommerfeldt/caption}}
+% \date{\docdate}
+% \maketitle
+%
+% \begin{abstract}
+% \Thispackage\ consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% \Thispackage\ redefines the \LaTeX\ commands
+% |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
+% |\caption@@make|, giving the user the possibility to control the look \& feel
+% of the captions from floating environments like |figure| and |table|.
+% Furthermore it does similar to the caption stuff coming from other packages
+% (like the \package{longtable} or \package{supertabular} package):
+% Mapping the appropriate internal commands (like |\LT@makecaption| or
+% |\ST@caption|) to the ones offered by the \package{caption3} kernel.
+% So you can think of \thispackage\ as a layer package, it
+% simply provides adaptation layers between the caption stuff coming from
+% \LaTeXe\ or packages, and the caption stuff offered by the
+% \package{caption3} kernel.
+% \end{abstract}
+%
+% \section*{User manual}
+%
+% This document is describing the code implementation only.
+% The user documentation can be found in
+% \nopagebreak\begin{quote}
+% \begin{tabular}{ll}
+% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-eng.pdf}%
+% {\texttt{caption-eng.pdf}} & The English documentation \\
+% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-rus.pdf}%
+% {\texttt{caption-rus.pdf}} & The Russian documentation\footnotemark \\
+% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-deu.pdf}%
+% {\texttt{caption-deu.pdf}} & The German documentation \\
+% \end{tabular}
+% \footnotetext{Thanks a lot to Olga Lapko for this translation}
+% \end{quote}
+%
+% \pagebreak[4]
+% \section*{Internal commands}
+%
+% These internal commands are save to use by other packages as well
+% since their interface will not change in future releases:
+% \begin{quote}\begin{tabular}{ll}
+% Internal command & Currently used by \\
+% \hline
+% |\caption@kernel@addcontentsline| & \package{floatrow} \\
+% |\caption@makecaption| & \package{bidi} \\
+% |\caption@settype| & \package{newfloat} \\
+% |\caption@setsubtype| & \package{floatrow} \\
+% |\caption@starfalse| & \package{bidi} \\
+% |\caption@startrue| & \package{bidi} \\
+% |\caption@xlabel| & \package{cleveref} \\
+% \end{tabular}\end{quote}
+%
+% If your package wants to use any other internal command of the \package{caption} package,
+% please write me an e-mail so we can define a proper interface together.
+%
+% The \package{lwarp} package uses a lot of internal commands as well,
+% but we are working on it on the Git branch \texttt{feature/lwarp}:
+% \url{https://gitlab.com/axelsommerfeldt/caption/-/tree/feature/lwarp}
+%
+% \StopEventually{}
+% \clearpage
+% \tableofcontents
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
+%
+% \changes{v1.0}{1994/10/27}{First release}
+% \changes{v1.1}{1994/11/03}{New option \texttt{centerlast}}
+% \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
+% \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
+% \changes{v1.4}{1995/01/30}{New option \texttt{nooneline}}
+% \changes{v1.4b}{1995/04/05}{Bugfix release}
+% \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v3.0d}{2004/11/28}{Split into two packages: \package{caption} \& \package{caption3}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \section{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption}[2020/10/26 v3.5g Customizing captions (AR)]
+% \end{macrocode}
+%
+% \section{Loading the kernel}
+%
+% \begin{macrocode}
+\RequirePackage{caption3}[=2020/10/06] % needs v2.2b or newer
+% \end{macrocode}
+%
+% \section{Check against unknown document classes}
+%
+% \begin{macrocode}
+\caption@ifbool{documentclass}{}{%
+ \caption@WarningNoLine{%
+ Unknown document class (or package),\MessageBreak
+ standard defaults will be used}}
+% \end{macrocode}
+%
+% \section{Check against incompatible packages}
+%
+% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
+% \begin{macrocode}
+\@ifpackageloaded{caption2}{%
+ \caption@Error{%
+ You can't use both, the (obsolete) caption2 *and*\MessageBreak
+ the (current) caption package}%
+ \endinput
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{ftcap} package added}
+% \changes{v3.1}{2007/06/15}{Check against incompatible \package{nonfloat} package added}
+% \changes{v3.1}{2007/06/18}{Check against incompatible \package{topcapt} package added}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}%
+ \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}%
+ \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}}
+% \end{macrocode}
+% \begin{macro}{\caption@DisablePositionOption}
+% \changes{v3.1g}{2008/03/20}{\texttt{position=b} added}
+% \changes{v3.1h}{2008/03/29}{%
+% Name changed from \cs{caption@IncompatiblePackage} to \cs{caption@DisablePositionOption};
+% disables the `position' option now instead of issuing a warning}
+% |\caption@DisablePositionOption|\marg{package}\par
+% disables the `position' option.
+% \begin{macrocode}
+\newcommand*\caption@DisablePositionOption[1]{%
+ \caption@InfoNoLine{%
+ `#1' package detected; setting `position=b' for compatibility reasons}%
+ \caption@setposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{position}{%
+ \caption@Error{Usage of the `position' option is incompatible\MessageBreak
+ to the `#1' package}}}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@DisablePositionOption
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Declaration of options}
+%
+% \subsection{Miscellaneous options}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{config}[caption]{%
+ \InputIfFileExists{#1.cfg}%
+ {\typeout{*** Local configuration file #1.cfg used ***}}%
+ {\caption@Warning{Configuration file #1.cfg not found}}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@selectlistentry}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% |\caption@selectlistentry|\marg{\purett{heading} or \purett{entry}}
+% \begin{macrocode}
+\newcommand*\caption@selectlistentry[1]{%
+ \caption@ifinlist{#1}{heading}{%
+ \let\caption@iflistheading\@firstoftwo
+ }{\caption@ifinlist{#1}{default,list-entry,entry}{%
+ \let\caption@iflistheading\@secondoftwo
+ }{%
+ \caption@Error{Undefined list-entry selection `#1'}%
+ }}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.3}{2012-03-25}{Option \opt{list-entry} added}
+% \begin{macrocode}
+\DeclareCaptionOption{list-entry}{\caption@selectlistentry{#1}}
+\captionsetup{list-entry=default}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@declparboxrestore}
+% \changes{v3.5g}{2020/10/26}{This macro added}
+% |\caption@declparboxrestore|\marg{name}\marg{code}
+% \begin{macrocode}
+% TODO: Remove \caption@declparboxrestore
+\newcommand\caption@declparboxrestore{%
+ \caption@decl{parboxrestore}}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@declparboxrestore
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setparboxrestore}
+% \changes{v3.2}{2010/11/07}{This macro added}
+% \changes{v3.5g}{2020/10/26}{New implementation; default changed from `partial' to `full'}
+% |\caption@setparboxrestore|\marg{\purett{partial} or \purett{full}}
+% \begin{macrocode}
+% TODO: Remove \caption@setparboxrestore
+\newcommand*\caption@setparboxrestore{%
+ \caption@set{parboxrestore}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@declparboxrestore{full}{%
+ \@parboxrestore}
+% \end{macrocode}
+% The original code (from |latex/base/ltboxes.dtx|):
+% \begin{verbatim}
+% \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}
+% \def\@arrayparboxrestore{%
+% \let\if@nobreak\iffalse
+% \let\if@noskipsec\iffalse
+% \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+% \parindent\z@ \parskip\z@skip
+% \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+% \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+% \parfillskip\@flushglue \lineskip\normallineskip
+% \baselineskip\normalbaselineskip
+% \sloppy}
+% \end{verbatim}%^^A
+% This one will be used by |\@caption| instead of |\@parboxrestore|.
+% \begin{macrocode}
+\caption@declparboxrestore{partial}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+% \let\-\@dischyph
+% \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parindent\z@ \parskip\z@skip
+ \everypar{}%
+% \linewidth\hsize
+% \@totalleftmargin\z@
+ \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+ \parfillskip\@flushglue \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \sloppy
+ \let\\\@normalcr}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@parboxrestore@mini}
+% \changes{v3.2}{2010/10/24}{This macro added}
+% \changes{v3.5g}{2020/10/26}{Renamed from \cs{caption@boxrestore@mini} to \cs{caption@parboxrestore@mini}}
+% Resets |\par| so the very first |\par| in |\@caption| behaves quite the same as in floating environments.
+% Will be used by |\set|\-|caption|\-|type|.
+% \begin{macrocode}
+\caption@declparboxrestore{mini}{%
+ \let\par\@@par
+ \parindent\z@ \parskip\z@skip
+ \sloppy}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `full'.
+% \changes{v3.5g}{2020/10/26}{The default of \cs{caption@parboxrestore} maps to `full' instead of `partial' now}
+% \begin{macrocode}
+\SetCaptionDefault{parboxrestore}{full}
+% \end{macrocode}
+%
+% \changes{v3.2}{2010/11/07}{Option \opt{parboxrestore} added}
+% \begin{macrocode}
+% TODO: Remove the (undocumentated) option "parboxrestore"
+\DeclareCaptionOption{parboxrestore}{\caption@setparboxrestore{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@parboxrestore}
+% \changes{v3.1}{2007/03/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added}
+% \changes{v3.2}{2010/11/07}{Support of option \opt{parboxrestore} added}
+% \changes{v3.5g}{2020/10/26}{New implementation; renamed from \cs{caption@boxrestore} to \cs{caption@parboxrestore}}
+% \begin{macrocode}
+% TODO: Change definition to \def\caption@parboxrestore{\@parboxrestore}
+\captionsetup{parboxrestore=default}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1f}{2007/11/28}{Option \opt{@minipage=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{@minipage}{%
+ \caption@ifinlist{#1}{auto,default}%
+ {\let\caption@if@minipage\@gobbletwo}%
+ {\caption@set@bool\caption@if@minipage{#1}}}
+\captionsetup{@minipage=default}
+% \end{macrocode}
+%
+% \subsection{caption v1.x compatibility options}
+% \changes{v3.1}{2007/07/21}{Option `compatibility' added}
+% \changes{v3.1}{2007/09/01}{caption v1.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v1.x$ compatibility options}
+% \changes{v3.5a}{2020/09/02}{caption v1.x compatibility options fixed}
+%
+% Currently we support |v1| and |v3| as values for the |compatibility=| option.
+% But since this used to be a boolean option is the past we still support any boolean value
+% for compatibility reasons.
+%
+% \begin{macrocode}
+\DeclareCaptionOption{compatibility}[v1]{%
+ \caption@ifinlist{#1}{v1,1,true,yes,on}{%
+ \let\caption@ifcompatibility\@firstoftwo
+ }{\caption@ifinlist{#1}{v3,3,0,false,no,off}{%
+ \let\caption@ifcompatibility\@secondoftwo
+ }{%
+ \caption@Error{Undefined compatibility value `#1'}%
+ }}}
+\@onlypreamble@key{caption}{compatibility}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@setbool{compatibility}{0} % default: Try not to be compatible to v1.x
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setincompatible}
+% \changes{v3.4}{2019/09/09}{This macro added}
+% |\caption@setincompatible|\marg{condition}\marg{message text}
+% \begin{macrocode}
+\newcommand*\caption@setincompatible[2]{%
+ #1{%
+ \caption@WarningNoLine{%
+ #2;\MessageBreak
+ Setting compatibility to v1}%
+ \caption@setbool{compatibility}{1}%
+ }{}}
+% \end{macrocode}
+% \end{macro}
+%
+% Check against incompatible packages which used to work fine with v1 of the `caption' package.
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@ifcompatibility{}{%
+% \end{macrocode}
+% The usage of the (now obsolete) \package{captcont} package,
+% which brings its own definition of |\caption*|, was quite common in the old days.
+% \begin{macrocode}
+ \caption@setincompatible{\@ifpackageloaded{captcont}}{captcont package is loaded}%
+% \end{macrocode}
+% To be continued\ldots
+% \begin{macrocode}
+}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{normal}{%
+ \caption@setup{format=plain,justification=justified}}
+\DeclareCaptionOptionNoValue*{isu}{%
+ \caption@setup{format=hang,justification=justified}}
+\DeclareCaptionOptionNoValue*{hang}{%
+ \caption@setup{format=hang,justification=justified}}
+\DeclareCaptionOptionNoValue*{center}{%
+ \caption@setup{format=plain,justification=centering}}
+\DeclareCaptionOptionNoValue*{centerlast}{%
+ \caption@setup{format=plain,justification=centerlast}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}}
+\DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}}
+\DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}}
+\DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}}
+\DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}}
+\DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{up}{\caption@setup{labelfont+=up}}
+\DeclareCaptionOptionNoValue*{it}{\caption@setup{labelfont+=it}}
+\DeclareCaptionOptionNoValue*{sl}{\caption@setup{labelfont+=sl}}
+\DeclareCaptionOptionNoValue*{sc}{\caption@setup{labelfont+=sc}}
+\DeclareCaptionOptionNoValue*{md}{\caption@setup{labelfont+=md}}
+\DeclareCaptionOptionNoValue*{bf}{\caption@setup{labelfont+=bf}}
+\DeclareCaptionOptionNoValue*{rm}{\caption@setup{labelfont+=rm}}
+\DeclareCaptionOptionNoValue*{sf}{\caption@setup{labelfont+=sf}}
+\DeclareCaptionOptionNoValue*{tt}{\caption@setup{labelfont+=tt}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{nooneline}{\caption@setup{slc=0}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\caption@setbool{ruled}{0}
+\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}}
+% \end{macrocode}
+%
+% \subsection{caption2 v2.x compatibility options}
+% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
+% \changes{v3.1}{2007/09/01}{caption2 v2.x compatibility options revised}
+% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v2.x$ compatibility options}
+% \changes{v3.5a}{2020/09/02}{caption v2.x compatibility options fixed}
+%
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{flushleft}{%
+ \caption@setup{format=plain,justification=raggedright}}
+\DeclareCaptionOptionNoValue*{flushright}{%
+ \caption@setup{format=plain,justification=raggedleft}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{oneline}{\caption@setup{slc=1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{%
+ \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}}
+% \end{macrocode}
+%
+% \subsection{Obsolete caption v3.0 options}
+% \changes{v3.1}{2007/05/07}{Package option \opt{caption} marked as obsolete,
+% gives error now}
+%
+% \begin{macrocode}
+\DeclareCaptionOption*{caption}{%
+ \caption@setbool{temp}{#1}%
+ \caption@ifbool{temp}{}{%
+ \caption@Error{%
+ The package option `caption=#1' is obsolete.\MessageBreak
+ Please pass this option to the subfig package instead\MessageBreak
+ and do *not* load the caption package anymore}}}
+% \end{macrocode}
+%
+% \subsection{fltpage package support options}
+%
+% \changes{v3.1}{2007/09/01}{Options `FPlist' \& `FPref' added}
+% With these options is controlled where the list-of entry and |\ref| resp.
+% |\pageref| or |\autoref| will link to.
+% Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent,
+% but compatible to the usual behaviour of the \package{fltpage} package.
+% \begin{macrocode}
+\DeclareCaptionOption{FPlist}[1]{\caption@setFPoption{list}{#1}}
+\DeclareCaptionOption{FPref}[1]{\caption@setFPoption{ref}{#1}}
+\@onlypreamble@key{caption}{FPlist}
+\@onlypreamble@key{caption}{FPref}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setFPoption[2]{%
+ \edef\caption@tempa{\@car#2\@nil}%
+ \caption@setbool{FP#1cap}{\if c\caption@tempa 1\else 0\fi}}
+\@onlypreamble\caption@setFPoption
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{FPlist=caption,FPref=figure}
+% \end{macrocode}
+%
+% \subsection{hyperref package support options}
+%
+% \changes{v3.1}{2007/06/21}{Options `hypcap' \& `hypcapspace' added}
+% With |hypcap=off| one can turn the \package{hypcap} support off
+% (default is |on|).
+% \begin{macrocode}
+\DeclareCaptionOption{hypcap}[1]{\caption@setbool{hypcap}{#1}}
+\DeclareCaptionOption{hypcapspace}{\def\caption@hypcapspace{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\captionsetup{hypcap=1,hypcapspace=.5\baselineskip}
+% \end{macrocode}
+%
+% \section{Document class support}
+%
+% Execute the code declared with |\At|\-|Caption|\-|Package|.
+% We do this right before processing the options so stuff done with
+% |\At|\-|Caption|\-|Package| could be overwritten by user options.
+%
+% \begin{macrocode}
+\caption@documentclass@code
+\let\caption@documentclass@code\@undefined
+\let\AtCaptionPackage\@firstofone
+% \end{macrocode}
+%
+% \section{Processing of options}
+%
+% \changes{v3.0m}{2007/03/04}{Verbose option added}
+% \changes{v3.1}{2007/07/02}{Verbose option removed from package}
+% \changes{v3.1}{2007/03/17}{We do not process global options anymore}
+%
+% \begin{macrocode}
+\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}
+\caption@ProcessOptions*{caption}
+% \end{macrocode}
+%
+% \section{\cs{caption}, \cs{@caption}, and \cs{@makecaption}}
+%
+% \begin{macro}{\caption@ifflag}
+% \changes{v3.3}{2011/12/28}{This switch added}
+% \changes{v3.3}{2018/08/08}{Rewritten (and renamed) so a counter is used instead of a switch}
+% Since we support continued floats and sub-figures it's not an easy task
+% to manage the figure (and table) counter. (Especially since previous versions
+% of the caption package has proven that correcting a counter locally is not a good idea.)
+%
+% These three switches hold the
+% current status: |\caption@if|\-|flag{2}| is set if the caption was already
+% typeset (so the counter doesn't need to be incremented for sub-figures),
+% |\caption@if|\-|flag{4}| is set if there is already content which have
+% incremented the counter (so the counter doesn't need to be incremented
+% for the main caption, further sub-figures, and other stuff), and
+% |\caption@if|\-|flag{1}| is set if |\continued|\-|float| was given.
+%
+% In the past three boolean switches were used to store the flags, but since some
+% packages (like the \package{floatrow} and \package{tabu} package) try hard to keep
+% counter changes locally under certain circumstances, it seems a good idea to make
+% these flags a counter value, too.
+% \begin{macrocode}
+\newcounter{caption@flags}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifflag[1]{%
+ \@tempcnta\c@caption@flags
+ \divide\@tempcnta #1\relax
+ \ifodd\@tempcnta
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clrflags}
+% \changes{v3.3}{2018/08/08}{This macro added}
+% \begin{macro}{\caption@clrflag}
+% \changes{v3.3}{2013/04/14}{This macro added}
+% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
+% \begin{macro}{\caption@setflag}
+% \changes{v3.3}{2013/04/14}{This macro added}
+% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
+% Furthermore we introduce the macros \cs{caption@clrflag} and \cs{caption@setflag}
+% for clearing resp.~setting these flags.
+% \begin{macrocode}
+\newcommand*\caption@clrflags{%
+ \setcounter{caption@flags}\z@}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@clrflag[1]{%
+ \caption@ifflag{#1}{\caption@addtoflags{-#1}}{}}
+\newcommand*\caption@setflag[1]{%
+ \caption@ifflag{#1}{}{\caption@addtoflags{#1}}}
+\newcommand*\caption@addtoflags{%
+ \addtocounter{caption@flags}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@caption}
+% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
+% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
+% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% Here comes our definition of |\caption| and |\caption*|.
+% Beside the support of the starred variant this code was adapted to the
+% various packages we support.
+% We are using |\caption@dblarg| instead of |\@dblarg| so |\caption{}|
+% (with an empty arg.) will produce a list-of entry, but |\caption[]{}|
+% won't.
+% \begin{macrocode}
+\def\caption@caption{%
+ \caption@iftype
+ {\caption@checkgrouplevel\@empty\caption
+ \caption@star
+ {\caption@refstepcounter\@captype}%
+ {\caption@dblarg{\@caption\@captype}}}%
+ {\caption@Error{\noexpand\caption outside float}%
+ \caption@gobble}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@star}
+% \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}}
+% \changes{v3.2c}{2011/08/21}{\cs{global} removed}
+% A helper macro which processes the optional |*| after |\caption|.
+% \begin{macrocode}
+\newcommand*\caption@star[2]{%
+ \@ifstar{\caption@startrue#2[]}{#1#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@caption}
+% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
+% \changes{v3.1f}{2007/11/28}{Bugfix: Handling of \texttt{@minipage} flag added}
+% \changes{v3.1f}{2007/11/28}{Support of option \opt{@minipage} added}
+% \changes{v3.1g}{2008/03/16}{Internal: Uses \cs{caption@prepareanchor} now}
+% \changes{v3.2d}{2011/10/21}{Adapted to the \textsf{memoir} document class}
+% \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved to \cs{caption@prepareanchor}}
+% \changes{v3.3}{2013/01/06}{Adapted to the \textsf{nag} package}
+% As above, our version has been adapted to the packages we support.
+% Additionally our code is nested by |\caption@begin|\-|ex| \&
+% |\caption@end| instead of |\begin|\-|group| \& |\end|\-|group|.
+% Furthermore we use |\caption@par|\-|box|\-|restore| instead of
+% |\@parbox|\-|restore|.
+% \begin{macrocode}
+\long\def\caption@@caption#1[#2]#3{%
+% \end{macrocode}
+% \begin{macrocode}
+ \ifcaption@star \else
+ \caption@prepareanchor{#1}{#2}%
+ \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}%
+ \@nameuse{nag@hascaptiontrue}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \par
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@setfloatcapt{%
+ \caption@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \caption@normalsize
+ \ifcaption@star
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \@makecaption{\csname fnum@#1\endcsname}%
+ {\ignorespaces\caption@makeanchor{#3}}\par
+ \caption@if@minipage\@minipagetrue\@minipagefalse}%
+ \caption@end}
+% \end{macrocode}
+% \class{memoir} document class stuff:
+% \begin{macrocode}
+\providecommand\memcaptioninfo[4]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareanchor}
+% \changes{v3.1g}{2008/03/16}{This macro added}
+% \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved from \cs{caption@@caption}}
+% \begin{macrocode}
+\newcommand*\caption@prepareanchor[2]{%
+ \caption@makecurrent{#1}{#2}%
+ \caption@ifhypcap\caption@@start\relax
+ \M@gettitle{#2}}
+% \end{macrocode}
+% \class{memoir} document class stuff:
+% \begin{macrocode}
+\providecommand\M@gettitle[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecaption}
+% \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added}
+% |\@makecaption|\marg{label}\marg{text}\par
+% We do basically the same as the original code (from the standard
+% \LaTeX\ document classes), but take care of the |position=| setting
+% and use |\caption@@make| from the \package{caption} kernel to finally
+% typeset the caption.
+% \begin{macrocode}
+\long\def\caption@makecaption#1#2{%
+ \caption@make@above
+ \caption@@make{#1}{#2}%
+ \caption@make@below}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@make@above}
+% \begin{macro}{\caption@make@below}
+% \changes{v3.3a}{2019/04/02}{This macro added}
+% |\caption@make@above|\\
+% |\caption@make@below|\par
+% Typesets the stuff above resp.~below the caption, depending on |\caption@iftop|.
+% \begin{macrocode}
+\newcommand*\caption@make@above{%
+ \caption@iftop
+ \caption@belowskip
+ {\caption@rule\caption@aboveskip}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@make@below{%
+ \caption@iftop
+ {\caption@aboveskip\caption@rule}%
+ \caption@belowskip}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@redefine}
+% \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now}
+% \begin{macrocode}
+\newcommand*\caption@redefine{}
+% \end{macrocode}
+% \end{macro}
+%
+% Prior to \version{3.4} we only redefined |\caption| and |\@caption| if the current definitions
+% were well known, so documents written in the old (\package{caption} package \version{1.x}) days
+% (where |\caption| \& |\@caption| were not redefined by us) still compiled fine.
+% This used to make sense when introducing \version{3.0} in the year 2003
+% but is simply overcautious and especially unwanted by the user nowadays.
+% So starting with \version{3.4} we only do not redefine |\caption| and |\@caption| if the
+% `compatibility' option is set to `v1'.
+%
+% \begin{macrocode}
+\g@addto@macro\caption@redefine{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifcompatibility{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@InfoNoLine{
+ \noexpand\caption will not be redefined since `compatibility' is set to v1}%
+% \end{macrocode}
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{}%
+% \end{macrocode}
+%
+% |\continuedfloat| is not supported in compatibility mode `v1'.
+% \begin{macrocode}
+ \renewcommand*\caption@continuedfloat[1]{%
+ \caption@Error{Not available with option `compatibility=v1'}}%
+% \end{macrocode}
+%
+% |\caption@start| is not supported in compatibility mode `v1'.
+% \begin{macrocode}
+ \caption@AtBeginDocument*{%
+ \let\caption@start\relax
+ \caption@ifdefined\caption@ORI@capstart{%
+ \caption@Debug{%
+ Restore hypcap definition of \string\capstart\@gobble}%
+ \let\capstart\caption@ORI@capstart}{}%
+ }%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@star}
+% We redefine |\caption@star| here so it does not make any harm.
+% \begin{macrocode}
+ \renewcommand*\caption@star[2]{#1#2}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption}
+% \begin{macro}{\@caption}
+% \begin{macrocode}
+ \renewcommand*\caption@redefine{%
+ \let\caption\caption@caption
+ \let\@caption\caption@@caption}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@redefine
+ \caption@AtBeginDocument*{%
+ \let\caption@ORI@capstart\@undefined}%
+% \end{macrocode}
+%
+% \begin{macro}{\@xfloat}
+% \changes{v3.1}{2007/05/09}{This re-definition added}
+% \changes{v3.1b}{2007/09/22}{Will now be redefined in compatibility mode, too}
+% \changes{v3.5}{2020/08/30}{Hook added}
+% We redefine |\@x|\-|float| so inside floating environments our
+% type-specific options will be used, a \package{hyperref}
+% anchor will be set etc.
+% \begin{macrocode}
+ \let\caption@ORI@xfloat\@xfloat
+% \end{macrocode}
+% \begin{macrocode}
+ \def\@xfloat#1[#2]{%
+ \caption@ORI@xfloat{#1}[#2]%
+ \caption@settype{#1}%
+ \caption@xfloat@hook}%
+% \end{macrocode}
+% Hook, could be extended with |\g@addto@macro\caption@x|\-|float@hook{|\ldots|}|.
+% (The caption type could be found in |\@cap|\-|type|.)
+% \begin{macrocode}
+ \newcommand*\caption@xfloat@hook{}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xdblfloat}
+% \changes{v3.5}{2020/08/30}{Re-definition of \cs{xdblfloat} added}
+% We redefine |\@xdbl|\-|float|, too, so special options for |figure*|
+% resp.~|table*| will be applied here.
+% \begin{macrocode}
+ \let\caption@ORI@xdblfloat\@xdblfloat
+% \end{macrocode}
+% \begin{macrocode}
+ \def\@xdblfloat#1[#2]{%
+ \caption@ORI@xdblfloat{#1}[#2]% expands to \@xfloat{#1}[#2] + extra stuff
+ \caption@setoptions{#1*}%
+ \caption@xdblfloat@hook}%
+% \end{macrocode}
+% Hook, could be extended with |\g@addto@macro\caption@xdbl|\-|float@hook{|\ldots|}|.
+% (The caption type could be found in |\@cap|\-|type|.)
+% \begin{macrocode}
+ \newcommand*\caption@xdblfloat@hook{}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% Some packages (like the \package{hyperref} package for example) redefines
+% |\caption| and |\@caption|, too.
+% So we have to use |\AtBeginDocument| here, so we can make sure
+% our definition is the one which will be valid at last.
+% \begin{macrocode}
+\caption@AtBeginDocument{\caption@redefine}
+% \end{macrocode}
+%
+% \begin{macro}{\@makecaption}
+% \begin{macrocode}
+\let\@makecaption\caption@makecaption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phantomcaption}
+% \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added}
+% |\phantomcaption|\par
+% Use this one for figures with subcaptions but without main caption.
+% \begin{macrocode}
+\newcommand\phantomcaption{%
+ \caption@iftype
+ {\caption@refstepcounter\@captype}%
+ {\caption@Error{\noexpand\phantomcaption outside float}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \section{\cs{setcaptiontype} and \cs{setcaptionsubtype}}
+%
+% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
+% \changes{v3.1}{2007/06/25}{Option \opt{type*=} added}
+% \changes{v3.1f}{2007/11/16}{Option \opt{subtype} \& \opt{subtype*} added}
+% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Option \opt{type=} uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOption{type}{\setcaptiontype{#1}}%
+ \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \DeclareCaptionOptionNoValue{subtype}{\setcaptionsubtype\relax}%
+ \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \emph{Important Note:}
+% Like |\captionof| the option |type=| should only be used inside a
+% group, box, or environment and does not check if the argument is a valid
+% floating environment or not.
+%
+% \begin{macro}{\setcaptiontype}
+% \changes{v3.2}{2010/10/24}{This macro added}
+% \changes{v3.4e}{2020/01/02}{Check added if the subtype is defined}
+% \changes{v3.5}{2020/08/24}{Definition method adapted to the \package{caption-light} package}
+% Like |\captionsetup{type=xxx}|, but also works if |\caption|\-|setup| was redefined.
+% \begin{macrocode}
+\def\setcaptiontype{%
+ \caption@parboxrestore@mini
+ \caption@settype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionsubtype}
+% \changes{v3.2a}{2011/08/15}{This macro added}
+% \changes{v3.5d}{2020/09/28}{This macro revised}
+% Same, but sets the sub-type.
+% \begin{macrocode}
+\newcommand\setcaptionsubtype{%
+ \caption@iftype
+ \caption@setsubtype
+ {\caption@Error{\noexpand\setcaptionsubtype outside float}}}%
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@setsubtype{%
+ \caption@teststar\caption@@setsubtype\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setsubtype[1]{%
+ \caption@@@settype{sub}{#1}{sub\@captype}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@settype}
+% \changes{v3.1}{2007/05/09}{This macro added}
+% \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added}
+% \changes{v3.1d}{2007/10/23}{Error message for \cs{caption@checkgrouplevel} revised}
+% \changes{v3.1f}{2007/11/16}{\cs{caption@setsubtype} added}
+% \changes{v3.1f}{2007/12/03}{Crappy \cs{caption@iftypewarning} replaced}
+% \changes{v3.1g}{2008/01/12}{Usage of \cs{ifcaptionsetup@star} added}
+% \changes{v3.2}{2010/10/26}{Error message moved from here to \cs{caption@refstepcounter}}
+% \changes{v3.3}{2011/12/28}{Resetting of \cs{ifcaption@caption} and \cs{ifcaption@subcaption} added}
+% \changes{v3.4e}{2020/01/02}{Checks added to prevent misuse regading subtypes}
+% \changes{v3.5d}{2020/09/28}{This macro revised}
+% |\caption@settype*|\marg{type}\par
+% sets |\@captype| and executes the options associated with it
+% (using |\caption@set|\-|options|).
+% Furthermore we check |\current|\-|group|\-|level| (if avail),
+% redefine |\@currentlabel| so a |\label| before |\caption| will result
+% in a hint instead of a wrong reference, and
+% use the macro |\caption@|(|sub|)|type|\-|hook| (which will be used by our
+% \package{float} package support).\par
+% The non-starred version sets a \package{hyperref} anchor additionally
+% (if |hypcap=|\-|true| and the \package{hypcap} package is not loaded).
+% \begin{macrocode}
+\newcommand*\caption@settype{%
+ \caption@clrflags
+ \caption@set@type}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@type{%
+ \caption@teststar\caption@@settype\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@settype{%
+ \caption@@@settype{}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@settype[3]{%
+% #1 = "" or "sub"
+% #2 = \@firstoftwo in star form, \@secondoftwo otherwise
+% #3 = <type>, e.g.: "figure" or "subfigure"
+ \caption@Debug{#1type=#3}%
+ \@nameuse{caption@check#1type}{#3}%
+ {\caption@checkgrouplevel{#1}{%
+ \captionsetup{#1type#2*\@empty=...}#2{ or
+ \@backslashchar#1captionof}{}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@tempa{#3}%
+ \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else
+ \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi
+ \fi
+ \expandafter\let\csname @#1captype\endcsname\caption@tempa
+% \end{macrocode}
+% \begin{macrocode}
+ \@nameuse{caption@#1typehook}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setoptions{#3}%
+ \ifx\caption@opt\relax
+ \@nameundef{caption@#1type@warning}%
+ \else
+ \@namedef{caption@#1type@warning}{\caption@Warning{%
+ The #1type was already set to
+ `\csname @#1captype\endcsname'\MessageBreak}}%
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ #2{}{%
+ \let\@currentlabel\caption@undefinedlabel
+% \let\@currentHlabel\@undefined
+ \ifx\caption@x@label\@undefined
+ \let\caption@x@label\label
+ \let\label\caption@xlabel
+ \fi
+ \caption@start}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftype}
+% \changes{v3.1}{2007/04/11}{This macro and its usage added}
+% Since we often need to check if |\@captype| is defined (means: we
+% are inside a floating environment) this helper macro was introduced.
+% \begin{macrocode}
+\newcommand*\caption@iftype{\caption@ifdefined\@captype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checktype}
+% \changes{v3.4g}{2020/01/02}{This macro and its usage added}
+% \changes{v3.4m}{2020/07/29}{Check of \cs{sf@counterlist} from \package{subfig} package added}
+% |\caption@checktype|\marg{type}\marg{code}\par
+% is used by |\caption@settype| and should either expand the code or issue an error
+% if the given type is not a proper type, i.e. it is a sub-type instead (either defined by
+% |\DeclareCaptionSubType| or |\newsubfloat|\cite{subfig}).
+% \begin{macrocode}
+\newcommand*\caption@checktype[1]{%
+ \caption@ifsubtype{#1}\@firstoftwo{\caption@ifin@list\sf@counterlist{#1}}%
+ {\caption@Error{Should not be used with subtype `#1'}%
+ \@gobble}%
+ \@firstofone}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checksubtype}
+% \changes{v3.4g}{2020/01/02}{This macro and its usage added}
+% \changes{v3.4m}{2020/07/29}{Check of \cs{sf@counterlist} from \package{subfig} package added}
+% |\caption@checksubtype|\marg{type}\marg{code}\par
+% is used by |\caption@settype| and should either expand the code or issue an error
+% if the given type is not a proper sub-type, i.e. not defined by |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% Since the |sub|\-|float|\-|row| environment offered by the \package{floatrow} package\cite{floatrow}
+% is using |\caption|\-|setup{sub|\-|type}| even if the sub-type was defined by |\new|\-|sub|\-|float|
+% offered by \package{subfig}\cite{subfig}, we take a more relaxed view of things here and allow
+% those sub-types as well (but not without warning since we do not support this).
+% \begin{macrocode}
+\newcommand*\caption@checksubtype[1]{%
+ \caption@ifsubtype{#1}%
+ \@firstofone
+ {\caption@ifin@list\sf@counterlist{#1}%
+ {\caption@Warning{%
+ \noexpand\setcaptionsubtype without \string\DeclareCaptionSubType.\MessageBreak
+ This is not designed to work; you could try replacing\MessageBreak
+ the `subfig' package with `subcaption' to resolve\MessageBreak
+ this problem which occurred}%
+ \@firstofone}%
+ {\caption@Error{Undefined subtype `#1'}%
+ \@gobble}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checkgrouplevel}
+% \changes{v3.1}{2007/07/15}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)}
+% \changes{v3.3}{2013/04/21}{Uses \cs{caption@ifeTeX} now}
+% \changes{v3.5}{2019/09/11}{Relies on \eTeX{} now}
+% Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done
+% inside a group or not -- in the latter case a warning message will
+% be issued.
+% \begin{macrocode}
+\newcommand*\caption@checkgrouplevel[2]{%
+ \@ifundefined{#1caption@grouplevel}{%
+ \caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}%
+ \ifnum\currentgrouplevel>\caption@grouplevel\relax
+ \expandafter\edef\csname #1caption@grouplevel\endcsname{%
+ \the\currentgrouplevel}%
+ \else
+ \caption@Warning{\string#2\MessageBreak outside box or environment}%
+ \fi
+ }{}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@undefinedlabel}
+% \changes{v3.1}{2007/07/03}{This macro and its usage added}
+% \changes{v3.1b}{2007/09/22}{Contents changed to \texttt{??}}
+% \changes{v3.1i}{2008/04/13}{Contents changed to \cs{caption@xref}(\ldots)}
+% \changes{v3.1k}{2009/03/30}{Bugfix 08-12-08: \cs{caption@xref} is robust now}
+% \changes{v3.2c}{2011/09/13}{Text changed from `before' to `without proper'}
+% \changes{v3.3}{2016/02/21}{Text changed from `without proper \cs{caption}' to `without proper reference'}
+% This label will be used for |\currentlabel| inside (floating) environments
+% as default. (see above)
+% \iffalse\Note{All commands used have to be robust here.}\fi
+% \begin{macrocode}
+\newcommand*\caption@undefinedlabel{%
+ \protect\caption@xref{\caption@labelname}{\on@line}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareRobustCommand*\caption@xref[2]{%
+ \caption@WarningNoLine{\noexpand\label without proper reference#2}%
+ \@setref\relax\@undefined{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@labelname{??}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@xlabel}
+% \changes{v3.1b}{2007/09/22}{This macro and its usage added}
+% \changes{v3.1f}{2007/11/11}{Revised}
+% \changes{v3.1i}{2008/04/13}{Bugfix: \cs{pageref} should always work now}
+% \changes{v3.2c}{2011/08/19}{Works with optional arguments now, too}
+% The new code of |\label| inside floating environments.
+% |\label| will be redefined using |\caption@withoptargs|, so
+% |#1| are the optional arguments (if any), and
+% |#2| is the mandatory argument here.
+% \begin{macrocode}
+\newcommand*\caption@xlabel{%
+ \caption@withoptargs\caption@@xlabel}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@xlabel[2]{%
+ \caption@@@xlabel
+ \def\caption@labelname{#2}%
+ \caption@x@label#1{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@xlabel{%
+ \global\let\caption@@@xlabel\@empty
+ \@bsphack
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@xref[2]{%
+ \string\@setref\string\relax\string\@undefined{\string##1}}}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionof}
+% \changes{v3.1}{2007/05/09}{Uses \cs{caption@settype} instead of \cs{def}\cs{@captype}}
+% \changes{v3.1c}{2007/09/22}{Bugfix: Redefinition of \cs{caption@setfloatcapt} removed}
+% \changes{v3.1e}{2007/10/30}{Better compatibility: Will be defined with \cs{AtBeginDocument} now}
+% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
+% \changes{v3.5}{2020/08/24}{Definition method adapted to the \package{caption-light} package}
+% |\captionof|\marg{type}\oarg{lst\_entry}\marg{heading}\\
+% |\captionof*|\oarg{lst\_entry}\marg{heading}\par
+% \Note{This will be defined with \cs{AtBeginDocument} so
+% \cs{usepackage}\csmarg{caption,capt-of} will still work.
+% (Compatibility to \version{1.x})}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\captionof{\caption@teststar\caption@of{\caption*}\caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@of[2]{\setcaptiontype*{#2}#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{\cs{captionlistentry}}
+%
+% \begin{macro}{\captionlistentry}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v3.1g}{2008/01/20}{Starred variant added}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% |\captionlistentry|\oarg{float type}\marg{list entry}\\
+% |\captionlistentry*|\oarg{float type}\marg{list entry}
+% \begin{macrocode}
+\newcommand*\captionlistentry{%
+ \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionlistentry[1]{%
+ \@testopt{\caption@listentry{#1}}\@captype}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@listentry#1[#2]#3{%
+ \@bsphack
+ #1{\caption@gettitle{#3}}%
+ {\caption@refstepcounter{#2}%
+ \caption@makecurrent{#2}{#3}}%
+ \caption@addcontentsline{#2}{#3}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{\cs{captionbox}}
+%
+% \begin{macro}{\captionbox}
+% \changes{v3.2}{2010/12/17}{This macro added}
+% \changes{v3.2a}{2011/08/16}{\cs{captionsetup} replaces with \cs{captionbox@settype} and \cs{caption@setposition}}
+% \changes{v3.3}{2012/04/09}{Adapted to revised version of \cs{caption@withoptargs}}
+% \changes{v3.3}{2017/03/19}{When used with fixed witdh the content will not be hboxed anymore}
+% \changes{v3.3c}{2019/09/01}{Adapted so it could be used by \cs{subfloat} offered by \package{subcaption}}
+% \changes{v3.5}{2020/07/28}{Adapted to \package{caption3} v2.0}
+% A |\parbox| with contents and caption, separated by an invisible |\hrule|.
+% \begin{macrocode}
+\newcommand*\captionbox{%
+ \caption@withoptargs{\caption@ibox\@gobble}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@ibox[3]{%
+ \kernel@ifnextchar[%]
+ {\caption@iibox{#1}{#2}{#3}}%
+ {\caption@iibox@{#1}{#2}{#3}}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iibox#1#2#3[#4]{%
+ \@testopt{\caption@iiibox{#1}{#2}{#3}[{#4}]}\captionbox@innerpos@default}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iibox@#1#2#3#4{%
+ \setbox\@tempboxa\hbox{#4}%
+ \caption@iiibox{#1}{#2}{#3}[\wd\@tempboxa][\captionbox@innerpos@default]{\unhbox\@tempboxa}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iiibox#1{%
+ \caption@iiiibox{#1}\vbox\vtop}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@iiiibox#1#2#3#4#5[#6][#7]#8{%
+ \begingroup
+ #1*% set \caption@position
+ \caption@iftop{%
+ \endgroup
+ \parbox[t]{#6}{%
+ #1\relax
+ \caption@setposition t%
+ #2{\caption#4{#5}}%
+ \captionbox@hrule
+ \csname caption@justification@#7\endcsname
+ #8}%
+ }{%
+ \endgroup
+ \parbox[b]{#6}{%
+ #1\relax
+ \caption@setposition b%
+ \csname caption@justification@#7\endcsname
+ #8%
+ \captionbox@hrule
+ #3{\caption#4{#5}}}%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\captionbox@innerpos@default{c}
+\newcommand*\captionbox@hrule{\hrule\@height\z@\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@justification@c{\centering}
+\providecommand*\caption@justification@l{\raggedright}
+\providecommand*\caption@justification@r{\raggedleft}
+\providecommand*\caption@justification@s{}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{\cs{continuedfloat}}
+%
+% \begin{macro}{\continuedfloat}
+% \changes{v3.0i}{2005/11/12}{Optional argument added}
+% \changes{v3.0g}{2005/06/28}{Bugfix: \cs{newcounter} replaced by \cs{newcount}}
+% \changes{v3.1}{2007/07/02}{Format of \package{hyperref} extension changed}
+% \changes{v3.1}{2007/07/07}{\cs{caption@setoptions} added}
+% \changes{v3.1g}{2008/01/29}{Starred variant added}
+% \changes{v3.2f}{2011/12/17}{Undocumented optional argument removed}
+% \changes{v3.3}{2011/12/28}{Uses \cs{ifcaption@ContinuedFloat} now}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@restorecounters} added}
+% \changes{v3.3}{2013/12/16}{Bugfix: Does not use \cs{caption@ContinuedFloat} anymore since this breaks \cs{ContinuedFloat} offered by the \package{subfig} package}
+% \changes{v3.4}{2015/09/16}{Renamed from \cs{ContinuedFloat} to \cs{continuedfloat}}
+% \changes{v3.5f}{2020/10/06}{Usage of \cs{caption@restorecounters} removed}
+% |\continuedfloat|\\
+% |\continuedfloat*|\par
+% This mainly sets the appropriate flag, increments the
+% continuation counter, and executes the given options.
+% Furthermore we set |\caption@reset|\-|continued|\-|float| to |\@gobble| so the
+% continuation counter will not be reset to zero inside |\caption@ref|\-|step|\-|counter|.\par
+% When the \package{hyperref} package is used we have the problem
+% that the usage of |\continued|\-|float| will create duplicate
+% hyper links -- |\@current|\-|Href| will be the same for the main float and
+% the continued ones. So we have to make sure unique labels and references
+% will be created each time. We do this by extending |\the|\-|H|\-|figure| and
+% |\the|\-|H|\-|table|, so for continued floats the scheme
+% \begin{quote}\meta{type}|.|\meta{type \#}|\alph{|\meta{continued \#}|}|\end{quote}
+% will be used instead of
+% \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
+% \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
+% \Note{This does not help if the \package{hyperref} package option
+% \texttt{naturalnames=true} is set.}
+% \begin{macrocode}
+\def\continuedfloat{%
+ \caption@iftype
+ {\caption@continuedfloat\@captype}%
+ {\caption@Error{\noexpand\continuedfloat outside float}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@continuedfloat[1]{%
+ \@ifstar
+ {\caption@@refstepcounter\@captype
+ \caption@@continuedfloat{#1}}%
+ {\caption@continued@float{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@continued@float[1]{%
+ \edef\caption@tempa{#1}%
+ \ifx\caption@tempa\caption@CFtype
+ \caption@@continuedfloat{#1}%
+ \else
+ \caption@Error{Continued `#1' after `\caption@CFtype'}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@continuedfloat{%
+ \caption@setflag1% continued float
+ \caption@@@continuedfloat}
+\newcommand*\caption@@@continuedfloat{%
+ \stepcounter{continuedfloat}%
+ \caption@@@@continuedfloat}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@continuedfloat[1]{%
+ \caption@setoptions{ContinuedFloat}% for compatibility reasons
+ \caption@setoptions{continuedfloat}%
+ \caption@setoptions{continued#1}%
+ \expandafter\l@addto@macro\csname the#1\endcsname\thecontinuedfloat
+ \@ifundefined{theH#1}{}{%
+ \expandafter\l@addto@macro\csname theH#1\endcsname{%
+ \@alph\c@continuedfloat}}%
+ \let\caption@@@@continuedfloat\@gobble}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@CFtype{??}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thecontinuedfloat}
+% \changes{v3.4}{2015/09/16}{Renamed from \cs{theContinuedFloat} to \cs{thecontinuedfloat}}
+% This one is preset to \cs{@empty}, so usually the continuation counter is not
+% included in the caption label or references.
+% \begin{macrocode}
+\newcounter{continuedfloat}
+\let\c@ContinuedFloat\c@continuedfloat % defined for compatibility reasons
+\def\thecontinuedfloat{\theContinuedFloat}
+\let\theContinuedFloat\@empty % defined for compatibility reasons
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@reset@continuedfloat}
+% \changes{v3.2f}{2011/12/17}{Redefinition of \cs{continuedfloat} added}
+% |\caption@reset@continuedfloat|\marg{type}\par
+% If a continuation counter is defined, we reset it.
+% (This one will be called inside |\@caption|.)
+% \begin{macrocode}
+\newcommand*\caption@reset@continuedfloat[1]{%
+ \xdef\caption@CFtype{#1}%
+ \@stpelt{continuedfloat}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ContinuedFloat}
+% For compatibility reasons we still support |\Continued|\-|Float|.
+% \begin{macrocode}
+\def\ContinuedFloat{\continuedfloat} % defined for compatibility reasons
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ContinuedFloat}
+% \changes{v3.0f}{2005/06/11}{This macro added}
+% \changes{v3.3}{2013/12/16}{Bugfix: Revised and defined with \cs{def} instead of \cs{newcommand}}
+% |\caption@ContinuedFloat|\marg{type}\par
+% This one is used by \cs{ContinuedFloat} offered by the \package{subfig} package.
+% \begin{macrocode}
+\def\caption@ContinuedFloat{%
+ \let\caption@reset@continuedfloat\@gobble
+ \caption@@@continuedfloat}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Internal helpers}
+%
+% \begin{macro}{\caption@refstepcounter}
+% \changes{v3.1}{2007/07/28}{This macro added}
+% \changes{v3.2}{2010/10/26}{Error message moved from \cs{caption@@@settype} to here}
+% \changes{v3.2c}{2011/09/04}{Support of \cs{donemaincaptiontrue} from \textsf{memoir} document class added}
+% \changes{v3.3}{2011/12/28}{Usage of \cs{ifcaption@caption}, \cs{ifcaption@subcaption}, and \cs{ifcaption@ContinuedFloat} added}
+% \changes{v3.5e}{2020/09/28}{Bugfix in re-definition of \cs{stepcounter}; uses \cs{edef} instead of \cs{def} now}
+% Increments the float (i.e. |figure| or |table|) counter,
+% resets the continuation counter, and redefines itself to |\@gobble|.
+% \begin{macrocode}
+\newcommand*\caption@refstepcounter[1]{%
+ \@ifundefined{c@#1}%
+ {\caption@Error{No float type '#1' defined}}%
+ {\caption@ref@stepcounter{#1}%
+% \end{macrocode}
+% Set flag if this part of the figure (or table) contains a caption now.
+% (If |\caption@if|\-|top| is not set, |\caption| is at the bottom of this part,
+% therefore ending this part, so we set the flag to |false| in this case.)
+% \begin{macrocode}
+ \caption@fixposition % TODO: Make this independant on the "position" setting
+ \caption@iftop\caption@setflag\caption@clrflag2% caption
+% \end{macrocode}
+% This part does not contain content (like sub-figures) yet,
+% so we set |\if|\-|caption@sub|\-|caption| to |false|.
+% \begin{macrocode}
+ \caption@clrflag4% subcaption
+% \end{macrocode}
+% Support of the \textsf{memoir} document class.
+% \begin{macrocode}
+ \@nameuse{donemaincaptiontrue}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ref@stepcounter{%
+ \caption@ifflag1{% continued float
+ \let\caption@tempa\caption@@refcounter
+ \caption@clrflag1% continued float
+ }{%
+ \let\caption@tempa\caption@@refstepcounter
+ \caption@ifflag2{}{% caption
+ \caption@ifflag4{% subcaption
+ % Counter was already incremented by content, so we suppress \stepcounter{#1} here
+ \let\caption@tempa\caption@@refcounter
+ }{}%
+ }%
+ }%
+ \caption@tempa}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@refcounter[1]{%
+ \let\caption@stepcounter@ORI\stepcounter
+ \def\stepcounter##1{%
+ \edef\caption@tempa{#1}%
+ \edef\caption@tempb{##1}%
+ \ifx\caption@tempa\caption@tempb \else
+ \caption@stepcounter@ORI{##1}%
+ \fi}%
+ \caption@@@refstepcounter{#1}%
+ \let\stepcounter\caption@stepcounter@ORI}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@refstepcounter[1]{%
+ \caption@prepare@stepcounter{#1}{ref}%
+ \caption@@@refstepcounter{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@stepcounter[1]{%
+ \caption@prepare@stepcounter{#1}{}%
+ \caption@@@stepcounter{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@prepare@stepcounter[2]{%
+ \caption@addsubcontentslines{#2stepcounter}%
+ \caption@reset@continuedfloat{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@refstepcounter{\refstepcounter}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@stepcounter{\stepcounter}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@dblarg}
+% \changes{v3.1}{2007/02/05}{This macro added}
+% \changes{v3.1f}{2007/12/06}{Bugfix 07-12-06: Changed so it works without \cs{kernel@ifnextchar} (which was introduced in \LaTeXe\ 2004/01/23), too}
+% \changes{v3.3}{2012/03/25}{Support of option \opt{list-entry} added}
+% A |\relax| was added compared to |\@dblarg| so |\caption{}| will be
+% expanded to |\caption[\relax]{}| (and not to |\caption[]{}|).
+% Furthermore support for option \opt{list-entry} was added.
+% \begin{macrocode}
+\@ifundefined{kernel@ifnextchar}{\let\kernel@ifnextchar\@ifnextchar}{}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@dblarg[1]{%
+ \kernel@ifnextchar[{\caption@ydblarg{#1}}{\caption@xdblarg{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@xdblarg[2]{%
+ #1[{#2\relax}]{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@ydblarg#1[#2]#3{%
+ \caption@iflistheading{#1[{#3}]{#3}}{#1[{#2}]{#3}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@begin}
+% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed to \cs{caption@setfloattype}}
+% \changes{v3.0e}{2005/04/12}{Check for default label format added}
+% \changes{v3.0f}{2005/06/11}{Usage of \cs{caption@resetContinuedFloat} added}
+% \changes{v3.1}{2007/05/09}{Usage of \cs{caption@setfloattype} \& \cs{caption@resetContinuedFloat} removed}
+% \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} removed}
+% Our handling of |\caption| will always be surrounded by
+% |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
+% |\caption@begin|\marg{type} performs these tasks:
+% \begin{enumerate}
+% \item[1.] Override the |position=| setting, if necessary.
+% (for example if set to |auto| or used inside a |supertabular|)
+% \item[2.] Start a new group.
+% \item[3.] Define |\fnum@|\meta{type} if the caption label format is set
+% to non-default.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand*\caption@begin[1]{%
+ \caption@fixposition
+ \begingroup
+ \caption@setfnum{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@beginex}
+% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
+% \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
+% \changes{v3.1}{2007/07/01}{Makes lst-entry now instead of redefining \cs{addcontentsline}}
+% \changes{v3.2}{2010/10/26}{Bugfix 09-05-15: Setting of \cs{lst@@caption} added}
+% |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par
+% performs the same tasks as |\caption@begin| and additionally:
+% \begin{enumerate}
+% \item[4.] Set |\lst@@caption|, so |\fnum@lstlisting| will include a numbering.
+% \item[5.] Make an entry in the list-of-whatever.
+% \item[6.] Set |\caption@ifempty| according argument \meta{heading}.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand\caption@beginex[3]{%
+ \caption@begin{#1}%
+ \let\lst@@caption\relax
+ \caption@addcontentsline{#1}{#2}%
+ \caption@ifempty{#3}{}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@end}
+% \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} removed}
+% |\caption@end| closes the group.
+% \begin{macrocode}
+\newcommand*\caption@end{%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0a}{2004/01/23}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
+% \changes{v3.0h}{2005/10/06}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
+%
+% \begin{macro}{\caption@setfnum}
+% \changes{v3.1}{2007/03/10}{This macro added}
+% \changes{v3.5}{2020/08/03}{Adapted to \package{caption3} v2.0}
+% |\caption@setfnum|\marg{type}\\
+% stores the original definition of |\fnum@|\meta{type} in |\caption@fnum@|\meta{type}
+% and re-defines it according the caption label format set with |label|\-|format=|.
+% \begin{macrocode}
+\newcommand*\caption@setfnum[1]{%
+ \@ifundefined{caption@fnum@#1}%
+ {\expandafter\let\csname caption@fnum@#1\expandafter\endcsname\csname fnum@#1\endcsname
+ \@namedef{fnum@#1}{\caption@fnum{#1}}}%
+ {}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@normalsize}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% \changes{v3.5}{2020/07/27}{Adapted to \package{caption3} v2.0}
+% This one will be used by |\@caption| instead of |\normalsize|.
+% \begin{macrocode}
+\newcommand*\caption@normalsize{%
+ \caption@font@normal\@unused}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setfloatcapt}
+% Needed for support of the \package{float} package, where the caption will
+% not be typeset directly, but catched in a |\vbox| called |\@floatcapt|
+% instead.
+% \begin{macrocode}
+\let\caption@setfloatcapt\@firstofone
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% This one is needed for support of the \package{nameref} and \package{hyperref} package.
+% \changes{v3.2f}{2012/01/14}{Bugfix: Usage of \cs{caption@gettitle} added}
+% \begin{macrocode}
+\newcommand*\caption@makecurrent[1]{\caption@gettitle}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makeanchor}
+% \begin{macro}{\caption@start}
+% \begin{macro}{\caption@@start}
+% \begin{macro}{\caption@freezeHref}
+% \begin{macro}{\caption@defrostHref}
+% All these are needed for support of the \package{hyperref} package.
+% \begin{macrocode}
+\let\caption@makeanchor\@firstofone
+\let\caption@start\relax
+\let\caption@@start\relax
+\let\caption@freezeHref\relax
+\let\caption@defrostHref\relax
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@gettitle}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This one is needed for support of the \package{nameref} package.
+% \begin{macrocode}
+\newcommand\caption@gettitle[1]{%
+ \caption@ifdefined\NR@gettitle
+ {\NR@gettitle{#1}}%
+ {\def\@currentlabelname{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Support for sub-captions}
+% \changes{v3.1f}{2007/11/16}{Support for sub-captions added}
+%
+% \begin{macro}{\caption@subtypehook}
+% \changes{v3.1g}{2008/03/20}{Redefinition of \cs{caption@setlist} added}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-08-12b: \cs{@makecaption} will now be restored here, too}
+% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
+% \changes{v3.2a}{2011/08/17}{Redefinition of \cs{phantomcaption} added}
+% \changes{v3.2a}{2011/08/17}{Usage of \cs{caption@warmup} added}
+% \changes{v3.2c}{2011/09/30}{Bugfix 11-09-26: Usage of \cs{if@subfloatrow} added}
+% \changes{v3.3}{2011/12/28}{Bugfix 11-12-16: \cs{caption@l@stepcounter} replaced by \cs{stepcounter}}
+% \changes{v3.3}{2012/03/15}{Usage of \cs{caption@setbox} added}
+% \changes{v3.3}{2013/05/01}{Redefinition of \cs{caption@settype} added}
+% \changes{v3.3}{2013/06/17}{Missing redefinition of \cs{captionlistentry} added}
+% \changes{v3.3}{2018/09/06}{Adapted to the \package{chkfloat} package}
+% \changes{v3.4f}{2020/01/03}{Redefinition of \cs{@caption} added since it was redefined by the \env{threeparttable} environment}
+% \changes{v3.5}{2020/07/27}{Adapted to \package{caption3} v2.0}
+% Hook, will be used inside \cs{caption@setsubtype}.\par
+% (Note: If we are inside an |sub|\-|float|\-|row| environment we have to keep
+% the |\@make|\-|caption| code of the \package{floatrow} package intact.)
+% \begin{macrocode}
+\newcommand*\caption@subtypehook{%
+ \ifx\caption\caption@subcaption \else
+ \caption@warmup
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifflag2{}{% caption
+% no \caption in this part of the (floating) environment yet
+ \let\caption@add@contentsline\caption@addsubcontentsline
+ \let\caption@addsubcontentslines\@gobble
+ \caption@ifflag4{}{% subcaption
+% no \subcaption in this part of the (floating) environment yet
+ \caption@ifflag1{% continued float
+ \caption@clrflag1%
+ }{%
+ \caption@@stepcounter\@captype
+ }%
+ \caption@setflag4% subcaption
+ }%
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \c@continuedfloat=0\relax
+ \let\caption@setfloatcapt\@firstofone
+ \let\caption@chkfloat\@gobbletwo
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@set{box}{none}%
+ \caption@clearmargin
+ \caption@iflist{}{\let\caption@setlist\@gobble}%
+ \caption@setoptions{sub}%
+ \caption@setoptions{subfloat}% for subfig-package compatibility
+% \end{macrocode}
+% \begin{macrocode}
+% redefine \setcaptiontype
+ \def\caption@settype{\caption@withoptargs\caption@sub@settype}%
+ \def\caption@sub@settype##1##2{%
+ \edef\caption@tempa{##2}%
+ \ifx\caption@tempa\@captype
+%%% \caption@setsubtype##1\relax
+ \else
+ \caption@Error{##2 inside \@subcaptype}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+% redefine \caption
+ \let\caption\caption@subcaption
+ \let\@caption\caption@@caption
+ \let\phantomcaption\caption@subphantom
+ \let\captionlistentry\caption@sublistentry
+% \let\@captype\@subcaptype
+ \let\caption@refstepcounter\caption@@@refstepcounter
+% \end{macrocode}
+% \begin{macrocode}
+% restore \@makecaption
+ \if@subfloatrow
+ \caption@Debug{Keeping \string\@makecaption}%
+ \else
+ \let\@makecaption\caption@makecaption
+ \fi
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\if@subfloatrow}
+% \changes{v3.2c}{2011/09/30}{This macro added}
+% This macro tests if we are inside an |sub|\-|float|\-|row| or |sub|\-|float|\-|row*| environment.
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \caption@ifundefined\@subfloatrowtrue
+ {\newif\if@subfloatrow
+ \caption@ifundefined\subfloatrow
+ {}%
+ {\caption@Debug{Patching subfloatrow environment}%
+ \g@addto@macro\capsubrowsettings{\@subfloatrowtrue}%
+ \g@addto@macro\killfloatstyle{%
+ \ifx\c@FRobj\c@FRsobj\@subfloatrowtrue\fi}}}%
+ {\caption@Debug{\string\if@subfloatrow is already defined}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subcaption}
+% Makes a sub-caption.
+% \begin{macrocode}
+\newcommand*\caption@subcaption{%
+ \caption@checkgrouplevel{sub}\subcaption
+ \caption@star
+ {\caption@refstepcounter\@subcaptype}%
+ {\caption@dblarg{\@caption\@subcaptype}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subphantom}
+% \changes{v3.2a}{2011/08/17}{This macro added}
+% Same as |\phantomcaption|, but for sub-captions.
+% \begin{macrocode}
+\newcommand*\caption@subphantom{%
+ \caption@checkgrouplevel{sub}\phantomsubcaption
+ \caption@refstepcounter\@subcaptype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@sublistentry}
+% \changes{v3.3}{2013/06/17}{This macro added}
+% Same as |\captionlistentry|, but for sub-captions.
+% \begin{macrocode}
+\newcommand*\caption@sublistentry{%
+ \caption@teststar\@subcaptionlistentry\@firstoftwo\@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@subcaptionlistentry[1]{%
+ \@testopt{\caption@listentry{#1}}\@subcaptype}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{caption@clearsubcontentslines}
+% Clear pending sub-caption list entries.
+% \begin{macrocode}
+\newcommand*\caption@clearsubcontentslines{%
+ \global\let\caption@subcontentslines\@empty}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@clearsubcontentslines
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addsubcontentsline}
+% \changes{v3.1i}{2008/08/02}{\cs{label}, \cs{index}, and \cs{glossary} are allowed inside the list entry now}
+% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
+% \changes{v3.2c}{2011/08/19}{Uses \cs{caption@gobble} instead of \cs{@gobble} now}
+% \changes{v3.3}{2012/01/15}{Debug message added}
+% \changes{v3.3}{2013/03/10}{A single \cs{protect} replaced by \cs{noexpand}}
+% Add a pending sub-caption list entry.
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentsline[4]{%
+ \caption@Debug{\string\caption@addsubcontentsline{#1}{#2}}%
+ \begingroup
+ \let\label\caption@gobble
+ \let\index\caption@gobble
+ \let\glossary\caption@gobble
+ \protected@edef\@tempa{\endgroup
+ \noexpand\g@addto@macro\noexpand\caption@subcontentslines{%
+ \noexpand\@namedef{the#2}{\csname the#2\endcsname}%
+ \ifx\@currentHref\@undefined \else
+ \noexpand\def\noexpand\@currentHref{\@currentHref}%
+ \fi
+ \noexpand\caption@@@addcontentsline{#1}{#2}{#3}{#4}}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\flushsubcaptionlistentries}
+% \changes{v3.3}{2012/01/15}{Renamed from \cs{caption@addsubcontentslines} to \cs{flushsubcaptionlistentries}}
+% \changes{v3.3}{2013/03/10}{Bugfix: Missing redefinition of \cs{caption@addsubcontentslines} added}
+% Writes pending sub-caption list entries.
+% \begin{macrocode}
+\newcommand*\flushsubcaptionlistentries{%
+ \caption@addsubcontentslines{user}}
+% \end{macrocode}
+% \begin{macrocode}
+\renewcommand*\caption@addsubcontentslines[1]{%
+ \caption@Debug{\string\flushsubcaptionlistentries (#1)}%
+ \begingroup
+ \caption@subcontentslines
+ \endgroup
+ \caption@clearsubcontentslines}
+% \end{macrocode}
+% We need to patch \cs{chapter} otherwise a vertical gap will be inserted into
+% the list prior pending sub-caption list entries.
+% We do this |\At|\-|Begin|\-|Document| so packages like \package{newfloat}
+% will not complain about an unknown document class.
+% \begin{macrocode}
+\AtBeginDocument{%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifdefined\chapter{%
+ \let\caption@chapter@ORI\chapter
+ \def\chapter{%
+ \caption@addsubcontentslines{chapter}\caption@chapter@ORI}}{}%
+% \end{macrocode}
+% Same for \cs{appendix}.
+% \begin{macrocode}
+ \caption@ifdefined\appendix{%
+ \let\caption@appendix@ORI\appendix
+ \def\appendix{%
+ \caption@addsubcontentslines{appendix}\caption@appendix@ORI}}{}%
+% \end{macrocode}
+% Flush the list of pending sub-caption list entries at the end of the document.
+% \begin{macrocode}
+ \caption@addsubcontentslines{AtEndDocument}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Babel package support}
+%
+% \subsection{The arabic \& farsi babel option}
+% \changes{v3.5}{2020/08/02}{\package{arabic} babel support addded}
+%
+% \begin{macrocode}
+\caption@IfBabelArabi{%
+% \end{macrocode}
+%
+% The \package{arabicore} package re-defines |\@make|\-|caption|, |\fnum@figure|, and |\fnum@table|
+% incompatible to the \package{caption} package, therefore we have to restore our resp.~the original definitions here.
+%
+% \begin{macrocode}
+ \let\@makecaption\caption@makecaption
+ \def\fnum@figure{\figurename\nobreakspace\thefigure}%
+ \def\fnum@table{\tablename\nobreakspace\thetable}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The frenchle \& frenchpro package}
+% \changes{v3.0h}{2005/10/03}{\package{frenchle/pro} package support added}
+% \changes{v3.5}{2020/08/01}{\package{frenchle/pro} package support updated}
+%
+% \begin{macrocode}
+\caption@IfFrenchLe{%
+% \end{macrocode}
+%
+% \begin{macro}{\f@ffrench}
+% \begin{macro}{\f@tfrench}
+% |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
+% when used in French mode. These contain additional code which typesets
+% the caption separator |\caption|\-|separator| instead of the usual colon.
+% Because this breaks with our |\@make|\-|caption| code we have to remove
+% this additional code here.
+% \begin{macrocode}
+ \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
+ \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
+ \let\@eatDP\@undefined
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% Since the \package{frenchle} package overwrites |\@make|\-|caption| (within |\GO|\-|french|),
+% we need to save it beforehand and restore it afterwards.
+% \begin{macrocode}
+ \caption@AtBeginDocument{%
+ \let\caption@original@makecaption\@makecaption}%
+ \g@addto@macro\GOfrench{%
+ \let\@makecaption\caption@original@makecaption}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The hungarian \& magyar babel option}
+% \changes{v3.2}{2009/03/29}{\package{magyar} babel support added}
+% \changes{v3.3}{2018/08/26}{\package{magyar} babel support revised}
+% \changes{v3.5}{2020/08/02}{\package{magyar} babel support updated}
+%
+% \begin{macrocode}
+\caption@IfBabelHungarian{%
+% \end{macrocode}
+%
+% Since the \package{magyar} package tends to overwrite |\@make|\-|caption|
+% we save it beforehand and restore it afterwards.
+% \Note{Currently it will not be overwritten, caused by a side-effect of a
+% work-around for the \package{floatrow} package within \package{caption3}.}
+%
+% \begin{macrocode}
+ \caption@AtBeginDocument{%
+ \let\caption@original@makecaption\@makecaption}%
+ \caption@ifdefined\extrashungarian{%
+ \addto\extrashungarian{%
+ \let\@makecaption\caption@original@makecaption}}{}%
+ \caption@ifdefined\extrasmagyar{%
+ \addto\extrasmagyar{%
+ \let\@makecaption\caption@original@makecaption}}{}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The latvian babel option}
+% \changes{v3.5}{2020/08/02}{\package{latvian} babel support updated}
+%
+% \begin{macrocode}
+\caption@IfBabelLatvian{%
+% \end{macrocode}
+%
+% The \package{latvian} package re-defines |\@make|\-|caption| incompatible to the \package{caption} package,
+% therefore we have to restore our definitions here.
+%
+% \begin{macrocode}
+ \let\@makecaption\caption@makecaption
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \section{Package support}
+% \changes{v3.1}{2007/04/11}{Package options `float', `longtable' etc.~are not supported anymore, removed}
+%
+% \begin{macro}{\caption@IfPackageLoaded}
+% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added, so no extra check is needed}
+% \changes{v3.1}{2007/07/04}{Re-written \& renamed from \cs{caption@ifpackage} to \cs{caption@IfPackageLoaded}}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% |\caption@IfPackageLoaded|\marg{package}\oarg{version}\marg{true}\marg{false}\par
+% Some kind of combination of |\@ifpackageloaded| and |\@ifpackagelater|.
+% If the \meta{package} is not loaded yet, the check will be (re-)done
+% |\AtBeginDocument|, so the \meta{package} could be loaded later on, too.
+% \begin{macrocode}
+\newcommand\caption@IfPackageLoaded[1]{%
+ \@testopt{\caption@@IfPackageLoaded{#1}}{}}
+\@onlypreamble\caption@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@IfPackageLoaded#1[#2]#3#4{%
+ \@ifpackageloaded{#1}\@firstofone{%
+ \caption@Debug{#1 package is not loaded (yet)\@gobble}%
+ \caption@AtBeginDocument}{%
+ \caption@If@Package@Loaded{#1}[{#2}]{#3}{#4}}}
+\@onlypreamble\caption@@IfPackageLoaded
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@If@Package@Loaded#1[#2]{%
+ \@ifpackageloaded{#1}{%
+ \caption@InfoNoLine{#1 package is loaded}%
+ \@ifpackagelater{#1}{#2}\@firstoftwo{%
+ \caption@Error{%
+ For a successful cooperation we need at least version\MessageBreak
+ `#2' of package #1,\MessageBreak
+ but only version\MessageBreak
+ `\csname ver@#1.\@pkgextension\endcsname'\MessageBreak
+ is available}%
+ \@secondoftwo}%
+ }{\@secondoftwo}}
+\@onlypreamble\caption@If@Package@Loaded
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@clearmargin}
+% \changes{v3.1}{2007/05/05}{This macro and its usage added}
+% This macro will be used by some package support stuff where the usual
+% margin setting is not welcome, e.g. in the \package{sidecap} package.
+% \begin{macrocode}
+\newcommand*\caption@clearmargin{%
+ \setcaptionmargin\z@
+ \let\caption@minmargin\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@setbool{needfreeze}{0}
+\caption@AtBeginDocument*{%
+ \caption@ifneedfreeze{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@freezetype}
+% \changes{v3.3}{2013/05/01}{This macro added}
+% |\caption@freezetype|\marg{type}\par
+% Used by the \package{fltpage} \& \package{sidecap} package support.
+% \begin{macrocode}
+ \newcommand*\caption@freezetype[1]{%
+ \caption@settype*{#1}%
+ \captionsetup*[sub]{hypcap=true}% Note: This is just a (q&d) workaround!
+ \caption@freeze}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@freeze}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} \& \cs{@caption} revised for enhanced compatibility}
+% \changes{v3.1c}{2007/10/06}{Bugfix: Made \cs{@caption} long}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1g}{2008/01/29}{Starred variants of \cs{ContinuedFloat} and \cs{captionsetup} added}
+% \changes{v3.2}{2010/10/26}{Bugfix 10-09-01a: Uses \cs{ignorespaces} instead of `space hack' again}
+% \changes{v3.2a}{2011/08/17}{Starred variant of \cs{caption@freeze} removed}
+% \changes{v3.2b}{2011/08/18}{Redefines \cs{caption@setup} instead of \cs{captionsetup} now}
+% \changes{v3.2b}{2011/08/18}{Redefinition of \cs{label} revised}
+% \changes{v3.2c}{2011/08/21}{Revised}
+% \changes{v3.3}{2013/01/06}{Adapted to new switch \cs{caption@caption} etc.}
+% |\caption@freeze|\par
+% Used by the \package{bicaption} package.
+% \begin{macrocode}
+ \newcommand*\caption@freeze{%
+ \let\caption@frozen@continuedfloat\continuedfloat
+ \def\continuedfloat{%
+ \caption@@freeze{\caption@@@@continuedfloat\@captype}%
+ \caption@frozen@continuedfloat}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@setup\caption@setup
+ \def\caption@setup##1{%
+ \caption@@freeze{\caption@setup{##1}}%
+ \caption@frozen@setup{##1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@caption\caption
+ \def\caption{%
+ \def\caption{%
+ \caption@Error{%
+ Only one \noexpand\caption can be placed in this environment}%
+ \caption@gobble}%
+ \@ifstar
+ {\caption@SC@caption*}%
+ {\let\@currentlabel\caption@SClabel
+ \caption@withoptargs\caption@SC@caption}}%
+ \long\def\caption@SC@caption##1##2{%
+ \caption@@freeze{\caption##1{##2}}%
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@label\label
+ \def\label{%
+ \caption@withoptargs\caption@SC@label}%
+ \def\caption@SC@label##1##2{%
+ \ifx\@currentlabel\caption@SClabel
+ \@bsphack
+ \caption@freeze@label{##1}{##2}%
+ \@esphack
+ \else
+ \caption@frozen@label##1{##2}%
+ \fi}%
+ \def\caption@SClabel{\caption@undefinedlabel}%
+ \def\caption@freeze@label##1##2{%
+ \caption@@freeze{\label##1{##2}}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\let\caption@frozen@content\@empty
+ \long\def\caption@@freeze{%
+ \g@addto@macro\caption@frozen@content}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@warmup{%
+ \let\continuedfloat\caption@frozen@continuedfloat
+ \let\caption@setup\caption@frozen@setup
+ \let\caption\caption@frozen@caption
+ \let\label\caption@frozen@label}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepare@defrost}
+% \changes{v3.3}{2013/01/06}{This macro added}
+% Prevent resetting the caption flags
+% \begin{macrocode}
+ \newcommand*\caption@prepare@defrost{%
+ \let\caption@settype\caption@set@type}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrost}
+% \changes{v3.1}{2007/07/22}{This macro added}
+% \changes{v3.1g}{2008/01/30}{\cs{caption@defrost@setup} added}
+% \changes{v3.2c}{2011/08/21}{Adapted to changes of \cs{caption@freeze}}
+% \changes{v3.2c}{2011/08/21}{\cs{caption@defrost@setup} removed}
+% |\caption@defrost|
+% \begin{macrocode}
+ \newcommand*\caption@defrost{%
+ \ifx\caption@frozen@caption\@undefined
+ \caption@frozen@content
+ \else
+ \caption@Error{Internal Error:\MessageBreak
+ \noexpand\caption@defrost in same group as \string\caption@freeze}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@undefbool{needfreeze}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@warmup}
+% \changes{v3.2a}{2011/08/17}{This macro added}
+% |\caption@warmup|
+% \begin{macrocode}
+\let\caption@warmup\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{The changepage package}
+% \changes{v3.4k}{2020/05/30}{Patch of the \package{changepage} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{changepage}[2008/07/23 memoir-v3.7k]{%
+% \end{macrocode}
+%
+% Both environments, \env{adjustwidth} and \env{adjustwidth*}, are starting a \env{list} \cs{item}.
+% But \cs{hsize} isn't set properly inside a \env{list} item, and therefore \cs{@makecaption}
+% (offered by document classes) doesn't work properly when used inside \env{adjustwidth}.
+% Therefore we try to detect the situation ``Are we inside a adjustwidth environment?''
+% inside \cs{@makecaption} and fix this. (Sigh!)
+%
+% We cannot simply set and test a flag here since our adjustment to \cs{hsize} should
+% not be done within a \cs{parbox} within a adjustwidth environment for example,
+% and therefore we store \cs{hsize} and \cs{linewidth}, and test \cs{hsize} and \cs{linewidth}
+% against the stored values instead. If they are equal we are (hopefully) quite save
+% to assume that we are now inside a plain \env{adjustwidth} environment and therefore need
+% to fix \cs{hsize} before typesetting the caption. (Deep sigh!)
+%
+% \begin{macro}{\caption@adjustwidth@hsize}
+% \begin{macro}{\caption@adjustwidth@linewidth}
+% \begin{macrocode}
+ \newdimen\caption@adjustwidth@hsize
+ \newdimen\caption@adjustwidth@linewidth
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@set@adjustwidth}
+% \changes{v3.4k}{2020/05/30}{This macro and its usage added}
+% Store the values of \cs{hsize} and \cs{linewidth}.
+% \begin{macrocode}
+ \providecommand*\caption@set@adjustwidth{%
+ \caption@adjustwidth@hsize\hsize
+ \caption@adjustwidth@linewidth\linewidth}%
+% \end{macrocode}
+% \begin{macrocode}
+ \providecommand*\caption@patch@changepage[1]{%
+ \expandafter\let\csname caption@#1\expandafter\endcsname\csname #1\endcsname
+ \expandafter\renewcommand\csname #1\endcsname[2]{%
+ \@nameuse{caption@#1}{##1}{##2}%
+ \caption@set@adjustwidth}}%
+ \caption@patch@changepage{adjustwidth}%
+ \caption@patch@changepage{adjustwidth*}%
+ \let\caption@patch@changepage\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@test@adjustwidth}
+% \changes{v3.4k}{2020/05/30}{This macro and its usage added}
+% Test if the values of \cs{hsize} and \cs{linewidth} are identical to
+% the ones stored in the \env{adjustwidth} environment.
+% If yes, set \cs{hsize} to the correct value.
+% \begin{macrocode}
+ \providecommand\caption@test@adjustwidth{%
+ \ifdim\hsize=\caption@adjustwidth@hsize
+ \ifdim\linewidth=\caption@adjustwidth@linewidth
+ \hsize=\linewidth
+ \fi
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \AtBeginCaption{\caption@test@adjustwidth}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+% \end{macrocode}
+%
+% \subsection{The chkfloat package}
+% \changes{v3.3}{2018/09/06}{Support of the \package{chkfloat} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{chkfloat}[2012/08/19 v0.1]{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@chkfloat}
+% \changes{v3.3}{2018/09/06}{This macro added}
+% \begin{macrocode}
+ \caption@ifdefined\chkfloat@addcontentsline{%
+ \renewcommand\caption@chkfloat{\chkfloat@addcontentsline}%
+ }{%
+ \renewcommand\caption@chkfloat[2]{%
+ \caption@ifdefined\chkfloat@page{%
+ \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}%
+ }{}}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+% \end{macrocode}
+%
+% \subsection{The float package}
+% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
+% \iffalse
+% (This is a more straight-ahead implementation, but it only works with v1.3
+% now, so v1.2 is no longer supported. The old code including documentation
+% can be found in caption-30f-050530.zip)
+% \fi
+%
+% The \package{float} package usually do not use the \LaTeX\ kernel command
+% |\@caption| to typeset the caption but |\float@caption| instead.
+% (|\@caption| will only be used if the float is re-styled with
+% |\restylefloat*|.)
+%
+% The main two things |\float@caption| is doing different are:
+% \begin{itemize}
+% \item The caption will be typeset inside a |\savebox| called |\@floatcapt|
+% so it can be placed above or below the float contents afterwards.
+% \item |\@makecaption| will not be used to finally typeset the caption.
+% Instead |\@fs@capt| will be used which definition is part of the float
+% style.
+% (Note that |\@fs@capt| will not typeset any vertical space above or below
+% the caption; instead this space will be typeset by the float style code
+% itself.)
+% \end{itemize}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{%
+ \@ifpackageloaded{floatrow}{%
+ \caption@If@Package@Loaded{floatrow}[2007/08/24 v0.2a]{}{}%
+ }{%
+% \end{macrocode}
+%
+% \begin{macro}{\@float@setevery}
+% \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added
+% to redefinition of \cs{caption@setfloatcapt}}
+% \changes{v3.4b}{2019/12/16}{Usage of \cs{caption@float@setname} added}
+% |\@float@setevery|\marg{float type} is provided by the \package{float}
+% package; it's called every time a floating environment defined with
+% |\newfloat| or |\restylefloat| begins.
+% We use this hook to do some adaptations and to setup the proper caption
+% style (if defined) and additional settings declared with
+% |\captionsetup|\oarg{float style}.
+% \begin{macrocode}
+ \let\caption@ORI@float@setevery\@float@setevery
+ \def\@float@setevery#1{%
+ \float@ifcaption{#1}{%
+% \end{macrocode}
+%
+% First of all we set the caption position to it's proper value by
+% converting |\@fs@iftopcapt| (which is part of a float style and
+% controls where the caption will be typeset, above or below the float
+% contents) to our |position=| setting.
+% Since the spacing above and below the caption will be done by the float
+% style and \emph{not} by us this sounds quite useless. But in fact it isn't,
+% since some packages based on \thispackage\ (like the \package{subfig}
+% package) could have an interest for this information and therefore use the
+% |\caption@iftop| macro we provide in our kernel. Furthermore we need this
+% information for ourself in |\captionof| which uses |\@makecaption| to
+% finally typeset the caption with skips.
+% \begin{macrocode}
+ \caption@setposition{\@fs@iftopcapt t\else b\fi}%
+% \end{macrocode}
+%
+% Afterward we redefine |\caption@setfloatcapt| (which will be used inside
+% |\@caption|) so the caption will be set inside the box |\@floatcapt|,
+% without extra vertical space.
+% \begin{macrocode}
+ \renewcommand\caption@setfloatcapt[1]{%
+ \let\@makecaption\caption@@make
+ \global\setbox\@floatcapt\vbox{%
+ \color@begingroup ##1\color@endgroup}}%
+% \end{macrocode}
+%
+% To allow different caption styles for different float styles we also
+% determine the current float style (e.g. `ruled') and select
+% a caption style (and additional settings) with the same name, if defined.
+% \begin{macrocode}
+ \float@getstyle\float@style{#1}%
+ \caption@setstyle*\float@style
+ \caption@setoptions\float@style
+% \end{macrocode}
+%
+% \begin{macrocode}
+ }{}%
+ \caption@float@setname{#1}%
+ \caption@freezeHref % will be defrosted in \float@makebox
+ \caption@ORI@float@setevery{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@makebox}
+% \changes{v3.3}{2013/01/06}{Corrects wrong load order hyperref-float now}
+% \changes{v3.3}{2013/02/03}{Correction of wrong load order hyperref-float revised}
+% Redefine |\float@makebox| (only if we are not operating in compatibility mode `v1').
+% \begin{macrocode}
+ \caption@AtBeginDocument{\caption@ifcompatibility{}{%
+% \end{macrocode}
+% If it was redefined by the \package{hyperref} package,
+% we need to build on the original definition (and not on the redefined one).
+% \begin{macrocode}
+ \caption@ifdefined\HyOrg@float@makebox
+ {\let\caption@ORI@float@makebox\HyOrg@float@makebox}%
+ {\let\caption@ORI@float@makebox\float@makebox}%
+ \renewcommand\float@makebox[1]{%
+ \caption@ORI@float@makebox{#1\relax \caption@defrostHref}}%
+% \end{macrocode}
+% \begin{macrocode}
+ }}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@float@setname}
+% \changes{v3.1}{2007/07/08}{float package hook added}
+% \changes{v3.4b}{2019/12/16}{Renamed from \cs{caption@typehook} to \cs{caption@float@setname}}
+% \LaTeX\ and almost every other packages use
+% |\|\meta{type}|name|
+% to provide a macro for the type resp.~environment name -- for example
+% the command |\figurename| will usually contain the name of the floating
+% environment |figure|:
+% \begin{quote}
+% |\newcommand\figurename{Figure}|
+% \end{quote}
+% But the \package{float} package doesn't follow this common naming
+% convention:
+% For floats defined with |\newfloat| it uses |\fname@|\meta{type} instead,
+% which breaks with our code (and with |\autoref| and some other things as
+% well).
+% So we have to map the \package{float} package name to the common one here.\par
+% \Note{If the float was not defined with \cs{newfloat} but with
+% \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.}
+% \begin{macrocode}
+ \newcommand*\caption@float@setname[1]{%
+ \expandafter\ifx\csname #1name\endcsname\relax
+ \expandafter\let\csname #1name\expandafter\endcsname\csname fname@#1\endcsname
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
+% \begin{macro}{\fs@plaintop}
+% \begin{macro}{\fs@boxed}
+% Since the float styles |plaintop| and |boxed| don't use |\abovecaptionskip|
+% which could be set with |skip=| (|plaintop| uses |\belowcaptionskip| instead of
+% |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|)
+% we patch the according float style macros here to change this.
+% \begin{macrocode}
+ \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
+ \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\float@getstyle}
+% \changes{v3.1}{2007/06/10}{This macro added}
+% |\float@getstyle|\marg{cmd}\marg{type}\par
+% Determining the float style is not so easy because the only hint
+% provided by the \package{float} package is the macro
+% |\fst@|\meta{float type} which points to the macro which represents the
+% float style. So for example after
+% \begin{quote}
+% |\floatstyle{ruled}|\\
+% |\newfloat{Program}{tbp}{lop}|
+% \end{quote}
+% |\fst@Program| will be defined as
+% \begin{quote}
+% |\def\fst@Program{\fs@ruled}|\quad.
+% \end{quote}\par
+% So here is what we do: We make the first level expansion of
+% |\fst@|\meta{float type} a string so we can gobble the first four tokens
+% (= |\fs@|), so only the the name of the float style is left.\par
+% \emph{TODO:} We need to convert the catcodes here.
+% \begin{macrocode}
+ \providecommand*\float@getstyle[2]{%
+ \edef#1{%
+ \noexpand\expandafter\noexpand\@gobblefour\noexpand\string
+ \expandafter\expandafter\expandafter\noexpand
+ \csname fst@#2\endcsname}%
+ \edef#1{#1}%
+ \caption@Debug{floatstyle{#2} = `#1'}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\float@ifcaption}
+% \changes{v3.1}{2007/06/23}{This macro added}
+% |\float@ifcaption|\marg{type}\marg{if-clause}\marg{else-clause}\par
+% Here we determine if the user has used |\newfloat| resp.~|\restylefloat|,
+% or |\restylefloat*|.
+% This is quite easy: If |\@float@c@|\meta{captype} is the same as
+% |\float@caption|, the user has used |\newfloat| or |\restylefloat|,
+% otherwise we assume he has used |\restylefloat*|.
+% (This test will fail if some package re-defines |\float@caption|,
+% so we have to assume that there is no one.)
+% \begin{macrocode}
+ \providecommand*\float@ifcaption[1]{%
+ \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}}{%
+ \providecommand*\float@ifcaption[1]{\@secondoftwo}%
+% \clearcaptionsetup{boxed}% used by the floatrow package?
+}
+% \end{macrocode}
+%
+% The skip between `boxed' floats and their caption defaults to |2pt|.
+%
+% \begin{macrocode}
+\captionsetup[boxed]{skip=2pt} % do not issue a warning when not used
+% \end{macrocode}
+%
+% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
+% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
+% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
+% `ruled' with appropriate options. But if the package option |ruled| was
+% specified, we setup some caption parameters to emulate the behavior
+% of \thispackage\ \version{1.x} option |ruled| instead, i.e.,
+% the current caption settings will be used, but without margin and without
+% `single-line-check'.
+% \begin{macrocode}
+\caption@ifbool{ruled}{%
+ \captionsetup[ruled]{margin=0pt,minmargin=0,slc=0}%
+}{%
+ \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
+}
+\caption@undefbool{ruled}
+% \end{macrocode}
+%
+% \subsection{The floatflt package}
+% \changes{v3.1}{2007/06/10}{Support of the \package{floatflt} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{floatflt}[1996/02/27 v1.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\floatingfigure}
+% We patch |\floatingfigure| so |\caption@floatflt| will be used.
+% \begin{macrocode}
+ \let\caption@ORI@floatingfigure\floatingfigure
+ \def\floatingfigure{%
+ \caption@floatflt{figure}%
+ \caption@ORI@floatingfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\floatingtable}
+% Same with |\floatingtable|\ldots
+% \begin{macrocode}
+ \let\caption@ORI@floatingtable\floatingtable
+ \def\floatingtable{%
+ \caption@floatflt{table}%
+% \caption@setautoposition b%
+ \caption@ORI@floatingtable}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@floatflt}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Here we do two things:
+% \begin{enumerate}
+% \item We use |\caption@set|\-|options{|\-|floating|\meta{type}|}| so
+% |\caption|\-|setup[|\-|floating|\meta{type}|]{|\ldots|}| is supported.
+% \item |\line|\-|width| must be set correctly.
+% Usually this is done by |\@par|\-|box|\-|restore| inside |\@caption|,
+% but since we use |\@caption@parbox|\-|restore| we have to map this to
+% |\@par|\-|box|\-|restore| instead.
+% \end{enumerate}
+% \begin{macrocode}
+ \newcommand*\caption@floatflt[1]{%
+ \caption@settype{#1}%
+ \caption@clearmargin
+ \caption@setparboxrestore{full}%
+ \caption@setoptions{floating#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The fltpage package}
+% \changes{v3.1}{2007/07/22}{Support of the \package{fltpage} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\FP@positionLabel}
+% \changes{v3.2c}{2011/08/28}{This redefinition added}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@positionLabel}{%
+% FP\@captype-\number\value{FP@\@captype C}-pos}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand\FP@positionLabel{%
+ FP\FP@captype-\number\value{FP@\FP@captype C}-pos}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@helpNote}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@helpNote}[2]{%
+% \typeout{FP#1 is inserted on page \pageref{#2}!}}%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand\FP@helpNote[2]{%
+ \begingroup % save \caption@thepage
+ \caption@pageref{#2}%
+ \typeout{FP#1 is inserted on page \caption@thepage!}%
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatBegin}
+% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
+% \changes{v3.1k}{2009/10/09}{Bugfix 09-09-11: Missing \cs{ignorespaces} added}
+% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
+% \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatBegin}[1]{%
+% \gdef\@captype{#1}%
+% \global\let\FP@savedCaptionCommand\caption%
+% \global\let\FP@savedLabelCommand\label%
+% \ifthenelse{\equal{\@captype}{figure}}
+% {\global\let\old@Fnum\fnum@figure}%
+% {\global\let\old@Fnum\fnum@table}%
+% \let\FP@LabelText\@empty%
+% \let\FP@CaptionText\@empty%
+% \let\FP@optionalCaptionText\@empty%
+% \renewcommand\label[1]{\gdef\FP@LabelText{##1}}%
+% \renewcommand\caption[2][]{%
+% \gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}%
+% \begin{lrbox}{\FP@floatCorpusBOX}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatBegin[1]{%
+ \def\FP@captype{#1}%
+ \begin{lrbox}{\FP@floatCorpusBOX}%
+ \minipage\hsize % changes from LR mode to vertical mode
+ \caption@freezetype{#1}%
+ \ignorespaces}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FP@floatEnd}
+% \changes{v3.1g}{2008/01/30}{Some minor bugfixes}
+% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
+% \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added}
+% Original code:
+% \begin{verbatim}
+% \newcommand{\FP@floatEnd}{%
+% \end{lrbox}%
+% \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
+% \stepcounter{FP@\@captype C}%
+% \FP@savedLabelCommand{\FP@positionLabel}%
+% \FP@helpNote{\@captype}{\FP@positionLabel}%
+% \FP@float
+% {\FP@positionLabel}% location label test
+% {\begin{\@captype}[p!]
+% \usebox{\FP@floatCorpusBOX}%
+% \refstepcounter{\@captype}%
+% \ifthenelse{\equal{\FP@LabelText}{\@empty}}
+% {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
+% \end{\@captype}}
+% {\addtocounter{\@captype}{-1}}
+% {\begin{\@captype}[b!]%
+% \ifthenelse{\equal{\FP@guide}{\@empty}}%
+% {}{\ifthenelse{\equal{\@captype}{figure}}%
+% {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}%
+% {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}%
+% \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption
+% \FP@separatorCaption%
+% \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
+% {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%
+% {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]%
+% {\expandafter\protect\FP@CaptionText}}%
+% \end{\@captype}}%
+% }%
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \renewcommand*\FP@floatEnd{%
+ \endminipage
+ \end{lrbox}%
+% \end{macrocode}
+% \begin{macrocode}
+ \stepcounter{FP@\FP@captype C}%
+ \caption@label\FP@positionLabel
+ \FP@helpNote\FP@captype\FP@positionLabel
+% \end{macrocode}
+% \begin{macrocode}
+ \FP@float
+ {\FP@positionLabel}% location label test
+ {\caption@prepare@defrost
+ \begin\FP@captype[p!]%
+ \usebox\FP@floatCorpusBOX
+ \end\FP@captype}%
+ {\@ifundefined{theH\FP@captype}{}{%
+ \expandafter\l@addto@macro\csname theH\FP@captype\endcsname{.FP}}}%
+ {\caption@prepare@defrost
+ \begin\FP@captype[b!]%
+ \let\FP@savedSetfnumCommand\caption@setfnum
+ \def\caption@setfnum##1{%
+ \FP@savedSetfnumCommand{##1}%
+ \ifx\FP@guide\@empty \else
+ \expandafter\l@addto@macro\csname fnum@##1\endcsname{\ {\FP@guide}}%
+ \fi}%
+ \setlength\abovecaptionskip{2pt plus 2pt minus 1pt}% length above caption
+ \setlength\belowcaptionskip{2pt plus 2pt minus 1pt}% length below caption
+ \caption@setoptions{FP\@captype}%
+ \FP@separatorCaption
+ \caption@defrost
+ \end\FP@captype}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\caption@ifFPlistcap\@undefined
+ \let\caption@ifFPrefcap\@undefined
+}
+% \end{macrocode}
+%
+% \subsection{The hyperref package}
+% \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
+% \changes{v3.1}{2007/03/09}{Usage of \cs{hyper@makecurrent} instead of
+% \cs{theHfigure} as indicator for \package{hyperref} package}
+% \changes{v3.2}{2011/07/30}{Test if \package{hyperref} has stopped early revised}
+% \changes{v3.2c}{2011/08/24}{Test if \package{hyperref} has stopped early adapted to current version of \package{hyperref} package: Usage of \cs{IfHyperBoolean} added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{%
+ % Test if hyperref has stopped early
+ \caption@ifundefined\IfHyperBoolean{%
+ \caption@set@bool\caption@ifhyp@stoppedearly0%
+ \caption@ifundefined\H@refstepcounter
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
+ \caption@ifundefined\hyper@makecurrent
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
+ \caption@ifundefined\measuring@true
+ {\caption@set@bool\caption@ifhyp@stoppedearly1}{}}}%
+ }{%
+ \def\caption@ifhyp@stoppedearly{\IfHyperBoolean{stoppedearly}}%
+ }%
+ \caption@ifhyp@stoppedearly{% hyperref has stopped early
+ \caption@InfoNoLine{%
+ Hyperref support is turned off\MessageBreak
+ because hyperref has stopped early}%
+ }{%
+ \g@addto@macro\caption@prepareslc{\measuring@true}%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@@@refstepcounter}
+% We redefine |\caption@@refstepcounter| so |\H@refstepcounter| will be used
+% instead of |\refstepcounter| inside |\caption| \& |\captionlistentry|.
+% \begin{macrocode}
+ \renewcommand*\caption@@@refstepcounter{\H@refstepcounter}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makecurrent}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% We redefine |\caption@makecurrent| so a \package{hyperref} label
+% will be defined inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand*\caption@makecurrent[2]{%
+ \caption@makecurrentHref{#1}%
+ \caption@Debug{hyperref current=\@currentHref}%
+ \caption@gettitle{#2}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \newcommand*\caption@makecurrentHref{\hyper@makecurrent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makeanchor}
+% \changes{v3.1l}{2010/01/09}{Adapted to the current hyperref package}
+% We redefine |\caption@makeanchor| so a \package{hyperref} anchor
+% will be set inside |\@caption|.
+% \Note{Will be redefined by \cs{caption@start}.}
+% \begin{macrocode}
+ \renewcommand\caption@makeanchor[1]{%
+ \caption@Debug{hyperref anchor: \@currentHref}%
+ % If we cannot have nesting, the anchor is empty.
+ \ifHy@nesting
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{#1}%
+ \else
+ \Hy@raisedlink{%
+ \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
+ }#1%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \g@addto@macro\caption@prepareslc{\let\caption@makeanchor\@firstofone}%
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{The hypcap option}
+%
+% \begin{macro}{\if@capstart}
+% Like the \package{hypcap} package we define the switch |\if@capstart|, too.
+% \begin{macrocode}
+ \newif\if@capstart
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@start}
+% \changes{v3.0l}{2007/02/20}{%
+% \cs{caption@currentHref} renamed to \cs{hc@currentHref}}
+% \changes{v3.1}{2007/06/21}{%
+% This macro renamed from \cs{capstart} to \cs{caption@start} and revised}
+% While the \package{hypcap} package defines a macro called |\capstart|
+% our variant is called |\caption@start| and is controlled by the option
+% |hypcap=||false|/|true|.
+% \begin{macrocode}
+ \def\caption@start{\caption@ifhypcap\caption@start@\relax}%
+ \def\caption@start@{%
+% \end{macrocode}
+% Generate the \package{hyperref} label and set the \package{hyperref} anchor,
+% usually (if |hypcap=false|) both is done inside |\@caption|.
+% \begin{macrocode}
+ \caption@makestart\@captype
+ \caption@startanchor\@currentHref
+% \end{macrocode}
+% Prevent |\@caption| from generating a new \package{hyperref} label,
+% use the label we save in |\hc@currentHref| instead.
+% (We also support the |@capstart| flag from the \package{hypcap} package.)
+% \begin{macrocode}
+ \global\@capstarttrue
+ \let\hc@currentHref\@currentHref
+ \def\caption@makecurrentHref##1{%
+ \global\@capstartfalse
+ \global\let\@currentHref\hc@currentHref}%
+% \end{macrocode}
+% Prevent |\@caption| from generating a \package{hyperref} anchor since this
+% has already been done.
+% \begin{macrocode}
+ \let\caption@makeanchor\@firstofone
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@makestart}
+% \changes{v3.1c}{2007/09/30}{\cs{@currentHref} will be extended by \texttt{caption}
+% instead of \texttt{xxx} now}
+% |\caption@makestart|\marg{type}
+% defines a \package{hyperref} anchor inside |\caption@start|.\par
+% Since we offer |\continuedfloat| the float counter can change between
+% `now' and |\caption|, i.e., we simply don't know the figure or table counter
+% yet and therefore we are not able to generate the `right' \package{hyperref}
+% label.
+% Two different solutions of this problem came into my mind:
+% \begin{enumerate}
+% \item I could use the aux file for this purpose.\par
+% -or-
+% \item I set |hypertexnames=false| locally.
+% Furthermore I use |#1.caption.|\meta{counter} (instead of |#1.|\meta{counter})
+% as naming scheme for |\@currentHref| to avoid conflicts with other hyper
+% links which are generated with |hypertexnames=true|.
+% \end{enumerate}
+% The first idea has the advantage that the `right' anchor name will be
+% generated, but one needs an additional \LaTeX\ run if figures or tables
+% will be inserted or removed.\par
+% The second idea has the advantage that it's very easy to implement, but
+% has some side-effects, e.g. the anchor names don't follow the figure or
+% table label names anymore.\par
+% Since I'm lazy I implemented the second idea, maybe I will revise this
+% later on.
+% \begin{macrocode}
+ \newcommand*\caption@makestart[1]{%
+ \begingroup
+ \Hy@hypertexnamesfalse
+% \gdef\@currentHlabel{}%
+ \hyper@makecurrent{#1.caption}%
+ \endgroup
+ \caption@Debug{hypcap start=\@currentHref}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@startanchor}
+% \changes{v3.1b}{2007/09/17}{Bugfix 06-09-17: We use \cs{caption@anchor} instead of \cs{hyper@@anchor}}
+% \changes{v3.1g}{2008/03/16}{Warning about TeX mode replaced with debug info}
+% |\caption@startanchor|\marg{Href}
+% sets a \package{hyperref} anchor inside |\caption@start|.\par
+% This code was taken from the \package{hypcap} package\cite{hypcap} and adapted.
+% \Note{Since \cs{hyper@@anchor}\marg{Href}\csmarg{\string\relax} can cause
+% a change from vertical mode to horizontal mode (design flaw in
+% \package{hyperref} package!?), and since the workaround
+% \cs{let}\cs{leavevmode}\cs{relax} which can be found in the
+% \package{hypcap} package is not always sufficient
+% (for example with ``Direct pdfmark support'' and \texttt{breaklinks=true}),
+% we use \cs{caption@anchor} instead of \cs{hyper@@anchor} here.}
+% \begin{macrocode}
+ \newcommand*\caption@startanchor[1]{%
+ \ifvmode\begingroup
+ \caption@Debug{hypcap anchor: #1 (vertical mode)}%
+ \@tempdima\prevdepth
+ \nointerlineskip
+ \vspace*{-\caption@hypcapspace}%
+ \caption@anchor{#1}%
+ \vspace*{\caption@hypcapspace}%
+ \prevdepth\@tempdima
+ \endgroup\else
+ \caption@Debug{hypcap anchor: #1 (horizontal mode)}%
+ \caption@anchor{#1}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@anchor}
+% \changes{v3.1c}{2007/10/17}{Workaround 07-10-17: We use \cs{caption@raisedlink} instead of \cs{Hy@raisedlink} now}
+% |\caption@anchor|\marg{Href} sets a \package{hyperref} anchor.
+% \begin{macrocode}
+ \newcommand*\caption@anchor[1]{%
+ \ifmeasuring@ \else
+ \caption@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}%
+ \fi}%
+% \end{macrocode}
+% \Note{Since \cs{Hy@raisedlink} change \cs{@tempdima} we surrounded it by \cs{ifvmode},
+% suppressing ``\texttt{LaTeX Warning: Float too large for page by 1.0pt}'' in \texttt{sideways} floats.
+% (This is not necessary since \package{hyperref} \version{6.77}.)}
+% \begin{macrocode}
+ \ifx\HyperRaiseLinkLength\@tempdima
+ \def\caption@raisedlink#1{\ifvmode#1\else\Hy@raisedlink{#1}\fi}%
+ \else
+ \let\caption@raisedlink\Hy@raisedlink
+ \fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@start}
+% Will be used by |\caption@freezeHref|. Apart from that we issue a warning
+% if we expect a saved \package{hyperref} label coming from |\caption@start|,
+% but there isn't any.
+% \begin{macrocode}
+ \def\caption@@start{%
+ \caption@ifundefined\hc@currentHref{%
+ \caption@Warning{%
+ The option `hypcap=true' will be ignored for this\MessageBreak
+ particular \string\caption}}{}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@freezeHref}
+% Suppress |\caption@start| from generating a \package{hyperref} label and
+% setting a \package{hyperref} anchor. Instead if |\@caption| generates a
+% \package{hyperref} label, it will be stored in |\caption@currentHref|.
+% Furthermore we need to redefine |\caption@setfloatcapt| so no
+% \package{hyperref} anchor will be placed in |\@caption|.
+% \iffalse
+% (Since |\caption@setfloatcapt| will be set to |\@firstofone| inside
+% |\subcaption| there is no need to add its restauration to
+% |\caption@subtypehook|.)
+% \fi
+% \begin{macrocode}
+ \def\caption@freezeHref{%
+ \let\caption@ORI@start\caption@start
+ \def\caption@start{\let\caption@start\caption@ORI@start}%
+% \end{macrocode}
+% \begin{macrocode}
+% \let\caption@ORI@@start\caption@@start
+% \l@addto@macro\caption@subtypehook{%
+% \let\caption@@start\caption@ORI@@start}%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\let\caption@currentHref\@undefined
+ \def\caption@@start{\global\let\caption@currentHref\@currentHref}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ORI@setfloatcapt\caption@setfloatcapt
+ \renewcommand*\caption@setfloatcapt{%
+ \ifx\caption@currentHref\@undefined \else
+ \let\caption@makeanchor\@firstofone
+ \fi
+ \caption@ORI@setfloatcapt}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@defrostHref}
+% If there is a freezed |\@currentHref|, we set the \package{hyperref}
+% anchor here.
+% \begin{macrocode}
+ \def\caption@defrostHref{%
+ \ifx\caption@currentHref\@undefined \else
+ \caption@startanchor\caption@currentHref
+ \global\let\caption@currentHref\@undefined
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }}{}
+% \end{macrocode}
+%
+% \subsection{The hypcap package}
+% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
+% \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} \version{1.6}}
+% \changes{v3.1e}{2007/11/04}{\package{hypcap} support adapted to \package{hyperref} \version{6.77}}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{hypcap}{% v1.0
+ \ifx\caption@start\relax \else % hyperref hasn't stopped early
+% \end{macrocode}
+%
+% If the \package{hypcap} package was loaded, we give up our own
+% hyperlink placement algorithm and give the control over the placement
+% to the \package{hypcap} package instead.
+%
+% \begin{macro}{\capstart}
+% \changes{v3.1k}{2009/10/09}{Support of \cs{ifcapstart} (\package{hypcap} package \version{1.10}) added}
+% We do this simply by mapping |\capstart| to |\caption@start@|,
+% although our code does not behave exactly like the original one:
+% The original |\capstart| has an effect on the next |\caption|
+% only but our version affects \emph{all} |\caption|s in the same
+% environment, at least unless a new |\capstart| will be placed.
+% \begin{macrocode}
+ \let\caption@ORI@capstart\capstart % save for compatibility mode
+ \caption@ifundefined\capstarttrue % check for v1.10 of hypcap package
+ {\def\capstart{\caption@start@}}%
+ {\def\capstart{\ifcapstart\caption@start@\fi}}%
+ \let\caption@start\relax
+ \let\caption@@start\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@hypcapspace}
+% Furthermore we map our |\caption@hypcapspace| to |\hypcapspace|
+% offered by the \package{hypcap} package.
+% \begin{macrocode}
+ \caption@set@bool\caption@ifhypcap 1%
+ \renewcommand*\caption@hypcapspace{\hypcapspace}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ \fi}{}
+% \end{macrocode}
+%
+% \subsection{The listings package}
+% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{%
+% \end{macrocode}
+%
+% \begin{macro}{\lst@MakeCaption}
+% \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now}
+% \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added}
+% \changes{v3.2}{2010/10/26}{Bugfix 10-07-20a: Set \cs{hsize} to \cs{linewidth}, if necessary}
+% \changes{v3.4c}{2020/01/01}{Ugly workaround for usage in lists added}
+% \changes{v3.4d}{2020/01/01}{Ugly workaround for usage in lists revised}
+% To support the \package{listings} package we need to redefine
+% |\lst@Make|\-|Caption| so the original stuff is nested with
+% |\caption@begin| and |\caption@end| etc.\par
+% We set a flag inside the "Init" hook of the \package{listings} package (where adaption of |\line|\-|width| etc.~takes place).
+% \begin{macrocode}
+ \caption@setbool{lst@Init}{0}%
+ \lst@AddToHook{Init}{\caption@setbool{lst@Init}{1}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@ORI@lst@MakeCaption\lst@MakeCaption
+ \def\lst@MakeCaption#1{% #1 is `t' or `b'
+% \end{macrocode}
+% This macro is always called twice by the \package{listings} package (with `t' resp. `b' as parameter),
+% therefore we need an extra group here.
+% \begin{macrocode}
+ \begingroup
+% \end{macrocode}
+% Inside lists the \package{listings} package ignores the left margin (|\@total|\-|left|\-|margin|) for captions.
+% We emulate this behaviour by adding a negative skip which will be typeset ahead of |\caption@box|.\par
+% Note: We only need to do this if the ``Init'' hook of the \package{listings} package wasn't called yet.
+% \begin{macrocode}
+ \caption@iflst@Init{}{%
+ \edef\caption@lst@leftskip{\noexpand\hskip-\the\@totalleftmargin\noexpand\relax}%
+ \l@addto@macro\caption@beginhook\caption@lst@leftskip}%
+% \end{macrocode}
+% We set |position=#1| and if it was set to `top',
+% we swap the skips so the default behavior of the \package{listings} package
+% will not be changed. (Note that the \package{listings} package has set its
+% own |\abovecaptionskip| \& |\belowcaptionskip| values prior to calling
+% \cs{lst@MakeCaption}.)
+% \begin{macrocode}
+ \caption@setposition{#1}%
+ \caption@iftop{%
+ \@tempdima\belowcaptionskip
+ \belowcaptionskip\abovecaptionskip
+ \abovecaptionskip\@tempdima}{}%
+% \end{macrocode}
+% Workaround for issue with wrong skips (FIXME: This should be examined further)
+% \begin{macrocode}
+ \caption@setup{rule=0}%
+% \end{macrocode}
+% Afterwards we set the local `lstlisting' options.
+% \begin{macrocode}
+ \caption@setoptions{lstlisting}%
+% \end{macrocode}
+% If the |position=| is now set to |auto|, we take over the |captionpos=|
+% setting from the \package{listings} package.
+% \begin{macrocode}
+ \caption@setautoposition{#1}%
+% \end{macrocode}
+% At the end we do similar stuff as in our \cs{@caption} code.
+% \begin{macrocode}
+ \caption@begin{lstlisting}%
+ \caption@ORI@lst@MakeCaption{#1}%
+ \caption@end
+% \end{macrocode}
+% \begin{macrocode}
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lst@makecaption}
+% \begin{macro}{\lst@maketitle}
+% Wrapper macros for typesetting the |caption=| resp. |title=| value.
+% \begin{macrocode}
+ \def\lst@makecaption{\caption@starfalse\@makecaption}%
+ \def\lst@maketitle{\caption@startrue\@makecaption\@empty}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ext@lstlisting}
+% \changes{v3.1}{2007/03/03}{This macro added}
+% Since the \package{listings} package do not define |\ext@lstlisting|
+% but we needed it when |\captionof{lstlisting}| will be done by the end user,
+% we define it here.
+% \begin{macrocode}
+ \providecommand*\ext@lstlisting{lol}%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v3.1a}{2007/07/13}{Bugfix 07-09-13: \cs{lst@@caption} will not be re-defined anymore}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The longtable package}
+%
+% \begin{macro}{\LTcaptype}
+% \changes{v3.1}{2007/07/06}{This macro and its support added}
+% |\LTcaptype| is preset to |table|.
+% \begin{macrocode}
+\providecommand*\LTcaptype{table}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@AtBeginLongtable}
+% \changes{v3.5}{2018/04/15}{This macro added}
+% \begin{macrocode}
+\providecommand*\caption@LT@array{}
+\newcommand\caption@AtBeginLongtable{%
+ \g@addto@macro\caption@LT@array}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{%
+% \end{macrocode}
+% \begin{macrocode}
+ \RequirePackage{ltcaption}[=2018/08/26]%
+ \let\LT@@makecaption\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\LT@array}
+% \changes{v3.1}{2007/07/22}{This redefinition added}
+% \changes{v3.1a}{2007/09/16}{Bugfix: This redefinition will always be done \cs{AtBeginDocument}}
+% \changes{v3.1g}{2008/01/20}{Bugfix in \cs{captionlistentry}: Table counter will not be incremented anymore, \cs{nameref} works}
+% \changes{v3.3}{2016/01/31}{Support for \cs{bicaption} added}
+% \changes{v3.3}{2018/10/05}{Definition of \cs{captionlistentry} fixed}
+% \changes{v3.5}{2018/04/15}{Usage of \cs{caption@AtBeginLongtable} added}
+% We redefine |\LT@array| here to get |\captionsetup|\marg{options} working inside |longtable|s.
+% \Note{Since the \package{hyperref} package patches \cs{LT@array} as well
+% and since this only works with the original definition of \cs{LT@array},
+% we have to do this after the \package{hyperref} package, i.e.~\cs{AtBeginDocument}.}
+% \begin{macrocode}
+ \caption@AtBeginDocument{%
+ \let\caption@ORI@LT@array\LT@array
+ \renewcommand*\LT@array{%
+ \caption@LT@array
+ \caption@ORI@LT@array}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@AtBeginLongtable{%
+% |\captionsetup| for longtable:
+% \begin{macrocode}
+ \global\let\caption@opt@@longtable\@undefined
+ \def\captionsetup{%
+ \noalign\bgroup
+ \@ifstar\@captionsetup\@captionsetup}% gobble *
+ \def\@captionsetup#1{\LT@captionsetup{#1}\egroup}%
+ \def\LT@captionsetup#1{%
+ \captionsetup@startrue\caption@setup@options[@longtable]{#1}%
+ \global\let\caption@opt@@longtable\caption@opt@@longtable}%
+% \end{macrocode}
+% |\captionlistentry| for longtable:
+% \begin{macrocode}
+ \def\captionlistentry{%
+ \noalign\bgroup
+ \@ifstar{\egroup\LT@listentry\LTcaptype}% gobble *
+ {\egroup\LT@listentry\LTcaptype}}%
+% \end{macrocode}
+% |\continuedfloat| for longtable:\\
+% {\small(Commented out, since it's not deeply tested and quite useless anyway)}
+% \Note{\package{hyperref} versions $<$ v6.76j uses $2\times$ \cs{hyper@makecurrent}}
+% \begin{macrocode}
+% \caption@ifhypcap{%
+% \let\caption@ORI@hyper@makecurrent\hyper@makecurrent
+% \def\hyper@makecurrent##1{%
+% \let\hyper@makecurrent\caption@ORI@hyper@makecurrent
+% \caption@makestart{##1}%
+%% \let\Hy@LT@currentHlabel\@currentHlabel
+% \let\Hy@LT@currentHref\@currentHref
+% \def\hyper@makecurrent####1{%
+%% \let\@currentHlabel\Hy@LT@currentHlabel
+% \let\@currentHref\Hy@LT@currentHref}}%
+% \let\caption@ORI@continuedfloat\continuedfloat
+% \def\continuedfloat{\noalign{%
+% \gdef\caption@setContinuedFloat{%
+% \let\caption@reset@continuedfloat\@gobble}%
+% \def\caption@setoptions##1{%
+% \g@addto@macro\caption@setContinuedFloat{%
+% \caption@setoptions{##1}}}%
+% \let\@captype\LTcaptype
+% \caption@ORI@ContinuedFloat}}%
+% }{%
+% \def\continuedfloat{\noalign{%
+% \caption@Error{%
+% \noexpand\continuedfloat inside longtables\MessageBreak
+% is only available with `hypcap=true'}}}%
+% }%
+% \global\let\caption@setContinuedFloat\@empty
+ \def\continuedfloat{\noalign{%
+ \caption@Error{\noexpand\continuedfloat outside float}}}%
+% \end{macrocode}
+% |\bicaption| for longtable:
+% \begin{macrocode}
+ \let\bicaption\LT@bicaption
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@capti@n}
+% \changes{v3.3}{2016/02/01}{This re-definition added}
+% The original implementation:
+% \begin{verbatim}
+% \def\LT@capti@n{%
+% \@ifstar
+% {\egroup\LT@c@ption\@gobble[]}%
+% {\egroup\@xdblarg{\LT@c@ption\@firstofone}}}
+% \end{verbatim}%^^A
+% Our implementation uses |\caption@xdblarg| instead of |\@xdblarg|:
+% \begin{macrocode}
+ \def\LT@capti@n{%
+ \@ifstar
+ {\egroup\LT@c@ption\@gobble[]}%
+ {\egroup\caption@xdblarg{\LT@c@ption\@firstofone}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@makecaption}
+% \changes{v3.0d}{2004/08/10}{Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
+% \changes{v3.0e}{2005/05/05}{Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
+% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
+% \changes{v3.3}{2016/02/01}{Support for \cs{bicaption} via \cs{caption@LT@setup} added}
+% \changes{v3.3a}{2019/04/02}{Work-around for problem with \package{floatrow} added}
+% |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
+% \smallskip
+% The original definition:
+% \begin{verbatim}
+% \def\LT@makecaption#1#2#3{%
+% \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
+% % Based on article class "\@makecaption", "#1" is "\@gobble" in star
+% % form, and "\@firstofone" otherwise.
+% \sbox\@tempboxa{#1{#2: }#3}%
+% \ifdim\wd\@tempboxa>\hsize
+% #1{#2: }#3%
+% \else
+% \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+% \fi
+% \endgraf\vskip\baselineskip}%
+% \hss}}}
+% \end{verbatim}%^^A
+% Our definition:
+% \begin{macrocode}
+ \renewcommand\LT@makecaption[3]{%
+ \caption@LT@make{%
+ \caption@LT@settype\LTcaptype
+% \end{macrocode}
+% |\caption@LT@setup| is re-defined inside the \package{bicaption} package
+% and contains the preparation of typesetting of the bilingual caption.
+% \begin{macrocode}
+ \caption@LT@setup
+% \end{macrocode}
+% \iffalse
+% The default |position=| setting for longtables is |top|.
+% (This emulates the standard behavior of the \package{longtable} package
+% which has no skip above the caption but a skip below it.)
+% \fi
+% |position=auto| is a bad idea for longtables, but we do our very best.
+% This works quite well for captions inside the longtable contents, but
+% not for captions inside the longtable (end)foot.
+% \Note{This should be `top' if unclear!}
+% \begin{macrocode}
+ \caption@setautoposition{\ifcase\LT@rows t\else b\fi}%
+% \end{macrocode}
+% We set |\ifcaption@star| according the 1st argument.
+% \begin{macrocode}
+ \caption@startrue#1\caption@starfalse
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@prepare@stepcounter\LTcaptype{LT}%
+% \end{macrocode}
+% \changes{v3.1}{2007/05/05}{\cs{caption@font@normal} added}
+% \begin{macrocode}
+ \caption@begin\LTcaptype
+ \caption@normalsize
+% \end{macrocode}
+% The following skip has the purpose to correct the height of the
+% |\parbox[t]|. Usually it's the height of the very first line, but
+% because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
+% it's always |0pt|.\par
+% (A different idea would be typesetting the first skip outside the longtable
+% column with |\noalign{\vskip|\ldots|}|, but this means we have to move
+% |\caption@begin| to some other place because it does not work in tabular
+% mode. And at the moment I have no idea on how to do this in an elegant
+% way\ldots)
+% \begin{macrocode}
+ \vskip-\ht\strutbox
+% \end{macrocode}
+% Work-around for problem with \package{floatrow}:
+% The |\below|\-|caption|\-|skip| disturbs the environment in which the caption is actually typeset (by creating extra, unwanted space),
+% so we supress this skip if the \package{floatrow} package is loaded.
+% (This fixes \issue{50})
+% \begin{macrocode}
+ \caption@ifdefined\FBifcaptop{%
+ \let\caption@belowskip\@empty}{}%
+% \end{macrocode}
+% The following code should look familiar. We do our skips and use
+% |\caption@@make| to typeset the caption itself.
+% \begin{macrocode}
+ \caption@make@above
+ \caption@@make{#2}{#3}\endgraf
+ \caption@make@below
+ \caption@end}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LT@listentry}
+% \changes{v3.3}{2018/08/26}{This macro added}
+% \changes{v3.3}{2018/10/05}{Bugfix: \cs{ignorespaces} added}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% \begin{macrocode}
+ \renewcommand*\LT@listentry[2]{%
+ \begingroup
+ \caption@LT@settype{#1}%
+ \caption@listentry\@firstoftwo[{#1}]{#2}%
+ \endgroup\ignorespaces}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@LT@settype}
+% \changes{v3.3}{2018/08/26}{This macro added}
+% \changes{v3.3}{2018/10/05}{Uses argument no. 1 instead of \cs{LTcaptype}}
+% \begin{macrocode}
+ \newcommand*\caption@LT@settype[1]{%
+ \caption@settype*{#1}%
+% \end{macrocode}
+% If |\LTcapwidth| is not set to its default value |4in| we assume
+% that it shall overwrite our own setting.
+% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
+% \begin{macrocode}
+ \ifdim\LTcapwidth=4in \else
+ \setcaptionwidth\LTcapwidth
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setoptions{longtable}%
+% \caption@setContinuedFloat
+% \end{macrocode}
+% Finally set options applied by |\captionsetup| inside the longtable.
+% \begin{macrocode}
+ \caption@setoptions{@longtable}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\flrow@setlist}
+% \changes{v3.4g}{2020/01/03}{Redefinition of this macro added}
+% The \package{floatrow} package uses |\flrow@setlist{{table}{longtable}}| inside its redefinition of |\LT@array| without setting |\@captype| first,
+% and this makes |\captionsetup[table]{name=...}| doomed to fail for longtables (``Undefined control sequence'').
+% Unfortunately we cannot easily patch |\LT@array| again to fix this bug in \package{floatrow} since it will be patched |\AtBeginDocument|.
+% Therefore we patch |\flrow@setlist| instead to catch and fix the bug on-the-fly.
+% \begin{macrocode}
+ \caption@AtBeginDocument{\caption@ifdefined\flrow@setlist@{%
+ \caption@InfoNoLine{Fixing longtable code of `floatrow' package}%
+ \let\caption@flrow@setlist@\flrow@setlist@
+ \renewcommand\flrow@setlist@[1]{%
+ \def\caption@tempa{{table}{longtable}}%
+ \def\caption@tempb{#1}%
+ \ifx\caption@tempa\caption@tempb
+ \def\@captype{table}%
+ \fi
+ \caption@flrow@setlist@{#1}}%
+ }{}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\caption@AtBeginLongtable\@gobble
+ \let\caption@LT@array\@undefined
+}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@LT@setup}
+% \changes{v3.3}{2016/02/01}{This macro added}
+% Hook for stuff which prepares the typesetting of the \package{longtable} caption.
+% \begin{macrocode}
+\providecommand*\caption@LT@setup{}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{The picinpar package}
+% \changes{v3.1}{2007/06/13}{Support of the \package{picinpar} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picinpar}{%
+% \end{macrocode}
+%
+% \begin{macro}{\figwindow}
+% \begin{macro}{\tabwindow}
+% The \package{picinpar} package comes with its own caption code
+% (|\wincaption|, |\@wincaption|, |\@makewincaption|, \ldots)
+% so we redefine |\figwindow| \& |\tabwindow| to use |\caption| instead.
+% \begin{macrocode}
+ \long\def\figwindow[#1,#2,#3,#4] {%
+ \caption@window{figure}%
+ \caption@setoptions{figwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\tabwindow[#1,#2,#3,#4] {%
+ \caption@window{table}%
+ \caption@setoptions{tabwindow}%
+ \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@window}
+% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
+% Beside calling |\caption@settype| we redefine |\caption@par|\-|box|\-|restore|
+% (as in \package{floatflt} \& \package{picins} package support)
+% and |\@makecaption| (as in \package{float} package support) here.
+% \begin{macrocode}
+ \newcommand*\caption@window[1]{%
+ \let\@makecaption\caption@@make
+ \caption@setautoposition b%
+ \caption@settype{#1}%
+ \caption@clearmargin
+ \caption@setparboxrestore{full}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@wincaption}
+% \changes{v3.1d}{2007/10/25}{Missing \% added}
+% \changes{v3.3}{2013/04/14}{\cs{caption@ContinuedFloattrue} added}
+% \changes{v3.3}{2018/10/06}{\cs{caption@ContinuedFloattrue} replaced by \cs{caption@setflag1}}
+% This one finally typesets the caption using |\caption|.
+% \begin{macrocode}
+ \newcommand\caption@wincaption[1]{%
+% \end{macrocode}
+% This will be done twice for every |figwindow| \& |tabwindow| caption --
+% on the first run |\picwd| is |0pt|, on the second run |\picwd| is |\hsize|.
+% \begin{macrocode}
+ \ifdim\picwd=\z@
+ \let\caption@makecurrent\@gobbletwo
+ \let\caption@@start\relax
+ \caption@prepareslc
+ \else
+ \caption@setflag1%
+ \fi
+% \end{macrocode}
+% The argument |#1| could contain simply the caption text
+% (e.g.~|A figure caption|), but it could also contain an optional argument,
+% the \meta{lst\_entry}
+% (e.g.~|[An| |entry| |to| |the| |LOF]||{A| |figure| |caption}|).
+% Therefore we have to test if |#1| begins with~|[| or not; furthermore we
+% support a starred variant -- as in |\caption*| -- so we test for~|*|, too.
+% \begin{macrocode}
+ \edef\@tempa{\expandafter\noexpand\@car#1\@nil}%
+ \if\@tempa*%
+ \let\@tempa\@firstofone
+ \else\if\@tempa[%]
+ \let\@tempa\@firstofone
+ \else
+ \let\@tempa\@empty
+ \fi\fi
+ \expandafter\caption\@tempa{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The picins package}
+% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
+%
+% \begin{macro}{\piccaptiontype}
+% |\piccaptiontype|\marg{type}\par
+% We offer this macro for changing the \meta{type} of the caption, so the user
+% doesn't have to redefine |\@captype|, as proposed in the \package{picins}
+% documentation.
+% \Note{We define this macro here so it can be used in the
+% preamble of the document, even when \thispackage\ was loaded prior to the
+% \package{picins} package.}
+% \begin{macrocode}
+\newcommand*\piccaptiontype[1]{\def\@piccaptype{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{picins}{%
+% \end{macrocode}
+%
+% Initial set |\@piccaptype| and undefine |\@captype| which was set to
+% |figure| by the \package{picins} package.
+% \begin{macrocode}
+ \caption@ifundefined\@piccaptype{%
+ \caption@iftype{%
+ \let\@piccaptype\@captype
+ }{%
+ \def\@piccaptype{figure}%
+ }%
+ }{}%
+ \let\@captype\@undefined
+% \end{macrocode}
+%
+% \begin{macro}{\piccaption}
+% The original code:
+% \begin{verbatim}
+% \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
+% \end{verbatim}%^^A
+% Our code uses |\caption@star| so |\piccaption*| works,
+% and |\caption@dblarg| so |\piccaption{}| works correctly.
+% \begin{macrocode}
+ \def\piccaption{\caption@star\relax{\caption@dblarg\@piccaption}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\make@piccaption}
+% \changes{v3.1}{2007/12/06}{Bugfix: \cs{caption@clearmargin} will always be used now}
+% The original code:
+% \begin{verbatim}
+% \def\make@piccaption{%
+% [...]
+% \setbox\@TEXT=\vbox{\hsize\hsiz@\caption[\sh@rtf@rm]{\capti@nt@xt}}%
+% }
+% \end{verbatim}%^^A
+% In our code we have to correct several things:
+% \begin{enumerate}
+% \item |\@captype| must be defined, since we have removed the global
+% definition.
+% \item We use |\caption@setoptions{parpic}| so
+% |\captionsetup[parpic]{|\ldots|}| is supported.
+% \item |\linewidth| must be set correctly.
+% Usually this is done by |\@parbox|\-|restore| inside |\@caption|,
+% but since we use |\@caption@parbox|\-|restore| we have to map this to
+% |\@parbox|\-|restore| instead.
+% \item The two arguments of |\caption| (|\sh@rtf@rm| \& |\capti@nt@xt|)
+% should be expanded on first level so |\caption[]{|\ldots|}| and
+% |\caption[|\ldots|]{}| work correctly.
+% \end{enumerate}
+% \begin{macrocode}
+ \let\caption@ORI@make@piccaption\make@piccaption
+ \def\make@piccaption{%
+ \let\caption@ORI\caption
+% \end{macrocode}
+% \begin{macrocode}
+ \long\def\caption[##1]##2{%
+ \caption@freezeHref % will be defrosted in \ivparpic
+ \caption@settype\@piccaptype
+% \ifnum\c@piccaptionpos>2\relax
+ \caption@clearmargin
+% \else
+% \captionwidth\z@ % do not use "width=" setting
+% \fi
+ \caption@setparboxrestore{full}%
+ \caption@setoptions{parpic}%
+ \caption@setautoposition b%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\expandafter\expandafter\caption@ORI
+ \expandafter\expandafter\expandafter[%
+ \expandafter\expandafter\expandafter{%
+ \expandafter##1\expandafter}\expandafter]\expandafter{##2}}%
+% \end{macrocode}
+% {\footnotesize\begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\begingroup|\\
+% | \toks0\expandafter{##1}| |\toks2\expandafter{##2}|\\
+% | \edef\x{\endgroup|\\
+% | \noexpand\caption@ORI[{\the\toks0}]{\the\toks2}}|\\
+% | \x|
+% \end{quote}
+% \begin{quote}
+% \leavevmode\llap{-or-\quad}%^^A
+% |\edef\x{%|\\
+% | \noexpand\caption@ORI[{\unexpanded\expandafter{##1}}]%|\\
+% | {\unexpanded\expandafter{##2}}}|\\
+% |\-|
+% \end{quote}}
+% \begin{macrocode}
+ \caption@ORI@make@piccaption
+ \let\caption\caption@ORI}%
+% \end{macrocode}
+% \end{macro}
+%
+
+% \begin{macro}{\ivparpic}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% We need to set our \package{hyperref} anchor here.
+% Not bullet-proof since we have to redefine |\noindent| here!
+% \begin{macrocode}
+ \let\caption@ORI@ivparpic\ivparpic
+ \def\ivparpic(#1,#2)(#3,#4)[#5][#6]#7{%
+ \let\caption@ORI@noindent\noindent
+ \def\noindent{%
+ \caption@defrostHref
+ \let\noindent\caption@ORI@noindent
+ \noindent}%
+ \caption@ORI@ivparpic(#1,#2)(#3,#4)[{#5}][{#6}]{#7}%
+ \let\noindent\caption@ORI@noindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{%
+ \let\piccaptiontype\@undefined
+}
+% \end{macrocode}
+%
+% \subsection{The rotating package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{rotating}[1995/08/22 v2.10]{%
+% \end{macrocode}
+%
+% \begin{macro}{\rotcaption}
+% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@star} removed}
+% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
+% Make |\rotcaption*| work.
+% \begin{macrocode}
+ \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
+% \let\@rotcaption\@undefined
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\rotcaptionof}
+% \changes{v3.0i}{2005/12/07}{New}
+% Make |\rotcaptionof(*)| work.
+% \begin{macrocode}
+ \def\rotcaptionof{%
+ \caption@teststar\caption@of{\rotcaption*}\rotcaption}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makerotcaption}
+% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
+% \changes{v3.0m}{2007/03/04}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox} now}
+% \changes{v3.3}{2012/12/26}{Rewritten (again)}
+% Original (bugfixed) code:
+% \begin{verbatim}
+% \long\def\@makerotcaption#1#2{%
+% \setbox\@tempboxa\hbox{#1: #2}%
+% \ifdim \wd\@tempboxa > .8\vsize
+% \rotatebox{90}{%
+% \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
+% }%\par % <== \par removed (AR)
+% \else%
+% \rotatebox{90}{\box\@tempboxa}%
+% \fi
+% \nobreak\hspace{12pt}% <== \nobreak added (AR)
+% }
+% \end{verbatim}%^^A
+% Our version emulates this behavior, but if |width=| is set,
+% the rotated caption is always typeset as |\parbox|.
+% (Note that |margin=| is not supported here.)
+% \begin{macrocode}
+ \long\def\@makerotcaption#1#2{%
+ \rotatebox{90}{%
+ \ifdim\captionwidth=\z@
+ \setcaptionwidth{.8\vsize}%
+ \l@addto@macro\caption@singleline{%
+ \caption@setup{parbox=none}}%
+ \fi
+ \let\caption@calcmargin\relax
+ \caption@@make{#1}{#2}}%
+ \nobreak\hspace{12pt}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The sidecap package}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{sidecap}[2003/06/06 v1.6f]{%
+ \caption@setbool{needfreeze}{1}%
+% \end{macrocode}
+%
+% \begin{macro}{\SC@zfloat}
+% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
+% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@star} removed}
+% \changes{v3.1c}{2007/10/06}{\cs{caption} will be saved \& restored now}
+% \changes{v3.2a}{2011/08/17}{Bugfix: Uses \cs{caption@freeze} instead of \cs{caption@freeze*} now}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
+% This macro will be called at the start of the environment, here is a good
+% opportunity to do some adaptations to |\caption| and |\captionsetup|.
+% \begin{macrocode}
+ \let\caption@ORI@SC@zfloat\SC@zfloat
+ \def\SC@zfloat#1#2#3[#4]{%
+% \end{macrocode}
+% First we use the original definition, but restore \cs{caption} and \cs{label}
+% so \cs{caption@freeze} and \cs{caption@warmup} will work correctly.
+% \begin{macrocode}
+ \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]%
+ \SC@RestoreCommands
+% \end{macrocode}
+% Since the sidecap package uses our |\caption| code outside the
+% environment the regular |\captionsetup| will not work.
+% So we need a special version here which saves the given argument list
+% which will be executed later on.
+% Furthermore we need to make |\caption*| work.
+% \begin{macrocode}
+ \caption@freezetype{#2}%
+% \end{macrocode}
+% The sidecap package uses |\ifx\label\SC@label| to test if it is just inside a
+% |SC|\-|figure| or not. So we redefine |\SC@label| here so this test will still work.
+% \begin{macrocode}
+ \let\SC@label\label}%
+% \end{macrocode}
+% \begin{macrocode}
+ \providecommand*\SC@RestoreCommands{%
+ \let\caption=\SC@orig@caption \let\label=\SC@orig@label}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\endSC@FLOAT}
+% \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
+% \changes{v3.1}{2007/05/05}{Call of \cs{caption@setoptions}\arg{SCfloat} added}
+% This macro will be called at the end of the environment, here we need to
+% setup our stuff before the \package{sidecap} package actually typesets
+% its caption.
+% \begin{macrocode}
+ \let\caption@ORI@endSC@FLOAT\endSC@FLOAT
+ \def\endSC@FLOAT{%
+% \end{macrocode}
+% Before we can typeset the caption we need to set the margin to zero
+% because any extra margin would only be disturbing here.\par
+% (We don't need to take care about the caption position because
+% the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
+% to a skip of zero anyway.)\par
+% Furthermore |\SC@justify| will override the caption justification, if set.
+% The usage of |\SC@justify| differs from version to version of the
+% \package{sidecap} package:\par
+% \begin{tabular}{ll}
+% Version 1.4: & |\SC@justify| is not defined\\
+% Version 1.5: & |\SC@justify| is |\relax| when not set\\
+% Version 1.6: & |\SC@justify| is |\@empty| when not set\\
+% \end{tabular}
+% \begin{macrocode}
+ \def\caption@setSC@justify{%
+ \caption@clearmargin
+ \ifx\SC@justify\@empty \else
+ \let\caption@justification\SC@justify
+ \let\SC@justify\@empty
+ \fi}%
+% \end{macrocode}
+% Make the original definition of |\endSC@FLOAT| to use our caption
+% stuff instead of its own.
+% \Note{At this point the \package{sidecap} definition of \cs{caption} is valid,
+% not the regular one!}
+% \begin{macrocode}
+ \let\caption\SC@orig@caption
+ \def\SC@orig@caption[##1]##2{%
+ \caption@setSC@justify
+%%% \caption@setoptions{SC}%
+ \caption@setoptions{SC\@captype}%
+ \caption@defrost}%
+% \end{macrocode}
+% Finally we call the original definition of |\endSC@FLOAT|.
+% \begin{macrocode}
+ \caption@setSC@justify % for compatibility mode
+ \caption@prepare@defrost
+ \caption@ORI@endSC@FLOAT}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The subfigure package}
+% \changes{v3.1}{2007/04/06}{subfigure package support added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{subfigure}[2002/01/23 v2.1]{%
+% \end{macrocode}
+%
+% \begin{macro}{\sf@ifpositiontop}
+% \changes{v3.1a}{2007/09/15}{Bugfix 07-09-15: Check for \cs{@captype} added}
+% If the \package{subfigure} package is loaded, we map |\sf@ifpositiontop|
+% to |\iffiguretopcap| resp. |\iftabletopcap|, so the \package{subfigure}
+% \version{2.1} options \opt{figbotcap} etc. will still work.
+% \begin{macrocode}
+ \def\sf@ifpositiontop{%
+ \ifx\@captype\@undefined
+ \expandafter\@gobbletwo
+ \else\ifx\@captype\relax
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\expandafter\sf@if@position@top
+ \fi\fi}
+% \end{macrocode}
+% \begin{macrocode}
+ \def\sf@if@position@top{%
+ \@ifundefined{if\@captype topcap}%
+ {\@gobbletwo}%
+ {\@nameuse{if\@captype topcap}%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The supertabular and xtab packages}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{supertabular}[2002/07/19 v4.1e]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
+% \changes{v3.1h}{2008/04/01}{Bugfix: Star variant does not increment table counter anymore}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1h}{2008/04/01}{Made \cs{nameref} \& \cs{autoref} work}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[{#1}]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
+% \changes{v3.1h}{2008/04/01}{Bugfix: \cs{@currentlabelname} will be set now}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% \if@topcaption \vskip 10\p@ \fi
+% \endgroup}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{supertabular}%
+% \end{macrocode}
+% The |position=| setting will be overwritten by the
+% \package{supertabular} package: If |\topcaption| was used,
+% the position will be |top| automatically, |bottom| otherwise.
+% \begin{macrocode}
+ \caption@setposition{\if@topcaption t\else b\fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@parboxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \changes{v3.1h}{2008/04/01}{Support of the xtab package added}
+% \begin{macrocode}
+\caption@IfPackageLoaded{xtab}[2000/04/09 v2.3]{%
+% \end{macrocode}
+%
+% \begin{macro}{\tablecaption}
+% Make |\topcaption*| and |\bottomcaption*| work.
+% \begin{macrocode}
+ \renewcommand*\tablecaption{%
+ \caption@star
+ {\refstepcounter{table}}%
+ {\caption@dblarg{\@xtablecaption}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xtablecaption}
+% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
+% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added}
+% Make |\nameref| and |\autoref| work.
+% \begin{macrocode}
+ \let\caption@ORI@xtablecaption\@xtablecaption
+ \long\def\@xtablecaption[#1]#2{%
+ \caption@gettitle{#2}%
+ \caption@ORI@xtablecaption[{#1}]{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ST@caption}
+% The original code:
+% \begin{verbatim}
+% \long\def\ST@caption#1[#2]#3{\par%
+% \@initisotab
+% \addcontentsline{\csname ext@#1\endcsname}{#1}%
+% {\protect\numberline{%
+% \csname the#1\endcsname}{\ignorespaces #2}}%
+% \begingroup
+% \@parboxrestore
+% \normalsize
+% %% \if@topcaption \vskip -10\p@ \fi
+% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+% %% \if@topcaption \vskip 10\p@ \fi
+% \endgroup
+% \global\advance\ST@pageleft -\PWSTcapht
+% \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \long\def\ST@caption#1[#2]#3{\par%
+ \caption@settype*{#1}%
+ \caption@setoptions{xtabular}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@set{position}{\if@topcaption t\else b\fi}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@initisotab
+ \caption@beginex{#1}{#2}{#3}%
+ \caption@parboxrestore
+ \caption@normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \caption@end
+ \global\advance\ST@pageleft -\PWSTcapht
+ \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The threeparttable package}
+% \changes{v3.1}{2007/05/08}{Support of the \package{threeparttable} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{threeparttable}[2003/06/13 v3.0]{%
+% \end{macrocode}
+%
+% \begin{macro}{\threeparttable}
+% \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined}
+% Unfortunately |\@captype| is not set when |\TPT@common| will be used,
+% so we have to redefine |\threeparttable| and |\measuredfigure| instead.
+% \begin{macrocode}
+ \let\caption@ORI@threeparttable\threeparttable
+ \renewcommand*\threeparttable{%
+ \caption@settype{\@ifundefined{@captype}{table}{\@captype}}%
+%%% \caption@setposition{auto}% ?
+ \caption@clearmargin
+ \caption@setoptions{threeparttable}%
+ \caption@ORI@threeparttable}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\measuredfigure}
+% \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined}
+% Same here\ldots
+% \begin{macrocode}
+ \let\caption@ORI@measuredfigure\measuredfigure
+ \renewcommand*\measuredfigure{%
+ \caption@settype{\@ifundefined{@captype}{figure}{\@captype}}%
+%%% \caption@setposition{auto}% ?
+ \caption@clearmargin
+ \caption@setoptions{measuredfigure}%
+ \caption@ORI@measuredfigure}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\TPT@caption}
+% The original code:
+% \begin{verbatim}
+% \def\TPT@caption#1[#2]#3{\gdef\TPT@docapt
+% {\par\global\let\TPT@docapt\@undefined \TPT@LA@caption{#1}[{#2}]%
+% {\strut\ignorespaces#3\ifhmode\unskip\@finalstrut\strutbox\fi}}%
+% \ifx\TPT@hsize\@empty \let\label\TPT@gatherlabel \abovecaptionskip\z@skip
+% \else \TPT@docapt \fi \ignorespaces}
+% \end{verbatim}%^^A
+% \begin{macrocode}
+ \def\TPT@caption#1[#2]#3{%
+ \gdef\TPT@docapt{%
+ \global\let\TPT@docapt\@undefined
+ \caption@setautoposition\caption@TPT@position
+ \TPT@LA@caption{#1}[{#2}]{#3}}%
+ \ifx\TPT@hsize\@empty
+ \let\label\TPT@gatherlabel % Bug: does not work for measuredfigures
+ \gdef\caption@TPT@position{t}%
+ \g@addto@macro\TPT@docapt\caption@TPT@eatvskip
+ \else
+ \def\caption@TPT@position{b}%
+ \TPT@docapt
+ \fi
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ %\newcommand*\caption@TPT@eatvskip{\vskip-.2\baselineskip}%
+ \def\caption@TPT@eatvskip#1\vskip{#1\@tempdima=}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The wrapfig package}
+% \changes{v3.1}{2007/05/05}{Support of the \package{wrapfig} package added}
+% \changes{v3.2d}{2011/11/02}{Support of the \package{wrapfig} package rewritten}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{wrapfig}[2003/01/31 v3.6]{%
+% \end{macrocode}
+%
+% \begin{macro}{\wrapfloat}
+% \changes{v3.2d}{2011/11/02}{Redefinition of this macro added}
+% First of all we make the \package{wrapfig} package independent from the package
+% load order regarding the \package{float} package.
+% Since the usage of |\@float@set|\-|every| is missing in the code of the \package{wrapfig}
+% package (it should be in the redefinition of |\float@re|\-|style|, right after
+% |\@nameuse{fst@#1}|), we don't use it here, too,
+% especially since |\wrap|\-|float| will usually not be used when used with re-styled floats.
+% \begin{macrocode}
+ \renewcommand*\wrapfloat[1]{%
+ \def\@captype{#1}%
+ \@ifundefined{fst@#1}{}{%
+ \@nameuse{fst@#1}%
+% \@float@setevery{#1}%
+ \def\WF@floatstyhook{\let\@currbox\WF@box
+ \global\setbox\WF@box\float@makebox{\wd\WF@box}}}%
+ \@ifnextchar[\WF@wr{\WF@wr[]}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\WF@rapt}
+% \changes{v3.2d}{2011/11/02}{Usage of \cs{WF@captionstyhook} added}
+% Original code:
+% \begin{verbatim}
+% \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+% \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+% \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+% \ifdim\hsize>\z@ \@parboxrestore \else
+% \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+% \ignorespaces \fi}
+% \end{verbatim}%^^A
+% Our code has |\WF@captionstyhook| in addition:
+% \begin{macrocode}
+ \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
+ \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
+ \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
+ \expandafter\WF@captionstyhook\expandafter{\@captype}% <= new
+ \ifdim\hsize>\z@ \@parboxrestore \else
+ \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
+ \ignorespaces \fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\WF@captionstyhook}
+% \changes{v3.2d}{2011/11/02}{This macro added}
+% \changes{v3.2e}{2011/11/10}{Bugfix 11-11-09: float package support fixed}
+% We place our \package{hyperref} anchor here, apply the `wrap' options etc.
+% Since the usage of |\@float@set|\-|every| is missing in the \package{wrapfig}
+% package we will catch it up here for making the necessary adaptions to the
+% \package{float} package.
+% \begin{macrocode}
+ \def\WF@captionstyhook#1{%
+ \let\@captype\@undefined
+ \@ifundefined{fst@#1}{}{\@float@setevery{#1}}%
+ \caption@settype{#1}%
+ \caption@clearmargin
+%%% \caption@setoptions{wrap}%
+ \caption@setoptions{wrap#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \section{That's all Folks!}
+%
+% Execute the code declared with |\After|\-|Caption|\-|Package|.
+%
+% \begin{macrocode}
+\caption@endtitles@code
+\let\caption@endtitles@code\@undefined
+\let\AfterCaptionPackage\@firstofone
+% \end{macrocode}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \begin{thebibliography}{99}
+% \bibitem{float}
+% Anselm Lingnau:\\
+% \href{http://www.ctan.org/pkg/float}%
+% {\emph{An Improved Environment for Floats}},\\
+% 2001/11/08
+%
+% \bibitem{floatflt}
+% Mats Dahlgren:\\
+% \href{http://www.ctan.org/pkg/floatflt}%
+% {\emph{Welcome to the floatflt package}},\\
+% 1998/06/05
+%
+% \bibitem{floatrow}
+% Olga Lapko:\\
+% \href{http://www.ctan.org/pkg/floatrow}%
+% {\emph{The floatrow package documentation}},\\
+% 2009/08/02
+%
+% \bibitem{fltpage}
+% Sebastian Gross:\\
+% \href{http://www.ctan.org/pkg/fltpage}%
+% {\emph{Welcome to the beta test of fltpage package!}},\\
+% 1998/11/13
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/hyperref}%
+% {\emph{Hypertext marks in \LaTeX: a manual for hyperref}},\\
+% November 2012
+%
+% \bibitem{hypcap}
+% Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/oberdiek}%
+% {\emph{The hypcap package -- Adjusting anchors of captions}},\\
+% 2011/02/16
+%
+% \bibitem{listings}
+% Carsten Heinz \& Brooks Moses:\\
+% \href{http://www.ctan.org/pkg/listings}%
+% {\emph{The Listings Package}},\\
+% 2007/02/22
+%
+% \bibitem{longtable}
+% David Carlisle:\\
+% \href{http://www.ctan.org/pkg/longtable}%
+% {\emph{The longtable package}},\\
+% 2004/02/01
+%
+% \bibitem{picinpar}
+% Friedhelm Sowa:\\
+% \href{http://www.ctan.org/pkg/picinpar}%
+% {\emph{Pictures in Paragraphs}},\\
+% July 13, 1993
+%
+% \bibitem{picins}
+% Joachim Bleser and Edmund Lang:\\
+% \href{http://www.ctan.org/pkg/picins}%
+% {\emph{PicIns-Benutzerhandbuch Version 3.0}},\\
+% September~1992
+%
+% \bibitem{rotating}
+% Sebastian Rahtz and Leonor Barroca:\\
+% \href{http://www.ctan.org/pkg/rotating}%
+% {\emph{A style option for rotated objects in \LaTeX}},\\
+% 1997/09/26
+%
+% \bibitem{sidecap}
+% Rolf Niepraschk \& Hubert G\"a\ss lein:\\
+% \href{http://www.ctan.org/pkg/sidecap}%
+% {\emph{The sidecap package}},\\
+% 2003/06/06
+%
+% \bibitem{subfigure}
+% Steven D. Cochran:\\
+% \href{http://www.ctan.org/pkg/subfigure}%
+% {\emph{The subfigure package}},\\
+% 2005/03/15
+%
+% \bibitem{subfig}
+% Steven D. Cochran:\\
+% \href{http://www.ctan.org/pkg/subfig}%
+% {\emph{The subfig package}},\\
+% 2005/07/05
+%
+% \bibitem{supertabular}
+% Johannes Braams and Theo Jurriens:\\
+% \href{http://www.ctan.org/pkg/supertabular}%
+% {\emph{The supertabular environment}},\\
+% 2004/02/20
+%
+% \bibitem{threeparttable}
+% Donald Arseneau:\\
+% \href{http://www.ctan.org/pkg/threeparttable}%
+% {\emph{Three part tables: title, tabular environment, notes}},\\
+% March 5, 2010
+%
+% \bibitem{wrapfig}
+% Donald Arseneau:\\
+% \href{http://www.ctan.org/pkg/wrapfig}%
+% {\emph{WRAPFIG.STY ver 3.6}},\\
+% Jan 31, 2003
+%
+% \bibitem{xtab}
+% Peter Wilson:\\
+% \href{http://www.ctan.org/pkg/xtab}%
+% {\emph{The xtab package}},\\
+% 2011/07/31
+% \end{thebibliography}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/caption/fallback/v3.5/caption3.dtx b/Master/texmf-dist/source/latex/caption/fallback/v3.5/caption3.dtx
new file mode 100644
index 00000000000..5918f4a540c
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/fallback/v3.5/caption3.dtx
@@ -0,0 +1,4680 @@
+% \iffalse meta-comment
+%
+% This is file `caption3.dtx'.
+%
+% Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+%
+% --------------------------------------------------------------------------
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files
+% caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx,
+% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx,
+% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx,
+% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx,
+% the derived files
+% caption.sty, caption-light.sty, caption2.sty, caption3.sty,
+% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto,
+% caption-koma.sto, caption-memoir.sto, caption-ntg.sto,
+% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty,
+% and the user manuals
+% caption-deu.tex, caption-eng.tex, caption-rus.tex.
+%
+% \fi
+% \CheckSum{3674}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{caption3.drv}[2020/10/11 v2.2 Implementation of the caption kernel]
+\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+\makeatletter % make room for subsections like 2.16.14 in the TOC
+%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
+\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
+\makeatother
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage{caption3}[2020/09/12]
+%
+\DeclareRobustCommand*\eTeX{\texorpdfstring
+ {\leavevmode\hbox{$\varepsilon$}-\TeX}%
+ {e-TeX}}
+%
+\begin{document}
+ \DocInput{caption3.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \def\thispackage{the \package{caption} kernel}
+% \def\Thispackage{The \package{caption} kernel}
+%
+% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
+% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
+% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
+% \let\class\puresf \let\package\puresf
+% \let\env\purett \let\opt\purett
+%
+% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+% \newcommand*\version[2][]{v$#2$}
+%
+% \GetFileInfo{caption3.drv}
+% \let\docdate\filedate
+% \let\docversion\fileversion
+% \GetFileInfo{caption3.sty}
+%
+% \title{The Implementation of
+% \texorpdfstring{\thispackage\thanks{%^^A
+% This package has version number \docversion.}}%^^A
+% {the caption kernel}}
+% \author{Axel Sommerfeldt\\
+% \url{https://gitlab.com/axelsommerfeldt/caption}}
+% \date{\docdate}
+% \maketitle
+%
+% \begin{abstract}
+% \Thispackage\ consists of two parts -- the kernel
+% (|caption3.sty|) and the main package (|caption.sty|).
+%
+% The kernel provides all the user commands and internal macros which are
+% necessary for typesetting captions and setting parameters regarding these.
+% While the standard \LaTeX\ document classes provide an internal command
+% called |\@makecaption| and no options to control its behavior (except the
+% vertical skips above and below the caption itself), we provide similar
+% commands called |\caption@make| and |\caption@@make|, but with a lot of
+% options which can be selected with |\captionsetup|.
+% Loading the kernel part do not change the output of a \LaTeX\ document
+% -- it just provides functionality which can be used by \LaTeXe\ packages
+% which typesets captions, for example the \package{caption} and
+% \package{subfig} packages.
+% \end{abstract}
+%
+% \section*{Internal commands}
+%
+% These internal commands are save to use by other packages as well
+% since their interface will not change in future releases:
+% \begin{quote}\begin{tabular}{ll}
+% Internal command & Currently used by \\
+% \hline
+% |\caption@addcontentsline| & \package{floatrow} \\
+% |\caption@fnun| & \package{floatrow} \\
+% |\caption@ifinlist| & \package{floatrow} \\
+% |\caption@iftop| & \package{keyfloat}, \package{subfig} \\
+% |\caption@make| & \package{subfig} \\
+% |\caption@@make| & \package{floatrow} \\
+% |\caption@setautoposition| & \package{bidi} \\
+% |\caption@setoptions| & \package{floatrow} \\
+% |\caption@setposition| & \package{floatrow} \\
+% |\caption@switchdefault| & \emph{none} \\
+% \end{tabular}\end{quote}
+%
+% If your package wants to use any other internal command of the \package{caption3} package,
+% please write me an e-mail so we can define a proper interface together.
+%
+% Unfortunately these internal commands are used by other packages and therefore will likely
+% not change in the future, too, but I do not support them (and maybe I will change them anyway
+% and patch the other package on-the-fly instead, at least if it's unmaintained):
+% \begin{quote}\begin{tabular}{ll}
+% Internal command & Currently used by \\
+% \hline
+% |\caption@hangindent | & \package{bidi} \\
+% |\caption@@@make| & \package{floatrow} \\
+% |\caption@@par| & \package{bidi} \\
+% |\caption@parindent| & \package{bidi} \\
+% |\caption@set@bool| & \package{floatrow} \\
+% |\caption@setfont| & \package{floatrow} \\
+% |\caption@setkeys| & \package{floatrow} \\
+% |\caption@setstyle*| & \package{floatrow} \\
+% \hline
+% |\caption@hj@|\meta{name} & \package{floatrow} \\
+% |\caption@lsep@|\meta{name} & \package{floatrow} \\
+% |\caption@lsep@default| & \package{babel-hungarian} \\
+% |\caption@sty@|\meta{name} & \package{floatrow} \\
+% \end{tabular}\end{quote}
+%
+% Furthermore the \package{floatrow} package uses the undocumented option
+% |position=a| (as abbreviation of |position=auto|).
+%
+% The \package{lwarp} package uses a lot of internal commands as well,
+% but we are working on it on the Git branch \texttt{feature/lwarp}:
+% \url{https://gitlab.com/axelsommerfeldt/caption/-/tree/feature/lwarp}
+%
+% \StopEventually{}
+% \clearpage
+% \tableofcontents
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
+% \DoNotIndex{\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
+%
+% \changes{v1.0}{2003/12/20}{Rewritten; many new commands and features}
+% \changes{v1.0c}{2004/11/28}{Split into two packages: \package{caption} \& \package{caption3}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \section{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{caption3}[2020/10/26 v2.2f caption3 kernel (AR)]
+% \end{macrocode}
+%
+% \section{Generic helpers}
+%
+% \begin{macro}{\@nameundef}
+% |\@nameundef|\marg{command name}\\
+% is the opposite to |\@name|\-|def| which is offered by the \LaTeX\ kernel.
+% We use it to remove the definition of some commands and keyval options after
+% |\begin{document}| (to save \TeX\ memory) and to remove caption options defined
+% with |\caption|\-|setup|\oarg{type}.
+% \begin{macrocode}
+\providecommand*\@nameundef[1]{%
+ \expandafter\let\csname #1\endcsname\@undefined}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@addto@macro}
+% \changes{v1.5}{2013/04/26}{Revised}
+% \changes{v2.0}{2019/09/11}{Relies on \eTeX{} now}
+% |\l@addto@macro|\marg{command}\marg{code}\\
+% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which
+% globally adds tokens to existing macros, like in |\AtBeginDocument|.
+% This one is the same but it works locally, not globally.
+% \begin{macrocode}
+\providecommand\l@addto@macro[2]{%
+ \edef#1{\unexpanded\expandafter{#1#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bothIfFirst}
+% \changes{v2.2}{2020/09/21}{Usage of \cs{caption@prepare@bothif} added}
+% \begin{macro}{\bothIfSecond}
+% \changes{v2.2}{2020/09/21}{Usage of \cs{caption@prepare@bothif} added}
+% |\bothIfFirst|\marg{code no. 1}\marg{code no. 2}\\
+% |\bothIfSecond|\marg{code no. 1}\marg{code no. 2}\\
+% |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond|
+% tests if the second argument is not empty. If yes both arguments get
+% typeset, otherwise none of them.
+% \begin{macrocode}
+\def\bothIfFirst#1#2{\caption@bothif{#1}{#1#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\bothIfSecond#1#2{\caption@bothif{#2}{#1#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@bothif[2]{%
+ \begingroup
+ \caption@prepare@bothif
+ \protected@xdef\caption@tempa{#1}%
+ \endgroup
+ \ifx\caption@tempa\@empty \else
+ #2%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepare@bothif}
+% \changes{v2.2}{2020/09/21}{This macro added}
+% |\caption@prepare@bothif|\\
+% re-defines anything which could disturb either |\both|\-|If|\-|First| or |\both|\-|If|\-|Second| check.
+% \begin{macrocode}
+\providecommand*\caption@prepare@bothif{}
+\g@addto@macro\caption@prepare@bothif{%
+ \let\inputencoding\@gobble}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifundefined}
+% \changes{v1.3a}{2011/08/12}{This macro added}
+% \changes{v1.3b}{2011/08/18}{Made expandable}
+% |\caption@ifundefined|\marg{command}\marg{yes-code}\marg{no-code}\\
+% is similar to \cs{@ifundefined} offered by the \LaTeX kernel,
+% but takes a command as argument instead of a command name.
+% \begin{macrocode}
+\newcommand*\caption@ifundefined[1]{%
+ \ifdefined#1%
+ \ifx#1\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi
+ \else
+ \expandafter\@firstoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifdefined}
+% \changes{v1.8e}{2018/05/11}{This macro added}
+% |\caption@ifdefined|\marg{command}\marg{yes-code}\marg{no-code}\\
+% is similar to \cs{@ifundefined} offered by the \LaTeX kernel,
+% but takes a command as argument instead of a command name.
+% \begin{macrocode}
+\newcommand*\caption@ifdefined[1]{%
+ \ifdefined#1%
+ \ifx#1\relax
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \else
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \fi
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifinlist}
+% \changes{v1.1}{2007/07/29}{Rewritten}
+% |\caption@ifinlist|\marg{element}\marg{list}\marg{yes-code}\marg{no-code}\\
+% This helper command checks if the \meta{element} is in the comma separated
+% \meta{list}. So for example
+% \begin{quote}
+% |\caption@ifinlist{frank}{axel,frank,olga,steven}{yes}{no}|
+% \end{quote}
+% would expand to |yes|.\par
+% (Note: Since this command is used by the \package{floatrow} package as well
+% its syntax should not change.)
+% \begin{macrocode}
+\newcommand*\caption@ifinlist{%
+ \@expandtwoargs\caption@@ifinlist}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@ifinlist[2]{%
+ \begingroup
+ \def\@tempa##1,#1,##2\@nil{%
+ \endgroup
+ \ifx\relax##2\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}%
+ \@tempa,#2,#1,\@nil}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifin@list}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% |\caption@ifin@list|\marg{cmd}\marg{element}\marg{yes-code}\marg{no-code}\\
+% is the same as |\caption@ifinlist| but with a command (containing a list)
+% instead of the list itself.
+% \begin{macrocode}
+\newcommand*\caption@ifin@list[2]{%
+ \caption@ifempty@list#1%
+ {\@secondoftwo}%
+ {\@expandtwoargs\caption@@ifinlist{#2}{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@addto@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@g@addto@list|\marg{cmd}\marg{element}\\
+% adds an element to a command containing a list.
+% (The command will get defined if it isn't defined yet.)
+% \begin{macrocode}
+\newcommand*\caption@g@addto@list[2]{%
+ \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@addto@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@l@addto@list|\marg{cmd}\marg{element}\\
+% is the same as |\caption@g@addto@list| but works locally.
+% \begin{macrocode}
+\newcommand*\caption@l@addto@list[2]{%
+ \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@g@removefrom@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@g@removefrom@list|\marg{cmd}\marg{element}\\
+% removes an element from a command containing a list.
+% \Note[Caveat]{\meta{cmd} will be expanded during this process since
+% \cs{@removeelement} is using \cs{edef} to build the new list.}
+% \begin{macrocode}
+\newcommand*\caption@g@removefrom@list[2]{%
+ \caption@l@removefrom@list#1{#2}%
+ \global\let#1#1}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@l@removefrom@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@l@removefrom@list|\marg{cmd}\marg{element}\\
+% is the same as |\caption@g@removefrom@list| but works locally.
+% \Note[Caveat]{\meta{cmd} will be expanded during this process since
+% \cs{@removeelement} is using \cs{edef} to build the new list.}
+% \begin{macrocode}
+\newcommand*\caption@l@removefrom@list[2]{%
+ \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@for@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@for@list|\marg{cmd}\marg{code with \#1}\\
+% iterates all elements of the list (within \meta{cmd}) using the given
+% \meta{code}.
+% \begin{macrocode}
+\newcommand*\caption@for@list[2]{%
+ \caption@ifempty@list#1{}%
+ {\def\caption@tempb##1{#2}%
+ \@for\caption@tempa:=#1\do{%
+ \expandafter\caption@tempb\expandafter{\caption@tempa}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty@list}
+% \changes{v1.1}{2007/07/29}{This macro added}
+% |\caption@ifempty@list|\marg{cmd}\marg{yes-code}\marg{no-code}\\
+% This helper command checks if the list (within \meta{cmd}) is empty.
+% \begin{macrocode}
+\newcommand*\caption@ifempty@list[1]{%
+ \ifx#1\@undefined
+ \expandafter\@firstoftwo
+ \else\ifx#1\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else\ifx#1\@empty
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak[3]
+% \begin{macro}{\caption@setbool}
+% \changes{v1.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added}
+% \begin{macro}{\caption@ifbool}
+% \changes{v1.1}{2020/08/02}{\cs{caption@if@bool}\marg{value} added}
+% \begin{macro}{\caption@undefbool}
+% For setting and testing boolean options we offer these three helper macros:
+% \begin{quote}
+% |\caption@setbool|\marg{name}\marg{value}\\
+% | |(with |value = false/true/no/yes/off/on/0/1|)\\
+% |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\
+% |\caption@undefbool|\marg{name}
+% \end{quote}
+% \begin{macrocode}
+\newcommand*\caption@setbool[1]{%
+ \expandafter\caption@set@bool\csname caption@if#1\endcsname}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@set@bool[2]{%
+ \caption@if@bool{#2}{\let#1\@firstoftwo}{\let#1\@secondoftwo}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@if@bool[1]{%
+ \caption@ifinlist{#1}{1,true,yes,on}%
+ {\@firstoftwo}%
+ {\caption@ifinlist{#1}{0,false,no,off}%
+ {}%
+ {\caption@Error{Undefined boolean value `#1'}}%
+ \@secondoftwo}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@teststar}
+% \changes{v1.1}{2007/05/08}{This macro and its usage added}
+% \changes{v1.1e}{2007/10/28}{\cs{caption@teststar@} added}
+% |\caption@teststar|\marg{cmd}\marg{star-arg}\marg{non-star-arg}\\
+% expands \meta{cmd} with either argument \marg{star-arg} or
+% \meta{non-star-arg}, depending on if the next char is a star (or not).\par
+% |\caption@teststar@|\marg{cmd}\marg{star-arg}\marg{non-star-arg}\\
+% will test the catcode of the character \@ additionally.
+% \begin{macrocode}
+\newcommand*\caption@teststar[3]{%
+ \@ifstar{#1{#2}}{#1{#3}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@teststar@[3]{%
+ \@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}}
+\AtBeginDocument{\let\caption@teststar@\caption@teststar}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifatletter}
+% \changes{v1.1e}{2007/10/28}{This macro added}
+% |\caption@ifatletter|\marg{yes-code}\marg{no-code}\\
+% will either expand \meta{yes-code} or \meta{no-code},
+% depending on the catcode of the character \@.
+% \begin{macrocode}
+\newcommand*\caption@ifatletter{%
+ \ifnum\the\catcode`\@=11
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{\let\caption@ifatletter\@secondoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@withoptargs}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% \changes{v1.5}{2012/04/09}{This macro revised}
+% |\caption@withoptargs|\marg{cmd}\\
+% collects a star and all optional arguments, and expands \meta{cmd}
+% afterwards with the collected stuff as first argument.
+% \begin{macrocode}
+\newcommand*\caption@withoptargs[1]{%
+ \@ifstar
+ {\def\caption@tempa{*}\caption@@withoptargs{#1}}%
+ {\def\caption@tempa{}\caption@@withoptargs{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@withoptargs#1{%
+ \@ifnextchar[%]
+ {\caption@@@withoptargs{#1}}%
+ {\caption@@@@withoptargs{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@withoptargs#1[#2]{%
+ \l@addto@macro\caption@tempa{[{#2}]}%
+ \caption@@withoptargs{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@@withoptargs#1{%
+ \def\caption@tempb{#1}%
+ \expandafter\caption@tempb\expandafter{\caption@tempa}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@gobble}
+% \changes{v1.4}{2011/08/19}{This macro added}
+% |\caption@gobble*|\oarg{arg}\oarg{\ldots}\marg{arg}\\
+% is similar to |\@gobble| but gobbles a star and optional arguments as well.
+% \begin{macrocode}
+\DeclareRobustCommand*\caption@gobble{%
+ \caption@withoptargs\@gobbletwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@AtBeginDocument}
+% \changes{v1.1}{2007/04/13}{This macro and its usage added}
+% \changes{v1.2e}{2010/01/09}{Adapted to the combine document class}
+% |\caption@AtBeginDocument*|\marg{code}\\
+% is similar to |\AtBeginDocument| but the execution of code will be
+% surrounded by two |\Package|\-|Info|s.
+% The starred variant causes the code to be executed after all code
+% specified using the non-starred variant.
+% \begin{macrocode}
+\let\caption@begindocumenthook\@empty
+\let\caption@@begindocumenthook\@empty
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@AtBeginDocument{%
+ \caption@teststar\g@addto@macro
+ \caption@@begindocumenthook\caption@begindocumenthook}
+%\@onlypreamble\caption@AtBeginDocument
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{%
+ \caption@InfoNoLine{Begin \noexpand\AtBeginDocument code}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}%
+ \caption@begindocumenthook
+ \let\caption@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@AtBeginDocument{%
+ \@ifstar\@firstofone\@firstofone}%
+ \caption@@begindocumenthook
+ \let\caption@@begindocumenthook\relax
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@InfoNoLine{End \noexpand\AtBeginDocument code}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Information, Warnings, and Errors}
+%
+% \begin{macro}{\caption@Info}
+% \changes{v1.3}{2010/10/25}{Moved from package to kernel}
+% |\caption@Info|\marg{message}\\
+% issues an info message (with code line indication).
+% \begin{macrocode}
+\newcommand*\caption@Info[1]{%
+ \PackageInfo{caption}{#1}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@InfoNoLine}
+% \changes{v1.3}{2010/10/25}{Moved from package to kernel}
+% |\caption@InfoNoLine|\marg{message}\\
+% issues an info message without code line indication.
+% \Note{The \cs{@gobble} at the end of the 2nd argument of
+% \cs{PackageInfo} suppresses the line number info.
+% See TLC2\cite{TLC2}, A.4.7, p885 for details.}
+% \begin{macrocode}
+\newcommand*\caption@InfoNoLine[1]{%
+ \caption@Info{#1\@gobble}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@Warning}
+% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% |\caption@Warning|\marg{message}\\
+% issues a warning message (with code line indication).
+% \begin{macrocode}
+\newcommand*\caption@Warning[1]{%
+ \caption@WarningNoLine{#1\on@line}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caption@WarningNoLine}
+% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings}
+% |\caption@WarningNoLine|\marg{message}\\
+% issues a warning message without code line indication.
+% \begin{macrocode}
+\newcommand*\caption@WarningNoLine[1]{%
+ \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@wh{%
+ See the caption package documentation for explanation.}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@Error}
+% \changes{v1.0j}{2007/01/20}{This macro added, will now be used for errors}
+% \changes{v1.0o}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}}
+% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed}
+% \changes{v2.2a}{2020/09/28}{\cs{caption@eh} renamed to \cs{caption@@eh} and revised}
+% |\caption@Error|\marg{message}\\
+% issues an error message (with code line indication).
+% \begin{macrocode}
+\newcommand*\caption@Error[1]{%
+ \PackageError{caption}{#1}{\caption@@eh{caption}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@eh[1]{%
+ If you do not understand this error, please take a closer look\MessageBreak
+ at the documentation of the `#1' package, especially the\MessageBreak
+ section about errors.\MessageBreak\@ehc}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@KV@err}
+% \changes{v1.1b}{2007/09/18}{This macro added}
+% |\caption@KV@err|\marg{message}\\
+% will be used to issue an error while parsing the key-value (package)
+% options.
+% \begin{macrocode}
+\let\caption@KV@err\caption@Error
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Using the keyval package}
+%
+% We need the \package{keyval} package for option handling, so we load it here.\par
+% \emph{TODO:} Use some recent stuff instead, for example kvdefinekey and kvsetkeys.
+% \begin{macrocode}
+\RequirePackage{keyval}[1997/11/10]
+% \end{macrocode}
+%
+% \begin{macro}{\undefine@key}
+% |\undefine@key|\marg{family}\marg{key}\\
+% is the opposite of |\define@key|, it removes a keyval definition.
+% \begin{macrocode}
+\providecommand*\undefine@key[2]{%
+ \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@onlypreamble@key}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \changes{v1.1e}{2007/11/01}{\cs{KV@err} will be used now instead of \cs{@notprerr}}
+% |\onlypreamble@key|\marg{family}\marg{key}\\
+% marks a keyval definition only valid in the document preamble, analogous to
+% |\@only|\-|preamble| from \LaTeXe.
+% \begin{macrocode}
+\providecommand*\@preamble@keys{}
+\providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}}
+\@onlypreamble\@onlypreamble@key
+\@onlypreamble\@preamble@keys
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument*{%
+ \def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}%
+ \@preamble@keys
+ \let\@elt\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOption}
+% |\DeclareCaptionOption*|\marg{option}\oarg{default value}\marg{code}\\
+% We declare our options using these commands (instead of using
+% |\Declare|\-|Option| offered by \LaTeXe), so the keyval package is used.
+% The starred form makes the option available during the lifetime of the
+% current package only, so they can be used with |\use|\-|package|, but
+% \emph{not} with |\caption|\-|setup| later on.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOption{%
+ \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareoption[2]{%
+ #1{\undefine@key{caption}{#2}}\caption@declare@option{#2}}
+\@onlypreamble\caption@declareoption
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declare@option{%
+ \define@key{caption}}
+%% no \@onlypreamble\caption@declare@option since it will be used by \captionsetup
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionOptionNoValue}
+% \changes{v1.1c}{2007/10/06}{This macro added}
+% |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\\
+% is the same as |\DeclareCaptionOption| but issues an error if a value is
+% given.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionOptionNoValue{%
+ \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble}
+\@onlypreamble\DeclareCaptionOptionNoValue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declareoption@novalue[3]{%
+ \caption@declareoption{#1}{#2}[\KV@err]{%
+ \caption@option@novalue{#2}{##1}{#3}}}
+\@onlypreamble\caption@declareoption@novalue
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@option@novalue[2]{%
+ \ifx\KV@err#2%
+ \expandafter\@firstofone
+ \else
+ \KV@err{No value allowed for #1}%
+ \expandafter\@gobble
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifcaptionsetup@star}
+% \changes{v1.2a}{2008/01/12}{This macro added}
+% If the starred form of |\caption|\-|setup| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@set|\-|keys|.)
+% \begin{macrocode}
+\newif\ifcaptionsetup@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionsetup}
+% \changes{v1.0a}{2004/01/17}{Bugfix: Missing \% added}
+% \changes{v1.1}{2007/07/22}{Starred-variant added}
+% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v1.2a}{2008/01/12}{\cs{ifcaptionsetup@star} will be set now}
+% \changes{v1.5}{2012/04/09}{Support of multiple optional arguments added}
+% \changes{v1.8h}{2020/01/03}{Syntax check of saved options added}
+% |\captionsetup*|\oarg{type}\ldots\marg{keyval-list of options}\\
+% applies the given list of options.
+% If the optional argument `type' is specified, we simply save or append
+% the option list, otherwise we `execute' it with |\set|\-|keys|.
+% (The non-starred variant issues a warning if \meta{keyval-list of options}
+% is not used later on.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\captionsetup{%
+ \caption@teststar@\@captionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@captionsetup[1]{%
+ \captionsetup@startrue#1\captionsetup@starfalse
+ \@ifnextchar[%]
+ \caption@setup@options\caption@setup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup{\caption@setkeys{caption}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@setup@options[#1]{%
+ \@ifnextchar[%]
+ {\caption@stepthecounter
+ \caption@withoptargs{\@expandtwoargs
+ \caption@setup@options@i{#1}{@\caption@thecounter}}}%
+ {\caption@setup@options@{#1}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup@options@i[4]{%
+ \caption@declare@option{#2}[]{\captionsetup#3{#4}}%
+ \caption@setup@options@{#1}{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setup@options@[2]{%
+ \@bsphack
+ \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi
+ \caption@checkoptions{#2}%
+ \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checkoptions}
+% \changes{v1.8h}{2020/01/03}{This macro added}
+% |\caption@checkoptions|\marg{keyval-list of options}\\
+% checks the syntax of the given options by executing them inside a group.
+% \begin{macrocode}
+\newcommand*\caption@checkoptions[1]{%
+ \begingroup
+ \caption@prepare@optioncheck
+ \caption@setup{#1}%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@prepare@optioncheck{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\IfCaptionOptionCheck}
+% \changes{v1.10}{2020/05/10}{This macro added}
+% |\IfCaptionOptionCheck|\marg{yes-code}\marg{no-code}\\
+% executes the \meta{yes-code} if options are just checked for syntax,
+% and \meta{no-code} if not.
+% \begin{macrocode}
+\let\IfCaptionOptionCheck\@secondoftwo
+% \end{macrocode}
+% \begin{macrocode}
+\g@addto@macro\caption@prepare@optioncheck{%
+ \let\IfCaptionOptionCheck\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\clearcaptionsetup}
+% \changes{v1.1}{2007/07/29}{Optional argument added}
+% \changes{v1.1}{2007/08/17}{Starred variant added}
+% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\clearcaptionsetup*|\oarg{option}\marg{type}\\
+% removes the saved option list associated with \meta{type}.
+% If \meta{option} is given, only this option will be removed from the list.
+% (The starred variant does not issue warnings.)
+% \Note{The starred variant will be used inside packages automatically.}
+% \begin{macrocode}
+\newcommand*\clearcaptionsetup{%
+ \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\@clearcaptionsetup[1]{%
+ \let\caption@tempa#1%
+ \@testopt\@@clearcaptionsetup{}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@@clearcaptionsetup[#1]#2{%
+ \@bsphack
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}%
+ {\ifx,#1,%
+ \caption@clearsetup{#2}%
+ \else
+ \caption@@removefromsetup{#1}{#2}%
+ \fi}%
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@clearsetup[1]{%
+ \caption@removefromoptlist{#1}%
+ \@nameundef{caption@opt@#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromsetup{%
+ \let\caption@tempa\@gobble
+ \caption@@removefromsetup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@removefromsetup[2]{%
+ \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname
+ \expandafter\let\csname caption@opt@#2\endcsname\@undefined
+ \def\@tempb##1=##2\@nil{##1}%
+ \edef\@tempc{#1}%
+ \@for\@tempa:=\@tempa\do{%
+ \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}%
+ \ifx\@tempd\@tempc
+ \let\caption@tempa\@gobble
+ \else
+ \expandafter\expandafter\expandafter\caption@l@addto@list
+ \expandafter\csname caption@opt@#2\expandafter\endcsname
+ \expandafter{\@tempa}%
+ \fi}%
+ \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname
+ {\caption@removefromoptlist{#2}}{}%
+ \caption@tempa{\caption@Warning{%
+ Option `#1' was not in list `#2'}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\showcaptionsetup}
+% \changes{v1.0d}{2005/05/03}{Optimized for memory usage}
+% \changes{v1.1}{2007/07/29}{Bugfix: Does not expand option list anymore}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% |\showcaptionsetup|\oarg{package}\marg{type}\\
+% shows the saved option list which is associated with \meta{type}
+% (as warning message).
+% \begin{macrocode}
+\newcommand*\showcaptionsetup[2][\@firstofone]{%
+ \@bsphack
+ \GenericWarning{}{%
+ #1 Caption Info: Option list on `#2'\MessageBreak
+ #1 Caption Data: \@ifundefined{caption@opt@#2}{%
+ -none-%
+ }{%
+ {\expandafter\expandafter\expandafter\strip@prefix
+ \expandafter\meaning\csname caption@opt@#2\endcsname}%
+ }}%
+ \@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.1}{2007/07/02}{Option \opt{options=} added}
+% \changes{v1.3}{2010/09/05}{Option \opt{options*=} added}
+% \changes{v1.4b}{2012/01/12}{Option \opt{options*=} removed}
+% \begin{macrocode}
+\DeclareCaptionOption{options}{\caption@setoptions{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setoptions}
+% \changes{v1.0g}{2006/01/03}{Optional argument added}
+% \changes{v1.0h}{2006/01/26}{Revised}
+% \changes{v1.0j}{2007/01/30}{Optional argument removed}
+% \changes{v1.1}{2007/04/11}{Usage of \cs{clearcaptionsetup} added}
+% \changes{v1.1}{2007/05/09}{Renamed from \cs{caption@settype} to \cs{caption@setoptions}}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% \changes{v1.3}{2010/09/05}{Starred variant added}
+% \changes{v1.4b}{2012/01/12}{Starred variant removed}
+% |\caption@setoptions|\marg{type or environment or\ldots}\\
+% applies caption options which have been saved with |\caption|\-|setup|\oarg{type}.
+% To prevent multiple application the list will be cleared (locally) afterwards.
+% \begin{macrocode}
+\newcommand*\caption@setoptions[1]{%
+ \caption@Debug{options=#1}%
+ \expandafter\let\expandafter\caption@opt\csname caption@opt@#1\endcsname
+ \ifx\caption@opt\relax \else
+ \caption@xsetup\caption@opt
+ \caption@clearsetup{#1}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtooptlist}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \begin{macro}{\caption@removefromoptlist}
+% \changes{v1.1}{2007/07/22}{This macro added}
+% \changes{v1.2c}{2008/08/24}{Fatal typo corrected}
+% |\caption@addtooptlist|\marg{type}\\
+% |\caption@removefromoptlist|\marg{type}\\
+% adds or removes an \meta{type} to the list of unused caption options.
+% Note that the catcodes of \meta{type} are sanitized here so removing
+% \meta{type} from the list do not fail when the \package{float} package
+% is used (since |\float@getstyle| gives a result which tokens have catcode
+% 12 $=$ ``other'').
+% \begin{macrocode}
+\newcommand*\caption@addtooptlist[1]{%
+ \@ifundefined{caption@opt@#1@lineno}%
+ {\caption@dooptlist\caption@g@addto@list{#1}%
+ \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}}%
+ {}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@removefromoptlist[1]{%
+ \caption@dooptlist\caption@g@removefrom@list{#1}%
+ \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@dooptlist[2]{%
+ \begingroup
+ \edef\@tempa{#2}\@onelevel@sanitize\@tempa
+ \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}%
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\AtEndDocument{%
+ \caption@for@list\caption@optlist
+ {\caption@WarningNoLine{%
+ Unused \string\captionsetup[#1]
+ on input line \csname caption@opt@#1@lineno\endcsname}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@setkeys}
+% \changes{v1.0g}{2006/01/03}{This macro added}
+% \changes{v1.0j}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added}
+% \changes{v1.0j}{2007/01/30}{Optional argument added}
+% \changes{v1.0n}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter}
+% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed, we use \cs{caption@KV@err} instead}
+% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
+% \changes{v1.2a}{2008/01/12}{\cs{captionsetup@starfalse} added}
+% \changes{v1.2d}{2009/09/30}{Bugfix 09-09-29: Missing error handler will be defined automatically}
+% \changes{v1.4}{2011/08/24}{Redefinition of \cs{XKV@err} added}
+% |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\\
+% expands to |\setkeys|\marg{family}\marg{key-values},
+% but lets the error messages not refer to the \package{keyval} package
+% but to the \meta{package} package instead.
+% \begin{macrocode}
+\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@setkeys[#1]#2#3{%
+ \@bsphack
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err
+ \expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx
+ \expandafter\let\csname ORI@XKV@err\caption@keydepth\endcsname\XKV@err
+ \edef\caption@keydepth{\caption@keydepth i}%
+% \end{macrocode}
+% \begin{macrocode}
+ \expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname
+ \ifx\KV@err\relax
+ \def\KV@err##1{\PackageError{#1}{##1}{%
+ See the #1 package documentation for explanation.}}%
+ \fi
+ \def\KV@errx{\KV@err}%
+ \def\XKV@err{\let\@tempa\XKV@tkey\KV@err}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{\noexpand\setkeys{#2}{#3}}%
+ \setkeys{#2}{#3}%
+% \end{macrocode}
+% \begin{macrocode}
+ \edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}%
+ \expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname
+ \expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname
+ \expandafter\let\expandafter\XKV@err\csname ORI@XKV@err\caption@keydepth\endcsname
+% \end{macrocode}
+% \begin{macrocode}
+ \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \@esphack}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@keydepth\@empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ExecuteOptions}
+% \changes{v1.1}{2007/07/15}{This macro added}
+% \changes{v1.3}{2010/09/04}{Depends on package now}
+% |\caption@ExecuteOptions|\marg{package}\marg{key-value options}\\
+% applies the given options using the keyval interface, so we use this one
+% instead of |\Execute|\-|Options| offered by \LaTeXe.
+% \begin{macrocode}
+\newcommand*\caption@ExecuteOptions[2]{%
+ \expandafter\@expandtwoargs\csname caption@setkeys@#1\endcsname{#1}{#2}}%
+\@onlypreamble\caption@ExecuteOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ProcessOptions}
+% \changes{v1.0a}{2004/01/23}{Bugfix, see \purett{news:400D360C.9678329F@gmx.net} for details}
+% \changes{v1.0g}{2006/01/03}{Improvement, uses \cs{caption@setkeys} instead of \cs{setkeys}}
+% \changes{v1.0h}{2006/02/23}{Bugfix, now processes only those global options which have a default value}
+% \changes{v1.0j}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to \cs{caption@ProcessOptions} and moved from the package to the kernel}
+% \changes{v1.1}{2007/04/17}{Starred variant added}
+% |\caption@ProcessOptions*|\marg{package}\\
+% processes the given options using the keyval package, so we use this one
+% instead of |\Process|\-|Options| offered by \LaTeXe.
+% The starred variant does not process the global options.
+% (This code was taken from the \package{hyperref} package\cite{hyperref}
+% \version{6.74} and modified.)
+% \begin{macrocode}
+\newcommand*\caption@ProcessOptions{%
+ \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone}
+\@onlypreamble\caption@ProcessOptions
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@ProcessOptions[2]{%
+ \let\@tempc\relax
+ \let\caption@tempa\@empty
+ #1{% \@firstofone -or- \@gobble
+ \@for\CurrentOption:=\@classoptionslist\do{%
+ \@ifundefined{KV@#2@\CurrentOption}{}{%
+ \@ifundefined{KV@#2@\CurrentOption @default}{%
+ \PackageInfo{#2}{Global option `\CurrentOption' ignored}%
+ }{%
+ \PackageInfo{#2}{Global option `\CurrentOption' processed}%
+ \edef\caption@tempa{\caption@tempa\CurrentOption,}%
+ \@expandtwoargs\@removeelement\CurrentOption
+ \@unusedoptionlist\@unusedoptionlist
+ }%
+ }%
+ }%
+ \let\CurrentOption\@empty
+ }%
+ \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}%
+ \AtEndOfPackage{\let\@unprocessedoptions\relax}}
+\@onlypreamble\caption@@ProcessOptions
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@SetupOptions}
+% \changes{v1.3}{2010/09/04}{This macro added}
+% |\caption@SetupOptions|\marg{package}\marg{code}\\
+% After application of this command |\caption@Execute|\-|Options| and
+% |\use|\-|package| will both be mapped to \meta{code} with \meta{package}
+% and \meta{options} as arguments |#1| and |#2|.
+% (This helps avoiding ``Option clash'' errors.)
+% \begin{macrocode}
+\newcommand\caption@SetupOptions[2]{%
+ \@namedef{caption@setkeys@#1}##1##2{#2}%
+ \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname
+ \@cons\caption@SetupOptions@list{{#1}}}
+\@onlypreamble\caption@SetupOptions
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@SetupOptions@list{}
+\@onlypreamble\caption@SetupOptions@list
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@onefilewithoptions\@onefilewithoptions
+\def\@onefilewithoptions#1[#2]{%
+ \begingroup
+ \def\@tempa{%
+ \endgroup
+ \caption@onefilewithoptions{#1}[{#2}]}%
+ \def\@tempb{#1}%
+ \def\@elt##1{%
+ \def\@tempc{##1}%
+ \ifx\@tempb\@tempc
+ \def\@tempa{%
+ \endgroup
+ \caption@ExecuteOptions{#1}{#2}%
+ \caption@onefilewithoptions{#1}[]}%
+ \fi}
+ \caption@SetupOptions@list
+ \@tempa}
+\@onlypreamble\caption@onefilewithoptions
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Declaring and setting key values}
+%
+% \begin{macro}{\caption@decl}
+% \changes{v2.0}{2019/09/10}{This macro added}
+% |\caption@decl|\oarg{command}\marg{option}\marg{name}\\
+% is used for declaring boxes, fonts, formats etc.
+% (It defines |\caption@|\meta{option}|@|\meta{name}
+% using the given \meta{command}.)
+% \begin{macrocode}
+\newcommand*\caption@decl[3][\def]{%
+ \global\long\expandafter#1\csname caption@#2@#3\endcsname}
+\@onlypreamble\caption@decl
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifdecl}
+% \changes{v2.0}{2019/09/10}{This macro added}
+% |\caption@ifdecl|\marg{option}\marg{name}\marg{yes-code}\marg{no-code}\\
+% checks if the given \meta{option} and \meta{name} combination is
+% already declared.
+% \begin{macrocode}
+\newcommand*\caption@ifdecl[2]{%
+ \@ifundefined{caption@#1@#2}\@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@checkdecl}
+% \changes{v2.0}{2019/09/10}{This macro added}
+% |\caption@checkdecl|\marg{option}\marg{name}\marg{yes-code}\\
+% behaves similar to |\caption@if|\-|decl| but issues an error message if the
+% given \meta{option} plus \meta{name} is not defined.
+% \begin{macrocode}
+\newcommand*\caption@checkdecl[2]{%
+ \caption@ifdecl{#1}{#2}%
+ \@firstofone
+ {\caption@Error{Undefined #1 `#2'}%
+ \@gobble}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@set}
+% \changes{v2.0}{2019/09/10}{This macro added}
+% \changes{v2.0}{2020/07/26}{Uses \cs{def} instead of \cs{let} internally}
+% |\caption@set|\marg{option}\marg{name}\\
+% sets the declared \meta{option} to \meta{name}, for example
+% |label|\-|format| to |simple|.
+% Note that since version \version{2.0} future changes to \meta{name}
+% (via |\caption@decl|) will effect the outcome,
+% for example |\caption@decl{labelformat}{simple}\ldots| will not only change
+% the definition of the label format |simple| but also effect the current
+% label format if set to |simple| (via |\caption@set|).
+% \begin{macrocode}
+\newcommand*\caption@set{%
+ \caption@maparg\caption@@set}%
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@set[3]{%
+ \caption@checkdecl{#1}{#3}{%
+% \expandafter\edef\csname caption@@#2\endcsname{#3}% could be used for debugging
+ \expandafter\def\csname caption@#2\expandafter\endcsname\expandafter{\csname caption@#1@#3\endcsname}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SetCaptionDefault}
+% \changes{v2.0}{2019/09/10}{This macro added}
+% \changes{v2.0}{2020/07/28}{Check for `default' added to prevent infinite loop}
+% |\SetCaptionDefault*|\marg{option}\marg{name}\\
+% sets the default value for the \meta{option}.
+% The starred variant is only relevant for setting default values for lengths
+% like |margin|. (See definition of |\caption@set|\-|default@length| for
+% details.)
+% \begin{macrocode}
+\newcommand*\SetCaptionDefault{%
+ \caption@teststar\caption@setdefault\def\edef}
+\@onlypreamble\SetCaptionDefault
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setdefault[2]{%
+ \@ifundefined{caption@setdefault@#2}%
+ {\caption@maparg\caption@@setdefault}%
+ {\@nameuse{caption@setdefault@#2}{#1}}%
+ {#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setdefault[3]{%
+ \caption@ifdefault{#3}%
+ {\caption@Error{Invalid argument for \string\SetCaptionDefault: `#3'}}% would cause an infinite loop otherwise
+ {\caption@@set{#1}{#2@default}{#3}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifdefault}
+% \changes{v2.0}{2020/08/23}{This macro added}
+% |\caption@ifdefault|\marg{value}\marg{yes-code}\marg{no-code}\\
+% expands to \meta{yes-code} if the \meta{value} expands to `default',
+% and to \meta{no-code} otherwise.
+% \begin{macrocode}
+\newcommand*\caption@ifdefault{\caption@ifequal{default}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifequal[2]{%
+ \edef\caption@tempa{#1}%
+ \edef\caption@tempb{#2}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setmapping}
+% \changes{v2.0}{2020/08/23}{This macro added}
+% |\caption@setmapping|\marg{source option}\marg{destination option}\\
+% sets a mapping from the \meta{source option} to the
+% \meta{destination option}, for example |label|\-|font| to |font|
+% since |label|\-|font| does not have any own definitions but shares
+% them with |font|.
+% \begin{macrocode}
+\newcommand*\caption@setmapping[2]{%
+ \@namedef{caption@map@#1}{#2}}
+\@onlypreamble\caption@setmapping
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@maparg}
+% \changes{v2.0}{2020/08/23}{This macro added}
+% |\caption@maparg|\marg{command}\marg{option}\\
+% similar to |\@dblarg| but either duplicates the given \meta{option} or
+% expands it to \meta{destination option} plus \meta{option} if a mapping
+% was defined for the given option (via |\caption@set|\-|mapping|).
+% \begin{macrocode}
+\newcommand*\caption@maparg[2]{%
+ \@ifundefined{caption@map@#2}%
+ {#1{#2}}%
+ {#1{\csname caption@map@#2\endcsname}}%
+ {#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@switchdefault}
+% \changes{v2.0}{2020/08/01}{This macro added}
+% |\caption@switchdefault\marg{option}|\marg{code with \#1}\marg{name}\\
+% like |\Set|\-|Caption|\-|Default| but first expands the given code with the
+% to-be-overwritten internal command as argument, so it can be stored (and
+% restored later on).
+% The main purpose of this command is switching default settings in
+% \package{babel} language packages, e.g.:
+% \begin{quote}|\caption@switchdefault{labelfont}{\babel@save #1}{sc}|\end{quote}
+% \begin{macrocode}
+\def\caption@switchdefault#1#2{%
+ \def\caption@tempa##1{#2}%
+ \expandafter\caption@tempa\csname caption@#1@default\endcsname
+ \caption@setdefault\def{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@restoredefault}
+% \changes{v2.0}{2020/08/01}{This macro added}
+% |\caption@restoredefault\marg{option}|\marg{command}\\
+% restores a default setting which was stored to \meta{command} before
+% (via |\caption@switch|\-|default|).
+% \begin{macrocode}
+\def\caption@restoredefault#1#2{%
+ \caption@checkdecl{#1}{default}{%
+ \caption@ifdefined#2{%
+ \expandafter\let\csname caption@#1@default\endcsname#2%
+ \let#2\@undefined}{}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SetCaptionFallback}
+% \changes{v2.2}{2020/09/21}{This macro added}
+% |\SetCaptionFallback|\marg{option}\marg{name}\\
+% sets the fallback value for the \meta{option}.
+% \begin{macrocode}
+\newcommand*\SetCaptionFallback{%
+ \caption@maparg\caption@@setfallback}
+\@onlypreamble\SetCaptionFallback
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setfallback[3]{%
+ \caption@ifequal{fallback}{#3}%
+ {\caption@Error{Invalid argument for \string\SetCaptionFallback: `#3'}}% would cause an infinite loop otherwise
+ {\caption@@set{#1}{#2@fallback}{#3}}}
+\@onlypreamble\caption@@setfallback
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@decl@package}
+% \changes{v2.0}{2020/07/26}{This macro added}
+% |\caption@decl@package|\marg{option}\marg{cmd}\oarg{package}\marg{name}\ldots\\
+% Helper command to declare a caption package option value which is dependent
+% on the existence of a specific package, for example the |font| value
+% |one|\-|half|\-|spacing| which is dependent on the \package{setspace}
+% package.
+% \begin{macrocode}
+\newcommand*\caption@decl@package[2]{%
+ \@ifnextchar[%]
+ {\caption@declare@package{#1}{#2}}%
+ {\caption@declarepackage{#1}{#2}}}
+\@onlypreamble\caption@decl@package
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@declare@package#1#2[#3]#4{%
+ \global\@namedef{caption@#1@#4@package}{#3}%
+ #2{#4}}
+\@onlypreamble\caption@declare@package
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declarepackage[3]{%
+ \global\@nameundef{caption@#1@#3@package}%
+ #2{#3}}
+\@onlypreamble\caption@declarepackage
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@load@package}
+% \changes{v2.0}{2020/07/26}{This macro added}
+% |\caption@load@package|\marg{option}\marg{value}\\
+% If the given option value needs a package, it will be loaded automatically.
+% \begin{macrocode}
+\newcommand*\caption@load@package[2]{%
+ \expandafter\let\expandafter\caption@tempa\csname caption@#1@#2@package\endcsname
+ \caption@ifdefined\caption@tempa
+ {\caption@requirepackage\caption@tempa{#1=#2}}%
+ {}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Declaring and setting lengths}
+%
+% \begin{macro}{\DeclareCaptionLength}
+% \changes{v2.0}{2020/08/09}{This macro added}
+% |\DeclareCaptionLength|\marg{name}\marg{default value}\\
+% \begin{enumerate}
+% \item Defines a new length (dimension)
+% \item Installes a hook for |\caption@set|\-|default| so
+% |\caption@set|\-|default@length| will be used to set a default
+% value for this length
+% \item Sets a default value using |\Set|\-|Caption|\-|Default*|.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionLength[1]{%
+ \expandafter\newdimen\csname caption#1\endcsname
+ \@namedef{caption@setdefault@#1}##1{%
+ \caption@setdefault@length{##1}}%
+ \SetCaptionDefault*{#1}}
+\@onlypreamble\DeclareCaptionLength
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setdefault@length}
+% \changes{v2.0}{2020/08/09}{This macro added}
+% |\caption@setdefault@length*|\marg{cmd}\marg{name}\marg{value}\\
+% sets a default value for the given \meta{length}, either using |\def|
+% (if the starred variant is used) or |\edef| (if the non-starred variant is
+% used).
+% \begin{macrocode}
+\newcommand*\caption@setdefault@length[3]{%
+ \expandafter#1\csname caption#2@default\endcsname{#3}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setlength}
+% \changes{v2.0}{2020/08/09}{This macro added}
+% |\caption@setlength|\marg{name}\marg{value}\\
+% sets a length to either the given \meta{value} or to the default value if
+% \meta{value} is `default'.
+% \begin{macrocode}
+\newcommand*\caption@setlength[2]{%
+ \caption@ifdefault{#2}%
+ {\expandafter\let\expandafter\caption@tempa\csname caption#1@default\endcsname}%
+ {\def\caption@tempa{#2}}%
+ \expandafter\setlength\csname caption#1\endcsname\caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Margin resp. width}
+% \changes{v1.0n}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}}
+% \changes{v1.0n}{2007/04/03}{Option `twoside' added}
+% \changes{v1.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added}
+% \changes{v1.2}{2007/11/10}{Option `oneside' added}
+%
+% \begin{macro}{\captionmargin}
+% \begin{macro}{\captionwidth}
+% |\captionmargin| and |\captionwidth| contain the extra margin
+% resp. the total width used for captions. Please never set these values in
+% a direct way, they are just accessible in user documents to provide
+% compatibility to \version{1.x} of the \package{caption} package.\par
+% Note that we can only set one value at a time, `margin' \emph{or} `width'.
+% If |\caption|\-|width| is not zero we will take this value afterwards,
+% otherwise |\caption|\-|margin| and |\caption|\-|margin@|.
+% \begin{macrocode}
+\DeclareCaptionLength{margin}{0pt}
+\DeclareCaptionLength{margin@}{\the\captionmargin}
+\DeclareCaptionLength{width}{0pt}
+\newdimen\caption@tempdima
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
+\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}}
+\DeclareCaptionOption{width}{\setcaptionwidth{#1}}
+\DeclareCaptionOption{width*}{\setcaptionwidth*{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{calcmargin}{\caption@setcalcmargin{#1}}
+\DeclareCaptionOption{calcmargin*}{\caption@setcalcmargin*{#1}}
+\DeclareCaptionOption{calcwidth}{\caption@setcalcwidth{#1}}
+\DeclareCaptionOption{calcwidth*}{\caption@setcalcwidth*{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}}
+\DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0}
+\caption@set@bool\caption@iftwoside{\if@twoside 1\else 0\fi}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}}
+\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\setcaptionmargin}
+% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
+% \changes{v1.0f}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take left+right margin}
+% \changes{v1.1}{2007/08/11}{Starred variant added}
+% \changes{v1.1}{2007/08/12}{\cs{setlength}\cs{captionmargin} \& \cs{setlength}\cs{captionmargin@} swapped so `\texttt{margin*=}\cs{captionmargin}' works in singleline options}
+% \changes{v1.3}{2010/11/07}{Support for option \opt{calcmargin} added}
+% |\setcaptionmargin*|\marg{amount}\\
+% sets the caption margin to the given \meta{amount}.
+% Please never use this in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionmargin{%
+ \caption@resetcalcmargin
+ \caption@setmargin}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setmargin{%
+ \caption@teststar\caption@@setmargin\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setmargin[2]{%
+ #1{\captionwidth\z@}%
+ \caption@@@setmargin#2,#2,\@nil}
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@setmargin#1,#2,#3\@nil{%
+ \caption@setlength{margin}{#1}%
+ \caption@setlength{margin@}{#2}%
+ \addtolength\captionmargin@{-\captionmargin}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setcaptionwidth}
+% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
+% \changes{v1.3}{2010/11/07}{Starred variant added}
+% \changes{v1.3}{2010/11/07}{Support for option \opt{calcwidth} added}
+% |\setcaptionwidth*|\marg{amount}\\
+% sets the caption width to the given \meta{amount}.
+% Please never use this in user documents, it's just there to
+% provide compatibility to the \package{caption2} package.
+% \begin{macrocode}
+\newcommand*\setcaptionwidth{%
+ \caption@resetcalcmargin
+ \caption@setwidth}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@setwidth{%
+ \caption@teststar\caption@@setwidth\@gobble\@firstofone}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setwidth[2]{%
+ #1{\captionmargin\z@\captionmargin@\z@}%
+ \caption@setlength{width}{#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setcalcmargin}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% |\caption@setcalcmargin*|\marg{amount}\\
+% sets the caption margin to the given \meta{amount}
+% right before the caption will be typeset, i.e.\meta{amount} will
+% not be evaluated immediately.
+% \begin{macrocode}
+\newcommand*\caption@setcalcmargin{%
+ \caption@teststar{\caption@@setcalcmargin\caption@setmargin}%
+ \@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setcalcmargin[3]{%
+ #2{\caption@resetcalcmargin
+ \l@addto@macro\caption@calcmargin@hook{#1{#3}}}%
+ {\l@addto@macro\caption@calcmargin@hook{#1*{#3}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetcalcmargin}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% |\caption@resetcalcmargin|\\
+% clears the value which was stored in |\caption@set|\-|calc|\-|margin|.
+% \begin{macrocode}
+\newcommand*\caption@resetcalcmargin{%
+ \let\caption@calcmargin@hook\@empty}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setcalcwidth}
+% \changes{v1.3}{2010/11/07}{This macro added}
+% |\caption@setcalcwidth*|\marg{amount}\\
+% sets the caption width to the given \meta{amount}
+% right before the caption will be typeset, i.e.\meta{amount} will
+% not be evaluated immediately.
+% \begin{macrocode}
+\newcommand*\caption@setcalcwidth{%
+ \caption@teststar{\caption@@setcalcmargin\caption@setwidth}%
+ \@secondoftwo\@firstoftwo}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@thecounter}
+% \changes{v1.0n}{2007/04/03}{This counter added}
+% \changes{v1.1e}{2007/10/28}{Renamed from \cs{caption@counter} to \cs{caption@thecounter}; \cs{caption@stepcounter} added}
+% \changes{v1.5}{2012/04/09}{\cs{caption@stepcounter} renamed to \cs{caption@stepthecounter}}
+% Internal counter.
+% At the moment it will be used inside |\caption@if|\-|odd|\-|page| only.
+% \begin{macrocode}
+\newcommand*\caption@thecounter{0}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@stepthecounter{%
+ \@tempcnta\caption@thecounter
+ \advance\@tempcnta\@ne\relax
+ \xdef\caption@thecounter{\the\@tempcnta}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@newlabel}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% |\caption@newlabel|\marg{name}\marg{value}\\
+% This command is a modified version of |\new|\-|label| from \LaTeX2e.
+% It will be written to the \texttt{.aux} file to
+% pass label information from one run to another.
+% (We use it inside |\caption@if|\-|odd|\-|page|.)
+% \begin{macrocode}
+\newcommand*\caption@newlabel{\@newl@bel{caption@r}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@thepage}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% This command is a modified version of |\the|\-|page| from \LaTeX2e.
+% It will be used inside |\caption@if|\-|odd|\-|page| only.
+% \begin{macrocode}
+\newcommand*\caption@thepage{\the\c@page}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@label}
+% \changes{v1.1}{2007/09/01}{This macro added}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@newlabel} in aux file added}
+% |\caption@label|\marg{name}\\
+% This command is a modified version of |\label| from \LaTeX2e.
+% It will be used inside |\caption@if|\-|odd|\-|page| and |\FP@help|\-|Note|.
+% \begin{macrocode}
+\newcommand*\caption@label[1]{%
+ \caption@@label
+ \protected@write\@auxout{\let\caption@thepage\relax}%
+ {\string\caption@newlabel{#1}{\caption@thepage}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@label{%
+ \global\let\caption@@label\relax
+ \protected@write\@auxout{}%
+ {\string\providecommand*\string\caption@newlabel[2]{}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@pageref}
+% \changes{v1.1}{2007/09/01}{This macro added}
+% \changes{v1.2d}{2009/10/09}{Uses \cs{@latex@warning} instead of \cs{caption@Warning} now}
+% |\caption@pageref|\marg{name}\\
+% This command is a modified version of |\page|\-|ref| from \LaTeX2e.
+% It will be used inside |\caption@if|\-|odd|\-|page| and |\FP@help|\-|Note|.
+% \begin{macrocode}
+\newcommand*\caption@pageref[1]{%
+ \expandafter\ifx\csname caption@r@#1\endcsname\relax
+ \G@refundefinedtrue % => 'There are undefined references.'
+ \@latex@warning{Reference `#1' on page \thepage \space undefined}%
+ \else
+ \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifoddpage}
+% \changes{v1.0n}{2007/04/03}{This macro added}
+% \changes{v1.1e}{2007/10/28}{Incrementation of counter moved to \cs{caption@@make}}
+% Currently this macro uses an own label\ldots ref mechanism,
+% but an alternative implementation method would use the
+% \package{refcount} package\cite{refcount} and
+% |\ifodd\get|\-|page|\-|ref|\-|number{|\ldots|}|.
+% Maybe we will change that in a later release.
+% \Note{This macro re-defines itself so the \texttt{.aux} file will
+% only be used once per group.}
+% \begin{macrocode}
+\newcommand*\caption@ifoddpage{%
+ \caption@iftwoside{%
+ \caption@label\caption@thecounter
+ \caption@pageref\caption@thecounter
+ \ifodd\caption@thepage
+ \let\caption@ifoddpage\@firstoftwo
+ \else
+ \let\caption@ifoddpage\@secondoftwo
+ \fi
+ }{\let\caption@ifoddpage\@firstoftwo}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@ifoddpage}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setoptcmd}
+% \changes{v1.1}{2007/08/11}{This macro added}
+% |\caption@setoptcmd|\marg{command}\marg{off -or- value}\\
+% defines the given \meta{command} to \meta{value},
+% but if \meta{value} if `off' the given \meta{command} is undefined instead.
+% \begin{macrocode}
+\newcommand*\caption@setoptcmd[2]{%
+ \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Indentions}
+%
+% \begin{macro}{\caption@indent}
+% \changes{v1.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}}
+% \begin{macro}{\caption@parindent}
+% \begin{macro}{\caption@hangindent}
+% These are the indentions we support.
+% \begin{macrocode}
+\DeclareCaptionLength{@indent}{0pt}
+\DeclareCaptionLength{@parindent}{0pt}
+\DeclareCaptionLength{@hangindent}{0pt}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v1.0b}{2004/05/16}{Defaults added for options \opt{parindent=} and \opt{hangindent=}}
+% \changes{v1.0f}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption} replaced by \cs{caption@@par}}
+% \changes{v1.0f}{2005/08/22}{Undocumented defaults for \opt{parindent=}, \opt{hangindent=}, and \opt{parskip=} removed}
+% \begin{macrocode}
+\DeclareCaptionOption{indent}[\leftmargini]{% obsolete
+ \caption@setlength{@indent}{#1}}
+\DeclareCaptionOption{indention}[\leftmargini]{%
+ \caption@setlength{@indent}{#1}}
+\DeclareCaptionOption{parindent}{%
+ \caption@setlength{@parindent}{#1}}
+\DeclareCaptionOption{hangindent}{%
+ \caption@setlength{@hangindent}{#1}}
+\DeclareCaptionOption{parskip}{%
+ \l@addto@macro\caption@@par{\setlength\parskip{#1}}}
+% \end{macrocode}
+%
+% \section{Styles}
+%
+% \begin{macro}{\DeclareCaptionStyle}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
+% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now}
+% \changes{v2.0}{2020/07/27}{\cs{caption@sls} renamed to \cs{caption@slsty}}
+% |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionStyle[1]{%
+ \@testopt{\caption@declarestyle{#1}}{}}
+\@onlypreamble\DeclareCaptionStyle
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@declarestyle#1[#2]#3{%
+ \caption@decl{style}{#1}%
+ {\def\caption@slsty{#2}%
+ \def\caption@sty{#3}}%
+% \end{macrocode}
+% The \package{floatrow} package uses |\@if|\-|undefined{caption@sty@#1}| to
+% determine in |\flrow@set|\-|style| if a caption style is defined or not.
+% Since the \package{floatrow} package is unmaintained we fake the definition
+% so the test will still work.
+% \begin{macrocode}
+ \@namedef{caption@sty@#1}{\@unused}}
+\@onlypreamble\caption@declarestyle
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2a}{2008/01/20}{Option \opt{style*=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{style}{\caption@setstyle{#1}}
+\DeclareCaptionOption{style*}{\caption@setstyle*{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setstyle}
+% \changes{v1.0e}{2005/06/01}{Starred variant added}
+% \changes{v1.1}{2007/07/29}{Recursive style definitions should work now}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed}
+% \changes{v2.0}{2019/09/10}{Uses \cs{caption@ifdecl} and \cs{caption@checkdecl} now}
+% |\caption@setstyle*|\marg{name}\\
+% Selecting a caption style means saving the additional
+% \meta{single-line-list-of-KV} (this will be done by |\caption@sl|\-|sty|),
+% resetting the caption options to the base ones (this will be done using
+% |\caption@reset|\-|style|) and executing the \meta{list-of-KV} options
+% (this will be done using |\caption@setup|).\par
+% The starred version will give no error message if the given style is not
+% defined.
+% \begin{macrocode}
+\newcommand*\caption@setstyle{%
+ \caption@teststar\caption@@setstyle\caption@ifdecl\caption@checkdecl}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setstyle[2]{%
+ #1{style}{#2}%
+ {\caption@set{style}{#2}%
+ \caption@style % defines \caption@sty & \caption@slsty
+ \ifx\caption@setstyle@flag\@undefined
+ \let\caption@setstyle@flag\relax % prevent \caption@resetstyle if called recursively
+ \caption@resetstyle
+ \caption@xsetup\caption@sty
+ \let\caption@setstyle@flag\@undefined
+ \else
+ \caption@xsetup\caption@sty
+ \fi}%
+ {}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@resetstyle}
+% \changes{v1.1}{2007/02/04}{This macro renamed from \cs{caption@setdefault} to \cs{caption@resetstyle}}
+% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency}
+% \changes{v1.2}{2007/11/17}{Usage of \opt{size=} added}
+% \changes{v1.2b}{2008/05/06}{Usage of \opt{rule} added}
+% \changes{v1.5}{2012/03/15}{\opt{box=parbox} added}
+% \changes{v1.6}{2013/05/01}{\opt{box=none} added, \opt{box=parbox} changed to \opt{parbox=parbox}}
+% |\caption@resetstyle|\\
+% This resets (nearly) all caption options to the base ones.
+% \emph{Note that this does not touch the skips and the positioning.}
+% \begin{macrocode}
+\newcommand*\caption@resetstyle{%
+ \caption@setup{%
+ box=none,boxcolor=white,parbox=parbox,%
+ format=plain,labelformat=default,labelsep=colon,textformat=simple,%
+ font=,labelfont=,textfont=,size=,%
+ justification=justified,slc,rule,strut,%
+ margin=0pt,minmargin=0,maxmargin=0,%
+ indent=0pt,parindent=0pt,hangindent=0pt}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
+% \changes{v1.1}{2007/02/04}{Caption style `default' renamed to `base', and a new `default' added}
+% \changes{v1.1}{2007/03/31}{\opt{format=plain} added to caption style \opt{default}}
+% \changes{v1.1c}{2007/10/14}{\opt{format=plain} removed from caption style \opt{default}}
+% \changes{v1.5}{2012/03/15}{\opt{box=default} added to caption style \opt{default}}
+% Currently there are two pre-defined styles, called `base' \& `default'.
+% The first one is a perfect match to the behavior of |\@make|\-|caption|
+% offered by the standard \LaTeX\ document classes (and was called `default'
+% in \thispackage\ \version{1.0}), the second one matches the document
+% class actually used.
+% \begin{macrocode}
+\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{}
+\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{%
+ box=default,%
+ format=default,labelformat=default,labelsep=default,textformat=default,%
+ font=default,labelfont=default,textfont=default,size=default,%
+ justification=default,slc=default,margin=default,%
+ indent=default,parindent=default,hangindent=default}
+% \end{macrocode}
+%
+% \begin{macro}{\DeclareCaptionSinglelinecheck}
+% \changes{v2.0}{2019/09/10}{This macro added}
+% |\DeclareCaptionSinglelinecheck|\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionSinglelinecheck[2]{%
+ \caption@decl{singlelinecheck}{#1}{#2}}
+\@onlypreamble\DeclareCaptionSinglelinecheck
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2b}{2008/05/06}{Option \opt{slc=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{singlelinecheck}[1]{\caption@setsinglelinecheck{#1}}
+\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}}
+% \end{macrocode}
+%
+% These are the pre-defined single-line-check code snippets.
+% \begin{macrocode}
+\DeclareCaptionSinglelinecheck{on}{\@firstoftwo}
+\DeclareCaptionSinglelinecheck{off}{\@secondoftwo}
+% \end{macrocode}
+%
+% `default' usually maps to `on'.
+% \begin{macrocode}
+\SetCaptionDefault{singlelinecheck}{on}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setsinglelinecheck}
+% \changes{v2.0}{2018/03/13}{This macro added}
+% |\caption@setsinglelinecheck|\marg{value}\\
+% sets the single-line-check either on or off,
+% where \meta{value} could be either a \meta{name} or boolean value.
+% \begin{macrocode}
+\newcommand*\caption@setsinglelinecheck[1]{%
+ \caption@ifdecl{singlelinecheck}{#1}%
+ {\caption@set{singlelinecheck}{#1}}%
+ {\caption@set@bool\caption@singlelinecheck{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Boxes}
+%
+% \begin{macro}{\DeclareCaptionBox}
+% \changes{v1.5}{2012/03/15}{This macro added}
+% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now}
+% \changes{v2.2f}{2020/10/26}{\cs{par} is now allowed as part of the \meta{code} argument}
+% |\DeclareCaptionBox|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand\DeclareCaptionBox[2]{%
+ \caption@decl{box}{#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionBox
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.5}{2012/03/15}{Option \opt{box=} added}
+% \changes{v1.6}{2013/05/01}{Option \opt{parbox=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{box}{\caption@set{box}{#1}}
+\DeclareCaptionOption{parbox}{\caption@set{parbox}{#1}}
+\caption@setmapping{parbox}{box}
+% \end{macrocode}
+%
+% There are four pre-defined boxes, called `empty', `none',
+% `parbox', and `colorbox'.
+% \changes{v1.0i}{2006/05/13}{We define \cs{captionbox} instead of \cs{caption@start/endbox}}
+% \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{captionbox} changed from \cs{parbox-t} to \cs{parbox-b}}
+% \changes{v1.2}{2007/11/11}{\cs{captionbox} renamed to \cs{caption@parbox}}
+% \changes{v1.5}{2012/03/15}{\cs{caption@parbox} adapted to \cs{DeclareCaptionBox}}
+% \changes{v1.6}{2013/05/02}{Option \opt{boxsep=} added}
+% \changes{v2.1b}{2020/09/17}{Missing braces re-added to \opt{colorbox} option code}
+% \begin{macrocode}
+\DeclareCaptionBox{empty}{}
+\DeclareCaptionBox{none}{#2}
+\DeclareCaptionBox{parbox}{\parbox[b]{#1}{#2}}
+\DeclareCaptionBox{colorbox}{%
+ \colorbox{\caption@boxcolor}{%
+ \setlength\caption@tempdima{#1}%
+ \addtolength\caption@tempdima{-2\fboxsep}%
+ \linewidth\caption@tempdima\relax
+ \hsize\caption@tempdima\relax
+ #2}}
+\DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}}
+\DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}}
+% \end{macrocode}
+%
+% `default' usually maps to `none' resp.~`parbox'.
+% \begin{macrocode}
+\SetCaptionDefault{box}{none}
+%\SetCaptionDefault{parbox}{parbox}
+% \end{macrocode}
+%
+% \section{Formats}
+%
+% \begin{macro}{\DeclareCaptionFormat}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
+% \changes{v1.0c}{2005/02/09}{Starred variant added}
+% \changes{v1.1c}{2007/10/15}{Optional argument added}
+% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now}
+% \changes{v2.0}{2020/07/27}{\cs{caption@ifh} renamed to \cs{caption@ifhmode}}
+% |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\\
+% The starred form causes the code being typeset in vertical (instead of
+% horizontal) mode, but does not support the |indention=| option.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFormat{%
+ \caption@teststar\caption@declareformat\@gobble\@firstofone}
+\@onlypreamble\DeclareCaptionFormat
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declareformat[2]{%
+ \@dblarg{\caption@@declareformat#1{#2}}}
+\@onlypreamble\caption@declareformat
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@declareformat#1#2[#3]#4{%
+ \caption@decl[\edef]{format}{#2}{%
+ \unexpanded{\let\caption@ifhmode#1}%
+ \unexpanded{\long\def\caption@slfmt}####1####2####3\unexpanded{{#3}}%
+ \unexpanded{\long\def\caption@fmt}####1####2####3\unexpanded{{#4}}}}
+\@onlypreamble\caption@@declareformat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@useformat}
+% \changes{v2.0}{2020/07/31}{This macro added}
+% |\caption@useformat|\marg{name}\\
+% expands |\caption@fmt| based on the given format \meta{name}.
+% \begin{macrocode}
+\newcommand*\caption@useformat[1]{% used by caption-koma.sto
+ \caption@checkdecl{format}{#1}{%
+ \begingroup
+ \@nameuse{caption@format@#1}\global\let\caption@tempa\caption@fmt
+ \endgroup\caption@tempa}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{format}{\caption@set{format}{#1}}
+% \end{macrocode}
+%
+% \changes{v1.0a}{2004/01/23}{Caption format \opt{default} renamed to \opt{normal}}
+% \changes{v1.0e}{2005/05/12}{Caption format \opt{normal} renamed to \opt{@normal}}
+% \changes{v1.0f}{2005/08/25}{Caption format \opt{@normal} renamed to \opt{plain} and documented}
+% \changes{v1.1c}{2007/10/14}{Single-line variant of caption format \opt{hang} added}
+% There are two pre-defined formats, called `plain' and `hang'.
+% \begin{macrocode}
+\DeclareCaptionFormat{plain}{#1#2#3\par}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionFormat{hang}[#1#2#3\par]{%
+ \caption@iflabelseparatorwithnewline
+ {\caption@Error{%
+ The option `labelsep=\caption@labelsep@name' does not work\MessageBreak
+ with `format=hang'}}%
+ {\@hangfrom{#1#2}%
+ \advance\caption@parindent\hangindent\relax
+ \advance\caption@hangindent\hangindent\relax
+ \caption@@par#3\par}}
+% \end{macrocode}
+%
+% `default' usually maps to `plain'.
+% \begin{macrocode}
+\SetCaptionDefault{format}{plain}
+% \end{macrocode}
+%
+% \section{Label formats}
+%
+% \begin{macro}{\DeclareCaptionLabelFormat}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
+% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now}
+% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionLabelFormat[2]{%
+ \caption@decl{labelformat}{#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionLabelFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelformat}{\caption@set{labelformat}{#1}}
+% \end{macrocode}
+%
+% \changes{v1.2}{2007/12/16}{Caption label format \opt{brace} added}
+% \changes{v1.7}{2015/09/16}{Caption label format \opt{autodot} added}
+% \changes{v1.7}{2016/05/22}{Caption label format \opt{autodot} fixed}
+% \changes{v1.8}{2016/05/22}{Caption label format \opt{unnumbered} added}
+% There are six pre-defined label formats, called `empty', `simple',
+% `parens', `brace', `autodot', and `unnumbered'.
+%
+% \begin{macrocode}
+\DeclareCaptionLabelFormat{empty}{}
+\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
+\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
+\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)}
+\DeclareCaptionLabelFormat{autodot}{\bothIfFirst{#1}{\nobreakspace}#2\autodot}
+\DeclareCaptionLabelFormat{unnumbered}{#1}
+% \end{macrocode}
+%
+% \changes{v2.0}{2020/08/03}{Caption label format \opt{original} added}
+% The label format `original' tries to preserve the original definition
+% of the label format which was defined by |\fnum@|\meta{environment}.
+% If no original definition is available, use the label format `simple'
+% as fallback.
+%
+% \begin{macrocode}
+\DeclareCaptionLabelFormat{original}{%
+ \caption@ifdefined\caption@original@fnum
+ {\caption@original@fnum}%
+ {\caption@labelformat@fallback{#1}{#2}}}
+% \end{macrocode}
+%
+% `default' usually maps to `original' resp. `simple'.
+% \begin{macrocode}
+\SetCaptionDefault{labelformat}{original}
+\SetCaptionFallback{labelformat}{simple}
+% \end{macrocode}
+%
+% \section{Label separators}
+%
+% \begin{macro}{\DeclareCaptionLabelSeparator}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
+% \changes{v1.0f}{2005/08/25}{Starred variant added}
+% \changes{v1.1}{2007/07/13}{Test for CR added}
+% \changes{v1.3}{2011/08/06}{Test for CR revised}
+% \changes{v2.0}{2018/05/15}{Variant with two stars added}
+% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now}
+% \changes{v2.0}{2020/07/27}{\cs{caption@iflf} renamed to \cs{caption@iflabelfont}}
+% \changes{v2.0}{2020/07/27}{\cs{caption@lsep} renamed to \cs{caption@labelsep}}
+% \changes{v2.0}{2020/07/27}{Definition of \cs{caption@labelsep@name} added}
+% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
+% |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\\
+% |\DeclareCaptionLabelSeparator**|\marg{name}\marg{condition}\marg{code}\\
+% The starred form causes the label separator to be typeset \emph{without}
+% using |\caption|\-|label|\-|font|.
+% The two-starred form uses \meta{condition} to decide if the label separator
+% should be typeset with or without using |\caption|\-|label|\-|font|.
+% \begin{macrocode}
+\newcommand\DeclareCaptionLabelSeparator{%
+ \@ifstar
+ \DeclareCaptionLabelSeparator@
+ {\caption@declarelabelseparator\@firstofone}}
+\@onlypreamble\DeclareCaptionLabelSeparator
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\DeclareCaptionLabelSeparator@{%
+ \@ifstar
+ \DeclareCaptionLabelSeparator@@
+ {\caption@declarelabelseparator\@gobble}}
+\@onlypreamble\DeclareCaptionLabelSeparator@
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionLabelSeparator@@[2]{%
+ \caption@declarelabelseparator
+ {#2\@gobble\@firstofone}%
+ {#1}}
+\@onlypreamble\DeclareCaptionLabelSeparator@@
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@declarelabelseparator[3]{%
+ \caption@decl{labelseparator}{#2}%
+ {\def\caption@iflabelfont{#1}%
+ \def\caption@labelsep@name{#2}%
+ \def\caption@labelsep{#3}}%
+% \end{macrocode}
+% Unfortunately |\Declare|\-|Float|\-|Separators| of the \package{floatrow}
+% package mis-uses |\Declare|\-|Caption|\-|Label|\-|Separator| instead of
+% storing the definition on its own. Since the \package{floatrow} package is
+% unmaintained we have to store the separator definition inside
+% |\caption@lsep@|\meta{name} for \package{floatrow}, too. (Sigh!)
+% \begin{macrocode}
+ \@namedef{caption@lsep@#2}{#3}}
+% \end{macrocode}
+% Since the `default' caption label separator will usually not be defined
+% with |\Declare|\-|Caption|\-|Label|\-|Separator|, we need to define
+% |\caption@lsep@default| manually.
+% \Note{This definition is used by \package{magyar.ldf} but only needs to be different
+% than \cs{caption@lsep} (which is usually undefined).}
+% \begin{macrocode}
+\newcommand*\caption@lsep@default{\caption@labelseparator@default\caption@labelsep}%
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@declarelabelseparator
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@LabelSeparatorWithNewline}
+% \changes{v2.0}{2020/07/27}{This macro added}
+% |\caption@LabelSeparatorWithNewline|\marg{name}\\
+% adds the given label separator to a list of label separators which uses
+% |\\| internally. (They are incompatible to the `hang' caption format.)
+% \begin{macrocode}
+\newcommand*\caption@LabelSeparatorWithNewline[1]{%
+ \caption@g@addto@list\caption@labelsep@crlist{#1}}
+\@onlypreamble\caption@LabelSeparatorWithNewline
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iflabelseparatorwithnewline}
+% \changes{v2.0}{2020/07/31}{This macro added}
+% |\caption@iflabelseparatorwithnewline|\marg{yes-code}\marg{no-code}\\
+% tests if the current label separator uses |\\| internally.
+% \begin{macrocode}
+\newcommand*\caption@iflabelseparatorwithnewline{%
+ \caption@ifin@list\caption@labelsep@crlist\caption@labelsep@name}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{labelsep}{\caption@set{labelseparator}{#1}}
+\DeclareCaptionOption{labelseparator}{\caption@set{labelseparator}{#1}}
+% \end{macrocode}
+%
+% \changes{v1.0e}{2005/06/11}{Caption label separator \opt{newline} implementation changed from \cs{newline} to \cs{textbackslash}}
+% \changes{v1.0f}{2005/08/24}{Caption label separator \opt{endash} added}
+% \changes{v1.12}{2020/05/30}{Caption label separator \opt{newline} implementation changed from \cs{textbackslash} to \cs{captionnewline}}
+% There are seven pre-defined label separators, called `none', `colon', `period', `space',
+% `quad', `newline', and `endash'.
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{none}{}
+\DeclareCaptionLabelSeparator{colon}{: }
+\DeclareCaptionLabelSeparator{period}{. }
+\DeclareCaptionLabelSeparator{space}{ }
+\DeclareCaptionLabelSeparator*{quad}{\quad}
+\DeclareCaptionLabelSeparator*{newline}{\captionnewline}
+% TODO: \DeclareCaptionLabelSeparator should detect on its own if it contains \captionnewline or not
+\caption@LabelSeparatorWithNewline{newline} % does not work with "format=hang"
+\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
+% \end{macrocode}
+%
+% \changes{v2.2c}{2020/10/10}{Caption label separators \opt{gobble} and \opt{gobbletwo} added}
+%
+% It's a common hack to mis-use |\fnum@figure| and |\fnum@table| to replace the caption
+% label separator, for example changing the separator to a period plus space with
+% \begin{quote}
+% |\renewcommand\fnum@figure[1]{\figurename~\thefigure.}|
+% \end{quote}
+% or dropping the label and separator completely with
+% \begin{quote}
+% |\renewcommand\fnum@figure[1]{\ignorespaces}|\quad
+% \end{quote}
+% (taken from \url{http://compgroups.net/comp.text.tex/figure-without-caption/1915079}).
+%
+% We emulate the behaviour of |\@make|\-|caption| of the base document classes
+% \class{article}, \class{report}, and \class{book} in this regard (in |\caption@@@make|)
+% so these hacks still work if the \package{caption} package is loaded.
+%
+% These are the label separators used when one or two tokens after the label format
+% should be dropped, called `gobble' and `gobbletwo':
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{gobble}{ }
+\DeclareCaptionLabelSeparator{gobbletwo}{}
+% \end{macrocode}
+%
+% \begin{macro}{\captionnewline}
+% \changes{v1.12}{2020/05/30}{This macro added}
+% \changes{v2.0}{2020/07/31}{\cs{relax} added to definition}
+% |\captionnewline|\\
+% will be used in the caption label separator |new|\-|line|,
+% and re-defined for |long|\-|table| environments
+% (in package \package{ltcaption}).
+% \begin{macrocode}
+\newcommand*\captionnewline{\\\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% `default' usually maps to `colon'.
+% \begin{macrocode}
+\SetCaptionDefault{labelseparator}{colon}
+% \end{macrocode}
+%
+% \section{Text formats}
+%
+% \begin{macro}{\DeclareCaptionTextFormat}
+% \changes{v1.0j}{2007/02/18}{This macro added}
+% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now}
+% \changes{v2.2f}{2020/10/26}{\cs{par} is now allowed as part of the \meta{code} argument}
+% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1}
+% \begin{macrocode}
+\newcommand\DeclareCaptionTextFormat[2]{%
+ \caption@decl{textformat}{#1}##1{#2}}
+\@onlypreamble\DeclareCaptionTextFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{textformat}{\caption@set{textformat}{#1}}
+% \end{macrocode}
+%
+% There are three pre-defined text formats, called `empty', `simple' and `period'.
+% \changes{v1.4}{2011/10/05}{Pre-defined text format `empty' added}
+% \changes{v1.7}{2015/09/16}{The text format `empty' now takes care of the \cs{label}}
+% \begin{macrocode}
+\DeclareCaptionTextFormat{empty}{%
+ \caption@get@label#1\caption@makeanchor{}\@nil
+ \caption@thelabel
+ \global\let\caption@thelabel\relax}
+\long\def\caption@get@label#1\caption@makeanchor#2#3\@nil{%
+ \def\caption@tempa{#2}%
+ \ifx\caption@tempa\@empty
+ \caption@getlabel{#1}%
+ \else
+ \caption@getlabel{#2}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionTextFormat{simple}{#1}
+\DeclareCaptionTextFormat{period}{#1.}
+% \end{macrocode}
+%
+% `default' usually maps to `simple'.
+% \begin{macrocode}
+\SetCaptionDefault{textformat}{simple}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@getlabel}
+% \changes{v1.0}{2011/09/03}{\cs{label} can have optional arguments now}
+% \changes{v1.7}{2015/09/16}{Moved from \package{bicaption} package to \package{caption3}}
+% \changes{v1.8d}{2019/09/01}{Bugfix: Global definition of \cs{caption@thelabel} added}
+% \changes{v2.0}{2020/08/23}{Syntax changed}
+% |\caption@getlabel|\marg{text}\\
+% gets the label command out of the given caption text and stores it to
+% |\caption@the|\-|label|.
+% \begin{macrocode}
+\newcommand\caption@getlabel[1]{%
+ \caption@@getlabel#1\label{}\@nil}
+\long\def\caption@@getlabel#1\label#2#3\@nil{%
+ \def\@tempa{#2}%
+ \ifx\@tempa\@empty
+ \let\caption@thelabel\relax
+ \else
+ \def\@tempb{*}%
+ \ifx\@tempa\@tempb
+ \def\caption@thelabel{\label*}%
+ \caption@@@getlabel#3\@nil
+ \else
+ \def\caption@thelabel{\label}%
+ \caption@@@getlabel{#2}#3\@nil
+ \fi
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@@getlabel#1#2\@nil{%
+ \def\@tempa{#1}%
+ \def\@tempb{[}%
+ \ifx\@tempa\@tempb
+ \caption@@@@getlabel#1#2\@nil
+ \else
+ \l@addto@macro\caption@thelabel{{#1}}%
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@@@getlabel[#1]#2\@nil{%
+ \l@addto@macro\caption@thelabel{[{#1}]}%
+ \caption@@@getlabel#2\@nil}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@thelabel\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{Option \opt{strut=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}}
+% \end{macrocode}
+%
+% \section{Fonts}
+%
+% \begin{macro}{\DeclareCaptionFont}
+% \changes{v1.0a}{2004/01/22}{Bugfix: Multi token arguments are allowed now}
+% \changes{v1.1}{2007/05/07}{Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now}
+% \changes{v1.8h}{2020/01/03}{Check for \package{ragged2e} package related options added}
+% \changes{v1.10}{2020/05/10}{Optional argument \opt{package} added}
+% |\DeclareCaptionFont|\oarg{package}\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionFont{%
+ \caption@decl@package{font}{\caption@declarefont}}
+\@onlypreamble\DeclareCaptionFont
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declarefont[2]{%
+ \caption@decl{font}{#1}##1{#2}%
+ \define@key{caption@font}{#1}[]{\caption@addto@font{#1}{##1}}}
+\@onlypreamble\caption@@declarefont
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@addto@font[1]{%
+% \end{macrocode}
+% \begin{macrocode}
+% Load package first, if necessary
+ \caption@load@package{font}{#1}%
+% \end{macrocode}
+% Add the content to \cs{caption@fnt}
+% \begin{macrocode}
+ \caption@add@to@font{font}{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@add@to@font[3]{%
+ \expandafter\g@addto@macro\expandafter\caption@fnt\expandafter{\csname caption@#1@#2\endcsname{#3}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
+\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
+\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}}
+\caption@setmapping{labelfont}{font}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
+\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}}
+\caption@setmapping{textfont}{font}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setfont}
+% \changes{v1.0j}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument}
+% \changes{v1.1}{2006/05/14}{Support of \cs{DeclareDefaultCaptionFont} added}
+% |\caption@setfont|\marg{name}\marg{keyval-list of names}\\
+% Selecting a caption font means saving all the code snippets
+% in |\caption|\meta{name}.
+% \begin{macrocode}
+\newcommand*\caption@setfont[1]{%
+ \expandafter\let\csname caption#1\endcsname\@empty
+ \caption@addtofont{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@addtofont}
+% \changes{v1.2}{2007/11/17}{This macro added}
+% |\caption@addtofont|\marg{name}\marg{keyval-list of names}\\
+% Like |\caption@set|\-|font|, but adds the code snippets to |\caption|\meta{name}.
+% Because we use |\set|\-|keys| recursive here we need to do this inside an
+% extra group.
+% \begin{macrocode}
+\newcommand*\caption@addtofont[2]{%
+ \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname
+ \begingroup
+ \define@key{caption@font}{default}[]{\caption@add@to@font{#1}{default}{##1}}%
+ \caption@setkeys[caption]{caption@font}{#2}%
+ \endgroup
+ \expandafter\let\csname caption#1\endcsname\caption@fnt}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined font code snippets.
+%
+% \changes{v1.1}{2007/05/07}{Color font support added}
+% \begin{macrocode}
+\DeclareCaptionFont{normalcolor}{\normalcolor}
+\DeclareCaptionFont{color}{\color{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{normalfont}{\normalfont}
+\DeclareCaptionFont{up}{\upshape}
+\DeclareCaptionFont{it}{\itshape}
+\DeclareCaptionFont{sl}{\slshape}
+\DeclareCaptionFont{sc}{\scshape}
+\DeclareCaptionFont{md}{\mdseries}
+\DeclareCaptionFont{bf}{\bfseries}
+\DeclareCaptionFont{rm}{\rmfamily}
+\DeclareCaptionFont{sf}{\sffamily}
+\DeclareCaptionFont{tt}{\ttfamily}
+% \end{macrocode}
+%
+% \changes{v1.7}{2018/05/01}{Missing font sizes \texttt{tiny}, \texttt{LARGE}, \texttt{huge}, and \texttt{Huge} added}
+% \begin{macrocode}
+\DeclareCaptionFont{tiny}{\tiny}
+\DeclareCaptionFont{scriptsize}{\scriptsize}
+\DeclareCaptionFont{footnotesize}{\footnotesize}
+\DeclareCaptionFont{small}{\small}
+\DeclareCaptionFont{normalsize}{\normalsize}
+\DeclareCaptionFont{large}{\large}
+\DeclareCaptionFont{Large}{\Large}
+\DeclareCaptionFont{LARGE}{\LARGE}
+\DeclareCaptionFont{huge}{\huge}
+\DeclareCaptionFont{Huge}{\Huge}
+% \end{macrocode}
+%
+% \changes{v1.8}{2018/05/01}{Font sizes \texttt{smaller} and \texttt{larger} added}
+% \begin{macrocode}
+\DeclareCaptionFont{smaller}{\caption@smaller}
+\DeclareCaptionFont{larger}{\caption@larger}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{none}{}
+\DeclareCaptionFont{normal}{%
+ \caption@font@normalcolor\@unused
+ \caption@font@normalfont\@unused
+ \caption@font@normalsize\@unused
+ \caption@font@singlespacing\@unused}
+% \end{macrocode}
+%
+% `default' usually maps to `none'.
+% \begin{macrocode}
+\SetCaptionDefault{font}{none}
+\SetCaptionDefault{labelfont}{none}
+\SetCaptionDefault{textfont}{none}
+% \end{macrocode}
+%
+% The \package{floatrow} package uses the fonts `footfont` and `@tempa` additionally,
+% so we need to map and define the default value for them, too.
+% \begin{macrocode}
+\caption@setmapping{footfont}{font}
+\SetCaptionDefault{footfont}{none}
+\caption@setmapping{@tempa}{font}
+\SetCaptionDefault{@tempa}{none}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@smaller}
+% |\caption@smaller|\\
+% selects a font size which is smaller than the current one.
+% \begin{macrocode}
+\newcommand\caption@smaller{%
+ \ifx\@currsize\tiny
+ \relax
+ \else\ifx\@currsize\scriptsize
+ \tiny
+ \else\ifx\@currsize\footnotesize
+ \scriptsize
+ \else\ifx\@currsize\small
+ \footnotesize
+ \else\ifx\@currsize\normalsize
+ \small
+ \else\ifx\@currsize\large
+ \normalsize
+ \else\ifx\@currsize\Large
+ \large
+ \else\ifx\@currsize\LARGE
+ \Large
+ \else\ifx\@currsize\huge
+ \LARGE
+ \else\ifx\@currsize\Huge
+ \huge
+ \else
+ \caption@Warning{%
+ Cannot determine current font size.\MessageBreak
+ Try setting it with `size=' explicitly}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@larger}
+% |\caption@larger|\\
+% selects a font size which is larger than the current one.
+% \begin{macrocode}
+\newcommand\caption@larger{%
+ \ifx\@currsize\tiny
+ \scriptsize
+ \else\ifx\@currsize\scriptsize
+ \footnotesize
+ \else\ifx\@currsize\footnotesize
+ \small
+ \else\ifx\@currsize\small
+ \normalsize
+ \else\ifx\@currsize\normalsize
+ \large
+ \else\ifx\@currsize\large
+ \Large
+ \else\ifx\@currsize\Large
+ \LARGE
+ \else\ifx\@currsize\LARGE
+ \huge
+ \else\ifx\@currsize\huge
+ \Huge
+ \else\ifx\@currsize\Huge
+ \relax
+ \else
+ \caption@Warning{%
+ Cannot determine current font size.\MessageBreak
+ Try setting it with `size=' explicitly}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@hypersetup}
+% |\caption@hypersetup|\marg{options}\\
+% expands to |\hypersetup|\marg{options} if defined, to nothing otherwise.
+% \begin{macrocode}
+\newcommand*\caption@hypersetup{\caption@ifdefined\hypersetup\hypersetup\@gobble}
+\DeclareCaptionFont{hypersetup}{\caption@hypersetup{#1}} % for usage in \captionsetup{font={hypersetup=...}}
+\DeclareCaptionOption{hypersetup}{\caption@hypersetup{#1}} % for usage in \captionsetup[<env>]{hypersetup=...}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Sizes}
+%
+% \changes{v1.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
+% The old versions \version{1.x} of \thispackage\ offered this
+% command to setup the font size used for captions. We still do
+% so old documents will work fine.
+% \begin{macrocode}
+\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
+\caption@setmapping{size}{font}
+% \end{macrocode}
+%
+% `default' usually maps to `none'.
+% \begin{macrocode}
+\SetCaptionDefault{size}{none}
+% \end{macrocode}
+%
+% \section{Justifications}
+%
+% \begin{macro}{\DeclareCaptionJustification}
+% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
+% \changes{v1.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}}
+% \changes{v2.0}{2020/07/26}{Uses \cs{caption@decl} now}
+% |\DeclareCaptionJustification|\oarg{package}\marg{name}\marg{code}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionJustification{%
+% \caption@decl@package{justification}{\caption@decl{justification}}} % Because of floatrow it isn't so easy...
+% \end{macrocode}
+% Unfortunately the (unmaintained) \package{floatrow} uses the old storage scheme
+% of the \package{caption} package and therefore expects the justification code
+% in |\caption@hj@|\meta{name} instead of |\caption@justification@|\meta{name}.
+% For this reason we have to store the code for the \package{floatrow} package
+% additionally, so |\flrow@FBo|\-|Align| will still work fine.
+% \begin{macrocode}
+ \caption@withoptargs\caption@declare@justification}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declare@justification[3]{%
+ \caption@decl@package{justification}{\caption@decl{justification}}#1{#2}{#3}%
+ \expandafter\let\csname caption@hj@#2\expandafter\endcsname\csname caption@justification@#2\endcsname}
+\@onlypreamble\DeclareCaptionJustification
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{justification}{%
+ \caption@load@package{justification}{#1}%
+ \caption@set{justification}{#1}}
+% \end{macrocode}
+%
+% These are the pre-defined justification code snippets.
+% \begin{macrocode}
+\DeclareCaptionJustification{justified}{}
+\DeclareCaptionJustification{centering}{\centering}
+\DeclareCaptionJustification{centerfirst}{\centerfirst}
+\DeclareCaptionJustification{centerlast}{\centerlast}
+\DeclareCaptionJustification{raggedleft}{\raggedleft}
+\DeclareCaptionJustification{raggedright}{\raggedright}
+% \end{macrocode}
+%
+% `default' usually maps to `justified'.
+% \begin{macrocode}
+\SetCaptionDefault{justification}{justified}
+% \end{macrocode}
+%
+% \begin{macro}{\centerfirst}
+% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}}
+% Please blame Frank Mittelbach for the code of |\center|\-|first| |:-)|
+% \begin{macrocode}
+\providecommand\centerfirst{%
+ \let\\\@centercr
+ \edef\caption@normaladjust{%
+ \leftskip\the\leftskip
+ \rightskip\the\rightskip
+ \parfillskip\the\parfillskip\relax}%
+ \leftskip\z@\@plus -1fil%
+ \rightskip\z@\@plus 1fil%
+ \parfillskip\z@skip
+ \noindent\hskip\z@\@plus 2fil%
+ \@setpar{\@@par\@restorepar\caption@normaladjust}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\centerlast}
+% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
+% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}}
+% This one is based on code from Anne Br\"uggemann-Klein\cite{Anne}.
+% \begin{macrocode}
+\providecommand\centerlast{%
+ \let\\\@centercr
+ \leftskip\z@\@plus 1fil%
+ \rightskip\z@\@plus -1fil%
+ \parfillskip\z@\@plus 2fil\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Vertical spaces before and after captions}
+%
+% \begin{macro}{\abovecaptionskip}
+% \begin{macro}{\belowcaptionskip}
+% Usually these skips are defined within the document class, but some
+% document classes don't.
+% \begin{macrocode}
+\caption@ifundefined\abovecaptionskip{%
+ \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
+\caption@ifundefined\belowcaptionskip{%
+ \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v1.0c}{2005/02/12}{Option \opt{skip=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
+\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
+\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@rule}
+% \changes{v1.2b}{2008/05/06}{This macro added}
+% |\caption@rule|\\
+% Draws an invisible rule to adjust the ``skip'' setting.
+% \begin{macrocode}
+\newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@hrule{\hrule\@height\z@}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2b}{2008/05/06}{Option \opt{rule=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}}
+% \end{macrocode}
+%
+% \section{Positioning}
+%
+% These macros handle the right position of the caption.
+% Note that the position is actually \emph{not} controlled by the
+% \package{caption3} kernel options, but by the user (or a specific package
+% like the \package{float} package) instead.
+% The user can put the |\caption| command wherever he likes! So this stuff
+% is only to give us a \emph{hint} where to put the right skips, the user
+% usually has to take care for himself that this hint actually matches the
+% right position.
+%
+% \begin{macro}{\caption@declare@position}
+% \changes{v2.0}{2020/07/26}{This macro added}
+% |\caption@declare@position|\marg{name}\marg{code}\\
+% declares a captionposition setting of the given \meta{name},
+% \meta{code} must either expand to |\@first|\-|of|\-|two| (top) or
+% |\@second|\-|of|\-|two| (below).
+% \begin{macrocode}
+\newcommand*\caption@declare@position[2]{%
+ \caption@decl{position}{#1}{#2}}
+\@onlypreamble\caption@declare@position
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{position}{\caption@setposition{#1}}
+% \end{macrocode}
+% \changes{v1.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figureposition}{\captionsetup*[figure]{position=#1}}
+\@onlypreamble@key{caption}{figureposition}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareCaptionOption{tableposition}{\captionsetup*[table]{position=#1}}
+\@onlypreamble@key{caption}{tableposition}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setposition}
+% \changes{v1.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b}, \opt{below}, and \opt{a} are allowed, too}
+% \changes{v1.0c}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
+% \changes{v2.0}{2020/07/27}{Uses \cs{caption@set} now}
+% |\caption@setposition|\marg{position}\\
+% puts |\caption@position| to the right value.
+% (Note: Since this command is used by the \package{floatrow} package as well
+% its syntax should not change.)
+% \begin{macrocode}
+\newcommand*\caption@setposition{\caption@set{position}}
+% \end{macrocode}
+% \end{macro}
+%
+% These are the pre-defined position code snippets.
+% \begin{macrocode}
+\caption@declare@position{t}{\@firstoftwo}
+\caption@declare@position{top}{\@firstoftwo}
+\caption@declare@position{above}{\@firstoftwo}
+\caption@declare@position{b}{\@secondoftwo}
+\caption@declare@position{bottom}{\@secondoftwo}
+\caption@declare@position{below}{\@secondoftwo}
+\caption@declare@position{a}{\caption@autoposition}% needed by floatrow package, \flrow@cappos
+\caption@declare@position{auto}{\caption@autoposition}
+% \end{macrocode}
+%
+% \changes{v1.1}{2007/05/08}{Default position changed from `bottom' to `auto'}
+% `default' usually maps to `auto'.
+% \begin{macrocode}
+\SetCaptionDefault{position}{auto}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@autoposition}
+% \changes{v2.0}{2020/07/27}{This macro added}
+% If in doubt, `position=auto' maps to `position=below'.
+% \begin{macrocode}
+\let\caption@autoposition\@secondoftwo
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@iftop}
+% \changes{v1.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
+% \changes{v1.0c}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
+% \changes{v1.1}{2007/05/08}{Position will be fixed to `bottom' if `auto'}
+% \changes{v2.0}{2020/07/27}{Adapted to current implementation of `auto'}
+% |\caption@iftop|\marg{true-code}\marg{false-code}\\
+% Since version \version{2.0} this command is identical to |\caption@position|.
+% \begin{macrocode}
+\newcommand*\caption@iftop{\caption@position}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@fixposition}
+% \changes{v1.0a}{2004/01/23}{\cs{ifvmode} added}
+% \changes{v1.0b}{2004/05/16}{Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
+% \changes{v2.0}{2020/07/27}{Adapted to current implementation of `auto'}
+% |\caption@fixposition|\\
+% We try to guess the current position of the caption by checking |\prev|\-|depth|.\par
+% A different solution would be setting the |\space|\-|factor| to something
+% not much less than 1000 (for example 994) in |\caption@start| and
+% checking this value here by |\ifnum\space|\-|factor=994|.
+% (It's implemented in the \package{threeparttable} package\cite{threeparttable} this way.)\par
+% Another idea would be checking |\@if|\-|mini|\-|page|, but since some packages
+% typeset the caption within a simple |\vbox| this does not seem to be a good one.
+% \begin{macrocode}
+\newcommand*\caption@fixposition{%
+ \ifvmode
+ \edef\caption@tempa{\the\prevdepth}%
+ \caption@Debug{\protect\prevdepth=\caption@tempa}%
+ \ifdim\prevdepth>-\p@
+ \let\caption@autoposition\@secondoftwo % position=below
+ \else
+ \let\caption@autoposition\@firstoftwo % position=above
+ \fi
+ \else
+ \caption@Debug{no \protect\prevdepth}%
+ \let\caption@autoposition\@secondoftwo % position=below
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setautoposition}
+% \changes{v1.1}{2007/06/10}{This macro added}
+% \changes{v2.0}{2020/07/27}{Adapted to current implementation of `auto'}
+% |\caption@setautoposition|\marg{position}\\
+% replaces the above algorithm by a different one (or a fixed position setting).
+% \begin{macrocode}
+\newcommand*\caption@setautoposition[1]{%
+ \def\caption@fixposition{\caption@@set{position}{autoposition}{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Hooks}
+%
+% \begin{macro}{\AtBeginCaption}
+% \begin{macro}{\AtEndCaption}
+% |\AtBeginCaption|\marg{code}\\
+% |\AtEndCaption|\marg{code}\\
+% These hooks can be used analogous to |\At|\-|Begin|\-|Document| and
+% |\At|\-|End|\-|Document|.
+% \begin{macrocode}
+\newcommand*\caption@beginhook{}
+\newcommand*\caption@endhook{}
+\newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook}
+\newcommand*\AtEndCaption{\l@addto@macro\caption@endhook}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \section{Lists}
+%
+% \changes{v1.0b}{2004/05/16}{Option \opt{listof=} added}
+% \changes{v1.2}{2007/11/17}{Option \opt{list=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{list}[1]{\caption@setlist{#1}}
+\DeclareCaptionOption{listof}[1]{\caption@setlist{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlist}
+% \changes{v1.2a}{2008/03/20}{This macro added}
+% |\caption@setlist|\marg{boolean value}\\
+% sets the `list' option to either `off' or `on'.
+% \begin{macrocode}
+\newcommand*\caption@setlist{\caption@set@bool\caption@iflist}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@setlist{on}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.4}{2011/08/30}{Option \opt{listtype=} added}
+% \changes{v1.4}{2011/08/30}{Option \opt{listtype+=} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listtype}{\caption@setlisttype{#1}}
+\DeclareCaptionOption{listtype+}{\caption@setlisttype@ext{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setlisttype}
+% \changes{v1.4}{2011/08/30}{This macro added}
+% |\caption@setlisttype|\marg{type}\\
+% sets the `listtype' option to the given \meta{type}.
+% \begin{macrocode}
+\newcommand*\caption@setlisttype{%
+ \caption@setlisttype@ext{}%
+ \caption@@setlisttype\caption@listtype}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@setlisttype[2]{%
+ \edef#1{#2}%
+ \ifx#1\@empty \let#1\@undefined \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@setlisttype@ext}
+% \changes{v1.4}{2011/08/30}{This macro added}
+% |\caption@setlisttype@ext|\marg{type extension}\\
+% sets the `listtype' option to the given \meta{type extension}.
+% \begin{macrocode}
+\newcommand*\caption@setlisttype@ext{%
+ \caption@@setlisttype\caption@listtype@ext}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionListFormat}
+% \changes{v1.1}{2004/07/15}{This macro added}
+% \changes{v1.2}{2007/11/17}{Renamed from \cs{DeclareCaptionListOfFormat} to \cs{DeclareCaptionListFormat}}
+% \changes{v2.0}{2020/07/26}{Uses \cs{caption@decl} now}
+% |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2}
+% \begin{macrocode}
+\newcommand*\DeclareCaptionListFormat[2]{%
+ \caption@decl{listformat}{#1}##1##2{#2}}
+\@onlypreamble\DeclareCaptionListFormat
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.1}{2007/07/15}{Option \opt{listofformat=} added}
+% \changes{v1.2}{2007/11/17}{Option \opt{listofformat=} renamed to \opt{listformat=}}
+% \begin{macrocode}
+\DeclareCaptionOption{listformat}{\caption@set{listformat}{#1}}
+% \end{macrocode}
+%
+% There are seven pre-defined list formats. (The first five were taken from the \package{subfig} package.)
+% \begin{macrocode}
+\DeclareCaptionListFormat{empty}{}
+\DeclareCaptionListFormat{simple}{#1#2}
+\DeclareCaptionListFormat{subsimple}{#2}
+\DeclareCaptionListFormat{parens}{#1(#2)}
+\DeclareCaptionListFormat{subparens}{(#2)}
+\DeclareCaptionListFormat{period}{#1#2.}
+\DeclareCaptionListFormat{subperiod}{#2.}
+% \end{macrocode}
+%
+% `default' usually maps to `subsimple'.
+% \begin{macrocode}
+\SetCaptionDefault{listformat}{subsimple}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@lstfmt}
+% \changes{v2.0}{This macro added}
+% To provide backward compatibility we still offer \cs{caption@lstfmt}.
+% (\cs{caption@lstfmt} is used in the \package{dgruyter} package.)
+% \begin{macrocode}
+\newcommand*\caption@lstfmt{\caption@listformat}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Debug option}
+% \changes{v1.0k}{2007/03/04}{Debug option added}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{debug}[1]{%
+ \caption@set@bool\caption@ifdebug{#1}%
+ \caption@ifdebug
+ {\let\caption@Debug\caption@Info}%
+ {\let\caption@Debug\@gobble}}
+% \end{macrocode}
+% \begin{macrocode}
+\DeclareOption{debug}{\setkeys{caption}{debug}}
+% \end{macrocode}
+% \begin{macrocode}
+\setkeys{caption}{debug=0}
+% \end{macrocode}
+%
+% \section{Document class support}
+% \changes{v2.0}{2018/05/11}{Document class support re-written}
+%
+% \begin{macro}{\@makecaption@standard}
+% \begin{macrocode}
+% article|report|book.sty [2005/09/16 v1.4f Standard LaTeX document class]
+\newcommand\@makecaption@standard[2]{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}
+\@onlypreamble\@makecaption@standard
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makecaption@arabic}
+% \begin{macrocode}
+% arabicore.sty [2006/01/01 v1.0 Arabi Core switching commands (may still change)]
+\newcommand\@makecaption@arabic[2]{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1: #2}%
+ \sbox\@Arabitempboxa{\textRL{#2} : #1}%
+ \if@rl{
+ \ifdim \wd\@Arabitempboxa >\hsize
+ \textRL{#2} : #1\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@Arabitempboxa\hfil}%
+ \fi}\else{
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi}\fi
+ \vskip\belowcaptionskip}
+\@onlypreamble\@makecaption@arabic
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makecaption@latvian}
+% \begin{macrocode}
+% latvian.ldf [2018/02/19 v2.0b Latvian support from the babel system]
+\newcommand\@makecaption@latvian[2]{%
+ \vskip10\p@
+ \sbox\@tempboxa{#1\if\empty#2\else: #2\fi}%
+ \ifdim\wd\@tempboxa>\hsize
+ #1: #2\par
+ \else
+ \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi}
+\@onlypreamble\@makecaption@latvian
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifdocumentclass}
+% Boolean switch which is set if the document class could be detected
+% successfully, i.e. |\caption@document|\-|class| is set to a proper value.
+% (If |\caption@document|\-|class| is already set, this flag will also be set.)
+% \begin{macrocode}
+\caption@setbool{documentclass}{1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@documentclass}
+% \changes{v1.8e}{2018/05/11}{This macro added}
+% Determine document class used.
+% Set |\caption@document|\-|class| by good-guessing, if not already set.
+% \begin{macrocode}
+\caption@ifundefined\caption@documentclass{%
+% \end{macrocode}
+% \begin{macrocode}
+ \@ifclassloaded{beamer}{%
+ \caption@InfoNoLine{beamer document class detected}%
+ \def\caption@documentclass{beamer}%
+% \end{macrocode}
+% \begin{macrocode}
+ }{\@ifclassloaded{elsarticle}{%
+ \caption@InfoNoLine{elsarticle document class detected}%
+ \def\caption@documentclass{elsarticle}%
+% \end{macrocode}
+% \begin{macrocode}
+ }{\@ifclassloaded{memoir}{%
+ \caption@InfoNoLine{memoir document class detected}%
+ \def\caption@documentclass{memoir}%
+% \end{macrocode}
+% \begin{macrocode}
+ }{\caption@ifdefined\scr@caption{%
+ \caption@InfoNoLine{KOMA-Script document class detected}%
+ \def\caption@documentclass{koma}%
+% \end{macrocode}
+% If |\@captionheadfont| is defined, we assume it's a AMS or SMF document class.
+% \begin{macrocode}
+ }{\caption@ifdefined\@captionheadfont{%
+ \caption@InfoNoLine{AMS or SMF document class detected}%
+ \def\caption@documentclass{ams-smf}%
+% \end{macrocode}
+% If |\CaptionFonts| is defined, we assume it's a NTG Dutch document class.
+% \begin{macrocode}
+ }{\caption@ifdefined\CaptionFonts{%
+ \caption@InfoNoLine{NTG document class detected}%
+ \def\caption@documentclass{ntg}%
+% \end{macrocode}
+% If |\cph@font| and |\cpb@font| are defined, we assume it's the thesis document class.
+% \begin{macrocode}
+ }{\caption@ifdefined\cph@font{%
+ \caption@ifdefined\cpb@font\@firstoftwo\@secondoftwo
+ }{%
+ \@secondoftwo
+ }{%
+ \caption@InfoNoLine{thesis document class detected}%
+ \def\caption@documentclass{thesis}%
+ }{%
+% \end{macrocode}
+% If the definition of |\@make|\-|caption| matches the one from the standard
+% \LaTeX\ document classes |article|, |report|, or |book|, we assume it's
+% either one of them or is compatible to them.
+% \begin{macrocode}
+ \ifx\@makecaption\@undefined
+ \caption@InfoNoLine{Document class w/o caption stuff detected}%
+ \else
+ \ifx\@makecaption\@makecaption@standard
+ \caption@InfoNoLine{Standard document class detected}%
+ \else
+ \ifx\@makecaption\@makecaption@arabic
+ \caption@InfoNoLine{arabic babel option detected}%
+ \else
+ \ifx\@makecaption\@makecaption@latvian
+ \caption@InfoNoLine{latvian babel option detected}%
+ \else
+% \end{macrocode}
+% Otherwise we are clueless and use standard default settings for the captions.
+% (And we unset the |document|\-|class| flag to indicate that the content of
+% |\caption@document|\-|class| is not correct.)
+% \begin{macrocode}
+ \caption@InfoNoLine{%
+ Unknown document class (or package),\MessageBreak
+ standard defaults will be used}%
+ \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}%
+ \caption@setbool{documentclass}{0}% unknown document class
+ \fi
+ \fi
+ \fi
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@documentclass\@empty % don't load adaption code later on
+ }}}}}}}%
+}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtCaptionPackage}
+% \changes{v2.0}{2018/05/14}{This macro added}
+% |\AtCaptionPackage|\marg{code}\\
+% can be used by the document class adaption packages to execute extra code
+% if the \package{caption} package is loaded (later on).
+% This code will by applied right before the package options are evaluated.
+% \begin{macrocode}
+\newcommand*\AtCaptionPackage{%
+ \g@addto@macro\caption@documentclass@code}
+\@onlypreamble\AtCaptionPackage
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@documentclass@code{}
+\@onlypreamble\caption@documentclass@code
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AfterCaptionPackage}
+% \changes{v2.1}{2020/09/12}{This macro added}
+% |\AfterCaptionPackage|\marg{code}\\
+% can be used by the document class adaption packages to execute extra code
+% if the \package{caption} package is loaded (later on).
+% This code will by applied at the very end.
+% \begin{macrocode}
+\newcommand*\AfterCaptionPackage{%
+ \g@addto@macro\caption@endtitles@code}
+\@onlypreamble\AfterCaptionPackage
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@endtitles@code{}
+\@onlypreamble\caption@endtitles@code
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Babel support}
+%
+% \begin{macro}{\caption@IfBabelPackageLoaded}
+% |\caption@IfBabelPackageLoaded|\marg{option}\marg{cmd}\marg{yes-code}\marg{no-code}\\
+% expands the given \meta{yes-code} if |\caption@if|\-|babel@|\meta{option}
+% is set and \meta{cmd} is defined.
+% Otherwise the \meta{no-code} is expanded.\par
+% This way the adaption could be prevented by defining
+% \begin{quote}|\def\caption@ifbabel@|\meta{option}|{false}|\end{quote}
+% \begin{macrocode}
+\newcommand*\caption@IfBabelPackageLoaded[4]{%
+ \caption@ifdefined#2\@firstofone\caption@AtBeginDocument{%
+ \caption@if@bool{\@nameuse{caption@ifbabel@#1}}%
+ {\def\caption@tempa{\caption@ifdefined#2}}%
+ {\let\caption@tempa\@secondoftwo}%
+ \caption@tempa
+ {\caption@InfoNoLine{#1 babel package is loaded}#3}%
+ {#4}}}
+\@onlypreamble\caption@IfBabelPackageLoaded
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{The arabic \& farsi babel option}
+% \changes{v1.8}{2018/05/20}{\package{arabic} babel support added}
+% \changes{v2.0}{2020/08/02}{\package{arabic} babel support updated}
+% \changes{v2.0}{2020/08/02}{\package{farsi} babel support added}
+%
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{arabi}{\if@rl\space\fi: }
+% \end{macrocode}
+%
+% \begin{macro}{\caption@IfBabelArabi}
+% |\caption@IfBabelArabic|\marg{yes-code}\marg{no-code}
+% \begin{macrocode}
+\newcommand*\caption@IfBabelArabi{%
+ \caption@IfBabelPackageLoaded{arabi}{\ArabiCoreLoaded}}
+\@onlypreamble\caption@IfBabelArabi
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@ifbabel@arabi{true}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfBabelArabi{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@rl}
+% \changes{v1.8}{2018/05/20}{This macro added}
+% \begin{macrocode}
+ \newcommand\caption@rl[1]{\if@rl\textRL{#1}\else\textLR{#1}\fi}%
+% \end{macrocode}
+% \end{macro}
+%
+% If the language `arabic' or `farsi' is selected, we switch the default label separator to `arabi'.
+%
+% \begin{macrocode}
+ \caption@ifdefined\extrasarabic{%
+ \addto\extrasarabic{%
+ \caption@switchdefault{labelseparator}{\babel@save #1}{arabi}}}{}%
+ \caption@ifdefined\extrasfarsi{%
+ \addto\extrasfarsi{%
+ \caption@switchdefault{labelseparator}{\babel@save #1}{arabi}}}{}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{%
+ \let\caption@rl\@firstofone
+}
+% \end{macrocode}
+%
+% \subsection{The babel-french package}
+% \changes{v1.1}{2006/05/14}{\package{frenchb} babel support added}
+% \changes{v2.0}{2020/08/01}{\package{french} babel support updated}
+%
+% We provide a `french' caption label separator.
+% |\caption@french@label|\-|separator| will be defined later on,
+% dependent on the `french' package used later on.
+%
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{french}{\caption@french@labelseparator}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@IfBabelFrench}
+% |\caption@IfBabelFrench|\marg{yes-code}\marg{no-code}
+% \begin{macrocode}
+\newcommand*\caption@IfBabelFrench{%
+ \caption@IfBabelPackageLoaded{french}{\FB@makecaption}}
+\@onlypreamble\caption@IfBabelFrench
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@ifbabel@french{true}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfBabelFrench{%
+% \end{macrocode}
+%
+% The \package{babel-french} package uses |\Caption|\-|Separator| as label separator.
+%
+% \begin{macrocode}
+ \providecommand\caption@french@labelseparator{\CaptionSeparator}%
+% \end{macrocode}
+%
+% Add a space before the label separator `colon' in French
+% in order to avoid problems when |Auto|\-|Space|\-|Punctuation| is set to |false|.
+%
+% \begin{macrocode}
+ \ifFB@active@punct
+ \DeclareCaptionLabelSeparator{colon}{%
+ \ifFBfrench\penalty\@M\FBcolonspace\fi : }%
+ \fi
+% \end{macrocode}
+%
+% We switch the default label separator to `french', dependant on the switches
+% |Customise|\-|Fig|\-|Tab|\-|Captions| and |Old|\-|Fig|\-|Tab|\-|Captions|.
+%
+% \begin{macrocode}
+ \ifFBOldFigTabCaptions
+ \caption@ifdefined\extrasfrench{%
+ \addto\extrasfrench{%
+ \caption@switchdefault{labelseparator}{\babel@save #1}{french}}}{}%
+ \caption@ifdefined\extrasacadian{%
+ \addto\extrasacadian{%
+ \caption@switchdefault{labelseparator}{\babel@save #1}{french}}}{}%
+ \else
+ \ifFBCustomiseFigTabCaptions
+ \caption@AtBeginDocument{%
+ \ifFB@mainlanguage@FR
+ \SetCaptionDefault{labelseparator}{french}%
+ \fi}%
+ \fi
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The frenchle \& frenchpro package}
+% \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added}
+% \changes{v2.0}{2020/08/01}{\package{frenchle/pro} package support updated}
+%
+% \begin{macro}{\caption@IfFrenchLe}
+% |\caption@IfFrenchLe|\marg{yes-code}\marg{no-code}
+% \begin{macrocode}
+\newcommand*\caption@IfFrenchLe{%
+ \caption@IfBabelPackageLoaded{frenchle}{\frenchTeXmods}}
+\@onlypreamble\caption@IfBabelFrenchLe
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@ifbabel@frenchle{true}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfFrenchLe{%
+% \end{macrocode}
+%
+% The \package{frenchle} package uses |\caption|\-|separator| plus |\space| as label separator.
+%
+% \begin{macrocode}
+ \providecommand\caption@french@labelseparator{\captionseparator\space}%
+% \end{macrocode}
+%
+% If the language `french' is selected, we switch the default label separator to `french',
+% and switch the default font to `it' and the default label font to `up'.
+%
+% \begin{macrocode}
+ \g@addto@macro\extrasfrench{%
+ \caption@switchdefault{labelseparator}{\let\caption@original@labelseparator#1}{french}%
+ \caption@switchdefault{font}{\let\caption@original@font#1}{it}%
+ \caption@switchdefault{labelfont}{\let\caption@original@labelfont#1}{up}}%
+ \g@addto@macro\extrasenglish{%
+ \caption@restoredefault{labelseparator}{\caption@original@labelseparator}%
+ \caption@restoredefault{font}{\caption@original@font}%
+ \caption@restoredefault{labelfont}{\caption@original@labelfont}}%
+% \end{macrocode}
+%
+% Since the \package{frenchle} package overwrites |\caption|\-|font| and |\caption|\-|label|\-|font|
+% (within |\GOfrench|) we need to save them beforehand and restore them afterwards.
+%
+% \begin{macrocode}
+ \caption@AtBeginDocument{%
+ \let\captionfont@original\captionfont
+ \let\captionlabelfont@original\captionlabelfont}%
+ \g@addto@macro\GOfrench{%
+ \let\captionfont\captionfont@original
+ \let\captionlabelfont\captionlabelfont@original}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The babel-hungarian package}
+% \changes{v1.3}{2009/03/29}{\package{magyar} babel support added}
+% \changes{v1.3a}{2011/08/12}{\package{magyar} babel support revised}
+% \changes{v1.8b}{2018/08/26}{\package{magyar} babel support revised}
+% \changes{v2.0}{2020/08/03}{\package{magyar} babel support updated}
+%
+% \begin{macrocode}
+\DeclareCaptionLabelFormat{magyar}{#2\bothIfSecond{.~}{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@IfBabelHungarian}
+% |\caption@IfBabelHungarian|\marg{yes-code}\marg{no-code}
+% \begin{macrocode}
+\newcommand*\caption@IfBabelHungarian{%
+ \caption@IfBabelPackageLoaded{hungarian}{\magyar@opt@defaults}}
+\@onlypreamble\caption@IfBabelHungarian
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@ifbabel@hungarian{true}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfBabelHungarian{%
+% \end{macrocode}
+%
+% If the language `hungarian' or `magyar' is selected,
+% we switch the default label format to `magyar', the default separator to `period',
+% and the default list format to `subperiod'.
+%
+% \begin{macrocode}
+ \caption@ifdefined\extrashungarian{%
+ \addto\extrashungarian{%
+ \caption@switchdefault{labelformat}{\babel@save #1}{magyar}%
+ \caption@switchdefault{labelseparator}{\babel@save #1}{period}%
+ \caption@switchdefault{listformat}{\babel@save #1}{subperiod}}}{}%
+ \caption@ifdefined\extrasmagyar{%
+ \addto\extrasmagyar{%
+ \caption@switchdefault{labelformat}{\babel@save #1}{magyar}%
+ \caption@switchdefault{labelseparator}{\babel@save #1}{period}%
+ \caption@switchdefault{listformat}{\babel@save #1}{subperiod}}}{}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \subsection{The latvian babel option}
+%
+% \begin{macrocode}
+\DeclareCaptionLabelFormat{latvian}{#2\bothIfSecond{~}{#1}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@IfBabelLatvian}
+% |\caption@IfBabelLatvian|\marg{yes-code}\marg{no-code}
+% \begin{macrocode}
+\newcommand*\caption@IfBabelLatvian{%
+ \caption@IfBabelPackageLoaded{latvian}{\bbl@latvianindent}}
+\@onlypreamble\caption@IfBabelLatvian
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@ifbabel@latvian{true}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\caption@IfBabelLatvian{%
+% \end{macrocode}
+%
+% If the language `latvian' is selected, we switch the default label format to `latvian'.
+%
+% \begin{macrocode}
+ \caption@ifdefined\extraslatvian{%
+ \addto\extraslatvian{%
+ \caption@switchdefault{labelformat}{\babel@save #1}{latvian}}}{}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}{}
+% \end{macrocode}
+%
+% \section{Package support}
+%
+% \begin{macro}{\caption@ifpackageloaded}
+% \changes{v2.0}{2020/07/26}{This macro added}
+% |\caption@ifpackageloaded|\marg{package}\marg{yes-code}\marg{no-code}\\
+% expands the given code if the given package is (not) loaded.
+% (Note: We cannot use |\@if|\-|package|\-|loaded| here since it's not
+% available after |\At|\-|Begin|\-|Document|.)
+% \begin{macrocode}
+\newcommand*\caption@ifpackageloaded[1]{%
+ \expandafter\ifx\csname ver@#1.\caption@pkgextension\endcsname\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@pkgextension\@pkgextension
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@pkg@list}
+% \changes{v1.4b}{2012/01/12}{This macro added}
+% We used this in the past as list of packages loaded
+% |\At|\-|Begin|\-|Document|.
+% (Note: Old |.aux| files could contain
+% |\@cons|\-|\caption@pkg@list|\-|{{|\meta{package}|}}|,
+% so this macro should always be defined, even if we don't use it anymore.)
+% \begin{macrocode}
+\newcommand*\caption@pkg@list{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@requirepackage}
+% \changes{v1.10}{2020/05/10}{This macro added}
+% \changes{v2.0}{2020/07/27}{This macro revised}
+% |\caption@requirepackage|\marg{package}\marg{option}\marg{value}\\
+% indicates that the given package option needs a package.
+% \begin{macrocode}
+\newcommand*\caption@requirepackage[2]{%
+ \caption@ifpackageloaded{#1}{}{\caption@@requirepackage{#1}{#2}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@requirepackage[2]{%
+ \@cons\caption@packagelist{{#1}{#2}}} % load package later on
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \renewcommand*\caption@@requirepackage[2]{%
+ \caption@Error{Option `#2' requires the `#1' package}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@packagelist}
+% \changes{v1.11}{2020/05/10}{This macro added}
+% We use this as list of packages loaded |\At|\-|Begin|\-|Document|.
+% \begin{macrocode}
+\newcommand*\caption@packagelist{}
+\@onlypreamble\caption@packagelist
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\caption@tempa{\endgroup}%
+ \begingroup
+ \def\@elt#1#2{%
+ \g@addto@macro\caption@tempa{%
+ \caption@loadpackage{#1}{#2}}}%
+ \caption@packagelist
+ \caption@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@loadpackage}
+% \changes{v1.11}{2020/05/10}{This macro added}
+% \changes{v2.0}{2020/07/26}{This macro revised}
+% |\caption@loadpackage|\marg{package}\marg{option}\marg{value}\\
+% loads the given package immediately.
+% \begin{macrocode}
+\newcommand*\caption@loadpackage[2]{%
+ \caption@ifpackageloaded{#1}{}{\caption@@loadpackage{#1}{#2}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@loadpackage[2]{%
+ \caption@Info{Option `#2' requires the `#1' package}%
+ \RequirePackage{#1}\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \let\caption@@loadpackage\caption@@requirepackage}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{The newfloat package}
+%
+% \begin{macro}{\caption@newfloat}
+% \changes{v1.4b}{2012/01/12}{This macro added}
+% \changes{v1.8h}{2020/01/03}{Usage of \cs{caption@ifpackageloaded} replaced by \cs{RequirePackage}}
+% \changes{v1.11}{2020/05/10}{Usage of \cs{RequirePackage} replaced by \cs{caption@usepackage}}
+% \changes{v2.0}{2020/07/27}{This macro revised}
+% |\caption@newfloat|\marg{option}\marg{value}\marg{code}\\
+% loads the \package{newfloat} package and executes the given code afterwards.
+% (Note: Since the package might use the crappy \package{keyval}
+% package, too, we need to save \& restore some macros here, otherwise this
+% recursion won't work properly.)
+% \begin{macrocode}
+\newcommand*\caption@newfloat[2]{%
+ \IfCaptionOptionCheck
+ {\caption@requirepackage{newfloat}{#1}}%
+ {\let\KV@prefix@ORI\KV@prefix
+ \let\@tempc@ORI\@tempc
+ \caption@loadpackage{newfloat}{#1}%
+ #2%
+ \let\@tempc\@tempc@ORI
+ \let\KV@prefix\KV@prefix@ORI}}
+% \end{macro}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.0c}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
+% \changes{v1.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written}
+% \changes{v1.2}{2007/11/18}{Option \opt{name} added}
+% \begin{macrocode}
+\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}}
+\@onlypreamble@key{caption}{figurename}
+\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}}
+\@onlypreamble@key{caption}{tablename}
+% \end{macrocode}
+%
+% \changes{v1.2a}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added}
+% \begin{macrocode}
+\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}}
+\@onlypreamble@key{caption}{listfigurename}
+\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}}
+\@onlypreamble@key{caption}{listtablename}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@SetName}
+% \changes{v1.1}{2007/07/04}{This macro added}
+% \changes{v1.2}{2007/11/18}{After-preamble variant added}
+% \changes{v1.2a}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}}
+% \changes{v1.2b}{2008/08/02}{Bugfix: Works now without \cs{addto}, too}
+% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package}
+% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now}
+% |\caption@SetName|\marg{float}\marg{name}\\
+% loads the \package{newfloat} package and uses |\newfloat@set|\-|name|.
+% \begin{macrocode}
+\newcommand*\caption@SetName[2]{%
+ \caption@newfloat{#1name}{\newfloat@setname{#1}{#2}}}
+\@onlypreamble\caption@SetName
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{name}{%
+ \IfCaptionOptionCheck{}{\caption@setname\@captype{#1}}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@setname}
+% |\caption@setname|\marg{float}\marg{name}\\
+% sets the given float name, e.g.: `Figure` for `figure`.
+% \begin{macrocode}
+\newcommand*\caption@setname[2]{%
+ \@namedef{#1name}{#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added}
+% \changes{v1.2e}{2010/01/09}{The \opt{within} options are now available within the document, too}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{figurewithin}{\caption@within{figure}{#1}}
+\DeclareCaptionOptionNoValue{figurewithout}{\caption@within{figure}{none}}
+\DeclareCaptionOption{tablewithin}{\caption@within{table}{#1}}
+\DeclareCaptionOptionNoValue{tablewithout}{\caption@within{table}{none}}
+% \end{macrocode}
+%
+% \begin{macro}{\caption@within}
+% \changes{v1.2}{2007/12/21}{This macro added}
+% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package}
+% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now}
+% |\caption@within|\marg{float}\marg{value}\\
+% loads the \package{newfloat} package and uses |\newfloat@set|\-|within|.
+% \begin{macrocode}
+\newcommand*\caption@within[2]{%
+ \caption@newfloat{#1within=#2}{\newfloat@setwithin{#1}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.2b}{2008/04/13}{Option \opt{within} added}
+% \changes{v1.2e}{2010/01/09}{The global \opt{within} option will now affect user-defined floats declared with \cs{DeclareCaptionType}, too}
+%
+% \begin{macrocode}
+\DeclareCaptionOption{within}{%
+ \caption@newfloat{within=#1}{\newfloatsetup{within=#1}}}
+\DeclareCaptionOptionNoValue{without}{%
+ \caption@newfloat{without}{\newfloatsetup{without}}}
+% \end{macrocode}
+%
+% \subsection{The ragged2e package}
+% \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support}
+% \changes{v1.8h}{2020/01/03}{Revised \package{ragged2e} package support}
+% \changes{v1.9}{2020/05/05}{Enhanced \package{ragged2e} package support}
+% \changes{v1.10}{2020/05/10}{Revised \package{ragged2e} package support}
+%
+% We support the upper-case commands offered by the \package{ragged2e}
+% package.
+% \begin{macrocode}
+\DeclareCaptionJustification[ragged2e]{Justified}{\justifying}
+\DeclareCaptionJustification[ragged2e]{Centering}{\Centering}
+\DeclareCaptionJustification[ragged2e]{RaggedLeft}{\RaggedLeft}
+\DeclareCaptionJustification[ragged2e]{RaggedRight}{\RaggedRight}
+% \end{macrocode}
+%
+% \subsection{The sansmath package}
+% \changes{v1.3}{2011/01/01}{\package{sansmath} package support added}
+% \changes{v1.10}{2020/05/10}{\package{sansmath} package support revised}
+%
+% \begin{macrocode}
+\DeclareCaptionFont[sansmath]{sansmath}{\sansmath}
+% \end{macrocode}
+%
+% \subsection{The setspace package}
+% \changes{v1.0n}{2007/04/02}{\package{setspace} package support added}
+% \changes{v1.2d}{2009/10/09}{\package{setspace} package support revised}
+%
+% \begin{macrocode}
+\DeclareCaptionFont{singlespacing}{%
+ \caption@ifdefined\setspace@singlespace{%
+ \setstretch\setspace@singlespace}{}}% normally 1
+\DeclareCaptionFont[setspace]{onehalfspacing}{\onehalfspacing}
+\DeclareCaptionFont[setspace]{doublespacing}{\doublespacing}
+\DeclareCaptionFont[setspace]{stretch}{\setstretch{#1}}
+% \end{macrocode}
+%
+% \subsection{The subfig package}
+% \changes{v1.1}{2007/07/07}{Adaptions to the \package{subfig} package added}
+% \changes{v1.4a}{2011/11/01}{Test for the \package{subfig} package revised}
+% \changes{v2.0a}{2020/09/07}{Re-definition of \cs{sf@ifpositiontop} added}
+%
+% Since the \package{subfig} package is not maintained anymore,
+% we have to make adaptions to \thispackage~\version{1.1} here.
+% Please note that we only support the version $1.3$ of the \package{subfig} package,
+% so older versions do not work with this version of \thispackage, and newer
+% versions are expected to be adapted.
+%
+% \begin{macrocode}
+\caption@AtBeginDocument{%
+ \def\@tempa{2005/06/28 ver: 1.3 subfig package}%
+ \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa
+ \caption@InfoNoLine{subfig package v1.3 is loaded}%
+% \end{macrocode}
+% \begin{macrocode}
+ \def\caption@eh{\caption@@eh{subfig}}%
+ \let\caption@setfloattype\@gobble
+ \let\@dottedxxxline\sf@NEW@dottedxxxline
+ \let\sf@subfloat\sf@NEW@subfloat
+ \let\sf@ifpositiontop\caption@iftop
+% \end{macrocode}
+% \begin{macrocode}
+ \fi
+ \let\sf@NEW@dottedxxxline\@undefined
+ \let\sf@NEW@subfloat\@undefined}
+% \end{macrocode}
+%
+% \begin{macro}{\@dottedxxxline}
+% New version of |\@dottedxxxline|
+% \begin{macrocode}
+\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{%
+ \begingroup
+ \caption@setfloattype{#1}%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub#1}%
+ \ifnum #3>\@nameuse{c@#2depth}\else
+ \@dottedtocline{\z@}{#4}{#5}{#6}{#7}%
+ \fi
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sf@subfloat}
+% \changes{v1.4b}{2011/12/29}{Bugfix 11-12-23: Usage of \cs{caption@warmup} added}
+% New version of |\sf@subfloat|
+% \begin{macrocode}
+\def\sf@NEW@subfloat{%
+ \begingroup
+ \@nameuse{caption@warmup}%
+ \caption@setfloattype\@captype
+ \sf@ifpositiontop{%
+ \maincaptiontoptrue
+ }{%
+ \maincaptiontopfalse
+ }%
+ \caption@setoptions{subfloat}%
+ \caption@setoptions{sub\@captype}%
+ \let\sf@oldlabel=\label
+ \let\label=\subfloat@label
+ \ifmaincaptiontop\else
+ \advance\@nameuse{c@\@captype}\@ne\relax
+ \fi
+ \refstepcounter{sub\@captype}%
+ \setcounter{sub\@captype @save}{\value{sub\@captype}}%
+ \@ifnextchar [% %] match left bracket
+ {\sf@@subfloat}%
+ {\sf@@subfloat[\@empty]}}
+% \end{macrocode}
+% \end{macro}
+%
+% Make the \package{subfig} package documentation compile.
+% \begin{macrocode}
+\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}}
+\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}}
+% \end{macrocode}
+%
+% \section{Making an `List of' entry}
+%
+% \begin{macro}{\caption@addcontentsline}
+% \changes{v1.1}{2007/07/01}{This macro added}
+% \changes{v1.3}{2010/10/26}{Error check added}
+% \changes{v1.3}{2011/06/24}{Split into two macros}
+% \changes{v1.4}{2011/08/19}{Split into three macros}
+% \changes{v1.4}{2011/08/30}{Support for option \opt{listtype=} added}
+% \changes{v1.5}{2012/01/15}{Usage of \cs{caption@addsubcontentslines} added}
+% \changes{v1.7}{2015/09/15}{Argument \#3 which holds the environment name added to \cs{caption@lstfmt}}
+% \changes{v1.7}{2015/09/20}{Unfortunately \package{subfig} defines and uses \cs{caption@lstfmt} as well, so I replaced the third argument with \cs{captionlisttype}}
+% \changes{v1.8}{2018/09/06}{Adapted to the \package{chkfloat} package}
+% |\caption@addcontentsline|\marg{type}\marg{list entry}\\
+% makes an entry in the list-of-whatever, if requested, i.e.~the argument
+% \meta{list entry} is not empty and |list|\-|of=| was set to |true|.
+% \begin{macrocode}
+\newcommand\caption@addcontentsline[2]{%
+ \caption@ifcontentsline{#2}{%
+ \begingroup
+ \let\@tempa\@gobble
+ \caption@ifdefined\caption@listtype
+ {\let\@tempa\@firstofone}%
+ {\edef\caption@listtype{#1}}%
+ \caption@ifdefined\caption@listtype@ext
+ {\edef\caption@listtype{\caption@listtype\caption@listtype@ext}%
+ \let\@tempa\@firstofone}%
+ {}%
+ \@tempa
+ {\caption@Debug{addcontentsline: #1 => \caption@listtype}%
+% \caption@setoptions\caption@listtype
+ \@namedef{the\caption@listtype}{\@nameuse{the#1}}}%
+ \expandafter\caption@@addcontentsline\expandafter{\caption@listtype}{#2}%
+ \endgroup}%
+ \caption@addsubcontentslines{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@addcontentsline[2]{%
+ {\let\\\space
+ \@ifundefined{ext@#1}%
+ {\caption@Error{No float type '#1' defined}}%
+ {\def\captionlisttype{#1}%
+ \caption@add@contentsline
+ {\csname ext@#1\endcsname}%
+ {#1}%
+ {\caption@listformat{\@nameuse{p@#1}}{\@nameuse{the#1}}}%
+ {\ignorespaces #2}%
+ \caption@chkfloat{#1}{#2}}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@add@contentsline{%
+ \caption@@@addcontentsline}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@addcontentsline[4]{%
+% \caption@ifdefined\main@Arabi@language
+% {\addtocontents{#1}{\xstring\select@language{\main@Arabi@language}}}{}%
+ \addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@chkfloat\@gobbletwo
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@ifcontentsline[1]{%
+ \caption@iflist
+ {\def\@tempa{#1}}%
+ {\let\@tempa\@empty}%
+ \ifx\@tempa\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@addsubcontentslines[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Typesetting the caption}
+%
+% \begin{macro}{\ifcaption@star}
+% If the starred form of |\caption| is used, this will be set to |true|.
+% (It will be reset to |false| at the end of |\caption@@make|.)
+% \begin{macrocode}
+\newif\ifcaption@star
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@aboveskip}
+% \begin{macro}{\caption@belowskip}
+% \changes{v2.0}{2020/08/23}{This macro moved from package to kernel}
+% |\caption@aboveskip| and |\caption@belowskip|\\
+% typeset the skip above resp.~below the caption.
+% \begin{macrocode}
+\newcommand*\caption@aboveskip{%
+ \vskip\abovecaptionskip}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@belowskip{%
+ \vskip\belowcaptionskip}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\caption@fnum}
+% \changes{v1.1}{2007/08/21}{This macro added}
+% \changes{v2.0}{2020/08/03}{The original definition will be stored in \cs{caption@original@fnum}}
+% |\caption@fnum|\marg{float type}\\
+% typesets the caption label; this acts as replacement for |\fnum@|\meta{float type}.
+% \begin{macrocode}
+\newcommand*\caption@fnum[1]{%
+ \expandafter\let\expandafter\caption@original@fnum\csname caption@fnum@#1\endcsname % for label format `original'
+ \caption@labelformat{\@nameuse{#1name}}{\@nameuse{the#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@make}
+% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\\
+% typesets the caption.
+% \begin{macrocode}
+\newcommand\caption@make[2]{\caption@@make{\caption@labelformat{#1}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@make}
+% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of \cs{captionmargin} resp. \cs{captionwidth}; check for \cs{z@} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end of caption added}
+% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
+% \changes{v1.0c}{2005/02/12}{Single-line-check moved up so it can affect margins now}
+% \changes{v1.0c}{2005/02/09}{Improvement: \cs{caption@ifhmode} added}
+% \changes{v1.0c}{2005/02/09}{Bugfix: \cs{leavevmode} added}
+% \changes{v1.0f}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
+% \changes{v1.0g}{2005/12/04}{Uses \cs{caption@slc} now}
+% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside single-line-check replaced by \cs{relax}}
+% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be typeset in horizontal mode}
+% \changes{v1.0i}{2006/05/13}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox}}
+% \changes{v1.0j}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v1.0h, re-added}
+% \changes{v1.0n}{2007/04/03}{Usage of \cs{caption@ifoddpage} added}
+% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} moved below single-line-check}
+% \changes{v1.1e}{2007/10/28}{\cs{caption@stepcounter} added}
+% \changes{v1.5}{2012/03/15}{Uses \cs{caption@tempdima} instead of \cs{@tempdima}}
+% \changes{v1.5}{2012/12/26}{max-margin stuff moved to \cs{caption@calcmargin}}
+% \changes{v1.6}{2013/05/01}{Usage of \cs{caption@box} added}
+% \changes{v1.7}{2016/01/31}{Adapted to the \package{bicaption} package}
+% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}}
+% |\caption@@make|\marg{caption label}\marg{caption text}
+% \begin{macrocode}
+\newcommand\caption@@make[2]{%
+ \begingroup
+ \caption@@make@{#1}{#2}%
+ \endgroup
+ \caption@@make@epilogue}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@make@[2]{%
+ \caption@stepthecounter
+ \caption@beginhook
+% \end{macrocode}
+% Typeset the outer box |\caption@box|
+% \begin{macrocode}
+ \caption@box\hsize{%
+% \end{macrocode}
+% Special single-line treatment (option |singlelinecheck=|)
+% \begin{macrocode}
+ \caption@singlelinecheck{\caption@slc{#1}{#2}\caption@singleline\caption@multiline}{\caption@multiline}%
+% \end{macrocode}
+% Typeset the left margin (option |margin=|)
+% \begin{macrocode}
+ \caption@calcmargin
+ \caption@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{}{\advance\caption@tempdima\captionmargin@\relax}%
+ \fi
+ \caption@ifhmode{\advance\caption@tempdima\caption@indent\relax}%
+ \hspace\caption@tempdima
+% \end{macrocode}
+% We actually use a |\vbox| of width |\captionwidth - \caption@indent|
+% to typeset the caption.
+% \Note{\cs{captionindent} is \emph{not} supported if the caption format
+% was defined with \cs{DeclareCaptionFormat*}.}
+% \begin{macrocode}
+ \caption@tempdima\captionwidth
+ \caption@ifhmode{\advance\caption@tempdima-\caption@indent\relax}%
+ \caption@parbox\caption@tempdima{%
+% \end{macrocode}
+% Typeset the indention (option |indention=|)\\
+% {\small Bugfix 04-05-05:
+% |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots}
+% \begin{macrocode}
+ \caption@ifhmode{%
+ \ifdim\caption@indent=\z@
+ \leavevmode
+ \else
+ \hskip-\caption@indent
+ \fi}%
+% \end{macrocode}
+% Typeset the caption itself and close the |\caption@parbox|
+% \begin{macrocode}
+ \caption@@@make{#1}{#2}}%
+% \end{macrocode}
+% Typeset the right margin (option |margin=|)
+% \begin{macrocode}
+ \caption@tempdima\captionmargin
+ \ifdim\captionmargin@=\z@ \else
+ \caption@ifoddpage{\advance\caption@tempdima\captionmargin@\relax}{}%
+ \fi
+ \hspace\caption@tempdima
+% \end{macrocode}
+% Close the outer box |\caption@box|
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@endhook}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@@make@epilogue{%
+ \global\caption@starfalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@calcmargin}
+% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by \cs{ifdim}\cs{captionwidth=}\cs{z@}}
+% \changes{v1.0g}{2006/01/12}{Improvement: Takes care of list environment now}
+% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore), use \cs{linewidth} instead of \cs{hsize}}
+% \changes{v1.5}{2012/12/26}{max-margin stuff moved from \cs{caption@@make} to here}
+% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}}
+% |\caption@calcmargin|\\
+% calculates |\caption|\-|margin| and |\caption|\-|width|, so both contain
+% valid values.
+% \begin{macrocode}
+\newcommand*\caption@calcmargin{%
+ \caption@calcmargin@hook
+% \end{macrocode}
+% Check margin, if |\caption@min|\-|margin| or |\caption@max|\-|margin| is set
+% \begin{macrocode}
+ \ifx\caption@maxmargin\@undefined \else
+ \ifdim\captionmargin>\caption@maxmargin\relax
+ \captionmargin\caption@maxmargin\relax
+ \fi
+ \fi
+ \ifx\caption@minmargin\@undefined \else
+ \ifdim\captionmargin<\caption@minmargin\relax
+ \captionmargin\caption@minmargin\relax
+ \fi
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \ifdim\captionwidth=\z@
+ \captionwidth\hsize\relax
+ \advance\captionwidth by -2\captionmargin\relax
+ \advance\captionwidth by -\captionmargin@\relax
+ \else
+ \captionmargin\hsize\relax
+ \advance\captionmargin by -\captionwidth\relax
+ \divide\captionmargin by 2\relax
+ \captionmargin@\z@\relax
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@Debug{%
+ \string\hsize=\the\hsize,
+ \string\captionwidth=\the\captionwidth,\MessageBreak
+ \string\captionmargin=\the\captionmargin,
+ \string\captionmargin@=\the\captionmargin@}%
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@slc}
+% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@justification}\cs{relax} added}
+% \changes{v1.1}{2007/07/29}{\cs{caption@setup}\cs{caption@sls} added after \cs{begingroup}}
+% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} added}
+% \changes{v1.1c}{2007/10/14}{\cs{caption@setup}\cs{caption@opt@SingleLine} outsourced to \cs{caption@SingleLine}}
+% \changes{v1.3}{2010/09/04}{Split into \cs{caption@slc} and \cs{caption@@slc}}
+% \changes{v1.5}{2012/12/26}{Merged into a single macro again}
+% \changes{v1.5}{2013/04/14}{Usage of \cs{ifsinglelinecaption} added}
+% |\caption@slc|\marg{label}\marg{text}\marg{single-line-code}\marg{multi-line-code}\\
+% This one does the single-line-check.
+% \begin{macrocode}
+\newcommand\caption@slc[4]{%
+ \caption@Debug{Begin SLC}%
+ \singlelinecaptiontrue
+ \begingroup
+ \caption@singleline
+ \let\caption@justification\relax
+ \caption@calcmargin % calculate \captionwidth
+ \caption@prepareslc
+ \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
+ \ifdim\wd\@tempboxa>\captionwidth
+ \endgroup
+ \singlelinecaptionfalse
+ #4%
+ \else
+ \endgroup
+ #3%
+ \fi
+ \caption@Debug{End SLC}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifsinglelinecaption}
+% \changes{v1.5}{2013/04/14}{This definition added}
+% |\ifsinglelinecaption|\\
+% could be used inside own caption formats to test if the caption is
+% currently typeset as single-line caption (or not).
+% \begin{macrocode}
+\newif\ifsinglelinecaption
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@singleline}
+% \changes{v1.1c}{2007/10/14}{This macro extracted from \cs{caption@slc}}
+% \changes{v1.1c}{2007/10/14}{Support of \cs{caption@slfmt} added}
+% \changes{v1.1d}{2007/10/23}{This macro renamed from \cs{caption@SingleLine} to \cs{caption@singleline} for consistency}
+% |\caption@singleline|\\
+% prepares the typesetting of a single-line caption.
+% \begin{macrocode}
+\newcommand*\caption@singleline{%
+ \caption@xsetup\caption@slsty % Note: This could change \caption@format
+ \caption@format % defines \caption@ifhmode, \caption@slfmt, and \caption@fmt
+ \let\caption@fmt\caption@slfmt}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@multiline}
+% \changes{v2.0}{2020/07/28}{This macro added}
+% |\caption@multiline|\\
+% prepares the typesetting of a multi-line caption.
+% \begin{macrocode}
+\newcommand*\caption@multiline{%
+ \caption@format} % defines \caption@ifhmode, \caption@slfmt, and \caption@fmt
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@prepareslc}
+% \changes{v1.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
+% \changes{v1.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
+% \changes{v1.0c}{2005/02/12}{\cs{let}\cs{caption@justification}\cs{relax} added}
+% \changes{v1.0f}{2005/07/09}{Support of \package{endnotes} package added}
+% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@justification}\cs{relax} moved to \cs{caption@slc}}
+% \changes{v1.1}{2007/06/13}{Redefinition of \cs{(H@)refstepcounter} added}
+% \changes{v1.1}{2007/08/12}{Redefinition of \cs{label} improved}
+% \changes{v1.1c}{2007/10/06}{Definition of \cs{caption@l@stepcounter} added}
+% \changes{v1.3}{2011/07/07}{Bugfix 11-07-06: Redefinition of \cs{footnote} and \cs{footnotemark} added, redefinition of \cs{stepcounter} and \cs{refstepcounter} dropped}
+% \changes{v1.4a}{2011/10/22}{Redefinition of \cs{footnote} revised}
+% \changes{v1.5}{2013/04/13}{Redefinition os \cs{glsunset} added}
+% \changes{v1.8}{2018/01/21}{Redefinition of \cs{endnote} added (thanks to Markus Kohm)}
+% \changes{v1.8}{2018/05/16}{Redefinition of \cs{acused} added}
+% \changes{v1.8}{2018/05/26}{Definition method changed so it can be pre-defined by other packages}
+% \changes{v1.8}{2018/05/27}{Redefinition of \cs{hypertarget} added}
+% |\caption@prepareslc|\\
+% re-defines anything which could disturb the single-line-check.
+% \begin{macrocode}
+\providecommand*\caption@prepareslc{}
+\g@addto@macro\caption@prepareslc{%
+ \let\label\caption@gobble
+ \let\hypertarget\@gobbletwo
+% \end{macrocode}
+% We re-define \cs{footnote} so
+% \begin{enumerate}
+% \item The footnote counter will not be increased twice (but still the
+% correct footnote mark will be used within the single-line-check)
+% \item The footnote text will not be evaluated twice
+% \end{enumerate}
+% \begin{macrocode}
+ \let\caption@footnote@ORI\footnote
+ \def\footnote{\caption@withoptargs\caption@footnote}%
+ \let\caption@footnotemark@ORI\footnotemark
+ \def\footnotemark{\caption@withoptargs\caption@footnotemark}%
+ \let\caption@footnotetext@ORI\@footnotetext
+ \let\@footnotetext\caption@gobble
+% \end{macrocode}
+% Same for \cs{endnote}
+% \begin{macrocode}
+ \let\caption@endnote@ORI\endnote
+ \def\endnote{\caption@withoptargs\caption@endnote}%
+ \let\caption@endnotemark@ORI\endnotemark
+ \def\endnotemark{\caption@withoptargs\caption@endnotemark}%
+ \let\caption@endnotetext@ORI\@endnotetext
+ \let\@endnotetext\caption@gobble
+% \end{macrocode}
+% Adaption to the \package{acronym} package\par
+% See also \url{https://tex.stackexchange.com/questions/428788}
+% \begin{macrocode}
+ \let\acused\@gobble
+ \let\AC@placelabel\@gobble
+% \end{macrocode}
+% Adaption to the \package{glossaries} package.\par
+% Please note that while this adaption is usually sufficient
+% it could give incorrect measuring results if \cs{gls} is both used
+% for the very first time and more than once (for a particular acronym).
+% The alternative would be using internal macros of the
+% \package{glossaries} package which I would like to avoid.\par
+% See also \url{https://tex.stackexchange.com/questions/108368}
+% \begin{macrocode}
+ \let\glsunset\@gobble
+% \end{macrocode}
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@footnote[2]{%
+ \caption@footnotemark{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@footnotemark[1]{%
+ \begingroup
+ \let\stepcounter\caption@l@stepcounter
+ \caption@footnotemark@ORI#1\relax
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@endnote[2]{%
+ \caption@endnotemark{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@endnotemark[1]{%
+ \begingroup
+ \let\stepcounter\caption@l@stepcounter
+ \caption@endnotemark@ORI#1\relax
+ \endgroup}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@l@stepcounter[1]{%
+ \advance\csname c@#1\endcsname\@ne\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@applyfont}
+% \changes{v1.3}{2010/09/04}{This macro added}
+% |\caption@applyfont|\\
+% applies the relevant font settings, i.e. by default
+% the options set by |justification=|, |font=|, and |size=|.
+% \begin{macrocode}
+\newcommand*\caption@applyfont{%
+ \caption@justification\captionfont\captionsize}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@@make}
+% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
+% \changes{v1.0c}{2005/02/12}{Bugfix 04-12-16: Use some kind of \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
+% \changes{v1.0c}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
+% \changes{v1.0d}{2005/05/05}{Use \cs{caption@ifempty}; \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
+% \changes{v1.0d}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
+% \changes{v1.0f}{2005/08/24}{Check for empty label added}
+% \changes{v1.0f}{2005/08/25}{\cs{caption@iflf} added}
+% \changes{v1.0j}{2007/02/18}{Usage of \cs{caption@textformat} added}
+% \changes{v1.1}{2007/05/07}{Bugfix: \cs{ifhmode} added to \cs{@finalstrut}}
+% \changes{v1.2}{2007/11/17}{Made option \opt{size=} stronger than \opt{font=}}
+% \changes{v1.3}{2010/09/04}{Uses \cs{caption@applyfont} now}
+% \changes{v1.3}{2010/11/01}{Bugfix: If the caption text is empty, the text format will be set to \opt{simple} now}
+% \changes{v1.7}{2016/02/01}{Bugfix: \cs{relax} added before \cs{caption@lsep} so the label separator will not be gobbled if the label font command ignores spaces, e.g. by usage of \cs{color}}
+% \changes{v1.8}{2018/09/12}{\cs{par} replaced by \cs{caption@textend}}
+% \changes{v2.2c}{2020/10/10}{Usage of the label separators \opt{gobble} and \opt{gobbletwo} added}
+% \changes{v2.2e}{2020/10/21}{Adaptions to \package{floatrow} package added}
+% |\caption@@@make|\marg{caption label}\marg{caption text}\\
+% This one finally typesets the caption paragraph, without margin and indention.
+% \begin{macrocode}
+\newcommand\caption@@@make[2]{%
+% \end{macrocode}
+% The \package{floatrow} package uses |\caption@@@make|, too,
+% but without using |\caption@single|\-|line| or |\caption@multi|\-|line|.
+% For this reason we must expand |\caption@format| if |\caption@fmt| isn't defined yet.
+% Furthermore it uses |\caption@lfmt| as argument which was renamed to
+% |\caption@label|\-|format| in \package{caption3}\version{2.0}.
+% \begin{macrocode}
+ \ifx\caption@fmt\@undefined\caption@format\fi
+ \let\caption@lfmt\caption@labelformat
+% \end{macrocode}
+% If the label is empty, we use the label separator `none'.
+% Futhermore we use this check to determine if |#1| ends with either
+% |\@gobble|, |\@gobble|\-|two|, and/or |\ignore|\-|spaces|.
+% If yes, we use the corresponding label separator.
+% \begin{macrocode}
+ \global\def\caption@tempa{gobbletwo}%
+ \global\def\caption@tempb{}%
+ \sbox\@tempboxa{%
+ \let\caption@ignorespaces\ignorespaces
+ \def\ignorespaces{%
+ \global\def\caption@tempb{two}% "gobble" -> "gobbletwo" if \ignorespaces is used addtionally
+ \caption@ignorespaces}%
+ #1%
+ {\global\let\caption@tempa\@undefined\aftergroup\@gobble}%
+ {\global\def\caption@tempa{gobble\caption@tempb}}}%
+ \ifdim\wd\@tempboxa=\z@
+ \gdef\caption@tempa{none}%
+% \@capbreakfalse
+ \fi
+ \ifx\caption@tempa\@undefined \else
+ \@expandtwoargs\caption@set{labelseparator}{\caption@tempa}%
+ \fi
+% \end{macrocode}
+% If the text is empty, we use no caption label separator, too.
+% (And no text format either.)
+% \begin{macrocode}
+ \caption@ifempty{#2}{%
+ \caption@set{labelseparator}{none}%
+ \caption@set{textformat}{simple}%
+% \@capbreakfalse
+% \let\caption@ifstrut\@secondoftwo
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@labelseparator % defines \caption@iflabelfont, \caption@labelsep and \caption@labelsep@name (the latter is needed by \caption@fmt)
+% \end{macrocode}
+% Take care that |\caption@par|\-|indent| and |\caption@hang|\-|indent|
+% will be used to typeset the paragraph.
+% \begin{macrocode}
+ \@setpar{\@@par\caption@@par}\caption@@par
+% \end{macrocode}
+% Finally typeset the caption.
+% \begin{macrocode}
+ \caption@applyfont
+ \caption@fmt
+ {\ifcaption@star\else
+ \begingroup
+ \captionlabelfont
+ #1\relax\relax
+ \endgroup
+ \fi}%
+ {\ifcaption@star\else
+ \begingroup
+ \caption@iflabelfont\captionlabelfont
+ \relax\caption@labelsep
+ \endgroup
+ \fi}%
+ {{\captiontextfont
+ \caption@textstart
+ \caption@ifstrut
+ {\vrule\@height\ht\strutbox\@width\z@}%
+ {}%
+ \nobreak\hskip\z@skip % enable hyphenation
+ \caption@textformat{#2}%
+% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
+ \caption@ifstrut
+ {\ifhmode\@finalstrut\strutbox\fi}%
+ {}%
+ \caption@textend}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@textstart{}
+\newcommand*\caption@textend{\par}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifempty}
+% \changes{v1.0d}{2005/05/05}{This macro added}
+% \changes{v1.1}{2007/07/04}{Re-defines itself now}
+% \changes{v1.2a}{2007/01/22}{Revised so \cs{label} will be detected, too}
+% \changes{v1.2b}{2008/08/02}{Revised so \cs{index} and \cs{glossary} will be detected, too}
+% |\caption@ifempty|\marg{text}\marg{yes-code}\\
+% tests if the \meta{text} is actually empty.
+% \Note{This will be done without expanding the text,
+% therefore this is far away from being bullet-proof.}
+% \Note{This macro is re-defining itself so only
+% the first test (in a group) will actually be done.}
+% \begin{macrocode}
+\newcommand\caption@ifempty[1]{%
+ \caption@if@empty{#1}%
+ \caption@ifempty\@unused}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@if@empty[1]{%
+ \def\caption@tempa{#1}%
+ \ifx\caption@tempa\@empty
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \expandafter\def\expandafter\caption@tempa\expandafter{%
+ \caption@car#1\caption@if@empty\caption@nil}%
+ \def\caption@tempb{\caption@if@empty}%
+ \ifx\caption@tempa\caption@tempb
+ \let\caption@ifempty\@secondoftwo
+ \else
+ \def\caption@tempb{\ignorespaces}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobble#1}%
+ \else
+ \def\caption@tempb{\label}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\index}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \def\caption@tempb{\glossary}%
+ \ifx\caption@tempa\caption@tempb
+ \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}%
+ \else
+ \let\caption@ifempty\@gobbletwo
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@@par}
+% \changes{v1.0f}{2005/08/22}{Made this definition global}
+% |\caption@@par|\\
+% will be expanded with every |\par| inside the caption.
+% \begin{macrocode}
+\newcommand*\caption@@par{%
+ \parindent\caption@parindent\hangindent\caption@hangindent}%
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Types \& sub-types}
+%
+% \begin{macro}{\DeclareCaptionType}
+% \changes{v1.1}{2007/08/12}{This macro added}
+% \changes{v1.1a}{2007/09/07}{Three optional arguments added}
+% \changes{v1.2}{2007/12/06}{Renamed from \cs{DeclareFloatingEnvironment} to \cs{DeclareCaptionType}}
+% \changes{v1.2}{2007/12/21}{Optional argument revised, uses key-value syntax now}
+% \changes{v1.2b}{2008/04/13}{Uses \cs{caption@within@default} now}
+% \changes{v1.2b}{2008/08/02}{Support of \cs{float@exts} and \cs{float@addtolists} added}
+% \changes{v1.2e}{2010/01/09}{Usage of \cs{caption@DeclareWithinOption} added}
+% \changes{v1.3}{2011/08/06}{Definition of \cs{listofXXXes} added}
+% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package}
+% |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name}\\
+% loads the \package{newfloat} package and uses |\Declare|\-|Floating|\-|Environment|.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionType{%
+ \caption@loadpackage{newfloat}{declare type}%
+ \DeclareFloatingEnvironment}
+\@onlypreamble\DeclareCaptionType
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ForEachCaptionType}
+% \changes{v1.4a}{2011/10/29}{This macro added}
+% \changes{v1.13}{2020/07/29}{Renamed from \cs{caption@ForEachType} to \cs{ForEachCaptionType} and starred variant added}
+% |\ForEachCaptionType*|\marg{code with \#1}\\
+% will execute the given code for each (known) floating environment.
+% The starred variant will only work for already existing environments,
+% i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment|
+% (offered by the \package{newfloat} package).
+% \begin{macrocode}
+\newcommand*\ForEachCaptionType{%
+ \@ifstar
+ {\caption@foreach@type\@gobble}%
+ {\caption@foreach@type\@iden}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@foreach@type[2]{%
+ \caption@ifdefined\ForEachFloatingEnvironment
+ {\ForEachFloatingEnvironment*{#2}}%
+ {\def\@elt##1{#2}%
+ \caption@ifdefined\c@figure\@elt\@gobble{figure}%
+ \caption@ifdefined\c@table\@elt\@gobble{table}%
+ \let\@elt\relax}%
+ #1{\newfloat@addtohook{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\newfloat@addtohook}
+% |\newfloat@addtohook|\marg{code with \#1}\\
+% adds code to the hook called in |\Declare|\-|Floating|\-|Environment|.\par
+% Note: We use |\provide|\-|command| instead of |\new|\-|command| here since the
+% exact same code is defined in the \package{newfloat} package.
+% \begin{macrocode}
+\providecommand\newfloat@addtohook[1]{%
+ \toks@=\expandafter{\newfloat@hook{##1}#1}%
+ \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%
+ \@tempa}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\newfloat@hook}
+% Hook used in |\Declare|\-|Floating|\-|Environment|.
+% \begin{macrocode}
+\providecommand*\newfloat@hook[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareCaptionSubType}
+% \changes{v1.2}{2007/11/16}{This macro added}
+% \changes{v1.2a}{2008/03/11}{Bugfix: \cs{subfigurename} will be defined now}
+% \changes{v1.2d}{2009/10/09}{Bugfix 08-10-01: Usage of \cs{caption@addtoreset} added}
+% \changes{v1.3}{2011/01/01}{\cs{@dottedlofline} will be defined \& used now}
+% \changes{v1.4}{2011/10/09}{Support of the titletoc package added}
+% \changes{v1.5}{2011/12/29}{Usage of \cs{caption@addtoreset} replaced by \cs{@addtoreset}}
+% \changes{v1.5}{2013/01/10}{Bugfix: Definition of autoref string corrected}
+% \changes{v1.6}{2013/06/17}{Bugfix: \cs{c@tocdepth} will be set (locally) now}
+% \changes{v1.8g}{2020/01/02}{Check revised if the sub-type is already defined or not}
+% \changes{v1.13}{2020/07/28}{Uses \cs{caption@l@addto@list} instead of \cs{@cons} now}
+% \changes{v1.13}{2020/07/29}{Usage of \cs{caption@subtype@hook} added}
+% \changes{v1.13}{2020/07/29}{We don't re-use existing counters anymore (This was a bad idea anyway)}
+% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\\
+% The starred variant provides the numbering format
+% \meta{type}|.|\meta{subtype} while the non-starred variant simply uses
+% \meta{subtype}.
+% \begin{macrocode}
+\newcommand*\DeclareCaptionSubType{%
+ \caption@teststar\caption@declaresubtype\@firstoftwo\@secondoftwo}
+\@onlypreamble\DeclareCaptionSubType
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declaresubtype[1]{%
+ \@testopt{\caption@@declaresubtype{#1}}{alph}}
+\@onlypreamble\caption@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@declaresubtype#1[#2]#3{%
+ \@ifundefined{c@#3}%
+ {\caption@Error{No float type '#3' defined}}%
+ {\caption@@@declaresubtype{#1}{#2}{#3}{sub#3}}}
+\@onlypreamble\caption@@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@declaresubtype[4]{%
+% \end{macrocode}
+% \begin{macrocode}
+% Check if the sub-type was already defined by |\Declare|\-|Sub|\-|Type|.
+% If not, define the counter and list entry.
+% \begin{macrocode}
+ \caption@ifsubtype{#4}%
+ {\caption@Debug{Modify subtype `#4'}}%
+ {\caption@Debug{New subtype `#4'}%
+ \newcounter{#4}[{#3}]%
+ \@namedef{ext@#4}{\csname ext@#3\endcsname}%
+ \caption@declaresublistentry{#3}%
+ \caption@l@addto@list\caption@subtypelist{#4}%
+ \caption@subtype@hook{#4}}%
+% \end{macrocode}
+% Support of \package{titletoc} package
+% \begin{macrocode}
+ \caption@ifdefined\contentsuse{%
+ \contentsuse{#4}{\csname ext@#4\endcsname}}{}%
+% \end{macrocode}
+% \begin{macrocode}
+ \@namedef{#4name}{}%
+ \@namedef{#4autorefname}{\csname #3autorefname\endcsname}%
+ #1% is \@firstoftwo in star form, and \@secondoftwo otherwise
+ {\@namedef{p@#4}{}%
+ \@namedef{the#4}{\csname the#3\endcsname.\@nameuse{#2}{#4}}}%
+ {\@namedef{p@#4}{\csname the#3\endcsname}%
+ \@namedef{the#4}{\@nameuse{#2}{#4}}}%
+ \@namedef{theH#4}{\csname theH#3\endcsname.\arabic{#4}}}
+% \end{macrocode}
+% \begin{macrocode}
+\@onlypreamble\caption@@@declaresubtype
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@declaresublistentry{%
+ \caption@ifdefined\l@chapter
+ {\caption@@declaresublistentry\l@subsection}%
+ {\caption@@declaresublistentry\l@subsubsection}}
+\@onlypreamble\caption@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@declaresublistentry[2]{%
+ \ifx#1\@undefined
+ \caption@@@declaresublistentry\relax\@dottedtocline\caption@nil{#2}%
+ \else
+ \expandafter\caption@@@declaresublistentry#1{}{}\@dottedtocline\caption@nil{#2}%
+ \fi}
+\@onlypreamble\caption@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\caption@@@declaresublistentry#1\@dottedtocline#2\caption@nil#3{%
+ \def\@tempa{#1}%
+% Does \l@(sub)subsection start with \@dottedtocline?
+ \ifx\@tempa\@empty
+% Yes
+ \caption@@@@declaresublistentry{#3}#2\caption@nil
+ \else
+% No
+ \caption@@@@declaresublistentry{#3}@{3.8em}{3.2em}\caption@nil
+ \fi}
+\@onlypreamble\caption@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\def\caption@@@@declaresublistentry#1#2#3#4#5\caption@nil{%
+ \expandafter\caption@@@@@declaresublistentry\expandafter
+ {\csname @dotted\csname ext@#1\endcsname line\endcsname}{#1}{#3}{#4}}
+\@onlypreamble\caption@@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@@declaresublistentry[4]{%
+ \@namedef{l@sub#2}{#1{2}{#3}{#4}}%
+ \expandafter\caption@@@@@@declaresublistentry
+ \expandafter#1\expandafter{\csname ext@#2\endcsname depth}}
+\@onlypreamble\caption@@@@@declaresublistentry
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@@@@@@declaresublistentry[2]{
+ \ifx#1\relax
+ \def#1##1{%
+ \def\next{\@dottedtocline{##1}}%
+ \@ifundefined{c@#2}{}{%
+ \ifnum ##1>\@nameuse{c@#2}\relax
+ \let\next\@gobblefour
+ \else
+ \c@tocdepth=\@nameuse{c@#2}\relax
+ \fi}%
+ \next}%
+ \fi}
+\@onlypreamble\caption@@@@@@declaresublistentry
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@subtypelist}
+% A list containing the sub-types defined with
+% |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% \begin{macrocode}
+\newcommand*\caption@subtypelist{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@ifsubtype}
+% \changes{v1.8g}{2020/01/02}{This macro added}
+% \changes{v1.13}{2020/07/28}{Uses \cs{caption@ifin@list} now}
+% |\caption@ifsubtype|\marg{yes-code}\marg{no-code}\\
+% checks if the given subtype was defined with
+% |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% \begin{macrocode}
+\newcommand*\caption@ifsubtype{%
+ \caption@ifin@list\caption@subtypelist}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ForEachCaptionSubType}
+% \changes{v1.13}{2020/07/29}{This macro added as replacement for \cs{caption@For}}
+% |\ForEachCaptionSubType*|\marg{code with \#1}\\
+% will execute the given code for each (known) sub-type.
+% The starred variant will only work for already existing sub-types,
+% i.e.~no hook will be placed inside |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% \begin{macrocode}
+\newcommand*\ForEachCaptionSubType{%
+ \@ifstar
+ {\caption@foreach@subtype\@gobble}%
+ {\caption@foreach@subtype\@iden}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\caption@foreach@subtype[2]{%
+ \caption@for@list\caption@subtypelist{#2}%
+ #1{\caption@addto@subtype@hook{#2}}}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand\caption@addto@subtype@hook[1]{%
+ \toks@=\expandafter{\caption@subtype@hook{##1}#1}%
+ \edef\@tempa{\def\noexpand\caption@subtype@hook####1{\the\toks@}}%
+ \@tempa}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@subtype@hook[1]{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@memresetsubcounter}
+% \changes{v1.5}{2013/05/01}{The macro \cs{caption@savesubcounters} added}
+% \changes{v1.13}{2020/07/28}{Uses \cs{caption@for@list} now for iterating the list}
+% \changes{v2.2b}{2020/10/06}{This stuff replaced by a patch of \cs{@memresetsubcounter}}
+% The \class{memoir} document class resets the \texttt{subfigure}
+% resp.~\texttt{subtable} counter at the begin of floating environments using
+% |\@mem|\-|reset|\-|sub|\-|counter|.
+% As a side-effect |\continued|\-|float| does not work correctly.
+% For that reason we need to patch |\@mem|\-|reset|\-|sub|\-|counter| here,
+% suppressing the counter reset if the counter was defined with
+% |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% \begin{macrocode}
+\caption@ifdefined\@memresetsubcounter
+ {\let\caption@memresetsubcounter\@memresetsubcounter
+ \renewcommand*\@memresetsubcounter[1]{%
+ \caption@ifsubtype{sub#1}\@gobble\caption@memresetsubcounter{#1}}}%
+ {}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Execution of options}
+%
+% \begin{macrocode}
+\ifx\caption@documentclass\@empty\else
+ \@pushfilename
+ \edef\@currname{caption-\caption@documentclass}
+ \edef\@currext{sto}
+ \InputIfFileExists
+ {\@currname.\@currext}%
+ {}%
+ {\@missingfileerror\@currname\@currext}%
+ \@popfilename
+\fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+\captionsetup{style=default,position=default,listformat=default}
+% \end{macrocode}
+% \begin{macrocode}
+\ProcessOptions*
+% \end{macrocode}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \clearpage
+% \begin{thebibliography}{99}
+% \bibitem{TLC2}
+% Frank Mittelbach and Michel Goossens:\\
+% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\
+% \newblock Addison-Wesley, 2004.
+%
+% \bibitem{Anne}
+% Anne Br\"uggemann-Klein:\\
+% \emph{Einf\"uhrung in die Dokumentverarbeitung},\\
+% B.G. Teubner, Stuttgart, 1989
+%
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/hyperref}%
+% {\emph{Hypertext marks in \LaTeX}},\\
+% November 12, 2007
+%
+% \bibitem{refcount}
+% Heiko Oberdiek:\\
+% \href{http://www.ctan.org/pkg/refcount}%
+% {\emph{The refcount package}},\\
+% 2006/02/20
+%
+% \bibitem{threeparttable}
+% Donald Arseneau:\\
+% \href{http://www.ctan.org/pkg/threeparttable}%
+% {\emph{Three part tables: title, tabular environment, notes}},\\
+% 2003/06/13
+% \end{thebibliography}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \clearpage
+% \Finale
+%
+\endinput