%%
%% This is file `caption2.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% caption2.dtx  (with options: `package')
%% 
%% Copyright (C) 1994-95 Harald Axel Sommerfeldt
%% 
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption2}[1995/10/09 v2.0 caption package (AS)]
\typeout{Package: caption v2.0(BETA) <1995/10/09> (Harald Sommerfeldt)}
\let\caption@message\undefined
\newcommand*\caption@package[1]{%
  \ifx\caption@message\undefined
    \message{\space\space\space\space\space\space\space\space\space
             packages detected:}
    \let\caption@message\empty
  \fi
  \message{#1}}
\newlength\realcaptionwidth
\newsavebox\captionbox
\newcommand*\captionsize{}
\newcommand*\captionfont{\captionsize}
\newcommand*\captionlabelfont{}
\newcommand*\captionlabeldelim{:}
\newdimen\captionlabelsep
  \sbox\captionbox{ }
  \setlength\captionlabelsep{\wd\captionbox}
\newdimen\captionmargin
\newdimen\captionwidth
\newdimen\captionindent
\newif\ifonelinecaptions
\newif\iftakecaptionwidth
\newcommand*\setcaptionmargin[1]{%
  \setlength\captionmargin{#1}%
  \takecaptionwidthfalse}
\newcommand*\setcaptionwidth[1]{%
  \setlength\captionwidth{#1}%
  \takecaptionwidthtrue}
\newcommand\newcaptionstyle[2]{%
  \expandafter\ifx\csname caption@@#1\endcsname\relax
    \defcaptionstyle{#1}{#2}%
  \else
    \PackageError{caption}{Caption style `#1' already defined}{}%
  \fi}
\newcommand\renewcaptionstyle[2]{%
  \expandafter\ifx\csname caption@@#1\endcsname\relax
    \PackageError{caption}{Caption style `#1' undefined}{}%
  \else
    \defcaptionstyle{#1}{#2}%
  \fi}
\newcommand\defcaptionstyle[2]{%
  \@namedef{caption@@#1}{#2}}
\newcommand*\dummycaptionstyle[2]{%
  \defcaptionstyle{#1}{%
    \expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname%
                    \csname caption@@#1\endcsname
      \PackageError{caption}{You can't use the caption style `#1' directy}{%
        The caption style `#1' is only a dummy and does not really exists.%
        \MessageBreak You have to redefine it (with \protect\renewcaptionstyle)
        before you can select\MessageBreak it with \protect\captionstyle.}%
    \else
      #2\usecaptionstyle{\caption@style}%
    \fi}}
\newcaptionstyle{normal}{\caption@make{normal}}
\newcaptionstyle{center}{\caption@make{center}}
\newcaptionstyle{flushleft}{\caption@make{flushleft}}
\newcaptionstyle{flushright}{\caption@make{flushright}}
\newcaptionstyle{centerlast}{\caption@make{centerlast}}
\newcaptionstyle{hang}{\caption@make{hang}}
\newcaptionstyle{indent}{\caption@make{indent}}
\newcommand*\captionstyle[1]{%
  \expandafter\ifx\csname caption@@#1\endcsname\relax
    \PackageError{caption}{Undefined caption style `#1'}{}%
  \else
    \def\caption@style{#1}%
  \fi}
\DeclareOption{normal}{\captionstyle{normal}}
\DeclareOption{center}{\captionstyle{center}}
\DeclareOption{flushleft}{\captionstyle{flushleft}}
\DeclareOption{flushright}{\captionstyle{flushright}}
\DeclareOption{centerlast}{\captionstyle{centerlast}}
\DeclareOption{anne}{\ExecuteOptions{centerlast}}
\DeclareOption{hang}{\captionstyle{hang}}
\DeclareOption{isu}{\ExecuteOptions{hang}}
\DeclareOption{indent}{\captionstyle{indent}}
\DeclareOption{oneline}{\onelinecaptionstrue}
\DeclareOption{nooneline}{\onelinecaptionsfalse}
\DeclareOption{scriptsize}{\renewcommand*\captionsize{\scriptsize}}
\DeclareOption{footnotesize}{\renewcommand*\captionsize{\footnotesize}}
\DeclareOption{small}{\renewcommand*\captionsize{\small}}
\DeclareOption{normalsize}{\renewcommand*\captionsize{\normalsize}}
\DeclareOption{large}{\renewcommand*\captionsize{\large}}
\DeclareOption{Large}{\renewcommand*\captionsize{\Large}}
\DeclareOption{up}{\renewcommand*\captionlabelfont{\upshape}}
\DeclareOption{it}{\renewcommand*\captionlabelfont{\itshape}}
\DeclareOption{sl}{\renewcommand*\captionlabelfont{\slshape}}
\DeclareOption{sc}{\renewcommand*\captionlabelfont{\scshape}}
\DeclareOption{md}{\renewcommand*\captionlabelfont{\mdseries}}
\DeclareOption{bf}{\renewcommand*\captionlabelfont{\bfseries}}
\DeclareOption{rm}{\renewcommand*\captionlabelfont{\rmfamily}}
\DeclareOption{sf}{\renewcommand*\captionlabelfont{\sffamily}}
\DeclareOption{tt}{\renewcommand*\captionlabelfont{\ttfamily}}
\DeclareOption{boxed}{\AtEndOfPackage{%
  \ifx\caption@@ruled\undefined
    \PackageWarningNoLine{caption}{%
      Option `boxed' is set but there is no `float' package\MessageBreak
      around here, so this option will be totally ignored}
  \else
    \dummycaptionstyle{boxed}{}%
  \fi}}
\DeclareOption{ruled}{\AtEndOfPackage{%
  \ifx\caption@@ruled\undefined
    \PackageWarningNoLine{caption}{%
      Option `ruled' is set but there is no `float' package\MessageBreak
      around here, so this option will be totally ignored}
  \else
    \dummycaptionstyle{ruled}{\onelinecaptionsfalse\setcaptionmargin{0pt}}%
  \fi}}
\DeclareOption{longtable}{\AtEndOfPackage{%
  \ifx\caption@@longtable\undefined
    \PackageWarningNoLine{caption}{%
      Option `longtable' is set but there is no `longtable' package\MessageBreak
      around here, so this option will be totally ignored}
  \else
    \dummycaptionstyle{longtable}{}%
  \fi}}
\DeclareOption*{\AtEndOfPackage{%
  \InputIfFileExists{\CurrentOption.caption}{}{%
    \PackageError{caption}{File `\CurrentOption.caption' not found}{%
    You selected the unknown package option `\CurrentOption', so I
    thought you want to\MessageBreak
    input the definition file `\CurrentOption.caption' here
    -- but there is no one!}}}}
\ExecuteOptions{normal,oneline}
\ProcessOptions
\renewcommand\@makecaption[2]{%
  \vskip\abovecaptionskip
  \realcaptionwidth\linewidth
  \def\captionlabel{#1}%
  \def\captiontext{#2}%
  \usecaptionstyle{\caption@style}%
  \vskip\belowcaptionskip}
\newcommand*\caption@canterr[1]{%
  \PackageError{caption}{You can't use \protect#1
    in normal text}{The usage of \protect#1 is only
    allowed inside code declared with\MessageBreak \protect\defcaptionstyle,
    \protect\newcaptionstyle \space or \protect\renewcaptionstyle.}}
\newcommand\onelinecaption[2]{%
  \ifx\captiontext\undefined
    \caption@canterr{\onelinecaption}%
  \else
    \def\caption@temp{#2}%
    \ifonelinecaptions
      \sbox\captionbox{#1}%
      \ifdim\wd\captionbox >\realcaptionwidth
        \caption@temp
      \else
        {\centering\usebox{\captionbox}\par}%
      \fi
    \else
      \caption@temp
    \fi
    \let\caption@temp\undefined
  \fi}
\newcommand*\usecaptionmargin{%
  \ifx\captiontext\undefined
    \caption@canterr{\usecaptionmargin}%
  \else
    \iftakecaptionwidth
      \leftskip\realcaptionwidth
      \advance\leftskip by -\captionwidth
      \divide\leftskip by 2
      \rightskip\leftskip
      \realcaptionwidth\captionwidth
    \else
      \leftskip\captionmargin
      \rightskip\captionmargin
      \advance\realcaptionwidth by -2\captionmargin
    \fi
  \fi}
\newcommand*\usecaptionstyle[1]{%
  \ifx\captiontext\undefined
    \caption@canterr{\usecaptionstyle}%
  \else
    \@ifundefined{caption@@#1}%
      {\PackageError{caption}{Caption style `#1' undefined}{}}%
      {\@nameuse{caption@@#1}}
  \fi}
\newcommand*\caption@make[1]{%
  \usecaptionmargin\captionfont
  \def\caption@label{%
    {\captionlabelfont\captionlabel\captionlabeldelim}%
    \hskip\captionlabelsep}%
  \onelinecaption{\caption@label\captiontext}%
    {\@nameuse{caption@@@#1}}}
\newcommand*\caption@@@normal{%
  \caption@label\captiontext\par}
\newcommand*\caption@@@center{%
  \parbox[t]{\realcaptionwidth}{\centering
  \caption@label\captiontext\par}}%
\newcommand*\caption@@@flushleft{%
  \parbox[t]{\realcaptionwidth}{\raggedright
  \caption@label\captiontext\par}}%
\newcommand*\caption@@@flushright{%
  \parbox[t]{\realcaptionwidth}{\raggedleft
  \caption@label\captiontext\par}}%
\newcommand*\caption@@@centerlast{%
  \advance\leftskip by 0pt plus 1fil%
  \advance\rightskip by 0pt plus -1fil%
  \parfillskip0pt plus 2fil%
  \caption@label\captiontext\par}
\newcommand*\caption@@@hang{%
  \sbox\captionbox{\caption@label}%
  \hangindent\wd\captionbox\noindent
  \usebox\captionbox\captiontext\par}
\newcommand*\caption@@@indent{%
  \hangindent\captionindent\noindent
  \caption@label\captiontext\par}
\ifx\floatc@plain\undefined
\else
  \caption@package{float}
  \newcommand\caption@floatc[3]{%
    \realcaptionwidth\linewidth
    \def\captionlabel{#2}%
    \def\captiontext{#3}%
    \usecaptionstyle{#1}}
  \renewcommand\floatc@plain{\caption@floatc{\caption@style}}
  \dummycaptionstyle{boxed}{\def\captionlabelfont{\bfseries}}
  \newcommand\floatc@boxed{\caption@floatc{boxed}}
  \let\caption@boxed\fs@boxed
  \renewcommand\fs@boxed{\let\floatc@plain\floatc@boxed\caption@boxed}
  \newcaptionstyle{ruled}{{\bfseries\captionlabel} \captiontext\par}
  \renewcommand*\floatc@ruled{\caption@floatc{ruled}}
\fi
\ifx\LT@makecaption\undefined
\else
  \caption@package{longtable}
  \dummycaptionstyle{longtable}{\setcaptionwidth\LTcapwidth}
  \renewcommand\LT@makecaption[3]{%
    \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\linewidth{%
    \realcaptionwidth\linewidth
    \ifx#1\@gobble
      \def\captionlabel{}%
      \def\captionlabeldelim{}%
      \captionlabelsep\z@
    \else
      \def\captionlabel{#2}%
    \fi
    \def\captiontext{#3}%
    \usecaptionstyle{longtable}%
    \endgraf\vskip\baselineskip}%
    \hss}}}
\fi
\newcommand*\addtosubcaption[1]{}
\@ifundefined{@makesubfigurecaption}{}{%
  \caption@package{subfigure}
  \newcommand*\subcapstyle[1]{%
    \expandafter\ifx\csname caption@@#1\endcsname\relax
      \PackageError{caption}{Undefined caption style `#1'}{}%
    \else
      \def\caption@substyle{#1}%
    \fi}
  \subcapstyle{normal}
  \ifsubcaphang
    \subcapstyle{hang}
  \fi
  \ifsubcapcenter
    \subcapstyle{center}
  \fi
  \ifsubcapcenterlast
    \subcapstyle{centerlast}
  \fi
  \newif\iftakesubfigcapwidth
  \newcommand*\subfigcapwidth{0pt}
  \newlength\subcapindent
  \newcommand*\setsubcapmargin[1]{%
    \renewcommand*\subcapfigmargin{#1}%
    \takesubfigcapwidthfalse}
  \newcommand*\setsubcapwidth[1]{%
    \renewcommand*\subcapfigwidth{#1}%
    \takesubfigcapwidthtrue}
  \renewcommand\@makesubfigurecaption[2]{%
    \realcaptionwidth\@tempdima
    \def\captionlabel{#1}%
    \def\captiontext{#2}%
    \let\captionfont\subcapsize
    \let\captionlabelfont\relax
    \let\captionlabeldelim\empty
    \captionlabelsep0pt
    \ifsubcapnooneline\onelinecaptionsfalse\else\onelinecaptionstrue\fi
    \iftakesubfigcapwidth\takecaptionwidthtrue\else\takecaptionwidthfalse\fi
    \setlength\captionmargin{\subfigcapmargin}%
    \setlength\captionwidth{\subfigcapwidth}%
    \captionindent\subcapindent
    \hbox{\parbox[t]\@tempdima{\strut\usecaptionstyle{\caption@substyle}}}}
  \renewcommand*\addtosubcaption[1]{%
    \let\caption@makesubfigurecaption\@makesubfigurecaption
    \renewcommand\@makesubfigurecaption[2]{%
      #1\caption@makesubfigurecaption}
    \let\@makesubtablecaption\@makesubfigurecaption}}
\ifx\caption@message\undefined
\else\message{^^J}\let\caption@message\undefined\fi
\let\caption@package\undefined
\let\caption@subcapsize\undefined
\endinput
%%
%% End of file `caption2.sty'.
