diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:51:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:51:35 +0000 |
commit | 280c4c7c64f5051ffcb3961f322e8d2b518520e8 (patch) | |
tree | 2c0d0fdaeea8286f90b1c10d9d0d84af1c8e3113 /Master/texmf-dist/source/latex/caption | |
parent | 82fbea1d7b7cf4aeb0379c705e4e288001afc627 (diff) |
trunk/Master/texmf-dist/source/latex/caption
git-svn-id: svn://tug.org/texlive/trunk@180 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/caption')
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption.dtx | 3787 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption.ins | 46 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption2.dtx | 543 |
3 files changed, 4376 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/caption/caption.dtx b/Master/texmf-dist/source/latex/caption/caption.dtx new file mode 100644 index 00000000000..e18f1629e5d --- /dev/null +++ b/Master/texmf-dist/source/latex/caption/caption.dtx @@ -0,0 +1,3787 @@ +% \iffalse meta-comment +% +% This is file `caption.dtx'. +% +% 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, caption3.sty, and manual.tex. +% +% \fi +% \CheckSum{1800} +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\setlength\parindent{0pt} +\setlength\parskip{\smallskipamount} +% +\newcommand\NEWfeature{\NEW{New feature}} +\newcommand\NEWdescription{\NEW{New description}} +\newcommand\NEW[2]{% + \hskip 1sp \marginpar{\footnotesize\sffamily\raggedleft + #1\\#2}} +% +\ifx\pdfoutput\undefined\else + \ifcase\pdfoutput\else + \usepackage{mathptmx,courier} + \usepackage[scaled=0.90]{helvet} + \addtolength\marginparwidth{15pt} + \fi +\fi +% +\usepackage{caption}[2004/11/28] +%\usepackage{float} +\usepackage{longtable,hyperref} +%\usepackage[raggedright]{sidecap} +% +\DeclareCaptionLabelSeparator{period-newline}{. \\} +\DeclareCaptionStyle{period-newline}[labelsep=period]{labelsep=period-newline} +\DeclareCaptionStyle{period-newline2}[labelsep=period,justification=centering]{labelsep=period-newline} +\DeclareCaptionStyle{period-newline3}[labelsep=period]{labelsep=period-newline,justification=centering} +\DeclareCaptionFormat{reverse}{#3#2#1} +\DeclareCaptionFormat{llap}{\llap{#1#2}#3\par} +\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)} +\DeclareCaptionLabelSeparator{fill}{\hfill} +% +\DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em% + M\kern.05em A\kern.1em-\kern.1em Script}} +% +\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\package\puresf\def\thispackage{\package{caption}} +% \let\env\purett \let\opt\purett +% +% \newenvironment{Options}[1]% +% {\list{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}% +% \settowidth{\labelwidth}{\texttt{#1\space}}% +% \setlength{\leftmargin}{\labelwidth}% +% \addtolength{\leftmargin}{\labelsep}}}% +% {\endlist} +% +% \newenvironment{Example}% +% {\ifvmode\else\unskip\par\fi +% \minipage{\linewidth}\smallskip}% +% {\smallskip\endminipage} +% \newcommand\example[3][figure]{% +% \begingroup +% \captionsetup{#2}% +% \captionof{#1}[]{#3}% +% \endgroup} +% +% \GetFileInfo{caption.sty} +% \title{Typesetting captions with the +% \thispackage\ package\thanks{This package has version number +% \fileversion, last revised \filedate.}} +% \author{Axel Sommerfeldt\\\href{mailto:caption@sommerfeldt.net}{\texttt{caption@sommerfeldt.net}}} +% \date{2005/06/13} +% \maketitle +% +% +% \begin{abstract} +% The \thispackage\ package provides many ways to customise the captions +% in floating environments such |figure| and |table| and cooperates with +% many other packages.\footnote{A complete re-work of the user interface +% done together with Steven D. Cochran and Frank Mittelbach has lead to +% this new enhanced version 3.0.} +% \end{abstract} +% +% \iffalse +% \tableofcontents +% \fi +% +% \newcommand\figuretext{% +% White sand beaches. The pink smoothness of the conch shell. A sea abundant +% with possibilities. Duty-free shops filled with Europe's finest gifts and +% perfumes. Play your favorite game of golf amidst the tropical greens on one +% of the many championship courses.} +% +% +% \section{Introduction} +% +% Within the standard \LaTeX\ classes captions haven't received the attention +% they deserve. Simply typeset as an ordinary paragraph there is no +% remarkable visual difference from the rest of the text, like here: +% +% \example{belowskip=\abovecaptionskip}{\figuretext} +% +% There should be possibilities to change this; e.g., it would be nice if you +% can make the text of the caption a little bit smaller as the normal text, +% add an extra margin, typeset the caption label with the same font family and +% shape as your headings etc. Just like this one: +% +% \example{belowskip=\abovecaptionskip,size=small,margin=10pt,labelfont=bf}{\figuretext} +% +% With this package you can do this easily as there are many ready-to-use +% caption formatting options, but you are free to define your very own stuff, too. +% +% +% \pagebreak[4] +% \section{Using the package} +% \label{usage} +% +% \DescribeMacro{\usepackage} +% Insert +% \begin{quote} +% |\usepackage|\oarg{options}|{caption}[|\texttt{\filedate}|]| +% \end{quote} +% into the preamble of your document, i.e.~the part of your document +% between |\documentclass| and |\begin{document}|. +% The options control how your captions will look like; e.g., +% \begin{quote} +% |\usepackage[margin=10pt,font=small,labelfont=bf]{caption}| +% \end{quote} +% would result in captions looking like the second one in the introduction. +% +% \DescribeMacro{\captionsetup} +% For a later change of options the \thispackage\ package provides the command +% \begin{quote} +% |\captionsetup|\oarg{float type}\marg{options} +% \end{quote} +% So +% \begin{quote} +% |\usepackage[margin=10pt,font=small,labelfont=bf]{caption}| +% \end{quote} +% and +% \begin{quote} +% |\usepackage{caption}|\\ +% |\captionsetup{margin=10pt,font=small,labelfont=bf}| +% \end{quote} +% are equal in their results. +% +% It's good to know that |\captionsetup| has an effect on the current +% environment only. So if you want to change some settings for the +% current |figure| or |table| only, just place the |\captionsetup| command +% inside the |figure| or |table| right before the |\caption| command. +% For example +% \begin{quote} +% |\begin{figure}|\\ +% | |\ldots\\ +% | \captionsetup{singlelinecheck=off}|\\ +% | \caption{|\ldots|}|\\ +% |\end{figure}| +% \end{quote} +% switches the single-line-check off, but only for this |figure| so all +% the other captions remain untouched. +% +% (For a description of the optional parameter \meta{float type} see +% section \ref{misc}: \textit{``Useful stuff''}.) +% +% \section{Options} +% \def\OptionLabel{RaggedRight} +% +% +% \subsection{Formatting} +% +% \DescribeMacro{format=} +% A figure or table caption mainly consits of three parts: the caption label, +% which says if this object is a `Figure' or `Table' and what number is +% associated with it, the caption text itself, which is normally a short +% description of contents, and the caption separator which separates the text +% from the label. +% +% The \textit{caption format} determines how this information will be presented; +% it is specified with the option +% \begin{quote} +% |format=|\meta{format name}\quad , +% \end{quote} +% having the name of the caption format as its argument. +% +% There are two standard caption formats:\footnote{You have the option to +% define your own ones, too. See section \ref{declare}: +% \textit{``Do it yourself!''} for details.} +% +% \begin{Options}{\OptionLabel} +% \item[default] +% Typesets the captions as a normal paragraph. +% (This is the default behaviour, it +% is adapted from the standard \LaTeX\ document classes.) +% +% \item[hang] +% Indents the caption text, so it will `hang' under the first line of the text. +% \end{Options} +% +% \begin{Example} +% An example: Specifying the option +% \begin{quote} +% |format=hang| +% \end{quote} +% yields captions like this: +% \example{format=hang}{\figuretext} +% \end{Example} +% +% \DescribeMacro{indention=} +% For both formats (\texttt{default} and \texttt{hang}) you can setup an extra +% indention starting at the second line of the caption. You do this with the +% option +% \begin{quote} +% |indention=|\meta{amount}. +% \end{quote} +% +% Three examples: +% +% \begin{Example} +% \begin{quote} +% |format=default,indention=.5cm| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{format=default,indention=.5cm}{\figuretext} +% \end{Example} +% +% \begin{Example} +% \begin{quote} +% |format=hang,indention=-0.5cm| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{format=hang,indention=-0.5cm}{\figuretext} +% \end{Example} +% +% \DescribeMacro{labelformat=} +% With the option +% \begin{quote} +% |labelformat=|\meta{label format name} +% \end{quote} +% \NEWdescription{v3.0e} +% you specify how the caption label will be typeset. +% There are three standard caption label formats: +% +% \begin{Options}{\OptionLabel} +% \item[default] +% The caption label will be typeset as specified by the document class, +% usually this means the name and the number (like \texttt{simple}). +% (This is the default behaviour.) +% +% \item[empty] +% The caption label will be empty. This option only makes sense when used +% together with other options like \texttt{labelsep=none}. +% +% \item[simple] +% The caption label will be typeset as a name and a number. +% +% \item[parens] +% The number of the caption label will be typeset in parentheses. +% \end{Options} +% +% \begin{Example} +% An example: Using the options +% \begin{quote} +% |labelformat=parens,labelsep=quad| +% \end{quote} +% yields captions like this one: +% \example{labelformat=parens,labelsep=quad}{\figuretext} +% \end{Example} +% +% \DescribeMacro{labelsep=} +% With the options +% \begin{quote} +% |labelsep=|\meta{label separator name} +% \end{quote} +% you specify what caption separator will be used. +% You can choose one of the following: +% +% \begin{Options}{\OptionLabel} +% \item[none] +% There is no caption separator. This option only makes sense when used +% together with other options like \texttt{labelformat=empty}. +% +% \item[colon] +% The caption label and text will be separated by a colon and a space. +% (This is the default one.) +% +% \item[period] +% The caption label and text will be separated by a period and a space. +% +% \item[space] +% The caption label and text will be separated by a single space. +% +% \item[quad] +% The caption label and text will be separated by a |\quad|. +% +% \item[newline] +% The caption label and text will be separated by a line break (|\\|). +% \end{Options} +% +% Two examples: +% \begin{Example} +% \begin{quote} +% |labelsep=period| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{labelsep=period}{\figuretext} +% \end{Example} +% +% \begin{Example} +% \begin{quote} +% |labelsep=newline,singlelinecheck=false| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{labelsep=newline,singlelinecheck=false}{\figuretext} +% \end{Example} +% +% +% \subsection{Justification} +% +% \DescribeMacro{justification=} +% As addition to the caption format you could also specify a +% \emph{caption justification}; it is specified with the option +% \begin{quote} +% |justification=|\meta{justification name}\quad. +% \end{quote} +% +% You can choose one of the following: +% +% \begin{Options}{\OptionLabel} +% \item[justified] +% Typesets the caption as a normal paragraph. (This is the default.) +% +% \item[centering] +% Each line of the caption will be centered. +% +% \iffalse +% \item[Centering] +% Each line of the caption will be centered, too. +% But this time the command |\Centering| of the \package{ragged2e} package +% will be used to achieve this. This difference is that this time the word +% breaking algorithm of \TeX\ will work inside the caption. +% \fi +% +% \item[centerlast] +% The last line of each paragraph of the caption text will be centered. +% +% \item[centerfirst] +% Only the first line of the caption will be centered. +% +% \item[raggedright] +% Each line of the caption will be moved to the left margin. +% +% \iffalse +% \item[RaggedRight] +% Each line of the caption will be moved to the left margin using +% the command |\RaggedRight| from the \package{ragged2e} package. +% \fi +% \item[RaggedRight] +% Each line of the caption will be moved to the left margin, too. +% But this time the command |\RaggedRight| of the \package{ragged2e} package +% will be used to achieve this. This difference is that this time the word +% breaking algorithm of \TeX\ will work inside the caption. +% +% \item[raggedleft] +% Each line of the caption will be moved to the right margin. +% +% \iffalse +% \item[RaggedLeft] +% Each line of the caption will be moved to the right margin using +% the command |\RaggedLeft| from the \package{ragged2e} package. +% \fi +% \end{Options} +% +% Two examples: +% \begin{Example} +% \begin{quote} +% |justification=centerlast| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{justification=centerlast}{\figuretext} +% \end{Example} +% +% \begin{Example} +% \begin{quote} +% |format=hang,justification=raggedright| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{format=hang,justification=raggedright}{\figuretext} +% \end{Example} +% +% \begin{Example} +% \begin{quote} +% |labelsep=newline,justification=centering| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{belowskip=\abovecaptionskip,labelsep=newline,justification=centering}{\figuretext} +% \end{Example} +% +% \DescribeMacro{singlelinecheck=} +% If the caption fit in a single line it will always be centered, ignoring +% the justification you set: +% +% \example{belowskip=\abovecaptionskip}{A short caption.} +% +% This behaviour is adapted from the standard \LaTeX\ document classes +% |article|, |report|, and |book|), but using the \thispackage\ package +% you can switch this special treatment of such short captions off +% with the option +% \begin{quote} +% |singlelinecheck=|\meta{bool}\quad. +% \end{quote} +% Using |false|, |no|, |off| or |0| for \meta{bool} you switch off the +% extra centering: +% \begin{quote} +% |singlelinecheck=false| +% \end{quote} +% Doing so the above short caption would look like +% +% \begingroup +% \captionsetup{type=figure} +% \ContinuedFloat +% \endgroup +% \example{belowskip=\abovecaptionskip,singlelinecheck=false}{A short caption.} +% +% Using |true|, |yes|, |on| or |1| for \meta{bool} you switch on the +% extra centering again. (The default is on.) +% +% +% \subsection{Fonts} +% +% \DescribeMacro{font=} +% \DescribeMacro{labelfont=} +% \DescribeMacro{textfont=} +% There are three font options which affects different parts of the caption: +% One affecting the whole caption (|font|), one which only affects the caption +% label and separator (|labelfont|) and at last one which only affects the +% caption text (|testfont|). +% You set them up using the options +% \begin{quote}\begin{tabular}{@{}r@{}ll} +% |font=| & \marg{font options} & ,\\ +% |labelfont=| & \marg{font options} & and\\ +% |textfont=| & \marg{font options} & .\\ +% \end{tabular}\end{quote} +% +% And these are the available font options: +% +% \begin{Options}{\OptionLabel} +% \item[scriptsize] {\scriptsize Very small size} +% \item[footnotesize] {\footnotesize The size usually used for footnotes} +% \item[small] {\small Small size} +% \item[normalsize] {\normalsize Normal size} +% \item[large] {\large Large size} +% \item[Large] {\Large Even larger size} +% +% \item[up] {\upshape Upright shape} +% \item[it] {\itshape Italic shape} +% \item[sl] {\slshape Slanted shape} +% \item[sc] {\scshape Small Caps shape} +% +% \item[md] {\mdseries Medium series} +% \item[bf] {\bfseries Bold series} +% +% \item[rm] {\rmfamily Roman family} +% \item[sf] {\sffamily Sans Serif family} +% \item[tt] {\ttfamily Typewriter family} +% \end{Options} +% +% If you use only one of these options you can omit the braces; +% e.g., the options +% \iffalse +% \begin{quote} +% \fi +% |font={small}| +% \iffalse +% \end{quote} +% \fi +% and +% \iffalse +% \begin{quote} +% \fi +% |font=small| +% \iffalse +% \end{quote} +% \fi +% yield the same result. +% +% Two examples: +% \begin{Example} +% \begin{quote} +% |font={small,it},labelfont=bf| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{font={small,it},labelfont=bf}{\figuretext} +% \end{Example} +% +% \begin{Example} +% \begin{quote} +% |font=small,labelfont=bf,textfont=it| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{font=small,labelfont=bf,textfont=it}{\figuretext} +% \end{Example} +% +% +% \subsection{Margins and further paragraph options} +% +% \DescribeMacro{margin=} +% \DescribeMacro{width=} +% For all captions you can specify \emph{either} an extra margin \emph{or} +% a fixed width. You do this using the options +% \begin{quote}\begin{tabular}{@{}r@{}ll} +% |margin=| & \meta{amount} & \emph{or}\\ +% |width=| & \meta{amount} & \\ +% \end{tabular}\end{quote} +% Nevertheless what option you use, the left and right margin will be the +% same. +% +% Two examples illustrating this: +% \begin{Example} +% \begin{quote} +% |margin=10pt| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{margin=10pt}{\figuretext} +% \end{Example} +% +% \begin{Example} +% \begin{quote} +% |width=.75\textwidth| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{width=.75\textwidth}{\figuretext} +% \end{Example} +% +% \DescribeMacro{parskip=} +% This option is useful for captions containing more than one paragraph. +% If specifies the extra vertical space inserted between them: +% \begin{quote} +% |parskip=|\meta{amount} +% \end{quote} +% One example: +% \begin{Example} +% \begin{quote} +% |margin=10pt,parskip=5pt| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{margin=10pt,parskip=5pt}{ +% First paragraph of the caption. This one contains some test, just to +% show how these options affect the layout of the caption. +% +% Second paragraph of the caption. This one contains some text, too, to +% show how these options affect the layout of the caption.} +% \end{Example} +% +% \DescribeMacro{hangindent=} +% The option +% \begin{quote} +% |hangindent=|\meta{amount} +% \end{quote} +% is for setting up a hanging indention starting from the second line of each +% paragraph. If the caption contains just a single paragraph, using this option +% leads to the same result as the option |indention=| you already know about. +% But if the caption contains multiple paragraphs you will notice the difference: +% +% \begin{Example} +% \begin{quote} +% |format=hang,indention=-.5cm| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{format=hang,indention=-.5cm}{ +% First paragraph of the caption. This one contains some test, just to +% show how these options affect the layout of the caption. +% +% Second paragraph of the caption. This one contains some text, too, to +% show how these options affect the layout of the caption.} +% \end{Example} +% +% \begin{Example} +% \begin{quote} +% |format=hang,hangindent=-.5cm| +% \end{quote} +% \captionsetup{aboveskip=0pt} +% \example{format=hang,hangindent=-.5cm}{ +% First paragraph of the caption. This one contains some test, just to +% show how these options affect the layout of the caption. +% +% Second paragraph of the caption. This one contains some text, too, to +% show how these options affect the layout of the caption.} +% \end{Example} +% +% +% \subsection{Styles} +% \label{style} +% +% \DescribeMacro{style=} +% A suitable combination of caption options is called \emph{caption style}. +% You can compare them more or less to page styles which you set up with +% |\pagestyle|: The caption style provides all settings for a whole caption layout. +% +% You switch to an already defined caption style with the option +% \begin{quote} +% |style=|\meta{style name}\quad. +% \end{quote} +% The \thispackage\ package usually defines only the style |default| which +% puts all options you already know about to the default ones. +% This means that specifying the option +% \begin{quote} +% |style=default| +% \end{quote} +% has the same effect as specifying all these options: +% \begin{quote} +% |format=default,labelformat=simple,labelsep=colon,|\\ +% |justification=justified,font=default,labelfont=default,|\\ +% |textfont=default,margin=0pt,indention=0pt,parindent=0pt|\\ +% |hangindent=0pt,singlelinecheck=true| +% \end{quote} +% +% +% \subsection{Skips} +% +% \DescribeMacro{aboveskip=} +% \DescribeMacro{belowskip=} +% The spaces above and below the caption are controlled by the skips +% |\abovecaptionskip| and |\belowcaptionskip|. The standard \LaTeX\ document +% classes |article|, |report| and |book| set |\abovecaptionskip| to |10pt| +% and |\belowcaptionskip| to |0pt|. +% +% \pagebreak[3] +% Both skips can be changed with the command |\setlength|, but you can +% use these options, too: +% \nopagebreak[3] +% \begin{quote}\begin{tabular}{@{}r@{}ll} +% |aboveskip=| & \meta{amount} & and\\ +% |belowskip=| & \meta{amount} & .\\ +% \end{tabular}\end{quote} +% +% \DescribeMacro{position=} +% Using |\abovecaptionskip| and |\belowcaptionskip| has a major design flaw: +% If the caption is typeset \emph{above} (and not \emph{below}) the figure +% or table they are not set up very useful at default, because there will be +% some extra space above the caption but no space between the caption and the +% figure or table itself. (Remember: |\belowcaptionskip| is usually set to |0pt|.) +% +% Please compare the spacing in these small tables: +% \begin{Example} +% \begin{minipage}[c]{.5\linewidth} +% \iffalse +% \captionsetup{aboveskip=0pt}% +% \fi +% \captionof{table}{A table} +% \centering\begin{tabular}{ll} +% A & B \\ +% C & D \\ +% \end{tabular} +% \end{minipage} +% \begin{minipage}[c]{.5\linewidth} +% \centering\begin{tabular}{ll} +% A & B \\ +% C & D \\ +% \end{tabular} +% \captionof{table}{A table} +% \end{minipage} +% \end{Example} +% +% But you can fix this by using the option |position=|: It specifies how the +% spacing above and below the caption will be used: +% \begin{quote} +% |position=top|\quad(or |position=above|) +% \end{quote} +% tells the \thispackage\ package to use the spacing useful for caption +% \emph{above} the figure or table and +% \begin{quote} +% |position=bottom|\quad(or |position=below|) +% \end{quote} +% tells the \thispackage\ package to use the spacing useful for captions +% \emph{below} the figure or table. (The last one is the default setting +% except for |longtable|s.) +% +% So adding an extra |\captionsetup{position=top}| to the left example +% table gives you proper spacing around both captions: +% \begin{Example} +% \begin{minipage}[c]{.5\linewidth} +% \captionsetup{position=top} +% \captionof{table}{A table} +% \centering\begin{tabular}{ll} +% A & B \\ +% C & D \\ +% \end{tabular} +% \end{minipage} +% \begin{minipage}[c]{.5\linewidth} +% \centering\begin{tabular}{ll} +% A & B \\ +% C & D \\ +% \end{tabular} +% \captionof{table}{A table} +% \end{minipage} +% \end{Example} +% +% (Technically speaking |\abovecaptionskip| and |\belowcaptionskip| will +% be swapped if you specify the option |position=top|, so in both cases +% |\abovecaptionskip| will be used between the caption and the figure or +% table itself.) +% +% \DescribeMacro{tableposition=} +% This option is especially useful when used together with the optional +% argument of the |\captionsetup| command. (See section \ref{misc}: +% \textit{``Useful stuff''} for details.) E.g., +% \begin{quote} +% |\captionsetup[table]{position=top}| +% \end{quote} +% causes all captions within tables to be treated as captions \emph{above} +% the table (regarding spacing around it). +% \NEWfeature{v3.0a} +% Because this is a very common setting the \thispackage\ package offers +% an abbreviating option for the use with |\usepackage|: +% \begin{quote} +% |\usepackage[|\ldots|,tableposition=top]{caption}| +% \end{quote} +% is equivalent to +% \begin{quote} +% |\usepackage[|\ldots|]{caption}|\\ +% |\captionsetup[table]{position=top}| +% \end{quote} +% +% +% \pagebreak[4] +% \section{Useful stuff} +% \label{misc} +% +% \DescribeMacro{\caption} +% The command +% \nopagebreak[3] +% \begin{quote} +% |\caption|\oarg{lst\_entry}\marg{heading} +% \end{quote} +% \nopagebreak[3] +% typesets the caption inside a floating environment like |figure| or |table|. +% Well, you already know this, but what is new is the fact then when you leave +% the argument \meta{lst\_entry} empty, no entry in the list of figures or +% tables will be made; e.g., +% \begin{quote} +% |\caption[]{A figure without entry in the list of figures.}| +% \end{quote} +% +% \DescribeMacro{\caption*} +% The \package{longtable} package defines the command |\caption*| which +% typesets the caption without label and without entry in the list of tables. +% An example: +% \begin{quote} +% |\begin{longtable}{cc}|\\ +% | \caption*{A table}\\|\\ +% | A & B \\|\\ +% | C & D \\|\\ +% |\end{longtable}| +% \end{quote} +% looks like +% \begin{longtable}{cc} +% \caption*{A table}\\ +% A & B \\ +% C & D \\ +% \end{longtable} +% +% This package does it, too, so you can use this command now within every +% floating environment like |figure| or |table|, like here: +% \begin{quote} +% |\begin{table}|\\ +% | \caption*{A table}|\\ +% | \begin{tabular}{cc}|\\ +% | A & B \\|\\ +% | C & D \\|\\ +% | \end{longtable}|\\ +% |\end{table}| +% \end{quote} +% +% \DescribeMacro{\captionof} +% \DescribeMacro{\captionof*} +% Sometimes you want to typeset a caption \emph{outside} a floating environment, +% putting a figure within a |minipage| for instance. For this purpose the +% \thispackage\ package offers the command +% \begin{quote} +% |\captionof|\marg{float type}\oarg{lst\_entry}\marg{heading}\quad. +% \end{quote} +% Note that the first argument, the \meta{float type}, is mandatory here, because +% the |\captionof| command needs to know which name to put into the caption label +% (e.g. ``Figure'' or ``Table'') and in which list to put the contents entry. +% An example: +% \begin{quote} +% |\captionof{figure}{A figure}|\\ +% |\captionof{table}{A table}| +% \end{quote} +% typesets captions like this: +% \begin{Example} +% \captionof{figure}{A figure} +% \captionsetup{belowskip=\abovecaptionskip} +% \captionof{table}{A table} +% \end{Example} +% +% The star variant |\captionof*| has the same behaviour as the |\caption*| command: +% it typesets the caption without label and without entry to the list of figures +% or tables. +% +% Please use both |\captionof| and |\captionof*| only \emph{inside} environments +% (like |minipage| or |\parbox|), otherwise a page break can appear between content +% and caption. Furthermore some strange effects could occur (e.g., wrong spacing +% around captions). +% +% \DescribeMacro{\ContinuedFloat} +% Sometimes you want to split figures or tables without giving them +% their own reference number. This is what the command +% \begin{quote} +% |\ContinuedFloat| +% \end{quote} +% is for; it should be used as first command inside the floating environment. +% It prevents the increment of the relevant counter so a figure or table +% with a |\ContinuedFloat| in it gets the same reference number as the figure +% or table before. +% +% An example: +% \begin{quote} +% |\begin{table}|\\ +% |\caption{A table}|\\ +% \ldots\\ +% |\end{table}|\\ +% \ldots\\ +% |\begin{table}\ContinuedFloat|\\ +% |\caption{A table (cont.)}|\\ +% \ldots\\ +% |\end{table}| +% \end{quote} +% gives the following result: +% \begin{Example} +% \makeatletter\def\@captype{table}\makeatother +% \caption[]{A table} +% \centerline{\ldots} +% \ContinuedFloat +% \captionsetup{aboveskip=0pt} +% \caption[]{A table (cont.)} +% \end{Example} +% +% \DescribeMacro{\captionsetup} +% We already know the |\captionsetup| command (see section \ref{usage}: +% \textit{``Using the package''}), but this time we get enlighten about +% the optional argument \meta{float type}. +% +% Remember, the syntax of this command is +% \begin{quote} +% |\captionsetup|\oarg{float type}\marg{options}\quad. +% \end{quote} +% +% If a \meta{float type} gets specified, all the \meta{options} don't +% change anything at this time. Instead they only get marked for a later use, +% when a caption inside of a floating environment of the particular type +% \meta{float type} gets typeset. +% For example +% \begin{quote} +% |\captionsetup[figure]|\marg{options} +% \end{quote} +% forces captions within a |figure| environment to use the given \meta{options}. +% +% Here comes an example to illustrate this: +% \begin{quote} +% |\captionsetup{font=small}|\\ +% |\captionsetup[figure]{labelfont=bf}| +% \end{quote} +% gives captions like this: +% \begin{Example} +% \captionsetup{font=small} +% \captionsetup[figure]{labelfont=bf} +% \captionof{figure}[]{A figure} +% \captionsetup{belowskip=\abovecaptionskip} +% \captionof{table}[]{A table} +% \end{Example} +% +% As you see the command |\captionsetup[figure]{labelfont=bf}| only changed +% the font of the figure caption labels, not touching all other ones. +% +% \DescribeMacro{\clearcaptionsetup} +% If you want to get rid of these parameters marked for an automatic use within +% a particular environment you can use the command +% \begin{quote} +% |\clearcaptionsetup|\marg{Typ}\quad. +% \end{quote} +% +% For example |\clearcaptionsetup{figure}| would clear the extra handling in the +% example above: +% \begin{Example} +% \captionsetup{font=small} +% \captionof{figure}[]{A figure} +% \captionsetup{belowskip=\abovecaptionskip} +% \captionof{table}[]{A table} +% \end{Example} +% +% As \meta{float type} you can usually give one of these only two: +% |figure| and |table|. +% But as we will see later some \LaTeX\ packages exist (like the \package{float} +% package for example) who can define additional floating enviroments and these two +% commands also works with them. +% +% +% \pagebreak[3] +% \section{Do it yourself!} +% \label{declare} +% +% A family of commands is provided to allow users to define their own formats. +% This enables information on separators, justification, fonts, and styles to +% be associated with a name and kept in one place +% (these commands need to appear in the document preamble, +% this is the part between |\documentclass| and |\begin{document}|). +% +% \pagebreak[2] +% \DescribeMacro{\DeclareCaptionFormat} +% You can define your own caption formats using the command +% \begin{quote} +% |\DeclareCaptionFormat|\marg{name}\marg{code using \#1, \#2 and \#3}\quad. +% \end{quote} +% At usage the system replaces \#1 with the caption label, \#2 with the +% separator and \#3 with the text. So the standard format |default| is defined +% inside |caption.sty| as +% \begin{quote} +% |\DeclareCaptionFormat{default}{#1#2#3\par}| +% \end{quote} +% +% \DescribeMacro{\DeclareCaptionLabelFormat} +% Likewise you can define your own caption label formats: +% \begin{quote} +% |\DeclareCaptionLabelFormat|\marg{name}\marg{code using \#1 and \#2} +% \end{quote} +% At usage \#1 gets replaced with the name (e.g. ``figure'') and \#2 +% gets replaced with the reference number (e.g. ``12''). +% +% \DescribeMacro{\bothIfFirst} +% \DescribeMacro{\bothIfSecond} +% When you define your own caption label formats and use the \package{subfig} +% package\cite{subfig}, too, you must take care of empty caption label names. +% For this purpose the commands +% \begin{quote} +% |\bothIfFirst|\marg{first arg}\marg{second arg}\quad and\\ +% |\bothIfSecond|\marg{first arg}\marg{second arg} +% \end{quote} +% are offered. |\bothIfFirst| tests if the first argument exists (means: is +% not empty), |\bothIfSecond| tests if the second argument exists. If it is +% so both arguments get typeset, otherwise none of them. +% +% For example the standard label format |simple| isn't defined as +% \begin{quote} +% |\DeclareCaptionLabelFormat{simple}{#1 #2}|\quad, +% \end{quote} +% because this could cause an extra space if \#1 is empty. Instead |simple| +% is defined as +% \begin{quote} +% |\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{ }#2}|\quad, +% \end{quote} +% causing the space to appear only if the label name is present. +% +% \pagebreak[3] +% \DescribeMacro{\DeclareCaptionLabelSeparator} +% You can define your own caption label separators with +% \nopagebreak[3] +% \begin{quote} +% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\quad. +% \end{quote} +% \nopagebreak[3] +% Again an easy example taken from |caption.sty| itself: +% \nopagebreak[3] +% \begin{quote} +% |\DeclareCaptionLabelSeparator{colon}{: }| +% \end{quote} +% \pagebreak[3] +% +% \DescribeMacro{\DeclareCaptionJustification} +% You can define your own caption justifications with +% \begin{quote} +% |\DeclareCaptionJustification|\marg{name}\marg{code}\quad. +% \end{quote} +% The \meta{code} simply gets typeset just before the caption. +% E.g.~using the justification |raggedright|, which is defined as +% \begin{quote} +% |\DeclareCaptionJustification{raggedright}{\raggedright}|\quad, +% \end{quote} +% yields captions with all lines moved to the left margin. +% +% \DescribeMacro{\DeclareCaptionFont} +% You can define your own caption fonts with +% \begin{quote} +% |\DeclareCaptionFont|\marg{name}\marg{code}\quad. +% \end{quote} +% For example this package defines the options |small| and |bf| as +% \begin{quote} +% |\DeclareCaptionFont{small}{\small}|\quad and\\ +% |\DeclareCaptionFont{bf}{\bfseries}|\quad. +% \end{quote} +% +% \DescribeMacro{\DeclareCaptionStyle} +% The best one comes at last: You can define your own caption styles with +% \begin{quote} +% |\DeclareCaptionStyle|\marg{name}\oarg{additional options}\marg{options} +% \end{quote} +% Remember, caption styles are just a collection of suitable options, saved +% under a given name. You can wake up these options at any time with the +% option |style=|\meta{style name}. +% +% All caption styles are based on the default set of options. (See section +% \ref{style}: \textit{``Styles''} for a complete list.) So you only need +% to specify options which are different to them. +% +% If you specify \meta{additional options} they get used in addition when +% the caption fits into a single line and this check was not disabled with +% the option |singlelinecheck=off|. +% +% Again a very easy example taken from |caption.sty|: +% \begin{quote} +% |\DeclareCaptionStyle{default}[justification=centering]{}| +% \end{quote} +% +% +% \subsection{Examples} +% +% If you would like to have a colon \emph{and} a line break as caption +% separator you could define it this way: +% \begin{quote} +% |\DeclareCaptionLabelSeparator{period-newline}{. \\}| +% \end{quote} +% Selecting this separator with |\captionsetup{labelsep=period-newline}| you +% get captions like this: +% \begin{Example} +% \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt} +% \captionsetup{aboveskip=0pt,type=figure} +% \caption[]{\figuretext} +% \end{Example} +% +% For short captions---which fit into one single line---this separator +% may not be satisfying, even when the automatically centering process +% is switched off (with |singlelinecheck=off|): +% \begin{Example} +% \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt,singlelinecheck=0} +% \captionsetup{aboveskip=0pt,type=figure} +% \caption[]{A figure.} +% \end{Example} +% +% An own caption style which selects another caption separator automatically +% puts this right: +% \begin{quote} +% |\DeclareCaptionStyle{period-newline}%|\\ +% | [labelsep=period]{labelsep=period-newline}| +% \end{quote} +% \begin{Example} +% \captionsetup{style=period-newline,labelfont=bf,margin=10pt} +% \captionsetup{aboveskip=0pt,type=figure} +% \ContinuedFloat +% \caption[]{A figure.} +% \end{Example} +% If you would like to keep the centering of these captions an appropriate +% definition is +% \begin{quote} +% |\DeclareCaptionStyle{period-newline}%|\\ +% | [labelsep=period,justification=centering]%|\\ +% | {labelsep=period-newline}| +% \end{quote} +% Using this definition short captions look like +% \begin{Example} +% \captionsetup{style=period-newline2,labelfont=bf,margin=10pt} +% \captionsetup{aboveskip=0pt,type=figure} +% \ContinuedFloat +% \caption[]{A figure.} +% \end{Example} +% while long ones still have a line break after the caption label. +% +% Slightly changed, you also get centered captions if they are longer than one line: +% \begin{quote} +% |\DeclareCaptionStyle{period-newline}%|\\ +% | [labelsep=period]%|\\ +% | {labelsep=period-newline,justification=centering}| +% \end{quote} +% \begin{Example} +% \captionsetup{style=period-newline3,labelfont=bf,margin=10pt} +% \captionsetup{aboveskip=0pt,type=figure} +% \caption[]{\figuretext} +% \end{Example} +% +% \bigskip\pagebreak[3] +% Another example: You want captions to look like this: +% \begin{Example} +% \captionsetup{format=reverse,labelformat=fullparens,labelsep=fill,font=small,labelfont=it} +% \captionsetup{aboveskip=0pt} +% \captionof{figure}[]{\figuretext} +% \end{Example} +% \pagebreak[2] +% You could do it this way: +% \nopagebreak[3] +% {\leftmargini=10pt +% \begin{quote} +% |\DeclareCaptionFormat{reverse}{#3#2#1}|\\ +% |\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)}|\\ +% |\DeclareCaptionLabelSeparator{fill}{\hfill}|\\ +% |\captionsetup{format=reverse,labelformat=fullparens,|\\ +% | labelsep=fill,font=small,labelfont=it}| +% \end{quote}} +% +% \bigskip\pagebreak[3] +% Another example: The caption text should go into the left margin; a possible +% solution would be: +% {\leftmargini=10pt +% \begin{quote} +% |\DeclareCaptionFormat{llap}{\llap{#1#2}#3\par}|\\ +% |\captionsetup{format=llap,labelsep=quad,singlelinecheck=no}| +% \end{quote}} +% As a result you would get captions like this: +% \begin{Example} +% \captionsetup{format=llap,singlelinecheck=no,labelsep=quad} +% \captionsetup{aboveskip=0pt} +% \captionof{figure}[]{\figuretext} +% \end{Example} +% +% +% \pagebreak[3] +% \section{Using non-standard document classes} +% +% \NEWdescription{v3.0d} +% The \thispackage\ package was developed using the standard document classes +% |article|, |report| and |book|. +% +% If you would like to use the \thispackage\ package with the +% \KOMAScript\ classes or with the \package{memoir} class, you have to take +% into consideration that all the possibilities for customization of the +% captions the \KOMAScript\ classes or \package{memoir} class have +% to offer will get lost. (And they have a lot of possibilites to offer!) +% So class options like |tablecaptionabove| and commands like |\captionabove|, +% |\captionbelow|, |\captionformat|, |\figureformat|, |\tableformat|, +% |\setcapindent|, |\setcaphanging|, |\captionstyle| etc.\ will not work +% anymore. So make a wise decision! +% +% Using the \thispackage\ package together with document classes not mentioned +% so far is not recommended at the moment -- unwanted layout changes, +% side effects or failures could occur. (But future versions of the +% \thispackage\ package will contain adaptions for more document classes! +% +% +% \section{Using other packages} +% \label{packages} +% +% The \thispackage\ package contains special adaptions to other packages who +% handle with captions, too, so the captions always should look like you +% have specified them to look like. +% +% These are the packages the \thispackage\ package is adapted to: +% +% \begin{tabular}{ll} +% |float| & Gives you the possibility to define new floating environments\\ +% |hypcap| & Adjusting \package{hyperref} anchors of captions\\ +% |listings| & Typesets source code listings\\ +% |longtable| & Typesets tables spanned over multiple pages\\ +% |rotating| & Supports rotated figures and tables\\ +% |sidecap| & Offers captions \emph{beside} figures or tables\\ +% |supertabular| & Typesets tables spanned over multiple pages\\ +% \end{tabular} +% +% \NEWfeature{v3.0b} +% If you use one of the above packages together with the {\thispackage} package +% you get the additional possibility to set up captions with +% \begin{quote}|\captionsetup|\oarg{environment}\marg{options}\quad.\end{quote} +% These options will apply for captions inside these environments automatically. +% For example +% \begin{quote}|\captionsetup[lstlisting]{labelfont=bf}|\end{quote} +% forces captions inside the |lstlisting| environment to have bold labels. +% (Please note that this do not work with the |sideways| environments offered by +% the \package{rotating} package.) +% +% If a certain support is not desired you can switch it off using the +% \thispackage\ package option +% \begin{quote} +% |\usepackage[|\ldots|,|\meta{package}|=no]{caption}|\quad. +% \end{quote} +% For example specifying the option |float=no| means you don't like the +% \thispackage\ package to support the \package{float} package. +% (Note: You can specify these options only within the |\usepackage| command, +% especially \emph{not} at a later time with |\captionsetup|.) +% +% For further information about the supported packages please take a look +% at the documentation belonging to it or buy yourself +% The \LaTeX\ Companion\cite{companion}. +% +% +% \subsection{The \package{float} package} +% +% A very useful feature is provided by the \package{float} package\cite{float}: +% It offers the float placement specifier |H| which is much more restrictive +% than the specifier |h| offered by \LaTeX. While the latter one is only a +% recommendation to \LaTeX\ to set the float ``here'', the |H| forces the +% float to appear exactly at the spot where it occurs in your input file +% and nowhere else. +% +% Furthermore it offers different styles for floating environments, these +% styles are |plain|, |plaintop|, |ruled|, and |boxed|. +% You can link one of these styles to either new floating environments or +% to one of the existing environments |figure| and |table|. +% +% If you are using the \thispackage\ package together with the \package{float} +% package this caption style called |ruled| gets defined automatically: +% \begin{quote} +% |\DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space}| +% \end{quote} +% This style represents the caption layout in |ruled| styled floats. +% For you as an end user this means that captions within |ruled| floats will +% always look like this, nevertheless what generic caption options do you +% specify: +% +% \ifx\floatstyle\undefined +% +% \begin{Example} +% \hrule height.8pt depth0pt \kern2pt +% \vbox{\strut{\bfseries Program 7.1} +% The first program. This hasn't got anything to do with the package +% but is included as an example. Note the \texttt{ruled} float style.} +% \kern2pt\hrule\kern2pt +% \begin{verbatim} +% #include <stdio.h> +% +% int main(int argc, char **argv) +% { +% for (int i = 0; i < argc; ++i) +% printf("argv[%d] = %s\n", i, argv[i]); +% return 0; +% } +% \end{verbatim} +% \kern2pt\hrule\relax +% \end{Example} +% +% \else +% +% \floatstyle{ruled} +% \newfloat{Program}{tbp}{lop}[section] +% \floatname{Program}{Program} +% +% \begin{Program}[H] +% \begin{verbatim} +% #include <stdio.h> +% +% int main(int argc, char **argv) +% { +% for (int i = 0; i < argc; ++i) +% printf("argv[%d] = %s\n", i, argv[i]); +% return 0; +% } +% \end{verbatim} +% \caption{The first program. This hasn't got anything to do with the package +% but is included as an example. Note the \texttt{ruled} float style.} +% \end{Program} +% +% \fi +% +% If you want a different layout for |ruled| captions you have to define +% your own one using the command +% \begin{quote} +% |\DeclareCaptionStyle{ruled}|\marg{options}\quad. +% \end{quote} +% +% This mechanism also works with all other float styles. If you want a special +% caption layout for |plain| or |boxed| floats for example you can simply define +% a suitable caption style with the same name as the float style. +% +% \textbf{Note:} For successful cooperation you need the float package +% version 1.3 or newer. +% +% +% \subsection{The \package{listings} package} +% +% \NEWdescription{v3.0b} +% The \package{listings} package\cite{listings} is a source code printer for \LaTeX. +% You can typeset stand alone files as well as listings with an environment +% similar to \texttt{verbatim} as well as you can print code snippets using +% a command similar to |\verb|. +% Many parameters control the output and if your preferred programming +% language isn't already supported, you can make your own definition. +% +% \textbf{Note:} For successful cooperation you need the listings package +% version 1.2 or higher. You'll get an error message when using an +% older version! +% +% +% \subsection{The \package{longtable} package} +% +% The \package{longtable} package\cite{longtable} offers the environment +% |longtable| which behaves similar to the |tabular| environment, but +% the table itself can span multiple pages. +% +% \textbf{Note:} For successful cooperation you need the longtable package +% version 3.15 or newer. +% +% +% \subsection{The \package{rotating} package} +% +% The \package{rotating} package\cite{rotating} offers the floating +% environments \texttt{sideways\-figure} and \texttt{sideways\-table} +% which are just like normal figures and tables but rotated by 90 degree. +% Furthermore they always use a full page on their own. +% +% +% \subsection{The \package{sidecap} package} +% +% \NEWdescription{v3.0b} +% The \package{sidecap} package\cite{sidecap} offers the floating +% environments |SCfigure| and |SCtable| which are like normal figures +% and tables but the caption will be put \emph{beside} the contents. +% +% The \package{sidecap} package offers it's own options for justification. +% If set, they will override the one specified with the caption option +% |justification=| for captions beside their contents. +% +% \DescribeMacro{listof=} +% Using the \package{sidecap} package you will probably notice that +% suppressing the entry in the list of figures or tables with +% |\caption[]{|\ldots|}| won't work inside these environments. +% This is caused by the implementation design of the \package{sidecap} +% package, but you can use |\captionsetup{listof=false}| inside the +% figure or table as an alternative here. +% +% \ifx\SCfigure\undefined +% +% \begin{Example} +% \newsavebox\scbox +% \begin{lrbox}{\scbox} +% \setlength{\unitlength}{.75cm} +% \setlength{\fboxsep}{0pt} +% \fbox{\begin{picture}(4,4) +% \put(1,3){\circle{1}} +% \put(3,3){\circle{1}} +% \put(2,2){\circle{1}} +% \put(1,1){\circle{1}} +% \put(3,1){\circle{1}} +% \end{picture}} +% \end{lrbox} +% \newlength\scboxwidth +% \setlength\scboxwidth{\wd\scbox} +% \makebox[\linewidth][c]{ +% \parbox[b]{\scboxwidth}{\unhbox\scbox} +% \hspace\marginparsep +% \parbox[b]{1.5\scboxwidth}{ +% \captionsetup{justification=RaggedRight,labelfont=bf} +% \captionof{figure}[]{A small example with the caption beside the figure.} +% } +% } +% \end{Example} +% +% \else +% +% \captionsetup{labelfont=bf} +% \begin{SCfigure}[1.5][!ht] +% \setlength{\unitlength}{.75cm} +% \setlength{\fboxsep}{0pt} +% \fbox{\begin{picture}(4,4) +% \put(1,3){\circle{1}} +% \put(3,3){\circle{1}} +% \put(2,2){\circle{1}} +% \put(1,1){\circle{1}} +% \put(3,1){\circle{1}} +% \end{picture}} +% \iffalse +% \captionsetup{labelfont=bf} +% \fi +% \caption[]{A small example with the caption beside the figure.} +% \end{SCfigure} +% \captionsetup{labelfont=default} +% +% \fi +% +% +% \subsection{The \package{supertabular} package} +% +% The \package{supertabular} package\cite{supertabular} offers the environment +% |supertabular| which is quite similar to the |longtable| environment provided +% by the \package{longtable} package. Both offers the typesetting of tables +% which can span multiple pages. For a detailed discussion about the +% differences between these powerful packages please take a look at +% The \LaTeX\ Companion\cite{companion}. +% +% +% \subsection{Known incompatibilities} +% +% \NEWdescription{v3.0b} +% Using the \thispackage\ package together with one of the following packages +% is not recommended; usually this would cause unwanted side effects or even +% errors: +% \begin{quote} +% \package{ccaption}, \package{hvfloat}, \package{nonfloat} +% \end{quote} +% +% +% \section{Compatibility to older versions} +% +% \subsection{\thispackage\ version $1.x$} +% +% This version of the \thispackage\ package still supports the old options +% and commands provided by the version $1.x$ of this package. So there +% shouldn't occur any problems compiling old documents, but please don't mix +% old options and commands with the new ones. This isn't supported and can +% yield to ugly side effects. +% +% Here comes a short oversight of the old options and commands and how they +% are replaced within this version of the \thispackage\ package: +% +% \begin{small}\begin{longtable}{ll} +% \thispackage\ $1.\mathit{x}$ & \thispackage\ $3.\mathit{x}$\\ +% \hline +% \endhead +% |normal| & |format=default|\\ +% |hang| & |format=hang|\\ +% |isu| & |format=hang|\\ +% |center| & |justification=centering|\\ +% |centerlast| & |justification=centerlast|\\ +% |anne| & |justification=centerlast|\\ +% |nooneline| & |singlelinecheck=off|\\ +% |scriptsize| & |font=scriptsize|\\ +% |footnotesize| & |font=footnotesize|\\ +% |small| & |font=small|\\ +% |normalsize| & |font=normalsize|\\ +% |large| & |font=large|\\ +% |Large| & |font=Large|\\ +% |up| & |labelfont=up|\\ +% |it| & |labelfont=it|\\ +% |sl| & |labelfont=sl|\\ +% |sc| & |labelfont=sc|\\ +% |md| & |labelfont=md|\\ +% |bf| & |labelfont=bf|\\ +% |rm| & |labelfont=rm|\\ +% |sf| & |labelfont=sf|\\ +% |tt| & |labelfont=tt|\\ +% |\setlength{\captionmargin}| & |margin=|\meta{amount}\\ +% |\renewcommand{\captionfont}| & |\DeclareCaptionFont|\\ +% & $+$ |\captionsetup{font=|\meta{name}|}|\\ +% |\renewcommand{\captionsize}| & |\DeclareCaptionFont|\\ +% & $+$ |\captionsetup{font=|\meta{name}|}|\\ +% |\renewcommand{\captionlabelfont}| & |\DeclareCaptionLabelFont|\\ +% & $+$ |\captionsetup{labelfont=|\meta{name}|}|\\ +% \end{longtable}\end{small} +% +% +% \subsection{\package{caption2} version $2.x$} +% +% Although they do very similar stuff the packages \package{caption} and +% \package{caption2} have a very different implementation design. So this +% version of the \thispackage\ package isn't compatible to the +% \package{caption2} package at all. Of course for compiling old documents +% you can still use the \package{caption2} package, the latest version +% is provided with this package. But newly created documents shouldn't use +% the \package{caption2} package, please use the \thispackage\ package +% instead as described in this manual. +% +% \iffalse +% TODO: Table like the "caption 1.x => caption 3.x" one +% \fi +% +% +% \pagebreak[3] +% \section{Further reading} +% +% I recommend the following documents for further reading: +% +% \begin{itemize} +% \item +% The \TeX\ FAQ - Frequently asked questions about \TeX\ and \LaTeX : +% \begin{quote}\url{http://faq.tug.org/}\end{quote} +% +% \item +% A French FAQ can be found at +% \begin{quote}\url{http://www.grappa.univ-lille3.fr/FAQ-LaTeX/}\end{quote} +% +% \item +% \textsf{epslatex} from Keith Reckdahl contains many tips around +% graphics in \LaTeXe. You will find this document in the directory +% \begin{quote}\url{ftp://ftp.ctan.org/pub/tex/info/}\end{quote} +% as \texttt{epslatex.ps} and \texttt{epslatex.pdf}. +% +% There is also a french translation available: +% \begin{quote}\url{ftp://ftp.ctan.org/pub/tex/info/fepslatex.ps}\end{quote} +% \end{itemize} +% +% +% \section{Thanks} +% +% I would like to thank Katja Melzner, Steven D. Cochran, Frank Mittelbach, +% David Carlisle, Carsten Hinz, and Olga Lapko. +% Thanks a lot for all your help, ideas, patience, spirit, and support! +% +% Also I would like to thank +% Harald Harders, +% Peter L\"offler, +% Peng Yu, +% Alexander Zimmermann, +% Matthias Pospiech, +% J\"urgen Wieferink, +% Christoph Bartoschek, +% Uwe St\"ohr, and +% Ralf Stubner +% who all helped to make this package a better one. +% +% +% \changes{v1.0}{27 Oct 94}{First release} +% \changes{v1.1}{ 3 Nov 94}{New captiontype \cs{centerlast}} +% \changes{v1.2}{28 Nov 94}{Support of the {\sf float} package} +% \changes{v1.3}{ 8 Jan 95}{Support of \cs{captionlabelfont} in subcaptions} +% \changes{v1.4}{30 Jan 95}{New option \cs{nooneline}} +% \changes{v3.0}{10 Jul 03}{Rewritten; many new commands and features} +% \changes{v3.0a}{22 Jan 04}{Some bugfixes and small design changes} +% \changes{v3.0b}{14 May 04}{Some bugfixes and small improvements} +% \changes{v3.0c}{15 Jul 04}{Bugfix regarding rotating and sidecap package support} +% \changes{v3.0d}{12 Feb 05}{Split into 2 packages; some bugfixes and improvements} +% \changes{v3.0e}{ 5 May 05}{Some bugfixes} +% \changes{v3.0f}{11 May 05}{hypcap support; bugfix regarding float support} +% +% \StopEventually{\begin{thebibliography}{9} +% \bibitem{companion} +% Frank Mittelbach and Michel Goossens: +% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)}, +% \newblock Addison-Wesley, 2004. +% +% \bibitem{float} +% Anselm Lingnau: +% \emph{An Improved Environment for Floats}, +% 2001/11/08 +% +% \bibitem{floatrow} +% Olga Lapko: +% \emph{The floatrow package documentation}, +% 2005/05/22 +% +% \bibitem{hyperref} +% Sebastian Rahtz: +% \emph{Hypertext marks in \LaTeX}, +% 2003/11/30 +% +% \bibitem{hypcap} +% Heiko Oberdiek: +% \emph{The hypcap package -- Adjusting anchors of captions} +% 2001/08/27 +% +% \bibitem{listings} +% Carsten Heinz: +% \emph{The Listings Package}, +% 2004/02/13 +% +% \bibitem{longtable} +% David Carlisle: +% \emph{The longtable package}, +% 2000/10/22 +% +% \bibitem{rotating} +% Sebastian Rahtz and Leonor Barroca: +% \emph{A style option for rotated objects in \LaTeX}, +% 1997/09/26 +% +% \bibitem{sidecap} +% Rolf Niepraschk und Hubert G\"a\ss lein: +% \emph{The sidecap package}, +% 2003/06/06 +% +% \bibitem{subfig} +% Steven D. Cochran: +% \emph{The subfig package}, +% 2004/01/16 +% +% \bibitem{supertabular} +% Johannes Braams und Theo Jurriens: +% \emph{The supertabular environment}, +% 2002/07/19 +% \end{thebibliography}} +% +% \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,\@tempdimb,\@tempdimc,\@tempb,\@tempc} +% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} +% \DoNotIndex{\p@,\z@} +% \DoNotIndex{\active,\addtocounter,\addtolength,\advance} +% \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{\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{\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{\ProcessOptions,\ProvidesPackage} +% +% \clearpage +% \setlength{\parskip}{0pt plus 1pt} +% +% \section{The Implementation} +% +% The \package{caption} package consists of two parts -- the kernel and the +% main package. +% +% The kernel provides all the user commands and internal macros which are +% necessary for typesetting captions and setting parameters regarding these. +% While the standard \LaTeX\ document classes provides an internal command +% called |\@makecaption| and no options to control its behavior (except the +% vertical skips above and below them), we provide similar commands called +% |\caption@make| and |\caption@@make|, but with a lot of options. +% Loading the kernel part do not change the output of a \LaTeX\ document +% -- it just provides functionality which can be used by \LaTeXe\ packages +% which typesets captions, like the \package{caption} package or the +% \package{subfig} package. +% +% The \package{caption} package itself redefines the \LaTeX\ commands +% |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to +% |\caption@@make|, giving the user the possibility to control the captions of +% the floating environments |figure| and |table|. Furthermore it does similar +% to the caption stuff coming from other packages like the \package{longtable} +% package: Mapping the appropriate internal commands (like |\LT@makecaption|) +% to the ones offered by the \package{caption} kernel. +% So you can think of the \package{caption} package as a layer package, it +% simply provides adaption layers between the caption stuff coming from +% \LaTeX\ itself or any \LaTeXe\ package and the caption stuff offered by the +% \package{caption} kernel. +% +% \subsection{Kernel} +% \iffalse +%<*kernel> +% \fi +% +% \subsubsection*{Identification} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{caption3}[2005/06/11 v3.0f caption3 kernel (AS)] +% \end{macrocode} +% +% \subsubsection*{Generic helpers} +% +% \begin{macro}{\@nameundef} +% This is the opposite part to |\@namedef| which is offered by the \LaTeX\ kernel. +% We use it to remove the definition of some commands and keyval options after +% |\begin{document}| (to save \TeX\ memory) or to remove caption options defined +% with |\captionsetup|\oarg{type}. +% \begin{macrocode} +\providecommand*\@nameundef[1]{% + \expandafter\let\csname #1\endcsname\@undefined} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\l@addto@macro} +% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which +% globally adds commands to any existising macro, like in |\AtBeginDocument|. +% This is the same but it works local, not global. +% \begin{macrocode} +\providecommand\l@addto@macro[2]{% + \begingroup + \toks@\expandafter{#1#2}% + \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}% + \@tempa} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bothIfFirst} +% \begin{macro}{\bothIfSecond} +% |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond| +% tests if the second argument is not empty. If yes both arguments get +% typeset, otherwise none of them. +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@ifinlist} +% This helper macro checks if the first argument is in the list which is +% offered as second argument. So for example +% \begin{quote} +% |\caption@ifinlist{frank}{axel,frank,steven}{yes}{no}| +% \end{quote} +% would expand to |yes|. +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setbool} +% \begin{macro}{\caption@ifbool} +% For setting and testing boolean options we offer these two helper macros: +% \begin{quote} +% |\caption@setbool|\marg{name}\marg{value}\\ +% | |(with |value = false/true/no/yes/off/on/0/1|)\\ +% |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\ +% \end{quote} +% \begin{macrocode} +\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}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection*{Using the keyval package} +% +% We need the \package{keyval} package for option handling, so we load it here. +% \begin{macrocode} +\RequirePackage{keyval}[1997/11/10] +% \end{macrocode} +% +% \begin{macro}{\undefine@key} +% This helper macro is the opposite of |\define@key|, it removes a keyval +% definition. +% \begin{macrocode} +\providecommand*\undefine@key[2]{% + \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareCaptionOption} +% |\DeclareCaptionOption|\marg{option}\marg{code}\\ +% |\DeclareCaptionOption*|\marg{option}\marg{code}\par +% The starred form makes the option only available during the lifetime +% of the current package, so they are only avail at |\usepackage|, but +% can't be used with |\captionsetup| later on. +% \begin{macrocode} +\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 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\captionsetup} +% |\captionsetup|\oarg{type}\marg{keyval-list of options}\par +% If `type' is set, we simply save or append the option list, +% otherwise we `execute' it with |\setkeys|. +% \changes{v3.0a}{17 Jan 04}{Missing percent added} +% \begin{macrocode} +\def\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup} +\def\caption@setuptype[#1]#2{% + \@ifundefined{caption@typ@#1}% + {\@namedef{caption@typ@#1}{#2}}% + {\expandafter\l@addto@macro\csname caption@typ@#1\endcsname{,#2}}} +\def\caption@setup{\setkeys{caption}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@settype} +% |\caption@settype|\marg{type}\par +% Caption options which have been saved with |\captionsetup|\oarg{type} can +% be executed using this macro. (It simply executes the saved option list, +% if there is any.) +% \begin{macrocode} +\def\caption@settype#1{% + \@ifundefined{caption@typ@#1}{}{% + \caption@esetup{\csname caption@typ@#1\endcsname}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@esetup} +% To execute a keyval-list of options saved within a macro we +% need this special version of |\caption@setup| which expands the +% argument first. +% \begin{macrocode} +\def\caption@esetup#1{% + \edef\caption@tempa{\noexpand\caption@setup{#1}}% + \caption@tempa} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\clearcaptionsetup} +% |\clearcaptionsetup|\marg{type}\par +% This removes the saved option list associated with \meta{type}. +% \begin{macrocode} +\newcommand*\clearcaptionsetup[1]{\@nameundef{caption@typ@#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\showcaptionsetup} +% |\showcaptionsetup|\oarg{package}\marg{type}\par +% This command is for debugging issues: It shows the saved option list which +% is associated with \meta{type}. +% \begin{macrocode} +\newcommand*\showcaptionsetup[2][\@firstofone]{% + \GenericWarning{}{% + #1 Caption Info: KV list on `#2'\MessageBreak + #1 Caption Data: (% + \@ifundefined{caption@typ@#2}{% + % Empty -- print nothing. + }{% + \@nameuse{caption@typ@#2}% + }% + )}} +% \end{macrocode} +% \end{macro} +% +% \subsubsection*{Errors} +% +% \begin{macro}{\caption@eh} +% We only provide this simple error message as helper for the user. +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% \subsubsection*{Margin resp. width} +% +% \begin{macro}{\captionmargin} +% \begin{macro}{\captionwidth} +% \begin{macro}{\ifcaption@width} +% |\captionmargin| and |\captionwidth| contains the extra margin +% resp. the total width used for captions. Never set these values in a +% direct way, they are just accessible in user documents to provide +% compatibility to |caption.sty| v$1.x$. +% \begin{macrocode} +\newdimen\captionmargin +\newdimen\captionwidth +\newif\ifcaption@width +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{margin}{\caption@setmargin{#1}} +\DeclareCaptionOption{width}{\caption@setwidth{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setmargin} +% \begin{macro}{\caption@setwidth} +% Note that we can only set one at a time, `margin' \emph{or} `width'. +% Which dimension is actually set will be recognized by |\ifcaption@width|. +% \begin{macrocode} +\newcommand\caption@setmargin{% + \caption@widthfalse + \setlength\captionmargin} +\newcommand\caption@setwidth{% + \caption@widthtrue + \setlength\captionwidth} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection*{Indentions} +% \begin{macro}{\captionindent} +% \begin{macro}{\captionparindent} +% \begin{macro}{\captionhangindent} +% These are the indentions we support. +% \begin{macrocode} +\newdimen\captionindent +\newdimen\captionparindent +\newdimen\captionhangindent +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}% obsolete! +\DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}} +\DeclareCaptionOption{parindent}[\parindent]{\setlength\captionparindent{#1}}% changed v3.0b +\DeclareCaptionOption{hangindent}[0pt]{\setlength\captionhangindent{#1}}% changed v3.0b +% \end{macrocode} +% +% \subsubsection*{Styles} +% +% \begin{macro}{\DeclareCaptionStyle} +% |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV} +% \changes{v3.0a}{17 Jan 04}{We pass through argument no.3 so extra spaces between the arguments do make any harm} +% \begin{macrocode} +\newcommand*\DeclareCaptionStyle[1]{% + \@ifnextchar[{\caption@declarestyle{#1}}{\caption@declarestyle{#1}[]}} +\def\caption@declarestyle#1[#2]#3{% + \global\@namedef{caption@sls@#1}{#2}% + \global\@namedef{caption@sty@#1}{#3}} +\@onlypreamble\DeclareCaptionStyle +\@onlypreamble\caption@declarestyle +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{style}{\caption@setstyle{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setstyle} +% |\caption@setstyle|\marg{name}\\ +% |\caption@setstyle*|\marg{name}\par +% Selecting a caption style means saving the additional +% \meta{single-line-list-of-KV} (this will be done by |\caption@sls|), +% resetting the caption options to the default ones (this will be done using +% |\caption@setdefault|) and executing the \meta{list-of-KV} options +% (this will be done using |\caption@esetup|).\par +% The starred version will give no error message if the given style is not +% defined. +% \begin{macrocode} +\newcommand\caption@setstyle{% + \@ifstar{\caption@@setstyle\@gobble}{\caption@@setstyle\@firstofone}} +\newcommand*\caption@@setstyle[2]{% + \@ifundefined{caption@sty@#2}% + {#1{\PackageError{caption}{Undefined caption style `#2'}{\caption@eh}}}% + {\expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname + \caption@setdefault\caption@esetup{\csname caption@sty@#2\endcsname}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setdefault} +% This resets (nearly) all caption options to the default ones. +% (Note that this does not touch the skips and the positioning!) +% \begin{macrocode} +\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}} +% \end{macrocode} +% \end{macro} +% +% There is only one pre-defined style, called `default'. It's a perfect match +% to the standard \LaTeX\ document classes: If the caption fits in one single +% line, it is typeset centered. +% +% \begin{macrocode} +\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{} +% \end{macrocode} +% +% \subsubsection*{Formats} +% +% \begin{macro}{\DeclareCaptionFormat} +% |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\ +% |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par +% The starred form causes the code being typeset in vertical (instead of +% horizontal) mode, but does not support the |indention=| option. +% \changes{v3.0a}{17 Jan 04}{We pass through argument no.3 so extra spaces between the arguments do make any harm} +% \changes{v3.0d}{9 Feb 05}{Starred form added} +% \begin{macrocode} +\def\DeclareCaptionFormat{% + \@ifstar{\caption@declareformat\@gobble}{\caption@declareformat\@firstofone}} +\newcommand\caption@declareformat[3]{% + \global\expandafter\let\csname caption@ifh@#2\endcsname#1% + \global\long\expandafter\def\csname caption@fmt@#2\endcsname##1##2##3{#3}} +\@onlypreamble\DeclareCaptionFormat +\@onlypreamble\caption@declareformat +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{format}{\caption@setformat{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setformat} +% |\caption@setformat|\marg{name}\par +% Selecting a caption format simply means saving the code (in |\caption@fmt|) +% and if the code should be used in horizontal or vertical mode (|\caption@ifh|). +% \begin{macrocode} +\newcommand*\caption@setformat[1]{% + \@ifundefined{caption@fmt@#1}% + {\PackageError{caption}{Undefined caption format `#1'}{\caption@eh}}% + {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname + \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}} +% \end{macrocode} +% \end{macro} +% +% There are two pre-defined formats, called `@normal' and `hang'. +% \iffalse +% (Note that `normal' is not documented and this name can be a subject of change +% in future versions of this package!) +% \fi +% +% \begin{macrocode} +\DeclareCaptionFormat{@normal}{#1#2#3\par} +\DeclareCaptionFormat{hang}{% + \@hangfrom{#1#2}% + \advance\captionparindent\hangindent + \advance\captionhangindent\hangindent + \caption@@par + #3\par} +% \end{macrocode} +% +% `default' usually maps to `@normal'. +% +% \begin{macrocode} +\def\caption@fmt@default{\caption@fmt@@normal} +\def\caption@ifh@default{\caption@ifh@@normal}% bugfix v3.0e (05-04-28) +% \end{macrocode} +% +% \subsubsection*{Label formats} +% +% \begin{macro}{\DeclareCaptionLabelFormat} +% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2} +% \changes{v3.0a}{17 Jan 04}{We pass through argument no.2 so extra spaces between the arguments do make any harm} +% \begin{macrocode} +\newcommand*\DeclareCaptionLabelFormat[2]{% + \global\expandafter\def\csname caption@lfmt@#1\endcsname##1##2{#2}} +\@onlypreamble\DeclareCaptionLabelFormat +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setlabelformat} +% |\caption@setlabelformat|\marg{name}\par +% Selecting a caption label format simply means saving the code (in |\caption@lfmt|). +% \begin{macrocode} +\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}} +% \end{macrocode} +% \end{macro} +% +% There are three pre-defined label formats, called `empty', `simple', and `parens'. +% +% \begin{macrocode} +\DeclareCaptionLabelFormat{empty}{} +\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2} +\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)} +% \end{macrocode} +% +% `default' usually maps to `simple'. +% +% \begin{macrocode} +\def\caption@lfmt@default{\caption@lfmt@simple} +% \end{macrocode} +% +% \subsubsection*{Label separators} +% +% \begin{macro}{\DeclareCaptionLabelSeparator} +% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code} +% \changes{v3.0a}{17 Jan 04}{We pass through argument no.2 so extra spaces between the arguments do make any harm} +% \begin{macrocode} +\newcommand\DeclareCaptionLabelSeparator[2]{% + \global\long\@namedef{caption@lsep@#1}{#2}} +\@onlypreamble\DeclareCaptionLabelSeparator +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}} +\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setlabelseparator} +% |\caption@setlabelseparator|\marg{name}\par +% Selecting a caption label separator simply means saving the code (in |\caption@lsep|). +% \begin{macrocode} +\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}} +% \end{macrocode} +% \end{macro} +% +% There are six pre-defined label separators, called `none', `colon', `period', `space', `quad', and `newline'. +% +% \begin{macrocode} +\DeclareCaptionLabelSeparator{none}{} +\DeclareCaptionLabelSeparator{colon}{: } +\DeclareCaptionLabelSeparator{period}{. } +\DeclareCaptionLabelSeparator{space}{ } +\DeclareCaptionLabelSeparator{quad}{\quad} +\DeclareCaptionLabelSeparator{newline}{\\}% 05-03-23 (v3.0f) +% \end{macrocode} +% +% `default' usually maps to `colon'. +% +% \begin{macrocode} +\def\caption@lsep@default{\caption@lsep@colon} +% \end{macrocode} +% +% \subsubsection*{Justifications} +% +% \begin{macro}{\DeclareCaptionJustification} +% |\DeclareCaptionJustification|\marg{name}\marg{code} +% \changes{v3.0a}{17 Jan 04}{We pass through argument no.2 so extra spaces between the arguments do make any harm} +% \begin{macrocode} +\newcommand*\DeclareCaptionJustification[2]{% + \global\@namedef{caption@hj@#1}{#2}} +%\newcommand\DeclareCaptionJustification{\DeclareCaptionFont} +\@onlypreamble\DeclareCaptionJustification +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{justification}{\caption@setjustification{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setjustification} +% |\caption@setjustification|\marg{name}\par +% Selecting a caption justification simply means saving the code (in |\caption@hj|). +% \begin{macrocode} +\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@setjustification{\caption@setfont{@hj}} +% \end{macrocode} +% \end{macro} +% +% These are the pre-defined justification code snippets. +% +% \begin{macrocode} +\DeclareCaptionJustification{justified}{} +\DeclareCaptionJustification{centering}{\centering} +\DeclareCaptionJustification{centerfirst}{\caption@centerfirst} +\DeclareCaptionJustification{centerlast}{\caption@centerlast} +\DeclareCaptionJustification{raggedleft}{\raggedleft} +\DeclareCaptionJustification{raggedright}{\raggedright} +% \end{macrocode} +% +% `default' usually maps to `justified'. +% +% \begin{macrocode} +\def\caption@hj@default{\caption@hj@justified} +% \end{macrocode} +% +% \begin{macro}{\caption@centerfirst} +% \begin{macro}{\caption@centerlast} +% Please blame Frank Mittelbach for |\caption@centerfirst| and +% Anne Br\"uggemann-Klein for |\caption@centerlast| |:-)| +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% We also support the upper-case commands offered by the \package{ragged2e} +% package. +% Note that these just map to their lower-case variants if the +% \package{ragged2e} package is not available. +% \begin{macrocode} +\DeclareCaptionJustification{Centering}{% + \caption@ragged\Centering\centering} +\DeclareCaptionJustification{RaggedLeft}{% + \caption@ragged\RaggedLeft\raggedleft} +\DeclareCaptionJustification{RaggedRight}{% + \caption@ragged\RaggedRight\raggedright} +% \end{macrocode} +% +% \begin{macro}{\caption@ragged} +% |\caption@ragged| will be basically defined as\par +% |\AtBeginDocument{\IfFileExists{ragged2e.sty}%|\\ +% | {\RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}%|\\ +% | {\let\caption@ragged\@secondoftwo}}|\par +% but with a warning if the ragged2e package is not avail. +% (This warning will by typeout only ones per option, that's why we need the +% |caption\string#1| stuff.) +% \begin{macrocode} +\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} +% \end{macrocode} +% \begin{macrocode} +\AtBeginDocument{\IfFileExists{ragged2e.sty}{% + \RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}{}} +% \end{macrocode} +% \end{macro} +% +% \subsubsection*{Fonts} +% +% \begin{macro}{\DeclareCaptionFont} +% |\DeclareCaptionFont|\marg{name}\marg{code} +% \changes{v3.0a}{22 Jan 04}{More-than-one token arguments are allowed now} +% \begin{macrocode} +\newcommand\DeclareCaptionFont[2]{% + \define@key{caption@fnt}{#1}[]{\g@addto@macro\caption@tempa{#2}}} +\@onlypreamble\DeclareCaptionFont +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{font}{\caption@setfont{font}{#1}} +\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}} +\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setfont} +% |\caption@setfont|\marg{command}\marg{keyval-list of names}\par +% Selecting a caption font means saving all the code snippets (in |#1|). +% Because we use |\setkeys| recursive here we need to put this into an extra +% group and collect all the code snippets in |\caption@tempa| first. +% \begin{macrocode} +\newcommand*\caption@setfont[2]{% + \let\caption@tempa\@empty + \begingroup + \setkeys{caption@fnt}{#2}% + \endgroup + \expandafter\let\csname caption#1\endcsname\caption@tempa} +% \end{macrocode} +% \end{macro} +% +% These are the pre-defined font code snippets. +% +% \begin{macrocode} +\DeclareCaptionFont{default}{} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionFont{scriptsize}{\scriptsize} +\DeclareCaptionFont{footnotesize}{\footnotesize} +\DeclareCaptionFont{small}{\small} +\DeclareCaptionFont{normalsize}{\normalsize} +\DeclareCaptionFont{large}{\large} +\DeclareCaptionFont{Large}{\Large} +% \end{macrocode} +% +% \begin{macrocode} +\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} +% \end{macrocode} +% +% \begin{macro}{\captionsize} +% The old versions $1.x$ of the \package{caption} package offered this +% command to setup the font size used for captions. We still do +% so old documents will work fine. +% \changes{v3.0c}{16 Jul 04}{Use \cs{providecommand} instead of \cs{newcommand} in respect of the memoir class} +% \begin{macrocode} +\providecommand\captionsize{} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}% changed v3.0a +% \end{macrocode} +% +% \subsubsection*{Vertical spaces before and after captions} +% +% \begin{macro}{\abovecaptionskip} +% \begin{macro}{\belowcaptionskip} +% Usually these skips are defined within the document class, but some +% document classes don't do so. +% \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{macrocode} +\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}} +\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}} +\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}% new 3.0d +% \end{macrocode} +% +% \subsubsection*{Positioning} +% +% These macros handle the right position of the caption. +% Note that the position is actually \emph{not} controlled by the +% \package{caption} kernel options, but by the user (or the package) instead. +% The user can put the |\caption| command where ever he likes! So this stuff +% is only to give us a hint where to put the right skips, the user usually has +% to take care for himself that this hint actually matches the right position. +% The user can also try out the experimental setting |position=auto| which +% means that the \package{caption} package should try to guess the actual +% position of the caption for himself. (But in many cases, for example in +% |longtable|s, this is doomed to fail, so it's not documented in the +% user part of the documentation.) +% +% \begin{macrocode} +\DeclareCaptionOption{position}{\caption@setposition{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setposition} +% Selecting the caption position means that we put |\caption@position| to +% the right value. Please do \emph{not} use the internal macro +% |\caption@position| in your own package or document, but use the wrapper +% macro |\caption@iftop| instead. +% \changes{v3.0a}{22 Jan 04}{Now `t', `above', `b', `below', and `a' are allowed, too} +% \changes{v3.0d}{10 Aug 04}{\cs{caption@defaultpos} added} +% \begin{macrocode} +\newcommand*\caption@setposition[1]{% + \caption@ifinlist{#1}{d,default}{% + \def\caption@position{\caption@defaultpos}% + }{\caption@ifinlist{#1}{t,top,above}{% + \let\caption@position\@firstoftwo + }{\caption@ifinlist{#1}{b,bottom,below}{% + \let\caption@position\@secondoftwo + }{\caption@ifinlist{#1}{a,auto}{% + \let\caption@position\@undefined + }{% + \PackageError{caption}{Undefined caption position `#1'}{\caption@eh}% + }}}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@defaultpos} +% The default `position' is `bottom', this means that the (larger) skip will +% be typeset above the caption. This correspondents to the |\@makecaption| +% implementation in the standard \LaTeX\ document classes. +% \begin{macrocode} +%\caption@setdefaultpos{b}% default = bottom +\let\caption@defaultpos\@secondoftwo +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@iftop} +% |\caption@iftop|\marg{true-code}\marg{false-code}\par +% (If |\caption@position| is set to `auto' we assume a `bottom' position.) +% \begin{macrocode} +\newcommand\caption@iftop{% bugfixed v3.0a, improved v3.0d + \ifx\caption@position\@undefined + \expandafter\@secondoftwo + \else + \expandafter\caption@position + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@fixposition} +% This macro checks if the `position' is set to `auto'. +% If yes, |\caption@autoposition| will be called to +% set |\caption@position| to a proper value we can actually use. +% \begin{macrocode} +\newcommand\caption@fixposition{% + \ifx\caption@position\@undefined + \caption@autoposition + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@autoposition} +% We guess the actual position of the caption by checking |\prevdepth|. +% \begin{macrocode} +\newcommand\caption@autoposition{% bugfixed v3.0a + \ifvmode + \ifodd\caption@debug\relax + \edef\caption@tempa{\the\prevdepth}% + \PackageInfo{caption}{\protect\prevdepth=\caption@tempa}% + \fi +% +% \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\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 +% +% \caption@setposition{b}% + \let\caption@position\@secondoftwo + \fi} +% \end{macrocode} +% \end{macro} +% +% \subsubsection*{Hooks} +% +% \begin{macro}{\AtBeginCaption} +% \begin{macro}{\AtEndCaption} +% |\AtBeginDocument| \marg{code}\\ +% |\AtEndDocument| \marg{code}\par +% These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|. +% \begin{macrocode} +\newcommand\caption@beginhook{} +\newcommand\caption@endhook{} +\newcommand\AtBeginCaption{\l@addto@macro\caption@beginhook} +\newcommand\AtEndCaption{\l@addto@macro\caption@endhook} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection*{Miscellaneous options} +% +% \begin{macrocode} +\DeclareCaptionOption{parskip}[5pt]{\AtBeginCaption{\setlength\parskip{#1}}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}}% new v3.0b +\DeclareCaptionOption{singlelinecheck}[1]{\caption@setbool{slc}{#1}} +\DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}}% new v3.0d +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionOption{debug}{\def\caption@debug{#1}} +% \end{macrocode} +% +% \subsubsection*{Initialization of parameters} +% +% \begin{macrocode} +\captionsetup{style=default,position=default,listof=1,strut=1,debug=0} +% \end{macrocode} +% +% \begin{macro}{\ifcaption@star} +% If the starred form of |\caption| is used, this will be set to |true|. +% (Note: This will be replaced by |\caption@iflabel| in future versions +% of the caption package, so I can use |\caption@setbool| so set this +% value.) +% \begin{macrocode} +\newif\ifcaption@star +% \end{macrocode} +% \end{macro} +% +% \subsubsection*{Typesetting the caption} +% +% \begin{macro}{\caption@make} +% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text} +% \begin{macrocode} +\newcommand\caption@make[2]{% + \caption@@make{\caption@lfmt{#1}{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@@make} +% |\caption@@make|\marg{caption label}\marg{caption text} +% \begin{macrocode} +\newcommand\caption@@make[2]{% +% \begingroup + \caption@beginhook + \caption@calcmargin +% \end{macrocode} +% +% Special single-line treatment +% (Improvement v3.0d: moved to here) +% +% \begin{macrocode} + \caption@ifslc{% + \ifx\caption@sls\@empty\else + \caption@startslc + \setbox\@tempboxa\hbox{\caption@@@make{#1}{#2}}% + \ifdim\wd\@tempboxa >\captionwidth + \caption@endslc + \else + \caption@endslc + \caption@esetup\caption@sls + \caption@calcmargin + \fi + \fi}{}% +% \end{macrocode} +% +% Bugfix v3.0d: Use |\@tempdima| instead of |\captionmargin|, |\ifdim added| (04-10-26) +% +% \begin{macrocode} + \@tempdima\captionmargin + \caption@ifh{\advance\@tempdima by \captionindent}% + \ifdim\@tempdima=\z@\else + \hskip\@tempdima + \fi +% \end{macrocode} +% +% Bugfix v3.0d: Use |\@tempdima| instead of |\captionwidth| (04-10-26) +% +% \begin{macrocode} + \@tempdima\captionwidth + \caption@ifh{\advance\@tempdima by -\captionindent}% + \caption@startbox\@tempdima +% \end{macrocode} +% +% Bugfix v3.0b: |\ifdim| added (04-05-05)\\ +% Bugfix v3.0d: |\leavevmode| added (05/02/09)\\ +% Improvement v3.0d: |\caption@ifh| (05/02/09) +% +% \begin{macrocode} + \caption@ifh{% + \ifdim\captionindent=\z@ + \leavevmode + \else + \hskip-\captionindent + \fi}% +% \end{macrocode} +% +% Bugfix v3.0d: |\strut| moved from here to |\caption@@@make| +% +% \begin{macrocode} + \caption@@@make{#1}{#2}% +% \end{macrocode} +% +% \begin{macrocode} + \caption@endbox +% \end{macrocode} +% +% Bugfix v3.0d: This |\hskip| added +% +% \begin{macrocode} + \ifdim\captionmargin=\z@\else + \hskip\captionmargin + \fi +% \end{macrocode} +% +% \begin{macrocode} + \caption@endhook +% \endgroup + \global\caption@starfalse} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@calcmargin} +% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid values. +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@startslc} +% Re-define anything which would disturb the single line check\par +% Bugfix v3.0b: re-definition of |\label| \& |\@footnotetext| was missing here\\ +% Improvement v3.0b: re-define |\stepcounter| instead of |\footnote(mark)|\\ +% Improvement v3.0d: |\let\caption@hj\relax| added +% \begin{macrocode} +\newcommand\caption@startslc{% + \begingroup + \let\label\@gobble\let\@footnotetext\@gobble + \def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}% + \let\caption@hj\relax} +\newcommand\caption@endslc{% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@startbox} +% \begin{macro}{\caption@endbox} +% These macros start and end the box which surrounds the caption paragraph. +% \begin{macrocode} +\newcommand*\caption@startbox[1]{\vbox\bgroup\hsize#1}% +%\newcommand*\caption@startbox[1]{\vbox\bgroup\setlength\hsize{#1}\@parboxrestore}% +\newcommand*\caption@endbox{\egroup} +%\newcommand*\caption@endbox{\@finalstrut\strutbox\@@par\egroup} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@@@make} +% |\caption@@@make|\marg{caption label}\marg{caption text}\par +% This one finally typesets the caption paragraph, without margin and indention. +% \begin{macrocode} +\newcommand\caption@@@make[2]{% +% \end{macrocode} +% +% Empty text? Then use no caption label separator. +% +% \begin{macrocode} + \caption@ifempty{#2}{% changed v3.0e + \let\caption@lsep\relax + \let\caption@ifstrut\@secondoftwo % added v3.0e + }% +% \end{macrocode} +% +% Take care that |\captionparindent| and |\captionhangindent| will be used +% to typeset the paragraph. +% +% \begin{macrocode} + \def\caption@@par{% + \parindent\captionparindent\hangindent\captionhangindent}% + \@setpar{\@@par\caption@@par}\caption@@par +% \end{macrocode} +% +% Finally the caption will be typeset. +% +% \begin{macrocode} + \caption@hj\captionsize\captionfont +% \end{macrocode} +% Bugfix v3.0e: Handling of |\ifcaption@star| changed +% \begin{macrocode} + \caption@fmt{\ifcaption@star\else{\captionlabelfont#1}\fi}% + {\ifcaption@star\else{\captionlabelfont\caption@lsep}\fi}% + {{\captiontextfont +% \end{macrocode} +% Bugfix v3.0d: Use some kind of |\@startstrut\strutbox| instead of |\strut| (04-12-16) +% \begin{macrocode} + \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}% +% \end{macrocode} +% Bugfix v3.0b: |\allowhyphens| added (04-05-06) +% \begin{macrocode} + \nobreak\hskip\z@skip + #2% +% \end{macrocode} +% Bugfix v3.0d: |\@finalstrut\strutbox| added (05-01-23) +% \begin{macrocode} +% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}% + \caption@ifstrut{\@finalstrut\strutbox}{}% + \par}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifempty} +% |\caption@ifempty|\marg{text}\marg{if-clause}\\ +% (new v3.0e, 05/05/05) +% \begin{macrocode} +\newcommand\caption@ifempty[1]{% + \def\caption@tempa{#1}% + \def\caption@tempb{\ignorespaces}% + \ifx\caption@tempa\caption@tempb + \let\caption@tempa\@empty + \fi + \ifx\caption@tempa\@empty + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi} +% \end{macrocode} +% \end{macro} +% +% \iffalse +%</kernel> +% \fi +% +% +% \subsection{Main package} +% \iffalse +%<*package> +% \fi +% +% \subsubsection*{Identification} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{caption}[2005/06/28 v3.0g Customising captions (AS)] +% \end{macrocode} +% +% \subsubsection*{Loading the caption kernel} +% +% \begin{macrocode} +\RequirePackage{caption3} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionOption{type}{\def\@captype{#1}}% new v3.0d +% \end{macrocode} +% +% \subsubsection*{Float names} +% +% \begin{macro}{\caption@floatname} +% |\caption@floatname|\marg{type}\par +% Usually all float names (which partly build the caption label) +% follow the same naming convention. But some packages (for example +% the \package{float} package) do not, so we use this wrapper macro which +% can be extended later on. +% \begin{macrocode} +\newcommand*\caption@floatname[1]{\@nameuse{#1name}} +% \end{macrocode} +% \end{macro} +% +% \subsubsection*{Support for |figure| and |table|} +% +% \changes{v3.0a}{9 Jan 04}{Options `figureposition' and `tableposition' added} +% \begin{macrocode} +\DeclareCaptionOption*{figureposition}{\captionsetup[figure]{position=#1}}% new v3.0a +\DeclareCaptionOption*{tableposition}{\captionsetup[table]{position=#1}}% new v3.0a +% \end{macrocode} +% +% \subsubsection*{Configuration files} +% +% \begin{macrocode} +\DeclareCaptionOption{config}[caption]{% + \InputIfFileExists{#1.cfg}{\typeout{*** Local configuration file + #1.cfg used ***}}% + {\PackageWarning{caption}{Configuration + file #1.cfg not found}}} +% \end{macrocode} +% +% \subsubsection*{Compatibility options (caption v$1.x$)} +% +% \begin{macrocode} +\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}} +% \end{macrocode} +% +% \begin{macrocode} +\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}} +% \end{macrocode} +% +% \begin{macrocode} +\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} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionOption*{nooneline}[]{\caption@setbool{slc}{0}} +% \end{macrocode} +% +% \begin{macrocode} +\caption@setbool{ruled}{0} +\DeclareCaptionOption*{ruled}[]{\caption@setbool{ruled}{1}} +% \end{macrocode} +% +% \subsubsection*{Generic package support} +% +% \begin{macro}{\DeclareCaptionPackage} +% Each single package support can be switched on or off by using the +% appropriate option. By default all of them are enabled. +% \begin{macrocode} +\newcommand*\DeclareCaptionPackage[1]{% + \caption@setbool{pkt@#1}{1}% + \DeclareCaptionOption*{#1}{\caption@setbool{pkt@#1}{##1}}} +\AtEndOfPackage{\let\DeclareCaptionPackage\@undefined} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifpackage} +% |\caption@ifpackage|\marg{package name}\marg{package macro}\marg{package code} +% \begin{macrocode} +\newcommand\caption@ifpackage[3]{% + \caption@ifbool{pkt@#1}{% + \@ifundefined{#2}% + {\let\next\AtBeginDocument}% + {\let\next\@firstofone}% + }{% + \let\next\@gobble + }% +% + \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{% + \expandafter\ifx\csname #2\endcsname\relax + \else + #3 + \fi}} +\AtEndOfPackage{\let\caption@ifpackage\@undefined} +% \end{macrocode} +% \end{macro} +% +% These are the packages we support: +% +% \begin{macrocode} +\DeclareCaptionPackage{caption} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionPackage{float} +\DeclareCaptionPackage{floatrow} +\DeclareCaptionPackage{hyperref} +\DeclareCaptionPackage{hypcap} +\DeclareCaptionPackage{listings} +\DeclareCaptionPackage{longtable} +\DeclareCaptionPackage{rotating} +\DeclareCaptionPackage{sidecap} +\DeclareCaptionPackage{supertabular} +% \end{macrocode} +% +% \begin{macro}{\ProcessOptionsWithKV} +% We process our options using the keyval package. +% \begin{macrocode} +\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 +% \end{macrocode} +% Bugfix, see |<400D360C.9678329F@gmx.net>| for details +% \begin{macrocode} + \let\CurrentOption\@empty + \AtEndOfPackage{\let\@unprocessedoptions\relax}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\ProcessOptionsWithKV{caption} +\let\ProcessOptionsWithKV\@undefined +% \end{macrocode} +% +% \begin{macrocode} +\caption@ifbool{pkt@caption}{}{\endinput} +\@nameundef{caption@ifpkt@caption} +% \end{macrocode} +% +% \subsubsection*{Usefull stuff} +% +% \begin{macro}{\captionof} +% |\captionof|(|*|)\marg{type}\oarg{lst\_entry}\marg{heading} +% \begin{macrocode} +\def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}} +\newcommand*\caption@of[2]{\def\@captype{#2}#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ContinuedFloat} +% |\ContinuedFloat| +% \begin{macrocode} +\providecommand\ContinuedFloat{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\ContinuedFloat outside float}\@ehd + \else + \addtocounter\@captype\m@ne + \caption@ContinuedFloat\@captype + \fi}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ContinuedFloat} +% \begin{macro}{\caption@resetContinuedFloat} +% \begin{macrocode} +\let\caption@ContinuedFloat\@gobble +\let\caption@resetContinuedFloat\@gobble +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection*{Internal helpers} +% +% \begin{macro}{\caption@begin} +% |\caption@begin|\marg{type} (changed in v3.0b+v3.0e) +% \begin{macrocode} +\newcommand*\caption@begin[1]{% + \caption@resetContinuedFloat{#1}% + \begingroup + \caption@setfloattype{#1}% +% \end{macrocode} +% +% \changes{v3.0e}{12 Apr 05}{Check for default label format added} +% \begin{macrocode} +% \caption@setfnum{#1}% + \ifx\caption@lfmt\caption@lfmt@default\else + \@namedef{fnum@#1}{% + \caption@lfmt{\caption@floatname{#1}}{\@nameuse{the#1}}}% + \fi +% \end{macrocode} +% +% \begin{macrocode} + \caption@fixposition + \global\let\caption@fixedposition\caption@position +% \end{macrocode} +% +% \begin{macrocode} + \caption@@begin{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@beginex} +% |\caption@beginex|\marg{type}\marg{list entry} +% \begin{macrocode} +\newcommand*\caption@beginex[1]{% + \caption@begin{#1}% + \caption@preparelof} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@end} +% |\caption@end| +% \begin{macrocode} +\newcommand*\caption@end{% + \caption@@end + \endgroup +% \end{macrocode} +% +% \begin{macrocode} + \let\caption@position\caption@fixedposition} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setfloattype} +% A macro for setting up the right float type within |\@caption|, |\LT@makecaption| etc. +% Usually this is equivalent to |\caption@settype| but I made it an own macro so +% I can extend it later on, for example if the \package{float} package is loaded. +% \begin{macrocode} +\let\caption@setfloattype\caption@settype% new v3.0a +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@letfloattype} +% |\caption@letfloattype|\marg{type}\marg{extra code}\\ +% (new in v3.0b, additional argument in v3.0e) +% \begin{macrocode} +\newcommand*\caption@letfloattype[2]{% + \def\caption@setfloattype##1{% + \caption@settype{##1}#2\caption@settype{#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@preparelof} +% |\caption@preparelof|\marg{list entry} +% \begin{macrocode} +\newcommand*\caption@preparelof[1]{% changed v3.0b + \caption@iflof% + {\def\caption@tempa{#1}}% + {\let\caption@tempa\@empty}% + \ifx\caption@tempa\@empty + \def\addcontentsline##1##2##3{}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@@begin} +% \begin{macro}{\caption@@end} +% |\caption@@begin|\marg{type}\\ +% |\caption@@end| +% \begin{macrocode} +\let\caption@@begin\@gobble % new v3.0a +\let\caption@@end\@empty % new v3.0a +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection*{Caption support} +% +% Some packages (like the \package{hyperref} package for example) redefines +% |\caption| and |\@caption|, too, but without chaining to the previous +% definition. So we have to use |\AtBeginDocument| here, so we can make sure +% our definition don't get lost. +% +% \begin{macrocode} +\AtBeginDocument{% + \let\caption@old\caption + \let\caption@@old\@caption +% \end{macrocode} +% +% \begin{macrocode} + \@ifundefined{cc@caption}{% +% \end{macrocode} +% +% \begin{macro}{\caption} +% Define |\caption*| \ldots\\ +% (07/18/03: |\global| added, so this works with sidecap) +% (05/22/05: |\ContinuedFloat| added) +% \begin{macrocode} + \def\caption{\caption@caption\caption@old}% + \def\caption@caption#1{% + \@ifstar{\ContinuedFloat\global\caption@startrue #1[]}{#1}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@caption} +% Define |\caption[]{|\ldots|}| \ldots +% \begin{macrocode} + \long\def\@caption#1[#2]#3{% + \caption@beginex{#1}{#2}% + \caption@@old{#1}[{#2}]{#3}% + \caption@end}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + }{% +% \end{macrocode} +% +% Minimum captcont package support (bugfixed v3.0c, 04-07-15) +% +% \begin{macrocode} + \PackageInfo{caption}{captcont package v2.0 detected}% + \def\caption@caption#1{#1}% added v3.0c + }% +} +% \end{macrocode} +% +% \begin{macro}{\@makecaption} +% |\@makecaption|\marg{label}\marg{text}\par\bigskip +% Original code (from |latex/base/classes.dtx|): +% \begin{verbatim} +% \long\def\@makecaption#1#2{% +% \vskip\abovecaptionskip +% \sbox\@tempboxa{#1: #2}% +% \ifdim \wd\@tempboxa >\hsize +% #1: #2\par +% \else +% \global \@minipagefalse +% \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% +% \fi +% \vskip\belowcaptionskip} +% \end{verbatim} +% \begin{macrocode} +\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}} +% \end{macrocode} +% \end{macro} +% +% \subsubsection*{KOMA-script classes support} +% (new in 3.0a) +% +% \changes{v3.0a}{18 Jan 04}{Minimum adaption to KOMA-Script added} +% \begin{macrocode} +\AtBeginDocument{\let\scr@caption\caption} +% \end{macrocode} +% +% \subsubsection*{float package support} +% +% \iffalse +% Rewritten v0.3f: more straight-ahead implementation, but only works with v1.3 now +% (the old code incl. 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} +% +% So our main goal is to re-define |\float@caption| so our macro +% |\caption@@make| will be used instead of |\@fs@capt|. +% +% To allow different caption styles for different float styles we will also +% determine the current float style (e.g. `ruled') at run time and setup +% a caption style (and additional settings) with the same name, if defined. +% +% \begin{macro}{\caption@setfloatposition} +% First of all we provide a macro which converts |\@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 the \package{caption} package (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. +% \begin{macrocode} +\def\caption@setfloatposition{% + \caption@setposition{\@fs@iftopcapt t\else b\fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@ifpackage{float}{@float@setevery}{% + \PackageInfo{caption}{float package v1.3 (or newer) detected}% +% \end{macrocode} +% +% Since |\float@caption| puts the float contents into a savebox we need +% a special version of |\captionof| which `unfolds' this box afterwards, +% so the caption actually gets typeset. Furthermore we have to typeset +% the spacing above and below the caption for ourself, since this space is +% not part of the box. +% +% Please note that this version of |\captionof| only works \emph{outside} +% floating environments defined with the float package, so for example +% a |\captionof{Program}| used within a `standard' |figure| or a +% |minipage| will work fine, but not within a re-styled |figure| or +% an |Example| environment defined with |\newfloat|. +% (We don't check for this so you'll get wired errors if you try to do so!) +% +% \begin{macro}{\caption@of@float} +% Usually no special action is necessary, so we define |\caption@of@float| +% to |\@gobble|. We will redefine it later on to |\@firstofone| to activate +% the code which `unfolds' the savebox. +% \begin{macrocode} + \let\caption@of@float\@gobble +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@of} +% If the float is defined by the float package (which means |\fst@|\meta{type} +% is defined) we activate the special treatment for such captions typeset +% with |\captionof|. Furthermore we `execute' this float style, so +% |\@fs@iftopcapt| is set to its proper value. +% \begin{macrocode} + \renewcommand*\caption@of[2]{% + \@ifundefined{fst@#2}{}{% + \let\caption@of@float\@firstofone + \@nameuse{fst@#2}\@float@setevery{#2}}% + \def\@captype{#2}#1}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\float@caption} +% Our version of |\float@caption| nearly looks like our version of |\@caption|. +% The main differences are that |\@fs@capt| will be replaced by our |\caption@@make| +% and that the savebox called |\@floatcapt| will be unfolded if required. (See above) +% \begin{macrocode} + \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}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@float@setevery} +% |\@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 adaptions and to setup the proper caption style +% (if defined) and additional settings declared with +% |\captionsetup|\oarg{float style}. +% \begin{macrocode} + \let\caption@float@setevery\@float@setevery + \def\@float@setevery#1{% + \caption@float@setevery{#1}% +% \end{macrocode} +% +% \LaTeX{} and most packages use |\|\meta{type}|name| +% to provide a macro for the float 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 don't follow this naming convention, +% it uses |\fname@|\meta{type} instead. So we have to adapt +% |\caption@floatname| here, so our captions will be still ok. +% +% \begin{macrocode} + \def\caption@floatname##1{\@nameuse{fname@#1}}% +% \end{macrocode} +% +% |\newfloat| and |\restylefloat| saves the \emph{actual} definition of +% |\@caption| or |\float@caption| in |\@float@c@|\meta{captype} with |\let| +% (instead of using |\def|), so redefinitions of |\@caption| (and of course +% our redefinition of |\float@caption|) will never been used if the +% |\newfloat| or |\restylefloat| command takes place in front of the +% redefinitions provided by the \package{caption} or other packages like the +% \package{hyperref} package. +% +% So here we determine if the user has used |\restylefloat| or +% |\restylefloat*| and bring |\@float@c@|\meta{captype} up-to-date. +% This is quite easy: If |\@float@c@|\meta{captype} is the same as the +% original or our own definition of |\float@caption|, the user has used +% |\restylefloat| (and |\float@caption| should be used), otherwise +% we assume he has used |\restylefloat*| (and |\@caption| should be used). +% (This test will fail if some other package re-defines |\float@caption|, +% too, so we have to assume that we are the only one.) +% +% \begin{macrocode} + \expandafter\let\expandafter\caption@tempa\csname @float@c@#1\endcsname + \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 +% \end{macrocode} +% +% If the floating environment is defined with |\newfloat| or |\restylefloat| +% (and \emph{not} with |\restylefloat*|), |\@float@c@|\meta{type} +% will now be identical to |\float@caption|. +% +% \begin{macrocode} + \expandafter\ifx\csname @float@c@#1\endcsname\float@caption +% \end{macrocode} +% +% First of all we set the caption position to it's proper value. +% (See above definition of |\caption@setfloatposition|) +% +% \begin{macrocode} + \caption@setfloatposition% changed v3.0b+f +% \end{macrocode} +% +% Now we'll have to determine the current float style. +% This 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} +% +% So here is what we do: We copy |\fst@|\meta{float type} to |\caption@fst| and +% make it a string so we can gobble the first four tokens (= |\fs@|), so only the +% the name of the float style is left. +% +% \begin{macrocode} + \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}% +% \edef\caption@fst{\caption@fst}% +% \end{macrocode} +% +% |\caption@fst| now contains the float style (e.g. `ruled') +% so we can use it to set the corresponding style (if defined) and additional options. +% +% \begin{macrocode} + \caption@setstyle*\caption@fst + \caption@settype\caption@fst% new v3.0f +% \end{macrocode} +% +% \begin{macrocode} + \fi}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fs@plaintop} +% \begin{macro}{\fs@boxed} +% The float styles |plaintop| and |boxed| don't use our skip which can be set +% with |skip=| : |plaintop| uses |\belowcaptionskip| instead of +% |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|. +% So we patch the according float style macros here. +% \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{macrocode} +} +% \end{macrocode} +% +% \begin{macrocode} +\captionsetup[boxed]{skip=2pt}% +% \end{macrocode} +% +% 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 additional caption settings to emulate the behaviour +% of the \package{caption} package v$1.x$ option |ruled| instead: +% The current caption settings will be used, but without margin and without +% `single-line-check'. +% \begin{macrocode} +\caption@ifbool{ruled}{% + \captionsetup[ruled]{margin=0pt,singlelinecheck=0}% new v3.0f +}{% v3.0f: "strut=0" added + \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}} +\let\caption@ifruled\@undefined +% \end{macrocode} +% +% \subsubsection*{floatrow package support} +% +% The \package{floatrow} package is adapted for usage with the +% \package{caption} package. So the main work has already been done, +% there are only two little things we have to take care about. +% +% \begin{macrocode} +\caption@ifpackage{floatrow}{flrow@setlist}{% + \PackageInfo{caption}{floatrow package v0.1f (or newer) detected}% +% \end{macrocode} +% +% \begin{macro}{\caption@of} +% Captions typeset with |\captionof| should have the correct layout, +% so we have to `activate' this layout here with |\flrow@setlist|. +% \par{\small (Please note that this version of |\captionof| has the same +% restrictions than the |\captionof| offered for floating environments +% defined with the \package{float} package, see above.)} +% \begin{macrocode} + \renewcommand*\caption@of[2]{% + \def\@captype{#2}\flrow@setlist{{#2}}#1}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@floatname} +% The \package{floatrow} package followes the same naming convention +% as the \package{float} package; so we have to adapt |\caption@floatname| +% here, too. +% \begin{macrocode} + \renewcommand*\caption@floatname[1]{% + \@nameuse{\@ifundefined{fname@#1}{#1name}{fname@#1}}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +} +% \end{macrocode} +% +% +% \subsubsection*{hyperref package support} +% +% When the \package{hyperref} package is used we have the problem +% that the usage of |\ContinuedFloat| will create duplicate +% hyperlinks -- both |\@currentHlabel| and |\@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 \#}|.|\meta{continue \#}\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.)} +% \par{\small Note: This does not help if |\Hy@naturalnamestrue| is set.} +% +% \begin{macrocode} +\caption@ifpackage{hyperref}{theHfigure}{% + \PackageInfo{caption}{hyperref package v6.74m (or newer) detected}% +% \end{macrocode} +% +% \begin{macro}{\caption@ContinuedFloat} +% If |\theH|\meta{type} is defined, we extend it with |.|\meta{continue \#}. +% Furthermore we set |\caption@resetContinuedFloat| to |\@gobble| so the +% continuation counter will not be reset to zero inside |\caption|. +% \begin{macrocode} + \def\caption@ContinuedFloat#1{% + \@ifundefined{theH#1}{}{% + \@ifundefined{CF@#1}{% + \expandafter\newcount\csname CF@#1\endcsname + \caption@resetContinuedFloat{#1}}{}% + \global\advance\csname CF@#1\endcsname\@ne\relax + \expandafter\l@addto@macro\csname theH#1\endcsname{.\expandafter\@arabic\csname CF@#1\endcsname}% + \let\caption@resetContinuedFloat\@gobble + }}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@resetContinuedFloat} +% If a continuation counter is defined, we reset it. +% \begin{macrocode} + \def\caption@resetContinuedFloat#1{% + \@ifundefined{CF@#1}{}{\global\csname CF@#1\endcsname\z@\relax}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +} +% \end{macrocode} +% +% +% \subsubsection*{hypcap package support} +% +% When the \package{hypcap} package is used the following problems occur: +% \begin{enumerate} +% \item The \package{hypcap} package uses |\capstart|, |\hc@caption|, and +% |\hc@@caption| instead of |\caption| and |\@caption|. +% So we have to patch these macros, too. +% \item |\caption| will be saved to |\hc@org@caption| when the +% \package{hypcap} package is loaded. +% We have to change this so our definition of |\caption| will always be +% used. +% \item Both, |\capstart| and |\hc@@caption|, call |\hyper@makecurrent|. +% But since we offer |\ContinuedFloat| the float counters could have changed +% between these both calls! So we fix this by saving the \package{hyperref} +% reference (= |\@currentHref|) in |\capstart| and restoring it later on in +% |\hc@@caption|. +% \par{\small (This also fixes the problem that \package{hypcap} does not +% work if |\Hy@hypertexnamesfalse| is set. This come in handy; we set +% it locally to avoid duplicated \package{hyperref} labels which could +% occur if |\ContinuedFloat| will be used.)} +% \item |\capstart| will call |\H@refstepcounter| to increase the float +% number. This collides with a following|\ContinuedFloat|, too, so we have +% to move this call from here to |\caption|. (Since we set +% |\Hy@hypertexnamesfalse| we can do this without problems.) +% \end{enumerate} +% +% \begin{macrocode} +\caption@ifpackage{hypcap}{hc@caption}{% + \PackageInfo{caption}{hypcap package v1.0 (or newer) detected}% +% \end{macrocode} +% +% \begin{macro}{\capstart} +% Here comes our version of |\capstart|: +% \begin{macrocode} + \let\caption@capstart\capstart + \def\capstart{% +% \end{macrocode} +% First of all we update |\hc@org@caption| to correct the problem that the +% \package{hypcap} package has saved an older definition of |\caption|. +% \begin{macrocode} + \let\hc@org@caption\caption +% \end{macrocode} +% Since we don't know the float counter yet (it could be changed with +% |\ContinuedFloat| afterwards!) we make sure |\H@refstepcounter| will +% not be used and |\Hy@hypertexnamesfalse| is set, so unique +% \package{hyperref} labels will be generated by the original +% definition of |\capstart|. +% Afterwards we save the reference which was generated by +% |\hyper@makecurrent|. +% \begin{macrocode} + \begingroup + \let\H@refstepcounter\@gobble + \Hy@hypertexnamesfalse + \caption@capstart + \global\let\caption@currentHref\@currentHref + \endgroup +% \end{macrocode} +% The \package{hypcap} package restores the previous definition of |\caption| +% inside |\hc@@caption|. But since we will call this inside a group later on +% (making this restauration non-working), we have to make this for ourself +% inside |\caption|. +% (This would not be necessary if \package{hypcap} would do this inside +% |\hc@caption| instead of |\hc@@caption|.)\par +% Additionally we increase the float counter here (since we have suppressed this +% in |\capstart|) and use |\caption@caption| here, so |\caption*| will work as +% expected. +% \begin{macrocode} + \def\caption{% + \let\caption\hc@org@caption + \H@refstepcounter\@captype + \caption@caption\hc@caption}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hc@@caption} +% Here comes our version of |\hc@@caption|: +% \begin{macrocode} + \let\caption@hc@@caption\hc@@caption + \long\def\hc@@caption#1[#2]#3{% + \caption@beginex{#1}{#2}% +% \end{macrocode} +% Beside the usual |\caption@begin| and |\caption@end| stuff (to support local +% options etc.) we make sure our saved \package{hyperref} reference will be +% used. +% \begin{macrocode} + \let\caption@hyper@makecurrent\hyper@makecurrent + \def\hyper@makecurrent\@captype{% + \let\hyper@makecurrent\caption@hyper@makecurrent + \global\let\@currentHref\caption@currentHref}% +% \end{macrocode} +% \begin{macrocode} + \caption@hc@@caption{#1}[{#2}]{#3}% + \caption@end}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +} +% \end{macrocode} +% +% +% \subsubsection*{listings package support} +% +% \begin{macrocode} +\caption@ifpackage{listings}{lst@MakeCaption}{% + \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}% +% +} +% \end{macrocode} +% +% \subsubsection*{longtable package support} +% +% \begin{macrocode} +\caption@ifpackage{longtable}{LT@makecaption}{% + \PackageInfo{caption}{longtable package v3.15 (or newer) detected}% +% +% Original code: +% \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}}} +% + \def\LT@makecaption#1#2#3{% +% \noalign{\vskip...}% +% + \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{% +% + \caption@letfloattype{longtable}{% bugfixed v3.0e + \ifdim\LTcapwidth=4in \else + \caption@setwidth\LTcapwidth + \fi}% +% \caption@setdefaultpos{t}% default = top + \let\caption@defaultpos\@firstoftwo% default = top + \def\caption@autoposition{% does not work within \end(last)foot! + \caption@setposition{\ifcase\LT@rows t\else b\fi}}% +% + \caption@begin{table}% +% +% This skip has 2 purposes: +% 1. Correct the heigth of the \parbox[t]. Usual it's the height of +% the very first line, but because of our extra skip it's always 0pt. +% 2. Correct \arraystretch, which usually also affect the longtable +% caption. (If this is not requested, take \strutbox instead.) +% NOTE: This is only a quick workaround, it has to be revised later on. +% + \vskip-\ht\@arstrutbox +% + \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}% +% \let\caption@beginbox\caption@beginLTbox + \caption@startrue#1\caption@starfalse + \caption@@make{#2}{#3}\endgraf + \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}% + \caption@end}% +% + \hss}}}% +% +} +% \end{macrocode} +% +% \subsubsection*{rotating package support} +% +% \begin{macrocode} +\caption@ifpackage{rotating}{@rotcaption}{% + \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}% +% +% Original code: +% \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 +% \else% +% \rotatebox{90}{\box\@tempboxa}% +% \fi +% \hspace{12pt}% +% } +% + \long\def\@makerotcaption#1#2{% + \rotatebox{90}{% + \begin{minipage}{.8\textheight}% + \caption@@make{#1}{#2}% + \end{minipage}% + }\par + \hspace{12pt}}% +% +} +% \end{macrocode} +% +% \subsubsection*{sidecap package support} +% +% \begin{macrocode} +\caption@ifpackage{sidecap}{endSC@FLOAT}{% + \PackageInfo{caption}{sidecap package v1.4d (or newer) detected}% +% +% First of all, we let sidecap use an actual definition of \caption: +% (This is only required for version 1.5d of the sidecap package.) +% + \let\SC@caption=\caption +% +% Make \caption* and local settings (\captionsetup) work +% + \let\caption@SC@zfloat\SC@zfloat + \def\SC@zfloat#1#2#3[#4]{% +% #2 = `figure' or `table' => \SC@captype + \caption@SC@zfloat{#1}{#2}{#3}[#4]% +% + \global\let\SC@CAPsetup\@empty + \def\captionsetup##1{\g@addto@macro\SC@CAPsetup{,##1}}% +% + \let\caption@old\caption +% \def\caption{\renewcommand\captionsetup[1]{}\caption@caption\caption@old}% + \def\caption{\caption@caption\caption@old}% + }% +% +% Before typesetting the caption, we set the captionmargin to zero +% because the extra margin is only disturbing here. +% (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.) +% Furthermore \SC@justify will override the caption justification, if set. +% +% Very old version (1.4): \SC@justify is not defined +% Older versions (1.5): \SC@justify is \relax when not set +% Newer versions (1.6): \SC@justify is \@empty when not set +% + \let\caption@endSC@FLOAT\endSC@FLOAT + \def\endSC@FLOAT{% +% (Note that \@captype isn't defined so far, this will be done inside +% the original definition of \endSC@FLOAT.) +% We set \@captype already here, so \captionsetup will +% work with \@captype-based options, too. (new v3.0d) + \let\@captype\SC@captype + \caption@esetup\SC@CAPsetup +% + \caption@letfloattype{SC\@captype}{% bugfixed v3.0e + \caption@setmargin\z@ + \@ifundefined{SC@justify}{}{% + \ifx\SC@justify\@empty\else + \let\caption@hj\SC@justify + \let\SC@justify\@empty + \fi}}% +% + \long\def\caption@ifempty##1{% bugfix v3.0e + \ifx\SC@CAPtext\@empty + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi}% +% + \caption@endSC@FLOAT}% +% +} +% \end{macrocode} +% +% \subsubsection*{supertabular package support} +% +% \begin{macrocode} +\def\caption@setSTposition{% + \caption@setposition{\if@topcaption t\else b\fi}} +% +\caption@ifpackage{supertabular}{ST@caption}{% + \PackageInfo{caption}{supertabular package detected}% +% +% Improvement v3.0e: \topcaption* and \bottomcaption* + \let\caption@tablecaption\tablecaption + \def\tablecaption{\caption@caption\caption@tablecaption}% +% +% Original code: +% \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} +% + \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}% +% +} +% \end{macrocode} +% +% \iffalse +%</package> +% \fi +% +% \clearpage +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex/caption/caption.ins b/Master/texmf-dist/source/latex/caption/caption.ins new file mode 100644 index 00000000000..405da4afc91 --- /dev/null +++ b/Master/texmf-dist/source/latex/caption/caption.ins @@ -0,0 +1,46 @@ +\def\batchfile{caption.ins} +\input docstrip + +\askonceonly +\keepsilent + +\preamble + +Copyright (C) 1994-2005 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, caption3.sty, and manual.tex. + +\endpreamble + +\generate{\file{caption.sty}{\from{caption.dtx}{package}} + \file{caption3.sty}{\from{caption.dtx}{kernel}} + \file{manual.tex}{\from{caption.dtx}{driver}}} +\generate{\file{caption2.sty}{\from{caption2.dtx}{package}}} + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the files} +\Msg{* `caption.sty', `caption2.sty', and 'caption3.sty'} +\Msg{* into a directory searched by TeX.} +\Msg{*} +\Msg{* To produce the documentation run the file `manual.tex'} +\Msg{* (english version) or the file `anleitung.tex' (german} +\Msg{* version) through LaTeX.} +\Msg{*} +\Msg{***********************************************************} diff --git a/Master/texmf-dist/source/latex/caption/caption2.dtx b/Master/texmf-dist/source/latex/caption/caption2.dtx new file mode 100644 index 00000000000..c96a7635a23 --- /dev/null +++ b/Master/texmf-dist/source/latex/caption/caption2.dtx @@ -0,0 +1,543 @@ +% \iffalse meta-comment +% +% This is file `caption2.dtx'. +% +% 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, caption3.sty, and manual.tex. +% +% \fi +% \CheckSum{843} +% +% \iffalse +%<*driver> +\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] +% +\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@sommerfeldt.net}} +% \date{2004/08/17} +% \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} +% +% \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 and has been superseed by the new +% release of the regular \package{caption} package version \mbox{3.0} in +% December 2003. +% +% \package{caption2} 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 I will \emph{not} answer +% questions about this package anymore except questions on migrating to the +% regular version of the \package{caption} package. And it will \emph{not} be +% adapted or enhanced in the future. +% +% 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. +% +% \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} +% (not documented anymore) +% \iffalse +%<*package> +% \fi +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{caption2}[2004/05/10 v2.1c Customising captions (AS)] +%\PackageWarning{caption2}{THIS PACKAGE IS OBSOLETE, USE caption INSTEAD!} +\newcommand*\captionfont{} +\newcommand*\captionlabelfont{} +\newcommand*\captionlabeldelim{} +\newcommand*\captionlabelsep{} +\newcommand*\captionsize{} +\newdimen\captionmargin +\newdimen\captionwidth +\newif\ifcaptionwidth +\newdimen\captionindent +\newif\ifcaptionlabel\captionlabeltrue +\newif\ifonelinecaptions +\newif\ifignoreLTcapwidth +\newcommand*\setcaptionmargin{% + \captionwidthfalse + \setlength\captionmargin} +\newcommand*\setcaptionwidth{% + \captionwidthtrue + \setlength\captionwidth} +\newcommand*\normalcaptionparams{% + \let\captionsize\@empty + \renewcommand*\captionfont{\captionsize}% + \let\captionlabelfont\@empty + \renewcommand*\captionlabeldelim{:}% + \renewcommand*\captionlabelsep{\space}% + \setcaptionmargin\z@\setlength\captionindent\z@ + \onelinecaptionstrue} +\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} +\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}} +\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}} +\newcommand*\captionstyle[1]{% + \expandafter\ifx\csname caption@@#1\endcsname\relax + \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}% + \else + \def\caption@style{#1}% + \fi} +\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}} +\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} +\newcommand*\caption@@@normal{% + \caption@label\captiontext} +\newcommand*\caption@@@center{% + \centering\caption@label\captiontext}% +\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} +\newcommand*\caption@@@flushleft{% + \raggedright\caption@label\captiontext}% +\newcommand*\caption@@@flushright{% + \raggedleft\caption@label\captiontext}% +\newcommand*\caption@@@hang{% + \sbox\@tempboxa{\caption@label}% + \hangindent\wd\@tempboxa\noindent + \usebox\@tempboxa\caption@hangplus\captiontext} +\newcommand*\caption@hangplus{} +\newcommand*\caption@@@hang@center{% + \let\caption@hangplus\centering\caption@@@hang} +\newcommand*\caption@@@hang@centerlast{% + \let\caption@hangplus\caption@centerlast\caption@@@hang} +\newcommand*\caption@@@hang@flushleft{% + \let\caption@hangplus\raggedright\caption@@@hang} +\newcommand*\caption@@@indent{% + \hangindent\captionindent\noindent + \caption@label\captiontext} +\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}} +\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} +\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} +\DeclareOption{oneline}{\onelinecaptionstrue} +\DeclareOption{nooneline}{\onelinecaptionsfalse} +\newcommand*\caption@package[1]{\@namedef{caption@pkt@#1}} +\DeclareOption{float}{\caption@twozerofalse\caption@package{float}{1}} +\DeclareOption{longtable}{\caption@twozerofalse\caption@package{longtable}{1}} +\DeclareOption{subfigure}{\caption@twozerofalse\caption@package{subfigure}{1}} +\DeclareOption{none}{\caption@twozerofalse + \caption@package{float}{0}\caption@package{longtable}{0}% + \caption@package{subfigure}{0}} +\DeclareOption{all}{\ExecuteOptions{float,longtable,subfigure}} +\newif\ifcaption@ruled +\DeclareOption{ruled}{\caption@ruledtrue} +\DeclareOption{boxed}{} +\DeclareOption{ignoreLTcapwidth}{\ignoreLTcapwidthtrue} +\DeclareOption{debug}{\caption@debugtrue} +\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 +\def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}} +\newcommand*\caption@of[2]{\def\@captype{#2}#1} +\@ifundefined{abovecaptionskip}{% + \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{} +\@ifundefined{belowcaptionskip}{% + \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{} +\newdimen\captionlinewidth +\newdimen\realcaptionwidth +\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} +\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} +\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}}% + }} +\renewcommand\@makecaption[2]{% + \vskip\abovecaptionskip + \captionlinewidth\hsize + \realcaptionwidth\hsize + \def\captionlabel{#1}% + \def\captiontext{#2}% + \usecaptionstyle{\caption@style}% + \vskip\belowcaptionskip} +\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} +\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} + \newcommand\caption@floatc[3]{% + \ifx\captionlabelfont\@empty + \let\captionlabelfont\@fs@cfont + \fi + \captionlinewidth\hsize + \realcaptionwidth\hsize + \def\captionlabel{#2}% + \def\captiontext{#3}% + \usecaptionstyle{#1}} + \renewcommand*\floatc@plain{\caption@floatc{\caption@style}} + \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}} + \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} + \newcommand\caption@of@float[2]{\egroup + \vskip\abovecaptionskip + \normalsize\caption@fs@capt{#1}{#2}% + \vskip\belowcaptionskip + \bgroup}% + \fi} +\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} + \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}}} + \fi} +\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} +\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}} +\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 + \ifx\subcapfont\undefined + \PackageInfo{caption2}{subfigure package v2.0 detected} + \let\subcapfont\@empty + \newcommand*\subfigcapwidth{\z@} + \newcommand*\setsubcapmargin{% + \subfigcapwidthfalse + \renewcommand*\subfigcapmargin} + \newcommand*\setsubcapwidth{% + \subfigcapwidthtrue + \renewcommand*\subfigcapwidth} + \newcommand*\subcaplabelsep{\space} + \let\caption@subfig@hss\hfil + \else + \PackageInfo{caption2}{subfigure package v2.1 (or newer) detected} + \newdimen\subfigcapwidth + \newcommand*\setsubcapmargin{% + \subfigcapwidthfalse + \setlength\subfigcapmargin} + \newcommand*\setsubcapwidth{% + \subfigcapwidthtrue + \setlength\subfigcapwidth} + \newcommand*\subcaplabelsep{\hskip\subfiglabelskip} + \let\caption@subfig@hss\hss + \fi + \newif\ifsubfigcapwidth + \newdimen\subcapindent + \newcommand*\subcaplabeldelim{} + \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 + \renewcommand*\@thesubfigure{\thesubfigure} + \renewcommand*\@thesubtable{\thesubtable} + \let\@makesubfigurecaption\caption@makesubcaption + \let\@makesubtablecaption\caption@makesubcaption + \fi} +\let\caption@package\undefined +% \end{macrocode} +% +% \iffalse +%</package> +% \fi +% +% \Finale +% +\endinput |