% \iffalse meta-comment
% 
% This is file `caption.dtx'.
% 
% Copyright (C) 1994-2023 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.
% 
% \fi
%
% \CheckSum{2925}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesFile{caption.drv}[2023/09/07 v3.6 The caption package]
%\errorcontextlines=3
%
\documentclass{captiondoc}
\hypersetup{pdfkeywords={LaTeX, package, caption}}
%
\usepackage[listof=false,hypcap=false]{caption}[2022/01/06]
%
\usepackage{graphicx,longtable}
%
% \ContinuedFloat
\DeclareCaptionLabelFormat{continued1}{Continued #1~#2}
\DeclareCaptionLabelFormat{continued2}{#1~#2\alph{ContinuedFloat}}
% \DeclareCaptionLabelFormat
\DeclareCaptionLabelFormat{bf-parens}{(\textbf{#2})}
% \DeclareCaptionStyle
\DeclareCaptionStyle{mystyle}[margin=5mm,justification=centering]%
                    {font=footnotesize,labelfont=sc,margin={10mm,0mm}}
% Example 1
\DeclareCaptionFormat{myformat1}{#1#2\\#3}
\newlength\myindention
\DeclareCaptionFormat{myformat2}{#1#2\\\hspace*\myindention#3}
\DeclareCaptionOption{myindention}{\setlength\myindention{#1}}
% Example 2
\DeclareCaptionFormat{reverse}{#3#2#1}
\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{~}#2)}
\DeclareCaptionLabelSeparator{fill}{\hfill}
% Example 3
\DeclareCaptionFormat{llap}{\llap{#1#2}#3\par}
\DeclareCaptionFormat{llapx}{\llap{\makebox[5em][l]{#1}}#3\par}
% Example 4
\DeclareCaptionLabelFormat{andtable}{#1~#2 \& \tablename~\thetable}
%
\begin{document}
  \DocInput{caption.dtx}
\end{document}
%</driver>
% \fi
%
% \iffalse
% ----------------------------------------------------------------------------------------------- %
% \fi
%
% \def\thispackage{the \pkg{caption} package}
% \def\Thispackage{The \pkg{caption} package}
%
% \def\x{\-}
%
% \newenvironment{Annotation}%
%   {\ifvmode\else\unskip\par\fi\pagebreak[2]%
%    \smallskip
%    \small(\ignorespaces}{\unskip)\par}
% \newenvironment{Annotation*}%
%   {\ifvmode\else\unskip\par\fi\pagebreak[2]%
%    \small(\ignorespaces}{\unskip)\par}
%
% \newenvironment{Example}%
%   {\ifvmode\else\unskip\par\fi\pagebreak[2]%
%    \minipage{\linewidth}\smallskip}%
%   {\smallskip\endminipage\par}
%
% \makeatletter
% \newcommand\example{\@ifstar
%   {\@example{belowskip=\abovecaptionskip}}%
%   {\@example{}}}
% \def\@example#1{%
%   \@testopt{\@@example{#1}}{figure}}
% \long\def\@@example#1[#2]#3#4{%
%   \begingroup
%     \captionsetup{#1,size=small,margin={\leftmargini,10pt},#3}%
%     \captionof{#2}[]{#4}%
%   \endgroup}
% \makeatother
%
% \newenvironment{Expert}%
%   {\ifvmode\else\unskip\par\fi\pagebreak[3]%
%    \smallskip
%    \footnotesize\ignorespaces}{\par}
% \newenvironment{Expert*}%
%   {\ifvmode\else\unskip\par\fi\pagebreak[3]%
%    \footnotesize\ignorespaces}{\par}
%
% \newenvironment{Note}[1][\DefaultNoteText]%
%   {\ifvmode\else\unskip\par\fi
%    \smallskip
%    \small\emph{#1:}~\ignorespaces}{\par}
% \newenvironment{Note*}[1][\DefaultNoteText]%
%   {\ifvmode\else\unskip\par\fi
%    \small\emph{#1:}~\ignorespaces}{\par}
% \newcommand*\DefaultNoteText{Note}
%
% \makeatletter
% \def\see{\@ifstar{\SEE\relax{see}}{\SEE\small{see}}}
% \def\See{\@ifstar{\SEE\relax{See}}{\SEE\small{See}}}
% \newcommand*\SEE[3]{\nopagebreak{#1(#2 #3)}}
% \newcommand*\SeeUserDefined[1][]{\See{\longref{declare}#1}}
% \makeatother
%
% \iffalse
% ----------------------------------------------------------------------------------------------- %
% \fi
%
% \GetFileInfo{caption.drv}
% \let\docdate\filedate
% \let\docversion\fileversion
% \GetFileInfo{caption.sty}
%
% \title{Customizing captions of floating environments%^^A
%         \texorpdfstring{\thanks{%^^A
%          This package has version number \docversion.}}%^^A
%        {}}
% \author{Axel Sommerfeldt\\
%         \url{https://gitlab.com/axelsommerfeldt/caption}}
% \date{\docdate}
% \maketitle
%
% \begin{abstract}
% \Thispackage\ offers customization of captions
% in floating environments such |figure| and |table| and cooperates with
% many other packages.
% \par\smallskip
% \textit{Please note:} Many document classes already have build-in options and
% commands for customizing captions.
% If these possibilities are sufficient for you, there is usually no need for
% you to use the \pkg{caption} package at all.
% And if you are only interested in using the command \cs{captionof}, loading of
% the very small \pkg{capt-of} package is usually sufficient.
% \end{abstract}
%
% \newcommand\shortexampletext{%
%   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.}
% \newcommand\exampletext{\shortexampletext\space
%   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\ document 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*{size=normalsize,margin=0pt}{\shortexampletext}
%
% There should be possibilities to change this; for example, it would be nice
% to 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*{size=small,margin=10pt,labelfont=bf,labelsep=endash}{\shortexampletext}
%
% 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.
%
% \bigskip
%
% \INFO\begin{minipage}[t]{\textwidth}
% \small
% Please note that \thispackage\ is only controlling the look \& feel of the
% captions. It does \emph{not} control the placement of the captions.
% (But you could do so by using other packages like the \pkg{floatrow}
%  package\cite{floatrow}.)
% \end{minipage}
%
% \medskip
%
% \INFO\begin{minipage}[t]{\textwidth}
% \small
% This documentation is outdated and is currently under revision.
% Progress could be tracked here:
% \url{https://gitlab.com/axelsommerfeldt/caption/-/commits/doc/caption}
% \end{minipage}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \tableofcontents
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Using this package}
% \label{usage}
%
% 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 |\document|\-|class| and |\begin{doc|\-|u|\-|ment}|.
% The options control how your captions will look like; e.g.,
% \begin{quote}
%   |\usepackage[margin=10pt,font=small,labelfont=bf,|\\
%   |            labelsep=endash]{caption}|%
%   %|[|\texttt{\filedate}|]|
% \end{quote}
% would result in captions looking like the second one in the introduction.
%
% \DescribeMacro{\captionsetup}
% For a later change of options \thispackage\ provides the command
% \begin{quote}
%   |\captionsetup|\oarg{float type}\marg{options}\quad.
% \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 |\caption|\-|setup| has an effect on the current
% environment only. So if you want to change settings for the
% current |figure| or |table| only, just place the |\caption|\-|setup| 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.
%
% \begin{Annotation}
% For a detailed description of |\caption|\-|setup| see \longref{captionsetup}.
% \end{Annotation}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Options}
% \label{options}
%
% \def\OptionLabel{RaggedRight}
% \def\UserDefined{\ldots}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \subsection{Formatting}
% \label{formats}
%
% \DescribeMacro{format=}
% A figure or table caption mainly consists 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:
% \begin{Options}{\OptionLabel}
%   \item[plain]%\NEWdescription{v3.0h}
%   Typesets the captions as a normal paragraph.
%
%   \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 |\Declare|\-|Caption|\-|Format|.\LineBreak
%   \SeeUserDefined
% \end{Options}
%
% \begin{Example}
%   An example: Specifying the option
%   \begin{quote}
%     |format=hang|
%   \end{quote}
%   yields captions like this:
%   \example{format=hang}{\exampletext}
% \end{Example}
%
% \pagebreak[3]
% \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}\quad.
% \end{quote}
%
% Two examples:
%
% \begin{Example}
%   \begin{quote}
%     |format=plain,indention=.5cm|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{format=plain,indention=.5cm}{\exampletext}
% \end{Example}
%
% \begin{Example}
%   \begin{quote}
%     |format=hang,indention=-0.5cm|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{format=hang,indention=-0.5cm}{\exampletext}
% \end{Example}
%
% \bigskip
%
% \pagebreak[3]
% \DescribeMacro{labelformat=}
% With the option
% \nopagebreak[3]
% \begin{quote}
%   |labelformat=|\meta{label format name}
% \end{quote}
% \nopagebreak[3]
% you specify how the caption label will be typeset.
% There are five standard caption label formats:
%
% \begin{Options}{\OptionLabel}
%   \item[original]
%   The caption label will be typeset as specified by the document class,
%   usually this means the name and the number (like \texttt{simple}).
%
%   Until \version{3.4} of \thispackage\ this label format was called `default'.
%   Since \version{3.5} it is called `original' and usually is the default label
%   format, so |label|\-|format=|\-|default| will still select this label format,
%   unless the default was changed by either a document class or babel language package.
%
%   \item[empty]
%   The caption label will be empty.
% \iffalse
%   (This option makes sense when used together with other options like
%    \texttt{labelsep=none}.)
% \fi
%
%   \item[simple]
%   The caption label will be typeset as a name and a number.
%
%   \item[brace]\NEWfeature{v3.1f}
%   The caption label will be closed with a single (right) brace.
%
%   \item[parens]
%   The number of the caption label will be typeset in parentheses.
%
%   \item[\UserDefined]
%   Own label formats can be defined using |\Declare|\-|Caption|\-|Label|\-|Format|.
%   \SeeUserDefined
% \end{Options}
%
% \begin{Example}
%   An example: Using the options
%   \begin{quote}
%     |format=plain,labelformat=parens,labelsep=quad|
%   \end{quote}
%   gives captions like this one:
%   \example{format=plain,labelformat=parens,labelsep=quad}{\exampletext}
% \end{Example}
%
% \medskip
%
% \begin{Note*}
% Some environments, e.g.~the |algorithm| environment offered by the
% \pkg{algorithm2e} package, might react allergic to a change of the
% caption label format.
% \end{Note*}
%
% \bigskip
%
% \pagebreak[3]
% \DescribeMacro{labelsep=}
% With the option
% \begin{quote}
%   |labelsep=|\meta{label separator name}
% \end{quote}
% you specify what caption separator will be used.\footnote{%
%   If the caption label or the caption text is empty,
%   no separator will be used.}
% You can choose one of the following:
%
% \begin{Options}{\OptionLabel}
%   \item[none]
%   There is no caption separator.
% \iffalse
%   (This option makes sense when used together with other options like
%    \texttt{labelformat=empty}.)
% \fi
%
%   \item[colon]
%   The caption label and text will be separated by a colon and a space.
%
%   \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 (|\\|).
%   Please note that this separator does not work with all caption
%   formats (e.g.~|format=|\x|hang|), and you'll get an error message
%   trying such combination of options.
%
%   \item[endash]\NEWfeature{v3.0h}
%   The caption label and text will be separated by an en-dash,
%   surrounded by spaces (\verb*| -- |).
%
%   \item[\UserDefined]
%   Own separators can be defined using |\Declare|\-|Caption|\-|Label|\-|Sep|\-|a|\-|ra|\-|tor|.
%   \SeeUserDefined
% \end{Options}
%
% Three examples:
% \begin{Example}
%   \begin{quote}
%     |format=plain,labelsep=period|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{format=plain,labelsep=period}{\exampletext}
% \end{Example}
%
% \begin{Example}
%   \begin{quote}
%     |format=plain,labelsep=newline,singlelinecheck=false|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{format=plain,labelsep=newline,singlelinecheck=false}{\exampletext}
% \end{Example}
%
% \begin{Example}
%   \begin{quote}
%     |format=plain,labelsep=endash|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{format=plain,labelsep=endash}{\exampletext}
% \end{Example}
%
% \bigskip
%
% \pagebreak[3]
% \DescribeMacro{textformat=}
% \NEWfeature*{v3.1}
% With the option
% \nopagebreak[3]
% \begin{quote}
%   |textformat=|\meta{text format name}
% \end{quote}
% \nopagebreak[3]
% you specify how the caption text will be typeset.
% There are two standard caption text formats:
%
% \begin{Options}{\OptionLabel}
%   \item[empty]
%   The caption text will be suppressed.
%
%   \item[simple]
%   The caption text will be typeset as it is.
%
%   \item[period]
%   The caption text will be followed by a period.
%
%   \item[\UserDefined]
%   Own text formats can be defined using |\Declare|\-|Caption|\-|Text|\-|Format|.
%   \SeeUserDefined
% \end{Options}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \PageBreak
% \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.
%
%   \item[centering]
%   Each line of the caption will be centered.
%
% \iffalse
%  \item[Centering]
% \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 \pkg{ragged2e} package.
% \else
%   \item[RaggedRight]
%   Each line of the caption will be moved to the left margin, too.
%   But this time the command |\RaggedRight| of the \pkg{ragged2e}
%   package will be used to achieve this.
%   The main difference to |raggedright| is that the word breaking
%   algorithm of \TeX\ will work inside captions.\footnote{%
%     The need for the \pkg{ragged2e} package will be detected at
%     run-time, therefore you maybe need a second \LaTeX\ run if this
%     option is used for the first time.}
% \fi
%
%   \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 \pkg{ragged2e} package.
% \fi
%
%   \item[\UserDefined]
%   Own justifications can be defined using |\Declare|\-|Caption|\-|Jus|\-|ti|\-|fi|\-|ca|\-|tion|.
%   \SeeUserDefined
% \end{Options}
%
% Three examples:
% \begin{Example}
%   \begin{quote}
%     |format=hang,justification=raggedright|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{format=hang,justification=raggedright}{\exampletext}
% \end{Example}
%
% \begin{Example}
%   \begin{quote}
%     |format=hang,justification=centerlast|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{format=hang,justification=centerlast}{\exampletext}
% \end{Example}
%
% \begin{Example}
%   \begin{quote}
%     |format=plain,labelsep=newline,justification=centering|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example*{format=plain,labelsep=newline,justification=centering}{\exampletext}
% \end{Example}
%
% \smallskip
%
% \PageBreak
% \DescribeMacro{singlelinecheck=}
% The standard \LaTeX\ document classes (\cls{article}, \cls{report}, and
% \cls{book}) automatically center a caption if it fits in one single line:
%
% \example*{}{A short caption.}
%
% \INFO
% \Thispackage\ adapts this behavior and therefore usually ignores the
% justification \& indention you have set with |justification=| \&
% |indention=| 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
%   \example*{singlelinecheck=false}{A short caption.}
% \endgroup
%
% 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 (|label|\-|font|) and at least one which only affects the
% caption text (|text|\-|font|).
% 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}
% where \meta{font options} is a list of comma separated font options.
%
% And these are the available font options:
%
% \begin{Options}{stretch=\meta{amount}}
%   \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}
% \end{Options}
% \vspace{0pt}\pagebreak[3]
% \begin{Options}{stretch=\meta{amount}}
%   \item[normalfont]   {\normalfont Normal shape \& series \& family}
%
%   \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}
% \end{Options}
% \vspace{0pt}\pagebreak[3]
% \begin{Options}{stretch=\meta{amount}}
%   \item[singlespacing]  Single spacing \See{\longref{setspace}}
%   \item[onehalfspacing] One-and-a-half spacing \See{\longref{setspace}}
%   \item[doublespacing]  Double spacing \See{\longref{setspace}}
%   \item[stretch=\meta{amount}] |\setstretch|\marg{amount} \See{\longref{setspace}}
% \end{Options}
% \vspace{0pt}\pagebreak[3]
% \begin{Options}{stretch=\meta{amount}}
%   \item[normalcolor]          |\normalcolor|
%   \item[color=\meta{colour}]  |\color|\marg{colour}
%        {\small(If the \pkg{color} or \pkg{xcolor} package is loaded,
%         see \longref{declare} for an example)}
% \end{Options}
% \vspace{0pt}\pagebreak[3]
% \begin{Options}{stretch=\meta{amount}}
%   \item[normal] The combination of the options |normal|\-|color|,
%                 |normal|\-|font|, |normal|\-|size|, and |single|\-|spacing|
%
%   \item[\UserDefined]
%   Own font options can be defined using |\Declare|\-|Caption|\-|Font|.
%   \SeeUserDefined
% \end{Options}
%
% If you use only one of these options you can omit the braces;
% e.g., the options
%   |font={small}|
% and
%   |font=small|
% will give the same result.
%
% Three examples:
% \begin{Example}
%   \begin{quote}
%     |font=it,labelfont=bf|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{font=it,labelfont=bf}{\exampletext}
% \end{Example}
%
% \begin{Example}
%   \begin{quote}
%     |labelfont=sc,textfont=it|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{labelfont=sc,textfont=it}{\exampletext}
% \end{Example}
%
% \begin{Example}
%   \begin{quote}
%     |font={small,stretch=0.80}|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{font={small,stretch=0.80}}{\exampletext}
% \end{Example}
%
% \medskip
%
% \pagebreak[3]
% \DescribeMacro{font+=}
% \DescribeMacro{labelfont+=}
% \DescribeMacro{textfont+=}
% \NEWfeature*{v3.1}
% You can also add font options to the current ones, so for example
% \begin{quote}
%   |\captionsetup{font=small}|\\
%   |\captionsetup{font+=it}|
% \end{quote}
% is identical to
% \begin{quote}
%   |\captionsetup{font={small,it}}|
% \end{quote}
%
% \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:~\footnote{Only fixed widths are supported here; if you are
% looking for a way to limit the width of the caption to the width of the
% figure or table, please take a look at the \pkg{floatrow}\cite{floatrow}
% or \pkg{threeparttable}\cite{threeparttable} package.}
% \begin{quote}\begin{tabular}{@{}r@{}ll}
%   |margin=| & \meta{amount} & \emph{--or--}\\
%   |margin=| & |{|\meta{left amount}|,|\meta{right amount}|}| & \emph{--or--}\\
%   |width=|  & \meta{amount} & \\
% \end{tabular}\end{quote}
% \NEWfeature{v3.1}
% If you specify just one \meta{amount} for the margin, it will be used for
% both, the left and right margin, e.g.~|margin=|\x|10pt| is equivalent to
% |margin=|\x|{10pt,10pt}|.
% In two-side documents the left and right margin will be swapped on even pages.
% \DescribeMacro{oneside}
% \DescribeMacro{twoside}
% To prevent this you can specify the option |oneside| additionally,
% e.g.~|\caption|\-|setup{margin=|\x|{0pt,10pt},|\x|oneside}|.\par
% But if you are specifying a width, then both, the left and the right margin,
% will have the same amount.
%
% Three examples will illustrating this:
% \begin{Example}
%   \begin{quote}
%     |margin=10pt|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{margin=10pt}{\exampletext}
% \end{Example}
%
% \begin{Example}
%   \begin{quote}
%     |margin={1cm,0cm}|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{margin={1cm,0cm}}{\exampletext}
% \end{Example}
%
% \begin{Example}
%   \begin{quote}
%     |width=.75\textwidth|
%   \end{quote}
%   \captionsetup{skip=0pt}
%   \example{width=.75\textwidth}{\exampletext}
% \end{Example}
%
% \begin{Note}
% When the caption is placed beside the contents (for example in a |SC|\-|figure|
% environment offered by the \pkg{sidecap} package\cite{sidecap}) or the
% figure is an in-text figure (for example in a |wrap|\-|figure| environment
% offered by the \pkg{wrapfig} package\cite{wrapfig}), the margin setting
% will be automatically reset to |0pt| at the very beginning of the environment.
% But if you really want to setup an extra margin for these environments, you can
% do so by setting this margin either inside the environment itself, of by
% specifying a margin for this particular environment,
% e.g.~|\caption|\-|setup[SC|\-|figure]{margin=|\x|10pt}|.
% \end{Note}
%
% \begin{Expert}
% \DescribeMacro{margin*=}
% \NEWfeature*{v3.1}
% There is also a starred variant of the |margin=| option, |margin*=|, which only
% changes the margin if no width was set.
% \end{Expert}
%
% \begin{Expert}
% \DescribeMacro{minmargin=}
% \DescribeMacro{maxmargin=}
% \NEWfeature*{v3.1}
% You can also set a minimum or maximum margin amount. This can be useful for
% limiting the margin amount in smaller environments, e.g.~|minipage|s.
% For example the \SmF\ document classes limit the margin amount to
% |maxmargin=|\x|0.1\linewidth|. (See \longref{SMF})
% \end{Expert}
%
% \medskip
%
% \pagebreak[3]
% \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{skip=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.\par
%     Second paragraph of the caption. This one contains some text, too, to
%     show how these options affect the layout of the caption.}
% \end{Example}
%
% \pagebreak[3]
% \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=|\meta{amount} 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{skip=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.\par
%     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{skip=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.\par
%     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{Note}
% If your caption contains more than one paragraph, you have
% to specify an alternative caption for the list-of-figures using the
% optional argument of |\caption| or |\caption|\-|of|, otherwise you will
% get an error message.
% \end{Note}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \PageBreak
% \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
% |\page|\-|style|;
% 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}
% \Thispackage\ pre-defines two styles: |base| and |default|.
%
% \NEWfeature{v3.1}
% The |base| style puts all options you already know about to values reflecting
% the look of the captions when using one of the base \LaTeX\ document classes
% \cls{article}, \cls{report}, and \cls{book}.
% This means that specifying the option
% \begin{quote}
%   |style=base|
% \end{quote}
% has the same effect as specifying all these options:
% \begin{quote}
%   |format=plain,labelformat=default,labelsep=colon,|\\
%   |justification=justified,font={},labelfont={},|\\
%   |textfont={},margin=0pt,indention=0pt|\\
%   |parindent=0pt,hangindent=0pt,singlelinecheck=true|
% \end{quote}
% \begin{Annotation*}
% But |justification=centering,indention=0pt| will be set if
% the caption fits into a single line.
% \end{Annotation*}
%
% In contrast the |default| style follows the default values, reflecting
% the look of the captions given by the document class you actually use.
% This style is selected by default and represents 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}
% \begin{Annotation*}
% But again |justification=centering,indention=0pt| will be set if
% the caption fits into a single line.
% \end{Annotation*}
%
% So if you use one of the base \LaTeX\ document classes \cls{article},
% \cls{report}, or \cls{book}, both caption styles, |base| and |default|,
% point to (nearly) the same settings.
%
% \begin{Note}
% Own caption styles can be defined using |\Declare|\-|Caption|\-|Style|.\LineBreak
% \SeeUserDefined
% \end{Note}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \subsection{Skips}
% \label{skips}
%
% \DescribeMacro{skip=}
% The vertical space between the caption and the figure or table contents is
% controlled by the option
% \begin{quote}
%   |skip=|\meta{amount}\quad.
% \end{quote}
% The standard \LaTeX\ document classes \cls{article}, \cls{report} and
% \cls{book} preset it to |skip=|\x|10pt|, but other document classes may
% use a different amount.
%
% \bigskip
%
% \pagebreak[3]
% \DescribeMacro{position=}
% The |\caption| command offered by \LaTeX{} has a design flaw:
% The command does not know if it stands on the beginning of the figure or
% table, or at the end. Therefore it does not know where to put the space
% separating the caption from the content of the figure or table.
% While the standard implementation always puts the space above the caption
% in floating environments (and inconsistently below the caption in
% |long|\-|table|s), the implementation offered by this package is more
% flexible:
% By giving the option
% \begin{quote}
%   |position=top|\quad or\quad |position=above|
% \end{quote}
% it's assumed that the caption is standing at the \emph{top} of the
% environment and therefore the space setup with |skip=|\x\meta{amount}
% is placed below the caption.
% (Please note that |position=|\x|top| does \emph{NOT} mean that the
% caption is actually placed at the top of the figure or table.
% Instead the caption is usually placed where you place the |\caption|
% command.)
% But with
% \begin{quote}
%   |position=bottom|\quad or\quad |position=below|
% \end{quote}
% it's assumed that the caption is standing at the \emph{bottom} of the
% environment and therefore the space is placed above the caption.
% And finally with
% \begin{quote}
%   |position=auto|\quad {\small(which is the default setting)}
% \end{quote}
% \thispackage\ tries its best to determine the actual position of
% the caption on its own. Please note that while this is successfully in
% most cases, it could give wrong results under rare circumstances.
%
% \medskip
%
% \pagebreak[3]
% \DescribeMacro{figureposition=}
% \DescribeMacro{tableposition=}
% The |position| option is especially useful when used together with the
% optional argument of the |\caption|\-|setup| command.
% \See{also \longref{captionsetup}}\par
% For example
% \begin{quote}
%   |\captionsetup[table]{position=above}|
% \end{quote}
% causes all captions within tables to be treated as captions \emph{above}
% the table (regarding spacing around it).
% Because this is a very common setting, \thispackage\ offers
% the abbreviating options |figure|\-|position=|\x\meta{pos} and
% |table|\-|position=|\x\meta{pos}, e.g.
% \begin{quote}
%   |\usepackage[|\ldots|,tableposition=top]{caption}|
% \end{quote}
% is equivalent to
% \begin{quote}
%   |\usepackage[|\ldots|]{caption}|\\
%   |\captionsetup[table]{position=top}|
% \end{quote}
%
% \medskip
%
% \INFO
% Please note that the options |skip=|, |position=|, |figure|\-|position=|,
% and |table|\-|position=| do not always have an effect.
% Since it's a matter of the document class to supply the environments
% |figure| and |table|, it could use its very own spacing, and could
% decide for itself if the caption will be typeset as ``top'' or ``bottom''
% caption.
% For example the \KOMAScript\ document classes support the |skip=|
% setting, but will always typeset |figure| captions as ``bottom'' captions,
% and |table| captions are dependent on the global option
% |table|\-|captions|\-|above| or |table|\-|captions|\-|below|.
% \See{\longref{KOMA}}
%
% Furthermore some packages control the behavior of the spacing above and
% below the caption for themself, e.g.~the \pkg{float}, the
% \pkg{floatrow}, and the \pkg{supertabular} package.
%
% \bigskip
%
% \begin{Expert*}
% Internally the skip between caption and contents is represented by
% |\above|\-|caption|\-|skip| (which is always set above the caption in
% \LaTeX{}s implementation).
% But there is a second value |\below|\-|caption|\-|skip| (usually set to
% |0pt| by default) which is set below the caption in \LaTeX{}s implementation,
% but on the other side than |\above|\-|caption|\-|skip| by this package.
% So technically speaking, this package swaps the meaning of these two skips
% when |position=|\x|top| is set.
% Please note that there are several packages around which do the same trick
% (like the \pkg{ftcap}, the \pkg{nonfloat}, and the \pkg{topcap}
% package), so the usage of the \pkg{caption} option |position=| is not
% supported if one of these packages will be used, too.
% \end{Expert*}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \subsection{Lists}
% \label{lists}
%
% \DescribeMacro{list=}
% \NEWfeature*{v3.1}
% The |\caption| command usually places an entry in the List of Figures
% or List of Tables. You can either suppress that individually by giving an
% empty optional argument to |\caption| {\small(see \longref{caption})}, or
% programmatically by saying
% \begin{quote}
%   |list=no|\quad(or any other boolean value instead of |no|)\quad.~\footnote{%
%   Please note that the \pkg{subfig} package\cite{subfig} is not supporting
%   this option, it uses the counters \texttt{lofdepth} \& \texttt{lotdepth} for
%   this purpose instead.}
% \end{quote}
%
% \pagebreak[3]
% \DescribeMacro{listformat=}
% \NEWfeature*{v3.1}
% With the option
% \nopagebreak[3]
% \begin{quote}
%   |listformat=|\meta{list format name}
% \end{quote}
% \nopagebreak[3]
% you can specify how the |figure| or |table| number will be typeset within
% the List of Figures or List of Tables.
% There are five standard caption list formats:
%
% \begin{Options}{\OptionLabel}
%   \item[empty]
%   No number will be typeset.
%
%   \item[simple]
%   The number will be typeset with label prefix.
%
%   \item[parens]
%   The number will be typeset in parentheses, with label prefix.
%
%   \item[subsimple]
%   Same as |simple|, but without label prefix. (default)
%
%   \item[subparens]
%   Same as |parens|, but without label prefix.
%
%   \item[\UserDefined]
%   Own list formats can be defined using |\Declare|\-|Caption|\-|List|\-|Format|.
%   \SeeUserDefined
% \end{Options}
%
% The prefix ($=$|\p@figure| or |\p@table|), which runs ahead of the
% number ($=$|\the|\-|figure| or |\the|\-|table|) in lists (e.g.~List of
% Figure/Table) and references, is usually empty,
% so the list formats |simple| and |subsimple| gives equal results;
% same with |parens| and |subparens|.
% But this can be different for sub-figures or sub-tables listed in the List of
% Figures or List of Tables, or when the label prefix is redefined for a
% different purpose.\footnote{%
%   Sub-figures and sub-tables can be typeset using the \pkg{subcaption}
%   or \pkg{subfig} package.}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \subsection{Names}
% \label{names}
%
% \DescribeMacro{name=}
% \NEWfeature*{v3.1}
% The option
% \begin{quote}
%   |name=|\meta{name}
% \end{quote}
% changes the name of the \emph{current} environment.
% This could be useful in conjunction with the optional argument of
% |\caption|\-|setup|, e.g.
% \begin{quote}
%   |\captionsetup[wrapfigure]{name=Fig.}|
% \end{quote}
% changes the name to ``Fig.'' for all |wrap|\-|figure|s (while all the other
% figure captions will still have ``Figure'' as name).
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \subsection{Types}
% \label{types}
%
% \DescribeMacro{type=}
% The |\caption| command can typeset captions for different types,
% e.g.~|figure| and |table|. If you try to use the |\caption| command outside
% these environments you will get an error message, because it does not know what
% kind of caption do you want to have here. But in such situations you can set
% the caption type manually with
% \begin{quote}
%   |type=|\meta{float type}
% \end{quote}
% prior to the usage of the |\caption| command (and other commands like
% |\Continued|\-|Float|, or |\sub|\-|caption|\-|box| offered by the
% \pkg{subcaption} package, or |\sub|\-|float| offered by the
% \pkg{subfig} package\cite{subfig}),
% for example within an non-floating environment like |minipage|:
% \begin{quote}
%   |\noindent\begin{minipage}{\textwidth}|\\
%   |  \captionsetup{type=figure}|\\
%   |  \subfloat{|\ldots|}|\\
%   |  |\ldots\\
%   |  \caption{|\ldots|}|\\
%   |\end{minipage}|
% \end{quote}
%
% \begin{Expert}
% There is also a starred variant of this option, |type*=|\meta{float type},
% which behaves different than |type=|\meta{float type} if the
% \pkg{hyperref} package\cite{hyperref} is loaded: While |type=| sets an
% hyperlink anchor (if |hypcap=|\x|true| is set), |type*=| does not.
% (See also \longref{hyperref}\,)
% \end{Expert}
% \begin{Expert}
% \emph{\DefaultNoteText:} Please don't re-define the internal macro |\@captype|
% for yourself, like suggested by some documentations, always use
% |\caption|\-|setup{type=|\x\ldots|}| instead.
% \end{Expert}
%
% \medskip
%
% Own float types can be defined with
%  |\Declare|\-|Floating|\-|Environment| offered by the \pkg{newfloat} package,
%  |\new|\-|float| offered by the \pkg{float} package\cite{float}, or
%  |\Declare|\-|New|\-|Float|\-|Type| offered by the \pkg{floatrow} package\cite{float}.
%
% \medskip
%
% \INFO % \NEWdescription{v3.1}
% Please note that you should use the option |type=| only
% \emph{inside} boxes or environments (like |\par|\-|box| or |mini|\-|page|),
% at best one where no page break could happen between contents and caption.
% Furthermore some visual side-effects (e.g.~mixed-up figure and table settings
% regarding captions) could occur without using a box or environment,
% therefore a warning message will be issued if you try to do so.\footnote{%
% You only get this warning message if you use \eTeX\ as underlying \TeX\ engine.}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Commands}
%
% \subsection{Typesetting captions}
% \label{caption}
% \label{captionlistentry}
%
% \DescribeMacro{\caption}
% The command
% \begin{quote}
%   |\caption|\oarg{list entry}\marg{heading}
% \end{quote}
% typesets the caption inside a floating environment like |figure| or |table|.
% Well, you already know this, but \thispackage\ offers an extension:
% If you leave the argument \meta{list entry} empty, no entry in the list of
% figures or tables will be made. For example:
% \begin{quote}
%   |\caption[]{A figure without list entry.}|
% \end{quote}
%
% \begin{Expert}
% Please remember that the \meta{heading} is a so-called \emph{moving} argument,
% if no \meta{list entry} has been given. But if a \meta{list entry} is given,
% this argument is moving instead.
% ``\emph{Moving} argument'' means that the argument will be written to the
% list-of file, make it appearing in the ``List of Figures'' or
% ``List of Tables'', too.
% \emph{Moving} arguments are not allowed to contain \emph{fragile} commands,
% everything must be \emph{robust}, otherwise the argument could get
% \emph{broken}, resulting in strange errors at the next \LaTeX\ run.
% Some \emph{fragile} commands could be \emph{protected} by a leading |\protect|,
% own definitions could get defined with |\Declare|\-|Robust|\-|Command| instead of
% |\new|\-|command| to make them \emph{robust}.
%
% An example: |\caption{${}^{137}_{\phantom{1}55}$Cs}| will cause errors since
% |\phantom| is \emph{fragile}.
% So we have either have to use the optional argument \meta{list entry}
% (e.g.~|\caption[${}^|\x|{137}_|\x|{55}$|\x|Cs]|\x|{${}^|\x|{137}_|\x|{\phantom{1}55}$|\x|Cs}|)
% or add |\protect| to prevent the |\phantom| command from getting \emph{broken}:
% |\caption{${}^|\x|{137}_|\x|{|\textcolor{blue}{\cs{protect}}|\phantom{1}55}$|\x|Cs}|.
%
% But sometimes even this is not sufficient. The reason behind is the so-called
% single-line-check: It puts the \meta{heading} into a horizontal box to determine
% the width of the caption, and this could cause error messages, too.
% An example:
% |\caption{A| |scheme.| |\[V_{C}| |\sim| |\left| |\{| |\begin{array}{cc}|
% |E_{g}| |&| |\textrm{p-n}| |\\| |e\phi_{B}| |&| |\textrm{M-S}| |\end{array}|
% |\right.| |\]}|.
% Using |\caption[A| |scheme]{|\ldots|}| is not sufficient here, it's still
% leading to errors. (``\texttt{Missing \$ inserted.}'')
% So we have to put a |\caption|\-|setup{single|\-|line|\-|check=|\x|off}|
% just in front of the |\caption| command additionally.
%
% For more information about \emph{moving} arguments and \emph{fragile} \&
% \emph{robust} commands, take a closer look at your \LaTeX\ manual or visit
% \url{http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/fragile.html}.
% \end{Expert}
%
% \medskip
%
% \pagebreak[3]
% \DescribeMacro{\caption*}
% The \pkg{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}{|\ldots|}|\\
%   |  \caption*{A table}\\|\\
%   |  |\ldots\\
%   |\end{longtable}|
% \end{quote}
% looks like
% \DeleteShortVerb{\|}
% \vskip\intextsep
% \begin{minipage}{\linewidth}
%   \captionsetup{type=table,position=t}
%   \caption*{A table}
%   \centering
%   \begin{tabular}{r|rr}
%       & x & y \\\hline
%     a & 1 & 2 \\
%     b & 3 & 4 \\
%   \end{tabular}
% \end{minipage}
% \vskip\intextsep
% \MakeShortVerb{\|}
% \Thispackage\ 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}|\\
%   |  |\ldots\\
%   |\end{table}|
% \end{quote}
%
% \pagebreak[3]
% \DescribeMacro{\captionof}
% \DescribeMacro{\captionof*}
% Sometimes you want to typeset a caption \emph{outside} a floating environment,
% putting a figure within a non-floating |mini|\-|page| for instance.
% For this purpose \thispackage\ offers the command
% \begin{quote}
%   |\captionof|\marg{float type}\oarg{list 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{table}{A table}|
% \end{quote}
% typesets captions like this:
% \begin{Example}
%   \captionsetup{position=top}
%   \captionof{table}{A table}
% \end{Example}
%
% The star variant |\caption|\-|of*| has the same behavior as the |\caption*|
% command:
% It typesets the caption without label and without entry to the list of figures
% or tables.
%
% \INFO % \NEWdescription{v3.1}
% Since |\caption|\-|of| uses the option |type| internally, the same
% restrictions as for the |type| option apply here, so you should use both
% |\caption|\-|of| and |\caption|\-|of*| only \emph{inside} boxes or
% environments, too.
% \See{\longref{types}}
%
% \bigskip
%
% \pagebreak[3]
% \DescribeMacro{\captionlistentry}
% \NEWfeature*{v3.1}
% Under certain circumstances it could be useful to make a list-of-figure
% (or table) entry on its own.
% This could be achieved with
% \begin{quote}
%   |\captionlistentry|\oarg{float type}\marg{list entry}\quad.
% \end{quote}
%
% One example: It's quite easy to have a |long|\-|table| with captions above the
% contents and a single list entry which points to the first page of the table:
% \begin{quote}
%   |\begin{longtable}{|\ldots|}|\\
%   |  \caption{|\ldots|}\\|\\
%   |\endfirsthead|\\
%   |  \caption[]{|\ldots|}\\|\\
%   |\endhead|\\
%   |  |\ldots
% \end{quote}
% But since the \pkg{longtable} package does not offer an
% |\end|\-|first|\-|foot| command, you cannot easily have captions \emph{below}
% the table contents and a single list entry which points to the first page of
% the table.
% Here is were the |\caption|\-|list|\-|entry| command could be used:
% \begin{quote}
%   |\begin{longtable}{|\ldots|}|\\
%   |  \caption[]{|\ldots|}\\|\\
%   |\endfoot|\\
%   |  \captionlistentry{|\ldots|}|\\
%   |  |\ldots
% \end{quote}
%
% \begin{Annotation*}
% Another example can be found in \longref{examples}.
% \end{Annotation*}
%
% \begin{Expert}
% There is also a starred variant, |\caption|\-|list|\-|entry*|, which does not
% increment the \meta{float type} counter.
% (Note that inside |long|\-|table| environments |\caption|\-|list|\-|entry|
% never increments the |table| counter. See also \longref{longtable}.)
% \end{Expert}
%
% \begin{Expert}
% Please note that \meta{list entry} is a \emph{moving} argument, so everything
% it contains must be \emph{robust}. (See also explanation of |\caption|)
% \end{Expert}
%
% \subsection{Setting options}
% \label{captionsetup}
%
% \DescribeMacro{\captionsetup}
% We already know the |\caption|\-|setup| command (see \longref{usage}),
% 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,textfont=it}|
% \end{quote}
% gives captions like this:
% \begin{Example}
%   \captionsetup{font=small}
%   \captionsetup[figure]{labelfont=bf,textfont=it}
%   \begingroup
%     \captionof{figure}{A figure}
%   \endgroup
%   \captionsetup{position=top}
%   \begingroup
%     \captionof{table}{A table}
%   \endgroup
% \end{Example}
% As you see the command |\caption|\-|setup[figure]{|\ldots|}| only changes
% the look of the |figure| caption labels, not touching the other ones.
%
% 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 \pkg{floatrow},
% \pkg{longtable}, and \pkg{sidecap} package for example) and also
% this package offer additional environments with captions and these two
% commands can also be used with them.
% \See{\longref{declare} and \longref{packages}}
%
% \begin{Expert}
% \NEWfeature{v3.1}
% There is also a starred variant of |\caption|\-|setup|:
% \begin{quote}
%   |\captionsetup*|\oarg{float type}\marg{options}
% \end{quote}
% While the non-starred variant can give you warnings---for example if the
% \meta{options} are actually not used throughout the document
% (e.g.~a |\caption|\-|setup[table]{font=|\x|sf}| without a |table|)---the
% starred variant will not.
% \iffalse
% This can get quite useful when setting generic options which are independent
% of a specific document.
% \fi
% \end{Expert}
%
% \medskip
%
% \pagebreak[3]
% \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|\oarg{option}\marg{float type}\quad.
% \end{quote}
%
% For example |\clearcaptionsetup{figure}| would clear all the extra handling
% for figures in the example above:
% \begin{quote}
%   |\captionsetup{font=small}|\\
%   |\captionsetup[figure]{labelfont=bf,textfont=it}|\\
%   \ldots\\
%   |  \caption{A figure}|\\
%   \ldots\\
%   |\clearcaptionsetup{figure}|\\
%   \ldots\\
%   |  \caption{A figure}|\\
%   \ldots
% \end{quote}
% \begin{Example}
%   \captionsetup{font=small}
%   \captionsetup[figure]{labelfont=bf,textfont=it}
%   \begingroup
%     \captionof{figure}{A figure}
%   \endgroup
%   \captionsetup{position=top}
%   \clearcaptionsetup{figure}
%   \begingroup
%     \captionof{figure}{A figure}
%   \endgroup
% \end{Example}
%
% \pagebreak[3]
% \NEWfeature{v3.1}
% If an optional argument \meta{option} is given, only the settings regarding
% this particular \meta{option} are cleared.\footnote{You can only specify
% \emph{one} option here, not a list of options.
% If you want to clean more than one option, you need to use more than one
% \cs{clear}\-\texttt{caption}\-\texttt{setup}.}
% While the example above not only clears the options
% |labelfont=bf,|\x|textfont=it|
% for figures (but all options for figures instead),
% this one would only clear the |labelfont=bf| setting, leaving all other
% settings for figures intact:
% \begin{quote}
%   |\captionsetup{font=small}|\\
%   |\captionsetup[figure]{labelfont=bf,textfont=it}|\\
%   \ldots\\
%   |  \caption{A figure}|\\
%   \ldots\\
%   |\clearcaptionsetup[labelfont]{figure}|\\
%   \ldots\\
%   |  \caption{A figure}|\\
%   \ldots
% \end{quote}
% \begin{Example}
%   \captionsetup{font=small}
%   \captionsetup[figure]{labelfont=bf,textfont=it}
%   \begingroup
%     \captionof{figure}{A figure}
%   \endgroup
%   \captionsetup{position=top}
%   \clearcaptionsetup[labelfont]{figure}
%   \begingroup
%     \captionof{figure}{A figure}
%   \endgroup
% \end{Example}
% \begin{Expert}
% Analogous to |\caption|\-|setup*| there is also a starred form
% |\clear|\-|caption|\-|setup*| which suppresses warnings if the given
% \meta{option} was not setup for the specified \meta{float type}.
% \end{Expert}
%
% \medskip
%
% \pagebreak[3]
% \DescribeMacro{\showcaptionsetup}
% For debugging purposes the command
% \nopagebreak[3]
% \begin{quote}
%   |\showcaptionsetup|\marg{float type}
% \end{quote}
% \nopagebreak[3]
% is offered. It generates a log file entry, showing the given options
% for the specified \meta{float type}. For example
% \begin{quote}
%   |\captionsetup[figure]{labelfont=bf,textfont=it}|\\
%   |\showcaptionsetup{figure}|
% \end{quote}
% gives the info:
% \begin{quote}\small
%   |Caption Info: Option list on `figure'|\\
%   |Caption Data: {labelfont=bf,textfont=it} on input line 5.|
% \end{quote}
%
% \pagebreak[3]
% \subsection{Continued floats}
% \label{ContinuedFloat}
%
% \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 incrementation of the relevant counter (usually done by
% |\caption|), so a figure or table containing a |\Continued|\-|Float| inside
% 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}
%   \captionsetup{type=table,position=b,skip=0pt}
%   \caption{A table}
%   \centerline{\ldots}
% \end{Example}
% \begin{Example}
%   \captionsetup{type=table,position=b,skip=0pt}
%   \ContinuedFloat
%   \caption{A table (cont.)}
%   \centerline{\ldots}
% \end{Example}
%
% \bigskip
%
% \NEWfeature{v3.1}
% Furthermore the |\Continued|\-|Float| command executes options associated with
% the type name ``|Continued|\-|Float|''. For example this can be used to switch
% to a different label format for continued figures or tables, as shown here:
% \begin{quote}
%   |\DeclareCaptionLabelFormat{continued}{Continued #1~#2}|\\
%   |\captionsetup[ContinuedFloat]{labelformat=continued}|\\
%   \ldots\\
%   |\begin{table}\ContinuedFloat|\\
%   |  \caption{A table}|\\
%   |  |\ldots\\
%   |\end{table}|
% \end{quote}
% \begin{Example}
%   \captionsetup{type=table,position=b,skip=0pt}
%   \captionsetup[ContinuedFloat]{labelformat=continued1}
%   \ContinuedFloat
%   \caption{A table}\label{continued1}
%   \centerline{\ldots}
% \end{Example}
% \smallskip
% \See{\longref{declare} for an explanation of
%      \cs{Declare}\-\texttt{Caption}\-\texttt{Label}\-\texttt{Format}.}
%
% \medskip
%
% There is also a \LaTeX\ counter called |Continued|\-|Float| which could be
% used for own purposes.
% For ordinary (floating) environments it's set to zero, to one for the first
% continued float, to two inside the second one, and so on.
% So every |\Continued|\-|Float| increments this counter and a floating
% environment without |\Continued|\-|Float| command resets this counter to zero.
% An example:
% \begin{quote}
%   |\DeclareCaptionLabelFormat{cont}{#1~#2\alph{ContinuedFloat}}|\\
%   |\captionsetup[ContinuedFloat]{labelformat=cont}|\\
%   \ldots\\
%   |\begin{table}\ContinuedFloat|\\
%   |  \caption{A table}|\\
%   |  |\ldots\\
%   |\end{table}|
% \end{quote}
% \begin{Example}
%   \captionsetup{type=table,position=b,skip=0pt}
%   \captionsetup[ContinuedFloat]{labelformat=continued2}
%   \ContinuedFloat
%   \caption{A table}\label{continued2}
%   \centerline{\ldots}
% \end{Example}
% \medskip
% A reference to this table would still result in the output
% ``\autoref{continued2}'' since only the caption label format was changed.
% If you would like to use the |Continued|\-|Float| counter for the references,
% too, you could redefine the command |\the|\-|Continued|\-|Float| instead,
% which will be appended to the figure or table counter automatically in
% continued floats and is preset to be empty.
% \begin{quote}
%   |\renewcommand\theContinuedFloat{\alph{ContinuedFloat}}|\\
%   \ldots\\
%   |\begin{table}\ContinuedFloat|\\
%   |  \caption{A table}|\\
%   |  |\ldots\\
%   |\end{table}|
% \end{quote}
% \begin{Example}
%   \captionsetup{type=table,position=b,skip=0pt}
%   \renewcommand\theContinuedFloat{\alph{ContinuedFloat}}
%   \ContinuedFloat
%   \caption{A table}\label{continued3}
%   \centerline{\ldots}
% \end{Example}
% \medskip
% A reference to that table would result in the output ``\autoref{continued3}''.
%
% \pagebreak[3]
% \DescribeMacro{\ContinuedFloat*}
% Suppose you want to start the first figure or table of such a series with a
% kind of ``Figure 7a'' and not with ``Figure 7'' (and the second one with
% ``Figure 7b'' instead of ``Figure 7a'').
% This is possible, too, by using the starred variant |\Continued|\-|Float*|
% which---just like |\Continued|\-|Float|---executes options associated with the
% type name ``|Continued|\-|Float|'' and increments the \LaTeX\ counter
% |Continued|\-|Float|, \emph{but} marks the first figure or table of a series
% instead:
% \begin{quote}
%   |\renewcommand\theContinuedFloat{\alph{ContinuedFloat}}|\\
%   \ldots\\
%   |\begin{figure}\ContinuedFloat*|\\
%   |  |\ldots\\
%   |  \caption{First figure of a series}|\\
%   |\end{figure}|\\
%   \ldots\\
%   |\begin{figure}\ContinuedFloat|\\
%   |  |\ldots\\
%   |  \caption{Second figure of a series}|\\
%   |\end{figure}|\\
%   \ldots\\
%   |\begin{figure}\ContinuedFloat|\\
%   |  |\ldots\\
%   |  \caption{Third figure of a series}|\\
%   |\end{figure}|
% \end{quote}
% \begin{Example}
%   \captionsetup{type=figure,position=b,skip=0pt}
%   \renewcommand\theContinuedFloat{\alph{ContinuedFloat}}
%   \begingroup
%     \ContinuedFloat*
%     \centerline{\ldots}
%     \caption{First figure of a series}
%   \endgroup
%   \begingroup
%     \ContinuedFloat
%     \centerline{\ldots}
%     \caption{Second figure of a series}
%   \endgroup
%   \begingroup
%     \ContinuedFloat
%     \centerline{\ldots}
%     \caption{Third figure of a series}
%   \endgroup
% \end{Example}
%
% \begin{Note}
%   Unfortunately \cs{ContinuedFloat*} is not available if the
%   \pkg{subfig} package\cite{subfig} is loaded.
% \end{Note}
%
% \pagebreak[3]
% \subsubsection*{A note about longtables}
% If you want to have a different caption label in |long|\-|table|s (offered
% by the \pkg{longtable} package\cite{longtable}) after a page break,
% this can \emph{not} be archived by using |\Continued|\-|Float|,
% but instead you could write something like:
% \begin{quote}
%   |\DeclareCaptionLabelFormat{continued}{Continued #1~#2}|\\
%   \ldots\\
%   |\begin{longtable}{|\ldots|}|\\
%   |  \caption{A longtable}\\|\\
%   |\endfirsthead|\\
%   |  \captionsetup{labelformat=continued}|\\
%   |  \caption[]{A longtable}\\|\\
%   |\endhead|\\
%   |  |\ldots\\
%   |\end{longtable}|
% \end{quote}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Own enhancements}
% \label{declare}
%
% A family of commands is provided to allow users to define their own formats
% etc.
% 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 |\document|\-|class| and |\begin{document}|.)
%
% \pagebreak[3]
% \DescribeMacro{\DeclareCaption-\\Format}
% You can define your own caption formats using the command
% \begin{quote}
%   |\DeclareCaptionFormat|\marg{name}\marg{code using \#1, \#2 and \#3}\mbox{\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 \thispackage\ as
% \begin{quote}
%   |\DeclareCaptionFormat{plain}{#1#2#3\par}|\quad.
% \end{quote}
% \begin{Expert}
% There is also a starred variant, |\Declare|\-|Caption|\-|Format*|,
% which causes the code being typeset in \TeX s vertical (instead of
% horizontal) mode, but does not support the |indention=| option.
% \end{Expert}
%
% \pagebreak[3]
% \DescribeMacro{\DeclareCaption-\\LabelFormat}
% 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'').
% An example:
% \begin{quote}
%   |\DeclareCaptionLabelFormat{bf-parens}{(\textbf{#2})}|\\
%   |\captionsetup{labelformat=bf-parens,labelsep=quad}|
% \end{quote}
% \example*{labelformat=bf-parens,labelsep=quad}{\exampletext}
%
% \pagebreak[3]
% \DescribeMacro{\bothIfFirst}
% \DescribeMacro{\bothIfSecond}
% If you define your own caption label formats and use the
% \pkg{subcaption} or \pkg{subfig}\cite{subfig} package,
% 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.
%
% \smallskip
%
% \pagebreak[3]
% For example the standard label format |simple| is \emph{not} defined as
% \begin{quote}
%   |\DeclareCaptionLabelFormat{simple}{#1~#2}|\mbox{\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}|\mbox{\quad,}
% \end{quote}
% causing the space to appear only if the label name is present.
%
% \smallskip
%
% \pagebreak[3]
% \DescribeMacro{\DeclareCaption-\\TextFormat}
% \NEWfeature*{v3.1}
% Likewise you can define your own caption text formats:
% \begin{quote}
%   |\DeclareCaptionTextFormat|\marg{name}\marg{code using \#1}
% \end{quote}
% At usage \#1 gets replaced with the caption text.
%
% \bigskip
%
% \pagebreak[3]
% \DescribeMacro{\DeclareCaption-\\LabelSeparator}
% You can define your own caption label separators with
% \begin{quote}
%   |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\mbox{\quad.}
% \end{quote}
% Again an easy example taken from \thispackage\ itself:
% \begin{quote}
%   |\DeclareCaptionLabelSeparator{colon}{: }|
% \end{quote}
% \begin{Expert}
% There is also a starred variant, |\Declare|\-|Caption|\-|Label|\-|Separator*|,
% which causes the code being typeset without using the |label|\-|font=| setting.
% So for example the label separators |quad|, |new|\-|line|, and |en|\-|dash|
% are defined in this way.
% \end{Expert}
%
% \bigskip
%
% \pagebreak[3]
% \DescribeMacro{\DeclareCaption-\\Justification}
% You can define your own caption justifications with
% \begin{quote}
%   |\DeclareCaptionJustification|\marg{name}\marg{code}\mbox{\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}|\mbox{\quad,}
% \end{quote}
% typesets captions with all lines moved to the left margin.
%
% \bigskip
%
% \pagebreak[3]
% \DescribeMacro{\DeclareCaption-\\Font}
% 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}
% \iffalse
% The line spacing could be customized using the \pkg{setspace} package,
% for example:%\NEWdescription{v3.0h}
% \begin{quote}
%   |\usepackage{setspace}|\\
%   |\DeclareCaptionFont{singlespacing}{\setstretch{1}}|~\footnote{%
%   \emph{\DefaultNoteText:} Using \cs{singlespacing} does not work here since
%   it contains a \cs{vskip} command.}\\
%   |\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}|\\
%   |\DeclareCaptionFont{doublespacing}{\doublespacing}|\\
%   |\captionsetup{font={onehalfspacing,small},labelfont=bf}|
% \end{quote}
% \example{font={onehalfspacing,small},labelfont=bf,singlelinecheck=off}{\exampletext}
% \fi
% 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,bf},textfont=green}|
% \end{quote}
% \example*{labelfont={color=blue,bf},textfont={color=green},singlelinecheck=off}{\exampletext}
% But since \thispackage\ already includes the tricky definition
% \begin{quote}
%   |\DeclareCaptionFont{color}{\color{#1}}|
% \end{quote}
% you can get the same result simply with
% \begin{quote}
%   |\usepackage{color}|\\
%   |\captionsetup{labelfont={color=blue,bf},|\\
%   |               textfont={color=green}}|\quad.
% \end{quote}
%
% \medskip
%
% \pagebreak[3]
% \DescribeMacro{\DeclareCaption-\\Style}
% You can define your own caption styles with
% \begin{quote}
%   |\DeclareCaptionStyle|\marg{name}\oarg{additional options}\marg{options}\mbox{\quad.}
% \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 |base| set of options. (See \longref{style}
% 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 |single|\-|line|\-|check=off|.
%
% Again a very easy example taken from the core of this package: The
% caption style |base| is pre-defined as
% \begin{quote}
%   |\DeclareCaptionStyle{base}%|\\
%   |        [justification=centering,indention=0pt]{}|\quad.
% \end{quote}
%
% Something more exciting:
% \begin{quote}
%   |\DeclareCaptionStyle{mystyle}%|\\
%   |        [margin=5mm,justification=centering]%|\\
%   |        {font=footnotesize,labelfont=sc,margin={10mm,0mm}}|\\
%   |\captionsetup{style=mystyle}|
% \end{quote}
% gives you caption like these ones:
% \begin{Example}
%   \captionsetup{type=figure,style=mystyle,position=b}
%   \caption{A short caption.}
%   \caption{A long long long long long long long long long
%              long long long long long long long long long
%              long long long long long long long long long caption.}
% \end{Example}
%
% \bigskip
%
% \pagebreak[3]
% \DescribeMacro{\DeclareCaption-\\ListFormat}
% \NEWfeature*{v3.1}
% You can define your own caption list formats with
% \begin{quote}
%   |\DeclareCaptionListFormat|\marg{name}\marg{code using \#1 and \#2}\mbox{\quad.}
% \end{quote}
% At usage \#1 gets replaced with the label prefix (e.g.~|\p@figure|),
% and \#2 gets replaced with the reference number (e.g.~|\thefigure|).
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \subsection{Further examples}
% \label{examples}
%
% \subsubsection*{Example 1}
%
% If you would like to have a line break between caption label and text
% you could define it this way:
% \begin{quote}
%   |\DeclareCaptionFormat{myformat}{#1#2\\#3}|
% \end{quote}
% If you select this format with |\caption|\-|setup{format=|\x|myformat}|
% you get captions like this:
%   \example{format=myformat1,labelfont=bf}{\exampletext}
% You could even use an indention with this caption format:
% \begin{quote}
%   |\captionsetup{format=myformat,indention=1cm}|
% \end{quote}
% This would look like this:
%   \example{format=myformat1,indention=1cm,labelfont=bf}{\exampletext}
% Instead, you would like to have an indention only of the first line of
% the caption text? No problem, e.g.
% \begin{quote}
%   |\newlength\myindention|\\
%   |\DeclareCaptionFormat{myformat}%|\\
%   |               {#1#2\\\hspace*{\myindention}#3}|\\
%   \ldots\\
%   |\setlength\myindention{1cm}|\\
%   |\captionsetup{format=myformat}|
% \end{quote}
% would give you captions like
%   \example{format=myformat2,myindention=1cm,labelfont=bf}{\exampletext}
% But you want to have an caption option for this indention, so you can use
% it for example with
% |\caption|\-|setup|\x|[figure]|\x|{my|\-|indention=|\x\ldots|}|?
% This could be done, too:
% \begin{quote}
%   |\newlength\myindention|\\
%   |\DeclareCaptionOption{myindention}%|\\
%   |               {\setlength\myindention{#1}}|\\
%   |\DeclareCaptionFormat{myformat}%|\\
%   |               {#1#2\\\hspace*{\myindention} #3}|\\
%   \ldots\\
%   |\captionsetup{format=myformat,myindention=1cm}|
% \end{quote}
% would give the same result as the example above.
%
% \subsubsection*{Example 2}
%
% You want captions to look like this:
%   \example{format=reverse,labelformat=fullparens,labelsep=fill,labelfont=it}{\exampletext}
%
% \pagebreak[2]
% You could do it this way:
% \nopagebreak[3]
% \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}
%
% \subsubsection*{Example 3}
%
% The caption text should go into the left margin? A possible solution would be:
% \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:
% \example{format=llap,labelsep=quad,singlelinecheck=no,margin=0pt}{\exampletext}
%
% \medskip
%
% If the indention into the margin shall be fixed, you could use a combination
% of |\llap| and |\makebox|, for example:
% \begin{quote}
%   |\DeclareCaptionFormat{llapx}%|\\
%   |               {\llap{\makebox[5em][l]{#1}}#3\par}|\\
%   |\captionsetup{format=llapx,singlelinecheck=off}|
% \end{quote}
% \example{format=llapx,singlelinecheck=off,skip=0pt,margin=0pt}{\exampletext}
%
% \subsubsection*{Example 4}
%
% This example puts a figure aside a table, but uses only one common caption for both.
% This will be achieved by a combination of
% |\Declare|\-|Caption|\-|Label|\-|Format| and |\caption|\-|list|\-|entry|:
% \begin{quote}
%   |\DeclareCaptionLabelFormat{andtable}%|\\
%   |               {#1~#2 \& \tablename~\thetable}|\\
%   \ldots\\
%   |\begin{figure}|\\
%   |  \centering|\\
%   |  \includegraphics{|\ldots|}%|\\
%   |  \qquad|\\
%   |  \begin{tabular}[b]{\ldots}|\\
%   |    |\ldots\\
%   |  \end{tabular}|\\
%   |  \captionlistentry[table]{|\ldots|}|\\
%   |  \captionsetup{labelformat=andtable}|\\
%   |  \caption{|\ldots|}|\\
%   |\end{figure}|
% \end{quote}
% \DeleteShortVerb{\|}%
% \noindent\begin{minipage}{\linewidth}
%   \captionsetup{type=figure}
%   \centering
%   \includegraphics[width=30pt]{cat}%
%   \qquad
%   \begin{tabular}[b]{r|rr}
%       & x & y \\\hline
%     a & 1 & 2 \\
%     b & 3 & 4 \\
%   \end{tabular}
%   \captionlistentry[table]{A figure and a table with a common caption}
%   \captionsetup{labelformat=andtable}
%   \caption{A figure and a table with a common caption~\footnotemark}
% \end{minipage}
% \footnotetext{The picture was taken with permission from the
%   \LaTeX\ Companion\cite{TLC2} examples.}
% \MakeShortVerb{\|}
%
% (Please remember that |\caption|\-|list|\-|entry| increments the figure
%  or table counter.)
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Supported document classes}
% \label{classes}
%
% This section will give you an overview of the document classes the
% \pkg{caption} supports, what do they already offer regarding captions,
% what side effects will occur when using the \pkg{caption} package with
% them, and what are the `default' settings for them.
%
% \NEWfeature{v3.1}
% The `default' settings depend on the document class you use; they represent
% how the class author wanted the captions to look like. So for example
% setting |format=|\x|default| can give you different visual designs when used
% with different document classes.
%
% \begingroup\setlength\leftmargini{0.3em}% default = 2.5em
% \INFO
% If you don't find the document class you use in this section, you usually
% don't have to worry: Many document classes (e.g.~the \cls{octavo} class)
% are derived from one of the standard document classes \cls{article},
% \cls{report}, or \cls{book}, and behave the same regarding captions.
% \Thispackage\ automatically does a compatibility check against the document
% class used and will give you the clear warning
% \begin{quote}\footnotesize
%   |Package caption Warning: Unsupported document class (or package) detected,|\\
%   |(caption)                usage of the caption package is not recommended.|\\
%   |See the caption package documentation for explanation.|
% \end{quote}
% if such an incompatibility was detected.
% If you don't get such warning everything is fine, but if you get it the
% usage of \thispackage\ is not recommended and especially not supported.
% \endgroup
%
% \begin{Expert}
% If you get such a compatibility warning but decide to use \thispackage{}
% anyway, you should watch carefully what side-effects occur, usually the
% look and feel of your captions will change by just including \thispackage{}
% without options, meaning they do not look like as intended by the author
% of the document class.
% If this is fine for you, you should first specify the option |style=|\x|base|
% via |\use|\-|package[style=|\x|base]{caption}| or
% |\caption|\-|setup{style=|\x|base}| to set \thispackage\ into a well-defined
% state.
% Afterwards you can start setting your own options additionally and
% keep your fingers crossed.
% \end{Expert}
%
% \newcommand*\Option{Option}
% \newcommand*\defaultvalue{\texttt{default} value}
% \newcommand*\uses{\textit{uses}}
% \newcommand*\settings{\textit{settings}}
% \newcommand*\nofont{\textit{none}}
%
% \subsection{Standard \LaTeX: article, report, and book}
%
% \begin{tabular}{ll}
% \Option          & \defaultvalue \\\hline
% |format=|        & |plain| \\
% |labelformat=|   & |simple| \\
% |labelsep=|      & |colon| \\
% |justification=| & |justified| \\
% |font=|          & \nofont \\
% |labelfont=|     & \nofont \\
% |textfont=|      & \nofont \\
% \end{tabular}
%
% \begin{Annotation}
% This also applies to document classes derived from them.
% \end{Annotation}
%
% \subsection{\AmS: amsart, amsproc, and amsbook}
% \label{AMS}
%
% \begin{tabular}{ll}
% \Option          & \defaultvalue \\\hline
% |format=|        & |plain| \\
% |labelformat=|   & |simple| \\
% |labelsep=|      & |.\enspace| \\
% |justification=| & |justified| \\
% |font=|          & |\@captionfont| \\
% |labelfont=|     & |\@captionheadfont| \\
% |textfont=|      & |\@captionfont\upshape| \\
% \end{tabular}
%
% \begin{Annotation*}
% |\@caption|\-|font| will be set to |\normal|\-|font|, and
% |\@caption|\-|head|\-|font| to |\sc|\-|shape| by the \AmS\ document classes.
% \end{Annotation*}
%
% Furthermore the margin will be set to |\caption|\-|indent| for
% more-than-one-line captions (which will be set to |3pc| by the \AmS\ classes),
% the margin for single-line captions will be set to the half of it instead.
% If you want to use a common margin for both, insert
% |\clear|\-|caption|\-|setup[margin*]{single|\-|line}|
% into the preamble of your document, after loading \thispackage.
%
% Additionally the options |figure|\-|position=b,|\x|table|\-|position=t|
% will be set. You can override these settings by specifying other values for
% |figure|\-|position=| or |table|\-|position=| in the option list while
% loading \thispackage.
%
% \subsection{beamer}
% \label{beamer}
%
% \begin{tabular}{ll}
% \Option          & \defaultvalue \\\hline
% |format=|        & |plain| \\
% |labelformat=|   & \textit{not numbered} \\
% |labelsep=|      & |colon| \\
% |justification=| & |raggedright| \\
% |font=|          & \cls{beamer} ``|caption|'' \settings \\
% |labelfont=|     & \cls{beamer} ``|caption name|'' \settings \\
% |textfont=|      & \nofont \\
% \end{tabular}
%
% \subsubsection*{Build-in features, and side-effects}
% You can setup font and color settings with
% |\set|\-|beamer|\-|font{caption}|\marg{options} and
% |\set|\-|beamer|\-|font{caption name}|\marg{options}.
% This will still work, unless you set a different font with
% |\caption|\-|setup{font=|\x\meta{options}|}| or
% |\caption|\-|setup{label|\-|font=|\x\meta{options}|}|.\par
% Furthermore the \cls{beamer} classes offer different caption templates
% which can be chosen with
% |\set|\-|beamer|\-|template|\x|{caption}|\x|[|\meta{template}|]|.
% Since \thispackage\ replaces this caption template mechanism,
% |\def|\-|beamer|\-|template*|\x|{caption}|\x\marg{template code}
% and
% |\set|\-|beamer|\-|template|\x|{caption}|\x|[|\meta{template}|]|
% will have no effect when \thispackage\ is used.
% (Exception: Selecting the template |default|, |num|\-|bered|, or
% |caption| |name| |own| |line| will be recognized by \thispackage and be mapped
% to corresponding options.)
%
% \subsection{\KOMAScript: scrartcl, scrreprt, and scrbook}
% \label{KOMA}
%
% \begin{tabular}{ll}
% \Option          & \defaultvalue \\\hline
% |format=|        & \uses\ |\setcapindent| \textit{\&} |\setcaphanging| \settings \\
% |labelformat=|   & \textit{like \purett{simple}, but with support of ``autodot''}\\
% |labelsep=|      & |\captionformat| \\
% |justification=| & |justified| \\
% |font=|          & |\setkomafont{caption}| \settings \\
% |labelfont=|     & |\setkomafont{captionlabel}| \settings \\
% |textfont=|      & \nofont \\
% \end{tabular}
%
% \subsubsection*{Build-in features}
% The \KOMAScript\ document classes offer many ways to customize the look and
% feel of the captions. For an overview and a full description please take a
% look at the \KOMAScript\ documentation, section `Tables and Figures'.
%
% \subsubsection*{Side effects}
% The optional argument of |\set|\-|cap|\-|width| is not supported and
% will be ignored if used in conjunction with the \pkg{caption} package.
% Furthermore the \KOMAScript\ options |table|\-|caption|\-|above| \&
% |table|\-|caption|\-|below| and the commands |\caption|\-|above| \&
% |\caption|\-|below| are stronger than the |position=| setting offered by
% the \pkg{caption} package.
%
% \subsection{\NTG: artikel, rapport, and boek}
% \label{NTG}
%
% \begin{tabular}{ll}
% \Option          & \defaultvalue \\\hline
% |format=|        & |plain| \\
% |labelformat=|   & |simple| \\
% |labelsep=|      & |colon| \\
% |justification=| & |justified| \\
% |font=|          & \nofont \\
% |labelfont=|     & |\CaptionLabelFont| \\
% |textfont=|      & |\CaptionTextFont| \\
% \end{tabular}
%
% \subsubsection*{Build-in features, and side-effects}
% |\Caption|\-|Label|\-|Font| and |\Caption|\-|Text|\-|Font| can be set either
% directly or by using |\Caption|\-|Fonts|.
% Both is still supported unless you use one of the two options
% |label|\-|font=| or |text|\-|font=| offered by \thispackage.
%
% \subsection{\SmF: smfart and smfbook}
% \label{SMF}
%
% Since the \SmF\ document classes are derived from the \AmS\ document classes
% the same default values are valid here.
%
% Additionally the margin is limited up to the tenth of the |\line|\-|width|.
% If you don't like this limitation, you can switch it off with the option
% |max|\-|margin=|\x|off| or |max|\-|margin=|\x|false|
% (which both means the same).
%
% \subsection{thesis}
% \label{thesis}
%
% \begin{tabular}{ll}
% \Option          & \defaultvalue \\\hline
% |format=|        & |hang| \\
% |labelformat=|   & \textit{like \purett{simple}, but with short name}\\
% |labelsep=|      & |colon| \\
% |justification=| & |justified| \\
% |font=|          & \nofont \\
% |labelfont=|     & |\captionheaderfont| \\
% |textfont=|      & |\captionbodyfont| \\
% \end{tabular}
%
% \subsubsection*{Build-in features, and side-effects}
% The caption label font can be set with |\caption|\-|header|\-|font|,
% the caption text font with |\caption|\-|body|\-|font|.
% Both is still supported unless you use one of the two options
% |label|\-|font=| or |text|\-|font=| offered by \thispackage.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Supported babel package options}
% \label{babel}
%
% \NEWfeature{v3.5}
% Since version \version{3.5} of the \pkg{caption} package the support
% is independent on the load order of \pkg{caption} and \pkg{babel}.
%
% \subsection{french babel option}
% \label{french}
%
% If you use the \pkg{french} option of the \pkg{babel} package
% with one of the three standard \LaTeX{} classes (or a one derived from them)
% the default |label|\-|sep=| will be set to |\Caption|\-|Sep|\-|a|\-|ra|\-|tor|
% (offered by \pkg{french}), overriding the default value set by the
% document class.
% So redefining |\Caption|\-|Sep|\-|a|\-|ra|\-|tor| will still work, unless you
% don't select a different |label|\-|sep=| than the default one.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Supported packages}
% \label{packages}
% \label{compatibility}
%
% \Thispackage\ was adapted to the following packages which deals with
% captions, too:
% \begin{quote}
%   \pkg{float}, \pkg{floatflt}, \pkg{fltpage},
%   \pkg{hyperref}, \pkg{hypcap}, \pkg{listings},
%   \pkg{longtable}, \pkg{picinpar}, \pkg{picins},
%   \pkg{rotating}, \pkg{setspace}, \pkg{sidecap},
%   \pkg{subfigure}, \pkg{supertabular}, \pkg{threeparttable},
%   \pkg{wrapfig}, and \pkg{xtab}
% \end{quote}
%
% Furthermore the \pkg{floatrow} package\cite{floatrow}, the
% \pkg{subcaption} package (which is part of the \pkg{caption} package
% bundle), and the \pkg{subfig} package\cite{subfig} support \thispackage{}
% and use its |\caption|\-|setup| interface.
%
% \bigskip
%
% \begingroup\setlength\leftmargini{0.3em}% default = 2.5em
% \INFO
% If a package (or document class) unknown to \thispackage\ redefines
% the |\caption| command as well, this redefinition will be preferred
% over the one this package offers, providing maximum compatibility and
% avoiding conflicts.
% If such a potential incompatibility is detected, you will see this
% warning message:~\footnote{%
%   You can suppress this warning by specifying the option
%   \texttt{compatibility=true} when loading \thispackage.}
% \begin{quote}\footnotesize
%   |Package caption Warning: \caption will not be redefined since it's already|\\
%   |(caption)                redefined by a document class or package which is|\\
%   |(caption)                unknown to the caption package.|\\
%   |See the caption package documentation for explanation.|
% \end{quote}
% \endgroup
%
% As a result, the following features offered by \thispackage\ will not be available:
% \begin{itemize}
%   \item the options |labelformat=|, |position=auto|, |list=|, and |listformat=|
%   \item |\caption*| (to produce a caption without label)
%   \item |\caption[]{|\ldots|}| (to produce no entry in the List of Figures or Tables)
%   \item |\caption{}| (to produce an empty caption without label separator)
%   \item |\ContinuedFloat|
%   \item correctly justified captions in environments like \texttt{wide} and
%         \texttt{addmargin} which add extra margins
%   \item the \textsf{hypcap} feature \See{\longref{hyperref}\,}
%   \item the sub-caption feature \See{\pkg{subcaption} package documentation}
% \end{itemize}
%
% \DescribeMacro{compatibility=}
% You can override this compatibility mode by specifying the option
% \begin{quote}
%   |compatibility=false|
% \end{quote}
% when loading \thispackage.
% But please note that using this option is neither recommended nor supported
% since unwanted side-effects or even errors could occur afterwards.
% (For that reason you will get a warning about this.)
%
% \newcommand\packagedescription[1]{%
%   \ifvmode\else\par\fi
%   \nopagebreak
%   \parbox[b]{\linewidth}{\footnotesize\leftskip=10pt\rightskip=10pt\relax#1}\par
%   \nopagebreak\smallskip\nopagebreak}
%
% \PageBreak
% \subsection{algorithms}
% \label{algorithms}
% \packagedescription{%
% The \pkg{algorithms} package bundle\cite{algorithms} provides two
% environments: The \texttt{algorithmic} environment provides a possibility
% for describing algorithms, and the \texttt{algorithm} environment provides
% a ``float'' wrapper for algorithms.}
%
% Since the \texttt{algorithm} environment is implemented via |\new|\-|float|
% provided by the \pkg{float} package\cite{float}, please see \longref{float}.
%
% \iffalse
% \pagebreak[3]
% \subsection{algorithm2e}
% \label{algorithm2e}
% \packagedescription{%
% The \pkg{algorithm2e} package\cite{algorithm2e} offers an environment for
% writing algorithms in LaTeX2e.}
%
% Since the \pkg{algorithm2e} package does not use some kind of standard
% interface for defining its floating environment (e.g.~|\newfloat| of the
% \pkg{float} package) and typesetting its caption,
% the \pkg{algorithm2e} package is \emph{not} supported by \thispackage.
%
% So if you want to customize the captions using \thispackage,
% you have to build a new environment which uses a supported interface regarding
% floats (e.g. using the \pkg{float} or \pkg{floatrow} package),
% and combine this environment with the internal \pkg{algorithm2e} code.
%
% As first step you could define a non-floating environment \texttt{algorithmic},
% for example:
% \begin{quote}
%   |\usepackage{algorithm2e}|\\
%   |% save the "algorithm" environment from the algorithm2e package|\\
%   |\let\ORIGalgorithm\algorithm|\\
%   |\let\ORIGendalgorithm\endalgorithm|\\
%   |% define the algorithmic environment|\\ % , based on the saved environment
%   |\newenvironment{algorithmic}%|\\
%   |  {\renewenvironment{algocf}[1][h]{}{}% pass over floating stuff|\\
%   |   \ORIGalgorithm}%|\\
%   |  {\ORIGendalgorithm}|\\
%   \ldots
% \end{quote}
% Having defined this non-floating environment, you could define your own new
% floating environment with |\newfloat| of the \pkg{float} package
% (or |\DeclareNewFloatType| of the \pkg{floatrow} package),
% and use the combination of this floating environment and \texttt{algorithmic}
% in its body, just like you would do when you use the
% \pkg{algorithm}/\pkg{algorithmic} package tandem.
%
% You could even use the \pkg{algorithm} package for this purpose, for example:
% \begin{quote}
%   \ldots\\
%   |% load the algorithm package to re-define the|\\
%   |% floating environment "algorithm" and \listofalgorithms|\\
%   |\let\listofalgorithms\undefined|\\
%   |\usepackage{algorithm}|\\
%   \ldots\\
%   |% Example usage:|\\
%   |\begin{algorithm}|\\
%   |\caption{An algorithm}|\\
%   |\begin{algorithmic}|\\
%   |  \SetVline|\\
%   |  \eIf{cond1}{|\\
%   |    a line\;|\\
%   |  }{|\\
%   |    another line\;|\\
%   |  }|\\
%   |\end{algorithmic}|
% \end{quote}
% Now you are finally able to customize the float and caption layout like every
% other floating environment defined with the \pkg{float} package\cite{float},
% please see \longref{float}.
%
% \begin{Annotation}
% An alternative would be using the \pkg{algorithmicx} package.
% \end{Annotation}
% \fi
%
% \pagebreak[3]
% \subsection{float}
% \label{float}
% \packagedescription{%
% The \pkg{float} package\cite{float} introduces the commands
% \cs{restylefloat} to give existing floating environments a new look \& feel
% and \cs{newfloat} to define new floating environments.
% It also provides the ``\texttt{H}'' float placement option which places
% the environments ``here'' instead of letting them floating around.}
%
% For floating environments defined with \cs{newfloat} or \cs{restylefloat} the
% |po|\-|si|\-|tion| option has no effect on the main caption anymore, since its
% placement and spacing will be controlled by the selected float style instead.
%
% A caption style and options defined with the name of the float style will be
% executed additionally to the regular ones.
% Using this mechanism \thispackage\ emulates the default look \& feel of the
% |ruled| captions: It defines the caption style
% \begin{quote}
%   |\DeclareCaptionStyle{ruled}%|\\
%   |       {labelfont=bf,labelsep=space,strut=off}|\mbox{\quad.}
% \end{quote}
% So to change this you need either define your own caption style called
% |ruled| or use |\caption|\-|setup[ruled]|\marg{options} to specify additional
% options.
%
% Also by using this mechanism the skip between a |boxed| float and its caption
% is specified, overriding its global value:
% \begin{quote}
%   |\captionsetup[boxed]{skip=2pt}|
% \end{quote}
% For changing this, just use |\caption|\-|setup[boxed]{skip=|\x\meta{value}|}|
% with an appropriate value. Or if you want to use the global |skip| setting
% instead, you can remove the usage of the local setting for these floats with
% |\clear|\-|caption|\-|setup[skip]{boxed}|.
%
% \begin{Note}
% Only one single caption can be typeset inside environments defined with
% |\new|\-|float| or |\re|\-|style|\-|float|, furthermore these environments
% are not behaving exactly like the pre-defined floats |figure| and |table|.
% As a consequence many packages do not cooperate well with these.
% Furthermore the \pkg{float} package has some caveats \& limitations,
% so if you just want to define a new simple floating environment---behaving
% like |figure| or |table|---I recommend using |\Declare|\-|Floating|\-|Environment|
% offered by the \pkg{newfloat} package instead.
% And for defining non-simple floating environments and customization I
% recommend using |\Declare|\-|New|\-|Float|\-|Type| offered by the
% \pkg{floatrow} package\cite{floatrow}.
% \end{Note}
%
% \iffalse
% Please also note that you \emph{don't} need a |\restyle|\-|float| for using
% the ``|H|'' float placement specifier. Some docs say so, but they are
% wrong.
% And |\restyle|\-|float{table}| is a very good method to shoot yourself
% in the foot, since many packages using |table| internally are not working
% correctly afterwards.
% \fi
%
% \pagebreak[3]
% \subsection{floatflt}
% \label{floatflt}
% \packagedescription{%
% The \pkg{floatflt} package\cite{floatflt} offers figures and tables
% which do not span the full width of a page and are float around by text.}
%
% \NEWfeature{v3.1}
% If you want to setup special options for the |float|\-|ing|\-|figure| and
% |float|\-|ing|\-|table| environments you can use
% \begin{quote}
%   |\captionsetup[floatingfigure]|\marg{options}\quad\emph{and}\\
%   |\captionsetup[floatingtable]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |figure| or |table|.
%
% \begin{Note}
% The |margin| or |width| setting will not be used for these figures or tables,
% unless you set it explicit with |\caption|\-|setup[floating|\-|figure]{|\ldots|}|
% or |\caption|\-|setup[floating|\-|table]{|\ldots|}|.
% \end{Note}
%
% \pagebreak[3]
% \subsection{fltpage}
% \label{fltpage}
% \packagedescription{%
% The \pkg{fltpage} package\cite{fltpage} offers the outhouse of the
% caption for |figure|s or |table|s which needs the whole page
% for its contents. This will be done by placing the caption on the bottom
% of the previous or next page.}
%
% \iffalse
% \NEWfeature{v3.1}
% Two options control the links to the environments |FPfigure| and |FPtable|:
% \begin{description}
% \item{\texttt{FPlist=caption} or \texttt{FPlist=figure}}\\[\smallskipamount]
% If set to |caption|, the list entry will link to the caption; if set to
% |figure|, it will link to the figure contents.
% (The default setting is |FP|\-|list=|\x|caption|.)
% \item{\texttt{FPref=caption} or \texttt{FPref=figure}}\\[\smallskipamount]
% If set to |caption|, a \cs{ref}, \cs{pageref}, \cs{autoref}, or \cs{nameref}
% will link to the caption; if set to |figure|, it will link to the figure contents.
% (The default setting is |FP|\-|ref=|\x|figure|.)
% \end{description}
% \fi
%
% If you want to setup special options for the |FPfigure| and |FPtable|
% environments you can use
% \begin{quote}
%   |\captionsetup[FPfigure]|\marg{options}\quad\emph{and}\\
%   |\captionsetup[FPtable]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |figure| or |table|.
%
% \pagebreak[3]
% \subsection{frenchle and frenchpro packages}
% \label{frenchpro}
%
% If you use the \pkg{frenchle} or \pkg{frenchpro} package,
% the default |label|\-|sep=| will be set to |\caption|\-|sep|\-|a|\-|ra|\-|tor|
% (offered by \pkg{frenchle/pro}) plus \cs{space}, overriding the default
% value set by the document class.
% So redefining |\caption|\-|sep|\-|a|\-|ra|\-|tor| will still work, unless you
% don't select a different |label|\-|sep=| than the default one.
%
% Furthermore the default |text|\-|font=| will be set to |text|\-|font=|\x|it|,
% since this emulates the default setting of |\caption|\-|font| defined by the
% \pkg{frenchle} or \pkg{frenchpro} package.
% Please note that the command |\caption|\-|font| is used by the
% \pkg{caption} package internally for a different purpose,
% so you should not change it (anymore).
%
% The command |\un|\-|numbered|\-|captions|\marg{figure \emph{or} table} will
% still work, but only unless you don't select a different |label|\-|format=|
% than the default one.
%
% \NEWfeature{v3.5}
% Since version \version{3.5} of the \pkg{caption} package the support
% is independent on the load order of \pkg{caption} and \pkg{frenchle}
% resp~.\pkg{frenchpro}.
%
% \pagebreak[3]
% \subsection{hyperref}
% \label{hyperref}
% \packagedescription{%
% The \pkg{hyperref} package\cite{hyperref} is used to handle cross
% referencing commands in LaTeX to produce hypertext links in the document.}
%
% \NEWfeature{v3.1}
% There are two options available to control the placement of hyperlink
% anchors:~\footnote{These options are named after the \pkg{hypcap} package
% which they supersede.}
% \begin{description}
% \item{\texttt{hypcap=true} or \texttt{hypcap=false}}\\[\smallskipamount]
% If set to |true| all hyperlink anchors -- where entries in the
% List of Figures, |\ref|, and |\auto|\-|ref| will link to -- are placed at
% the beginning of the (floating) environment.\par
% If set to |false| the hyperlink anchor is (usually) placed at the caption.\par
% (The default setting is |hypcap=|\x|true|.)
% \item{\texttt{hypcapspace=}\meta{amount}}\\[\smallskipamount]
% Because it looks poor if the hyperlink points exactly at the top of
% the figure or table, you can specify a vertical distance between
% the hyperlink anchor and the (floating) environment itself,
% e.g.~|hyp|\-|cap|\-|space=|\x|0pt| removes this distance.\par
% (The default setting is |hyp|\-|cap|\-|space=|\x|0.5\base|\-|line|\-|skip|.)
% \end{description}
%
% Both settings have no effect in |lst|\-|listing|s (provided by the
% \pkg{listings} package), |long|\-|table|s (provided by the
% \pkg{longtable} package), |super|\-|tabular|s (provided by the
% \pkg{supertabular} package), and |x|\-|tabular|s (provided by the
% \pkg{xtab} package), within these environments hyperlink
% anchors will always be placed as if |hyp|\-|cap=|\x|true| and
% |hyp|\-|cap|\-|space=|\x|0pt| would be set.
%
% \pagebreak[3]Please note:\nopagebreak
% \begin{description}
% \item{\cs{captionof}\marg{type}\csmarg{\purerm\ldots}
%   vs.~\cs{captionsetup}\csmarg{type=\textrm{\meta{type}}}$+$\cs{caption}\csmarg{\purerm\ldots}}%
% \\[\smallskipamount]
% Without \pkg{hyperref} loaded, both will give you identical results.
% But with \pkg{hyperref} loaded, and with |hyp|\-|cap=|\x|true| requested,
% the hyperlink anchor will be placed different.
% For example:
% \begin{quote}
% |\begin{minipage}{\linewidth}|\\
% |  |\ldots\\
% |  \captionof{figure}{A figure}|\\
% |\end{minipage}|
% \end{quote}
% will place the hyperlink anchor at the caption.
% (And if |hyp|\-|cap=|\x|true| is set, you will get a warning about this.)
% But
% \begin{quote}
% |\begin{minipage}{\linewidth}|\\
% |  \captionsetup{type=figure}|\\
% |  |\ldots\\
% |  \caption{A figure}|\\
% |\end{minipage}|
% \end{quote}
% will place the hyperlink anchor at the beginning of the |mini|\-|page|,
% since |\caption|\-|setup{type=|\x|figure}| does not only set the caption type
% to ``figure'' but does place a hyperlink anchor, too.
%
% \item{\cs{caption}\csoarg{}\csmarg{\purerm\ldots}
%   vs.~\cs{captionsetup}\csmarg{list=false}$+$\cs{caption}\csmarg{\purerm\ldots}}\\[\smallskipamount]
% Again, without \pkg{hyperref} loaded, both will give you identical results.
% But with \pkg{hyperref} loaded, the difference is in the nuances.
% So for example the optional argument of |\caption| will also be written to
% the |aux| file, and will be used by the |\name|\-|ref| command.
% So if you choose to use |\caption| with empty optional argument,
% |\name|\-|ref| will also give you an empty result.
% So it's better to use |\caption|\-|setup{list=|\x|false}| if you don't
% want an entry in the List of Figures or List of Tables.
% \end{description}
%
% \pagebreak[3]
% \subsection{hypcap}
% \label{hypcap}
% \packagedescription{%
% The \pkg{hyp\-cap} package\cite{hypcap} offers a solution to the problem
% that links to a float using \pkg{hyper\-ref} may anchors to the caption
% rather than the beginning of the float.
% Since \thispackage\ \version{3.1} already solves this problem for itself,
% the \pkg{hypcap} package is usually not needed.}
%
% If the \pkg{hyp\-cap} package is loaded additionally to the
% \pkg{hyper\-ref} package, it takes over the control of the hyperlink
% anchor placement from \thispackage, overriding the options |hyp|\-|cap=|
% and |hyp|\-|cap|\-|space=|.
%
% So for a manual placement of hyperlink anchors
% |\caption|\-|setup{type=|\x\meta{type}|}| is not sufficient anymore,
% instead you need to use |\cap|\-|start| (provided by the \pkg{hyp\-cap}
% package) for this.
%
% Regarding the automatically placement the \pkg{hypcap} package offers good
% placement of hyperlink anchors for the floating environments |figure| and
% |table| only. In contrast the |hypcap=|\x|true| option of \thispackage\ also
% offers good placements of hyperlink anchors for
% |floating|\-|figure|s (provided by the \pkg{float\-flt} package),
% |FP|\-|figure|s \& |FPtable|s (provided by the \pkg{flt\-page} package),
% |fig|\-|window|s (provided by the \pkg{pic\-in\-par} package),
% |par|\-|pic|s (provided by the \pkg{pic\-ins} package),
% |SC|\-|figure|s (provided by the \pkg{side\-cap} package),
% |three|\-|part|\-|table|s (provided by the \pkg{three\-part\-table} package),
% and |wrapfigure|s (provided by the \pkg{wrap\-fig} package).
%
% \pagebreak[3]
% \subsection{listings}
% \label{listings}
% \packagedescription{%
% The \pkg{listings} package\cite{listings} typesets programming code.}
%
% If you want to setup special options for the |lst|\-|listing| environment
% you can use
% \begin{quote}
%   |\captionsetup[lstlisting]|\marg{options}\quad.
% \end{quote}
%
% Please note that the \pkg{listings} package has its very own options
% for controlling the position and the skips of the caption:
% |caption|\-|pos=|, |above|\-|caption|\-|skip=|, and |below|\-|caption|\-|skip=|.
% \See{\pkg{listings} documentation for details.}
% These \pkg{listings} options override the \pkg{caption}'s ones, but
% can be again overwritten by |\caption|\-|setup[lst|\-|listing]{|\ldots|}|,
% e.g.%~
% \begin{quote}|\caption|\-|setup[lst|\-|listing]{skip=|\x|10pt}|\quad.\end{quote}
%
% \pagebreak[3]
% \subsection{longtable}
% \label{longtable}
% \packagedescription{%
% The \pkg{longtable} package\cite{longtable} offers an environment
% which behaves similar to the \texttt{tabular} environment, but the table
% itself can span multiple pages.}
%
% If you want to setup special options for the |long|\-|table| environment
% you can use
% \begin{quote}
%   |\captionsetup[longtable]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |table|.
%
% The |margin| and |width| settings usually override |\LT|\-|cap|\-|width|,
% so you get an equal look \& feel of the captions in |table|s and
% |long|\-|table|s.
% But if you set |\LT|\-|cap|\-|width| to a value different than its default
% $=$ |4in|, \thispackage\ will follow that.
% (But |\LT|\-|cap|\-|width| will be overwritten by
% |\caption|\-|setup[long|\-|table]{width=|\x\meta{value}|}|,
% even if it is set to a value different than |4in|.)
%
% \begin{Note}
% |\caption|\-|of| and |\Continued|\-|Float| do \emph{not} work for |long|\-|table|s.
% Furthermore neither |\caption| nor |\caption|\-|list|\-|entry| will increment
% the |table| counter here; it's incremented by the |long|\-|table| environment
% instead.
% \NEWfeature{v3.1}
% If you need a |long|\-|table| which does not increment the |table| counter
% please use the |long|\-|table*| environment (offered by the
% \pkg{ltcaption} package which is part of \thispackage\ bundle and will be
% loaded automatically).
% \end{Note}
%
% \pagebreak[3]
% \subsection{picinpar}
% \label{picinpar}
% \packagedescription{%
% Similar to the \pkg{floatflt} package the \pkg{picinpar}
% package\cite{picinpar} offers figures and tables which do not span the full
% width of a page and are float around by text.
% For a detailed discussion about the differences between these packages
% please take a look at The \LaTeX\ Companion\cite{TLC2}.}
%
% \NEWfeature{v3.1}
% If you want to setup special options for the |fig|\-|window| and
% |tab|\-|window| environments you can use
% \begin{quote}
%   |\captionsetup[figwindow]|\marg{options}\quad\emph{and}\\
%   |\captionsetup[tabwindow]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |figure| or |table|.
%
% \begin{Note}
% The |margin| or |width| setting will not be used for these figures and tables,
% unless you set it explicit with |\caption|\-|setup[fig|\-|window]{|\ldots|}| or
% |\caption|\-|setup[fig|\-|table]{|\ldots|}|.
% \end{Note}
%
% \pagebreak[3]
% \subsection{picins}
% \label{picins}
% \packagedescription{%
% Similar to the \pkg{floatflt} and \pkg{picinpar} package the
% \pkg{picins} package\cite{picins} offers figures and tables which do not
% span the full width of a page and are float around by text.
% For a detailed discussion about the differences between these packages
% please take a look at The \LaTeX\ Companion\cite{TLC2}.}
%
% \NEWfeature{v3.1}
% If you want to setup special options for the |par|\-|pic| environment you can use
% \begin{quote}
%   |\captionsetup[parpic]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |figure| or |table|.
%
% Furthermore |\pic|\-|caption[]{|\ldots|}| produce no entry in the List of Figures,
% and |\pic|\-|caption*{|\ldots|}| gives an unlabeled \& unnumbered caption.
%
% \begin{Note}
% The |margin| or |width| setting will not be used for these figures and tables.
% \iffalse
% if |pic|\-|caption|\-|side| or |pic|\-|caption|\-|top|\-|side| is used.
% The |width| setting will not be used (but the |margin| setting will) if
% |pic|\-|caption|\-|out|\-|side| or |pic|\-|caption|\-|in|\-|side| is used.
% \fi
% But you can override this by setting it explicit with
% |\caption|\-|setup[par|\-|pic]{|\ldots|}|.
% \end{Note}
%
% If you want to have a |\pic|\-|caption| of another type as |figure|, please
% do \emph{not} re-define |\@cap|\-|type| as suggested by the \pkg{picins}
% documentation. Please use the |\pic|\-|caption|\-|type|\marg{type} command
% which is offered by \thispackage\ instead, e.g.:
% \begin{quote}
%   |\piccaptiontype{table}|\\
%   |\piccaption{An example table}|\\
%   |\parpic(50mm,10mm)[s]{|\ldots|}|
% \end{quote}
%
% \pagebreak[3]
% \subsection{rotating}
% \label{rotating}
% \packagedescription{%
% The \pkg{rotating} package\cite{rotating} offers the floating
% environments \texttt{side\-ways\-figure} and \texttt{side\-ways\-table} which
% are just like normal figures and tables but rotated by 90 or 270 degree.
% Furthermore a command \cs{rot\-caption} is offered for rotated captions only.}
%
% \iffalse % No, we don't do that
% If you want to setup special options for the |side|\-|ways|\-|figure| and
% |side|\-|ways|\-|table| environments you can use
% \begin{quote}
%   |\captionsetup[sidewaysfigure]|\marg{options}\\
%   |\captionsetup[sidewaystable]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |figure| or |table|.
% \fi
%
% The command |\rot|\-|caption| will be extended by \thispackage, so
% |\rot|\-|caption*| and |\rot|\-|caption|\-|of| can be used analogous to
% |\caption*| and |\caption|\-|of|.
%
% \pagebreak[3]
% \subsection{setspace}
% \label{setspace}
% \packagedescription{%
% The \pkg{setspace} package\cite{setspace} offers options and commands
% to change the spacing,
% e.g.\ \cs{usepackage}\x\csoarg{one\-half\-spacing}\x\csmarg{set\-space}
% causes the document to be typeset in one-and-a-half spacing.}
%
% If the \pkg{setspace} package is used in conjunction with \thispackage,
% the caption will be typeset with single spacing as default. This can be changed
% by specifying either |font=|\x|one|\-|half|\-|spacing|,
% |font=|\x|double|\-|spacing|, or |font={stretch=|\x\meta{amount}|}|.
% \See{also \longref{fonts}}
%
% \pagebreak[3]
% \subsection{sidecap}
% \label{sidecap}
% \packagedescription{%
% The \pkg{sidecap} package\cite{sidecap} offers the floating environments
% \texttt{SC\-figure} and \texttt{SC\-table} which are like usual figures
% and tables but the caption will be put \emph{beside} the contents.}
%
% If you want to setup special options for the |SCfigure| and |SCtable|
% environments you can use
% \begin{quote}
%   |\captionsetup[SCfigure]|\marg{options}\quad\emph{and}\\
%   |\captionsetup[SCtable]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |figure| or |table|.
%
% \pagebreak[3]
% \begin{Note}
% The \pkg{sidecap} package offers its own options for justification.
% If set, they will override the one specified with the caption option
% |jus|\-|ti|\-|fi|\-|ca|\-|tion=| for captions beside their contents.
% \end{Note}
%
% \begin{Note}
% The |margin| or |width| setting will not be used for these figures and tables,
% unless you set it explicit with |\caption|\-|setup[SC|\-|figure]{|\ldots|}|
% or |\caption|\-|setup[SC|\-|table]{|\ldots|}|.
% \end{Note}
%
% \medskip
%
% \begin{Annotation*}
% Instead of using the \pkg{sidecap} package you can also use the more
% powerful and flexible \pkg{floatrow} package\cite{floatrow} for typesetting
% captions beside the contents.
% \end{Annotation*}
%
% \pagebreak[3]
% \subsubsection*{Undocumented features}
% The \pkg{sidecap} package \version{1.6} has some undocumented package
% options and commands which allow further customization of the side-captions:
%
% \pagebreak[3]
% \DescribeMacro{margincaption}
% The package option
% \begin{quote}
%   |margincaption|\qquad{\small(e.g.~|\usepackage[margincaption]{sidecap}|)}
% \end{quote}
% causes all side-captions to be placed into the margin.
%
% \pagebreak[3]
% \DescribeMacro{\sidecaptionvpos}
% The command
% \begin{quote}
%   |\sidecaptionvpos|\marg{float type}\marg{pos}
% \end{quote}
% sets the vertical position of the side-caption. \meta{pos} can be either `|t|'
% (for top alignment), `|b|' (for bottom alignment), or `|c|' (for center alignment).
% The default setting for |table| is `|t|', for |figure| and all other ones
% defined with |\Declare|\-|Floating|\-|Environment| it's `|b|'.
%
% \pagebreak[3]
% \subsection{subfigure}
% \label{subfigure}
% \packagedescription{%
% The \pkg{subfigure} package\cite{subfigure} provides support for small or
% `sub' figures and tables within a single figure or table environment.
% This package is obsolete, new users should use \pkg{subfig} instead.}
%
% Since the \pkg{subfigure} package is obsolete it will only be supported in
% a way that old documents (which have used \thispackage\ \version{1.x} during
% development) should still compile as expected.
%
% Please use the \pkg{subfig} or \pkg{subcaption} package instead which both supports \thispackage\
% \version{3.x}.
%
% \See{the \pkg{subfig} package\cite{subfig} documentation for details.}
%
% \pagebreak[3]
% \subsection{supertabular and xtab}
% \label{supertabular}
% \packagedescription{%
% The \pkg{supertabular}\cite{supertabular} and \pkg{xtab}\cite{xtab}
% packages offer an environment which can span multiple pages and is quite
% similar to the \texttt{long\-table} environment provided by the
% \pkg{longtable} package\cite{longtable}.
% For a detailed discussion about the differences between these powerful
% packages please take a look at The \LaTeX\ Companion\cite{TLC2}.}
%
% If you want to setup special options for the |super|\-|tabular|
% or |x|\-|tabular| environment you can use
% \begin{quote}
%   |\captionsetup[supertabular]|\marg{options}\quad\emph{or}\\
%   |\captionsetup[xtabular]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |table|.
%
% \begin{Note}
% |\Continued|\-|Float| does not work for |super|\-|tabular|s and |x|\-|tabular|s.
% \end{Note}
%
% \pagebreak[3]
% \subsection{threeparttable}
% \label{threeparttable}
% \packagedescription{%
% The \pkg{threeparttable} package\cite{threeparttable} provides a scheme
% for tables that have a structured note section after the table contents and
% the caption.
% This scheme provides an answer to the old problem of putting footnotes in
% tables---by making footnotes entirely unnecessary.}
%
% \NEWfeature{v3.1}
% If you want to setup special options for the |three|\-|part|\-|table| and
% |measured|\-|figure| environments you can use
% \begin{quote}
%   |\captionsetup[threeparttable]|\marg{options}\quad\emph{and}\\
%   |\captionsetup[measuredfigure]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |table| or |figure|.
%
% \begin{Note}
% Since the caption will have the same width as the contents here,
% the |margin| or |width| setting will not be used for these figures and tables,
% at least unless you set it explicit with
% |\caption|\-|setup[three|\-|part|\-|table]{|\ldots|}| or
% |\caption|\-|setup[measured|\-|figure]{|\ldots|}|.
% \end{Note}
%
% \medskip
%
% \begin{Annotation*}
% Instead of using the \pkg{threeparttable} package you can
% also use the \pkg{floatrow} package\cite{floatrow} for this purpose.
% \end{Annotation*}
%
% \pagebreak[3]
% \subsection{wrapfig}
% \label{wrapfig}
% \packagedescription{%
% Similar to the \pkg{floatflt}, the \pkg{picinpar}, and the
% \pkg{picins} package the \pkg{wrapfig} package\cite{wrapfig} offers
% figures and tables which do not span the full width of a page and are float
% around by text.
% For a detailed discussion about the differences between these packages
% please take a look at The \LaTeX\ Companion\cite{TLC2}.}
%
% \NEWfeature{v3.1}
% If you want to setup special options for the |wrap|\-|figure| and
% |wrap|\-|table| environments you can use
% \begin{quote}
%   |\captionsetup[wrapfigure]|\marg{options}\quad\emph{and}\\
%   |\captionsetup[wraptable]|\marg{options}\quad.
% \end{quote}
% These options will be executed additionally to the regular ones for
% |figure| or |table|.
%
% \begin{Note}
% The |margin| or |width| setting will not be used for these figures and
% tables, unless you set it explicit with
% |\caption|\-|setup[wrap|\-|figure]{|\ldots|}|
% or |\caption|\-|setup[wrap|\-|table]{|\ldots|}|.
% \end{Note}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \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
%   ``What is a minimal working example?'' from Christian Faulhammer and Ulrich Schwarz:
%   \begin{quote}\url{http://www.minimalbeispiel.de/mini-en.html}\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{http://mirror.ctan.org/info/epslatex/}\end{quote}
% \end{itemize}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \pagebreak[3]
% \section{Thanks}
%
% I would like to thank Katja Melzner,
% Steven D. Cochran, Frank Mittelbach, Olga Lapko,
% David Carlisle, Carsten Heinz, Keith Reckdahl, Markus Kohm,
% Heiko Oberdiek, and Herbert Vo\ss.
% 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,
% Prof.~Dr.~Dirk Hoffmann,
% Frank Martini,
% Danie Els,
% Philipp Woock,
% Fadi Semmo,
% Matthias Stevens, and
% Leo Liu
% who all helped to make this package a better one.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage\appendix
% \section{Alphabetical Reference}
%
% \makeatletter
% \newenvironment{Warnings}{%
%   \newif\ifMessage
%   \def\Message{%
%     \ifMessage\end{minipage}\par\vspace\itemsep\pagebreak[3]\fi
%     \begin{minipage}{\linewidth}%
%     \setlength\parindent{0pt}%
%     \setlength\parskip{\smallskipamount}%
%     \setlength\leftskip{0pt}%
%     \color{blue}%
%     \Messagetrue}%
%   \def\Description{%
%     \par\color{black}\leftskip=1.5em}%
%   \def\Or{\@testopt\@Or{or}}%
%   \def\@Or[##1]{%
%     \\{\small\color{black}\hspace{1.5em}\textit{-- ##1 --}}\\}%
% }{%
%   \ifMessage\end{minipage}\par\fi
% }
% \makeatother
%
% \subsection{Options}
% \newcommand\preambleoption{~%
%   \begingroup\def\thefootnote{\fnsymbol{footnote}}%
%     \footnotemark[2]%
%   \endgroup}
% \newcommand\preambleoptiontext{%
%   \begingroup\def\thefootnote{\fnsymbol{footnote}}%
%     \footnotetext[2]{These options are only available in the preamble of the document.}%
%   \endgroup}
%
% \begin{longtable*}{lll}
% Option           & Short description & Section \\
% \hline
% \endhead
% |aboveskip|       & sets the skip above caption & \ref{skips} \\
% |belowskip|       & sets the skip below caption & \ref{skips} \\
% |compatibility|\preambleoption & force (non-)compatibility & \ref{compatibility} \\
% |figureposition|\preambleoption & gives a hint about the figure caption position & \ref{skips} \\
% |font|(|+|)       & sets the font & \ref{fonts} \\
% |format|          & sets the format & \ref{formats} \\
% \iffalse
% |FPlist|          & To where the list entry of a FPfigure should link? & \ref{fltpage} \\
% |FPref|           & To where a |\ref| to a FPfigure should link? & \ref{fltpage} \\
% \fi
% |hangindent|      & sets the hang indention & \ref{margins} \\
% |hypcap|          & selects `hypcap' feature & \ref{hyperref} \\
% |hypcapspace|     & sets the distance between hyperlink and contents & \ref{hyperref} \\
% |indention|       & sets the indention & \ref{margins} \\
% |justification|   & sets the justification & \ref{justification} \\
% |labelfont|(|+|)  & sets the font of the caption label & \ref{fonts} \\
% |labelformat|     & sets the format of the caption label & \ref{formats} \\
% |labelsep|        & sets the label separator & \ref{formats} \\
% |labelseparator|  & --same as |labelsep|-- & \ref{formats} \\
% |list|            & switches the entries in the List on or off & \ref{lists} \\
% |listformat|      & sets the `List of Figure/Table' entry format & \ref{lists} \\
% |margin|          & sets the margin & \ref{margins} \\
% |margin*|         & sets the margin, but only if no width is set & \ref{margins} \\
% |maxmargin|       & sets the max. margin & \ref{margins} \\
% |minmargin|       & sets the min. margin & \ref{margins} \\
% |name|            & sets the name of the current environment & \ref{names} \\
% |oneside|         & selects the one-side mode & \ref{margins} \\
% |options|         & executes the given option list & \\
% |parindent|       & sets the paragraph indention & \ref{margins} \\
% |parskip|         & sets the skip between paragraphs & \ref{margins} \\
% |position|        & gives a hint about the caption position & \ref{skips} \\
% |singlelinecheck| & switches the single-line-check on or off & \ref{justification} \\
% |skip|            & sets the skip between content and caption & \ref{skips} \\
% |strut|           & switches the usage of |\strut|s on or off & \ref{formats} \\
% |style|           & sets the caption style & \ref{style} \\
% |subtype|         & sets the sub-caption type & \phantom{t}--~\footnotemark \\
% |tableposition|\preambleoption & gives a hint about the table caption position & \ref{skips} \\
% |textfont|(|+|)   & sets the font of the caption text & \ref{fonts} \\
% |textformat|      & sets the format of the caption text & \ref{formats} \\
% |twoside|         & selects the two-side mode & \ref{margins} \\
% |type|            & sets the caption type \& places a hyperlink anchor & \ref{types} \\
% |type*|           & sets the caption type only & \ref{types} \\
% |width|           & sets a fixed caption width & \ref{margins} \\
% \end{longtable*}
% \preambleoptiontext
% \footnotetext{The option \texttt{subtype} is explained in the
%   \pkg{subcaption} package documentation.}
%
% \nopagebreak\parbox[t]{\linewidth}{% prevent from page break
% \begin{Note*}
%   Obsolete options are not listed here. See
%   \longref{caption1} and
%   \longref{caption2} for a list of these options.
% \end{Note*}}
%
% \pagebreak[3]
% \subsection{Commands}
%
% \begin{longtable*}{lll}
% Command                          & & Section \\
% \hline
% \endhead
% |\abovecaptionskip|              & & \ref{skips} \\
% |\belowcaptionskip|              & & \ref{skips} \\
% |\caption|                       & & \ref{caption} \\
% |\caption*|                      & & \ref{caption} \\
% |\captionlistentry|              & & \ref{captionlistentry} \\
% |\captionof|                     & & \ref{caption} \\
% |\captionof*|                    & & \ref{caption} \\
% |\captionsetup|                  & & \ref{captionsetup} \\
% |\captionsetup*|                 & & \ref{captionsetup} \\
% |\centerfirst|                   & & \ref{justification} \\
% |\centerlast|                    & & \ref{justification} \\
% |\clearcaptionsetup|             & & \ref{captionsetup} \\
% |\clearcaptionsetup*|            & & \ref{captionsetup} \\
% |\ContinuedFloat|                & & \ref{ContinuedFloat} \\
% |\DeclareCaptionFont|            & & \ref{declare} \\
% |\DeclareCaptionFormat|          & & \ref{declare} \\
% |\DeclareCaptionFormat*|         & & \ref{declare} \\
% |\DeclareCaptionJustification|   & & \ref{declare} \\
% |\DeclareCaptionLabelFormat|     & & \ref{declare} \\
% |\DeclareCaptionLabelSeparator|  & & \ref{declare} \\
% |\DeclareCaptionLabelSeparator*| & & \ref{declare} \\
% |\DeclareCaptionListFormat|      & & \ref{declare} \\
% |\DeclareCaptionOption|          & & \ref{declare} \\
% |\DeclareCaptionStyle|           & & \ref{declare} \\
% |\DeclareCaptionSubType|         & & --~\footnotemark \\
% |\DeclareCaptionTextFormat|      & & \ref{declare} \\
% |\showcaptionsetup|              & & \ref{captionsetup} \\
% \end{longtable*}
% \footnotetext{\cs{DeclareCaptionSubType} is explained in the
%   \pkg{subcaption} package documentation.}
%
% \clearpage
% \subsection{Warnings}
%
% \begin{Warnings}
%
% \Message
%   |\caption outside box or environment.|
% \Or
%   |\captionsetup{type=...} outside box or environment.|
% \Or
%   |\captionsetup{type*=...} or \captionof outside box|\\
%   | or environment.|
% \Description
%   You have placed a |\caption|, |\caption|\-|of|, or
%   |\caption|\-|setup{type=|\x\meta{type}|}| command outside an box, group,
%   or environment.
%   You should not do this since it could cause some bad side-effects.
%   \par\See{\longref{types} and \longref{caption}}
%
% \Message
%   |\caption will not be redefined since it's already|\\
%   |redefined by a document class or package which is|\\
%   |unknown to the caption package.|
% \Description
%   If \thispackage\ detects that some (unknown) document class or
%   package has enhanced |\caption|, it will not redefine
%   |\caption|, too, since this would simply kill the enhancement.
%   As a result some features, like |\caption*|, |\Continued|\-|Float|,
%   using the optional argument of |\caption|\-|setup|,
%   or the options |list=| and |hypcap=| will not be available.\par
%   If you don't care about the original enhancements but would
%   like to use the full range of features of \thispackage\ instead
%   you can give the unsupported(!) option |compatibility=|\x|false|
%   a try and keep your fingers crossed.
%   (But you will get the next warning instead.)
%   \par\See{\longref{classes} and \longref{compatibility}}
%
% \Message
%   |Forced redefinition of \caption since the|\\
%   |unsupported(!) package option `compatibility=false'|\\
%   |was given.|
% \Description
%   Since you were so keen to specify the option |compatibility=|\x|false|
%   \thispackage\ will try to do its best to fulfill your wishes.
%   But depending on the document class or other packages you use that
%   can end in non-functional features or even errors. So keep your
%   fingers crossed!
%   \par\See{\longref{compatibility}}
%
% \Message
%   |Hyperref support is turned off because hyperref has|\\
%   |stopped early.|
% \Description
%   If the \pkg{hyperref} package stops early during loading
%   (because of what-ever reason), the \pkg{hyperref} support of
%   \thispackage\ will not be available. As a result you could get
%   \pkg{hyperref} warnings and non-functional hyperlinks to figures
%   or tables.
%   \par\See{\longref{hyperref}\,}
%
% \Message
%   |Ignoring optional argument [|\meta{pos}|] of \setcapwidth.|
% \Description
%   \Thispackage\ tries to emulate the \KOMAScript\ commands regarding
%   captions as best as it can. But the optional argument of the
%   \KOMAScript\ command |\setcapwidth| is not (yet) working if you use
%   this package, so if you try to use it anyway, you will get this warning.
%   \par\See{\longref{KOMA}}
%
% \Message
%   |Internal Warning: |\meta{warning message}|.|
% \Description
%   You should never see this warning, either you use a package which redefines
%   |figure| or |table| and which is unknown to \thispackage, or this is a bug
%   in \thispackage.
%   Please send me an e-mail reporting this issue.
%
% \Message
%   |\label without proper \caption|
% \Description
%   Regarding |\label| the floating environments behave differently than its
%   non-floating counterparts: The internal reference will not be generated
%   at the beginning of the environment, but at |\caption| instead.
%   So you have to place the |\label| command either just \emph{after} or
%   \emph{inside} the caption text (mandatory argument of |\caption|).
%
% \Message
%   |Option `|\meta{option}|' was not in list `|\meta{option list}|'.|
% \Description
%   If you try to remove a specific option of an option list,
%   for example with |\clear|\-|caption|\-|setup[po|\-|si|\-|tion]{table}|,
%   and this option can not be found inside the option list, you will
%   get this warning. If this is not because of a typo and you would like
%   to suppress this warning, use |\clear|\-|caption|\-|setup*| instead of
%   |\clear|\-|caption|\-|setup|.
%   \par\See{\longref{captionsetup}}
%
% \Message
%   |Option list `|\meta{option list}|' undefined.|
% \Description
%   If you try to remove a specific option of an option list,
%   for example with |\clear|\-|caption|\-|setup[for|\-|mat]{figure}|,
%   and this option list is not defined (yet), you will
%   get this warning. If this is not because of a typo and you would like
%   to suppress this warning, use |\clear|\-|caption|\-|setup*| instead of
%   |\clear|\-|caption|\-|setup|.
%   \par\See{\longref{captionsetup}}
%
% \Message
%   |Obsolete option `ignoreLTcapwidth' ignored.|
% \Description
%   The \pkg{caption2} package option |ignoreLTcapwidth| will not be
%   emulated by this version of \thispackage, usually you can simply wipe it
%   away.
%   \par\See{\longref{caption2} and \longref{longtable}}
%
% \Message
%   |`ragged2e' support has been changed. Rerun to get|\\
%   |captions right.|
% \Description
%   The \pkg{ragged2e} package will only be loaded by \thispackage\ if it
%   is actually needed.
%   At least two \LaTeX\ runs are needed for that, so on the first run you could
%   get this warning.
%   Just compile your document again and this warning should go away.
%   \par\See{\longref{justification}}
%
% \Message
%   |Reference on page |\meta{page no.}| undefined.|
% \Description
%   If you use a |twoside| page layout, \thispackage\ needs to track the
%   page numbers to get the margins right.
%   At least two \LaTeX\ runs are needed for that, on the first run you could get
%   this warning.
%   Just compile your document again and this warning should go away.
%   \par\See{\longref{margins}}
%
% \Message
%   |The caption type was already set to `|\meta{type}|'.|
% \Description
%   This warning informs you about mixed caption options. For example if
%   you use a |\caption|\-|setup{type=|\x|table}| or
%   |\caption|\-|of{table}{|\ldots|}| inside a |figure| environment,
%   this would result in using both option sets for that specific caption,
%   the one for |figure| (specified with |\caption|\-|setup[figure]{|\ldots|}|)
%   and the one for |table| (specified with |\caption|\-|setup[table]{|\ldots|}|)
%   as well.\par
%   {\small(You can suppress this warning by using the starred form
%   |\caption|\-|setup*{type=|\x\ldots|}|.)\par}
%   \par\See{\longref{captionsetup}}
%
% \Message
%   |The option `hypcap=true' will be ignored for this|\\
%   |particular \caption.|
% \Description
%   \Thispackage\ hasn't found a proper hyperlink anchor for this particular
%   caption, so it decides to ignore the setting |hypcap=|\x|true| (which is set by
%   default). As a result a link to this caption (e.g.~in the List of Figures,
%   or set by |\ref| or |\auto|\-|ref|) will link you to the caption of the figure
%   or table, not to the figure or table itself.\par
%   This can happen if you use |\caption|\-|of| inside a non-floating environment,
%   but also if you use some package which redefines |figure| or |table|, and
%   which is unknown to \thispackage.\par
%   If this is ok for you but you want to suppress this warning, simply place a
%   |\caption|\-|setup{hyp|\-|cap=|\x|false}| just before the |\caption| or
%   |\caption|\-|of| command which is causing the warning.
%   If this is not ok for you, you can set a hyperlink anchor with
%   |\caption|\-|setup{type=|\x\meta{float type}|}| for yourself.
%   \par\See{\longref{hyperref}\,}
%
% \Message
%   |Unsupported document class (or package) detected,|\\
%   |usage of the caption package is not recommended.|
% \Description
%   Either the document class you use is unknown to \thispackage, or you
%   have included a package in your document which redefines |\@make|\-|caption|
%   (which is responsible for typesetting the caption internally) as well.
%   This means \thispackage\ will either change the design of captions in an
%   unwanted way, or it even refuses to work correctly at all.
%   \par\See{\longref{classes} and \longref{compatibility}}
%
% \Message
%   |Unused \captionsetup[|\meta{type}|].|
% \Description
%   You have specified options with |\caption|\-|setup[|\meta{type}|]| which are
%   not used later on.
%   This can be because of a typo in \meta{type},
%   or because you use a package which redefines |figure| or |table| and
%   which is unknown to \thispackage, or simply because you don't have any usage
%   of the environment \meta{type} after this line.
%   (If you want to suppress this warning you can use |\caption|\-|setup*|
%    instead of |\caption|\-|setup|.)
%   \par\See{\longref{captionsetup}}
%
% \Message
%   |Usage of the |\meta{package}| package together with the|\\
%   |caption package is strongly not recommended.|\\
%   |Instead of loading the |\meta{package}| package you should|\\
%   |use the caption package option `tableposition=top'.|
% \Description
%   The package \meta{package} is dealing with caption skips as well.
%   Please decide which one do you actually want to use, \thispackage\ or the
%   other one, using both can lead to wrong skips above or below the caption.
%   \par\See{\longref{skips}}
%
% \end{Warnings}
%
% \pagebreak[3]
% \subsection{Errors}
%
% \begin{Warnings}
%
% \Message
%   |Argument of \@caption has an extra }.|
% \Or
%   |Paragraph ended before \@caption was complete.|
% \Description
%   If you want to typeset something special (like a tabular) as caption,
%   you need to give an optional argument to |\caption| or |\caption|\-|of|
%   for the List of Figures or List of Tables, too, even if you don't
%   use such list.
%   \par\See{\longref{caption}, \longref{lists}, and \longref{hyperref}\,}
%
% \Message
%   |\caption outside float.|
% \Description
%   You have placed a |\caption| command outside a floating environment, or
%   a |long|\-|table| or |wrap|\-|figure|.
%   If this is what you want to, please use either
%   |\caption|\-|setup{type=|\x\meta{type}|}| $+$ |\caption| or
%   |\caption|\-|of|.
%   \par\See{\longref{caption}}
%
% \Message
%   |\ContinuedFloat outside float.|
% \Description
%   You have placed a |\Continued|\-|Float| command outside a floating
%   environment. % or |long|\-|table|.
%   If this is what you want to, please use the combination
%   |\caption|\-|setup{type=|\x\meta{type}|}| $+$ |\Continued|\-|Float|.\par
%   Please note that |\Continued|\-|Float| inside a |long|\-|table| is not
%   working, but maybe using the |long|\-|table*| environment, which
%   typesets a |long|\-|table| without incrementing the |table| counter,
%   if sufficient for you.
%   \par\See{\longref{ContinuedFloat} and \longref{longtable}}
%
% \Message
%   |Continued `|\meta{type}|' after `|\meta{type}|'.|
% \Description
%   Continued figures or tables are not allowed to be interrupted by a floating
%   environment (or |long|\-|table|) of another type,
%   e.g.~a table between a figure and a continued figure.
%   \par\See{\longref{ContinuedFloat}}
%
% \Message
%   |For a successful cooperation we need at least version|\\
%   |`|\meta{date}|' of package |\meta{package}|, but only version|\\
%   |`|\meta{old-date}|' is available.|
% \Description
%   \Thispackage\ does not work with such an outdated package, please update it
%   to a more recent version, at least to the one requested.
%
% \Message
%   |Internal Error: |\meta{error message}|.|
% \Description
%   You should never see this error.
%   Please send me an e-mail reporting this issue.
%
% \Message
%   |No float type '|\meta{type}|' defined.|
% \Description
%   The \meta{type} you have specified in |\caption|\-|setup{type=|\x\meta{type}|}|,
%   |\caption|\-|of|\marg{type}, or |\Declare|\-|Caption|\-|Sub|\-|Type| is
%   not defined.
%   \meta{type} should be either `\texttt{figure}' or `\texttt{table}', or
%   any other floating environment defined with
%   |\Declare|\-|Floating|\-|Environment| offered by the \pkg{newfloat} package,
%   |\new|\-|float| offered by the \pkg{float} package\cite{float}, or
%   |\Declare|\-|New|\-|Float|\-|Type| offered by the \pkg{floatrow} package\cite{floatrow}.
%
% \Message
%   |Not allowed in longtable* environment.|
% \Description
%   The usage of |\caption| is not allowed inside the |long|\-|table*| environment.
%   Please use either |\caption*| for a caption without label or use the regular
%   |long|\-|table| environment instead.
%
% \Message
%   |Not available in compatibility mode.|
% \Description
%   The feature required is not supported in compatibility mode.
%   `compatibility mode' means that \thispackage\ has detected either an
%   incompatible document class or an incompatible package which also
%   extents the |\caption| command. Leaving the original extension intact,
%   some features of \thispackage\ are not supported.
%   \par\See{\longref{compatibility}}
%
% \Message
%   |Only one \caption can be placed in this environment.|
% \Description
%   Inside the environments offered by the \pkg{fltpage} and \pkg{sidecap}
%   package only \emph{one} caption can be placed. (This is due implementation design.)
%
% \Message
%   |Paragraph ended before \caption@makecurrent was complete.|
% \Or
%   |Paragraph ended before \caption@prepareanchor was complete.|
% \Description
%   If you want to typeset multi-paragraph captions, you need to give an
%   optional argument to |\caption| or |\caption|\-|of| for the List of
%   Figures or List of Tables, too, even if you don't use such list.
%   \par\See{\longref{caption}, \longref{lists}, and \longref{hyperref}\,}
%
% \Message
%   |Something's wrong--perhaps a missing \caption|\\
%   |in the last figure or table.|
% \Description
%   It seems that you have used a |\sub|\-|caption| command (or a different one
%   which has typeset a sub-caption) without a corresponding |\caption| command.
%   This is not supported.
%
% \Message
%   |The option `labelsep=|\meta{name}|' does not work|\\
%   |with `format=hang'.|
% \Or
%   |The option `labelsep=|\meta{name}|' does not work|\\
%   |with \setcaphanging (which is set by default).|
% \Description
%   A caption label separator which contains a |\\| command (like
%   |labelsep=|\x|newline|) can not be combined with a hanging caption format
%   (like |format=|\x|hang|).
%   Please select either another caption label separator
%   (e.g.~|labelsep=|\x|colon|) or another caption format
%   (e.g.~|format=|\x|plain|).
%   \par\See{\longref{formats} or \longref{KOMA}}
%
% \Message
%   |The package option `caption=false' is obsolete.|\\
%   |Please pass this option to the subfig package instead|\\
%   |and do *not* load the caption package anymore.|
% \Description
%   You have specified the option |caption=|\x|false|. This used to be a workaround
%   for not using the whole \pkg{caption} package (leaving the caption stuff
%   offered by the document class or other packages intact), but keeping the
%   \pkg{subfig} package working. This mechanism is obsolete and not offered
%   anymore, please pass this option to the \pkg{subfig} package instead and
%   do not load \thispackage\ anymore.
%   \par\See{the \pkg{subfig} package\cite{subfig} documentation}
%
% \Message
%   |Undefined boolean value `|\meta{value}|'.|
% \Description
%   You tried to set a boolean option (like |singlelinecheck=| or |hypcap=|)
%   with an improper value. Only |false|, |no|, |off|, |0| or |true|, |yes|,
%   |on|, |1| is allowed here.
%
% \Message
%   |Undefined format `|\meta{name}|'.|
% \Description
%   You tried to set a caption format which does not exists.
%   Maybe a typo!?
%   \par\See{\longref{formats}}
%
% \Message
%   |Undefined label format `|\meta{name}|'.|
% \Description
%   You tried to set a caption label format which does not exists.
%   Maybe a typo!?
%   \par\See{\longref{formats}}
%
% \Message
%   |Undefined label separator `|\meta{name}|'.|
% \Description
%   You tried to set a caption label separator which does not exists.
%   Maybe a typo!?
%   \par\See{\longref{formats}}
%
% \Message
%   |Undefined list format `|\meta{name}|'.|
% \Description
%   You tried to set a caption list-of format which does not exists.
%   Maybe a typo!?
%   \par\See{\longref{lists}}
%
% \Message
%   |Undefined position `|\meta{name}|'.|
% \Description
%   You tried to set a caption position with an improper value.
%   Maybe a typo!?
%   \par\See{\longref{skips}}
%
% \Message
%   |Undefined style `|\meta{name}|'.|
% \Description
%   You tried to set a caption style which does not exists.
%   Maybe a typo!?
%   \par\See{\longref{style}}
%
% \Message
%   |Usage of the `position' option is incompatible|\\
%   |to the `|\meta{package}|' package.|
% \Description
%   The given package is dealing with caption skips as well.
%   Please decide which one do you actually want to use: The |position=| option
%   of \thispackage\ or the mechanism of the other one; using both this way
%   would lead to wrong skips above or below the caption and is therefore
%   not supported.
%   \par\See{\longref{skips}}
%
% \Message
%   |Undefined text format `|\meta{name}|'.|
% \Description
%   You tried to set a caption text format which does not exists.
%   Maybe a typo!?
%   \par\See{\longref{formats}}
%
% \Message
%   |You can't use both, the (obsolete) caption2 *and*|\\
%   |the (current) caption package.|
% \Description
%   This error message says it all, you simply can't do that.
%   Please use only \thispackage.
%   \par\See{\longref{caption2}}
%
% \end{Warnings}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Version history}
% \label{history}
%
% The version $1.0$ was written in 1994 and was offering a handful of options
% to customize the look \& feel of the captions.
% Furthermore this version already supported the \pkg{rotating} and
% \pkg{subfigure} packages.
% Version $1.1$ introduced the |center|\-|last| option;
% version $1.2$ added the support of the \pkg{float} package.
% Version $1,3$ offered a better support of the \pkg{subfigure} package,
% while version $1.4$ came with the new option |nooneline|.
%
% The \pkg{caption2} package $2.0$ was an experimental side-version of
% the regular \pkg{caption} package. It was made public as beta test version
% without proper documentation in 1995 because of the strong demand for new
% features and adaptations to additional packages like the \pkg{longtable}
% package.
% Furthermore it offered a revised support of the \pkg{subfigure} package.
% (An improved version $2.1$ was offered in 2002.)
%
% In 2003 I finally found some time, so a new regular release $3.0$
% of the \pkg{caption} package could be build in cooperation with
% Frank Mittelbach and Steven Cochran.
% It was released in December 2003 and superseded the neglected
% \pkg{caption2} package.
% Main parts were re-written and it provided a complete re-work of
% the user interface.
% Furthermore it supported the \pkg{hyperref}, \pkg{hypcap},
% \pkg{listings}, \pkg{sidecap}, and \pkg{supertabular} packages
% additionally.
%
% While all the previous versions were designed for usage with the standard
% \LaTeX\ document classes \cls{article}, \cls{report}, and \cls{book},
% the current version $3.1$ released in 2007 also supports the \AmS,
% \KOMAScript, \NTG, and \SmF\ document classes, and the \cls{beamer} class
% as well.
% Furthermore it was adapted to the \pkg{french} Babel option,
% the \pkg{frenchle} \& \pkg{frenchpro} packages,
% and the \pkg{floatflt}, \pkg{fltpage}, \pkg{picinpar},
% \pkg{picins}, \pkg{setspace}, \pkg{threeparttable},
% and \pkg{wrapfig} packages.
% New options and commands were introduced as well, among other things
% |font+|, |figure|\-|within| \& |table|\-|within|,
% |list| \& |list|\-|format|, |max|\-|margin| \& |min|\-|margin|,
% |\caption|\-|list|\-|entry|, |\Declare|\-|Caption|\-|List|\-|Format|.
% Further benefits are the new compatibility check \see*{\longref{compatibility}},
% the new ``hypcap'' feature \see*{\longref{hyperref}\,}, and the sub-caption
% feature \see*{\pkg{subcaption} package documentation}.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Compatibility to older versions}
%
% \subsection{caption v\texorpdfstring{$1.x$}{1.x}}
% \label{caption1}
%
% This version of \thispackage\ still supports the old options
% and commands provided by the version $1.0$ to $1.4$ 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 how
% they have been replaced within this version of \thispackage:
%
% \begin{center}\small
% \begin{tabular}{ll}
% \pkg{caption} \version{1.x} & \pkg{caption} \version{3.x}\\
% \hline
% |normal|        & |format=plain|\\
% |hang|          & |format=hang|\\
% |isu|           & |format=hang|\\
% |center|        & |justification=centering|\\
% |centerlast|    & |justification=centerlast|\\
% |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{tabular}
% \end{center}
%
% Beside the options for setting up the desired font there were also
% the commands |\caption|\-|size| or |\caption|\-|font| and
% |\caption|\-|label|\-|font| who could be redefined with
% |\re|\-|new|\-|command| 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{\longref{margins}}
%
% 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
% \pkg{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 \thispackage\ offers a more flexible way
% for changing the captions of these floating environments:
% \begin{quote}
%   |\DeclareCaptionStyle{ruled}{|\ldots|}|
% \end{quote}
% or
% \begin{quote}
%   |\captionsetup[ruled]{|\ldots|}|\qquad.
% \end{quote}
% \SeeUserDefined[, \longref{captionsetup}, and \longref{float}]
%
% \subsection{caption2 v\texorpdfstring{$2.x$}{2.x}}
% \label{caption2}
%
% Although they do very similar stuff, the packages \pkg{caption} and
% its experimental and now obsolete variant \pkg{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 \pkg{caption2}
% package will still compile fine.
%
% Newly created documents should use the actual version of
% \thispackage\ 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 \pkg{caption2}
% to \pkg{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:
%
% \begin{center}\small
% \begin{tabular}{ll}
% \pkg{caption2} \version{2.x} & \pkg{caption} \version{3.x}\\
% \hline
% |flushleft|   & |justification=raggedright|\\
% |flushright|  & |justification=raggedleft|\\
% |oneline|     & |singlelinecheck=on|\\
% \end{tabular}
% \end{center}
%
% Setting the margin for captions was done in \version{2.x} with
% \begin{quote}\leavevmode\hbox{%
%   |\setcaptionmargin{|\ldots|}| or
%   |\setcaptionwidth{|\ldots|}|\quad.
% }\end{quote}
% This was replaced by
% \begin{quote}\leavevmode\hbox{%
%   |\captionsetup{margin=|\ldots|}| or
%   |\captionsetup{width=|\ldots|}|\quad.
% }\end{quote}
% \See{\longref{margins}}
%
% Setting an indention was done in \version{2.x} with
% \begin{quote}
%   |\captionstyle{indent}|\\
%   |\setlength\captionindent{|\ldots|}|\quad.
% \end{quote}
% \pagebreak[3]
% This is now done with
% \nopagebreak[3]
% \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
% |\caption|\-|setup{single|\-|line|\-|check=|\x|off}|
% or
% |\caption|\-|setup{single|\-|line|\-|check=|\x|on}|\quad.
% \See{\longref{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 \thispackage. (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
% be able to find appropriate options and commands instead.
%
% \iffalse
% ... (some examples)
% \fi
%
% The \version{2.x} option |ignore|\-|LT|\-|cap|\-|width| do not have a
% replacement, too.
% But in most cases you can simply drop using that option because
% in this version of \thispackage\ the value of |\LT|\-|cap|\-|width|
% will be ignored anyway (unless you set it to a different value than the
% default one which is |4in|).
% \See{\longref{longtable}}
%
% \subsection{caption v\texorpdfstring{$3.0$}{3.0}}
% \label{caption3}
%
% \Thispackage\ \version{3.0} did not support any document classes
% other than the standard \LaTeX\ ones: \cls{article}, \cls{report},
% and \cls{book}.
% Therefore the default settings used to be fixed, but now \thispackage{}
% supports more classes, therefore they are now set in dependence on the
% document class used.
%
% For example: While in \version{3.0} the default caption
% |jus|\-|ti|\-|fi|\-|ca|\-|tion| used to be always |jus|\-|ti|\-|fied|,
% it's now still |jus|\-|ti|\-|fied| when using one of the standard document
% classes, but |ragged|\-|right| will be used as default format when used
% with the \cls{beamer} document class.
%
% An easy way to select the `old' defaults is using the option
% |style=base| when loading \thispackage\ (or later on using |\caption|\-|setup|).
%
% \medskip
%
% Another new feature is the automatic check for compatibility; if an
% incompatibility will be found, a warning message will be issued and if a strong
% incompatibility was found some features of \thispackage\ will be disabled.
% Please note that only this check was added to \thispackage, so if you get
% such warning message, the previous versions of \thispackage\ were incompatible
% as well, but did not issued such warning, they were ``only'' having
% side-effects or causing problems.
% So these warnings only say that some bad side effects or problems could
% happen, but not that they actually will happen.
% Anyway, if you use \thispackage\ in such circumstances,
% you should use it with care.
%
% \bigskip
%
% \begin{Note*}
% \Thispackage\ \version{3.0} offered the option |caption=|\x|false|,
% which used to be a workaround for not using the whole \pkg{caption} package
% (leaving the caption stuff offered by the document class or other packages
% intact), but keeping the \pkg{subfig} package\cite{subfig} working.
% This mechanism is obsolete and not offered anymore, please pass this option
% to the \pkg{subfig} package instead and do not load \thispackage\ anymore.
% \end{Note*}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Commands for document class authors}
%
% A document class could simply load the \pkg{caption} package instead
% of defining an own variant of |\@make|\-|caption|. However if the author decides
% not to do this -- for whatever reason -- there is a second option:
%
% \NEWfeature{v3.5}
% If a document class defines |\caption@document|\-|class|, an adaption to the
% \pkg{caption} package will be loaded as |caption-|\meta{documentclass}|.sto|
% if the \pkg{caption} kernel is loaded.
% The goal of this adaption file is changing the default settings of the
% \pkg{caption} package so simply loading it (without any package options)
% will not make any harm to the look at feel of the captions.
% This gives end-users the opportunity to fine-tune certain aspects of the
% appearance of captions by adding package options, without unwanted
% side-effects on other aspects of the appearance.
%
% In both cases the command |\Set|\-|Caption|\-|Default|
% could be used to adapt the \pkg{caption} package default values:
%
% \DescribeMacro{\SetCaptionDefault}
% The command
% \begin{quote}
%   |\SetCaptionDefault*|\marg{option}\marg{default value}
% \end{quote}
% changes the default value for the option \meta{option}, for example:
% \begin{quote}
%   |\SetCaptionDefault{format}{hang}|\\
%   |\SetCaptionDefault{justification}{raggedright}|\\
%   |\DeclareCaptionLabelSeparator{silly}{ +++ }|\\
%   |\SetCaptionDefault{labelseparator}{silly}|
% \end{quote}
% This command is available for the options
%   |box|,
%   |font|,
%   |format|,
%   |justification|,
%   |label|\-|font|,
%   |label|\-|format|,
%   |label|\-|separator|,
%   |list|\-|format|,
%   |margin|,
%   |parbox|,
%   |position|,
%   |single|\-|line|\-|check|,
%   |text|\-|font|,
%   |text|\-|format|, and
%   |width|.
%
% The starred variant only makes a difference when setting the default length
% of either |margin| or |width|, in this case it will use |\def| internally
% instead of |\edef| to store the value so the actual margin will be calculated
% when used (and not when set).
%
% \DescribeMacro{\SetCaptionFallback}
% The command
% \begin{quote}
%   |\SetCaptionFallback|\marg{option}\marg{fallback value}
% \end{quote}
% changes the fallback value for the option \meta{option}, for example:
% \begin{quote}
%   |\SetCaptionFallback{labelformat}{simple}|
% \end{quote}
% Currently only the pre-defined label format `original' uses a fallback
% value when |\fnum@|\meta{environment} is not defined for the current (floating)
% environment.
%
% \DescribeMacro{\AtCaptionPackage}
% The adaption file will be loaded when the \pkg{caption} kernel |caption3.sty|
% will be loaded so the given adaptions will be done for the \pkg{floatrow}
% and \pkg{subfig} packages even if the \pkg{caption} package isn't loaded.
%
% But some adaptions have to be done for the \pkg{caption} package,
% and for this reason the hook
% \begin{quote}|\AtCaptionPackage|\marg{code}\end{quote}
% is offered to authors of adaption files.
% The \meta{code} inside the hook will be executed right before the given package
% options will be evaluated.
%
% For example the adaption file for the \KOMAScript\ document classes
% uses |\At|\-|Begin|\-|Caption| to re-define the \pkg{caption} package
% options |figure|\-|position| and |table|\-|position| to issue a warning
% that using these options have little effect here.
%
% \DescribeMacro{\AfterCaptionPackage}
% The additional hook
% \begin{quote}|\AfterCaptionPackage|\marg{code}\end{quote}
% is offered to authors of adaption files as well.
% The \meta{code} inside the hook will be executed at the very end of the
% \pkg{caption} package.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{Commands for babel language package authors}
%
% \NEWfeature{v3.5}
% \DescribeMacro{\caption@switchdefault}
% If the \pkg{caption3} kernel package is loaded, the command
% \begin{quote}|\caption@switchdefault|\marg{option}\marg{code with \#1}\marg{new value}\end{quote}
% is available which saves the old default value of the given option using
% \meta{code} and sets the new default value afterwards.
%
% \DescribeMacro{\caption@restoredefault}
% The command
% \begin{quote}|\caption@restoredefault|\marg{option}\marg{old value}\end{quote}
% restores the old default value which was stored in \meta{old value} before.
%
% Example:
% \begin{quote}
%   |\DeclareCaptionLabelSeparator{french}{|\ldots|}|\\
%   |\addto\extrasfrench{%|\\
%   |  \caption@switchdefault{labelseparator}{\babel@save #1}{french}}|\\
%   |% Note: \caption@restoredefault isn't needed here|
% \end{quote}
%
% Another example:
% \begin{quote}
%   |\caption@switchdefault{font}{\let\original@captionfont#1}{it}%|\\
%   \ldots\\
%   |\caption@restoredefault{font}{\original@captionfont}%|\\
% \end{quote}
%
% Since boths commands are defined with |\def| inside the \pkg{caption3}
% kernel, they could be pre-defined with
% \begin{quote}
%   |\providecommand\caption@switchdefault[3]{}|\\
%   |\providecommand\caption@restoredefault[2]{}|
% \end{quote}
% inside the babel language package so their existence doesn't need to be tested
% prior use.
%
% Additionally babel language packages should not re-define |\@make|\-|caption|
% if the \pkg{caption} package is loaded, i.e.~if |\caption@makecaption| is
% defined. (Unfortunately one cannot use the \LaTeX{} kernel command
% |\@if|\-|package|\-|loaded{caption}| here since it's only available in the
% document preamble.)
%
% Please note that code like
% \begin{quote}
%   |\addto\extraswhatever{%|\\
%   |  \@ifundefined{caption@makecaption}{%|\\
%   |    \babel@save\@makecaption|\\
%   |    \let\@makecaption\my@makecaption|\\
%   |  }{%|\\
%   |    \caption@switchdefault{|\ldots|}{\babel@save #1}{|\ldots|}%|\\
%   |  }}|
% \end{quote}
% would be wrong since it mixes up the presence of the \pkg{caption3} kernel
% and the \pkg{caption} package.
% If the \pkg{caption3} kernel is loaded this does not mean that the
% \pkg{caption} package is loaded, too, and the latter one re-defines
% |\caption|, |\@caption|, and |\@make|\-|caption| while the \pkg{caption3}
% kernel does not re-define any of them, instead it only provides (default) values
% for the \pkg{caption}, \pkg{floatrow}, and \pkg{subfig} package.
%
% Currently there is build-in support for the following babel language options:
% |arabic|, |farsi|, |french|, |hungarian|, |latvian|, and |magyar|.
% This support could be deactivated by defining
% \begin{quote}
%   |\def\caption@ifbabel@|\meta{package}|{false}|
% \end{quote}
% where \meta{package} is either |arabi|, |french|, |frenchle|, |hungarian|,
% or |latvian|.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \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| & \pkg{floatrow} \\
%   |\caption@settype|                & \pkg{newfloat} \\
%   |\caption@xlabel|                 & \pkg{cleveref} \\
% \end{tabular}\end{quote}
%
% If your package wants to use any other internal command of the \pkg{caption} package,
% please write me an e-mail so we can define a proper interface together.
%
% The \pkg{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}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \StopEventually{%^^A
% \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://www.ctan.org/pkg/beamer}%
%        {\emph{User Guide to the Beamer Class, Version 3.07}},\\
%   March 11, 2007
%
%   \bibitem{KOMAScript}
%   Markus Kohm \& Jens-Uwe-Morawski:\\
%   \href{http://www.ctan.org/pkg/koma-script}%
%        {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\
%   2007-01-09
%
%   \bibitem{NTG}
%   Victor Eijkhout:\\
%   \href{http://www.ctan.org/pkg/ntgclass}%
%        {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\
%   3 September 1989
%
%   \bibitem{algorithms}
%   Rog\'erio Brito:\\
%   \href{http://www.ctan.org/pkg/algorithms}%
%        {\emph{Algorithms}},\\
%   June 2, 2006
%
%   \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{setspace}
%   Erica M. S. Harris \& Geoffrey Tobin:\\
%   \href{http://www.ctan.org/pkg/setspace}%
%        {\emph{LaTeX Document Package ``setspace''}},\\
%   1 December 2000
%
%   \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
%
% \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{\kernel@ifnextchar}
% \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}
% \renewcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
% \let\endNote\undefined
%
% \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 \pkg{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: \pkg{caption} \& \pkg{caption3}}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{The implementation}
%
% \iffalse
%<*package>
% \fi
%
% \subsection{Introduction}
%
% \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 \pkg{longtable} or \pkg{supertabular} package):
% Mapping the appropriate internal commands (like |\LT@makecaption| or
% |\ST@caption|) to the ones offered by the \pkg{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
% \pkg{caption3} kernel.
%
% \subsection{Identification}
%
% We need at least \LaTeX2e\ version 1994/12/01.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%    \end{macrocode}
%
% Bypass the release declarations in case the \LaTeX\ kernel doesn’t know how to deal with them
% (as suggested by \url{https://www.latex-project.org/publications/2018-FMi-TUB-tb122mitt-version-rollback.pdf}).
%    \begin{macrocode}
\providecommand\DeclareRelease[3]{}
\providecommand\DeclareCurrentRelease[2]{}
%    \end{macrocode}
%
% Declare all supported releases.
%    \begin{macrocode}
\DeclareRelease{v1}{1994-10-27}{caption_1995-04-05.sty}
\DeclareRelease{v3.0}{2003-12-20}{caption_2007-04-16.sty}
\DeclareRelease{v3.1}{2007-09-01}{caption_2010-01-09.sty}
\DeclareRelease{v3.2}{2011-08-06}{caption_2011-11-10.sty}
\DeclareRelease{v3.3}{2013-01-10}{caption_2019-09-01.sty}
\DeclareRelease{v3.4}{2019-11-24}{caption_2020-07-29.sty}
\DeclareRelease{v3.5}{2020-08-30}{caption_2020-10-26.sty}
\DeclareCurrentRelease{v3.6}{2022-02-20}
%    \end{macrocode}
%
% Identify the current version of the package.
%    \begin{macrocode}
\ProvidesPackage{caption}[2023/08/05 v3.6o Customizing captions (AR)]
%    \end{macrocode}
%
% \subsection{Loading the kernel}
%
% Load a matching version of the \pkg{caption} kernel.
%    \begin{macrocode}
\RequirePackage{caption3}[2023/07/31] % needs v2.4d or newer
%    \end{macrocode}
%
% \subsection{Check against unknown document classes}
%
%    \begin{macrocode}
\caption@ifdocumentclass{unknown}%
  {\caption@WarningNoLine{%
     Unknown document class (or package),\MessageBreak
     standard defaults will be used}}%
  {}
%    \end{macrocode}
%
% \subsection{Check against incompatible packages}
%
% \changes{v3.0p}{2007/04/06}{Check against obsolete \pkg{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}
%
% Check against incompatible packages which used to work fine with \version{1} of the `caption' package.
% \changes{v3.1}{2007/06/15}{Check against incompatible \pkg{ftcap} package added}
% \changes{v3.1}{2007/06/15}{Check against incompatible \pkg{nonfloat} package added}
% \changes{v3.1}{2007/06/18}{Check against incompatible \pkg{topcapt} package added}
% \changes{v3.6}{2021/01/02}{Check against incompatible packages \pkg{ftcap}, \pkg{nonfloat}, and \pkg{topcapt} revised}
%    \begin{macrocode}
\caption@AtBeginDocument{%
  \caption@setincompatible{\@ifpackageloaded{captcont}}{captcont package}%
  \caption@setincompatible{\@ifpackageloaded{ftcap}}{ftcap package}%
  \caption@setincompatible{\@ifpackageloaded{nonfloat}}{nonfloat package}%
  \caption@setincompatible{\@ifpackageloaded{topcapt}}{topcapt package}}
%    \end{macrocode}
%
% \begin{macro}{\caption@setincompatible}
% \changes{v3.4}{2019/09/09}{This macro added}
% \changes{v3.6}{2020/12/22}{Adapted to fallback concept}
% |\caption@setincompatible|\marg{condition}\marg{message text}
%    \begin{macrocode}
\newcommand*\caption@setincompatible[2]{%
  #1{%
    \caption@Error{%
      The #2 is incompatible to the\MessageBreak
      current version of the `caption' package,\MessageBreak
      so try \string\usepackage{caption}[=v1] instead}%
  }{}}
\@onlypreamble\caption@setincompatible
%    \end{macrocode}
% \end{macro}
%
% \subsection{Positioning}
%
%    \begin{macrocode}
\DeclareCaptionPosition{auto}{#2}{%
  \caption@ifsubcaption@above{#2}{%
    \ifvmode
      \caption@autoposition{#1}{#2}%
    \else
      #2%
    \fi}}
%    \end{macrocode}
%
% \subsection{Declaration of options}
%
% \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}
%
% \changes{v3.2}{2010/11/07}{Option \opt{parboxrestore} added}
% \changes{v3.6}{2021/01/07}{(Undocumented) Option \opt{parboxrestore} removed}
%
% \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}
%
% \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}
% \changes{v3.6}{2020/12/22}{Option `compatibility' adapted to fallback concept}
% \changes{v3.6h}{2022/07/03}{Command \cs{caption@ifcompatibility} re-added}
%
% We only support boolean values for the |compatibility=| option
% since these were the only one which were documented in the past.
%
%    \begin{macrocode}
\DeclareCaptionOption{compatibility}[1]{%
  \caption@ifinlist{#1}{1,true,yes,on}{%
    \caption@Error{%
      Obsolete compatibility value `#1',\MessageBreak
      please use either \string\usepackage{caption}[=v1]\MessageBreak
      or \string\usepackage{caption-light} instead}%
  }{\caption@ifinlist{#1}{0,false,no,off}{%
      \let\caption@ifcompatibility\@secondoftwo % not used; for backward compatibility only
  }{%
    \caption@Error{Undefined compatibility value `#1'}%
  }}}
\@onlypreamble@key{caption}{compatibility}
\caption@setbool{compatibility}{0} % default: Try not to be compatible to v1.x
%    \end{macrocode}
%
% \subsubsection{caption v1.x compatibility options}
%
%    \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}
%
% \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}
% \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}
%
% \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| or
% |\pageref| or |\autoref| will link to.
% Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent,
% but compatible to the usual behaviour of the \pkg{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 \pkg{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{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}
%
% \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@flags}
% \changes{v3.3}{2018/08/08}{This counter and associated macros added}
% 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 have proven that correcting a counter locally is not a good idea,
% and to make it dependent on the |position=| setting (like the \pkg{subfig} package does)
% is not a good idea, either.
%
% In the past three boolean switches were used to store the flags, but since some
% packages (like the \pkg{floatrow} and \pkg{tabu} package) try hard to keep
% \LaTeX{} counter changes locally under certain circumstances, it seems a good idea to make
% these flags a \LaTeX{} counter value.
%
% See also:
% \url{https://gitlab.com/axelsommerfeldt/caption/-/issues/27} and
% \url{https://tex.stackexchange.com/questions/444942/subcaptionbox-in-tabu-wrong-numbering-of-subfigures}
%
%    \begin{macrocode}
\newcounter{caption@flags}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@clrflags}
% \changes{v3.3}{2018/08/08}{This macro added}
% |\caption@clrflags| clears all flags.
% Note that we have to use |\set|\-|counter| here (instead of using \TeX{} primitives)
% since some packages re-define |\set|\-|counter| to keep counter changes local.
%    \begin{macrocode}
\newcommand*\caption@clrflags{%
  \setcounter{caption@flags}{0}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifflags}
% \changes{v3.6}{2020/12/28}{This macro added}
% |\caption@ifflags|\marg{yes-code}\marg{no-code}\\
% tests if any of the flags is set.
%    \begin{macrocode}
\newcommand*\caption@ifflags{%
  \ifcase\c@caption@flags
    \expandafter\@secondoftwo
  \else
    \expandafter\@firstoftwo
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \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}
% |\caption@setflag|\marg{number}\\
% sets the flag with the given number (where \meta{number} is one of 1, 2, 4, 8, 16, \ldots).
% Note that we have to use |\add|\-|to|\-|counter| here (instead of |\advance|)
% since some packages re-define |\add|\-|to|\-|counter| to keep counter changes local.
%    \begin{macrocode}
\newcommand*\caption@setflag[1]{%
  \caption@ifflag{#1}{}{\addtocounter{caption@flags}{#1}}}
%    \end{macrocode}
% \end{macro}
%
% \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}
% |\caption@ifflag|\marg{number}\marg{yes-code}\marg{no-code}\\
% tests if the flag with the given number is set (where \meta{number} is one of 1, 2, 4, 8, 16, \ldots).
%    \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@setcontinued}
% \changes{v3.6}{2020/09/20}{This macro added}
% |\caption@setcontinued| sets the `continued float' flag, i.e. |\continued|\-|float| was used.
%    \begin{macrocode}
\newcommand*\caption@setcontinued{\caption@setflag1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifcontinued}
% \changes{v3.3}{2011/12/28}{This switch added}
% \changes{v3.3}{2018/08/08}{\cs{ifcaption@ContinuedFloat} replaced by \cs{caption@ifflag1}}
% \changes{v3.6}{2020/09/20}{Revived as \cs{caption@ifcontinued}}
% |\caption@if|\-|continued|\marg{yes-code}\marg{no-code}\\
% tests if the `continued float' flag is set.
%    \begin{macrocode}
\newcommand*\caption@ifcontinued{\caption@ifflag1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setcaption}
% \changes{v3.6}{2020/09/20}{This macro added}
% |\caption@setcaption| sets the `caption' flag, i.e. |\caption|, |\phantom|\-|caption|, or |\caption|\-|list|\-|entry| was used.
%    \begin{macrocode}
\newcommand*\caption@setcaption{\caption@setflag2}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifcaption}
% \changes{v3.3}{2011/12/28}{This switch added}
% \changes{v3.3}{2018/08/08}{\cs{ifcaption@caption} replaced by \cs{caption@ifflag2}}
% \changes{v3.6}{2020/09/20}{Revived as \cs{caption@ifcaption}}
% |\caption@if|\-|caption|\marg{yes-code}\marg{no-code}\\
% tests if the `caption' flag is set.
%    \begin{macrocode}
\newcommand*\caption@ifcaption{\caption@ifflag2}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setsubcaption}
% \changes{v3.6}{2020/09/20}{This macro added}
% |\caption@setsubcaption| sets the `subcaption' flag, i.e. |\subcaption|, |\subcaptionbox|, \ldots was used.
%    \begin{macrocode}
\newcommand*\caption@setsubcaption{%
  \caption@ifcaption{\caption@setflag8}{\caption@setflag4}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifsubcaption@above}
% \changes{v3.3}{2011/12/28}{This switch added}
% \changes{v3.3}{2018/08/08}{\cs{ifcaption@subcaption} replaced by \cs{caption@ifflag4}}
% \changes{v3.6}{2020/09/20}{Revived as \cs{caption@ifsubcaption@above} and \cs{caption@ifsubcaption@below}}
% |\caption@if|\-|sub|\-|caption@above|\marg{yes-code}\marg{no-code}\\
% tests if the `subcaption' flag was set before the `caption' flag was set, i.e. a sub-caption was typeset \emph{above} the corresponding caption.
%    \begin{macrocode}
\newcommand*\caption@ifsubcaption@above{\caption@ifflag4}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifsubcaption@below}
% \changes{v3.3}{2011/12/28}{This switch added}
% \changes{v3.3}{2018/08/08}{\cs{ifcaption@subcaption} replaced by \cs{caption@ifflag4}}
% \changes{v3.6}{2020/09/20}{Revived as \cs{caption@ifsubcaption@above} and \cs{caption@ifsubcaption@below}}
% |\caption@if|\-|sub|\-|caption@below|\marg{yes-code}\marg{no-code}\\
% tests if the `subcaption' flag was set after the `caption' flag was set, i.e. a sub-caption was typeset \emph{below} the corresponding caption.
%    \begin{macrocode}
\newcommand*\caption@ifsubcaption@below{\caption@ifflag8}
%    \end{macrocode}
% \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}
% \changes{v3.6}{2022/01/05}{Usage of \cs{caption@Error} replaced by \cs{caption@OutsideFloat}}
%  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@OutsideFloat\caption
     \caption@withoptargs\@gobbletwo}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@OutsideFloat}
% \changes{v3.6}{2022/01/05}{This macro added}
% |\caption@OutsideFloat}| issues a ``\meta{command} outside float'' error.
%    \begin{macrocode}
\newcommand*\caption@OutsideFloat[1]{%
  \caption@Error{\string#1 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}}
% \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}
% \changes{v3.6}{2022/01/06}{Usage of \cs{caption@nobreak} added to improve \textsf{beamer} document class support}
%  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@nobreak
  \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@nobreak
      \caption@if@minipage\@minipagetrue\@minipagefalse}%
  \caption@end}
%    \end{macrocode}
% \cls{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}
% \cls{memoir} document class stuff:
%    \begin{macrocode}
\providecommand\M@gettitle[1]{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@nobreak}
% \changes{v3.6}{2022/01/06}{This macro added}
% |\caption@nobreak| for use in places where |\@caption| or |\beamer@makecaption| does |\nobreak|.
% It's defined to do nothing unless the \cls{beamer} document class is used.
%    \begin{macrocode}
\newcommand*\caption@nobreak{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@parboxrestore}
% \changes{v3.1}{2007/03/03}{This macro definition 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}}
% \changes{v3.6}{2021/01/02}{Always uses \cs{@parboxrestore} now}
% |\caption@parboxrestore| simply expands to |\@par|\-|box|\-|restore|.
%    \begin{macrocode}
\newcommand*\caption@parboxrestore{\@parboxrestore}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@makecaption}
% \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added}
% \changes{v3.6}{2022/01/06}{Usage of \cs{caption@nobreak} added to improve \textsf{beamer} document class support}
%  |\@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 \pkg{caption} kernel to finally
%  typeset the caption.
%    \begin{macrocode}
\long\def\caption@makecaption#1#2{%
  \caption@nobreak
  \caption@make@above
  \caption@nobreak
  \caption@@make{#1}{#2}%
  \caption@nobreak
  \caption@make@below
  \caption@nobreak}
%    \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 or 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.1}{2007/05/09}{Re-definition of \cs{@xfloat} added}
% \changes{v3.1b}{2007/09/22}{cs{@xfloat} will now be redefined in compatibility mode, too}
% \changes{v3.1k}{2009/03/30}{The macro \cs{caption@redefine} contains the patching code now}
% \changes{v3.5}{2020/08/30}{Re-definition of \cs{@xdblfloat} added}
%    \begin{macrocode}
\newcommand*\caption@redefine{%
%    \end{macrocode}
%   Prior to \version{3.4} we only redefined |\caption| and |\@caption| if the current definitions
%   were well known, so documents written in the old (\pkg{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 `true', and starting with \version{3.6} we always redefine them.
%    \begin{macrocode}
  \let\caption\caption@caption
  \let\@caption\caption@@caption
%    \end{macrocode}
%   We redefine |\@x|\-|float| so inside floating environments our
%   type-specific options will be used, a \pkg{hyperref}
%   anchor will be set etc.
%    \begin{macrocode}
  \let\caption@ORI@xfloat\@xfloat
  \let\@xfloat\caption@xfloat
%    \end{macrocode}
%   We redefine |\@xdbl|\-|float|, too, so special options for |figure*|
%   or |table*| will be applied here.
%    \begin{macrocode}
  \let\caption@ORI@xdblfloat\@xdblfloat
  \let\@xdblfloat\caption@xdblfloat
%    \end{macrocode}
%    \begin{macrocode}
}
%    \end{macrocode}
% Some packages (like the \pkg{hyperref} package for example) redefines
% |\caption| and |\@caption|, too.
% So we have to use |\At|\-|Begin|\-|Document| here, so we can make sure
% our definition is the one which will be valid at last.
%    \begin{macrocode}
\caption@AtBeginDocument{%
  \caption@redefine
  \let\caption@redefine\relax}
%    \end{macrocode}
% The redefinition of |\@make|\-|caption| will be done immediately.
%    \begin{macrocode}
\let\@makecaption\caption@makecaption
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@xfloat}
% \changes{v3.1}{2007/05/09}{Re-definition of \cs{@xfloat} added}
% \changes{v3.5}{2020/08/30}{Definition and usage of \cs{caption@xfloat@hook} added}
% \changes{v3.6}{2020/12/27}{Re-definition of \cs{@xfloat} put into \cs{caption@xfloat}}
%    \begin{macrocode}
\def\caption@xfloat#1[#2]{%
  \caption@ORI@xfloat{#1}[#2]%
  \caption@settype{#1}%
  \caption@setanchor
  \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}{\caption@xdblfloat}
% \changes{v3.5}{2020/08/30}{Re-definition of \cs{@xdblfloat} added}
% \changes{v3.5}{2020/08/30}{Definition and usage of \cs{caption@xdblfloat@hook} added}
% \changes{v3.6}{2020/12/27}{Re-definition of \cs{@xdblfloat} put into \cs{caption@xdblfloat}}
%    \begin{macrocode}
\def\caption@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}
%
% \subsection{\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.5}{2020/08/24}{Definition method adapted to the \pkg{caption-light} package}
% \changes{v3.6}{2022/02/20}{Optional argument added}
% \changes{v3.6e}{2022/04/17}{Re-written, task sequence corrected}
% \changes{v3.6f}{2022/04/18}{\cs{@ifnextchar} replaced by \cs{kernel@ifnextchar}}
%  |\setcaptiontype*|\oarg{additional options}\marg{type}\\
%  Like |\captionsetup{type=|\meta{type}|}|, but also works if |\caption|\-|setup| was redefined.
%  The non-starred version sets a \pkg{hyperref} anchor additionally
%  (if |hypcap=|\-|true| and the \pkg{hypcap} package is not loaded).
%    \begin{macrocode}
\def\setcaptiontype{%
  \caption@teststar\@setcaptiontype\@gobble\@iden}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\@setcaptiontype[1]{%
  \kernel@ifnextchar[%]
    {\@setcaptiontype@#1}%
    {\@@setcaptiontype#1\relax}}
%    \end{macrocode}
%    \begin{macrocode}
\def\@setcaptiontype@#1[#2]{%
  \@@setcaptiontype{#1}{\caption@setoptions{#2}}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\@@setcaptiontype[3]{%
  \caption@settype{#3}#2%
  \caption@parboxrestore@light
  #1\caption@setanchor}
%    \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/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.4e}{2020/01/02}{Check added if the subtype is defined}
% \changes{v3.5d}{2020/09/28}{This macro revised}
% \changes{v3.6}{2020/12/27}{Some code out-sourced to \cs{caption@reset@currentlabel}}
% \changes{v3.6}{2021/01/02}{Usage of \cs{caption@initposition} added}
% \changes{v3.6}{2021/01/09}{Usage of \cs{flushsubcaptionlistentries} added}
% \changes{v3.6e}{2022/04/17}{Starred variant and optional argument removed}
% \changes{v3.6g}{2022/04/18}{Usage of \cs{ifcaptionsetup@star} removed}
%  |\caption@settype|\marg{type}\\
%  sets |\@captype| and executes the options associated with it
%  (using |\caption@set|\-|options|).
%  Furthermore we check |\current|\-|group|\-|level| (if avail), and
%  use the macro |\caption@|(|sub|)|type|\-|hook| (which will be used by our
%  \pkg{float} package support).\par
%    \begin{macrocode}
\newcommand*\caption@settype{%
  \caption@initposition
  \caption@clrflags
  \aftergroup\flushsubcaptionlistentries
  \caption@@settype{}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@settype[2]{%
% #1 = "" or "sub"
% #2 = <type>, e.g.: "figure" or "subfigure"
  \caption@Debug{#1type:=#2}%
  \@nameuse{caption@check#1type}{#2}%
    {\caption@checkgrouplevel{#1}{\setcaption#1type}%
%    \end{macrocode}
%    \begin{macrocode}
     \edef\caption@tempa{#2}%
     \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else
       \@nameuse{caption@#1type@warning}%
     \fi
     \expandafter\let\csname @#1captype\endcsname\caption@tempa
%    \end{macrocode}
%    \begin{macrocode}
     \@nameuse{caption@#1typehook}%
%    \end{macrocode}
%    \begin{macrocode}
     \caption@setoptions{#2}%
     \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}
% \end{macro}
%
% \begin{macro}{\setcaptionsubtype}
% \changes{v3.2a}{2011/08/15}{This macro added}
% \changes{v3.5d}{2020/09/28}{This macro revised}
% \changes{v3.6}{2022/01/05}{Usage of \cs{caption@Error} replaced by \cs{caption@OutsideFloat}}
% \changes{v3.6}{2022/01/07}{Multiple use is suppressed now by checking \cs{caption@ifsubtype}}
% \changes{v3.6e}{2022/04/17}{Re-written}
%  |\setcaptionsubtype*|\\
%  Like |\captionsetup{subtype}|, but also works if |\caption|\-|setup| was redefined.
%  Sets |\@sub|\-|cap|\-|type| and executes the options associated with it.
%  The non-starred version sets a \pkg{hyperref} anchor additionally
%  (if |hypcap=|\-|true| and the \pkg{hypcap} package is not loaded).
%    \begin{macrocode}
\newcommand*\setcaptionsubtype{%
  \caption@teststar\@setcaptionsubtype\@gobble\@iden}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\@setcaptionsubtype[1]{%
  \caption@iftype
    {\caption@ifsubtype
       {\caption@Debug{type=\@captype, subtype=\@subcaptype}}%
       {\caption@@settype{sub}{sub\@captype}%
        #1\caption@setanchor}}%
    {\caption@OutsideFloat\setcaptionsubtype}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@parboxrestore@light}
% \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}}
% \changes{v3.6}{2021/01/02}{Renamed from \cs{caption@parboxrestore@mini} to \cs{caption@parboxrestore@light}}
% 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}
\newcommand*\caption@parboxrestore@light{%
  \let\par\@@par
  \parindent\z@ \parskip\z@skip
  \sloppy}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setanchor}
% \changes{v3.6e}{2022/04/17}{Code extracted from \cs{caption@settype}}
%  |\caption@setanchor|\\
%  sets a \pkg{hyperref} anchor.
%    \begin{macrocode}
\newcommand*\caption@setanchor{%
  \caption@reset@currentlabel
  \caption@start}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@reset@currentlabel}
% \changes{v3.6}{2020/12/27}{This macro out-sourced from \cs{caption@settype}}
%  Redefine |\@currentlabel| so a |\label| before |\caption| will result
%  in a hint instead of a wrong reference.
%    \begin{macrocode}
\newcommand*\caption@reset@currentlabel{%
  \let\@currentlabel\caption@undefinedlabel
% \let\@currentHlabel\@undefined
  \ifx\caption@x@label\@undefined
    \let\caption@x@label\label
    \let\label\caption@xlabel
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@iftype}
% \changes{v3.1}{2007/04/11}{This macro definition added}
%  Since we often need to check if |\@cap|\-|type| 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@ifsubtype}
% \changes{v3.6}{2022/01/07}{This macro definition added}
%  Since we often need to check if |\@sub|\-|cap|\-|type| is defined (means: we
%  are inside a sub-caption group of a floating environment) this helper macro was introduced.
%    \begin{macrocode}
\newcommand*\caption@ifsubtype{\caption@ifdefined\@subcaptype}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@checktype}
% \changes{v3.4g}{2020/01/02}{This macro definition added}
% \changes{v3.4m}{2020/07/29}{Check of \cs{sf@counterlist} from \pkg{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@ifdefined@subtype{#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 definition added}
% \changes{v3.4m}{2020/07/29}{Check of \cs{sf@counterlist} from \pkg{subfig} package added}
% \changes{v3.6c}{2022/04/06}{Check of \cs{sf@counterlist} from \pkg{subfig} package removed}
% \changes{v3.6c}{2022/04/06}{Usage of \cs{caption@subtypesource} 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|.
%    \begin{macrocode}
\newcommand*\caption@checksubtype[1]{%
  \caption@ifdefined@subtype{#1}%
    \@firstofone
    {\@ifundefined{c@#1}%
       {\caption@Error{Undefined counter `#1'}}%
       {\caption@subtypesource\caption@subtype@source{#1}%
        \caption@Error{The counter `#1' was defined by\MessageBreak\caption@subtype@source}}%
     \@gobble}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@checkgrouplevel}
% \changes{v3.1}{2007/07/15}{This macro definition 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 definition 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 definition 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 \pkg{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}
%
% \subsection{\cs{phantomcaption}}
%
% \begin{macro}{\phantomcaption}
% \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added}
% \changes{v3.6}{2022/01/05}{Usage of \cs{caption@Error} replaced by \cs{caption@OutsideFloat}}
%  |\phantomcaption|\par
%  increments the counter and generates an reference
%  which could be used with |\label|, but does not typeset anything.
%    \begin{macrocode}
\newcommand*\phantomcaption{%
  \caption@iftype
    {\caption@refstepcounter\@captype}%
    {\caption@OutsideFloat\phantomcaption}}
%    \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}
% \changes{v3.6}{2020/12/27}{With optional argument \cs{caption@refstepcounter@} is used instead of \cs{caption@refstepcounter}}
% \changes{v3.6}{2022/01/05}{Usage of \cs{caption@Error} replaced by \cs{caption@OutsideFloat}}
% \changes{v3.6f}{2022/04/18}{\cs{@ifnextchar} replaced by \cs{kernel@ifnextchar}}
%  |\captionlistentry|\oarg{float type}\marg{list entry}\\
%  |\captionlistentry*|\oarg{float type}\marg{list entry}
%    \begin{macrocode}
\newcommand*\captionlistentry{%
  \caption@teststar\caption@listentry\@firstoftwo\@secondoftwo}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@listentry[1]{%
  \kernel@ifnextchar[%]
    {\caption@listentry@{#1}}%
    {\caption@@listentry{#1}}}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@listentry@#1[#2]{%
  \caption@@@listentry{#1}{#2}{\caption@refstepcounter@}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@listentry[1]{%
  \caption@iftype
    {\caption@@@listentry{#1}{\@captype}{\caption@refstepcounter}}%
    {\caption@OutsideFloat\captionlistentry
     \@gobble}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@@listentry[4]{%
  \@bsphack
    #1{\caption@gettitle{#4}}%
      {#3{#2}\caption@makecurrent{#2}{#4}}%
    \caption@addcontentsline{#2}{#4}%
  \@esphack}
%    \end{macrocode}
% \end{macro}
%
% \subsection{\cs{captiontext}}
%
% \begin{macro}{\captiontext}
% \changes{v3.6}{2022/01/05}{This macro added}
% \changes{v3.6}{2022/01/05}{Usage of \cs{caption@Error} replaced by \cs{caption@OutsideFloat}}
%  |\captiontext*|\oarg{number}\marg{text for caption}\par
%  typesets the caption without incrementing the counter,
%  without putting an entry into the list, and without skips.
%  The starred variant skips the single-line-check additionally
%  and does not use a box or parbox or margin.
%    \begin{macrocode}
\newcommand*\captiontext{%
  \caption@iftype
    {\caption@text\@captype}%
    {\caption@OutsideFloat\captiontext
     \caption@withoptargs\@gobbletwo}}
\newcommand*\caption@text[1]{%
  \caption@teststar{\caption@@text{#1}}\caption@@@make\caption@@make}
\newcommand*\caption@@text[2]{%
  \kernel@ifnextchar[%]
    {\caption@@@text{#1}#2\@iden}%
    {\caption@@@text{#1}#2\@gobble[0]}}
\long\def\caption@@@text#1#2#3[#4]#5{%
  \begingroup
    #3{\csname c@#1\endcsname #4\relax}%
    #2{\caption@fnum{#1}}{#5}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
% \subsection{The \env{captiongroup} environment}
%
% \begin{environment}{captiongroup}
% \changes{v3.6}{2022/02/20}{This environment definition added}
% \env{captiongroup} is simply an environment containing |\set|\-|caption|\-|type|, that's all.
% A starred variant of this environment is available, too, which uses |\set|\-|caption|\-|type*|.
%    \begin{macrocode}
\newenvironment{captiongroup}{\setcaptiontype}{}
\newenvironment{captiongroup*}{\setcaptiontype*}{}
%    \end{macrocode}
% \end{environment}
%
% \subsubsection{The \env{captionblock} environment}
%
% \begin{macro}{\caption@minipage}
% \changes{v3.6}{2022/02/20}{This macro definition added}
% This is a \env{minipage} with |\set|\-|caption|\-|type| as first contents line.
%    \begin{macrocode}
\newcommand*\caption@minipage{%
  \@testopt\caption@iminipage b}
%    \end{macrocode}
% We pass all other optional arguments using the generic helper macro
% |\caption@with|\-|opt|\-|args| offered by the \pkg{caption} kernel).
%    \begin{macrocode}
\def\caption@iminipage[#1]{%
  \caption@withoptargs{\caption@iiminipage{#1}}}
%    \end{macrocode}
% `B' and `T' will add a |\vspace{0pt}|, all other values (and additional
% optional arguments) will be passed unseen to the |minipage| environment.
%    \begin{macrocode}
\newcommand*\caption@iiminipage[3]{%
  \let\caption@endminipage@hook\@empty
  \if#1B%
    \minipage[b]#2{#3}%
    \def\caption@endminipage@hook{\vspace{0pt}}%
  \else\if#1T%
    \minipage[t]#2{#3}%
    \vspace{0pt}%
  \else
    \minipage[#1]#2{#3}%
  \fi\fi
  \@floatboxreset
  \setcaptiontype}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@endminipage{%
  \caption@endminipage@hook
  \endminipage}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{captionblock}
% \changes{v3.6}{2022/02/20}{This environment definition added}
% \env{captionblock} is a \env{minipage} with |\set|\-|caption|\-|type| as first contents line.
%    \begin{macrocode}
\newenvironment{captionblock}{\caption@minipage}{\caption@endminipage}
%    \end{macrocode}
% \end{environment}
%
% \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 \pkg{subcaption}}
% \changes{v3.5}{2020/07/28}{Adapted to \pkg{caption3} v2.0}
% \changes{v3.6}{2020/12/24}{Check of argument \meta{inner-pos} added}
% 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{%
  \caption@checkdecl{justification}{#7}{%
    \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}
%
% \subsection{\cs{continuedfloat}}
%
% \begin{macro}{\c@continuedfloat}
% \changes{v3.4}{2015/09/16}{Counter renamed from \cs{ContinuedFloat} to \cs{continuedfloat}}
% |\thecontinuedfloat| will be preset to |\@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
%    \end{macrocode}
%    \begin{macrocode}
\def\thecontinuedfloat{\theContinuedFloat}
\let\theContinuedFloat\@empty              % defined for compatibility reasons
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\continuedfloat@captype}
% \changes{v3.6}{Renamed from \cs{caption@CFtype} to \cs{continuedfloat@captype}}
% Since we have only a single `continuedfloat' counter (and not one per caption type),
% we need to attach a caption type to our counter to make sure that the counter is not
% (mis-)used for a different float type while it holds a value other than zero.
%    \begin{macrocode}
\newcommand*\continuedfloat@captype{??}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@reset@continuedfloat}
%  |\caption@reset@continuedfloat|\marg{caption type}\\
%  resets the continuation counter to zero and attaches the given caption type to it.
%    \begin{macrocode}
\newcommand*\caption@reset@continuedfloat[1]{%
  \xdef\continuedfloat@captype{#1}%
  \@stpelt{continuedfloat}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@set@continuedfloat}
% \changes{v3.6}{2020/12/27}{Some code of \cs{continuedfloat} out-sourced to this macro}
%  |\caption@set@continuedfloat|\marg{yes-code}\marg{no-code}\\
%  checks if the current caption type matches the one attached to the `continuedfloat' counter
%  before increasing it.
%    \begin{macrocode}
\newcommand*\caption@set@continuedfloat{%
  \ifx\@captype\continuedfloat@captype
    \stepcounter{continuedfloat}%
    \expandafter\@firstoftwo
  \else
    \caption@Error{Continued `\@captype' after `\continuedfloat@captype'}%
    \expandafter\@secondoftwo
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \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 \pkg{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.2f}{2011/12/17}{Redefinition of \cs{caption@@@continuedfloat} added}
% \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 \pkg{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}
% \changes{v3.6}{2020/12/27}{Check of counter caption type out-sourced to \cs{caption@check@continuedfloat}}
% \changes{v3.6}{2022/01/05}{Usage of \cs{caption@Error} replaced by \cs{caption@OutsideFloat}}
%  |\continuedfloat|\\
%  |\continuedfloat*|\par
%  This mainly sets the `continued float' flag, increments the continuation counter, and executes the given options.
%    \begin{macrocode}
\def\continuedfloat{%
  \caption@teststar\caption@continuedfloat\@firstoftwo\@secondoftwo}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@continuedfloat[1]{%
  \caption@iftype
    {#1{\caption@@refstepcounter\@captype}{}%
     \caption@@continuedfloat\@captype}%
    {\caption@OutsideFloat\continuedfloat}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@continuedfloat{%
  \caption@clrflags
  \caption@set@continuedfloat
    {\caption@setcontinued
     \caption@@@continuedfloat}%
    {\@gobble}}
%    \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
%    \end{macrocode}
%  When the \pkg{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 \pkg{hyperref} package option \texttt{naturalnames=true} is set.}
%    \begin{macrocode}
  \@ifundefined{theH#1}{}{%
    \expandafter\l@addto@macro\csname theH#1\endcsname{%
      \@alph\c@continuedfloat}}%
%    \end{macrocode}
% Make sure the options and the \pkg{hyperref} patch is only applied once (per group).
%    \begin{macrocode}
  \let\caption@@@continuedfloat\@gobble}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ContinuedFloat}
% For compatibility reasons we still support the obsolete |\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{caption type}\par
% This one is used by \cs{ContinuedFloat} offered by the \pkg{subfig} package.
% Since the \pkg{subfig} package does its own counter handling we try not to
% interfere by changing couter-related flags.
% not interfere with it
%    \begin{macrocode}
\def\caption@ContinuedFloat{%
  \caption@set@continuedfloat\caption@@@continuedfloat\@gobble}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\nextfloat}
% \changes{v3.6}{2020/09/20}{This command added}
% \changes{v3.6}{2021/01/09}{Usage of \cs{flushsubcaptionlistentries} added}
% \changes{v3.6}{2022/01/05}{Usage of \cs{caption@Error} replaced by \cs{caption@OutsideFloat}}
% |\nextfloat| resets the flags (indicating that the next contents of the floating environment starts here),
% and sets a new \pkg{hyperref} anchor.
%    \begin{macrocode}
\providecommand*\nextfloat{%
    \caption@teststar\caption@nextfloat\@firstoftwo\@secondoftwo}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@nextfloat[1]{%
  \caption@iftype
    {\caption@@nextfloat\@captype
     #1{}{\caption@reset@currentlabel\caption@start}}%
    {\caption@OutsideFloat\nextfloat}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@nextfloat[1]{%
  \flushsubcaptionlistentries
  \caption@clrflags
  \ifx\caption@@@continuedfloat\@gobble
    % next continued float
    \caption@set@continuedfloat\caption@setcontinued\relax
  \fi}
%    \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}
% \changes{v3.5e}{2020/09/28}{Bugfix in re-definition of \cs{stepcounter}; uses \cs{edef} instead of \cs{def} now}
% \changes{v3.6}{2020/09/20}{Handling of flags out-sourced to \cs{caption@ifrefstepcounter}}
% \changes{v3.6}{2020/12/27}{\cs{caption@@@refstepcounter} renamed to \cs{caption@refstepcounter@}}
% \changes{v3.6}{2021/01/09}{Adapted to current interface of \cs{caption@prepare@stepcounter}}
% |\caption@refstepcounter|\marg{counter}\\
% increments the float counter (using |\ref|\-|step|\-|counter|) and resets the continuation counter.
%    \begin{macrocode}
\newcommand*\caption@refstepcounter{%
  \@nameuse{donemaincaptiontrue}% Support of the memoir document class
  \caption@ifrefstepcounter\caption@@refstepcounter\caption@@refcounter}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@refstepcounter[1]{%
  \caption@prepare@stepcounter{#1}%
  \caption@refstepcounter@{#1}}
%    \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
      % Suppress incrementation of counter
    \else
      \caption@stepcounter@ORI{##1}%
    \fi}%
  \caption@refstepcounter@{#1}%
  \let\stepcounter\caption@stepcounter@ORI}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@refstepcounter@{\refstepcounter}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@stepcounter}
% \changes{v3.6}{2020/09/20}{This macro added}
% \changes{v3.6}{2020/12/27}{Handling of flags out-sourced to \cs{caption@ifstepcounter}}
% \changes{v3.6}{2020/12/27}{\cs{caption@@@stepcounter} renamed to \cs{caption@stepcounter@}}
% \changes{v3.6}{2021/01/09}{Adapted to current interface of \cs{caption@prepare@stepcounter}}
% |\caption@stepcounter|\marg{counter}\\
% increments the float counter (using |\step|\-|counter|) and resets the continuation counter.
%    \begin{macrocode}
\newcommand*\caption@stepcounter{%
  \caption@ifstepcounter\caption@@stepcounter\caption@@counter}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@stepcounter[1]{%
  \caption@prepare@stepcounter{#1}%
  \caption@stepcounter@{#1}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@counter[1]{} % nothing to do
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@stepcounter@{\stepcounter}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@prepare@stepcounter}
% \changes{v3.3}{2011/12/28}{This macro added}
% \changes{v3.6}{2021/01/09}{Argument \meta{source hint} dropped; adapted to current interface of \cs{caption@addsubcontentslines}}
% |\caption@prepare@stepcounter|\marg{counter}
% Dumps the cached list entries and resets the continuation counter.
%    \begin{macrocode}
\newcommand*\caption@prepare@stepcounter{%
  \caption@addsubcontentslines\relax
  \caption@reset@continuedfloat}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifrefstepcounter}
% \changes{v3.6}{2020/09/20}{This macro added}
% |\caption@ifrefstepcounter|\marg{yes-code}\marg{no-code}\\
% tests if the counter should be increased or not. Furthermore it updates the flags accordingly.
%    \begin{macrocode}
\newcommand*\caption@ifrefstepcounter{%
  \caption@ifcounter
%    \end{macrocode}
% If a caption was already typeset in this environment, we need to increment the counter (again).
%    \begin{macrocode}
    {\caption@ifcaption}%
%    \end{macrocode}
% If a caption and a sub-caption below it were already typeset, we issue a warning additionally.
% (This will only be done if |position=b| is set because this is the case were the sub-caption numbering got most likely wrong.)
%    \begin{macrocode}
    {\caption@ifsubcaption@below{\caption@iftop\@secondoftwo\@firstoftwo}{\@secondoftwo}}%
%    \end{macrocode}
% In each case set the `caption' flag to indicate a caption was typeset.
%    \begin{macrocode}
    {\caption@setcaption}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifstepcounter}
% \changes{v3.6}{2020/12/27}{This macro added}
% |\caption@ifstepcounter|\marg{yes-code}\marg{no-code}\\
% tests if the counter should be increased or not. Furthermore it updates the flags accordingly.
%    \begin{macrocode}
\newcommand*\caption@ifstepcounter{%
  \caption@ifcounter
%    \end{macrocode}
% If a caption and a sub-caption above it were already typeset in this environment, we need to increment the counter (again).
%    \begin{macrocode}
    {\caption@ifcaption\caption@ifsubcaption@above\@secondoftwo}%
%    \end{macrocode}
% In this case issue a warning additionally.
% (This will only be done if |position=t| is set because this is the case were the sub-caption numbering got most likely wrong.)
%    \begin{macrocode}
    {\caption@iftop}%
%    \end{macrocode}
% In each case set the `subcaption' flag to indicate a sub-caption was typeset.
%    \begin{macrocode}
    {\caption@setsubcaption}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifcounter}
% \changes{v3.6}{2020/12/28}{This macro added}
% |\caption@ifcounter|\marg{increment the counter?}\marg{issue a warning?}\marg{set flag}\marg{yes-code}\marg{no-code}\\
% contains the common code of |\caption@if|\-|ref|\-|step|\-|counter| and |\caption@if|\-|step|\-|counter|.
%    \begin{macrocode}
\newcommand*\caption@ifcounter[3]{%
  \caption@ifflags
%    \end{macrocode}
% Test if the counter should be incremented (again). If yes, test if a warning should be issued additionally.
% (If the counter gets incremented all flags will be cleared to indicate a new run.)
%    \begin{macrocode}
    {#1%
       {#2\caption@Warning\@gobble{Ambiguous sub-caption(s), use \string\nextfloat}%
        \caption@clrflags
        \let\caption@next\@firstoftwo}%
       {\let\caption@next\@secondoftwo}}%
%    \end{macrocode}
% Always increment the counter if no flag was set so far.
%    \begin{macrocode}
    {\let\caption@next\@firstoftwo}%
%    \end{macrocode}
% Set either the `caption' or `subcaption' flag.
%    \begin{macrocode}
  #3%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@next}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@dblarg}
% \changes{v3.1}{2007/02/05}{This macro added}
% \changes{v3.3}{2012/03/25}{Support of option \opt{list-entry} added}
% \changes{v3.6n}{2023/07/31}{Only an empty list-entry will expand to \cs{relax}, otherwise it remains unchanged}
%  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}
\newcommand\caption@dblarg[1]{%
  \kernel@ifnextchar[%]
    {\caption@ydblarg{#1}}%
    {\caption@xdblarg{#1}}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand\caption@xdblarg[2]{%
  \caption@iftokens{#2}{#1[{#2}]{#2}}{#1[\relax]{}}}
%    \end{macrocode}
%    \begin{macrocode}
\long\def\caption@ydblarg#1[#2]#3{%
  \caption@iflistheading{#1[{#3}]{#3}}{#1[{#2}]{#3}}}
%    \end{macrocode}
%    \begin{macrocode}
%    \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}
% \changes{v3.5h}{2022/03/01}{Hook added, setting of \cs{lst@@caption} removed}
%  |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par
%  performs the same tasks as |\caption@begin| and additionally:
%  \begin{enumerate}
%  \item[4.] Apply the hook |\caption@beginex@hook|
%  \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}%
  \caption@beginex@hook
  \caption@addcontentsline{#1}{#2}%
  \caption@ifempty{#3}{}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@beginex@hook{}
%    \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@normalsize}
% \changes{v3.1}{2007/05/05}{This macro definition added}
% \changes{v3.5}{2020/07/27}{Adapted to \pkg{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 \pkg{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 \pkg{nameref} and \pkg{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 \pkg{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.1l}{2010/01/09}{This macro and its usage added to adapt the definition of \cs{@currentlabelname} to recent versions of \pkg{nameref}}
% \changes{v3.6o}{2023/08/05}{Support for older versions of \pkg{nameref} revised to make it compatible with \LaTeX\ 2023-06-01}
%  This one is needed for support of the \pkg{nameref} package.
%    \begin{macrocode}
\newcommand\caption@gettitle[1]{%
  \caption@ifdefined\NR@gettitle
    {\NR@gettitle{#1}}%                                         % support for recent versions of nameref package
    {\caption@ifdefined\NR@sect{\def\@currentlabelname{#1}}{}}} % support for older versions of nameref package
%    \end{macrocode}
% \end{macro}
%
% \subsection{Support for sub-captions}
% \changes{v3.1f}{2007/11/16}{Support for sub-captions added}
%
% \begin{macro}{\subcaptionsetup}
% \changes{v3.6l}{2023/03/22}{This macro definition moved from \pkg{subcaption} package to here}
% |\subcaptionsetup*|\oarg{environment}\marg{options}
% is an abbreviation for |\caption|\-|setup*[sub|\meta{environment}|]|\marg{options},
% especially |\sub|\-|caption|\-|setup|\marg{options} sets options valid for all sub-captions.
%    \begin{macrocode}
\newcommand*\subcaptionsetup{%
  \caption@teststar\@subcaptionsetup*{}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\@subcaptionsetup[1]{%
  \@testopt{\captionsetup@sub{#1}}{}}
%    \end{macrocode}
%    \begin{macrocode}
\def\captionsetup@sub#1[#2]#3{%
  \captionsetup#1[sub#2]{#3}}
%    \end{macrocode}
% \end{macro}
%
% \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 \pkg{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 \pkg{caption3} v2.0}
% \changes{v3.6}{2020/09/20}{Handling of flags out-sourced to \cs{caption@stepcounter}}
% \changes{v3.6d}{2022/04/17}{Usage of \cs{if@subfloatrow} removed in favour of a re-definition of \env{subfloatrow*}}
%  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 \pkg{floatrow} package intact.)
%    \begin{macrocode}
\newcommand*\caption@subtypehook{%
  \ifx\caption\caption@subcaption \else
    \caption@warmup
    \caption@stepcounter\@captype
    \caption@ifcaption
      {}%
      {\let\caption@add@contentsline\caption@addsubcontentsline
       \let\caption@addsubcontentslines\@gobble}%
%    \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
    \renewcommand*\caption@settype[1]{%
      \caption@Error{##1 inside \@subcaptype}}%
%    \end{macrocode}
%    \begin{macrocode}
% redefine \caption
    \let\caption\caption@subcaption
    \let\@caption\caption@@caption
    \let\phantomcaption\caption@subphantom
    \let\captionlistentry\caption@sublistentry
    \let\captiontext\caption@subtext
%   \let\@captype\@subcaptype
    \let\caption@refstepcounter\caption@refstepcounter@
%    \end{macrocode}
%    \begin{macrocode}
% restore \@makecaption
    \let\@makecaption\caption@makecaption
  \fi}%
%    \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@subtext}
% \changes{v3.2a}{2011/08/17}{This macro added}
% Same as |\captiontext|, but for sub-captions.
%    \begin{macrocode}
\newcommand*\caption@subtext{%
% \caption@checkgrouplevel{sub}\subcaptiontext
  \caption@text\@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}}
% \changes{v3.6m}{2023/07/28}{Redefinition of \cs{label} etc. replaced by \cs{caption@prepareslc}}
% Add a pending sub-caption list entry.
%    \begin{macrocode}
\newcommand*\caption@addsubcontentsline[4]{%
  \caption@Debug{\string\caption@addsubcontentsline{#1}{#2}}%
  \begingroup
  \caption@prepareslc
  \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}
% \changes{v3.6}{2021/01/09}{Patch of \cs{chapter} and \cs{appendix} dropped}
% Writes pending sub-caption list entries.
% (Note: We keep the parameter of |\caption@add|\-|sub|\-|contents|\-|lines| for compatibility reasons although it's not used anymore.)
%    \begin{macrocode}
\newcommand*\flushsubcaptionlistentries{%
  \caption@addsubcontentslines\relax}
%    \end{macrocode}
%    \begin{macrocode}
\renewcommand*\caption@addsubcontentslines[1]{%
  \caption@Debug{\string\flushsubcaptionlistentries}%
  \begingroup
    \caption@subcontentslines
  \endgroup
  \caption@clearsubcontentslines}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Babel package support}
%
% \subsubsection{The arabic \& farsi babel option}
% \changes{v3.5}{2020/08/02}{\pkg{arabic} babel support addded}
%
%    \begin{macrocode}
\caption@IfBabelArabi{%
%    \end{macrocode}
%
% The \pkg{arabicore} package re-defines |\@make|\-|caption|, |\fnum@figure|, and |\fnum@table|
% incompatible to the \pkg{caption} package, therefore we have to restore our or 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}
%
% \subsubsection{The frenchle \& frenchpro package}
% \changes{v3.0h}{2005/10/03}{\pkg{frenchle/pro} package support added}
% \changes{v3.5}{2020/08/01}{\pkg{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 \pkg{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}
%
% \subsubsection{The hungarian \& magyar babel option}
% \changes{v3.2}{2009/03/29}{\pkg{magyar} babel support added}
% \changes{v3.3}{2018/08/26}{\pkg{magyar} babel support revised}
% \changes{v3.5}{2020/08/02}{\pkg{magyar} babel support updated}
%
%    \begin{macrocode}
\caption@IfBabelHungarian{%
%    \end{macrocode}
%
% Since the \pkg{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 \pkg{floatrow} package within \pkg{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}
%
% \subsubsection{The latvian babel option}
% \changes{v3.5}{2020/08/02}{\pkg{latvian} babel support updated}
%
%    \begin{macrocode}
\caption@IfBabelLatvian{%
%    \end{macrocode}
%
% The \pkg{latvian} package re-defines |\@make|\-|caption| incompatible to the \pkg{caption} package,
% therefore we have to restore our definitions here.
%
%    \begin{macrocode}
  \let\@makecaption\caption@makecaption
%    \end{macrocode}
%
%    \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}}
% \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 definition added}
% \changes{v3.6}{2021/01/17}{Adapted to current implementation of \cs{caption@setmargin}}
%  This macro will be used by some package support stuff where the usual
%  margin setting is not welcome, e.g. in the \pkg{sidecap} package.
%    \begin{macrocode}
\newcommand*\caption@clearmargin{%
  \caption@setmargin\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 \pkg{fltpage} \& \pkg{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 \pkg{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@nextfloat\nextfloat
      \def\nextfloat{\caption@freeze@error}%
%    \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@freeze@error\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\nextfloat\caption@frozen@nextfloat
        \let\caption@setup\caption@frozen@setup
        \let\caption\caption@frozen@caption
        \let\label\caption@frozen@label}}%
%    \end{macrocode}
%    \begin{macrocode}
    \newcommand*\caption@freeze@error{%
      \caption@Error{Only one \noexpand\caption can be placed in this environment}}
%    \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{%
      \def\caption@settype{\caption@@settype{}}}
%    \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 changepage package}
% \changes{v3.4k}{2020/05/30}{Patch of the \pkg{changepage} package added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{changepage}[2008/07/23 memoir-v3.7k]{%
%    \end{macrocode}
%
% \begin{macro}{\caption@patch@adjustwidth}
% \changes{v3.4k}{2020/05/30}{This macro definition added}
% \changes{v3.6j}{2023/03/12}{\cs{ignorespaces} added to environment re-definition}
% 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 \env{adjustwidth} environment?''
% inside \cs{@makecaption} and fix this. (Sigh!)
%    \begin{macrocode}
  \providecommand*\caption@patch@adjustwidth[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
      \ignorespaces}}%
  \caption@patch@adjustwidth{adjustwidth}%
  \caption@patch@adjustwidth{adjustwidth*}%
  \let\caption@patch@adjustwidth\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@set@adjustwidth}
% \changes{v3.4k}{2020/05/30}{This macro definition added}
% \changes{v3.5h}{2022/03/01}{Usage of \cs{AtBeginCaption} replaced by \cs{l@addto@macro}\cs{caption@beginex@hook}}
% 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 \env{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{macrocode}
  \newdimen\caption@adjustwidth@hsize
  \newdimen\caption@adjustwidth@linewidth
%    \end{macrocode}
%    \begin{macrocode}
  \providecommand*\caption@set@adjustwidth{%
    \caption@adjustwidth@hsize\hsize
    \caption@adjustwidth@linewidth\linewidth
    \l@addto@macro\caption@beginex@hook\caption@test@adjustwidth}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@test@adjustwidth}
% \changes{v3.4k}{2020/05/30}{This macro definition 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}
% \end{macro}
%
%    \begin{macrocode}
  }{}%
%    \end{macrocode}
%
% \subsubsection{The chkfloat package}
% \changes{v3.3}{2018/09/06}{Support of the \pkg{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}
%
% \subsubsection{The float package}
% \changes{v3.0f}{2005/05/31}{\pkg{float} package support rewritten and improved}
% \iffalse
% (This is a more straight-ahead implementation, but it only works with \version{1.3}
%  now, so \version{1.2} is no longer supported.
% \fi
%
% The \pkg{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 \pkg{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 \pkg{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|:
%    \begin{macrocode}
  \caption@AtBeginDocument{%
%    \end{macrocode}
% If it was redefined by the \pkg{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}}
% \changes{v3.6i}{2023/02/19}{Uses \cs{def} instead of \cs{let} now}
%  \LaTeX\ and almost every other packages use
%    |\|\meta{type}|name|
%  to provide a macro for the type or environment name -- for example
%  the command |\figure|\-|name| will usually contain the name of the floating
%  environment |figure|:
%  \begin{quote}
%    |\newcommand\figurename{Figure}|
%  \end{quote}
%  But the \pkg{float} package doesn't follow this common naming
%  convention:
%  For floats defined with |\new|\-|float| it uses |\fname@|\meta{type} instead,
%  which breaks with our code (and with |\auto|\-|ref| and some other things as
%  well).
%  So we have to map the \pkg{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 % either undefined or \relax
      \@namedef{#1name}{\@nameuse{fname@#1}}%
    \fi}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setname}
% \changes{v3.6i}{2023/02/19}{Re-definition of \cs{caption@setname} added to \pkg{float} package support}
% Same problem as in |\caption@float@set|\-|name|, but other direction:
% If the option |name=| is used, we should set |\fname@|\meta{type}, too.
%    \begin{macrocode}
  \renewcommand*\caption@setname[2]{%
    \@ifundefined{fname@#1}{}{\caption@ifdefined\floatname\floatname\@gobbletwo{#1}{#2}}%
    \@namedef{#1name}{#2}}%
%    \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 \pkg{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| or |\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 \pkg{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@setoptions{floating#1}%
    \caption@setanchor}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The floatrow package}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{floatrow}[2008/08/02 v0.3b]{%
%    \end{macrocode}
%
% \begin{macro}{\captionlabel}
% \changes{v3.6e}{2022/04/17}{This macro re-definition added}
% The original definition of |\caption|\-|label| uses the internal macro
% |\caption@set|\-|sub|\-|type| which does not exist anymore and needs to
% be replaced by |\set|\-|caption|\-|sub|\-|type|.
%    \begin{macrocode}
  \renewcommand\captionlabel[1]{{\def\FR@tmp{\@captype}\ifnum\floatbox@depth>\@ne
       \def\FR@tmp{sub\@captype}\setcaptionsubtype*\stepcounter{\FR@tmp}\fi
   \caption@@@make{\caption@fnum\FR@tmp}{#1}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{subfloatrow}
% \changes{v3.6d}{2022/04/17}{This environment re-definition added}
% The original definition of the environment |sub|\-|float|\-|row|
% uses |\caption|\-|setup{sub|\-|type}| to switch caption commands
% like |\caption| to their counterparts offered by the \pkg{subcaption}
% package.
% Since \pkg{caption} \version{3.6} this does not work in coorparation
% with the \pkg{subfig} package anymore, and therefore we replace it
% with a hook which could be filled by the \pkg{subcaption} package.
%    \begin{macrocode}
  \renewenvironment{subfloatrow}{\capsubrowsettings
    \caption@subfloatrow@hook % as replacement for \captionsetup{subtype}
    \@nameuse{subfloatrow*}}{\@nameuse{endsubfloatrow*}}
%    \end{macrocode}
%    \begin{macrocode}
  \providecommand*\caption@subfloatrow@hook{}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{subfloatrow*}
% \changes{v3.6d}{2022/04/17}{This environment re-definition added}
% Some packages (like the \pkg{float} and \pkg{floatrow} package) re-define
% |\@make|\-|caption| for special handling of the main caption.
% Since this usually does not work fine with sub-captions, the command
% |\set|\-|caption|\-|sub|\-|type| will restore the definition
% of |\@make|\-|caption|. But this is not desired here, and therefore
% we make sure that |\flrow@make|\-|caption| will be used for sub-captions,
% too.
%    \begin{macrocode}
  \renewenvironment{subfloatrow*}[1][2]{\let\flrow@to\empty
    \let\Xhsize\sXhsize%\let\Zhsize\sZhsize
    \FR@ifunloc{\let\FR@ifcountH\@firstoftwo}\let\c@FRobj\c@FRsobj
    \def\FRleftmargin{}\def\FRrightmargin{}\let\floatrowsep\subfloatrowsep
    \floatrow[#1]\killfloatstyle
    \let\caption@makecaption\flrow@makecaption}% <- This line added
    {\ifdim\lastskip>\z@\unskip\fi
     \@ifundefined{adjustsubfloats}\relax\adjustsubfloats\endfloatrow}
%    \end{macrocode}
% \end{environment}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The fltpage package}
% \changes{v3.1}{2007/07/22}{Support of the \pkg{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 \pkg{hyperref} package added}
% \changes{v3.1}{2007/03/09}{Usage of \cs{hyper@makecurrent} instead of
%   \cs{theHfigure} as indicator for \pkg{hyperref} package}
% \changes{v3.2}{2011/07/30}{Test if \pkg{hyperref} has stopped early revised}
% \changes{v3.2c}{2011/08/24}{Test if \pkg{hyperref} has stopped early adapted to current version of \pkg{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}%
  }{%
    \AtCaptionSingleLineCheck{\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 \pkg{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 \pkg{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}
    \AtCaptionSingleLineCheck{\let\caption@makeanchor\@firstofone}%
%    \end{macrocode}
% \end{macro}
%
% \paragraph{The hypcap option}
%
% \begin{macro}{\if@capstart}
% Like the \pkg{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 \pkg{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 \pkg{hyperref} label and set the \pkg{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 \pkg{hyperref} label,
% use the label we save in |\hc@currentHref| instead.
% (We also support the |@capstart| flag from the \pkg{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 \pkg{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 \pkg{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' \pkg{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 \pkg{hyperref} anchor inside |\caption@start|.\par
% This code was taken from the \pkg{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
% \pkg{hyperref} package!?), and since the workaround
% \cs{let}\cs{leavevmode}\cs{relax} which can be found in the
% \pkg{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 \pkg{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 \pkg{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 \pkg{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 \pkg{hyperref} label and
%  setting a \pkg{hyperref} anchor. Instead if |\@caption| generates a
%  \pkg{hyperref} label, it will be stored in |\caption@currentHref|.
%  Furthermore we need to redefine |\caption@setfloatcapt| so no
%  \pkg{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 \pkg{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 \pkg{hypcap} package added}
% \changes{v3.0l}{2007/02/20}{Adapted to \pkg{hypcap} \version{1.6}}
% \changes{v3.1e}{2007/11/04}{\pkg{hypcap} support adapted to \pkg{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 \pkg{hypcap} package was loaded, we give up our own
% hyperlink placement algorithm and give the control over the placement
% to the \pkg{hypcap} package instead.
%
% \begin{macro}{\capstart}
% \changes{v3.1k}{2009/10/09}{Support of \cs{ifcapstart} (\pkg{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}
    \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 \pkg{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 \pkg{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}
% \changes{v3.6}{2021/01/04}{Re-definition of \cs{addcontentsline} added}
%  To support the \pkg{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 \pkg{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
  \renewcommand*\lst@MakeCaption[1]{% #1 is `t' or `b'
%    \end{macrocode}
% This macro is always called twice by the \pkg{listings} package (with `t' or `b' as parameter),
% therefore we need an extra group here.
%    \begin{macrocode}
    \begingroup
%    \end{macrocode}
% Inside lists the \pkg{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 \pkg{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 \pkg{listings} package
% will not be changed. (Note that the \pkg{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 \pkg{listings} package.
%    \begin{macrocode}
      \caption@setautoposition{#1}%
%    \end{macrocode}
%    \begin{macrocode}
% We re-define |\addcontentsline| so our list format gets used for the lol entry etc.
      \ifx\lst@@caption\@empty \else
        \let\caption@ORI@addcontentsline\addcontentsline
        \renewcommand*\addcontentsline[3]{%
          \let\addcontentsline\caption@ORI@addcontentsline
          \caption@addcontentsline{lstlisting}{\lst@@caption}}%
      \fi
%    \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=| or |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 \pkg{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}
%
% \begin{macro}{\lst@@caption}
% \changes{v3.1}{2007/03/03}{This macro added}
% \changes{v3.1a}{2007/07/13}{Bugfix 07-09-13: \cs{lst@@caption} will not be re-defined anymore}
% \changes{v3.2}{2010/10/26}{Bugfix 09-05-15: Setting of \cs{lst@@caption} added to \cs{caption@beginex}}
% \changes{v3.5h}{2022/03/01}{Re-definition of \cs{lst@@caption} moved from \cs{caption@beginex} to \cs{caption@beginex@hook}}
% We define |\lst@@caption| to non-|\@empty|, so |\fnum@lst|\-|listing| will
% include a numbering.
%    \begin{macrocode}
  \l@addto@macro\caption@beginex@hook{\let\lst@@caption\relax}%
%    \end{macrocode}
% \end{macro}
%
%    \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{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}
% \changes{v3.6}{2022/01/05}{Usage of \cs{caption@Error} replaced by \cs{caption@OutsideFloat}}
% \changes{v3.6g}{2022/04/18}{Adapted to recent version of \pkg{caption3} package}
% We redefine |\LT@array| here to get |\captionsetup|\marg{options} working inside |longtable|s.
% \Note{Since the \pkg{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 \pkg{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{%
      \caption@setup@options\@gobble[@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{\pkg{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@OutsideFloat\continuedfloat}}%
%    \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 \pkg{floatrow} added}
% \changes{v3.6}{2021/01/09}{Adapted to current interface of \cs{caption@prepare@stepcounter}}
%  |\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 \pkg{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 \pkg{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
%    \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 \pkg{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 \pkg{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}}
% \changes{v3.6}{2021/01/17}{Adapted to current implementation of \cs{caption@setwidth}}
%    \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
      \caption@setwidth\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 \pkg{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 \pkg{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 \pkg{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 \pkg{picinpar} package added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{picinpar}{%
%    \end{macrocode}
%
% \begin{macro}{\figwindow}
% \begin{macro}{\tabwindow}
% The \pkg{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 \pkg{floatflt} \& \pkg{picins} package support)
% and |\@makecaption| (as in \pkg{float} package support) here.
%    \begin{macrocode}
  \newcommand*\caption@window[1]{%
    \let\@makecaption\caption@@make
    \caption@setautoposition b%
    \caption@settype{#1}%
    \caption@clearmargin
    \caption@setanchor}%
%    \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}}
% \changes{v3.6}{2020/12/28}{\cs{caption@setflag1} replaced by \cs{caption@clrflags}\cs{caption@setcontinued}}
% 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
      % don't increment the figure or table counter again
      \caption@clrflags
      \caption@setcontinued
    \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 \pkg{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 \pkg{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
%  \pkg{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 \pkg{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
%       \caption@width\z@ % do not use "width=" setting
%     \fi
      \caption@setoptions{parpic}%
      \caption@setautoposition b%
      \caption@setanchor
%    \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 \pkg{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 \pkg{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}}
% \changes{v3.3}{2012/12/26}{Rewritten (again)}
% \changes{v3.6}{2021/01/17}{Adapted to current implementation of \cs{caption@setmargin}}
%  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\caption@width=\z@
        \caption@setwidth{.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 scrextend package}
% \changes{v3.6j}{2023/03/12}{Patch of the \pkg{scrextend} package added}
%
% \begin{macro}{\caption@IfKomaPackageLoaded}
% \changes{v3.6j}{2023/03/12}{This macro definition added}
% \changes{v3.6k}{2023/03/14}{Check for \cs{scr@caption} replaced by \cs{caption@ifdocumentclass}}
%    \begin{macrocode}
\caption@ifdocumentclass{koma}%
  {\long\def\caption@IfKomaPackageLoaded#1[#2]#3#4{%
     \caption@InfoNoLine{KOMA-Script #1 package detected}%
     #3}}%
  {\let\caption@IfKomaPackageLoaded\caption@IfPackageLoaded}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\caption@IfKomaPackageLoaded{scrextend}[2002/07/01 v3.0]{%
%    \end{macrocode}
%
% \begin{macro}{\caption@patch@addmargin}
% \changes{v3.6j}{2023/03/12}{This macro definition added}
% Both environments, \env{addmargin} and \env{addmargin*}, 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{addmargin}.
% Therefore we try to detect the situation ``Are we inside a \env{addmargin} environment?''
% inside \cs{@makecaption} and fix this. (Sigh!)
%    \begin{macrocode}
  \let\caption@addmargin@env\@addmargin
  \renewcommand*\@addmargin{%
    \@testopt\caption@@addmargin\@tempa}%
  \def\caption@@addmargin[#1]#2{%
    \caption@addmargin@env[{#1}]{#2}%
    \caption@set@addmargin
    \ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@set@addmargin}
% \changes{v3.6j}{2023/03/12}{This macro definition added}
% 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 \env{addmargin} 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{addmargin} environment and therefore need
% to fix \cs{hsize} before typesetting the caption. (Deep sigh!)
%    \begin{macrocode}
  \newdimen\caption@addmargin@hsize
  \newdimen\caption@addmargin@linewidth
%    \end{macrocode}
%    \begin{macrocode}
  \providecommand*\caption@set@addmargin{%
    \caption@addmargin@hsize\hsize
    \caption@addmargin@linewidth\linewidth
    \l@addto@macro\caption@beginex@hook\caption@test@addmargin}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@test@addmargin}
% \changes{v3.6j}{2023/03/12}{This macro definition added}
% Test if the values of \cs{hsize} and \cs{linewidth} are identical to
% the ones stored in the \env{addmargin} environment.
% If yes, set \cs{hsize} to the correct value.
%    \begin{macrocode}
  \providecommand\caption@test@addmargin{%
    \ifdim\hsize=\caption@addmargin@hsize
      \ifdim\linewidth=\caption@addmargin@linewidth
        \hsize=\linewidth
      \fi
    \fi}%
%    \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}}
% \changes{v3.6i}{2022/07/10}{\cs{ignorespaces} appended}
%  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 |\caption|\-|setup| 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}
% Since the original definition of |\SC@zfloat| ends with |\begin{lrbox}| which ends with |\ignore|\-|spaces|,
% we do have to end our re-definition of |\SC@zfloat| with |\ignore|\-|spaces| as well.
%    \begin{macrocode}
    \ignorespaces}%
%    \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 \pkg{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
%  \pkg{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 \pkg{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 \pkg{subfigure} package is loaded, we map |\sf@ifpositiontop|
%  to |\iffiguretopcap| or |\iftabletopcap|, so the \pkg{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
%  \pkg{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}
%
% \subsubsection{The threeparttable package}
% \changes{v3.1}{2007/05/08}{Support of the \pkg{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}
% \changes{v3.6e}{2022/04/17}{Main code outsourced to \cs{caption@setthreeparttable}}
% 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@setthreeparttabletype{threepart}{table}%
    \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}
% \changes{v3.6e}{2022/04/17}{Main code outsourced to \cs{caption@setthreeparttable}}
%  Same here\ldots
%    \begin{macrocode}
  \let\caption@ORI@measuredfigure\measuredfigure
  \renewcommand*\measuredfigure{%
    \caption@setthreeparttabletype{measured}{figure}%
    \caption@ORI@measuredfigure}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setthreeparttabletype}
% \changes{v3.6e}{2022/04/17}{Extracted from \cs{threeparttable} and \cs{measuredfigure}}
% \changes{v3.6e}{2022/04/17}{Support for usage inside \env{subtable} or \env{subfigure} added}
%  |\caption@setthreeparttabletype|\marg{threepart type}\marg{main type}
%    \begin{macrocode}
  \newcommand*\caption@setthreeparttabletype[2]{%
    \caption@ifsubtype
      {\def\caption@threeparttabletype{#1sub#2}%
       \let\caption@setanchor\relax}%
      {\caption@settype{\@ifundefined{@captype}{#2}{\@captype}}%
       \def\caption@threeparttabletype{#1#2}}%
%%% \caption@setposition{auto}% ?
    \caption@clearmargin
    \caption@setoptions\caption@threeparttabletype
    \caption@setanchor}%
%    \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 \pkg{wrapfig} package added}
% \changes{v3.2d}{2011/11/02}{Support of the \pkg{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}
% \changes{v3.6}{2020/12/28}{Usage of \cs{@testopt} added}
% First of all we make the \pkg{wrapfig} package independent from the package
% load order regarding the \pkg{float} package.
% Since the usage of |\@float@set|\-|every| is missing in the code of the \pkg{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}}}%
    \@testopt\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 \pkg{hyperref} anchor here, 	apply the `wrap' options etc.
% Since the usage of |\@float@set|\-|every| is missing in the \pkg{wrapfig}
% package we will catch it up here for making the necessary adaptions to the
% \pkg{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}%
    \caption@setanchor}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsection{Debug stuff}
%
% \begin{macro}{\caption@checkcounter}
% \changes{v3.6}{2020/12/28}{This macro added}
% |\caption@checkref|\marg{counter}\marg{expected value}\\
% checks if |\value|\marg{counter} would result in the \meta{expected value}.
%    \begin{macrocode}
\newcommand*\caption@checkcounter[1]{%
  \caption@check{\the#1}{\@nameuse{the#1}}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@check[3]{%
  \edef\caption@tempa{#2}%
  \edef\caption@tempb{#3}%
  \ifx\caption@tempa\caption@tempb
    \caption@Info{\string#1 = \caption@tempa}%
  \else
    \caption@Error{\string#1 = \caption@tempa\space <> \caption@tempb}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@checkref}
% \changes{v3.6}{2020/12/28}{This macro added}
% |\caption@checkref|\marg{marker}\marg{expected value}\\
% checks if |\ref|\marg{marker} would result in the \meta{expected value}.
%    \begin{macrocode}
\newcommand*\caption@checkref[2]{%
  \@ifundefined{r@#1}{}%
    {\expandafter\expandafter\expandafter
       \caption@@checkref\csname r@#1\endcsname\@nil{#1}{#2}}}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@@checkref#1#2\@nil#3#4{%
  \caption@check{\ref{#3}}{#1}{#4}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{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
% \Finale
%
\endinput

