From 5351150bc318eded08bb95323545f9279454652d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 12 Aug 2011 00:23:55 +0000 Subject: caption (11aug11) git-svn-id: svn://tug.org/texlive/trunk@23505 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/caption/bicaption.dtx | 821 +++ Master/texmf-dist/source/latex/caption/caption.dtx | 6230 +++++--------------- Master/texmf-dist/source/latex/caption/caption.ins | 16 +- .../texmf-dist/source/latex/caption/caption2.dtx | 11 +- .../texmf-dist/source/latex/caption/caption3.dtx | 4023 +++++++++++++ .../texmf-dist/source/latex/caption/ltcaption.dtx | 21 +- .../texmf-dist/source/latex/caption/subcaption.dtx | 215 +- 7 files changed, 6359 insertions(+), 4978 deletions(-) create mode 100644 Master/texmf-dist/source/latex/caption/bicaption.dtx create mode 100644 Master/texmf-dist/source/latex/caption/caption3.dtx (limited to 'Master/texmf-dist/source/latex/caption') diff --git a/Master/texmf-dist/source/latex/caption/bicaption.dtx b/Master/texmf-dist/source/latex/caption/bicaption.dtx new file mode 100644 index 00000000000..48bb77a4d7b --- /dev/null +++ b/Master/texmf-dist/source/latex/caption/bicaption.dtx @@ -0,0 +1,821 @@ +% \iffalse meta-comment +% +% This is file `bicaption.dtx'. +% +% Copyright (C) 2010-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) +% +% -------------------------------------------------------------------------- +% +% 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, +% caption3.dtx, bicaption.dtx, ltcaption.dtx, and subcaption.dtx, +% the derived files caption.sty, caption2.sty, caption3.sty, bicaption.sty, +% ltcaption.sty, and subcaption.sty, and the user manuals caption-deu.tex, +% caption-eng.tex, and caption-rus.tex. +% +% \fi +% \CheckSum{188} +% +% \iffalse +%<*driver> +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesFile{bicaption.drv}[2010/09/19 v1.0 Adds a bilingual caption feature to the caption package] +\hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up. +%\errorcontextlines=3 +% +\documentclass[german,english]{ltxdoc} +\setlength\parindent{0pt} +\setlength\parskip{\smallskipamount} +% +\newcommand\LineBreak{\linebreak[3]} +\newcommand\PageBreak{\pagebreak[3]} +\usepackage{ifpdf} +\ifpdf + \usepackage{mathptmx,courier} + \usepackage[scaled=0.90]{helvet} + \addtolength\marginparwidth{15pt} + \ifdim\paperheight=297mm % a4paper + \renewcommand\LineBreak{\\} + \renewcommand\PageBreak{\clearpage} + \fi +\fi +% +\usepackage[T1]{fontenc} +\usepackage[german,english]{babel} +\usepackage{selinput}\SelectInputMappings{adieresis={ä},germandbls={ß}} +% +\usepackage[bottom]{footmisc} +% +\usepackage{hypdoc} +\ifpdf\usepackage{hypdestopt}\fi +\hypersetup{pdfkeywords={LaTeX, package, bicaption},pdfstartpage={},pdfstartview={}} +% +\usepackage{bicaption}[2010/09/01] +\usepackage{subcaption}[2010/09/01] +% +\newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}} +\newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}} +\newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}} +\let\package\puresf +\let\env\purett \let\opt\purett +% +\newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} +\newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} +\newcommand*\version[2][]{$v#2$} +\newcommand*\x{\discretionary{}{}{}} +% +\usepackage{marvosym} +\makeatletter +\newcommand*\INFO{\@ifstar{\@INFO{}}{\@INFO{\vbox to \ht\strutbox}}} +\newcommand*\@INFO[1]{\MARGINSYM{#1{\LARGE\Info}}} +\makeatother +% +\usepackage[alpine]{ifsym} +\newenvironment{background}{\par\bigskip\csname background*\endcsname}{\csname endbackground*\endcsname} +\newenvironment{background*}{\small\MARGINSYM{\Mountain}\ignorespaces}{\par} +% +\newcommand*\MARGINSYM[1]{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{#1}}}} +%\newcommand*\NEW[2]{}%\hskip 1sp \marginpar{\footnotesize\sffamily\raggedleft#1\\#2}} +% +\newenvironment{Options}[1]% + {\list{}{\renewcommand\makelabel[1]{\texttt{##1}\hfil}% + \settowidth\labelwidth{\texttt{#1\space}}% + \setlength\leftmargin{10pt}% + \addtolength\leftmargin{\labelwidth}% + \addtolength\leftmargin{\labelsep}}}% + {\endlist} +% +\begin{document} + \DocInput{bicaption.dtx} +\end{document} +% +% \fi +% +% \let\subsectionautorefname\sectionautorefname +% \let\subsubsectionautorefname\sectionautorefname +% +% \def\thispackage{the \package{bicaption} package} +% \def\Thispackage{The \package{bicaption} package} +% +% \newcommand\NEWfeature{\NEW{New feature}} +% \newcommand\NEWdescription{\NEW{New description}} +% +% \makeatletter +% \newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}} +% \newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}} +% \makeatother +% \newcommand*\See[1]{\nopagebreak{\small (See #1)}} +% +% \GetFileInfo{bicaption.drv} +% \let\docdate\filedate +% \GetFileInfo{bicaption.sty} +% +% \title{\texorpdfstring{\Thispackage\thanks{%^^A +% This package has version number \fileversion, last revised \filedate.}}%^^A +% {The bicaption package}} +% \author{Axel Sommerfeldt\\ +% \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}} +% \date{\docdate} +% \maketitle +% +% \begin{abstract} +% This package supports the typesetting of bilangual captions. +% \end{abstract} +% +% \setcounter{tocdepth}{2} +% \tableofcontents +% +% \clearpage +% \section{The user interface} +% +% \subsection{Loading the package} +% +% \DescribeMacro{\usepackage} +% This package will be loaded by +% \begin{quote} +% |\usepackage|\oarg{options}|{bicaption}|\quad. +% \end{quote} +% The options for \thispackage\ are the same ones as for the \package{caption} +% package and specify settings which are used for the second language +% \emph{additionally}. +% In fact +% \begin{quote} +% |\usepackage|\oarg{options}|{bicaption}| +% \end{quote} +% is identical to +% \begin{quote} +% |\usepackage{bicaption}|\\ +% |\captionsetup[bi-second]|\marg{options}\quad. +% \end{quote} +% +% \subsection{Setting options} +% +% \DescribeMacro{\captionsetup} +% \begin{quote} +% |\captionsetup[bi]|\marg{options} +% \end{quote} +% do setup options which will be used for bilanguage captions \emph{additionally} +% to the ones which are setup for the specific floating environment. +% +% \begin{quote} +% |\captionsetup[bi-first]|\marg{options} +% \end{quote} +% do setup options which will be used for the \emph{first} heading +% of the bilanguage captions \emph{additionally} +% to the ones which are setup for the specific floating environment +% and the ones which are setup by |\captionsetup[bi]{|\ldots|}|. +% +% \begin{quote} +% |\captionsetup[bi-second]|\marg{options} +% \end{quote} +% do setup options which will be used for the \emph{second} heading +% of the bilanguage captions \emph{additionally} +% to the ones which are setup for the specific floating environment +% and the ones which are setup by |\captionsetup[bi]{|\ldots|}|. +% +% \bigskip +% +% Options specified with |\usepackage[|\ldots|]{bi|\-|caption}| and +% |\caption|\-|setup[bi|\ldots|]{|\ldots|}| will override the ones specified by +% |\caption|\-|setup{|\ldots|}| and |\caption|\-|setup[fig|\-|ure]{|\ldots|}| +% (same for `table'). So finally we have the following order how +% settings for bilingual captions are applied: +% \begin{enumerate} +% \item Global settings +% {\small(|\usepackage[|\ldots|]{caption}| and |\captionsetup{|\ldots|}|)} +% \item Environmental settings +% {\small(|\captionsetup[figure|\emph{ -or- }|table]{|\ldots|}|)} +% \item Local settings +% {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)} +% \item Custom `bi' settings +% {\small(|\captionsetup[bi]{|\ldots|}|)} +% \item Custom `bi-first' resp.~`bi-second' settings +% {\small(|\usepackage[|\ldots|]{bicaption}| and +% |\caption|\-|setup[bi-first]{|\ldots|}| +% resp.~|\caption|\-|setup[bi-second]{|\ldots|}|)} +% \end{enumerate} +% An example: +% \begin{quote} +% |\usepackage[labelsep=quad,indention=10pt]{caption}|\\ +% |\usepackage[labelfont=bf]{bicaption}|\\ +% |\captionsetup[table]{labelfont=it,position=top}| +% \end{quote} +% causes the second heading of the bilingual caption inside |table| environments +% to be typeset with the settings +% \begin{quote} +% |labelsep=quad,indention=10pt,position=top,labelfont=bf|~. +% \end{quote} +% +% \subsection{Additional options} +% +% These options are available additional to the ones offered by the +% \package{caption} package: +% +% \begin{Options}{language=} +% \item[language=] +% \DescribeMacro{language=} +% Sets the language of the caption, +% e.g. +% \begin{quote}|\use|\-|package|\-|[eng|\-|lish]{bi|\-|caption}|\end{quote} +% will typeset the second caption of bilingual captions in English. +% (The language will be set with |\select|\-|language| internally, +% so the \package{babel} package must be loaded for using this option.) +% +% \item[bi-lang=] +% \DescribeMacro{bi-lang=} +% Causes a selection of the headings of bilingual captions. +% \begin{quote}|\captionsetup{bi-lang=both}|\end{quote} +% will cause that both caption headings are being typeset.\\ +% (This is the default.) +% \begin{quote}|\captionsetup{bi-lang=first}|\end{quote} +% will cause that only the \emph{first} heading is being typeset, and +% \begin{quote}|\captionsetup{bi-lang=second}|\end{quote} +% will cause that only the \emph{second} heading is being typeset. +% +% \item[bi-slc=] +% \DescribeMacro{bi-singlelinecheck=} +% Switches the common single-line-check |on| or |off|, i.e.~when switched on +% only a single check will be done for both captions, and the result will affect +% both captions afterwards. So if only one caption is longer than a single line, +% both captions will be treated as if they are longer than a single line, even if +% the second one isn't. (The default is |on|.) +% +% \item[bi-swap=] +% \DescribeMacro{bi-swap=} +% \begin{quote}|\captionsetup{bi-swap}|\end{quote} +% will swap the primary and secondary language, +% making the first language the second one and vice versa. (The default is |false|.) +% \end{Options} +% +% \subsection{The \cs{bicaption} commands} +% +% \DescribeMacro\bicaption +% Bilingual captions will be typeset by +% \begin{quote} +% |\bicaption|\oarg{list entry}\marg{heading \#1}\marg{heading \#2}\\ +% |\bicaption*|\marg{heading \#1}\marg{heading \#2} +% \end{quote} +% The |\label| should be placed either after this command, or inside the first heading. +% +% \bigskip +% +% If the \package{subcaption} package is loaded, these commands are available +% additionally: +% +% \DescribeMacro\bisubcaption +% Bilingual sub-captions will be typeset by +% \begin{quote} +% |\bisubcaption|\oarg{list entry}\marg{heading \#1}\marg{heading \#2}\\ +% |\bisubcaption*|\marg{heading \#1}\marg{heading \#2} +% \end{quote} +% The |\label| should be placed either after this command, or inside the first heading. +% +% \DescribeMacro\bisubcaptionbox +% Bilingual sub-caption boxes will be typeset by +% \begin{quote} +% |\subcaptionbox|\oarg{list entry}\marg{heading \#1}\marg{heading \#2}\\ +% | |\oarg{width}\oarg{inner-pos}\marg{contents}\\ +% |\subcaptionbox*|\marg{heading \#1}\marg{heading \#2}\\ +% | |\oarg{width}\oarg{inner-pos}\marg{contents} +% \end{quote} +% The |\label| should be placed inside the first heading. +% +% \subsection{An example code} +% +% \begin{quote} +% |\documentclass[english,ngerman]{article}|\\ +% |\usepackage{selinput}|\\ +% |\SelectInputMappings{adieresis={ä},germandbls={ß}}|\\ +% ||\\ +% |\usepackage{babel}|\\ +% |\usepackage[lang=english,font=it]{bicaption}|\\ +% |\usepackage[format=hang,list=on]{subcaption}|\\ +% ||\\ +% |\begin{document}|\\ +% ||\\ +% \iffalse +% |\listoffigures|\\ +% ||\\ +% \fi +% |\begin{figure}[!htb]|\\ +% | \centering|\\ +% | \bisubcaptionbox|\\ +% | {Teilabbildung A\label{fig:test:A}}|\\ +% | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ +% | \qquad|\\ +% | \bisubcaptionbox|\\ +% | {Teilabbildung langer Titel B\label{fig:test:B}}|\\ +% | {Subfigure long title B}[0.4\textwidth]{IMAGE}%|\\ +% | \bicaption{Deutscher Titel}{English Title}|\\ +% | \label{fig:test}|\\ +% |\end{figure}|\\ +% ||\\ +% \iffalse +% |\captionsetup{bi-lang=2nd}|\\ +% ||\\ +% |\begin{figure}[!htb]|\\ +% | \centering|\\ +% | \bisubcaptionbox|\\ +% | {Teilabbildung A\label{fig:test2:A}}|\\ +% | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ +% | \qquad|\\ +% | \bisubcaptionbox|\\ +% | {Teilabbildung langer Titel B\label{fig:test2:B}}|\\ +% | {Subfigure long title B}[0.4\textwidth]{IMAGE}%|\\ +% | \bicaption{Deutscher Titel}{English Title}|\\ +% | \label{fig:test2}|\\ +% |\end{figure}|\\ +% \fi +% ||\\ +% |\captionsetup{bi-lang=both}|\\ +% ||\\ +% |\begin{figure}[!htb]|\\ +% | \centering|\\ +% | \bisubcaptionbox[A]|\\ +% | {Und eine gaaaanz lange Caption: Teilabbildung A}|\\ +% | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ +% | \qquad|\\ +% | \bisubcaptionbox[B]|\\ +% | {Teilabbildung B}|\\ +% | {Subfigure B}[0.4\textwidth]{IMAGE}%|\\ +% | \bicaption[Abbildungsverzeichnistitel]|\\ +% | {Und eine noch viel viel viel|\\ +% | längere deutsche Beschriftung: Deutscher Titel}|\\ +% | {Short English heading}|\\ +% |\end{figure}|\\ +% ||\\ +% |\captionsetup{bi-slc=0}|\\ +% ||\\ +% |\begin{figure}[!htb]|\\ +% | \centering|\\ +% | \bisubcaptionbox[A]|\\ +% | {Und eine gaaaanz lange Caption: Teilabbildung A}|\\ +% | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ +% | \qquad|\\ +% | \bisubcaptionbox[B]|\\ +% | {Teilabbildung B}|\\ +% | {Subfigure B}[0.4\textwidth]{IMAGE}%|\\ +% | \bicaption[Abbildungsverzeichnistitel]|\\ +% | {Und eine noch viel viel viel|\\ +% | längere deutsche Beschriftung: Deutscher Titel}|\\ +% | {Short English heading}|\\ +% |\end{figure}|\\ +% ||\\ +% |\captionsetup{slc=0}|\\ +% ||\\ +% |\begin{figure}[!htb]|\\ +% | \centering|\\ +% | \bisubcaptionbox[A]|\\ +% | {Und eine gaaaanz lange Caption: Teilabbildung A}|\\ +% | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\ +% | \qquad|\\ +% | \bisubcaptionbox[B]|\\ +% | {Teilabbildung B}|\\ +% | {Subfigure B}[0.4\textwidth]{IMAGE}%|\\ +% | \bicaption[Abbildungsverzeichnistitel]|\\ +% | {Und eine noch viel viel viel|\\ +% | längere deutsche Beschriftung: Deutscher Titel}|\\ +% | {Short English heading}|\\ +% |\end{figure}|\\ +% ||\\ +% |\end{document}|\\ +% \end{quote} +% +% \captionsetup[bi-first]{lang=german} +% \captionsetup[bi-second]{lang=english,font=it} +% \captionsetup[sub]{format=hang,list=on} +% +% \iffalse +% \listoffigures +% \bigskip +% \fi +% +% \begin{figure}[!htb] +% \centering +% \bisubcaptionbox +% {Teilabbildung A\label{fig:test:A}} +% {Subfigure A}[0.4\textwidth]{IMAGE}% +% \qquad +% \bisubcaptionbox +% {Teilabbildung langer Titel B\label{fig:test:B}} +% {Subfigure long title B}[0.4\textwidth]{IMAGE}% +% \bicaption{Deutscher Titel}{English Title} +% \label{fig:test} +% \end{figure} +% +% \iffalse +% \captionsetup{bi-lang=2nd} +% +% \begin{figure}[!htb] +% \centering +% \bisubcaptionbox +% {Teilabbildung A\label{fig:test2:A}} +% {Subfigure A}[0.4\textwidth]{IMAGE}% +% \qquad +% \bisubcaptionbox +% {Teilabbildung langer Titel B\label{fig:test2:B}} +% {Subfigure long title B}[0.4\textwidth]{IMAGE}% +% \bicaption{Deutscher Titel}{English Title} +% \label{fig:test2} +% \end{figure} +% \fi +% +% \captionsetup{bi-lang=both} +% +% \begin{figure}[!htb] +% \centering +% \bisubcaptionbox[A] +% {Und eine gaaaanz lange Caption: Teilabbildung A} +% {Subfigure A}[0.4\textwidth]{IMAGE}% +% \qquad +% \bisubcaptionbox[B] +% {Teilabbildung B} +% {Subfigure B}[0.4\textwidth]{IMAGE}% +% \bicaption[Abbildungsverzeichnistitel] +% {Und eine noch viel viel viel +% längere deutsche Beschriftung: Deutscher Titel} +% {Short English heading} +% \end{figure} +% +% \captionsetup{bi-slc=0} +% +% \begin{figure}[!htb] +% \centering +% \bisubcaptionbox[A] +% {Und eine gaaaanz lange Caption: Teilabbildung A} +% {Subfigure A}[0.4\textwidth]{IMAGE}% +% \qquad +% \bisubcaptionbox[B] +% {Teilabbildung B} +% {Subfigure B}[0.4\textwidth]{IMAGE}% +% \bicaption[Abbildungsverzeichnistitel] +% {Und eine noch viel viel viel +% längere deutsche Beschriftung: Deutscher Titel} +% {Short English heading} +% \end{figure} +% +% \captionsetup{slc=0} +% +% \begin{figure}[!htb] +% \centering +% \bisubcaptionbox[A] +% {Und eine gaaaanz lange Caption: Teilabbildung A} +% {Subfigure A}[0.4\textwidth]{IMAGE}% +% \qquad +% \bisubcaptionbox[B] +% {Teilabbildung B} +% {Subfigure B}[0.4\textwidth]{IMAGE}% +% \bicaption[Abbildungsverzeichnistitel] +% {Und eine noch viel viel viel +% längere deutsche Beschriftung: Deutscher Titel} +% {Short English heading} +% \end{figure} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \StopEventually{%^^A +% } +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \DoNotIndex{\\,\_,\ ,\@@par} +% \DoNotIndex{\@bsphack} +% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname} +% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs} +% \DoNotIndex{\@for,\@firstofone,\@firstoftwo} +% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom} +% \DoNotIndex{\@ifnextchar,\@ifpackagelater,\@ifpackageloaded} +% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse} +% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist} +% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar} +% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc} +% \DoNotIndex{\@testopt} +% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} +% \DoNotIndex{\p@,\z@} +% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup} +% \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{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip} +% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write} +% \DoNotIndex{\providecommand,\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{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \setlength{\parskip}{0pt plus 1pt} +% \changes{v0.1}{2010/07/13}{Initial version} +% \changes{v0.2}{2010/07/13}{Check for caption package added} +% \changes{v0.3}{2010/07/13}{Usage of \cs{caption@applyfont} added} +% \changes{v0.4}{2010/07/13}{``Singlelinecheck'' fixed} +% \changes{v0.5}{2010/07/13}{Options \opt{bi-first} and \opt{bi-second} added} +% \changes{v0.6}{2010/07/13}{Option \opt{bi-slc} added} +% \changes{v0.7}{2010/07/13}{Option \opt{bi-lang} added} +% \changes{v0.8}{2010/09/04}{Adapted to current version of the caption kernel} +% \changes{v0.9}{2010/09/17}{Option \opt{bi-swap} added} +% \changes{v0.9a}{2011/07/13}{Warning regarding \package{babel} package added} +% +% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \clearpage +% \section{The implementation} +% \iffalse +%<*package> +% \fi +% +% \subsection{Identification} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{bicaption}[2011/07/13 v0.9a Bilingual Captions (AR)] +\RequirePackage{caption}[2011/01/01] % needs v3.2 or newer +% \end{macrocode} +% \bigskip +% +% \pagebreak[3] +% \subsection{Initial code} +% +% \begin{macro}{\bicaption@Warning} +% |\bicaption@Warning|\marg{message} +% \begin{macrocode} +\newcommand*\bicaption@Warning[1]{% + \bicaption@WarningNoLine{#1\on@line}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\bicaption@WarningNoLine} +% |\bicaption@WarningNoLine|\marg{message} +% \begin{macrocode} +\newcommand*\bicaption@WarningNoLine[1]{% + \PackageWarning{bicaption}{#1.^^J\bicaption@wh\@gobbletwo}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\bicaption@wh{% + See the bicaption package documentation for explanation.} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\bicaption@Error} +% |\bicaption@Error|\marg{message} +% \begin{macrocode} +\newcommand*\bicaption@Error[1]{% + \PackageError{bicaption}{#1}\bicaption@eh} +%\let\bicaption@KV@err\bicaption@Error +% \end{macrocode} +% \begin{macrocode} +\newcommand*\bicaption@eh{% + If you do not understand this error, please take a closer look\MessageBreak + at the documentation of the `bicaption' package.\MessageBreak\@ehc} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{Declaration of options} +% +% The option |bi-lang| will setup which language(s) will actually be typeset, +% the first one, the second one, or both of them. +% \begin{macrocode} +\newcount\bicaption@lang +\DeclareCaptionOption{bi-lang}{% + \caption@ifinlist{#1}{0,all,both}{% + \bicaption@lang=0\relax + }{\caption@ifinlist{#1}{1,1st,first}{% + \bicaption@lang=1\relax + }{\caption@ifinlist{#1}{2,2nd,second}{% + \bicaption@lang=2\relax + }{% + \bicaption@Error{Undefined bi-lang value `#1'}% + }}}} +% \end{macrocode} +% +% The option |bi-singlelinecheck| will setup if a single check will be used +% for both languages (|=on|), +% or if both languages will be checked individually (|=off|). +% \begin{macrocode} +\DeclareCaptionOption{bi-singlelinecheck}[1]{% + \caption@set@bool\bicaption@ifslc{#1}} +\DeclareCaptionOption{bi-slc}[1]{% + \caption@set@bool\bicaption@ifslc{#1}} +% \end{macrocode} +% +% The option |bi-swap| will swap the primary and secondary language, +% making the first language the second one and vice versa. +% \begin{macrocode} +\DeclareCaptionOption{bi-swap}[1]{% + \caption@set@bool\bicaption@ifswap{#1}} +% \end{macrocode} +% +% The option |lang=|\meta{language} will setup the language of the caption. +% \begin{macrocode} +\DeclareCaptionOption{lang}{\def\bicaption@language{#1}} +\let\KV@caption@language\KV@caption@lang +% \end{macrocode} +% +% \begin{macro}{\bicaption@selectlanguage} +% Set the language via \cs{selectlanguage}. +% \begin{macrocode} +\newcommand*\bicaption@selectlanguage{% + \@ifundefined{bicaption@language}{}{% + \expandafter\selectlanguage\expandafter{\bicaption@language}}} +% \end{macrocode} +% |\caption@applyfont| (of the \package{caption} package kernel) will be extended here +% so the language setting will actually take effect. +% \begin{macrocode} +\g@addto@macro\caption@applyfont{% + \bicaption@selectlanguage} +% \end{macrocode} +% \begin{macrocode} +\g@addto@macro\caption@prepareslc{% + \let\bicaption@language\@undefined} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{Execution of options} +% +% Setup default values for |bi-lang| and |bi-singlelinecheck|. +% \begin{macrocode} +\caption@ExecuteOptions{caption}{bi-lang=0,bi-slc=1,bi-swap=0} +% \end{macrocode} +% +% Set the language for the first caption. +% \begin{macrocode} +\ifx\bbl@main@language\@undefined + \bicaption@WarningNoLine{Please load this package after the babel package} +\else + \edef\@tempa{\noexpand\captionsetup[bi-first]{lang=\bbl@main@language}} + \@tempa +\fi +% \end{macrocode} +% We use |\caption@ProcessOptions| here to add the options to the `|bi-second|' option +% list instead of executing them immediately. +% \begin{macrocode} +\caption@SetupOptions{bicaption}{\captionsetup[bi-second]{#2}}% +\caption@ProcessOptions*{bicaption} +% \end{macrocode} +% +% \pagebreak[3] +% \subsection{Main code} +% +% \begin{macro}{\caption@@make} +% We patch \cs{caption@@make} (of the \package{caption} package kernel) +% so \cs{bicaption@@make} will be used for bilingual captions instead. +% \begin{macrocode} +\let\caption@@make@ORI\caption@@make +\renewcommand\caption@@make[2]{% + \@ifundefined{bicaption@text}% + {\caption@@make@ORI{#1}{#2}}% + {\bicaption@@make{#1}{#2}{\bicaption@text}% + \global\let\bicaption@label\@undefined + \global\let\bicaption@text\@undefined}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bicaption@@make} +% |\bicaption@@make|\marg{label}\marg{text \#1}\marg{text \#2}\par +% Typeset both captions using the original version of \cs{caption@@make}. +% \begin{macrocode} +\newcommand\bicaption@@make[3]{% +% \end{macrocode} +% Execute the options setup with |\captionsetup[bi]{|\ldots|}|. +% \begin{macrocode} + \caption@setoptions{bi}% +% \end{macrocode} +% Perform the common single-line-check for both captions, if requested. +% \begin{macrocode} + \ifnum\bicaption@lang=0\relax + \bicaption@ifslc + {\caption@@slc{#1}{#2}{\captionwidth}{}% + {\caption@set@bool\caption@ifslc0}% + \caption@@slc{#1}{#3}{\captionwidth}{}% + {\caption@set@bool\caption@ifslc0}}% + {}% + \fi +% \end{macrocode} +% Typeset the first caption, if requested. +% (Otherwise we only apply the label of it.) +% \begin{macrocode} + \ifnum\bicaption@lang=2\relax + \ifx\bicaption@label\@empty\else + \expandafter\label\expandafter{\bicaption@label}% + \fi + \else + \begingroup + \caption@setoptions{bi-first}% + \caption@@make@ORI{#1}{#2}% + \endgroup + \fi +% \end{macrocode} +% Typeset the second caption, if requested. +% \begin{macrocode} + \ifnum\bicaption@lang=1\relax + \else + \begingroup + \caption@setoptions{bi-second}% + \caption@@make@ORI{#1}{#3}% + \endgroup + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bicaption@setup} +% |\bicaption@setup|\marg{text \#1}\marg{text \#2}\par +% Initiates the bilingual caption typesetting by extracting the |\label| +% of the first text and storing the second text into |\bicaption@text|. +% \begin{macrocode} +\newcommand\bicaption@setup[2]{% + \bicaption@getlabel#1\label{}\@nil + \global\long\def\bicaption@text{\ignorespaces#2}} +\long\def\bicaption@getlabel#1\label#2#3\@nil{% + \global\def\bicaption@label{#2}} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsubsection{The \cs{bicaption} commands} +% +% \begin{macro}{\@bicaption} +% \begin{macrocode} +\newcommand*\@bicaption[1]{% + \let\bicaption@cmd#1% + \caption@withoptargs\@@bicaption} +\newcommand\@@bicaption[3]{% + \bicaption@ifswap + {\bicaption@setup{#2}{#2}% + \bicaption@cmd#1{#3}}% + {\bicaption@setup{#2}{#3}% + \bicaption@cmd#1{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bicaption} +% |\bicaption*|\oarg{list entry}\marg{text \#1}\marg{text \#2} +% \begin{macrocode} +\newcommand\bicaption{\@bicaption\caption} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bisubcaption} +% |\bisubcaption*|\oarg{list entry}\marg{text \#1}\marg{text \#2} +% \begin{macrocode} +\newcommand\bisubcaption{\@bicaption\subcaption} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bisubcaptionbox} +% |\bisubcaptionbox*|\oarg{list entry}\marg{text \#1}\marg{text \#2}% +% \oarg{\ldots}\marg{\ldots} +% \begin{macrocode} +\newcommand\bisubcaptionbox{\@bicaption\subcaptionbox} +% \end{macrocode} +% \end{macro} +% +% \iffalse +% +% \fi +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex/caption/caption.dtx b/Master/texmf-dist/source/latex/caption/caption.dtx index 12d8e975342..7e93fe05176 100644 --- a/Master/texmf-dist/source/latex/caption/caption.dtx +++ b/Master/texmf-dist/source/latex/caption/caption.dtx @@ -2,7 +2,7 @@ % % This is file `caption.dtx'. % -% Copyright (C) 1994-2010 Axel Sommerfeldt (caption@sommerfee.de) +% Copyright (C) 1994-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % @@ -19,17 +19,18 @@ % This Current Maintainer of this work is Axel Sommerfeldt. % % This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% ltcaption.dtx, and subcaption.dtx, the derived files caption.sty, -% caption2.sty, caption3.sty, ltcaption.sty, and subcaption.sty, and the -% user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% caption3.dtx, bicaption.dtx, ltcaption.dtx, and subcaption.dtx, +% the derived files caption.sty, caption2.sty, caption3.sty, bicaption.sty, +% ltcaption.sty, and subcaption.sty, and the user manuals caption-deu.tex, +% caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{7235} +% \CheckSum{3589} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{caption.drv}[2010/01/14 v3.1m Implementation of the caption package] +\ProvidesFile{caption.drv}[2011/08/06 v3.2 Implementation of the caption package] \hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up. %\errorcontextlines=3 % @@ -37,12 +38,9 @@ \setlength\parindent{0pt} \setlength\parskip{\smallskipamount} % -%\let\ORIsubsection\subsection -%\def\subsection{\clearpage\ORIsubsection} -% \makeatletter % make room for subsections like 2.16.14 in the TOC -%\newcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}} -\renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.6em}} +%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}} +\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}} \makeatother % \usepackage{ifpdf} @@ -56,7 +54,7 @@ \ifpdf\usepackage{hypdestopt}\fi \hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}} % -\usepackage[debug]{caption}[2009/10/09] +\usepackage[debug]{caption}[2010/09/01] % \DeclareRobustCommand*\eTeX{\texorpdfstring {\leavevmode\hbox{$\varepsilon$}-\TeX}% @@ -100,7 +98,7 @@ % This package has version number \fileversion, last revised \filedate.}}%^^A % {the caption package}} % \author{Axel Sommerfeldt\\ -% \href{mailto:caption@sommerfee.de}{\texttt{caption@sommerfee.de}}} +% \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}} % \date{\docdate} % \maketitle % @@ -108,18 +106,6 @@ % \Thispackage\ 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 provide 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, for example the \package{caption} and -% \package{subfig} packages. -% % \Thispackage\ redefines the \LaTeX\ commands % |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to % |\caption@@make|, giving the user the possibility to control the look \& feel @@ -206,5237 +192,1832 @@ % \fi % % \setlength{\parskip}{0pt plus 1pt} +% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par} % % \changes{v1.0}{1994/10/27}{First release} -% \changes{v1.1}{1994/11/03}{New option \cs{centerlast}} +% \changes{v1.1}{1994/11/03}{New option \texttt{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.4}{1995/01/30}{New option \texttt{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}} % -% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par} -% % \iffalse % --------------------------------------------------------------------------- % % \fi % % \clearpage -% \section{Kernel} +% \let\subsubsection\subsection +% \let\subsection\section +% % \iffalse -%<*kernel> +%<*package> % \fi % % \subsection{Identification} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2010/01/14 v3.1m caption3 kernel (AR)] +\ProvidesPackage{caption}[2011/08/06 v3.2 Customizing captions (AR)] +%\@ifundefined{PackageRedefines}{}{\PackageRedefines{caption}{caption}} % \end{macrocode} % -% \subsection{Generic helpers} +% \subsection{Loading the kernel} % -% \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} +\RequirePackage{caption3}[2011/08/01] % needs v1.3 or newer % \end{macrocode} -% \end{macro} % -% \begin{macro}{\l@addto@macro} -% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which -% globally adds tokens to existing macros, like in |\AtBeginDocument|. -% This is the same but it works local, not global -% (using \cs{edef} instead of \cs{xdef}). -% \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} +% \subsection{Check against incompatible document classes} % -% \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} +\caption@ifbool{documentclass}{}{% + \caption@WarningNoLine{% + Unsupported document class (or package) detected,\MessageBreak + usage of the caption package is not recommended}% + \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption}% +} % \end{macrocode} -% \end{macro} -% \end{macro} % -% \begin{macro}{\caption@ifinlist} -% \changes{v3.1}{2007/07/29}{Rewritten} -% 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,olga,steven}{yes}{no}| -% \end{quote} -% would expand to |yes|. -% \begin{macrocode} -\newcommand*\caption@ifinlist{% - \@expandtwoargs\caption@@ifinlist} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@@ifinlist[2]{% - \begingroup - \def\@tempa##1,#1,##2\@nil{% - \endgroup - \ifx\relax##2\relax - \expandafter\@secondoftwo - \else - \expandafter\@firstoftwo - \fi}% - \@tempa,#2,#1,\@nil}% -% \end{macrocode} -% \end{macro} +% \subsection{Check against incompatible packages} % -% \begin{macro}{\caption@ifin@list} -% \changes{v3.1}{2007/08/12}{This macro added} -% |\caption@ifin@list|\marg{cmd}\marg{list entry}\marg{yes}\marg{no} +% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added} % \begin{macrocode} -\newcommand*\caption@ifin@list[2]{% - \caption@ifempty@list#1% - {\@secondoftwo}% - {\@expandtwoargs\caption@@ifinlist{#2}{#1}}} +\@ifpackageloaded{caption2}{% + \caption@Error{% + You can't use both, the (obsolete) caption2 *and*\MessageBreak + the (current) caption package}% + \endinput +}{} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\caption@g@addto@list} -% \changes{v3.1}{2007/07/29}{This macro added} -% |\caption@g@addto@list|\marg{cmd}\marg{list entry} +% \changes{v3.1}{2007/06/15}{Check against incompatible \package{ftcap} package added} +% \changes{v3.1}{2007/06/15}{Check against incompatible \package{nonfloat} package added} +% \changes{v3.1}{2007/06/18}{Check against incompatible \package{topcapt} package added} % \begin{macrocode} -\newcommand*\caption@g@addto@list[2]{% - \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}} +\caption@AtBeginDocument{% + \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}% + \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}% + \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}} % \end{macrocode} -% \end{macro} -% \begin{macro}{\caption@l@addto@list} -% \changes{v3.1}{2007/07/29}{This macro added} -% |\caption@l@addto@list|\marg{cmd}\marg{list entry} +% \begin{macro}{\caption@DisablePositionOption} +% \changes{v3.1g}{2008/03/20}{\texttt{position=b} added} +% \changes{v3.1h}{2008/03/29}{% +% Name changed from \cs{caption@IncompatiblePackage} to \cs{caption@DisablePositionOption}; +% moved from package to kernel; disables the `position' option now instead of issuing a warning} +% |\caption@DisablePositionOption|\marg{package}\par +% disables the `position' option. % \begin{macrocode} -\newcommand*\caption@l@addto@list[2]{% - \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}} +\newcommand*\caption@DisablePositionOption[1]{% + \caption@InfoNoLine{% + `#1' package detected; setting `position=b' for compatibility reasons}% + \caption@setposition b% % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@g@removefrom@list} -% \changes{v3.1}{2007/07/29}{This macro added} -% |\caption@g@removefrom@list|\marg{cmd}\marg{list entry} % \begin{macrocode} -\newcommand*\caption@g@removefrom@list[2]{% - \caption@l@removefrom@list#1{#2}% - \global\let#1#1} + \DeclareCaptionOption{position}{% + \caption@Error{Usage of the `position' option is incompatible\MessageBreak + to the `#1' package}}} % \end{macrocode} -% \end{macro} -% \begin{macro}{\caption@l@removefrom@list} -% \changes{v3.1}{2007/07/29}{This macro added} -% |\caption@l@removefrom@list|\marg{cmd}\marg{list entry}\par -% \Note[Caveat]{\meta{cmd} will be expanded during this process since -% \cs{@removeelement} is using \cs{edef} to build the new list!} % \begin{macrocode} -\newcommand*\caption@l@removefrom@list[2]{% - \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}} +\@onlypreamble\caption@DisablePositionOption % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@for@list} -% \changes{v3.1}{2007/07/29}{This macro added} -% |\caption@for@list|\marg{cmd}\marg{code with \#1} -% \begin{macrocode} -\newcommand*\caption@for@list[2]{% - \caption@ifempty@list#1{}{% - \def\caption@tempb##1{#2}% - \@for\caption@tempa:=#1\do{% - \expandafter\caption@tempb\expandafter{\caption@tempa}}}} -% \end{macrocode} -% \end{macro} +% \subsection{Declaration of options} % -% \begin{macro}{\caption@ifempty@list} -% \changes{v3.1}{2007/07/29}{This macro added} -% |\caption@ifempty@list|\marg{cmd}\marg{true}\marg{false} -% \begin{macrocode} -\newcommand*\caption@ifempty@list[1]{% - \ifx#1\@undefined - \expandafter\@firstoftwo - \else\ifx#1\relax - \expandafter\expandafter\expandafter\@firstoftwo - \else\ifx#1\@empty - \expandafter\expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter\@firstoftwo - \else - \expandafter\expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter\@secondoftwo - \fi\fi\fi} -% \end{macrocode} -% \end{macro} +% \subsubsection{Options for figure and table} % -% \pagebreak[3] -% \begin{macro}{\caption@setbool} -% \begin{macro}{\caption@set@bool} -% \changes{v3.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added} -% \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} -\newcommand*\caption@setbool[1]{% - \expandafter\caption@set@bool\csname caption@if#1\endcsname} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@set@bool[2]{% - \caption@ifinlist{#2}{1,true,yes,on}{% - \let#1\@firstoftwo - }{\caption@ifinlist{#2}{0,false,no,off}{% - \let#1\@secondoftwo - }{% - \caption@Error{Undefined boolean value `#2'}% - }}} -% \end{macrocode} +% \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added} % \begin{macrocode} -\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}} +\DeclareCaptionOption{figureposition}{% + \captionsetup*[figure]{position=#1}} +\@onlypreamble@key{caption}{figureposition} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}} +\DeclareCaptionOption{tableposition}{% + \captionsetup*[table]{position=#1}} +\@onlypreamble@key{caption}{tableposition} % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\caption@teststar} -% \changes{v3.1}{2007/05/08}{This macro and its usage added} -% \changes{v3.1e}{2007/10/28}{\cs{caption@teststar@} added} -% |\caption@teststar|\marg{cmd}\marg{star arg}\marg{non-star arg}\\ -% |\caption@teststar@|\marg{cmd}\marg{star arg}\marg{non-star arg} -% \begin{macrocode} -\newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@teststar@[3]{% - \@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}} -\AtBeginDocument{\let\caption@teststar@\caption@teststar} -% \end{macrocode} +% \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added} +% \changes{v3.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written} +% \changes{v3.1f}{2007/11/18}{Options \opt{figurename} and \opt{tablename} are now +% available after the document preamble, too.} +% \changes{v3.1f}{2007/11/18}{Option \opt{name} added} % \begin{macrocode} -\newcommand*\caption@ifatletter{% - \ifnum\the\catcode`\@=11 - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} -\AtBeginDocument{\let\caption@ifatletter\@secondoftwo} +\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}} +\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}} +\DeclareCaptionOption{name}{\caption@setname\@captype{#1}} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\caption@withoptargs} -% \changes{v3.1}{2007/08/12}{This macro added} -% |\caption@withoptargs|\marg{cmd} -% \begin{macrocode} -\newcommand*\caption@withoptargs[1]{% - \@ifstar - {\def\caption@tempa{*}\caption@@withoptargs#1}% - {\def\caption@tempa{}\caption@@withoptargs#1}} -% \end{macrocode} -% \begin{macrocode} -\def\caption@@withoptargs#1{% - \@ifnextchar[%] - {\caption@@@withoptargs#1}% - {\caption@@@@withoptargs#1}} -% \end{macrocode} -% \begin{macrocode} -\def\caption@@@withoptargs#1[#2]{% - \l@addto@macro\caption@tempa{[{#2}]}% - \caption@@withoptargs#1} -% \end{macrocode} +% \changes{v3.1g}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added} % \begin{macrocode} -\def\caption@@@@withoptargs#1{% - \expandafter#1\expandafter{\caption@tempa}} +\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}} +\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\caption@CheckCommand} -% \changes{v3.1}{2007/04/10}{This macro added} -% \begin{macro}{\caption@IfCheckCommand} -% \changes{v3.1}{2007/04/10}{This macro added} -% \changes{v3.1i}{2008/08/02}{Revised so \cs{next} is no longer used} -% |\caption@CheckCommand|\marg{macro}\marg{definition of macro}\par -% checks if a command already exists, with the same definition. -% It can be used more-than-once to check if one of multiple definitions will -% finally match. -% (It redefines itself later on to |\@gobbletwo| if the two commands match -% fine, making further checks harmless.)\par -% |\caption@IfCheckCommand|\marg{true}\marg{false}\par -% will execute the \meta{true} code if one match was finally given, -% the \meta{false} code otherwise. -% (It simply checks if |\caption@CheckCommand| is |\@gobbletwo| and -% restores the starting definition of |\caption@CheckCommand|.) +% \begin{macro}{\caption@SetName} +% \changes{v3.1}{2007/07/04}{This macro added} +% \changes{v3.1f}{2007/11/18}{After-preamble variant added} +% \changes{v3.1g}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}} +% \changes{v3.1i}{2008/08/02}{Bugfix: Works now without \cs{addto}, too} +% |\caption@SetName|\marg{cmd}\marg{value} % \begin{macrocode} -\newcommand\caption@DoCheckCommand[2]{% +\newcommand*\caption@SetName[2]{% + \caption@setname{#1}{#2}% \begingroup - \let\@tempa#1% - #2% - \ifx\@tempa#1% - \endgroup - \let\caption@CheckCommand\@gobbletwo - \else - \endgroup - \fi} -\@onlypreamble\caption@DoCheckCommand + \@ifundefined{languagename}{}{% + \@ifundefined{captions\languagename}{}{% + \expandafter\g@addto@macro\csname captions\languagename\endcsname + {\caption@setname{#1}{#2}}}}% + \endgroup} % \end{macrocode} % \begin{macrocode} -\let\caption@CheckCommand\caption@DoCheckCommand -\@onlypreamble\caption@CheckCommand +\newcommand*\caption@setname[2]{\@namedef{#1name}{#2}} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@IfCheckCommand{% - \ifx\caption@CheckCommand\@gobbletwo - \let\caption@CheckCommand\caption@DoCheckCommand - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} -\@onlypreamble\caption@IfCheckCommand +\caption@AtBeginDocument{\let\caption@SetName\caption@setname} % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\caption@AtBeginDocument} -% \changes{v3.1}{2007/04/13}{This macro and its usage added} -% \changes{v3.1l}{2010/01/09}{Adapted to the combine document class} -% |\caption@AtBeginDocument*|\marg{code}\\ -% Same as |\AtBeginDocument| but the execution of code -% will be surrounded by two |\PackageInfo|s. -% The starred variant causes the code to be executed after all code -% specified using the non-starred variant. -% \begin{macrocode} -\let\caption@begindocumenthook\@empty -\let\caption@@begindocumenthook\@empty -% \end{macrocode} -% \begin{macrocode} -\def\caption@AtBeginDocument{% - \caption@teststar\g@addto@macro - \caption@@begindocumenthook\caption@begindocumenthook} -%\@onlypreamble\caption@AtBeginDocument -% \end{macrocode} +% \changes{v3.1f}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added} +% \changes{v3.1i}{2008/04/13}{Option \opt{within} added} +% \changes{v3.1l}{2010/01/09}{The \opt{within} options are now available within the document, too} +% \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined floats +% declared with \cs{DeclareCaptionType}, too} +% +% \begin{macro}{\caption@DeclareWithinOption} +% \changes{v3.1l}{2010/01/09}{This macro and its usage added} % \begin{macrocode} -\AtBeginDocument{% - \PackageInfo{caption}{Begin \noexpand\AtBeginDocument code\@gobble}% +\newcommand*\caption@DeclareWithinOption[1]{% + \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}% + \DeclareCaptionOption{#1without}{\caption@Within{#1}{none}}} % \end{macrocode} +% \end{macro} % \begin{macrocode} - \def\caption@AtBeginDocument{% - \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}% - \caption@begindocumenthook - \let\caption@begindocumenthook\relax +\caption@DeclareWithinOption{figure} +\caption@DeclareWithinOption{table} % \end{macrocode} % \begin{macrocode} - \def\caption@AtBeginDocument{% - \@ifstar\@firstofone\@firstofone}% - \caption@@begindocumenthook - \let\caption@@begindocumenthook\relax +\DeclareCaptionOption{within}{% + \@ifundefined{c@figure}{}{\caption@Within{figure}{#1}}% + \@ifundefined{c@table}{}{\caption@Within{table}{#1}}% + \caption@For{typelist}{\caption@Within{##1}{#1}}% + \def\caption@within@default{#1}} +\DeclareCaptionOption{without}{\KV@caption@within{none}} % \end{macrocode} +% \begin{macro}{\caption@within} +% \changes{v3.1}{2007/12/21}{This macro added} % \begin{macrocode} - \PackageInfo{caption}{End \noexpand\AtBeginDocument code\@gobble}} +\newcommand*\caption@Within[1]{\def\caption@type{#1}\KV@caption@DCT@within} % \end{macrocode} % \end{macro} % -% \subsection{Errors} +% \subsubsection{Miscellaneous options} % -% \begin{macro}{\caption@Warning} -% \changes{v3.1c}{2007/10/14}{This macro added, will now be used for warnings} -% \begin{macro}{\caption@WarningNoLine} -% \changes{v3.1c}{2007/10/14}{This macro added, will now be used for warnings} -% \begin{macro}{\caption@Error} -% \changes{v3.0l}{2007/01/20}{This macro added, will now be used for errors} -% \changes{v3.0q}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}} -% \changes{v3.1b}{2007/09/18}{Usage of \cs{caption@Package} removed} -% \begin{macro}{\caption@KV@err} -% \changes{v3.1b}{2007/09/18}{This macro added} -% |\caption@Error|\marg{message} % \begin{macrocode} -\newcommand*\caption@Warning[1]{% - \caption@WarningNoLine{#1\on@line}} -\newcommand*\caption@WarningNoLine[1]{% - \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}} -\newcommand*\caption@Error[1]{% - \PackageError{caption}{#1}\caption@eh} -\let\caption@KV@err\caption@Error +\DeclareCaptionOption*{config}[caption]{% + \InputIfFileExists{#1.cfg}% + {\typeout{*** Local configuration file #1.cfg used ***}}% + {\caption@Warning{Configuration file #1.cfg not found}}} % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\caption@wh} -% \begin{macro}{\caption@eh} -% At the moment we only offer these two simple warning resp. error helpers. +% \changes{v3.1f}{2007/11/28}{Option \opt{@minipage=} added} % \begin{macrocode} -\newcommand*\caption@wh{% - See the caption package documentation for explanation.} -\newcommand*\caption@eh{% - If you do not understand this error, please take a closer look\MessageBreak - at the documentation of the `caption' package, especially the\MessageBreak - section about errors.\MessageBreak\@ehc} +\DeclareCaptionOption{@minipage}{% + \caption@ifinlist{#1}{auto,default}% + {\let\caption@if@minipage\@gobbletwo}% + {\caption@set@bool\caption@if@minipage{#1}}} +\captionsetup{@minipage=default} % \end{macrocode} -% \end{macro} -% \end{macro} % -% \subsection{Using the keyval package} +% \subsubsection{caption v1.x compatibility options} +% \changes{v3.1}{2007/07/21}{Option `compatibility' added} +% \changes{v3.1}{2007/09/01}{caption v1.x compatibility options revised} +% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v1.x$ compatibility options} % -% We need the \package{keyval} package for option handling, so we load it here. % \begin{macrocode} -\RequirePackage{keyval}[1997/11/10] +\DeclareCaptionOption{compatibility}[1]{\caption@setbool{compatibility}{#1}} +\@onlypreamble@key{caption}{compatibility} % \end{macrocode} % -% \begin{macro}{\undefine@key} -% |\undefine@key|\marg{family}\marg{key}\par -% 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}} +\DeclareCaptionOptionNoValue*{normal}{% + \caption@setformat{plain}% + \caption@setjustification{justified}} +\DeclareCaptionOptionNoValue*{isu}{% + \caption@setformat{hang}% + \caption@setjustification{justified}} +\DeclareCaptionOptionNoValue*{hang}{% + \caption@setformat{hang}% + \caption@setjustification{justified}} +\DeclareCaptionOptionNoValue*{center}{% + \caption@setformat{plain}% + \caption@setjustification{centering}} +\DeclareCaptionOptionNoValue*{anne}{% + \caption@setformat{plain}% + \caption@setjustification{centerlast}} +\DeclareCaptionOptionNoValue*{centerlast}{% + \caption@setformat{plain}% + \caption@setjustification{centerlast}} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\@onlypreamble@key} -% \changes{v3.1}{2007/07/22}{This macro added} -% \changes{v3.1e}{2007/11/01}{\cs{KV@err} will be used now instead of \cs{@notprerr}} -% |\onlypreamble@key|\marg{family}\marg{key}\par -% Analogous to |\@onlypreamble| from \LaTeXe. -% \begin{macrocode} -\providecommand*\@preamble@keys{} -\providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}} -\@onlypreamble\@onlypreamble@key -\@onlypreamble\@preamble@keys -% \end{macrocode} % \begin{macrocode} -\providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}} +\DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}} +\DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}} +\DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}} +\DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}} +\DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}} +\DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}} % \end{macrocode} +% % \begin{macrocode} -\caption@AtBeginDocument*{% - \def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}% - \@preamble@keys - \let\@elt\relax} +\DeclareCaptionOptionNoValue*{up}{\l@addto@macro\captionlabelfont\upshape} +\DeclareCaptionOptionNoValue*{it}{\l@addto@macro\captionlabelfont\itshape} +\DeclareCaptionOptionNoValue*{sl}{\l@addto@macro\captionlabelfont\slshape} +\DeclareCaptionOptionNoValue*{sc}{\l@addto@macro\captionlabelfont\scshape} +\DeclareCaptionOptionNoValue*{md}{\l@addto@macro\captionlabelfont\mdseries} +\DeclareCaptionOptionNoValue*{bf}{\l@addto@macro\captionlabelfont\bfseries} +\DeclareCaptionOptionNoValue*{rm}{\l@addto@macro\captionlabelfont\rmfamily} +\DeclareCaptionOptionNoValue*{sf}{\l@addto@macro\captionlabelfont\sffamily} +\DeclareCaptionOptionNoValue*{tt}{\l@addto@macro\captionlabelfont\ttfamily} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\DeclareCaptionOption} -% |\DeclareCaptionOption|\marg{option}\oarg{default value}\marg{code}\\ -% |\DeclareCaptionOption*|\marg{option}\oarg{default value}\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{% - \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble} -\@onlypreamble\DeclareCaptionOption +\DeclareCaptionOptionNoValue*{nooneline}{\caption@setbool{slc}{0}} % \end{macrocode} +% % \begin{macrocode} -\newcommand*\caption@declareoption[2]{% - #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}} -\@onlypreamble\caption@declareoption +\caption@setbool{ruled}{0} +\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\DeclareCaptionOptionNoValue} -% \changes{v3.1c}{2007/10/06}{This macro added} -% |\DeclareCaptionOptionNoValue|\marg{option}\marg{code}\\ -% |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\par -% Same as \cs{DeclareCaptionOption} but issues an error if a value is given. +% \subsubsection{caption2 v2.x compatibility options} +% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added} +% \changes{v3.1}{2007/09/01}{caption2 v2.x compatibility options revised} +% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v2.x$ compatibility options} +% % \begin{macrocode} -\newcommand*\DeclareCaptionOptionNoValue{% - \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble} -\@onlypreamble\DeclareCaptionOptionNoValue +\DeclareCaptionOptionNoValue*{flushleft}{% + \caption@setformat{plain}% + \caption@setjustification{raggedright}} +\DeclareCaptionOptionNoValue*{flushright}{% + \caption@setformat{plain}% + \caption@setjustification{raggedleft}} % \end{macrocode} % \begin{macrocode} -\newcommand\caption@declareoption@novalue[3]{% - \caption@declareoption{#1}{#2}[\KV@err]{% - \caption@option@novalue{#2}{##1}{#3}}} -\@onlypreamble\caption@declareoption@novalue +\DeclareCaptionOptionNoValue*{oneline}{\caption@setbool{slc}{1}} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@option@novalue[2]{% - \ifx\KV@err#2% - \expandafter\@firstofone - \else - \KV@err{No value allowed for #1}% - \expandafter\@gobble - \fi} +\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{% + \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\ifcaptionsetup@star} -% \changes{v3.1g}{2008/01/12}{This macro added} -% If the starred form of |\captionsetup| is used, this will be set to |true|. -% (It will be reset to |false| at the end of |\caption@setkeys|.) -% \begin{macrocode} -\newif\ifcaptionsetup@star -% \end{macrocode} -% \end{macro} +% \subsubsection{Obsolete caption v3.0 options} +% \changes{v3.1}{2007/05/07}{Package option \opt{caption} marked as obsolete, +% gives error now} % -% \begin{macro}{\captionsetup} -% \changes{v3.0a}{2004/01/17}{Bugfix: Missing \% added} -% \changes{v3.1}{2007/07/22}{Starred-variant added} -% \changes{v3.1e}{2007/07/27}{Inside packages the starred variant will be used automatically} -% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added} -% \changes{v3.1g}{2008/01/12}{\cs{ifcaptionsetup@star} will be set now} -% |\captionsetup|\oarg{type}\marg{keyval-list of options}\\ -% |\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|. -% (The non-starred variant issues a warning if \meta{keyval-list of options} -% is not used later on.) -% \Note{The starred variant will be used inside packages automatically.} % \begin{macrocode} -\newcommand*\captionsetup{% - \caption@teststar@\@captionsetup\@gobble\@firstofone} +\DeclareCaptionOption*{caption}{% + \caption@setbool{temp}{#1}% + \caption@ifbool{temp}{}{% + \caption@Error{% + The package option `caption=#1' is obsolete.\MessageBreak + Please pass this option to the subfig package instead\MessageBreak + and do *not* load the caption package anymore}}} % \end{macrocode} +% +% \subsubsection{fltpage package support options} +% +% \changes{v3.1}{2007/09/01}{Options `FPlist' \& `FPref' added} +% With these options is controlled where the list-of entry and |\ref| resp. +% |\pageref| or |\autoref| will link to. +% Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent, +% but compatible to the usual behaviour of the \package{fltpage} package. % \begin{macrocode} -\newcommand*\@captionsetup[1]{% - \captionsetup@startrue#1\captionsetup@starfalse - \@ifnextchar[\caption@setup@options\caption@setup} +\DeclareCaptionOption{FPlist}[1]{\caption@setFPoption{list}{#1}} +\DeclareCaptionOption{FPref}[1]{\caption@setFPoption{ref}{#1}} +\@onlypreamble@key{caption}{FPlist} +\@onlypreamble@key{caption}{FPref} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@setup{\caption@setkeys{caption}} +\newcommand*\caption@setFPoption[2]{% + \edef\caption@tempa{\@car#2\@nil}% + \caption@setbool{FP#1cap}{\if c\caption@tempa 1\else 0\fi}} +\@onlypreamble\caption@setFPoption % \end{macrocode} % \begin{macrocode} -\def\caption@setup@options[#1]#2{% - \@bsphack - \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi - \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}% - \@esphack} +\captionsetup{FPlist=caption,FPref=figure} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\clearcaptionsetup} -% \changes{v3.1}{2007/07/29}{Optional argument added} -% \changes{v3.1}{2007/08/17}{Starred variant added} -% \changes{v3.1e}{2007/07/27}{Inside packages the starred variant will be used automatically} -% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added} -% |\clearcaptionsetup|\oarg{option}\marg{type}\\ -% |\clearcaptionsetup*|\oarg{option}\marg{type}\par -% This removes the saved option list associated with \meta{type}. -% If \meta{option} is given, only this option will be removed from the list. -% (The starred variant does not issue warnings.) -% \Note{The starred variant will be used inside packages automatically.} -% \begin{macrocode} -\newcommand*\clearcaptionsetup{% - \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone} -% \end{macrocode} +% \subsubsection{hyperref package support options} +% +% \changes{v3.1}{2007/06/21}{Options `hypcap' \& `hypcapspace' added} +% With |hypcap=off| one can turn the \package{hypcap} support off +% (default is |on|). % \begin{macrocode} -\newcommand*\@clearcaptionsetup[1]{% - \let\caption@tempa#1% - \@testopt\@@clearcaptionsetup{}} +\DeclareCaptionOption{hypcap}[1]{\caption@setbool{hypcap}{#1}} +\DeclareCaptionOption{hypcapspace}{\def\caption@hypcapspace{#1}} % \end{macrocode} % \begin{macrocode} -\def\@@clearcaptionsetup[#1]#2{% - \@bsphack - \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname - {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}% - {\ifx,#1,% - \caption@clearsetup{#2}% - \else - \caption@@removefromsetup{#1}{#2}% - \fi}% - \@esphack} +\captionsetup{hypcap=1,hypcapspace=.5\baselineskip} % \end{macrocode} +% +% \subsection{\AmS{} \& \SmF{} document classes support} +% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ document classes support added} +% % \begin{macrocode} -\newcommand*\caption@clearsetup[1]{% - \caption@removefromoptlist{#1}% - \@nameundef{caption@opt@#1}} +\caption@ifamsclass{% + \caption@InfoNoLine{AMS or SMF document class}% % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@removefromsetup{% - \let\caption@tempa\@gobble - \caption@@removefromsetup} + \setlength\belowcaptionskip{0pt}% set to 12pt by AMS class % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@@removefromsetup[2]{% - \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname - \expandafter\let\csname caption@opt@#2\endcsname\@undefined - \def\@tempb##1=##2\@nil{##1}% - \edef\@tempc{#1}% - \@for\@tempa:=\@tempa\do{% - \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}% - \ifx\@tempd\@tempc - \let\caption@tempa\@gobble - \else - \expandafter\expandafter\expandafter\caption@l@addto@list - \expandafter\csname caption@opt@#2\expandafter\endcsname - \expandafter{\@tempa}% - \fi}% - \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname - {\caption@removefromoptlist{#2}}{}% - \caption@tempa{\caption@Warning{% - Option `#1' was not in list `#2'\MessageBreak}}} +} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\showcaptionsetup} -% \changes{v3.0e}{2005/05/03}{Optimized for memory usage} -% \changes{v3.1}{2007/07/29}{Bugfix: Does not expand option list anymore} -% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added} -% |\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]{% - \@bsphack - \GenericWarning{}{% - #1 Caption Info: Option list on `#2'\MessageBreak - #1 Caption Data: \@ifundefined{caption@opt@#2}{% - -none-% - }{% - {\expandafter\expandafter\expandafter\strip@prefix - \expandafter\meaning\csname caption@opt@#2\endcsname}% - }}% - \@esphack} -% \end{macrocode} -% \end{macro} +% \subsection{\KOMAScript{} document classes support} +% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added} +% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added} +% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added} +% \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised} +% \changes{v3.1}{2007/03/17}{\KOMAScript\ compatibility options removed} +% \changes{v3.1}{2007/04/05}{\KOMAScript\ compatibility revised \& enhanced} % -% \changes{v3.1}{2007/07/02}{Option \opt{options=} added} % \begin{macrocode} -\DeclareCaptionOption{options}{\caption@setoptions{#1}} +\caption@ifkomaclass{% + \caption@InfoNoLine{KOMA-Script document class}% % \end{macrocode} % -% \begin{macro}{\caption@setoptions} -% \changes{v3.0i}{2006/01/03}{Optional argument added} -% \changes{v3.0j}{2006/01/26}{Revised} -% \changes{v3.0l}{2007/01/30}{Optional argument removed} -% \changes{v3.1}{2007/04/11}{Usage of \cs{clearcaptionsetup} added} -% \changes{v3.1}{2007/05/09}{Renamed from \cs{caption@settype} to \cs{caption@setoptions}} -% \changes{v3.1f}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed} -% |\caption@setoptions|\marg{type or environment or\ldots}\par -% Caption options which have been saved with |\captionsetup|\oarg{type} can -% be executed by using this command. -% It simply executes the saved option list (and clears it afterwards), -% if there is any. -% \begin{macrocode} -\newcommand*\caption@setoptions[1]{% - \caption@Debug{options=#1}% - \expandafter\let\expandafter\caption@opt\csname caption@opt@#1\endcsname - \ifx\caption@opt\relax \else - \caption@xsetup\caption@opt - \caption@clearsetup{#1}% - \fi} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}} -% \end{macrocode} -% \end{macro} +% Here we emulate the caption related commands and take over the caption +% related settings from the \KOMAScript\ classes. % -% \begin{macro}{\caption@addtooptlist} -% \changes{v3.1}{2007/07/22}{This macro added} -% \begin{macro}{\caption@removefromoptlist} -% \changes{v3.1}{2007/07/22}{This macro added} -% \changes{v3.1j}{2008/08/24}{Fatal typo corrected} -% |\caption@addtooptlist|\marg{type}\\ -% |\caption@removefromoptlist|\marg{type}\par -% Adds or removes an \meta{type} to the list of unused caption options. -% Note that the catcodes of \meta{type} are sanitized here so removing -% \meta{type} from the list do not fail when the \package{float} package -% is used (since |\float@getstyle| gives a result which tokens have catcode -% 12 $=$ ``other''). -% \begin{macrocode} -\newcommand*\caption@addtooptlist[1]{% - \@ifundefined{caption@opt@#1@lineno}{% - \caption@dooptlist\caption@g@addto@list{#1}% - \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}% - }{}} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@removefromoptlist[1]{% - \caption@dooptlist\caption@g@removefrom@list{#1}% - \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@dooptlist[2]{% - \begingroup - \edef\@tempa{#2}\@onelevel@sanitize\@tempa - \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}% - \endgroup} -% \end{macrocode} +% \begin{macro}{\@tablecaptionabovetrue} +% \begin{macro}{\@tablecaptionabovefalse} +% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}} % \begin{macrocode} -\AtEndDocument{% - \caption@for@list\caption@optlist{% - \caption@WarningNoLine{% - Unused \string\captionsetup[#1] - on input line \csname caption@opt@#1@lineno\endcsname}}} + \g@addto@macro\@tablecaptionabovetrue{\captionsetup*[table]{position=t}} + \g@addto@macro\@tablecaptionabovefalse{\captionsetup*[table]{position=b}} % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\caption@setkeys} -% \changes{v3.0i}{2006/01/03}{This macro added} -% \changes{v3.0l}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added} -% \changes{v3.0l}{2007/01/30}{Optional argument added} -% \changes{v3.0p}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter} -% \changes{v3.1b}{2007/09/18}{Usage of \cs{caption@Package} removed, we use \cs{caption@KV@err} instead} -% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added} -% \changes{v3.1g}{2008/01/12}{\cs{captionsetup@starfalse} added} -% \changes{v3.1k}{2009/09/30}{Bugfix 09-09-29: Missing error handler will be defined automatically} -% |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\par -% This one simply calls |\setkeys|\marg{family}\marg{key-values} -% but lets the error messages not refer to the \package{keyval} package, -% but to the \meta{package} package instead. -% \begin{macrocode} -\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys} -% \end{macrocode} % \begin{macrocode} -\long\def\caption@@setkeys[#1]#2#3{% - \@bsphack -% \end{macrocode} -% \begin{macrocode} - \expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err - \expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx - \expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname - \ifx\KV@err\relax - \def\KV@err##1{\PackageError{#1}{##1}{% - See the #1 package documentation for explanation.}}% + \if@tablecaptionabove + \@tablecaptionabovetrue + \else + \@tablecaptionabovefalse \fi - \let\KV@errx\KV@err - \edef\caption@keydepth{\caption@keydepth i}% -% \end{macrocode} -% \begin{macrocode} - \caption@Debug{\protect\setkeys{#2}{#3}}% - \setkeys{#2}{#3}% -% \end{macrocode} -% \begin{macrocode} - \edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}% - \expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname - \expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname -% \end{macrocode} -% \begin{macrocode} - \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi -% \end{macrocode} -% \begin{macrocode} - \@esphack} % \end{macrocode} -% \begin{macrocode} -\let\caption@keydepth\@empty -% \end{macrocode} -% \end{macro} % -% \begin{macro}{\caption@ExecuteOptions} -% \changes{v3.1}{2007/07/15}{This macro added} -% |\caption@ExecuteOptions|\marg{family}\marg{key-values}\par -% We execute our options using the keyval interface, so we use this one -% instead of |\ExecuteOptions| offered by \LaTeXe. +% \begin{macro}{\onelinecaptionstrue} +% \begin{macro}{\onelinecaptionsfalse} +% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}} % \begin{macrocode} -\newcommand*\caption@ExecuteOptions[2]{% - \@expandtwoargs\caption@setkeys{#1}{#2}}% -\@onlypreamble\caption@ExecuteOptions + \g@addto@macro\onelinecaptionstrue{\let\caption@ifslc\@firstoftwo} + \g@addto@macro\onelinecaptionsfalse{\let\caption@ifslc\@secondoftwo} % \end{macrocode} % \end{macro} -% -% \begin{macro}{\caption@ProcessOptions} -% \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} -% \changes{v3.0l}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to -% \cs{caption@ProcessOptions} and moved from the package to the kernel} -% \changes{v3.1}{2007/04/17}{Star variant added} -% |\caption@ProcessOptions*|\marg{family}\par -% We process our options using the keyval package, so we use this one -% instead of |\ProcessOptions| offered by \LaTeXe. -% The starred variant do not process the global options. -% (This code was taken from the \package{hyperref} package\cite{hyperref} -% \version{6.74} and improved.) -% \begin{macrocode} -\newcommand*\caption@ProcessOptions{% - \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone} -\@onlypreamble\caption@ProcessOptions -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@@ProcessOptions[2]{% - \let\@tempc\relax - \let\caption@tempa\@empty - #1{% \@firstofone -or- \@gobble - \@for\CurrentOption:=\@classoptionslist\do{% - \@ifundefined{KV@#2@\CurrentOption}{}{% - \@ifundefined{KV@#2@\CurrentOption @default}{% - \PackageInfo{#2}{Global option `\CurrentOption' ignored}% - }{% - \PackageInfo{#2}{Global option `\CurrentOption' processed}% - \edef\caption@tempa{\caption@tempa,\CurrentOption,}% - \@expandtwoargs\@removeelement\CurrentOption - \@unusedoptionlist\@unusedoptionlist - }% - }% - }% - \let\CurrentOption\@empty - }% - \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}% - \AtEndOfPackage{\let\@unprocessedoptions\relax}} -\@onlypreamble\caption@@ProcessOptions -% \end{macrocode} % \end{macro} % -% \subsection{Margin resp. width} -% \changes{v3.0p}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}} -% \changes{v3.0p}{2007/04/03}{Option `twoside' added} -% \changes{v3.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added} -% \changes{v3.1f}{2007/11/10}{Option `oneside' added} -% -% \begin{macro}{\captionmargin} -% \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 \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 |\captionmargin@|. % \begin{macrocode} -\newdimen\captionmargin -\newdimen\captionmargin@ -\newdimen\captionwidth + \ifonelinecaptions + \onelinecaptionstrue + \else + \onelinecaptionsfalse + \fi % \end{macrocode} -% \end{macro} -% \end{macro} % +% \begin{macro}{\@captionabovetrue} +% \begin{macro}{\@captionabovefalse} +% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21: +% \cs{let}\cs{caption@setposition}\cs{@gobble} added} +% \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed} +% \changes{v3.1}{2007/03/31}{We redefine \cs{captionabovetrue/false} now +% instead of \cs{captionabove/below}} +% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}} +% \changes{v3.1k}{2009/10/09}{\opt{figureposition} and \opt{tableposition} will issue a warning now} +% Please note that these are stronger than the \opt{position} setting, therefore we +% override the options \opt{figureposition} and \opt{tableposition} to typeout a warning. % \begin{macrocode} -\DeclareCaptionOption{margin}{\setcaptionmargin{#1}} -\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}} -\DeclareCaptionOption{width}{\setcaptionwidth{#1}} -\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}} -\DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0} + \g@addto@macro\@captionabovetrue{\let\caption@position\@firstoftwo} + \g@addto@macro\@captionabovefalse{\let\caption@position\@secondoftwo} % \end{macrocode} % \begin{macrocode} -\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}} -\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}} + \DeclareCaptionOption{figureposition}{% + \caption@WarningNoLine{Option `figureposition=#1' has no effect\MessageBreak + when used with a KOMA script document class}} + \DeclareCaptionOption{tableposition}{% + \caption@WarningNoLine{Option `tableposition=#1' has no effect\MessageBreak + when used with a KOMA script document class}} % \end{macrocode} +% \end{macro} +% \end{macro} % -% \begin{macro}{\setcaptionmargin} -% \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} -% \changes{v3.1}{2007/08/11}{Starred variant added} -% \changes{v3.1}{2007/08/12}{\cs{setlength}\cs{captionmargin} \& -% \cs{setlength}\cs{captionmargin@} swapped so -% `\texttt{margin*=}\cs{captionmargin}' works in singleline options} -% |\setcaptionmargin|\marg{amount}\\ -% |\setcaptionmargin*|\marg{amount}\par -% Please never use them in user documents, it's just there to -% provide compatibility to the \package{caption2} package. +% \begin{macro}{\setcapindent} % \begin{macrocode} -\newcommand*\setcaptionmargin{% - \caption@teststar\caption@setmargin\@gobble\@firstofone} + \let\caption@KOMA@setcapindent\@setcapindent + \renewcommand*\@setcapindent[1]{% + \caption@KOMA@setcapindent{#1}\caption@setcapindent} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@setmargin[2]{% - #1{\captionwidth\z@}% - \caption@@setmargin#2,#2,\@nil} + \let\caption@KOMA@@setcapindent\@@setcapindent + \renewcommand*\@@setcapindent[1]{% + \caption@KOMA@@setcapindent{#1}\caption@setcapindent} % \end{macrocode} % \begin{macrocode} -\def\caption@@setmargin#1,#2,#3\@nil{% - \setlength\captionmargin@{#2}% - \setlength\captionmargin{#1}% - \addtolength\captionmargin@{-\captionmargin}} + \newcommand*\caption@setcapindent{% + \captionsetup{indent=\ifdim\cap@indent<\z@\z@\else\cap@indent\fi}} % \end{macrocode} % \end{macro} % -% \begin{macro}{\setcaptionwidth} -% \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 the \package{caption2} package. % \begin{macrocode} -\newcommand*\setcaptionwidth{% - \captionmargin\z@ - \captionmargin@\z@ - \setlength\captionwidth} + \@ifundefined{cap@indent}{}{\caption@setcapindent} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\caption@counter} -% \changes{v3.0p}{2007/04/03}{This counter added} -% \changes{v3.1e}{2007/10/28}{Renamed to \cs{caption@thecounter}; \cs{caption@stepcounter} added} -% This counter numbers the captions. At the moment it will be used inside -% |\caption@ifoddpage| only. -% \begin{macrocode} -\newcommand*\caption@thecounter{0} -% \end{macrocode} +% \begin{macro}{\setcapwidth} +% \Note{The optional argument of \cs{setcapwidth} if not supported (yet), +% so we issue a warning if used. +% (Since this does not seem to have an negative effect when used +% by the \texttt{captionbeside} environment, we suppress the warning here.)} % \begin{macrocode} -\newcommand*\caption@stepcounter{% - \@tempcnta\caption@thecounter - \advance\@tempcnta\@ne - \xdef\caption@thecounter{\the\@tempcnta}} + \expandafter\let\expandafter\caption@KOMA@setcapwidth + \csname\string\setcapwidth\endcsname + \@namedef{\string\setcapwidth}[#1]#2{% + \caption@KOMA@setcapwidth[#1]{#2}\caption@setcapwidth{#1}} % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@newlabel} -% \changes{v3.0p}{2007/04/03}{This macro added} -% This command is a modified version of |\newlabel| from \LaTeX2e. -% It will be written to the \texttt{.aux} file to -% pass label information from one run to another. -% (We use it inside |\caption@ifoddpage| and |\caption@ragged|.) % \begin{macrocode} -\newcommand*\caption@newlabel{\@newl@bel{caption@r}} + \newcommand*\caption@setcapwidth[1]{% + \ifx\\#1\\\else + \@ifundefined{cap@margin}{}{% + \def\@tempa{captionbeside}% + \ifx\@tempa\@currenvir\else\caption@Warning{% + Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}% + \fi}% + \fi + \captionsetup{width=\cap@width}} % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@thepage} -% \changes{v3.0p}{2007/04/03}{This macro added} -% This command is a modified version of |\thepage| from \LaTeX2e. -% It will be used inside |\caption@ifoddpage| only. % \begin{macrocode} -\newcommand*\caption@thepage{\the\c@page} + \def\caption@tempa{\hsize}% + \ifx\caption@tempa\cap@width \else + \caption@setcapwidth{?} + \fi % \end{macrocode} -% \end{macro} % -% \begin{macro}{\caption@label} -% \changes{v3.1}{2007/09/01}{This macro added} -% \changes{v3.1f}{2007/12/03}{Definition of \cs{caption@newlabel} in AUX file added} -% This command is a modified version of |\label| from \LaTeX2e. -% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|. +% \begin{macro}{\setcapmargin} % \begin{macrocode} -\newcommand*\caption@label[1]{% - \caption@@label - \protected@write\@auxout{\let\caption@thepage\relax}% - {\string\caption@newlabel{#1}{\caption@thepage}}} + \expandafter\let\expandafter\caption@KOMA@setcapmargin + \csname\string\@setcapmargin\endcsname + \@namedef{\string\@setcapmargin}[#1]#2{% + \caption@KOMA@setcapmargin[#1]{#2}\caption@setcapmargin} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@@label{% - \global\let\caption@@label\relax - \protected@write\@auxout{}% - {\string\providecommand*\string\caption@newlabel[2]{}}} + \expandafter\let\expandafter\caption@KOMA@@setcapmargin + \csname\string\@@setcapmargin\endcsname + \@namedef{\string\@@setcapmargin}[#1]#2{% + \caption@KOMA@@setcapmargin[#1]{#2}\caption@setcapmargin} % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@pageref} -% \changes{v3.1}{2007/09/01}{This macro added} -% \changes{v3.1k}{2009/10/09}{Uses \cs{@latex@warning} instead of \cs{caption@Warning} now} -% This command is a modified version of |\pageref| from \LaTeX2e. -% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|. % \begin{macrocode} -\newcommand*\caption@pageref[1]{% - \expandafter\ifx\csname caption@r@#1\endcsname\relax - \G@refundefinedtrue % => 'There are undefined references.' - \@latex@warning{Reference `#1' on page \thepage \space undefined}% - \else - \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname - \fi} + \newcommand*\caption@setcapmargin{% + \begingroup + \let\onelinecaptionsfalse\relax + \def\@twoside{0}% + \def\if@twoside{\def\@twoside{1}\iffalse}% + \cap@margin + \def\@tempa{\endgroup}% + \ifx\cap@left\hfill\else\ifx\cap@right\hfill\else + \def\hspace##1##{\@firstofone}% + \edef\@tempa{\endgroup + \noexpand\captionsetup{% + twoside=\@twoside,slc=0,% + margin={\cap@left,\cap@right}}}% + \fi\fi + \@tempa} % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@ifoddpage} -% \changes{v3.0p}{2007/04/03}{This macro added} -% \changes{v3.1e}{2007/10/28}{Incrementation of counter moved to \cs{caption@@make}} -% At the moment this macro uses an own label\ldots ref mechanism, -% but an alternative implementation method would be using the -% \package{refcount} package\cite{refcount} and |\ifodd\getpagerefnumber{|\ldots|}|. -% \Note{This macro re-defines itself so the \texttt{.aux} file will -% only be used once per group.} -% \begin{macrocode} -\newcommand*\caption@ifoddpage{% - \caption@iftwoside{% - \caption@label\caption@thecounter - \caption@pageref\caption@thecounter - \ifodd\caption@thepage - \let\caption@ifoddpage\@firstoftwo - \else - \let\caption@ifoddpage\@secondoftwo - \fi - }{\let\caption@ifoddpage\@firstoftwo}% -% \end{macrocode} % \begin{macrocode} - \caption@ifoddpage} + \ifx\cap@margin\relax \else + \caption@setcapmargin + \fi % \end{macrocode} -% \end{macro} % -% \begin{macro}{\caption@setoptcmd} -% \changes{v3.1}{2007/08/11}{This macro added} -% |\caption@setoptcmd|\marg{cmd}\marg{off -or- value} % \begin{macrocode} -\newcommand*\caption@setoptcmd[2]{% - \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}} +} % \end{macrocode} -% \end{macro} % -% \subsection{Indentions} +% \subsection{Processing of options} % -% \begin{macro}{\caption@indent} -% \changes{v3.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}} -% \begin{macro}{\caption@parindent} -% \begin{macro}{\caption@hangindent} -% These are the indentions we support. -% \begin{macrocode} -\newdimen\caption@indent -\newdimen\caption@parindent -\newdimen\caption@hangindent -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} +% \changes{v3.0m}{2007/03/04}{Verbose option added} +% \changes{v3.1}{2007/07/02}{Verbose option removed from package} % -% \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} +% \changes{v3.1}{2007/03/17}{We do not process global options anymore} % \begin{macrocode} -\DeclareCaptionOption{indent}[\leftmargini]{% obsolete! - \setlength\caption@indent{#1}} -\DeclareCaptionOption{indention}[\leftmargini]{% - \setlength\caption@indent{#1}} -\DeclareCaptionOption{parindent}{% - \setlength\caption@parindent{#1}} -\DeclareCaptionOption{hangindent}{% - \setlength\caption@hangindent{#1}} -\DeclareCaptionOption{parskip}{% - \l@addto@macro\caption@@par{\setlength\parskip{#1}}} +\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}% +\caption@ProcessOptions*{caption} % \end{macrocode} % -% \changes{v3.0h}{2005/08/22}{Increased compatibility to KOMA-Script: -% A special version of options `parindent' and `parskip' added} -% \changes{v3.0i}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of -% `parskip' and `parindent' options revised and moved into caption kernel} -% \changes{v3.0j}{2006/02/23}{KOMA-Script variants of `parskip' and -% `parindent' are obsolete now, removed} -% \changes{v3.0o}{2007/03/30}{KOMA-Script variants of `parskip' and -% `parindent' re-added, since they still collide with the current -% version of the subfig package (Sigh!)} +% \subsection{\cs{caption}, \cs{@caption}, and \cs{@makecaption}} % -% There is an option clash between the \KOMAScript\ document classes -% and the \package{caption} kernel, both define the options |parindent| and -% |parskip| but with different meaning. -% Furthermore the ones defined by the \package{caption} kernel take a -% value as parameter but the \KOMAScript\ ones do not. -% So we need special versions of the options |parindent| and |parskip| here -% which determine if a value is given (and therefore should be treated as -% our option) or not (and therefore should be ignored by us).\footnote{%^^A -% This problem was completely solved due a change of \cs{caption@ProcessOptions} -% in \thispackage\ \version{3.0j}, but we still need this workaround since -% these options would otherwise still collide with the current version $1.3$ -% of the \package{subfig} package (Sigh!)} +% \begin{macro}{\caption@caption} +% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added} +% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed} +% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added} +% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore} +% Here comes our definition of |\caption| and |\caption*|. +% Beside the support of the starred variant this code was adapted to the +% various packages we support. +% We are using |\caption@dblarg| instead of |\@dblarg| so |\caption{}| +% (with an empty arg.) will produce a list-of entry, but |\caption[]{}| +% won't. % \begin{macrocode} -\providecommand*\caption@ifkomaclass{% - \@ifundefined{scr@caption}\@gobble\@firstofone} -\@onlypreamble\caption@ifkomaclass -% \end{macrocode} -% \begin{macrocode} -\caption@ifkomaclass{% -% \end{macrocode} -% \begin{macrocode} - \let\caption@KV@parindent\KV@caption@parindent - \DeclareCaptionOption{parindent}[]{% - \ifx,#1,% - \caption@Debug{Option `parindent' ignored}% - \else - \caption@KV@parindent{#1}% - \fi}% -% \end{macrocode} -% \begin{macrocode} - \let\caption@KV@parskip\KV@caption@parskip - \DeclareCaptionOption{parskip}[]{% - \ifx,#1,% - \caption@Debug{Option `parskip' ignored}% - \else - \caption@KV@parskip{#1}% - \fi}% -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsection{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]{% - \@testopt{\caption@declarestyle{#1}}{}} -\@onlypreamble\DeclareCaptionStyle -% \end{macrocode} -% \begin{macrocode} -\def\caption@declarestyle#1[#2]#3{% - \global\@namedef{caption@sls@#1}{#2}% - \global\@namedef{caption@sty@#1}{#3}} -\@onlypreamble\caption@declarestyle -% \end{macrocode} -% \end{macro} -% -% \changes{v3.1g}{2008/01/20}{Option \opt{style*=} added} -% \changes{v3.1i}{2008/05/06}{Option \opt{slc=} added} -% \begin{macrocode} -\DeclareCaptionOption{style}{\caption@setstyle{#1}} -\DeclareCaptionOption{style*}{\caption@setstyle*{#1}} -\DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}} -\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}} -% \end{macrocode} -% -% \begin{macro}{\caption@setstyle} -% \changes{v3.0f}{2005/06/01}{Starred variant added} -% \changes{v3.1}{2007/07/29}{Recursive style definitions should work now} -% \changes{v3.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} -% \changes{v3.1f}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed} -% |\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 base ones (this will be done using -% |\caption@resetstyle|) and executing the \meta{list-of-KV} options -% (this will be done using |\caption@setup|).\par -% The starred version will give no error message if the given style is not -% defined. -% \begin{macrocode} -\newcommand*\caption@setstyle{% - \caption@teststar\caption@@setstyle\@gobble\@firstofone} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@@setstyle[2]{% - \@ifundefined{caption@sty@#2}% - {#1{\caption@Error{Undefined style `#2'}}}% - {\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname - \ifx\caption@setstyle@flag\@undefined - \let\caption@setstyle@flag\relax - \caption@resetstyle - \caption@xsetup\caption@sty - \let\caption@setstyle@flag\@undefined - \else - \caption@xsetup\caption@sty - \fi - \expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname - \expandafter\caption@l@addto@list\expandafter\caption@opt@singleline - \expandafter{\caption@sls}}} +\def\caption@caption{% + \caption@iftype + {\caption@checkgrouplevel\@empty\caption + \caption@star + {\caption@refstepcounter\@captype}% + {\caption@dblarg{\@caption\@captype}}}% + {\caption@Error{\noexpand\caption outside float}}}% % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@resetstyle} -% \changes{v3.1}{2007/02/04}{% -% This macro renamed from \cs{caption@setdefault} to \cs{caption@resetstyle}} -% \changes{v3.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} -% \changes{v3.1f}{2007/11/17}{Usage of \texttt{size=} added} -% \changes{v3.1i}{2008/05/06}{Usage of \texttt{rule} added} -% This resets (nearly) all caption options to the base ones. -% \emph{Note that this does not touch the skips and the positioning!} +% \begin{macro}{\caption@star} +% \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}} +% A helper macro which processes the optional |*| after |\caption|. +% \Note{We set \cs{caption@startrue} globally so it works with the +% \package{sidecap} package, too.} % \begin{macrocode} -\newcommand*\caption@resetstyle{% - \caption@setup{% - format=plain,labelformat=default,labelsep=colon,textformat=simple,% - justification=justified,font=,size=,labelfont=,textfont=,% - margin=0pt,minmargin=0,maxmargin=0,% - indent=0pt,parindent=0pt,hangindent=0pt,% - slc,rule,strut}% - \caption@clearsetup{singleline}} +\newcommand*\caption@star[2]{% + \@ifstar{\global\caption@startrue#2[]}{#1#2}}% % \end{macrocode} % \end{macro} % -% \changes{v3.0d}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}} -% \changes{v3.1}{2007/02/04}{Caption style `default' renamed to `base', and a new `default' added} -% \changes{v3.1}{2007/03/31}{\opt{format=plain} added to caption style \opt{default}} -% \changes{v3.1c}{2007/10/14}{\opt{format=plain} removed from caption style \opt{default}} -% Currently there are two pre-defined styles, called `base' \& `default'. -% The first one is a perfect match to the behavior of |\@makecaption| offered -% by the standard \LaTeX\ document classes (and was called `default' in -% \thispackage\ \version{3.0}), the second one matches the document -% class actually used. -% \begin{macrocode} -\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{} -\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{% - format=default,labelsep=default,textformat=default,% - justification=default,font=default,labelfont=default,textfont=default} -% \end{macrocode} -% -% \subsection{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} -% \changes{v3.1c}{2007/10/15}{Optional argument 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{macro}{\caption@@caption} +% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore} +% \changes{v3.1f}{2007/11/28}{Bugfix: Handling of \texttt{@minipage} flag added} +% \changes{v3.1f}{2007/11/28}{Support of option \opt{@minipage} added} +% \changes{v3.1g}{2008/03/16}{Internal: Uses \cs{caption@prepareanchor} now} +% As above, our version has been adapted to the packages we support. +% Additionally our code is nested by |\caption@beginex| \& +% |\caption@end| instead of |\begingroup| \& |\endgroup|. +% Furthermore we use |\caption@boxrestore| instead of |\@parboxrestore| +% so this code also works correctly inside list-based environments +% like |wide| \& |addmargin|. (This, and the fact that we use +% |\linewidth| instead of |\hsize| inside |\@makecaption|, solves +% \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2472}%^^A +% {\LaTeX\ PR \texttt{latex/2472}}.) % \begin{macrocode} -\newcommand*\DeclareCaptionFormat{% - \caption@teststar\caption@declareformat\@gobble\@firstofone} -\@onlypreamble\DeclareCaptionFormat +\long\def\caption@@caption#1[#2]#3{% % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@declareformat[2]{% - \@dblarg{\caption@@declareformat#1{#2}}} -\@onlypreamble\caption@declareformat + \ifcaption@star \else + \caption@prepareanchor{#1}{#2}% + \fi % \end{macrocode} % \begin{macrocode} -\long\def\caption@@declareformat#1#2[#3]#4{% - \global\expandafter\let\csname caption@ifh@#2\endcsname#1% - \global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}% - \global\long\@namedef{caption@fmt@#2}##1##2##3{#4}} -\@onlypreamble\caption@@declareformat + \par + \caption@beginex{#1}{#2}{#3}% + \caption@setfloatcapt{% + \caption@boxrestore + \if@minipage + \@setminipage + \fi + \caption@normalsize + \ifcaption@star + \let\caption@makeanchor\@firstofone + \fi + \@makecaption{\csname fnum@#1\endcsname}% + {\ignorespaces\caption@makeanchor{#3}}\par + \caption@if@minipage\@minipagetrue\@minipagefalse}% + \caption@end}% % \end{macrocode} % \end{macro} % +% \begin{macro}{\caption@prepareanchor} +% \changes{v3.1g}{2008/03/16}{This macro added} % \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}% - {\caption@Error{Undefined format `#1'}}% - {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname - \expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname - \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}} +\newcommand*\caption@prepareanchor[2]{% + \caption@makecurrent{#1}{#2}% + \caption@ifhypcap\caption@@start{}} % \end{macrocode} % \end{macro} % -% \begin{macro}{\DeclareCaptionDefaultFormat} -% \changes{v3.1g}{2008/01/31}{This macro added} +% \begin{macro}{\caption@makecaption} +% \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added} +% |\@makecaption|\marg{label}\marg{text}\par +% We do basically the same as the original code (from the standard +% \LaTeX\ document classes), but take care of the |position=| setting +% and use |\caption@@make| from the \package{caption} kernel to finally +% typeset the caption. % \begin{macrocode} -\newcommand*\DeclareCaptionDefaultFormat[1]{% - \expandafter\def\expandafter\caption@fmt@default\expandafter - {\csname caption@fmt@#1\endcsname}% - \expandafter\def\expandafter\caption@slfmt@default\expandafter - {\csname caption@slfmt@#1\endcsname}% - \expandafter\def\expandafter\caption@ifh@default\expandafter - {\csname caption@ifh@#1\endcsname}} -\@onlypreamble\DeclareCaptionDefaultFormat +\long\def\caption@makecaption#1#2{% + \caption@iftop + {\vskip\belowcaptionskip}% + {\caption@rule\vskip\abovecaptionskip}% + \caption@@make{#1}{#2}% + \caption@iftop + {\vskip\abovecaptionskip\caption@rule}% + {\vskip\belowcaptionskip}} % \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} -% \changes{v3.1c}{2007/10/14}{% -% Single-line variant of caption format \opt{hang} added} -% There are two pre-defined formats, called `plain' and `hang'. -% \begin{macrocode} -\DeclareCaptionFormat{plain}{#1#2#3\par} -% \end{macrocode} -% \begin{macrocode} -\DeclareCaptionFormat{hang}[#1#2#3\par]{% - \caption@ifin@list\caption@lsepcrlist\caption@lsepname - {\caption@Error{% - The option `labelsep=\caption@lsepname' does not work\MessageBreak - with `format=hang'}}% - {\@hangfrom{#1#2}% - \advance\caption@parindent\hangindent - \advance\caption@hangindent\hangindent - \caption@@par#3\par}} -% \end{macrocode} -% -% \changes{v3.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{plain}} -% \changes{v3.0e}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added} -% `default' usually maps to `plain'. -% \begin{macrocode} -\DeclareCaptionDefaultFormat{plain} -% \end{macrocode} -% -% \subsection{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{macro}{\caption@redefine} +% \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now} +% We only redefine |\caption| and |\@caption| if the current definitions +% are well known, so documents written in the old (\package{caption} +% package \version{1.x}) days (where |\caption| \& |\@caption| were not +% redefined by us) will still compile fine. +% For example the usage of the \package{captcont} package, which brings +% it's own definition of |\caption*|, was quite common these days. % \begin{macrocode} -\newcommand*\DeclareCaptionLabelFormat[2]{% - \global\@namedef{caption@lfmt@#1}##1##2{#2}} -\@onlypreamble\DeclareCaptionLabelFormat +\newcommand*\caption@redefine{} +\g@addto@macro\caption@redefine{% % \end{macrocode} -% \end{macro} % % \begin{macrocode} -\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}} + \caption@setbool{incompatible}{0}% % \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}% - {\caption@Error{Undefined label format `#1'}}% - {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}} + \caption@CheckCommand\caption{% + % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)] + \def\caption{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\caption outside float}\@ehd + \expandafter\@gobble + \else + \refstepcounter\@captype + \expandafter\@firstofone + \fi + {\@dblarg{\@caption\@captype}}% + }}% % \end{macrocode} -% \end{macro} % -% \changes{v3.1f}{2007/12/16}{Caption label format \opt{brace} added} -% There are four pre-defined label formats, called `empty', `simple', -% `parens', and `brace'. % \begin{macrocode} -\DeclareCaptionLabelFormat{empty}{} -\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2} -\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)} -\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)} + \caption@CheckCommand\caption{% + % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau + \def\caption{ + \ifx\@captype\@undefined + \@latex@error{\noexpand\caption outside figure or table}\@ehd + \expandafter\@gobble + \else + \refstepcounter\@captype + \expandafter\@firstofone + \fi + {\@dblarg{\@caption\@captype}}% + }}% % \end{macrocode} % -% `default' usually maps to `simple'. % \begin{macrocode} -\def\caption@lfmt@default{\caption@lfmt@simple} + \caption@CheckCommand\caption{% + % float.sty [2001/11/08 v1.3d Float enhancements (AL)] + \renewcommand\caption{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\caption outside float}\@ehd + \expandafter\@gobble + \else + \refstepcounter\@captype + \let\@tempf\@caption + \expandafter\ifx\csname @float@c@\@captype\endcsname\relax\else + \expandafter\expandafter\let + \expandafter\@tempf\csname @float@c@\@captype\endcsname + \fi + \fi + \@dblarg{\@tempf\@captype}}}% % \end{macrocode} % -% \subsection{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} -% \changes{v3.1}{2007/07/13}{Test for CR 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{% - \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone} -\@onlypreamble\DeclareCaptionLabelSeparator -% \end{macrocode} -% \begin{macrocode} -\newcommand\caption@declarelabelseparator[3]{% - \global\expandafter\let\csname caption@iflf@#2\endcsname#1% - \global\long\@namedef{caption@lsep@#2}{#3}% - \caption@@declarelabelseparator{#2}#3\\\@nil} -\@onlypreamble\caption@declarelabelseparator + \caption@CheckCommand\caption{% + % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX] + % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX] + % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX] + \def\caption{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\caption outside float}\@ehd + \expandafter\@gobble + \else + \H@refstepcounter\@captype + \@ifundefined{fst@\@captype}{% + \let\Hy@tempa\@caption + }{% + \let\Hy@tempa\Hy@float@caption + }% + \expandafter\@firstofone + \fi + {\@dblarg{\Hy@tempa\@captype}}% + }}% % \end{macrocode} % \begin{macrocode} -\long\def\caption@@declarelabelseparator#1#2\\#3\@nil{% - \def\@tempa{#3}\ifx\@tempa\@empty \else - \caption@g@addto@list\caption@lsepcrlist{#1}% - \fi} -\@onlypreamble\caption@@declarelabelseparator + \caption@CheckCommand\caption{% + % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX] + \def\caption{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\caption outside float}\@ehd + \expandafter\@gobble + \else + \H@refstepcounter\@captype + \let\Hy@tempa\@caption + \@ifundefined{float@caption}{% + }{% + \expandafter\ifx\csname @float@c@\@captype\endcsname\float@caption + \let\Hy@tempa\Hy@float@caption + \fi + }% + \expandafter\@firstofone + \fi + {\@dblarg{\Hy@tempa\@captype}}% + }}% % \end{macrocode} -% \end{macro} % % \begin{macrocode} -\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}} -\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}} + \caption@IfCheckCommand{}{% + \caption@InfoNoLine{% + Incompatible package detected (regarding \string\caption).\MessageBreak + \string\caption\space=\space\meaning\caption}% + \caption@setbool{incompatible}{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}% - {\caption@Error{Undefined label separator `#1'}}% - {\edef\caption@lsepname{#1}% - \expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname - \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}} + \caption@CheckCommand\@caption{% + % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)] + \long\def\@caption#1[#2]#3{% + \par + \addcontentsline{\csname ext@#1\endcsname}{#1}% + {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par + \endgroup}}% % \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} + \caption@CheckCommand\@caption{% + % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau + \long\def\@caption#1[#2]#3{% second argument ignored + \par\nobreak + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \beamer@makecaption{#1}{\ignorespaces #3}\par\nobreak + \endgroup}}% % \end{macrocode} % -% \begin{macro}{\caption@setdefaultlabelsep} -% \changes{v3.1k}{2009/03/29}{This macro added} -% \begin{macrocode} -\newcommand*\caption@setdefaultlabelsep[1]{% - \ifx\caption@lsep\caption@lsep@default - \caption@set@default@labelsep{#1}% - \caption@setlabelseparator{default}% - \else - \caption@set@default@labelsep{#1}% - \fi} -% \end{macrocode} % \begin{macrocode} -\newcommand*\caption@set@default@labelsep[1]{% - \def\caption@lsep@default{\@nameuse{caption@lsep@#1}}% - \def\caption@iflf@default{\@nameuse{caption@iflf@#1}}} + \caption@CheckCommand\@caption{% + % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system] + \long\def\@caption#1[#2]#3{% + \csname par\endcsname + \addcontentsline{\csname ext@#1\endcsname}{#1}% + {\protect\numberline{\csname the#1\endcsname.}{\ignorespaces #2}}% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \@makecaption{\csname fnum@#1\endcsname}% + {\ignorespaces #3}\csname par\endcsname + \endgroup}}% % \end{macrocode} -% \end{macro} % -% `default' usually maps to `colon'. % \begin{macrocode} -\caption@set@default@labelsep{colon} +% \caption@CheckCommand\float@caption{% +% % float.sty [2001/11/08 v1.3d Float enhancements (AL)] +% \long\def\float@caption#1[#2]#3{% +% \addcontentsline{\@nameuse{ext@#1}}{#1}% +% {\protect\numberline{\@nameuse{the#1}}{\ignorespaces #2}} +% \global\setbox\@floatcapt\vbox\bgroup\@parboxrestore +% \normalsize\@fs@capt{\@nameuse{fnum@#1}}{\ignorespaces #3}% +% \@ifnextchar[{\float@ccon}{\egroup}}% +% \long\def\float@ccon[#1]{#1\par\egroup}}% % \end{macrocode} % -% \subsection{Text formats} -% -% \begin{macro}{\DeclareCaptionTextFormat} -% \changes{v3.0l}{2007/02/18}{This macro added} -% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1} % \begin{macrocode} -\newcommand*\DeclareCaptionTextFormat[2]{% - \global\long\@namedef{caption@tfmt@#1}##1{#2}} -\@onlypreamble\DeclareCaptionTextFormat -% \end{macrocode} -% \end{macro} -% -% \changes{v3.0d}{2005/02/12}{Option \opt{strut=} added} -% \begin{macrocode} -\DeclareCaptionOption{textformat}{\caption@settextformat{#1}} -\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}} + \caption@CheckCommand\@caption{% + % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX] + \long\def\@caption#1[#2]#3{% + \hyper@makecurrent{\@captype}% + \def\@currentlabelname{#2}% + \par\addcontentsline{\csname ext@#1\endcsname}{#1}{% + \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}% + }% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \@makecaption{\csname fnum@#1\endcsname}{% + \ignorespaces + \ifHy@nesting + \hyper@@anchor{\@currentHref}{#3}% + \else + \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3% + \fi + }% + \par + \endgroup + }}% % \end{macrocode} -% -% \begin{macro}{\caption@settextformat} -% \changes{v3.0l}{2007/02/18}{This macro added} -% |\caption@settextformat|\marg{name}\par -% Selecting a caption text format simply means saving the code (in |\caption@tfmt|). % \begin{macrocode} -\newcommand*\caption@settextformat[1]{% - \@ifundefined{caption@tfmt@#1}% - {\caption@Error{Undefined text format `#1'}}% - {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}} + \caption@CheckCommand\@caption{% + % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX] + % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX] + % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX] + \long\def\@caption#1[#2]#3{% + \expandafter\ifx\csname if@capstart\expandafter\endcsname + \csname iftrue\endcsname + \global\let\@currentHref\hc@currentHref + \else + \hyper@makecurrent{\@captype}% + \fi + \def\@currentlabelname{#2}% + \par\addcontentsline{\csname ext@#1\endcsname}{#1}{% + \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}% + }% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \expandafter\ifx\csname if@capstart\expandafter\endcsname + \csname iftrue\endcsname + \global\@capstartfalse + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}% + \else + \@makecaption{\csname fnum@#1\endcsname}{% + \ignorespaces + \ifHy@nesting + \hyper@@anchor{\@currentHref}{#3}% + \else + \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3% + \fi + }% + \fi + \par + \endgroup + }}% % \end{macrocode} -% \end{macro} -% -% There are two pre-defined text formats, called `simple' and `period'. % \begin{macrocode} -\DeclareCaptionTextFormat{simple}{#1} -\DeclareCaptionTextFormat{period}{#1.} + \caption@CheckCommand\@caption{% + % hyperref.sty [2009/11/27 v6.79k Hypertext links for LaTeX] + \long\def\@caption#1[#2]#3{% + \expandafter\ifx\csname if@capstart\expandafter\endcsname + \csname iftrue\endcsname + \global\let\@currentHref\hc@currentHref + \else + \hyper@makecurrent{\@captype}% + \fi + \def\@currentlabelname{#2}% + \par\addcontentsline{\csname ext@#1\endcsname}{#1}{% + \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}% + }% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \expandafter\ifx\csname if@capstart\expandafter\endcsname + \csname iftrue\endcsname + \global\@capstartfalse + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}% + \else + \@makecaption{\csname fnum@#1\endcsname}{% + \ignorespaces + \ifHy@nesting + \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}% + \else + \Hy@raisedlink{% + \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}% + }% + #3% + \fi + }% + \fi + \par + \endgroup + }}% % \end{macrocode} -% -% `default' usually maps to `simple'. % \begin{macrocode} -\def\caption@tfmt@default{\caption@tfmt@simple} + \caption@CheckCommand\@caption{% + % hyperref.sty [2009/12/09 v6.79m Hypertext links for LaTeX] + % hyperref.sty [2009/12/28 v6.79z Hypertext links for LaTeX] + \long\def\@caption#1[#2]#3{% + \expandafter\ifx\csname if@capstart\expandafter\endcsname + \csname iftrue\endcsname + \global\let\@currentHref\hc@currentHref + \else + \hyper@makecurrent{\@captype}% + \fi + \@ifundefined{NR@gettitle}{% + \def\@currentlabelname{#2}% + }{% + \NR@gettitle{#2}% + }% + \par\addcontentsline{\csname ext@#1\endcsname}{#1}{% + \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}% + }% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \expandafter\ifx\csname if@capstart\expandafter\endcsname + \csname iftrue\endcsname + \global\@capstartfalse + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}% + \else + \@makecaption{\csname fnum@#1\endcsname}{% + \ignorespaces + \ifHy@nesting + \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}% + \else + \Hy@raisedlink{% + \expandafter\hyper@@anchor\expandafter{% + \@currentHref + }{\relax}% + }% + #3% + \fi + }% + \fi + \par + \endgroup + }}% % \end{macrocode} % -% \subsection{Fonts} -% -% \begin{macro}{\DeclareCaptionFont} -% \changes{v3.0a}{2004/01/22}{% -% Bugfix: Multi token arguments are allowed now} -% \changes{v3.1}{2007/05/07}{% -% Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now} -% |\DeclareCaptionFont|\marg{name}\marg{code} % \begin{macrocode} -\newcommand*\DeclareCaptionFont[2]{% - \define@key{caption@fnt}{#1}[]{\l@addto@macro\caption@fnt{#2}}} -\@onlypreamble\DeclareCaptionFont + \caption@CheckCommand\@caption{% + % nameref.sty [2006/12/27 v2.28 Cross-referencing by name of section] + \long\def\@caption#1[#2]{% + \def\@currentlabelname{#2}% + \NR@@caption{#1}[{#2}]% + }}% % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\DeclareCaptionDefaultFont} -% \changes{v3.1}{2006/05/14}{This macro added} -% \changes{v3.1g}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionFont} to \cs{DeclareCaptionDefaultFont}} -% |\DeclareCaptionDefaultFont|\marg{name}\marg{code} % \begin{macrocode} -\newcommand*\DeclareCaptionDefaultFont[2]{% - \global\@namedef{caption#1@default}{#2}} -\@onlypreamble\DeclareCaptionDefaultFont + \caption@CheckCommand\@caption{% + % nameref.sty [2009/11/27 v2.32 Cross-referencing by name of section] + \long\def\@caption#1[#2]{% + \NR@gettitle{#2}% + \NR@@caption{#1}[{#2}]% + }}% % \end{macrocode} -% \end{macro} % % \begin{macrocode} -\DeclareCaptionOption{font}{\caption@setfont{font}{#1}} -\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}} -\DeclareCaptionDefaultFont{font}{} + \caption@CheckCommand\@caption{% + % subfigure.sty [2002/07/30 v2.1.4 subfigure package] + \long\def\@caption#1[#2]#3{% + \@ifundefined{if#1topcap}% + {\subfig@oldcaption{#1}[{#2}]{#3}}% + {\@nameuse{if#1topcap}% + \@listsubcaptions{#1}% + \subfig@oldcaption{#1}[{#2}]{#3}% + \else + \subfig@oldcaption{#1}[{#2}]{#3}% + \@listsubcaptions{#1}% + \fi}}}% % \end{macrocode} +% % \begin{macrocode} -\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}} -\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}} -\DeclareCaptionDefaultFont{labelfont}{} + \caption@CheckCommand\@caption{% + % subfig.sty [2005/06/28 ver: 1.3 subfig package] + \def\@caption{\caption@}% +% \long\def\caption@#1[#2]#3{% +% \@ifundefined{caption@setfloattype}% +% \caption@settype +% \caption@setfloattype +% \@captype +% \sf@ifpositiontop{% +% \@listsubcaptions{#1}% +% \sf@old@caption{#1}[{#2}]{#3}% +% }{% +% \sf@old@caption{#1}[{#2}]{#3}% +% \@listsubcaptions{#1}% +% }}% + }% % \end{macrocode} +% % \begin{macrocode} -\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}} -\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}} -\DeclareCaptionDefaultFont{textfont}{} + \caption@IfCheckCommand{}{% + \caption@InfoNoLine{% + Incompatible package detected (regarding \string\@caption).\MessageBreak + \string\@caption\space=\space\meaning\@caption}% + \caption@setbool{incompatible}{1}}% % \end{macrocode} % -% \begin{macro}{\caption@setfont} -% \changes{v3.0l}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument} -% \changes{v3.1}{2006/05/14}{Support of \cs{DeclareDefaultCaptionFont} added} -% |\caption@setfont|\marg{name}\marg{keyval-list of names}\par -% Selecting a caption font means saving all the code snippets -% in |\caption|\meta{name}. +% The option |compatibility=| will override the compatibility mode. % \begin{macrocode} -\newcommand*\caption@setfont[1]{% - \expandafter\let\csname caption#1\endcsname\@empty - \caption@addtofont{#1}} + \@ifundefined{caption@ifcompatibility}% + {\let\caption@ifcompatibility\caption@ifincompatible + \let\caption@tempa\caption@WarningNoLine}% + {\let\caption@tempa\@gobble}% suppress warning % \end{macrocode} -% \end{macro} % -% \begin{macro}{\caption@addtofont} -% \changes{v3.1f}{2007/11/17}{This macro added} -% |\caption@addtofont|\marg{name}\marg{keyval-list of names}\par -% Like |\caption@setfont|, but adds the code snippets to |\caption|\meta{name}.\par -% Because we use |\setkeys| recursive here we need to do this inside an -% extra group. % \begin{macrocode} -\newcommand*\caption@addtofont[2]{% - \begingroup - \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname - \define@key{caption@fnt}{default}[]{% - \l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}% - \caption@setkeys[caption]{caption@fnt}{#2}% - \global\let\caption@tempa\caption@fnt - \endgroup - \expandafter\let\csname caption#1\endcsname\caption@tempa} + \caption@ifcompatibility{% % \end{macrocode} -% \end{macro} % -% \begin{macro}{\caption@font} -% \changes{v3.1}{2007/05/07}{This macro added} -% |\caption@font|\marg{keyval-list of names}\\ -% |\caption@font*|\marg{keyval-code}\par -% Sets the given font, e.g.~|\caption@font{small,it}| -% is equivalent to |\small\itshape|. % \begin{macrocode} -\newcommand*\caption@font{% - \caption@teststar\caption@@font\@firstofone - {\caption@setkeys[caption]{caption@fnt}}} -\newcommand*\caption@@font[2]{% - \begingroup - \def\caption@fnt{\endgroup}% - #1{#2}% - \caption@fnt} + \caption@tempa{% + \noexpand\caption will not be redefined since it's already\MessageBreak + redefined by a document class or package which is\MessageBreak + unknown to the caption package}% % \end{macrocode} -% \end{macro} -% -% These are the pre-defined font code snippets. % -% \changes{v3.1}{2007/05/07}{Color font support added (kernel)} % \begin{macrocode} -\DeclareCaptionFont{normalcolor}{\normalcolor} -\DeclareCaptionFont{color}{\color{#1}} + \renewcommand*\caption@redefine{}% % \end{macrocode} % +% |\ContinuedFloat| is not supported in compatibility mode. % \begin{macrocode} -\DeclareCaptionFont{normalfont}{\normalfont} -\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} + \renewcommand*\caption@ContinuedFloat[1]{% + \caption@Error{Not available in compatibility mode}}% % \end{macrocode} % +% |\caption@start| is not supported in compatibility mode. % \begin{macrocode} -\DeclareCaptionFont{scriptsize}{\scriptsize} -\DeclareCaptionFont{footnotesize}{\footnotesize} -\DeclareCaptionFont{small}{\small} -\DeclareCaptionFont{normalsize}{\normalsize} -\DeclareCaptionFont{large}{\large} -\DeclareCaptionFont{Large}{\Large} + \caption@AtBeginDocument*{% + \let\caption@start\relax + \@ifundefined{caption@ORI@capstart}{}{% + \caption@Debug{% + Restore hypcap definition of \string\capstart\@gobble}% + \let\capstart\caption@ORI@capstart}% + \@ifundefined{caption@ORI@float@makebox}{}{% + \caption@Debug{% + Restore hyperref redefinition of \string\float@makebox\@gobble}% + \let\float@makebox\caption@ORI@float@makebox}% + }% % \end{macrocode} % -% \changes{v3.0p}{2007/04/02}{\package{setspace} package support added (kernel)} -% \changes{v3.1k}{2009/10/09}{Bugfix 09-05-18: \package{setspace} package support revised (kernel)} +% \begin{macro}{\caption@star} +% We redefine |\caption@star| here so it does not make any harm. % \begin{macrocode} -\DeclareCaptionFont{singlespacing}{% - \@ifundefined{setspace@singlespace}{}{% - \setstretch\setspace@singlespace}}% normally 1 -\DeclareCaptionFont{onehalfspacing}{\onehalfspacing} -\DeclareCaptionFont{doublespacing}{\doublespacing} -\DeclareCaptionFont{stretch}{\setstretch{#1}} + \renewcommand*\caption@star[2]{#1#2}% % \end{macrocode} +% \end{macro} % % \begin{macrocode} -%\DeclareCaptionFont{normal}{% -% \caption@font{normalcolor,normalfont,normalsize,singlespacing} -\DeclareCaptionFont{normal}{% - \caption@font*{% - \KV@caption@fnt@normalcolor\@unused - \KV@caption@fnt@normalfont\@unused - \KV@caption@fnt@normalsize\@unused - \KV@caption@fnt@singlespacing\@unused}} + }{% % \end{macrocode} % -% \changes{v3.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}} -% The old versions \version{1.x} of \thispackage\ offered this -% command to setup the font size used for captions. We still do -% so old documents will work fine. % \begin{macrocode} -\DeclareCaptionOption{size}{\caption@setfont{size}{#1}} -\DeclareCaptionDefaultFont{size}{} + \caption@ifincompatible{% + \caption@WarningNoLine{% + Forced redefinition of \noexpand\caption since the\MessageBreak + unsupported(!) package option `compatibility=false'\MessageBreak + was given}% + }{}% % \end{macrocode} % -% \subsection{Justifications} -% -% \begin{macro}{\DeclareCaptionJustification} -% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces -% between arguments do make any harm} -% \changes{v3.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}} -% |\DeclareCaptionJustification|\marg{name}\marg{code} +% \begin{macro}{\caption} +% \begin{macro}{\@caption} % \begin{macrocode} -\newcommand*\DeclareCaptionJustification[2]{% - \global\@namedef{caption@hj@#1}{#2}% for compatibility to v3.0 - \DeclareCaptionFont{#1}{#2}} -\@onlypreamble\DeclareCaptionJustification + \renewcommand*\caption@redefine{% + \let\caption\caption@caption + \let\@caption\caption@@caption}% + \caption@redefine % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}{\DeclareCaptionDefaultJustification} -% \changes{v3.1}{2007/07/03}{This macro added} -% \changes{v3.1g}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionJustification} to \cs{DeclareCaptionDefaultJustification}} -% |\DeclareCaptionDefaultJustification|\marg{code} % \begin{macrocode} -\newcommand*\DeclareCaptionDefaultJustification[1]{% - \global\@namedef{caption@hj@default}{#1}% for compatibility to v3.0 - \DeclareCaptionDefaultFont{@hj}{#1}} -\@onlypreamble\DeclareCaptionDefaultJustification + }% % \end{macrocode} -% \end{macro} -% % \begin{macrocode} -\DeclareCaptionOption{justification}{\caption@setjustification{#1}} -\DeclareCaptionDefaultJustification{} + \caption@AtBeginDocument*{% + \let\caption@ORI@capstart\@undefined + \let\caption@ORI@float@makebox\@undefined}% % \end{macrocode} % -% \begin{macro}{\caption@setjustification} -% \changes{v3.1}{2007/07/03}{Mapped to \cs{caption@setfont}} -% |\caption@setjustification|\marg{name}\par -% Selecting a caption justification simply means saving the code (in |\caption@hj|). +% \begin{macro}{\@xfloat} +% \changes{v3.1}{2007/05/09}{This re-definition added} +% \changes{v3.1b}{2007/09/22}{Will now be redefined in compatibility mode, too} +% We redefine |\@xfloat| so inside floating environments our +% type-specific options will be used, a \package{hyperref} +% anchor will be set etc. % \begin{macrocode} -\newcommand*\caption@setjustification{\caption@setfont{@hj}} + \let\caption@ORI@xfloat\@xfloat + \def\@xfloat#1[#2]{% + \caption@ORI@xfloat{#1}[#2]% + \caption@settype{#1}}% % \end{macrocode} % \end{macro} % -% These are the pre-defined justification code snippets. % \begin{macrocode} -\DeclareCaptionJustification{justified}{} -\DeclareCaptionJustification{centering}{\centering} -\DeclareCaptionJustification{centerfirst}{\centerfirst} -\DeclareCaptionJustification{centerlast}{\centerlast} -\DeclareCaptionJustification{raggedleft}{\raggedleft} -\DeclareCaptionJustification{raggedright}{\raggedright} +} % \end{macrocode} +% \end{macro} % -% \begin{macro}{\centerfirst} -% \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)} -% \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}} -% Please blame Frank Mittelbach for the code of |\centerfirst| |:-)| +% Some packages (like the \package{hyperref} package for example) redefines +% |\caption| and |\@caption|, too. +% So we have to use |\AtBeginDocument| here, so we can make sure +% our definition is the one which will be valid at last. % \begin{macrocode} -\providecommand\centerfirst{% - \let\\\@centercr - \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}} +\caption@AtBeginDocument{\caption@redefine} % \end{macrocode} -% \end{macro} % -% \begin{macro}{\centerlast} -% \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)} -% \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}} -% This is based on code from Anne Br\"uggemann-Klein\cite{Anne} +% \begin{macro}{\@makecaption} % \begin{macrocode} -\providecommand\centerlast{% - \let\\\@centercr - \leftskip\z@\@plus 1fil% - \rightskip\z@\@plus -1fil% - \parfillskip\z@\@plus 2fil\relax} +\let\@makecaption\caption@makecaption % \end{macrocode} % \end{macro} % -% \subsubsection{The ragged2e package} -% \changes{v3.0b}{2004/05/16}{Improved \package{ragged2e} package support} +% \subsection{\cs{captionof} and \cs{captionlistentry}} +% +% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added} +% \changes{v3.1}{2007/06/25}{Option \opt{type*=} added} +% \changes{v3.1f}{2007/11/16}{Option \opt{subtype} \& \opt{subtype*} added} +% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Option \opt{type=} uses \cs{setcaptiontype} instead of \cs{caption@settype} now} % -% 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} +\caption@AtBeginDocument{% % \end{macrocode} -% -% \begin{macro}{\caption@ragged} -% \changes{v3.0p}{2007/04/07}{The `ragged2e' package will now only been -% loaded when needed} -% \changes{v3.0q}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced -% by \cs{caption@Debug}} -% \changes{v3.1}{2007/04/16}{A different warning will be given on first \LaTeX\ run} -% |\caption@ragged| will be basically defined as -% \begin{quote} -% |\AtBeginDocument{\IfFileExists{ragged2e.sty}%|\\ -% | {\RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}%|\\ -% | {\let\caption@ragged\@secondoftwo}}| -% \end{quote} -% but with an additional warning if the ragged2e package is not loaded (yet). -% (This warning will be type out only one time per option, that's why -% we need the |caption\string#1| stuff.) -% Furthermore we load the \package{ragged2e} package, if needed and available. % \begin{macrocode} -\newcommand*\caption@ragged{% - \caption@Debug{We need ragged2e}% - \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}% - \global\let\caption@ragged\caption@@ragged - \caption@ragged} + \DeclareCaptionOption{type}{\setcaptiontype{#1}}% + \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}% % \end{macrocode} % \begin{macrocode} -\caption@AtBeginDocument{% - \@ifundefined{caption@r@ragged2e}{% - \newcommand*\caption@@ragged{% - \caption@Warning{% - `ragged2e' support has been changed.\MessageBreak - Rerun to get captions right}% - \global\let\caption@ragged\@secondoftwo % suppress further warnings - \caption@ragged}% - }{% - \caption@Debug{We load ragged2e}% - \IfFileExists{ragged2e.sty}{% - \RequirePackage{ragged2e}% - \let\caption@@ragged\@firstoftwo - }{% - \newcommand*\caption@@ragged[2]{% - \@ifundefined{caption\string#1}{% - \caption@Warning{% - `ragged2e' package not loaded, therefore\MessageBreak - substituting \string#2 for \string#1\MessageBreak}% - \global\@namedef{caption\string#1}}{}% - #2}% - }% - }} + \DeclareCaptionOption{subtype}[sub\@captype]{\caption@setsubtype{#1}}% + \DeclareCaptionOption{subtype*}[sub\@captype]{\caption@setsubtype*{#1}}% % \end{macrocode} % \begin{macrocode} +} % \end{macrocode} -% \end{macro} % -% \subsection{Vertical spaces before and after captions} +% \emph{Important Note:} +% Like |\captionof| the option |type=| should only be used inside a +% group, box, or environment and does not check if the argument is a valid +% floating environment or not. % -% \begin{macro}{\abovecaptionskip} -% \begin{macro}{\belowcaptionskip} -% Usually these skips are defined within the document class, but some -% document classes don't do so. +% \begin{macro}{\setcaptiontype} +% \changes{v3.2}{2010/10/24}{This macro added} +% Like |\captionsetup{type=xxx}|, but also works if \cs{captionsetup} was redefined. % \begin{macrocode} -\@ifundefined{abovecaptionskip}{% - \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{} -\@ifundefined{belowcaptionskip}{% - \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{} +\newcommand\setcaptiontype{% + \caption@boxrestore@mini + \caption@settype} % \end{macrocode} % \end{macro} -% \end{macro} % -% \changes{v3.0d}{2005/02/12}{Option \opt{skip=} added} +% \begin{macro}{\caption@settype} +% \changes{v3.1}{2007/05/09}{This macro added} +% \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added} +% \changes{v3.1d}{2007/10/23}{Error message for \cs{caption@checkgrouplevel} revised} +% \changes{v3.1f}{2007/11/16}{\cs{caption@setsubtype} added} +% \changes{v3.1f}{2007/12/03}{Crappy \cs{caption@iftypewarning} replaced} +% \changes{v3.1g}{2008/01/12}{Usage of \cs{ifcaptionsetup@star} added} +% \changes{v3.2}{2010/10/26}{Error message moved from here to \cs{caption@refstepcounter}} +% |\caption@settype*|\marg{type}\par +% sets |\@captype| and executes the options associated with it +% (using |\caption@setoptions|). +% Furthermore we check |\currentgrouplevel| (if avail), +% redefine |\@currentlabel| so a |\label| before |\caption| will result +% in a hint instead of a wrong reference, and +% use the macro |\caption@|(|sub|)|typehook| (which will be used by our +% \package{float} package support).\par +% The non-starred version sets a \package{hyperref} anchor additionally +% (if |hypcap=true| and the \package{hypcap} package is not loaded). % \begin{macrocode} -\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}} -\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}} -\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}} +\newcommand*\caption@settype{% + \caption@@settype{}} % \end{macrocode} -% -% \begin{macro}{\caption@rule} -% \changes{v3.1i}{2008/05/06}{This macro added} -% |\caption@rule|\par -% Draws an invisible rule to adjust the ``skip'' setting. % \begin{macrocode} -\newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax} +\newcommand*\caption@setsubtype{% + \caption@iftype + {\caption@@settype{sub}}% + {\caption@Error{Option `subtype=' outside float}}}% % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@hrule{\hrule\@height\z@} +\newcommand*\caption@@settype[1]{% + \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo} % \end{macrocode} -% \end{macro} -% -% \changes{v3.1i}{2008/05/06}{Option \opt{rule=} added} % \begin{macrocode} -\DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}} +\newcommand*\caption@@@settype[3]{% +% #1 = "" or "sub" +% #2 = \@firstoftwo in star form, \@secondoftwo otherwise +% #3 = , e.g. "figure" or "table" + \caption@Debug{#1type=#3}% + \caption@checkgrouplevel{#1}{% + \captionsetup{#1type#2*\@empty=...}#2{ or + \@backslashchar#1captionof}{}}% % \end{macrocode} -% -% \subsection{Positioning} -% -% These macros handle the right position of the caption. -% Note that the position is actually \emph{not} controlled by the -% \package{caption3} 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. -% % \begin{macrocode} -\DeclareCaptionOption{position}{\caption@setposition{#1}} + \edef\caption@tempa{#3}% + \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else + \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi + \fi + \expandafter\let\csname @#1captype\endcsname\caption@tempa % \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}{% - \let\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 - }{% - \caption@Error{Undefined position `#1'}% - }}}}} + \@nameuse{caption@#1typehook}% % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@defaultpos} -% \changes{v3.1}{2007/05/08}{Default position changed from `bottom' to `auto'} -% The default `position' is `auto', this means that \thispackage\ will try -% to guess the current position of the caption. -% (But in many cases, for example in |longtable|s, this is doomed to fail!)\par -% The setting `bottom' correspondents to the |\@makecaption| implementation -% in the standard \LaTeX\ document classes, but `auto' should give better -% results in most cases. % \begin{macrocode} -%\caption@setdefaultpos{a}% default = auto -\let\caption@defaultpos\@undefined + \caption@setoptions{#3}% + \ifx\caption@opt\relax + \@nameundef{caption@#1type@warning}% + \else + \@namedef{caption@#1type@warning}{\caption@Warning{% + The #1caption type was already set to + `\csname @#1captype\endcsname'\MessageBreak}}% + \fi % \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}} -% \changes{v3.1}{2007/05/08}{Position will be fixed to `bottom' if `auto'} -% |\caption@iftop|\marg{true-code}\marg{false-code}\par -% (If the |position=| is set to |auto| we assume a |bottom| position here.) % \begin{macrocode} -\newcommand*\caption@iftop{% - \ifx\caption@position\@undefined - \let\caption@position\@secondoftwo -% = \caption@setposition b% - \fi - \caption@position} + \let\caption@ifrefstepcounter\@secondoftwo + #2{}{% + \let\@currentlabel\caption@undefinedlabel +% \let\@currentHlabel\@undefined + \ifx\caption@ORI@label\@undefined + \let\caption@ORI@label\label + \let\label\caption@xlabel + \fi + \caption@start}} % \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{macro}{\caption@typehook} +% Hook, will be extended later on, e.g.~by our \package{float} package +% support. % \begin{macrocode} -\newcommand*\caption@fixposition{% - \ifx\caption@position\@undefined - \caption@autoposition - \fi} +\newcommand*\caption@typehook{} % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@autoposition} -% \changes{v3.0a}{2004/01/23}{\cs{ifvmode} added} -% |\caption@autoposition|\par -% We guess the current position of the caption by checking |\prevdepth|.\par -% A different solution would be setting the |\spacefactor| to something -% not much less than 1000 (for example 994) in |\caption@start| and -% checking this value here by |\ifnum\spacefactor=994|. -% (It's implemented in the \package{threeparttable} -% package\cite{threeparttable} this way.)\par -% Another idea would be checking |\@ifminipage|, but since some packages -% typeset the caption within a simple |\vbox| this does not seem to be a -% good one. -% \begin{macrocode} -\newcommand*\caption@autoposition{% - \ifvmode - \edef\caption@tempa{\the\prevdepth}% - \caption@Debug{\protect\prevdepth=\caption@tempa}% - \ifdim\prevdepth>-\p@ - \let\caption@position\@secondoftwo - \else - \let\caption@position\@firstoftwo - \fi -% = \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}% - \else - \caption@Debug{no \protect\prevdepth}% - \let\caption@position\@secondoftwo -% = \caption@setposition b% - \fi} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\caption@setautoposition} -% \changes{v3.1}{2007/06/10}{This macro added} -% |\caption@setautoposition|\marg{position}\par -% replaces the above algorithm by a different one (or a fixed position setting). +% \begin{macro}{\caption@iftype} +% \changes{v3.1}{2007/04/11}{This macro and its usage added} +% Since we often need to check if |\@captype| is defined (means: we +% are inside a floating environment) this helper macro was introduced. % \begin{macrocode} -\newcommand*\caption@setautoposition[1]{% - \def\caption@autoposition{\caption@setposition{#1}}} +\newcommand*\caption@iftype{% + \@ifundefined{@captype}{\let\@captype\@undefined\@secondoftwo}\@firstoftwo} % \end{macrocode} +% \iffalse +% \newcommand*\caption@iftype{% +% \begingroup +% \@ifundefined{@captype}% +% {\aftergroup\@secondoftwo}% +% {\aftergroup\@firstoftwo}% +% \endgroup} +% \fi % \end{macro} % -% \subsection{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{macro}{\caption@checkgrouplevel} +% \changes{v3.1}{2007/07/15}{This macro and its usage added} +% \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)} +% Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done +% inside a group or not -- in the latter case a warning message will +% be issued. (needs \eTeX) % \begin{macrocode} -\newcommand*\caption@beginhook{} -\newcommand*\caption@endhook{} -\newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook} -\newcommand*\AtEndCaption{\l@addto@macro\caption@endhook} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname currentgrouplevel\endcsname\relax + \caption@Debug{TeX engine: TeX} + \let\caption@checkgrouplevel\@gobbletwo +\else + \caption@Debug{TeX engine: e-TeX} + \newcommand*\caption@checkgrouplevel[2]{% + \@ifundefined{#1caption@grouplevel}{% + \@ifundefined{caption@grouplevel}{\let\caption@grouplevel\z@}{}% + \ifnum\currentgrouplevel>\caption@grouplevel\relax + \expandafter\edef\csname #1caption@grouplevel\endcsname{% + \the\currentgrouplevel}% + \else + \caption@Warning{\string#2\MessageBreak outside box or environment}% + \fi + }{}} +\fi % \end{macrocode} % \end{macro} -% \end{macro} -% -% \subsection{Lists} % -% \changes{v3.0b}{2004/05/16}{Option \opt{listof=} added} -% \changes{v3.1f}{2007/11/17}{Option \opt{list=} added} +% \begin{macro}{\caption@undefinedlabel} +% \changes{v3.1}{2007/07/03}{This macro and its usage added} +% \changes{v3.1b}{2007/09/22}{Contents changed to \texttt{??}} +% \changes{v3.1i}{2008/04/13}{Contents changed to \cs{caption@xref}(\ldots)} +% \changes{v3.1k}{2009/03/30}{Bugfix 08-12-08: \cs{caption@xref} is robust now} +% This label will be used for |\currentlabel| inside (floating) environments +% as default. (see above) +% \iffalse\Note{All commands used have to be robust here.}\fi % \begin{macrocode} -\DeclareCaptionOption{list}[1]{\caption@setlist{#1}} -\DeclareCaptionOption{listof}[1]{\caption@setlist{#1}} +\newcommand*\caption@undefinedlabel{% + \protect\caption@xref{\caption@labelname}{\on@line}} % \end{macrocode} -% -% \begin{macro}{\caption@setlist} -% \changes{v3.1g}{2008/03/20}{This macro added} -% |\caption@setlist|\marg{boolean} % \begin{macrocode} -\newcommand*\caption@setlist{\caption@set@bool\caption@iflist} +\DeclareRobustCommand*\caption@xref[2]{% + \caption@WarningNoLine{\noexpand\label before \string\caption#2}% + \@setref\relax\@undefined{#1}} % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\DeclareCaptionListFormat} -% \changes{v3.1}{2004/07/15}{This macro added} -% \changes{v3.1f}{2007/11/17}{Renamed from \cs{DeclareCaptionListOfFormat} to \cs{DeclareCaptionListFormat}} -% |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2} % \begin{macrocode} -\newcommand*\DeclareCaptionListFormat[2]{% - \global\@namedef{caption@lstfmt@#1}##1##2{#2}} -\@onlypreamble\DeclareCaptionListFormat +\newcommand*\caption@labelname{??} % \end{macrocode} % \end{macro} -% -% \changes{v3.1}{2007/07/15}{Option \opt{listofformat=} added} -% \changes{v3.1f}{2007/11/17}{Option \opt{listofformat=} renamed to \opt{listformat=}} +% \begin{macro}{\caption@xlabel} +% \changes{v3.1b}{2007/09/22}{This macro and its usage added} +% \changes{v3.1f}{2007/11/11}{Revised} +% \changes{v3.1i}{2008/04/13}{Bugfix: \cs{pageref} should always work now} +% The new code of |\label| inside floating environments. +% |\label| will be redefined using |\caption@withoptargs|, so +% |#1| are the optional arguments (if any), and +% |#2| is the mandatory argument here. % \begin{macrocode} -\DeclareCaptionOption{listformat}{\caption@setlistformat{#1}} +\newcommand*\caption@xlabel[1]{% + \caption@@xlabel + \def\caption@labelname{#1}% + \caption@ORI@label{#1}} % \end{macrocode} -% -% \begin{macro}{\caption@setlistformat} -% \changes{v3.1}{2004/07/15}{This macro added} -% \changes{v3.1f}{2007/11/17}{Renamed from \cs{caption@setlistofformat} to \cs{caption@setlistformat}} -% |\caption@setlistformat|\marg{name}\par -% Selecting a caption list format simply means saving the code (in |\caption@lstfmt|). % \begin{macrocode} -\newcommand*\caption@setlistformat[1]{% - \@ifundefined{caption@lstfmt@#1}% - {\caption@Error{Undefined list format `#1'}}% - {\expandafter\let\expandafter\caption@lstfmt - \csname caption@lstfmt@#1\endcsname}} +\newcommand*\caption@@xlabel{% + \global\let\caption@@xlabel\@empty + \@bsphack + \protected@write\@auxout{}% + {\string\providecommand*\string\caption@xref[2]{% + \string\@setref\string\relax\string\@undefined{\string##1}}}% + \@esphack} % \end{macrocode} % \end{macro} % -% There are five pre-defined list formats, taken from the \package{subfig} package. -% \begin{macrocode} -\DeclareCaptionListFormat{empty}{} -\DeclareCaptionListFormat{simple}{#1#2} -\DeclareCaptionListFormat{parens}{#1(#2)} -\DeclareCaptionListFormat{subsimple}{#2} -\DeclareCaptionListFormat{subparens}{(#2)} -% \end{macrocode} -% -% \begin{macro}{\caption@setdefaultlistformat} -% \changes{v3.1k}{2009/03/29}{This macro added} +% \begin{macro}{\captionof} +% \changes{v3.1}{2007/05/09}{Uses \cs{caption@settype} instead of \cs{def}\cs{@captype}} +% \changes{v3.1c}{2007/09/22}{Bugfix: Redefinition of \cs{caption@setfloatcapt} removed} +% \changes{v3.1e}{2007/10/30}{Better compatibility: Will be defined with \cs{AtBeginDocument} now} +% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Uses \cs{setcaptiontype} instead of \cs{caption@settype} now} +% |\captionof|\marg{type}\oarg{lst\_entry}\marg{heading}\\ +% |\captionof*|\oarg{lst\_entry}\marg{heading}\par +% \Note{This will be defined with \cs{AtBeginDocument} so +% \cs{usepackage}\csmarg{caption,capt-of} will still work. +% (Compatibility to \version{1.x})} % \begin{macrocode} -\newcommand*\caption@setdefaultlistformat[1]{% - \ifx\caption@lstfmt\caption@lstfmt@default - \caption@set@default@listformat{#1}% - \caption@setlistformat{default}% - \else - \caption@set@default@listformat{#1}% - \fi} +\caption@AtBeginDocument{% + \def\captionof{\caption@teststar\caption@of{\caption*}\caption}} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@set@default@listformat[1]{% - \def\caption@lstfmt@default{\@nameuse{caption@lstfmt@#1}}} +\newcommand*\caption@of[2]{\setcaptiontype*{#2}#1} % \end{macrocode} % \end{macro} % -% `default' usually maps to `subsimple'. -% \begin{macrocode} -\caption@set@default@listformat{subsimple} -% \end{macrocode} -% -% \subsection{Debug option} -% \changes{v3.0m}{2007/03/04}{Debug option added (kernel)} -% -% \begin{macrocode} -\DeclareCaptionOption{debug}[1]{% - \caption@set@bool\caption@ifdebug{#1}% - \caption@ifdebug - {\def\caption@Debug{\PackageInfo{caption}}}% - {\let\caption@Debug\@gobble}} -% \end{macrocode} +% \begin{macro}{\captionlistentry} +% \changes{v3.1}{2007/07/28}{This macro added} +% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added} +% \changes{v3.1g}{2008/01/20}{Starred variant added} +% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package} +% |\captionlistentry|\oarg{float type}\marg{list entry}\\ +% |\captionlistentry*|\oarg{float type}\marg{list entry} % \begin{macrocode} -\DeclareOption{debug}{\setkeys{caption}{debug}} +\newcommand*\captionlistentry{% + \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo} % \end{macrocode} % \begin{macrocode} -\setkeys{caption}{debug=0} +\newcommand*\@captionlistentry[1]{% + \@testopt{\caption@listentry{#1}}\@captype} % \end{macrocode} -% -% \subsection{Document classes \& Babel support} -% -% \subsubsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes} -% % \begin{macrocode} -\caption@CheckCommand\@makecaption{% - % article|report|book [2005/09/16 v1.4f Standard LaTeX document class] - \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}} +\def\caption@listentry#1[#2]#3{% + \@bsphack + #1{\caption@gettitle{#3}}% + {\caption@refstepcounter{#2}% + \caption@makecurrent{#2}{#3}}% + \caption@addcontentsline{#2}{#3}% + \@esphack} % \end{macrocode} +% \end{macro} % -% \subsubsection{The \AmS{} \& \SmF{} classes} -% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added (kernel)} +% \subsection{\cs{captionbox}} % +% \begin{macro}{\captionbox} +% \changes{v3.2}{2010/12/17}{This macro added} +% A |\parbox| with contents and caption, separated by an invisible |\hrule|. % \begin{macrocode} -\providecommand*\caption@ifamsclass{% - \@ifundefined{@captionheadfont}\@gobble\@firstofone} -\@onlypreamble\caption@ifamsclass -% \end{macrocode} -% \begin{macrocode} -\caption@ifamsclass{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % amsart|amsproc|amsbook [2004/08/06 v2.20] - \long\def\@makecaption#1#2{% - \setbox\@tempboxa\vbox{\color@setgroup - \advance\hsize-2\captionindent\noindent - \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp - {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}% - \unskip\kern-2\captionindent\par - \global\setbox\@ne\lastbox\color@endgroup}% - \ifhbox\@ne % the normal case - \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}% - \fi - \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line - \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}% - \else % tempboxa contained more than one line - \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip - \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}% - \fi - \ifnum\@tempcnta<64 % if the float IS a figure... - \addvspace\abovecaptionskip - \hbox to\hsize{\kern\captionindent\box\@ne\hss}% - \else % if the float IS NOT a figure... - \hbox to\hsize{\kern\captionindent\box\@ne\hss}% - \nobreak - \vskip\belowcaptionskip - \fi - \relax - }} -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % smfart|smfbook [1999/11/15 v1.2f Classe LaTeX pour les articles publies par la SMF] - \long\def\@makecaption#1#2{% - \ifdim\captionindent>.1\hsize \captionindent.1\hsize \fi - \setbox\@tempboxa\vbox{\color@setgroup - \advance\hsize-2\captionindent\noindent - \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp - {\@cdr#2\@nil}{\@addpunct{.}\@captionfont\upshape\enspace#2}% - \unskip\kern-2\captionindent\par - \global\setbox\@ne\lastbox\color@endgroup}% - \ifhbox\@ne % the normal case - \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}% - \fi - \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line - \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}% - \@tempdima\wd\@ne\advance\@tempdima-\captionindent - \wd\@ne\@tempdima - \else % tempboxa contained more than one line - \setbox\@ne\vbox{\rightskip=0pt plus\captionindent\relax - \unvbox\@tempboxa\parskip\z@skip - \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}% - \fi - \ifnum\@tempcnta<64 % if the float IS a figure... - \addvspace\abovecaptionskip - \noindent\kern\captionindent\box\@ne - \else % if the float IS NOT a figure... - \noindent\kern\captionindent\box\@ne - \nobreak - \vskip\belowcaptionskip - \fi - \relax - }} -% \end{macrocode} -% \begin{macrocode} - \let\captionmargin\captionindent % set to 3pc by AMS class - \begingroup\edef\@tempa{\endgroup - \noexpand\caption@g@addto@list\noexpand\caption@sty@default - {margin=\the\captionmargin - \@ifundefined{smf@makecaption}{}{,maxmargin=.1\linewidth}}} - \@tempa - \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin} - \DeclareCaptionLabelSeparator{default}{.\enspace} - \DeclareCaptionDefaultFont{font}{\@captionfont} - \DeclareCaptionDefaultFont{labelfont}{\@captionheadfont} - \DeclareCaptionDefaultFont{textfont}{\@captionfont\upshape} - \captionsetup[figure]{position=b} - \captionsetup[table]{position=t} +\newcommand*\captionbox{% + \let\captionbox@type\@empty + \caption@withoptargs\caption@box} % \end{macrocode} % \begin{macrocode} -} +\newcommand\caption@box[2]{% + \@testopt{\caption@ibox{#1}{#2}}{\wd\@tempboxa}} % \end{macrocode} -% -% \subsubsection{The beamer class} -% \changes{v3.1}{2007/03/10}{beamer class support added (kernel)} -% % \begin{macrocode} -\providecommand*\caption@ifbeamerclass{% - \@ifclassloaded{beamer}\@firstofone\@gobble} -\@onlypreamble\caption@ifbeamerclass +\long\def\caption@ibox#1#2[#3]{% + \@testopt{\caption@iibox{#1}{#2}{#3}}\captionbox@hj@default} % \end{macrocode} % \begin{macrocode} -\caption@ifbeamerclass{% +\long\def\caption@iibox#1#2#3[#4]#5{% + \setbox\@tempboxa\hbox{#5}% + \begingroup + \expandafter\captionsetup\expandafter{\captionbox@type*}% set \caption@position + \caption@iftop{% + \endgroup + \parbox[t]{#3}{% + \expandafter\captionsetup\expandafter{\captionbox@type,position=t}% + \vbox{\caption#1{#2}}% + \captionbox@hrule + \csname caption@hj@#4\endcsname + \unhbox\@tempboxa}% + }{% + \endgroup + \parbox[b]{#3}{% + \expandafter\captionsetup\expandafter{\captionbox@type,position=b}% + \csname caption@hj@#4\endcsname + \unhbox\@tempboxa + \captionbox@hrule + \vtop{\caption#1{#2}}}% + }} % \end{macrocode} % \begin{macrocode} - \caption@CheckCommand\beamer@makecaption{% - % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau - \long\def\beamer@makecaption#1#2{% - \def\insertcaptionname{\csname#1name\endcsname}% - \def\insertcaptionnumber{\csname the#1\endcsname}% - \def\insertcaption{#2}% - \nobreak\vskip\abovecaptionskip\nobreak - \sbox\@tempboxa{\usebeamertemplate**{caption}}% - \ifdim \wd\@tempboxa >\hsize - \usebeamertemplate**{caption}\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \nobreak\vskip\belowcaptionskip\nobreak}} +\newcommand*\captionbox@hj@default{c} +\newcommand*\captionbox@hrule{\hrule\@height\z@\relax} % \end{macrocode} % \begin{macrocode} - \DeclareCaptionLabelFormat{default}{#1} - \DeclareCaptionDefaultJustification{\raggedright} - \DeclareCaptionDefaultFont{font}{% - \usebeamerfont*{caption}% - \usebeamercolor[fg]{caption}} - \DeclareCaptionDefaultFont{labelfont}{% - \usebeamercolor[fg]{caption name}% - \usebeamerfont*{caption name}} +\providecommand*\caption@hj@c{\centering} +\providecommand*\caption@hj@l{\raggedright} +\providecommand*\caption@hj@r{\raggedleft} +\providecommand*\caption@hj@s{} % \end{macrocode} -% If the \package{beamer} document class is used, we offer a beamer -% template called `caption3' which can be used with option `beamer' or -% |\setbeamertemplate{caption}[caption3]|.\par -% (Note that this is of no use when \thispackage\ is used, too.) % \begin{macrocode} - \defbeamertemplate{caption}{caption3}{% - \caption@make\insertcaptionname\insertcaptionnumber\insertcaption} -% \end{macrocode} -% \begin{macrocode} - \DeclareOption{beamer}{% - % \usebeamertemplate**{caption} will set font - \DeclareCaptionDefaultFont{font}{}% - \setbeamertemplate{caption}[caption3]} -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsubsection{The \KOMAScript{} classes} -% \changes{v3.1}{2007/03/31}{\KOMAScript\ classes support added (kernel)} -% -% \begin{macrocode} -\providecommand*\caption@ifkomaclass{% - \@ifundefined{scr@caption}\@gobble\@firstofone} -\@onlypreamble\caption@ifkomaclass -% \end{macrocode} -% \begin{macrocode} -\caption@ifkomaclass{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % scrartcl|scrreprt|scrbook [2007/03/07 v2.97a KOMA-Script document class] - \long\def\@makecaption#1#2{% - \if@captionabove - \vskip\belowcaptionskip - \else - \vskip\abovecaptionskip - \fi - \@@makecaption\@firstofone{#1}{#2}% - \if@captionabove - \vskip\abovecaptionskip - \else - \vskip\belowcaptionskip - \fi}} -% \end{macrocode} -% \begin{macrocode} - \DeclareCaptionFormat{default}[#1#2#3\par]{% - \ifdofullc@p - \caption@ifin@list\caption@lsepcrlist\caption@lsepname - {\caption@Error{% - The option `labelsep=\caption@lsepname' does not work\MessageBreak - with \noexpand\setcaphanging (which is set by default)}}% - {\caption@fmt@hang{#1}{#2}{#3}}% - \else - #1#2% - \ifdim\cap@indent<\z@ - \par - \noindent\hspace*{-\cap@indent}% - \else\if@capbreak - \par - \fi\fi - #3\par - \fi} - \DeclareCaptionLabelSeparator{default}{\captionformat} - \DeclareCaptionDefaultFont{font}{\scr@fnt@caption} - \DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel} -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsubsection{The \NTG{} Dutch classes} -% \changes{v3.1}{2007/04/06}{NTG classes support added (kernel)} -% -% \begin{macrocode} -\providecommand*\caption@ifntgclass{% - \@ifundefined{CaptionFonts}\@gobble\@firstofone} -\@onlypreamble\caption@ifntgclass -% \end{macrocode} -% \begin{macrocode} -\caption@ifntgclass{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % artikel|rapport|boek [2004/06/07 v2.1a NTG LaTeX document class] - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{{\CaptionLabelFont#1:} \CaptionTextFont#2}% - \ifdim \wd\@tempboxa >\hsize - {\CaptionLabelFont#1:} \CaptionTextFont#2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}} -% \end{macrocode} -% \begin{macrocode} - \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont} - \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont} -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsubsection{The thesis class} -% \changes{v3.1g}{2008/01/31}{thesis class support added (kernel)} -% \changes{v3.1l}{2009/11/15}{Bugfix 09-11-14: thesis class support revised (kernel)} -% -% \begin{macrocode} -\providecommand*\caption@ifthesisclass{% - \@ifundefined{cph@font}{\@gobble}{\@ifundefined{cpb@font}\@gobble\@firstofone}} -% \end{macrocode} -% \begin{macrocode} -\caption@ifthesisclass{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % thesis.cls 1996/25/01 1.0g LaTeX document class (wm). - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \setbox\@tempboxa\hbox{{\cph@font #1:} {\cpb@font #2}}% - \ifdim \wd\@tempboxa >\hsize - \@hangfrom{\cph@font #1: }{\cpb@font #2\par}% - \else - \hbox to\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}} -% \end{macrocode} -% \begin{macrocode} - \DeclareCaptionDefaultFormat{hang} - \DeclareCaptionDefaultFont{labelfont}{\cph@font} - \DeclareCaptionDefaultFont{textfont}{\cpb@font} -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsubsection{The frenchb Babel option} -% \changes{v3.1}{2006/05/14}{\package{frenchb} package support added (kernel)} -% -% \begin{macrocode} -\@ifundefined{FB@makecaption}{}{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % frenchb.ldf [2005/02/06 v1.6g French support from the babel system] - % frenchb.ldf [2007/10/05 v2.0e French support from the babel system] - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{#1\CaptionSeparator #2}% - \ifdim \wd\@tempboxa >\hsize - #1\CaptionSeparator #2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}} -% \end{macrocode} -% \begin{macrocode} - \ifx\@makecaption\STD@makecaption - \DeclareCaptionLabelSeparator{default}{\CaptionSeparator} - \def\caption@frenchb{% supress frenchb warning - \let\STD@makecaption\@makecaption - \let\FB@makecaption\@makecaption} - \else - \ifx\@makecaption\@undefined\else - \PackageInfo{caption}{% - The definition of \protect\@makecaption\space - has been changed,\MessageBreak - frenchb will NOT customize it}% - \fi - \fi -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsubsection{The frenchle/pro package} -% \changes{v3.1}{2006/05/14}{\package{frenchle/pro} package support added (kernel)} -% -% \begin{macrocode} -\@ifundefined{frenchTeXmods}{}{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % french(le).sty [2006/10/03 The french(le) package /V5,9991/] - % french(le).sty [2007/06/28 The french(le) package /V5,9994/] - \def\@makecaption#1#2{% - \ifFTY% - \def\@secondofmany##1##2\void{##2}% - \def\@tempa{\@secondofmany#2\void}% - \ifx\@tempa\empty% - \let\captionseparator\empty% - \fi% - \@mcORI{#1}{\relax\captionfont{#2}}% - \else - \@mcORI{#1}{#2}% - \fi}} -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % french(le).sty [2007/02/11 The french(le) package /V5,9993/] - \def\@makecaption#1#2{% - \ifFTY% - \def\@secondofmany##1##2\void{##2}% - \protected@edef\@tempa{\@secondofmany#2\void}% - \ifx\@tempa\empty% - \let\captionseparator\empty% - \fi% - \@mcORI{#1}{\relax\captionfont{#2}}% - \else - \@mcORI{#1}{#2}% - \fi}} -% \end{macrocode} -% \begin{macrocode} - \DeclareCaptionDefaultFont{textfont}{\itshape}% - \DeclareCaptionLabelSeparator{default}{\captionseparator\space}% -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \iffalse -% \subsubsection{The hungarian and magyar Babel option} -% \changes{v3.2}{2009/03/29}{\package{magyar} package support added (kernel)} -% -% \begin{macrocode} -\DeclareCaptionListFormat{subperiod}{#2.} -% \end{macrocode} -% -% \begin{macrocode} -%%% \def\caption@tempa#1{\@ifundefined{extras#1}{}{% -%%% \expandafter\addto\csname extras#1\endcsname{% -%%% % reverse changes made by magyar.ldf -%%% \let\@makecaption\caption@makecaption -%%% \babel@save\@makecaption -%%% \caption@redefine -%%% \babel@save\@caption -%%% % change default labelsep and listformat -%%% \caption@setdefaultlabelsep{period}% -%%% \caption@setdefaultlistformat{subperiod}}% -%%% \expandafter\addto\csname noextras#1\endcsname{% -%%% % change default labelsep and listformat -%%% \caption@setdefaultlabelsep{colon}% -%%% \caption@setdefaultlistformat{subsimple}}% -%%% }} -% \end{macrocode} -% \begin{macrocode} -%%% \caption@tempa{hungarian} -%%% \caption@tempa{magyar} -% \end{macrocode} -% \fi -% -% \subsection{Execution of options} -% -% \begin{macrocode} -\captionsetup{style=default,position=default,% - list,listformat=default,twoside=\if@twoside 1\else 0\fi} -% \end{macrocode} -% \begin{macrocode} -\ProcessOptions* -% \end{macrocode} -% -% \changes{v3.1}{2007/04/10}{Check of document class added} -% \begin{macrocode} -\caption@IfCheckCommand{% - \caption@setbool{documentclass}{1}% -}{% - \caption@setbool{documentclass}{0}% - \PackageInfo{caption}{% - Unknown document class (or package),\MessageBreak - standard defaults will be used}% - \caption@Debug{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}% -} -% \end{macrocode} -% -% \subsection{Making an `List of' entry} -% -% \begin{macro}{\caption@addcontentsline} -% \changes{v3.1}{2007/07/01}{This macro added} -% |\caption@addcontentsline|\marg{type}\marg{list entry}\par -% Makes an entry in the list-of-whatever, if requested, -% i.e.~the argument \meta{list entry} is not empty and -% |listof=| was set to |true|. -% \begin{macrocode} -\newcommand*\caption@addcontentsline[2]{% - \caption@iflist - {\def\@tempa{#2}}% - {\let\@tempa\@empty}% - \ifx\@tempa\@empty \else - {\let\\\space - \addcontentsline{\csname ext@#1\endcsname}{#1}% - {\protect\numberline - {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}% - {\ignorespaces #2}}}% - \fi} -% \end{macrocode} -% \end{macro} -% -% \subsection{Typesetting the caption} -% -% \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} -% -% \begin{macro}{\caption@fnum} -% \changes{v3.1}{2007/08/21}{This macro added} -% |\caption@fnum|\marg{float type}\par -% Typesets the caption label; as replacement for |\fnum@|\meta{float type}. -% \begin{macrocode} -\newcommand*\caption@fnum[1]{\caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@make} -% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\par -% Typesets the caption. -% \begin{macrocode} -\newcommand\caption@make[2]{\caption@@make{\caption@lfmt{#1}{#2}}} +\DeclareCaptionOption{*}[]{} % \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} now} -% \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} -% \changes{v3.0k}{2006/05/13}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox}} -% \changes{v3.0l}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v3.0j, re-added} -% \changes{v3.0p}{2007/04/03}{Usage of \cs{caption@ifoddpage} added} -% \changes{v3.1}{2007/07/29}{\cs{caption@calcmargin} moved below single-line-check} -% \changes{v3.1e}{2007/10/28}{\cs{caption@stepcounter} added} -% |\caption@@make|\marg{caption label}\marg{caption text} -% \begin{macrocode} -\newcommand\caption@@make[2]{% - \begingroup - \caption@stepcounter - \caption@beginhook -% \end{macrocode} -% -% Check margin, if |\caption@minmargin| or |\caption@maxmargin| is set -% \begin{macrocode} - \ifx\caption@maxmargin\@undefined \else - \ifdim\captionmargin>\caption@maxmargin\relax - \captionmargin\caption@maxmargin\relax - \fi - \fi - \ifx\caption@minmargin\@undefined \else - \ifdim\captionmargin<\caption@minmargin\relax - \captionmargin\caption@minmargin\relax - \fi - \fi -% \end{macrocode} -% -% Special single-line treatment (option |singlelinecheck=|) -% \begin{macrocode} - \caption@ifslc{\caption@slc{#1}{#2}\captionwidth\relax}{}% -% \end{macrocode} -% -% Typeset the left margin (option |margin=|) -% \begin{macrocode} - \caption@calcmargin - \@tempdima\captionmargin - \ifdim\captionmargin@=\z@ \else - \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}% - \fi - \caption@ifh{\advance\@tempdima\caption@indent}% - \hspace\@tempdima -% \end{macrocode} -% -% We actually use a |\vbox| of width |\captionwidth - \caption@indent| -% to typeset the caption. -% \Note{\cs{captionindent} is \emph{not} supported if the caption format -% was defined with \cs{DeclareCaptionFormat*}.} -% \begin{macrocode} - \@tempdima\captionwidth - \caption@ifh{\advance\@tempdima-\caption@indent}% - \caption@parbox\@tempdima{% -% \end{macrocode} +% \subsection{\cs{ContinuedFloat}} % -% Typeset the indention (option |indention=|)\\ -% {\small Bugfix 04-05-05: -% |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots} +% \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} +% \changes{v3.0g}{2005/06/28}{% +% Bugfix: \cs{newcounter} replaced by \cs{newcount}} +% \changes{v3.1}{2007/07/02}{Format of \package{hyperref} extension changed} +% \changes{v3.1}{2007/07/07}{\cs{caption@setoptions} added} +% \changes{v3.1g}{2008/01/29}{Starred variant and hook \cs{sf@ContinuedFloat} added} +% |\ContinuedFloat|\\ +% |\ContinuedFloat*|\par +% This mainly decrements the appropriate counter and increments the +% continuation counter instead. +% Furthermore we set |\caption@resetContinuedFloat| to |\@gobble| so the +% continuation counter will not be reset to zero inside |\caption@refstepcounter|. +% Please forget about the optional argument, it was never working well, is +% incompatible to the \package{subfig} package, but is still there for +% compatibility reasons. +% \Note{The definition of \cs{ContinuedFloat} itself is compatible +% to the one inside the \package{subfig} package, except for the +% starred variant and the optional argument.} +% When the \package{hyperref} package is used we have the problem +% that the usage of |\ContinuedFloat| will create duplicate +% hyper links -- |\@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 \#}|\alph{|\meta{continued \#}|}|\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.)} +% \Note{This does not help if the \package{hyperref} package option +% \texttt{naturalnames=true} is set.} % \begin{macrocode} - \caption@ifh{% - \ifdim\caption@indent=\z@ - \leavevmode - \else - \hskip-\caption@indent - \fi}% +\def\ContinuedFloat{% + \@ifnextchar[\@Continued@Float\@ContinuedFloat} % \end{macrocode} -% -% Typeset the caption itself and close the |\caption@parbox| % \begin{macrocode} - \caption@@@make{#1}{#2}}% +\def\@Continued@Float[#1]{\addtocounter{#1}\m@ne} % \end{macrocode} -% -% Typeset the right margin (option |margin=|) % \begin{macrocode} - \@tempdima\captionmargin - \ifdim\captionmargin@=\z@ \else - \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}% - \fi - \hspace\@tempdima +\def\@ContinuedFloat{% + \caption@iftype + {\addtocounter\@captype\m@ne + \caption@ContinuedFloat\@captype}% + {\caption@Error{\noexpand\ContinuedFloat outside float}}} % \end{macrocode} -% % \begin{macrocode} - \caption@endhook - \endgroup +\def\caption@ContinuedFloat#1{% + \@ifstar{\caption@Continued@Float@{#1}}{\caption@Continued@Float{#1}}} % \end{macrocode} -% % \begin{macrocode} - \global\caption@starfalse} +\def\caption@Continued@Float@{% + \addtocounter\@captype\@ne + \@stpelt{ContinuedFloat}\stepcounter{ContinuedFloat}% + \def\caption@resetContinuedFloat##1{\xdef\caption@CFtype{##1}}% + \caption@@ContinuedFloat} % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@calcmargin} -% \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} -% \changes{v3.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore), -% use \cs{linewidth} instead of \cs{hsize}} -% |\caption@calcmargin|\par -% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid -% values. % \begin{macrocode} -\newcommand*\caption@calcmargin{% - \ifdim\captionwidth=\z@ - \captionwidth\linewidth - \advance\captionwidth by -2\captionmargin - \advance\captionwidth by -\captionmargin@ +\def\caption@Continued@Float#1{% + \edef\caption@tempa{#1}% + \ifx\caption@tempa\caption@CFtype + \stepcounter{ContinuedFloat}% + \let\caption@resetContinuedFloat\@gobble + \caption@@ContinuedFloat{#1}% + \sf@ContinuedFloat{#1}% \else - \captionmargin\linewidth - \advance\captionmargin by -\captionwidth - \divide\captionmargin by 2 - \captionmargin@\z@ - \fi -% \end{macrocode} -% \begin{macrocode} - \caption@Debug{% - \string\hsize=\the\hsize, - \string\linewidth=\the\linewidth,\MessageBreak - \string\leftmargin=\the\leftmargin, - \string\rightmargin=\the\rightmargin,\MessageBreak - \string\margin=\the\captionmargin, - \string\margin@=\the\captionmargin@, - \string\width=\the\captionwidth}% + \caption@Error{Continued `#1' after `\caption@CFtype'}% + \fi} % \end{macrocode} % \begin{macrocode} -} +\def\caption@@ContinuedFloat#1{% + \expandafter\l@addto@macro\csname the#1\endcsname\theContinuedFloat + \@ifundefined{theH#1}{}{% + \expandafter\l@addto@macro\csname theH#1\endcsname{% + \@alph\c@ContinuedFloat}}% + \caption@setoptions{ContinuedFloat}% + \caption@setoptions{continued#1}} % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@slc} -% \changes{v3.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} added} -% \changes{v3.1}{2007/07/29}{\cs{caption@setup}\cs{caption@sls} added after \cs{begingroup}} -% \changes{v3.1}{2007/07/29}{\cs{caption@calcmargin} added} -% \changes{v3.1c}{2007/10/14}{Support of \cs{caption@slfmt} added} -% \changes{v3.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} -% |\caption@slc|\marg{label}\marg{text}\marg{width}\marg{extra code}\par -% This one does the single-line-check. % \begin{macrocode} -\newcommand\caption@slc[4]{% - \caption@Debug{Begin SLC}% - \begingroup - \caption@singleline - \let\caption@hj\@empty - \caption@calcmargin % calculate #3 if necessary - \caption@prepareslc - \sbox\@tempboxa{\caption@@@make{#1}{#2}}% - \ifdim\wd\@tempboxa>#3% - \endgroup - \else - \endgroup - \caption@singleline - #4% - \fi - \caption@Debug{End SLC}} +\providecommand*\sf@ContinuedFloat[1]{} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@singleline{% - \caption@xsetup\caption@opt@singleline - \let\caption@fmt\caption@slfmt} +\newcommand*\caption@CFtype{??} % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@prepareslc} -% \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} -% \changes{v3.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} moved to \cs{caption@slc}} -% \changes{v3.1}{2007/06/13}{Redefinition of \cs{(H@)refstepcounter} added} -% \changes{v3.1}{2007/08/12}{Redefinition of \cs{label} improved} -% \changes{v3.1c}{2007/10/06}{Definition of \cs{caption@l@stepcounter} added} -% |\caption@prepareslc|\par -% Re-define anything which would disturb the single-line-check. -% \begin{macrocode} -\newcommand*\caption@prepareslc{% - \let\@footnotetext\@gobble\let\@endnotetext\@gobble - \def\label{\caption@withoptargs\@gobbletwo}% - \let\stepcounter\caption@l@stepcounter - \let\refstepcounter\stepcounter\let\H@refstepcounter\stepcounter} -% \end{macrocode} +% \begin{macro}{\theContinuedFloat} +% Its preset to \cs{@empty}, so usually the continuation counter is not +% included in the caption label or references. % \begin{macrocode} -\newcommand*\caption@l@stepcounter[1]{\advance\csname c@#1\endcsname\@ne\relax} +\newcounter{ContinuedFloat} +\let\theContinuedFloat\@empty % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@parbox} -% \changes{v3.0k}{2006/05/13}{We define \cs{caption@parbox} instead of -% \cs{caption@start/endbox}} -% \changes{v3.0n}{2006/03/09}{Bugfix 07-03-09: \cs{caption@parbox} changed from -% \cs{parbox-t} to \cs{parbox-b}} -% \changes{v3.1f}{2007/11/11}{Renamed from \cs{captionbox} to \cs{caption@parbox}} -% |\caption@parbox|\marg{width}\marg{contents}\par -% This macro defines the box which surrounds the caption paragraph. +% \begin{macro}{\caption@resetContinuedFloat} +% |\caption@resetContinuedFloat|\marg{type}\par +% If a continuation counter is defined, we reset it. +% (This one will be called inside |\@caption|.) % \begin{macrocode} -\newcommand*\caption@parbox{\parbox[b]} +\newcommand*\caption@resetContinuedFloat[1]{% + \@stpelt{ContinuedFloat}\xdef\caption@CFtype{#1}} % \end{macrocode} % \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} -% \changes{v3.0l}{2007/02/18}{Usage of \cs{caption@tfmt} added} -% \changes{v3.1}{2007/05/07}{Bugfix: \cs{ifhmode} added to \cs{@finalstrut}} -% \changes{v3.1f}{2007/11/17}{Made option \opt{size=} stronger than \opt{font=}} -% |\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 -% \@capbreakfalse - \fi -% \end{macrocode} -% -% If the text is empty, we use no caption label separator, too. -% \begin{macrocode} - \caption@ifempty{#2}{% - \let\caption@lsep\relax -% \@capbreakfalse -% \let\caption@ifstrut\@secondoftwo - }% -% \end{macrocode} -% -% Take care that |\caption@parindent| and |\caption@hangindent| will be used -% to typeset the paragraph. -% \begin{macrocode} - \@setpar{\@@par\caption@@par}\caption@@par -% \end{macrocode} -% -% Finally typeset the caption. -% \begin{macrocode} - \caption@hj\captionfont\captionsize\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 % enable hyphenation - \caption@tfmt{#2}% -% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}% - \caption@ifstrut{\ifhmode\@finalstrut\strutbox\fi}{}% - \par}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@ifempty} -% \changes{v3.0e}{2005/05/05}{This macro added} -% \changes{v3.1}{2007/07/04}{Re-defines itself now} -% \changes{v3.1g}{2007/01/22}{Revised so \cs{label} will be detected, too} -% \changes{v3.1i}{2008/08/02}{Revised so \cs{index} and \cs{glossary} will be detected, too} -% |\caption@ifempty|\marg{text}\marg{true} (\emph{no} \meta{false})\par -% This one tests if the \meta{text} is actually empty. -% \Note{This will be done without expanding the text, -% therefore this is far away from being bullet-proof.} -% \Note{This macro is re-defining itself so only -% the first test (in a group) will actually be done.} -% \begin{macrocode} -\newcommand\caption@ifempty[1]{% - \caption@if@empty{#1}% - \caption@ifempty\@unused} -% \end{macrocode} -% \begin{macrocode} -\newcommand\caption@if@empty[1]{% - \def\caption@tempa{#1}% - \ifx\caption@tempa\@empty - \let\caption@ifempty\@secondoftwo - \else - \expandafter\def\expandafter\caption@tempa\expandafter{% - \caption@car#1\caption@if@empty\caption@nil}% - \def\caption@tempb{\caption@if@empty}% - \ifx\caption@tempa\caption@tempb - \let\caption@ifempty\@secondoftwo - \else - \def\caption@tempb{\ignorespaces}% - \ifx\caption@tempa\caption@tempb - \expandafter\caption@if@empty\expandafter{\@gobble#1}% - \else - \def\caption@tempb{\label}% - \ifx\caption@tempa\caption@tempb - \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}% - \else - \def\caption@tempb{\index}% - \ifx\caption@tempa\caption@tempb - \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}% - \else - \def\caption@tempb{\glossary}% - \ifx\caption@tempa\caption@tempb - \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}% - \else - \let\caption@ifempty\@gobbletwo - \fi - \fi - \fi - \fi - \fi - \fi} -% \end{macrocode} -% \begin{macrocode} -\long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long -% \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\caption@parindent\hangindent\caption@hangindent}% -% \end{macrocode} -% \end{macro} -% -% \subsection{Types \& sub-types} -% -% \begin{macro}{\DeclareCaptionType} -% \changes{v3.1}{2007/08/12}{This macro added} -% \changes{v3.1a}{2007/09/07}{Three optional arguments added} -% \changes{v3.1f}{2007/12/06}{Renamed from \cs{DeclareFloatingEnvironment} to \cs{DeclareCaptionType}} -% \changes{v3.1f}{2007/12/21}{Optional argument revised, uses key-value syntax now} -% \changes{v3.1i}{2008/04/13}{Uses \cs{caption@within@default} now} -% \changes{v3.1i}{2008/08/02}{Support of \cs{float@exts} and \cs{float@addtolists} added} -% \changes{v3.1l}{2010/01/09}{Usage of \cs{caption@DeclareWithinOption} added} -% |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name} -% \begin{macrocode} -\newcommand*\DeclareCaptionType{% - \@testopt\@DeclareCaptionType{}} -\@onlypreamble\DeclareCaptionType -% \end{macrocode} -% \begin{macrocode} -\def\@DeclareCaptionType[#1]#2{% - \def\caption@type{#2}% - \caption@Debug{New type `#2'}% - \newcounter{#2}\@namedef{theH#2}{}% - \KV@caption@DCT@within\caption@within@default - \caption@DeclareWithinOption{#2}% - \KV@caption@DCT@placement{tbp}% - \@ifundefined{c@float@type}% - {\newcounter{float@type}% - \setcounter{float@type}{\@ifundefined{c@figure}14}}% - {}% - \caption@Debug{float type `#2'=\the\value{float@type}}% - \expandafter\xdef\csname ftype@#2\endcsname{\the\value{float@type}}% - \addtocounter{float@type}{\value{float@type}}% - \KV@caption@DCT@fileext{lo#2}% - \@namedef{fnum@#2}{\@nameuse{#2name}\nobreakspace\@nameuse{the#2}}% - \newenvironment{#2}{\@float{#2}}{\end@float}% - \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}% - \expandafter\newcommand\csname listof#2s\endcsname{\caption@listof{#2}}% - \@ifundefined{l@figure}% - {\@namedef{l@#2}{\@dottedtocline{1}{1.5em}{2.3em}}}% - {\expandafter\let\csname l@#2\endcsname\l@figure}% -% \end{macrocode} -% \begin{macrocode} - \expandafter\newcommand\csname #2name\endcsname{}% - \edef\@tempa{\def\noexpand\@tempa{\@car#2\@nil}}% - \uppercase\expandafter{\@tempa}% - \edef\@tempb{\noexpand\g@addto@macro\noexpand\@tempa{\@cdr#2\@nil}}% - \@tempb - \expandafter\let\csname #2name\endcsname\@tempa - \expandafter\newcommand\csname list#2name\endcsname{}% - \expandafter\xdef\csname list#2name\endcsname{List of \@tempa s}% -% \end{macrocode} -% \begin{macrocode} - \@cons\caption@typelist{{#2}}% - \caption@setkeys[caption]{caption@DCT}{#1}% -% \end{macrocode} -% \begin{macrocode} - \@ifundefined{float@exts}{\newtoks\float@exts}{}% - \let\float@do=\relax - \edef\@tempa{\noexpand\float@exts{\the\float@exts\float@do{\@nameuse{ext@#2}}}}% - \@tempa - \@ifundefined{float@addtolists}{% - \newcommand\float@addtolists[1]{% - \def\float@do####1{\addtocontents{####1}{##1}}\the\float@exts}% - \@ifundefined{@chapter}{}{\caption@PatchChapter}}{}% -% \end{macrocode} -% \begin{macrocode} - \@ifnextchar[\@@DeclareCaptionType\relax} -\@onlypreamble\@DeclareCaptionType -% \end{macrocode} -% \begin{macrocode} -\def\@@DeclareCaptionType[#1]{% - \KV@caption@DCT@name{#1}% - \@ifnextchar[\@@@DeclareCaptionType\relax} -\@onlypreamble\@@DeclareCaptionType -% \end{macrocode} -% \begin{macrocode} -\def\@@@DeclareCaptionType[#1]{% - \KV@caption@DCT@listname{#1}} -\@onlypreamble\@@@DeclareCaptionType -% \end{macrocode} -% \begin{macrocode} -\let\DeclareFloatingEnvironment\DeclareCaptionType % old command name -\@onlypreamble\DeclareFloatingEnvironment -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@within@default} -% \changes{v3.1i}{2008/04/13}{This macro added} -% The default `within' value. -% \begin{macrocode} -\newcommand*\caption@within@default{\@ifundefined{c@chapter}{none}{chapter}} -\@onlypreamble\caption@within@default -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@listof} -% \changes{v3.1f}{2007/12/21}{This macro added} -% |\caption@listof|\marg{float type} -% \begin{macrocode} -\newcommand*\caption@listof[1]{% - \begingroup - \expandafter\let\expandafter\listfigurename\csname list#1name\endcsname - \expandafter\let\expandafter\ext@figure\csname ext@#1\endcsname - \let\caption@ORI@starttoc\@starttoc - \renewcommand*\@starttoc[1]{% - \expandafter\caption@ORI@starttoc\expandafter{\ext@figure}}% - \listoffigures - \endgroup} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@typelist} -% An \cs{@elt}-list containing the caption types defined -% with |\Declare|\x|Caption|\x|Type|. -% \begin{macrocode} -\newcommand*\caption@typelist{} -% \end{macrocode} -% \end{macro} -% -% The available \meta{options} are: -% |fileext=|\meta{file extension}, -% |listname=|\meta{list name}, -% |name=|\meta{prosa name}, -% |placement=|\meta{htbp}, -% |within=|\meta{none,chapter,section}, and -% |without|. -% \begin{macrocode} -\define@key{caption@DCT}{fileext}{\@namedef{ext@\caption@type}{#1}} -\@onlypreamble@key{caption@DCT}{fileext} -\define@key{caption@DCT}{listname}{\@namedef{list\caption@type name}{#1}} -\@onlypreamble@key{caption@DCT}{listname} -\define@key{caption@DCT}{name}{\@namedef{\caption@type name}{#1}} -\@onlypreamble@key{caption@DCT}{name} -\define@key{caption@DCT}{placement}{\@namedef{fps@\caption@type}{#1}} -\@onlypreamble@key{caption@DCT}{placement} -\define@key{caption@DCT}{within}{% - \@ifundefined{c@chapter}{}{\@removefromreset\caption@type{chapter}}% - \@removefromreset\caption@type{section}% - \begingroup - \caption@setkeys[caption]{caption@within}{#1}% - \endgroup} -%\@onlypreamble@key{caption@DCT}{within} -\define@key{caption@DCT}{without}{\KV@caption@DCT@within{none}} -%\@onlypreamble@key{caption@DCT}{without} -% \end{macrocode} -% \changes{v3.1k}{2009/03/29}{Bugfix 08-09-25: \texttt{within=section} fixed} -% \begin{macrocode} -\define@key{caption@within}{none}[]{% - \caption@within{}{}} -%\@onlypreamble@key{caption@within}{none} -\define@key{caption@within}{section}[]{% - \@addtoreset\caption@type{section}% - \caption@within{\ifnum\c@section>\z@ \thesection.\fi}{\theHsection.}} -%\@onlypreamble@key{caption@within}{section} -\@ifundefined{c@chapter}{}{% - \define@key{caption@within}{chapter}[]{% - \@addtoreset\caption@type{chapter}% - \caption@within{\ifnum\c@chapter>\z@ \thechapter.\fi}{\theHchapter.}} -}% \@onlypreamble@key{caption@within}{chapter}} -% \end{macrocode} -% \begin{macro}{\caption@within} -% \changes{v3.1f}{2007/12/21}{This macro added} -% |\caption@within|\marg{thecode}\marg{theHcode} -% \begin{macrocode} -\newcommand*\caption@within{% - \expandafter\caption@within@\expandafter{\caption@type}} -%\@onlypreamble\caption@within -\newcommand*\caption@within@[3]{% - \global\@namedef{the#1}{#2\arabic{#1}}% - \@ifundefined{theH#1}\caption@AtBeginDocument\@firstofone - {\global\@namedef{theH#1}{#3\arabic{#1}}}} -%\@onlypreamble\caption@within@ -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@removefromreset} -% \changes{v3.1f}{2007/12/21}{This macro added} -% This code was taken from the \package{remreset} package -% which is part of the `carlisle' package bundle. -% (Copyright 1997 David Carlisle) -% \begin{macrocode} -\providecommand*\@removefromreset[2]{{% - \expandafter\let\csname c@#1\endcsname\@removefromreset - \def\@elt##1{% - \expandafter\ifx\csname c@##1\endcsname\@removefromreset - \else - \noexpand\@elt{##1}% - \fi}% - \expandafter\xdef\csname cl@#2\endcsname{% - \csname cl@#2\endcsname}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@PatchChapter} -% \changes{v3.1i}{2008/08/02}{This macro added} -% We try to patch \cs{@chapter} so \cs{float@addtolists} will be supported. -% (Note: The \KOMAScript\ classes already support \cs{float@addtolists}.) -% \begin{macrocode} -\newcommand*\caption@PatchChapter{% - \providecommand*\@chapterlistsgap{10\p@}% -% \end{macrocode} -% \begin{macrocode} - % report.cls [2005/09/16 v1.4f Standard LaTeX document class] - \caption@patch@chapter{report}{% - \ifnum \c@secnumdepth >\m@ne - \refstepcounter{chapter}% - \typeout{\@chapapp\space\thechapter.}% - \addcontentsline{toc}{chapter}% - {\protect\numberline{\thechapter}##1}% - \else - \addcontentsline{toc}{chapter}{##1}% - \fi - \chaptermark{##1}% - \addtocontents{lof}{\protect\addvspace{10\p@}}% - \addtocontents{lot}{\protect\addvspace{10\p@}}% - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}]% - \else - \@makechapterhead{##2}% - \@afterheading - \fi - }{% - \ifnum \c@secnumdepth >\m@ne - \refstepcounter{chapter}% - \typeout{\@chapapp\space\thechapter.}% - \addcontentsline{toc}{chapter}% - {\protect\numberline{\thechapter}##1}% - \else - \addcontentsline{toc}{chapter}{##1}% - \fi - \chaptermark{##1}% - \ifdim \@chapterlistsgap>\z@ - \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% - \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% - \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% - \fi - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}]% - \else - \@makechapterhead{##2}% - \@afterheading - \fi}% -% \end{macrocode} -% \begin{macrocode} - % book.cls [2005/09/16 v1.4f Standard LaTeX document class] - \caption@patch@chapter{book}{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \refstepcounter{chapter}% - \typeout{\@chapapp\space\thechapter.}% - \addcontentsline{toc}{chapter}% - {\protect\numberline{\thechapter}##1}% - \else - \addcontentsline{toc}{chapter}{##1}% - \fi - \else - \addcontentsline{toc}{chapter}{##1}% - \fi - \chaptermark{##1}% - \addtocontents{lof}{\protect\addvspace{10\p@}}% - \addtocontents{lot}{\protect\addvspace{10\p@}}% - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}]% - \else - \@makechapterhead{##2}% - \@afterheading - \fi - }{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \refstepcounter{chapter}% - \typeout{\@chapapp\space\thechapter.}% - \addcontentsline{toc}{chapter}% - {\protect\numberline{\thechapter}##1}% - \else - \addcontentsline{toc}{chapter}{##1}% - \fi - \else - \addcontentsline{toc}{chapter}{##1}% - \fi - \chaptermark{##1}% - \ifdim \@chapterlistsgap>\z@ - \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% - \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% - \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% - \fi - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}]% - \else - \@makechapterhead{##2}% - \@afterheading - \fi}% -% \end{macrocode} -% \begin{macrocode} - % amsbook.cls [2004/08/06 v2.20] - % smfbook.cls [1999/11/15 v1.2f Classe LaTeX pour les monographies editees par la SMF] - \caption@patch@chapter{ams/smfbook}{% - \refstepcounter{chapter}% - \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty - \else \let\@secnumber\thechapter \fi - \typeout{\chaptername\space\@secnumber}% - \def\@toclevel{0}% - \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{##2}% - \else \@tocwriteb\tocchapter{chapter}{##2}\fi - \chaptermark{##1}% - \addtocontents{lof}{\protect\addvspace{10\p@}}% - \addtocontents{lot}{\protect\addvspace{10\p@}}% - \@makechapterhead{##2}\@afterheading - }{% - \refstepcounter{chapter}% - \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty - \else \let\@secnumber\thechapter \fi - \typeout{\chaptername\space\@secnumber}% - \def\@toclevel{0}% - \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{##2}% - \else \@tocwriteb\tocchapter{chapter}{##2}\fi - \chaptermark{##1}% - \ifdim \@chapterlistsgap>\z@ - \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% - \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% - \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% - \fi - \@makechapterhead{##2}\@afterheading}% -% \end{macrocode} -% \begin{macrocode} - % scrreprt/scrbook.cls - \@ifundefined{KOMAClassName}{}{% - \caption@Debug{document class `\KOMAClassName' detected}% - \let\caption@patch@chapter\@gobblethree}% -% \end{macrocode} -% \begin{macrocode} - % rapport1/3.cls [2004/06/07 v2.1a NTG LaTeX document class] - \caption@patch@chapter{rapport}{% - \ifnum \c@secnumdepth >\m@ne - \refstepcounter{chapter}% - \typeout{\@chapapp\space\thechapter.}% - \addcontentsline{toc}{chapter}% - {\protect\numberline{\thechapter}\toc@font0 ##1}% - \else - \addcontentsline{toc}{chapter}{\toc@font0 ##1}% - \fi - \chaptermark{##1}% - \addtocontents{lof}{\protect\addvspace{10\p@}}% - \addtocontents{lot}{\protect\addvspace{10\p@}}% - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}]% - \else - \@makechapterhead{##2}% - \@afterheading - \fi - }{% - \ifnum \c@secnumdepth >\m@ne - \refstepcounter{chapter}% - \typeout{\@chapapp\space\thechapter.}% - \addcontentsline{toc}{chapter}% - {\protect\numberline{\thechapter}\toc@font0 ##1}% - \else - \addcontentsline{toc}{chapter}{\toc@font0 ##1}% - \fi - \chaptermark{##1}% - \ifdim \@chapterlistsgap>\z@ - \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% - \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% - \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% - \fi - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}]% - \else - \@makechapterhead{##2}% - \@afterheading - \fi}% -% \end{macrocode} -% \begin{macrocode} - % boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class] - \caption@patch@chapter{boek}{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \refstepcounter{chapter}% - \typeout{\@chapapp\space\thechapter.}% - \addcontentsline{toc}{chapter}% - {\protect\numberline{\thechapter}\toc@font0 ##1}% - \else - \addcontentsline{toc}{chapter}{\toc@font0 ##1}% - \fi - \else - \addcontentsline{toc}{chapter}{\toc@font0 ##1}% - \fi - \chaptermark{##1}% - \addtocontents{lof}{\protect\addvspace{10\p@}}% - \addtocontents{lot}{\protect\addvspace{10\p@}}% - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}]% - \else - \@makechapterhead{##2}% - \@afterheading - \fi - }{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \refstepcounter{chapter}% - \typeout{\@chapapp\space\thechapter.}% - \addcontentsline{toc}{chapter}% - {\protect\numberline{\thechapter}\toc@font0 ##1}% - \else - \addcontentsline{toc}{chapter}{\toc@font0 ##1}% - \fi - \else - \addcontentsline{toc}{chapter}{\toc@font0 ##1}% - \fi - \chaptermark{##1}% - \ifdim \@chapterlistsgap>\z@ - \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% - \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% - \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% - \fi - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}]% - \else - \@makechapterhead{##2}% - \@afterheading - \fi}% -% \end{macrocode} -% \begin{macrocode} - % thesis.cls [1996/25/01 1.0g LaTeX document class (wm).] - \caption@patch@chapter{thesis}{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \refstepcounter{chapter}% - \typeout{\chaptername\space\thechapter.} - \if@thema - \ifx\@shortauthor\@empty - \addcontentsline{toc}{chapter}{% - \protect\numberline{\thechapter.}##1}% - \else - \addcontentsline{toc}{chapter}{% - \protect\numberline{\thechapter.}% - \@shortauthor\hfill\mbox{}\vskip\normallineskip ##1}% - \fi - \else - \addcontentsline{toc}{chapter}{% - \protect\numberline{\thechapter.}##1}% - \fi - \else - \addcontentsline{toc}{chapter}{##1} - \fi - \else - \addcontentsline{toc}{chapter}{##1} - \fi - \chaptermark{##1} - \addtocontents{lof}{\protect\addvspace{10pt}} - \addtocontents{lot}{\protect\addvspace{10pt}} - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}] - \else - \@makechapterhead{##2} - \@afterheading - \fi - }{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \refstepcounter{chapter}% - \typeout{\chaptername\space\thechapter.}% - \if@thema - \ifx\@shortauthor\@empty - \addcontentsline{toc}{chapter}{% - \protect\numberline{\thechapter.}##1}% - \else - \addcontentsline{toc}{chapter}{% - \protect\numberline{\thechapter.}% - \@shortauthor\hfill\mbox{}\vskip\normallineskip ##1}% - \fi - \else - \addcontentsline{toc}{chapter}{% - \protect\numberline{\thechapter.}##1}% - \fi - \else - \addcontentsline{toc}{chapter}{##1}% - \fi - \else - \addcontentsline{toc}{chapter}{##1}% - \fi - \chaptermark{##1}% - \ifdim \@chapterlistsgap>\z@ - \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% - \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% - \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% - \fi - \if@twocolumn - \@topnewpage[\@makechapterhead{##2}]% - \else - \@makechapterhead{##2}% - \@afterheading - \fi}% -% \end{macrocode} -% \begin{macrocode} - \ifx\caption@patch@chapter\@gobblethree \else - \caption@Debug{% - Unsupported document class detected,\MessageBreak - or \noexpand\@chapter was redefined by another package}% - \fi - \let\caption@PatchChapter\@undefined} -%\@onlypreamble\caption@PatchChapter -% \end{macrocode} -% \begin{macrocode} -\newcommand\caption@patch@chapter[3]{% - \begingroup -% \let\if@twocolumn\iffalse - \let\if@mainmatter\iffalse - \let\if@thema\iffalse - \def\@tempa[##1]##2{#2}% - \ifx\@tempa\@chapter - \caption@Debug{document class `#1' detected}% - \gdef\@chapter[##1]##2{#3}% - \global\let\caption@patch@chapter\@gobblethree - \fi - \endgroup} -%\@onlypreamble\caption@patch@chapter -% \end{macrocode} -% \begin{macrocode} -\long\def \@gobblethree #1#2#3{} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@stpelt} -% We patch \cs{@stpelt} so a list of `connected' counters will be reset, too. -% (Like \cs{stepcounter} does in |ltcounts.dtx|.) -% \begin{macrocode} -\newcommand*\caption@patch@stpelt{% - \let\caption@stpelt\@stpelt - \def\@stpelt##1{% - \caption@stpelt{##1}% - \begingroup - \let\@elt\caption@stpelt - \csname caption@cl@##1\endcsname - \endgroup}% - \let\caption@patch@stpelt\relax} -\@onlypreamble\caption@patch@stpelt -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@addtoreset} -% \changes{v3.1k}{2009/10/09}{This macro added} -% Like \cs{@addtoreset} from |ltcounts.dtx| -% \begin{macrocode} -\newcommand*\caption@addtoreset[2]{% - \caption@patch@stpelt - \@ifundefined{caption@cl@#2}{\@namedef{caption@cl@#2}{}}{}% - \expandafter\@cons\csname caption@cl@#2\endcsname{{#1}}} -\@onlypreamble\caption@addtoreset -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@addtoreset} -% \changes{v3.1k}{2009/10/09}{This macro added} -% Like \cs{@removefromreset} from |remreset.sty| -% \begin{macrocode} -\newcommand*\caption@removefromreset[2]{% - \begingroup - \expandafter\let\csname c@#1\endcsname\caption@removefromreset - \def\@elt##1{% - \expandafter\ifx\csname c@##1\endcsname\caption@removefromreset - \else - \noexpand\@elt{##1}% - \fi}% - \expandafter\xdef\csname caption@cl@#2\endcsname{% - \csname caption@cl@#2\endcsname}% - \endgroup} -\@onlypreamble\caption@removefromreset -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\DeclareCaptionSubType} -% \changes{v3.1f}{2007/11/16}{This macro added} -% \changes{v3.1g}{2008/03/11}{Bugfix: \cs{subfigurename} will be defined now} -% \changes{v3.1k}{2009/10/09}{Bugfix 08-10-01: Usage of \cs{caption@addtoreset} added} -% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\ -% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\par -% The starred variant provides the numbering format -% \meta{type}|.|\meta{subtype} while the non-starred variant simply -% uses \meta{subtype}. -% \begin{macrocode} -\newcommand*\DeclareCaptionSubType{% - \caption@teststar\@DeclareCaptionSubType\@firstoftwo\@secondoftwo} -\@onlypreamble\DeclareCaptionSubType -% \end{macrocode} -% \begin{macrocode} -\newcommand*\@DeclareCaptionSubType[1]{% - \@testopt{\@@DeclareCaptionSubType{#1}}{alph}} -\@onlypreamble\@DeclareCaptionSubType -% \end{macrocode} -% \begin{macrocode} -\def\@@DeclareCaptionSubType#1[#2]#3{% - \@ifundefined{c@#3}% - {\caption@Error{No float type '#3' defined}}% -% \end{macrocode} -% \begin{macrocode} - {\@ifundefined{c@sub#3}% - {\caption@Debug{New subtype `sub#3'}% - \newcounter{sub#3}% - \caption@addtoreset{sub#3}{#3}% - \@namedef{ext@sub#3}{\csname ext@#3\endcsname}% - \@ifundefined{l@chapter}% - {\edef\@tempa{\expandafter\expandafter\expandafter\noexpand - \expandafter\@car\l@subsubsection\@nil}% - \def\@tempb{\@dottedtocline}% - \ifx\@tempa\@tempb % \l@subsubsection starts with \@dottedtocline - \expandafter\edef\csname l@sub#3\endcsname{% - \noexpand\@dottedtocline{2}% - \expandafter\expandafter\expandafter\noexpand - \expandafter\@gobbletwo\l@subsubsection}% - \else - \@namedef{l@sub#3}{\@dottedtocline{2}{3.8em}{3.2em}}% - \fi}% - {\expandafter\let\csname l@sub#3\endcsname\l@subsection}% - \@cons\caption@subtypelist{{#3}}}% - {\caption@Debug{Modify caption `sub#3'}}% -% \end{macrocode} -% \begin{macrocode} - \@namedef{sub#3name}{}% - \@namedef{sub#3autorefname}{\csname #3name\endcsname}% - #1% is \@firstoftwo in star form, and \@secondoftwo otherwise - {\@namedef{p@sub#3}{}% - \@namedef{thesub#3}{\csname the#3\endcsname.\@nameuse{#2}{sub#3}}}% - {\@namedef{p@sub#3}{\csname the#3\endcsname}% - \@namedef{thesub#3}{\@nameuse{#2}{sub#3}}}% - \@namedef{theHsub#3}{\csname theH#3\endcsname.\arabic{sub#3}}% - }} -% \end{macrocode} -% \begin{macrocode} -\@onlypreamble\@@DeclareCaptionSubType -% \end{macrocode} -% \end{macro} -% \begin{macro}{\caption@subtypelist} -% An \cs{@elt}-list containing the subtypes defined -% with |\Declare|\x|Caption|\x|Sub|\x|Type|. -% \begin{macrocode} -\newcommand*\caption@subtypelist{} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@For} -% \changes{v3.1a}{2007/09/07}{This macro added} -% \changes{v3.1f}{2007/11/16}{Renamed from \cs{ForFloatingEnvironments} to \cs{caption@For}} -% |\caption@For|\marg{elt-list}\marg{code with \#1}\\ -% |\caption@For*|\marg{elt-list}\marg{code with \#1} -% \begin{macrocode} -\newcommand*\caption@For{\caption@withoptargs\caption@@For} -%\@onlypreamble\caption@For -% \end{macrocode} -% \begin{macrocode} -\newcommand\caption@@For[3]{% - \caption@AtBeginDocument#1{% - \def\@elt##1{#3}% - \@nameuse{caption@#2}% - \let\@elt\relax}}% -%\@onlypreamble\caption@@For -% \end{macrocode} -% \end{macro} -% -% \subsection{subfig package adaptions} -% \changes{v3.0k}{2007/01/07}{Very small bugfix of \package{subfig} package added} -% \changes{v3.0l}{2007/01/31}{Bugfix of subfig package moved from package (kernel)} -% \changes{v3.1}{2007/07/07}{Several adaptions to the \package{subfig} package added} -% \changes{v3.1l}{2010/01/09}{Patch for better hyperref support added to \package{subfig} package adaptions} -% \changes{v3.1m}{2010/01/14}{Last patch didn't worked without hyperref; fixed} -% -% We have to make several adaptions to \thispackage~\version{3.1} here. -% \begin{macrocode} -\caption@AtBeginDocument{% - \def\@tempa{\@ifstar\sf@@subref\sf@subref}% - \ifx\subref\@tempa - \PackageInfo{caption3}{subfig package 1.2 or 1.3 is loaded\@gobble}% -% \end{macrocode} -% \begin{macrocode} - \let\caption@setfloattype\@gobble - \let\@dottedxxxline\sf@NEW@dottedxxxline - \let\sf@subfloat\sf@NEW@subfloat -% \end{macrocode} -% This is a bugfix for \version{1.2} and \version{1.3} or the -% \package{subfig} package, making \cs{subref} robust, so it works in -% captions, too: -% \begin{macrocode} - \DeclareRobustCommand*\subref{\@ifstar\sf@@subref\sf@subref}% -% \end{macrocode} -% This patch should provide better hyperref support: -% \begin{macrocode} - \@ifpackageloaded{hyperref}{% - \renewcommand*\sf@updatecaptionlist[4]{% - \xdef\sf@captionlist{% - \sf@captionlist,% - {\protect\numberline{\@subcaplabel}\noexpand{\ignorespaces #2}}% - {\@currentHref}}}% - }{}% -% \end{macrocode} -% \begin{macrocode} - \fi - \let\sf@NEW@dottedxxxline\@undefined - \let\sf@NEW@subfloat\@undefined} -% \end{macrocode} -% \begin{macrocode} -\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{% - \begingroup - \caption@setfloattype{#1}% - \caption@setoptions{subfloat}% - \caption@setoptions{sub#1}% - \ifnum #3>\@nameuse{c@#2depth}\else - \@dottedtocline{\z@}{#4}{#5}{#6}{#7}% - \fi - \endgroup} -% \end{macrocode} -% \begin{macrocode} -\def\sf@NEW@subfloat{% - \begingroup - \caption@setfloattype\@captype - \sf@ifpositiontop{% - \maincaptiontoptrue - }{% - \maincaptiontopfalse - }% - \caption@setoptions{subfloat}% - \caption@setoptions{sub\@captype}% - \let\sf@oldlabel=\label - \let\label=\subfloat@label - \ifmaincaptiontop\else - \advance\@nameuse{c@\@captype}\@ne - \fi - \refstepcounter{sub\@captype}% - \setcounter{sub\@captype @save}{\value{sub\@captype}}% - \@ifnextchar [% %] match left bracket - {\sf@@subfloat}% - {\sf@@subfloat[\@empty]}} -% \end{macrocode} -% -% \iffalse -% -% \fi -% -% \iffalse -% --------------------------------------------------------------------------- % -% \fi -% -% \clearpage -% \section{Main package} -% \iffalse -%<*package> -% \fi -% -% \subsection{Identification} -% -% \begin{macrocode} -\NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2010/01/09 v3.1m Customizing captions (AR)] -%\@ifundefined{PackageRedefines}{}{\PackageRedefines{caption}{caption}} -% \end{macrocode} -% -% \begin{macro}{\caption@Info} -% \Note{The \cs{@gobble} at the end of the 2nd argument of -% \cs{PackageInfo} suppresses the line number info. -% See TLC2\cite{TLC2}, A.4.7, p885 for details.} -% \begin{macrocode} -\newcommand*\caption@Info[1]{\PackageInfo{caption}{#1\@gobble}} -\@onlypreamble\caption@Info -% \end{macrocode} -% \end{macro} -% -% \subsection{Loading the kernel} -% -% \begin{macrocode} -\RequirePackage{caption3}[2008/08/24] % needs v3.1j or newer -% \end{macrocode} -% -% \subsection{Check against incompatible document classes} -% -% \begin{macrocode} -\caption@ifbool{documentclass}{}{% - \caption@WarningNoLine{% - Unsupported document class (or package) detected,\MessageBreak - usage of the caption package is not recommended}% - \caption@Info{\string\@makecaption\space=\space\meaning\@makecaption}% -} -% \end{macrocode} -% -% \subsection{Check against incompatible packages} -% -% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added} -% \begin{macrocode} -\@ifpackageloaded{caption2}{% - \caption@Error{% - You can't use both, the (obsolete) caption2 *and*\MessageBreak - the (current) caption package}% - \endinput -}{} -% \end{macrocode} -% -% \changes{v3.1}{2007/06/15}{Check against incompatible \package{ftcap} package added} -% \changes{v3.1}{2007/06/15}{Check against incompatible \package{nonfloat} package added} -% \changes{v3.1}{2007/06/18}{Check against incompatible \package{topcapt} package added} -% \begin{macrocode} -\caption@AtBeginDocument{% - \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}% - \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}% - \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}} -% \end{macrocode} -% \begin{macro}{\caption@DisablePositionOption} -% \changes{v3.1g}{2008/03/20}{\texttt{position=b} added} -% \changes{v3.1h}{2008/03/29}{% -% Name changed from \cs{caption@IncompatiblePackage} to \cs{caption@DisablePositionOption}; -% moved from package to kernel; disables the `position' option now instead of issuing a warning} -% |\caption@DisablePositionOption|\marg{package}\par -% disables the `position' option. -% \begin{macrocode} -\newcommand*\caption@DisablePositionOption[1]{% - \caption@Info{% - `#1' package detected; setting `position=b' for compatibility reasons}% - \caption@setposition b% -% \end{macrocode} -% \begin{macrocode} - \DeclareCaptionOption{position}{% - \caption@Error{Usage of the `position' option is incompatible\MessageBreak - to the `#1' package}}} -% \end{macrocode} -% \begin{macrocode} -\@onlypreamble\caption@DisablePositionOption -% \end{macrocode} -% \end{macro} -% -% \subsection{Declaration of options} -% -% \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}} -\@onlypreamble@key{caption}{figureposition} -% \end{macrocode} -% \begin{macrocode} -\DeclareCaptionOption{tableposition}{% - \captionsetup*[table]{position=#1}} -\@onlypreamble@key{caption}{tableposition} -% \end{macrocode} -% -% \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added} -% \changes{v3.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written} -% \changes{v3.1f}{2007/11/18}{Options \opt{figurename} and \opt{tablename} are now -% available after the document preamble, too.} -% \changes{v3.1f}{2007/11/18}{Option \opt{name} added} -% \begin{macrocode} -\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}} -\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}} -\DeclareCaptionOption{name}{\caption@setname\@captype{#1}} -% \end{macrocode} -% -% \changes{v3.1g}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added} -% \begin{macrocode} -\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}} -\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}} -% \end{macrocode} -% -% \begin{macro}{\caption@SetName} -% \changes{v3.1}{2007/07/04}{This macro added} -% \changes{v3.1f}{2007/11/18}{After-preamble variant added} -% \changes{v3.1g}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}} -% \changes{v3.1i}{2008/08/02}{Bugfix: Works now without \cs{addto}, too} -% |\caption@SetName|\marg{cmd}\marg{value} -% \begin{macrocode} -\newcommand*\caption@SetName[2]{% - \caption@setname{#1}{#2}% - \begingroup - \@ifundefined{languagename}{}{% - \@ifundefined{captions\languagename}{}{% - \expandafter\g@addto@macro\csname captions\languagename\endcsname - {\caption@setname{#1}{#2}}}}% - \endgroup} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@setname[2]{\@namedef{#1name}{#2}} -% \end{macrocode} -% \begin{macrocode} -\caption@AtBeginDocument{\let\caption@SetName\caption@setname} -% \end{macrocode} -% \end{macro} -% -% \changes{v3.1f}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added} -% \changes{v3.1i}{2008/04/13}{Option \opt{within} added} -% \changes{v3.1l}{2010/01/09}{The \opt{within} options are now available within the document, too} -% \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined floats -% declared with \cs{DeclareCaptionType}, too} -% -% \begin{macro}{\caption@DeclareWithinOption} -% \changes{v3.1l}{2010/01/09}{This macro and its usage added} -% \begin{macrocode} -\newcommand*\caption@DeclareWithinOption[1]{% - \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}% - \DeclareCaptionOption{#1without}{\caption@Within{#1}{none}}} -% \end{macrocode} -% \end{macro} -% \begin{macrocode} -\caption@DeclareWithinOption{figure} -\caption@DeclareWithinOption{table} -% \end{macrocode} -% \begin{macrocode} -\DeclareCaptionOption{within}{% - \@ifundefined{c@figure}{}{\caption@Within{figure}{#1}}% - \@ifundefined{c@table}{}{\caption@Within{table}{#1}}% - \caption@For{typelist}{\caption@Within{##1}{#1}}% - \def\caption@within@default{#1}} -\DeclareCaptionOption{without}{\KV@caption@within{none}} -% \end{macrocode} -% \begin{macro}{\caption@within} -% \changes{v3.1}{2007/12/21}{This macro added} -% \begin{macrocode} -\newcommand*\caption@Within[1]{\def\caption@type{#1}\KV@caption@DCT@within} -% \end{macrocode} -% \end{macro} -% -% \subsubsection{Miscellaneous options} -% -% \begin{macrocode} -\DeclareCaptionOption*{config}[caption]{% - \InputIfFileExists{#1.cfg}% - {\typeout{*** Local configuration file #1.cfg used ***}}% - {\caption@Warning{Configuration file #1.cfg not found}}} -% \end{macrocode} -% -% \changes{v3.1f}{2007/11/28}{Option \opt{@minipage=} added} -% \begin{macrocode} -\DeclareCaptionOption{@minipage}{% - \caption@ifinlist{#1}{auto,default}% - {\let\caption@if@minipage\@gobbletwo}% - {\caption@set@bool\caption@if@minipage{#1}}} -\captionsetup{@minipage=default} -% \end{macrocode} -% -% \subsubsection{caption v1.x compatibility options} -% \changes{v3.1}{2007/07/21}{Option `compatibility' added} -% \changes{v3.1}{2007/09/01}{caption v1.x compatibility options revised} -% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v1.x$ compatibility options} -% -% \begin{macrocode} -\DeclareCaptionOption{compatibility}[1]{\caption@setbool{compatibility}{#1}} -\@onlypreamble@key{caption}{compatibility} -% \end{macrocode} -% -% \begin{macrocode} -\DeclareCaptionOptionNoValue*{normal}{% - \caption@setformat{plain}% - \caption@setjustification{justified}} -\DeclareCaptionOptionNoValue*{isu}{% - \caption@setformat{hang}% - \caption@setjustification{justified}} -\DeclareCaptionOptionNoValue*{hang}{% - \caption@setformat{hang}% - \caption@setjustification{justified}} -\DeclareCaptionOptionNoValue*{center}{% - \caption@setformat{plain}% - \caption@setjustification{centering}} -\DeclareCaptionOptionNoValue*{anne}{% - \caption@setformat{plain}% - \caption@setjustification{centerlast}} -\DeclareCaptionOptionNoValue*{centerlast}{% - \caption@setformat{plain}% - \caption@setjustification{centerlast}} -% \end{macrocode} -% -% \begin{macrocode} -\DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}} -\DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}} -\DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}} -\DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}} -\DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}} -\DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}} -% \end{macrocode} -% -% \begin{macrocode} -\DeclareCaptionOptionNoValue*{up}{\l@addto@macro\captionlabelfont\upshape} -\DeclareCaptionOptionNoValue*{it}{\l@addto@macro\captionlabelfont\itshape} -\DeclareCaptionOptionNoValue*{sl}{\l@addto@macro\captionlabelfont\slshape} -\DeclareCaptionOptionNoValue*{sc}{\l@addto@macro\captionlabelfont\scshape} -\DeclareCaptionOptionNoValue*{md}{\l@addto@macro\captionlabelfont\mdseries} -\DeclareCaptionOptionNoValue*{bf}{\l@addto@macro\captionlabelfont\bfseries} -\DeclareCaptionOptionNoValue*{rm}{\l@addto@macro\captionlabelfont\rmfamily} -\DeclareCaptionOptionNoValue*{sf}{\l@addto@macro\captionlabelfont\sffamily} -\DeclareCaptionOptionNoValue*{tt}{\l@addto@macro\captionlabelfont\ttfamily} -% \end{macrocode} -% -% \begin{macrocode} -\DeclareCaptionOptionNoValue*{nooneline}{\caption@setbool{slc}{0}} -% \end{macrocode} -% -% \begin{macrocode} -\caption@setbool{ruled}{0} -\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}} -% \end{macrocode} -% -% \subsubsection{caption2 v2.x compatibility options} -% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added} -% \changes{v3.1}{2007/09/01}{caption2 v2.x compatibility options revised} -% \changes{v3.1d}{2007/10/24}{Bugfix 07-10-24 in caption v2.x$ compatibility options} -% -% \begin{macrocode} -\DeclareCaptionOptionNoValue*{flushleft}{% - \caption@setformat{plain}% - \caption@setjustification{raggedright}} -\DeclareCaptionOptionNoValue*{flushright}{% - \caption@setformat{plain}% - \caption@setjustification{raggedleft}} -% \end{macrocode} -% \begin{macrocode} -\DeclareCaptionOptionNoValue*{oneline}{\caption@setbool{slc}{1}} -% \end{macrocode} -% \begin{macrocode} -\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{% - \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}} -% \end{macrocode} -% -% \subsubsection{Obsolete caption v3.0 options} -% \changes{v3.1}{2007/05/07}{Package option \opt{caption} marked as obsolete, -% gives error now} -% -% \begin{macrocode} -\DeclareCaptionOption*{caption}{% - \caption@setbool{temp}{#1}% - \caption@ifbool{temp}{}{% - \caption@Error{% - The package option `caption=#1' is obsolete.\MessageBreak - Please pass this option to the subfig package instead\MessageBreak - and do *not* load the caption package anymore}}} -% \end{macrocode} -% -% \subsubsection{fltpage package support options} -% -% \changes{v3.1}{2007/09/01}{Options `FPlist' \& `FPref' added} -% With these options is controlled where the list-of entry and |\ref| resp. -% |\pageref| or |\autoref| will link to. -% Defaults are |FPlist=caption| and |FPref=figure| which is inconsistent, -% but compatible to the usual behaviour of the \package{fltpage} package. -% \begin{macrocode} -\DeclareCaptionOption{FPlist}[1]{\caption@setFPoption{list}{#1}} -\DeclareCaptionOption{FPref}[1]{\caption@setFPoption{ref}{#1}} -\@onlypreamble@key{caption}{FPlist} -\@onlypreamble@key{caption}{FPref} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@setFPoption[2]{% - \edef\caption@tempa{\@car#2\@nil}% - \caption@setbool{FP#1cap}{\if c\caption@tempa 1\else 0\fi}} -\@onlypreamble\caption@setFPoption -% \end{macrocode} -% \begin{macrocode} -\captionsetup{FPlist=caption,FPref=figure} -% \end{macrocode} -% -% \subsubsection{hyperref package support options} -% -% \changes{v3.1}{2007/06/21}{Options `hypcap' \& `hypcapspace' added} -% With |hypcap=off| one can turn the \package{hypcap} support off -% (default is |on|). -% \begin{macrocode} -\DeclareCaptionOption{hypcap}[1]{\caption@setbool{hypcap}{#1}} -\DeclareCaptionOption{hypcapspace}{\def\caption@hypcapspace{#1}} -% \end{macrocode} -% \begin{macrocode} -\captionsetup{hypcap=1,hypcapspace=.5\baselineskip} -% \end{macrocode} -% -% \subsection{\AmS{} \& \SmF{} document classes support} -% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ document classes support added (package)} -% -% \begin{macrocode} -\caption@ifamsclass{% - \caption@Info{AMS or SMF document class}% -% \end{macrocode} -% \begin{macrocode} - \setlength\belowcaptionskip{0pt}% set to 12pt by AMS class -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsection{\KOMAScript{} document classes support} -% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added (package)} -% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added (package)} -% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added (package)} -% \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised (package)} -% \changes{v3.1}{2007/03/17}{\KOMAScript\ compatibility options removed (package)} -% \changes{v3.1}{2007/04/05}{\KOMAScript\ compatibility revised \& enhanced (package)} -% -% \begin{macrocode} -\caption@ifkomaclass{% - \caption@Info{KOMA-Script document class}% -% \end{macrocode} -% -% Here we emulate the caption related commands and take over the caption -% related settings from the \KOMAScript\ classes. -% -% \begin{macro}{\@tablecaptionabovetrue} -% \begin{macro}{\@tablecaptionabovefalse} -% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}} -% \begin{macrocode} - \g@addto@macro\@tablecaptionabovetrue{\captionsetup*[table]{position=t}} - \g@addto@macro\@tablecaptionabovefalse{\captionsetup*[table]{position=b}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macrocode} - \if@tablecaptionabove - \@tablecaptionabovetrue - \else - \@tablecaptionabovefalse - \fi -% \end{macrocode} -% -% \begin{macro}{\onelinecaptionstrue} -% \begin{macro}{\onelinecaptionsfalse} -% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}} -% \begin{macrocode} - \g@addto@macro\onelinecaptionstrue{\let\caption@ifslc\@firstoftwo} - \g@addto@macro\onelinecaptionsfalse{\let\caption@ifslc\@secondoftwo} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macrocode} - \ifonelinecaptions - \onelinecaptionstrue - \else - \onelinecaptionsfalse - \fi -% \end{macrocode} -% -% \begin{macro}{\@captionabovetrue} -% \begin{macro}{\@captionabovefalse} -% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21: -% \cs{let}\cs{caption@setposition}\cs{@gobble} added} -% \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed} -% \changes{v3.1}{2007/03/31}{We redefine \cs{captionabovetrue/false} now -% instead of \cs{captionabove/below}} -% \changes{v3.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}} -% \changes{v3.1k}{2009/10/09}{\opt{figureposition} and \opt{tableposition} will issue a warning now} -% Please note that these are stronger than the \opt{position} setting, therefore we -% override the options \opt{figureposition} and \opt{tableposition} to typeout a warning. -% \begin{macrocode} - \g@addto@macro\@captionabovetrue{\let\caption@position\@firstoftwo} - \g@addto@macro\@captionabovefalse{\let\caption@position\@secondoftwo} -% \end{macrocode} -% \begin{macrocode} - \DeclareCaptionOption{figureposition}{% - \caption@WarningNoLine{Option `figureposition=#1' has no effect\MessageBreak - when used with a KOMA script document class}} - \DeclareCaptionOption{tableposition}{% - \caption@WarningNoLine{Option `tableposition=#1' has no effect\MessageBreak - when used with a KOMA script document class}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\setcapindent} -% \begin{macrocode} - \let\caption@KOMA@setcapindent\@setcapindent - \renewcommand*\@setcapindent[1]{% - \caption@KOMA@setcapindent{#1}\caption@setcapindent} -% \end{macrocode} -% \begin{macrocode} - \let\caption@KOMA@@setcapindent\@@setcapindent - \renewcommand*\@@setcapindent[1]{% - \caption@KOMA@@setcapindent{#1}\caption@setcapindent} -% \end{macrocode} -% \begin{macrocode} - \newcommand*\caption@setcapindent{% - \captionsetup{indent=\ifdim\cap@indent<\z@\z@\else\cap@indent\fi}} -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} - \@ifundefined{cap@indent}{}{\caption@setcapindent} -% \end{macrocode} -% -% \begin{macro}{\setcapwidth} -% \Note{The optional argument of \cs{setcapwidth} if not supported (yet), -% so we issue a warning if used. -% (Since this does not seem to have an negative effect when used -% by the \texttt{captionbeside} environment, we suppress the warning here.)} -% \begin{macrocode} - \expandafter\let\expandafter\caption@KOMA@setcapwidth - \csname\string\setcapwidth\endcsname - \@namedef{\string\setcapwidth}[#1]#2{% - \caption@KOMA@setcapwidth[#1]{#2}\caption@setcapwidth{#1}} -% \end{macrocode} -% \begin{macrocode} - \newcommand*\caption@setcapwidth[1]{% - \ifx\\#1\\\else - \@ifundefined{cap@margin}{}{% - \def\@tempa{captionbeside}% - \ifx\@tempa\@currenvir\else\caption@Warning{% - Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}% - \fi}% - \fi - \captionsetup{width=\cap@width}} -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} - \def\caption@tempa{\hsize}% - \ifx\caption@tempa\cap@width \else - \caption@setcapwidth{?} - \fi -% \end{macrocode} -% -% \begin{macro}{\setcapmargin} -% \begin{macrocode} - \expandafter\let\expandafter\caption@KOMA@setcapmargin - \csname\string\@setcapmargin\endcsname - \@namedef{\string\@setcapmargin}[#1]#2{% - \caption@KOMA@setcapmargin[#1]{#2}\caption@setcapmargin} -% \end{macrocode} -% \begin{macrocode} - \expandafter\let\expandafter\caption@KOMA@@setcapmargin - \csname\string\@@setcapmargin\endcsname - \@namedef{\string\@@setcapmargin}[#1]#2{% - \caption@KOMA@@setcapmargin[#1]{#2}\caption@setcapmargin} -% \end{macrocode} -% \begin{macrocode} - \newcommand*\caption@setcapmargin{% - \begingroup - \let\onelinecaptionsfalse\relax - \def\@twoside{0}% - \def\if@twoside{\def\@twoside{1}\iffalse}% - \cap@margin - \def\@tempa{\endgroup}% - \ifx\cap@left\hfill\else\ifx\cap@right\hfill\else - \def\hspace##1##{\@firstofone}% - \edef\@tempa{\endgroup - \noexpand\captionsetup{% - twoside=\@twoside,slc=0,% - margin={\cap@left,\cap@right}}}% - \fi\fi - \@tempa} -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} - \ifx\cap@margin\relax \else - \caption@setcapmargin - \fi -% \end{macrocode} -% -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsection{Processing of options} -% -% \changes{v3.0m}{2007/03/04}{Verbose option added (package)} -% \changes{v3.1}{2007/07/02}{Verbose option removed from package} -% -% \changes{v3.1}{2007/03/17}{We do not process global options anymore} -% \begin{macrocode} -\caption@ProcessOptions*{caption} -% \end{macrocode} -% -% \subsection{\cs{captionof} and \cs{captionlistentry}} -% -% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added} -% \changes{v3.1}{2007/06/25}{Option \opt{type*=} added} -% \changes{v3.1f}{2007/11/16}{Option \opt{subtype} \& \opt{subtype*} added} -% -% \begin{macrocode} -\caption@AtBeginDocument{% -% \end{macrocode} -% \begin{macrocode} - \DeclareCaptionOption{type}{\caption@settype{#1}}% - \DeclareCaptionOption{type*}{\caption@settype*{#1}}% -% \end{macrocode} -% \begin{macrocode} - \DeclareCaptionOption{subtype}[sub\@captype]{\caption@setsubtype{#1}}% - \DeclareCaptionOption{subtype*}[sub\@captype]{\caption@setsubtype*{#1}}% -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \emph{Important Note:} -% Like |\captionof| the option |type=| should only be used inside a -% group, box, or environment and does not check if the argument is a valid -% floating environment or not. -% -% \begin{macro}{\caption@settype} -% \changes{v3.1}{2007/05/09}{This macro added} -% \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added} -% \changes{v3.1d}{2007/10/23}{Error message for \cs{caption@checkgrouplevel} revised} -% \changes{v3.1f}{2007/11/16}{\cs{caption@setsubtype} added} -% \changes{v3.1f}{2007/12/03}{Crappy \cs{caption@iftypewarning} replaced} -% \changes{v3.1g}{2008/01/12}{Usage of \cs{ifcaptionsetup@star} added} -% |\caption@settype*|\marg{type}\par -% sets |\@captype| and executes the options associated with it -% (using |\caption@setoptions|). -% Furthermore we check |\currentgrouplevel| (if avail), -% redefine |\@currentlabel| so a |\label| before |\caption| will result -% in a hint instead of a wrong reference, and -% use the macro |\caption@|(|sub|)|typehook| (which will be used by our -% \package{float} package support).\par -% The non-starred version sets a \package{hyperref} anchor additionally -% (if |hypcap=true| and the \package{hypcap} package is not loaded). -% \begin{macrocode} -\newcommand*\caption@settype{% - \caption@@settype{}} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@setsubtype{% - \caption@iftype - {\caption@@settype{sub}}% - {\caption@Error{Option `subtype=' outside float}}}% -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@@settype[1]{% - \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@@@settype[3]{% -% #1 = "" or "sub" -% #2 = \@firstoftwo in star form, \@secondoftwo otherwise -% #3 = , e.g. "figure" or "table" - \@ifundefined{c@#3}% - {\caption@Error{No float type '#3' defined}}% - {\caption@Debug{#1type=#3}% - \caption@checkgrouplevel{#1}{% - \captionsetup{#1type#2*\@empty=...}#2{ or - \@backslashchar#1captionof}{}}% -% \end{macrocode} -% \begin{macrocode} - \edef\caption@tempa{#3}% - \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else - \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi - \fi - \expandafter\let\csname @#1captype\endcsname\caption@tempa -% \end{macrocode} -% \begin{macrocode} - \@nameuse{caption@#1typehook}% -% \end{macrocode} -% \begin{macrocode} - \caption@setoptions{#3}% - \ifx\caption@opt\relax - \@nameundef{caption@#1type@warning}% - \else - \@namedef{caption@#1type@warning}{\caption@Warning{% - The #1caption type was already set to - `\csname @#1captype\endcsname'\MessageBreak}}% - \fi -% \end{macrocode} -% \begin{macrocode} - \let\caption@ifrefstepcounter\@secondoftwo - #2{}{% - \let\@currentlabel\caption@undefinedlabel -% \let\@currentHlabel\@undefined - \ifx\caption@ORI@label\@undefined - \let\caption@ORI@label\label - \let\label\caption@xlabel - \fi - \caption@start}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@typehook} -% Hook, will be extended later on, e.g.~by our \package{float} package -% support. -% \begin{macrocode} -\newcommand*\caption@typehook{} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@iftype} -% \changes{v3.1}{2007/04/11}{This macro and its usage added} -% Since we often need to check if |\@captype| is defined (means: we -% are inside a floating environment) this helper macro was introduced. -% \begin{macrocode} -\newcommand*\caption@iftype{% - \@ifundefined{@captype}{\let\@captype\@undefined\@secondoftwo}\@firstoftwo} -% \end{macrocode} -% \iffalse -% \newcommand*\caption@iftype{% -% \begingroup -% \@ifundefined{@captype}% -% {\aftergroup\@secondoftwo}% -% {\aftergroup\@firstoftwo}% -% \endgroup} -% \fi -% \end{macro} -% -% \begin{macro}{\caption@checkgrouplevel} -% \changes{v3.1}{2007/07/15}{This macro and its usage added} -% \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)} -% Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done -% inside a group or not -- in the latter case a warning message will -% be issued. (needs \eTeX) -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname currentgrouplevel\endcsname\relax - \caption@Debug{TeX engine: TeX} - \let\caption@checkgrouplevel\@gobbletwo -\else - \caption@Debug{TeX engine: e-TeX} - \newcommand*\caption@checkgrouplevel[2]{% - \@ifundefined{#1caption@grouplevel}{% - \@ifundefined{caption@grouplevel}{\let\caption@grouplevel\z@}{}% - \ifnum\currentgrouplevel>\caption@grouplevel\relax - \expandafter\edef\csname #1caption@grouplevel\endcsname{% - \the\currentgrouplevel}% - \else - \caption@Warning{\string#2\MessageBreak outside box or environment}% - \fi - }{}} -\fi -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@undefinedlabel} -% \changes{v3.1}{2007/07/03}{This macro and its usage added} -% \changes{v3.1b}{2007/09/22}{Contents changed to \texttt{??}} -% \changes{v3.1i}{2008/04/13}{Contents changed to \cs{caption@xref}(\ldots)} -% \changes{v3.1k}{2009/03/30}{Bugfix 08-12-08: \cs{caption@xref} is robust now} -% This label will be used for |\currentlabel| inside (floating) environments -% as default. (see above) -% \iffalse\Note{All commands used have to be robust here.}\fi -% \begin{macrocode} -\newcommand*\caption@undefinedlabel{% - \protect\caption@xref{\caption@labelname}{\on@line}} -% \end{macrocode} -% \begin{macrocode} -\DeclareRobustCommand*\caption@xref[2]{% - \caption@WarningNoLine{\noexpand\label before \string\caption#2}% - \@setref\relax\@undefined{#1}} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@labelname{??} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\caption@xlabel} -% \changes{v3.1b}{2007/09/22}{This macro and its usage added} -% \changes{v3.1f}{2007/11/11}{Revised} -% \changes{v3.1i}{2008/04/13}{Bugfix: \cs{pageref} should always work now} -% The new code of |\label| inside floating environments. -% |\label| will be redefined using |\caption@withoptargs|, so -% |#1| are the optional arguments (if any), and -% |#2| is the mandatory argument here. -% \begin{macrocode} -\newcommand*\caption@xlabel[1]{% - \caption@@xlabel - \def\caption@labelname{#1}% - \caption@ORI@label{#1}} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@@xlabel{% - \global\let\caption@@xlabel\@empty - \@bsphack - \protected@write\@auxout{}% - {\string\providecommand*\string\caption@xref[2]{% - \string\@setref\string\relax\string\@undefined{\string##1}}}% - \@esphack} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\captionof} -% \changes{v3.1}{2007/05/09}{Uses \cs{caption@settype} instead of \cs{def}\cs{@captype}} -% \changes{v3.1c}{2007/09/22}{Bugfix: Redefinition of \cs{caption@setfloatcapt} removed} -% \changes{v3.1e}{2007/10/30}{Better compatibility: Will be defined with \cs{AtBeginDocument} now} -% |\captionof|\marg{type}\oarg{lst\_entry}\marg{heading}\\ -% |\captionof*|\oarg{lst\_entry}\marg{heading}\par -% \Note{This will be defined with \cs{AtBeginDocument} so -% \cs{usepackage}\csmarg{caption,capt-of} will still work. -% (Compatibility to \version{1.x})} -% \begin{macrocode} -\caption@AtBeginDocument{% - \def\captionof{\caption@teststar\caption@of{\caption*}\caption}} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@of[2]{\caption@settype*{#2}#1} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\captionlistentry} -% \changes{v3.1}{2007/07/28}{This macro added} -% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added} -% \changes{v3.1g}{2008/01/20}{Starred variant added} -% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package} -% |\captionlistentry|\oarg{float type}\marg{list entry}\\ -% |\captionlistentry*|\oarg{float type}\marg{list entry} -% \begin{macrocode} -\newcommand*\captionlistentry{% - \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\@captionlistentry[1]{% - \@testopt{\caption@listentry{#1}}\@captype} -% \end{macrocode} -% \begin{macrocode} -\def\caption@listentry#1[#2]#3{% - \@bsphack - #1{\caption@gettitle{#3}}% - {\caption@refstepcounter{#2}% - \caption@makecurrent{#2}{#3}}% - \caption@addcontentsline{#2}{#3}% - \@esphack} -% \end{macrocode} -% \end{macro} -% -% \subsection{\cs{ContinuedFloat}} -% -% \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} -% \changes{v3.0g}{2005/06/28}{% -% Bugfix: \cs{newcounter} replaced by \cs{newcount}} -% \changes{v3.1}{2007/07/02}{Format of \package{hyperref} extension changed} -% \changes{v3.1}{2007/07/07}{\cs{caption@setoptions} added} -% \changes{v3.1g}{2008/01/29}{Starred variant and hook \cs{sf@ContinuedFloat} added} -% |\ContinuedFloat|\\ -% |\ContinuedFloat*|\par -% This mainly decrements the appropriate counter and increments the -% continuation counter instead. -% Furthermore we set |\caption@resetContinuedFloat| to |\@gobble| so the -% continuation counter will not be reset to zero inside |\caption@refstepcounter|. -% Please forget about the optional argument, it was never working well, is -% incompatible to the \package{subfig} package, but is still there for -% compatibility reasons. -% \Note{The definition of \cs{ContinuedFloat} itself is compatible -% to the one inside the \package{subfig} package, except for the -% starred variant and the optional argument.} -% When the \package{hyperref} package is used we have the problem -% that the usage of |\ContinuedFloat| will create duplicate -% hyper links -- |\@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 \#}|\alph{|\meta{continued \#}|}|\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.)} -% \Note{This does not help if the \package{hyperref} package option -% \texttt{naturalnames=true} is set.} -% \begin{macrocode} -\def\ContinuedFloat{% - \@ifnextchar[\@Continued@Float\@ContinuedFloat} -% \end{macrocode} -% \begin{macrocode} -\def\@Continued@Float[#1]{\addtocounter{#1}\m@ne} -% \end{macrocode} -% \begin{macrocode} -\def\@ContinuedFloat{% - \caption@iftype - {\addtocounter\@captype\m@ne - \caption@ContinuedFloat\@captype}% - {\caption@Error{\noexpand\ContinuedFloat outside float}}} -% \end{macrocode} -% \begin{macrocode} -\def\caption@ContinuedFloat#1{% - \@ifstar{\caption@Continued@Float@{#1}}{\caption@Continued@Float{#1}}} -% \end{macrocode} -% \begin{macrocode} -\def\caption@Continued@Float@{% - \addtocounter\@captype\@ne - \@stpelt{ContinuedFloat}\stepcounter{ContinuedFloat}% - \def\caption@resetContinuedFloat##1{\xdef\caption@CFtype{##1}}% - \caption@@ContinuedFloat} -% \end{macrocode} -% \begin{macrocode} -\def\caption@Continued@Float#1{% - \edef\caption@tempa{#1}% - \ifx\caption@tempa\caption@CFtype - \stepcounter{ContinuedFloat}% - \let\caption@resetContinuedFloat\@gobble - \caption@@ContinuedFloat{#1}% - \sf@ContinuedFloat{#1}% - \else - \caption@Error{Continued `#1' after `\caption@CFtype'}% - \fi} -% \end{macrocode} -% \begin{macrocode} -\def\caption@@ContinuedFloat#1{% - \expandafter\l@addto@macro\csname the#1\endcsname\theContinuedFloat - \@ifundefined{theH#1}{}{% - \expandafter\l@addto@macro\csname theH#1\endcsname{% - \@alph\c@ContinuedFloat}}% - \caption@setoptions{ContinuedFloat}% - \caption@setoptions{continued#1}} -% \end{macrocode} -% \begin{macrocode} -\providecommand*\sf@ContinuedFloat[1]{} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@CFtype{??} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\theContinuedFloat} -% Its preset to \cs{@empty}, so usually the continuation counter is not -% included in the caption label or references. -% \begin{macrocode} -\newcounter{ContinuedFloat} -\let\theContinuedFloat\@empty -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@resetContinuedFloat} -% |\caption@resetContinuedFloat|\marg{type}\par -% If a continuation counter is defined, we reset it. -% (This one will be called inside |\@caption|.) -% \begin{macrocode} -\newcommand*\caption@resetContinuedFloat[1]{% - \@stpelt{ContinuedFloat}\xdef\caption@CFtype{#1}} -% \end{macrocode} -% \end{macro} -% -% \subsection{Internal helpers} -% -% \begin{macro}{\caption@refstepcounter} -% \changes{v3.1}{2007/07/28}{This macro added} -% Resets the continuation counter, increments the float (i.e. |figure| or -% |table|) counter, and sets the |refstepcounter| flag. -% \begin{macrocode} -\newcommand*\caption@refstepcounter[1]{% - \caption@resetContinuedFloat{#1}% - \caption@@refstepcounter{#1}% - \let\caption@ifrefstepcounter\@firstoftwo} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@@refstepcounter{\refstepcounter} -\let\caption@ifrefstepcounter\@secondoftwo -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@dblarg} -% \changes{v3.1}{2007/02/05}{This macro added} -% \changes{v3.1f}{2007/12/06}{Bugfix 07-12-06: Changed so it works without \cs{kernel@ifnextchar} -% (which was introduced in \LaTeXe\ 2004/01/23), too} -% A |\relax| was added compared to |\@dblarg| so |\caption{}| will be -% expanded to |\caption[\relax]{}| (and not to |\caption[]{}|). -% \begin{macrocode} -\@ifundefined{kernel@ifnextchar}% - {\newcommand\caption@dblarg[1]{\@ifnextchar[{#1}{\caption@xdblarg{#1}}}}% - {\newcommand\caption@dblarg[1]{\kernel@ifnextchar[{#1}{\caption@xdblarg{#1}}}}% -\newcommand\caption@xdblarg[2]{#1[{#2\relax}]{#2}}% -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@begin} -% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed to \cs{caption@setfloattype}} -% \changes{v3.0e}{2005/04/12}{Check for default label format added} -% \changes{v3.0f}{2005/06/11}{Usage of \cs{caption@resetContinuedFloat} added} -% \changes{v3.1}{2007/05/09}{Usage of \cs{caption@setfloattype} \& -% \cs{caption@resetContinuedFloat} removed} -% 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{enumerate} -% \item[1.] Start a new group. -% \item[2.] Define |\fnum@|\meta{type} if the caption label format is set -% to non-default. -% \item[3.] Override the |position=| setting, if necessary. -% (for example if set to |auto| or used inside a |supertabular|) -% \end{enumerate} -% \begin{macrocode} -\newcommand*\caption@begin[1]{% - \begingroup - \caption@setfnum{#1}% - \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.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added} -% \changes{v3.1}{2007/07/01}{Makes lst-entry now instead of redefining \cs{addcontentsline}} -% |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par -% performs the same tasks as |\caption@begin| and additionally: -% \begin{enumerate} -% \item[4.] Make an entry in the list-of-whatever. -% \item[5.] Set |\caption@ifempty| according argument \meta{heading}. -% \end{enumerate} -% \begin{macrocode} -\newcommand\caption@beginex[3]{% - \caption@begin{#1}% - \caption@addcontentsline{#1}{#2}% - \caption@ifempty{#3}{}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@end} -% |\caption@end| closes the group. -% \begin{macrocode} -\newcommand*\caption@end{% - \endgroup - \let\caption@position\caption@fixedposition} -% \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@setfnum} -% \changes{v3.1}{2007/03/10}{This macro added} -% |\caption@setfnum|\marg{type}\\ -% redefines |\fnum@|\meta{type} according the caption label format -% set with |labelformat=|. But if |labelformat=default| is set, -% |\fnum@|\meta{type} will not be overwritten by us. -% \begin{macrocode} -\newcommand*\caption@setfnum[1]{% - \@ifundefined{fnum@#1}{\iftrue}{\ifx\caption@lfmt\caption@lfmt@default\else}% - \@namedef{fnum@#1}{\caption@fnum{#1}}% - \fi} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@boxrestore} -% \changes{v3.1}{2007/03/03}{This macro and its usage added} -% \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added} -% The original code (from |latex/base/ltboxes.dtx|): -% \begin{verbatim} -% \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr} -% \def\@arrayparboxrestore{% -% \let\if@nobreak\iffalse -% \let\if@noskipsec\iffalse -% \let\par\@@par -% \let\-\@dischyph -% \let\'\@acci\let\`\@accii\let\=\@acciii -% \parindent\z@ \parskip\z@skip -% \everypar{}% -% \linewidth\hsize -% \@totalleftmargin\z@ -% \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip -% \parfillskip\@flushglue \lineskip\normallineskip -% \baselineskip\normalbaselineskip -% \sloppy} -% \end{verbatim}%^^A -% This one will be used by |\@caption| instead of |\@parboxrestore|. -% \begin{macrocode} -\newcommand*\caption@boxrestore{% - \let\if@nobreak\iffalse - \let\if@noskipsec\iffalse - \let\par\@@par -% \let\-\@dischyph -% \let\'\@acci\let\`\@accii\let\=\@acciii - \parindent\z@ \parskip\z@skip - \everypar{}% -% \linewidth\hsize -% \@totalleftmargin\z@ - \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip - \parfillskip\@flushglue \lineskip\normallineskip - \baselineskip\normalbaselineskip - \sloppy - \let\\\@normalcr -} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@normalsize} -% \changes{v3.1}{2007/05/05}{This macro and its usage added} -% This one will be used by |\@caption| instead of |\normalsize|.\par -% Its code is equivalent to -% \begin{quote} -% |\caption@font{normal}%| -% \end{quote} -% but executes faster (since the starred form of |\caption@font| -% does not use |\setkeys| internally). -% \begin{macrocode} -\newcommand*\caption@normalsize{% - \caption@font*{\KV@caption@fnt@normal\@unused}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@setfloatcapt} -% Needed for support of the \package{float} package, where the caption will -% not be typeset directly, but catched in a |\vbox| called |\@floatcapt| -% instead. -% \begin{macrocode} -\let\caption@setfloatcapt\@firstofone -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@makecurrent} -% \begin{macro}{\caption@makeanchor} -% \begin{macro}{\caption@start} -% \begin{macro}{\caption@@start} -% \begin{macro}{\caption@freezeHref} -% \begin{macro}{\caption@defrostHref} -% All these are needed for support of the \package{hyperref} package. -% \begin{macrocode} -\newcommand*\caption@makecurrent[2]{} -\let\caption@makeanchor\@firstofone -\let\caption@start\relax -\let\caption@@start\relax -\let\caption@freezeHref\relax -\let\caption@defrostHref\relax -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\caption@gettitle} -% \changes{v3.1}{2007/05/05}{This macro and its usage added} -% This one is needed for support of the \package{nameref} package. -% \begin{macrocode} -\newcommand\caption@gettitle[1]{% - \@ifundefined{NR@gettitle}% - {\def\@currentlabelname{#1}}% - {\NR@gettitle{#1}}} -% \end{macrocode} -% \end{macro} -% -% \subsection{\cs{caption}, \cs{@caption}, and \cs{@makecaption}} -% -% \begin{macro}{\caption@caption} -% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added} -% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed} -% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added} -% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore} -% Here comes our definition of |\caption| and |\caption*|. -% Beside the support of the starred variant this code was adapted to the -% various packages we support. -% We are using |\caption@dblarg| instead of |\@dblarg| so |\caption{}| -% (with an empty arg.) will produce a list-of entry, but |\caption[]{}| -% won't. -% \begin{macrocode} -\def\caption@caption{% - \caption@iftype - {\caption@checkgrouplevel\@empty\caption - \caption@star - {\caption@refstepcounter\@captype}% - {\caption@dblarg{\@caption\@captype}}}% - {\caption@Error{\noexpand\caption outside float}}}% -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@star} -% \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}} -% A helper macro which processes the optional |*| after |\caption|. -% \Note{We set \cs{caption@startrue} globally so it works with the -% \package{sidecap} package, too.} -% \begin{macrocode} -\newcommand*\caption@star[2]{% - \@ifstar{\global\caption@startrue#2[]}{#1#2}}% -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@@caption} -% \changes{v3.1}{2007/02/04}{Re-written, does not save\&use original definition anymore} -% \changes{v3.1f}{2007/11/28}{Bugfix: Handling of \texttt{@minipage} flag added} -% \changes{v3.1f}{2007/11/28}{Support of option \opt{@minipage} added} -% \changes{v3.1g}{2008/03/16}{Internal: Uses \cs{caption@prepareanchor} now} -% As above, our version has been adapted to the packages we support. -% Additionally our code is nested by |\caption@beginex| \& -% |\caption@end| instead of |\begingroup| \& |\endgroup|. -% Furthermore we use |\caption@boxrestore| instead of |\@parboxrestore| -% so this code also works correctly inside list-based environments -% like |wide| \& |addmargin|. (This, and the fact that we use -% |\linewidth| instead of |\hsize| inside |\@makecaption|, solves -% \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2472}%^^A -% {\LaTeX\ PR \texttt{latex/2472}}.) -% \begin{macrocode} -\long\def\caption@@caption#1[#2]#3{% -% \end{macrocode} -% \begin{macrocode} - \ifcaption@star \else - \caption@prepareanchor{#1}{#2}% - \fi -% \end{macrocode} -% \begin{macrocode} - \par - \caption@beginex{#1}{#2}{#3}% - \caption@setfloatcapt{% - \caption@boxrestore - \if@minipage - \@setminipage - \fi - \caption@normalsize - \ifcaption@star - \let\caption@makeanchor\@firstofone - \fi - \@makecaption{\csname fnum@#1\endcsname}% - {\ignorespaces\caption@makeanchor{#3}}\par - \caption@if@minipage\@minipagetrue\@minipagefalse}% - \caption@end}% -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@prepareanchor} -% \changes{v3.1g}{2008/03/16}{This macro added} -% \begin{macrocode} -\newcommand*\caption@prepareanchor[2]{% - \caption@makecurrent{#1}{#2}% - \caption@ifhypcap\caption@@start{}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@makecaption} -% \changes{v3.1i}{2008/05/06}{Usage of \cs{caption@rule} added} -% |\@makecaption|\marg{label}\marg{text}\par -% We do basically the same as the original code (from the standard -% \LaTeX\ document classes), but take care of the |position=| setting -% and use |\caption@@make| from the \package{caption} kernel to finally -% typeset the caption. -% \begin{macrocode} -\long\def\caption@makecaption#1#2{% - \caption@iftop - {\vskip\belowcaptionskip}% - {\caption@rule\vskip\abovecaptionskip}% - \caption@@make{#1}{#2}% - \caption@iftop - {\vskip\abovecaptionskip\caption@rule}% - {\vskip\belowcaptionskip}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@redefine} -% \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now} -% We only redefine |\caption| and |\@caption| if the current definitions -% are well known, so documents written in the old (\package{caption} -% package \version{1.x}) days (where |\caption| \& |\@caption| were not -% redefined by us) will still compile fine. -% For example the usage of the \package{captcont} package, which brings -% it's own definition of |\caption*|, was quite common these days. -% \begin{macrocode} -\newcommand*\caption@redefine{} -\g@addto@macro\caption@redefine{% -% \end{macrocode} -% -% \begin{macrocode} - \caption@setbool{incompatible}{0}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\caption{% - % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)] - \def\caption{% - \ifx\@captype\@undefined - \@latex@error{\noexpand\caption outside float}\@ehd - \expandafter\@gobble - \else - \refstepcounter\@captype - \expandafter\@firstofone - \fi - {\@dblarg{\@caption\@captype}}% - }}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\caption{% - % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau - \def\caption{ - \ifx\@captype\@undefined - \@latex@error{\noexpand\caption outside figure or table}\@ehd - \expandafter\@gobble - \else - \refstepcounter\@captype - \expandafter\@firstofone - \fi - {\@dblarg{\@caption\@captype}}% - }}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\caption{% - % float.sty [2001/11/08 v1.3d Float enhancements (AL)] - \renewcommand\caption{% - \ifx\@captype\@undefined - \@latex@error{\noexpand\caption outside float}\@ehd - \expandafter\@gobble - \else - \refstepcounter\@captype - \let\@tempf\@caption - \expandafter\ifx\csname @float@c@\@captype\endcsname\relax\else - \expandafter\expandafter\let - \expandafter\@tempf\csname @float@c@\@captype\endcsname - \fi - \fi - \@dblarg{\@tempf\@captype}}}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\caption{% - % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX] - % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX] - % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX] - \def\caption{% - \ifx\@captype\@undefined - \@latex@error{\noexpand\caption outside float}\@ehd - \expandafter\@gobble - \else - \H@refstepcounter\@captype - \@ifundefined{fst@\@captype}{% - \let\Hy@tempa\@caption - }{% - \let\Hy@tempa\Hy@float@caption - }% - \expandafter\@firstofone - \fi - {\@dblarg{\Hy@tempa\@captype}}% - }}% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\caption{% - % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX] - \def\caption{% - \ifx\@captype\@undefined - \@latex@error{\noexpand\caption outside float}\@ehd - \expandafter\@gobble - \else - \H@refstepcounter\@captype - \let\Hy@tempa\@caption - \@ifundefined{float@caption}{% - }{% - \expandafter\ifx\csname @float@c@\@captype\endcsname\float@caption - \let\Hy@tempa\Hy@float@caption - \fi - }% - \expandafter\@firstofone - \fi - {\@dblarg{\Hy@tempa\@captype}}% - }}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@IfCheckCommand{}{% - \caption@Info{% - Incompatible package detected (regarding \string\caption).\MessageBreak - \string\caption\space=\space\meaning\caption}% - \caption@setbool{incompatible}{1}}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % ltfloat.dtx [2002/10/01 v1.1v LaTeX Kernel (Floats)] - \long\def\@caption#1[#2]#3{% - \par - \addcontentsline{\csname ext@#1\endcsname}{#1}% - {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}% - \begingroup - \@parboxrestore - \if@minipage - \@setminipage - \fi - \normalsize - \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par - \endgroup}}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau - \long\def\@caption#1[#2]#3{% second argument ignored - \par\nobreak - \begingroup - \@parboxrestore - \if@minipage - \@setminipage - \fi - \beamer@makecaption{#1}{\ignorespaces #3}\par\nobreak - \endgroup}}% -% \end{macrocode} -% -% \begin{macrocode} -% \caption@CheckCommand\float@caption{% -% % float.sty [2001/11/08 v1.3d Float enhancements (AL)] -% \long\def\float@caption#1[#2]#3{% -% \addcontentsline{\@nameuse{ext@#1}}{#1}% -% {\protect\numberline{\@nameuse{the#1}}{\ignorespaces #2}} -% \global\setbox\@floatcapt\vbox\bgroup\@parboxrestore -% \normalsize\@fs@capt{\@nameuse{fnum@#1}}{\ignorespaces #3}% -% \@ifnextchar[{\float@ccon}{\egroup}}% -% \long\def\float@ccon[#1]{#1\par\egroup}}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % hyperref.sty [2007/02/27 v6.75t Hypertext links for LaTeX] - \long\def\@caption#1[#2]#3{% - \hyper@makecurrent{\@captype}% - \def\@currentlabelname{#2}% - \par\addcontentsline{\csname ext@#1\endcsname}{#1}{% - \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}% - }% - \begingroup - \@parboxrestore - \if@minipage - \@setminipage - \fi - \normalsize - \@makecaption{\csname fnum@#1\endcsname}{% - \ignorespaces - \ifHy@nesting - \hyper@@anchor{\@currentHref}{#3}% - \else - \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3% - \fi - }% - \par - \endgroup - }}% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % hyperref.sty [2007/04/09 v6.76a Hypertext links for LaTeX] - % hyperref.sty [2007/06/12 v6.76h Hypertext links for LaTeX] - % hyperref.sty [2007/08/05 v6.76j Hypertext links for LaTeX] - \long\def\@caption#1[#2]#3{% - \expandafter\ifx\csname if@capstart\expandafter\endcsname - \csname iftrue\endcsname - \global\let\@currentHref\hc@currentHref - \else - \hyper@makecurrent{\@captype}% - \fi - \def\@currentlabelname{#2}% - \par\addcontentsline{\csname ext@#1\endcsname}{#1}{% - \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}% - }% - \begingroup - \@parboxrestore - \if@minipage - \@setminipage - \fi - \normalsize - \expandafter\ifx\csname if@capstart\expandafter\endcsname - \csname iftrue\endcsname - \global\@capstartfalse - \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}% - \else - \@makecaption{\csname fnum@#1\endcsname}{% - \ignorespaces - \ifHy@nesting - \hyper@@anchor{\@currentHref}{#3}% - \else - \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#3% - \fi - }% - \fi - \par - \endgroup - }}% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % hyperref.sty [2009/11/27 v6.79k Hypertext links for LaTeX] - \long\def\@caption#1[#2]#3{% - \expandafter\ifx\csname if@capstart\expandafter\endcsname - \csname iftrue\endcsname - \global\let\@currentHref\hc@currentHref - \else - \hyper@makecurrent{\@captype}% - \fi - \def\@currentlabelname{#2}% - \par\addcontentsline{\csname ext@#1\endcsname}{#1}{% - \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}% - }% - \begingroup - \@parboxrestore - \if@minipage - \@setminipage - \fi - \normalsize - \expandafter\ifx\csname if@capstart\expandafter\endcsname - \csname iftrue\endcsname - \global\@capstartfalse - \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}% - \else - \@makecaption{\csname fnum@#1\endcsname}{% - \ignorespaces - \ifHy@nesting - \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}% - \else - \Hy@raisedlink{% - \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}% - }% - #3% - \fi - }% - \fi - \par - \endgroup - }}% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % hyperref.sty [2009/12/09 v6.79m Hypertext links for LaTeX] - % hyperref.sty [2009/12/28 v6.79z Hypertext links for LaTeX] - \long\def\@caption#1[#2]#3{% - \expandafter\ifx\csname if@capstart\expandafter\endcsname - \csname iftrue\endcsname - \global\let\@currentHref\hc@currentHref - \else - \hyper@makecurrent{\@captype}% - \fi - \@ifundefined{NR@gettitle}{% - \def\@currentlabelname{#2}% - }{% - \NR@gettitle{#2}% - }% - \par\addcontentsline{\csname ext@#1\endcsname}{#1}{% - \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}% - }% - \begingroup - \@parboxrestore - \if@minipage - \@setminipage - \fi - \normalsize - \expandafter\ifx\csname if@capstart\expandafter\endcsname - \csname iftrue\endcsname - \global\@capstartfalse - \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces#3}% - \else - \@makecaption{\csname fnum@#1\endcsname}{% - \ignorespaces - \ifHy@nesting - \expandafter\hyper@@anchor\expandafter{\@currentHref}{#3}% - \else - \Hy@raisedlink{% - \expandafter\hyper@@anchor\expandafter{% - \@currentHref - }{\relax}% - }% - #3% - \fi - }% - \fi - \par - \endgroup - }}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % nameref.sty [2006/12/27 v2.28 Cross-referencing by name of section] - \long\def\@caption#1[#2]{% - \def\@currentlabelname{#2}% - \NR@@caption{#1}[{#2}]% - }}% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % nameref.sty [2009/11/27 v2.32 Cross-referencing by name of section] - \long\def\@caption#1[#2]{% - \NR@gettitle{#2}% - \NR@@caption{#1}[{#2}]% - }}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % subfigure.sty [2002/07/30 v2.1.4 subfigure package] - \long\def\@caption#1[#2]#3{% - \@ifundefined{if#1topcap}% - {\subfig@oldcaption{#1}[{#2}]{#3}}% - {\@nameuse{if#1topcap}% - \@listsubcaptions{#1}% - \subfig@oldcaption{#1}[{#2}]{#3}% - \else - \subfig@oldcaption{#1}[{#2}]{#3}% - \@listsubcaptions{#1}% - \fi}}}% -% \end{macrocode} -% -% \begin{macrocode} - \caption@CheckCommand\@caption{% - % subfig.sty [2005/06/28 ver: 1.3 subfig package] - \def\@caption{\caption@}% -% \long\def\caption@#1[#2]#3{% -% \@ifundefined{caption@setfloattype}% -% \caption@settype -% \caption@setfloattype -% \@captype -% \sf@ifpositiontop{% -% \@listsubcaptions{#1}% -% \sf@old@caption{#1}[{#2}]{#3}% -% }{% -% \sf@old@caption{#1}[{#2}]{#3}% -% \@listsubcaptions{#1}% -% }}% - }% -% \end{macrocode} -% -% \begin{macrocode} - \caption@IfCheckCommand{}{% - \caption@Info{% - Incompatible package detected (regarding \string\@caption).\MessageBreak - \string\@caption\space=\space\meaning\@caption}% - \caption@setbool{incompatible}{1}}% -% \end{macrocode} -% -% The option |compatibility=| will override the compatibility mode. +% \begin{macro}{\phantomcaption} +% \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added} +% |\phantomcaption|\par +% Use this one for figures with subcaptions but without main caption. % \begin{macrocode} - \@ifundefined{caption@ifcompatibility}% - {\let\caption@ifcompatibility\caption@ifincompatible - \let\caption@tempa\caption@WarningNoLine}% - {\let\caption@tempa\@gobble}% suppress warning +\newcommand\phantomcaption{% + \caption@iftype + {\caption@refstepcounter\@captype}% + {\caption@Error{\noexpand\phantomcaption outside float}}}% % \end{macrocode} +% \end{macro} +% +% \subsection{Internal helpers} % +% \begin{macro}{\caption@refstepcounter} +% \changes{v3.1}{2007/07/28}{This macro added} +% \changes{v3.2}{2010/10/26}{Error message moved from \cs{caption@@@settype} to here} +% Resets the continuation counter, increments the float (i.e. |figure| or +% |table|) counter, and sets the |refstepcounter| flag. % \begin{macrocode} - \caption@ifcompatibility{% +\newcommand*\caption@refstepcounter[1]{% + \@ifundefined{c@#1}% + {\caption@Error{No float type '#1' defined}}% + {\caption@resetContinuedFloat{#1}% + \caption@@refstepcounter{#1}% + \let\caption@ifrefstepcounter\@firstoftwo}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@refstepcounter{\refstepcounter} +\let\caption@ifrefstepcounter\@secondoftwo % \end{macrocode} +% \end{macro} % +% \begin{macro}{\caption@dblarg} +% \changes{v3.1}{2007/02/05}{This macro added} +% \changes{v3.1f}{2007/12/06}{Bugfix 07-12-06: Changed so it works without \cs{kernel@ifnextchar} +% (which was introduced in \LaTeXe\ 2004/01/23), too} +% A |\relax| was added compared to |\@dblarg| so |\caption{}| will be +% expanded to |\caption[\relax]{}| (and not to |\caption[]{}|). % \begin{macrocode} - \caption@tempa{% - \noexpand\caption will not be redefined since it's already\MessageBreak - redefined by a document class or package which is\MessageBreak - unknown to the caption package}% +\@ifundefined{kernel@ifnextchar}% + {\newcommand\caption@dblarg[1]{\@ifnextchar[{#1}{\caption@xdblarg{#1}}}}% + {\newcommand\caption@dblarg[1]{\kernel@ifnextchar[{#1}{\caption@xdblarg{#1}}}}% +\newcommand\caption@xdblarg[2]{#1[{#2\relax}]{#2}}% % \end{macrocode} +% \end{macro} % +% \begin{macro}{\caption@begin} +% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed to \cs{caption@setfloattype}} +% \changes{v3.0e}{2005/04/12}{Check for default label format added} +% \changes{v3.0f}{2005/06/11}{Usage of \cs{caption@resetContinuedFloat} added} +% \changes{v3.1}{2007/05/09}{Usage of \cs{caption@setfloattype} \& +% \cs{caption@resetContinuedFloat} removed} +% 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{enumerate} +% \item[1.] Start a new group. +% \item[2.] Define |\fnum@|\meta{type} if the caption label format is set +% to non-default. +% \item[3.] Override the |position=| setting, if necessary. +% (for example if set to |auto| or used inside a |supertabular|) +% \end{enumerate} % \begin{macrocode} - \renewcommand*\caption@redefine{}% +\newcommand*\caption@begin[1]{% + \begingroup + \caption@setfnum{#1}% + \caption@fixposition + \global\let\caption@fixedposition\caption@position} % \end{macrocode} +% \end{macro} % -% |\ContinuedFloat| is not supported in compatibility mode. +% \begin{macro}{\caption@beginex} +% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added} +% \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added} +% \changes{v3.1}{2007/07/01}{Makes lst-entry now instead of redefining \cs{addcontentsline}} +% \changes{v3.2}{2010/10/26}{Bugfix 09-05-15: Setting of \cs{lst@@caption} added} +% |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\par +% performs the same tasks as |\caption@begin| and additionally: +% \begin{enumerate} +% \item[4.] Set |\lst@@caption|, so |\fnum@lstlisting| will include a numbering. +% \item[5.] Make an entry in the list-of-whatever. +% \item[6.] Set |\caption@ifempty| according argument \meta{heading}. +% \end{enumerate} % \begin{macrocode} - \renewcommand*\caption@ContinuedFloat[1]{% - \caption@Error{Not available in compatibility mode}}% +\newcommand\caption@beginex[3]{% + \caption@begin{#1}% + \let\lst@@caption\relax + \caption@addcontentsline{#1}{#2}% + \caption@ifempty{#3}{}} % \end{macrocode} +% \end{macro} % -% |\caption@start| is not supported in compatibility mode. +% \begin{macro}{\caption@end} +% |\caption@end| closes the group. % \begin{macrocode} - \caption@AtBeginDocument*{% - \let\caption@start\relax - \@ifundefined{caption@ORI@capstart}{}{% - \caption@Debug{% - Restore hypcap definition of \string\capstart\@gobble}% - \let\capstart\caption@ORI@capstart}% - \@ifundefined{caption@ORI@float@makebox}{}{% - \caption@Debug{% - Restore hyperref redefinition of \string\float@makebox\@gobble}% - \let\float@makebox\caption@ORI@float@makebox}% - }% +\newcommand*\caption@end{% + \endgroup + \let\caption@position\caption@fixedposition} % \end{macrocode} +% \end{macro} % -% \begin{macro}{\caption@star} -% We redefine |\caption@star| here so it does not make any harm. +% \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@setfnum} +% \changes{v3.1}{2007/03/10}{This macro added} +% |\caption@setfnum|\marg{type}\\ +% redefines |\fnum@|\meta{type} according the caption label format +% set with |labelformat=|. But if |labelformat=default| is set, +% |\fnum@|\meta{type} will not be overwritten by us. % \begin{macrocode} - \renewcommand*\caption@star[2]{#1#2}% +\newcommand*\caption@setfnum[1]{% + \@ifundefined{fnum@#1}{\iftrue}{\ifx\caption@lfmt\caption@lfmt@default\else}% + \@namedef{fnum@#1}{\caption@fnum{#1}}% + \fi} % \end{macrocode} % \end{macro} % +% \begin{macro}{\caption@setparboxrestore} +% \changes{v3.2}{2010/11/07}{This macro added} +% |\caption@setparboxrestore|\marg{\purett{partial} or \purett{full}} % \begin{macrocode} +\newcommand*\caption@setparboxrestore[1]{% + \caption@ifinlist{#1}{full}{% + \let\caption@parboxrestore\@firstoftwo + }{\caption@ifinlist{#1}{default,light,partial}{% + \let\caption@parboxrestore\@secondoftwo }{% + \caption@Error{Undefined parboxrestore `#1'}% + }}} % \end{macrocode} +% \end{macro} % +% \begin{macro}{\caption@setfullparboxrestore} +% \changes{v3.2}{2010/11/07}{This macro added} +% |\caption@setfullparboxrestore|\par +% This is an abbreviation for |\caption@setparboxrestore{full}|. % \begin{macrocode} - \caption@ifincompatible{% - \caption@WarningNoLine{% - Forced redefinition of \noexpand\caption since the\MessageBreak - unsupported(!) package option `compatibility=false'\MessageBreak - was given}% - }{}% +\newcommand*\caption@setfullparboxrestore{% + \let\caption@parboxrestore\@firstoftwo} % \end{macrocode} +% \end{macro} % -% \begin{macro}{\caption} -% \begin{macro}{\@caption} +% \changes{v3.2}{2010/11/07}{Option \opt{parboxrestore} added} % \begin{macrocode} - \renewcommand*\caption@redefine{% - \let\caption\caption@caption - \let\@caption\caption@@caption}% - \caption@redefine +\DeclareCaptionOption{parboxrestore}{\caption@setparboxrestore{#1}} +\caption@setparboxrestore{default} % \end{macrocode} -% \end{macro} -% \end{macro} % +% \begin{macro}{\caption@boxrestore} +% \changes{v3.1}{2007/03/03}{This macro and its usage added} +% \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added} +% \changes{v3.2}{2010/11/07}{Support of option \opt{parboxrestore} added} +% The original code (from |latex/base/ltboxes.dtx|): +% \begin{verbatim} +% \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr} +% \def\@arrayparboxrestore{% +% \let\if@nobreak\iffalse +% \let\if@noskipsec\iffalse +% \let\par\@@par +% \let\-\@dischyph +% \let\'\@acci\let\`\@accii\let\=\@acciii +% \parindent\z@ \parskip\z@skip +% \everypar{}% +% \linewidth\hsize +% \@totalleftmargin\z@ +% \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip +% \parfillskip\@flushglue \lineskip\normallineskip +% \baselineskip\normalbaselineskip +% \sloppy} +% \end{verbatim}%^^A +% This one will be used by |\@caption| instead of |\@parboxrestore|. % \begin{macrocode} - }% +\newcommand*\caption@boxrestore{% + \caption@parboxrestore{\@parboxrestore}{% + \let\if@nobreak\iffalse + \let\if@noskipsec\iffalse + \let\par\@@par +% \let\-\@dischyph +% \let\'\@acci\let\`\@accii\let\=\@acciii + \parindent\z@ \parskip\z@skip + \everypar{}% +% \linewidth\hsize +% \@totalleftmargin\z@ + \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip + \parfillskip\@flushglue \lineskip\normallineskip + \baselineskip\normalbaselineskip + \sloppy + \let\\\@normalcr + }} % \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@boxrestore@mini} +% \changes{v3.2}{2010/10/24}{This macro added} +% Resets \cs{par} so the very first \cs{par} in \cs{@caption} behaves quite the same as in floating environments. Will be used by \cs{setcaptiontype}. % \begin{macrocode} - \caption@AtBeginDocument*{% - \let\caption@ORI@capstart\@undefined - \let\caption@ORI@float@makebox\@undefined}% +\newcommand\caption@boxrestore@mini{% + \let\par\@@par + \parindent\z@ \parskip\z@skip + \sloppy} % \end{macrocode} +% \end{macro} % -% \begin{macro}{\@xfloat} -% \changes{v3.1}{2007/05/09}{This re-definition added} -% \changes{v3.1b}{2007/09/22}{Will now be redefined in compatibility mode, too} -% We redefine |\@xfloat| so inside floating environments our -% type-specific options will be used, a \package{hyperref} -% anchor will be set etc. +% \begin{macro}{\caption@normalsize} +% \changes{v3.1}{2007/05/05}{This macro and its usage added} +% This one will be used by |\@caption| instead of |\normalsize|.\par +% Its code is equivalent to +% \begin{quote} +% |\caption@font{normal}%| +% \end{quote} +% but executes faster (since the starred form of |\caption@font| +% does not use |\setkeys| internally). % \begin{macrocode} - \let\caption@ORI@xfloat\@xfloat - \def\@xfloat#1[#2]{% - \caption@ORI@xfloat{#1}[#2]% - \caption@settype{#1}}% +\newcommand*\caption@normalsize{% + \caption@font*{\KV@caption@fnt@normal\@unused}} % \end{macrocode} % \end{macro} % +% \begin{macro}{\caption@setfloatcapt} +% Needed for support of the \package{float} package, where the caption will +% not be typeset directly, but catched in a |\vbox| called |\@floatcapt| +% instead. % \begin{macrocode} -} +\let\caption@setfloatcapt\@firstofone % \end{macrocode} % \end{macro} % -% Some packages (like the \package{hyperref} package for example) redefines -% |\caption| and |\@caption|, too. -% So we have to use |\AtBeginDocument| here, so we can make sure -% our definition is the one which will be valid at last. +% \begin{macro}{\caption@makecurrent} +% \begin{macro}{\caption@makeanchor} +% \begin{macro}{\caption@start} +% \begin{macro}{\caption@@start} +% \begin{macro}{\caption@freezeHref} +% \begin{macro}{\caption@defrostHref} +% All these are needed for support of the \package{hyperref} package. % \begin{macrocode} -\caption@AtBeginDocument{\caption@redefine} +\newcommand*\caption@makecurrent[2]{} +\let\caption@makeanchor\@firstofone +\let\caption@start\relax +\let\caption@@start\relax +\let\caption@freezeHref\relax +\let\caption@defrostHref\relax % \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % -% \begin{macro}{\@makecaption} +% \begin{macro}{\caption@gettitle} +% \changes{v3.1}{2007/05/05}{This macro and its usage added} +% This one is needed for support of the \package{nameref} package. % \begin{macrocode} -\let\@makecaption\caption@makecaption +\newcommand\caption@gettitle[1]{% + \@ifundefined{NR@gettitle}% + {\def\@currentlabelname{#1}}% + {\NR@gettitle{#1}}} % \end{macrocode} % \end{macro} % @@ -5471,6 +2052,7 @@ % \begin{macro}{\caption@subtypehook} % \changes{v3.1g}{2008/03/20}{Redefinition of \cs{caption@setlist} added} % \changes{v3.1k}{2009/10/09}{Bugfix 09-08-12b: \cs{@makecaption} will now be restored here, too} +% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now} % Hook, will be used inside \cs{caption@setsubtype}. % \begin{macrocode} \newcommand*\caption@subtypehook{% @@ -5481,7 +2063,7 @@ % no \caption or \subcaption in this (floating) environment yet \caption@Debug{Increment \@captype\ counter =\the\value\@captype}% \caption@l@stepcounter\@captype - \let\addcontentsline\caption@addsubcontentsline}% + \let\caption@@addcontentsline\caption@addsubcontentsline}% % \end{macrocode} % \begin{macrocode} \ifnum\csname caption@c@\@captype\endcsname=\value\@captype \else @@ -5546,20 +2128,13 @@ % \end{macrocode} % \end{macro} % -% \begin{macrocode} -\caption@AtBeginDocument*{% - \@ifundefined{sf@ifpositiontop}{\let\sf@ifpositiontop\@gobbletwo}{}% - \caption@clearsubcontentslines - \g@addto@macro\caption@typehook{\caption@checksubcontentslines}% - \AtEndDocument{\caption@checksubcontentslines}}% -% \end{macrocode} -% % \begin{macro}{\caption@addsubcontentsline} % \changes{v3.1i}{2008/08/02}{Bugfix 08-07-28: % \cs{label}, \cs{index}, and \cs{glossary} are allowed inside the list entry now} +% \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now} % Add a pending sub-caption list entry. % \begin{macrocode} -\newcommand*\caption@addsubcontentsline[3]{% +\newcommand*\caption@addsubcontentsline[4]{% \begingroup \let\label\@gobble \let\index\@gobble \let\glossary\@gobble \protected@edef\@tempa{\endgroup @@ -5568,7 +2143,7 @@ \ifx\@currentHref\@undefined \else \noexpand\def\noexpand\@currentHref{\@currentHref}% \fi - \protect\addcontentsline{#1}{#2}{#3}}}% + \protect\caption@@addcontentsline{#1}{#2}{#3}{#4}}}% \@tempa} % \end{macrocode} % \end{macro} @@ -5596,37 +2171,36 @@ % \end{macrocode} % \end{macro} % +% \begin{macrocode} +\caption@AtBeginDocument*{% + \@ifundefined{sf@ifpositiontop}{\let\sf@ifpositiontop\@gobbletwo}{}% + \caption@clearsubcontentslines + \g@addto@macro\caption@typehook{\caption@checksubcontentslines}% + \AtEndDocument{\caption@checksubcontentslines}}% +% \end{macrocode} +% % \subsection{Document class \& Babel package support} % % \subsubsection{The \AmS{} \& \SmF{} classes} -% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added (package)} +% \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added} % % \begin{macrocode} \@ifundefined{smf@makecaption}{}{\let\smf@makecaption\@makecaption} % \end{macrocode} % % \subsubsection{The beamer class} -% \changes{v3.1}{2007/03/10}{beamer class support added (package)} +% \changes{v3.1}{2007/03/10}{beamer class support added} % % \begin{macrocode} \@ifclassloaded{beamer}{% - \caption@Info{beamer document class}% -% \end{macrocode} -% -% Since the beamer class do not offer a `list of figures' we switch -% this support in \thispackage\ off. -% \begin{macrocode} - \captionsetup{list=false} - \DeclareCaptionOption{list}[1]{} - \DeclareCaptionOption{listof}[1]{} + \caption@InfoNoLine{beamer document class}% % \end{macrocode} % % \begin{macro}{\figure} % \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added} % \begin{macro}{\table} % \changes{v3.1f}{2007/12/17}{This re-definition for \class{beamer} document class added} -% We redefine |figure| \& |table| so our type-specific options will be used, -% a \package{hyperref} anchor will be set etc. +% We redefine |figure| \& |table| so our type-specific options will be used etc. % \begin{macrocode} \expandafter\let\expandafter\caption@ORI@figure \csname\string\figure\endcsname @@ -5660,7 +2234,7 @@ % \end{macrocode} % % \subsubsection{The frenchb Babel option} -% \changes{v3.1}{2006/05/14}{Adaptation to \package{frenchb} added (package)} +% \changes{v3.1}{2006/05/14}{Adaptation to \package{frenchb} added} % % Suppress % ``Package |frenchb.ldf| Warning: The definition of |\@makecaption| has been @@ -5671,11 +2245,11 @@ % \end{macrocode} % % \subsubsection{The frenchle/pro package} -% \changes{v3.0h}{2005/10/03}{Adaptation to \package{frenchle/pro} added (package)} +% \changes{v3.0h}{2005/10/03}{Adaptation to \package{frenchle/pro} added} % % \begin{macrocode} \caption@AtBeginDocument{\@ifundefined{frenchTeXmods}{}{% - \caption@Info{frenchle/pro package is loaded}% + \caption@InfoNoLine{frenchle/pro package is loaded}% % \end{macrocode} % % \begin{macrocode} @@ -5750,6 +2324,25 @@ }} % \end{macrocode} % +% \subsubsection{The hungarian and magyar Babel option} +% \changes{v3.2}{2009/03/29}{\package{magyar} package support added} +% +% \begin{macrocode} +\def\caption@tempa#1{% + \@ifundefined{extras#1}\caption@AtBeginDocument\@firstofone{% + \@ifundefined{extras#1}{}{% + \caption@InfoNoLine{#1 babel option is loaded}% + \expandafter\addto\csname extras#1\endcsname{% + % reverse changes made by magyar.ldf + \let\@makecaption\caption@makecaption + \babel@save\@makecaption + \caption@redefine + \babel@save\@caption}% + }}} +\caption@tempa{hungarian}% +\caption@tempa{magyar}% +% \end{macrocode} +% % \subsection{Package support} % \changes{v3.1}{2007/04/11}{Package options `float', `longtable' etc. % are not supported anymore, removed} @@ -5784,7 +2377,7 @@ % \begin{macrocode} \long\def\caption@@ifpackageloaded#1[#2]{% \@ifpackageloaded{#1}{% - \caption@Info{#1 package is loaded}% + \caption@InfoNoLine{#1 package is loaded}% \@ifpackagelater{#1}{#2}\@firstoftwo{% \caption@Error{% For a successful cooperation we need at least version\MessageBreak @@ -5821,6 +2414,7 @@ % \changes{v3.1c}{2007/10/06}{Bugfix: Made \cs{@caption} long} % \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now} % \changes{v3.1g}{2008/01/29}{Starred variants of \cs{ContinuedFloat} and \cs{captionsetup} added} +% \changes{v3.2}{2010/10/26}{Bugfix 10-09-01a: Uses \cs{ignorespaces} instead of `space hack' again} % |\caption@freeze*|\par % Used by the \package{fltpage} \& \package{sidecap} package support. % \begin{macrocode} @@ -5862,10 +2456,11 @@ \let\caption@@refstepcounter\caption@l@stepcounter \caption@ORI}% \long\def\@caption##1[##2]##3{% - \@bsphack +% \@bsphack \gdef\caption@SClentry{##2}% \gdef\caption@SCtext{##3}% - \@esphack}% +% \@esphack}% + \ignorespaces}% #1{% is \@gobble in star form, and \@firstofone otherwise \def\label##1{\@bsphack\gdef\caption@SClabel{##1}\@esphack}}% % \end{macrocode} @@ -6216,8 +2811,8 @@ \newcommand*\caption@floatflt[1]{% \caption@settype{#1}% \caption@clearmargin - \caption@setoptions{floating#1}% - \let\caption@boxrestore\@parboxrestore}% + \caption@setfullparboxrestore + \caption@setoptions{floating#1}}% % \end{macrocode} % \end{macro} % @@ -6413,14 +3008,22 @@ % \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added} % \changes{v3.1}{2007/03/09}{Usage of \cs{hyper@makecurrent} instead of % \cs{theHfigure} as indicator for \package{hyperref} package} +% \changes{v3.2}{2011/07/30}{Test if \package{hyperref} has stopped early revised} % % \begin{macrocode} \caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{% - \@ifundefined{hyper@makecurrent}{% hyperref has stopped early - \caption@WarningNoLine{% + % Test if hyperref has stopped early + \@ifundefined{ifhyp@stoppedearly}{% + \newif\ifhyp@stoppedearly + \@ifundefined{H@refstepcounter}\hyp@stoppedearlytrue{% + \@ifundefined{hyper@makecurrent}\hyp@stoppedearlytrue{% + \@ifundefined{measuring@true}\hyp@stoppedearlytrue{}}}}{}% + \ifhyp@stoppedearly % hyperref has stopped early + \caption@InfoNoLine{% Hyperref support is turned off\MessageBreak because hyperref has stopped early}% - }{% + \else + % \g@addto@macro\caption@prepareslc{\measuring@true}% % \end{macrocode} % @@ -6680,7 +3283,7 @@ % \end{macro} % % \begin{macrocode} -}}{} + \fi}{} % \end{macrocode} % % \subsubsection{The hypcap package} @@ -6737,6 +3340,7 @@ % \begin{macro}{\lst@MakeCaption} % \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now} % \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added} +% \changes{v3.2}{2010/10/26}{Bugfix 10-07-20a: Set \cs{hsize} to \cs{linewidth}, if necessary} % To support the \package{listings} package we need to redefine % |\lst@MakeCaption| so the original stuff is nested with % |\caption@begin| and |\caption@end| etc. @@ -6747,6 +3351,13 @@ \def\lst@MakeCaption#1{% #1 is `t' or `b' \begingroup % \end{macrocode} +% Workaround for bug in \package{listings} package: +% If |\hsize| seems not to be set correctly, we set it to |\linewidth|. +% \begin{macrocode} + \ifdim\hsize>\linewidth + \hsize\linewidth + \fi +% \end{macrocode} % First of all, we set |position=#1| and if it was set to `top', % we swap the skips so the default behavior of the \package{listings} package % will not be changed. (Note that the \package{listings} package has set its @@ -7055,11 +3666,11 @@ % and |\@makecaption| (as in \package{float} package support) here. % \begin{macrocode} \newcommand*\caption@window[1]{% - \let\caption@boxrestore\@parboxrestore \let\@makecaption\caption@@make \caption@setautoposition b% \caption@settype{#1}% - \caption@clearmargin}% + \caption@clearmargin + \caption@setfullparboxrestore}% % \end{macrocode} % \end{macro} % @@ -7179,12 +3790,12 @@ \caption@freezeHref % will be defrosted in \ivparpic \caption@settype\@piccaptype % \ifnum\c@piccaptionpos>2\relax - \caption@clearmargin + \caption@clearmargin % \else % \captionwidth\z@ % do not use "width=" setting % \fi + \caption@setfullparboxrestore \caption@setoptions{parpic}% - \let\caption@boxrestore\@parboxrestore \caption@setautoposition b% % \end{macrocode} % \begin{macrocode} @@ -7446,7 +4057,7 @@ % \end{macrocode} % % \subsubsection{The subfigure package} -% \changes{v3.1}{2007/04/06}{subfigure package support added (package)} +% \changes{v3.1}{2007/04/06}{subfigure package support added} % % \begin{macrocode} \caption@IfPackageLoaded{subfigure}[2002/01/23 v2.1]{% @@ -7982,17 +4593,6 @@ % \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/xtab/}% % {\emph{The xtab package}},\\ % 2004/05/24 -% -% \bibitem{Anne} -% Anne Br\"uggemann-Klein:\\ -% \emph{Einf\"uhrung in die Dokumentverarbeitung},\\ -% B.G. Teubner, Stuttgart, 1989 -% -% \bibitem{refcount} -% Heiko Oberdiek:\\ -% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/oberdiek/refcount.pdf}% -% {\emph{The refcount package}},\\ -% 2006/02/20 % \end{thebibliography} % % \iffalse diff --git a/Master/texmf-dist/source/latex/caption/caption.ins b/Master/texmf-dist/source/latex/caption/caption.ins index f476f3414f7..c68496061ae 100644 --- a/Master/texmf-dist/source/latex/caption/caption.ins +++ b/Master/texmf-dist/source/latex/caption/caption.ins @@ -6,7 +6,7 @@ \preamble -Copyright (C) 1994-2010 Axel Sommerfeldt (caption@sommerfee.de) +Copyright (C) 1994-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) -------------------------------------------------------------------------- @@ -23,15 +23,17 @@ 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, -ltcaption.dtx, and subcaption.dtx, the derived files caption.sty, -caption2.sty, caption3.sty, ltcaption.sty, and subcaption.sty, and the -user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +caption3.dtx, bicaption.dtx, ltcaption.dtx, and subcaption.dtx, +the derived files caption.sty, caption2.sty, caption3.sty, bicaption.sty, +ltcaption.sty, and subcaption.sty, and the user manuals caption-deu.tex, +caption-eng.tex, and caption-rus.tex. \endpreamble -\generate{\file{caption.sty}{\from{caption.dtx}{package}} - \file{caption3.sty}{\from{caption.dtx}{kernel}}} +\generate{\file{caption.sty}{\from{caption.dtx}{package}}} \generate{\file{caption2.sty}{\from{caption2.dtx}{package}}} +\generate{\file{caption3.sty}{\from{caption3.dtx}{package}}} +\generate{\file{bicaption.sty}{\from{bicaption.dtx}{package}}} \generate{\file{ltcaption.sty}{\from{ltcaption.dtx}{package}}} \generate{\file{subcaption.sty}{\from{subcaption.dtx}{package}}} @@ -39,7 +41,7 @@ user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. \Msg{*} \Msg{* To finish the installation you have to move the files} \Msg{* `caption.sty', `caption2.sty', 'caption3.sty',} -\Msg{* `ltcaption.sty', and `subcaption.sty'} +\Msg{* `bicaption.sty', `ltcaption.sty', and `subcaption.sty'} \Msg{* into a directory searched by TeX.} \Msg{*} \Msg{* To produce the documentation run the file} diff --git a/Master/texmf-dist/source/latex/caption/caption2.dtx b/Master/texmf-dist/source/latex/caption/caption2.dtx index 0172521d3aa..4df70ba1cf4 100644 --- a/Master/texmf-dist/source/latex/caption/caption2.dtx +++ b/Master/texmf-dist/source/latex/caption/caption2.dtx @@ -2,7 +2,7 @@ % % This is file `caption2.dtx'. % -% Copyright (C) 1994-2008 Axel Sommerfeldt (caption@sommerfee.de) +% Copyright (C) 1994-2008 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % @@ -19,9 +19,10 @@ % This Current Maintainer of this work is Axel Sommerfeldt. % % This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% ltcaption.dtx, and subcaption.dtx, the derived files caption.sty, -% caption2.sty, caption3.sty, ltcaption.sty, and subcaption.sty, and the -% user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% caption3.dtx, bicaption.dtx, ltcaption.dtx, and subcaption.dtx, +% the derived files caption.sty, caption2.sty, caption3.sty, bicaption.sty, +% ltcaption.sty, and subcaption.sty, and the user manuals caption-deu.tex, +% caption-eng.tex, and caption-rus.tex. % % \fi % \CheckSum{848} @@ -73,7 +74,7 @@ % This package has version number \fileversion, last revised \filedate.}}%^^A % {caption2 package}} % \author{Axel Sommerfeldt\\ -% \href{mailto:caption@sommerfee.de}{\texttt{caption@sommerfee.de}}} +% \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}} % \date{\docdate} % \maketitle % diff --git a/Master/texmf-dist/source/latex/caption/caption3.dtx b/Master/texmf-dist/source/latex/caption/caption3.dtx new file mode 100644 index 00000000000..cc40823cbc1 --- /dev/null +++ b/Master/texmf-dist/source/latex/caption/caption3.dtx @@ -0,0 +1,4023 @@ +% \iffalse meta-comment +% +% This is file `caption3.dtx'. +% +% Copyright (C) 1994-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) +% +% -------------------------------------------------------------------------- +% +% 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, +% caption3.dtx, bicaption.dtx, ltcaption.dtx, and subcaption.dtx, +% the derived files caption.sty, caption2.sty, caption3.sty, bicaption.sty, +% ltcaption.sty, and subcaption.sty, and the user manuals caption-deu.tex, +% caption-eng.tex, and caption-rus.tex. +% +% \fi +% \CheckSum{4056} +% +% \iffalse +%<*driver> +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesFile{caption3.drv}[2011/08/06 v1.3 Implementation of the caption kernel] +\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up. +%\errorcontextlines=3 +% +\documentclass{ltxdoc} +\setlength\parindent{0pt} +\setlength\parskip{\smallskipamount} +% +%\let\ORIsubsection\subsection +%\def\subsection{\clearpage\ORIsubsection} +% +\makeatletter % make room for subsections like 2.16.14 in the TOC +%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}} +\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}} +\makeatother +% +\usepackage{ifpdf} +\ifpdf + \usepackage{mathptmx,courier} + \usepackage[scaled=0.90]{helvet} + \addtolength\marginparwidth{15pt} +\fi +% +\usepackage{hypdoc} +\ifpdf\usepackage{hypdestopt}\fi +\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}} +% +\usepackage[debug]{caption3}[2011/07/01] +% +\DeclareRobustCommand*\eTeX{\texorpdfstring + {\leavevmode\hbox{$\varepsilon$}-\TeX}% + {e-TeX}} +\DeclareRobustCommand*\AmS{\texorpdfstring + {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}% + {AMS}} +\DeclareRobustCommand*\KOMAScript{\texorpdfstring + {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}% + {KOMA-Script}} +\DeclareRobustCommand*\NTG{NTG} +\DeclareRobustCommand*\SmF{SMF} +% +\begin{document} + \DocInput{caption3.dtx} +\end{document} +% +% \fi +% +% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}} +% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}} +% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}} +% \let\class\puresf \let\package\puresf +% \let\env\purett \let\opt\purett +% +% \def\thispackage{the \package{caption} kernel} +% \def\Thispackage{The \package{caption} kernel} +% +% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} +% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} +% \newcommand*\version[2][]{\textit{v#2}} +% \newcommand*\x{\discretionary{-}{}{}} +% \newcommand*\xx{\discretionary{}{}{}} +% +% \GetFileInfo{caption3.drv} +% \let\docdate\filedate +% \GetFileInfo{caption3.sty} +% +% \title{The Implementation of +% \texorpdfstring{\thispackage\thanks{%^^A +% This package has version number \fileversion, last revised \filedate.}}%^^A +% {the caption kernel}} +% \author{Axel Sommerfeldt\\ +% \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}} +% \date{\docdate} +% \maketitle +% +% \begin{abstract} +% \Thispackage\ 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 provide 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, for example the \package{caption} and +% \package{subfig} packages. +% \end{abstract} +% +% \StopEventually{} +% \clearpage +% \tableofcontents +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \DoNotIndex{\\,\_,\ ,\@@par} +% \DoNotIndex{\@bsphack} +% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname} +% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs} +% \DoNotIndex{\@for,\@firstofone,\@firstoftwo} +% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom} +% \DoNotIndex{\if@minipage\@ifnextchar,\@ifpackagelater,\@ifpackageloaded} +% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue} +% \DoNotIndex{\@namedef,\@nameuse} +% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist} +% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar} +% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc} +% \DoNotIndex{\@testopt} +% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} +% \DoNotIndex{\p@,\z@} +% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup} +% \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{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip} +% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write} +% \DoNotIndex{\providecommand,\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{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \setlength{\parskip}{0pt plus 1pt} +% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par} +% +% \changes{v1.0}{2003/12/20}{Rewritten; many new commands and features} +% \changes{v1.0c}{2004/11/28}{Split into two packages: +% \package{caption} \& \package{caption3}} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \clearpage +% \let\subsubsection\subsection +% \let\subsection\section +% +% \iffalse +%<*package> +% \fi +% +% \subsection{Identification} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{caption3}[2011/08/06 v1.3 caption3 kernel (AR)] +% \end{macrocode} +% +% \subsection{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 tokens to existing macros, like in |\AtBeginDocument|. +% This is the same but it works local, not global +% (using \cs{edef} instead of \cs{xdef}). +% \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} +% \changes{v1.1}{2007/07/29}{Rewritten} +% 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,olga,steven}{yes}{no}| +% \end{quote} +% would expand to |yes|. +% \begin{macrocode} +\newcommand*\caption@ifinlist{% + \@expandtwoargs\caption@@ifinlist} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@ifinlist[2]{% + \begingroup + \def\@tempa##1,#1,##2\@nil{% + \endgroup + \ifx\relax##2\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi}% + \@tempa,#2,#1,\@nil}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifin@list} +% \changes{v1.1}{2007/08/12}{This macro added} +% |\caption@ifin@list|\marg{cmd}\marg{list entry}\marg{yes}\marg{no} +% \begin{macrocode} +\newcommand*\caption@ifin@list[2]{% + \caption@ifempty@list#1% + {\@secondoftwo}% + {\@expandtwoargs\caption@@ifinlist{#2}{#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@g@addto@list} +% \changes{v1.1}{2007/07/29}{This macro added} +% |\caption@g@addto@list|\marg{cmd}\marg{list entry} +% \begin{macrocode} +\newcommand*\caption@g@addto@list[2]{% + \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\caption@l@addto@list} +% \changes{v1.1}{2007/07/29}{This macro added} +% |\caption@l@addto@list|\marg{cmd}\marg{list entry} +% \begin{macrocode} +\newcommand*\caption@l@addto@list[2]{% + \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@g@removefrom@list} +% \changes{v1.1}{2007/07/29}{This macro added} +% |\caption@g@removefrom@list|\marg{cmd}\marg{list entry} +% \begin{macrocode} +\newcommand*\caption@g@removefrom@list[2]{% + \caption@l@removefrom@list#1{#2}% + \global\let#1#1} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\caption@l@removefrom@list} +% \changes{v1.1}{2007/07/29}{This macro added} +% |\caption@l@removefrom@list|\marg{cmd}\marg{list entry}\par +% \Note[Caveat]{\meta{cmd} will be expanded during this process since +% \cs{@removeelement} is using \cs{edef} to build the new list!} +% \begin{macrocode} +\newcommand*\caption@l@removefrom@list[2]{% + \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@for@list} +% \changes{v1.1}{2007/07/29}{This macro added} +% |\caption@for@list|\marg{cmd}\marg{code with \#1} +% \begin{macrocode} +\newcommand*\caption@for@list[2]{% + \caption@ifempty@list#1{}{% + \def\caption@tempb##1{#2}% + \@for\caption@tempa:=#1\do{% + \expandafter\caption@tempb\expandafter{\caption@tempa}}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifempty@list} +% \changes{v1.1}{2007/07/29}{This macro added} +% |\caption@ifempty@list|\marg{cmd}\marg{true}\marg{false} +% \begin{macrocode} +\newcommand*\caption@ifempty@list[1]{% + \ifx#1\@undefined + \expandafter\@firstoftwo + \else\ifx#1\relax + \expandafter\expandafter\expandafter\@firstoftwo + \else\ifx#1\@empty + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\@firstoftwo + \else + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\@secondoftwo + \fi\fi\fi} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \begin{macro}{\caption@setbool} +% \begin{macro}{\caption@set@bool} +% \changes{v1.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added} +% \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} +\newcommand*\caption@setbool[1]{% + \expandafter\caption@set@bool\csname caption@if#1\endcsname} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@set@bool[2]{% + \caption@ifinlist{#2}{1,true,yes,on}{% + \let#1\@firstoftwo + }{\caption@ifinlist{#2}{0,false,no,off}{% + \let#1\@secondoftwo + }{% + \caption@Error{Undefined boolean value `#2'}% + }}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@teststar} +% \changes{v1.1}{2007/05/08}{This macro and its usage added} +% \changes{v1.1e}{2007/10/28}{\cs{caption@teststar@} added} +% |\caption@teststar|\marg{cmd}\marg{star arg}\marg{non-star arg}\\ +% |\caption@teststar@|\marg{cmd}\marg{star arg}\marg{non-star arg} +% \begin{macrocode} +\newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@teststar@[3]{% + \@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}} +\AtBeginDocument{\let\caption@teststar@\caption@teststar} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@ifatletter{% + \ifnum\the\catcode`\@=11 + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\AtBeginDocument{\let\caption@ifatletter\@secondoftwo} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@withoptargs} +% \changes{v1.1}{2007/08/12}{This macro added} +% |\caption@withoptargs|\marg{cmd} +% \begin{macrocode} +\newcommand*\caption@withoptargs[1]{% + \@ifstar + {\def\caption@tempa{*}\caption@@withoptargs#1}% + {\def\caption@tempa{}\caption@@withoptargs#1}} +% \end{macrocode} +% \begin{macrocode} +\def\caption@@withoptargs#1{% + \@ifnextchar[%] + {\caption@@@withoptargs#1}% + {\caption@@@@withoptargs#1}} +% \end{macrocode} +% \begin{macrocode} +\def\caption@@@withoptargs#1[#2]{% + \l@addto@macro\caption@tempa{[{#2}]}% + \caption@@withoptargs#1} +% \end{macrocode} +% \begin{macrocode} +\def\caption@@@@withoptargs#1{% + \expandafter#1\expandafter{\caption@tempa}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@CheckCommand} +% \changes{v1.1}{2007/04/10}{This macro added} +% \begin{macro}{\caption@IfCheckCommand} +% \changes{v1.1}{2007/04/10}{This macro added} +% \changes{v1.2b}{2008/08/02}{Revised so \cs{next} is no longer used} +% |\caption@CheckCommand|\marg{macro}\marg{definition of macro}\par +% checks if a command already exists, with the same definition. +% It can be used more-than-once to check if one of multiple definitions will +% finally match. +% (It redefines itself later on to |\@gobbletwo| if the two commands match +% fine, making further checks harmless.)\par +% |\caption@IfCheckCommand|\marg{true}\marg{false}\par +% will execute the \meta{true} code if one match was finally given, +% the \meta{false} code otherwise. +% (It simply checks if |\caption@CheckCommand| is |\@gobbletwo| and +% restores the starting definition of |\caption@CheckCommand|.) +% \begin{macrocode} +\newcommand\caption@DoCheckCommand[2]{% + \begingroup + \let\@tempa#1% + #2% + \ifx\@tempa#1% + \endgroup + \let\caption@CheckCommand\@gobbletwo + \else + \endgroup + \fi} +\@onlypreamble\caption@DoCheckCommand +% \end{macrocode} +% \begin{macrocode} +\let\caption@CheckCommand\caption@DoCheckCommand +\@onlypreamble\caption@CheckCommand +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@IfCheckCommand{% + \ifx\caption@CheckCommand\@gobbletwo + \let\caption@CheckCommand\caption@DoCheckCommand + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\@onlypreamble\caption@IfCheckCommand +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@AtBeginDocument} +% \changes{v1.1}{2007/04/13}{This macro and its usage added} +% \changes{v1.2e}{2010/01/09}{Adapted to the combine document class} +% |\caption@AtBeginDocument*|\marg{code}\\ +% Same as |\AtBeginDocument| but the execution of code +% will be surrounded by two |\PackageInfo|s. +% The starred variant causes the code to be executed after all code +% specified using the non-starred variant. +% \begin{macrocode} +\let\caption@begindocumenthook\@empty +\let\caption@@begindocumenthook\@empty +% \end{macrocode} +% \begin{macrocode} +\def\caption@AtBeginDocument{% + \caption@teststar\g@addto@macro + \caption@@begindocumenthook\caption@begindocumenthook} +%\@onlypreamble\caption@AtBeginDocument +% \end{macrocode} +% \begin{macrocode} +\AtBeginDocument{% + \caption@InfoNoLine{Begin \noexpand\AtBeginDocument code}% +% \end{macrocode} +% \begin{macrocode} + \def\caption@AtBeginDocument{% + \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}% + \caption@begindocumenthook + \let\caption@begindocumenthook\relax +% \end{macrocode} +% \begin{macrocode} + \def\caption@AtBeginDocument{% + \@ifstar\@firstofone\@firstofone}% + \caption@@begindocumenthook + \let\caption@@begindocumenthook\relax +% \end{macrocode} +% \begin{macrocode} + \caption@InfoNoLine{End \noexpand\AtBeginDocument code}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Information, Warnings, and Errors} +% +% \begin{macro}{\caption@Info} +% \changes{v1.3}{2010/10/25}{Moved from package to kernel} +% |\caption@Info|\marg{message} +% \begin{macrocode} +\newcommand*\caption@Info[1]{% + \PackageInfo{caption}{#1}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\caption@InfoNoLine} +% \changes{v1.3}{2010/10/25}{Moved from package to kernel} +% |\caption@InfoNoLine|\marg{message}\\ +% \Note{The \cs{@gobble} at the end of the 2nd argument of +% \cs{PackageInfo} suppresses the line number info. +% See TLC2\cite{TLC2}, A.4.7, p885 for details.} +% \begin{macrocode} +\newcommand*\caption@InfoNoLine[1]{% + \PackageInfo{caption}{#1\@gobble}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\caption@Warning} +% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings} +% |\caption@Warning|\marg{message} +% \begin{macrocode} +\newcommand*\caption@Warning[1]{% + \caption@WarningNoLine{#1\on@line}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\caption@WarningNoLine} +% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings} +% |\caption@WarningNoLine|\marg{message} +% \begin{macrocode} +\newcommand*\caption@WarningNoLine[1]{% + \PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@wh{% + See the caption package documentation for explanation.} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\caption@Error} +% \changes{v1.0j}{2007/01/20}{This macro added, will now be used for errors} +% \changes{v1.0o}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}} +% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed} +% |\caption@Error|\marg{message} +% \begin{macrocode} +\newcommand*\caption@Error[1]{% + \PackageError{caption}{#1}\caption@eh} +% \end{macrocode} +% \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, especially the\MessageBreak + section about errors.\MessageBreak\@ehc} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\caption@KV@err} +% \changes{v1.1b}{2007/09/18}{This macro added} +% \begin{macrocode} +\let\caption@KV@err\caption@Error +% \end{macrocode} +% \end{macro} +% +% \subsection{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} +% |\undefine@key|\marg{family}\marg{key}\par +% 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}{\@onlypreamble@key} +% \changes{v1.1}{2007/07/22}{This macro added} +% \changes{v1.1e}{2007/11/01}{\cs{KV@err} will be used now instead of \cs{@notprerr}} +% |\onlypreamble@key|\marg{family}\marg{key}\par +% Analogous to |\@onlypreamble| from \LaTeXe. +% \begin{macrocode} +\providecommand*\@preamble@keys{} +\providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}} +\@onlypreamble\@onlypreamble@key +\@onlypreamble\@preamble@keys +% \end{macrocode} +% \begin{macrocode} +\providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}} +% \end{macrocode} +% \begin{macrocode} +\caption@AtBeginDocument*{% + \def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}% + \@preamble@keys + \let\@elt\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareCaptionOption} +% |\DeclareCaptionOption|\marg{option}\oarg{default value}\marg{code}\\ +% |\DeclareCaptionOption*|\marg{option}\oarg{default value}\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{% + \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble} +\@onlypreamble\DeclareCaptionOption +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declareoption[2]{% + #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}} +\@onlypreamble\caption@declareoption +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareCaptionOptionNoValue} +% \changes{v1.1c}{2007/10/06}{This macro added} +% |\DeclareCaptionOptionNoValue|\marg{option}\marg{code}\\ +% |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\par +% Same as \cs{DeclareCaptionOption} but issues an error if a value is given. +% \begin{macrocode} +\newcommand*\DeclareCaptionOptionNoValue{% + \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble} +\@onlypreamble\DeclareCaptionOptionNoValue +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@declareoption@novalue[3]{% + \caption@declareoption{#1}{#2}[\KV@err]{% + \caption@option@novalue{#2}{##1}{#3}}} +\@onlypreamble\caption@declareoption@novalue +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@option@novalue[2]{% + \ifx\KV@err#2% + \expandafter\@firstofone + \else + \KV@err{No value allowed for #1}% + \expandafter\@gobble + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifcaptionsetup@star} +% \changes{v1.2a}{2008/01/12}{This macro added} +% If the starred form of |\captionsetup| is used, this will be set to |true|. +% (It will be reset to |false| at the end of |\caption@setkeys|.) +% \begin{macrocode} +\newif\ifcaptionsetup@star +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\captionsetup} +% \changes{v1.0a}{2004/01/17}{Bugfix: Missing \% added} +% \changes{v1.1}{2007/07/22}{Starred-variant added} +% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically} +% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added} +% \changes{v1.2a}{2008/01/12}{\cs{ifcaptionsetup@star} will be set now} +% |\captionsetup|\oarg{type}\marg{keyval-list of options}\\ +% |\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|. +% (The non-starred variant issues a warning if \meta{keyval-list of options} +% is not used later on.) +% \Note{The starred variant will be used inside packages automatically.} +% \begin{macrocode} +\newcommand*\captionsetup{% + \caption@teststar@\@captionsetup\@gobble\@firstofone} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\@captionsetup[1]{% + \captionsetup@startrue#1\captionsetup@starfalse + \@ifnextchar[\caption@setup@options\caption@setup} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@setup{\caption@setkeys{caption}} +% \end{macrocode} +% \begin{macrocode} +\def\caption@setup@options[#1]#2{% + \@bsphack + \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi + \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}% + \@esphack} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\clearcaptionsetup} +% \changes{v1.1}{2007/07/29}{Optional argument added} +% \changes{v1.1}{2007/08/17}{Starred variant added} +% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically} +% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added} +% |\clearcaptionsetup|\oarg{option}\marg{type}\\ +% |\clearcaptionsetup*|\oarg{option}\marg{type}\par +% This removes the saved option list associated with \meta{type}. +% If \meta{option} is given, only this option will be removed from the list. +% (The starred variant does not issue warnings.) +% \Note{The starred variant will be used inside packages automatically.} +% \begin{macrocode} +\newcommand*\clearcaptionsetup{% + \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\@clearcaptionsetup[1]{% + \let\caption@tempa#1% + \@testopt\@@clearcaptionsetup{}} +% \end{macrocode} +% \begin{macrocode} +\def\@@clearcaptionsetup[#1]#2{% + \@bsphack + \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname + {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}% + {\ifx,#1,% + \caption@clearsetup{#2}% + \else + \caption@@removefromsetup{#1}{#2}% + \fi}% + \@esphack} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@clearsetup[1]{% + \caption@removefromoptlist{#1}% + \@nameundef{caption@opt@#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@removefromsetup{% + \let\caption@tempa\@gobble + \caption@@removefromsetup} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@removefromsetup[2]{% + \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname + \expandafter\let\csname caption@opt@#2\endcsname\@undefined + \def\@tempb##1=##2\@nil{##1}% + \edef\@tempc{#1}% + \@for\@tempa:=\@tempa\do{% + \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}% + \ifx\@tempd\@tempc + \let\caption@tempa\@gobble + \else + \expandafter\expandafter\expandafter\caption@l@addto@list + \expandafter\csname caption@opt@#2\expandafter\endcsname + \expandafter{\@tempa}% + \fi}% + \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname + {\caption@removefromoptlist{#2}}{}% + \caption@tempa{\caption@Warning{% + Option `#1' was not in list `#2'\MessageBreak}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\showcaptionsetup} +% \changes{v1.0d}{2005/05/03}{Optimized for memory usage} +% \changes{v1.1}{2007/07/29}{Bugfix: Does not expand option list anymore} +% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added} +% |\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]{% + \@bsphack + \GenericWarning{}{% + #1 Caption Info: Option list on `#2'\MessageBreak + #1 Caption Data: \@ifundefined{caption@opt@#2}{% + -none-% + }{% + {\expandafter\expandafter\expandafter\strip@prefix + \expandafter\meaning\csname caption@opt@#2\endcsname}% + }}% + \@esphack} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.1}{2007/07/02}{Option \opt{options=} added} +% \changes{v1.3}{2010/09/05}{Option \opt{options*=} added} +% \begin{macrocode} +\DeclareCaptionOption{options}{\caption@setoptions{#1}} +\DeclareCaptionOption{options*}{\caption@setoptions*{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setoptions} +% \changes{v1.0g}{2006/01/03}{Optional argument added} +% \changes{v1.0h}{2006/01/26}{Revised} +% \changes{v1.0j}{2007/01/30}{Optional argument removed} +% \changes{v1.1}{2007/04/11}{Usage of \cs{clearcaptionsetup} added} +% \changes{v1.1}{2007/05/09}{Renamed from \cs{caption@settype} to \cs{caption@setoptions}} +% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed} +% \changes{v1.3}{2010/09/05}{Starred variant added} +% |\caption@setoptions*|\marg{type or environment or\ldots}\par +% Caption options which have been saved with |\captionsetup|\oarg{type} can +% be executed by using this command. +% It simply executes the saved option list (and clears it afterwards), +% if there is any. (The starred variant do not clear the option list.) +% \begin{macrocode} +\newcommand*\caption@setoptions{% + \caption@teststar\caption@set@options\@gobble\@firstofone} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@set@options[2]{% + \caption@Debug{options=#2}% + \expandafter\let\expandafter\caption@opt\csname caption@opt@#2\endcsname + \ifx\caption@opt\relax \else + \caption@xsetup\caption@opt + #1{\caption@clearsetup{#2}}% #1 = \@firstofone -or- \@gobble + \fi} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@addtooptlist} +% \changes{v1.1}{2007/07/22}{This macro added} +% \begin{macro}{\caption@removefromoptlist} +% \changes{v1.1}{2007/07/22}{This macro added} +% \changes{v1.2c}{2008/08/24}{Fatal typo corrected} +% |\caption@addtooptlist|\marg{type}\\ +% |\caption@removefromoptlist|\marg{type}\par +% Adds or removes an \meta{type} to the list of unused caption options. +% Note that the catcodes of \meta{type} are sanitized here so removing +% \meta{type} from the list do not fail when the \package{float} package +% is used (since |\float@getstyle| gives a result which tokens have catcode +% 12 $=$ ``other''). +% \begin{macrocode} +\newcommand*\caption@addtooptlist[1]{% + \@ifundefined{caption@opt@#1@lineno}{% + \caption@dooptlist\caption@g@addto@list{#1}% + \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}% + }{}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@removefromoptlist[1]{% + \caption@dooptlist\caption@g@removefrom@list{#1}% + \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@dooptlist[2]{% + \begingroup + \edef\@tempa{#2}\@onelevel@sanitize\@tempa + \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}% + \endgroup} +% \end{macrocode} +% \begin{macrocode} +\AtEndDocument{% + \caption@for@list\caption@optlist{% + \caption@WarningNoLine{% + Unused \string\captionsetup[#1] + on input line \csname caption@opt@#1@lineno\endcsname}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@setkeys} +% \changes{v1.0g}{2006/01/03}{This macro added} +% \changes{v1.0j}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added} +% \changes{v1.0j}{2007/01/30}{Optional argument added} +% \changes{v1.0n}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter} +% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed, we use \cs{caption@KV@err} instead} +% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added} +% \changes{v1.2a}{2008/01/12}{\cs{captionsetup@starfalse} added} +% \changes{v1.2d}{2009/09/30}{Bugfix 09-09-29: Missing error handler will be defined automatically} +% |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\par +% This one simply calls |\setkeys|\marg{family}\marg{key-values} +% but lets the error messages not refer to the \package{keyval} package, +% but to the \meta{package} package instead. +% \begin{macrocode} +\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys} +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@@setkeys[#1]#2#3{% + \@bsphack +% \end{macrocode} +% \begin{macrocode} + \expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err + \expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx + \expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname + \ifx\KV@err\relax + \def\KV@err##1{\PackageError{#1}{##1}{% + See the #1 package documentation for explanation.}}% + \fi + \let\KV@errx\KV@err + \edef\caption@keydepth{\caption@keydepth i}% +% \end{macrocode} +% \begin{macrocode} + \caption@Debug{\protect\setkeys{#2}{#3}}% + \setkeys{#2}{#3}% +% \end{macrocode} +% \begin{macrocode} + \edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}% + \expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname + \expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname +% \end{macrocode} +% \begin{macrocode} + \ifx\caption@keydepth\@empty \captionsetup@starfalse \fi +% \end{macrocode} +% \begin{macrocode} + \@esphack} +% \end{macrocode} +% \begin{macrocode} +\let\caption@keydepth\@empty +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ExecuteOptions} +% \changes{v1.1}{2007/07/15}{This macro added} +% \changes{v1.3}{2010/09/04}{Depends on package now} +% |\caption@ExecuteOptions|\marg{package}\marg{key-values}\par +% We execute our options using the keyval interface, so we use this one +% instead of |\ExecuteOptions| offered by \LaTeXe. +% \begin{macrocode} +\newcommand*\caption@ExecuteOptions[2]{% + \expandafter\@expandtwoargs\csname caption@setkeys@#1\endcsname{#1}{#2}}% +\@onlypreamble\caption@ExecuteOptions +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ProcessOptions} +% \changes{v1.0a}{2004/01/23}{Bugfix, see +% \purett{news:400D360C.9678329F@gmx.net} for details} +% \changes{v1.0g}{2006/01/03}{Improvement, uses \cs{caption@setkeys} +% instead of \cs{setkeys}} +% \changes{v1.0h}{2006/02/23}{Bugfix, now processes only those global +% options which have a default value} +% \changes{v1.0j}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to +% \cs{caption@ProcessOptions} and moved from the package to the kernel} +% \changes{v1.1}{2007/04/17}{Star variant added} +% |\caption@ProcessOptions*|\marg{package}\par +% We process our options using the keyval package, so we use this one +% instead of |\ProcessOptions| offered by \LaTeXe. +% The starred variant do not process the global options. +% (This code was taken from the \package{hyperref} package\cite{hyperref} +% \version{6.74} and improved.) +% \begin{macrocode} +\newcommand*\caption@ProcessOptions{% + \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone} +\@onlypreamble\caption@ProcessOptions +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@@ProcessOptions[2]{% + \let\@tempc\relax + \let\caption@tempa\@empty + #1{% \@firstofone -or- \@gobble + \@for\CurrentOption:=\@classoptionslist\do{% + \@ifundefined{KV@#2@\CurrentOption}{}{% + \@ifundefined{KV@#2@\CurrentOption @default}{% + \PackageInfo{#2}{Global option `\CurrentOption' ignored}% + }{% + \PackageInfo{#2}{Global option `\CurrentOption' processed}% + \edef\caption@tempa{\caption@tempa\CurrentOption,}% + \@expandtwoargs\@removeelement\CurrentOption + \@unusedoptionlist\@unusedoptionlist + }% + }% + }% + \let\CurrentOption\@empty + }% + \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}% + \AtEndOfPackage{\let\@unprocessedoptions\relax}} +\@onlypreamble\caption@@ProcessOptions +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@SetupOptions} +% \changes{v1.3}{2010/09/04}{This macro added} +% |\caption@SetupOptions|\marg{package}\marg{code}\par +% After calling this macro |\caption@ExecuteOptions| and +% |\usepackage|\oarg{options}\marg{package} +% will both be mapped to \meta{code} with \meta{package} and \meta{options} +% as arguments |#1| and |#2|. (This helps avoiding ``Option clash'' errors.) +% \begin{macrocode} +\newcommand*\caption@packagelist{} +\@onlypreamble\caption@packagelist +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@SetupOptions[2]{% + \@namedef{caption@setkeys@#1}##1##2{#2}% + \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname + \@cons\caption@packagelist{{#1}}} +\@onlypreamble\caption@SetupOptions +% \end{macrocode} +% \begin{macrocode} +\let\caption@onefilewithoptions\@onefilewithoptions +\def\@onefilewithoptions#1[#2]{% + \begingroup + \def\@tempa{% + \endgroup + \caption@onefilewithoptions{#1}[{#2}]}% + \def\@tempb{#1}% + \def\@elt##1{% + \def\@tempc{##1}% + \ifx\@tempb\@tempc + \def\@tempa{% + \endgroup + \caption@ExecuteOptions{#1}{#2}% + \caption@onefilewithoptions{#1}[]}% + \fi} + \caption@packagelist + \@tempa} +\@onlypreamble\caption@onefilewithoptions +% \end{macrocode} +% \end{macro} +% +% \subsection{Margin resp. width} +% \changes{v1.0n}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}} +% \changes{v1.0n}{2007/04/03}{Option `twoside' added} +% \changes{v1.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added} +% \changes{v1.2}{2007/11/10}{Option `oneside' added} +% +% \begin{macro}{\captionmargin} +% \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 \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 |\captionmargin@|. +% \begin{macrocode} +\newdimen\captionmargin +\newdimen\captionmargin@ +\newdimen\captionwidth +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{margin}{\setcaptionmargin{#1}} +\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}} +\DeclareCaptionOption{width}{\setcaptionwidth{#1}} +\DeclareCaptionOption{width*}{\setcaptionwidth*{#1}} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOption{calcmargin}{\caption@setcalcmargin{#1}} +\DeclareCaptionOption{calcmargin*}{\caption@setcalcmargin*{#1}} +\DeclareCaptionOption{calcwidth}{\caption@setcalcwidth{#1}} +\DeclareCaptionOption{calcwidth*}{\caption@setcalcwidth*{#1}} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}} +\DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}} +\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}} +% \end{macrocode} +% +% \begin{macro}{\setcaptionmargin} +% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}} +% \changes{v1.0f}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take +% left+right margin} +% \changes{v1.1}{2007/08/11}{Starred variant added} +% \changes{v1.1}{2007/08/12}{\cs{setlength}\cs{captionmargin} \& +% \cs{setlength}\cs{captionmargin@} swapped so +% `\texttt{margin*=}\cs{captionmargin}' works in singleline options} +% \changes{v1.3}{2010/11/07}{Support for option \opt{calcmargin} added} +% |\setcaptionmargin|\marg{amount}\\ +% |\setcaptionmargin*|\marg{amount}\par +% Please never use this in user documents, it's just there to +% provide compatibility to the \package{caption2} package. +% \begin{macrocode} +\newcommand*\setcaptionmargin{% + \caption@resetcalcmargin + \caption@setmargin} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@setmargin{% + \caption@teststar\caption@@setmargin\@gobble\@firstofone} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setmargin[2]{% + #1{\captionwidth\z@}% + \caption@@@setmargin#2,#2,\@nil} +% \end{macrocode} +% \begin{macrocode} +\def\caption@@@setmargin#1,#2,#3\@nil{% + \setlength\captionmargin@{#2}% + \setlength\captionmargin{#1}% + \addtolength\captionmargin@{-\captionmargin}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setcaptionwidth} +% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}} +% \changes{v1.3}{2010/11/07}{Starred variant added} +% \changes{v1.3}{2010/11/07}{Support for option \opt{calcwidth} added} +% |\setcaptionwidth|\marg{amount}\\ +% |\setcaptionwidth*|\marg{amount}\par +% Please never use this in user documents, it's just there to +% provide compatibility to the \package{caption2} package. +% \begin{macrocode} +\newcommand*\setcaptionwidth{% + \caption@resetcalcmargin + \caption@setwidth} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@setwidth{% + \caption@teststar\caption@@setwidth\@gobble\@firstofone} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setwidth[2]{% + #1{\captionmargin\z@\captionmargin@\z@}% + \setlength\captionwidth{#2}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@resetcalcmargin} +% \changes{v1.3}{2010/11/07}{This macro added} +% \begin{macrocode} +\newcommand*\caption@resetcalcmargin{% + \let\caption@calcmargin@hook\@empty} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setcalcmargin} +% \changes{v1.3}{2010/11/07}{This macro added} +% \begin{macrocode} +\newcommand*\caption@setcalcmargin{% + \caption@teststar{\caption@@setcalcmargin\caption@setmargin}% + \@secondoftwo\@firstoftwo} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setcalcmargin[3]{% + #2{\caption@resetcalcmargin + \l@addto@macro\caption@calcmargin@hook{#1{#3}}}% + {\l@addto@macro\caption@calcmargin@hook{#1*{#3}}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setcalcwidth} +% \changes{v1.3}{2010/11/07}{This macro added} +% \begin{macrocode} +\newcommand*\caption@setcalcwidth{% + \caption@teststar{\caption@@setcalcmargin\caption@setwidth}% + \@secondoftwo\@firstoftwo} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@counter} +% \changes{v1.0n}{2007/04/03}{This counter added} +% \changes{v1.1e}{2007/10/28}{Renamed to \cs{caption@thecounter}; \cs{caption@stepcounter} added} +% This counter numbers the captions. At the moment it will be used inside +% |\caption@ifoddpage| only. +% \begin{macrocode} +\newcommand*\caption@thecounter{0} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@stepcounter{% + \@tempcnta\caption@thecounter + \advance\@tempcnta\@ne + \xdef\caption@thecounter{\the\@tempcnta}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@newlabel} +% \changes{v1.0n}{2007/04/03}{This macro added} +% This command is a modified version of |\newlabel| from \LaTeX2e. +% It will be written to the \texttt{.aux} file to +% pass label information from one run to another. +% (We use it inside |\caption@ifoddpage| and |\caption@ragged|.) +% \begin{macrocode} +\newcommand*\caption@newlabel{\@newl@bel{caption@r}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@thepage} +% \changes{v1.0n}{2007/04/03}{This macro added} +% This command is a modified version of |\thepage| from \LaTeX2e. +% It will be used inside |\caption@ifoddpage| only. +% \begin{macrocode} +\newcommand*\caption@thepage{\the\c@page} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@label} +% \changes{v1.1}{2007/09/01}{This macro added} +% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@newlabel} in AUX file added} +% This command is a modified version of |\label| from \LaTeX2e. +% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|. +% \begin{macrocode} +\newcommand*\caption@label[1]{% + \caption@@label + \protected@write\@auxout{\let\caption@thepage\relax}% + {\string\caption@newlabel{#1}{\caption@thepage}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@label{% + \global\let\caption@@label\relax + \protected@write\@auxout{}% + {\string\providecommand*\string\caption@newlabel[2]{}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@pageref} +% \changes{v1.1}{2007/09/01}{This macro added} +% \changes{v1.2d}{2009/10/09}{Uses \cs{@latex@warning} instead of \cs{caption@Warning} now} +% This command is a modified version of |\pageref| from \LaTeX2e. +% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|. +% \begin{macrocode} +\newcommand*\caption@pageref[1]{% + \expandafter\ifx\csname caption@r@#1\endcsname\relax + \G@refundefinedtrue % => 'There are undefined references.' + \@latex@warning{Reference `#1' on page \thepage \space undefined}% + \else + \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifoddpage} +% \changes{v1.0n}{2007/04/03}{This macro added} +% \changes{v1.1e}{2007/10/28}{Incrementation of counter moved to \cs{caption@@make}} +% At the moment this macro uses an own label\ldots ref mechanism, +% but an alternative implementation method would be using the +% \package{refcount} package\cite{refcount} and |\ifodd\getpagerefnumber{|\ldots|}|. +% \Note{This macro re-defines itself so the \texttt{.aux} file will +% only be used once per group.} +% \begin{macrocode} +\newcommand*\caption@ifoddpage{% + \caption@iftwoside{% + \caption@label\caption@thecounter + \caption@pageref\caption@thecounter + \ifodd\caption@thepage + \let\caption@ifoddpage\@firstoftwo + \else + \let\caption@ifoddpage\@secondoftwo + \fi + }{\let\caption@ifoddpage\@firstoftwo}% +% \end{macrocode} +% \begin{macrocode} + \caption@ifoddpage} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setoptcmd} +% \changes{v1.1}{2007/08/11}{This macro added} +% |\caption@setoptcmd|\marg{cmd}\marg{off -or- value} +% \begin{macrocode} +\newcommand*\caption@setoptcmd[2]{% + \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Indentions} +% +% \begin{macro}{\caption@indent} +% \changes{v1.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}} +% \begin{macro}{\caption@parindent} +% \begin{macro}{\caption@hangindent} +% These are the indentions we support. +% \begin{macrocode} +\newdimen\caption@indent +\newdimen\caption@parindent +\newdimen\caption@hangindent +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \changes{v1.0b}{2004/05/16}{Defaults added for options \opt{parindent=} +% and \opt{hangindent=}} +% \changes{v1.0f}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption} +% replaced by \cs{caption@@par}} +% \changes{v1.0f}{2005/08/22}{Undocumented defaults for \opt{parindent=}, +% \opt{hangindent=}, and \opt{parskip=} removed} +% \begin{macrocode} +\DeclareCaptionOption{indent}[\leftmargini]{% obsolete! + \setlength\caption@indent{#1}} +\DeclareCaptionOption{indention}[\leftmargini]{% + \setlength\caption@indent{#1}} +\DeclareCaptionOption{parindent}{% + \setlength\caption@parindent{#1}} +\DeclareCaptionOption{hangindent}{% + \setlength\caption@hangindent{#1}} +\DeclareCaptionOption{parskip}{% + \l@addto@macro\caption@@par{\setlength\parskip{#1}}} +% \end{macrocode} +% +% \changes{v1.0f}{2005/08/22}{Increased compatibility to KOMA-Script: +% A special version of options `parindent' and `parskip' added} +% \changes{v1.0g}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of +% `parskip' and `parindent' options revised and moved into caption kernel} +% \changes{v1.0h}{2006/02/23}{KOMA-Script variants of `parskip' and +% `parindent' are obsolete now, removed} +% \changes{v1.0m}{2007/03/30}{KOMA-Script variants of `parskip' and +% `parindent' re-added, since they still collide with the current +% version of the subfig package (Sigh!)} +% +% There is an option clash between the \KOMAScript\ document classes +% and the \package{caption} kernel, both define the options |parindent| and +% |parskip| but with different meaning. +% Furthermore the ones defined by the \package{caption} kernel take a +% value as parameter but the \KOMAScript\ ones do not. +% So we need special versions of the options |parindent| and |parskip| here +% which determine if a value is given (and therefore should be treated as +% our option) or not (and therefore should be ignored by us).\footnote{%^^A +% This problem was completely solved due a change of \cs{caption@ProcessOptions} +% in \thispackage\ \version{1.0h}, but we still need this workaround since +% these options would otherwise still collide with the current version $1.3$ +% of the \package{subfig} package (Sigh!)} +% \begin{macrocode} +\providecommand*\caption@ifkomaclass{% + \@ifundefined{scr@caption}\@gobble\@firstofone} +\@onlypreamble\caption@ifkomaclass +% \end{macrocode} +% \begin{macrocode} +\caption@ifkomaclass{% +% \end{macrocode} +% \begin{macrocode} + \let\caption@KV@parindent\KV@caption@parindent + \DeclareCaptionOption{parindent}[]{% + \ifx,#1,% + \caption@Debug{Option `parindent' ignored}% + \else + \caption@KV@parindent{#1}% + \fi}% +% \end{macrocode} +% \begin{macrocode} + \let\caption@KV@parskip\KV@caption@parskip + \DeclareCaptionOption{parskip}[]{% + \ifx,#1,% + \caption@Debug{Option `parskip' ignored}% + \else + \caption@KV@parskip{#1}% + \fi}% +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% +% \subsection{Styles} +% +% \begin{macro}{\DeclareCaptionStyle} +% \changes{v1.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]{% + \@testopt{\caption@declarestyle{#1}}{}} +\@onlypreamble\DeclareCaptionStyle +% \end{macrocode} +% \begin{macrocode} +\def\caption@declarestyle#1[#2]#3{% + \global\@namedef{caption@sls@#1}{#2}% + \global\@namedef{caption@sty@#1}{#3}} +\@onlypreamble\caption@declarestyle +% \end{macrocode} +% \end{macro} +% +% \changes{v1.2a}{2008/01/20}{Option \opt{style*=} added} +% \changes{v1.2b}{2008/05/06}{Option \opt{slc=} added} +% \begin{macrocode} +\DeclareCaptionOption{style}{\caption@setstyle{#1}} +\DeclareCaptionOption{style*}{\caption@setstyle*{#1}} +\DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}} +\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setstyle} +% \changes{v1.0e}{2005/06/01}{Starred variant added} +% \changes{v1.1}{2007/07/29}{Recursive style definitions should work now} +% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} +% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed} +% |\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 base ones (this will be done using +% |\caption@resetstyle|) and executing the \meta{list-of-KV} options +% (this will be done using |\caption@setup|).\par +% The starred version will give no error message if the given style is not +% defined. +% \begin{macrocode} +\newcommand*\caption@setstyle{% + \caption@teststar\caption@@setstyle\@gobble\@firstofone} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setstyle[2]{% + \@ifundefined{caption@sty@#2}% + {#1{\caption@Error{Undefined style `#2'}}}% + {\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname + \ifx\caption@setstyle@flag\@undefined + \let\caption@setstyle@flag\relax + \caption@resetstyle + \caption@xsetup\caption@sty + \let\caption@setstyle@flag\@undefined + \else + \caption@xsetup\caption@sty + \fi + \expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname + \expandafter\caption@l@addto@list\expandafter\caption@opt@singleline + \expandafter{\caption@sls}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@resetstyle} +% \changes{v1.1}{2007/02/04}{% +% This macro renamed from \cs{caption@setdefault} to \cs{caption@resetstyle}} +% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} +% \changes{v1.2}{2007/11/17}{Usage of \texttt{size=} added} +% \changes{v1.2b}{2008/05/06}{Usage of \texttt{rule} added} +% This resets (nearly) all caption options to the base ones. +% \emph{Note that this does not touch the skips and the positioning!} +% \begin{macrocode} +\newcommand*\caption@resetstyle{% + \caption@setup{% + format=plain,labelformat=default,labelsep=colon,textformat=simple,% + justification=justified,font=,size=,labelfont=,textfont=,% + margin=0pt,minmargin=0,maxmargin=0,% + indent=0pt,parindent=0pt,hangindent=0pt,% + slc,rule,strut}% + \caption@clearsetup{singleline}} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.0c}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}} +% \changes{v1.1}{2007/02/04}{Caption style `default' renamed to `base', and a new `default' added} +% \changes{v1.1}{2007/03/31}{\opt{format=plain} added to caption style \opt{default}} +% \changes{v1.1c}{2007/10/14}{\opt{format=plain} removed from caption style \opt{default}} +% Currently there are two pre-defined styles, called `base' \& `default'. +% The first one is a perfect match to the behavior of |\@makecaption| offered +% by the standard \LaTeX\ document classes (and was called `default' in +% \thispackage\ \version{1.0}), the second one matches the document +% class actually used. +% \begin{macrocode} +\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{} +\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{% + format=default,labelsep=default,textformat=default,% + justification=default,font=default,labelfont=default,textfont=default} +% \end{macrocode} +% +% \subsection{Formats} +% +% \begin{macro}{\DeclareCaptionFormat} +% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces +% between arguments do make any harm} +% \changes{v1.0c}{2005/02/09}{Starred variant added} +% \changes{v1.1c}{2007/10/15}{Optional argument 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{% + \caption@teststar\caption@declareformat\@gobble\@firstofone} +\@onlypreamble\DeclareCaptionFormat +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declareformat[2]{% + \@dblarg{\caption@@declareformat#1{#2}}} +\@onlypreamble\caption@declareformat +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@@declareformat#1#2[#3]#4{% + \global\expandafter\let\csname caption@ifh@#2\endcsname#1% + \global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}% + \global\long\@namedef{caption@fmt@#2}##1##2##3{#4}} +\@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}% + {\caption@Error{Undefined format `#1'}}% + {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname + \expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname + \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareCaptionDefaultFormat} +% \changes{v1.2a}{2008/01/31}{This macro added} +% \begin{macrocode} +\newcommand*\DeclareCaptionDefaultFormat[1]{% + \expandafter\def\expandafter\caption@fmt@default\expandafter + {\csname caption@fmt@#1\endcsname}% + \expandafter\def\expandafter\caption@slfmt@default\expandafter + {\csname caption@slfmt@#1\endcsname}% + \expandafter\def\expandafter\caption@ifh@default\expandafter + {\csname caption@ifh@#1\endcsname}} +\@onlypreamble\DeclareCaptionDefaultFormat +% \end{macrocode} +% \end{macro} +% +% \changes{v1.0a}{2004/01/23}{% +% Caption format \opt{default} renamed to \opt{normal}} +% \changes{v1.0e}{2005/05/12}{% +% Caption format \opt{normal} renamed to \opt{@normal}} +% \changes{v1.0f}{2005/08/25}{% +% Caption format \opt{@normal} renamed to \opt{plain} and documented} +% \changes{v1.1c}{2007/10/14}{% +% Single-line variant of caption format \opt{hang} added} +% There are two pre-defined formats, called `plain' and `hang'. +% \begin{macrocode} +\DeclareCaptionFormat{plain}{#1#2#3\par} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionFormat{hang}[#1#2#3\par]{% + \caption@ifin@list\caption@lsepcrlist\caption@lsepname + {\caption@Error{% + The option `labelsep=\caption@lsepname' does not work\MessageBreak + with `format=hang'}}% + {\@hangfrom{#1#2}% + \advance\caption@parindent\hangindent + \advance\caption@hangindent\hangindent + \caption@@par#3\par}} +% \end{macrocode} +% +% \changes{v1.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{plain}} +% \changes{v1.0d}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added} +% `default' usually maps to `plain'. +% \begin{macrocode} +\DeclareCaptionDefaultFormat{plain} +% \end{macrocode} +% +% \subsection{Label formats} +% +% \begin{macro}{\DeclareCaptionLabelFormat} +% \changes{v1.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}% + {\caption@Error{Undefined label format `#1'}}% + {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.2}{2007/12/16}{Caption label format \opt{brace} added} +% There are four pre-defined label formats, called `empty', `simple', +% `parens', and `brace'. +% \begin{macrocode} +\DeclareCaptionLabelFormat{empty}{} +\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2} +\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)} +\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)} +% \end{macrocode} +% +% `default' usually maps to `simple'. +% \begin{macrocode} +\def\caption@lfmt@default{\caption@lfmt@simple} +% \end{macrocode} +% +% \subsection{Label separators} +% +% \begin{macro}{\DeclareCaptionLabelSeparator} +% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces +% between arguments do make any harm} +% \changes{v1.0f}{2005/08/25}{Starred variant added} +% \changes{v1.1}{2007/07/13}{Test for CR added} +% \changes{v1.3}{2011/08/06}{Test for CR revised} +% |\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{% + \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone} +\@onlypreamble\DeclareCaptionLabelSeparator +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@declarelabelseparator[3]{% + \global\@namedef{caption@iflf@#2}{#1}% + \global\long\@namedef{caption@lsep@#2}{#3}% + \caption@@declarelabelseparator{#2}#3\\\@nil} +\@onlypreamble\caption@declarelabelseparator +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@@declarelabelseparator#1#2\\#3\@nil{% + \def\@tempa{#3}\ifx\@tempa\@empty \else + \caption@g@addto@list\caption@lsepcrlist{#1}% + \fi} +\@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}% + {\caption@Error{Undefined label separator `#1'}}% + {\edef\caption@lsepname{#1}% + \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{v1.0e}{2005/06/11}{Bugfix 05-03-23: Caption label separator +% \opt{newline} implementation changed from \cs{newline} to \cs{\textbackslash}} +% \changes{v1.0f}{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} +% +% \begin{macro}{\caption@setdefaultlabelsep} +% \changes{v1.2d}{2009/03/29}{This macro added} +% \begin{macrocode} +\newcommand*\caption@setdefaultlabelsep[1]{% + \ifx\caption@lsep\caption@lsep@default + \caption@set@default@labelsep{#1}% + \caption@setlabelseparator{default}% + \else + \caption@set@default@labelsep{#1}% + \fi} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@set@default@labelsep[1]{% + \def\caption@lsep@default{\@nameuse{caption@lsep@#1}}% + \def\caption@iflf@default{\@nameuse{caption@iflf@#1}}} +% \end{macrocode} +% \end{macro} +% +% `default' usually maps to `colon'. +% \begin{macrocode} +\caption@set@default@labelsep{colon} +% \end{macrocode} +% +% \subsection{Text formats} +% +% \begin{macro}{\DeclareCaptionTextFormat} +% \changes{v1.0j}{2007/02/18}{This macro added} +% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1} +% \begin{macrocode} +\newcommand*\DeclareCaptionTextFormat[2]{% + \global\long\@namedef{caption@tfmt@#1}##1{#2}} +\@onlypreamble\DeclareCaptionTextFormat +% \end{macrocode} +% \end{macro} +% +% \changes{v1.0c}{2005/02/12}{Option \opt{strut=} added} +% \begin{macrocode} +\DeclareCaptionOption{textformat}{\caption@settextformat{#1}} +\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@settextformat} +% \changes{v1.0j}{2007/02/18}{This macro added} +% |\caption@settextformat|\marg{name}\par +% Selecting a caption text format simply means saving the code (in |\caption@tfmt|). +% \begin{macrocode} +\newcommand*\caption@settextformat[1]{% + \@ifundefined{caption@tfmt@#1}% + {\caption@Error{Undefined text format `#1'}}% + {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}} +% \end{macrocode} +% \end{macro} +% +% There are two pre-defined text formats, called `simple' and `period'. +% \begin{macrocode} +\DeclareCaptionTextFormat{simple}{#1} +\DeclareCaptionTextFormat{period}{#1.} +% \end{macrocode} +% +% `default' usually maps to `simple'. +% \begin{macrocode} +\def\caption@tfmt@default{\caption@tfmt@simple} +% \end{macrocode} +% +% \subsection{Fonts} +% +% \begin{macro}{\DeclareCaptionFont} +% \changes{v1.0a}{2004/01/22}{% +% Bugfix: Multi token arguments are allowed now} +% \changes{v1.1}{2007/05/07}{% +% Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now} +% |\DeclareCaptionFont|\marg{name}\marg{code} +% \begin{macrocode} +\newcommand*\DeclareCaptionFont[2]{% + \define@key{caption@fnt}{#1}[]{\l@addto@macro\caption@fnt{#2}}} +\@onlypreamble\DeclareCaptionFont +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareCaptionDefaultFont} +% \changes{v1.1}{2006/05/14}{This macro added} +% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionFont} to \cs{DeclareCaptionDefaultFont}} +% |\DeclareCaptionDefaultFont|\marg{name}\marg{code} +% \begin{macrocode} +\newcommand*\DeclareCaptionDefaultFont[2]{% + \global\@namedef{caption#1@default}{#2}} +\@onlypreamble\DeclareCaptionDefaultFont +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{font}{\caption@setfont{font}{#1}} +\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}} +\DeclareCaptionDefaultFont{font}{} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}} +\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}} +\DeclareCaptionDefaultFont{labelfont}{} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}} +\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}} +\DeclareCaptionDefaultFont{textfont}{} +% \end{macrocode} +% +% \begin{macro}{\caption@setfont} +% \changes{v1.0j}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument} +% \changes{v1.1}{2006/05/14}{Support of \cs{DeclareDefaultCaptionFont} added} +% |\caption@setfont|\marg{name}\marg{keyval-list of names}\par +% Selecting a caption font means saving all the code snippets +% in |\caption|\meta{name}. +% \begin{macrocode} +\newcommand*\caption@setfont[1]{% + \expandafter\let\csname caption#1\endcsname\@empty + \caption@addtofont{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@addtofont} +% \changes{v1.2}{2007/11/17}{This macro added} +% |\caption@addtofont|\marg{name}\marg{keyval-list of names}\par +% Like |\caption@setfont|, but adds the code snippets to |\caption|\meta{name}.\par +% Because we use |\setkeys| recursive here we need to do this inside an +% extra group. +% \begin{macrocode} +\newcommand*\caption@addtofont[2]{% + \begingroup + \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname + \define@key{caption@fnt}{default}[]{% + \l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}% + \caption@setkeys[caption]{caption@fnt}{#2}% + \global\let\caption@tempa\caption@fnt + \endgroup + \expandafter\let\csname caption#1\endcsname\caption@tempa} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@font} +% \changes{v1.1}{2007/05/07}{This macro added} +% |\caption@font|\marg{keyval-list of names}\\ +% |\caption@font*|\marg{keyval-code}\par +% Sets the given font, e.g.~|\caption@font{small,it}| +% is equivalent to |\small\itshape|. +% \begin{macrocode} +\newcommand*\caption@font{% + \caption@teststar\caption@@font\@firstofone + {\caption@setkeys[caption]{caption@fnt}}} +\newcommand*\caption@@font[2]{% + \begingroup + \def\caption@fnt{\endgroup}% + #1{#2}% + \caption@fnt} +% \end{macrocode} +% \end{macro} +% +% These are the pre-defined font code snippets. +% +% \changes{v1.1}{2007/05/07}{Color font support added} +% \begin{macrocode} +\DeclareCaptionFont{normalcolor}{\normalcolor} +\DeclareCaptionFont{color}{\color{#1}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionFont{normalfont}{\normalfont} +\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{macrocode} +\DeclareCaptionFont{scriptsize}{\scriptsize} +\DeclareCaptionFont{footnotesize}{\footnotesize} +\DeclareCaptionFont{small}{\small} +\DeclareCaptionFont{normalsize}{\normalsize} +\DeclareCaptionFont{large}{\large} +\DeclareCaptionFont{Large}{\Large} +% \end{macrocode} +% +% \changes{v1.3}{2011/01/01}{\package{sansmath} package support added} +% \begin{macrocode} +\DeclareCaptionFont{sansmath}{\sansmath} +% \end{macrocode} +% +% \changes{v1.0n}{2007/04/02}{\package{setspace} package support added} +% \changes{v1.2d}{2009/10/09}{Bugfix 09-05-18: \package{setspace} package support revised} +% \begin{macrocode} +\DeclareCaptionFont{singlespacing}{% + \@ifundefined{setspace@singlespace}{}{% + \setstretch\setspace@singlespace}}% normally 1 +\DeclareCaptionFont{onehalfspacing}{\onehalfspacing} +\DeclareCaptionFont{doublespacing}{\doublespacing} +\DeclareCaptionFont{stretch}{\setstretch{#1}} +% \end{macrocode} +% +% \begin{macrocode} +%\DeclareCaptionFont{normal}{% +% \caption@font{normalcolor,normalfont,normalsize,singlespacing} +\DeclareCaptionFont{normal}{% + \caption@font*{% + \KV@caption@fnt@normalcolor\@unused + \KV@caption@fnt@normalfont\@unused + \KV@caption@fnt@normalsize\@unused + \KV@caption@fnt@singlespacing\@unused}} +% \end{macrocode} +% +% \changes{v1.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}} +% The old versions \version{1.x} of \thispackage\ offered this +% command to setup the font size used for captions. We still do +% so old documents will work fine. +% \begin{macrocode} +\DeclareCaptionOption{size}{\caption@setfont{size}{#1}} +\DeclareCaptionDefaultFont{size}{} +% \end{macrocode} +% +% \subsection{Justifications} +% +% \begin{macro}{\DeclareCaptionJustification} +% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces +% between arguments do make any harm} +% \changes{v1.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}} +% |\DeclareCaptionJustification|\marg{name}\marg{code} +% \begin{macrocode} +\newcommand*\DeclareCaptionJustification[2]{% + \global\@namedef{caption@hj@#1}{#2}% for compatibility to v1.0 + \DeclareCaptionFont{#1}{#2}} +\@onlypreamble\DeclareCaptionJustification +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareCaptionDefaultJustification} +% \changes{v1.1}{2007/07/03}{This macro added} +% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionJustification} to \cs{DeclareCaptionDefaultJustification}} +% |\DeclareCaptionDefaultJustification|\marg{code} +% \begin{macrocode} +\newcommand*\DeclareCaptionDefaultJustification[1]{% + \global\@namedef{caption@hj@default}{#1}% for compatibility to v1.0 + \DeclareCaptionDefaultFont{@hj}{#1}} +\@onlypreamble\DeclareCaptionDefaultJustification +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{justification}{\caption@setjustification{#1}} +\DeclareCaptionDefaultJustification{} +% \end{macrocode} +% +% \begin{macro}{\caption@setjustification} +% \changes{v1.1}{2007/07/03}{Mapped to \cs{caption@setfont}} +% |\caption@setjustification|\marg{name}\par +% Selecting a caption justification simply means saving the code (in |\caption@hj|). +% \begin{macrocode} +\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}{\centerfirst} +\DeclareCaptionJustification{centerlast}{\centerlast} +\DeclareCaptionJustification{raggedleft}{\raggedleft} +\DeclareCaptionJustification{raggedright}{\raggedright} +% \end{macrocode} +% +% \begin{macro}{\centerfirst} +% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)} +% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}} +% Please blame Frank Mittelbach for the code of |\centerfirst| |:-)| +% \begin{macrocode} +\providecommand\centerfirst{% + \let\\\@centercr + \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}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\centerlast} +% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)} +% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}} +% This is based on code from Anne Br\"uggemann-Klein\cite{Anne} +% \begin{macrocode} +\providecommand\centerlast{% + \let\\\@centercr + \leftskip\z@\@plus 1fil% + \rightskip\z@\@plus -1fil% + \parfillskip\z@\@plus 2fil\relax} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{The ragged2e package} +% \changes{v1.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} +% \changes{v1.0n}{2007/04/07}{The `ragged2e' package will now only been +% loaded when needed} +% \changes{v1.0o}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced +% by \cs{caption@Debug}} +% \changes{v1.1}{2007/04/16}{A different warning will be given on first \LaTeX\ run} +% |\caption@ragged| will be basically defined as +% \begin{quote} +% |\AtBeginDocument{\IfFileExists{ragged2e.sty}%|\\ +% | {\RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}%|\\ +% | {\let\caption@ragged\@secondoftwo}}| +% \end{quote} +% but with an additional warning if the ragged2e package is not loaded (yet). +% (This warning will be type out only one time per option, that's why +% we need the |caption\string#1| stuff.) +% Furthermore we load the \package{ragged2e} package, if needed and available. +% \begin{macrocode} +\newcommand*\caption@ragged{% + \caption@Debug{We need ragged2e}% + \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}% + \global\let\caption@ragged\caption@@ragged + \caption@ragged} +% \end{macrocode} +% \begin{macrocode} +\caption@AtBeginDocument{% + \@ifundefined{caption@r@ragged2e}{% + \newcommand*\caption@@ragged{% + \caption@Warning{% + `ragged2e' support has been changed.\MessageBreak + Rerun to get captions right}% + \global\let\caption@ragged\@secondoftwo % suppress further warnings + \caption@ragged}% + }{% + \caption@Debug{We load ragged2e}% + \IfFileExists{ragged2e.sty}{% + \RequirePackage{ragged2e}% + \let\caption@@ragged\@firstoftwo + }{% + \newcommand*\caption@@ragged[2]{% + \@ifundefined{caption\string#1}{% + \caption@Warning{% + `ragged2e' package not loaded, therefore\MessageBreak + substituting \string#2 for \string#1\MessageBreak}% + \global\@namedef{caption\string#1}}{}% + #2}% + }% + }} +% \end{macrocode} +% \begin{macrocode} +% \end{macrocode} +% \end{macro} +% +% \subsection{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{v1.0c}{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} +% +% \begin{macro}{\caption@rule} +% \changes{v1.2b}{2008/05/06}{This macro added} +% |\caption@rule|\par +% Draws an invisible rule to adjust the ``skip'' setting. +% \begin{macrocode} +\newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@hrule{\hrule\@height\z@} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.2b}{2008/05/06}{Option \opt{rule=} added} +% \begin{macrocode} +\DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}} +% \end{macrocode} +% +% \subsection{Positioning} +% +% These macros handle the right position of the caption. +% Note that the position is actually \emph{not} controlled by the +% \package{caption3} 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. +% +% \begin{macrocode} +\DeclareCaptionOption{position}{\caption@setposition{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setposition} +% \changes{v1.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b}, +% \opt{below}, and \opt{a} are allowed, too} +% \changes{v1.0c}{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}{% + \let\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 + }{% + \caption@Error{Undefined position `#1'}% + }}}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@defaultpos} +% \changes{v1.1}{2007/05/08}{Default position changed from `bottom' to `auto'} +% The default `position' is `auto', this means that \thispackage\ will try +% to guess the current position of the caption. +% (But in many cases, for example in |longtable|s, this is doomed to fail!)\par +% The setting `bottom' correspondents to the |\@makecaption| implementation +% in the standard \LaTeX\ document classes, but `auto' should give better +% results in most cases. +% \begin{macrocode} +%\caption@setdefaultpos{a}% default = auto +\let\caption@defaultpos\@undefined +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@iftop} +% \changes{v1.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}} +% \changes{v1.0c}{2005/02/12}{Adapted to \cs{caption@defaultpos}} +% \changes{v1.1}{2007/05/08}{Position will be fixed to `bottom' if `auto'} +% |\caption@iftop|\marg{true-code}\marg{false-code}\par +% (If the |position=| is set to |auto| we assume a |bottom| position here.) +% \begin{macrocode} +\newcommand*\caption@iftop{% + \ifx\caption@position\@undefined + \let\caption@position\@secondoftwo +% = \caption@setposition b% + \fi + \caption@position} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@fixposition} +% \changes{v1.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{v1.0a}{2004/01/23}{\cs{ifvmode} added} +% |\caption@autoposition|\par +% We guess the current position of the caption by checking |\prevdepth|.\par +% A different solution would be setting the |\spacefactor| to something +% not much less than 1000 (for example 994) in |\caption@start| and +% checking this value here by |\ifnum\spacefactor=994|. +% (It's implemented in the \package{threeparttable} +% package\cite{threeparttable} this way.)\par +% Another idea would be checking |\@ifminipage|, but since some packages +% typeset the caption within a simple |\vbox| this does not seem to be a +% good one. +% \begin{macrocode} +\newcommand*\caption@autoposition{% + \ifvmode + \edef\caption@tempa{\the\prevdepth}% + \caption@Debug{\protect\prevdepth=\caption@tempa}% + \ifdim\prevdepth>-\p@ + \let\caption@position\@secondoftwo + \else + \let\caption@position\@firstoftwo + \fi +% = \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}% + \else + \caption@Debug{no \protect\prevdepth}% + \let\caption@position\@secondoftwo +% = \caption@setposition b% + \fi} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\caption@setautoposition} +% \changes{v1.1}{2007/06/10}{This macro added} +% |\caption@setautoposition|\marg{position}\par +% replaces the above algorithm by a different one (or a fixed position setting). +% \begin{macrocode} +\newcommand*\caption@setautoposition[1]{% + \def\caption@autoposition{\caption@setposition{#1}}} +% \end{macrocode} +% \end{macro} +% +% \subsection{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} +% +% \subsection{Lists} +% +% \changes{v1.0b}{2004/05/16}{Option \opt{listof=} added} +% \changes{v1.2}{2007/11/17}{Option \opt{list=} added} +% \begin{macrocode} +\DeclareCaptionOption{list}[1]{\caption@setlist{#1}} +\DeclareCaptionOption{listof}[1]{\caption@setlist{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setlist} +% \changes{v1.2a}{2008/03/20}{This macro added} +% |\caption@setlist|\marg{boolean} +% \begin{macrocode} +\newcommand*\caption@setlist{\caption@set@bool\caption@iflist} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareCaptionListFormat} +% \changes{v1.1}{2004/07/15}{This macro added} +% \changes{v1.2}{2007/11/17}{Renamed from \cs{DeclareCaptionListOfFormat} to \cs{DeclareCaptionListFormat}} +% |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2} +% \begin{macrocode} +\newcommand*\DeclareCaptionListFormat[2]{% + \global\@namedef{caption@lstfmt@#1}##1##2{#2}} +\@onlypreamble\DeclareCaptionListFormat +% \end{macrocode} +% \end{macro} +% +% \changes{v1.1}{2007/07/15}{Option \opt{listofformat=} added} +% \changes{v1.2}{2007/11/17}{Option \opt{listofformat=} renamed to \opt{listformat=}} +% \begin{macrocode} +\DeclareCaptionOption{listformat}{\caption@setlistformat{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setlistformat} +% \changes{v1.1}{2004/07/15}{This macro added} +% \changes{v1.2}{2007/11/17}{Renamed from \cs{caption@setlistofformat} to \cs{caption@setlistformat}} +% |\caption@setlistformat|\marg{name}\par +% Selecting a caption list format simply means saving the code (in |\caption@lstfmt|). +% \begin{macrocode} +\newcommand*\caption@setlistformat[1]{% + \@ifundefined{caption@lstfmt@#1}% + {\caption@Error{Undefined list format `#1'}}% + {\expandafter\let\expandafter\caption@lstfmt + \csname caption@lstfmt@#1\endcsname}} +% \end{macrocode} +% \end{macro} +% +% There are five pre-defined list formats, taken from the \package{subfig} package. +% \begin{macrocode} +\DeclareCaptionListFormat{empty}{} +\DeclareCaptionListFormat{simple}{#1#2} +\DeclareCaptionListFormat{parens}{#1(#2)} +\DeclareCaptionListFormat{subsimple}{#2} +\DeclareCaptionListFormat{subparens}{(#2)} +% \end{macrocode} +% +% \begin{macro}{\caption@setdefaultlistformat} +% \changes{v1.2d}{2009/03/29}{This macro added} +% \begin{macrocode} +\newcommand*\caption@setdefaultlistformat[1]{% + \ifx\caption@lstfmt\caption@lstfmt@default + \caption@set@default@listformat{#1}% + \caption@setlistformat{default}% + \else + \caption@set@default@listformat{#1}% + \fi} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@set@default@listformat[1]{% + \def\caption@lstfmt@default{\@nameuse{caption@lstfmt@#1}}} +% \end{macrocode} +% \end{macro} +% +% `default' usually maps to `subsimple'. +% \begin{macrocode} +\caption@set@default@listformat{subsimple} +% \end{macrocode} +% +% \subsection{Debug option} +% \changes{v1.0k}{2007/03/04}{Debug option added} +% +% \begin{macrocode} +\DeclareCaptionOption{debug}[1]{% + \caption@set@bool\caption@ifdebug{#1}% + \caption@ifdebug + {\let\caption@Debug\caption@Info}% + {\let\caption@Debug\@gobble}} +% \end{macrocode} +% \begin{macrocode} +\DeclareOption{debug}{\setkeys{caption}{debug}} +% \end{macrocode} +% \begin{macrocode} +\setkeys{caption}{debug=0} +% \end{macrocode} +% +% \subsection{Document classes \& Babel support} +% +% \subsubsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes} +% +% \begin{macrocode} +\caption@CheckCommand\@makecaption{% + % article|report|book [2005/09/16 v1.4f Standard LaTeX document class] + \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{macrocode} +% +% \subsubsection{The \AmS{} \& \SmF{} classes} +% \changes{v1.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added} +% +% \begin{macro}{\caption@ifamsclass} +% \begin{macrocode} +\providecommand*\caption@ifamsclass{% + \@ifundefined{@captionheadfont}\@gobble\@firstofone} +\@onlypreamble\caption@ifamsclass +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@ifamsclass{% +% \end{macrocode} +% \begin{macrocode} + \caption@CheckCommand\@makecaption{% + % amsart|amsproc|amsbook [2004/08/06 v2.20] + \long\def\@makecaption#1#2{% + \setbox\@tempboxa\vbox{\color@setgroup + \advance\hsize-2\captionindent\noindent + \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp + {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}% + \unskip\kern-2\captionindent\par + \global\setbox\@ne\lastbox\color@endgroup}% + \ifhbox\@ne % the normal case + \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}% + \fi + \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line + \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}% + \else % tempboxa contained more than one line + \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip + \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}% + \fi + \ifnum\@tempcnta<64 % if the float IS a figure... + \addvspace\abovecaptionskip + \hbox to\hsize{\kern\captionindent\box\@ne\hss}% + \else % if the float IS NOT a figure... + \hbox to\hsize{\kern\captionindent\box\@ne\hss}% + \nobreak + \vskip\belowcaptionskip + \fi + \relax + }} +% \end{macrocode} +% \begin{macrocode} + \caption@CheckCommand\@makecaption{% + % smfart|smfbook [1999/11/15 v1.2f Classe LaTeX pour les articles publies par la SMF] + \long\def\@makecaption#1#2{% + \ifdim\captionindent>.1\hsize \captionindent.1\hsize \fi + \setbox\@tempboxa\vbox{\color@setgroup + \advance\hsize-2\captionindent\noindent + \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp + {\@cdr#2\@nil}{\@addpunct{.}\@captionfont\upshape\enspace#2}% + \unskip\kern-2\captionindent\par + \global\setbox\@ne\lastbox\color@endgroup}% + \ifhbox\@ne % the normal case + \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}% + \fi + \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line + \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}% + \@tempdima\wd\@ne\advance\@tempdima-\captionindent + \wd\@ne\@tempdima + \else % tempboxa contained more than one line + \setbox\@ne\vbox{\rightskip=0pt plus\captionindent\relax + \unvbox\@tempboxa\parskip\z@skip + \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}% + \fi + \ifnum\@tempcnta<64 % if the float IS a figure... + \addvspace\abovecaptionskip + \noindent\kern\captionindent\box\@ne + \else % if the float IS NOT a figure... + \noindent\kern\captionindent\box\@ne + \nobreak + \vskip\belowcaptionskip + \fi + \relax + }} +% \end{macrocode} +% \begin{macrocode} + \let\captionmargin\captionindent % set to 3pc by AMS class + \begingroup\edef\@tempa{\endgroup + \noexpand\caption@g@addto@list\noexpand\caption@sty@default + {margin=\the\captionmargin + \@ifundefined{smf@makecaption}{}{,maxmargin=.1\linewidth}}} + \@tempa + \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin} + \DeclareCaptionLabelSeparator{default}{.\enspace} + \DeclareCaptionDefaultFont{font}{\@captionfont} + \DeclareCaptionDefaultFont{labelfont}{\@captionheadfont} + \DeclareCaptionDefaultFont{textfont}{\@captionfont\upshape} + \captionsetup[figure]{position=b} + \captionsetup[table]{position=t} +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% +% \subsubsection{The beamer class (Part one)} +% \changes{v1.1}{2007/03/10}{beamer class support added} +% \changes{v1.3}{2011/08/06}{beamer class support revised} +% +% \begin{macro}{\caption@ifbeamerclass} +% \begin{macrocode} +\providecommand*\caption@ifbeamerclass{% + \@ifclassloaded{beamer}\@firstofone\@gobble} +\@onlypreamble\caption@ifbeamerclass +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@ifbeamerclass{% +% \end{macrocode} +% \begin{macrocode} + \caption@CheckCommand\beamer@makecaption{% + % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau + \long\def\beamer@makecaption#1#2{% + \def\insertcaptionname{\csname#1name\endcsname}% + \def\insertcaptionnumber{\csname the#1\endcsname}% + \def\insertcaption{#2}% + \nobreak\vskip\abovecaptionskip\nobreak + \sbox\@tempboxa{\usebeamertemplate**{caption}}% + \ifdim \wd\@tempboxa >\hsize + \usebeamertemplate**{caption}\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \nobreak\vskip\belowcaptionskip\nobreak}} +% \end{macrocode} +% \begin{macro}{\caption@ifbeamertemplate} +% \begin{macrocode} +\newcommand*\caption@ifbeamertemplate[1]{% + \begingroup + \let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption + \@nameuse{beamer@@tmpop@caption@#1}% + \ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption + \endgroup\expandafter\@firstoftwo + \else + \endgroup\expandafter\@secondoftwo + \fi} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} + \DeclareCaptionLabelFormat{default}{% + #1\caption@ifbeamertemplate{numbered}{~#2}{}} + \caption@declarelabelseparator + {\caption@ifbeamertemplate{caption name own line}\@gobble\@firstofone} + {default} + {\caption@ifbeamertemplate{caption name own line}{\\}{: }} + \DeclareCaptionDefaultFont{font}{% + \usebeamerfont*{caption}% + \usebeamercolor[fg]{caption}} + \DeclareCaptionDefaultFont{labelfont}{% + \usebeamercolor[fg]{caption name}% + \usebeamerfont*{caption name}} + \DeclareCaptionDefaultJustification{\raggedright} + \DeclareOption{beamerclass}{% + \renewcommand\caption@ifslc{% + \caption@ifbeamertemplate{caption name own line}\@secondoftwo\@firstoftwo} + % Since the beamer class do not offer a `list of figures' we switch this support off. + \captionsetup{list=0}} + \PassOptionsToPackage{beamerclass}{caption3} +% \end{macrocode} +% +% If the \package{beamer} document class is used, we offer a beamer +% template called `caption3' which can be used with option `beamer' or +% |\setbeamertemplate{caption}[caption3]|.\par +% (Note that this is of no use when the \package{caption} package is used, too.) +% \begin{macrocode} + \defbeamertemplate{caption}{caption3}{% + \caption@make\insertcaptionname\insertcaptionnumber\insertcaption} +% \end{macrocode} +% \begin{macrocode} + \DeclareOption{beamer}{% + % \usebeamertemplate**{caption} will set font + \DeclareCaptionDefaultFont{font}{}% + \setbeamertemplate{caption}[caption3]} +% \end{macrocode} +% \begin{macrocode} +% +% \begin{macrocode] +} +% \end{macrocode} +% +% \subsubsection{The KOMA-Script classes} +% \changes{v1.1}{2007/03/31}{\KOMAScript\ classes support added} +% +% \begin{macro}{\caption@ifkomaclass} +% \begin{macrocode} +\providecommand*\caption@ifkomaclass{% + \@ifundefined{scr@caption}\@gobble\@firstofone} +\@onlypreamble\caption@ifkomaclass +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@ifkomaclass{% +% \end{macrocode} +% \begin{macrocode} + \caption@CheckCommand\@makecaption{% + % scrartcl|scrreprt|scrbook [2007/03/07 v2.97a KOMA-Script document class] + \long\def\@makecaption#1#2{% + \if@captionabove + \vskip\belowcaptionskip + \else + \vskip\abovecaptionskip + \fi + \@@makecaption\@firstofone{#1}{#2}% + \if@captionabove + \vskip\abovecaptionskip + \else + \vskip\belowcaptionskip + \fi}} +% \end{macrocode} +% \begin{macrocode} + \DeclareCaptionFormat{default}[#1#2#3\par]{% + \ifdofullc@p + \caption@ifin@list\caption@lsepcrlist\caption@lsepname + {\caption@Error{% + The option `labelsep=\caption@lsepname' does not work\MessageBreak + with \noexpand\setcaphanging (which is set by default)}}% + {\caption@fmt@hang{#1}{#2}{#3}}% + \else + #1#2% + \ifdim\cap@indent<\z@ + \par + \noindent\hspace*{-\cap@indent}% + \else\if@capbreak + \par + \fi\fi + #3\par + \fi} + \DeclareCaptionLabelSeparator{default}{\captionformat} + \DeclareCaptionDefaultFont{font}{\scr@fnt@caption} + \DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel} +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% +% \subsubsection{The \NTG{} Dutch classes} +% \changes{v1.1}{2007/04/06}{NTG classes support added} +% +% \begin{macro}{\caption@ifntgclass} +% \begin{macrocode} +\providecommand*\caption@ifntgclass{% + \@ifundefined{CaptionFonts}\@gobble\@firstofone} +\@onlypreamble\caption@ifntgclass +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@ifntgclass{% +% \end{macrocode} +% \begin{macrocode} + \caption@CheckCommand\@makecaption{% + % artikel|rapport|boek [2004/06/07 v2.1a NTG LaTeX document class] + \long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{{\CaptionLabelFont#1:} \CaptionTextFont#2}% + \ifdim \wd\@tempboxa >\hsize + {\CaptionLabelFont#1:} \CaptionTextFont#2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip}} +% \end{macrocode} +% \begin{macrocode} + \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont} + \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont} +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% +% \subsubsection{The thesis class} +% \changes{v1.2a}{2008/01/31}{thesis class support added} +% \changes{v1.2e}{2009/11/15}{Bugfix 09-11-14: thesis class support revised} +% +% \begin{macro}{\caption@ifthesisclass} +% \begin{macrocode} +\providecommand*\caption@ifthesisclass{% + \@ifundefined{cph@font}{\@gobble}{\@ifundefined{cpb@font}\@gobble\@firstofone}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@ifthesisclass{% +% \end{macrocode} +% \begin{macrocode} + \caption@CheckCommand\@makecaption{% + % thesis.cls 1996/25/01 1.0g LaTeX document class (wm). + \long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \setbox\@tempboxa\hbox{{\cph@font #1:} {\cpb@font #2}}% + \ifdim \wd\@tempboxa >\hsize + \@hangfrom{\cph@font #1: }{\cpb@font #2\par}% + \else + \hbox to\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip}} +% \end{macrocode} +% \begin{macrocode} + \DeclareCaptionDefaultFormat{hang} + \DeclareCaptionDefaultFont{labelfont}{\cph@font} + \DeclareCaptionDefaultFont{textfont}{\cpb@font} +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% +% \subsubsection{The frenchb Babel option} +% \changes{v1.1}{2006/05/14}{\package{frenchb} package support added} +% +% \begin{macrocode} +\@ifundefined{FB@makecaption}{}{% +% \end{macrocode} +% \begin{macrocode} + \caption@CheckCommand\@makecaption{% + % frenchb.ldf [2005/02/06 v1.6g French support from the babel system] + % frenchb.ldf [2007/10/05 v2.0e French support from the babel system] + \long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{#1\CaptionSeparator #2}% + \ifdim \wd\@tempboxa >\hsize + #1\CaptionSeparator #2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip}} +% \end{macrocode} +% \begin{macrocode} + \ifx\@makecaption\STD@makecaption + \DeclareCaptionLabelSeparator{default}{\CaptionSeparator} + \def\caption@frenchb{% supress frenchb warning + \let\STD@makecaption\@makecaption + \let\FB@makecaption\@makecaption} + \else + \ifx\@makecaption\@undefined\else + \caption@InfoNoLine{% + The definition of \protect\@makecaption\space + has been changed,\MessageBreak + frenchb will NOT customize it}% + \fi + \fi +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% +% \subsubsection{The frenchle/pro package} +% \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added} +% +% \begin{macrocode} +\@ifundefined{frenchTeXmods}{}{% +% \end{macrocode} +% \begin{macrocode} + \caption@CheckCommand\@makecaption{% + % french(le).sty [2006/10/03 The french(le) package /V5,9991/] + % french(le).sty [2007/06/28 The french(le) package /V5,9994/] + \def\@makecaption#1#2{% + \ifFTY% + \def\@secondofmany##1##2\void{##2}% + \def\@tempa{\@secondofmany#2\void}% + \ifx\@tempa\empty% + \let\captionseparator\empty% + \fi% + \@mcORI{#1}{\relax\captionfont{#2}}% + \else + \@mcORI{#1}{#2}% + \fi}} +% \end{macrocode} +% \begin{macrocode} + \caption@CheckCommand\@makecaption{% + % french(le).sty [2007/02/11 The french(le) package /V5,9993/] + \def\@makecaption#1#2{% + \ifFTY% + \def\@secondofmany##1##2\void{##2}% + \protected@edef\@tempa{\@secondofmany#2\void}% + \ifx\@tempa\empty% + \let\captionseparator\empty% + \fi% + \@mcORI{#1}{\relax\captionfont{#2}}% + \else + \@mcORI{#1}{#2}% + \fi}} +% \end{macrocode} +% \begin{macrocode} + \DeclareCaptionDefaultFont{textfont}{\itshape}% + \DeclareCaptionLabelSeparator{default}{\captionseparator\space}% +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% +% \subsubsection{The hungarian and magyar Babel option} +% \changes{v1.3}{2009/03/29}{\package{magyar} package support added} +% +% \begin{macrocode} +\DeclareCaptionListFormat{subperiod}{#2.} +% \end{macrocode} +% +% \begin{macrocode} +\def\caption@tempa#1{\@ifundefined{extras#1}{}{% + \expandafter\addto\csname extras#1\endcsname{% + % change default labelsep and listformat + \caption@setdefaultlabelsep{period}% + \caption@setdefaultlistformat{subperiod}}% + \expandafter\addto\csname noextras#1\endcsname{% + % change default labelsep and listformat + \caption@setdefaultlabelsep{colon}% + \caption@setdefaultlistformat{subsimple}}% +}} +% \end{macrocode} +% \begin{macrocode} +\caption@tempa{hungarian} +\caption@tempa{magyar} +% \end{macrocode} +% +% \subsubsection{Unknown document class (or package)} +% \changes{v1.1}{2007/04/10}{Check of document class added} +% +% \begin{macrocode} +\caption@IfCheckCommand{% + \caption@setbool{documentclass}{1}% +}{% + \caption@setbool{documentclass}{0}% + \caption@InfoNoLine{% + Unknown document class (or package),\MessageBreak + standard defaults will be used}% + \caption@Debug{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}% +} +% \end{macrocode} +% +% \subsection{Execution of options} +% +% \begin{macrocode} +\captionsetup{style=default,position=default,% + list,listformat=default,twoside=\if@twoside 1\else 0\fi} +% \end{macrocode} +% \begin{macrocode} +\ProcessOptions* +% \end{macrocode} +% +% \subsection{Making an `List of' entry} +% +% \begin{macro}{\caption@addcontentsline} +% \changes{v1.1}{2007/07/01}{This macro added} +% \changes{v1.3}{2010/10/26}{Error check added} +% \changes{v1.3}{2011/06/24}{Split into two macros} +% |\caption@addcontentsline|\marg{type}\marg{list entry}\par +% Makes an entry in the list-of-whatever, if requested, +% i.e.~the argument \meta{list entry} is not empty and +% |listof=| was set to |true|. +% \begin{macrocode} +\newcommand*\caption@addcontentsline[2]{% + \caption@iflist + {\def\@tempa{#2}}% + {\let\@tempa\@empty}% + \ifx\@tempa\@empty \else + {\let\\\space + \@ifundefined{ext@#1}% + {\caption@Error{No float type '#1' defined}}% + {\caption@@addcontentsline + {\csname ext@#1\endcsname}% + {#1}% + {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}% + {\ignorespaces #2}}}% + \fi} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@addcontentsline[4]{% + \addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Typesetting the caption} +% +% \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} +% +% \begin{macro}{\caption@fnum} +% \changes{v1.1}{2007/08/21}{This macro added} +% |\caption@fnum|\marg{float type}\par +% Typesets the caption label; as replacement for |\fnum@|\meta{float type}. +% \begin{macrocode} +\newcommand*\caption@fnum[1]{\caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@make} +% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\par +% Typesets the caption. +% \begin{macrocode} +\newcommand\caption@make[2]{\caption@@make{\caption@lfmt{#1}{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@@make} +% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added} +% \changes{v1.0c}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of +% \cs{captionmargin} resp. \cs{captionwidth}; check for \cs{z@} added} +% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end +% of caption added} +% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}} +% \changes{v1.0c}{2005/02/12}{Single-line-check moved up so it can affect margins now} +% \changes{v1.0c}{2005/02/09}{Improvement: \cs{caption@ifh} added} +% \changes{v1.0c}{2005/02/09}{Bugfix: \cs{leavevmode} added} +% \changes{v1.0f}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check} +% \changes{v1.0g}{2005/12/04}{Uses \cs{caption@slc} now} +% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside +% single-line-check replaced by \cs{relax}} +% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be +% typeset in horizontal mode} +% \changes{v1.0i}{2006/05/13}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox}} +% \changes{v1.0j}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v1.0h, re-added} +% \changes{v1.0n}{2007/04/03}{Usage of \cs{caption@ifoddpage} added} +% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} moved below single-line-check} +% \changes{v1.1e}{2007/10/28}{\cs{caption@stepcounter} added} +% |\caption@@make|\marg{caption label}\marg{caption text} +% \begin{macrocode} +\newcommand\caption@@make[2]{% + \begingroup + \caption@stepcounter + \caption@beginhook +% \end{macrocode} +% +% Check margin, if |\caption@minmargin| or |\caption@maxmargin| is set +% \begin{macrocode} +% TODO: Move this to \caption@calcmargin!? + \ifx\caption@maxmargin\@undefined \else + \ifdim\captionmargin>\caption@maxmargin\relax + \captionmargin\caption@maxmargin\relax + \fi + \fi + \ifx\caption@minmargin\@undefined \else + \ifdim\captionmargin<\caption@minmargin\relax + \captionmargin\caption@minmargin\relax + \fi + \fi +% \end{macrocode} +% +% Special single-line treatment (option |singlelinecheck=|) +% \begin{macrocode} + \caption@ifslc{\caption@slc{#1}{#2}\captionwidth\relax}{}% +% \end{macrocode} +% +% Typeset the left margin (option |margin=|) +% \begin{macrocode} + \caption@calcmargin + \@tempdima\captionmargin + \ifdim\captionmargin@=\z@ \else + \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}% + \fi + \caption@ifh{\advance\@tempdima\caption@indent}% + \hspace\@tempdima +% \end{macrocode} +% +% We actually use a |\vbox| of width |\captionwidth - \caption@indent| +% to typeset the caption. +% \Note{\cs{captionindent} is \emph{not} supported if the caption format +% was defined with \cs{DeclareCaptionFormat*}.} +% \begin{macrocode} + \@tempdima\captionwidth + \caption@ifh{\advance\@tempdima-\caption@indent}% + \caption@parbox\@tempdima{% +% \end{macrocode} +% +% Typeset the indention (option |indention=|)\\ +% {\small Bugfix 04-05-05: +% |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots} +% \begin{macrocode} + \caption@ifh{% + \ifdim\caption@indent=\z@ + \leavevmode + \else + \hskip-\caption@indent + \fi}% +% \end{macrocode} +% +% Typeset the caption itself and close the |\caption@parbox| +% \begin{macrocode} + \caption@@@make{#1}{#2}}% +% \end{macrocode} +% +% Typeset the right margin (option |margin=|) +% \begin{macrocode} + \@tempdima\captionmargin + \ifdim\captionmargin@=\z@ \else + \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}% + \fi + \hspace\@tempdima +% \end{macrocode} +% +% \begin{macrocode} + \caption@endhook + \endgroup +% \end{macrocode} +% +% \begin{macrocode} + \global\caption@starfalse} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@calcmargin} +% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by +% \cs{ifdim}\cs{captionwidth=}\cs{z@}} +% \changes{v1.0g}{2006/01/12}{Improvement: Takes care of list environment now} +% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore), +% use \cs{linewidth} instead of \cs{hsize}} +% |\caption@calcmargin|\par +% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid +% values. +% \begin{macrocode} +\newcommand*\caption@calcmargin{% + \caption@calcmargin@hook + \ifdim\captionwidth=\z@ + \captionwidth\linewidth + \advance\captionwidth by -2\captionmargin + \advance\captionwidth by -\captionmargin@ + \else + \captionmargin\linewidth + \advance\captionmargin by -\captionwidth + \divide\captionmargin by 2 + \captionmargin@\z@ + \fi +% \end{macrocode} +% \begin{macrocode} + \caption@Debug{% + \string\hsize=\the\hsize, + \string\linewidth=\the\linewidth,\MessageBreak + \string\leftmargin=\the\leftmargin, + \string\rightmargin=\the\rightmargin,\MessageBreak + \string\margin=\the\captionmargin, + \string\margin@=\the\captionmargin@, + \string\width=\the\captionwidth}% +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@slc} +% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} added} +% \changes{v1.1}{2007/07/29}{\cs{caption@setup}\cs{caption@sls} added after \cs{begingroup}} +% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} added} +% \changes{v1.1c}{2007/10/14}{Support of \cs{caption@slfmt} added} +% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} +% \changes{v1.3}{2010/09/04}{Split into \cs{caption@slc} and \cs{caption@@slc}} +% |\caption@slc|\marg{label}\marg{text}\marg{width}\marg{extra code}\par +% This one does the single-line-check. +% \begin{macrocode} +\newcommand\caption@slc[4]{% + \caption@@slc{#1}{#2}{#3}{\caption@singleline#4}{}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@@slc[5]{% + \caption@Debug{Begin SLC}% + \begingroup + \caption@singleline + \let\caption@hj\@empty + \caption@calcmargin % calculate #3 if necessary + \caption@prepareslc + \sbox\@tempboxa{\caption@@@make{#1}{#2}}% + \ifdim\wd\@tempboxa>#3% + \endgroup + #5% + \else + \endgroup + #4% + \fi + \caption@Debug{End SLC}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@singleline{% + \caption@xsetup\caption@opt@singleline + \let\caption@fmt\caption@slfmt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@prepareslc} +% \changes{v1.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added} +% \changes{v1.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}} +% \changes{v1.0c}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added} +% \changes{v1.0f}{2005/07/09}{Support of \package{endnotes} package added} +% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} moved to \cs{caption@slc}} +% \changes{v1.1}{2007/06/13}{Redefinition of \cs{(H@)refstepcounter} added} +% \changes{v1.1}{2007/08/12}{Redefinition of \cs{label} improved} +% \changes{v1.1c}{2007/10/06}{Definition of \cs{caption@l@stepcounter} added} +% |\caption@prepareslc|\par +% \changes{v1.3}{2011/07/07}{Bugfix 11-07-06: Redefinition of \cs{footnote} and \cs{footnotemark} added, redefinition of \cs{stepcounter} and \cs{refstepcounter} dropped} +% Re-define anything which would disturb the single-line-check. +% \begin{macrocode} +\newcommand*\caption@prepareslc{% + \def\label{\caption@withoptargs\@gobbletwo}% +% \end{macrocode} +% \begin{macrocode} + \let\caption@footnote@ORI\footnote + \def\footnote{\caption@withoptargs\caption@footnote}% + \let\caption@footnotemark@ORI\footnotemark + \def\footnotemark{\caption@withoptargs\caption@footnotemark}% + \let\@footnotetext\@gobble +% \end{macrocode} +% \begin{macrocode} + \let\@endnotetext\@gobble} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@footnote[2]{% + \begingroup + \let\stepcounter\caption@l@stepcounter + \caption@footnote@ORI#1{#2}% + \endgroup} +\newcommand\caption@footnotemark[1]{% + \begingroup + \let\stepcounter\caption@l@stepcounter + \caption@footnotemark@ORI#1% + \endgroup} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@l@stepcounter[1]{% + \advance\csname c@#1\endcsname\@ne\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@parbox} +% \changes{v1.0i}{2006/05/13}{We define \cs{caption@parbox} instead of +% \cs{caption@start/endbox}} +% \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{caption@parbox} changed from +% \cs{parbox-t} to \cs{parbox-b}} +% \changes{v1.2}{2007/11/11}{Renamed from \cs{captionbox} to \cs{caption@parbox}} +% |\caption@parbox|\marg{width}\marg{contents}\par +% This macro defines the box which surrounds the caption paragraph. +% \begin{macrocode} +\newcommand*\caption@parbox{\parbox[b]} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@applyfont} +% \changes{v1.3}{2010/09/04}{This macro added} +% |\caption@applyfont|\par +% This macro executes the font relevant macros, i.e. by default +% the options set by |justification=|, |font=|, and |size=|. +% \begin{macrocode} +\newcommand*\caption@applyfont{% + \caption@hj\captionfont\captionsize} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@@@make} +% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added} +% \changes{v1.0c}{2005/02/12}{Bugfix 04-12-16: Use some kind of +% \cs{@startstrut}\cs{strutbox} instead of \cs{strut}} +% \changes{v1.0c}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added} +% \changes{v1.0d}{2005/05/05}{Use \cs{caption@ifempty}; +% \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added} +% \changes{v1.0d}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed} +% \changes{v1.0f}{2005/08/24}{Check for empty label added} +% \changes{v1.0f}{2005/08/25}{\cs{caption@iflf} added} +% \changes{v1.0j}{2007/02/18}{Usage of \cs{caption@tfmt} added} +% \changes{v1.1}{2007/05/07}{Bugfix: \cs{ifhmode} added to \cs{@finalstrut}} +% \changes{v1.2}{2007/11/17}{Made option \opt{size=} stronger than \opt{font=}} +% \changes{v1.3}{2010/09/04}{Uses \cs{caption@applyfont} now} +% \changes{v1.3}{2010/11/01}{Bugfix: If the caption text is empty, the text format will be set to \opt{simple} now} +% |\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 +% \@capbreakfalse + \fi +% \end{macrocode} +% +% If the text is empty, we use no caption label separator, too. +% (And no text format either.) +% \begin{macrocode} + \caption@ifempty{#2}{% + \let\caption@lsep\@empty + \let\caption@tfmt\@firstofone +% \@capbreakfalse +% \let\caption@ifstrut\@secondoftwo + }% +% \end{macrocode} +% +% Take care that |\caption@parindent| and |\caption@hangindent| will be used +% to typeset the paragraph. +% \begin{macrocode} + \@setpar{\@@par\caption@@par}\caption@@par +% \end{macrocode} +% +% Finally typeset the caption. +% \begin{macrocode} + \caption@applyfont + \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 % enable hyphenation + \caption@tfmt{#2}% +% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}% + \caption@ifstrut{\ifhmode\@finalstrut\strutbox\fi}{}% + \par}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifempty} +% \changes{v1.0d}{2005/05/05}{This macro added} +% \changes{v1.1}{2007/07/04}{Re-defines itself now} +% \changes{v1.2a}{2007/01/22}{Revised so \cs{label} will be detected, too} +% \changes{v1.2b}{2008/08/02}{Revised so \cs{index} and \cs{glossary} will be detected, too} +% |\caption@ifempty|\marg{text}\marg{true} (\emph{no} \meta{false})\par +% This one tests if the \meta{text} is actually empty. +% \Note{This will be done without expanding the text, +% therefore this is far away from being bullet-proof.} +% \Note{This macro is re-defining itself so only +% the first test (in a group) will actually be done.} +% \begin{macrocode} +\newcommand\caption@ifempty[1]{% + \caption@if@empty{#1}% + \caption@ifempty\@unused} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@if@empty[1]{% + \def\caption@tempa{#1}% + \ifx\caption@tempa\@empty + \let\caption@ifempty\@secondoftwo + \else + \expandafter\def\expandafter\caption@tempa\expandafter{% + \caption@car#1\caption@if@empty\caption@nil}% + \def\caption@tempb{\caption@if@empty}% + \ifx\caption@tempa\caption@tempb + \let\caption@ifempty\@secondoftwo + \else + \def\caption@tempb{\ignorespaces}% + \ifx\caption@tempa\caption@tempb + \expandafter\caption@if@empty\expandafter{\@gobble#1}% + \else + \def\caption@tempb{\label}% + \ifx\caption@tempa\caption@tempb + \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}% + \else + \def\caption@tempb{\index}% + \ifx\caption@tempa\caption@tempb + \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}% + \else + \def\caption@tempb{\glossary}% + \ifx\caption@tempa\caption@tempb + \expandafter\caption@if@empty\expandafter{\@gobbletwo#1}% + \else + \let\caption@ifempty\@gobbletwo + \fi + \fi + \fi + \fi + \fi + \fi} +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@@par} +% \changes{v1.0f}{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\caption@parindent\hangindent\caption@hangindent}% +% \end{macrocode} +% \end{macro} +% +% \subsection{Types \& sub-types} +% +% \begin{macro}{\DeclareCaptionType} +% \changes{v1.1}{2007/08/12}{This macro added} +% \changes{v1.1a}{2007/09/07}{Three optional arguments added} +% \changes{v1.2}{2007/12/06}{Renamed from \cs{DeclareFloatingEnvironment} to \cs{DeclareCaptionType}} +% \changes{v1.2}{2007/12/21}{Optional argument revised, uses key-value syntax now} +% \changes{v1.2b}{2008/04/13}{Uses \cs{caption@within@default} now} +% \changes{v1.2b}{2008/08/02}{Support of \cs{float@exts} and \cs{float@addtolists} added} +% \changes{v1.2e}{2010/01/09}{Usage of \cs{caption@DeclareWithinOption} added} +% \changes{v1.3}{2011/08/06}{Definition of \cs{listofXXXes} added} +% |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name} +% \begin{macrocode} +\newcommand*\DeclareCaptionType{% + \@testopt\@DeclareCaptionType{}} +\@onlypreamble\DeclareCaptionType +% \end{macrocode} +% \begin{macrocode} +\def\@DeclareCaptionType[#1]#2{% + \def\caption@type{#2}% + \caption@Debug{New type `#2'}% + \newcounter{#2}\@namedef{theH#2}{}% + \KV@caption@DCT@within\caption@within@default + \caption@DeclareWithinOption{#2}% + \KV@caption@DCT@placement{tbp}% + \@ifundefined{c@float@type}% + {\newcounter{float@type}% + \setcounter{float@type}{\@ifundefined{c@figure}14}}% + {}% + \caption@Debug{float type `#2'=\the\value{float@type}}% + \expandafter\xdef\csname ftype@#2\endcsname{\the\value{float@type}}% + \addtocounter{float@type}{\value{float@type}}% + \KV@caption@DCT@fileext{lo#2}% + \@namedef{fnum@#2}{\@nameuse{#2name}\nobreakspace\@nameuse{the#2}}% + \newenvironment{#2}{\@float{#2}}{\end@float}% + \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}% + \expandafter\newcommand\csname listof#2s\endcsname{\caption@listof{#2}}% + \expandafter\newcommand\csname listof#2es\endcsname{\caption@listof{#2}}% + \@ifundefined{l@figure}% + {\@namedef{l@#2}{\@dottedtocline{1}{1.5em}{2.3em}}}% + {\expandafter\let\csname l@#2\endcsname\l@figure}% +% \end{macrocode} +% \begin{macrocode} + \expandafter\newcommand\csname #2name\endcsname{}% + \edef\@tempa{\def\noexpand\@tempa{\@car#2\@nil}}% + \uppercase\expandafter{\@tempa}% + \edef\@tempb{\noexpand\g@addto@macro\noexpand\@tempa{\@cdr#2\@nil}}% + \@tempb + \expandafter\let\csname #2name\endcsname\@tempa + \expandafter\newcommand\csname list#2name\endcsname{}% + \expandafter\xdef\csname list#2name\endcsname{List of \@tempa s}% +% \end{macrocode} +% \begin{macrocode} + \@cons\caption@typelist{{#2}}% + \caption@setkeys[caption]{caption@DCT}{#1}% +% \end{macrocode} +% \begin{macrocode} + \@ifundefined{float@exts}{\newtoks\float@exts}{}% + \let\float@do=\relax + \edef\@tempa{\noexpand\float@exts{\the\float@exts\float@do{\@nameuse{ext@#2}}}}% + \@tempa + \@ifundefined{float@addtolists}{% + \newcommand\float@addtolists[1]{% + \def\float@do####1{\addtocontents{####1}{##1}}\the\float@exts}% + \@ifundefined{@chapter}{}{\caption@PatchChapter}}{}% +% \end{macrocode} +% \begin{macrocode} + \@ifnextchar[\@@DeclareCaptionType\relax} +\@onlypreamble\@DeclareCaptionType +% \end{macrocode} +% \begin{macrocode} +\def\@@DeclareCaptionType[#1]{% + \KV@caption@DCT@name{#1}% + \@ifnextchar[\@@@DeclareCaptionType\relax} +\@onlypreamble\@@DeclareCaptionType +% \end{macrocode} +% \begin{macrocode} +\def\@@@DeclareCaptionType[#1]{% + \KV@caption@DCT@listname{#1}} +\@onlypreamble\@@@DeclareCaptionType +% \end{macrocode} +% \begin{macrocode} +\let\DeclareFloatingEnvironment\DeclareCaptionType % old command name +\@onlypreamble\DeclareFloatingEnvironment +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@within@default} +% \changes{v1.2b}{2008/04/13}{This macro added} +% The default `within' value. +% \begin{macrocode} +\newcommand*\caption@within@default{\@ifundefined{c@chapter}{none}{chapter}} +\@onlypreamble\caption@within@default +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@listof} +% \changes{v1.2}{2007/12/21}{This macro added} +% |\caption@listof|\marg{float type} +% \begin{macrocode} +\newcommand*\caption@listof[1]{% + \begingroup + \expandafter\let\expandafter\listfigurename\csname list#1name\endcsname + \expandafter\let\expandafter\ext@figure\csname ext@#1\endcsname + \let\caption@ORI@starttoc\@starttoc + \renewcommand*\@starttoc[1]{% + \expandafter\caption@ORI@starttoc\expandafter{\ext@figure}}% + \listoffigures + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@typelist} +% An \cs{@elt}-list containing the caption types defined +% with |\Declare|\x|Caption|\x|Type|. +% \begin{macrocode} +\newcommand*\caption@typelist{} +% \end{macrocode} +% \end{macro} +% +% The available \meta{options} are: +% |fileext=|\meta{file extension}, +% |listname=|\meta{list name}, +% |name=|\meta{prosa name}, +% |placement=|\meta{htbp}, +% |within=|\meta{none,chapter,section}, and +% |without|. +% \begin{macrocode} +\define@key{caption@DCT}{fileext}{\@namedef{ext@\caption@type}{#1}} +\@onlypreamble@key{caption@DCT}{fileext} +\define@key{caption@DCT}{listname}{\@namedef{list\caption@type name}{#1}} +\@onlypreamble@key{caption@DCT}{listname} +\define@key{caption@DCT}{name}{\@namedef{\caption@type name}{#1}} +\@onlypreamble@key{caption@DCT}{name} +\define@key{caption@DCT}{placement}{\@namedef{fps@\caption@type}{#1}} +\@onlypreamble@key{caption@DCT}{placement} +\define@key{caption@DCT}{within}{% + \@ifundefined{c@chapter}{}{\@removefromreset\caption@type{chapter}}% + \@removefromreset\caption@type{section}% + \begingroup + \caption@setkeys[caption]{caption@within}{#1}% + \endgroup} +%\@onlypreamble@key{caption@DCT}{within} +\define@key{caption@DCT}{without}{\KV@caption@DCT@within{none}} +%\@onlypreamble@key{caption@DCT}{without} +% \end{macrocode} +% \changes{v1.2d}{2009/03/29}{Bugfix 08-09-25: \texttt{within=section} fixed} +% \begin{macrocode} +\define@key{caption@within}{none}[]{% + \caption@within{}{}} +%\@onlypreamble@key{caption@within}{none} +\define@key{caption@within}{section}[]{% + \@addtoreset\caption@type{section}% + \caption@within{\ifnum\c@section>\z@ \thesection.\fi}{\theHsection.}} +%\@onlypreamble@key{caption@within}{section} +\@ifundefined{c@chapter}{}{% + \define@key{caption@within}{chapter}[]{% + \@addtoreset\caption@type{chapter}% + \caption@within{\ifnum\c@chapter>\z@ \thechapter.\fi}{\theHchapter.}} +}% \@onlypreamble@key{caption@within}{chapter}} +% \end{macrocode} +% \begin{macro}{\caption@within} +% \changes{v1.2}{2007/12/21}{This macro added} +% |\caption@within|\marg{thecode}\marg{theHcode} +% \begin{macrocode} +\newcommand*\caption@within{% + \expandafter\caption@within@\expandafter{\caption@type}} +%\@onlypreamble\caption@within +\newcommand*\caption@within@[3]{% + \global\@namedef{the#1}{#2\arabic{#1}}% + \@ifundefined{theH#1}\caption@AtBeginDocument\@firstofone + {\global\@namedef{theH#1}{#3\arabic{#1}}}} +%\@onlypreamble\caption@within@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@removefromreset} +% \changes{v1.2}{2007/12/21}{This macro added} +% This code was taken from the \package{remreset} package +% which is part of the `carlisle' package bundle. +% (Copyright 1997 David Carlisle) +% \begin{macrocode} +\providecommand*\@removefromreset[2]{{% + \expandafter\let\csname c@#1\endcsname\@removefromreset + \def\@elt##1{% + \expandafter\ifx\csname c@##1\endcsname\@removefromreset + \else + \noexpand\@elt{##1}% + \fi}% + \expandafter\xdef\csname cl@#2\endcsname{% + \csname cl@#2\endcsname}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@PatchChapter} +% \changes{v1.2b}{2008/08/02}{This macro added} +% We try to patch \cs{@chapter} so \cs{float@addtolists} will be supported. +% (Note: The \KOMAScript\ classes already support \cs{float@addtolists}.) +% \begin{macrocode} +\newcommand*\caption@PatchChapter{% + \providecommand*\@chapterlistsgap{10\p@}% +% \end{macrocode} +% \begin{macrocode} + % report.cls [2005/09/16 v1.4f Standard LaTeX document class] + \caption@patch@chapter{report}{% + \ifnum \c@secnumdepth >\m@ne + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}##1}% + \else + \addcontentsline{toc}{chapter}{##1}% + \fi + \chaptermark{##1}% + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}% + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}]% + \else + \@makechapterhead{##2}% + \@afterheading + \fi + }{% + \ifnum \c@secnumdepth >\m@ne + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}##1}% + \else + \addcontentsline{toc}{chapter}{##1}% + \fi + \chaptermark{##1}% + \ifdim \@chapterlistsgap>\z@ + \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% + \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% + \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% + \fi + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}]% + \else + \@makechapterhead{##2}% + \@afterheading + \fi}% +% \end{macrocode} +% \begin{macrocode} + % book.cls [2005/09/16 v1.4f Standard LaTeX document class] + \caption@patch@chapter{book}{% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}##1}% + \else + \addcontentsline{toc}{chapter}{##1}% + \fi + \else + \addcontentsline{toc}{chapter}{##1}% + \fi + \chaptermark{##1}% + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}% + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}]% + \else + \@makechapterhead{##2}% + \@afterheading + \fi + }{% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}##1}% + \else + \addcontentsline{toc}{chapter}{##1}% + \fi + \else + \addcontentsline{toc}{chapter}{##1}% + \fi + \chaptermark{##1}% + \ifdim \@chapterlistsgap>\z@ + \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% + \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% + \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% + \fi + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}]% + \else + \@makechapterhead{##2}% + \@afterheading + \fi}% +% \end{macrocode} +% \begin{macrocode} + % amsbook.cls [2004/08/06 v2.20] + % smfbook.cls [1999/11/15 v1.2f Classe LaTeX pour les monographies editees par la SMF] + \caption@patch@chapter{ams/smfbook}{% + \refstepcounter{chapter}% + \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty + \else \let\@secnumber\thechapter \fi + \typeout{\chaptername\space\@secnumber}% + \def\@toclevel{0}% + \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{##2}% + \else \@tocwriteb\tocchapter{chapter}{##2}\fi + \chaptermark{##1}% + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}% + \@makechapterhead{##2}\@afterheading + }{% + \refstepcounter{chapter}% + \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty + \else \let\@secnumber\thechapter \fi + \typeout{\chaptername\space\@secnumber}% + \def\@toclevel{0}% + \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{##2}% + \else \@tocwriteb\tocchapter{chapter}{##2}\fi + \chaptermark{##1}% + \ifdim \@chapterlistsgap>\z@ + \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% + \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% + \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% + \fi + \@makechapterhead{##2}\@afterheading}% +% \end{macrocode} +% \begin{macrocode} + % scrreprt/scrbook.cls + \@ifundefined{KOMAClassName}{}{% + \caption@Debug{document class `\KOMAClassName' detected}% + \let\caption@patch@chapter\@gobblethree}% +% \end{macrocode} +% \begin{macrocode} + % rapport1/3.cls [2004/06/07 v2.1a NTG LaTeX document class] + \caption@patch@chapter{rapport}{% + \ifnum \c@secnumdepth >\m@ne + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}\toc@font0 ##1}% + \else + \addcontentsline{toc}{chapter}{\toc@font0 ##1}% + \fi + \chaptermark{##1}% + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}% + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}]% + \else + \@makechapterhead{##2}% + \@afterheading + \fi + }{% + \ifnum \c@secnumdepth >\m@ne + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}\toc@font0 ##1}% + \else + \addcontentsline{toc}{chapter}{\toc@font0 ##1}% + \fi + \chaptermark{##1}% + \ifdim \@chapterlistsgap>\z@ + \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% + \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% + \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% + \fi + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}]% + \else + \@makechapterhead{##2}% + \@afterheading + \fi}% +% \end{macrocode} +% \begin{macrocode} + % boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class] + \caption@patch@chapter{boek}{% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}\toc@font0 ##1}% + \else + \addcontentsline{toc}{chapter}{\toc@font0 ##1}% + \fi + \else + \addcontentsline{toc}{chapter}{\toc@font0 ##1}% + \fi + \chaptermark{##1}% + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}% + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}]% + \else + \@makechapterhead{##2}% + \@afterheading + \fi + }{% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}\toc@font0 ##1}% + \else + \addcontentsline{toc}{chapter}{\toc@font0 ##1}% + \fi + \else + \addcontentsline{toc}{chapter}{\toc@font0 ##1}% + \fi + \chaptermark{##1}% + \ifdim \@chapterlistsgap>\z@ + \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% + \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% + \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% + \fi + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}]% + \else + \@makechapterhead{##2}% + \@afterheading + \fi}% +% \end{macrocode} +% \begin{macrocode} + % thesis.cls [1996/25/01 1.0g LaTeX document class (wm).] + \caption@patch@chapter{thesis}{% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\chaptername\space\thechapter.} + \if@thema + \ifx\@shortauthor\@empty + \addcontentsline{toc}{chapter}{% + \protect\numberline{\thechapter.}##1}% + \else + \addcontentsline{toc}{chapter}{% + \protect\numberline{\thechapter.}% + \@shortauthor\hfill\mbox{}\vskip\normallineskip ##1}% + \fi + \else + \addcontentsline{toc}{chapter}{% + \protect\numberline{\thechapter.}##1}% + \fi + \else + \addcontentsline{toc}{chapter}{##1} + \fi + \else + \addcontentsline{toc}{chapter}{##1} + \fi + \chaptermark{##1} + \addtocontents{lof}{\protect\addvspace{10pt}} + \addtocontents{lot}{\protect\addvspace{10pt}} + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}] + \else + \@makechapterhead{##2} + \@afterheading + \fi + }{% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\chaptername\space\thechapter.}% + \if@thema + \ifx\@shortauthor\@empty + \addcontentsline{toc}{chapter}{% + \protect\numberline{\thechapter.}##1}% + \else + \addcontentsline{toc}{chapter}{% + \protect\numberline{\thechapter.}% + \@shortauthor\hfill\mbox{}\vskip\normallineskip ##1}% + \fi + \else + \addcontentsline{toc}{chapter}{% + \protect\numberline{\thechapter.}##1}% + \fi + \else + \addcontentsline{toc}{chapter}{##1}% + \fi + \else + \addcontentsline{toc}{chapter}{##1}% + \fi + \chaptermark{##1}% + \ifdim \@chapterlistsgap>\z@ + \addtocontents{lof}{\protect\addvspace{\@chapterlistsgap}}% + \addtocontents{lot}{\protect\addvspace{\@chapterlistsgap}}% + \float@addtolists{\protect\addvspace{\@chapterlistsgap}}% + \fi + \if@twocolumn + \@topnewpage[\@makechapterhead{##2}]% + \else + \@makechapterhead{##2}% + \@afterheading + \fi}% +% \end{macrocode} +% \begin{macrocode} + \ifx\caption@patch@chapter\@gobblethree \else + \caption@Debug{% + Unsupported document class detected,\MessageBreak + or \noexpand\@chapter was redefined by another package}% + \fi + \let\caption@PatchChapter\@undefined} +%\@onlypreamble\caption@PatchChapter +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@patch@chapter[3]{% + \begingroup +% \let\if@twocolumn\iffalse + \let\if@mainmatter\iffalse + \let\if@thema\iffalse + \def\@tempa[##1]##2{#2}% + \ifx\@tempa\@chapter + \caption@Debug{document class `#1' detected}% + \gdef\@chapter[##1]##2{#3}% + \global\let\caption@patch@chapter\@gobblethree + \fi + \endgroup} +%\@onlypreamble\caption@patch@chapter +% \end{macrocode} +% \begin{macrocode} +\long\def \@gobblethree #1#2#3{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@stpelt} +% We patch \cs{@stpelt} so a list of `connected' counters will be reset, too. +% (Like \cs{stepcounter} does in |ltcounts.dtx|.) +% \begin{macrocode} +\newcommand*\caption@patch@stpelt{% + \let\caption@stpelt\@stpelt + \def\@stpelt##1{% + \caption@stpelt{##1}% + \begingroup + \let\@elt\caption@stpelt + \csname caption@cl@##1\endcsname + \endgroup}% + \let\caption@patch@stpelt\relax} +\@onlypreamble\caption@patch@stpelt +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@addtoreset} +% \changes{v1.2d}{2009/10/09}{This macro added} +% Like \cs{@addtoreset} from |ltcounts.dtx| +% \begin{macrocode} +\newcommand*\caption@addtoreset[2]{% + \caption@patch@stpelt + \@ifundefined{caption@cl@#2}{\@namedef{caption@cl@#2}{}}{}% + \expandafter\@cons\csname caption@cl@#2\endcsname{{#1}}} +\@onlypreamble\caption@addtoreset +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@addtoreset} +% \changes{v1.2d}{2009/10/09}{This macro added} +% Like \cs{@removefromreset} from |remreset.sty| +% \begin{macrocode} +\newcommand*\caption@removefromreset[2]{% + \begingroup + \expandafter\let\csname c@#1\endcsname\caption@removefromreset + \def\@elt##1{% + \expandafter\ifx\csname c@##1\endcsname\caption@removefromreset + \else + \noexpand\@elt{##1}% + \fi}% + \expandafter\xdef\csname caption@cl@#2\endcsname{% + \csname caption@cl@#2\endcsname}% + \endgroup} +\@onlypreamble\caption@removefromreset +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareCaptionSubType} +% \changes{v1.2}{2007/11/16}{This macro added} +% \changes{v1.2a}{2008/03/11}{Bugfix: \cs{subfigurename} will be defined now} +% \changes{v1.2d}{2009/10/09}{Bugfix 08-10-01: Usage of \cs{caption@addtoreset} added} +% \changes{v1.3}{2011/01/01}{\cs{@dottedlofline} will be defined \& used now} +% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\ +% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\par +% The starred variant provides the numbering format +% \meta{type}|.|\meta{subtype} while the non-starred variant simply +% uses \meta{subtype}. +% \begin{macrocode} +\newcommand*\DeclareCaptionSubType{% + \caption@teststar\caption@declaresubtype\@firstoftwo\@secondoftwo} +\@onlypreamble\DeclareCaptionSubType +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declaresubtype[1]{% + \@testopt{\caption@@declaresubtype{#1}}{alph}} +\@onlypreamble\caption@declaresubtype +% \end{macrocode} +% \begin{macrocode} +\def\caption@@declaresubtype#1[#2]#3{% + \@ifundefined{c@#3}% + {\caption@Error{No float type '#3' defined}}% +% \end{macrocode} +% \begin{macrocode} + {\@ifundefined{c@sub#3}% + {\caption@Debug{New subtype `sub#3'}% + \newcounter{sub#3}% + \caption@addtoreset{sub#3}{#3}% + \@namedef{ext@sub#3}{\csname ext@#3\endcsname}% + \caption@declaresublistentry{#3}% + \@cons\caption@subtypelist{{#3}}}% + {\caption@Debug{Modify caption `sub#3'}}% +% \end{macrocode} +% \begin{macrocode} + \@namedef{sub#3name}{}% + \@namedef{sub#3autorefname}{\csname #3name\endcsname}% + #1% is \@firstoftwo in star form, and \@secondoftwo otherwise + {\@namedef{p@sub#3}{}% + \@namedef{thesub#3}{\csname the#3\endcsname.\@nameuse{#2}{sub#3}}}% + {\@namedef{p@sub#3}{\csname the#3\endcsname}% + \@namedef{thesub#3}{\@nameuse{#2}{sub#3}}}% + \@namedef{theHsub#3}{\csname theH#3\endcsname.\arabic{sub#3}}% + }} +% \end{macrocode} +% \begin{macrocode} +\@onlypreamble\caption@@declaresubtype +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declaresublistentry{% + \@ifundefined{l@chapter}% + {\caption@@declaresublistentry\l@subsubsection}% + {\caption@@declaresublistentry\l@subsection}} +\@onlypreamble\caption@declaresublistentry +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@declaresublistentry[2]{% + \ifx#1\@undefined + \caption@@@declaresublistentry\relax\@dottedtocline\caption@nil{#2}% + \else + \expandafter\caption@@@declaresublistentry#1{}{}\@dottedtocline\caption@nil{#2}% + \fi} +\@onlypreamble\caption@@declaresublistentry +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@@@declaresublistentry#1\@dottedtocline#2\caption@nil#3{% + \def\@tempa{#1}% +% Does \l@(sub)subsection start with \@dottedtocline? + \ifx\@tempa\@empty +% Yes + \caption@@@@declaresublistentry{#3}#2\caption@nil + \else +% No + \caption@@@@declaresublistentry{#3}@{3.8em}{3.2em}\caption@nil + \fi} +\@onlypreamble\caption@@@declaresublistentry +% \end{macrocode} +% \begin{macrocode} +\def\caption@@@@declaresublistentry#1#2#3#4#5\caption@nil{% + \expandafter\caption@@@@@declaresublistentry\expandafter + {\csname @dotted\csname ext@#1\endcsname line\endcsname}{#1}{#3}{#4}} +\@onlypreamble\caption@@@@declaresublistentry +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@@@@declaresublistentry[4]{% + \@namedef{l@sub#2}{#1{2}{#3}{#4}}% + \caption@@@@@@declaresublistentry#1{c@\csname ext@#2\endcsname depth}} +\@onlypreamble\caption@@@@@declaresublistentry +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@@@@@declaresublistentry[2]{ + \ifx#1\relax + \def#1##1{% + \def\next{\@dottedtocline{##1}}% + \@ifundefined{#2}{}{% + \ifnum ##1>\@nameuse{#2}\relax + \let\next\@gobblefour + \fi}% + \next}% + \fi} +\@onlypreamble\caption@@@@@@declaresublistentry +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@subtypelist} +% An \cs{@elt}-list containing the subtypes defined +% with |\Declare|\x|Caption|\x|Sub|\x|Type|. +% \begin{macrocode} +\newcommand*\caption@subtypelist{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@For} +% \changes{v1.1a}{2007/09/07}{This macro added} +% \changes{v1.2}{2007/11/16}{Renamed from \cs{ForFloatingEnvironments} to \cs{caption@For}} +% |\caption@For|\marg{elt-list}\marg{code with \#1}\\ +% |\caption@For*|\marg{elt-list}\marg{code with \#1} +% \begin{macrocode} +\newcommand*\caption@For{\caption@withoptargs\caption@@For} +%\@onlypreamble\caption@For +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@@For[3]{% + \caption@AtBeginDocument#1{% + \def\@elt##1{#3}% + \@nameuse{caption@#2}% + \let\@elt\relax}}% +%\@onlypreamble\caption@@For +% \end{macrocode} +% \end{macro} +% +% \subsection{subfig package adaptions} +% \changes{v1.0i}{2007/01/07}{Very small bugfix of \package{subfig} package added} +% \changes{v1.0j}{2007/01/31}{Bugfix of subfig package moved from package} +% \changes{v1.1}{2007/07/07}{Several adaptions to the \package{subfig} package added} +% \changes{v1.2e}{2010/01/09}{Patch for better hyperref support added to \package{subfig} package adaptions} +% \changes{v1.2f}{2010/01/14}{Latest patch didn't worked without hyperref; fixed} +% \changes{v1.3}{2010/12/20}{subfig package bugfixes dropped} +% +% We have to make several adaptions to \thispackage~\version{1.1} here. +% \begin{macrocode} +\caption@AtBeginDocument{% + \def\@tempa{\@ifstar\sf@@subref\sf@subref}% + \ifx\subref\@tempa + \caption@InfoNoLine{subfig package 1.2 or 1.3 is loaded}% +% \end{macrocode} +% \begin{macrocode} + \let\caption@setfloattype\@gobble + \let\@dottedxxxline\sf@NEW@dottedxxxline + \let\sf@subfloat\sf@NEW@subfloat +% \end{macrocode} +% \begin{macrocode} + \fi + \let\sf@NEW@dottedxxxline\@undefined + \let\sf@NEW@subfloat\@undefined} +% \end{macrocode} +% \begin{macrocode} +\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{% + \begingroup + \caption@setfloattype{#1}% + \caption@setoptions{subfloat}% + \caption@setoptions{sub#1}% + \ifnum #3>\@nameuse{c@#2depth}\else + \@dottedtocline{\z@}{#4}{#5}{#6}{#7}% + \fi + \endgroup} +% \end{macrocode} +% \begin{macrocode} +\def\sf@NEW@subfloat{% + \begingroup + \caption@setfloattype\@captype + \sf@ifpositiontop{% + \maincaptiontoptrue + }{% + \maincaptiontopfalse + }% + \caption@setoptions{subfloat}% + \caption@setoptions{sub\@captype}% + \let\sf@oldlabel=\label + \let\label=\subfloat@label + \ifmaincaptiontop\else + \advance\@nameuse{c@\@captype}\@ne + \fi + \refstepcounter{sub\@captype}% + \setcounter{sub\@captype @save}{\value{sub\@captype}}% + \@ifnextchar [% %] match left bracket + {\sf@@subfloat}% + {\sf@@subfloat[\@empty]}} +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% \clearpage +% \begin{thebibliography}{99} +% \bibitem{Anne} +% Anne Br\"uggemann-Klein:\\ +% \emph{Einf\"uhrung in die Dokumentverarbeitung},\\ +% B.G. Teubner, Stuttgart, 1989 +% +% \bibitem{hyperref} +% Sebastian Rahtz \& Heiko Oberdiek:\\ +% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/hyperref/}% +% {\emph{Hypertext marks in \LaTeX}},\\ +% November 12, 2007 +% +% \bibitem{refcount} +% Heiko Oberdiek:\\ +% \href{ftp://ctan.tug.org/tex-archive/macros/latex/contrib/oberdiek/refcount.pdf}% +% {\emph{The refcount package}},\\ +% 2006/02/20 +% +% \bibitem{threeparttable} +% Donald Arseneau:\\ +% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/misc/}% +% {\emph{Three part tables: title, tabular environment, notes}},\\ +% 2003/06/13 +% \end{thebibliography} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \clearpage +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex/caption/ltcaption.dtx b/Master/texmf-dist/source/latex/caption/ltcaption.dtx index 7fd8663a8b8..4973327f210 100644 --- a/Master/texmf-dist/source/latex/caption/ltcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/ltcaption.dtx @@ -2,7 +2,7 @@ % % This is file `ltcaption.dtx'. % -% Copyright (C) 2007-2009 Axel Sommerfeldt (caption@sommerfee.de) +% Copyright (C) 2007-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % @@ -19,12 +19,13 @@ % This Current Maintainer of this work is Axel Sommerfeldt. % % This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% ltcaption.dtx, and subcaption.dtx, the derived files caption.sty, -% caption2.sty, caption3.sty, ltcaption.sty, and subcaption.sty, and the -% user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% caption3.dtx, bicaption.dtx, ltcaption.dtx, and subcaption.dtx, +% the derived files caption.sty, caption2.sty, caption3.sty, bicaption.sty, +% ltcaption.sty, and subcaption.sty, and the user manuals caption-deu.tex, +% caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{340} +% \CheckSum{341} % % \iffalse %<*driver> @@ -83,7 +84,7 @@ % This package has version number \fileversion, last revised \filedate.}}%^^A % {The ltcaption package}} % \author{Axel Sommerfeldt\\ -% \href{mailto:caption@sommerfee.de}{\texttt{caption@sommerfee.de}}} +% \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}} % \date{\docdate} % \maketitle % @@ -450,7 +451,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{ltcaption}[2008/03/28 v1.2 longtable captions (AR)] +\ProvidesPackage{ltcaption}[2011/01/01 v1.2a longtable captions (AR)] % \end{macrocode} % % \subsection{User interface} @@ -578,7 +579,8 @@ % \end{macro} % % \begin{macro}{\LT@c@ption} -% \changes{v1.1a}{2008/01/22}{Made it \cs{long}} +% \changes{v1.1a}{2008/01/22}{Bugfix: Made it \cs{long}} +% \changes{v1.2a}{2011/01/01}{Bugfix: \cs{ignorespaces} added} % The original implementation: % \begin{verbatim} % \def\LT@c@ption#1[#2]#3{% @@ -598,7 +600,8 @@ {\let\\\space \addcontentsline{\csname ext@\LTcaptype\endcsname}{\LTcaptype}% {\protect\numberline{\csname the\LTcaptype\endcsname}{#2}}}% - \fi} + \fi + \ignorespaces} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx index 8c6781305e2..413d66da4ec 100644 --- a/Master/texmf-dist/source/latex/caption/subcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx @@ -2,7 +2,7 @@ % % This is file `subcaption.dtx'. % -% Copyright (C) 2007-2008 Axel Sommerfeldt (caption@sommerfee.de) +% Copyright (C) 2007-2010 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % @@ -19,17 +19,18 @@ % This Current Maintainer of this work is Axel Sommerfeldt. % % This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% ltcaption.dtx, and subcaption.dtx, the derived files caption.sty, -% caption2.sty, caption3.sty, ltcaption.sty, and subcaption.sty, and the -% user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% caption3.dtx, bicaption.dtx, ltcaption.dtx, and subcaption.dtx, +% the derived files caption.sty, caption2.sty, caption3.sty, bicaption.sty, +% ltcaption.sty, and subcaption.sty, and the user manuals caption-deu.tex, +% caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{203} +% \CheckSum{78} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{subcaption.drv}[2008/08/31 v1.0b Adds a sub-caption feature to the caption package] +\ProvidesFile{subcaption.drv}[2010/09/04 v1.0 Adds a sub-caption feature to the caption package] \hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up. %\errorcontextlines=3 % @@ -58,8 +59,7 @@ \ifpdf\usepackage{hypdestopt}\fi \hypersetup{pdfkeywords={LaTeX, package, subcaption},pdfstartpage={},pdfstartview={}} % -\usepackage{caption}[2007/12/06] % needs v3.1f or newer -\usepackage{subcaption}[2008/08/31] +\usepackage{subcaption}[2010/09/01] \DeclareCaptionSubType*[arabic]{table} \captionsetup[subtable]{labelformat=simple,labelsep=colon} % @@ -116,13 +116,13 @@ % This package has version number \fileversion, last revised \filedate.}}%^^A % {The subcaption package}} % \author{Axel Sommerfeldt\\ -% \href{mailto:caption@sommerfee.de}{\texttt{caption@sommerfee.de}}} +% \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}} % \date{\docdate} % \maketitle % % \begin{abstract} -% This tiny package demonstrates the sub-caption feature of the -% \package{caption} package. +% This package supports typesetting of sub-captions +% (by using the the sub-caption feature of the \package{caption} package). % \end{abstract} % % \begin{background} @@ -153,10 +153,11 @@ % \clearpage % \section{The user interface} % -% Just load this package after the \package{caption} package, e.g.: +% \subsection{Loading the package} +% +% Load this package using % \begin{quote} -% |\usepackage|\oarg{options}|{caption}|\\ -% |\usepackage|\oarg{options}|{subcaption}| +% |\usepackage|\oarg{options}|{subcaption}|\quad. % \end{quote} % The options for \thispackage\ are the same ones as for the \package{caption} % package, but specify settings which are used for sub-captions @@ -168,7 +169,7 @@ % is identical to % \begin{quote} % |\usepackage{subcaption}|\\ -% |\captionsetup[sub]|\marg{options} +% |\captionsetup[sub]|\marg{options}\quad. % \end{quote} % % \bigskip @@ -178,30 +179,30 @@ % |margin=0pt,font+=small,labelformat=parens,labelsep=space,|\\ % |skip=6pt,list=false,hypcap=false|~\footnote{%^^A % This means that sub-captions are not listed in the List of Figures -% or Tables by default, but (of course) you can enable that by +% or Tables by default, but you can enable that by % specifying the option \texttt{list=true}.} % \end{quote} % % Options specified with |\usepackage[|\ldots|]{sub|\-|caption}| and % |\caption|\-|setup[sub]{|\ldots|}| will override the ones specified by -% |\caption|\-|setup{|\ldots|}| and |\caption|\-|setup[figure]{|\ldots|}|, +% |\caption|\-|setup{|\ldots|}| and |\caption|\-|setup[fig|\-|ure]{|\ldots|}|, % but are again overwritten by |\caption|\-|setup[sub|\-|figure]{|\ldots|}| % (same for `table'). So finally we have the following order how % settings for sub-captions are applied: % \begin{enumerate} -% \item global settings +% \item Global settings % {\small(|\usepackage[|\ldots|]{caption}| and |\captionsetup{|\ldots|}|)} -% \item environmental settings +% \item Environmental settings % {\small(|\captionsetup[figure|\emph{ -or- }|table]{|\ldots|}|)} -% \item local settings +% \item Local settings % {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)} -% \item default `sub' settings +% \item Default `sub' settings % {\small(|margin=0pt,font+=small,|\ldots, see above)} -% \item custom `sub' settings +% \item Custom `sub' settings % {\small(|\usepackage[|\ldots|]{subcaption}| and |\captionsetup[sub]{|\ldots|}|)} -% \item environmental `sub' settings +% \item Environmental `sub' settings % {\small(|\captionsetup[subfigure|\emph{ -or- }|subtable]{|\ldots|}|)} -% \item local `sub' settings +% \item Local `sub' settings % {\small(|\captionsetup{|\ldots|}| inside |subfigure| or |subtable|)} % \end{enumerate} % An example: @@ -287,8 +288,8 @@ % |subtable| are available, which have the same (optional \& mandatory) % arguments as the |minipage| environment. % Inside these environments you use the ordinary |\caption| command -% for typesetting captions. So this example is identical to the -% last one, but uses the |subfigure| environment: +% for typesetting captions. So this example is the same as the last one, +% but uses the |subfigure| environment: % \begin{quote} % |\begin{figure}|\\ % | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\ @@ -303,7 +304,7 @@ % |\end{figure}| % \end{quote} % Using the |subfigure| or |subtable| environment instead of |\subcaption| -% has two (little) advantages: +% has two advantages: % \begin{itemize} % \item You can override the setttings for a specific subcaption % with a |\captionsetup| inside the |subfigure| or |subtable| environment, e.g.: @@ -316,7 +317,7 @@ % |\end{subfigure}|\\ % \ldots % \end{quote} -% \item Hyperlinks pointing to this subfigure will jump to the beginning +% \item Hyperlinks targeted to this subfigure will jump to the beginning % of the subfigure, and not to the caption of the subfigure % (if |hypcap=true| is set for sub-captions). % \See{\Ref{hypcap}} @@ -440,6 +441,21 @@ % % \bigskip % +% \iffalse +% \noindent\begin{minipage}{\linewidth} +% \captionsetup{type=figure} +% \centering +% \hbox{\subcaptionbox{An elephant\label{elephant4}} +% {\includegraphics[width=.4\textwidth]{elephant}}%^^A +% \vbox{\subcaptionbox{Cat 1\label{cat4.1}} +% {\includegraphics[width=30pt]{cat}}\par +% \subcaptionbox{Cat 2\label{cat4.2}} +% {\includegraphics[width=30pt]{cat}}}}%^^A +% \caption{Two animals}\label{animals4} +% \end{minipage} +% \bigskip +% \fi +% % \begin{background} % The |\sub|\-|caption|\-|box| is a |\par|\-|box| with % |\caption|\-|setup{sub|\-|type}| as first contents line. @@ -691,6 +707,8 @@ % \changes{v0.2}{2007/11/11}{\cs{subcaptionbox} added} % \changes{v0.3}{2007/12/06}{Adapted to \package{caption} package \version{3.1f}} % \changes{v1.0}{2008/03/16}{\cs{subfloat} added} +% \changes{v1.0c}{2010/10/27}{An error message will be issued when the subfigure or subfig package is loaded} +% \changes{v1.0c}{2011/01/22}{Undocumented command \cs{subfloat} removed} % % \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}} % @@ -705,24 +723,33 @@ % \fi % % \subsection{Identification} -% % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{subcaption}[2008/08/31 v1.0b Adding subcaptions (AR)] +\ProvidesPackage{subcaption}[2011/01/22 v1.0c Adding subcaptions (AR)] % \end{macrocode} % % \subsection{Initial code} % -% We need the \package{caption} package, so we issue an error here if it's -% not loaded yet. +% Since we are incompatible to them an error message will be issued when +% the \package{subfigure} or \package{subfig} package is loaded. % \begin{macrocode} -\@ifundefined{caption@subtypehook}{% we need caption v3.1f or newer - \PackageError{subcaption}{`caption' package not loaded\MessageBreak - (which is needed by this package)\@gobble}{% - If you do not understand this error, please take a closer look\MessageBreak - at the documentation of the `subcaption' package.\MessageBreak - \@ehc}% - \endinput}{} +\@ifundefined{subfigure}{}{% + \PackageError{subcaption}{% + This package can't be used in cooperation\MessageBreak + with the subfigure package}% + \endinput} +% \end{macrocode} +% \begin{macrocode} +\@ifundefined{subfloat}{}{% + \PackageError{subcaption}{% + This package can't be used in cooperation\MessageBreak + with the subfig package}% + \endinput} +% \end{macrocode} +% +% Since we base on the \package{caption} package we load it here. +% \begin{macrocode} +\RequirePackage{caption}[2010/12/01] % needs v3.2 or newer % \end{macrocode} % % \iffalse @@ -732,22 +759,14 @@ % % \subsection{Execution of options} % -% We map |\caption@setkeys| to |\captionsetup[sub]| so |\caption@ExecuteOptions| -% \& |\caption@ProcessOptions| adds the options to the `|sub|' option list -% instead of executing them immediately. -% \begin{macrocode} -\let\caption@setkeys@ORI\caption@setkeys -\renewcommand\caption@setkeys[2]{\captionsetup[sub]{#2}} -% \end{macrocode} +% We use |\caption@ExecuteOptions| and |\caption@ProcessOptions| here to add +% the options to the `|sub|' option list instead of executing them immediately. % \begin{macrocode} +\caption@SetupOptions{subcaption}{\captionsetup[sub]{#2}}% \caption@ExecuteOptions{subcaption}{% font+=small,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0} \caption@ProcessOptions*{subcaption} % \end{macrocode} -% \begin{macrocode} -\let\caption@setkeys\caption@setkeys@ORI -\let\caption@setkeys@ORI\@undefined -% \end{macrocode} % % \subsection{Main code} % @@ -808,100 +827,12 @@ % \begin{macro}{\subcaptionbox} % \changes{v1.0a}{2008/05/06}{Adapted to the \opt{rule} option of the \package{caption} package} % \changes{v1.0b}{2008/08/31}{Definition and usage of \cs{subcaption@hrule} added} +% \changes{v1.0c}{2010/12/17}{Uses \cs{caption@box} now} % A |\parbox| with contents and sub-caption, separated by an invisible |\hrule|. % \begin{macrocode} -\newcommand*\subcaptionbox{\caption@withoptargs\subcaption@box} -% \end{macrocode} -% \begin{macrocode} -\newcommand\subcaption@box[2]{% - \@testopt{\subcaption@ibox{#1}{#2}}{\wd\@tempboxa}} -% \end{macrocode} -% \begin{macrocode} -\long\def\subcaption@ibox#1#2[#3]{% - \@testopt{\subcaption@iibox{#1}{#2}{#3}}\subcaptionbox@hj@default} -% \end{macrocode} -% \begin{macrocode} -\long\def\subcaption@iibox#1#2#3[#4]#5{% - \setbox\@tempboxa\hbox{#5}% - \begingroup - \captionsetup{subtype*}% set \caption@position - \caption@iftop{% - \endgroup - \parbox[t]{#3}{% - \captionsetup{subtype,position=t}% - \vbox{\caption#1{#2}}% - \subcaption@hrule - \csname caption@hj@#4\endcsname - \unhbox\@tempboxa}% - }{% - \endgroup - \parbox[b]{#3}{% - \captionsetup{subtype,position=b}% - \csname caption@hj@#4\endcsname - \unhbox\@tempboxa - \subcaption@hrule - \vtop{\caption#1{#2}}}% - }} -% \end{macrocode} -% \begin{macrocode} -\providecommand*\caption@hj@c{\centering} -\providecommand*\caption@hj@l{\raggedright} -\providecommand*\caption@hj@r{\raggedleft} -\providecommand*\caption@hj@s{} -\newcommand*\subcaptionbox@hj@default{c} -\newcommand*\subcaption@hrule{\hrule\@height\z@} -% \end{macrocode} -% \end{macro} -% -% \pagebreak[3] -% \subsubsection{The \cs{subfloat} command} -% -% \begin{macro}{\subfloat} -% \changes{v0.4}{2008/03/01}{This macro added} -% |\subfloat|\oarg{list\_entry}\oarg{sub-caption}\marg{body}\\ -% |\subfloat*|\marg{body}\par -% If \meta{sub-caption} is given, we simply map this to \cs{subcaptionbox}. -% If not, we do the same as \cs{subcaptionbox}, but increment the -% sub-caption counter instead of typesetting a sub-caption. -% (The star variant is neither incrementing the sub-caption counter -% nor setting an hyperref anchor.) -% \begin{macrocode} -\newcommand*\subfloat{% - \@ifnextchar[\@subfloat\subfloat@} -% \end{macrocode} -% \begin{macrocode} -\long\def\@subfloat[#1]{% - \@ifnextchar[{\@@subfloat{#1}}{\subcaptionbox{#1}}} -% \end{macrocode} -% \begin{macrocode} -\long\def\@@subfloat#1[#2]{\subcaptionbox[{#1}]{#2}} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\subfloat@{% - \caption@teststar\subfloat@@\@firstoftwo\@secondoftwo} -% \end{macrocode} -% \begin{macrocode} -\newcommand\subfloat@@[2]{% - \setbox\@tempboxa\hbox{#2}% - \begingroup - \captionsetup{subtype*}% set \caption@position - \caption@iftop{\subfloat@@@ t}{\subfloat@@@ b}% - {#1}\subcaptionbox@hj@default} -% \end{macrocode} -% \begin{macrocode} -\newcommand\subfloat@@@[3]{% - \endgroup - \parbox[#1]{\wd\@tempboxa}{% - #2% \@firstoftwo in star form, \@secondoftwo otherwise - {\captionsetup{subtype*,position=#1}}% - {\captionsetup{subtype,position=#1}% - \caption@refstepcounter\@subcaptype - \caption@prepareanchor\@subcaptype{}% - \caption@makeanchor{}}% - \caption@iftop\subcaption@hrule\@empty - \csname caption@hj@#3\endcsname - \unhbox\@tempboxa - \caption@iftop\@empty\subcaption@hrule}}% +\newcommand*\subcaptionbox{% + \def\captionbox@type{subtype}% + \caption@withoptargs\caption@box} % \end{macrocode} % \end{macro} % -- cgit v1.2.3