%%
%% This is file `caption.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% caption.dtx  (with options: `package')
%% 
%% Copyright (C) 1994-2004 Axel Sommerfeldt (caption@sommerfeldt.net)
%% 
%% --------------------------------------------------------------------------
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% This Current Maintainer of this work is Axel Sommerfeldt.
%% 
%% This work consists of the files caption.ins, caption.dtx,
%% caption2.dtx, caption.xml, and anleitung.tex and the derived files
%% caption.sty, caption2.sty, and manual.tex.
%% 
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption}[2004/07/16 v3.0c Customising captions (AS)]
\providecommand*\@nameundef[1]{%
  \expandafter\let\csname #1\endcsname\@undefined}
\providecommand\l@addto@macro[2]{%
  \begingroup
    \toks@\expandafter{#1#2}%
    \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
  \@tempa}
\def\bothIfFirst#1#2{%
  \protected@edef\caption@tempa{#1}%
  \ifx\caption@tempa\@empty\else
    #1#2%
  \fi}
\def\bothIfSecond#1#2{%
  \protected@edef\caption@tempa{#2}%
  \ifx\caption@tempa\@empty\else
    #1#2%
  \fi}
\def\caption@ifinlist#1#2{%
  \let\next\@secondoftwo
  \edef\caption@tempa{#1}%
  \@for\caption@tempb:={#2}\do{%
    \ifx\caption@tempa\caption@tempb
      \let\next\@firstoftwo
    \fi}%
  \next}
\def\caption@setbool#1#2{%
  \caption@ifinlist{#2}{1,true,yes,on}{%
    \expandafter\let\csname caption@if#1\endcsname\@firstoftwo
  }{\caption@ifinlist{#2}{0,false,no,off}{%
    \expandafter\let\csname caption@if#1\endcsname\@secondoftwo
  }{%
    \PackageError{caption}{Undefined boolean value `#2'}{\caption@eh}%
  }}}
\def\caption@ifbool#1{\@nameuse{caption@if#1}}
\providecommand\captionsize{}%  changed v3.0a+c
\newdimen\captionmargin
\newdimen\captionwidth
\newif\ifcaption@width
\newcommand\caption@setmargin{%
  \caption@widthfalse
  \setlength\captionmargin}
\newcommand\caption@setwidth{%
  \caption@widthtrue
  \setlength\captionwidth}
\newdimen\captionindent
\newdimen\captionparindent
\newdimen\captionhangindent
\newif\ifcaption@star
\@ifundefined{abovecaptionskip}{%
  \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
\@ifundefined{belowcaptionskip}{%
  \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
\newcommand\caption@eh{%
  If you do not understand this error, please take a closer look\MessageBreak
  at the documentation of the `caption' package.\MessageBreak
  \@ehc}
\RequirePackage{keyval}[1997/11/10]
\providecommand*\undefine@key[2]{%
  \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
\newcommand\caption@setdefault{\captionsetup{%
  format=default,labelformat=default,labelsep=default,justification=default,%
  font=default,labelfont=default,textfont=default,%
  margin=0pt,indention=0pt,parindent=0pt,hangindent=0pt,singlelinecheck}}
\newcommand*\DeclareCaptionStyle[1]{%
  \@ifnextchar[{\caption@declarestyle{#1}}{\caption@declarestyle{#1}[]}}
\def\caption@declarestyle#1[#2]#3{%  bugfixed v3.0a
  \global\@namedef{caption@sls@#1}{#2}%
  \global\@namedef{caption@sty@#1}{#3}}
\@onlypreamble\DeclareCaptionStyle
\@onlypreamble\caption@declarestyle
\newcommand*\caption@setstyle[1]{%
  \@ifundefined{caption@sty@#1}%
    {\PackageError{caption}{Undefined caption style `#1'}{\caption@eh}}%
    {\expandafter\let\expandafter\caption@sls\csname caption@sls@#1\endcsname
     \caption@setdefault\caption@esetup{\csname caption@sty@#1\endcsname}}}
\DeclareCaptionStyle{default}[justification=centering]{}
\newcommand\DeclareCaptionFormat[2]{%  bugfixed v3.0a
  \global\long\expandafter\def\csname caption@fmt@#1\endcsname##1##2##3{#2}}
\@onlypreamble\DeclareCaptionFormat
\newcommand*\caption@setformat[1]{%
  \@ifundefined{caption@fmt@#1}%
    {\PackageError{caption}{Undefined caption format `#1'}{\caption@eh}}%
    {\expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
\DeclareCaptionFormat{normal}{#1#2#3\par}
\DeclareCaptionFormat{hang}{%
  \@hangfrom{#1#2}%
  \advance\captionparindent\hangindent
  \advance\captionhangindent\hangindent
  \caption@@par
  #3\par}
\def\caption@fmt@default{\caption@fmt@normal}
\newcommand*\DeclareCaptionLabelFormat[2]{%  bugfixed v3.0a
  \global\expandafter\def\csname caption@lfmt@#1\endcsname##1##2{#2}}
\@onlypreamble\DeclareCaptionLabelFormat
\newcommand*\caption@setlabelformat[1]{%
  \@ifundefined{caption@lfmt@#1}%
    {\PackageError{caption}{Undefined caption label format `#1'}{\caption@eh}}%
    {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
\DeclareCaptionLabelFormat{empty}{}
\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
\def\caption@lfmt@default{\caption@lfmt@simple}
\newcommand\DeclareCaptionLabelSeparator[2]{%  bugfixed v3.0a
  \global\long\@namedef{caption@lsep@#1}{#2}}
\@onlypreamble\DeclareCaptionLabelSeparator
\newcommand*\caption@setlabelseparator[1]{%
  \@ifundefined{caption@lsep@#1}%
    {\PackageError{caption}{Undefined caption label separator `#1'}{\caption@eh}}%
    {\expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
\DeclareCaptionLabelSeparator{none}{}
\DeclareCaptionLabelSeparator{colon}{: }
\DeclareCaptionLabelSeparator{period}{. }
\DeclareCaptionLabelSeparator{space}{ }
\DeclareCaptionLabelSeparator{quad}{\quad}
\DeclareCaptionLabelSeparator{newline}{\newline}
\DeclareCaptionLabelSeparator{widespace}{\hspace{1em plus .3em}}%  obsolete, do not use!
\def\caption@lsep@default{\caption@lsep@colon}
\newcommand*\DeclareCaptionJustification[2]{%  bugfixed v3.0a
  \global\@namedef{caption@hj@#1}{#2}}
\@onlypreamble\DeclareCaptionJustification
\newcommand*\caption@setjustification[1]{%
  \@ifundefined{caption@hj@#1}%
    {\PackageError{caption}{Undefined caption justification `#1'}{\caption@eh}}%
    {\expandafter\let\expandafter\caption@hj\csname caption@hj@#1\endcsname}}
\newcommand\caption@centerfirst{%
  \edef\caption@normaladjust{%
    \leftskip\the\leftskip
    \rightskip\the\rightskip
    \parfillskip\the\parfillskip\relax}%
  \leftskip\z@\@plus -1fil%
  \rightskip\z@\@plus 1fil%
  \parfillskip\z@skip
  \noindent\hskip\z@\@plus 2fil%
  \@setpar{\@@par\@restorepar\caption@normaladjust}}
\newcommand\caption@centerlast{%
  \leftskip\z@\@plus 1fil%
  \rightskip\z@\@plus -1fil%
  \parfillskip\z@\@plus 2fil\relax}
\DeclareCaptionJustification{justified}{}
\DeclareCaptionJustification{centering}{\centering}
\DeclareCaptionJustification{centerfirst}{\caption@centerfirst}
\DeclareCaptionJustification{centerlast}{\caption@centerlast}
\DeclareCaptionJustification{raggedleft}{\raggedleft}
\DeclareCaptionJustification{raggedright}{\raggedright}
\def\caption@hj@default{\caption@hj@justified}
\DeclareCaptionJustification{Centering}{%
  \caption@ragged\Centering\centering}
\DeclareCaptionJustification{RaggedLeft}{%
  \caption@ragged\RaggedLeft\raggedleft}
\DeclareCaptionJustification{RaggedRight}{%
  \caption@ragged\RaggedRight\raggedright}
\newcommand*\caption@ragged[2]{%
  \@ifundefined{caption\string#1}{%
    \PackageWarning{caption}{%
      Cannot locate the `ragged2e' package, therefore\MessageBreak
      substituting \string#2 for \string#1\MessageBreak}%
    \global\@namedef{caption\string#1}}{}%
  #2}
\AtBeginDocument{\IfFileExists{ragged2e.sty}{%
  \RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}{}}
\newcommand\DeclareCaptionFont[2]{%  bugfixed v3.0a
  \define@key{caption@fnt}{#1}[]{\g@addto@macro\caption@tempa{#2}}}
\@onlypreamble\DeclareCaptionFont
\newcommand*\caption@setfont[2]{%
  \let\caption@tempa\@empty
  \begingroup
    \setkeys{caption@fnt}{#2}%
  \endgroup
  \expandafter\let\csname caption#1\endcsname\caption@tempa}
\DeclareCaptionFont{default}{}
\DeclareCaptionFont{scriptsize}{\scriptsize}
\DeclareCaptionFont{footnotesize}{\footnotesize}
\DeclareCaptionFont{small}{\small}
\DeclareCaptionFont{normalsize}{\normalsize}
\DeclareCaptionFont{large}{\large}
\DeclareCaptionFont{Large}{\Large}
\DeclareCaptionFont{up}{\upshape}
\DeclareCaptionFont{it}{\itshape}
\DeclareCaptionFont{sl}{\slshape}
\DeclareCaptionFont{sc}{\scshape}
\DeclareCaptionFont{md}{\mdseries}
\DeclareCaptionFont{bf}{\bfseries}
\DeclareCaptionFont{rm}{\rmfamily}
\DeclareCaptionFont{sf}{\sffamily}
\DeclareCaptionFont{tt}{\ttfamily}
\newcommand*\caption@setposition[1]{%  improved v3.0a
  \caption@ifinlist{#1}{t,top,above}{%
    \let\caption@position\@firstoftwo
  }{\caption@ifinlist{#1}{b,bottom,below,default}{%
    \let\caption@position\@secondoftwo
  }{\caption@ifinlist{#1}{a,auto}{%
    \let\caption@position\@undefined
  }{%
    \PackageError{caption}{Undefined caption position `#1'}{\caption@eh}%
  }}}}
\def\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup}
\def\caption@setuptype[#1]#2{%  bugfixed v3.0a
  \@ifundefined{caption@typ@#1}%
    {\@namedef{caption@typ@#1}{#2}}%
    {\expandafter\l@addto@macro\csname caption@typ@#1\endcsname{,#2}}}
\def\caption@setup{\setkeys{caption}}
\def\caption@esetup#1{%
  \edef\caption@tempa{\noexpand\caption@setup{#1}}%
  \caption@tempa}
\def\caption@settype#1{%
  \@ifundefined{caption@typ@#1}{}{%
    \caption@esetup{\csname caption@typ@#1\endcsname}}}%
\let\caption@setfloattype\caption@settype%  new v3.0a
\newcommand*\clearcaptionsetup[1]{\@nameundef{caption@typ@#1}}
\newcommand*\showcaptionsetup[2][]{%
  \def\caption@tempa{#1}%
  \ifx\caption@tempa\@empty
    \def\caption@tempa{Caption\space}%
  \else
    \def\caption@tempa{#1 Caption\space}%
  \fi
  \GenericWarning{\caption@tempa}{%
    \caption@tempa Info: KV list on `#2'\MessageBreak
    Data: (%
    \@ifundefined{caption@typ@#2}{%
      % Empty -- print nothing.
    }{%
      \@nameuse{caption@typ@#2}%
    }%
    )}}
\newcommand\caption@beginhook{}
\newcommand\caption@endhook{}
\newcommand\AtBeginCaption{\l@addto@macro\caption@beginhook}
\newcommand\AtEndCaption{\l@addto@macro\caption@endhook}
\newcommand\DeclareCaptionOption{%
  \@ifstar{\caption@declareoption\AtEndOfPackage}{\caption@declareoption\@gobble}}
\newcommand*\caption@declareoption[2]{%
  #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}}
\@onlypreamble\DeclareCaptionOption
\@onlypreamble\caption@declareoption
\DeclareCaptionOption{default}[]{%
  \caption@setup{style=default,position=default,aboveskip=10pt,belowskip=0pt}}
\DeclareCaptionOption{style}{\caption@setstyle{#1}}
\DeclareCaptionOption{format}{\caption@setformat{#1}}
\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
\DeclareCaptionOption{justification}{\caption@setjustification{#1}}
\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}% changed v3.0a
\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
\DeclareCaptionOption{margin}{\caption@setmargin{#1}}
\DeclareCaptionOption{width}{\caption@setwidth{#1}}
\DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}
\DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}}
\DeclareCaptionOption{parindent}[\parindent]{\setlength\captionparindent{#1}}% changed v3.0b
\DeclareCaptionOption{hangindent}[0pt]{\setlength\captionhangindent{#1}}% changed v3.0b
\DeclareCaptionOption{parskip}[5pt]{\AtBeginCaption{\setlength\parskip{#1}}}
\DeclareCaptionOption{singlelinecheck}[1]{\caption@setbool{slc}{#1}}
\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
\DeclareCaptionOption{position}{\caption@setposition{#1}}
\DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}}% new v3.0b
\DeclareCaptionOption{debug}{\def\caption@debug{#1}}
\captionsetup{style=default,position=default,listof=1,debug=0}
\newcommand\caption@fixposition{%
  \ifx\caption@position\@undefined
    \caption@autoposition
  \fi}
\newcommand\caption@autoposition{% bugfixed v3.0a
  \ifvmode
    \ifodd\caption@debug\relax
      \edef\caption@tempa{\the\prevdepth}%
      \PackageInfo{caption}{\protect\prevdepth=\caption@tempa}%
    \fi
    \ifdim\prevdepth>-\p@
      \let\caption@position\@secondoftwo
    \else
      \let\caption@position\@firstoftwo
    \fi
  \else
    \ifodd\caption@debug\relax
      \PackageInfo{caption}{no \protect\prevdepth}%
    \fi
    \let\caption@position\@secondoftwo
  \fi}
\newcommand\caption@iftop{% bugfixed v3.0a
  \ifx\caption@position\@firstoftwo
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}
\newcommand\caption@make[2]{%
  \caption@@make{\caption@lfmt{#1}{#2}}}
\newcommand\caption@@make[2]{%
  \caption@beginhook
  \caption@calcmargin
  \advance\captionmargin by \captionindent
  \advance\captionwidth by -\captionindent
  \hskip\captionmargin
  \vbox{\hsize=\captionwidth
    \ifdim\captionindent=\z@\else
      \hskip-\captionindent
    \fi
    \caption@ifslc{%
      \ifx\caption@sls\@empty\else
        \caption@beginslc
        \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
        \ifdim\wd\@tempboxa >\hsize
          \caption@endslc
        \else
          \caption@endslc
          \caption@esetup\caption@sls
        \fi
      \fi}{}%
    \captionsize\captionfont\strut
    \caption@@@make{#1}{#2}}%
  \caption@endhook
  \global\caption@starfalse}
\newcommand\caption@calcmargin{%
  \ifcaption@width
    \captionmargin\hsize
    \advance\captionmargin by -\captionwidth
    \divide\captionmargin by 2
  \else
    \captionwidth\hsize
    \advance\captionwidth by -2\captionmargin
  \fi
  \ifodd\caption@debug\relax
    \PackageInfo{caption}{\protect\hsize=\the\hsize,
      \protect\margin=\the\captionmargin,
      \protect\width=\the\captionwidth}%
  \fi}
\newcommand\caption@beginslc{%
  \begingroup
  \let\label\@gobble\let\@footnotetext\@gobble
  \def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}}
\newcommand\caption@endslc{%
  \endgroup}
\newcommand\caption@@@make[2]{%
  \ifcaption@star
    \let\caption@lfmt\@gobbletwo
    \let\caption@lsep\relax
  \fi
  \def\caption@tempa{#2}%
  \def\caption@tempb{\ignorespaces}%
  \ifx\caption@tempa\caption@tempb
    \let\caption@tempa\@empty
  \fi
  \ifx\caption@tempa\@empty
    \let\caption@lsep\relax
  \fi
  \def\caption@@par{%
    \parindent\captionparindent\hangindent\captionhangindent}%
  \@setpar{\@@par\caption@@par}\caption@@par
  \caption@hj\captionsize\captionfont
  \caption@fmt{{\captionlabelfont#1}}%
              {{\captionlabelfont\caption@lsep}}%
              {{\captiontextfont\nobreak\hskip\z@skip#2\par}}}
\DeclareCaptionOption{config}[caption]{%
   \InputIfFileExists{#1.cfg}{\typeout{*** Local configuration file
                                       #1.cfg used ***}}%
                             {\PackageWarning{caption}{Configuration
                               file #1.cfg not found}}}
\DeclareCaptionOption*{figureposition}{\captionsetup[figure]{position=#1}}%  new v3.0a
\DeclareCaptionOption*{tableposition}{\captionsetup[table]{position=#1}}%    new v3.0a
\DeclareCaptionOption*{normal}[]{\caption@setformat{normal}}
\DeclareCaptionOption*{isu}[]{\caption@setformat{hang}}
\DeclareCaptionOption*{hang}[]{\caption@setformat{hang}}
\DeclareCaptionOption*{center}[]{\caption@setjustification{centering}}
\DeclareCaptionOption*{anne}[]{\caption@setjustification{centerlast}}
\DeclareCaptionOption*{centerlast}[]{\caption@setjustification{centerlast}}
\DeclareCaptionOption*{nooneline}[]{\caption@setbool{slc}{0}}
\DeclareCaptionOption*{scriptsize}[]{\def\captionfont{\scriptsize}}
\DeclareCaptionOption*{footnotesize}[]{\def\captionfont{\footnotesize}}
\DeclareCaptionOption*{small}[]{\def\captionfont{\small}}
\DeclareCaptionOption*{normalsize}[]{\def\captionfont{\normalsize}}
\DeclareCaptionOption*{large}[]{\def\captionfont{\large}}
\DeclareCaptionOption*{Large}[]{\def\captionfont{\Large}}
\DeclareCaptionOption*{up}[]{\l@addto@macro\captionlabelfont\upshape}
\DeclareCaptionOption*{it}[]{\l@addto@macro\captionlabelfont\itshape}
\DeclareCaptionOption*{sl}[]{\l@addto@macro\captionlabelfont\slshape}
\DeclareCaptionOption*{sc}[]{\l@addto@macro\captionlabelfont\scshape}
\DeclareCaptionOption*{md}[]{\l@addto@macro\captionlabelfont\mdseries}
\DeclareCaptionOption*{bf}[]{\l@addto@macro\captionlabelfont\bfseries}
\DeclareCaptionOption*{rm}[]{\l@addto@macro\captionlabelfont\rmfamily}
\DeclareCaptionOption*{sf}[]{\l@addto@macro\captionlabelfont\sffamily}
\DeclareCaptionOption*{tt}[]{\l@addto@macro\captionlabelfont\ttfamily}
\caption@setbool{ruled}{0}
\DeclareCaptionOption*{ruled}[]{\caption@setbool{ruled}{1}}
\newcommand*\DeclareCaptionPackage[1]{%
  \caption@setbool{pkt@#1}{1}%
  \DeclareCaptionOption*{#1}{\caption@setbool{pkt@#1}{##1}}}
\DeclareCaptionPackage{caption}
\DeclareCaptionPackage{float}
\DeclareCaptionPackage{listings}
\DeclareCaptionPackage{longtable}
\DeclareCaptionPackage{rotating}
\DeclareCaptionPackage{sidecap}
\DeclareCaptionPackage{supertabular}
\let\DeclareCaptionPackage\@undefined
\def\ProcessOptionsWithKV#1{% bugfixed v3.0a
  \let\@tempc\relax
  \let\caption@tempa\@empty
  \@for\CurrentOption:=\@classoptionslist\do{%
    \@ifundefined{KV@#1@\CurrentOption}%
    {}%
    {%
      \edef\caption@tempa{\caption@tempa,\CurrentOption,}%
      \@expandtwoargs\@removeelement\CurrentOption
        \@unusedoptionlist\@unusedoptionlist
    }%
  }%
  \edef\caption@tempa{%
    \noexpand\setkeys{#1}{%
      \caption@tempa\@ptionlist{\@currname.\@currext}%
    }%
  }%
  \caption@tempa
  \let\CurrentOption\@empty
  \AtEndOfPackage{\let\@unprocessedoptions\relax}}
\ProcessOptionsWithKV{caption}
\let\ProcessOptionsWithKV\@undefined
\def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}}
\newcommand*\caption@of[2]{\def\@captype{#2}#1}
\providecommand\ContinuedFloat{%
  \ifx\@captype\@undefined
    \@latex@error{\noexpand\ContinuedFloat outside float}\@ehd
  \else
    \addtocounter{\@captype}{\m@ne}%
  \fi}%
\newcommand*\caption@floatname[1]{\@nameuse{#1name}}
\newcommand*\caption@thefloat[1]{\@nameuse{the#1}}
\def\caption@letfloattype#1{%
  \def\caption@setfloattype##1{%
    \caption@settype{##1}\caption@settype{#1}}}
\newcommand*\caption@begin[1]{%
  \begingroup
  \caption@setfloattype{#1}%
  \@namedef{fnum@#1}{%
    \caption@lfmt{\caption@floatname{#1}}{\caption@thefloat{#1}}}%
  \caption@fixposition
  \global\let\caption@fixedposition\caption@position
  \caption@@begin{#1}}
\newcommand*\caption@beginex[1]{%
  \caption@begin{#1}%
  \caption@preparelof}
\newcommand*\caption@end{%
  \caption@@end
  \endgroup
  \let\caption@position\caption@fixedposition}
\let\caption@@begin\@gobble%  new v3.0a
\let\caption@@end\@empty%     new v3.0a
\newcommand*\caption@preparelof[1]{%  changed v3.0b
  \caption@ifbool{lof}%
    {\def\caption@tempa{#1}}%
    {\let\caption@tempa\@empty}%
  \ifx\caption@tempa\@empty
    \def\addcontentsline##1##2##3{}%
  \fi}
\caption@ifpkt@caption{
  \renewcommand\@makecaption[2]{%
    \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
    \ifnum\caption@debug>1 %
      \llap{$\caption@iftop\downarrow\uparrow$ }%
    \fi
    \caption@@make{#1}{#2}%
    \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}}
  \AtBeginDocument{%
    \@ifundefined{cc@caption}{%
      \def\caption@caption#1{%
        \@ifstar{\global\caption@startrue\@ifnextchar[{#1}{#1[]}}{#1}}%
      \let\caption@old\caption
      \def\caption{\caption@caption\caption@old}%
      \let\caption@@old\@caption
      \long\def\@caption#1[#2]#3{%
        \caption@beginex{#1}{#2}%
          \caption@@old{#1}[{#2}]{#3}%
        \caption@end}%
    }{%
      \PackageInfo{caption}{captcont package v2.0 detected}%
      \def\caption@caption#1{#1}%  added v3.0c
    }%
  }}{}
\AtEndOfPackage{\let\caption@ifpkt@caption\@undefined}%  bugfixed v3.0a
\newcommand*\caption@ifpackage[2]{%
  \let\next\@gobble
  \caption@ifpkt@caption{%
    \caption@ifbool{pkt@#1}{%
      \@ifundefined{#2}%
        {\let\next\AtBeginDocument}%
        {\let\next\@firstofone}}{}%
    \ifodd\caption@debug\relax
      \edef\caption@tempa{%
        \caption@ifbool{pkt@#1}{%
          \@ifundefined{#2}{AtBeginDocument}{firstofone}%
        }{gobble}}%
      \PackageInfo{caption}{#1 = \caption@ifbool{pkt@#1}{1}{0} %
           (\@ifundefined{#2}{not }{}loaded -> \caption@tempa)}%
    \fi
  }{}%
  \@nameundef{caption@ifpkt@#1}%  bugfixed v3.0a
  \next}
\AtEndOfPackage{\let\caption@ifpackage\@undefined}
\def\caption@setfloatposition{%
  \caption@setposition{\@fs@iftopcapt t\else b\fi}}
\caption@ifpackage{float}{float@caption}{%
  \ifx\float@caption\relax
  \else
    \PackageInfo{caption}{float package v1.2 (or newer) detected}%
    \let\caption@of@float\@gobble
    \renewcommand*\caption@of[2]{%
      \@ifundefined{fst@#2}{}{%
        \let\caption@of@float\@firstofone
        \@nameuse{fst@#2}\@float@setevery{#2}}%
      \def\@captype{#2}#1}%
    \renewcommand*\caption@floatname[1]{%
      \@nameuse{\@ifundefined{fname@#1}{#1name}{fname@#1}}}%
    \let\caption@@float\float@caption
    \long\def\float@caption#1[#2]#3{%
      \caption@beginex{#1}{#2}%
        \let\@fs@capt\caption@@make
        \caption@@float{#1}[{#2}]{#3}%
        \caption@of@float{%
          \def\caption@@make##1##2{\unvbox\@floatcapt}%
          \@makecaption{}{}}%
      \caption@end}%
    \renewcommand*\caption@setfloattype[1]{%  improved v3.0a
      \caption@fixfloat@c{#1}%
      \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
        \expandafter\let\expandafter\caption@fst\csname fst@#1\endcsname
        \edef\caption@fst{\noexpand\string\expandafter\noexpand\caption@fst}%
        \edef\caption@fst{\noexpand\@gobblefour\caption@fst}%
        \@ifundefined{caption@sty@\caption@fst}{}{\caption@setstyle\caption@fst}%
        \caption@setfloatposition%  changed v3.0b
      \fi
      \caption@settype{#1}}%
    \let\caption@float\caption
    \def\caption{%
      \ifx\@captype\@undefined
        \@latex@error{\noexpand\caption outside float}\@ehd
        \expandafter\@gobble
      \else
        \caption@fixfloat@c\@captype
      \fi
      \caption@float}%
    \def\caption@fixfloat@c#1{%
      \expandafter\let\expandafter\caption@tempa\csname @float@c@#1\endcsname
      \ifx\caption@tempa\relax
      \else\ifx\caption@tempa\float@caption
      \else\ifx\caption@tempa\@caption
      \else\ifx\caption@tempa\caption@@float
        \ifodd\caption@debug\relax
          \PackageInfo{caption}{\protect\@float@c@#1\space := \protect\float@caption}%
        \fi
        \expandafter\let\csname @float@c@#1\endcsname\float@caption
      \else
        \ifodd\caption@debug\relax
          \PackageInfo{caption}{\protect\@float@c@#1\space := \protect\@caption}%
        \fi
        \expandafter\let\csname @float@c@#1\endcsname\@caption
      \fi\fi\fi\fi}%
  \fi}
\caption@ifbool{ruled}{}{%
  \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space}}
\let\caption@ifruled\@undefined
\caption@ifpackage{listings}{lst@MakeCaption}{%
  \ifx\lst@MakeCaption\relax
  \else
    \PackageInfo{caption}{listings package v1.2 (or newer) detected}%
    \let\caption@lst@MakeCaption\lst@MakeCaption
    \def\lst@MakeCaption#1{%
      \let\caption@setfloattype\caption@settype
      \def\caption@autoposition{\caption@setposition{#1}}%
      \caption@begin{lstlisting}%
        \caption@lst@MakeCaption{#1}%
      \caption@end}%
  \fi}
\caption@ifpackage{longtable}{LT@makecaption}{%
  \ifx\LT@makecaption\relax
  \else
    \PackageInfo{caption}{longtable package v3.15 (or newer) detected}%
    \def\LT@makecaption#1#2#3{%
       \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\linewidth{%
         \caption@letfloattype{longtable}%
         \caption@begin{table}%
           \ifdim\LTcapwidth=4in \else
             \caption@setwidth\LTcapwidth
           \fi
           \caption@startrue#1\caption@starfalse
           \caption@@make{#2}{#3}%
           \endgraf\vskip\baselineskip
         \caption@end}%
       \hss}}}%
  \fi}
\caption@ifpackage{rotating}{@rotcaption}{%
  \ifx\@rotcaption\relax
  \else
    \PackageInfo{caption}{rotating package v2.0 (or newer) detected}%
    \let\caption@rot\rotcaption
    \def\rotcaption{\caption@caption\caption@rot}%
    \let\caption@@rot\@rotcaption
    \long\def\@rotcaption#1[#2]#3{%
      \caption@beginex{#1}{#2}%
        \caption@@rot{#1}[{#2}]{#3}%
      \caption@end}%
    \long\def\@makerotcaption#1#2{%
      \rotatebox{90}{%
        \begin{minipage}{.8\textheight}%
          \caption@@make{#1}{#2}%
        \end{minipage}%
      }\par
      \hspace{12pt}}%
  \fi}
\caption@ifpackage{sidecap}{endSC@FLOAT}{%
  \ifx\endSC@FLOAT\relax
  \else
    \PackageInfo{caption}{sidecap package v1.4d (or newer) detected}%
    \let\SC@caption=\caption
    \let\caption@SC@zfloat\SC@zfloat
    \def\SC@zfloat#1#2#3[#4]{%
      \caption@SC@zfloat{#1}{#2}{#3}[#4]%
      \global\let\SC@CAPsetup\@empty
      \renewcommand\captionsetup[1]{\g@addto@macro\SC@CAPsetup{,##1}}%
      \let\caption@old\caption
      \def\caption{\caption@caption\caption@old}%
    }%
    \let\caption@endSC@FLOAT\endSC@FLOAT
    \def\endSC@FLOAT{%
      \caption@setmargin\z@
      \@ifundefined{SC@justify}{}{%
        \ifx\SC@justify\@empty\else
          \let\caption@hj\SC@justify
          \let\SC@justify\@empty
        \fi}%
      \caption@esetup\SC@CAPsetup
      \caption@letfloattype{SC\@captype}%
      \caption@endSC@FLOAT}%
  \fi}
\def\caption@setSTposition{%
  \caption@setposition{\if@topcaption t\else b\fi}}
\caption@ifpackage{supertabular}{ST@caption}{%
  \ifx\ST@caption\relax
  \else
    \PackageInfo{caption}{supertabular package detected}%
  \let\caption@ST\ST@caption
  \long\def\ST@caption#1[#2]#3{\par%  bugfixed v3.0a
    \caption@letfloattype{supertabular}%
    \let\caption@fixposition\caption@setSTposition
    \caption@beginex{#1}{#2}%
      \addcontentsline{\csname ext@#1\endcsname}{#1}%
                      {\protect\numberline{%
                          \csname the#1\endcsname}{\ignorespaces #2}}%
      \@parboxrestore
      \normalsize
      \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
    \caption@end}%
  \fi}
\AtBeginDocument{\let\scr@caption\caption}
\endinput
%%
%% End of file `caption.sty'.
