% \iffalse meta-comment
% 
% This is file `caption.dtx'.
% 
% Copyright (C) 1994-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
% 
% --------------------------------------------------------------------------
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Axel Sommerfeldt.
% 
% This work consists of the files caption.ins, caption.dtx, caption2.dtx,
% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx,
% the derived files caption.sty, caption2.sty, caption3.sty,
% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty,
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
% 
% \fi
% \CheckSum{3535}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesFile{caption.drv}[2011/08/06 v3.2 Implementation of the caption package]
\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up.
%\errorcontextlines=3
%
\documentclass{ltxdoc}
\setlength\parindent{0pt}
\setlength\parskip{\smallskipamount}
%
\makeatletter % make room for subsections like 2.16.14 in the TOC
%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
\makeatother
%
\usepackage{ifpdf}
\ifpdf
  \usepackage{mathptmx,courier}
  \usepackage[scaled=0.90]{helvet}
  \addtolength\marginparwidth{15pt}
\fi
%
\usepackage{hypdoc}
\ifpdf\usepackage{hypdestopt}\fi
\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}}
%
\usepackage[debug]{caption}[2010/09/01]
%
\DeclareRobustCommand*\eTeX{\texorpdfstring
  {\leavevmode\hbox{$\varepsilon$}-\TeX}%
  {e-TeX}}
\DeclareRobustCommand*\AmS{\texorpdfstring
  {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}%
  {AMS}}
\DeclareRobustCommand*\KOMAScript{\texorpdfstring
  {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}%
  {KOMA-Script}}
\DeclareRobustCommand*\NTG{NTG}
\DeclareRobustCommand*\SmF{SMF}
%
\begin{document}
  \DocInput{caption.dtx}
\end{document}
%</driver>
% \fi
%
% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
% \let\class\puresf \let\package\puresf
% \let\env\purett \let\opt\purett
%
% \def\thispackage{the \package{caption} package}
% \def\Thispackage{The \package{caption} package}
%
% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
% \newcommand*\version[2][]{\textit{v#2}}
% \newcommand*\x{\discretionary{-}{}{}}
% \newcommand*\xx{\discretionary{}{}{}}
%
% \GetFileInfo{caption.drv}
% \let\docdate\filedate
% \GetFileInfo{caption.sty}
%
% \title{The Implementation of
%        \texorpdfstring{\thispackage\thanks{%^^A
%          This package has version number \fileversion, last revised \filedate.}}%^^A
%        {the caption package}}
% \author{Axel Sommerfeldt\\
%         \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}}
% \date{\docdate}
% \maketitle
%
% \begin{abstract}
% \Thispackage\ consists of two parts -- the kernel
% (|caption3.sty|) and the main package (|caption.sty|).
%
% \Thispackage\ redefines the \LaTeX\ commands
% |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
% |\caption@@make|, giving the user the possibility to control the look \& feel
% of the captions from floating environments like |figure| and |table|.
% Furthermore it does similar to the caption stuff coming from other packages
% (like the \package{longtable} or \package{supertabular} package):
% Mapping the appropriate internal commands (like |\LT@makecaption| or
% |\ST@caption|) to the ones offered by the \package{caption3} kernel.
% So you can think of \thispackage\ as a layer package, it
% simply provides adaptation layers between the caption stuff coming from
% \LaTeXe\ or packages, and the caption stuff offered by the
% \package{caption3} kernel.
% \end{abstract}
% 
% \section*{User manuals}
%
% This document is describing the code implementation only. The user
% documentation can be found in
% \nopagebreak\begin{quote}
% \begin{tabular}{ll}
% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/caption/caption-eng.pdf}%
%      {\texttt{caption-eng.pdf}} & The English documentation \\
% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/caption/caption-rus.pdf}%
%      {\texttt{caption-rus.pdf}} & The Russian documentation\footnotemark \\
% \href{ftp://dante.ctan.org/tex-archive/macros/latex/contrib/caption/caption-deu.pdf}%
%      {\texttt{caption-deu.pdf}} & The German documentation \\
% \end{tabular}
% \footnotetext{Thanks a lot to Olga Lapko for this translation}
% \end{quote}
%
% \StopEventually{}
% \clearpage
% \tableofcontents
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \DoNotIndex{\\,\_,\ ,\@@par}
% \DoNotIndex{\@bsphack}
% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
% \DoNotIndex{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
% \DoNotIndex{\@namedef,\@nameuse}
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
% \DoNotIndex{\@testopt}
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
% \DoNotIndex{\p@,\z@}
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
% \DoNotIndex{\fi,\footnotesize,\global}
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
% \DoNotIndex{\ifx,\ignorespaces,\itshape}
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
% \DoNotIndex{\providecommand,\quad}
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
% \DoNotIndex{\rightskip,\rmfamily}
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
% \DoNotIndex{\small,\string,\space,\strut}
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \setlength{\parskip}{0pt plus 1pt}
% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
%
% \changes{v1.0}{1994/10/27}{First release}
% \changes{v1.1}{1994/11/03}{New option \texttt{centerlast}}
% \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
% \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
% \changes{v1.4}{1995/01/30}{New option \texttt{nooneline}}
% \changes{v1.4b}{1995/04/05}{Bugfix release}
% \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
% \changes{v3.0d}{2004/11/28}{Split into two packages:
%                             \package{caption} \& \package{caption3}}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \let\subsubsection\subsection
% \let\subsection\section
%
% \iffalse
%<*package>
% \fi
%
% \subsection{Identification}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption}[2022/07/10 v3.2f Customizing captions (AR)]
%\@ifundefined{PackageRedefines}{}{\PackageRedefines{caption}{caption}}
%    \end{macrocode}
%
% \subsection{Loading the kernel}
%
%    \begin{macrocode}
\RequirePackage{caption3}[=2011/08/30] % needs v1.4 or newer
%    \end{macrocode}
%
% \subsection{Check against incompatible document classes}
%
%    \begin{macrocode}
\caption@ifbool{documentclass}{}{%
  \caption@WarningNoLine{%
    Unsupported document class (or package) detected,\MessageBreak
    usage of the caption package is not recommended}%
  \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption}%
}
%    \end{macrocode}
%
% \subsection{Check against incompatible packages}
%
% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
%    \begin{macrocode}
\@ifpackageloaded{caption2}{%
  \caption@Error{%
    You can't use both, the (obsolete) caption2 *and*\MessageBreak
    the (current) caption package}%
  \endinput
}{}
%    \end{macrocode}
%
% \changes{v3.1}{2007/06/15}{Check against incompatible \package{ftcap} package added}
% \changes{v3.1}{2007/06/15}{Check against incompatible \package{nonfloat} package added}
% \changes{v3.1}{2007/06/18}{Check against incompatible \package{topcapt} package added}
%    \begin{macrocode}
\caption@AtBeginDocument{%
  \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}%
  \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}%
  \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}}
%    \end{macrocode}
% \begin{macro}{\caption@DisablePositionOption}
% \changes{v3.1g}{2008/03/20}{\texttt{position=b} added}
% \changes{v3.1h}{2008/03/29}{%
%   Name changed from \cs{caption@IncompatiblePackage} to \cs{caption@DisablePositionOption};
%   moved from package to kernel; disables the `position' option now instead of issuing a warning}
% |\caption@DisablePositionOption|\marg{package}\par
% disables the `position' option.
%    \begin{macrocode}
\newcommand*\caption@DisablePositionOption[1]{%
  \caption@InfoNoLine{%
    `#1' package detected; setting `position=b' for compatibility reasons}%
  \caption@setposition b%
%    \end{macrocode}
%    \begin{macrocode}
  \DeclareCaptionOption{position}{%
    \caption@Error{Usage of the `position' option is incompatible\MessageBreak
      to the `#1' package}}}
%    \end{macrocode}
%    \begin{macrocode}
\@onlypreamble\caption@DisablePositionOption
%    \end{macrocode}
% \end{macro}
%
% \subsection{Declaration of options}
%
% \subsubsection{Options for figure and table}
%
% \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
%    \begin{macrocode}
\DeclareCaptionOption{figureposition}{%
  \captionsetup*[figure]{position=#1}}
\@onlypreamble@key{caption}{figureposition}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareCaptionOption{tableposition}{%
  \captionsetup*[table]{position=#1}}
\@onlypreamble@key{caption}{tableposition}
%    \end{macrocode}
%
% \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
% \changes{v3.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written}
% \changes{v3.1f}{2007/11/18}{Options \opt{figurename} and \opt{tablename} are now
%        available after the document preamble, too.}
% \changes{v3.1f}{2007/11/18}{Option \opt{name} added}
%    \begin{macrocode}
\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}}
\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}}
\DeclareCaptionOption{name}{\caption@setname\@captype{#1}}
%    \end{macrocode}
%
% \changes{v3.1g}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added}
%    \begin{macrocode}
\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}}
\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}}
%    \end{macrocode}
%
% \begin{macro}{\caption@SetName}
% \changes{v3.1}{2007/07/04}{This macro added}
% \changes{v3.1f}{2007/11/18}{After-preamble variant added}
% \changes{v3.1g}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}}
% \changes{v3.1i}{2008/08/02}{Bugfix: Works now without \cs{addto}, too}
% \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package}
%  |\caption@SetName|\marg{cmd}\marg{value}
%    \begin{macrocode}
\newcommand*\caption@SetName{%
  \RequirePackage{newfloat}%
  \newfloat@setname}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@setname[2]{\@namedef{#1name}{#2}}
%    \end{macrocode}
%    \begin{macrocode}
\caption@AtBeginDocument{\let\caption@SetName\caption@setname}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.1f}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added}
% \changes{v3.1i}{2008/04/13}{Option \opt{within} added}
% \changes{v3.1l}{2010/01/09}{The \opt{within} options are now available within the document, too}
% \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined
%                             floats declared with \cs{DeclareCaptionType}, too}
%
% \begin{macro}{\caption@DeclareWithinOption}
% \changes{v3.1l}{2010/01/09}{This macro and its usage added}
%    \begin{macrocode}
\newcommand*\caption@DeclareWithinOption[1]{%
  \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}%
  \DeclareCaptionOptionNoValue{#1without}{\caption@Within{#1}{none}}}
\@onlypreamble\caption@DeclareWithinOption
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\caption@DeclareWithinOption{figure}
\caption@DeclareWithinOption{table}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareCaptionOption{within}{%
  \RequirePackage{newfloat}%
  \newfloatsetup{within=#1}}
\DeclareCaptionOptionNoValue{without}{%
  \RequirePackage{newfloat}%
  \newfloatsetup{without}}
%    \end{macrocode}
% \begin{macro}{\caption@Within}
% \changes{v3.1}{2007/12/21}{This macro added}
% \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package}
%    \begin{macrocode}
\newcommand*\caption@Within{%
  \RequirePackage{newfloat}%
  \newfloat@setwithin}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Miscellaneous options}
%
%    \begin{macrocode}
\DeclareCaptionOption*{config}[caption]{%
   \InputIfFileExists{#1.cfg}%
     {\typeout{*** Local configuration file #1.cfg used ***}}%
     {\caption@Warning{Configuration file #1.cfg not found}}}
%    \end{macrocode}
%
% \begin{macro}{\caption@setparboxrestore}
% \changes{v3.2}{2010/11/07}{This macro added}
%  |\caption@setparboxrestore|\marg{\purett{partial} or \purett{full}}
%    \begin{macrocode}
\newcommand*\caption@setparboxrestore[1]{%
  \caption@ifinlist{#1}{full}{%
    \caption@setfullparboxrestore
  }{\caption@ifinlist{#1}{default,light,partial}{%
    \let\caption@parboxrestore\@secondoftwo
  }{%
    \caption@Error{Undefined parboxrestore `#1'}%
  }}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setfullparboxrestore}
% \changes{v3.2}{2010/11/07}{This macro added}
%  |\caption@setfullparboxrestore|\par
%  This is an abbreviation for |\caption@setparboxrestore{full}|.
%    \begin{macrocode}
\newcommand*\caption@setfullparboxrestore{%
  \let\caption@parboxrestore\@firstoftwo}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.2}{2010/11/07}{Option \opt{parboxrestore} added}
%    \begin{macrocode}
\DeclareCaptionOption{parboxrestore}{\caption@setparboxrestore{#1}}
\captionsetup{parboxrestore=default}
%    \end{macrocode}
%
% \changes{v3.1f}{2007/11/28}{Option \opt{@minipage=} added}
%    \begin{macrocode}
\DeclareCaptionOption{@minipage}{%
  \caption@ifinlist{#1}{auto,default}%
    {\let\caption@if@minipage\@gobbletwo}%
    {\caption@set@bool\caption@if@minipage{#1}}}
\captionsetup{@minipage=default}
%    \end{macrocode}
%
% \subsubsection{caption v1.x compatibility options}
% \changes{v3.1}{2007/07/21}{Option `compatibility' added}
% \changes{v3.1}{2007/09/01}{caption v1.x compatibility options revised}
% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v1.x$ compatibility options}
%
%    \begin{macrocode}
\DeclareCaptionOption{compatibility}[1]{\caption@setbool{compatibility}{#1}}
\@onlypreamble@key{caption}{compatibility}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareCaptionOptionNoValue*{normal}{%
  \caption@setformat{plain}%
  \caption@setjustification{justified}}
\DeclareCaptionOptionNoValue*{isu}{%
  \caption@setformat{hang}%
  \caption@setjustification{justified}}
\DeclareCaptionOptionNoValue*{hang}{%
  \caption@setformat{hang}%
  \caption@setjustification{justified}}
\DeclareCaptionOptionNoValue*{center}{%
  \caption@setformat{plain}%
  \caption@setjustification{centering}}
\DeclareCaptionOptionNoValue*{anne}{%
  \caption@setformat{plain}%
  \caption@setjustification{centerlast}}
\DeclareCaptionOptionNoValue*{centerlast}{%
  \caption@setformat{plain}%
  \caption@setjustification{centerlast}}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}}
\DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}}
\DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}}
\DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}}
\DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}}
\DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareCaptionOptionNoValue*{up}{\l@addto@macro\captionlabelfont\upshape}
\DeclareCaptionOptionNoValue*{it}{\l@addto@macro\captionlabelfont\itshape}
\DeclareCaptionOptionNoValue*{sl}{\l@addto@macro\captionlabelfont\slshape}
\DeclareCaptionOptionNoValue*{sc}{\l@addto@macro\captionlabelfont\scshape}
\DeclareCaptionOptionNoValue*{md}{\l@addto@macro\captionlabelfont\mdseries}
\DeclareCaptionOptionNoValue*{bf}{\l@addto@macro\captionlabelfont\bfseries}
\DeclareCaptionOptionNoValue*{rm}{\l@addto@macro\captionlabelfont\rmfamily}
\DeclareCaptionOptionNoValue*{sf}{\l@addto@macro\captionlabelfont\sffamily}
\DeclareCaptionOptionNoValue*{tt}{\l@addto@macro\captionlabelfont\ttfamily}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareCaptionOptionNoValue*{nooneline}{\caption@setbool{slc}{0}}
%    \end{macrocode}
%
%    \begin{macrocode}
\caption@setbool{ruled}{0}
\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}}
%    \end{macrocode}
%
% \subsubsection{caption2 v2.x compatibility options}
% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
% \changes{v3.1}{2007/09/01}{caption2 v2.x compatibility options revised}
% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v2.x$ compatibility options}
%
%    \begin{macrocode}
\DeclareCaptionOptionNoValue*{flushleft}{%
  \caption@setformat{plain}%
  \caption@setjustification{raggedright}}
\DeclareCaptionOptionNoValue*{flushright}{%
  \caption@setformat{plain}%
  \caption@setjustification{raggedleft}}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareCaptionOptionNoValue*{oneline}{\caption@setbool{slc}{1}}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{%
  \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}}
%    \end{macrocode}
%
% \subsubsection{Obsolete caption v3.0 options}
% \changes{v3.1}{2007/05/07}{Package option \opt{caption} marked as obsolete,
%        gives error now}
%
%    \begin{macrocode}
\DeclareCaptionOption*{caption}{%
  \caption@setbool{temp}{#1}%
  \caption@ifbool{temp}{}{%
    \caption@Error{%
      The package option `caption=#1' is obsolete.\MessageBreak
      Please pass this option to the subfig package instead\MessageBreak
      and do *not* load the caption package anymore}}}
%    \end{macrocode}
%
% \subsubsection{fltpage package support options}
%
% \changes{v3.1}{2007/09/01}{Options `FPlist' \& `FPref' added}
% With these options is controlled where the list-of entry and |\ref| resp.
% |\pageref| or |\autoref| will link to.
% Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent,
% but compatible to the usual behaviour of the \package{fltpage} package.
%    \begin{macrocode}
\DeclareCaptionOption{FPlist}[1]{\caption@setFPoption{list}{#1}}
\DeclareCaptionOption{FPref}[1]{\caption@setFPoption{ref}{#1}}
\@onlypreamble@key{caption}{FPlist}
\@onlypreamble@key{caption}{FPref}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@setFPoption[2]{%
  \edef\caption@tempa{\@car#2\@nil}%
  \caption@setbool{FP#1cap}{\if c\caption@tempa 1\else 0\fi}}
\@onlypreamble\caption@setFPoption
%    \end{macrocode}
%    \begin{macrocode}
\captionsetup{FPlist=caption,FPref=figure}
%    \end{macrocode}
%
% \subsubsection{hyperref package support options}
%
% \changes{v3.1}{2007/06/21}{Options `hypcap' \& `hypcapspace' added}
% With |hypcap=off| one can turn the \package{hypcap} support off
% (default is |on|).
%    \begin{macrocode}
\DeclareCaptionOption{hypcap}[1]{\caption@setbool{hypcap}{#1}}
\DeclareCaptionOption{hypcapspace}{\def\caption@hypcapspace{#1}}
%    \end{macrocode}
%    \begin{macrocode}
\captionsetup{hypcap=1,hypcapspace=.5\baselineskip}
%    \end{macrocode}
%
% \subsection{\AmS{} \& \SmF{} document classes support}
% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ document classes support added}
%
%    \begin{macrocode}
\caption@ifamsclass{%
  \caption@InfoNoLine{AMS or SMF document class}%
%    \end{macrocode}
%    \begin{macrocode}
  \setlength\belowcaptionskip{0pt}% set to 12pt by AMS class
%    \end{macrocode}
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsection{\KOMAScript{} document classes support}
% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added}
% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added}
% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added}
% \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised}
% \changes{v3.1}{2007/03/17}{\KOMAScript\ compatibility options removed}
% \changes{v3.1}{2007/04/05}{\KOMAScript\ compatibility revised \& enhanced}
%
%    \begin{macrocode}
\caption@ifkomaclass{%
  \caption@InfoNoLine{KOMA-Script document class}%
%    \end{macrocode}
%
% Here we emulate the caption related commands and take over the caption 
% related settings from the \KOMAScript\ classes.
%
% \begin{macro}{\@tablecaptionabovetrue}
% \begin{macro}{\@tablecaptionabovefalse}
% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
%    \begin{macrocode}
  \g@addto@macro\@tablecaptionabovetrue{\captionsetup*[table]{position=t}}
  \g@addto@macro\@tablecaptionabovefalse{\captionsetup*[table]{position=b}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
  \if@tablecaptionabove
    \@tablecaptionabovetrue
  \else
    \@tablecaptionabovefalse
  \fi
%    \end{macrocode}
%
% \begin{macro}{\onelinecaptionstrue}
% \begin{macro}{\onelinecaptionsfalse}
% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
%    \begin{macrocode}
  \g@addto@macro\onelinecaptionstrue{\let\caption@ifslc\@firstoftwo}
  \g@addto@macro\onelinecaptionsfalse{\let\caption@ifslc\@secondoftwo}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
  \ifonelinecaptions
    \onelinecaptionstrue
  \else
    \onelinecaptionsfalse
  \fi
%    \end{macrocode}
%
% \begin{macro}{\@captionabovetrue}
% \begin{macro}{\@captionabovefalse}
% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21:
%        \cs{let}\cs{caption@setposition}\cs{@gobble} added}
% \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed}
% \changes{v3.1}{2007/03/31}{We redefine \cs{captionabovetrue/false} now
%        instead of \cs{captionabove/below}}
% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
% \changes{v3.1k}{2009/10/09}{\opt{figureposition} and \opt{tableposition} will issue a warning now}
%  Please note that these are stronger than the \opt{position} setting, therefore we
%  override the options \opt{figureposition} and \opt{tableposition} to typeout a warning.
%    \begin{macrocode}
  \g@addto@macro\@captionabovetrue{\let\caption@position\@firstoftwo}
  \g@addto@macro\@captionabovefalse{\let\caption@position\@secondoftwo}
%    \end{macrocode}
%    \begin{macrocode}
  \DeclareCaptionOption{figureposition}{%
    \caption@WarningNoLine{Option `figureposition=#1' has no effect\MessageBreak
    when used with a KOMA script document class}}
  \DeclareCaptionOption{tableposition}{%
    \caption@WarningNoLine{Option `tableposition=#1' has no effect\MessageBreak
    when used with a KOMA script document class}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\setcapindent}
%    \begin{macrocode}
  \let\caption@KOMA@setcapindent\@setcapindent
  \renewcommand*\@setcapindent[1]{%
    \caption@KOMA@setcapindent{#1}\caption@setcapindent}
%    \end{macrocode}
%    \begin{macrocode}
  \let\caption@KOMA@@setcapindent\@@setcapindent
  \renewcommand*\@@setcapindent[1]{%
    \caption@KOMA@@setcapindent{#1}\caption@setcapindent}
%    \end{macrocode}
%    \begin{macrocode}
  \newcommand*\caption@setcapindent{%
    \captionsetup{indent=\ifdim\cap@indent<\z@\z@\else\cap@indent\fi}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  \caption@ifundefined\cap@indent{}{\caption@setcapindent}
%    \end{macrocode}
%
% \begin{macro}{\setcapwidth}
%  \Note{The optional argument of \cs{setcapwidth} if not supported (yet),
%  so we issue a warning if used.
%  (Since this does not seem to have an negative effect when used
%   by the \texttt{captionbeside} environment, we suppress the warning here.)}
%    \begin{macrocode}
  \expandafter\let\expandafter\caption@KOMA@setcapwidth
                  \csname\string\setcapwidth\endcsname
  \@namedef{\string\setcapwidth}[#1]#2{%
    \caption@KOMA@setcapwidth[#1]{#2}\caption@setcapwidth{#1}}
%    \end{macrocode}
%    \begin{macrocode}
  \newcommand*\caption@setcapwidth[1]{%
    \ifx\\#1\\\else
      \caption@ifundefined\cap@margin{}{%
        \def\@tempa{captionbeside}%
        \ifx\@tempa\@currenvir\else\caption@Warning{%
          Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}%
        \fi}%
    \fi
    \captionsetup{width=\cap@width}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  \def\caption@tempa{\hsize}%
  \ifx\caption@tempa\cap@width \else
    \caption@setcapwidth{?}
  \fi
%    \end{macrocode}
%
% \begin{macro}{\setcapmargin}
%    \begin{macrocode}
  \expandafter\let\expandafter\caption@KOMA@setcapmargin
                  \csname\string\@setcapmargin\endcsname
  \@namedef{\string\@setcapmargin}[#1]#2{%
    \caption@KOMA@setcapmargin[#1]{#2}\caption@setcapmargin}
%    \end{macrocode}
%    \begin{macrocode}
  \expandafter\let\expandafter\caption@KOMA@@setcapmargin
                  \csname\string\@@setcapmargin\endcsname
  \@namedef{\string\@@setcapmargin}[#1]#2{%
    \caption@KOMA@@setcapmargin[#1]{#2}\caption@setcapmargin}
%    \end{macrocode}
%    \begin{macrocode}
  \newcommand*\caption@setcapmargin{%
    \begingroup
      \let\onelinecaptionsfalse\relax
      \def\@twoside{0}%
      \def\if@twoside{\def\@twoside{1}\iffalse}%
      \cap@margin
      \def\@tempa{\endgroup}%
      \ifx\cap@left\hfill\else\ifx\cap@right\hfill\else
        \def\hspace##1##{\@firstofone}%
        \edef\@tempa{\endgroup
          \noexpand\captionsetup{%
            twoside=\@twoside,slc=0,%
            margin={\cap@left,\cap@right}}}%
      \fi\fi
      \@tempa}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  \ifx\cap@margin\relax \else
    \caption@setcapmargin
  \fi
%    \end{macrocode}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsection{Processing of options}
%
% \changes{v3.0m}{2007/03/04}{Verbose option added}
% \changes{v3.1}{2007/07/02}{Verbose option removed from package}
%
% \changes{v3.1}{2007/03/17}{We do not process global options anymore}
%    \begin{macrocode}
\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}
\caption@ProcessOptions*{caption}
%    \end{macrocode}
%
% \subsection{\cs{caption}, \cs{@caption}, and \cs{@makecaption}}
%
% \begin{macro}{\caption@caption}
% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
% \changes{v3.2c}{2011/09/04}{Support of \cs{donemaincaptiontrue} from \textsf{memoir} document class added}
%  Here comes our definition of |\caption| and |\caption*|.
%  Beside the support of the starred variant this code was adapted to the
%  various packages we support.
%  We are using |\caption@dblarg| instead of |\@dblarg| so |\caption{}|
%  (with an empty arg.) will produce a list-of entry, but |\caption[]{}|
%  won't.
%    \begin{macrocode}
\def\caption@caption{%
  \caption@iftype
    {\caption@checkgrouplevel\@empty\caption
     \caption@star
       {\@nameuse{donemaincaptiontrue}%
        \caption@refstepcounter\@captype}%
       {\caption@dblarg{\@caption\@captype}}}%
    {\caption@Error{\noexpand\caption outside float}%
     \caption@gobble}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@star}
% \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}}
% \changes{v3.2c}{2011/08/21}{\cs{global} removed}
%  A helper macro which processes the optional |*| after |\caption|.
%    \begin{macrocode}
\newcommand*\caption@star[2]{%
  \@ifstar{\caption@startrue#2[]}{#1#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@caption}
% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore}
% \changes{v3.1f}{2007/11/28}{Bugfix: Handling of \texttt{@minipage} flag added}
% \changes{v3.1f}{2007/11/28}{Support of option \opt{@minipage} added}
% \changes{v3.1g}{2008/03/16}{Internal: Uses \cs{caption@prepareanchor} now}
% \changes{v3.2d}{2011/10/21}{Adapted to the \textsf{memoir} document class}
%  As above, our version has been adapted to the packages we support.
%  Additionally our code is nested by |\caption@beginex| \&
%  |\caption@end| instead of |\begingroup| \& |\endgroup|.
%  Furthermore we use |\caption@boxrestore| instead of |\@parboxrestore|
%  so this code also works correctly inside list-based environments
%  like |wide| \& |addmargin|. (This, and the fact that we use
%  |\linewidth| instead of |\hsize| inside |\@makecaption|, solves
%  \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2472}%^^A
%  {\LaTeX\ PR \texttt{latex/2472}}.)
%    \begin{macrocode}
\long\def\caption@@caption#1[#2]#3{%
%    \end{macrocode}
%    \begin{macrocode}
  \ifcaption@star \else
    \caption@prepareanchor{#1}{#2}%
    \M@gettitle{#2}%
    \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}%
  \fi
%    \end{macrocode}
%    \begin{macrocode}
  \par
  \caption@beginex{#1}{#2}{#3}%
    \caption@setfloatcapt{%
      \caption@boxrestore
      \if@minipage
        \@setminipage
      \fi
      \caption@normalsize
      \ifcaption@star
        \let\caption@makeanchor\@firstofone
      \fi
      \@makecaption{\csname fnum@#1\endcsname}%
                   {\ignorespaces\caption@makeanchor{#3}}\par
      \caption@if@minipage\@minipagetrue\@minipagefalse}%
  \caption@end}
%    \end{macrocode}
% \textsf{memoir} document class stuff:
%    \begin{macrocode}
\providecommand\M@gettitle[1]{}
\providecommand\memcaptioninfo[4]{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@prepareanchor}
% \changes{v3.1g}{2008/03/16}{This macro added}
%    \begin{macrocode}
\newcommand*\caption@prepareanchor[2]{%
  \caption@makecurrent{#1}{#2}%
  \caption@ifhypcap\caption@@start{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@makecaption}
% \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added}
%  |\@makecaption|\marg{label}\marg{text}\par
%  We do basically the same as the original code (from the standard
%  \LaTeX\ document classes), but take care of the |position=| setting
%  and use |\caption@@make| from the \package{caption} kernel to finally
%  typeset the caption.
%    \begin{macrocode}
\long\def\caption@makecaption#1#2{%
  \caption@iftop
    {\vskip\belowcaptionskip}%
    {\caption@rule\vskip\abovecaptionskip}%
  \caption@@make{#1}{#2}%
  \caption@iftop
    {\vskip\abovecaptionskip\caption@rule}%
    {\vskip\belowcaptionskip}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@redefine}
% \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now}
% We only redefine |\caption| and |\@caption| if the current definitions
% are well known, so documents written in the old (\package{caption}
% package \version{1.x}) days (where |\caption| \& |\@caption| were not
% redefined by us) will still compile fine.
% For example the usage of the \package{captcont} package, which brings
% it's own definition of |\caption*|, was quite common these days.
%    \begin{macrocode}
\newcommand*\caption@redefine{}
\g@addto@macro\caption@redefine{%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@setbool{incompatible}{0}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\caption{%
    % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
    \def\caption{%
       \ifx\@captype\@undefined
         \@latex@error{\noexpand\caption outside float}\@ehd
         \expandafter\@gobble
       \else
         \refstepcounter\@captype
         \expandafter\@firstofone
       \fi
       {\@dblarg{\@caption\@captype}}%
    }}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\caption{%
    % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
    \def\caption{
      \ifx\@captype\@undefined
        \@latex@error{\noexpand\caption outside figure or table}\@ehd
        \expandafter\@gobble
      \else
        \refstepcounter\@captype
        \expandafter\@firstofone
      \fi
      {\@dblarg{\@caption\@captype}}%
    }}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\caption{%
    % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
    \renewcommand\caption{%
      \ifx\@captype\@undefined
        \@latex@error{\noexpand\caption outside float}\@ehd
        \expandafter\@gobble
      \else
        \refstepcounter\@captype
        \let\@tempf\@caption
        \expandafter\ifx\csname @float@c@\@captype\endcsname\relax\else
          \expandafter\expandafter\let
            \expandafter\@tempf\csname @float@c@\@captype\endcsname
        \fi
      \fi
      \@dblarg{\@tempf\@captype}}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\caption{%
    % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
    % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
    % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
    \def\caption{%
      \ifx\@captype\@undefined
        \@latex@error{\noexpand\caption outside float}\@ehd
        \expandafter\@gobble
      \else
        \H@refstepcounter\@captype
        \@ifundefined{fst@\@captype}{%
          \let\Hy@tempa\@caption
        }{%
          \let\Hy@tempa\Hy@float@caption
        }%
        \expandafter\@firstofone
      \fi
      {\@dblarg{\Hy@tempa\@captype}}%
    }}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@CheckCommand\caption{%
    % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
    \def\caption{%
      \ifx\@captype\@undefined
        \@latex@error{\noexpand\caption outside float}\@ehd
        \expandafter\@gobble
      \else
        \H@refstepcounter\@captype
        \let\Hy@tempa\@caption
        \@ifundefined{float@caption}{%
        }{%
          \expandafter\ifx\csname @float@c@\@captype\endcsname\float@caption
            \let\Hy@tempa\Hy@float@caption
          \fi
        }%
        \expandafter\@firstofone
      \fi
      {\@dblarg{\Hy@tempa\@captype}}%
    }}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@CheckCommand\caption{%
    % memhfixc.sty [2010/08/17 v1.15 nameref/hyperref package fixes for memoir class]
    % \let\m@moldhypcaption\caption
    \renewcommand{\caption}{\donemaincaptiontrue\m@moldhypcaption}}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@IfCheckCommand{}{%
    \caption@InfoNoLine{%
      Incompatible package detected (regarding \string\caption).\MessageBreak
      \string\caption\space=\space\meaning\caption}%
    \caption@setbool{incompatible}{1}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)]
    \long\def\@caption#1[#2]#3{%
      \par
      \addcontentsline{\csname ext@#1\endcsname}{#1}%
        {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
      \begingroup
        \@parboxrestore
        \if@minipage
          \@setminipage
        \fi
        \normalsize
        \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
      \endgroup}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau
    \long\def\@caption#1[#2]#3{% second argument ignored
      \par\nobreak
      \begingroup
        \@parboxrestore
        \if@minipage
          \@setminipage
        \fi
        \beamer@makecaption{#1}{\ignorespaces #3}\par\nobreak
        \endgroup}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system]
    \long\def\@caption#1[#2]#3{%
      \csname par\endcsname
      \addcontentsline{\csname ext@#1\endcsname}{#1}%
        {\protect\numberline{\csname the#1\endcsname.}{\ignorespaces #2}}%
      \begingroup
        \@parboxrestore
        \if@minipage
          \@setminipage
        \fi
        \normalsize
        \@makecaption{\csname fnum@#1\endcsname}%
            {\ignorespaces #3}\csname par\endcsname
      \endgroup}}%
%    \end{macrocode}
%
%    \begin{macrocode}
%   \caption@CheckCommand\float@caption{%
%     % float.sty [2001/11/08 v1.3d Float enhancements (AL)]
%     \long\def\float@caption#1[#2]#3{%
%       \addcontentsline{\@nameuse{ext@#1}}{#1}%
%        {\protect\numberline{\@nameuse{the#1}}{\ignorespaces #2}}
%       \global\setbox\@floatcapt\vbox\bgroup\@parboxrestore
%         \normalsize\@fs@capt{\@nameuse{fnum@#1}}{\ignorespaces #3}%
%         \@ifnextchar[{\float@ccon}{\egroup}}%
%     \long\def\float@ccon[#1]{#1\par\egroup}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX]
    \long\def\@caption#1[#2]#3{%
      \hyper@makecurrent{\@captype}%
      \def\@currentlabelname{#2}%
      \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
        \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
      }%
      \begingroup
        \@parboxrestore
        \if@minipage
          \@setminipage
        \fi
        \normalsize
        \@makecaption{\csname fnum@#1\endcsname}{%
          \ignorespaces
          \ifHy@nesting
            \hyper@@anchor{\@currentHref}{#3}%
          \else
            \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
          \fi
        }%
        \par
      \endgroup
    }}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX]
    % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX]
    % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX]
    \long\def\@caption#1[#2]#3{%
      \expandafter\ifx\csname if@capstart\expandafter\endcsname
                      \csname iftrue\endcsname
        \global\let\@currentHref\hc@currentHref
      \else
        \hyper@makecurrent{\@captype}%
      \fi
      \def\@currentlabelname{#2}%
      \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
        \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
      }%
      \begingroup
        \@parboxrestore
        \if@minipage
          \@setminipage
        \fi
        \normalsize
        \expandafter\ifx\csname if@capstart\expandafter\endcsname
                        \csname iftrue\endcsname
          \global\@capstartfalse
          \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
        \else
          \@makecaption{\csname fnum@#1\endcsname}{%
            \ignorespaces
            \ifHy@nesting
              \hyper@@anchor{\@currentHref}{#3}%
            \else
              \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3%
            \fi
          }%
        \fi
        \par
      \endgroup
    }}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % hyperref.sty [2009/11/27 v6.79k Hypertext links for LaTeX]
    \long\def\@caption#1[#2]#3{%
      \expandafter\ifx\csname if@capstart\expandafter\endcsname
                      \csname iftrue\endcsname
        \global\let\@currentHref\hc@currentHref
      \else
        \hyper@makecurrent{\@captype}%
      \fi
      \def\@currentlabelname{#2}%
      \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
        \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
      }%
      \begingroup
        \@parboxrestore
        \if@minipage
          \@setminipage
        \fi
        \normalsize
        \expandafter\ifx\csname if@capstart\expandafter\endcsname
                        \csname iftrue\endcsname
          \global\@capstartfalse
          \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
        \else
          \@makecaption{\csname fnum@#1\endcsname}{%
            \ignorespaces
            \ifHy@nesting
              \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
            \else
              \Hy@raisedlink{%
                \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
              }%
              #3%
            \fi
          }%
        \fi
        \par
      \endgroup
    }}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % hyperref.sty [2009/12/09 v6.79m Hypertext links for LaTeX]
    % hyperref.sty [2009/12/28 v6.79z Hypertext links for LaTeX]
    \long\def\@caption#1[#2]#3{%
      \expandafter\ifx\csname if@capstart\expandafter\endcsname
                      \csname iftrue\endcsname
        \global\let\@currentHref\hc@currentHref
      \else
        \hyper@makecurrent{\@captype}%
      \fi
      \@ifundefined{NR@gettitle}{%
        \def\@currentlabelname{#2}%
      }{%
        \NR@gettitle{#2}%
      }%
      \par\addcontentsline{\csname ext@#1\endcsname}{#1}{%
        \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}%
      }%
      \begingroup
        \@parboxrestore
        \if@minipage
          \@setminipage
        \fi
        \normalsize
        \expandafter\ifx\csname if@capstart\expandafter\endcsname
                        \csname iftrue\endcsname
          \global\@capstartfalse
          \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}%
        \else
          \@makecaption{\csname fnum@#1\endcsname}{%
            \ignorespaces
            \ifHy@nesting
              \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}%
            \else
              \Hy@raisedlink{%
                \expandafter\hyper@@anchor\expandafter{%
                  \@currentHref
                }{\relax}%
              }%
              #3%
            \fi
          }%
        \fi
        \par
      \endgroup
    }}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % nameref.sty [2006/12/27 v2.28 Cross-referencing by name of section]
    \long\def\@caption#1[#2]{%
      \def\@currentlabelname{#2}%
      \NR@@caption{#1}[{#2}]%
    }}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % nameref.sty [2009/11/27 v2.32 Cross-referencing by name of section]
    \long\def\@caption#1[#2]{%
      \NR@gettitle{#2}%
      \NR@@caption{#1}[{#2}]%
    }}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % subfigure.sty [2002/07/30 v2.1.4 subfigure package]
    \long\def\@caption#1[#2]#3{%
      \@ifundefined{if#1topcap}%
        {\subfig@oldcaption{#1}[{#2}]{#3}}%
        {\@nameuse{if#1topcap}%
           \@listsubcaptions{#1}%
           \subfig@oldcaption{#1}[{#2}]{#3}%
         \else
           \subfig@oldcaption{#1}[{#2}]{#3}%
           \@listsubcaptions{#1}%
         \fi}}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@CheckCommand\@caption{%
    % subfig.sty [2005/06/28 ver: 1.3 subfig package]
    \def\@caption{\caption@}%
%   \long\def\caption@#1[#2]#3{%
%     \@ifundefined{caption@setfloattype}%
%       \caption@settype
%       \caption@setfloattype
%           \@captype
%     \sf@ifpositiontop{%
%       \@listsubcaptions{#1}%
%       \sf@old@caption{#1}[{#2}]{#3}%
%     }{%
%       \sf@old@caption{#1}[{#2}]{#3}%
%       \@listsubcaptions{#1}%
%     }}%
    }%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@IfCheckCommand{}{%
    \caption@InfoNoLine{%
      Incompatible package detected (regarding \string\@caption).\MessageBreak
      \string\@caption\space=\space\meaning\@caption}%
    \caption@setbool{incompatible}{1}}%
%    \end{macrocode}
%
% The option |compatibility=| will override the compatibility mode.
%    \begin{macrocode}
  \caption@ifundefined\caption@ifcompatibility
    {\let\caption@ifcompatibility\caption@ifincompatible
     \let\caption@tempa\caption@WarningNoLine}%
    {\let\caption@tempa\@gobble}% suppress warning
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@ifcompatibility{%
%    \end{macrocode}
%
%    \begin{macrocode}
    \caption@tempa{%
      \noexpand\caption will not be redefined since it's already\MessageBreak
      redefined by a document class or package which is\MessageBreak
      unknown to the caption package}%
%    \end{macrocode}
%
%    \begin{macrocode}
    \renewcommand*\caption@redefine{}%
%    \end{macrocode}
%
%  |\ContinuedFloat| is not supported in compatibility mode.
%    \begin{macrocode}
    \renewcommand*\caption@ContinuedFloat[1]{%
      \caption@Error{Not available in compatibility mode}}%
%    \end{macrocode}
%
%  |\caption@start| is not supported in compatibility mode.
%    \begin{macrocode}
    \caption@AtBeginDocument*{%
      \let\caption@start\relax
      \caption@ifundefined\caption@ORI@capstart{}{%
        \caption@Debug{%
          Restore hypcap definition of \string\capstart\@gobble}%
        \let\capstart\caption@ORI@capstart}%
      \caption@ifundefined\caption@ORI@float@makebox{}{%
        \caption@Debug{%
          Restore hyperref redefinition of \string\float@makebox\@gobble}%
        \let\float@makebox\caption@ORI@float@makebox}%
    }%
%    \end{macrocode}
%
% \begin{macro}{\caption@star}
%  We redefine |\caption@star| here so it does not make any harm.
%    \begin{macrocode}
    \renewcommand*\caption@star[2]{#1#2}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  }{%
%    \end{macrocode}
%
%    \begin{macrocode}
    \caption@ifincompatible{%
      \caption@WarningNoLine{%
        Forced redefinition of \noexpand\caption since the\MessageBreak
        unsupported(!) package option `compatibility=false'\MessageBreak
        was given}%
    }{}%
%    \end{macrocode}
%
% \begin{macro}{\caption}
% \begin{macro}{\@caption}
%    \begin{macrocode}
    \renewcommand*\caption@redefine{%
      \let\caption\caption@caption
      \let\@caption\caption@@caption}%
    \caption@redefine
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
  }%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@AtBeginDocument*{%
    \let\caption@ORI@capstart\@undefined
    \let\caption@ORI@float@makebox\@undefined}%
%    \end{macrocode}
%
% \begin{macro}{\@xfloat}
% \changes{v3.1}{2007/05/09}{This re-definition added}
% \changes{v3.1b}{2007/09/22}{Will now be redefined in compatibility mode, too}
% We redefine |\@xfloat| so inside floating environments our
% type-specific options will be used, a \package{hyperref}
% anchor will be set etc.
%    \begin{macrocode}
  \let\caption@ORI@xfloat\@xfloat
  \def\@xfloat#1[#2]{%
    \caption@ORI@xfloat{#1}[#2]%
    \caption@settype{#1}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
% \end{macro}
%
% Some packages (like the \package{hyperref} package for example) redefines
% |\caption| and |\@caption|, too.
% So we have to use |\AtBeginDocument| here, so we can make sure
% our definition is the one which will be valid at last.
%    \begin{macrocode}
\caption@AtBeginDocument{\caption@redefine}
%    \end{macrocode}
%
% \begin{macro}{\@makecaption}
%    \begin{macrocode}
\let\@makecaption\caption@makecaption
%    \end{macrocode}
% \end{macro}
%
% \subsection{\cs{captionof} and \cs{captionlistentry}}
%
% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
% \changes{v3.1}{2007/06/25}{Option \opt{type*=} added}
% \changes{v3.1f}{2007/11/16}{Option \opt{subtype} \& \opt{subtype*} added}
% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Option \opt{type=} uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
%
%    \begin{macrocode}
\caption@AtBeginDocument{%
%    \end{macrocode}
%    \begin{macrocode}
  \DeclareCaptionOption{type}{\setcaptiontype{#1}}%
  \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}%
%    \end{macrocode}
%    \begin{macrocode}
  \DeclareCaptionOptionNoValue{subtype}{\setcaptionsubtype\relax}%
  \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}%
%    \end{macrocode}
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \emph{Important Note:}
% Like |\captionof| the option |type=| should only be used inside a
% group, box, or environment and does not check if the argument is a valid
% floating environment or not.
%
% \begin{macro}{\setcaptiontype}
% \changes{v3.2}{2010/10/24}{This macro added}
%  Like |\captionsetup{type=xxx}|, but also works if \cs{captionsetup} was redefined.
%    \begin{macrocode}
\newcommand\setcaptiontype{%
  \caption@boxrestore@mini
  \caption@settype}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setcaptionsubtype}
% \changes{v3.2a}{2011/08/15}{This macro added}
% Same, but sets the sub-type.
%    \begin{macrocode}
\newcommand\setcaptionsubtype{%
  \caption@iftype
    \caption@setsubtype
    {\caption@Error{\noexpand\setcaptionsubtype outside float}}}%
%    \end{macrocode}
%    \begin{macrocode}
\newcommand\caption@setsubtype{%
  \@ifstar
    {\caption@@settype{sub}*{sub\@captype}}%
    {\caption@@settype{sub}{sub\@captype}}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@settype}
% \changes{v3.1}{2007/05/09}{This macro added}
% \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added}
% \changes{v3.1d}{2007/10/23}{Error message for \cs{caption@checkgrouplevel} revised}
% \changes{v3.1f}{2007/11/16}{\cs{caption@setsubtype} added}
% \changes{v3.1f}{2007/12/03}{Crappy \cs{caption@iftypewarning} replaced}
% \changes{v3.1g}{2008/01/12}{Usage of \cs{ifcaptionsetup@star} added}
% \changes{v3.2}{2010/10/26}{Error message moved from here to \cs{caption@refstepcounter}}
%  |\caption@settype*|\marg{type}\par
%  sets |\@captype| and executes the options associated with it
%  (using |\caption@setoptions|).
%  Furthermore we check |\currentgrouplevel| (if avail),
%  redefine |\@currentlabel| so a |\label| before |\caption| will result
%  in a hint instead of a wrong reference, and
%  use the macro |\caption@|(|sub|)|typehook| (which will be used by our
%  \package{float} package support).\par
%  The non-starred version sets a \package{hyperref} anchor additionally
%  (if |hypcap=true| and the \package{hypcap} package is not loaded).
%    \begin{macrocode}
\newcommand*\caption@settype{%
  \caption@@settype{}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@settype[1]{%
  \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@@settype[3]{%
% #1 = "" or "sub"
% #2 = \@firstoftwo in star form, \@secondoftwo otherwise
% #3 = <type>, e.g. "figure" or "table"
  \caption@Debug{#1type=#3}%
  \caption@checkgrouplevel{#1}{%
    \captionsetup{#1type#2*\@empty=...}#2{ or
                  \@backslashchar#1captionof}{}}%
%    \end{macrocode}
%    \begin{macrocode}
  \edef\caption@tempa{#3}%
  \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else
    \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi
  \fi
  \expandafter\let\csname @#1captype\endcsname\caption@tempa
%    \end{macrocode}
%    \begin{macrocode}
  \@nameuse{caption@#1typehook}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@setoptions{#3}%
  \ifx\caption@opt\relax
    \@nameundef{caption@#1type@warning}%
  \else
    \@namedef{caption@#1type@warning}{\caption@Warning{%
      The #1caption type was already set to
      `\csname @#1captype\endcsname'\MessageBreak}}%
  \fi
%    \end{macrocode}
%    \begin{macrocode}
  \let\caption@ifrefstepcounter\@secondoftwo
  #2{}{%
    \let\@currentlabel\caption@undefinedlabel
%   \let\@currentHlabel\@undefined
    \ifx\caption@x@label\@undefined
      \let\caption@x@label\label
      \let\label\caption@xlabel
    \fi
    \caption@start}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@typehook}
% Hook, will be extended later on, e.g.~by our \package{float} package
% support.
%    \begin{macrocode}
\newcommand*\caption@typehook{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@iftype}
% \changes{v3.1}{2007/04/11}{This macro and its usage added}
%  Since we often need to check if |\@captype| is defined (means: we
%  are inside a floating environment) this helper macro was introduced.
%    \begin{macrocode}
\newcommand*\caption@iftype{%
  \caption@ifundefined\@captype\@secondoftwo\@firstoftwo}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@checkgrouplevel}
% \changes{v3.1}{2007/07/15}{This macro and its usage added}
% \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)}
%  Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done
%  inside a group or not -- in the latter case a warning message will
%  be issued. (needs \eTeX)
%    \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname currentgrouplevel\endcsname\relax
  \caption@Debug{TeX engine: TeX}
  \let\caption@checkgrouplevel\@gobbletwo
\else
  \caption@Debug{TeX engine: e-TeX}
  \newcommand*\caption@checkgrouplevel[2]{%
    \@ifundefined{#1caption@grouplevel}{%
       \caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}%
       \ifnum\currentgrouplevel>\caption@grouplevel\relax
         \expandafter\edef\csname #1caption@grouplevel\endcsname{%
           \the\currentgrouplevel}%
       \else
         \caption@Warning{\string#2\MessageBreak outside box or environment}%
       \fi
    }{}}
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@undefinedlabel}
% \changes{v3.1}{2007/07/03}{This macro and its usage added}
% \changes{v3.1b}{2007/09/22}{Contents changed to \texttt{??}}
% \changes{v3.1i}{2008/04/13}{Contents changed to \cs{caption@xref}(\ldots)}
% \changes{v3.1k}{2009/03/30}{Bugfix 08-12-08: \cs{caption@xref} is robust now}
% \changes{v3.2c}{2011/09/13}{Text changed from `before' to `without proper'}
%  This label will be used for |\currentlabel| inside (floating) environments
%  as default. (see above)
%  \iffalse\Note{All commands used have to be robust here.}\fi
%    \begin{macrocode}
\newcommand*\caption@undefinedlabel{%
  \protect\caption@xref{\caption@labelname}{\on@line}}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareRobustCommand*\caption@xref[2]{%
  \caption@WarningNoLine{\noexpand\label without proper \string\caption#2}%
  \@setref\relax\@undefined{#1}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@labelname{??}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\caption@xlabel}
% \changes{v3.1b}{2007/09/22}{This macro and its usage added}
% \changes{v3.1f}{2007/11/11}{Revised}
% \changes{v3.1i}{2008/04/13}{Bugfix: \cs{pageref} should always work now}
% \changes{v3.2c}{2011/08/19}{Works with optional arguments now, too}
%  The new code of |\label| inside floating environments.
%  |\label| will be redefined using |\caption@withoptargs|, so
%  |#1| are the optional arguments (if any), and
%  |#2| is the mandatory argument here.
%    \begin{macrocode}
\newcommand*\caption@xlabel{%
  \caption@withoptargs\caption@@xlabel}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@xlabel[2]{%
  \caption@@@xlabel
  \def\caption@labelname{#2}%
  \caption@x@label#1{#2}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@@xlabel{%
  \global\let\caption@@@xlabel\@empty
  \@bsphack
    \protected@write\@auxout{}%
      {\string\providecommand*\string\caption@xref[2]{%
        \string\@setref\string\relax\string\@undefined{\string##1}}}%
  \@esphack}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionof}
% \changes{v3.1}{2007/05/09}{Uses \cs{caption@settype} instead of \cs{def}\cs{@captype}}
% \changes{v3.1c}{2007/09/22}{Bugfix: Redefinition of \cs{caption@setfloatcapt} removed}
% \changes{v3.1e}{2007/10/30}{Better compatibility: Will be defined with \cs{AtBeginDocument} now}
% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Uses \cs{setcaptiontype} instead of \cs{caption@settype} now}
%  |\captionof|\marg{type}\oarg{lst\_entry}\marg{heading}\\
%  |\captionof*|\oarg{lst\_entry}\marg{heading}\par
% \Note{This will be defined with \cs{AtBeginDocument} so
%  \cs{usepackage}\csmarg{caption,capt-of} will still work.
%  (Compatibility to \version{1.x})}
%    \begin{macrocode}
\caption@AtBeginDocument{%
  \def\captionof{\caption@teststar\caption@of{\caption*}\caption}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@of[2]{\setcaptiontype*{#2}#1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionlistentry}
% \changes{v3.1}{2007/07/28}{This macro added}
% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
% \changes{v3.1g}{2008/01/20}{Starred variant added}
% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
%  |\captionlistentry|\oarg{float type}\marg{list entry}\\
%  |\captionlistentry*|\oarg{float type}\marg{list entry}
%    \begin{macrocode}
\newcommand*\captionlistentry{%
  \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\@captionlistentry[1]{%
  \@testopt{\caption@listentry{#1}}\@captype}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@listentry#1[#2]#3{%
  \@bsphack
    #1{\caption@gettitle{#3}}%
      {\caption@refstepcounter{#2}%
       \caption@makecurrent{#2}{#3}}%
    \caption@addcontentsline{#2}{#3}%
  \@esphack}
%    \end{macrocode}
% \end{macro}
%
% \subsection{\cs{captionbox}}
%
% \begin{macro}{\captionbox}
% \changes{v3.2}{2010/12/17}{This macro added}
% \changes{v3.2a}{2011/08/16}{\cs{captionsetup} replaces with \cs{captionbox@settype} and \cs{caption@setposition}}
% A |\parbox| with contents and caption, separated by an invisible |\hrule|.
%    \begin{macrocode}
\newcommand*\captionbox{%
  \let\captionbox@settype\@gobble
  \caption@withoptargs\caption@box}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand\caption@box[2]{%
  \@testopt{\caption@ibox{#1}{#2}}{\wd\@tempboxa}}
%    \end{macrocode}
%    \begin{macrocode}
\long\def\caption@ibox#1#2[#3]{%
  \@testopt{\caption@iibox{#1}{#2}{#3}}\captionbox@hj@default}
%    \end{macrocode}
%    \begin{macrocode}
\long\def\caption@iibox#1#2#3[#4]#5{%
  \setbox\@tempboxa\hbox{#5}%
  \begingroup
  \captionbox@settype*% set \caption@position
  \caption@iftop{%
    \endgroup
    \parbox[t]{#3}{%
      \captionbox@settype\relax
      \caption@setposition t%
      \vbox{\caption#1{#2}}%
      \captionbox@hrule
      \csname caption@hj@#4\endcsname
      \unhbox\@tempboxa}%
  }{%
    \endgroup
    \parbox[b]{#3}{%
      \captionbox@settype\relax
      \caption@setposition b%
      \csname caption@hj@#4\endcsname
      \unhbox\@tempboxa
      \captionbox@hrule
      \vtop{\caption#1{#2}}}%
  }}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\captionbox@hj@default{c}
\newcommand*\captionbox@hrule{\hrule\@height\z@\relax}
%    \end{macrocode}
%    \begin{macrocode}
\providecommand*\caption@hj@c{\centering}
\providecommand*\caption@hj@l{\raggedright}
\providecommand*\caption@hj@r{\raggedleft}
\providecommand*\caption@hj@s{}
%    \end{macrocode}
% \end{macro}
%
% \subsection{\cs{ContinuedFloat}}
%
% \begin{macro}{\ContinuedFloat}
% \changes{v3.0f}{2005/06/11}{%
%         Call of \cs{caption@ContinuedFloat} added}
% \changes{v3.0i}{2005/11/12}{%
%         Optional argument and call of \cs{caption@@ContinuedFloat} added}
% \changes{v3.0g}{2005/06/28}{%
%         Bugfix: \cs{newcounter} replaced by \cs{newcount}}
% \changes{v3.1}{2007/07/02}{Format of \package{hyperref} extension changed}
% \changes{v3.1}{2007/07/07}{\cs{caption@setoptions} added}
% \changes{v3.1g}{2008/01/29}{Starred variant and hook \cs{sf@ContinuedFloat} added}
%  |\ContinuedFloat|\\
%  |\ContinuedFloat*|\par
%  This mainly decrements the appropriate counter and increments the
%  continuation counter instead.
%  Furthermore we set |\caption@resetContinuedFloat| to |\@gobble| so the
%  continuation counter will not be reset to zero inside |\caption@refstepcounter|.
%  Please forget about the optional argument, it was never working well, is
%  incompatible to the \package{subfig} package, but is still there for
%  compatibility reasons.
%  \Note{The definition of \cs{ContinuedFloat} itself is compatible
%   to the one inside the \package{subfig} package, except for the
%   starred variant and the optional argument.}
%  When the \package{hyperref} package is used we have the problem
%  that the usage of |\ContinuedFloat| will create duplicate
%  hyper links -- |\@currentHref| will be the same for the main float and
%  the continued ones. So we have to make sure unique labels and references
%  will be created each time. We do this by extending |\theHfigure| and
%  |\theHtable|, so for continued floats the scheme
%  \begin{quote}\meta{type}|.|\meta{type \#}|\alph{|\meta{continued \#}|}|\end{quote}
%  will be used instead of
%  \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
%  \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
%  \Note{This does not help if the \package{hyperref} package option
%        \texttt{naturalnames=true} is set.}
%    \begin{macrocode}
\def\ContinuedFloat{%
  \@ifnextchar[\@Continued@Float\@ContinuedFloat}
%    \end{macrocode}
%    \begin{macrocode}
\def\@Continued@Float[#1]{\addtocounter{#1}\m@ne}
%    \end{macrocode}
%    \begin{macrocode}
\def\@ContinuedFloat{%
  \caption@iftype
    {\addtocounter\@captype\m@ne
     \caption@ContinuedFloat\@captype}%
    {\caption@Error{\noexpand\ContinuedFloat outside float}}}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@ContinuedFloat#1{%
  \@ifstar{\caption@Continued@Float@{#1}}{\caption@Continued@Float{#1}}}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@Continued@Float@{%
  \addtocounter\@captype\@ne
  \@stpelt{ContinuedFloat}\stepcounter{ContinuedFloat}%
  \def\caption@resetContinuedFloat##1{\xdef\caption@CFtype{##1}}%
  \caption@@ContinuedFloat}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@Continued@Float#1{%
  \edef\caption@tempa{#1}%
  \ifx\caption@tempa\caption@CFtype
    \stepcounter{ContinuedFloat}%
    \let\caption@resetContinuedFloat\@gobble
    \caption@@ContinuedFloat{#1}%
    \sf@ContinuedFloat{#1}%
  \else
    \caption@Error{Continued `#1' after `\caption@CFtype'}%
  \fi}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@@ContinuedFloat#1{%
  \expandafter\l@addto@macro\csname the#1\endcsname\theContinuedFloat
  \@ifundefined{theH#1}{}{%
    \expandafter\l@addto@macro\csname theH#1\endcsname{%
      \@alph\c@ContinuedFloat}}%
  \caption@setoptions{ContinuedFloat}%
  \caption@setoptions{continued#1}}
%    \end{macrocode}
%    \begin{macrocode}
\providecommand*\sf@ContinuedFloat[1]{}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@CFtype{??}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\theContinuedFloat}
% Its preset to \cs{@empty}, so usually the continuation counter is not
% included in the caption label or references.
%    \begin{macrocode}
\newcounter{ContinuedFloat}
\let\theContinuedFloat\@empty
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@resetContinuedFloat}
%  |\caption@resetContinuedFloat|\marg{type}\par
%  If a continuation counter is defined, we reset it.
%  (This one will be called inside |\@caption|.)
%    \begin{macrocode}
\newcommand*\caption@resetContinuedFloat[1]{%
  \@stpelt{ContinuedFloat}\xdef\caption@CFtype{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\phantomcaption}
% \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added}
%  |\phantomcaption|\par
% Use this one for figures with subcaptions but without main caption.
%    \begin{macrocode}
\newcommand\phantomcaption{%
  \caption@iftype
    {\caption@refstepcounter\@captype}%
    {\caption@Error{\noexpand\phantomcaption outside float}}}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Internal helpers}
%
% \begin{macro}{\caption@refstepcounter}
% \changes{v3.1}{2007/07/28}{This macro added}
% \changes{v3.2}{2010/10/26}{Error message moved from \cs{caption@@@settype} to here}
%  Resets the continuation counter, increments the float (i.e. |figure| or
%  |table|) counter, and sets the |refstepcounter| flag.
%    \begin{macrocode}
\newcommand*\caption@refstepcounter[1]{%
  \@ifundefined{c@#1}%
    {\caption@Error{No float type '#1' defined}}%
    {\caption@resetContinuedFloat{#1}%
     \caption@@refstepcounter{#1}%
     \let\caption@ifrefstepcounter\@firstoftwo}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@refstepcounter{\refstepcounter}
\let\caption@ifrefstepcounter\@secondoftwo
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@dblarg}
% \changes{v3.1}{2007/02/05}{This macro added}
% \changes{v3.1f}{2007/12/06}{Bugfix 07-12-06: Changed so it works without \cs{kernel@ifnextchar}
%        (which was introduced in \LaTeXe\ 2004/01/23), too}
%  A |\relax| was added compared to |\@dblarg| so |\caption{}| will be
%  expanded to |\caption[\relax]{}| (and not to |\caption[]{}|).
%    \begin{macrocode}
\caption@ifundefined\kernel@ifnextchar
  {\newcommand\caption@dblarg[1]{\@ifnextchar[{#1}{\caption@xdblarg{#1}}}}%
  {\newcommand\caption@dblarg[1]{\kernel@ifnextchar[{#1}{\caption@xdblarg{#1}}}}%
\newcommand\caption@xdblarg[2]{#1[{#2\relax}]{#2}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@begin}
% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed to \cs{caption@setfloattype}}
% \changes{v3.0e}{2005/04/12}{Check for default label format added}
% \changes{v3.0f}{2005/06/11}{Usage of \cs{caption@resetContinuedFloat} added}
% \changes{v3.1}{2007/05/09}{Usage of \cs{caption@setfloattype} \&
%        \cs{caption@resetContinuedFloat} removed}
%  Our handling of |\caption| will always be surrounded by
%  |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
%  |\caption@begin|\marg{type} performs these tasks:
%  \begin{enumerate}
%  \item[1.] Start a new group.
%  \item[2.] Define |\fnum@|\meta{type} if the caption label format is set
%            to non-default.
%  \item[3.] Override the |position=| setting, if necessary.
%            (for example if set to |auto| or used inside a |supertabular|)
%  \end{enumerate}
%    \begin{macrocode}
\newcommand*\caption@begin[1]{%
  \begingroup
    \caption@setfnum{#1}%
    \caption@fixposition
    \global\let\caption@fixedposition\caption@position}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@beginex}
% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
% \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
% \changes{v3.1}{2007/07/01}{Makes lst-entry now instead of redefining \cs{addcontentsline}}
% \changes{v3.2}{2010/10/26}{Bugfix 09-05-15: Setting of \cs{lst@@caption} added}
%  |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par
%  performs the same tasks as |\caption@begin| and additionally:
%  \begin{enumerate}
%  \item[4.] Set |\lst@@caption|, so |\fnum@lstlisting| will include a numbering.
%  \item[5.] Make an entry in the list-of-whatever.
%  \item[6.] Set |\caption@ifempty| according argument \meta{heading}.
% \end{enumerate}
%    \begin{macrocode}
\newcommand\caption@beginex[3]{%
  \caption@begin{#1}%
  \let\lst@@caption\relax
  \caption@addcontentsline{#1}{#2}%
  \caption@ifempty{#3}{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@end}
%  |\caption@end| closes the group.
%    \begin{macrocode}
\newcommand*\caption@end{%
  \endgroup
  \let\caption@position\caption@fixedposition}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0a}{2004/01/23}{%
%       Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
% \changes{v3.0h}{2005/10/06}{%
%       Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
%
% \begin{macro}{\caption@setfnum}
% \changes{v3.1}{2007/03/10}{This macro added}
%  |\caption@setfnum|\marg{type}\\
%  redefines |\fnum@|\meta{type} according the caption label format
%  set with |labelformat=|. But if |labelformat=default| is set,
%  |\fnum@|\meta{type} will not be overwritten by us.
%    \begin{macrocode}
\newcommand*\caption@setfnum[1]{%
  \@ifundefined{fnum@#1}{\iftrue}{\ifx\caption@lfmt\caption@lfmt@default\else}%
    \@namedef{fnum@#1}{\caption@fnum{#1}}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@boxrestore}
% \changes{v3.1}{2007/03/03}{This macro and its usage added}
% \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added}
% \changes{v3.2}{2010/11/07}{Support of option \opt{parboxrestore} added}
%  The original code (from |latex/base/ltboxes.dtx|):
%  \begin{verbatim}
%  \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}
%  \def\@arrayparboxrestore{%
%    \let\if@nobreak\iffalse
%    \let\if@noskipsec\iffalse
%    \let\par\@@par
%    \let\-\@dischyph
%    \let\'\@acci\let\`\@accii\let\=\@acciii
%    \parindent\z@ \parskip\z@skip
%    \everypar{}%
%    \linewidth\hsize
%    \@totalleftmargin\z@ 
%    \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
%    \parfillskip\@flushglue \lineskip\normallineskip
%    \baselineskip\normalbaselineskip
%    \sloppy}
%  \end{verbatim}%^^A
% This one will be used by |\@caption| instead of |\@parboxrestore|.
%    \begin{macrocode}
\newcommand*\caption@boxrestore{%
  \caption@parboxrestore{\@parboxrestore}{%
    \let\if@nobreak\iffalse
    \let\if@noskipsec\iffalse
    \let\par\@@par
%   \let\-\@dischyph
%   \let\'\@acci\let\`\@accii\let\=\@acciii
    \parindent\z@ \parskip\z@skip
    \everypar{}%
%   \linewidth\hsize
%   \@totalleftmargin\z@ 
    \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
    \parfillskip\@flushglue \lineskip\normallineskip
    \baselineskip\normalbaselineskip
    \sloppy
    \let\\\@normalcr
  }}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@boxrestore@mini}
% \changes{v3.2}{2010/10/24}{This macro added}
% Resets \cs{par} so the very first \cs{par} in \cs{@caption} behaves quite the same as in floating environments.
% Will be used by \cs{setcaptiontype}.
%    \begin{macrocode}
\newcommand\caption@boxrestore@mini{%
  \let\par\@@par
  \parindent\z@ \parskip\z@skip
  \sloppy}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@normalsize}
% \changes{v3.1}{2007/05/05}{This macro and its usage added}
%  This one will be used by |\@caption| instead of |\normalsize|.\par
%  Its code is equivalent to
%  \begin{quote}
%    |\caption@font{normal}%|
%  \end{quote}
%  but executes faster (since the starred form of |\caption@font|
%  does not use |\setkeys| internally).
%    \begin{macrocode}
\newcommand*\caption@normalsize{%
  \caption@font*{\KV@caption@fnt@normal\@unused}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setfloatcapt}
%  Needed for support of the \package{float} package, where the caption will
%  not be typeset directly, but catched in a |\vbox| called |\@floatcapt|
%  instead.
%    \begin{macrocode}
\let\caption@setfloatcapt\@firstofone
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@makecurrent}
% \begin{macro}{\caption@makeanchor}
% \begin{macro}{\caption@start}
% \begin{macro}{\caption@@start}
% \begin{macro}{\caption@freezeHref}
% \begin{macro}{\caption@defrostHref}
%  All these are needed for support of the \package{hyperref} package.
%    \begin{macrocode}
\newcommand*\caption@makecurrent[2]{}
\let\caption@makeanchor\@firstofone
\let\caption@start\relax
\let\caption@@start\relax
\let\caption@freezeHref\relax
\let\caption@defrostHref\relax
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@gettitle}
% \changes{v3.1}{2007/05/05}{This macro and its usage added}
%  This one is needed for support of the \package{nameref} package.
%    \begin{macrocode}
\newcommand\caption@gettitle[1]{%
  \caption@ifundefined\NR@gettitle
    {\def\@currentlabelname{#1}}%
    {\NR@gettitle{#1}}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Support for sub-captions}
% \changes{v3.1f}{2007/11/16}{Support for sub-captions added}
%
% \begin{macro}{\caption@DeclareSubType}
% |\caption@DeclareSub| initializes the usage of \cs{caption}
% in sub-floats.
%    \begin{macrocode}
\def\caption@DeclareSubType sub#1\@nil{%
  \caption@Debug{Initializing subtype for `#1'\@gobble}%
  \@namedef{caption@c@#1}{0}%
  \@namedef{caption@beginsub#1}{\caption@beginsubfloat{#1}}}
\@onlypreamble\caption@DeclareSubType
%    \end{macrocode}
% \end{macro}
%
% Initialize the sub-captions defined with \cs{DeclareCaptionSubType}\ldots
%    \begin{macrocode}
\caption@For*{subtypelist}{\caption@DeclareSubType sub#1\@nil}
%    \end{macrocode}
%
% Initialize the sub-captions defined with \cs{newsubfloat}\cite{subfig}\ldots
%    \begin{macrocode}
\caption@AtBeginDocument*{%
  \caption@ifundefined\sf@counterlist{}{%
    \@for\sf@temp:=\sf@counterlist\do{%
      \expandafter\caption@DeclareSubType\sf@temp\@nil}}}
%    \end{macrocode}
%
% \begin{macro}{\caption@subtypehook}
% \changes{v3.1g}{2008/03/20}{Redefinition of \cs{caption@setlist} added}
% \changes{v3.1k}{2009/10/09}{Bugfix 09-08-12b: \cs{@makecaption} will now be restored here, too}
% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
% \changes{v3.2a}{2011/08/17}{Redefinition of \cs{phantomcaption} added}
% \changes{v3.2a}{2011/08/17}{Usage of \cs{caption@warmup} added}
% \changes{v3.2c}{2011/09/30}{Bugfix 11-09-26: Usage of \cs{if@subfloatrow} added}
%  Hook, will be used inside \cs{caption@setsubtype}.\par
% (Note: If we are inside an |sub|\-|float|\-|row| environment we have to keep
% the |\@make|\-|caption| code of the \package{floatrow} package intact.)
%    \begin{macrocode}
\newcommand*\caption@subtypehook{%
  \ifx\caption\caption@subcaption \else
    \caption@warmup
%    \end{macrocode}
%    \begin{macrocode}
    \caption@ifrefstepcounter{}{%
      % no \caption or \subcaption in this (floating) environment yet
      \caption@Debug{Increment \@captype\ counter =\the\value\@captype}%
      \caption@l@stepcounter\@captype
      \let\caption@@@addcontentsline\caption@addsubcontentsline}%
%    \end{macrocode}
%    \begin{macrocode}
    \ifnum\csname caption@c@\@captype\endcsname=\value\@captype \else
      \caption@Debug{Reset sub\@captype\ counter}%
      \expandafter\xdef\csname caption@c@\@captype\endcsname{%
        \the\value\@captype}%
      \@stpelt\@subcaptype
    \fi
%    \end{macrocode}
%    \begin{macrocode}
    \c@ContinuedFloat=0\relax
    \let\caption@resetContinuedFloat\@gobble
    \let\caption@addcontentsline\caption@kernel@addcontentsline
    \let\caption@setfloatcapt\@firstofone
%    \end{macrocode}
%    \begin{macrocode}
    \caption@clearmargin
    \caption@iflist{}{\let\caption@setlist\@gobble}%
    \caption@setoptions{sub}%
    \caption@setoptions{subfloat}% for subfig-package compatibility
%    \end{macrocode}
%    \begin{macrocode}
    \let\caption\caption@subcaption
    \let\phantomcaption\caption@subphantom
    \if@subfloatrow
      \caption@Debug{Keeping \string\@makecaption}%
    \else
      \let\@makecaption\caption@makecaption
    \fi
  \fi}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@subfloatrow}
% \changes{v3.2c}{2011/09/30}{This macro added}
% This macro tests if we are inside an |sub|\-|float|\-|row| or |sub|\-|float|\-|row*| environment.
%    \begin{macrocode}
\caption@AtBeginDocument{%
  \caption@ifundefined\@subfloatrowtrue
   {\newif\if@subfloatrow
    \caption@ifundefined\subfloatrow{}%
    {\caption@Debug{Patching subfloatrow environment}%
     \g@addto@macro\capsubrowsettings{\@subfloatrowtrue}%
     \g@addto@macro\killfloatstyle{%
       \ifx\c@FRobj\c@FRsobj\@subfloatrowtrue\fi}}}%
   {\caption@Debug{\string\if@subfloatrow is already defined}}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@subcaption}
% Makes a sub-caption.
%    \begin{macrocode}
\newcommand*\caption@subcaption{%
  \caption@checkgrouplevel{sub}\subcaption
  \caption@star
    {\caption@refstepcounter\@subcaptype}%
    {\caption@dblarg{\@caption\@subcaptype}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@subphantom}
% \changes{v3.2a}{2011/08/17}{This macro added}
% Same as |\phantomcaption|, but for sub-captions.
%    \begin{macrocode}
\newcommand*\caption@subphantom{%
  \caption@checkgrouplevel{sub}\phantomsubcaption
  \caption@refstepcounter\@subcaptype}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@addcontentsline}
% \changes{v3.1g}{2008/01/12}{Argument of \cs{caption@addsubcontentslines} removed}
% \changes{v3.1i}{2008/08/02}{Argument of \cs{caption@addsubcontentslines} re-added}
% We extend |\caption@addcontentsline| so it handles sub-captions, too.
% \Note{\cs{sf@ifpositiontop} \& \cs{@listsubcaptions} are defined by the
%  \package{subfigure} \& \package{subfig} packages.}
%    \begin{macrocode}
\let\caption@kernel@addcontentsline\caption@addcontentsline
\renewcommand\caption@addcontentsline[2]{%
  \sf@ifpositiontop{\@listsubcaptions{#1}}{}%
  \caption@kernel@addcontentsline{#1}{#2}%
  \sf@ifpositiontop{}{\@listsubcaptions{#1}}%
  \caption@addsubcontentslines{#1}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@addsubcontentslines[1]{%
  \begingroup
    \caption@subcontentslines
  \endgroup
  \caption@clearsubcontentslines}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@addsubcontentsline}
% \changes{v3.1i}{2008/08/02}{Bugfix 08-07-28:
%    \cs{label}, \cs{index}, and \cs{glossary} are allowed inside the list entry now}
% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now}
% \changes{v3.2c}{2011/08/19}{Uses \cs{caption@gobble} instead of \cs{@gobble} now}
% Add a pending sub-caption list entry.
%    \begin{macrocode}
\newcommand*\caption@addsubcontentsline[4]{%
  \begingroup
  \let\label\caption@gobble \let\index\caption@gobble \let\glossary\caption@gobble
  \protected@edef\@tempa{\endgroup
    \noexpand\g@addto@macro\noexpand\caption@subcontentslines{%
      \noexpand\@namedef{the#2}{\csname the#2\endcsname}%
      \ifx\@currentHref\@undefined \else
        \noexpand\def\noexpand\@currentHref{\@currentHref}%
      \fi
      \protect\caption@@@addcontentsline{#1}{#2}{#3}{#4}}}%
  \@tempa}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@checksubcontentslines}
% \changes{v3.1g}{2008/01/07}{Bugfix: Uses \cs{caption@Error} instead of \cs{subcaption@Error} now}
% Checks if the list of pending sub-captions is empty, if not,
% a warning will be issued.
%    \begin{macrocode}
\newcommand*\caption@checksubcontentslines{%
  \ifx\caption@subcontentslines\@empty \else
    \caption@Error{%
      Something's wrong--perhaps a missing \protect\caption\MessageBreak
      in the last figure or table}%
    \caption@clearsubcontentslines
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@clearsubcontentslines}
% Clear pending sub-caption list entries.
%    \begin{macrocode}
\newcommand*\caption@clearsubcontentslines{%
  \global\let\caption@subcontentslines\@empty}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\caption@AtBeginDocument*{%
  \caption@ifundefined\sf@ifpositiontop{\let\sf@ifpositiontop\@gobbletwo}{}%
  \caption@clearsubcontentslines
  \g@addto@macro\caption@typehook{\caption@checksubcontentslines}%
  \AtEndDocument{\caption@checksubcontentslines}}%
%    \end{macrocode}
%
% \subsection{Document class \& Babel package support}
%
% \subsubsection{The \AmS{} \& \SmF{} classes}
% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added}
%
%    \begin{macrocode}
\caption@ifundefined\smf@makecaption{}{\let\smf@makecaption\@makecaption}
%    \end{macrocode}
%
% \subsubsection{The beamer class}
% \changes{v3.1}{2007/03/10}{beamer class support added}
%
%    \begin{macrocode}
\@ifclassloaded{beamer}{%
  \caption@InfoNoLine{beamer document class}%
%    \end{macrocode}
%
% \begin{macro}{\figure}
% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
% \begin{macro}{\table}
% \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added}
%  We redefine |figure| \& |table| so our type-specific options will be used etc.
%    \begin{macrocode}
  \expandafter\let\expandafter\caption@ORI@figure
    \csname\string\figure\endcsname
  \@namedef{\string\figure}[#1]{%
    \caption@ORI@figure[#1]%
    \caption@settype{figure}}
%    \end{macrocode}
%    \begin{macrocode}
  \expandafter\let\expandafter\caption@ORI@table
    \csname\string\table\endcsname
  \@namedef{\string\table}[#1]{%
    \caption@ORI@table[#1]%
    \caption@settype{table}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The \KOMAScript{} classes}
%
% \KOMAScript\ contains the code
% |\AtBeginDocument{\let\scr@caption\caption}|
% so we need to update |\scr@caption| here, too.
%
%    \begin{macrocode}
\caption@ifundefined\scr@caption{}{%
  \caption@AtBeginDocument{\let\scr@caption\caption}}
%    \end{macrocode}
%
% \subsubsection{The frenchb Babel option}
% \changes{v3.1}{2006/05/14}{Adaptation to \package{frenchb} added}
%
% Suppress
% ``Package |frenchb.ldf| Warning: The definition of |\@makecaption| has been
%  changed, frenchb will NOT customize it.''
%  (but only if we emulate this customization)
%    \begin{macrocode}
\@nameuse{caption@frenchb}\@nameundef{caption@frenchb}
%    \end{macrocode}
%
% \subsubsection{The frenchle/pro package}
% \changes{v3.0h}{2005/10/03}{Adaptation to \package{frenchle/pro} added}
%
%    \begin{macrocode}
\caption@AtBeginDocument{\caption@ifundefined\frenchTeXmods{}{%
  \caption@InfoNoLine{frenchle/pro package is loaded}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \let\captionfont@ORI\captionfont
  \let\captionlabelfont@ORI\captionlabelfont
  \let\@makecaption@ORI\@makecaption
%    \end{macrocode}

% If |\GOfrench| is defined as |\relax| all the re-definitions regarding
% captions have already been done, so we can do our patches immediately.
% Otherwise we must add our stuff to |\GOfrench|.
%    \begin{macrocode}
  \caption@ifundefined\GOfrench
    {\let\caption@tempa\@firstofone}%
    {\def\caption@tempa{\g@addto@macro\GOfrench}}%
  \caption@tempa{%
%    \end{macrocode}
%
%    \begin{macrocode}
    \let\captionfont\captionfont@ORI
    \let\captionfont@ORI\@undefined
    \let\captionlabelfont\captionlabelfont@ORI
    \let\captionlabelfont@ORI\@undefined
    \let\@makecaption\@makecaption@ORI
    \let\@makecaption@ORI\@undefined
%    \end{macrocode}
%
% \begin{macro}{\@cnORI}
%  We update the definition of |\@cnORI| so it actually reflects
%  our definition of |\caption|.
%    \begin{macrocode}
    \let\@cnORI\caption
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tablescaption}
%  The \package{frenchle/pro} package sets |\caption| to |\@tablescaption| at
%  |\begin{table}| for special treatment of footnotes.
%  Therefore we have to patch |\@tablescaption| so |\caption*| will work
%  inside the |table| environment.
%    \begin{macrocode}
    \let\caption@tcORI\@tablescaption
    \def\@tablescaption{\caption@star\relax\caption@tcORI}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\f@ffrench}
% \begin{macro}{\f@tfrench}
%  |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
%  when used in French mode. These contain additional code which typesets
%  the caption separator |\captionseparator| instead of the usual colon.
%  Because this breaks with our |\@makecaption| code we have to remove
%  this additional code here.
%    \begin{macrocode}
    \let\@eatDP\@undefined
    \let\caption@tempa\@empty
    \ifx\f@ffrench\fnum@figure
      \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
    \fi
    \ifx\f@tfrench\fnum@table
      \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
    \fi
    \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
    \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
    \caption@tempa
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
  }%
}}
%    \end{macrocode}
%
% \subsubsection{The hungarian and magyar Babel option}
% \changes{v3.2}{2009/03/29}{\package{magyar} package support added}
%
%    \begin{macrocode}
\def\caption@tempa#1{%
  \@ifundefined{extras#1}\caption@AtBeginDocument\@firstofone{%
    \@ifundefined{extras#1}{}{%
      \caption@InfoNoLine{#1 babel option is loaded}%
      \expandafter\addto\csname extras#1\endcsname{%
         % reverse changes made by magyar.ldf
         \let\@makecaption\caption@makecaption
         \babel@save\@makecaption
         \caption@redefine
         \babel@save\@caption}%
    }}}
\caption@tempa{hungarian}%
\caption@tempa{magyar}%
%    \end{macrocode}
%
% \subsection{Package support}
% \changes{v3.1}{2007/04/11}{Package options `float', `longtable' etc.
%        are not supported anymore, removed}
%
% \begin{macro}{\caption@IfPackageLoaded}
% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added,
%        so no extra check is needed}
% \changes{v3.1}{2007/07/04}{Re-written \& renamed from \cs{caption@ifpackage}
%        to \cs{caption@IfPackageLoaded}}
%  |\caption@IfPackageLoaded|\marg{package}\oarg{version}\marg{true}\marg{false}\par
%  Some kind of combination of |\@ifpackageloaded| and |\@ifpackagelater|.
%  If the \meta{package} is not loaded yet, the check will be (re-)done
%  |\AtBeginDocument|, so the \meta{package} could be loaded later on, too.
%    \begin{macrocode}
\newcommand\caption@IfPackageLoaded[1]{%
  \@testopt{\caption@@IfPackageLoaded{#1}}{}}
\@onlypreamble\caption@IfPackageLoaded
%    \end{macrocode}
%    \begin{macrocode}
\long\def\caption@@IfPackageLoaded#1[#2]#3#4{%
  \@ifpackageloaded{#1}\@firstofone{%
    \caption@Debug{#1 package is not loaded (yet)\@gobble}%
    \caption@AtBeginDocument}{%
      \caption@@ifpackageloaded{#1}[#2]{#3}{#4}}}
\@onlypreamble\caption@@IfPackageLoaded
%    \end{macrocode}
%    \begin{macrocode}
\newcommand\caption@ifpackageloaded[1]{%
  \@testopt{\caption@@ifpackageloaded{#1}}{}}
\@onlypreamble\caption@ifpackageloaded
%    \end{macrocode}
%    \begin{macrocode}
\long\def\caption@@ifpackageloaded#1[#2]{%
  \@ifpackageloaded{#1}{%
    \caption@InfoNoLine{#1 package is loaded}%
    \@ifpackagelater{#1}{#2}\@firstoftwo{%
      \caption@Error{%
        For a successful cooperation we need at least version\MessageBreak
          `#2' of package #1,\MessageBreak
        but only version\MessageBreak
          `\csname ver@#1.\@pkgextension\endcsname'\MessageBreak
        is available}%
      \@secondoftwo}%
  }{\@secondoftwo}}
\@onlypreamble\caption@@ifpackageloaded
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@clearmargin}
% \changes{v3.1}{2007/05/05}{This macro and its usage added}
%  This macro will be used by some package support stuff where the usual
%  margin setting is not welcome, e.g. in the \package{sidecap} package.
%    \begin{macrocode}
\newcommand*\caption@clearmargin{%
  \setcaptionmargin\z@
  \let\caption@minmargin\@undefined}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\caption@setbool{needfreeze}{0}
\caption@AtBeginDocument*{%
  \caption@ifneedfreeze{%
%    \end{macrocode}
%
% \begin{macro}{\caption@freeze}
% \changes{v3.1}{2007/07/22}{This macro added}
% \changes{v3.1c}{2007/10/06}{\cs{caption} \& \cs{@caption} revised for enhanced compatibility}
% \changes{v3.1c}{2007/10/06}{Bugfix: Made \cs{@caption} long}
% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
% \changes{v3.1g}{2008/01/29}{Starred variants of \cs{ContinuedFloat} and \cs{captionsetup} added}
% \changes{v3.2}{2010/10/26}{Bugfix 10-09-01a: Uses \cs{ignorespaces} instead of `space hack' again}
% \changes{v3.2a}{2011/08/17}{Starred variant of \cs{caption@freeze} removed}
% \changes{v3.2b}{2011/08/18}{Redefines \cs{caption@setup} instead of \cs{captionsetup} now}
% \changes{v3.2b}{2011/08/18}{Redefinition of \cs{label} revised}
% \changes{v3.2c}{2011/08/21}{Revised}
%  |\caption@freeze|\par
%  Used by the \package{fltpage} \& \package{sidecap} package support.
%    \begin{macrocode}
  \newcommand*\caption@freeze{%
%    \end{macrocode}
%    \begin{macrocode}
    \let\caption@frozen@ContinuedFloat\ContinuedFloat
    \def\ContinuedFloat{%
      \caption@withoptargs\caption@SC@ContinuedFloat}%
    \def\caption@SC@ContinuedFloat##1{%
      \caption@@freeze{\ContinuedFloat##1}%
      \let\caption@frozen@setcounter\setcounter
      \let\caption@frozen@addtocounter\addtocounter
      \def\setcounter####1####2{\csname c@####1\endcsname####2\relax}%
      \def\addtocounter####1####2{\advance\csname c@####1\endcsname ####2\relax}%
      \caption@frozen@ContinuedFloat##1%
      \let\setcounter\caption@frozen@setcounter
      \let\addtocounter\caption@frozen@addtocounter}%
%    \end{macrocode}
%    \begin{macrocode}
    \let\caption@frozen@setup\caption@setup
    \def\caption@setup##1{%
      \caption@@freeze{\caption@setup{##1}}%
      \caption@frozen@setup{##1}}%
%    \end{macrocode}
%    \begin{macrocode}
    \let\caption@frozen@caption\caption
    \def\caption{%
      \def\caption{%
        \caption@Error{%
          Only one \noexpand\caption can be placed in this environment}%
        \caption@gobble}%
      \@ifstar
      {\caption@SC@caption*}%
      {\let\caption@frozen@refstepcounter\caption@@refstepcounter
       \let\caption@@refstepcounter\caption@l@stepcounter
       \caption@refstepcounter\@captype
       \let\caption@@refstepcounter\caption@frozen@refstepcounter
       \let\@currentlabel\caption@SClabel
       \caption@withoptargs\caption@SC@caption}}%
    \long\def\caption@SC@caption##1##2{%
      \caption@@freeze{\caption##1{##2}}%
      \ignorespaces}%
%    \end{macrocode}
%    \begin{macrocode}
    \let\caption@frozen@label\label
    \def\label{%
      \caption@withoptargs\caption@SC@label}%
    \def\caption@SC@label##1##2{%
      \ifx\@currentlabel\caption@SClabel
        \@bsphack
          \caption@freeze@label{##1}{##2}%
        \@esphack
      \else
        \caption@frozen@label##1{##2}%
      \fi}%
    \def\caption@SClabel{\caption@undefinedlabel}%
    \def\caption@freeze@label##1##2{%
      \caption@@freeze{\label##1{##2}}}%
%    \end{macrocode}
%    \begin{macrocode}
    \global\let\caption@frozen@content\@empty
    \long\def\caption@@freeze{%
      \g@addto@macro\caption@frozen@content}%
%    \end{macrocode}
%    \begin{macrocode}
    \def\caption@warmup{%
      \let\ContinuedFloat\caption@frozen@ContinuedFloat
      \let\caption@setup\caption@frozen@setup
      \let\caption\caption@frozen@caption
      \let\label\caption@frozen@label}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@defrost}
% \changes{v3.1}{2007/07/22}{This macro added}
% \changes{v3.1g}{2008/01/30}{\cs{caption@defrost@setup} added}
% \changes{v3.2c}{2011/08/21}{Adapted to changes of \cs{caption@freeze}}
% \changes{v3.2c}{2011/08/21}{\cs{caption@defrost@setup} removed}
%  |\caption@defrost|
%    \begin{macrocode}
  \newcommand*\caption@defrost{%
    \ifx\caption@frozen@caption\@undefined
      \caption@frozen@content
    \else
      \caption@Error{Internal Error:\MessageBreak
        \noexpand\caption@defrost in same group as \string\caption@freeze}%
    \fi}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  }{}%
  \caption@undefbool{needfreeze}}
%    \end{macrocode}
%
% \begin{macro}{\caption@warmup}
% \changes{v3.2a}{2011/08/17}{This macro added}
%  |\caption@warmup|
%    \begin{macrocode}
\let\caption@warmup\relax
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{The float package}
% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
% \iffalse
% (This is a more straight-ahead implementation, but it only works with v1.3
%  now, so v1.2 is no longer supported. The old code including documentation
%  can be found in caption-30f-050530.zip)
% \fi
%
% The \package{float} package usually do not use the \LaTeX\ kernel command
% |\@caption| to typeset the caption but |\float@caption| instead.
% (|\@caption| will only be used if the float is re-styled with
% |\restylefloat*|.)
%
% The main two things |\float@caption| is doing different are:
% \begin{itemize}
%   \item The caption will be typeset inside a |\savebox| called |\@floatcapt|
%   so it can be placed above or below the float contents afterwards.
%   \item |\@makecaption| will not be used to finally typeset the caption.
%   Instead |\@fs@capt| will be used which definition is part of the float
%   style.
%   (Note that |\@fs@capt| will not typeset any vertical space above or below
%   the caption; instead this space will be typeset by the float style code
%   itself.)
% \end{itemize}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{%
 \@ifpackageloaded{floatrow}{%
  \caption@ifpackageloaded{floatrow}[2007/08/24 v0.2a]{}{}%
 }{%
%    \end{macrocode}
%
% \begin{macro}{\@float@setevery}
% \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added
%                             to redefinition of \cs{caption@setfloatcapt}}
%  |\@float@setevery|\marg{float type} is provided by the \package{float}
%  package; it's called every time a floating environment defined with
%  |\newfloat| or |\restylefloat| begins.
%  We use this hook to do some adaptations and to setup the proper caption
%  style (if defined) and additional settings declared with
%  |\captionsetup|\oarg{float style}.
%    \begin{macrocode}
  \let\caption@ORI@float@setevery\@float@setevery
  \def\@float@setevery#1{%
    \float@ifcaption{#1}{%
%    \end{macrocode}
%
%  First of all we set the caption position to it's proper value by
%  converting |\@fs@iftopcapt| (which is part of a float style and
%  controls where the caption will be typeset, above or below the float
%  contents) to our |position=| setting.
%  Since the spacing above and below the caption will be done by the float
%  style and \emph{not} by us this sounds quite useless. But in fact it isn't,
%  since some packages based on \thispackage\ (like the \package{subfig}
%  package) could have an interest for this information and therefore use the
%  |\caption@iftop| macro we provide in our kernel. Furthermore we need this
%  information for ourself in |\captionof| which uses |\@makecaption| to
%  finally typeset the caption with skips.
%    \begin{macrocode}
      \caption@setposition{\@fs@iftopcapt t\else b\fi}%
%    \end{macrocode}
%
%  Afterward we redefine |\caption@setfloatcapt| (which will be used inside
%  |\@caption|) so the caption will be set inside the box |\@floatcapt|,
%  without extra vertical space.
%    \begin{macrocode}
      \renewcommand\caption@setfloatcapt[1]{%
        \let\@makecaption\caption@@make
        \global\setbox\@floatcapt\vbox{%
          \color@begingroup ##1\color@endgroup}}%
%    \end{macrocode}
%
%  To allow different caption styles for different float styles we also
%  determine the current float style (e.g. `ruled') and select
%  a caption style (and additional settings) with the same name, if defined.
%    \begin{macrocode}
      \float@getstyle\float@style{#1}%
      \caption@setstyle*\float@style
      \caption@setoptions\float@style
%    \end{macrocode}
%
%    \begin{macrocode}
    }{}%
    \caption@freezeHref % will be defrosted in \float@makebox
    \caption@ORI@float@setevery{#1}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@typehook}
% \changes{v3.1}{2007/07/08}{float package hook added}
%  \LaTeX\ and almost every other packages use
%    |\|\meta{type}|name|
%  to provide a macro for the type resp.~environment name -- for example
%  the command |\figurename| will usually contain the name of the floating
%  environment |figure|:
%  \begin{quote}
%    |\newcommand\figurename{Figure}|
%  \end{quote}
%  But the \package{float} package doesn't follow this common naming
%  convention:
%  For floats defined with |\newfloat| it uses |\fname@|\meta{type} instead,
%  which breaks with our code (and with |\autoref| and some other things as
%  well).
%  So we have to map the \package{float} package name to the common one here.\par
%  \Note{If the float was not defined with \cs{newfloat} but with
%  \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.}
%    \begin{macrocode}
  \g@addto@macro\caption@typehook{%
    \expandafter\ifx\csname #1name\endcsname\relax
      \expandafter\let\csname #1name\expandafter\endcsname
                      \csname fname@#1\endcsname
    \fi}%
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
% \begin{macro}{\fs@plaintop}
% \begin{macro}{\fs@boxed}
%  Since the float styles |plaintop| and |boxed| don't use |\abovecaptionskip|
%  which could be set with |skip=| (|plaintop| uses |\belowcaptionskip| instead of
%  |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|)
%  we patch the according float style macros here to change this.
%    \begin{macrocode}
  \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
  \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\float@getstyle}
% \changes{v3.1}{2007/06/10}{This macro added}
% |\float@getstyle|\marg{cmd}\marg{type}\par
%  Determining the float style is not so easy because the only hint
%  provided by the \package{float} package is the macro
%  |\fst@|\meta{float type} which points to the macro which represents the
%  float style. So for example after
%  \begin{quote}
%    |\floatstyle{ruled}|\\
%    |\newfloat{Program}{tbp}{lop}|
%  \end{quote}
%  |\fst@Program| will be defined as
%  \begin{quote}
%    |\def\fst@Program{\fs@ruled}|\quad.
%  \end{quote}\par
%  So here is what we do: We make the first level expansion of
%  |\fst@|\meta{float type} a string so we can gobble the first four tokens
%  (= |\fs@|), so only the the name of the float style is left.\par
%  \emph{TODO:} We need to convert the catcodes here.
%    \begin{macrocode}
  \providecommand*\float@getstyle[2]{%
    \edef#1{%
      \noexpand\expandafter\noexpand\@gobblefour\noexpand\string
        \expandafter\expandafter\expandafter\noexpand
          \csname fst@#2\endcsname}%
    \edef#1{#1}%
    \caption@Debug{floatstyle{#2} = `#1'}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\float@ifcaption}
% \changes{v3.1}{2007/06/23}{This macro added}
% |\float@ifcaption|\marg{type}\marg{if-clause}\marg{else-clause}\par
%  Here we determine if the user has used |\newfloat| resp.~|\restylefloat|,
%  or |\restylefloat*|.
%  This is quite easy: If |\@float@c@|\meta{captype} is the same as
%  |\float@caption|, the user has used |\newfloat| or |\restylefloat|,
%  otherwise we assume he has used |\restylefloat*|.
%  (This test will fail if some package re-defines |\float@caption|,
%  so we have to assume that there is no one.)
%    \begin{macrocode}
  \providecommand*\float@ifcaption[1]{%
    \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}}{%
  \providecommand*\float@ifcaption[1]{\@secondoftwo}%
% \clearcaptionsetup{boxed}% used by the floatrow package?
}
%    \end{macrocode}
%
% The skip between `boxed' floats and their caption defaults to |2pt|.
%
%    \begin{macrocode}
\captionsetup[boxed]{skip=2pt} % do not issue a warning when not used
%    \end{macrocode}
%
% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
% `ruled' with appropriate options. But if the package option |ruled| was
% specified, we setup some caption parameters to emulate the behavior
% of \thispackage\ \version{1.x} option |ruled| instead, i.e.,
% the current caption settings will be used, but without margin and without
% `single-line-check'.
%    \begin{macrocode}
\caption@ifbool{ruled}{%
  \captionsetup[ruled]{margin=0pt,minmargin=0,slc=0}%
}{%
  \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
}
\caption@undefbool{ruled}
%    \end{macrocode}
%
% \subsubsection{The floatflt package}
% \changes{v3.1}{2007/06/10}{Support of the \package{floatflt} package added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{floatflt}[1996/02/27 v1.3]{%
%    \end{macrocode}
%
% \begin{macro}{\floatingfigure}
% We patch |\floatingfigure| so |\caption@floatflt| will be used.
%    \begin{macrocode}
  \let\caption@ORI@floatingfigure\floatingfigure
  \def\floatingfigure{%
    \caption@floatflt{figure}%
    \caption@ORI@floatingfigure}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\floatingtable}
% Same with |\floatingtable|\ldots
%    \begin{macrocode}
  \let\caption@ORI@floatingtable\floatingtable
  \def\floatingtable{%
    \caption@floatflt{table}%
%   \caption@setautoposition b%
    \caption@ORI@floatingtable}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@floatflt}
% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
%  Here we do two things:
%  \begin{enumerate}
%    \item We use |\caption@set|\-|options{|\-|floating|\meta{type}|}| so
%       |\caption|\-|setup[|\-|floating|\meta{type}|]{|\ldots|}| is supported.
%    \item |\line|\-|width| must be set correctly.
%       Usually this is done by |\@par|\-|box|\-|restore| inside |\@caption|,
%       but since we use |\@caption@box|\-|restore| we have to map this to
%       |\@par|\-|box|\-|restore| instead.
%  \end{enumerate}
%    \begin{macrocode}
  \newcommand*\caption@floatflt[1]{%
    \caption@settype{#1}%
    \caption@clearmargin
    \caption@setfullparboxrestore
    \caption@setoptions{floating#1}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The fltpage package}
% \changes{v3.1}{2007/07/22}{Support of the \package{fltpage} package added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{%
  \caption@setbool{needfreeze}{1}%
%    \end{macrocode}
%
% \begin{macro}{\FP@positionLabel}
% \changes{v3.2c}{2011/08/28}{This redefinition added}
% Original code:
% \begin{verbatim}
% \newcommand{\FP@positionLabel}{%
%   FP\@captype-\number\value{FP@\@captype C}-pos}
% \end{verbatim}%^^A
%    \begin{macrocode}
  \renewcommand\FP@positionLabel{%
    FP\FP@captype-\number\value{FP@\FP@captype C}-pos}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FP@helpNote}
% Original code:
% \begin{verbatim}
% \newcommand{\FP@helpNote}[2]{%
%   \typeout{FP#1 is inserted on page \pageref{#2}!}}%
% \end{verbatim}%^^A
%    \begin{macrocode}
  \renewcommand\FP@helpNote[2]{%
    \begingroup % save \caption@thepage
      \caption@pageref{#2}%
      \typeout{FP#1 is inserted on page \caption@thepage!}%
    \endgroup}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FP@floatBegin}
% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now}
% \changes{v3.1k}{2009/10/09}{Bugfix 09-09-11: Missing \cs{ignorespaces} added}
% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
% Original code:
% \begin{verbatim}
% \newcommand{\FP@floatBegin}[1]{%
%   \gdef\@captype{#1}%
%   \global\let\FP@savedCaptionCommand\caption%
%   \global\let\FP@savedLabelCommand\label%
%   \ifthenelse{\equal{\@captype}{figure}}
%      {\global\let\old@Fnum\fnum@figure}%
%      {\global\let\old@Fnum\fnum@table}%
%   \let\FP@LabelText\@empty%
%   \let\FP@CaptionText\@empty%
%   \let\FP@optionalCaptionText\@empty%
%   \renewcommand\label[1]{\gdef\FP@LabelText{##1}}%
%   \renewcommand\caption[2][]{%
%     \gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}%
%   \begin{lrbox}{\FP@floatCorpusBOX}%
% }%
% \end{verbatim}%^^A
%    \begin{macrocode}
  \renewcommand*\FP@floatBegin[1]{%
    \def\FP@captype{#1}%
    \begin{lrbox}{\FP@floatCorpusBOX}%
    \caption@settype*{#1}%
    \caption@freeze
    \global\let\FP@Label\@empty
    \caption@ifFPrefcap
      {}%
      {\def\caption@freeze@label##1##2{%
          \g@addto@macro\FP@Label{\FP@label##1{##2}}}}%
    \ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FP@floatEnd}
% \changes{v3.1g}{2008/01/30}{Some minor bugfixes}
% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
% Original code:
% \begin{verbatim}
% \newcommand{\FP@floatEnd}{%
%   \end{lrbox}%
%   \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX
%   \stepcounter{FP@\@captype C}%
%   \FP@savedLabelCommand{\FP@positionLabel}%
%   \FP@helpNote{\@captype}{\FP@positionLabel}%
%   \FP@float
%     {\FP@positionLabel}% location label test
%     {\begin{\@captype}[p!]
%        \usebox{\FP@floatCorpusBOX}%
%        \refstepcounter{\@captype}%
%        \ifthenelse{\equal{\FP@LabelText}{\@empty}}
%          {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}%
%      \end{\@captype}}
%     {\addtocounter{\@captype}{-1}}
%     {\begin{\@captype}[b!]%
%        \ifthenelse{\equal{\FP@guide}{\@empty}}%
%          {}{\ifthenelse{\equal{\@captype}{figure}}%
%              {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}%
%              {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}%
%        \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption
%        \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption
%        \FP@separatorCaption%
%        \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}%
%          {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}%
%          {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]%
%                                  {\expandafter\protect\FP@CaptionText}}%
%      \end{\@captype}}%
% }%
% \end{verbatim}%^^A
%    \begin{macrocode}
  \renewcommand*\FP@floatEnd{%
    \end{lrbox}%
%    \end{macrocode}
%    \begin{macrocode}
    \stepcounter{FP@\FP@captype C}%
    \caption@label\FP@positionLabel
    \FP@helpNote\FP@captype\FP@positionLabel
%    \end{macrocode}
%    \begin{macrocode}
    \edef\FP@RestoreCounter{%
      \noexpand\setcounter{\FP@captype}{\the\value\FP@captype}%
      \noexpand\setcounter{ContinuedFloat}{\the\value{ContinuedFloat}}}%
%    \end{macrocode}
%    \begin{macrocode}
    \FP@float
      {\FP@positionLabel}% location label test
      {\begin\FP@captype[p!]%
         \usebox\FP@floatCorpusBOX
         \let\caption@SClentry\@empty
         \def\caption{\caption@dblarg{\@caption\@captype}}%
         \long\def\@caption##1[##2]##3{\def\caption@SClentry{##2}}%
         \let\FP@label\label
         \let\label\caption@gobble
         \caption@defrost
         \caption@ifFPlistcap
           {\caption@refstepcounter\@captype
            \expandafter\caption@makecurrent\expandafter\@captype
                                         \expandafter{\caption@SClentry}}%
           {\ifx\caption@SClentry\@empty \else
               \expandafter\captionlistentry\expandafter{\caption@SClentry}%
             \fi}%
         \caption@makeanchor\relax
         \FP@Label
       \end\FP@captype}%
      {\FP@RestoreCounter
       \@ifundefined{theH\FP@captype}{}{%
         \expandafter\l@addto@macro\csname theH\FP@captype\endcsname{.FP}}}%
      {\begin\FP@captype[b!]%
         \let\FP@savedSetfnumCommand\caption@setfnum
         \def\caption@setfnum##1{%
           \FP@savedSetfnumCommand{##1}%
           \ifx\FP@guide\@empty \else
             \expandafter\l@addto@macro\csname fnum@##1\endcsname{\ {\FP@guide}}%
           \fi}%
         \setlength\abovecaptionskip{2pt plus 2pt minus 1pt}% length above caption
         \setlength\belowcaptionskip{2pt plus 2pt minus 1pt}% length below caption
         \caption@setoptions{FP\@captype}%
         \FP@separatorCaption
         \caption@ifFPlistcap{}{\let\caption@addcontentsline\@gobbletwo}%
         \caption@defrost
       \end\FP@captype}%
  }%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{%
  \let\caption@ifFPlistcap\@undefined
  \let\caption@ifFPrefcap\@undefined
}
%    \end{macrocode}
%
% \subsubsection{The hyperref package}
% \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
% \changes{v3.1}{2007/03/09}{Usage of \cs{hyper@makecurrent} instead of
%   \cs{theHfigure} as indicator for \package{hyperref} package}
% \changes{v3.2}{2011/07/30}{Test if \package{hyperref} has stopped early revised}
% \changes{v3.2c}{2011/08/24}{Test if \package{hyperref} has stopped early adapted to current version of \package{hyperref} package: Usage of \cs{IfHyperBoolean} added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{%
  % Test if hyperref has stopped early
  \caption@ifundefined\IfHyperBoolean{%
    \caption@set@bool\caption@ifhyp@stoppedearly0%
    \caption@ifundefined\H@refstepcounter
      {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
    \caption@ifundefined\hyper@makecurrent
      {\caption@set@bool\caption@ifhyp@stoppedearly1}{%
    \caption@ifundefined\measuring@true
      {\caption@set@bool\caption@ifhyp@stoppedearly1}{}}}%
  }{%
    \def\caption@ifhyp@stoppedearly{\IfHyperBoolean{stoppedearly}}%
  }%
  \caption@ifhyp@stoppedearly{% hyperref has stopped early
    \caption@InfoNoLine{%
      Hyperref support is turned off\MessageBreak
      because hyperref has stopped early}%
  }{%
    \g@addto@macro\caption@prepareslc{\measuring@true}%
%    \end{macrocode}
%
% \begin{macro}{\caption@@refstepcounter}
% We redefine |\caption@@refstepcounter| so |\H@refstepcounter| will be used
% instead of |\refstepcounter| inside |\caption| \& |\captionlistentry|.
%    \begin{macrocode}
    \renewcommand*\caption@@refstepcounter{\H@refstepcounter}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@makecurrent}
% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
% We redefine |\caption@makecurrent| so a \package{hyperref} label
% will be defined inside |\@caption|.
% \Note{Will be redefined by \cs{caption@start}.}
%    \begin{macrocode}
    \renewcommand*\caption@makecurrent[2]{%
      \caption@makecurrentHref{#1}%
      \caption@Debug{hyperref current=\@currentHref}%
      \caption@gettitle{#2}}%
%    \end{macrocode}
%    \begin{macrocode}
    \newcommand*\caption@makecurrentHref{\hyper@makecurrent}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@makeanchor}
% \changes{v3.1l}{2010/01/09}{Adapted to the current hyperref package}
% We redefine |\caption@makeanchor| so a \package{hyperref} anchor
% will be set inside |\@caption|.
% \Note{Will be redefined by \cs{caption@start}.}
%    \begin{macrocode}
    \renewcommand\caption@makeanchor[1]{%
      \caption@Debug{hyperref anchor: \@currentHref}%
      % If we cannot have nesting, the anchor is empty.
      \ifHy@nesting
        \expandafter\hyper@@anchor\expandafter{\@currentHref}{#1}%
      \else
        \Hy@raisedlink{%
          \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
        }#1%
      \fi}%
%    \end{macrocode}
%    \begin{macrocode}
    \g@addto@macro\caption@prepareslc{\let\caption@makeanchor\@firstofone}%
%    \end{macrocode}
% \end{macro}
%
% \paragraph{The hypcap option}
%
% \begin{macro}{\if@capstart}
% Like the \package{hypcap} package we define the switch |\if@capstart|, too.
%    \begin{macrocode}
    \newif\if@capstart
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@start}
% \changes{v3.0l}{2007/02/20}{%
%         \cs{caption@currentHref} renamed to \cs{hc@currentHref}}
% \changes{v3.1}{2007/06/21}{%
%         This macro renamed from \cs{capstart} to \cs{caption@start} and revised}
% While the \package{hypcap} package defines a macro called |\capstart|
% our variant is called |\caption@start| and is controlled by the option
% |hypcap=||false|/|true|.
%    \begin{macrocode}
    \def\caption@start{\caption@ifhypcap\caption@start@\relax}%
    \def\caption@start@{%
%    \end{macrocode}
% Generate the \package{hyperref} label and set the \package{hyperref} anchor,
% usually (if |hypcap=false|) both is done inside |\@caption|.
%    \begin{macrocode}
      \caption@makestart\@captype
      \caption@startanchor\@currentHref
%    \end{macrocode}
% Prevent |\@caption| from generating a new \package{hyperref} label,
% use the label we save in |\hc@currentHref| instead.
% (We also support the |@capstart| flag from the \package{hypcap} package.)
%    \begin{macrocode}
      \global\@capstarttrue
      \let\hc@currentHref\@currentHref
      \def\caption@makecurrentHref##1{%
        \global\@capstartfalse
        \global\let\@currentHref\hc@currentHref}%
%    \end{macrocode}
% Prevent |\@caption| from generating a \package{hyperref} anchor since this
% has already been done.
%    \begin{macrocode}
      \let\caption@makeanchor\@firstofone
%    \end{macrocode}
%    \begin{macrocode}
    }%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@makestart}
% \changes{v3.1c}{2007/09/30}{\cs{@currentHref} will be extended by \texttt{caption}
%        instead of \texttt{xxx} now}
%  |\caption@makestart|\marg{type}
%  defines a \package{hyperref} anchor inside |\caption@start|.\par
%  Since we offer |\ContinuedFloat| the float counter can change between
%  `now' and |\caption|, i.e., we simply don't know the figure or table counter
%  yet and therefore we are not able to generate the `right' \package{hyperref}
%  label.
%  Two different solutions of this problem came into my mind:
%  \begin{enumerate}
%  \item I could use the aux file for this purpose.\par
%  -or-
%  \item I set |hypertexnames=false| locally.
%  Furthermore I use |#1.caption.|\meta{counter} (instead of |#1.|\meta{counter})
%  as naming scheme for |\@currentHref| to avoid conflicts with other hyper
%  links which are generated with |hypertexnames=true|.
%  \end{enumerate}
%  The first idea has the advantage that the `right' anchor name will be
%  generated, but one needs an additional \LaTeX\ run if figures or tables
%  will be inserted or removed.\par
%  The second idea has the advantage that it's very easy to implement, but
%  has some side-effects, e.g. the anchor names don't follow the figure or
%  table label names anymore.\par
%  Since I'm lazy I implemented the second idea, maybe I will revise this
%  later on.
%    \begin{macrocode}
    \newcommand*\caption@makestart[1]{%
      \begingroup
        \Hy@hypertexnamesfalse
%       \gdef\@currentHlabel{}%
        \hyper@makecurrent{#1.caption}%
      \endgroup
      \caption@Debug{hypcap start=\@currentHref}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@startanchor}
% \changes{v3.1b}{2007/09/17}{Bugfix 06-09-17: We use \cs{caption@anchor} instead of \cs{hyper@@anchor}}
% \changes{v3.1g}{2008/03/16}{Warning about TeX mode replaced with debug info}
% |\caption@startanchor|\marg{Href}
% sets a \package{hyperref} anchor inside |\caption@start|.\par
% This code was taken from the \package{hypcap} package\cite{hypcap} and adapted.
% \Note{Since \cs{hyper@@anchor}\marg{Href}\csmarg{\string\relax} can cause
% a change from vertical mode to horizontal mode (design flaw in
% \package{hyperref} package!?), and since the workaround
% \cs{let}\cs{leavevmode}\cs{relax} which can be found in the
% \package{hypcap} package is not always sufficient
% (for example with ``Direct pdfmark support'' and \texttt{breaklinks=true}),
% we use \cs{caption@anchor} instead of \cs{hyper@@anchor} here.}
%    \begin{macrocode}
    \newcommand*\caption@startanchor[1]{%
      \ifvmode\begingroup
        \caption@Debug{hypcap anchor: #1 (vertical mode)}%
        \@tempdima\prevdepth
        \nointerlineskip
        \vspace*{-\caption@hypcapspace}%
        \caption@anchor{#1}%
        \vspace*{\caption@hypcapspace}%
        \prevdepth\@tempdima
      \endgroup\else
        \caption@Debug{hypcap anchor: #1 (horizontal mode)}%
        \caption@anchor{#1}%
      \fi}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@anchor}
% \changes{v3.1c}{2007/10/17}{Workaround 07-10-17: We use \cs{caption@raisedlink} instead of \cs{Hy@raisedlink} now}
% |\caption@anchor|\marg{Href} sets a \package{hyperref} anchor.
%    \begin{macrocode}
    \newcommand*\caption@anchor[1]{%
      \ifmeasuring@ \else
        \caption@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}%
      \fi}%
%    \end{macrocode}
% \Note{Since \cs{Hy@raisedlink} change \cs{@tempdima} we surrounded it by \cs{ifvmode},
% suppressing ``\texttt{LaTeX Warning: Float too large for page by 1.0pt}'' in \texttt{sideways} floats.
% (This is not necessary since \package{hyperref} \version{6.77}.)}
%    \begin{macrocode}
    \ifx\HyperRaiseLinkLength\@tempdima
      \def\caption@raisedlink#1{\ifvmode#1\else\Hy@raisedlink{#1}\fi}%
    \else
      \let\caption@raisedlink\Hy@raisedlink
    \fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@start}
% Will be used by |\caption@freezeHref|. Apart from that we issue a warning
% if we expect a saved \package{hyperref} label coming from |\caption@start|,
% but there isn't any.
%    \begin{macrocode}
    \def\caption@@start{%
      \caption@ifundefined\hc@currentHref{%
        \caption@Warning{%
          The option `hypcap=true' will be ignored for this\MessageBreak
          particular \string\caption}}{}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@freezeHref}
%  Suppress |\caption@start| from generating a \package{hyperref} label and
%  setting a \package{hyperref} anchor. Instead if |\@caption| generates a
%  \package{hyperref} label, it will be stored in |\caption@currentHref|.
%  Furthermore we need to redefine |\caption@setfloatcapt| so no
%  \package{hyperref} anchor will be placed in |\@caption|.
% \iffalse
%  (Since |\caption@setfloatcapt| will be set to |\@firstofone| inside
%   |\subcaption| there is no need to add its restauration to
%   |\caption@subtypehook|.)
% \fi
%    \begin{macrocode}
    \def\caption@freezeHref{%
      \let\caption@ORI@start\caption@start
      \def\caption@start{\let\caption@start\caption@ORI@start}%
%    \end{macrocode}
%    \begin{macrocode}
%     \let\caption@ORI@@start\caption@@start
%     \l@addto@macro\caption@subtypehook{%
%       \let\caption@@start\caption@ORI@@start}%
%    \end{macrocode}
%    \begin{macrocode}
      \global\let\caption@currentHref\@undefined
      \def\caption@@start{\global\let\caption@currentHref\@currentHref}%
%    \end{macrocode}
%    \begin{macrocode}
      \let\caption@ORI@setfloatcapt\caption@setfloatcapt
      \renewcommand*\caption@setfloatcapt{%
        \ifx\caption@currentHref\@undefined \else
          \let\caption@makeanchor\@firstofone
        \fi
        \caption@ORI@setfloatcapt}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@defrostHref}
%  If there is a freezed |\@currentHref|, we set the \package{hyperref}
%  anchor here.
%    \begin{macrocode}
    \def\caption@defrostHref{%
      \ifx\caption@currentHref\@undefined \else
        \caption@startanchor\caption@currentHref
        \global\let\caption@currentHref\@undefined
      \fi}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\float@makebox}
% Do our own redefinition of |\float@makebox|, if it was redefined by
% the \package{hyperref} package.
%    \begin{macrocode}
    \caption@ifundefined\HyOrg@float@makebox{}{%
      \caption@Debug{%
        Redefining \noexpand\float@makebox (again)\@gobble}%
      \let\caption@ORI@float@makebox\float@makebox % save for compatibility mode
      \renewcommand\float@makebox[1]{%
        \HyOrg@float@makebox{#1\relax \caption@defrostHref}}%
    }%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  }}{}
%    \end{macrocode}
%
% \subsubsection{The hypcap package}
% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
% \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} \version{1.6}}
% \changes{v3.1e}{2007/11/04}{\package{hypcap} support adapted to \package{hyperref} \version{6.77}}
% 
%    \begin{macrocode}
\caption@IfPackageLoaded{hypcap}{% v1.0
  \ifx\caption@start\relax \else % hyperref hasn't stopped early
%    \end{macrocode}
%
% If the \package{hypcap} package was loaded, we give up our own
% hyperlink placement algorithm and give the control over the placement
% to the \package{hypcap} package instead.
%
% \begin{macro}{\capstart}
% \changes{v3.1k}{2009/10/09}{Support of \cs{ifcapstart} (\package{hypcap} package \version{1.10}) added}
% We do this simply by mapping |\capstart| to |\caption@start@|,
% although our code does not behave exactly like the original one:
% The original |\capstart| has an effect on the next |\caption|
% only but our version affects \emph{all} |\caption|s in the same
% environment, at least unless a new |\capstart| will be placed.
%    \begin{macrocode}
    \let\caption@ORI@capstart\capstart % save for compatibility mode
    \caption@ifundefined\capstarttrue % check for v1.10 of hypcap package
      {\def\capstart{\caption@start@}}%
      {\def\capstart{\ifcapstart\caption@start@\fi}}%
    \let\caption@start\relax
    \let\caption@@start\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@hypcapspace}
% Furthermore we map our |\caption@hypcapspace| to |\hypcapspace|
% offered by the \package{hypcap} package.
%    \begin{macrocode}
    \caption@set@bool\caption@ifhypcap 1%
    \renewcommand*\caption@hypcapspace{\hypcapspace}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  \fi}{}
%    \end{macrocode}
%
% \subsubsection{The listings package}
% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{%
%    \end{macrocode}
%
% \begin{macro}{\lst@MakeCaption}
% \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now}
% \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added}
% \changes{v3.2}{2010/10/26}{Bugfix 10-07-20a: Set \cs{hsize} to \cs{linewidth}, if necessary}
%  To support the \package{listings} package we need to redefine
%  |\lst@MakeCaption| so the original stuff is nested with
%  |\caption@begin| and |\caption@end| etc.
%  \Note{This macro is always called twice (with `t' resp. `b' as
%    parameter), therefore we need an extra group here.}
%    \begin{macrocode}
  \let\caption@ORI@lst@MakeCaption\lst@MakeCaption
  \def\lst@MakeCaption#1{% #1 is `t' or `b'
    \begingroup
%    \end{macrocode}
% Workaround for bug in \package{listings} package:
% If |\hsize| seems not to be set correctly, we set it to |\linewidth|.
%    \begin{macrocode}
    \ifdim\hsize>\linewidth
      \hsize\linewidth
    \fi
%    \end{macrocode}
% First of all, we set |position=#1| and if it was set to `top',
% we swap the skips so the default behavior of the \package{listings} package
% will not be changed. (Note that the \package{listings} package has set its
% own |\abovecaptionskip| \& |\belowcaptionskip| values prior to calling
% \cs{lst@MakeCaption}.)
%    \begin{macrocode}
      \caption@setposition{#1}%
      \caption@iftop{%
        \@tempdima\belowcaptionskip
        \belowcaptionskip\abovecaptionskip
        \abovecaptionskip\@tempdima}{}%
%    \end{macrocode}
% Workaround for issue with wrong skips (should be examined further)
%    \begin{macrocode}
      \caption@setup{rule=0}%
%    \end{macrocode}
% Afterwards we set the local `lstlisting' options.
%    \begin{macrocode}
      \caption@setoptions{lstlisting}%
%    \end{macrocode}
% If the |position=| is now set to |auto|, we take over the |captionpos=|
% setting from the \package{listings} package.
%    \begin{macrocode}
      \caption@setautoposition{#1}%
%    \end{macrocode}
% At the end we do similar stuff as in our \cs{@caption} code.
%    \begin{macrocode}
      \caption@begin{lstlisting}%
        \caption@ORI@lst@MakeCaption{#1}%
      \caption@end
%    \end{macrocode}
%    \begin{macrocode}
    \endgroup}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lst@makecaption}
% \begin{macro}{\lst@maketitle}
% Wrapper macros for typesetting the |caption=| resp. |title=| value.
%    \begin{macrocode}
  \def\lst@makecaption{\caption@starfalse\@makecaption}%
  \def\lst@maketitle{\caption@startrue\@makecaption\@empty}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ext@lstlisting}
% \changes{v3.1}{2007/03/03}{This macro added}
% Since the \package{listings} package do not define |\ext@lstlisting|
% but we needed it when |\captionof{lstlisting}| will be done by the end user,
% we define it here.
%    \begin{macrocode}
  \providecommand*\ext@lstlisting{lol}%
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.1a}{2007/07/13}{Bugfix 07-09-13: \cs{lst@@caption} will not be re-defined anymore}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The longtable package}
%
% \begin{macro}{\LTcaptype}
% \changes{v3.1}{2007/07/06}{This macro and its support added}
%  |\LTcaptype| is preset to |table|.
%    \begin{macrocode}
\providecommand*\LTcaptype{table}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{%
%    \end{macrocode}
%    \begin{macrocode}
  \RequirePackage{ltcaption}[=2007/09/01]%
  \let\LT@@makecaption\@undefined
%    \end{macrocode}
%
% \begin{macro}{\LT@array}
% \changes{v3.1}{2007/07/22}{This redefinition added}
% \changes{v3.1a}{2007/09/14}{Bugfix 07-09-14: Redefinition of \cs{@captionabovetrue} \& \cs{@captionabovefalse} added}
% \changes{v3.1a}{2007/09/16}{Bugfix: This redefinition will always be done \cs{AtBeginDocument}}
% \changes{v3.1g}{2008/01/20}{Bugfix in \cs{captionlistentry}: Table counter will not be incremented anymore, \cs{nameref} works}
% We redefine |\LT@array| here to get |\captionsetup|\marg{options}
% working inside |longtable|s.
% \Note{Since the \package{hyperref} package patches \cs{LT@array} as well
%  and since this only works with the original definition of \cs{LT@array},
%  we have to do this after the \package{hyperref} package,
%  i.e.~\cs{AtBeginDocument}.}
%    \begin{macrocode}
  \caption@AtBeginDocument{%
    \let\caption@ORI@LT@array\LT@array
    \renewcommand*\LT@array{%
%    \end{macrocode}
% |\captionsetup| for longtable:
%    \begin{macrocode}
      \global\let\caption@opt@@longtable\@undefined
      \def\captionsetup{%
        \noalign\bgroup
        \@ifstar\@captionsetup\@captionsetup}% gobble *
      \def\@captionsetup##1{\LT@captionsetup{##1}\egroup}%
      \def\LT@captionsetup##1{%
        \captionsetup@startrue\caption@setup@options[@longtable]{##1}%
        \global\let\caption@opt@@longtable\caption@opt@@longtable}%
%    \end{macrocode}
% |\captionabove| \& |\captionbelow| for longtable: (\KOMAScript\ document class)
%    \begin{macrocode}
      \def\@captionabovetrue{\LT@captionsetup{position=t}}%
      \def\@captionabovefalse{\LT@captionsetup{position=b}}%
%    \end{macrocode}
% |\captionlistentry| for longtable:
%    \begin{macrocode}
      \def\captionlistentry{%
        \noalign\bgroup
        \@ifstar{\egroup\LT@captionlistentry}% gobble *
                {\egroup\LT@captionlistentry}}%
      \def\LT@captionlistentry##1{%
        \caption@listentry\@firstoftwo[\LTcaptype]{##1}}%
%    \end{macrocode}
% |\ContinuedFloat| for longtable:\\
% {\small(Commented out, since it's not deeply tested and quite useless anyway)}
% \Note{\package{hyperref} versions $<$ v6.76j uses $2\times$ \cs{hyper@makecurrent}}
%    \begin{macrocode}
%     \caption@ifhypcap{%
%       \let\caption@ORI@hyper@makecurrent\hyper@makecurrent
%       \def\hyper@makecurrent##1{%
%         \let\hyper@makecurrent\caption@ORI@hyper@makecurrent
%         \caption@makestart{##1}%
%%        \let\Hy@LT@currentHlabel\@currentHlabel
%         \let\Hy@LT@currentHref\@currentHref
%         \def\hyper@makecurrent####1{%
%%          \let\@currentHlabel\Hy@LT@currentHlabel
%           \let\@currentHref\Hy@LT@currentHref}}%
%       \let\caption@ORI@ContinuedFloat\ContinuedFloat
%       \def\ContinuedFloat{\noalign{%
%         \gdef\caption@setContinuedFloat{%
%           \let\caption@resetContinuedFloat\@gobble}%
%         \def\caption@setoptions####1{%
%           \g@addto@macro\caption@setContinuedFloat{%
%             \caption@setoptions{####1}}}%
%         \let\@captype\LTcaptype
%         \caption@ORI@ContinuedFloat}}%
%     }{%
%       \def\ContinuedFloat{\noalign{%
%         \caption@Error{%
%           \noexpand\ContinuedFloat inside longtables\MessageBreak
%           is only available with `hypcap=true'}}}%
%     }%
%     \global\let\caption@setContinuedFloat\@empty
      \def\ContinuedFloat{\noalign{%
        \caption@Error{\noexpand\ContinuedFloat outside float}}}%
%    \end{macrocode}
%    \begin{macrocode}
      \caption@ORI@LT@array}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LT@c@ption}
% \changes{v3.1g}{2008/01/22}{Made it \cs{long}}
%  The original implementation:
%  \begin{verbatim}
%  \def\LT@c@ption#1[#2]#3{%
%    \LT@makecaption#1\fnum@table{#3}%
%    \def\@tempa{#2}%
%    \ifx\@tempa\@empty\else
%       {\let\\\space
%       \addcontentsline{lot}{table}{\protect\numberline{\thetable}{#2}}}%
%    \fi}
%  \end{verbatim}%^^A
%  Our implementation uses |\LTcaptype| instead of |{table}|:
%    \begin{macrocode}
  \long\def\LT@c@ption#1[#2]#3{%
    \LT@makecaption#1{\csname fnum@\LTcaptype\endcsname}{#3}%
    \LT@captionlistentry{#2}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LT@makecaption}
% \changes{v3.0d}{2004/08/10}{%
%       Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
% \changes{v3.0e}{2005/05/05}{%
%       Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
%  |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
%  \smallskip
%  The original definition:
%  \begin{verbatim}
%  \def\LT@makecaption#1#2#3{%
%    \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
%      % Based on article class "\@makecaption", "#1" is "\@gobble" in star
%      % form, and "\@firstofone" otherwise.
%      \sbox\@tempboxa{#1{#2: }#3}%
%      \ifdim\wd\@tempboxa>\hsize
%        #1{#2: }#3%
%      \else
%        \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
%      \fi
%      \endgraf\vskip\baselineskip}%
%    \hss}}}
%  \end{verbatim}%^^A
%  Our definition:
%    \begin{macrocode}
  \renewcommand\LT@makecaption[3]{%
    \caption@LT@make{%
%    \end{macrocode}
%
%  If |\LTcapwidth| is not set to its default value |4in| we assume
%  that it shall overwrite our own setting.
%  (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
%    \begin{macrocode}
      \caption@settype*\LTcaptype
      \ifdim\LTcapwidth=4in \else
        \setcaptionwidth\LTcapwidth
      \fi
      \caption@setoptions{longtable}%
%     \caption@setContinuedFloat
      \caption@setoptions{@longtable}%
%    \end{macrocode}
%
% \iffalse
%  The default |position=| setting for longtables is |top|.
%  (This emulates the standard behavior of the \package{longtable} package
%   which has no skip above the caption but a skip below it.)
% \fi
%
%  |position=auto| is a bad idea for longtables, but we do our very best.
%  This works quite well for captions inside the longtable contents, but
%  not for captions inside the longtable (end)foot.
%  \Note{This should be `top' if unclear!}
%    \begin{macrocode}
      \caption@setautoposition{\ifcase\LT@rows t\else b\fi}%
%    \end{macrocode}
%
%  We set |\ifcaption@star| according the 1st argument.
%    \begin{macrocode}
      \caption@startrue#1\caption@starfalse
%    \end{macrocode}
%
% \changes{v3.1}{2007/05/05}{\cs{caption@normalsize} added}
%    \begin{macrocode}
      \caption@resetContinuedFloat\LTcaptype
      \caption@begin\LTcaptype
        \caption@normalsize
%    \end{macrocode}
%
%  The following skip has the purpose to correct the height of the
%  |\parbox[t]|. Usually it's the height of the very first line, but
%  because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
%  it's always |0pt|.\par
%  (A different idea would be typesetting the first skip outside the longtable
%   column with |\noalign{\vskip|\ldots|}|, but this means we have to move
%   |\caption@begin| to some other place because it does not work in tabular
%   mode. And at the moment I have no idea on how to do this in an elegant
%   way\ldots)
%    \begin{macrocode}
        \vskip-\ht\strutbox
%    \end{macrocode}
%
%  The following code should look familiar. We do our skips and use
%  |\caption@@make| to typeset the caption itself.
%    \begin{macrocode}
        \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
        \caption@@make{#2}{#3}\endgraf
        \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}%
      \caption@end}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The picinpar package}
% \changes{v3.1}{2007/06/13}{Support of the \package{picinpar} package added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{picinpar}{%
%    \end{macrocode}
%
% \begin{macro}{\figwindow}
% \begin{macro}{\tabwindow}
% The \package{picinpar} package comes with its own caption code
% (|\wincaption|, |\@wincaption|, |\@makewincaption|, \ldots)
% so we redefine |\figwindow| \& |\tabwindow| to use |\caption| instead.
%    \begin{macrocode}
  \long\def\figwindow[#1,#2,#3,#4] {%
    \caption@window{figure}%
    \caption@setoptions{figwindow}%
    \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
%    \end{macrocode}
%    \begin{macrocode}
  \long\def\tabwindow[#1,#2,#3,#4] {%
    \caption@window{table}%
    \caption@setoptions{tabwindow}%
    \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@window}
% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added}
% Beside calling |\caption@settype| we redefine |\caption@boxrestore|
% (as in \package{floatflt} \& \package{picins} package support)
% and |\@makecaption| (as in \package{float} package support) here.
%    \begin{macrocode}
  \newcommand*\caption@window[1]{%
    \let\@makecaption\caption@@make
    \caption@setautoposition b%
    \caption@settype{#1}%
    \caption@clearmargin
    \caption@setfullparboxrestore}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@wincaption}
% \changes{v3.1d}{2007/10/25}{Missing \% added}
% This one finally typesets the caption using |\caption|.
%    \begin{macrocode}
  \newcommand\caption@wincaption[1]{%
%    \end{macrocode}
% This will be done twice for every |figwindow| \& |tabwindow| caption --
% on the first run |\picwd| is |0pt|, on the second run |\picwd| is |\hsize|.
%    \begin{macrocode}
    \ifdim\picwd=\z@
      \let\caption@makecurrent\@gobbletwo
      \let\caption@@start\relax
      \caption@prepareslc
    \fi
%    \end{macrocode}
% The argument |#1| could contain simply the caption text
% (e.g.~|A figure caption|), but it could also contain an optional argument,
% the \meta{lst\_entry}
% (e.g.~|[An| |entry| |to| |the| |LOF]||{A| |figure| |caption}|).
% Therefore we have to test if |#1| begins with~|[| or not; furthermore we
% support a starred variant -- as in |\caption*| -- so we test for~|*|, too.
%    \begin{macrocode}
    \edef\@tempa{\expandafter\noexpand\@car#1\@nil}%
    \if\@tempa*%
      \let\@tempa\@firstofone
    \else\if\@tempa[%]
      \let\@tempa\@firstofone
    \else
      \let\@tempa\@empty
    \fi\fi
    \expandafter\caption\@tempa{#1}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The picins package}
% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
%
% \begin{macro}{\piccaptiontype}
% |\piccaptiontype|\marg{type}\par
% We offer this macro for changing the \meta{type} of the caption, so the user
% doesn't have to redefine |\@captype|, as proposed in the \package{picins}
% documentation.
% \Note{We define this macro here so it can be used in the
%  preamble of the document, even when \thispackage\ was loaded prior to the
%  \package{picins} package.}
%    \begin{macrocode}
\newcommand*\piccaptiontype[1]{\def\@piccaptype{#1}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{picins}{%
%    \end{macrocode}
%
% Initial set |\@piccaptype| and undefine |\@captype| which was set to
% |figure| by the \package{picins} package.
%    \begin{macrocode}
  \caption@ifundefined\@piccaptype{%
    \caption@iftype{%
      \let\@piccaptype\@captype
    }{%
      \def\@piccaptype{figure}%
    }%
  }{}%
  \let\@captype\@undefined
%    \end{macrocode}
%
% \begin{macro}{\piccaption}
%  The original code:
%  \begin{verbatim}
%  \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
%  \end{verbatim}%^^A
%  Our code uses |\caption@star| so |\piccaption*| works,
%  and |\caption@dblarg| so |\piccaption{}| works correctly.
%    \begin{macrocode}
  \def\piccaption{\caption@star\relax{\caption@dblarg\@piccaption}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\make@piccaption}
% \changes{v3.1}{2007/12/06}{Bugfix: \cs{caption@clearmargin} will always be used now}
%  The original code:
%  \begin{verbatim}
%  \def\make@piccaption{%
%   [...]
%   \setbox\@TEXT=\vbox{\hsize\hsiz@\caption[\sh@rtf@rm]{\capti@nt@xt}}%
%  }
%  \end{verbatim}%^^A
%  In our code we have to correct several things:
%  \begin{enumerate}
%    \item |\@captype| must be defined, since we have removed the global
%          definition.
%    \item We use |\caption@setoptions{parpic}| so
%          |\captionsetup[parpic]{|\ldots|}| is supported.
%    \item |\linewidth| must be set correctly.
%          Usually this is done by |\@parboxrestore| inside |\@caption|,
%          but since we use |\@caption@boxrestore| we have to map this to
%          |\@parboxrestore| instead.
%    \item The two arguments of |\caption| (|\sh@rtf@rm| \& |\capti@nt@xt|)
%          should be expanded on first level so |\caption[]{|\ldots|}| and
%          |\caption[|\ldots|]{}| work correctly.
%  \end{enumerate}
%    \begin{macrocode}
  \let\caption@ORI@make@piccaption\make@piccaption
  \def\make@piccaption{%
    \let\caption@ORI\caption
%    \end{macrocode}
%    \begin{macrocode}
    \long\def\caption[##1]##2{%
      \caption@freezeHref % will be defrosted in \ivparpic
      \caption@settype\@piccaptype
%     \ifnum\c@piccaptionpos>2\relax
      \caption@clearmargin
%     \else
%       \captionwidth\z@ % do not use "width=" setting
%     \fi
      \caption@setfullparboxrestore
      \caption@setoptions{parpic}%
      \caption@setautoposition b%
%    \end{macrocode}
%    \begin{macrocode}
      \expandafter\expandafter\expandafter\caption@ORI
        \expandafter\expandafter\expandafter[%
        \expandafter\expandafter\expandafter{%
        \expandafter##1\expandafter}\expandafter]\expandafter{##2}}%
%    \end{macrocode}
% {\footnotesize\begin{quote}
%   \leavevmode\llap{-or-\quad}%^^A
%   |\begingroup|\\
%   |  \toks0\expandafter{##1}| |\toks2\expandafter{##2}|\\
%   |  \edef\x{\endgroup|\\
%   |    \noexpand\caption@ORI[{\the\toks0}]{\the\toks2}}|\\
%   |  \x|
% \end{quote}
% \begin{quote}
%   \leavevmode\llap{-or-\quad}%^^A
%   |\edef\x{%|\\
%   |  \noexpand\caption@ORI[{\unexpanded\expandafter{##1}}]%|\\
%   |                        {\unexpanded\expandafter{##2}}}|\\
%   |\x|
% \end{quote}}
%    \begin{macrocode}
    \caption@ORI@make@piccaption
    \let\caption\caption@ORI}%
%    \end{macrocode}
% \end{macro}
%

% \begin{macro}{\ivparpic}
% We need to set our \package{hyperref} anchor here.
% Not bullet-proof since we have to redefine |\noindent| here!
%    \begin{macrocode}
  \let\caption@ORI@ivparpic\ivparpic
  \def\ivparpic(#1,#2)(#3,#4)[#5][#6]#7{%
    \let\caption@ORI@noindent\noindent
    \def\noindent{%
      \caption@defrostHref
      \let\noindent\caption@ORI@noindent
      \noindent}%
    \caption@ORI@ivparpic(#1,#2)(#3,#4)[#5][#6]{#7}%
    \let\noindent\caption@ORI@noindent}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{%
  \let\piccaptiontype\@undefined
}
%    \end{macrocode}
%
% \subsubsection{The rotating package}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{rotating}[1995/08/22 v2.10]{%
%    \end{macrocode}
%
% \begin{macro}{\rotcaption}
% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@star} removed}
% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
%  Make |\rotcaption*| work.
%    \begin{macrocode}
  \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
% \let\@rotcaption\@undefined
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rotcaptionof}
% \changes{v3.0i}{2005/12/07}{New}
%  Make |\rotcaptionof(*)| work.
%    \begin{macrocode}
  \def\rotcaptionof{%
    \caption@teststar\caption@of{\rotcaption*}\rotcaption}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@makerotcaption}
% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
% \changes{v3.0m}{2007/03/04}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox} now}
%  Original (bugfixed) code:
%  \begin{verbatim}
%  \long\def\@makerotcaption#1#2{%
%    \setbox\@tempboxa\hbox{#1: #2}%
%    \ifdim \wd\@tempboxa > .8\vsize
%      \rotatebox{90}{%
%      \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
%      }%\par   % <== \par removed (AR)
%    \else%
%      \rotatebox{90}{\box\@tempboxa}%
%    \fi
%    \nobreak\hspace{12pt}% <== \nobreak added (AR)
%  }
%  \end{verbatim}%^^A
%  Our version emulates this behavior, but if |width=| is set,
%  the rotated caption is always typeset as |minipage|.
%  (Note that |margin=| is not supported here.)
%    \begin{macrocode}
  \long\def\@makerotcaption#1#2{%
%    \end{macrocode}
%
%    \begin{macrocode}
    \ifdim\captionwidth=\z@
      \setcaptionwidth{.8\textheight}%
      \caption@slc{#1}{#2}{.8\vsize}{%
        \let\caption@makerot\caption@@make
        \caption@clearmargin
%       \long\def\caption@parbox##1##2{\hbox{\hsize=.8\textheight\relax##2}}%
%         (not needed because \rotatebox uses an \hbox anyway)
        \let\caption@parbox\@secondoftwo}%
      \caption@set@bool\caption@ifslc0% been there, done that
    \fi
%    \end{macrocode}
%
%    \begin{macrocode}
    \rotatebox{90}{\caption@makerot{#1}{#2}}%
    \nobreak\hspace{12pt}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \newcommand\caption@makerot[2]{%
    \begin{minipage}\captionwidth\caption@@make{#1}{#2}\end{minipage}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The sidecap package}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{sidecap}[2003/06/06 v1.6f]{%
  \caption@setbool{needfreeze}{1}%
%    \end{macrocode}
%
% \begin{macro}{\SC@zfloat}
% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@star} removed}
% \changes{v3.1c}{2007/10/06}{\cs{caption} will be saved \& restored now}
% \changes{v3.2a}{2011/08/17}{Bugfix: Uses \cs{caption@freeze} instead of \cs{caption@freeze*} now}
% \changes{v3.2f}{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@settype*{#2}%
    \caption@freeze
%    \end{macrocode}
% The sidecap package uses |\ifx\label\SC@label| to test if it is just inside a
% |SC|\-|figure| or not. So we redefine |\SC@label| here so this test will still work.
%    \begin{macrocode}
    \let\SC@label\label
%    \end{macrocode}
% 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 \package{sidecap} package actually typesets
%  its caption.
%    \begin{macrocode}
  \let\caption@ORI@endSC@FLOAT\endSC@FLOAT
  \def\endSC@FLOAT{%
%    \end{macrocode}
%  \Note{\cs{@captype} isn't defined here, this will be done inside
%  the original definition of \cs{endSC@FLOAT}. But \cs{SC@captype} is
%  defined and can be used here, if needed.}
%    \begin{macrocode}
    \let\caption@ORI@settype\caption@settype
    \def\caption@settype##1{% will be done in \@xfloat
      \caption@ORI@settype*{##1}% do not change \@currentlabel
      \caption@setSC@justify
%%%   \caption@setoptions{SCfloat}%
      \caption@setoptions{SC\@captype}%
      \caption@start}%
%    \end{macrocode}
%  Before we can typeset the caption we need to set the margin to zero
%  because any extra margin would only be disturbing here.\par
%  (We don't need to take care about the caption position because
%   the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
%   to a skip of zero anyway.)\par
%  Furthermore |\SC@justify| will override the caption justification, if set.
%  The usage of |\SC@justify| differs from version to version of the
%  \package{sidecap} package:\par
%  \begin{tabular}{ll}
%    Version 1.4: & |\SC@justify| is not defined\\
%    Version 1.5: & |\SC@justify| is |\relax| when not set\\
%    Version 1.6: & |\SC@justify| is |\@empty| when not set\\
%  \end{tabular}
%    \begin{macrocode}
    \def\caption@setSC@justify{%
      \caption@clearmargin
        \ifx\SC@justify\@empty \else
          \let\caption@hj\SC@justify
          \let\SC@justify\@empty
        \fi}%
%    \end{macrocode}
%  Make the original definition of |\endSC@FLOAT| to use our caption
%  stuff instead of its own.
%  \Note{At this point the \package{sidecap} definition of \cs{caption} is valid,
%  not the regular one!}
%    \begin{macrocode}
    \let\caption\SC@orig@caption
    \def\SC@orig@caption[##1]##2{\caption@defrost}%
%    \end{macrocode}
%  Finally we call the original definition of |\endSC@FLOAT|.
%    \begin{macrocode}
    \caption@setSC@justify % for compatibility mode
    \caption@ORI@endSC@FLOAT}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The subfigure package}
% \changes{v3.1}{2007/04/06}{subfigure package support added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{subfigure}[2002/01/23 v2.1]{%
%    \end{macrocode}
%
% \begin{macro}{\sf@ifpositiontop}
% \changes{v3.1a}{2007/09/15}{Bugfix 07-09-15: Check for \cs{@captype} added}
%  If the \package{subfigure} package is loaded, we map |\sf@ifpositiontop|
%  to |\iffiguretopcap| resp. |\iftabletopcap|, so the \package{subfigure}
%  \version{2.1} options \opt{figbotcap} etc. will still work.
%    \begin{macrocode}
  \def\sf@ifpositiontop{%
    \ifx\@captype\@undefined
      \expandafter\@gobbletwo
    \else\ifx\@captype\relax
      \expandafter\expandafter\expandafter\@gobbletwo
    \else
      \expandafter\expandafter\expandafter\sf@if@position@top
    \fi\fi}
%    \end{macrocode}
%    \begin{macrocode}
  \def\sf@if@position@top{%
    \@ifundefined{if\@captype topcap}%
      {\@gobbletwo}%
      {\@nameuse{if\@captype topcap}%
         \expandafter\@firstoftwo
       \else
         \expandafter\@secondoftwo
       \fi}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The supertabular and xtab packages}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{supertabular}[2002/07/19 v4.1e]{%
%    \end{macrocode}
%
% \begin{macro}{\tablecaption}
% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
% \changes{v3.1h}{2008/04/01}{Bugfix: Star variant does not increment table counter anymore}
%  Make |\topcaption*| and |\bottomcaption*| work.
%    \begin{macrocode}
  \renewcommand*\tablecaption{%
    \caption@star
      {\refstepcounter{table}}%
      {\caption@dblarg{\@xtablecaption}}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xtablecaption}
% \changes{v3.1h}{2008/04/01}{Made \cs{nameref} \& \cs{autoref} work}
% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
%  Make |\nameref| and |\autoref| work.
%    \begin{macrocode}
  \let\caption@ORI@xtablecaption\@xtablecaption
  \long\def\@xtablecaption[#1]#2{%
    \caption@gettitle{#2}%
    \caption@ORI@xtablecaption[#1]{#2}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ST@caption}
% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
% \changes{v3.1h}{2008/04/01}{Bugfix: \cs{@currentlabelname} will be set now}
%  The original code:
%  \begin{verbatim}
%  \long\def\ST@caption#1[#2]#3{\par%
%    \addcontentsline{\csname ext@#1\endcsname}{#1}%
%                    {\protect\numberline{%
%                        \csname the#1\endcsname}{\ignorespaces #2}}
%    \begingroup
%      \@parboxrestore
%      \normalsize
%      \if@topcaption \vskip -10\p@ \fi
%      \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
%      \if@topcaption \vskip 10\p@ \fi
%    \endgroup}
%  \end{verbatim}%^^A
%    \begin{macrocode}
  \long\def\ST@caption#1[#2]#3{\par%
    \caption@settype*{#1}%
    \caption@setoptions{supertabular}%
%    \end{macrocode}
%  The |position=| setting will be overwritten by the
%  \package{supertabular} package: If |\topcaption| was used,
%  the position will be |top| automatically, |bottom| otherwise.
%    \begin{macrocode}
    \def\caption@fixposition{%
      \caption@setposition{\if@topcaption t\else b\fi}}%
%    \end{macrocode}
%    \begin{macrocode}
    \caption@beginex{#1}{#2}{#3}%
      \caption@boxrestore
      \caption@normalsize
      \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
    \caption@end}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \changes{v3.1h}{2008/04/01}{Support of the xtab package added}
%    \begin{macrocode}
\caption@IfPackageLoaded{xtab}[2000/04/09 v2.3]{%
%    \end{macrocode}
%
% \begin{macro}{\tablecaption}
%  Make |\topcaption*| and |\bottomcaption*| work.
%    \begin{macrocode}
  \renewcommand*\tablecaption{%
    \caption@star
      {\refstepcounter{table}}%
      {\caption@dblarg{\@xtablecaption}}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xtablecaption}
% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package}
%  Make |\nameref| and |\autoref| work.
%    \begin{macrocode}
  \let\caption@ORI@xtablecaption\@xtablecaption
  \long\def\@xtablecaption[#1]#2{%
    \caption@gettitle{#2}%
    \caption@ORI@xtablecaption[#1]{#2}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ST@caption}
%  The original code:
%  \begin{verbatim}
%  \long\def\ST@caption#1[#2]#3{\par%
%    \@initisotab
%    \addcontentsline{\csname ext@#1\endcsname}{#1}%
%                    {\protect\numberline{%
%                      \csname the#1\endcsname}{\ignorespaces #2}}%
%    \begingroup
%      \@parboxrestore
%      \normalsize
%    %%  \if@topcaption \vskip -10\p@ \fi
%      \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
%    %%  \if@topcaption \vskip 10\p@ \fi
%    \endgroup
%    \global\advance\ST@pageleft -\PWSTcapht
%    \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}
%  \end{verbatim}%^^A
%    \begin{macrocode}
  \long\def\ST@caption#1[#2]#3{\par%
    \caption@settype*{#1}%
    \caption@setoptions{xtabular}%
%    \end{macrocode}
%    \begin{macrocode}
    \def\caption@fixposition{%
      \caption@setposition{\if@topcaption t\else b\fi}}%
%    \end{macrocode}
%    \begin{macrocode}
    \@initisotab
    \caption@beginex{#1}{#2}{#3}%
      \caption@boxrestore
      \caption@normalsize
      \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
    \caption@end
    \global\advance\ST@pageleft -\PWSTcapht
    \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The threeparttable package}
% \changes{v3.1}{2007/05/08}{Support of the \package{threeparttable} package added}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{threeparttable}[2003/06/13 v3.0]{%
%    \end{macrocode}
%
% \begin{macro}{\threeparttable}
% Unfortunately |\@captype| is not set when |\TPT@common| will be used,
% so we have to redefine |\threeparttable| and |\measuredfigure| instead.
%    \begin{macrocode}
  \let\caption@ORI@threeparttable\threeparttable
  \renewcommand*\threeparttable{%
    \caption@settype{table}%
      \caption@setposition a% ?
      \caption@clearmargin
    \caption@setoptions{threeparttable}%
    \caption@ORI@threeparttable}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\measuredfigure}
%  Same here\ldots
%    \begin{macrocode}
  \let\caption@ORI@measuredfigure\measuredfigure
  \renewcommand*\measuredfigure{%
    \caption@settype{figure}%
      \caption@setposition a% ?
      \caption@clearmargin
    \caption@setoptions{measuredfigure}%
    \caption@ORI@measuredfigure}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\TPT@caption}
%  The original code:
%  \begin{verbatim}
%  \def\TPT@caption#1[#2]#3{\gdef\TPT@docapt
%   {\par\global\let\TPT@docapt\@undefined \TPT@LA@caption{#1}[{#2}]%
%     {\strut\ignorespaces#3\ifhmode\unskip\@finalstrut\strutbox\fi}}%
%   \ifx\TPT@hsize\@empty \let\label\TPT@gatherlabel \abovecaptionskip\z@skip
%   \else \TPT@docapt \fi \ignorespaces}
%  \end{verbatim}%^^A
%    \begin{macrocode}
  \def\TPT@caption#1[#2]#3{%
    \gdef\TPT@docapt{%
      \global\let\TPT@docapt\@undefined
      \caption@setautoposition\caption@TPT@position
      \TPT@LA@caption{#1}[{#2}]{#3}}%
    \ifx\TPT@hsize\@empty
      \let\label\TPT@gatherlabel % Bug: does not work for measuredfigures
      \gdef\caption@TPT@position{t}%
      \g@addto@macro\TPT@docapt\caption@TPT@eatvskip
    \else
      \def\caption@TPT@position{b}%
      \TPT@docapt
    \fi
    \ignorespaces}%
%    \end{macrocode}
%    \begin{macrocode}
  %\newcommand*\caption@TPT@eatvskip{\vskip-.2\baselineskip}%
  \def\caption@TPT@eatvskip#1\vskip{#1\@tempdima=}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \subsubsection{The wrapfig package}
% \changes{v3.1}{2007/05/05}{Support of the \package{wrapfig} package added}
% \changes{v3.2d}{2011/11/02}{Support of the \package{wrapfig} package rewritten}
%
%    \begin{macrocode}
\caption@IfPackageLoaded{wrapfig}[2003/01/31 v3.6]{%
%    \end{macrocode}
%
% \begin{macro}{\wrapfloat}
% \changes{v3.2d}{2011/11/02}{Redefinition of this macro added}
% First of all we make the \package{wrapfig} package independent from the package
% load order regarding the \package{float} package.
% Since the usage of |\@float@set|\x|every| is missing in the code of the \package{wrapfig}
% package (it should be in the redefinition of |\float@re|\x|style|, right after
% |\@nameuse{fst@#1}|), we don't use it here, too,
% especially since |\wrap|\x|float| will usually not be used when used with re-styled floats.
%    \begin{macrocode}
  \renewcommand*\wrapfloat[1]{%
    \def\@captype{#1}%
    \@ifundefined{fst@#1}{}{%
      \@nameuse{fst@#1}%
%     \@float@setevery{#1}%
      \def\WF@floatstyhook{\let\@currbox\WF@box 
         \global\setbox\WF@box\float@makebox{\wd\WF@box}}}%
    \@ifnextchar[\WF@wr{\WF@wr[]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\WF@rapt}
% \changes{v3.2d}{2011/11/02}{Usage of \cs{WF@captionstyhook} added}
% Original code:
% \begin{verbatim}
%   \def\WF@rapt[#1]#2{% final two args: #1 = overhang,  #2 = width,
%     \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
%     \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
%     \ifdim\hsize>\z@ \@parboxrestore \else
%     \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
%     \ignorespaces \fi}
% \end{verbatim}%^^A
% Our code has |\WF@captionstyhook| in addition:
%    \begin{macrocode}
  \def\WF@rapt[#1]#2{% final two args: #1 = overhang,  #2 = width,
    \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
    \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
    \expandafter\WF@captionstyhook\expandafter{\@captype}% <= new
    \ifdim\hsize>\z@ \@parboxrestore \else
    \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption
    \ignorespaces \fi}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\WF@captionstyhook}
% \changes{v3.2d}{2011/11/02}{This macro added}
% \changes{v3.2e}{2011/11/10}{Bugfix 11-11-09: float package support fixed}
% We place our \package{hyperref} anchor here, 	apply the `wrap' options etc.
% Since the usage of |\@float@set|\x|every| is missing in the \package{wrapfig}
% package we will catch it up here for making the necessary adaptions to the
% \package{float} package.
%    \begin{macrocode}
  \def\WF@captionstyhook#1{%
    \let\@captype\@undefined
    \@ifundefined{fst@#1}{}{\@float@setevery{#1}}%
    \caption@settype{#1}%
    \caption@clearmargin
%%%    \caption@setoptions{wrapfloat}%
    \caption@setoptions{wrap#1}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \begin{thebibliography}{99}
%   \bibitem{TLC2}
%   Frank Mittelbach and Michel Goossens:\\
%   \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\
%   \newblock Addison-Wesley, 2004.
%
%   \bibitem{beamer}
%   Till Tantau:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/beamer/}%
%        {\emph{User Guide to the Beamer Class, Version 3.07}},\\
%   March 11, 2007
%
%   \bibitem{KOMAScript}
%   Markus Kohm \& Jens-Uwe-Morawski:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/koma-script/}%
%        {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\
%   2007-01-09
%
%   \bibitem{NTG}
%   Victor Eijkhout:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/ntgclass/}%
%        {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\
%   3 September 1989
%
%   \bibitem{float}
%   Anselm Lingnau:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/float/}%
%        {\emph{An Improved Environment for Floats}},\\
%   2001/11/08
%
%   \bibitem{floatflt}
%   Mats Dahlgren:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/floatflt/}%
%        {\emph{Welcome to the floatflt package}},\\
%   1998/06/05
%
%   \bibitem{floatrow}
%   Olga Lapko:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/floatrow/}%
%        {\emph{The floatrow package documentation}},\\
%   2007/08/24
%
%   \bibitem{fltpage}
%   Sebastian Gross:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/fltpage/}%
%        {\emph{Welcome to the beta test of fltpage package!}},\\
%   1998/11/13
%
%   \bibitem{hyperref}
%   Sebastian Rahtz \& Heiko Oberdiek:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/hyperref/}%
%        {\emph{Hypertext marks in \LaTeX}},\\
%   November 12, 2007
%
%   \bibitem{hypcap}
%   Heiko Oberdiek:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/oberdiek/}%
%        {\emph{The hypcap package -- Adjusting anchors of captions}},\\
%   2007/04/09
%
%   \bibitem{listings}
%   Carsten Heinz \& Brooks Moses:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/listings/}%
%        {\emph{The Listings Package}},\\
%   2007/02/22
%
%   \bibitem{longtable}
%   David Carlisle:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/required/tools/}%
%        {\emph{The longtable package}},\\
%   2004/02/01
%
%   \bibitem{picinpar}
%   Friedhelm Sowa:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex209/contrib/picinpar/}%
%        {\emph{Pictures in Paragraphs}},\\
%   July 13, 1993
%
%   \bibitem{picins}
%   Joachim Bleser and Edmund Lang:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex209/contrib/picins/}%
%        {\emph{PicIns-Benutzerhandbuch Version 3.0}},\\
%   September~1992
%
%   \bibitem{rotating}
%   Sebastian Rahtz and Leonor Barroca:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/rotating/}%
%        {\emph{A style option for rotated objects in \LaTeX}},\\
%   1997/09/26
%
%   \bibitem{sidecap}
%   Rolf Niepraschk \& Hubert G\"a\ss lein:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/sidecap/}%
%        {\emph{The sidecap package}},\\
%   2003/06/06
%
%   \bibitem{subfigure}
%   Steven D. Cochran:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/subfigure/}%
%        {\emph{The subfigure package}},\\
%   2002/07/02
%
%   \bibitem{subfig}
%   Steven D. Cochran:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/subfig/}%
%        {\emph{The subfig package}},\\
%   2005/07/05
%
%   \bibitem{supertabular}
%   Johannes Braams and Theo Jurriens:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/supertabular/}%
%        {\emph{The supertabular environment}},\\
%   2002/07/19
%
%   \bibitem{threeparttable}
%   Donald Arseneau:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/misc/}%
%        {\emph{Three part tables: title, tabular environment, notes}},\\
%   2003/06/13
%
%   \bibitem{wrapfig}
%   Donald Arseneau:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/wrapfig/}%
%        {\emph{WRAPFIG.STY ver 3.6}},\\
%   2003/01/31
%
%   \bibitem{xtab}
%   Peter Wilson:\\
%   \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/xtab/}%
%        {\emph{The xtab package}},\\
%   2004/05/24
% \end{thebibliography}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \Finale
%
\endinput
