Revision 9eba034662db17ae6f414fac22b555ec7891a35a authored by hieuhoang1972 on 25 July 2007, 10:05:34 UTC, committed by hieuhoang1972 on 25 July 2007, 10:05:34 UTC
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1435 1f5c12ca-751b-0410-a591-d2e778427230
1 parent 1b09cb1
Raw File
caption2.dtx
% \iffalse meta-comment
% 
% This is file `caption2.dtx'.
% 
% Copyright (C) 1994-2005 Axel Sommerfeldt (caption@sommerfee.de)
% 
% --------------------------------------------------------------------------
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Axel Sommerfeldt.
% 
% This work consists of the files caption.ins, caption.dtx,
% caption2.dtx, caption.xml, and anleitung.tex and the derived files
% caption.sty, caption2.sty, caption3.sty, and manual.tex.
% 
% \fi
% \CheckSum{843}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\documentclass{ltxdoc}
\setlength\parindent{0pt}
\setlength\parskip{\smallskipamount}
%
\ifx\pdfoutput\undefined\else
  \ifcase\pdfoutput\else
    \usepackage{mathptmx,courier}
    \usepackage[scaled=0.90]{helvet}
  \fi
\fi
%
\usepackage{caption2}[2004/04/16]
%
%<+driver>\OnlyDescription
%
\begin{document}
  \DocInput{caption2.dtx}
\end{document}
%</driver>
% \fi
%
% \newcommand*{\purerm}[1]{{\upshape\mdseries\rmfamily #1}}
% \newcommand*{\puresf}[1]{{\upshape\mdseries\sffamily #1}}
% \newcommand*{\purett}[1]{{\upshape\mdseries\ttfamily #1}}
% \let\package\puresf\def\thispackage{\package{caption2}}
% \let\env\purett \let\opt\purett
%
% \GetFileInfo{caption2.sty}
% \title{The \thispackage\ package\thanks{This package has version number
%        \fileversion, last revised \filedate.}}
% \author{Axel Sommerfeldt\\\texttt{caption@sommerfee.de}}
% \date{2005/11/02}
% \maketitle
%
% \changes{v2.0}{ 9 Oct 95}{New experimental version: Many new commands and features}
% \changes{v2.0}{ 9 Oct 95}{Support of the longtable package added}
% \changes{v2.1}{20 Feb 02}{Revised: New commands and options}
% \changes{v2.1}{26 Feb 02}{Adapted to version 2.1 of the subfigure package}
% \changes{v2.1a}{12 Nov 03}{Some minor bug fixes and improved compatibility to v2.0}
% \changes{v2.1b}{16 Apr 04}{Some minor bug fixes and improved compatibility to v2.0}
% \changes{v2.1c}{10 May 04}{Some minor bug fixes and improved compatibility to v2.0}
% \changes{v2.1d}{ 3 Oct 05}{Some superfluous brackets removed; warning added}
%
% \providecommand\LaTeXcomp{The \LaTeX{} Companion}
%
% \section*{This package is obsolete!}
%
% The \package{caption2} package used to be an experimental side-version of
% the regular \package{caption} package. It was made public as beta test version
% without documentation in 1995 because of the demand for new features and
% adaptations to other packages like the \package{longtable} and
% \package{subfigure} package.
%
% Even in the next seven years I found no time to reintegrate some of the
% well-tried features into the regular \package{caption} package. So I
% decided to release a version $2.1$ of the \package{caption2} package in 2002
% instead, which included some minor bug fixes and adaptations to the new
% version $2.1$ of the \package{subfigure} package. Furthermore I started
% to write a documentation for this package, but unfortunately did not get
% very far with this\ldots
%
% In 2003 I finally found some (more) time, so a new regular release $3.0$
% of the \package{caption} package could be build with massive help from
% Frank Mittelbach\cite{A-W:GMS94} and Steven Cochran\cite{subfigure}.
% It was released in December 2003 and superseded the neglected
% \package{caption2} package.
%
% {\small (In parallel, Steven Cochran released the \package{subfig} package which
% superseded the \package{subfigure} package.)}
%
% So please don't use this package for new documents. It's old, it's obsolete
% and it starts to begin smell bad!
% Please ignore all hints in books or other documents which try to tell you
% that the \package{caption2} package should be used instead of the
% \package{caption} package -- these hints are outdated since December 2003.
%
% \section*{How to migrate to the regular \package{caption} package?}
%
% Usually replacing \package{caption2} by \package{caption} is sufficient
% because the \package{caption} package emulates most of the options and
% commands of the \package{caption2} package.
% If you get some errors or wired results afterwards, please take a closer
% look at the \package{caption} package documentation which will hopefully
% help you clearing these problems.
% If all this should fail you can write me an e-mail asking for help.
%
% \section*{What will happen to this package?}
%
% The \package{caption2} package is still some kind of supported, that means
% it will be part of future releases and bugs will still be fixed so existing
% documents using this package will still compile.
% But it will \emph{not} be enhanced in the future or adapted to future versions
% of foreign packages.
%
% This means migrating to the actual \package{caption} package should not be
% necessary for old documents.
%
% \StopEventually{}
%
% \DoNotIndex{\\,\_,\ ,\@@par}
% \DoNotIndex{\@classoptionslist,\@currext,\@currname}
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@expandtwoargs}
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
% \DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined,\@latex@error}
% \DoNotIndex{\@namedef,\@nameuse}
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempb,\@tempc}
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
% \DoNotIndex{\p@,\z@}
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance}
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\bgroup,\box}
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
% \DoNotIndex{\edef,\egroup,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
% \DoNotIndex{\fi,\footnotesize,\global}
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
% \DoNotIndex{\if,\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
% \DoNotIndex{\ifx,\ignorespaces,\itshape}
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
% \DoNotIndex{\next,\nobreakspace,\noexpand,\noindent,\numberline}
% \DoNotIndex{\normalsize,\or,\par,\parbox,\parfillskip}
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\providecommand}
% \DoNotIndex{\quad}
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
% \DoNotIndex{\rightskip,\rmfamily}
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
% \DoNotIndex{\small,\string,\space,\strut}
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
% \DoNotIndex{\undefined,\unvbox,\uparrow,\upshape,\usebox,\usepackage}
% \DoNotIndex{\vbox,\vsize,\vskip,\wd,\width,\z@skip}
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
% \DoNotIndex{\ProcessOptions,\ProvidesPackage}
%
% \clearpage
%
% \section{The Implementation}
% \iffalse
%<*package>
% \fi
%
% \subsection{Identificaton}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption2}[2005/10/03 v2.1d Customising captions (AS)]
\PackageWarning{caption2}{%
  THIS PACKAGE IS OBSOLETE, PLEASE USE caption INSTEAD}
%    \end{macrocode}
%
% \subsection{Preliminary declarations}
%
% \begin{macro}{\captionfont}
% \begin{macro}{\captionlabelfont}
% \cs{captionfont} and \cs{captionlabelfont} will hold the font specifications for the caption.
%    \begin{macrocode}
\newcommand*\captionfont{}
\newcommand*\captionlabelfont{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionlabeldelim}
% \begin{macro}{\captionlabelsep}
% \cs{captionlabeldelim} \& \cs{captionlabelsep} will hold the iterim
% space between caption label and text.
% (\cs{captionlabeldelim} will be typeset within \cs{captionlabelfont},
%  \cs{captionlabelsep} not.)
%    \begin{macrocode}
\newcommand*\captionlabeldelim{}
\newcommand*\captionlabelsep{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionsize}
% The macro \cs{captionsize} is obsolete since v1.4 of the \textsf{caption} package,
% but we still support it to provide backward compatibility.
%    \begin{macrocode}
\newcommand*\captionsize{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionmargin}
% \begin{macro}{\captionwidth}
% \begin{macro}{\ifcaptionwidth}
% Either \cs{captionmargin} (with specifies an extra margin) or \cs{captionwidth}
% (with specifies an explicit width) can be set, therefore we need the flag \cs{ifcaptionwidth}
% to determine with parameter we should pay attention to.
%    \begin{macrocode}
\newdimen\captionmargin
\newdimen\captionwidth
\newif\ifcaptionwidth
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionindent}
% \cs{captionindent} will be used in caption style \texttt{indent} and specifies the indention
% after the first line.
%    \begin{macrocode}
\newdimen\captionindent
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifcaptionlabel}
% \begin{macro}{\ifonelinecaptions}
% \begin{macro}{\ifignoreLTcapwidth}
% More flags. If \cs{ifcaptionlabel} is not set the caption label should be suppressed;
% we need this flag to support the \cs{caption*} command.
% If \cs{ifonelinecaptions} is set we support the \LaTeX\ base style 'one line captions',
% that means the caption will be typeset centered if it fits to one line.
% If \cs{ifignoreLTcapwidth} is set we ignore the \cs{LTcapwidth} of \textsf{longtable}.
% \changes{v2.1}{20 Feb 02}{New ifs \cs{ifcaptionlabel} and \cs{ifignoreLTcapwidth}}
%    \begin{macrocode}
\newif\ifcaptionlabel\captionlabeltrue
\newif\ifonelinecaptions
\newif\ifignoreLTcapwidth
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\setcaptionmargin}
% \begin{macro}{\setcaptionwidth}
% User-friendly commands to set the caption margin resp.\ width.
% Note that they additionally set the \cs{ifcaptionwidth} flag.
%    \begin{macrocode}
\newcommand*\setcaptionmargin{%
  \captionwidthfalse
  \setlength\captionmargin}
\newcommand*\setcaptionwidth{%
  \captionwidthtrue
  \setlength\captionwidth}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\normalcaptionparams}
% \cs{normalcaptionparams} resets all caption related parameters to it's normal default values.
% \cs{captionfont} will be set to \cs{captionsize} so setting the obsolete \cs{captionsize} will still work.
% Same story with \cs{captiondelim} and the obsolete \cs{captionlabeldelim}.
% \changes{v2.1}{29 Jan 02}{New command \cs{normalcaptionparams}}
%    \begin{macrocode}
\newcommand*\normalcaptionparams{%
  \let\captionsize\@empty
  \renewcommand*\captionfont{\captionsize}%
  \let\captionlabelfont\@empty
  \renewcommand*\captionlabeldelim{:}%
  \renewcommand*\captionlabelsep{\space}%
  \setcaptionmargin\z@\setlength\captionindent\z@
  \onelinecaptionstrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@eh}
% Some commands will produce an error message, use this as help text.
%    \begin{macrocode}
\newcommand*\caption@eh{%
  If you do not understand this error, please take a closer look\MessageBreak
  at the documentation of the `caption2' package.\MessageBreak
  \@ehc}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\defcaptionstyle}
% \begin{macro}{\newcaptionstyle}
% \begin{macro}{\renewcaptionstyle}
% These macros will define a new caption style. \cs{newcaptionstyle} and \cs{renewcaptionstyle}
% will additionally check if the caption style already exists or not.
%    \begin{macrocode}
\newcommand*\defcaptionstyle[1]{%
  \@namedef{caption@@#1}}
%
\newcommand*\newcaptionstyle[1]{%
  \expandafter\ifx\csname caption@@#1\endcsname\relax
    \expandafter\defcaptionstyle
  \else
    \PackageError{caption2}{Caption style `#1' already defined}{\caption@eh}%
    \expandafter\@gobbletwo
  \fi
  {#1}}
%
\newcommand*\renewcaptionstyle[1]{%
  \expandafter\ifx\csname caption@@#1\endcsname\relax
    \PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}%
    \expandafter\@gobbletwo
  \else
    \expandafter\defcaptionstyle
  \fi
  {#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\dummycaptionstyle}
% This macro will also define a new caption style, but a one which is based on the
% actual set caption style. Therefore you can't set a caption style made with this
% command with \cs{captionstyle} -- we check this to avoid an endless recursion.
%    \begin{macrocode}
\newcommand*\dummycaptionstyle[2]{%
  \defcaptionstyle{#1}{%
    \expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname%
                    \csname caption@@#1\endcsname
      \PackageError{caption2}{You can't use the caption style `#1' directy}{%
        The caption style `#1' is only a dummy and does not really exists.%
        \MessageBreak You have to redefine it (with \protect\renewcaptionstyle)
        before you can select\MessageBreak it with \protect\captionstyle.
        \space\caption@eh}%
    \else
      #2\usecaptionstyle\caption@style
    \fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionstyle}
% \cs{captionstyle} sets the actual caption style. It includes a check if the given caption
% style is defined or not.
%    \begin{macrocode}
\newcommand*\captionstyle[1]{%
  \expandafter\ifx\csname caption@@#1\endcsname\relax
    \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}%
  \else
    \def\caption@style{#1}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{style `normal'}
% \begin{macro}{style `center'}
% \begin{macro}{style `centerlast'}
% \begin{macro}{style `flushleft'}
% \begin{macro}{style `flushright'}
% \begin{macro}{style `hang'}
% \begin{macro}{style `indent'}
% The predefined caption styles `normal', `center', `flushleft', `flushright', `centerlast',
% `hang', `hang+X', and `indent'. Because they are quite similar they all are based on the macro
% \cs{caption@make}.
%    \begin{macrocode}
\newcaptionstyle{normal}{\caption@make{normal}}
\newcaptionstyle{center}{\caption@make{center}}
\newcaptionstyle{centerlast}{\caption@make{centerlast}}
\newcaptionstyle{flushleft}{\caption@make{flushleft}}
\newcaptionstyle{flushright}{\caption@make{flushright}}
\newcaptionstyle{hang}{\caption@make{hang}}
\newcaptionstyle{hang+center}{\caption@make{hang@center}}
\newcaptionstyle{hang+centerlast}{\caption@make{hang@centerlast}}
\newcaptionstyle{hang+flushleft}{\caption@make{hang@flushleft}}
\newcaptionstyle{indent}{\caption@make{indent}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@makecaption}
% Our predefined caption styles. \cs{caption@makecaption} takes the style
% name as parameter, it does the common stuff and calls a macro
% (build out of the style name) to do the uncommon stuff if neccessary.
% \changes{v2.1}{26 Feb 02}{Renamed from \cs{caption@make} to \cs{caption@makecaption}}
% \changes{v2.1b}{16 Apr 04}{We offer and use \cs{caption@make}, again}
% \changes{v2.1c}{10 May 04}{Bugfix: Extra \cs{par} added}
%    \begin{macrocode}
\newcommand*\caption@makecaption[1]{%
  \usecaptionmargin
%
  \ifcaptionlabel
    \def\caption@label{%
      {\captionlabelfont\captionlabel\captionlabeldelim}\captionlabelsep}%
  \else
    \let\caption@label\@empty
  \fi
%
  \captionfont
  \onelinecaption
    {\caption@label\captiontext}%
    {\parbox[b]\captionlinewidth{\strut\@nameuse{caption@@@#1}\par}\par}}
\newcommand*\caption@make{\caption@makecaption}
%    \end{macrocode}
% \end{macro}
%
% \changes{v2.1}{26 Feb 02}{Removed all extra parboxes from caption styles}
% \changes{v2.1a}{12 Nov 03}{\ldots and put the parbox into \cs{caption@makecaption} instead}
%
% \begin{macro}{\caption@@@normal}
% The `normal' caption style. Just typeset caption (label \& text) as paragraph.
%    \begin{macrocode}
\newcommand*\caption@@@normal{%
  \caption@label\captiontext}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@center}
% The `center' caption style. Typeset the caption centered within a parbox.
%    \begin{macrocode}
\newcommand*\caption@@@center{%
  \centering\caption@label\captiontext}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@centerlast}
% The `centerlast' caption style.
% The idea how to do this was taken from Br\"uggemann-Klein\cite{Anne},
% it is also mentioned in Kopka\cite[p227]{Kopka-E}.
%    \begin{macrocode}
\newcommand*\caption@centerlast{%
  \advance\leftskip by 0pt plus 1fil%
  \advance\rightskip by 0pt plus -1fil%
  \parfillskip0pt plus 2fil\relax}
%
\newcommand*\caption@@@centerlast{%
  \caption@centerlast\caption@label\captiontext}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@flushleft}
% The `flushleft' caption style. Typeset the caption raggedright within a parbox.
%    \begin{macrocode}
\newcommand*\caption@@@flushleft{%
  \raggedright\caption@label\captiontext}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@flushright}
% The `flushright' caption style. Typeset the caption raggedleft within a parbox.
%    \begin{macrocode}
\newcommand*\caption@@@flushright{%
  \raggedleft\caption@label\captiontext}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@hang}
% \begin{macro}{\caption@hangplus}
% The `hang' caption style.
% This code was taken from \LaTeXcomp\cite[p155]{A-W:GMS94} and modified.
%    \begin{macrocode}
\newcommand*\caption@@@hang{%
  \sbox\@tempboxa{\caption@label}%
  \hangindent\wd\@tempboxa\noindent
  \usebox\@tempboxa\caption@hangplus\captiontext}
%
\newcommand*\caption@hangplus{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@@@hang@center}
% The `hang+flushleft' caption style.
%    \begin{macrocode}
\newcommand*\caption@@@hang@center{%
  \let\caption@hangplus\centering\caption@@@hang}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@hang@centerlast}
% The `hang+flushleft' caption style.
%    \begin{macrocode}
\newcommand*\caption@@@hang@centerlast{%
  \let\caption@hangplus\caption@centerlast\caption@@@hang}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@hang@flushleft}
% The `hang+flushleft' caption style.
%    \begin{macrocode}
\newcommand*\caption@@@hang@flushleft{%
  \let\caption@hangplus\raggedright\caption@@@hang}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@indent}
% The `indent' caption style. Is is quite like the `hang' style but the
% indention is given as \cs{captionindent}.
%    \begin{macrocode}
\newcommand*\caption@@@indent{%
  \hangindent\captionindent\noindent
  \caption@label\captiontext}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Options}
%
% \begin{macro}{normal}
% \begin{macro}{center}
% \begin{macro}{centerlast,anne}
% \begin{macro}{flushleft}
% \begin{macro}{flushright}
% \begin{macro}{hang,isu}
% \begin{macro}{indent}
% These options will set the caption style.
% (`normal' is the default one.)
%
% The options `anne' and `isu' are for
% backward compatibility only.
%    \begin{macrocode}
\DeclareOption{normal}{\captionstyle{normal}}
\DeclareOption{center}{\captionstyle{center}}
\DeclareOption{centerlast}{\captionstyle{centerlast}}
\DeclareOption{flushleft}{\captionstyle{flushleft}}
\DeclareOption{flushright}{\captionstyle{flushright}}
\DeclareOption{anne}{\ExecuteOptions{centerlast}}
\DeclareOption{hang}{\captionstyle{hang}}
\DeclareOption{hang+center}{\captionstyle{hang+center}}
\DeclareOption{hang+centerlast}{\captionstyle{hang+centerlast}}
\DeclareOption{hang+flushleft}{\captionstyle{hang+flushleft}}
\DeclareOption{isu}{\ExecuteOptions{hang}}
\DeclareOption{indent}{\captionstyle{indent}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{scriptsize}
% \begin{macro}{footnotesize}
% \begin{macro}{small}
% \begin{macro}{normalsize}
% \begin{macro}{large,Large}
% These options will set the caption size. We use \cs{g@addto@macro} so more that one
% option can be set.
%    \begin{macrocode}
\DeclareOption{scriptsize}{\g@addto@macro\captionsize\scriptsize}
\DeclareOption{footnotesize}{\g@addto@macro\captionsize\footnotesize}
\DeclareOption{small}{\g@addto@macro\captionsize\small}
\DeclareOption{normalsize}{\g@addto@macro\captionsize\normalsize}
\DeclareOption{large}{\g@addto@macro\captionsize\large}
\DeclareOption{Large}{\g@addto@macro\captionsize\Large}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{up,it,sl,sc}
% \begin{macro}{md,bf}
% \begin{macro}{rm,sf,tt}
% These options will set the caption label.
%    \begin{macrocode}
\DeclareOption{up}{\g@addto@macro\captionlabelfont\upshape}
\DeclareOption{it}{\g@addto@macro\captionlabelfont\itshape}
\DeclareOption{sl}{\g@addto@macro\captionlabelfont\slshape}
\DeclareOption{sc}{\g@addto@macro\captionlabelfont\scshape}
\DeclareOption{md}{\g@addto@macro\captionlabelfont\mdseries}
\DeclareOption{bf}{\g@addto@macro\captionlabelfont\bfseries}
\DeclareOption{rm}{\g@addto@macro\captionlabelfont\rmfamily}
\DeclareOption{sf}{\g@addto@macro\captionlabelfont\sffamily}
\DeclareOption{tt}{\g@addto@macro\captionlabelfont\ttfamily}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{oneline}
% \begin{macro}{nooneline}
% These options will set the `oneline' flag.
% (`oneline' is the default.)
%    \begin{macrocode}
\DeclareOption{oneline}{\onelinecaptionstrue}
\DeclareOption{nooneline}{\onelinecaptionsfalse}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@package}
% A helper macro, a value of 1 within parameter \#2 will activate the support
% of the package given in parameter \#1, a value of 0 will deactivate it.
%    \begin{macrocode}
\newcommand*\caption@package[1]{\@namedef{caption@pkt@#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{float}
% \begin{macro}{longtable}
% \begin{macro}{subfigure}
% \changes{v2.1}{19 Feb 02}{New options for interaction with other packages}
% These options will enable or suppress the support of the packages
% \textsf{float}, \textsf{longtable}, and \textsf{subfigure}.
%    \begin{macrocode}
\DeclareOption{float}{\caption@twozerofalse\caption@package{float}{1}}
\DeclareOption{longtable}{\caption@twozerofalse\caption@package{longtable}{1}}
\DeclareOption{subfigure}{\caption@twozerofalse\caption@package{subfigure}{1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{none}
% \begin{macro}{all}
% These options will enable or suppress the support of all the above packages.
%    \begin{macrocode}
\DeclareOption{none}{\caption@twozerofalse
  \caption@package{float}{0}\caption@package{longtable}{0}%
  \caption@package{subfigure}{0}}
\DeclareOption{all}{\ExecuteOptions{float,longtable,subfigure}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{ruled}
% \begin{macro}{boxed}
% The option `ruled' introduced in \textsf{caption} v1.2 is obsolete now, but
% we will still support it. The option `boxed' was introduced in version 2.0
% and is obsolete now, too.
%    \begin{macrocode}
\newif\ifcaption@ruled
\DeclareOption{ruled}{\caption@ruledtrue}
\DeclareOption{boxed}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{ignoreLTcapwidth}
% This option will make the caption code ignore the setting of \cs{LTcapwidth}
% and use the setting of \cs{setcaptionmargin} or \cs{setcaptionwidth} instead.
%    \begin{macrocode}
\DeclareOption{ignoreLTcapwidth}{\ignoreLTcapwidthtrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{debug}
% This option will put additional debug information in the log file.
%    \begin{macrocode}
\DeclareOption{debug}{\caption@debugtrue}
%    \end{macrocode}
% \end{macro}
%
% That's it! Now set the default values and start processing the options.
% (If \cs{caption@twozero} is set to true (default) we will emulate the package
% load algorithm of \textsf{caption} v2.0: If the package is already loaded
% patch it, otherwise do nothing.)
% \changes{v2.1}{19 Feb 02}{\cs{ProcessOptions} changed to \cs{ProcessOptions*}}
%    \begin{macrocode}
\newif\ifcaption@debug
\newif\ifcaption@twozero
\normalcaptionparams
\ExecuteOptions{none,normal}
\caption@twozerotrue
\ProcessOptions*
\ifcaption@twozero
  \PackageInfo{caption2}{Running in caption2 v2.0 compatibility mode}
\fi
%    \end{macrocode}
%
% \subsection{More declarations}
%
% \begin{macro}{\captionof}
% \begin{macro}{\captionof*}
% \cs{captionof} resp.\ \cs{captionof*} will just set \cs{@captype} and do the normal
% \cs{caption} resp.\ \cs{caption*}, so we can also typeset captions outside floating
% environments.
% \changes{v2.1}{19 Feb 02}{New commands \cs{captionof} and \cs{captionof*}}
%    \begin{macrocode}
\def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}}
\newcommand*\caption@of[2]{\def\@captype{#2}#1}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\abovecaptionskip}
% \begin{macro}{\belowcaptionskip}
% Not all document classes define \cs{abovecaptionskip} and \cs{belowcaptionskip}
% (like \textsf{ucthesis}), so we do it here if not already done.
% \changes{v2.1}{19 Feb 02}{\cs{abovecaptionskip} and \cs{belowcaptionskip} will be defined if neccessary}
%    \begin{macrocode}
\@ifundefined{abovecaptionskip}{%
  \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
\@ifundefined{belowcaptionskip}{%
  \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionlinewidth}
% \changes{v2.1}{26 Feb 02}{Renamed from \cs{realcaptionwidth} to \cs{captionlinewidth}}
% \changes{v2.1a}{12 Nov 03}{We offer \cs{realcaptionwidth}, again}
% \begin{macro}{\captionlabel}
% \begin{macro}{\captiontext}
% These values are only set and used within the caption code itself.
% \cs{captionlinewidth} will be set to the given vertical space for the caption,
% normally this is \cs{linewidth}. (This value was called \cs{realcaptionwidth}
% within \thispackage\ \mbox{2.0}, so we will offer this, too.)
%
% \cs{captionlabel} and \cs{captiontext} will be set to the caption label
% resp.\ the caption text.
% (Because \cs{captionlabel} and \cs{captiontext} will be locally defined with
% \cs{def} we do not need to define them here.)
%    \begin{macrocode}
\newdimen\captionlinewidth
\newdimen\realcaptionwidth
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\usecaptionmargin}
% A helper macro for caption style authors:
% It calculates \cs{leftskip} and \cs{rightskip} out of
% \cs{captionlinewidth} and \cs{captionmargin} resp.\ \cs{captionwidth}.
% Also \cs{captionlinewidth} will be corrected to the appropriate value.
%    \begin{macrocode}
\newcommand*\usecaptionmargin{%
  \ifcaptionwidth
    \leftskip\captionlinewidth
    \advance\leftskip by -\captionwidth
    \divide\leftskip by 2
    \rightskip\leftskip
    \captionlinewidth\captionwidth
  \else
    \leftskip\captionmargin
    \rightskip\captionmargin
    \advance\captionlinewidth by -2\captionmargin
  \fi
  \realcaptionwidth\captionlinewidth}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\onelinecaption}
% This macro definition helps setting captions the \LaTeX\ base classes way:
% If \cs{ifonelinecaptions} is set and the 1st argument fits within \cs{captionlinewidth},
% we typeset it centered -- otherway we typeset the 2nd argument.
% (We use the savebox \cs{@tempboxa} as helper for this.)
%    \begin{macrocode}
\newcommand\onelinecaption[1]{%
  \let\next\@firstofone
  \ifonelinecaptions
    \sbox\@tempboxa{#1}%
    \ifdim\wd\@tempboxa >\captionlinewidth
    \else
      \def\next{{\centering\usebox\@tempboxa\par}\@gobble}%
    \fi
  \fi\next}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\usecaptionstyle}
% First we check if we are inside a caption -- if \cs{captiontext} is undefined we are not.
% If we are we call the appropriate caption definition.
%
% \changes{v2.1b}{16 Apr 04}{Missing percent added (and extra space removed)}
%    \begin{macrocode}
\newcommand*\usecaptionstyle[1]{%
  \@ifundefined{captiontext}{%
    \PackageError{caption2}{You can't use \protect#1
      in normal text}{The usage of \protect#1 is only
      allowed inside code declared with\MessageBreak \protect\defcaptionstyle,
      \protect\newcaptionstyle \space or \protect\renewcaptionstyle.
      \space\caption@eh}
  }{%
    \@ifundefined{caption@@#1}%
      {\PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}}%
      {\@nameuse{caption@@#1}}%
  }}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@makecaption}
% This is the heart of the \thispackage\ package -- the redefinition of the
% core caption code. It was taken from the \LaTeXe\ standard classes and modified.
% It's very easy -- apart from using \cs{abovecaptionskip} and \cs{belowcaptionskip}
% we just set \cs{captionlinewidth}, \cs{captionlabel} and \cs{captiontext}
% to its appropriate values and using the code of the actual caption style via
% \cs{usecaptionstyle}.
%    \begin{macrocode}
\renewcommand\@makecaption[2]{%
  \vskip\abovecaptionskip
  \captionlinewidth\hsize
  \realcaptionwidth\hsize
  \def\captionlabel{#1}%
  \def\captiontext{#2}%
  \usecaptionstyle\caption@style
  \vskip\belowcaptionskip}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Support of other packages}
%
% \begin{macro}{\caption@package}
% This macro will execute the code needed to support the package
% named within argument \#1. The parameter \#2 is the command
% which shows if the package is loaded -- it is defined, it is
% already loaded, otherwise not. The parameter \#3 contains code
% which will be executed if no support is required -- this is for
% cleanup purposes. The final parameter \#4 contains the code itself.
% \changes{v2.1c}{9 May 04}{Compatibility warning removed}
%    \begin{macrocode}
\renewcommand*\caption@package[3]{%
  \if1\@nameuse{caption@pkt@#1}%
    \@ifundefined{#2}%
      {\let\next\AtBeginDocument}%
      {\let\next\@firstofone}%
  \else\ifcaption@twozero
    \@ifundefined{#2}%
      {#3\let\next\@gobble}%
      {\let\next\@firstofone}%
  \else
    #3\let\next\@gobble
  \fi\fi
  \expandafter\let\csname caption@pkt@#1\endcsname\undefined
  \ifcaption@debug
    \ifx\next\@gobble\PackageInfo{caption2}{#1 => gobble}%
    \else\ifx\next\@firstofone\PackageInfo{caption2}{#1 => firstofone}%
    \else\ifx\next\AtBeginDocument\PackageInfo{caption2}{#1 => AtBeginDocument}%
    \fi\fi\fi
  \fi
  \next}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Support of the \puresf{float} package}
%
%    \begin{macrocode}
\caption@package{float}{floatc@plain}{}{%
  \ifx\floatc@plain\relax
    \PackageWarning{caption2}{%
      Option `float' was set but there is no float package loaded}
  \else
    \PackageInfo{caption2}{float package v1.2 (or newer) detected}
%    \end{macrocode}
%
% \begin{macro}{\caption@floatc}
% First we define a helper macro to typeset the caption via \cs{usecaptionstyle},
% the 1st parameter is the caption style name,
% the 2nd and 3rd are the caption label and text.
%
% \textsf{caption2} has the goal not to modify the output just by
% loading it (without options), therefore we have to be tricky here to
% support \cs{@fs@cfont} which is in fact the same as our \cs{captionlabelfont}.
% So we test if a \cs{captionlabelfont} has been set by the user -- if not
% \cs{@fs@cfont} will be used, otherwise \cs{captionlabelfont}.
%
% \changes{v2.1b}{19 Mar 04}{\cs{realcaptionwidth}$=$\cs{hsize} was missing here}
%    \begin{macrocode}
    \newcommand\caption@floatc[3]{%
      \ifx\captionlabelfont\@empty
        \let\captionlabelfont\@fs@cfont
      \fi
      \captionlinewidth\hsize
      \realcaptionwidth\hsize
      \def\captionlabel{#2}%
      \def\captiontext{#3}%
      \usecaptionstyle{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\floatc@plain}
% Now we can redefine the caption code of the \textsf{float} package.
% Here we redefine \cs{floatc@plain} to use our caption code, so
% \texttt{plain} and \texttt{boxed} float types will use the actual
% caption style set by the user.
%    \begin{macrocode}
    \renewcommand*\floatc@plain{\caption@floatc{\caption@style}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\floatc@ruled}
% The support of the \texttt{ruled} float type is a little
% more complex. First we define a caption style `ruled' so the end-user
% can change this caption style afterwards. If the (obsolete) option
% `ruled' is set, we define it in a \textsf{caption} v1.x compatible way,
% otherwise we define it in a \textsf{float} compatible way.
%
% Then we redefine \cs{floatc@ruled} so the caption style `ruled' will
% be used.
%    \begin{macrocode}
    \ifcaption@ruled
      \dummycaptionstyle{ruled}{\onelinecaptionsfalse\setcaptionmargin{\z@}}%
    \else
      \newcaptionstyle{ruled}{%
        \ifcaptionlabel
          {\@fs@cfont\captionlabel}\space%
        \fi\captiontext\par}%
    \fi
%
    \renewcommand*\floatc@ruled{\caption@floatc{ruled}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@of}
% Typesetting captions outside floats is not so easy with redefined floats,
% because
% \begin{itemize}
% \item The caption code of the \textsf{float} package needs not only
% \cs{@captype} defined, but \cs{@fs@capt} (the command which will typeset the
% caption itself) either.
% \item The caption is only saved within a \cs{vbox}, so the \textsf{float}
% package can typeset the caption later at it's float style specific place
% (that means at top or at the bottom of the float).
% \end{itemize}
%
% Here is the new code: First we check if it's a restyled float by checking if
% \cs{fst@<floattype>} is defined. If yes, we use this command (it will define
% \cs{@fs@capt}).
% Then we execute \cs{@float@setevery}, if it exists (that means we are
% dealing with the \textsf{float} package 1.3 or newer here).
% Now comes the basic trick:
% We redefine the caption typesetting command \cs{@fs@capt}, so it will close
% the \cs{vbox}, typeset the caption outside the vbox and finally start the
% group again so the original \cs{@fs@capt} is happy with closing the group.
%
%    \begin{macrocode}
    \renewcommand*\caption@of[2]{\def\@captype{#2}%
      \@ifundefined{fst@#2}{}{%
        \@nameuse{fst@#2}%
        \@ifundefined{@float@setevery}{}{\@float@setevery{#2}}%
        \let\caption@fs@capt\@fs@capt
        \let\@fs@capt\caption@of@float}%
      #1}
%    \end{macrocode}
%
%    \begin{macrocode}
    \newcommand\caption@of@float[2]{\egroup
      \vskip\abovecaptionskip
      \normalsize\caption@fs@capt{#1}{#2}%
      \vskip\belowcaptionskip
      \bgroup}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  \fi}
%    \end{macrocode}
%
% \subsubsection{Support of the \puresf{longtable} package}
%
%    \begin{macrocode}
\caption@package{longtable}{LT@makecaption}{}{%
  \ifx\LT@makecaption\relax
    \PackageWarning{caption2}{%
      Option `longtable' was set but there is no longtable package loaded}
  \else
    \PackageInfo{caption2}{longtable package v3.15 (or newer) detected}
%    \end{macrocode}
%
% \begin{macro}{\LT@makecaption}
% David Carlisle was so kind to introduce a macro called
% \cs{LT@makecaption} in version 3.15 of the \textsf{longtable}
% package which typeset the caption and can be easily redefined.
%
% This is the original definition:
% \begin{quote}
% |\def\LT@makecaption#1#2#3{%|\\
% |  \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%|\\
% |    |$\langle$\textit{typeset} |#1{#2: }#3| \textit{as caption}$\rangle$\\
% |    \endgraf\vskip\baselineskip}%|\\
% |  \hss}}}|
% \end{quote}
%
% So we do here:
% First we define a new (dummy) caption style `longtable',
% than we redefine \cs{LT@makecaption} so this style will be used.
% (Remember: |#1| is |\@gobble| in star form of |\caption|,
% and |\@firstofone| otherwise.)
%    \begin{macrocode}
    \dummycaptionstyle{longtable}{}
%
    \renewcommand\LT@makecaption[3]{%
      \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{%
        \ifignoreLTcapwidth
        \else
          \setcaptionwidth\LTcapwidth
        \fi
        \captionlinewidth\hsize
        \realcaptionwidth\hsize
        \captionlabelfalse#1\captionlabeltrue
        \def\captionlabel{#2}%
        \def\captiontext{#3}%
        \usecaptionstyle{longtable}%
        \endgraf\vskip\baselineskip}%
      \hss}}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  \fi}
%    \end{macrocode}
%
% \subsubsection{Support of the \puresf{subfigure} package}
%
% Some of the following code will not work within \cs{if},
% because of the (yet) undefined \cs{if}\textit{xxx}s. So we simply define
% the critical code within the helper commands \cs{setsubcapstyle}
% and \cs{caption@makesubcaption} already here.
%
% \begin{macro}{\setsubcapstyle}
% This sets the subcaptionstyle to a appropriate value.
%
% If \cs{ifsubcapraggedright} is undefined (it was introduced
% into v2.1 of the \textsf{subfigure} package) we define it first.
%    \begin{macrocode}
\newcommand*\setsubcapstyle{%
  \@ifundefined{subcapraggedrightfalse}{%
    \newif\ifsubcapraggedright}{}%
  \ifsubcaphang
    \ifsubcapcenter
      \subcapstyle{hang+center}%
    \else\ifsubcapcenterlast
      \subcapstyle{hang+centerlast}%
    \else\ifsubcapraggedright
      \subcapstyle{hang+flushleft}%
    \else
      \subcapstyle{hang}%
    \fi\fi\fi
  \else\ifsubcapcenter
    \subcapstyle{center}%
  \else\ifsubcapcenterlast
    \subcapstyle{centerlast}%
  \else\ifsubcapraggedright
    \subcapstyle{flushleft}%
  \else
    \subcapstyle{normal}%
  \fi\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@makesubcaption}
% This will typeset the subcaption.
% We just set all our \cs{caption}\textit{xxx} values to
% the values of \cs{subcap}\textit{xxx} and typeset the
% caption like \textsf{subfigure} within a \cs{hbox},
% but with the help of \cs{usecaptionstyle}.
%
% But this is not as easy as it seems. We typeset the caption like this:
% \begin{quote}
%   |\captionfont|\\
%   |  {\capionlabelfont\captionlabel\captionlabeldelim}%|\\
%   |\captionlabelsep\captiontext|
% \end{quote}
% Within \textsf{subfigure} 2.0 the caption will be set quite similar to:
% \begin{quote}
%   |\subcapsize|\\
%   |  {\subcaplabelfont\captionlabel}%|\\
%   |\space\captiontext|
% \end{quote}
% But within \textsf{subfigure} 2.1 this has changed to:
% \begin{quote}
%   |\subcapsize|\\
%   |  {\subcaplabelfont\captionlabel}%|\\
%   |\hskip\subfiglabelskip|\\
%   |  {\subcapfont\captiontext}}|
% \end{quote}
% So we have to be tricky here: We set \cs{captionlabelfont} to \cs{normalfont} plus
% \cs{subcapsize} \& \cs{subcaplabelfont}, so the font setting in \cs{captionfont}
% will not affect the caption label in subfigure captions.
%
% Note that \cs{hfil} has changed to \cs{hss} from subfigure 2.0 to 2.1,
% so we use \cs{caption@subfig@hss} instead. (We will define this later on.)
%    \begin{macrocode}
\newcommand\caption@makesubcaption[2]{%
  \renewcommand*\captionfont{\subcapsize\subcapfont}%
  \renewcommand*\captionlabelfont{\normalfont\subcapsize\subcaplabelfont}%
  \let\captionlabeldelim\subcaplabeldelim
  \let\captionlabelsep\subcaplabelsep
  \ifsubfigcapwidth\captionwidthtrue\else\captionwidthfalse\fi
  \setlength\captionmargin\subfigcapmargin
  \setlength\captionwidth\subfigcapwidth
  \captionindent\subcapindent
  \ifsubcapnooneline\onelinecaptionsfalse\else\onelinecaptionstrue\fi
  \hbox to\@tempdima{%
    \caption@subfig@hss\parbox[t]\@tempdima{%
      \captionlinewidth\@tempdima
      \realcaptionwidth\@tempdima
      \captionlabeltrue
      \def\captionlabel{#1}%
      \def\captiontext{\ignorespaces #2}%
      \usecaptionstyle\caption@substyle}%
    \caption@subfig@hss}}
%    \end{macrocode}
% \end{macro}
%
% If the subfigure support is not needed, we throw
% the helper macros in the garbage can.
%
%    \begin{macrocode}
\caption@package{subfigure}{@makesubfigurecaption}{%
  \let\setsubcapstyle\undefined
  \let\caption@makesubcaption\undefined}{%
  \ifx\@makesubfigurecaption\relax
    \PackageWarning{caption2}{%
      Option `subfigure' was set but there is no subfigure package loaded}
    \let\setsubcapstyle\undefined
    \let\caption@makesubcaption\undefined
  \else
%    \end{macrocode}
%
% Some stuff has changed from version 2.0 to 2.1 of the
% \textsf{subfigure} package, so we make a branch here.
% If \cs{subcapfont} is undefined we assume v2.0,
% otherwise we assume v2.1 or newer.
%
%    \begin{macrocode}
    \ifx\subcapfont\undefined
      \PackageInfo{caption2}{subfigure package v2.0 detected}
%    \end{macrocode}
%
% \begin{macro}{\subcapfont}
% We define \cs{subcapfont} here so we can use it later
% in common code for \textsf{subfigure} v2.0 and v2.1 (or newer).
%    \begin{macrocode}
      \let\subcapfont\@empty
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subfigcapwidth}
% \begin{macro}{\setsubcapmargin}
% \begin{macro}{\setsubcapwidth}
% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and
% \cs{setcaptionwidth} we define \cs{subfigcapwidth},
% \cs{setsubcapmargin}, and \cs{setsubcapwidth}.
%
% Note: \cs{subfigcapmargin} is a command in v2.0 of \textsf{subfigure}.
% So we make \cs{subfigcapwidth} a command, too.
%    \begin{macrocode}
      \newcommand*\subfigcapwidth{\z@}
      \newcommand*\setsubcapmargin{%
        \subfigcapwidthfalse
        \renewcommand*\subfigcapmargin}
      \newcommand*\setsubcapwidth{%
        \subfigcapwidthtrue
        \renewcommand*\subfigcapwidth}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\subcaplabelsep}
% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}.
%    \begin{macrocode}
      \newcommand*\subcaplabelsep{\space}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@subfig@hss}
% This will be uses within the caption code itself.
%    \begin{macrocode}
      \let\caption@subfig@hss\hfil
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
    \else
      \PackageInfo{caption2}{subfigure package v2.1 (or newer) detected}
%    \end{macrocode}
%
% \begin{macro}{\subfigcapwidth}
% \begin{macro}{\setsubcapmargin}
% \begin{macro}{\setsubcapwidth}
% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and
% \cs{setcaptionwidth} we define \cs{subfigcapwidth},
% \cs{setsubcapmargin}, and \cs{setsubcapwidth}.
%
% Note: \cs{subfigcapmargin} is a length in v2.1 of \textsf{subfigure}.
% So we make \cs{subfigcapwidth} a length, too.
%    \begin{macrocode}
      \newdimen\subfigcapwidth
      \newcommand*\setsubcapmargin{%
        \subfigcapwidthfalse
        \setlength\subfigcapmargin}
      \newcommand*\setsubcapwidth{%
        \subfigcapwidthtrue
        \setlength\subfigcapwidth}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\subcaplabelsep}
% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}.
%    \begin{macrocode}
      \newcommand*\subcaplabelsep{\hskip\subfiglabelskip}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@subfig@hss}
% This will be uses within the caption code itself.
%    \begin{macrocode}
      \let\caption@subfig@hss\hss
%    \end{macrocode}
%
% \end{macro}
%    \begin{macrocode}
    \fi
%    \end{macrocode}
%
% Here starts the common code for \textsf{subfigure} v2.0 and v2.1.
%
% \begin{macro}{\ifsubfigcapwidth}
% \begin{macro}{\subcapindent}
% \begin{macro}{\subcaplabeldelim}
% Analogous to \cs{ifcaptionwidth}, \cs{captionindent} \& \cs{captionlabeldelim}
% we define \cs{ifsubfigcapwidth}, \cs{subcapindent} \& \cs{subcaplabeldelim}
%    \begin{macrocode}
    \newif\ifsubfigcapwidth
    \newdimen\subcapindent
    \newcommand*\subcaplabeldelim{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\subcapstyle}
% Analogous to \cs{captionstyle} we define \cs{subcapstyle}
% and set it (via \cs{setsubcapstyle}) to a appropriate value.
%    \begin{macrocode}
    \newcommand*\subcapstyle[1]{%
      \expandafter\ifx\csname caption@@#1\endcsname\relax
        \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}%
      \else
        \def\caption@substyle{#1}%
      \fi}
    \setsubcapstyle
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@thesubfigure}
% \begin{macro}{\@thesubtable}
% The \textsf{subfigure} package makes use of \cs{subcaplabelfont} and
% \cs{subfiglabelskip} within its \cs{@thesub}\textit{xxx} macros.
% This is totally in contrast to the way the \textsf{caption2} package
% handle these settings. So we redefine the \cs{@thesub}\textit{xxx}
% to be just the plain label and nothing else.
%
%    \begin{macrocode}
    \renewcommand*\@thesubfigure{\thesubfigure}
    \renewcommand*\@thesubtable{\thesubtable}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@makesubfigurecaption}
% \begin{macro}{\@makesubtablecaption}
% Now we are ready to redefine \cs{@makesubfigurecaption}.
%    \begin{macrocode}
    \let\@makesubfigurecaption\caption@makesubcaption
    \let\@makesubtablecaption\caption@makesubcaption
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
  \fi}
%    \end{macrocode}
%
% That's all folks!
%
%    \begin{macrocode}
\let\caption@package\undefined
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
% \begin{thebibliography}{9}
% \bibitem{float}
%   Anselm Lingnau:
%   \textsl{An Improved Environment for Floats},
%   2001/11/08
% \bibitem{longtable}
%   David Carlisle:
%   \textsl{The longtable package},
%   2000/10/22
% \bibitem{rotating}
%   Sebastian Rahtz and Leonor Barroca:
%   \textsl{A style option for rotated objects in \LaTeX},
%   1997/09/26
% \bibitem{subfigure}
%   Steven Douglas Cochran:
%   \textsl{The subfigure package},
%   2002/02/14
% \bibitem{A-W:GMS94}
%   Michel Goossens, Frank Mittelbach and Alexander Samarin:
%   \newblock \textsl{The {\LaTeX} Companion},
%   \newblock Addison-Wesley, Reading, Massachusetts, 1994.
% \bibitem{Anne}
%   Anne Br\"uggemann-Klein:
%   \textsl{Einf\"uhrung in die Dokumentverarbeitung},
%   B.G. Teubner, Stuttgart, 1989
% \bibitem{Kopka-E}
%   Helmut Kopka:
%   \textsl{\LaTeX -- Erweiterungsm\"oglichkeiten},
%   3. \"uberarbeitete Auf\/lage, Addison-Wesley, Bonn, 1991
% \end{thebibliography}
%
% \Finale
%
\endinput
back to top