mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-01 08:21:47 +03:00
8b6ad460cc
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@940 1f5c12ca-751b-0410-a591-d2e778427230
4798 lines
167 KiB
TeX
4798 lines
167 KiB
TeX
% \iffalse meta-comment
|
|
%
|
|
% This is file `caption.dtx'.
|
|
%
|
|
% Copyright (C) 1994-2006 Axel Sommerfeldt (caption@sommerfee.de)
|
|
%
|
|
% --------------------------------------------------------------------------
|
|
%
|
|
% This work may be distributed and/or modified under the
|
|
% conditions of the LaTeX Project Public License, either version 1.3
|
|
% of this license or (at your option) any later version.
|
|
% The latest version of this license is in
|
|
% http://www.latex-project.org/lppl.txt
|
|
% and version 1.3 or later is part of all distributions of LaTeX
|
|
% version 2003/12/01 or later.
|
|
%
|
|
% This work has the LPPL maintenance status "maintained".
|
|
%
|
|
% This Current Maintainer of this work is Axel Sommerfeldt.
|
|
%
|
|
% This work consists of the files caption.ins, caption.dtx,
|
|
% caption2.dtx, and anleitung.tex and the derived files
|
|
% caption.sty, caption2.sty, caption3.sty, and manual.tex.
|
|
%
|
|
% \fi
|
|
% \CheckSum{1956}
|
|
%
|
|
% \iffalse
|
|
%<*driver>
|
|
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
|
|
\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}}
|
|
%
|
|
\font\manual=manfnt
|
|
\newcommand\DANGER{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{\manual\char127}}}}
|
|
%
|
|
\ifx\pdfoutput\undefined\else
|
|
\ifcase\pdfoutput\else
|
|
\usepackage{mathptmx,courier}
|
|
\usepackage[scaled=0.90]{helvet}
|
|
\addtolength\marginparwidth{15pt}
|
|
\fi
|
|
\fi
|
|
%
|
|
%\usepackage[french,USenglish]{babel}
|
|
\usepackage{color,setspace}
|
|
%
|
|
%\usepackage{float}
|
|
\usepackage{longtable}
|
|
%\usepackage[raggedright]{sidecap}
|
|
%
|
|
\usepackage{caption}[2005/08/24]
|
|
\DeclareCaptionLabelSeparator{endash}{\space\textendash\space}
|
|
\usepackage{hyperref}
|
|
%
|
|
\DeclareCaptionFont{singlespacing}{\singlespacing}
|
|
\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
|
|
\DeclareCaptionFont{doublespacing}{\doublespacing}
|
|
\DeclareCaptionFont{red}{\color{red}}
|
|
\DeclareCaptionFont{green}{\color{green}}
|
|
\DeclareCaptionFont{blue}{\color{blue}}
|
|
%
|
|
\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}}
|
|
%
|
|
%<+driver>\OnlyDescription
|
|
%
|
|
\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
|
|
%
|
|
% \newcommand*\version[1]{$v#1$}
|
|
%
|
|
% \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@sommerfee.de}{\texttt{caption@sommerfee.de}}}
|
|
% \date{2006/01/12}
|
|
% \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}
|
|
%
|
|
% \tableofcontents
|
|
%
|
|
% \newcommand\figuretext{^^A
|
|
% 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.}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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,labelsep=endash}{\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.
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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''}.)
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \pagebreak[3]
|
|
% \section{Options}
|
|
%
|
|
% \def\OptionLabel{RaggedRight}
|
|
% \def\UserDefined{\ldots}
|
|
% \makeatletter
|
|
% \newcommand*\Section{\@ifstar{\@Section\relax}{\@Section{section}}}
|
|
% \newcommand*\@Section[3]{#1 \ref{#2}: \textit{``#3''}}
|
|
% \makeatother
|
|
% \newcommand*\See[1]{{\small (See #1)}}
|
|
% \newcommand*\SeeUserDefined[1][]{%
|
|
% \See{\Section{declare}{Do it yourself}#1}}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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:
|
|
% \iffalse
|
|
% \footnote{You have the option to
|
|
% define your own ones, too. See section \ref{declare}:
|
|
% \textit{``Do it yourself!''} for details.}
|
|
% \fi
|
|
%
|
|
% \begin{Options}{\OptionLabel}
|
|
% \item[plain]\NEWdescription{v3.0h}
|
|
% 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.
|
|
%
|
|
% \item[\UserDefined]
|
|
% Own formats can be defined using |\DeclareCaptionFormat|.
|
|
% \SeeUserDefined
|
|
% \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{plain} 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=plain,indention=.5cm|
|
|
% \end{quote}
|
|
% \captionsetup{aboveskip=0pt}
|
|
% \example{format=plain,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}
|
|
%
|
|
% \pagebreak[3]
|
|
% \DescribeMacro{labelformat=}
|
|
% With the option
|
|
% \nopagebreak[3]
|
|
% \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.
|
|
%
|
|
% \item[\UserDefined]
|
|
% Own label formats can be defined using |\DeclareCaptionLabelFormat|.
|
|
% \SeeUserDefined
|
|
% \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 (|\\|).
|
|
%
|
|
% \item[endash]\NEWfeature{v3.0h}
|
|
% The caption label and text will be separated by an en-dash,
|
|
% surrounded by spaces (| -- |).
|
|
%
|
|
% \item[\UserDefined]
|
|
% Own separators can be defined using |\DeclareCaptionLabelSeparator|.
|
|
% \SeeUserDefined
|
|
% \end{Options}
|
|
%
|
|
% Three 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}
|
|
%
|
|
% \begin{Example}
|
|
% \begin{quote}
|
|
% |labelsep=endash|
|
|
% \end{quote}
|
|
% \captionsetup{aboveskip=0pt}
|
|
% \example{labelsep=endash}{\figuretext}
|
|
% \end{Example}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{Justification}
|
|
% \label{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
|
|
%
|
|
% \item[\UserDefined]
|
|
% Own justifications can be defined using |\DeclareCaptionJustification|.
|
|
% \SeeUserDefined
|
|
% \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=}
|
|
% The standard \LaTeX\ document classes (|article|, |report|, and |book|)
|
|
% automatically center a caption if it fits in one single line:
|
|
%
|
|
% \example{belowskip=\abovecaptionskip}{A short caption.}
|
|
%
|
|
% \DANGER
|
|
% The \thispackage\ package adapts this behaviour and therefore usually
|
|
% ignores the justification you have set with |justification=| in such case.
|
|
% But 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.)
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{Fonts}
|
|
% \label{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}
|
|
%
|
|
% \item[\UserDefined]
|
|
% Own font options can be defined using |\DeclareCaptionFont|.
|
|
% \SeeUserDefined
|
|
% \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}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{Margins and further paragraph options}
|
|
% \label{margins}
|
|
%
|
|
% \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}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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=default,labelsep=default,|\\
|
|
% |justification=default,font=default,labelfont=default,|\\
|
|
% |textfont=default,margin=0pt,indention=0pt,parindent=0pt|\\
|
|
% |hangindent=0pt,singlelinecheck=true|
|
|
% \end{quote}
|
|
%
|
|
% Own caption styles can be defined using |\DeclareCaptionStyle|.
|
|
% \SeeUserDefined
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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{misc}{Useful stuff} for details}\par
|
|
% 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}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \pagebreak[3]
|
|
% \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{tabular}|\\
|
|
% |\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{usage}
|
|
% {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 that some \LaTeX\ packages exist (like the
|
|
% \package{float}, \package{longtable}, and \package{sidecap} package
|
|
% for example) who can define additional floating enviroments and these two
|
|
% commands can also be used with them.
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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 |plain| is defined
|
|
% inside |caption.sty| as
|
|
% \begin{quote}
|
|
% |\DeclareCaptionFormat{plain}{#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}
|
|
% The line spacing could be customized using the \package{setspace} package,
|
|
% for example:\NEWdescription{v3.0h}
|
|
% regeln:
|
|
% \begin{quote}
|
|
% |\usepackage{setspace}|\\
|
|
% |\DeclareCaptionFont{singlespacing}{\singlespacing}|\\
|
|
% |\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}|\\
|
|
% |\DeclareCaptionFont{doublespacing}{\doublespacing}|\\
|
|
% |\captionsetup{font={onehalfspacing,small},labelfont=bf}|
|
|
% \end{quote}
|
|
% \example{font={onehalfspacing,small},labelfont=bf,singlelinecheck=off}\figuretext
|
|
% An example which brings color into life:
|
|
% \begin{quote}
|
|
% |\usepackage{color}|\\
|
|
% |\DeclareCaptionFont{red}{\color{red}}|\\
|
|
% |\DeclareCaptionFont{green}{\color{green}}|\\
|
|
% |\DeclareCaptionFont{blue}{\color{blue}}|\\
|
|
% |\captionsetup{labelfont=blue,textfont=green}|
|
|
% \end{quote}
|
|
% \example{labelfont=blue,textfont=green,singlelinecheck=off}\figuretext
|
|
%
|
|
% \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
|
|
% {style}{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}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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 adaptations for more document classes!
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \section{Using other packages}
|
|
% \label{packages}
|
|
%
|
|
% The \thispackage\ package contains special adaptations 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}.
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{The \package{float} package}
|
|
% \label{float}
|
|
%
|
|
% 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.
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{The \package{listings} package}
|
|
% \label{listings}
|
|
%
|
|
% \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!
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{The \package{longtable} package}
|
|
% \label{longtable}
|
|
%
|
|
% 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.
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{The \package{rotating} package}
|
|
% \label{rotating}
|
|
%
|
|
% 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.
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{The \package{sidecap} package}
|
|
% \label{sidecap}
|
|
%
|
|
% \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
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{The \package{supertabular} package}
|
|
% \label{supertabular}
|
|
%
|
|
% 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}.
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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{ftcap}, \package{hvfloat}, and
|
|
% \package{nonfloat}
|
|
% \end{quote}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \section{Compatibility to older versions}
|
|
% \label{compatibility}
|
|
%
|
|
% \subsection{The \thispackage\ package 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 obsolete options and commands and how
|
|
% they have been replaced within this version of the \thispackage\ package:
|
|
%
|
|
% {\small\begin{longtable}{ll}
|
|
% \thispackage\ \version{1.x} & \thispackage\ \version{3.x}\\
|
|
% \hline
|
|
% \endhead
|
|
% |normal| & |format=plain|\\
|
|
% |hang| & |format=hang|\\
|
|
% |isu| & |format=hang|\\
|
|
% |center| & |justification=centering|\\
|
|
% |centerlast| & |justification=centerlast|\\
|
|
% \iffalse
|
|
% |anne| & |justification=centerlast|\\
|
|
% \fi
|
|
% |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|\\
|
|
% \end{longtable}}
|
|
%
|
|
% Beside the options for setting up the desired font there were also
|
|
% the commands |\captionsize| resp.~|\captionfont| and |\captionlabelfont|
|
|
% who could be redefined with |\renewcommand| and allowed an alternate and
|
|
% more flexible way to change the font used for captions.
|
|
% This mechanism was replaced by the commands
|
|
% \begin{minipage}\linewidth\begin{quote}
|
|
% |\DeclareCaptionFont{|\ldots|}{|\ldots|}|\qquad and\\
|
|
% |\captionsetup{font=|\ldots|,labelfont=|\ldots|}|\qquad.
|
|
% \end{quote}\SeeUserDefined\strut\end{minipage}
|
|
%
|
|
% Setting the margin for captions was done in \version{1.x} with
|
|
% \begin{quote}
|
|
% |\setlength{\captionmargin}{|\ldots|}|\quad.
|
|
% \end{quote}
|
|
% This was replaced by
|
|
% \begin{quote}
|
|
% |\captionsetup{margin=|\ldots|}|\qquad.
|
|
% \end{quote}
|
|
% \See{\Section{margins}{Margins and further paragraph options}}
|
|
%
|
|
% For example the old-style code
|
|
% \begin{quote}
|
|
% |\usepackage[hang,bf]{caption}|\\
|
|
% |\renewcommand\captionfont{\small\sffamily}|\\
|
|
% |\setlength\captionmargin{10pt}|
|
|
% \end{quote}
|
|
% should now be written as
|
|
% \begin{quote}
|
|
% |\usepackage[format=hang,labelfont=bf,font={small,sf},|\\
|
|
% | margin=10pt]{caption}|
|
|
% \end{quote}
|
|
% or
|
|
% \begin{quote}
|
|
% |\usepackage{caption}|\\
|
|
% |\captionsetup{format=hang,labelfont=bf,font={small,sf},|\\
|
|
% | margin=10pt}|\qquad.
|
|
% \end{quote}
|
|
%
|
|
% The quite exotic option |ruled| who allowed a partial usage of
|
|
% the caption settings for |ruled| floats defined with the
|
|
% \package{float} package will be emulated by this version of the
|
|
% caption package, too.
|
|
% But using this option is not recommended anymore since this
|
|
% version of the \thispackage\ package offers a more flexible way
|
|
% for changing the captions of these floating environments:
|
|
% \begin{quote}
|
|
% |\DeclareCaptionStyle{ruled}{|\ldots|}|
|
|
% \end{quote}
|
|
% resp.
|
|
% \begin{quote}
|
|
% |\captionsetup[ruled]{|\ldots|}|\qquad.
|
|
% \end{quote}
|
|
% \SeeUserDefined[, \Section*{misc}{Useful stuff}, and
|
|
% \Section*{float}{The \package{float} package}]
|
|
%
|
|
% \subsection{The \package{caption2} package version $2.x$}
|
|
%
|
|
% Although they do very similar stuff the packages \package{caption} and
|
|
% its experimental and now obsolete variant \package{caption2} have a
|
|
% very different implementation design.
|
|
% Therefore a full compatibility could not be offered.
|
|
% For that reason you will still find a file called |caption2.sty| in
|
|
% this package distribution, so old documents using the \package{caption2}
|
|
% package will still compile fine.
|
|
%
|
|
% Newly created documents should use the actual version of the
|
|
% \thispackage\ package instead. In most cases it's sufficient to replace
|
|
% the command
|
|
% \begin{quote}
|
|
% |\usepackage[...]{caption2}|
|
|
% \end{quote}
|
|
% by
|
|
% \begin{quote}
|
|
% |\usepackage[...]{caption}|\qquad.
|
|
% \end{quote}
|
|
% But some options and commands will not be emulated, so you can get
|
|
% error messages afterwards. This section will help you removing
|
|
% these errors. If you have problems migrating from \package{caption2}
|
|
% to \package{caption} please don't hesitate to send me an e-mail.
|
|
%
|
|
% In addition to the obsolete options shown in the last section
|
|
% these ones will be emulated, too:
|
|
%
|
|
% {\small\begin{longtable}{ll}
|
|
% \package{caption2} \version{2.x} & \thispackage\ \version{3.x}\\
|
|
% \hline
|
|
% \endhead
|
|
% |flushleft| & |justification=raggedright|\\
|
|
% |flushright| & |justification=raggedleft|\\
|
|
% |oneline| & |singlelinecheck=on|\\
|
|
% \end{longtable}}
|
|
%
|
|
% Setting the margin for captions was done in \version{2.x} with
|
|
% \begin{quote}\leavevmode\hbox{%
|
|
% |\setcaptionmargin{|\ldots|}| resp.
|
|
% |\setcaptionwidth{|\ldots|}|\quad.
|
|
% }\end{quote}
|
|
% This was replaced by
|
|
% \begin{quote}\leavevmode\hbox{%
|
|
% |\captionsetup{margin=|\ldots|}| resp.
|
|
% |\captionsetup{width=|\ldots|}|\quad.
|
|
% }\end{quote}
|
|
% \See{\Section{margins}{Margins and further paragraph options}}
|
|
%
|
|
% The so-called single-line-check was controlled by the commands
|
|
% |\oneline|\-|captions|\-|false| (for switching the check off) and
|
|
% |\oneline|\-|captions|\-|true| (for switching the check on).
|
|
% This was replaced by
|
|
% |\captionsetup{|\discretionary{}{}{}|singlelinecheck=|\discretionary{}{}{}|off}|
|
|
% resp.
|
|
% |\captionsetup{|\discretionary{}{}{}|singlelinecheck=|\discretionary{}{}{}|on}|.
|
|
% \See{\Section{justification}{Justification}}
|
|
%
|
|
% The commands
|
|
% \begin{quote}
|
|
% |\captionstyle|, |\captionlabeldelim|, |\captionlabelsep|,\\
|
|
% |\captionindent|, |\captionlabelfalse|, |\defcaptionstyle|,\\
|
|
% |\newcaptionstyle|, and |\renewcaptionstyle|
|
|
% \end{quote}
|
|
% do not have a simple replacement and therefore will not be emulated
|
|
% by this version of the \thispackage\ package. (So using them will
|
|
% yield to error messages.) Rewriting such code is not always easy and
|
|
% straight-ahead, but by conscientious reading of this manual you should
|
|
% find appropriate options and commands instead.
|
|
%
|
|
% \iffalse
|
|
% ... (some examples)
|
|
% \fi
|
|
%
|
|
% The \version{2.x} option |ignoreLTcapwidth| do not have a replacement, too.
|
|
% But in most cases you could simply drop using that option because
|
|
% in this version of the \thispackage\ package the value of |\LTcapwidth|
|
|
% will be ignored anyway (unless you set it to a different value than the
|
|
% default one).
|
|
% \See{\Section{longtable}{The \package{longtable} package}}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \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
|
|
% including graphics in \LaTeXe\ documents.
|
|
% You will find this document in the directory
|
|
% \begin{quote}\url{ftp://ftp.ctan.org/pub/tex/info/epslatex/}\end{quote}
|
|
% \end{itemize}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \section{Thanks}
|
|
%
|
|
% I would like to thank Katja Melzner,
|
|
% Steven D. Cochran, Frank Mittelbach,
|
|
% David Carlisle, Carsten Hinz, Olga Lapko, and Keith Reckdahl.
|
|
% 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,
|
|
% Ralf Stubner,
|
|
% Geoff Vallis,
|
|
% Florian Keiler,
|
|
% J\"urgen G\"obel,
|
|
% and
|
|
% Uwe Siart
|
|
% who all helped to make this package a better one.
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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},
|
|
% 2005/07/05
|
|
%
|
|
% \bibitem{supertabular}
|
|
% Johannes Braams und Theo Jurriens:
|
|
% \emph{The supertabular environment},
|
|
% 2002/07/19
|
|
%
|
|
% \bibitem{Anne}
|
|
% Anne Br\"uggemann-Klein:
|
|
% \emph{Einf\"uhrung in die Dokumentverarbeitung},
|
|
% B.G. Teubner, Stuttgart, 1989
|
|
% \end{thebibliography}}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \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}
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \clearpage
|
|
% \setlength{\parskip}{0pt plus 1pt}
|
|
%
|
|
% \section{The Implementation}
|
|
%
|
|
% \changes{v1.0}{1994/10/27}{First release}
|
|
% \changes{v1.1}{1994/11/03}{New captiontype \cs{centerlast}}
|
|
% \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
|
|
% \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
|
|
% \changes{v1.4}{1995/01/30}{New option \cs{nooneline}}
|
|
% \changes{v1.4b}{1995/04/05}{Bugfix release}
|
|
% \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
|
|
% \changes{v3.0d}{2004/11/28}{Split into two packages: \package{caption} \& \package{caption3}}
|
|
%
|
|
% The \package{caption} package consists of two parts -- the kernel
|
|
% (|caption3.sty|) and the main package (|caption.sty|).
|
|
%
|
|
% 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 the caption itself), we provide similar
|
|
% commands called |\caption@make| and |\caption@@make|, but with a lot of
|
|
% options which can be selected with |\captionsetup|.
|
|
% 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}
|
|
% or \package{supertabular} package):
|
|
% Mapping the appropriate internal commands (like |\LT@makecaption| or
|
|
% |\ST@caption|) 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 adaptation layers between the caption stuff coming from
|
|
% \LaTeXe\ itself or a \LaTeXe\ package and the caption stuff offered by the
|
|
% \package{caption} kernel.
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{Kernel}
|
|
% \iffalse
|
|
%<*kernel>
|
|
% \fi
|
|
%
|
|
% \subsubsection*{Identification}
|
|
%
|
|
% \begin{macrocode}
|
|
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
|
|
\ProvidesPackage{caption3}[2006/03/16 v3.0j caption3 kernel (AR)]
|
|
%<+debug>\PackageWarning{caption3}{DEBUG VERSION}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Generic helpers}
|
|
%
|
|
% \begin{macro}{\@nameundef}
|
|
% This is the opposite 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) and 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}
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
\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 comma separated
|
|
% 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}
|
|
% \begin{macro}{\caption@undefbool}
|
|
% For setting and testing boolean options we offer these three 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}\\
|
|
% |\caption@undefbool|\marg{name}
|
|
% \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}%
|
|
}}}
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
\def\caption@ifbool#1{\@nameuse{caption@if#1}}
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
\def\caption@undefbool#1{\@nameundef{caption@if#1}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \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
|
|
% We declare our options using these commands (instead of using
|
|
% |\DeclareOption| offered by \LaTeXe), so the keyval package is used.
|
|
% The starred form makes the option available during the lifetime of the
|
|
% current package only, so they can be used with |\usepackage|, but
|
|
% \emph{not} 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}
|
|
% \changes{v3.0a}{2004/01/17}{Bugfix: Missing \% added}
|
|
% |\captionsetup|\oarg{type}\marg{keyval-list of options}\par
|
|
% If the optional argument `type' is specified, we simply save or append
|
|
% the option list, otherwise we `execute' it with |\setkeys|.
|
|
% \begin{macrocode}
|
|
\newcommand\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup}
|
|
\newcommand\caption@typ@{caption@typ@} % This saves 74 words of TeX memory
|
|
\def\caption@setuptype[#1]#2{%
|
|
\@ifundefined{\caption@typ@#1}%
|
|
{\@namedef{\caption@typ@#1}{#2}}%
|
|
{\expandafter\l@addto@macro\csname\caption@typ@#1\endcsname{,#2}}}
|
|
\newcommand\caption@setup{\caption@setkeys{caption}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@setkeys}
|
|
% \changes{v3.0i}{2006/01/03}{\cs{caption@setkeys} introduced}
|
|
% This one simply calls |\setkeys| but lets error messages refer to
|
|
% the \package{caption} package instead of the \package{keyval} package.
|
|
% \begin{macrocode}
|
|
\newcommand*\caption@setkeys[2]{%
|
|
\let\caption@KV@errx\KV@errx
|
|
\let\caption@KV@err\KV@err
|
|
\def\KV@errx##1{\PackageError\caption@package{##1}\@ehc}%
|
|
\let\KV@err\KV@errx
|
|
\setkeys{#1}{#2}%
|
|
\let\KV@errx\caption@KV@errx
|
|
\let\KV@err\caption@KV@err}
|
|
\newcommand\caption@package{caption}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@settype}
|
|
% \changes{v3.0i}{2006/01/03}{Optional argument added}
|
|
% \changes{v3.0j}{2006/01/26}{Revised}
|
|
% |\caption@settype|\oarg{package}\marg{type}\par
|
|
% Caption options which have been saved with |\captionsetup|\oarg{type} can
|
|
% be executed using this command.
|
|
% (It simply executes the saved option list, if there is any.)
|
|
% \begin{macrocode}
|
|
\newcommand\caption@settype{%
|
|
\@ifnextchar[\caption@@settype{\caption@@settype[caption]}}
|
|
\def\caption@@settype[#1]#2{%
|
|
\@ifundefined{\caption@typ@#2}{}{%
|
|
\def\caption@package{#1}%
|
|
\caption@esetup{\csname\caption@typ@#2\endcsname}%
|
|
\def\caption@package{caption}}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@esetup}
|
|
% |\caption@esetup|\marg{keyval-list of options}\par
|
|
% 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}
|
|
\newcommand*\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}
|
|
% \changes{v3.0e}{2005/05/03}{Optimized for memory usage}
|
|
% |\showcaptionsetup|\oarg{package}\marg{type}\par
|
|
% This comes 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}
|
|
% At the moment we only offer this simple error message as generic 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}{\captionmarginx}
|
|
% \begin{macro}{\captionwidth}
|
|
% |\captionmargin| and |\captionwidth| contain the extra margin
|
|
% resp. the total width used for captions. Please never set these values in
|
|
% a direct way, they are just accessible in user documents to provide
|
|
% compatibility to |caption.sty| \version{1.x}.\par
|
|
% Note that we can only set one value at a time, `margin' \emph{or} `width'.
|
|
% If |\captionwidth| is not zero we will take this value afterwards,
|
|
% otherwise |\captionmargin| and |\captionmarginx|.
|
|
% \begin{macrocode}
|
|
\newdimen\captionmargin
|
|
\newdimen\captionmarginx
|
|
\newdimen\captionwidth
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
|
|
\DeclareCaptionOption{width}{\setcaptionwidth{#1}}
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\setcaptionmargin}
|
|
% |\setcaptionmargin|\marg{amount}
|
|
% \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
|
|
% \changes{v3.0h}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take left+right margin}
|
|
% |\setcaptionmargin|\marg{amount}\par
|
|
% Please never use this in user documents, it's just there to
|
|
% provide compatibility to |caption2.sty| \version{2.x}.
|
|
% \begin{macrocode}
|
|
\newcommand*\setcaptionmargin[1]{%
|
|
\captionwidth\z@
|
|
\caption@@setmargin#1,#1,\@nil\@@}
|
|
\def\caption@@setmargin#1,#2,#3\@@{%
|
|
\setlength\captionmargin{#1}%
|
|
\setlength\captionmarginx{#2}%
|
|
\advance\captionmarginx by -\captionmargin}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\setcaptionwidth}
|
|
% |\setcaptionwidth|\marg{amount}
|
|
% \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
|
|
% |\setcaptionwidth|\marg{amount}\par
|
|
% Please never use this in user documents, it's just there to
|
|
% provide compatibility to |caption2.sty| \version{2.x}.
|
|
% \begin{macrocode}
|
|
\newcommand\setcaptionwidth{%
|
|
\setlength\captionwidth}
|
|
% \end{macrocode}
|
|
% \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}
|
|
%
|
|
% \changes{v3.0b}{2004/05/16}{Defaults added for options \opt{parindent=} and \opt{hangindent=}}
|
|
% \changes{v3.0h}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption} replaced by \cs{caption@@par}}
|
|
% \changes{v3.0h}{2005/08/22}{Undocumented defaults for \opt{parindent=}, \opt{hangindent=},
|
|
% and \opt{parskip=} removed}
|
|
% \begin{macrocode}
|
|
\DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}% obsolete!
|
|
\DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}}
|
|
\DeclareCaptionOption{hangindent}{\setlength\captionhangindent{#1}}
|
|
\DeclareCaptionOption{parindent}{\setlength\captionparindent{#1}}
|
|
\DeclareCaptionOption{parskip}{\l@addto@macro\caption@@par{\setlength\parskip{#1}}}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Styles}
|
|
%
|
|
% \begin{macro}{\DeclareCaptionStyle}
|
|
% \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
|
|
% |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
|
|
% \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}
|
|
% \changes{v3.0f}{2005/06/01}{Starred variant added}
|
|
% |\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.
|
|
% \emph{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,indent=0pt,parindent=0pt,hangindent=0pt,%
|
|
singlelinecheck=1,strut=1}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \changes{v3.0d}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
|
|
% Currently there is only one pre-defined style, called `default'.
|
|
% It's a perfect match to the behaviour of |\@makecaption| offered by 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}
|
|
% \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
|
|
% \changes{v3.0d}{2005/02/09}{Starred variant added}
|
|
% |\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.
|
|
% \begin{macrocode}
|
|
\newcommand\DeclareCaptionFormat{%
|
|
\@ifstar{\caption@declareformat\@gobble}%
|
|
{\caption@declareformat\@firstofone}}
|
|
\newcommand\caption@declareformat[3]{%
|
|
\global\expandafter\let\csname caption@ifh@#2\endcsname#1%
|
|
\global\long\@namedef{caption@fmt@#2}##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}
|
|
%
|
|
% \changes{v3.0a}{2004/01/23}{Caption format \opt{default} renamed to \opt{normal}}
|
|
% \changes{v3.0f}{2005/05/12}{Caption format \opt{normal} renamed to \opt{@normal}}
|
|
% \changes{v3.0h}{2005/08/25}{Caption format \opt{@normal} renamed to \opt{plain} and documented}
|
|
% There are two pre-defined formats, called `plain' and `hang'.
|
|
%
|
|
% \begin{macrocode}
|
|
\DeclareCaptionFormat{plain}{#1#2#3\par}
|
|
\DeclareCaptionFormat{hang}{%
|
|
\@hangfrom{#1#2}%
|
|
\advance\captionparindent\hangindent
|
|
\advance\captionhangindent\hangindent
|
|
\caption@@par
|
|
#3\par}
|
|
% \end{macrocode}
|
|
%
|
|
% \changes{v3.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{normal}}
|
|
% \changes{v3.0e}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added}
|
|
% `default' usually maps to `plain'.
|
|
%
|
|
% \begin{macrocode}
|
|
\def\caption@fmt@default{\caption@fmt@plain}
|
|
\def\caption@ifh@default{\caption@ifh@plain}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Label formats}
|
|
%
|
|
% \begin{macro}{\DeclareCaptionLabelFormat}
|
|
% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
|
|
% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
|
|
% \begin{macrocode}
|
|
\newcommand*\DeclareCaptionLabelFormat[2]{%
|
|
\global\@namedef{caption@lfmt@#1}##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}
|
|
% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
|
|
% \changes{v3.0h}{2005/08/25}{Starred variant added}
|
|
% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
|
|
% |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par
|
|
% The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|.
|
|
% \begin{macrocode}
|
|
\newcommand\DeclareCaptionLabelSeparator{%
|
|
\@ifstar{\caption@declarelabelseparator\@gobble}%
|
|
{\caption@declarelabelseparator\@firstofone}}
|
|
\newcommand\caption@declarelabelseparator[3]{%
|
|
\global\expandafter\let\csname caption@iflf@#2\endcsname#1%
|
|
\global\long\@namedef{caption@lsep@#2}{#3}}
|
|
\@onlypreamble\DeclareCaptionLabelSeparator
|
|
\@onlypreamble\caption@declarelabelseparator
|
|
% \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@iflf\csname caption@iflf@#1\endcsname
|
|
\expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \changes{v3.0f}{2005/06/11}{Bugfix 05-03-23: Caption label separator \opt{newline} implementation
|
|
% changed from \cs{newline} to \cs{\textbackslash}}
|
|
% \changes{v3.0h}{2005/08/24}{Caption label separator \opt{endash} added}
|
|
% There are seven pre-defined label separators, called `none', `colon', `period', `space',
|
|
% `quad', `newline', and `endash'.
|
|
%
|
|
% \begin{macrocode}
|
|
\DeclareCaptionLabelSeparator{none}{}
|
|
\DeclareCaptionLabelSeparator{colon}{: }
|
|
\DeclareCaptionLabelSeparator{period}{. }
|
|
\DeclareCaptionLabelSeparator{space}{ }
|
|
\DeclareCaptionLabelSeparator*{quad}{\quad}
|
|
\DeclareCaptionLabelSeparator*{newline}{\\}
|
|
\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
|
|
% \end{macrocode}
|
|
%
|
|
% `default' usually maps to `colon'.
|
|
%
|
|
% \begin{macrocode}
|
|
\def\caption@lsep@default{\caption@lsep@colon}
|
|
\def\caption@iflf@default{\caption@iflf@colon}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Justifications}
|
|
%
|
|
% \begin{macro}{\DeclareCaptionJustification}
|
|
% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
|
|
% |\DeclareCaptionJustification|\marg{name}\marg{code}
|
|
% \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\cite{Anne} 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}
|
|
%
|
|
% \changes{v3.0b}{2004/05/16}{Improved \package{ragged2e} package support}
|
|
% 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 an additional warning if the ragged2e package is not avail.
|
|
% (This warning will be typeout only one time 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}
|
|
% \changes{v3.0a}{2004/01/22}{Bugfix: Multi token arguments are allowed now}
|
|
% |\DeclareCaptionFont|\marg{name}\marg{code}
|
|
% \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{name}\marg{keyval-list of names}\par
|
|
% Selecting a caption font means saving all the code snippets
|
|
% (in |\caption#1|).
|
|
% Because we use |\setkeys| recursive here we need to do this inside an
|
|
% extra group and collect all the code snippets in |\caption@tempa| first.
|
|
% \begin{macrocode}
|
|
\newcommand*\caption@setfont[2]{%
|
|
\let\caption@tempa\@empty
|
|
\begingroup
|
|
% \define@key{caption@fnt}{default}[]{%
|
|
% \global\expandafter\let\expandafter\caption@tempa
|
|
% \csname caption#1@default\endcsname}%
|
|
\caption@setkeys{caption@fnt}{#2}%
|
|
\endgroup
|
|
\expandafter\let\csname caption#1\endcsname\caption@tempa}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
\DeclareCaptionFont{default}{}
|
|
% \end{macrocode}
|
|
%
|
|
% These are the pre-defined font code snippets.
|
|
%
|
|
% \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}
|
|
% \changes{v3.0a}{2004/01/23}{Implementation changed from \cs{captionfont} to \cs{@empty}}
|
|
% \changes{v3.0c}{2004/07/16}{Use \cs{providecommand} instead of \cs{newcommand} in respect of the memoir class}
|
|
% The old versions \version{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.
|
|
% \begin{macrocode}
|
|
\providecommand\captionsize{}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \changes{v3.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
|
|
% \begin{macrocode}
|
|
\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
|
|
% \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}
|
|
%
|
|
% \changes{v3.0d}{2005/02/12}{Option \opt{skip=} added}
|
|
% \begin{macrocode}
|
|
\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
|
|
\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
|
|
\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
|
|
% \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 a specific package
|
|
% like the \package{float} package) instead.
|
|
% The user can put the |\caption| command wherever he likes! So this stuff
|
|
% is only to give us a \emph{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}
|
|
% \changes{v3.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b},
|
|
% \opt{below}, and \opt{a} are allowed, too}
|
|
% \changes{v3.0d}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
|
|
% |\caption@setposition|\marg{position}\par
|
|
% Selecting the caption position means that we put |\caption@position| to
|
|
% the right value. \emph{Please do \textbf{not} use the internal macro
|
|
% \cs{caption@position} in your own package or document, but use the wrapper
|
|
% macro \cs{caption@iftop} instead.}
|
|
% \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 usually `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}
|
|
% \changes{v3.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
|
|
% \changes{v3.0d}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
|
|
% |\caption@iftop|\marg{true-code}\marg{false-code}\par
|
|
% (If the |position=| is set to |auto| we assume a |bottom| position.)
|
|
% \begin{macrocode}
|
|
\newcommand\caption@iftop{%
|
|
\ifx\caption@position\@undefined
|
|
\expandafter\@secondoftwo
|
|
\else
|
|
\expandafter\caption@position
|
|
\fi}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@fixposition}
|
|
% \changes{v3.0b}{2004/05/16}{Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
|
|
% |\caption@fixposition|\par
|
|
% 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}
|
|
% \changes{v3.0a}{2004/01/23}{\cs{ifvmode} added}
|
|
% |\caption@autoposition|\par
|
|
% We guess the actual position of the caption by checking |\prevdepth|.
|
|
% \begin{macrocode}
|
|
\newcommand\caption@autoposition{%
|
|
\ifvmode
|
|
%<+debug> \edef\caption@tempa{\the\prevdepth}%
|
|
%<+debug> \PackageInfo{caption}{\protect\prevdepth=\caption@tempa}%
|
|
% \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}%
|
|
\ifdim\prevdepth>-\p@
|
|
\let\caption@position\@secondoftwo
|
|
\else
|
|
\let\caption@position\@firstoftwo
|
|
\fi
|
|
\else
|
|
%<+debug> \PackageInfo{caption}{no \protect\prevdepth}%
|
|
% \caption@setposition{b}%
|
|
\let\caption@position\@secondoftwo
|
|
\fi}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \subsubsection*{Hooks}
|
|
%
|
|
% \begin{macro}{\AtBeginCaption}
|
|
% \begin{macro}{\AtEndCaption}
|
|
% |\AtBeginCaption| \marg{code}\\
|
|
% |\AtEndCaption| \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}
|
|
%
|
|
% \changes{v3.0b}{2004/05/16}{Option \opt{listof=} added}
|
|
% \changes{v3.0d}{2005/02/12}{Option \opt{strut=} added}
|
|
% \begin{macrocode}
|
|
\DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}}
|
|
\DeclareCaptionOption{singlelinecheck}{\caption@setbool{slc}{#1}}
|
|
\DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Debug options}
|
|
% {\small Please note that these options are usually not available.}
|
|
%
|
|
% \begin{macrocode}
|
|
%<+debug>\DeclareCaptionOption{showposition}{\caption@setbool{showpos}{#1}}
|
|
%<+debug>\captionsetup{showposition=0}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Initialization of parameters}
|
|
%
|
|
% \begin{macrocode}
|
|
\captionsetup{style=default,position=default,listof=1}
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\ifcaption@star}
|
|
% If the starred form of |\caption| is used, this will be set to |true|.
|
|
% (It will be reset to |false| at the end of |\caption@@make|.)
|
|
% \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}
|
|
% \changes{v3.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
|
|
% \changes{v3.0d}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of \cs{captionmargin} resp. \cs{captionwidth};
|
|
% check for \cs{z@} added}
|
|
% \changes{v3.0d}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end of caption added}
|
|
% \changes{v3.0d}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
|
|
% \changes{v3.0d}{2005/02/12}{Single-line-check moved up so it can affect margins now}
|
|
% \changes{v3.0d}{2005/02/09}{Improvement: \cs{caption@ifh} added}
|
|
% \changes{v3.0d}{2005/02/09}{Bugfix: \cs{leavevmode} added}
|
|
% \changes{v3.0h}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
|
|
% \changes{v3.0i}{2005/12/04}{Uses \cs{caption@slc}}
|
|
% \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside single-line-check replaced by \cs{relax}}
|
|
% \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be typeset in horizontal mode}
|
|
% |\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 (option |singlelinecheck=|)
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@ifslc{\ifx\caption@sls\@empty\else
|
|
\caption@slc{#1}{#2}\captionwidth\relax
|
|
\fi}{}%
|
|
% \end{macrocode}
|
|
%
|
|
% Typeset the left margin (option |margin=|)
|
|
%
|
|
% \begin{macrocode}
|
|
\@tempdima\captionmargin
|
|
\caption@ifh{\advance\@tempdima by \captionindent}%
|
|
\hskip\@tempdima
|
|
% \end{macrocode}
|
|
%
|
|
% We actually use a |\vbox| of width |\captionwidth - \captionindent|
|
|
% to typeset the caption
|
|
% (Note: |\captionindent| is \emph{not} supported if the caption format
|
|
% was defined with |\DeclareCaptionFormat*|.)
|
|
%
|
|
% \begin{macrocode}
|
|
\@tempdima\captionwidth
|
|
\caption@ifh{\advance\@tempdima by -\captionindent}%
|
|
\caption@startbox\@tempdima
|
|
% \end{macrocode}
|
|
%
|
|
% Typeset the indention (option |indention=|)
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@ifh{%
|
|
% \ifdim\captionindent=\z@
|
|
% \leavevmode
|
|
% \else
|
|
\hskip-\captionindent}%
|
|
% \fi}%
|
|
% \end{macrocode}
|
|
%
|
|
% Typeset the caption itself
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@@@make{#1}{#2}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@endbox
|
|
% \end{macrocode}
|
|
%
|
|
% Typeset the right margin (option |margin=|)
|
|
%
|
|
% \begin{macrocode}
|
|
\@tempdima\captionmargin
|
|
\advance\@tempdima by \captionmarginx
|
|
\hskip\@tempdima
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@endhook
|
|
\endgroup
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\global\caption@starfalse}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@calcmargin}
|
|
% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
|
|
% values.
|
|
% \changes{v3.0h}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by \cs{ifdim}\cs{captionwidth=}\cs{z@}}
|
|
% \changes{v3.0i}{2006/01/12}{Improvement: Takes care of list environment now}
|
|
% \begin{macrocode}
|
|
\newcommand\caption@calcmargin{%
|
|
% \end{macrocode}
|
|
% \emph{Note:} Inside a |list| environment |\linewidth| do not contain
|
|
% the proper value, because |\@caption| calls |\@parboxrestore| which
|
|
% resets |\linewidth| to |\hsize|. Therefore we have to calculate the
|
|
% proper line width on our own in this case.
|
|
% \begin{macrocode}
|
|
\@tempdima\hsize
|
|
\ifnum\@listdepth>0\relax
|
|
\advance\@tempdima by -\leftmargin
|
|
\advance\@tempdima by -\rightmargin
|
|
\fi
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
\ifdim\captionwidth=\z@
|
|
\captionwidth\@tempdima
|
|
\advance\captionwidth by -2\captionmargin
|
|
\advance\captionwidth by -\captionmarginx
|
|
\else
|
|
\captionmargin\@tempdima
|
|
\advance\captionmargin by -\captionwidth
|
|
\divide\captionmargin by 2
|
|
\captionmarginx\z@
|
|
\fi
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
%<+debug> \PackageInfo{caption}{%
|
|
%<+debug> \protect\hsize=\the\hsize,
|
|
%<+debug> \protect\margin=\the\captionmargin,
|
|
%<+debug> \protect\marginx=\the\captionmarginx,
|
|
%<+debug> \protect\width=\the\captionwidth}%
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@slc}
|
|
% This one does the single-line-check.
|
|
% \begin{macrocode}
|
|
\newcommand\caption@slc[4]{%
|
|
\caption@startslc
|
|
\sbox\@tempboxa{\caption@@@make{#1}{#2}}%
|
|
\ifdim\wd\@tempboxa >#3%
|
|
\caption@endslc
|
|
\else
|
|
\caption@endslc
|
|
\caption@esetup\caption@sls
|
|
#4%
|
|
\fi}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@startslc}
|
|
% \changes{v3.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
|
|
% \changes{v3.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
|
|
% \changes{v3.0d}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added}
|
|
% \changes{v3.0h}{2005/07/09}{Support of \package{endnotes} package added}
|
|
% Re-define anything which would disturb the single-line-check.
|
|
% \begin{macrocode}
|
|
\newcommand\caption@startslc{%
|
|
\begingroup
|
|
\let\label\@gobble
|
|
\let\@footnotetext\@gobble\let\@endnotetext\@gobble
|
|
\def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}%
|
|
\let\caption@hj\relax}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@endslc}
|
|
% This ends the single-line-check.
|
|
% \begin{macrocode}
|
|
\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}
|
|
% \changes{v3.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
|
|
% \changes{v3.0d}{2005/02/12}{Bugfix 04-12-16: Use some kind of \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
|
|
% \changes{v3.0d}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
|
|
% \changes{v3.0e}{2005/05/05}{Use \cs{caption@ifempty}; \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
|
|
% \changes{v3.0e}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
|
|
% \changes{v3.0h}{2005/08/24}{Check for empty label added}
|
|
% \changes{v3.0h}{2005/08/25}{\cs{caption@iflf} added}
|
|
% |\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}
|
|
%
|
|
% If the label is empty, we use no caption label separator.
|
|
%
|
|
% \begin{macrocode}
|
|
\sbox\@tempboxa{#1}%
|
|
\ifdim\wd\@tempboxa=\z@
|
|
\let\caption@lsep\relax
|
|
\fi
|
|
% \end{macrocode}
|
|
%
|
|
% If the text is empty, we use no caption label separator, too.\par
|
|
% \emph{Note:} Unfortunately this only works under certain circumstances.
|
|
% Therefore an additional check inside |\@caption| will be introduced
|
|
% in the upcoming version \version{3.1} of the caption package.
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@ifempty{#2}{%
|
|
\let\caption@lsep\relax
|
|
% \let\caption@ifstrut\@secondoftwo
|
|
}%
|
|
% \end{macrocode}
|
|
%
|
|
% Take care that |\captionparindent| and |\captionhangindent| will be used
|
|
% to typeset the paragraph.
|
|
%
|
|
% \begin{macrocode}
|
|
\@setpar{\@@par\caption@@par}\caption@@par
|
|
% \end{macrocode}
|
|
%
|
|
% Finally the caption will be typeset.
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@hj\captionsize\captionfont\caption@fmt
|
|
{\ifcaption@star\else{\captionlabelfont#1}\fi}%
|
|
{\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}%
|
|
{{\captiontextfont
|
|
\caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
|
|
\nobreak\hskip\z@skip
|
|
#2%
|
|
% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
|
|
\caption@ifstrut{\@finalstrut\strutbox}{}%
|
|
\par}}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@ifempty}
|
|
% \changes{v3.0e}{2005/05/05}{This macro added}
|
|
% |\caption@ifempty|\marg{text}\marg{if-clause}\par
|
|
% This one tests if the \meta{text} is actually empty.\par
|
|
% \emph{Note:} This will be done without expanding the text, therefore this
|
|
% is far away from being bullet-proof.
|
|
% \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}
|
|
%
|
|
% \begin{macro}{\caption@@par}
|
|
% \changes{v3.0h}{2005/08/22}{Made this definition global}
|
|
% |\caption@@par|\par
|
|
% This command will be executed with every |\par| inside the caption.
|
|
% \begin{macrocode}
|
|
\newcommand*\caption@@par{%
|
|
\parindent\captionparindent\hangindent\captionhangindent}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \iffalse
|
|
%</kernel>
|
|
% \fi
|
|
%
|
|
% \iffalse
|
|
% --------------------------------------------------------------------------- %
|
|
% \fi
|
|
%
|
|
% \subsection{Main package}
|
|
% \iffalse
|
|
%<*package>
|
|
% \fi
|
|
%
|
|
% \subsubsection*{Identification}
|
|
%
|
|
% \begin{macrocode}
|
|
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
|
|
\ProvidesPackage{caption}[2006/03/21 v3.0j Customising captions (AR)]
|
|
%<+debug>\PackageWarning{caption}{DEBUG VERSION}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Loading the caption kernel}
|
|
%
|
|
% \begin{macrocode}
|
|
\RequirePackage{caption3}[2006/01/12] % needs v3.0i or newer
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Option for 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*{Options for |figure| and |table|}
|
|
%
|
|
% \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
|
|
% \begin{macrocode}
|
|
\DeclareCaptionOption*{figureposition}{\captionsetup[figure]{position=#1}}
|
|
\DeclareCaptionOption*{tableposition}{\captionsetup[table]{position=#1}}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{caption \version{1.x} compatibility options}
|
|
%
|
|
% \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*{Some caption2 \version{2.x} compatibility options}
|
|
% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
|
|
%
|
|
% \begin{macrocode}
|
|
\DeclareCaptionOption*{flushleft}[]{\caption@setjustification{raggedright}}
|
|
\DeclareCaptionOption*{flushright}[]{\caption@setjustification{raggedleft}}
|
|
\DeclareCaptionOption*{oneline}[]{\caption@setbool{slc}{1}}
|
|
\DeclareCaptionOption*{ignoreLTcapwidth}[]{}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Some \KOMAScript\ compatibility stuff}
|
|
% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added}
|
|
% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added}
|
|
%
|
|
% \begin{macrocode}
|
|
\@ifundefined{scr@caption}{}{%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\DeclareCaptionOption*{onelinecaption}[]{\onelinecaptionstrue}
|
|
\DeclareCaptionOption*{noonelinecaption}[]{\onelinecaptionsfalse}
|
|
\DeclareCaptionOption*{tablecaptionabove}[]{\captionsetup[table]{position=t}}
|
|
\DeclareCaptionOption*{tablecaptionbelow}[]{\captionsetup[table]{position=b}}
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\onelinecaptionsfalse}
|
|
% \begin{macro}{\onelinecaptionstrue}
|
|
% \begin{macrocode}
|
|
\def\onelinecaptionstrue{\caption@setbool{slc}{1}}
|
|
\def\onelinecaptionsfalse{\caption@setbool{slc}{0}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\captionabove}
|
|
% \begin{macro}{\captionbelow}
|
|
% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21: \cs{let}\cs{caption@setposition}\cs{@gobble} added}
|
|
% Original code:
|
|
% \begin{verbatim}
|
|
% \newcommand{\captionabove}{\@captionabovetrue\scr@caption}
|
|
% \newcommand{\captionbelow}{\@captionabovefalse\scr@caption}
|
|
% \end{verbatim}
|
|
% \begin{macrocode}
|
|
\def\captionabove{%
|
|
\caption@setposition{t}\let\caption@setposition\@gobble
|
|
\scr@caption}
|
|
\def\captionbelow{%
|
|
\caption@setposition{b}\let\caption@setposition\@gobble
|
|
\scr@caption}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
%
|
|
% \iffalse % Not very useful...
|
|
% \begin{macro}{\setcapindent}
|
|
% \begin{macrocode}
|
|
% \def\setcapindent{\@ifstar{\@@setcapindent}{\@setcapindent}}
|
|
% \def\@setcapindent#1{%
|
|
% \caption@setformat{plain}\setlength\captionindent{#1}}
|
|
% \def\@@setcapindent#1{%
|
|
% \PackageError{caption}{\string\setcapindent* is not supported yet}{\caption@eh}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\setcaphanging}
|
|
% \begin{macrocode}
|
|
% \def\setcaphanging{%
|
|
% \caption@setformat{hang}\setlength\captionindent\@z}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\setcapwidth}
|
|
% \begin{macrocode}
|
|
% \renewcommand*\setcapwidth[2][]{%
|
|
% \PackageWarning{caption}{%
|
|
% Ignoring optional argument of \string\setcapwidth!\MessageBreak
|
|
% You're using package caption.\MessageBreak}%
|
|
% \setcaptionwidth{#2}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\setcapmargin}
|
|
% \begin{macrocode}
|
|
% \renewcommand*\setcapmargin{\@ifstar\@setcapmargin\@@setcapmargin}
|
|
% \renewcommand*\@setcapmargin[2][\@tempdimb]{%
|
|
% \setlength\@tempdimb{#2}%
|
|
% \setlength\@tempdima{#1}%
|
|
% \setcaptionmargin{\@tempdima,\@tempdimb}}
|
|
% \renewcommand*\@@setcapmargin[2][\@tempdimb]{%
|
|
% \PackageError{caption}{\string\setcapmargin* is not supported yet}{\caption@eh}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \fi
|
|
%
|
|
% \begin{macrocode}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Generic package support}
|
|
%
|
|
% \begin{macro}{\caption@declarepackage}
|
|
% |\caption@declarepackage|\marg{package name}\par
|
|
% 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*\caption@declarepackage[1]{%
|
|
\caption@setbool{pkt@#1}{1}%
|
|
\DeclareCaptionOption*{#1}{\caption@setbool{pkt@#1}{##1}}}
|
|
\AtEndOfPackage{\let\caption@declarepackage\@undefined}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@ifpackage}
|
|
% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added, so no extra check is needed}
|
|
% |\caption@ifpackage|\marg{package name}\marg{package macro}\marg{code}\par
|
|
% If a certain package support is requested the appropriate code will
|
|
% be used. `Requested' means that the option belonging to it is set to
|
|
% |true| and the macro called \meta{package macro} is defined.
|
|
% (If \meta{package macro} is not yet defined we use |\AtBeginDocument|
|
|
% here, so the package could be loaded after this package, too.)
|
|
% \begin{macrocode}
|
|
\newcommand\caption@ifpackage[3]{%
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
%<+debug> \edef\caption@tempa{%
|
|
%<+debug> \caption@ifbool{pkt@#1}%
|
|
%<+debug> {\@ifundefined{#2}{AtBeginDocument}{firstofone}}%
|
|
%<+debug> {gobble}}%
|
|
%<+debug> \PackageInfo{caption}{#1 = \caption@ifbool{pkt@#1}{1}{0} %
|
|
%<+debug> (\@ifundefined{#2}{not }{}loaded -> \caption@tempa)}%
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
\caption@ifbool{pkt@#1}{%
|
|
\@ifundefined{#2}%
|
|
{\let\caption@tempa\AtBeginDocument}%
|
|
{\let\caption@tempa\@firstofone}%
|
|
}{%
|
|
\let\caption@tempa\@gobble
|
|
}%
|
|
\caption@tempa{\@ifundefined{#2}{}{#3}}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@undefbool{pkt@#1}}
|
|
\AtEndOfPackage{\let\caption@ifpackage\@undefined}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% You can also switch the caption support off using the package option
|
|
% |caption=false|.
|
|
% This may look strange, but there are certain circumstances where this could
|
|
% be useful.
|
|
% Such a situation might be the usage of the \package{subfig} package without
|
|
% disturbing the main caption code of the document class.\par
|
|
% \emph{Note: This mechanism is obsolete now, it has been superseeded by the
|
|
% \package{subfig} package option {\rm|caption=false|} which causes that only the
|
|
% caption kernel \package{caption3} is loaded.}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@declarepackage{caption}
|
|
% \end{macrocode}
|
|
%
|
|
% These are the packages we support:
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@declarepackage{float}
|
|
\caption@declarepackage{floatrow}
|
|
\caption@declarepackage{hyperref}
|
|
\caption@declarepackage{hypcap}
|
|
\caption@declarepackage{listings}
|
|
\caption@declarepackage{longtable}
|
|
\caption@declarepackage{picins}
|
|
\caption@declarepackage{rotating}
|
|
\caption@declarepackage{sidecap}
|
|
\caption@declarepackage{supertabular}
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\ProcessOptionsWithKV}
|
|
% \changes{v3.0a}{2004/01/23}{Bugfix, see \purett{news:400D360C.9678329F@gmx.net} for details}
|
|
% \changes{v3.0i}{2006/01/03}{Improvement, uses \cs{caption@setkeys} instead of \cs{setkeys}}
|
|
% \changes{v3.0j}{2006/02/23}{Bugfix, now processes only those global options which have a default value}
|
|
% We process our options using the keyval package, so we use this one
|
|
% instead of |\ProcessOptions| offered by \LaTeXe.
|
|
% (This code was taken from the \package{hyperref} package.)
|
|
% \begin{macrocode}
|
|
\def\ProcessOptionsWithKV#1{%
|
|
\let\@tempc\relax
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\let\caption@tempa\@empty
|
|
\@for\CurrentOption:=\@classoptionslist\do{%
|
|
\@ifundefined{KV@#1@\CurrentOption}{%
|
|
}{%
|
|
\@ifundefined{KV@#1@\CurrentOption @default}{%
|
|
\PackageInfo{#1}{Global option `\CurrentOption' ignored}%
|
|
}{%
|
|
\PackageInfo{#1}{Global option `\CurrentOption' processed}%
|
|
\edef\caption@tempa{\caption@tempa,\CurrentOption,}%
|
|
\@expandtwoargs\@removeelement\CurrentOption
|
|
\@unusedoptionlist\@unusedoptionlist
|
|
}%
|
|
}%
|
|
}%
|
|
\edef\caption@tempa{%
|
|
\noexpand\caption@setkeys{#1}{%
|
|
\caption@tempa\@ptionlist{\@currname.\@currext}%
|
|
}%
|
|
}%
|
|
\caption@tempa
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\let\CurrentOption\@empty
|
|
\AtEndOfPackage{\let\@unprocessedoptions\relax}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
\ProcessOptionsWithKV{caption}
|
|
% \end{macrocode}
|
|
%
|
|
% If the option |caption=false| was given we stop processing this file
|
|
% immediately.
|
|
% \begin{macrocode}
|
|
\caption@ifbool{pkt@caption}{}{\endinput}
|
|
\caption@undefbool{pkt@caption}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{Useful 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}
|
|
%
|
|
% Note: Like |\captionof| the option |type=| should only be used inside a
|
|
% group or environment and does not check if the argument is a valid
|
|
% floating environment or not.
|
|
%
|
|
% \changes{v3.0d}{2005/11/28}{Option \opt{type=} added}
|
|
% \begin{macrocode}
|
|
\DeclareCaptionOption{type}{\def\@captype{#1}}
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\ContinuedFloat}
|
|
% \changes{v3.0f}{2005/06/11}{Call of \cs{caption@ContinuedFloat} added}
|
|
% \changes{v3.0i}{2005/11/12}{Optional argument and call of \cs{caption@@ContinuedFloat} added}
|
|
% |\ContinuedFloat|\oarg{type}\par
|
|
% This mainly decreases the appropriate counter by $-1$.
|
|
% \begin{macrocode}
|
|
\providecommand\ContinuedFloat{%
|
|
\@ifnextchar[%]
|
|
\@ContinuedFloat
|
|
{\ifx\@captype\@undefined
|
|
\@latex@error{\noexpand\ContinuedFloat outside float}\@ehd
|
|
\else
|
|
\@ContinuedFloat[\@captype]%
|
|
\fi}}
|
|
\def\@ContinuedFloat[#1]{%
|
|
\addtocounter{#1}\m@ne
|
|
\caption@ContinuedFloat{#1}%
|
|
\caption@@ContinuedFloat{#1}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@ContinuedFloat}
|
|
% \begin{macro}{\caption@resetContinuedFloat}
|
|
% |\caption@ContinuedFloat|\marg{type}\par
|
|
% |\caption@resetContinuedFloat|\marg{type}\par
|
|
% The first one will be called inside |\ContinuedFloat|, the second one
|
|
% inside |\caption|. Usually they do nothing but this changes if the
|
|
% \package{hyperref} package is loaded. (See \package{hyperref} package
|
|
% support for details.)
|
|
% \begin{macrocode}
|
|
\let\caption@ContinuedFloat\@gobble
|
|
\let\caption@resetContinuedFloat\@gobble
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@@ContinuedFloat}
|
|
% This hook is for foreign packages which link themself into |\ContinuedFloat|,
|
|
% for example the \package{subfig} package\cite{subfig}.
|
|
% \begin{macrocode}
|
|
\providecommand*\caption@@ContinuedFloat[1]{}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \subsubsection*{Internal helpers}
|
|
%
|
|
% \begin{macro}{\caption@begin}
|
|
% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed by \cs{caption@setfloattype}}
|
|
% \changes{v3.0e}{2005/04/12}{Check for default label format added}
|
|
% \changes{v3.0f}{2005/06/11}{Call of \cs{caption@resetContinuedFloat} added}
|
|
% Our handling of |\caption| will always be surrounded by
|
|
% |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
|
|
% |\caption@begin|\marg{type} performs these tasks:
|
|
% \begin{itemize}
|
|
% \item Call |\caption@resetContinuedFloat| (see above)
|
|
% and start a new group
|
|
% \item Execute the options set with |\captionsetup|\oarg{type}
|
|
% \item Define |\fnum@|\meta{type} if the caption label format is set
|
|
% to non-default
|
|
% \item Override the |position=| setting, if necessary
|
|
% (for example if set to |auto| or used inside a |supertabular|)
|
|
% \end{itemize}
|
|
% \begin{macrocode}
|
|
\newcommand*\caption@begin[1]{%
|
|
\caption@resetContinuedFloat{#1}%
|
|
\begingroup
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
\caption@setfloattype{#1}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\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}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@beginex}
|
|
% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
|
|
% \changes{v3.0h}{2005/09/16}{Bugfix: Made this macro and \cs{addcontentsline} \cs{long}}
|
|
% |\caption@beginex|\marg{type}\marg{list entry}\\
|
|
% performs the same tasks as |\caption@begin| and additionally:
|
|
% Redefine |\addcontentsline| if no list-of entry is requested, that
|
|
% means either the argument \meta{list entry} is empty or |listof=| was
|
|
% set to |false|.
|
|
% \begin{macrocode}
|
|
\newcommand\caption@beginex[2]{%
|
|
\caption@begin{#1}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@iflof%
|
|
{\def\caption@tempa{#2}}%
|
|
{\let\caption@tempa\@empty}%
|
|
\ifx\caption@tempa\@empty
|
|
\long\def\addcontentsline##1##2##3{}%
|
|
\fi}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@end}
|
|
% |\caption@end| closes the group.
|
|
% \begin{macrocode}
|
|
\newcommand*\caption@end{%
|
|
\endgroup
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\let\caption@position\caption@fixedposition}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@setfloattype}
|
|
% \changes{v3.0a}{2004/01/23}{This macro added}
|
|
% |\caption@setfloattype|\marg{type}\\
|
|
% sets 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} or
|
|
% \package{sidecap} package is loaded.
|
|
% \begin{macrocode}
|
|
\let\caption@setfloattype\caption@settype
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@letfloattype}
|
|
% \changes{v3.0b}{2004/05/16}{This macro added}
|
|
% \changes{v3.0e}{2005/05/05}{Argument \meta{extra code} added}
|
|
% |\caption@letfloattype|\marg{type}\marg{extra code}\\
|
|
% redefines |\caption@setfloattype| so it does not only
|
|
% |\caption@settype|\marg{type} but two additional tasks:
|
|
% Executing extra code given as second argument and
|
|
% execute options with |\caption@settype{#1}| afterwards.\par
|
|
% You can find an example of its usage in the \package{longtable}
|
|
% support, where this macro is called so
|
|
% |\captionsetup[longtable]{|\ldots|}| can be used to setup options
|
|
% for longtables which have a higher priority than the options which
|
|
% have been setup with |\captionsetup[table]{|\ldots|}| or
|
|
% |\setlength\LTcapwidth{|\ldots|}|.
|
|
% \begin{macrocode}
|
|
\newcommand*\caption@letfloattype[2]{%
|
|
\def\caption@setfloattype##1{%
|
|
\caption@settype{##1}#2\caption@settype{#1}}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \changes{v3.0a}{2004/01/23}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
|
|
% \changes{v3.0h}{2005/10/06}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
|
|
%
|
|
% \begin{macro}{\caption@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 changed later on.
|
|
% \begin{macrocode}
|
|
\newcommand*\caption@floatname[1]{\@nameuse{#1name}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \subsubsection*{Caption support}
|
|
%
|
|
% \iffalse\begin{quote}
|
|
% \small\emph{Note:}
|
|
% Our aim is patching the existing |\caption| code so changes done by other
|
|
% packages will not get lost. We do similar in our \package{float},
|
|
% \package{hyperref}, and \package{hypcap} support so get the disadvantage
|
|
% of having ugly code with some negative side-effects, like the non-working
|
|
% |\caption{}| feature when the \package{french(le)} or \package{hyperref}
|
|
% package is loaded.
|
|
% \end{quote}\fi
|
|
%
|
|
% Some packages (like the \package{hyperref} package for example) redefines
|
|
% |\caption| and |\@caption|, too, but without chaining to their previous
|
|
% definitions. So we have to use |\AtBeginDocument| here, so we can make sure
|
|
% our definition don't get lost.
|
|
%
|
|
% \begin{macrocode}
|
|
\AtBeginDocument{%
|
|
% \end{macrocode}
|
|
%
|
|
% We only patch |\caption| and |\@caption| if the \package{captcont} package
|
|
% (which brings it's own definition of |\caption*|) is not used.
|
|
% It does not make much sense using the actual version of the \package{caption}
|
|
% package with the \package{captcont} package, but this was different in the
|
|
% old (\version{1.x}) days so we take care to be backward compatible.
|
|
%
|
|
% \begin{macrocode}
|
|
\@ifundefined{cc@caption}{%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\caption}
|
|
% \iffalse\changes{v3.0}{2003/07/18}{Bugfix: \cs{global} added, so this works with sidecap}\fi
|
|
% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
|
|
% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
|
|
% Here comes our definition of |\caption| and |\caption*|.
|
|
% (We set |\caption@startrue| globally so it works with the \package{sidecap} package, too.)
|
|
% \begin{macrocode}
|
|
\let\caption@old\caption
|
|
\def\caption{\caption@caption\caption@old}%
|
|
\def\caption@caption#1{%
|
|
\@ifstar{\ContinuedFloat\global\caption@startrue#1[]}{#1}}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\@caption}
|
|
% Our definition of |\@caption| simply calls the old definition,
|
|
% nested by |\caption@beginex| and |\caption@end|.
|
|
% \begin{macrocode}
|
|
\let\caption@@old\@caption
|
|
\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}
|
|
%
|
|
% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: \package{captcont} support fixed}
|
|
% Minimum \package{captcont} package support:\\
|
|
% We define |\caption@caption| here so it's there but does not make any harm.
|
|
%
|
|
% \begin{macrocode}
|
|
\PackageInfo{caption}{captcont package v2.0 detected}%
|
|
\def\caption@caption#1{#1}%
|
|
}%
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\@makecaption}
|
|
% |\@makecaption|\marg{label}\marg{text}\par
|
|
% The 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}
|
|
% We do basically the same, but take care of the |position=| setting
|
|
% and use |\caption@@make| from the \package{caption} kernel to actually
|
|
% typeset the caption.
|
|
% \begin{macrocode}
|
|
\renewcommand\@makecaption[2]{%
|
|
\caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
%<+debug> \caption@ifbool{showpos}{%
|
|
%<+debug> \llap{$\caption@iftop\downarrow\uparrow$ }}{}%
|
|
% \end{macrocode}
|
|
% \begin{macrocode}
|
|
\caption@@make{#1}{#2}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \subsubsection*{\package{\KOMAScript} classes support}
|
|
% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added}
|
|
% \changes{v3.0h}{2005/08/22}{\cs{PackageInfo} added to \KOMAScript\ support}
|
|
%
|
|
% \begin{macrocode}
|
|
\AtBeginDocument{\@ifundefined{scr@caption}{}{%
|
|
\PackageInfo{caption}{KOMA-Script class detected}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\scr@caption}
|
|
% We update the definition of |\scr@caption| so it actually reflects
|
|
% our definition of |\caption|.
|
|
% \begin{macrocode}
|
|
\let\scr@caption\caption
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
}}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{french(le) package support}
|
|
% \changes{v3.0h}{2005/10/03}{Minimum adaptation to \package{french(le)} added}
|
|
%
|
|
% \begin{macrocode}
|
|
\AtBeginDocument{\@ifundefined{f@ffrench}{}{%
|
|
\PackageInfo{caption}{french(le) package detected}%
|
|
% \end{macrocode}
|
|
%
|
|
% If |\GOfrench| is defined as |\relax| all the re-definitions regarding
|
|
% captions have already been done, so we can do our patches immediately.
|
|
% Otherwise we must add our stuff to |\GOfrench|.
|
|
%
|
|
% \begin{macrocode}
|
|
\@ifundefined{GOfrench}%
|
|
{\let\caption@tempa\@firstofone}%
|
|
{\def\caption@tempa{\g@addto@macro\GOfrench}}%
|
|
\caption@tempa{%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\@cnORI}
|
|
% We update the definition of |\@cnORI| so it actually reflects
|
|
% our definition of |\caption|.
|
|
% \begin{macrocode}
|
|
\let\@cnORI\caption
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\@tablescaption}
|
|
% The \package{french(le)} package sets |\caption| to |\@tablescaption| at
|
|
% |\begin{table}| for special a treatment of footnotes.
|
|
% Therefore we have to patch |\@tablescaption| so |\caption*| will work
|
|
% inside the |table| environment.
|
|
% \begin{macrocode}
|
|
\let\caption@tablescaption\@tablescaption
|
|
\def\@tablescaption{\caption@caption\caption@tablescaption}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\f@ffrench}
|
|
% \begin{macro}{\f@tfrench}
|
|
% |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
|
|
% when used in french mode. These contain additional code which typesets
|
|
% the caption separator |\captionseparator| instead of the usual colon.
|
|
% Because this breaks with our |\@makecaption| code we have to remove
|
|
% this additional code here.
|
|
% \begin{macrocode}
|
|
\let\@eatDP\@undefined
|
|
\let\caption@tempa\@empty
|
|
\ifx\f@ffrench\fnum@figure
|
|
\l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
|
|
\fi
|
|
\ifx\f@tfrench\fnum@table
|
|
\l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
|
|
\fi
|
|
\def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
|
|
\def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
|
|
\caption@tempa
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
}}}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{\package{float} package support}
|
|
% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
|
|
% \iffalse
|
|
% (This is a more straight-ahead implementation, but it only works with v1.3
|
|
% now, so v1.2 is no longer supported. The old code including documentation
|
|
% can be found in caption-30f-050530.zip)
|
|
% \fi
|
|
%
|
|
% The \package{float} package usually do not use the \LaTeX\ kernel command
|
|
% |\@caption| to typeset the caption but |\float@caption| instead.
|
|
% (|\@caption| will only be used if the float is re-styled with
|
|
% |\restylefloat*|.)
|
|
%
|
|
% The main two things |\float@caption| is doing different are:
|
|
% \begin{itemize}
|
|
% \item The caption will be typeset inside a savebox called |\@floatcapt| so
|
|
% it can be placed above or below the float contents afterwards.
|
|
% \item |\@makecaption| will not be used to finally typeset the caption.
|
|
% Instead |\@fs@capt| will be used which definition is part of the float
|
|
% style.
|
|
% (Note that |\@fs@capt| will not typeset any vertical space above or below
|
|
% the caption; instead this space will be typeset by the float style code
|
|
% itself.)
|
|
% \end{itemize}
|
|
%
|
|
% 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 select
|
|
% 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 with skips.
|
|
% \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}
|
|
% \changes{v3.0h}{2005/08/23}{Bugfix 05-08-12: \cs{captionof} sets hyperref anchor now}
|
|
% 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 requested by
|
|
% |\captionof|. (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}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@of@float{%
|
|
% \end{macrocode}
|
|
% If the \package{hyperref} package is loaded, we need to set the appropriate
|
|
% anchor for ourself. To do so without adding extra vertical space we need
|
|
% to save (and restore) |\prevdepth| and switch off the interline skip.
|
|
% \begin{macrocode}
|
|
\@ifundefined{hyper@@anchor}{}{%
|
|
\begingroup
|
|
\@tempdima\prevdepth
|
|
\nointerlineskip
|
|
\let\leavevmode\relax
|
|
\hyper@@anchor\@currentHref\relax
|
|
\prevdepth\@tempdima
|
|
\endgroup}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\def\caption@@make##1##2{\unvbox\@floatcapt}%
|
|
\@makecaption{}{}}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\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 adaptations 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}
|
|
%
|
|
% Both |\newfloat| and |\restylefloat| save 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
|
|
%<+debug> \PackageInfo{caption}{\protect\@float@c@#1\space := \protect\float@caption}%
|
|
\expandafter\let\csname @float@c@#1\endcsname\float@caption
|
|
\else
|
|
%<+debug> \PackageInfo{caption}{\protect\@float@c@#1\space := \protect\@caption}%
|
|
\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
|
|
% \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
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\fi}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
|
|
%
|
|
% \begin{macro}{\fs@plaintop}
|
|
% \begin{macro}{\fs@boxed}
|
|
% 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 to change this.
|
|
% \begin{macrocode}
|
|
\g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
|
|
\g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% The skip between `boxed' floats and their caption defaults to |2pt|.
|
|
%
|
|
% \begin{macrocode}
|
|
\captionsetup[boxed]{skip=2pt}
|
|
% \end{macrocode}
|
|
%
|
|
% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
|
|
% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
|
|
% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
|
|
% `ruled' with appropriate options. But if the package option |ruled| was
|
|
% specified, we setup some caption parameters to emulate the behaviour
|
|
% of the \package{caption} package \version{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}%
|
|
}{%
|
|
\DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
|
|
}
|
|
\caption@undefbool{ruled}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{\package{floatrow} package support}
|
|
% \changes{v3.0f}{2005/06/01}{Support of the \package{floatrow} package added}
|
|
%
|
|
% 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 follows 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*{\package{hyperref} package support}
|
|
% \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
|
|
%
|
|
% 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}
|
|
% \changes{v3.0g}{2005/06/28}{Bugfix: \cs{newcounter} replaced by \cs{newcount}}
|
|
% 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*{\package{hypcap} package support}
|
|
% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
|
|
%
|
|
% 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*{\package{listings} package support}
|
|
% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@ifpackage{listings}{lst@MakeCaption}{%
|
|
\PackageInfo{caption}{listings package v1.2 (or newer) detected}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\lst@MakeCaption}
|
|
% To support the \package{listings} package we need to redefine
|
|
% |\lst@MakeCaption| so the original stuff is nested with
|
|
% |\caption@begin| and |\caption@end|.
|
|
% \begin{macrocode}
|
|
\let\caption@lst@MakeCaption\lst@MakeCaption
|
|
\def\lst@MakeCaption#1{%
|
|
% \end{macrocode}
|
|
%
|
|
% If the |position=| is set to |auto|, we take over the |captionpos=| setting
|
|
% from the \package{listings} package.
|
|
% Note that we won't do this otherwise, so \package{listings} settings like
|
|
% |abovecaptionskip=0pt,belowcaptionskip=10pt,captionpos=t| will \emph{not}
|
|
% cause different outputs with or without the \package{caption} package loaded.
|
|
% \begin{macrocode}
|
|
\def\caption@autoposition{\caption@setposition{#1}}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@begin{lstlisting}%
|
|
\caption@lst@MakeCaption{#1}%
|
|
\caption@end}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{\package{longtable} package support}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@ifpackage{longtable}{LT@makecaption}{%
|
|
\PackageInfo{caption}{longtable package v3.15 (or newer) detected}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\LT@makecaption}
|
|
% \changes{v3.0d}{2004/08/10}{Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
|
|
% \changes{v3.0e}{2005/05/05}{Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
|
|
% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
|
|
% |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
|
|
% Original code:
|
|
% \begin{verbatim}
|
|
% \def\LT@makecaption#1#2#3{%
|
|
% \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
|
|
% % Based on article class "\@makecaption", "#1" is "\@gobble" in star
|
|
% % form, and "\@firstofone" otherwise.
|
|
% \sbox\@tempboxa{#1{#2: }#3}%
|
|
% \ifdim\wd\@tempboxa>\hsize
|
|
% #1{#2: }#3%
|
|
% \else
|
|
% \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
|
|
% \fi
|
|
% \endgraf\vskip\baselineskip}%
|
|
% \hss}}}
|
|
% \end{verbatim}
|
|
%
|
|
% \begin{macrocode}
|
|
\def\LT@makecaption#1#2#3{%
|
|
\caption@LT@make{%
|
|
% \end{macrocode}
|
|
%
|
|
% We set |\ifcaption@star| according the 1st argument.
|
|
% \begin{macrocode}
|
|
\caption@startrue#1\caption@starfalse
|
|
% \end{macrocode}
|
|
%
|
|
% If |\LTcapwidth| is not set to its default value |4in| we assume
|
|
% that it shall overwrite our own setting.
|
|
% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
|
|
% \begin{macrocode}
|
|
\caption@letfloattype{longtable}{%
|
|
\ifdim\LTcapwidth=4in \else
|
|
\setcaptionwidth\LTcapwidth
|
|
\fi}%
|
|
% \end{macrocode}
|
|
%
|
|
% The default |position=| setting for longtables is |top|.
|
|
% (This emulates the standard behaviour of the \package{longtable} package
|
|
% which has no skip above the caption but a skip below it.)
|
|
% \begin{macrocode}
|
|
% \caption@setdefaultpos{t}%
|
|
\let\caption@defaultpos\@firstoftwo
|
|
% \end{macrocode}
|
|
%
|
|
% |position=auto| is a bad idea for longtables, but we do our very best.
|
|
% This works quite well for captions inside the longtable contents, but
|
|
% not for captions inside the longtable (end)foot.
|
|
% \begin{macrocode}
|
|
\def\caption@autoposition{%
|
|
\caption@setposition{\ifcase\LT@rows t\else b\fi}}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@begin{table}%
|
|
% \end{macrocode}
|
|
%
|
|
% The following skip has the purpose to correct the height of the
|
|
% |\parbox[t]|. Usually it's the height of the very first line, but
|
|
% because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
|
|
% it's always |0pt|.
|
|
% (A different idea would be typesetting the first skip outside the longtable
|
|
% column with |\noalign{\vskip|\ldots|}|, but this means we have to move
|
|
% |\caption@begin| to some other place because it does not work in tabular
|
|
% mode\ldots)
|
|
% \begin{macrocode}
|
|
\vskip-\ht\strutbox
|
|
% \end{macrocode}
|
|
%
|
|
% This should look familiar. We do our skips and use |\caption@@make| to
|
|
% typeset the caption itself.
|
|
% \begin{macrocode}
|
|
\caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
|
|
\caption@@make{#2}{#3}\endgraf
|
|
\caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}%
|
|
\caption@end}}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\caption@LT@make}
|
|
% Typesets the caption as centered |\multicolumn|\ldots
|
|
% \begin{macrocode}
|
|
\newcommand\caption@LT@make[1]{%
|
|
\LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{#1}\hss}}}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{\package{picins} package support}
|
|
% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@ifpackage{picins}{piccaption}{%
|
|
\PackageInfo{caption}{picins package v3.0 (or newer) detected}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\piccaption}
|
|
% Original code:
|
|
% \begin{verbatim}
|
|
% \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
|
|
% \end{verbatim}
|
|
% \begin{macrocode}
|
|
\def\piccaption{\@dblarg\@piccaption}
|
|
% \def\piccaption{\caption@caption{\@dblarg\@piccaption}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% {\itshape TODO: Make |\piccaption[]{|\ldots|}| and |\piccaption{}| work}
|
|
%
|
|
% \begin{macrocode}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{\package{rotating} package support}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@ifpackage{rotating}{@rotcaption}{%
|
|
\PackageInfo{caption}{rotating package v2.0 (or newer) detected}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\rotcaption}
|
|
% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@caption} removed}
|
|
% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
|
|
% Make |\rotcaption*| work.
|
|
% \begin{macrocode}
|
|
\def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
|
|
% \let\@rotcaption\@undefined
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\rotcaptionof}
|
|
% \changes{v3.0i}{2005/12/07}{New}
|
|
% Make |\rotcaptionof(*)| work.
|
|
% \begin{macrocode}
|
|
\def\rotcaptionof{\@ifstar{\caption@of{\rotcaption*}}{\caption@of\rotcaption}}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\@makerotcaption}
|
|
% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
|
|
% Original (bugfixed) code:
|
|
% \begin{verbatim}
|
|
% \long\def\@makerotcaption#1#2{%
|
|
% \setbox\@tempboxa\hbox{#1: #2}%
|
|
% \ifdim \wd\@tempboxa > .8\vsize
|
|
% \rotatebox{90}{%
|
|
% \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
|
|
% }%\par % <== \par removed (AR)
|
|
% \else%
|
|
% \rotatebox{90}{\box\@tempboxa}%
|
|
% \fi
|
|
% \nobreak\hspace{12pt}% <== \nobreak added (AR)
|
|
% }
|
|
% \end{verbatim}
|
|
% Our version emulates this behaviour, but if |width=| is set,
|
|
% the rotated caption is always typeset as |minipage|.
|
|
% (Note that |margin=| is not supported here.)
|
|
% \begin{macrocode}
|
|
\long\def\@makerotcaption#1#2{%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\ifdim\captionwidth=\z@
|
|
\setcaptionwidth{.8\textheight}%
|
|
\caption@slc{#1}{#2}{.8\vsize}{%
|
|
\let\caption@makerot\caption@@make
|
|
\setcaptionmargin\z@
|
|
% \setlength\captionindent\z@
|
|
% \def\caption@startbox##1{\hbox\bgroup\hsize=.8\textheight}%
|
|
% \def\caption@endbox{\egroup}%
|
|
% (not needed because \rotatebox uses an \hbox anyway)
|
|
\let\caption@startbox\@gobble
|
|
\let\caption@endbox\relax}%
|
|
\caption@setbool{slc}{0}% been there, done that
|
|
\fi
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\rotatebox{90}{\caption@makerot{#1}{#2}}%
|
|
\nobreak\hspace{12pt}}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macrocode}
|
|
\newcommand\caption@makerot[2]{%
|
|
\begin{minipage}\captionwidth\caption@@make{#1}{#2}\end{minipage}}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{\package{sidecap} package support}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@ifpackage{sidecap}{endSC@FLOAT}{%
|
|
\PackageInfo{caption}{sidecap package v1.4d (or newer) detected}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\SC@caption}
|
|
% \changes{v3.0d}{2004/11/28}{Bugfix: Definition of \cs{@captype} added}
|
|
% \changes{v3.0e}{2005/05/05}{Bugfix: Empty captions are handled correctly now}
|
|
% \changes{v3.0e}{2005/05/05}{Priority of options fixed}
|
|
% \changes{v3.0h}{2005/10/03}{Bugfix: Always use \cs{AtBeginDocument} to set \cs{SC@caption}}
|
|
% First of all, we let sidecap use an actual definition of |\caption|.\\
|
|
% (This is only required for version 1.5d of the sidecap package.)
|
|
% \begin{macrocode}
|
|
\@ifundefined{caption@caption}%
|
|
{\let\caption@tempa\AtBeginDocument}%
|
|
{\let\caption@tempa\@firstofone}%
|
|
\caption@tempa{\let\SC@caption=\caption}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\SC@zfloat}
|
|
% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
|
|
% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@caption} removed}
|
|
% This macro will be called at the start of the environment, here is a good
|
|
% opportunity to do some adaptations to |\caption| and |\captionsetup|.
|
|
% \begin{macrocode}
|
|
\let\caption@SC@zfloat\SC@zfloat
|
|
\def\SC@zfloat#1#2#3[#4]{%
|
|
% \end{macrocode}
|
|
%
|
|
% Note: |#2| is either |figure| or |table| and will be stored to |\SC@captype|
|
|
% by the original version of |\SC@zfloat|.
|
|
% \begin{macrocode}
|
|
\caption@SC@zfloat{#1}{#2}{#3}[#4]%
|
|
% \end{macrocode}
|
|
%
|
|
% Since the sidecap package uses our |\caption| code outside the
|
|
% floating environment the regular |\captionsetup| will not work.
|
|
% So we need a special version here which saves the given argument list
|
|
% which will be executed later on.
|
|
% \begin{macrocode}
|
|
\global\let\SC@CAPsetup\@empty
|
|
\def\captionsetup##1{\g@addto@macro\SC@CAPsetup{,##1}}%
|
|
% \end{macrocode}
|
|
%
|
|
% Make |\caption*| work.
|
|
% \begin{macrocode}
|
|
\let\caption@old\caption
|
|
% \def\caption{\renewcommand\captionsetup[1]{}\caption@caption\caption@old}%
|
|
\def\caption{\caption@caption\caption@old}%
|
|
}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\endSC@FLOAT}
|
|
% \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
|
|
% This macro will be called at the end of the environment, here we need to
|
|
% setup our stuff before the \package{sidecap} package actually typesets
|
|
% its caption.
|
|
% \begin{macrocode}
|
|
\let\caption@endSC@FLOAT\endSC@FLOAT
|
|
\def\endSC@FLOAT{%
|
|
% \end{macrocode}
|
|
%
|
|
% Note that |\@captype| isn't defined so far, this will be done inside
|
|
% the original definition of |\endSC@FLOAT|.
|
|
% But we define |\@captype| already here to make |\captionsetup| work
|
|
% with |\@captype|-based options (like |type=|).
|
|
% \begin{macrocode}
|
|
\let\@captype\SC@captype
|
|
% \end{macrocode}
|
|
%
|
|
% Here we execute the options set with |\captionsetup| inside this environment.
|
|
% \begin{macrocode}
|
|
\caption@esetup\SC@CAPsetup
|
|
% \end{macrocode}
|
|
%
|
|
% Before we can typeset the caption we need to set the margin to zero
|
|
% because any extra margin would only be disturbing here.\par
|
|
% (We don't need to take care about the caption position because
|
|
% the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
|
|
% to a skip of zero anyway.)\par
|
|
% Furthermore |\SC@justify| will override the caption justification, if set.
|
|
% The usage of |\SC@justify| differs from version to version of the
|
|
% \package{sidecap} package:\par
|
|
% \begin{tabular}{ll}
|
|
% Version 1.4: & |\SC@justify| is not defined\\
|
|
% Version 1.5: & |\SC@justify| is |\relax| when not set\\
|
|
% Version 1.6: & |\SC@justify| is |\@empty| when not set\\
|
|
% \end{tabular}
|
|
% \begin{macrocode}
|
|
\caption@letfloattype{SC\@captype}{%
|
|
\@listdepth\z@
|
|
\setcaptionmargin\z@
|
|
\@ifundefined{SC@justify}{}{%
|
|
\ifx\SC@justify\@empty\else
|
|
\let\caption@hj\SC@justify
|
|
\let\SC@justify\@empty
|
|
\fi}}%
|
|
% \end{macrocode}
|
|
%
|
|
% We adapt |\caption@ifempty| so |\caption{}| will work within these
|
|
% environments, too.
|
|
% \begin{macrocode}
|
|
\long\def\caption@ifempty##1{%
|
|
\ifx\SC@CAPtext\@empty
|
|
\expandafter\@firstofone
|
|
\else
|
|
\expandafter\@gobble
|
|
\fi}%
|
|
% \end{macrocode}
|
|
%
|
|
% \iffalse % Does not work anyway...
|
|
% Furthermore we adapt |\caption@ifnocontentsline| so |\caption[]{|\ldots|}|
|
|
% will work within these environments, too.
|
|
% \begin{macrocode}
|
|
% \long\def\caption@ifnocontentsline##1{%
|
|
% \ifx\SC@OPTCAPtext\@empty
|
|
% \expandafter\@firstofone
|
|
% \else
|
|
% \expandafter\@gobble
|
|
% \fi}%
|
|
% \end{macrocode}
|
|
% \fi
|
|
%
|
|
% Finally we call the original definition of |\endSC@FLOAT| which will
|
|
% call our version of |\caption| to typeset the caption.
|
|
% \begin{macrocode}
|
|
\caption@endSC@FLOAT}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \subsubsection*{\package{supertabular} package support}
|
|
%
|
|
% \begin{macro}{\caption@setSTposition}
|
|
% The |position=| setting will be overwritten by the
|
|
% \package{supertabular} package: If |\topcaption| is used,
|
|
% the position will be |top| automatically, |bottom| otherwise.
|
|
% \begin{macrocode}
|
|
\def\caption@setSTposition{%
|
|
\caption@setposition{\if@topcaption t\else b\fi}}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
\caption@ifpackage{supertabular}{ST@caption}{%
|
|
\PackageInfo{caption}{supertabular package detected}%
|
|
% \end{macrocode}
|
|
%
|
|
% \begin{macro}{\tablecaption}
|
|
% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
|
|
% Make |\topcaption*| and |\bottomcaption*| work.
|
|
% \begin{macrocode}
|
|
\let\caption@tablecaption\tablecaption
|
|
\def\tablecaption{\caption@caption\caption@tablecaption}%
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macro}{\ST@caption}
|
|
% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
|
|
% Original code:
|
|
% \begin{verbatim}
|
|
% \long\def\ST@caption#1[#2]#3{\par%
|
|
% \addcontentsline{\csname ext@#1\endcsname}{#1}%
|
|
% {\protect\numberline{%
|
|
% \csname the#1\endcsname}{\ignorespaces #2}}
|
|
% \begingroup
|
|
% \@parboxrestore
|
|
% \normalsize
|
|
% \if@topcaption \vskip -10\p@ \fi
|
|
% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
|
|
% \if@topcaption \vskip 10\p@ \fi
|
|
% \endgroup}
|
|
% \end{verbatim}
|
|
% \begin{macrocode}
|
|
\let\caption@ST\ST@caption
|
|
\long\def\ST@caption#1[#2]#3{\par%
|
|
\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}
|
|
% \end{macro}
|
|
%
|
|
% \begin{macrocode}
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \iffalse
|
|
%</package>
|
|
% \fi
|
|
%
|
|
% \clearpage
|
|
% \Finale
|
|
%
|
|
\endinput
|