From a9409c96664c73e4fd0586f358845df19b1afd62 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 21 Feb 2022 03:01:01 +0000 Subject: CTAN sync 202202210301 --- .../contrib/caption/fallback/v3.5/caption.dtx | 4292 ++++++++++++++++++ .../contrib/caption/fallback/v3.5/caption3.dtx | 4680 ++++++++++++++++++++ 2 files changed, 8972 insertions(+) create mode 100644 macros/latex/contrib/caption/fallback/v3.5/caption.dtx create mode 100644 macros/latex/contrib/caption/fallback/v3.5/caption3.dtx (limited to 'macros/latex/contrib/caption/fallback/v3.5') diff --git a/macros/latex/contrib/caption/fallback/v3.5/caption.dtx b/macros/latex/contrib/caption/fallback/v3.5/caption.dtx new file mode 100644 index 0000000000..c573255554 --- /dev/null +++ b/macros/latex/contrib/caption/fallback/v3.5/caption.dtx @@ -0,0 +1,4292 @@ +% \iffalse meta-comment +% +% This is file `caption.dtx'. +% +% Copyright (C) 1994-2020 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, caption-light.dtx, caption2.dtx, caption3.dtx, +% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx, +% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx, +% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, +% the derived files +% caption.sty, caption-light.sty, caption2.sty, caption3.sty, +% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto, +% caption-koma.sto, caption-memoir.sto, caption-ntg.sto, +% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty, +% and the user manuals +% caption-deu.tex, caption-eng.tex, caption-rus.tex. +% +% \fi +% \CheckSum{2692} +% +% \iffalse +%<*driver> +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesFile{caption.drv}[2020/10/11 v3.5 Implementation of the caption package] +\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up. +%\errorcontextlines=3 +% +\documentclass{ltxdoc} +\setlength\parindent{0pt} +\setlength\parskip{\smallskipamount} +% +\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]{caption}[2013/01/01] +% +\DeclareRobustCommand*\eTeX{\texorpdfstring + {\leavevmode\hbox{$\varepsilon$}-\TeX}% + {e-TeX}} +% +\begin{document} + \DocInput{caption.dtx} +\end{document} +% +% \fi +% +% \newcommand*\purerm[1]{\texorpdfstring{{\upshape\mdseries\rmfamily #1}}{#1}} +% \newcommand*\puresf[1]{\texorpdfstring{{\upshape\mdseries\sffamily #1}}{#1}} +% \newcommand*\purett[1]{\texorpdfstring{{\upshape\mdseries\ttfamily #1}}{#1}} +% \let\class\puresf \let\package\puresf +% \let\env\purett \let\opt\purett +% +% \def\thispackage{the \package{caption} package} +% \def\Thispackage{The \package{caption} package} +% +% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} +% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} +% \newcommand*\version[2][]{v$#2$} +% +% \newcommand*\issue[1]{GitLab~\##1} +% +% \GetFileInfo{caption.drv} +% \let\docdate\filedate +% \let\docversion\fileversion +% \GetFileInfo{caption.sty} +% +% \title{The Implementation of +% \texorpdfstring{\thispackage\thanks{%^^A +% This package has version number \docversion.}}%^^A +% {the caption package}} +% \author{Axel Sommerfeldt\\ +% \url{https://gitlab.com/axelsommerfeldt/caption}} +% \date{\docdate} +% \maketitle +% +% \begin{abstract} +% \Thispackage\ consists of two parts -- the kernel +% (|caption3.sty|) and the main package (|caption.sty|). +% +% \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 +% of the captions from floating environments like |figure| and |table|. +% Furthermore it does similar to the caption stuff coming from other packages +% (like the \package{longtable} or \package{supertabular} package): +% Mapping the appropriate internal commands (like |\LT@makecaption| or +% |\ST@caption|) to the ones offered by the \package{caption3} kernel. +% So you can think of \thispackage\ as a layer package, it +% simply provides adaptation layers between the caption stuff coming from +% \LaTeXe\ or packages, and the caption stuff offered by the +% \package{caption3} kernel. +% \end{abstract} +% +% \section*{User manual} +% +% This document is describing the code implementation only. +% The user documentation can be found in +% \nopagebreak\begin{quote} +% \begin{tabular}{ll} +% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-eng.pdf}% +% {\texttt{caption-eng.pdf}} & The English documentation \\ +% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-rus.pdf}% +% {\texttt{caption-rus.pdf}} & The Russian documentation\footnotemark \\ +% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption-deu.pdf}% +% {\texttt{caption-deu.pdf}} & The German documentation \\ +% \end{tabular} +% \footnotetext{Thanks a lot to Olga Lapko for this translation} +% \end{quote} +% +% \pagebreak[4] +% \section*{Internal commands} +% +% These internal commands are save to use by other packages as well +% since their interface will not change in future releases: +% \begin{quote}\begin{tabular}{ll} +% Internal command & Currently used by \\ +% \hline +% |\caption@kernel@addcontentsline| & \package{floatrow} \\ +% |\caption@makecaption| & \package{bidi} \\ +% |\caption@settype| & \package{newfloat} \\ +% |\caption@setsubtype| & \package{floatrow} \\ +% |\caption@starfalse| & \package{bidi} \\ +% |\caption@startrue| & \package{bidi} \\ +% |\caption@xlabel| & \package{cleveref} \\ +% \end{tabular}\end{quote} +% +% If your package wants to use any other internal command of the \package{caption} package, +% please write me an e-mail so we can define a proper interface together. +% +% The \package{lwarp} package uses a lot of internal commands as well, +% but we are working on it on the Git branch \texttt{feature/lwarp}: +% \url{https://gitlab.com/axelsommerfeldt/caption/-/tree/feature/lwarp} +% +% \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}{1994/10/27}{First release} +% \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 \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}} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \clearpage +% +% \iffalse +%<*package> +% \fi +% +% \section{Identification} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{caption}[2020/10/26 v3.5g Customizing captions (AR)] +% \end{macrocode} +% +% \section{Loading the kernel} +% +% \begin{macrocode} +\RequirePackage{caption3}[=2020/10/06] % needs v2.2b or newer +% \end{macrocode} +% +% \section{Check against unknown document classes} +% +% \begin{macrocode} +\caption@ifbool{documentclass}{}{% + \caption@WarningNoLine{% + Unknown document class (or package),\MessageBreak + standard defaults will be used}} +% \end{macrocode} +% +% \section{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}; +% 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@InfoNoLine{% + `#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} +% +% \section{Declaration of options} +% +% \subsection{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} +% +% \begin{macro}{\caption@selectlistentry} +% \changes{v3.2}{2010/11/07}{This macro added} +% |\caption@selectlistentry|\marg{\purett{heading} or \purett{entry}} +% \begin{macrocode} +\newcommand*\caption@selectlistentry[1]{% + \caption@ifinlist{#1}{heading}{% + \let\caption@iflistheading\@firstoftwo + }{\caption@ifinlist{#1}{default,list-entry,entry}{% + \let\caption@iflistheading\@secondoftwo + }{% + \caption@Error{Undefined list-entry selection `#1'}% + }}} +% \end{macrocode} +% \end{macro} +% +% \changes{v3.3}{2012-03-25}{Option \opt{list-entry} added} +% \begin{macrocode} +\DeclareCaptionOption{list-entry}{\caption@selectlistentry{#1}} +\captionsetup{list-entry=default} +% \end{macrocode} +% +% \begin{macro}{\caption@declparboxrestore} +% \changes{v3.5g}{2020/10/26}{This macro added} +% |\caption@declparboxrestore|\marg{name}\marg{code} +% \begin{macrocode} +% TODO: Remove \caption@declparboxrestore +\newcommand\caption@declparboxrestore{% + \caption@decl{parboxrestore}} +% \end{macrocode} +% \begin{macrocode} +\@onlypreamble\caption@declparboxrestore +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setparboxrestore} +% \changes{v3.2}{2010/11/07}{This macro added} +% \changes{v3.5g}{2020/10/26}{New implementation; default changed from `partial' to `full'} +% |\caption@setparboxrestore|\marg{\purett{partial} or \purett{full}} +% \begin{macrocode} +% TODO: Remove \caption@setparboxrestore +\newcommand*\caption@setparboxrestore{% + \caption@set{parboxrestore}} +% \end{macrocode} +% \begin{macrocode} +\caption@declparboxrestore{full}{% + \@parboxrestore} +% \end{macrocode} +% 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} +\caption@declparboxrestore{partial}{% + \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@parboxrestore@mini} +% \changes{v3.2}{2010/10/24}{This macro added} +% \changes{v3.5g}{2020/10/26}{Renamed from \cs{caption@boxrestore@mini} to \cs{caption@parboxrestore@mini}} +% Resets |\par| so the very first |\par| in |\@caption| behaves quite the same as in floating environments. +% Will be used by |\set|\-|caption|\-|type|. +% \begin{macrocode} +\caption@declparboxrestore{mini}{% + \let\par\@@par + \parindent\z@ \parskip\z@skip + \sloppy} +% \end{macrocode} +% \end{macro} +% +% `default' usually maps to `full'. +% \changes{v3.5g}{2020/10/26}{The default of \cs{caption@parboxrestore} maps to `full' instead of `partial' now} +% \begin{macrocode} +\SetCaptionDefault{parboxrestore}{full} +% \end{macrocode} +% +% \changes{v3.2}{2010/11/07}{Option \opt{parboxrestore} added} +% \begin{macrocode} +% TODO: Remove the (undocumentated) option "parboxrestore" +\DeclareCaptionOption{parboxrestore}{\caption@setparboxrestore{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@parboxrestore} +% \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} +% \changes{v3.5g}{2020/10/26}{New implementation; renamed from \cs{caption@boxrestore} to \cs{caption@parboxrestore}} +% \begin{macrocode} +% TODO: Change definition to \def\caption@parboxrestore{\@parboxrestore} +\captionsetup{parboxrestore=default} +% \end{macrocode} +% \end{macro} +% +% \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} +% +% \subsection{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} +% \changes{v3.5a}{2020/09/02}{caption v1.x compatibility options fixed} +% +% Currently we support |v1| and |v3| as values for the |compatibility=| option. +% But since this used to be a boolean option is the past we still support any boolean value +% for compatibility reasons. +% +% \begin{macrocode} +\DeclareCaptionOption{compatibility}[v1]{% + \caption@ifinlist{#1}{v1,1,true,yes,on}{% + \let\caption@ifcompatibility\@firstoftwo + }{\caption@ifinlist{#1}{v3,3,0,false,no,off}{% + \let\caption@ifcompatibility\@secondoftwo + }{% + \caption@Error{Undefined compatibility value `#1'}% + }}} +\@onlypreamble@key{caption}{compatibility} +% \end{macrocode} +% \begin{macrocode} +\caption@setbool{compatibility}{0} % default: Try not to be compatible to v1.x +% \end{macrocode} +% +% \begin{macro}{\caption@setincompatible} +% \changes{v3.4}{2019/09/09}{This macro added} +% |\caption@setincompatible|\marg{condition}\marg{message text} +% \begin{macrocode} +\newcommand*\caption@setincompatible[2]{% + #1{% + \caption@WarningNoLine{% + #2;\MessageBreak + Setting compatibility to v1}% + \caption@setbool{compatibility}{1}% + }{}} +% \end{macrocode} +% \end{macro} +% +% Check against incompatible packages which used to work fine with v1 of the `caption' package. +% \begin{macrocode} +\caption@AtBeginDocument{\caption@ifcompatibility{}{% +% \end{macrocode} +% The usage of the (now obsolete) \package{captcont} package, +% which brings its own definition of |\caption*|, was quite common in the old days. +% \begin{macrocode} + \caption@setincompatible{\@ifpackageloaded{captcont}}{captcont package is loaded}% +% \end{macrocode} +% To be continued\ldots +% \begin{macrocode} +}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionOptionNoValue*{normal}{% + \caption@setup{format=plain,justification=justified}} +\DeclareCaptionOptionNoValue*{isu}{% + \caption@setup{format=hang,justification=justified}} +\DeclareCaptionOptionNoValue*{hang}{% + \caption@setup{format=hang,justification=justified}} +\DeclareCaptionOptionNoValue*{center}{% + \caption@setup{format=plain,justification=centering}} +\DeclareCaptionOptionNoValue*{centerlast}{% + \caption@setup{format=plain,justification=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}{\caption@setup{labelfont+=up}} +\DeclareCaptionOptionNoValue*{it}{\caption@setup{labelfont+=it}} +\DeclareCaptionOptionNoValue*{sl}{\caption@setup{labelfont+=sl}} +\DeclareCaptionOptionNoValue*{sc}{\caption@setup{labelfont+=sc}} +\DeclareCaptionOptionNoValue*{md}{\caption@setup{labelfont+=md}} +\DeclareCaptionOptionNoValue*{bf}{\caption@setup{labelfont+=bf}} +\DeclareCaptionOptionNoValue*{rm}{\caption@setup{labelfont+=rm}} +\DeclareCaptionOptionNoValue*{sf}{\caption@setup{labelfont+=sf}} +\DeclareCaptionOptionNoValue*{tt}{\caption@setup{labelfont+=tt}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionOptionNoValue*{nooneline}{\caption@setup{slc=0}} +% \end{macrocode} +% +% \begin{macrocode} +\caption@setbool{ruled}{0} +\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}} +% \end{macrocode} +% +% \subsection{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} +% \changes{v3.5a}{2020/09/02}{caption v2.x compatibility options fixed} +% +% \begin{macrocode} +\DeclareCaptionOptionNoValue*{flushleft}{% + \caption@setup{format=plain,justification=raggedright}} +\DeclareCaptionOptionNoValue*{flushright}{% + \caption@setup{format=plain,justification=raggedleft}} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOptionNoValue*{oneline}{\caption@setup{slc=1}} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{% + \caption@WarningNoLine{Obsolete option `ignoreLTcapwidth' ignored}} +% \end{macrocode} +% +% \subsection{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} +% +% \subsection{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} +% +% \subsection{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} +% +% \section{Document class support} +% +% Execute the code declared with |\At|\-|Caption|\-|Package|. +% We do this right before processing the options so stuff done with +% |\At|\-|Caption|\-|Package| could be overwritten by user options. +% +% \begin{macrocode} +\caption@documentclass@code +\let\caption@documentclass@code\@undefined +\let\AtCaptionPackage\@firstofone +% \end{macrocode} +% +% \section{Processing of options} +% +% \changes{v3.0m}{2007/03/04}{Verbose option added} +% \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@SetupOptions{caption}{\caption@setkeys{#1}{#2}} +\caption@ProcessOptions*{caption} +% \end{macrocode} +% +% \section{\cs{caption}, \cs{@caption}, and \cs{@makecaption}} +% +% \begin{macro}{\caption@ifflag} +% \changes{v3.3}{2011/12/28}{This switch added} +% \changes{v3.3}{2018/08/08}{Rewritten (and renamed) so a counter is used instead of a switch} +% Since we support continued floats and sub-figures it's not an easy task +% to manage the figure (and table) counter. (Especially since previous versions +% of the caption package has proven that correcting a counter locally is not a good idea.) +% +% These three switches hold the +% current status: |\caption@if|\-|flag{2}| is set if the caption was already +% typeset (so the counter doesn't need to be incremented for sub-figures), +% |\caption@if|\-|flag{4}| is set if there is already content which have +% incremented the counter (so the counter doesn't need to be incremented +% for the main caption, further sub-figures, and other stuff), and +% |\caption@if|\-|flag{1}| is set if |\continued|\-|float| was given. +% +% In the past three boolean switches were used to store the flags, but since some +% packages (like the \package{floatrow} and \package{tabu} package) try hard to keep +% counter changes locally under certain circumstances, it seems a good idea to make +% these flags a counter value, too. +% \begin{macrocode} +\newcounter{caption@flags} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@ifflag[1]{% + \@tempcnta\c@caption@flags + \divide\@tempcnta #1\relax + \ifodd\@tempcnta + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@clrflags} +% \changes{v3.3}{2018/08/08}{This macro added} +% \begin{macro}{\caption@clrflag} +% \changes{v3.3}{2013/04/14}{This macro added} +% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch} +% \begin{macro}{\caption@setflag} +% \changes{v3.3}{2013/04/14}{This macro added} +% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch} +% Furthermore we introduce the macros \cs{caption@clrflag} and \cs{caption@setflag} +% for clearing resp.~setting these flags. +% \begin{macrocode} +\newcommand*\caption@clrflags{% + \setcounter{caption@flags}\z@} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@clrflag[1]{% + \caption@ifflag{#1}{\caption@addtoflags{-#1}}{}} +\newcommand*\caption@setflag[1]{% + \caption@ifflag{#1}{}{\caption@addtoflags{#1}}} +\newcommand*\caption@addtoflags{% + \addtocounter{caption@flags}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \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}% + \caption@gobble}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@star} +% \changes{v3.1}{2007/06/24}{Renamed from \cs{caption@caption} to \cs{caption@star}} +% \changes{v3.2c}{2011/08/21}{\cs{global} removed} +% A helper macro which processes the optional |*| after |\caption|. +% \begin{macrocode} +\newcommand*\caption@star[2]{% + \@ifstar{\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} +% \changes{v3.2d}{2011/10/21}{Adapted to the \textsf{memoir} document class} +% \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved to \cs{caption@prepareanchor}} +% \changes{v3.3}{2013/01/06}{Adapted to the \textsf{nag} package} +% As above, our version has been adapted to the packages we support. +% Additionally our code is nested by |\caption@begin|\-|ex| \& +% |\caption@end| instead of |\begin|\-|group| \& |\end|\-|group|. +% Furthermore we use |\caption@par|\-|box|\-|restore| instead of +% |\@parbox|\-|restore|. +% \begin{macrocode} +\long\def\caption@@caption#1[#2]#3{% +% \end{macrocode} +% \begin{macrocode} + \ifcaption@star \else + \caption@prepareanchor{#1}{#2}% + \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}% + \@nameuse{nag@hascaptiontrue}% + \fi +% \end{macrocode} +% \begin{macrocode} + \par + \caption@beginex{#1}{#2}{#3}% + \caption@setfloatcapt{% + \caption@parboxrestore + \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} +% \class{memoir} document class stuff: +% \begin{macrocode} +\providecommand\memcaptioninfo[4]{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@prepareanchor} +% \changes{v3.1g}{2008/03/16}{This macro added} +% \changes{v3.2f}{2012/01/14}{Usage of \cs{M@gettitle} moved from \cs{caption@@caption}} +% \begin{macrocode} +\newcommand*\caption@prepareanchor[2]{% + \caption@makecurrent{#1}{#2}% + \caption@ifhypcap\caption@@start\relax + \M@gettitle{#2}} +% \end{macrocode} +% \class{memoir} document class stuff: +% \begin{macrocode} +\providecommand\M@gettitle[1]{} +% \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@make@above + \caption@@make{#1}{#2}% + \caption@make@below} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@make@above} +% \begin{macro}{\caption@make@below} +% \changes{v3.3a}{2019/04/02}{This macro added} +% |\caption@make@above|\\ +% |\caption@make@below|\par +% Typesets the stuff above resp.~below the caption, depending on |\caption@iftop|. +% \begin{macrocode} +\newcommand*\caption@make@above{% + \caption@iftop + \caption@belowskip + {\caption@rule\caption@aboveskip}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@make@below{% + \caption@iftop + {\caption@aboveskip\caption@rule}% + \caption@belowskip} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@redefine} +% \changes{v3.1k}{2009/03/30}{This macro added, it contains the patching code now} +% \begin{macrocode} +\newcommand*\caption@redefine{} +% \end{macrocode} +% \end{macro} +% +% Prior to \version{3.4} we only redefined |\caption| and |\@caption| if the current definitions +% were well known, so documents written in the old (\package{caption} package \version{1.x}) days +% (where |\caption| \& |\@caption| were not redefined by us) still compiled fine. +% This used to make sense when introducing \version{3.0} in the year 2003 +% but is simply overcautious and especially unwanted by the user nowadays. +% So starting with \version{3.4} we only do not redefine |\caption| and |\@caption| if the +% `compatibility' option is set to `v1'. +% +% \begin{macrocode} +\g@addto@macro\caption@redefine{% +% \end{macrocode} +% \begin{macrocode} + \caption@ifcompatibility{% +% \end{macrocode} +% \begin{macrocode} + \caption@InfoNoLine{ + \noexpand\caption will not be redefined since `compatibility' is set to v1}% +% \end{macrocode} +% \begin{macrocode} + \renewcommand*\caption@redefine{}% +% \end{macrocode} +% +% |\continuedfloat| is not supported in compatibility mode `v1'. +% \begin{macrocode} + \renewcommand*\caption@continuedfloat[1]{% + \caption@Error{Not available with option `compatibility=v1'}}% +% \end{macrocode} +% +% |\caption@start| is not supported in compatibility mode `v1'. +% \begin{macrocode} + \caption@AtBeginDocument*{% + \let\caption@start\relax + \caption@ifdefined\caption@ORI@capstart{% + \caption@Debug{% + Restore hypcap definition of \string\capstart\@gobble}% + \let\capstart\caption@ORI@capstart}{}% + }% +% \end{macrocode} +% +% \begin{macro}{\caption@star} +% We redefine |\caption@star| here so it does not make any harm. +% \begin{macrocode} + \renewcommand*\caption@star[2]{#1#2}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + }{% +% \end{macrocode} +% +% \begin{macro}{\caption} +% \begin{macro}{\@caption} +% \begin{macrocode} + \renewcommand*\caption@redefine{% + \let\caption\caption@caption + \let\@caption\caption@@caption}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} + }% +% \end{macrocode} +% \begin{macrocode} + \caption@redefine + \caption@AtBeginDocument*{% + \let\caption@ORI@capstart\@undefined}% +% \end{macrocode} +% +% \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} +% \changes{v3.5}{2020/08/30}{Hook added} +% We redefine |\@x|\-|float| so inside floating environments our +% type-specific options will be used, a \package{hyperref} +% anchor will be set etc. +% \begin{macrocode} + \let\caption@ORI@xfloat\@xfloat +% \end{macrocode} +% \begin{macrocode} + \def\@xfloat#1[#2]{% + \caption@ORI@xfloat{#1}[#2]% + \caption@settype{#1}% + \caption@xfloat@hook}% +% \end{macrocode} +% Hook, could be extended with |\g@addto@macro\caption@x|\-|float@hook{|\ldots|}|. +% (The caption type could be found in |\@cap|\-|type|.) +% \begin{macrocode} + \newcommand*\caption@xfloat@hook{}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xdblfloat} +% \changes{v3.5}{2020/08/30}{Re-definition of \cs{xdblfloat} added} +% We redefine |\@xdbl|\-|float|, too, so special options for |figure*| +% resp.~|table*| will be applied here. +% \begin{macrocode} + \let\caption@ORI@xdblfloat\@xdblfloat +% \end{macrocode} +% \begin{macrocode} + \def\@xdblfloat#1[#2]{% + \caption@ORI@xdblfloat{#1}[#2]% expands to \@xfloat{#1}[#2] + extra stuff + \caption@setoptions{#1*}% + \caption@xdblfloat@hook}% +% \end{macrocode} +% Hook, could be extended with |\g@addto@macro\caption@xdbl|\-|float@hook{|\ldots|}|. +% (The caption type could be found in |\@cap|\-|type|.) +% \begin{macrocode} + \newcommand*\caption@xdblfloat@hook{}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +} +% \end{macrocode} +% +% 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} +\caption@AtBeginDocument{\caption@redefine} +% \end{macrocode} +% +% \begin{macro}{\@makecaption} +% \begin{macrocode} +\let\@makecaption\caption@makecaption +% \end{macrocode} +% \end{macro} +% +% \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} +\newcommand\phantomcaption{% + \caption@iftype + {\caption@refstepcounter\@captype}% + {\caption@Error{\noexpand\phantomcaption outside float}}}% +% \end{macrocode} +% \end{macro} +% +% \section{\cs{setcaptiontype} and \cs{setcaptionsubtype}} +% +% \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} +% +% \begin{macrocode} +\caption@AtBeginDocument{% +% \end{macrocode} +% \begin{macrocode} + \DeclareCaptionOption{type}{\setcaptiontype{#1}}% + \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}% +% \end{macrocode} +% \begin{macrocode} + \DeclareCaptionOptionNoValue{subtype}{\setcaptionsubtype\relax}% + \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}% +% \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}{\setcaptiontype} +% \changes{v3.2}{2010/10/24}{This macro added} +% \changes{v3.4e}{2020/01/02}{Check added if the subtype is defined} +% \changes{v3.5}{2020/08/24}{Definition method adapted to the \package{caption-light} package} +% Like |\captionsetup{type=xxx}|, but also works if |\caption|\-|setup| was redefined. +% \begin{macrocode} +\def\setcaptiontype{% + \caption@parboxrestore@mini + \caption@settype} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setcaptionsubtype} +% \changes{v3.2a}{2011/08/15}{This macro added} +% \changes{v3.5d}{2020/09/28}{This macro revised} +% Same, but sets the sub-type. +% \begin{macrocode} +\newcommand\setcaptionsubtype{% + \caption@iftype + \caption@setsubtype + {\caption@Error{\noexpand\setcaptionsubtype outside float}}}% +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@setsubtype{% + \caption@teststar\caption@@setsubtype\@firstoftwo\@secondoftwo} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setsubtype[1]{% + \caption@@@settype{sub}{#1}{sub\@captype}} +% \end{macrocode} +% \end{macro} +% +% \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}} +% \changes{v3.3}{2011/12/28}{Resetting of \cs{ifcaption@caption} and \cs{ifcaption@subcaption} added} +% \changes{v3.4e}{2020/01/02}{Checks added to prevent misuse regading subtypes} +% \changes{v3.5d}{2020/09/28}{This macro revised} +% |\caption@settype*|\marg{type}\par +% sets |\@captype| and executes the options associated with it +% (using |\caption@set|\-|options|). +% Furthermore we check |\current|\-|group|\-|level| (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|)|type|\-|hook| (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@clrflags + \caption@set@type} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@set@type{% + \caption@teststar\caption@@settype\@firstoftwo\@secondoftwo} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@settype{% + \caption@@@settype{}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@@settype[3]{% +% #1 = "" or "sub" +% #2 = \@firstoftwo in star form, \@secondoftwo otherwise +% #3 = , e.g.: "figure" or "subfigure" + \caption@Debug{#1type=#3}% + \@nameuse{caption@check#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 #1type was already set to + `\csname @#1captype\endcsname'\MessageBreak}}% + \fi +% \end{macrocode} +% \begin{macrocode} + #2{}{% + \let\@currentlabel\caption@undefinedlabel +% \let\@currentHlabel\@undefined + \ifx\caption@x@label\@undefined + \let\caption@x@label\label + \let\label\caption@xlabel + \fi + \caption@start}}} +% \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{\caption@ifdefined\@captype} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@checktype} +% \changes{v3.4g}{2020/01/02}{This macro and its usage added} +% \changes{v3.4m}{2020/07/29}{Check of \cs{sf@counterlist} from \package{subfig} package added} +% |\caption@checktype|\marg{type}\marg{code}\par +% is used by |\caption@settype| and should either expand the code or issue an error +% if the given type is not a proper type, i.e. it is a sub-type instead (either defined by +% |\DeclareCaptionSubType| or |\newsubfloat|\cite{subfig}). +% \begin{macrocode} +\newcommand*\caption@checktype[1]{% + \caption@ifsubtype{#1}\@firstoftwo{\caption@ifin@list\sf@counterlist{#1}}% + {\caption@Error{Should not be used with subtype `#1'}% + \@gobble}% + \@firstofone} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@checksubtype} +% \changes{v3.4g}{2020/01/02}{This macro and its usage added} +% \changes{v3.4m}{2020/07/29}{Check of \cs{sf@counterlist} from \package{subfig} package added} +% |\caption@checksubtype|\marg{type}\marg{code}\par +% is used by |\caption@settype| and should either expand the code or issue an error +% if the given type is not a proper sub-type, i.e. not defined by |\Declare|\-|Caption|\-|Sub|\-|Type|. +% Since the |sub|\-|float|\-|row| environment offered by the \package{floatrow} package\cite{floatrow} +% is using |\caption|\-|setup{sub|\-|type}| even if the sub-type was defined by |\new|\-|sub|\-|float| +% offered by \package{subfig}\cite{subfig}, we take a more relaxed view of things here and allow +% those sub-types as well (but not without warning since we do not support this). +% \begin{macrocode} +\newcommand*\caption@checksubtype[1]{% + \caption@ifsubtype{#1}% + \@firstofone + {\caption@ifin@list\sf@counterlist{#1}% + {\caption@Warning{% + \noexpand\setcaptionsubtype without \string\DeclareCaptionSubType.\MessageBreak + This is not designed to work; you could try replacing\MessageBreak + the `subfig' package with `subcaption' to resolve\MessageBreak + this problem which occurred}% + \@firstofone}% + {\caption@Error{Undefined subtype `#1'}% + \@gobble}}} +% \end{macrocode} +% \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)} +% \changes{v3.3}{2013/04/21}{Uses \cs{caption@ifeTeX} now} +% \changes{v3.5}{2019/09/11}{Relies on \eTeX{} now} +% Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done +% inside a group or not -- in the latter case a warning message will +% be issued. +% \begin{macrocode} +\newcommand*\caption@checkgrouplevel[2]{% + \@ifundefined{#1caption@grouplevel}{% + \caption@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 + }{}}% +% \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} +% \changes{v3.2c}{2011/09/13}{Text changed from `before' to `without proper'} +% \changes{v3.3}{2016/02/21}{Text changed from `without proper \cs{caption}' to `without proper reference'} +% 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 without proper reference#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} +% \changes{v3.2c}{2011/08/19}{Works with optional arguments now, too} +% 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{% + \caption@withoptargs\caption@@xlabel} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@xlabel[2]{% + \caption@@@xlabel + \def\caption@labelname{#2}% + \caption@x@label#1{#2}} +% \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} +% \changes{v3.2}{2010/10/24}{Bugfix 10-10-17: Uses \cs{setcaptiontype} instead of \cs{caption@settype} now} +% \changes{v3.5}{2020/08/24}{Definition method adapted to the \package{caption-light} package} +% |\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} +\providecommand*\caption@of[2]{\setcaptiontype*{#2}#1} +% \end{macrocode} +% \end{macro} +% +% \section{\cs{captionlistentry}} +% +% \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} +% +% \section{\cs{captionbox}} +% +% \begin{macro}{\captionbox} +% \changes{v3.2}{2010/12/17}{This macro added} +% \changes{v3.2a}{2011/08/16}{\cs{captionsetup} replaces with \cs{captionbox@settype} and \cs{caption@setposition}} +% \changes{v3.3}{2012/04/09}{Adapted to revised version of \cs{caption@withoptargs}} +% \changes{v3.3}{2017/03/19}{When used with fixed witdh the content will not be hboxed anymore} +% \changes{v3.3c}{2019/09/01}{Adapted so it could be used by \cs{subfloat} offered by \package{subcaption}} +% \changes{v3.5}{2020/07/28}{Adapted to \package{caption3} v2.0} +% A |\parbox| with contents and caption, separated by an invisible |\hrule|. +% \begin{macrocode} +\newcommand*\captionbox{% + \caption@withoptargs{\caption@ibox\@gobble}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@ibox[3]{% + \kernel@ifnextchar[%] + {\caption@iibox{#1}{#2}{#3}}% + {\caption@iibox@{#1}{#2}{#3}}} +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@iibox#1#2#3[#4]{% + \@testopt{\caption@iiibox{#1}{#2}{#3}[{#4}]}\captionbox@innerpos@default} +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@iibox@#1#2#3#4{% + \setbox\@tempboxa\hbox{#4}% + \caption@iiibox{#1}{#2}{#3}[\wd\@tempboxa][\captionbox@innerpos@default]{\unhbox\@tempboxa}} +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@iiibox#1{% + \caption@iiiibox{#1}\vbox\vtop} +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@iiiibox#1#2#3#4#5[#6][#7]#8{% + \begingroup + #1*% set \caption@position + \caption@iftop{% + \endgroup + \parbox[t]{#6}{% + #1\relax + \caption@setposition t% + #2{\caption#4{#5}}% + \captionbox@hrule + \csname caption@justification@#7\endcsname + #8}% + }{% + \endgroup + \parbox[b]{#6}{% + #1\relax + \caption@setposition b% + \csname caption@justification@#7\endcsname + #8% + \captionbox@hrule + #3{\caption#4{#5}}}% + }} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\captionbox@innerpos@default{c} +\newcommand*\captionbox@hrule{\hrule\@height\z@\relax} +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@justification@c{\centering} +\providecommand*\caption@justification@l{\raggedright} +\providecommand*\caption@justification@r{\raggedleft} +\providecommand*\caption@justification@s{} +% \end{macrocode} +% \end{macro} +% +% \section{\cs{continuedfloat}} +% +% \begin{macro}{\continuedfloat} +% \changes{v3.0i}{2005/11/12}{Optional argument 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 added} +% \changes{v3.2f}{2011/12/17}{Undocumented optional argument removed} +% \changes{v3.3}{2011/12/28}{Uses \cs{ifcaption@ContinuedFloat} now} +% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@restorecounters} added} +% \changes{v3.3}{2013/12/16}{Bugfix: Does not use \cs{caption@ContinuedFloat} anymore since this breaks \cs{ContinuedFloat} offered by the \package{subfig} package} +% \changes{v3.4}{2015/09/16}{Renamed from \cs{ContinuedFloat} to \cs{continuedfloat}} +% \changes{v3.5f}{2020/10/06}{Usage of \cs{caption@restorecounters} removed} +% |\continuedfloat|\\ +% |\continuedfloat*|\par +% This mainly sets the appropriate flag, increments the +% continuation counter, and executes the given options. +% Furthermore we set |\caption@reset|\-|continued|\-|float| to |\@gobble| so the +% continuation counter will not be reset to zero inside |\caption@ref|\-|step|\-|counter|.\par +% When the \package{hyperref} package is used we have the problem +% that the usage of |\continued|\-|float| will create duplicate +% hyper links -- |\@current|\-|Href| 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 |\the|\-|H|\-|figure| and +% |\the|\-|H|\-|table|, 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{% + \caption@iftype + {\caption@continuedfloat\@captype}% + {\caption@Error{\noexpand\continuedfloat outside float}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@continuedfloat[1]{% + \@ifstar + {\caption@@refstepcounter\@captype + \caption@@continuedfloat{#1}}% + {\caption@continued@float{#1}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@continued@float[1]{% + \edef\caption@tempa{#1}% + \ifx\caption@tempa\caption@CFtype + \caption@@continuedfloat{#1}% + \else + \caption@Error{Continued `#1' after `\caption@CFtype'}% + \fi} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@continuedfloat{% + \caption@setflag1% continued float + \caption@@@continuedfloat} +\newcommand*\caption@@@continuedfloat{% + \stepcounter{continuedfloat}% + \caption@@@@continuedfloat} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@@@continuedfloat[1]{% + \caption@setoptions{ContinuedFloat}% for compatibility reasons + \caption@setoptions{continuedfloat}% + \caption@setoptions{continued#1}% + \expandafter\l@addto@macro\csname the#1\endcsname\thecontinuedfloat + \@ifundefined{theH#1}{}{% + \expandafter\l@addto@macro\csname theH#1\endcsname{% + \@alph\c@continuedfloat}}% + \let\caption@@@@continuedfloat\@gobble} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@CFtype{??} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\thecontinuedfloat} +% \changes{v3.4}{2015/09/16}{Renamed from \cs{theContinuedFloat} to \cs{thecontinuedfloat}} +% This one is preset to \cs{@empty}, so usually the continuation counter is not +% included in the caption label or references. +% \begin{macrocode} +\newcounter{continuedfloat} +\let\c@ContinuedFloat\c@continuedfloat % defined for compatibility reasons +\def\thecontinuedfloat{\theContinuedFloat} +\let\theContinuedFloat\@empty % defined for compatibility reasons +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@reset@continuedfloat} +% \changes{v3.2f}{2011/12/17}{Redefinition of \cs{continuedfloat} added} +% |\caption@reset@continuedfloat|\marg{type}\par +% If a continuation counter is defined, we reset it. +% (This one will be called inside |\@caption|.) +% \begin{macrocode} +\newcommand*\caption@reset@continuedfloat[1]{% + \xdef\caption@CFtype{#1}% + \@stpelt{continuedfloat}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ContinuedFloat} +% For compatibility reasons we still support |\Continued|\-|Float|. +% \begin{macrocode} +\def\ContinuedFloat{\continuedfloat} % defined for compatibility reasons +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ContinuedFloat} +% \changes{v3.0f}{2005/06/11}{This macro added} +% \changes{v3.3}{2013/12/16}{Bugfix: Revised and defined with \cs{def} instead of \cs{newcommand}} +% |\caption@ContinuedFloat|\marg{type}\par +% This one is used by \cs{ContinuedFloat} offered by the \package{subfig} package. +% \begin{macrocode} +\def\caption@ContinuedFloat{% + \let\caption@reset@continuedfloat\@gobble + \caption@@@continuedfloat} +% \end{macrocode} +% \end{macro} +% +% \section{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} +% \changes{v3.2c}{2011/09/04}{Support of \cs{donemaincaptiontrue} from \textsf{memoir} document class added} +% \changes{v3.3}{2011/12/28}{Usage of \cs{ifcaption@caption}, \cs{ifcaption@subcaption}, and \cs{ifcaption@ContinuedFloat} added} +% \changes{v3.5e}{2020/09/28}{Bugfix in re-definition of \cs{stepcounter}; uses \cs{edef} instead of \cs{def} now} +% Increments the float (i.e. |figure| or |table|) counter, +% resets the continuation counter, and redefines itself to |\@gobble|. +% \begin{macrocode} +\newcommand*\caption@refstepcounter[1]{% + \@ifundefined{c@#1}% + {\caption@Error{No float type '#1' defined}}% + {\caption@ref@stepcounter{#1}% +% \end{macrocode} +% Set flag if this part of the figure (or table) contains a caption now. +% (If |\caption@if|\-|top| is not set, |\caption| is at the bottom of this part, +% therefore ending this part, so we set the flag to |false| in this case.) +% \begin{macrocode} + \caption@fixposition % TODO: Make this independant on the "position" setting + \caption@iftop\caption@setflag\caption@clrflag2% caption +% \end{macrocode} +% This part does not contain content (like sub-figures) yet, +% so we set |\if|\-|caption@sub|\-|caption| to |false|. +% \begin{macrocode} + \caption@clrflag4% subcaption +% \end{macrocode} +% Support of the \textsf{memoir} document class. +% \begin{macrocode} + \@nameuse{donemaincaptiontrue}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@ref@stepcounter{% + \caption@ifflag1{% continued float + \let\caption@tempa\caption@@refcounter + \caption@clrflag1% continued float + }{% + \let\caption@tempa\caption@@refstepcounter + \caption@ifflag2{}{% caption + \caption@ifflag4{% subcaption + % Counter was already incremented by content, so we suppress \stepcounter{#1} here + \let\caption@tempa\caption@@refcounter + }{}% + }% + }% + \caption@tempa} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@refcounter[1]{% + \let\caption@stepcounter@ORI\stepcounter + \def\stepcounter##1{% + \edef\caption@tempa{#1}% + \edef\caption@tempb{##1}% + \ifx\caption@tempa\caption@tempb \else + \caption@stepcounter@ORI{##1}% + \fi}% + \caption@@@refstepcounter{#1}% + \let\stepcounter\caption@stepcounter@ORI} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@refstepcounter[1]{% + \caption@prepare@stepcounter{#1}{ref}% + \caption@@@refstepcounter{#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@stepcounter[1]{% + \caption@prepare@stepcounter{#1}{}% + \caption@@@stepcounter{#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@prepare@stepcounter[2]{% + \caption@addsubcontentslines{#2stepcounter}% + \caption@reset@continuedfloat{#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@@refstepcounter{\refstepcounter} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@@stepcounter{\stepcounter} +% \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} +% \changes{v3.3}{2012/03/25}{Support of option \opt{list-entry} added} +% A |\relax| was added compared to |\@dblarg| so |\caption{}| will be +% expanded to |\caption[\relax]{}| (and not to |\caption[]{}|). +% Furthermore support for option \opt{list-entry} was added. +% \begin{macrocode} +\@ifundefined{kernel@ifnextchar}{\let\kernel@ifnextchar\@ifnextchar}{} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@dblarg[1]{% + \kernel@ifnextchar[{\caption@ydblarg{#1}}{\caption@xdblarg{#1}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@xdblarg[2]{% + #1[{#2\relax}]{#2}} +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@ydblarg#1[#2]#3{% + \caption@iflistheading{#1[{#3}]{#3}}{#1[{#2}]{#3}}} +% \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} +% \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} 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.] Override the |position=| setting, if necessary. +% (for example if set to |auto| or used inside a |supertabular|) +% \item[2.] Start a new group. +% \item[3.] Define |\fnum@|\meta{type} if the caption label format is set +% to non-default. +% \end{enumerate} +% \begin{macrocode} +\newcommand*\caption@begin[1]{% + \caption@fixposition + \begingroup + \caption@setfnum{#1}} +% \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}} +% \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} +\newcommand\caption@beginex[3]{% + \caption@begin{#1}% + \let\lst@@caption\relax + \caption@addcontentsline{#1}{#2}% + \caption@ifempty{#3}{}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@end} +% \changes{v3.3}{2011/12/29}{Usage of \cs{caption@fixedposition} removed} +% |\caption@end| closes the group. +% \begin{macrocode} +\newcommand*\caption@end{% + \endgroup} +% \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} +% \changes{v3.5}{2020/08/03}{Adapted to \package{caption3} v2.0} +% |\caption@setfnum|\marg{type}\\ +% stores the original definition of |\fnum@|\meta{type} in |\caption@fnum@|\meta{type} +% and re-defines it according the caption label format set with |label|\-|format=|. +% \begin{macrocode} +\newcommand*\caption@setfnum[1]{% + \@ifundefined{caption@fnum@#1}% + {\expandafter\let\csname caption@fnum@#1\expandafter\endcsname\csname fnum@#1\endcsname + \@namedef{fnum@#1}{\caption@fnum{#1}}}% + {}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@normalsize} +% \changes{v3.1}{2007/05/05}{This macro and its usage added} +% \changes{v3.5}{2020/07/27}{Adapted to \package{caption3} v2.0} +% This one will be used by |\@caption| instead of |\normalsize|. +% \begin{macrocode} +\newcommand*\caption@normalsize{% + \caption@font@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} +% This one is needed for support of the \package{nameref} and \package{hyperref} package. +% \changes{v3.2f}{2012/01/14}{Bugfix: Usage of \cs{caption@gettitle} added} +% \begin{macrocode} +\newcommand*\caption@makecurrent[1]{\caption@gettitle} +% \end{macrocode} +% \end{macro} +% +% \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} +\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} +% +% \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]{% + \caption@ifdefined\NR@gettitle + {\NR@gettitle{#1}}% + {\def\@currentlabelname{#1}}} +% \end{macrocode} +% \end{macro} +% +% \section{Support for sub-captions} +% \changes{v3.1f}{2007/11/16}{Support for sub-captions added} +% +% \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} +% \changes{v3.2a}{2011/08/17}{Redefinition of \cs{phantomcaption} added} +% \changes{v3.2a}{2011/08/17}{Usage of \cs{caption@warmup} added} +% \changes{v3.2c}{2011/09/30}{Bugfix 11-09-26: Usage of \cs{if@subfloatrow} added} +% \changes{v3.3}{2011/12/28}{Bugfix 11-12-16: \cs{caption@l@stepcounter} replaced by \cs{stepcounter}} +% \changes{v3.3}{2012/03/15}{Usage of \cs{caption@setbox} added} +% \changes{v3.3}{2013/05/01}{Redefinition of \cs{caption@settype} added} +% \changes{v3.3}{2013/06/17}{Missing redefinition of \cs{captionlistentry} added} +% \changes{v3.3}{2018/09/06}{Adapted to the \package{chkfloat} package} +% \changes{v3.4f}{2020/01/03}{Redefinition of \cs{@caption} added since it was redefined by the \env{threeparttable} environment} +% \changes{v3.5}{2020/07/27}{Adapted to \package{caption3} v2.0} +% Hook, will be used inside \cs{caption@setsubtype}.\par +% (Note: If we are inside an |sub|\-|float|\-|row| environment we have to keep +% the |\@make|\-|caption| code of the \package{floatrow} package intact.) +% \begin{macrocode} +\newcommand*\caption@subtypehook{% + \ifx\caption\caption@subcaption \else + \caption@warmup +% \end{macrocode} +% \begin{macrocode} + \caption@ifflag2{}{% caption +% no \caption in this part of the (floating) environment yet + \let\caption@add@contentsline\caption@addsubcontentsline + \let\caption@addsubcontentslines\@gobble + \caption@ifflag4{}{% subcaption +% no \subcaption in this part of the (floating) environment yet + \caption@ifflag1{% continued float + \caption@clrflag1% + }{% + \caption@@stepcounter\@captype + }% + \caption@setflag4% subcaption + }% + }% +% \end{macrocode} +% \begin{macrocode} + \c@continuedfloat=0\relax + \let\caption@setfloatcapt\@firstofone + \let\caption@chkfloat\@gobbletwo +% \end{macrocode} +% \begin{macrocode} + \caption@set{box}{none}% + \caption@clearmargin + \caption@iflist{}{\let\caption@setlist\@gobble}% + \caption@setoptions{sub}% + \caption@setoptions{subfloat}% for subfig-package compatibility +% \end{macrocode} +% \begin{macrocode} +% redefine \setcaptiontype + \def\caption@settype{\caption@withoptargs\caption@sub@settype}% + \def\caption@sub@settype##1##2{% + \edef\caption@tempa{##2}% + \ifx\caption@tempa\@captype +%%% \caption@setsubtype##1\relax + \else + \caption@Error{##2 inside \@subcaptype}% + \fi}% +% \end{macrocode} +% \begin{macrocode} +% redefine \caption + \let\caption\caption@subcaption + \let\@caption\caption@@caption + \let\phantomcaption\caption@subphantom + \let\captionlistentry\caption@sublistentry +% \let\@captype\@subcaptype + \let\caption@refstepcounter\caption@@@refstepcounter +% \end{macrocode} +% \begin{macrocode} +% restore \@makecaption + \if@subfloatrow + \caption@Debug{Keeping \string\@makecaption}% + \else + \let\@makecaption\caption@makecaption + \fi + \fi}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\if@subfloatrow} +% \changes{v3.2c}{2011/09/30}{This macro added} +% This macro tests if we are inside an |sub|\-|float|\-|row| or |sub|\-|float|\-|row*| environment. +% \begin{macrocode} +\caption@AtBeginDocument{% + \caption@ifundefined\@subfloatrowtrue + {\newif\if@subfloatrow + \caption@ifundefined\subfloatrow + {}% + {\caption@Debug{Patching subfloatrow environment}% + \g@addto@macro\capsubrowsettings{\@subfloatrowtrue}% + \g@addto@macro\killfloatstyle{% + \ifx\c@FRobj\c@FRsobj\@subfloatrowtrue\fi}}}% + {\caption@Debug{\string\if@subfloatrow is already defined}}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@subcaption} +% Makes a sub-caption. +% \begin{macrocode} +\newcommand*\caption@subcaption{% + \caption@checkgrouplevel{sub}\subcaption + \caption@star + {\caption@refstepcounter\@subcaptype}% + {\caption@dblarg{\@caption\@subcaptype}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@subphantom} +% \changes{v3.2a}{2011/08/17}{This macro added} +% Same as |\phantomcaption|, but for sub-captions. +% \begin{macrocode} +\newcommand*\caption@subphantom{% + \caption@checkgrouplevel{sub}\phantomsubcaption + \caption@refstepcounter\@subcaptype} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@sublistentry} +% \changes{v3.3}{2013/06/17}{This macro added} +% Same as |\captionlistentry|, but for sub-captions. +% \begin{macrocode} +\newcommand*\caption@sublistentry{% + \caption@teststar\@subcaptionlistentry\@firstoftwo\@secondoftwo} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\@subcaptionlistentry[1]{% + \@testopt{\caption@listentry{#1}}\@subcaptype} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{caption@clearsubcontentslines} +% Clear pending sub-caption list entries. +% \begin{macrocode} +\newcommand*\caption@clearsubcontentslines{% + \global\let\caption@subcontentslines\@empty} +% \end{macrocode} +% \begin{macrocode} +\caption@clearsubcontentslines +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@addsubcontentsline} +% \changes{v3.1i}{2008/08/02}{\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} +% \changes{v3.2c}{2011/08/19}{Uses \cs{caption@gobble} instead of \cs{@gobble} now} +% \changes{v3.3}{2012/01/15}{Debug message added} +% \changes{v3.3}{2013/03/10}{A single \cs{protect} replaced by \cs{noexpand}} +% Add a pending sub-caption list entry. +% \begin{macrocode} +\newcommand*\caption@addsubcontentsline[4]{% + \caption@Debug{\string\caption@addsubcontentsline{#1}{#2}}% + \begingroup + \let\label\caption@gobble + \let\index\caption@gobble + \let\glossary\caption@gobble + \protected@edef\@tempa{\endgroup + \noexpand\g@addto@macro\noexpand\caption@subcontentslines{% + \noexpand\@namedef{the#2}{\csname the#2\endcsname}% + \ifx\@currentHref\@undefined \else + \noexpand\def\noexpand\@currentHref{\@currentHref}% + \fi + \noexpand\caption@@@addcontentsline{#1}{#2}{#3}{#4}}}% + \@tempa} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\flushsubcaptionlistentries} +% \changes{v3.3}{2012/01/15}{Renamed from \cs{caption@addsubcontentslines} to \cs{flushsubcaptionlistentries}} +% \changes{v3.3}{2013/03/10}{Bugfix: Missing redefinition of \cs{caption@addsubcontentslines} added} +% Writes pending sub-caption list entries. +% \begin{macrocode} +\newcommand*\flushsubcaptionlistentries{% + \caption@addsubcontentslines{user}} +% \end{macrocode} +% \begin{macrocode} +\renewcommand*\caption@addsubcontentslines[1]{% + \caption@Debug{\string\flushsubcaptionlistentries (#1)}% + \begingroup + \caption@subcontentslines + \endgroup + \caption@clearsubcontentslines} +% \end{macrocode} +% We need to patch \cs{chapter} otherwise a vertical gap will be inserted into +% the list prior pending sub-caption list entries. +% We do this |\At|\-|Begin|\-|Document| so packages like \package{newfloat} +% will not complain about an unknown document class. +% \begin{macrocode} +\AtBeginDocument{% +% \end{macrocode} +% \begin{macrocode} + \caption@ifdefined\chapter{% + \let\caption@chapter@ORI\chapter + \def\chapter{% + \caption@addsubcontentslines{chapter}\caption@chapter@ORI}}{}% +% \end{macrocode} +% Same for \cs{appendix}. +% \begin{macrocode} + \caption@ifdefined\appendix{% + \let\caption@appendix@ORI\appendix + \def\appendix{% + \caption@addsubcontentslines{appendix}\caption@appendix@ORI}}{}% +% \end{macrocode} +% Flush the list of pending sub-caption list entries at the end of the document. +% \begin{macrocode} + \caption@addsubcontentslines{AtEndDocument}% +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% \end{macro} +% +% \section{Babel package support} +% +% \subsection{The arabic \& farsi babel option} +% \changes{v3.5}{2020/08/02}{\package{arabic} babel support addded} +% +% \begin{macrocode} +\caption@IfBabelArabi{% +% \end{macrocode} +% +% The \package{arabicore} package re-defines |\@make|\-|caption|, |\fnum@figure|, and |\fnum@table| +% incompatible to the \package{caption} package, therefore we have to restore our resp.~the original definitions here. +% +% \begin{macrocode} + \let\@makecaption\caption@makecaption + \def\fnum@figure{\figurename\nobreakspace\thefigure}% + \def\fnum@table{\tablename\nobreakspace\thetable}% +% \end{macrocode} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The frenchle \& frenchpro package} +% \changes{v3.0h}{2005/10/03}{\package{frenchle/pro} package support added} +% \changes{v3.5}{2020/08/01}{\package{frenchle/pro} package support updated} +% +% \begin{macrocode} +\caption@IfFrenchLe{% +% \end{macrocode} +% +% \begin{macro}{\f@ffrench} +% \begin{macro}{\f@tfrench} +% |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table| +% when used in French mode. These contain additional code which typesets +% the caption separator |\caption|\-|separator| instead of the usual colon. +% Because this breaks with our |\@make|\-|caption| code we have to remove +% this additional code here. +% \begin{macrocode} + \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}% + \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}% + \let\@eatDP\@undefined +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Since the \package{frenchle} package overwrites |\@make|\-|caption| (within |\GO|\-|french|), +% we need to save it beforehand and restore it afterwards. +% \begin{macrocode} + \caption@AtBeginDocument{% + \let\caption@original@makecaption\@makecaption}% + \g@addto@macro\GOfrench{% + \let\@makecaption\caption@original@makecaption}% +% \end{macrocode} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The hungarian \& magyar babel option} +% \changes{v3.2}{2009/03/29}{\package{magyar} babel support added} +% \changes{v3.3}{2018/08/26}{\package{magyar} babel support revised} +% \changes{v3.5}{2020/08/02}{\package{magyar} babel support updated} +% +% \begin{macrocode} +\caption@IfBabelHungarian{% +% \end{macrocode} +% +% Since the \package{magyar} package tends to overwrite |\@make|\-|caption| +% we save it beforehand and restore it afterwards. +% \Note{Currently it will not be overwritten, caused by a side-effect of a +% work-around for the \package{floatrow} package within \package{caption3}.} +% +% \begin{macrocode} + \caption@AtBeginDocument{% + \let\caption@original@makecaption\@makecaption}% + \caption@ifdefined\extrashungarian{% + \addto\extrashungarian{% + \let\@makecaption\caption@original@makecaption}}{}% + \caption@ifdefined\extrasmagyar{% + \addto\extrasmagyar{% + \let\@makecaption\caption@original@makecaption}}{}% +% \end{macrocode} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The latvian babel option} +% \changes{v3.5}{2020/08/02}{\package{latvian} babel support updated} +% +% \begin{macrocode} +\caption@IfBabelLatvian{% +% \end{macrocode} +% +% The \package{latvian} package re-defines |\@make|\-|caption| incompatible to the \package{caption} package, +% therefore we have to restore our definitions here. +% +% \begin{macrocode} + \let\@makecaption\caption@makecaption +% \end{macrocode} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \section{Package support} +% \changes{v3.1}{2007/04/11}{Package options `float', `longtable' etc.~are not supported anymore, removed} +% +% \begin{macro}{\caption@IfPackageLoaded} +% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added, so no extra check is needed} +% \changes{v3.1}{2007/07/04}{Re-written \& renamed from \cs{caption@ifpackage} to \cs{caption@IfPackageLoaded}} +% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added} +% |\caption@IfPackageLoaded|\marg{package}\oarg{version}\marg{true}\marg{false}\par +% Some kind of combination of |\@ifpackageloaded| and |\@ifpackagelater|. +% If the \meta{package} is not loaded yet, the check will be (re-)done +% |\AtBeginDocument|, so the \meta{package} could be loaded later on, too. +% \begin{macrocode} +\newcommand\caption@IfPackageLoaded[1]{% + \@testopt{\caption@@IfPackageLoaded{#1}}{}} +\@onlypreamble\caption@IfPackageLoaded +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@@IfPackageLoaded#1[#2]#3#4{% + \@ifpackageloaded{#1}\@firstofone{% + \caption@Debug{#1 package is not loaded (yet)\@gobble}% + \caption@AtBeginDocument}{% + \caption@If@Package@Loaded{#1}[{#2}]{#3}{#4}}} +\@onlypreamble\caption@@IfPackageLoaded +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@If@Package@Loaded#1[#2]{% + \@ifpackageloaded{#1}{% + \caption@InfoNoLine{#1 package is loaded}% + \@ifpackagelater{#1}{#2}\@firstoftwo{% + \caption@Error{% + For a successful cooperation we need at least version\MessageBreak + `#2' of package #1,\MessageBreak + but only version\MessageBreak + `\csname ver@#1.\@pkgextension\endcsname'\MessageBreak + is available}% + \@secondoftwo}% + }{\@secondoftwo}} +\@onlypreamble\caption@If@Package@Loaded +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@clearmargin} +% \changes{v3.1}{2007/05/05}{This macro and its usage added} +% This macro will be used by some package support stuff where the usual +% margin setting is not welcome, e.g. in the \package{sidecap} package. +% \begin{macrocode} +\newcommand*\caption@clearmargin{% + \setcaptionmargin\z@ + \let\caption@minmargin\@undefined} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@setbool{needfreeze}{0} +\caption@AtBeginDocument*{% + \caption@ifneedfreeze{% +% \end{macrocode} +% +% \begin{macro}{\caption@freezetype} +% \changes{v3.3}{2013/05/01}{This macro added} +% |\caption@freezetype|\marg{type}\par +% Used by the \package{fltpage} \& \package{sidecap} package support. +% \begin{macrocode} + \newcommand*\caption@freezetype[1]{% + \caption@settype*{#1}% + \captionsetup*[sub]{hypcap=true}% Note: This is just a (q&d) workaround! + \caption@freeze}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@freeze} +% \changes{v3.1}{2007/07/22}{This macro added} +% \changes{v3.1c}{2007/10/06}{\cs{caption} \& \cs{@caption} revised for enhanced compatibility} +% \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} +% \changes{v3.2a}{2011/08/17}{Starred variant of \cs{caption@freeze} removed} +% \changes{v3.2b}{2011/08/18}{Redefines \cs{caption@setup} instead of \cs{captionsetup} now} +% \changes{v3.2b}{2011/08/18}{Redefinition of \cs{label} revised} +% \changes{v3.2c}{2011/08/21}{Revised} +% \changes{v3.3}{2013/01/06}{Adapted to new switch \cs{caption@caption} etc.} +% |\caption@freeze|\par +% Used by the \package{bicaption} package. +% \begin{macrocode} + \newcommand*\caption@freeze{% + \let\caption@frozen@continuedfloat\continuedfloat + \def\continuedfloat{% + \caption@@freeze{\caption@@@@continuedfloat\@captype}% + \caption@frozen@continuedfloat}% +% \end{macrocode} +% \begin{macrocode} + \let\caption@frozen@setup\caption@setup + \def\caption@setup##1{% + \caption@@freeze{\caption@setup{##1}}% + \caption@frozen@setup{##1}}% +% \end{macrocode} +% \begin{macrocode} + \let\caption@frozen@caption\caption + \def\caption{% + \def\caption{% + \caption@Error{% + Only one \noexpand\caption can be placed in this environment}% + \caption@gobble}% + \@ifstar + {\caption@SC@caption*}% + {\let\@currentlabel\caption@SClabel + \caption@withoptargs\caption@SC@caption}}% + \long\def\caption@SC@caption##1##2{% + \caption@@freeze{\caption##1{##2}}% + \ignorespaces}% +% \end{macrocode} +% \begin{macrocode} + \let\caption@frozen@label\label + \def\label{% + \caption@withoptargs\caption@SC@label}% + \def\caption@SC@label##1##2{% + \ifx\@currentlabel\caption@SClabel + \@bsphack + \caption@freeze@label{##1}{##2}% + \@esphack + \else + \caption@frozen@label##1{##2}% + \fi}% + \def\caption@SClabel{\caption@undefinedlabel}% + \def\caption@freeze@label##1##2{% + \caption@@freeze{\label##1{##2}}}% +% \end{macrocode} +% \begin{macrocode} + \global\let\caption@frozen@content\@empty + \long\def\caption@@freeze{% + \g@addto@macro\caption@frozen@content}% +% \end{macrocode} +% \begin{macrocode} + \def\caption@warmup{% + \let\continuedfloat\caption@frozen@continuedfloat + \let\caption@setup\caption@frozen@setup + \let\caption\caption@frozen@caption + \let\label\caption@frozen@label}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@prepare@defrost} +% \changes{v3.3}{2013/01/06}{This macro added} +% Prevent resetting the caption flags +% \begin{macrocode} + \newcommand*\caption@prepare@defrost{% + \let\caption@settype\caption@set@type} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@defrost} +% \changes{v3.1}{2007/07/22}{This macro added} +% \changes{v3.1g}{2008/01/30}{\cs{caption@defrost@setup} added} +% \changes{v3.2c}{2011/08/21}{Adapted to changes of \cs{caption@freeze}} +% \changes{v3.2c}{2011/08/21}{\cs{caption@defrost@setup} removed} +% |\caption@defrost| +% \begin{macrocode} + \newcommand*\caption@defrost{% + \ifx\caption@frozen@caption\@undefined + \caption@frozen@content + \else + \caption@Error{Internal Error:\MessageBreak + \noexpand\caption@defrost in same group as \string\caption@freeze}% + \fi}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + }{}% + \caption@undefbool{needfreeze}} +% \end{macrocode} +% +% \begin{macro}{\caption@warmup} +% \changes{v3.2a}{2011/08/17}{This macro added} +% |\caption@warmup| +% \begin{macrocode} +\let\caption@warmup\relax +% \end{macrocode} +% \end{macro} +% +% \subsection{The changepage package} +% \changes{v3.4k}{2020/05/30}{Patch of the \package{changepage} package added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{changepage}[2008/07/23 memoir-v3.7k]{% +% \end{macrocode} +% +% Both environments, \env{adjustwidth} and \env{adjustwidth*}, are starting a \env{list} \cs{item}. +% But \cs{hsize} isn't set properly inside a \env{list} item, and therefore \cs{@makecaption} +% (offered by document classes) doesn't work properly when used inside \env{adjustwidth}. +% Therefore we try to detect the situation ``Are we inside a adjustwidth environment?'' +% inside \cs{@makecaption} and fix this. (Sigh!) +% +% We cannot simply set and test a flag here since our adjustment to \cs{hsize} should +% not be done within a \cs{parbox} within a adjustwidth environment for example, +% and therefore we store \cs{hsize} and \cs{linewidth}, and test \cs{hsize} and \cs{linewidth} +% against the stored values instead. If they are equal we are (hopefully) quite save +% to assume that we are now inside a plain \env{adjustwidth} environment and therefore need +% to fix \cs{hsize} before typesetting the caption. (Deep sigh!) +% +% \begin{macro}{\caption@adjustwidth@hsize} +% \begin{macro}{\caption@adjustwidth@linewidth} +% \begin{macrocode} + \newdimen\caption@adjustwidth@hsize + \newdimen\caption@adjustwidth@linewidth +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@set@adjustwidth} +% \changes{v3.4k}{2020/05/30}{This macro and its usage added} +% Store the values of \cs{hsize} and \cs{linewidth}. +% \begin{macrocode} + \providecommand*\caption@set@adjustwidth{% + \caption@adjustwidth@hsize\hsize + \caption@adjustwidth@linewidth\linewidth}% +% \end{macrocode} +% \begin{macrocode} + \providecommand*\caption@patch@changepage[1]{% + \expandafter\let\csname caption@#1\expandafter\endcsname\csname #1\endcsname + \expandafter\renewcommand\csname #1\endcsname[2]{% + \@nameuse{caption@#1}{##1}{##2}% + \caption@set@adjustwidth}}% + \caption@patch@changepage{adjustwidth}% + \caption@patch@changepage{adjustwidth*}% + \let\caption@patch@changepage\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@test@adjustwidth} +% \changes{v3.4k}{2020/05/30}{This macro and its usage added} +% Test if the values of \cs{hsize} and \cs{linewidth} are identical to +% the ones stored in the \env{adjustwidth} environment. +% If yes, set \cs{hsize} to the correct value. +% \begin{macrocode} + \providecommand\caption@test@adjustwidth{% + \ifdim\hsize=\caption@adjustwidth@hsize + \ifdim\linewidth=\caption@adjustwidth@linewidth + \hsize=\linewidth + \fi + \fi}% +% \end{macrocode} +% \begin{macrocode} + \AtBeginCaption{\caption@test@adjustwidth}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + }{}% +% \end{macrocode} +% +% \subsection{The chkfloat package} +% \changes{v3.3}{2018/09/06}{Support of the \package{chkfloat} package added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{chkfloat}[2012/08/19 v0.1]{% +% \end{macrocode} +% +% \begin{macro}{\caption@chkfloat} +% \changes{v3.3}{2018/09/06}{This macro added} +% \begin{macrocode} + \caption@ifdefined\chkfloat@addcontentsline{% + \renewcommand\caption@chkfloat{\chkfloat@addcontentsline}% + }{% + \renewcommand\caption@chkfloat[2]{% + \caption@ifdefined\chkfloat@page{% + \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}% + }{}}% + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + }{}% +% \end{macrocode} +% +% \subsection{The float package} +% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved} +% \iffalse +% (This is a more straight-ahead implementation, but it only works with v1.3 +% now, so v1.2 is no longer supported. The old code including documentation +% can be found in caption-30f-050530.zip) +% \fi +% +% The \package{float} package usually do not use the \LaTeX\ kernel command +% |\@caption| to typeset the caption but |\float@caption| instead. +% (|\@caption| will only be used if the float is re-styled with +% |\restylefloat*|.) +% +% The main two things |\float@caption| is doing different are: +% \begin{itemize} +% \item The caption will be typeset inside a |\savebox| called |\@floatcapt| +% so it can be placed above or below the float contents afterwards. +% \item |\@makecaption| will not be used to finally typeset the caption. +% Instead |\@fs@capt| will be used which definition is part of the float +% style. +% (Note that |\@fs@capt| will not typeset any vertical space above or below +% the caption; instead this space will be typeset by the float style code +% itself.) +% \end{itemize} +% +% \begin{macrocode} +\caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{% + \@ifpackageloaded{floatrow}{% + \caption@If@Package@Loaded{floatrow}[2007/08/24 v0.2a]{}{}% + }{% +% \end{macrocode} +% +% \begin{macro}{\@float@setevery} +% \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added +% to redefinition of \cs{caption@setfloatcapt}} +% \changes{v3.4b}{2019/12/16}{Usage of \cs{caption@float@setname} added} +% |\@float@setevery|\marg{float type} is provided by the \package{float} +% package; it's called every time a floating environment defined with +% |\newfloat| or |\restylefloat| begins. +% We use this hook to do some adaptations and to setup the proper caption +% style (if defined) and additional settings declared with +% |\captionsetup|\oarg{float style}. +% \begin{macrocode} + \let\caption@ORI@float@setevery\@float@setevery + \def\@float@setevery#1{% + \float@ifcaption{#1}{% +% \end{macrocode} +% +% First of all we set the caption position to it's proper value by +% converting |\@fs@iftopcapt| (which is part of a float style and +% controls where the caption will be typeset, above or below the float +% contents) to our |position=| setting. +% Since the spacing above and below the caption will be done by the float +% style and \emph{not} by us this sounds quite useless. But in fact it isn't, +% since some packages based on \thispackage\ (like the \package{subfig} +% package) could have an interest for this information and therefore use the +% |\caption@iftop| macro we provide in our kernel. Furthermore we need this +% information for ourself in |\captionof| which uses |\@makecaption| to +% finally typeset the caption with skips. +% \begin{macrocode} + \caption@setposition{\@fs@iftopcapt t\else b\fi}% +% \end{macrocode} +% +% Afterward we redefine |\caption@setfloatcapt| (which will be used inside +% |\@caption|) so the caption will be set inside the box |\@floatcapt|, +% without extra vertical space. +% \begin{macrocode} + \renewcommand\caption@setfloatcapt[1]{% + \let\@makecaption\caption@@make + \global\setbox\@floatcapt\vbox{% + \color@begingroup ##1\color@endgroup}}% +% \end{macrocode} +% +% To allow different caption styles for different float styles we also +% determine the current float style (e.g. `ruled') and select +% a caption style (and additional settings) with the same name, if defined. +% \begin{macrocode} + \float@getstyle\float@style{#1}% + \caption@setstyle*\float@style + \caption@setoptions\float@style +% \end{macrocode} +% +% \begin{macrocode} + }{}% + \caption@float@setname{#1}% + \caption@freezeHref % will be defrosted in \float@makebox + \caption@ORI@float@setevery{#1}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\float@makebox} +% \changes{v3.3}{2013/01/06}{Corrects wrong load order hyperref-float now} +% \changes{v3.3}{2013/02/03}{Correction of wrong load order hyperref-float revised} +% Redefine |\float@makebox| (only if we are not operating in compatibility mode `v1'). +% \begin{macrocode} + \caption@AtBeginDocument{\caption@ifcompatibility{}{% +% \end{macrocode} +% If it was redefined by the \package{hyperref} package, +% we need to build on the original definition (and not on the redefined one). +% \begin{macrocode} + \caption@ifdefined\HyOrg@float@makebox + {\let\caption@ORI@float@makebox\HyOrg@float@makebox}% + {\let\caption@ORI@float@makebox\float@makebox}% + \renewcommand\float@makebox[1]{% + \caption@ORI@float@makebox{#1\relax \caption@defrostHref}}% +% \end{macrocode} +% \begin{macrocode} + }}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@float@setname} +% \changes{v3.1}{2007/07/08}{float package hook added} +% \changes{v3.4b}{2019/12/16}{Renamed from \cs{caption@typehook} to \cs{caption@float@setname}} +% \LaTeX\ and almost every other packages use +% |\|\meta{type}|name| +% to provide a macro for the type resp.~environment name -- for example +% the command |\figurename| will usually contain the name of the floating +% environment |figure|: +% \begin{quote} +% |\newcommand\figurename{Figure}| +% \end{quote} +% But the \package{float} package doesn't follow this common naming +% convention: +% For floats defined with |\newfloat| it uses |\fname@|\meta{type} instead, +% which breaks with our code (and with |\autoref| and some other things as +% well). +% So we have to map the \package{float} package name to the common one here.\par +% \Note{If the float was not defined with \cs{newfloat} but with +% \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.} +% \begin{macrocode} + \newcommand*\caption@float@setname[1]{% + \expandafter\ifx\csname #1name\endcsname\relax + \expandafter\let\csname #1name\expandafter\endcsname\csname fname@#1\endcsname + \fi}% +% \end{macrocode} +% \end{macro} +% +% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected} +% \begin{macro}{\fs@plaintop} +% \begin{macro}{\fs@boxed} +% Since the float styles |plaintop| and |boxed| don't use |\abovecaptionskip| +% which could be set with |skip=| (|plaintop| uses |\belowcaptionskip| instead of +% |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|) +% we patch the according float style macros here to change this. +% \begin{macrocode} + \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}% + \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\float@getstyle} +% \changes{v3.1}{2007/06/10}{This macro added} +% |\float@getstyle|\marg{cmd}\marg{type}\par +% Determining the float style is not so easy because the only hint +% provided by the \package{float} package is the macro +% |\fst@|\meta{float type} which points to the macro which represents the +% float style. So for example after +% \begin{quote} +% |\floatstyle{ruled}|\\ +% |\newfloat{Program}{tbp}{lop}| +% \end{quote} +% |\fst@Program| will be defined as +% \begin{quote} +% |\def\fst@Program{\fs@ruled}|\quad. +% \end{quote}\par +% So here is what we do: We make the first level expansion of +% |\fst@|\meta{float type} a string so we can gobble the first four tokens +% (= |\fs@|), so only the the name of the float style is left.\par +% \emph{TODO:} We need to convert the catcodes here. +% \begin{macrocode} + \providecommand*\float@getstyle[2]{% + \edef#1{% + \noexpand\expandafter\noexpand\@gobblefour\noexpand\string + \expandafter\expandafter\expandafter\noexpand + \csname fst@#2\endcsname}% + \edef#1{#1}% + \caption@Debug{floatstyle{#2} = `#1'}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\float@ifcaption} +% \changes{v3.1}{2007/06/23}{This macro added} +% |\float@ifcaption|\marg{type}\marg{if-clause}\marg{else-clause}\par +% Here we determine if the user has used |\newfloat| resp.~|\restylefloat|, +% or |\restylefloat*|. +% This is quite easy: If |\@float@c@|\meta{captype} is the same as +% |\float@caption|, the user has used |\newfloat| or |\restylefloat|, +% otherwise we assume he has used |\restylefloat*|. +% (This test will fail if some package re-defines |\float@caption|, +% so we have to assume that there is no one.) +% \begin{macrocode} + \providecommand*\float@ifcaption[1]{% + \expandafter\ifx\csname @float@c@#1\endcsname\float@caption + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}}{% + \providecommand*\float@ifcaption[1]{\@secondoftwo}% +% \clearcaptionsetup{boxed}% used by the floatrow package? +} +% \end{macrocode} +% +% The skip between `boxed' floats and their caption defaults to |2pt|. +% +% \begin{macrocode} +\captionsetup[boxed]{skip=2pt} % do not issue a warning when not used +% \end{macrocode} +% +% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}} +% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed} +% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style +% `ruled' with appropriate options. But if the package option |ruled| was +% specified, we setup some caption parameters to emulate the behavior +% of \thispackage\ \version{1.x} option |ruled| instead, i.e., +% the current caption settings will be used, but without margin and without +% `single-line-check'. +% \begin{macrocode} +\caption@ifbool{ruled}{% + \captionsetup[ruled]{margin=0pt,minmargin=0,slc=0}% +}{% + \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}% +} +\caption@undefbool{ruled} +% \end{macrocode} +% +% \subsection{The floatflt package} +% \changes{v3.1}{2007/06/10}{Support of the \package{floatflt} package added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{floatflt}[1996/02/27 v1.3]{% +% \end{macrocode} +% +% \begin{macro}{\floatingfigure} +% We patch |\floatingfigure| so |\caption@floatflt| will be used. +% \begin{macrocode} + \let\caption@ORI@floatingfigure\floatingfigure + \def\floatingfigure{% + \caption@floatflt{figure}% + \caption@ORI@floatingfigure}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\floatingtable} +% Same with |\floatingtable|\ldots +% \begin{macrocode} + \let\caption@ORI@floatingtable\floatingtable + \def\floatingtable{% + \caption@floatflt{table}% +% \caption@setautoposition b% + \caption@ORI@floatingtable}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@floatflt} +% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added} +% Here we do two things: +% \begin{enumerate} +% \item We use |\caption@set|\-|options{|\-|floating|\meta{type}|}| so +% |\caption|\-|setup[|\-|floating|\meta{type}|]{|\ldots|}| is supported. +% \item |\line|\-|width| must be set correctly. +% Usually this is done by |\@par|\-|box|\-|restore| inside |\@caption|, +% but since we use |\@caption@parbox|\-|restore| we have to map this to +% |\@par|\-|box|\-|restore| instead. +% \end{enumerate} +% \begin{macrocode} + \newcommand*\caption@floatflt[1]{% + \caption@settype{#1}% + \caption@clearmargin + \caption@setparboxrestore{full}% + \caption@setoptions{floating#1}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The fltpage package} +% \changes{v3.1}{2007/07/22}{Support of the \package{fltpage} package added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{% + \caption@setbool{needfreeze}{1}% +% \end{macrocode} +% +% \begin{macro}{\FP@positionLabel} +% \changes{v3.2c}{2011/08/28}{This redefinition added} +% Original code: +% \begin{verbatim} +% \newcommand{\FP@positionLabel}{% +% FP\@captype-\number\value{FP@\@captype C}-pos} +% \end{verbatim}%^^A +% \begin{macrocode} + \renewcommand\FP@positionLabel{% + FP\FP@captype-\number\value{FP@\FP@captype C}-pos}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FP@helpNote} +% Original code: +% \begin{verbatim} +% \newcommand{\FP@helpNote}[2]{% +% \typeout{FP#1 is inserted on page \pageref{#2}!}}% +% \end{verbatim}%^^A +% \begin{macrocode} + \renewcommand\FP@helpNote[2]{% + \begingroup % save \caption@thepage + \caption@pageref{#2}% + \typeout{FP#1 is inserted on page \caption@thepage!}% + \endgroup}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FP@floatBegin} +% \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now} +% \changes{v3.1k}{2009/10/09}{Bugfix 09-09-11: Missing \cs{ignorespaces} added} +% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}} +% \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added} +% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}} +% Original code: +% \begin{verbatim} +% \newcommand{\FP@floatBegin}[1]{% +% \gdef\@captype{#1}% +% \global\let\FP@savedCaptionCommand\caption% +% \global\let\FP@savedLabelCommand\label% +% \ifthenelse{\equal{\@captype}{figure}} +% {\global\let\old@Fnum\fnum@figure}% +% {\global\let\old@Fnum\fnum@table}% +% \let\FP@LabelText\@empty% +% \let\FP@CaptionText\@empty% +% \let\FP@optionalCaptionText\@empty% +% \renewcommand\label[1]{\gdef\FP@LabelText{##1}}% +% \renewcommand\caption[2][]{% +% \gdef\FP@optionalCaptionText{##1}\gdef\FP@CaptionText{##2}}% +% \begin{lrbox}{\FP@floatCorpusBOX}% +% }% +% \end{verbatim}%^^A +% \begin{macrocode} + \renewcommand*\FP@floatBegin[1]{% + \def\FP@captype{#1}% + \begin{lrbox}{\FP@floatCorpusBOX}% + \minipage\hsize % changes from LR mode to vertical mode + \caption@freezetype{#1}% + \ignorespaces}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FP@floatEnd} +% \changes{v3.1g}{2008/01/30}{Some minor bugfixes} +% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}} +% \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added} +% Original code: +% \begin{verbatim} +% \newcommand{\FP@floatEnd}{% +% \end{lrbox}% +% \global\setbox\FP@floatCorpusBOX=\box\FP@floatCorpusBOX +% \stepcounter{FP@\@captype C}% +% \FP@savedLabelCommand{\FP@positionLabel}% +% \FP@helpNote{\@captype}{\FP@positionLabel}% +% \FP@float +% {\FP@positionLabel}% location label test +% {\begin{\@captype}[p!] +% \usebox{\FP@floatCorpusBOX}% +% \refstepcounter{\@captype}% +% \ifthenelse{\equal{\FP@LabelText}{\@empty}} +% {}{\FP@savedLabelCommand{\expandafter\protect\FP@LabelText}}% +% \end{\@captype}} +% {\addtocounter{\@captype}{-1}} +% {\begin{\@captype}[b!]% +% \ifthenelse{\equal{\FP@guide}{\@empty}}% +% {}{\ifthenelse{\equal{\@captype}{figure}}% +% {\renewcommand{\fnum@figure}{\old@Fnum\ {\FP@guide}}}% +% {\renewcommand{\fnum@table}{\old@Fnum\ {\FP@guide}}}}% +% \setlength{\abovecaptionskip}{2pt plus2pt minus 1pt} % length above caption +% \setlength{\belowcaptionskip}{2pt plus2pt minus 1pt} % length above caption +% \FP@separatorCaption% +% \ifthenelse{\equal{\FP@optionalCaptionText}{\@empty}}% +% {\FP@savedCaptionCommand{\expandafter\protect\FP@CaptionText}}% +% {\FP@savedCaptionCommand[\expandafter\protect\FP@optionalCaptionText]% +% {\expandafter\protect\FP@CaptionText}}% +% \end{\@captype}}% +% }% +% \end{verbatim}%^^A +% \begin{macrocode} + \renewcommand*\FP@floatEnd{% + \endminipage + \end{lrbox}% +% \end{macrocode} +% \begin{macrocode} + \stepcounter{FP@\FP@captype C}% + \caption@label\FP@positionLabel + \FP@helpNote\FP@captype\FP@positionLabel +% \end{macrocode} +% \begin{macrocode} + \FP@float + {\FP@positionLabel}% location label test + {\caption@prepare@defrost + \begin\FP@captype[p!]% + \usebox\FP@floatCorpusBOX + \end\FP@captype}% + {\@ifundefined{theH\FP@captype}{}{% + \expandafter\l@addto@macro\csname theH\FP@captype\endcsname{.FP}}}% + {\caption@prepare@defrost + \begin\FP@captype[b!]% + \let\FP@savedSetfnumCommand\caption@setfnum + \def\caption@setfnum##1{% + \FP@savedSetfnumCommand{##1}% + \ifx\FP@guide\@empty \else + \expandafter\l@addto@macro\csname fnum@##1\endcsname{\ {\FP@guide}}% + \fi}% + \setlength\abovecaptionskip{2pt plus 2pt minus 1pt}% length above caption + \setlength\belowcaptionskip{2pt plus 2pt minus 1pt}% length below caption + \caption@setoptions{FP\@captype}% + \FP@separatorCaption + \caption@defrost + \end\FP@captype}% + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{% + \let\caption@ifFPlistcap\@undefined + \let\caption@ifFPrefcap\@undefined +} +% \end{macrocode} +% +% \subsection{The hyperref package} +% \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} +% \changes{v3.2c}{2011/08/24}{Test if \package{hyperref} has stopped early adapted to current version of \package{hyperref} package: Usage of \cs{IfHyperBoolean} added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{% + % Test if hyperref has stopped early + \caption@ifundefined\IfHyperBoolean{% + \caption@set@bool\caption@ifhyp@stoppedearly0% + \caption@ifundefined\H@refstepcounter + {\caption@set@bool\caption@ifhyp@stoppedearly1}{% + \caption@ifundefined\hyper@makecurrent + {\caption@set@bool\caption@ifhyp@stoppedearly1}{% + \caption@ifundefined\measuring@true + {\caption@set@bool\caption@ifhyp@stoppedearly1}{}}}% + }{% + \def\caption@ifhyp@stoppedearly{\IfHyperBoolean{stoppedearly}}% + }% + \caption@ifhyp@stoppedearly{% hyperref has stopped early + \caption@InfoNoLine{% + Hyperref support is turned off\MessageBreak + because hyperref has stopped early}% + }{% + \g@addto@macro\caption@prepareslc{\measuring@true}% +% \end{macrocode} +% +% \begin{macro}{\caption@@@refstepcounter} +% We redefine |\caption@@refstepcounter| so |\H@refstepcounter| will be used +% instead of |\refstepcounter| inside |\caption| \& |\captionlistentry|. +% \begin{macrocode} + \renewcommand*\caption@@@refstepcounter{\H@refstepcounter}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@makecurrent} +% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package} +% We redefine |\caption@makecurrent| so a \package{hyperref} label +% will be defined inside |\@caption|. +% \Note{Will be redefined by \cs{caption@start}.} +% \begin{macrocode} + \renewcommand*\caption@makecurrent[2]{% + \caption@makecurrentHref{#1}% + \caption@Debug{hyperref current=\@currentHref}% + \caption@gettitle{#2}}% +% \end{macrocode} +% \begin{macrocode} + \newcommand*\caption@makecurrentHref{\hyper@makecurrent}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@makeanchor} +% \changes{v3.1l}{2010/01/09}{Adapted to the current hyperref package} +% We redefine |\caption@makeanchor| so a \package{hyperref} anchor +% will be set inside |\@caption|. +% \Note{Will be redefined by \cs{caption@start}.} +% \begin{macrocode} + \renewcommand\caption@makeanchor[1]{% + \caption@Debug{hyperref anchor: \@currentHref}% + % If we cannot have nesting, the anchor is empty. + \ifHy@nesting + \expandafter\hyper@@anchor\expandafter{\@currentHref}{#1}% + \else + \Hy@raisedlink{% + \expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}% + }#1% + \fi}% +% \end{macrocode} +% \begin{macrocode} + \g@addto@macro\caption@prepareslc{\let\caption@makeanchor\@firstofone}% +% \end{macrocode} +% \end{macro} +% +% \paragraph{The hypcap option} +% +% \begin{macro}{\if@capstart} +% Like the \package{hypcap} package we define the switch |\if@capstart|, too. +% \begin{macrocode} + \newif\if@capstart +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@start} +% \changes{v3.0l}{2007/02/20}{% +% \cs{caption@currentHref} renamed to \cs{hc@currentHref}} +% \changes{v3.1}{2007/06/21}{% +% This macro renamed from \cs{capstart} to \cs{caption@start} and revised} +% While the \package{hypcap} package defines a macro called |\capstart| +% our variant is called |\caption@start| and is controlled by the option +% |hypcap=||false|/|true|. +% \begin{macrocode} + \def\caption@start{\caption@ifhypcap\caption@start@\relax}% + \def\caption@start@{% +% \end{macrocode} +% Generate the \package{hyperref} label and set the \package{hyperref} anchor, +% usually (if |hypcap=false|) both is done inside |\@caption|. +% \begin{macrocode} + \caption@makestart\@captype + \caption@startanchor\@currentHref +% \end{macrocode} +% Prevent |\@caption| from generating a new \package{hyperref} label, +% use the label we save in |\hc@currentHref| instead. +% (We also support the |@capstart| flag from the \package{hypcap} package.) +% \begin{macrocode} + \global\@capstarttrue + \let\hc@currentHref\@currentHref + \def\caption@makecurrentHref##1{% + \global\@capstartfalse + \global\let\@currentHref\hc@currentHref}% +% \end{macrocode} +% Prevent |\@caption| from generating a \package{hyperref} anchor since this +% has already been done. +% \begin{macrocode} + \let\caption@makeanchor\@firstofone +% \end{macrocode} +% \begin{macrocode} + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@makestart} +% \changes{v3.1c}{2007/09/30}{\cs{@currentHref} will be extended by \texttt{caption} +% instead of \texttt{xxx} now} +% |\caption@makestart|\marg{type} +% defines a \package{hyperref} anchor inside |\caption@start|.\par +% Since we offer |\continuedfloat| the float counter can change between +% `now' and |\caption|, i.e., we simply don't know the figure or table counter +% yet and therefore we are not able to generate the `right' \package{hyperref} +% label. +% Two different solutions of this problem came into my mind: +% \begin{enumerate} +% \item I could use the aux file for this purpose.\par +% -or- +% \item I set |hypertexnames=false| locally. +% Furthermore I use |#1.caption.|\meta{counter} (instead of |#1.|\meta{counter}) +% as naming scheme for |\@currentHref| to avoid conflicts with other hyper +% links which are generated with |hypertexnames=true|. +% \end{enumerate} +% The first idea has the advantage that the `right' anchor name will be +% generated, but one needs an additional \LaTeX\ run if figures or tables +% will be inserted or removed.\par +% The second idea has the advantage that it's very easy to implement, but +% has some side-effects, e.g. the anchor names don't follow the figure or +% table label names anymore.\par +% Since I'm lazy I implemented the second idea, maybe I will revise this +% later on. +% \begin{macrocode} + \newcommand*\caption@makestart[1]{% + \begingroup + \Hy@hypertexnamesfalse +% \gdef\@currentHlabel{}% + \hyper@makecurrent{#1.caption}% + \endgroup + \caption@Debug{hypcap start=\@currentHref}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@startanchor} +% \changes{v3.1b}{2007/09/17}{Bugfix 06-09-17: We use \cs{caption@anchor} instead of \cs{hyper@@anchor}} +% \changes{v3.1g}{2008/03/16}{Warning about TeX mode replaced with debug info} +% |\caption@startanchor|\marg{Href} +% sets a \package{hyperref} anchor inside |\caption@start|.\par +% This code was taken from the \package{hypcap} package\cite{hypcap} and adapted. +% \Note{Since \cs{hyper@@anchor}\marg{Href}\csmarg{\string\relax} can cause +% a change from vertical mode to horizontal mode (design flaw in +% \package{hyperref} package!?), and since the workaround +% \cs{let}\cs{leavevmode}\cs{relax} which can be found in the +% \package{hypcap} package is not always sufficient +% (for example with ``Direct pdfmark support'' and \texttt{breaklinks=true}), +% we use \cs{caption@anchor} instead of \cs{hyper@@anchor} here.} +% \begin{macrocode} + \newcommand*\caption@startanchor[1]{% + \ifvmode\begingroup + \caption@Debug{hypcap anchor: #1 (vertical mode)}% + \@tempdima\prevdepth + \nointerlineskip + \vspace*{-\caption@hypcapspace}% + \caption@anchor{#1}% + \vspace*{\caption@hypcapspace}% + \prevdepth\@tempdima + \endgroup\else + \caption@Debug{hypcap anchor: #1 (horizontal mode)}% + \caption@anchor{#1}% + \fi}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@anchor} +% \changes{v3.1c}{2007/10/17}{Workaround 07-10-17: We use \cs{caption@raisedlink} instead of \cs{Hy@raisedlink} now} +% |\caption@anchor|\marg{Href} sets a \package{hyperref} anchor. +% \begin{macrocode} + \newcommand*\caption@anchor[1]{% + \ifmeasuring@ \else + \caption@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}% + \fi}% +% \end{macrocode} +% \Note{Since \cs{Hy@raisedlink} change \cs{@tempdima} we surrounded it by \cs{ifvmode}, +% suppressing ``\texttt{LaTeX Warning: Float too large for page by 1.0pt}'' in \texttt{sideways} floats. +% (This is not necessary since \package{hyperref} \version{6.77}.)} +% \begin{macrocode} + \ifx\HyperRaiseLinkLength\@tempdima + \def\caption@raisedlink#1{\ifvmode#1\else\Hy@raisedlink{#1}\fi}% + \else + \let\caption@raisedlink\Hy@raisedlink + \fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@@start} +% Will be used by |\caption@freezeHref|. Apart from that we issue a warning +% if we expect a saved \package{hyperref} label coming from |\caption@start|, +% but there isn't any. +% \begin{macrocode} + \def\caption@@start{% + \caption@ifundefined\hc@currentHref{% + \caption@Warning{% + The option `hypcap=true' will be ignored for this\MessageBreak + particular \string\caption}}{}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@freezeHref} +% Suppress |\caption@start| from generating a \package{hyperref} label and +% setting a \package{hyperref} anchor. Instead if |\@caption| generates a +% \package{hyperref} label, it will be stored in |\caption@currentHref|. +% Furthermore we need to redefine |\caption@setfloatcapt| so no +% \package{hyperref} anchor will be placed in |\@caption|. +% \iffalse +% (Since |\caption@setfloatcapt| will be set to |\@firstofone| inside +% |\subcaption| there is no need to add its restauration to +% |\caption@subtypehook|.) +% \fi +% \begin{macrocode} + \def\caption@freezeHref{% + \let\caption@ORI@start\caption@start + \def\caption@start{\let\caption@start\caption@ORI@start}% +% \end{macrocode} +% \begin{macrocode} +% \let\caption@ORI@@start\caption@@start +% \l@addto@macro\caption@subtypehook{% +% \let\caption@@start\caption@ORI@@start}% +% \end{macrocode} +% \begin{macrocode} + \global\let\caption@currentHref\@undefined + \def\caption@@start{\global\let\caption@currentHref\@currentHref}% +% \end{macrocode} +% \begin{macrocode} + \let\caption@ORI@setfloatcapt\caption@setfloatcapt + \renewcommand*\caption@setfloatcapt{% + \ifx\caption@currentHref\@undefined \else + \let\caption@makeanchor\@firstofone + \fi + \caption@ORI@setfloatcapt}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@defrostHref} +% If there is a freezed |\@currentHref|, we set the \package{hyperref} +% anchor here. +% \begin{macrocode} + \def\caption@defrostHref{% + \ifx\caption@currentHref\@undefined \else + \caption@startanchor\caption@currentHref + \global\let\caption@currentHref\@undefined + \fi}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + }}{} +% \end{macrocode} +% +% \subsection{The hypcap package} +% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added} +% \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} \version{1.6}} +% \changes{v3.1e}{2007/11/04}{\package{hypcap} support adapted to \package{hyperref} \version{6.77}} +% +% \begin{macrocode} +\caption@IfPackageLoaded{hypcap}{% v1.0 + \ifx\caption@start\relax \else % hyperref hasn't stopped early +% \end{macrocode} +% +% If the \package{hypcap} package was loaded, we give up our own +% hyperlink placement algorithm and give the control over the placement +% to the \package{hypcap} package instead. +% +% \begin{macro}{\capstart} +% \changes{v3.1k}{2009/10/09}{Support of \cs{ifcapstart} (\package{hypcap} package \version{1.10}) added} +% We do this simply by mapping |\capstart| to |\caption@start@|, +% although our code does not behave exactly like the original one: +% The original |\capstart| has an effect on the next |\caption| +% only but our version affects \emph{all} |\caption|s in the same +% environment, at least unless a new |\capstart| will be placed. +% \begin{macrocode} + \let\caption@ORI@capstart\capstart % save for compatibility mode + \caption@ifundefined\capstarttrue % check for v1.10 of hypcap package + {\def\capstart{\caption@start@}}% + {\def\capstart{\ifcapstart\caption@start@\fi}}% + \let\caption@start\relax + \let\caption@@start\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@hypcapspace} +% Furthermore we map our |\caption@hypcapspace| to |\hypcapspace| +% offered by the \package{hypcap} package. +% \begin{macrocode} + \caption@set@bool\caption@ifhypcap 1% + \renewcommand*\caption@hypcapspace{\hypcapspace}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + \fi}{} +% \end{macrocode} +% +% \subsection{The listings package} +% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{% +% \end{macrocode} +% +% \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} +% \changes{v3.4c}{2020/01/01}{Ugly workaround for usage in lists added} +% \changes{v3.4d}{2020/01/01}{Ugly workaround for usage in lists revised} +% To support the \package{listings} package we need to redefine +% |\lst@Make|\-|Caption| so the original stuff is nested with +% |\caption@begin| and |\caption@end| etc.\par +% We set a flag inside the "Init" hook of the \package{listings} package (where adaption of |\line|\-|width| etc.~takes place). +% \begin{macrocode} + \caption@setbool{lst@Init}{0}% + \lst@AddToHook{Init}{\caption@setbool{lst@Init}{1}}% +% \end{macrocode} +% \begin{macrocode} + \let\caption@ORI@lst@MakeCaption\lst@MakeCaption + \def\lst@MakeCaption#1{% #1 is `t' or `b' +% \end{macrocode} +% This macro is always called twice by the \package{listings} package (with `t' resp. `b' as parameter), +% therefore we need an extra group here. +% \begin{macrocode} + \begingroup +% \end{macrocode} +% Inside lists the \package{listings} package ignores the left margin (|\@total|\-|left|\-|margin|) for captions. +% We emulate this behaviour by adding a negative skip which will be typeset ahead of |\caption@box|.\par +% Note: We only need to do this if the ``Init'' hook of the \package{listings} package wasn't called yet. +% \begin{macrocode} + \caption@iflst@Init{}{% + \edef\caption@lst@leftskip{\noexpand\hskip-\the\@totalleftmargin\noexpand\relax}% + \l@addto@macro\caption@beginhook\caption@lst@leftskip}% +% \end{macrocode} +% 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 +% own |\abovecaptionskip| \& |\belowcaptionskip| values prior to calling +% \cs{lst@MakeCaption}.) +% \begin{macrocode} + \caption@setposition{#1}% + \caption@iftop{% + \@tempdima\belowcaptionskip + \belowcaptionskip\abovecaptionskip + \abovecaptionskip\@tempdima}{}% +% \end{macrocode} +% Workaround for issue with wrong skips (FIXME: This should be examined further) +% \begin{macrocode} + \caption@setup{rule=0}% +% \end{macrocode} +% Afterwards we set the local `lstlisting' options. +% \begin{macrocode} + \caption@setoptions{lstlisting}% +% \end{macrocode} +% If the |position=| is now set to |auto|, we take over the |captionpos=| +% setting from the \package{listings} package. +% \begin{macrocode} + \caption@setautoposition{#1}% +% \end{macrocode} +% At the end we do similar stuff as in our \cs{@caption} code. +% \begin{macrocode} + \caption@begin{lstlisting}% + \caption@ORI@lst@MakeCaption{#1}% + \caption@end +% \end{macrocode} +% \begin{macrocode} + \endgroup}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lst@makecaption} +% \begin{macro}{\lst@maketitle} +% Wrapper macros for typesetting the |caption=| resp. |title=| value. +% \begin{macrocode} + \def\lst@makecaption{\caption@starfalse\@makecaption}% + \def\lst@maketitle{\caption@startrue\@makecaption\@empty}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ext@lstlisting} +% \changes{v3.1}{2007/03/03}{This macro added} +% Since the \package{listings} package do not define |\ext@lstlisting| +% but we needed it when |\captionof{lstlisting}| will be done by the end user, +% we define it here. +% \begin{macrocode} + \providecommand*\ext@lstlisting{lol}% +% \end{macrocode} +% \end{macro} +% +% \changes{v3.1a}{2007/07/13}{Bugfix 07-09-13: \cs{lst@@caption} will not be re-defined anymore} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The longtable package} +% +% \begin{macro}{\LTcaptype} +% \changes{v3.1}{2007/07/06}{This macro and its support added} +% |\LTcaptype| is preset to |table|. +% \begin{macrocode} +\providecommand*\LTcaptype{table} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@AtBeginLongtable} +% \changes{v3.5}{2018/04/15}{This macro added} +% \begin{macrocode} +\providecommand*\caption@LT@array{} +\newcommand\caption@AtBeginLongtable{% + \g@addto@macro\caption@LT@array} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{% +% \end{macrocode} +% \begin{macrocode} + \RequirePackage{ltcaption}[=2018/08/26]% + \let\LT@@makecaption\@undefined +% \end{macrocode} +% +% \begin{macro}{\LT@array} +% \changes{v3.1}{2007/07/22}{This redefinition added} +% \changes{v3.1a}{2007/09/16}{Bugfix: This redefinition will always be done \cs{AtBeginDocument}} +% \changes{v3.1g}{2008/01/20}{Bugfix in \cs{captionlistentry}: Table counter will not be incremented anymore, \cs{nameref} works} +% \changes{v3.3}{2016/01/31}{Support for \cs{bicaption} added} +% \changes{v3.3}{2018/10/05}{Definition of \cs{captionlistentry} fixed} +% \changes{v3.5}{2018/04/15}{Usage of \cs{caption@AtBeginLongtable} added} +% We redefine |\LT@array| here to get |\captionsetup|\marg{options} working inside |longtable|s. +% \Note{Since the \package{hyperref} package patches \cs{LT@array} as well +% and since this only works with the original definition of \cs{LT@array}, +% we have to do this after the \package{hyperref} package, i.e.~\cs{AtBeginDocument}.} +% \begin{macrocode} + \caption@AtBeginDocument{% + \let\caption@ORI@LT@array\LT@array + \renewcommand*\LT@array{% + \caption@LT@array + \caption@ORI@LT@array}}% +% \end{macrocode} +% \begin{macrocode} + \caption@AtBeginLongtable{% +% |\captionsetup| for longtable: +% \begin{macrocode} + \global\let\caption@opt@@longtable\@undefined + \def\captionsetup{% + \noalign\bgroup + \@ifstar\@captionsetup\@captionsetup}% gobble * + \def\@captionsetup#1{\LT@captionsetup{#1}\egroup}% + \def\LT@captionsetup#1{% + \captionsetup@startrue\caption@setup@options[@longtable]{#1}% + \global\let\caption@opt@@longtable\caption@opt@@longtable}% +% \end{macrocode} +% |\captionlistentry| for longtable: +% \begin{macrocode} + \def\captionlistentry{% + \noalign\bgroup + \@ifstar{\egroup\LT@listentry\LTcaptype}% gobble * + {\egroup\LT@listentry\LTcaptype}}% +% \end{macrocode} +% |\continuedfloat| for longtable:\\ +% {\small(Commented out, since it's not deeply tested and quite useless anyway)} +% \Note{\package{hyperref} versions $<$ v6.76j uses $2\times$ \cs{hyper@makecurrent}} +% \begin{macrocode} +% \caption@ifhypcap{% +% \let\caption@ORI@hyper@makecurrent\hyper@makecurrent +% \def\hyper@makecurrent##1{% +% \let\hyper@makecurrent\caption@ORI@hyper@makecurrent +% \caption@makestart{##1}% +%% \let\Hy@LT@currentHlabel\@currentHlabel +% \let\Hy@LT@currentHref\@currentHref +% \def\hyper@makecurrent####1{% +%% \let\@currentHlabel\Hy@LT@currentHlabel +% \let\@currentHref\Hy@LT@currentHref}}% +% \let\caption@ORI@continuedfloat\continuedfloat +% \def\continuedfloat{\noalign{% +% \gdef\caption@setContinuedFloat{% +% \let\caption@reset@continuedfloat\@gobble}% +% \def\caption@setoptions##1{% +% \g@addto@macro\caption@setContinuedFloat{% +% \caption@setoptions{##1}}}% +% \let\@captype\LTcaptype +% \caption@ORI@ContinuedFloat}}% +% }{% +% \def\continuedfloat{\noalign{% +% \caption@Error{% +% \noexpand\continuedfloat inside longtables\MessageBreak +% is only available with `hypcap=true'}}}% +% }% +% \global\let\caption@setContinuedFloat\@empty + \def\continuedfloat{\noalign{% + \caption@Error{\noexpand\continuedfloat outside float}}}% +% \end{macrocode} +% |\bicaption| for longtable: +% \begin{macrocode} + \let\bicaption\LT@bicaption +% \end{macrocode} +% \begin{macrocode} + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@capti@n} +% \changes{v3.3}{2016/02/01}{This re-definition added} +% The original implementation: +% \begin{verbatim} +% \def\LT@capti@n{% +% \@ifstar +% {\egroup\LT@c@ption\@gobble[]}% +% {\egroup\@xdblarg{\LT@c@ption\@firstofone}}} +% \end{verbatim}%^^A +% Our implementation uses |\caption@xdblarg| instead of |\@xdblarg|: +% \begin{macrocode} + \def\LT@capti@n{% + \@ifstar + {\egroup\LT@c@ption\@gobble[]}% + {\egroup\caption@xdblarg{\LT@c@ption\@firstofone}}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@makecaption} +% \changes{v3.0d}{2004/08/10}{Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now} +% \changes{v3.0e}{2005/05/05}{Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now} +% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced} +% \changes{v3.3}{2016/02/01}{Support for \cs{bicaption} via \cs{caption@LT@setup} added} +% \changes{v3.3a}{2019/04/02}{Work-around for problem with \package{floatrow} added} +% |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par +% \smallskip +% The original definition: +% \begin{verbatim} +% \def\LT@makecaption#1#2#3{% +% \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{% +% % Based on article class "\@makecaption", "#1" is "\@gobble" in star +% % form, and "\@firstofone" otherwise. +% \sbox\@tempboxa{#1{#2: }#3}% +% \ifdim\wd\@tempboxa>\hsize +% #1{#2: }#3% +% \else +% \hbox to\hsize{\hfil\box\@tempboxa\hfil}% +% \fi +% \endgraf\vskip\baselineskip}% +% \hss}}} +% \end{verbatim}%^^A +% Our definition: +% \begin{macrocode} + \renewcommand\LT@makecaption[3]{% + \caption@LT@make{% + \caption@LT@settype\LTcaptype +% \end{macrocode} +% |\caption@LT@setup| is re-defined inside the \package{bicaption} package +% and contains the preparation of typesetting of the bilingual caption. +% \begin{macrocode} + \caption@LT@setup +% \end{macrocode} +% \iffalse +% The default |position=| setting for longtables is |top|. +% (This emulates the standard behavior of the \package{longtable} package +% which has no skip above the caption but a skip below it.) +% \fi +% |position=auto| is a bad idea for longtables, but we do our very best. +% This works quite well for captions inside the longtable contents, but +% not for captions inside the longtable (end)foot. +% \Note{This should be `top' if unclear!} +% \begin{macrocode} + \caption@setautoposition{\ifcase\LT@rows t\else b\fi}% +% \end{macrocode} +% We set |\ifcaption@star| according the 1st argument. +% \begin{macrocode} + \caption@startrue#1\caption@starfalse +% \end{macrocode} +% \begin{macrocode} + \caption@prepare@stepcounter\LTcaptype{LT}% +% \end{macrocode} +% \changes{v3.1}{2007/05/05}{\cs{caption@font@normal} added} +% \begin{macrocode} + \caption@begin\LTcaptype + \caption@normalsize +% \end{macrocode} +% The following skip has the purpose to correct the height of the +% |\parbox[t]|. Usually it's the height of the very first line, but +% because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|) +% it's always |0pt|.\par +% (A different idea would be typesetting the first skip outside the longtable +% column with |\noalign{\vskip|\ldots|}|, but this means we have to move +% |\caption@begin| to some other place because it does not work in tabular +% mode. And at the moment I have no idea on how to do this in an elegant +% way\ldots) +% \begin{macrocode} + \vskip-\ht\strutbox +% \end{macrocode} +% Work-around for problem with \package{floatrow}: +% The |\below|\-|caption|\-|skip| disturbs the environment in which the caption is actually typeset (by creating extra, unwanted space), +% so we supress this skip if the \package{floatrow} package is loaded. +% (This fixes \issue{50}) +% \begin{macrocode} + \caption@ifdefined\FBifcaptop{% + \let\caption@belowskip\@empty}{}% +% \end{macrocode} +% The following code should look familiar. We do our skips and use +% |\caption@@make| to typeset the caption itself. +% \begin{macrocode} + \caption@make@above + \caption@@make{#2}{#3}\endgraf + \caption@make@below + \caption@end}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@listentry} +% \changes{v3.3}{2018/08/26}{This macro added} +% \changes{v3.3}{2018/10/05}{Bugfix: \cs{ignorespaces} added} +% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added} +% \begin{macrocode} + \renewcommand*\LT@listentry[2]{% + \begingroup + \caption@LT@settype{#1}% + \caption@listentry\@firstoftwo[{#1}]{#2}% + \endgroup\ignorespaces}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@LT@settype} +% \changes{v3.3}{2018/08/26}{This macro added} +% \changes{v3.3}{2018/10/05}{Uses argument no. 1 instead of \cs{LTcaptype}} +% \begin{macrocode} + \newcommand*\caption@LT@settype[1]{% + \caption@settype*{#1}% +% \end{macrocode} +% If |\LTcapwidth| is not set to its default value |4in| we assume +% that it shall overwrite our own setting. +% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.) +% \begin{macrocode} + \ifdim\LTcapwidth=4in \else + \setcaptionwidth\LTcapwidth + \fi +% \end{macrocode} +% \begin{macrocode} + \caption@setoptions{longtable}% +% \caption@setContinuedFloat +% \end{macrocode} +% Finally set options applied by |\captionsetup| inside the longtable. +% \begin{macrocode} + \caption@setoptions{@longtable}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\flrow@setlist} +% \changes{v3.4g}{2020/01/03}{Redefinition of this macro added} +% The \package{floatrow} package uses |\flrow@setlist{{table}{longtable}}| inside its redefinition of |\LT@array| without setting |\@captype| first, +% and this makes |\captionsetup[table]{name=...}| doomed to fail for longtables (``Undefined control sequence''). +% Unfortunately we cannot easily patch |\LT@array| again to fix this bug in \package{floatrow} since it will be patched |\AtBeginDocument|. +% Therefore we patch |\flrow@setlist| instead to catch and fix the bug on-the-fly. +% \begin{macrocode} + \caption@AtBeginDocument{\caption@ifdefined\flrow@setlist@{% + \caption@InfoNoLine{Fixing longtable code of `floatrow' package}% + \let\caption@flrow@setlist@\flrow@setlist@ + \renewcommand\flrow@setlist@[1]{% + \def\caption@tempa{{table}{longtable}}% + \def\caption@tempb{#1}% + \ifx\caption@tempa\caption@tempb + \def\@captype{table}% + \fi + \caption@flrow@setlist@{#1}}% + }{}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{% + \let\caption@AtBeginLongtable\@gobble + \let\caption@LT@array\@undefined +} +% \end{macrocode} +% +% \begin{macro}{\caption@LT@setup} +% \changes{v3.3}{2016/02/01}{This macro added} +% Hook for stuff which prepares the typesetting of the \package{longtable} caption. +% \begin{macrocode} +\providecommand*\caption@LT@setup{} +% \end{macrocode} +% \end{macro} +% +% \subsection{The picinpar package} +% \changes{v3.1}{2007/06/13}{Support of the \package{picinpar} package added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{picinpar}{% +% \end{macrocode} +% +% \begin{macro}{\figwindow} +% \begin{macro}{\tabwindow} +% The \package{picinpar} package comes with its own caption code +% (|\wincaption|, |\@wincaption|, |\@makewincaption|, \ldots) +% so we redefine |\figwindow| \& |\tabwindow| to use |\caption| instead. +% \begin{macrocode} + \long\def\figwindow[#1,#2,#3,#4] {% + \caption@window{figure}% + \caption@setoptions{figwindow}% + \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }% +% \end{macrocode} +% \begin{macrocode} + \long\def\tabwindow[#1,#2,#3,#4] {% + \caption@window{table}% + \caption@setoptions{tabwindow}% + \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@window} +% \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added} +% Beside calling |\caption@settype| we redefine |\caption@par|\-|box|\-|restore| +% (as in \package{floatflt} \& \package{picins} package support) +% and |\@makecaption| (as in \package{float} package support) here. +% \begin{macrocode} + \newcommand*\caption@window[1]{% + \let\@makecaption\caption@@make + \caption@setautoposition b% + \caption@settype{#1}% + \caption@clearmargin + \caption@setparboxrestore{full}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@wincaption} +% \changes{v3.1d}{2007/10/25}{Missing \% added} +% \changes{v3.3}{2013/04/14}{\cs{caption@ContinuedFloattrue} added} +% \changes{v3.3}{2018/10/06}{\cs{caption@ContinuedFloattrue} replaced by \cs{caption@setflag1}} +% This one finally typesets the caption using |\caption|. +% \begin{macrocode} + \newcommand\caption@wincaption[1]{% +% \end{macrocode} +% This will be done twice for every |figwindow| \& |tabwindow| caption -- +% on the first run |\picwd| is |0pt|, on the second run |\picwd| is |\hsize|. +% \begin{macrocode} + \ifdim\picwd=\z@ + \let\caption@makecurrent\@gobbletwo + \let\caption@@start\relax + \caption@prepareslc + \else + \caption@setflag1% + \fi +% \end{macrocode} +% The argument |#1| could contain simply the caption text +% (e.g.~|A figure caption|), but it could also contain an optional argument, +% the \meta{lst\_entry} +% (e.g.~|[An| |entry| |to| |the| |LOF]||{A| |figure| |caption}|). +% Therefore we have to test if |#1| begins with~|[| or not; furthermore we +% support a starred variant -- as in |\caption*| -- so we test for~|*|, too. +% \begin{macrocode} + \edef\@tempa{\expandafter\noexpand\@car#1\@nil}% + \if\@tempa*% + \let\@tempa\@firstofone + \else\if\@tempa[%] + \let\@tempa\@firstofone + \else + \let\@tempa\@empty + \fi\fi + \expandafter\caption\@tempa{#1}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The picins package} +% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added} +% +% \begin{macro}{\piccaptiontype} +% |\piccaptiontype|\marg{type}\par +% We offer this macro for changing the \meta{type} of the caption, so the user +% doesn't have to redefine |\@captype|, as proposed in the \package{picins} +% documentation. +% \Note{We define this macro here so it can be used in the +% preamble of the document, even when \thispackage\ was loaded prior to the +% \package{picins} package.} +% \begin{macrocode} +\newcommand*\piccaptiontype[1]{\def\@piccaptype{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@IfPackageLoaded{picins}{% +% \end{macrocode} +% +% Initial set |\@piccaptype| and undefine |\@captype| which was set to +% |figure| by the \package{picins} package. +% \begin{macrocode} + \caption@ifundefined\@piccaptype{% + \caption@iftype{% + \let\@piccaptype\@captype + }{% + \def\@piccaptype{figure}% + }% + }{}% + \let\@captype\@undefined +% \end{macrocode} +% +% \begin{macro}{\piccaption} +% The original code: +% \begin{verbatim} +% \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}} +% \end{verbatim}%^^A +% Our code uses |\caption@star| so |\piccaption*| works, +% and |\caption@dblarg| so |\piccaption{}| works correctly. +% \begin{macrocode} + \def\piccaption{\caption@star\relax{\caption@dblarg\@piccaption}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\make@piccaption} +% \changes{v3.1}{2007/12/06}{Bugfix: \cs{caption@clearmargin} will always be used now} +% The original code: +% \begin{verbatim} +% \def\make@piccaption{% +% [...] +% \setbox\@TEXT=\vbox{\hsize\hsiz@\caption[\sh@rtf@rm]{\capti@nt@xt}}% +% } +% \end{verbatim}%^^A +% In our code we have to correct several things: +% \begin{enumerate} +% \item |\@captype| must be defined, since we have removed the global +% definition. +% \item We use |\caption@setoptions{parpic}| so +% |\captionsetup[parpic]{|\ldots|}| is supported. +% \item |\linewidth| must be set correctly. +% Usually this is done by |\@parbox|\-|restore| inside |\@caption|, +% but since we use |\@caption@parbox|\-|restore| we have to map this to +% |\@parbox|\-|restore| instead. +% \item The two arguments of |\caption| (|\sh@rtf@rm| \& |\capti@nt@xt|) +% should be expanded on first level so |\caption[]{|\ldots|}| and +% |\caption[|\ldots|]{}| work correctly. +% \end{enumerate} +% \begin{macrocode} + \let\caption@ORI@make@piccaption\make@piccaption + \def\make@piccaption{% + \let\caption@ORI\caption +% \end{macrocode} +% \begin{macrocode} + \long\def\caption[##1]##2{% + \caption@freezeHref % will be defrosted in \ivparpic + \caption@settype\@piccaptype +% \ifnum\c@piccaptionpos>2\relax + \caption@clearmargin +% \else +% \captionwidth\z@ % do not use "width=" setting +% \fi + \caption@setparboxrestore{full}% + \caption@setoptions{parpic}% + \caption@setautoposition b% +% \end{macrocode} +% \begin{macrocode} + \expandafter\expandafter\expandafter\caption@ORI + \expandafter\expandafter\expandafter[% + \expandafter\expandafter\expandafter{% + \expandafter##1\expandafter}\expandafter]\expandafter{##2}}% +% \end{macrocode} +% {\footnotesize\begin{quote} +% \leavevmode\llap{-or-\quad}%^^A +% |\begingroup|\\ +% | \toks0\expandafter{##1}| |\toks2\expandafter{##2}|\\ +% | \edef\x{\endgroup|\\ +% | \noexpand\caption@ORI[{\the\toks0}]{\the\toks2}}|\\ +% | \x| +% \end{quote} +% \begin{quote} +% \leavevmode\llap{-or-\quad}%^^A +% |\edef\x{%|\\ +% | \noexpand\caption@ORI[{\unexpanded\expandafter{##1}}]%|\\ +% | {\unexpanded\expandafter{##2}}}|\\ +% |\-| +% \end{quote}} +% \begin{macrocode} + \caption@ORI@make@piccaption + \let\caption\caption@ORI}% +% \end{macrocode} +% \end{macro} +% + +% \begin{macro}{\ivparpic} +% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added} +% We need to set our \package{hyperref} anchor here. +% Not bullet-proof since we have to redefine |\noindent| here! +% \begin{macrocode} + \let\caption@ORI@ivparpic\ivparpic + \def\ivparpic(#1,#2)(#3,#4)[#5][#6]#7{% + \let\caption@ORI@noindent\noindent + \def\noindent{% + \caption@defrostHref + \let\noindent\caption@ORI@noindent + \noindent}% + \caption@ORI@ivparpic(#1,#2)(#3,#4)[{#5}][{#6}]{#7}% + \let\noindent\caption@ORI@noindent}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{% + \let\piccaptiontype\@undefined +} +% \end{macrocode} +% +% \subsection{The rotating package} +% +% \begin{macrocode} +\caption@IfPackageLoaded{rotating}[1995/08/22 v2.10]{% +% \end{macrocode} +% +% \begin{macro}{\rotcaption} +% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@star} removed} +% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now} +% Make |\rotcaption*| work. +% \begin{macrocode} + \def\rotcaption{\let\@makecaption\@makerotcaption\caption}% +% \let\@rotcaption\@undefined +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rotcaptionof} +% \changes{v3.0i}{2005/12/07}{New} +% Make |\rotcaptionof(*)| work. +% \begin{macrocode} + \def\rotcaptionof{% + \caption@teststar\caption@of{\rotcaption*}\rotcaption}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@makerotcaption} +% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now} +% \changes{v3.0m}{2007/03/04}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox} now} +% \changes{v3.3}{2012/12/26}{Rewritten (again)} +% Original (bugfixed) code: +% \begin{verbatim} +% \long\def\@makerotcaption#1#2{% +% \setbox\@tempboxa\hbox{#1: #2}% +% \ifdim \wd\@tempboxa > .8\vsize +% \rotatebox{90}{% +% \begin{minipage}{.8\textheight}#1: #2\end{minipage}% +% }%\par % <== \par removed (AR) +% \else% +% \rotatebox{90}{\box\@tempboxa}% +% \fi +% \nobreak\hspace{12pt}% <== \nobreak added (AR) +% } +% \end{verbatim}%^^A +% Our version emulates this behavior, but if |width=| is set, +% the rotated caption is always typeset as |\parbox|. +% (Note that |margin=| is not supported here.) +% \begin{macrocode} + \long\def\@makerotcaption#1#2{% + \rotatebox{90}{% + \ifdim\captionwidth=\z@ + \setcaptionwidth{.8\vsize}% + \l@addto@macro\caption@singleline{% + \caption@setup{parbox=none}}% + \fi + \let\caption@calcmargin\relax + \caption@@make{#1}{#2}}% + \nobreak\hspace{12pt}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The sidecap package} +% +% \begin{macrocode} +\caption@IfPackageLoaded{sidecap}[2003/06/06 v1.6f]{% + \caption@setbool{needfreeze}{1}% +% \end{macrocode} +% +% \begin{macro}{\SC@zfloat} +% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added} +% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@star} removed} +% \changes{v3.1c}{2007/10/06}{\cs{caption} will be saved \& restored now} +% \changes{v3.2a}{2011/08/17}{Bugfix: Uses \cs{caption@freeze} instead of \cs{caption@freeze*} now} +% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}} +% This macro will be called at the start of the environment, here is a good +% opportunity to do some adaptations to |\caption| and |\captionsetup|. +% \begin{macrocode} + \let\caption@ORI@SC@zfloat\SC@zfloat + \def\SC@zfloat#1#2#3[#4]{% +% \end{macrocode} +% First we use the original definition, but restore \cs{caption} and \cs{label} +% so \cs{caption@freeze} and \cs{caption@warmup} will work correctly. +% \begin{macrocode} + \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]% + \SC@RestoreCommands +% \end{macrocode} +% Since the sidecap package uses our |\caption| code outside the +% environment the regular |\captionsetup| will not work. +% So we need a special version here which saves the given argument list +% which will be executed later on. +% Furthermore we need to make |\caption*| work. +% \begin{macrocode} + \caption@freezetype{#2}% +% \end{macrocode} +% The sidecap package uses |\ifx\label\SC@label| to test if it is just inside a +% |SC|\-|figure| or not. So we redefine |\SC@label| here so this test will still work. +% \begin{macrocode} + \let\SC@label\label}% +% \end{macrocode} +% \begin{macrocode} + \providecommand*\SC@RestoreCommands{% + \let\caption=\SC@orig@caption \let\label=\SC@orig@label}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endSC@FLOAT} +% \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added} +% \changes{v3.1}{2007/05/05}{Call of \cs{caption@setoptions}\arg{SCfloat} added} +% This macro will be called at the end of the environment, here we need to +% setup our stuff before the \package{sidecap} package actually typesets +% its caption. +% \begin{macrocode} + \let\caption@ORI@endSC@FLOAT\endSC@FLOAT + \def\endSC@FLOAT{% +% \end{macrocode} +% Before we can typeset the caption we need to set the margin to zero +% because any extra margin would only be disturbing here.\par +% (We don't need to take care about the caption position because +% the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip| +% to a skip of zero anyway.)\par +% Furthermore |\SC@justify| will override the caption justification, if set. +% The usage of |\SC@justify| differs from version to version of the +% \package{sidecap} package:\par +% \begin{tabular}{ll} +% Version 1.4: & |\SC@justify| is not defined\\ +% Version 1.5: & |\SC@justify| is |\relax| when not set\\ +% Version 1.6: & |\SC@justify| is |\@empty| when not set\\ +% \end{tabular} +% \begin{macrocode} + \def\caption@setSC@justify{% + \caption@clearmargin + \ifx\SC@justify\@empty \else + \let\caption@justification\SC@justify + \let\SC@justify\@empty + \fi}% +% \end{macrocode} +% Make the original definition of |\endSC@FLOAT| to use our caption +% stuff instead of its own. +% \Note{At this point the \package{sidecap} definition of \cs{caption} is valid, +% not the regular one!} +% \begin{macrocode} + \let\caption\SC@orig@caption + \def\SC@orig@caption[##1]##2{% + \caption@setSC@justify +%%% \caption@setoptions{SC}% + \caption@setoptions{SC\@captype}% + \caption@defrost}% +% \end{macrocode} +% Finally we call the original definition of |\endSC@FLOAT|. +% \begin{macrocode} + \caption@setSC@justify % for compatibility mode + \caption@prepare@defrost + \caption@ORI@endSC@FLOAT}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The subfigure package} +% \changes{v3.1}{2007/04/06}{subfigure package support added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{subfigure}[2002/01/23 v2.1]{% +% \end{macrocode} +% +% \begin{macro}{\sf@ifpositiontop} +% \changes{v3.1a}{2007/09/15}{Bugfix 07-09-15: Check for \cs{@captype} added} +% If the \package{subfigure} package is loaded, we map |\sf@ifpositiontop| +% to |\iffiguretopcap| resp. |\iftabletopcap|, so the \package{subfigure} +% \version{2.1} options \opt{figbotcap} etc. will still work. +% \begin{macrocode} + \def\sf@ifpositiontop{% + \ifx\@captype\@undefined + \expandafter\@gobbletwo + \else\ifx\@captype\relax + \expandafter\expandafter\expandafter\@gobbletwo + \else + \expandafter\expandafter\expandafter\sf@if@position@top + \fi\fi} +% \end{macrocode} +% \begin{macrocode} + \def\sf@if@position@top{% + \@ifundefined{if\@captype topcap}% + {\@gobbletwo}% + {\@nameuse{if\@captype topcap}% + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The supertabular and xtab packages} +% +% \begin{macrocode} +\caption@IfPackageLoaded{supertabular}[2002/07/19 v4.1e]{% +% \end{macrocode} +% +% \begin{macro}{\tablecaption} +% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work} +% \changes{v3.1h}{2008/04/01}{Bugfix: Star variant does not increment table counter anymore} +% Make |\topcaption*| and |\bottomcaption*| work. +% \begin{macrocode} + \renewcommand*\tablecaption{% + \caption@star + {\refstepcounter{table}}% + {\caption@dblarg{\@xtablecaption}}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xtablecaption} +% \changes{v3.1h}{2008/04/01}{Made \cs{nameref} \& \cs{autoref} work} +% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package} +% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added} +% Make |\nameref| and |\autoref| work. +% \begin{macrocode} + \let\caption@ORI@xtablecaption\@xtablecaption + \long\def\@xtablecaption[#1]#2{% + \caption@gettitle{#2}% + \caption@ORI@xtablecaption[{#1}]{#2}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ST@caption} +% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added} +% \changes{v3.1h}{2008/04/01}{Bugfix: \cs{@currentlabelname} will be set now} +% The original code: +% \begin{verbatim} +% \long\def\ST@caption#1[#2]#3{\par% +% \addcontentsline{\csname ext@#1\endcsname}{#1}% +% {\protect\numberline{% +% \csname the#1\endcsname}{\ignorespaces #2}} +% \begingroup +% \@parboxrestore +% \normalsize +% \if@topcaption \vskip -10\p@ \fi +% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par +% \if@topcaption \vskip 10\p@ \fi +% \endgroup} +% \end{verbatim}%^^A +% \begin{macrocode} + \long\def\ST@caption#1[#2]#3{\par% + \caption@settype*{#1}% + \caption@setoptions{supertabular}% +% \end{macrocode} +% The |position=| setting will be overwritten by the +% \package{supertabular} package: If |\topcaption| was used, +% the position will be |top| automatically, |bottom| otherwise. +% \begin{macrocode} + \caption@setposition{\if@topcaption t\else b\fi}% +% \end{macrocode} +% \begin{macrocode} + \caption@beginex{#1}{#2}{#3}% + \caption@parboxrestore + \caption@normalsize + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par + \caption@end}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \changes{v3.1h}{2008/04/01}{Support of the xtab package added} +% \begin{macrocode} +\caption@IfPackageLoaded{xtab}[2000/04/09 v2.3]{% +% \end{macrocode} +% +% \begin{macro}{\tablecaption} +% Make |\topcaption*| and |\bottomcaption*| work. +% \begin{macrocode} + \renewcommand*\tablecaption{% + \caption@star + {\refstepcounter{table}}% + {\caption@dblarg{\@xtablecaption}}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xtablecaption} +% \changes{v3.1l}{2010/01/09}{Adapted to current version of nameref package} +% \changes{v3.3}{2018/12/26}{Bugfix: Missing curly braces added} +% Make |\nameref| and |\autoref| work. +% \begin{macrocode} + \let\caption@ORI@xtablecaption\@xtablecaption + \long\def\@xtablecaption[#1]#2{% + \caption@gettitle{#2}% + \caption@ORI@xtablecaption[{#1}]{#2}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ST@caption} +% The original code: +% \begin{verbatim} +% \long\def\ST@caption#1[#2]#3{\par% +% \@initisotab +% \addcontentsline{\csname ext@#1\endcsname}{#1}% +% {\protect\numberline{% +% \csname the#1\endcsname}{\ignorespaces #2}}% +% \begingroup +% \@parboxrestore +% \normalsize +% %% \if@topcaption \vskip -10\p@ \fi +% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par +% %% \if@topcaption \vskip 10\p@ \fi +% \endgroup +% \global\advance\ST@pageleft -\PWSTcapht +% \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}} +% \end{verbatim}%^^A +% \begin{macrocode} + \long\def\ST@caption#1[#2]#3{\par% + \caption@settype*{#1}% + \caption@setoptions{xtabular}% +% \end{macrocode} +% \begin{macrocode} + \caption@set{position}{\if@topcaption t\else b\fi}% +% \end{macrocode} +% \begin{macrocode} + \@initisotab + \caption@beginex{#1}{#2}{#3}% + \caption@parboxrestore + \caption@normalsize + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par + \caption@end + \global\advance\ST@pageleft -\PWSTcapht + \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The threeparttable package} +% \changes{v3.1}{2007/05/08}{Support of the \package{threeparttable} package added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{threeparttable}[2003/06/13 v3.0]{% +% \end{macrocode} +% +% \begin{macro}{\threeparttable} +% \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined} +% Unfortunately |\@captype| is not set when |\TPT@common| will be used, +% so we have to redefine |\threeparttable| and |\measuredfigure| instead. +% \begin{macrocode} + \let\caption@ORI@threeparttable\threeparttable + \renewcommand*\threeparttable{% + \caption@settype{\@ifundefined{@captype}{table}{\@captype}}% +%%% \caption@setposition{auto}% ? + \caption@clearmargin + \caption@setoptions{threeparttable}% + \caption@ORI@threeparttable}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\measuredfigure} +% \changes{v3.3}{2016/01/31}{Bugfix: \cs{@captype} will be used if already defined} +% Same here\ldots +% \begin{macrocode} + \let\caption@ORI@measuredfigure\measuredfigure + \renewcommand*\measuredfigure{% + \caption@settype{\@ifundefined{@captype}{figure}{\@captype}}% +%%% \caption@setposition{auto}% ? + \caption@clearmargin + \caption@setoptions{measuredfigure}% + \caption@ORI@measuredfigure}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TPT@caption} +% The original code: +% \begin{verbatim} +% \def\TPT@caption#1[#2]#3{\gdef\TPT@docapt +% {\par\global\let\TPT@docapt\@undefined \TPT@LA@caption{#1}[{#2}]% +% {\strut\ignorespaces#3\ifhmode\unskip\@finalstrut\strutbox\fi}}% +% \ifx\TPT@hsize\@empty \let\label\TPT@gatherlabel \abovecaptionskip\z@skip +% \else \TPT@docapt \fi \ignorespaces} +% \end{verbatim}%^^A +% \begin{macrocode} + \def\TPT@caption#1[#2]#3{% + \gdef\TPT@docapt{% + \global\let\TPT@docapt\@undefined + \caption@setautoposition\caption@TPT@position + \TPT@LA@caption{#1}[{#2}]{#3}}% + \ifx\TPT@hsize\@empty + \let\label\TPT@gatherlabel % Bug: does not work for measuredfigures + \gdef\caption@TPT@position{t}% + \g@addto@macro\TPT@docapt\caption@TPT@eatvskip + \else + \def\caption@TPT@position{b}% + \TPT@docapt + \fi + \ignorespaces}% +% \end{macrocode} +% \begin{macrocode} + %\newcommand*\caption@TPT@eatvskip{\vskip-.2\baselineskip}% + \def\caption@TPT@eatvskip#1\vskip{#1\@tempdima=}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The wrapfig package} +% \changes{v3.1}{2007/05/05}{Support of the \package{wrapfig} package added} +% \changes{v3.2d}{2011/11/02}{Support of the \package{wrapfig} package rewritten} +% +% \begin{macrocode} +\caption@IfPackageLoaded{wrapfig}[2003/01/31 v3.6]{% +% \end{macrocode} +% +% \begin{macro}{\wrapfloat} +% \changes{v3.2d}{2011/11/02}{Redefinition of this macro added} +% First of all we make the \package{wrapfig} package independent from the package +% load order regarding the \package{float} package. +% Since the usage of |\@float@set|\-|every| is missing in the code of the \package{wrapfig} +% package (it should be in the redefinition of |\float@re|\-|style|, right after +% |\@nameuse{fst@#1}|), we don't use it here, too, +% especially since |\wrap|\-|float| will usually not be used when used with re-styled floats. +% \begin{macrocode} + \renewcommand*\wrapfloat[1]{% + \def\@captype{#1}% + \@ifundefined{fst@#1}{}{% + \@nameuse{fst@#1}% +% \@float@setevery{#1}% + \def\WF@floatstyhook{\let\@currbox\WF@box + \global\setbox\WF@box\float@makebox{\wd\WF@box}}}% + \@ifnextchar[\WF@wr{\WF@wr[]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\WF@rapt} +% \changes{v3.2d}{2011/11/02}{Usage of \cs{WF@captionstyhook} added} +% Original code: +% \begin{verbatim} +% \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width, +% \gdef\WF@ovh{#1}% hold overhang for later, when \width is known +% \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}% +% \ifdim\hsize>\z@ \@parboxrestore \else +% \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption +% \ignorespaces \fi} +% \end{verbatim}%^^A +% Our code has |\WF@captionstyhook| in addition: +% \begin{macrocode} + \def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width, + \gdef\WF@ovh{#1}% hold overhang for later, when \width is known + \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}% + \expandafter\WF@captionstyhook\expandafter{\@captype}% <= new + \ifdim\hsize>\z@ \@parboxrestore \else + \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption + \ignorespaces \fi}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\WF@captionstyhook} +% \changes{v3.2d}{2011/11/02}{This macro added} +% \changes{v3.2e}{2011/11/10}{Bugfix 11-11-09: float package support fixed} +% We place our \package{hyperref} anchor here, apply the `wrap' options etc. +% Since the usage of |\@float@set|\-|every| is missing in the \package{wrapfig} +% package we will catch it up here for making the necessary adaptions to the +% \package{float} package. +% \begin{macrocode} + \def\WF@captionstyhook#1{% + \let\@captype\@undefined + \@ifundefined{fst@#1}{}{\@float@setevery{#1}}% + \caption@settype{#1}% + \caption@clearmargin +%%% \caption@setoptions{wrap}% + \caption@setoptions{wrap#1}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \section{That's all Folks!} +% +% Execute the code declared with |\After|\-|Caption|\-|Package|. +% +% \begin{macrocode} +\caption@endtitles@code +\let\caption@endtitles@code\@undefined +\let\AfterCaptionPackage\@firstofone +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \clearpage +% \begin{thebibliography}{99} +% \bibitem{float} +% Anselm Lingnau:\\ +% \href{http://www.ctan.org/pkg/float}% +% {\emph{An Improved Environment for Floats}},\\ +% 2001/11/08 +% +% \bibitem{floatflt} +% Mats Dahlgren:\\ +% \href{http://www.ctan.org/pkg/floatflt}% +% {\emph{Welcome to the floatflt package}},\\ +% 1998/06/05 +% +% \bibitem{floatrow} +% Olga Lapko:\\ +% \href{http://www.ctan.org/pkg/floatrow}% +% {\emph{The floatrow package documentation}},\\ +% 2009/08/02 +% +% \bibitem{fltpage} +% Sebastian Gross:\\ +% \href{http://www.ctan.org/pkg/fltpage}% +% {\emph{Welcome to the beta test of fltpage package!}},\\ +% 1998/11/13 +% +% \bibitem{hyperref} +% Sebastian Rahtz \& Heiko Oberdiek:\\ +% \href{http://www.ctan.org/pkg/hyperref}% +% {\emph{Hypertext marks in \LaTeX: a manual for hyperref}},\\ +% November 2012 +% +% \bibitem{hypcap} +% Heiko Oberdiek:\\ +% \href{http://www.ctan.org/pkg/oberdiek}% +% {\emph{The hypcap package -- Adjusting anchors of captions}},\\ +% 2011/02/16 +% +% \bibitem{listings} +% Carsten Heinz \& Brooks Moses:\\ +% \href{http://www.ctan.org/pkg/listings}% +% {\emph{The Listings Package}},\\ +% 2007/02/22 +% +% \bibitem{longtable} +% David Carlisle:\\ +% \href{http://www.ctan.org/pkg/longtable}% +% {\emph{The longtable package}},\\ +% 2004/02/01 +% +% \bibitem{picinpar} +% Friedhelm Sowa:\\ +% \href{http://www.ctan.org/pkg/picinpar}% +% {\emph{Pictures in Paragraphs}},\\ +% July 13, 1993 +% +% \bibitem{picins} +% Joachim Bleser and Edmund Lang:\\ +% \href{http://www.ctan.org/pkg/picins}% +% {\emph{PicIns-Benutzerhandbuch Version 3.0}},\\ +% September~1992 +% +% \bibitem{rotating} +% Sebastian Rahtz and Leonor Barroca:\\ +% \href{http://www.ctan.org/pkg/rotating}% +% {\emph{A style option for rotated objects in \LaTeX}},\\ +% 1997/09/26 +% +% \bibitem{sidecap} +% Rolf Niepraschk \& Hubert G\"a\ss lein:\\ +% \href{http://www.ctan.org/pkg/sidecap}% +% {\emph{The sidecap package}},\\ +% 2003/06/06 +% +% \bibitem{subfigure} +% Steven D. Cochran:\\ +% \href{http://www.ctan.org/pkg/subfigure}% +% {\emph{The subfigure package}},\\ +% 2005/03/15 +% +% \bibitem{subfig} +% Steven D. Cochran:\\ +% \href{http://www.ctan.org/pkg/subfig}% +% {\emph{The subfig package}},\\ +% 2005/07/05 +% +% \bibitem{supertabular} +% Johannes Braams and Theo Jurriens:\\ +% \href{http://www.ctan.org/pkg/supertabular}% +% {\emph{The supertabular environment}},\\ +% 2004/02/20 +% +% \bibitem{threeparttable} +% Donald Arseneau:\\ +% \href{http://www.ctan.org/pkg/threeparttable}% +% {\emph{Three part tables: title, tabular environment, notes}},\\ +% March 5, 2010 +% +% \bibitem{wrapfig} +% Donald Arseneau:\\ +% \href{http://www.ctan.org/pkg/wrapfig}% +% {\emph{WRAPFIG.STY ver 3.6}},\\ +% Jan 31, 2003 +% +% \bibitem{xtab} +% Peter Wilson:\\ +% \href{http://www.ctan.org/pkg/xtab}% +% {\emph{The xtab package}},\\ +% 2011/07/31 +% \end{thebibliography} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \clearpage +% \Finale +% +\endinput diff --git a/macros/latex/contrib/caption/fallback/v3.5/caption3.dtx b/macros/latex/contrib/caption/fallback/v3.5/caption3.dtx new file mode 100644 index 0000000000..5918f4a540 --- /dev/null +++ b/macros/latex/contrib/caption/fallback/v3.5/caption3.dtx @@ -0,0 +1,4680 @@ +% \iffalse meta-comment +% +% This is file `caption3.dtx'. +% +% Copyright (C) 1994-2020 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, caption-light.dtx, caption2.dtx, caption3.dtx, +% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx, +% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx, +% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, +% the derived files +% caption.sty, caption-light.sty, caption2.sty, caption3.sty, +% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto, +% caption-koma.sto, caption-memoir.sto, caption-ntg.sto, +% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty, +% and the user manuals +% caption-deu.tex, caption-eng.tex, caption-rus.tex. +% +% \fi +% \CheckSum{3674} +% +% \iffalse +%<*driver> +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesFile{caption3.drv}[2020/10/11 v2.2 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} +% +\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{caption3}[2020/09/12] +% +\DeclareRobustCommand*\eTeX{\texorpdfstring + {\leavevmode\hbox{$\varepsilon$}-\TeX}% + {e-TeX}} +% +\begin{document} + \DocInput{caption3.dtx} +\end{document} +% +% \fi +% +% \def\thispackage{the \package{caption} kernel} +% \def\Thispackage{The \package{caption} kernel} +% +% \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 +% +% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} +% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} +% \newcommand*\version[2][]{v$#2$} +% +% \GetFileInfo{caption3.drv} +% \let\docdate\filedate +% \let\docversion\fileversion +% \GetFileInfo{caption3.sty} +% +% \title{The Implementation of +% \texorpdfstring{\thispackage\thanks{%^^A +% This package has version number \docversion.}}%^^A +% {the caption kernel}} +% \author{Axel Sommerfeldt\\ +% \url{https://gitlab.com/axelsommerfeldt/caption}} +% \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} +% +% \section*{Internal commands} +% +% These internal commands are save to use by other packages as well +% since their interface will not change in future releases: +% \begin{quote}\begin{tabular}{ll} +% Internal command & Currently used by \\ +% \hline +% |\caption@addcontentsline| & \package{floatrow} \\ +% |\caption@fnun| & \package{floatrow} \\ +% |\caption@ifinlist| & \package{floatrow} \\ +% |\caption@iftop| & \package{keyfloat}, \package{subfig} \\ +% |\caption@make| & \package{subfig} \\ +% |\caption@@make| & \package{floatrow} \\ +% |\caption@setautoposition| & \package{bidi} \\ +% |\caption@setoptions| & \package{floatrow} \\ +% |\caption@setposition| & \package{floatrow} \\ +% |\caption@switchdefault| & \emph{none} \\ +% \end{tabular}\end{quote} +% +% If your package wants to use any other internal command of the \package{caption3} package, +% please write me an e-mail so we can define a proper interface together. +% +% Unfortunately these internal commands are used by other packages and therefore will likely +% not change in the future, too, but I do not support them (and maybe I will change them anyway +% and patch the other package on-the-fly instead, at least if it's unmaintained): +% \begin{quote}\begin{tabular}{ll} +% Internal command & Currently used by \\ +% \hline +% |\caption@hangindent | & \package{bidi} \\ +% |\caption@@@make| & \package{floatrow} \\ +% |\caption@@par| & \package{bidi} \\ +% |\caption@parindent| & \package{bidi} \\ +% |\caption@set@bool| & \package{floatrow} \\ +% |\caption@setfont| & \package{floatrow} \\ +% |\caption@setkeys| & \package{floatrow} \\ +% |\caption@setstyle*| & \package{floatrow} \\ +% \hline +% |\caption@hj@|\meta{name} & \package{floatrow} \\ +% |\caption@lsep@|\meta{name} & \package{floatrow} \\ +% |\caption@lsep@default| & \package{babel-hungarian} \\ +% |\caption@sty@|\meta{name} & \package{floatrow} \\ +% \end{tabular}\end{quote} +% +% Furthermore the \package{floatrow} package uses the undocumented option +% |position=a| (as abbreviation of |position=auto|). +% +% The \package{lwarp} package uses a lot of internal commands as well, +% but we are working on it on the Git branch \texttt{feature/lwarp}: +% \url{https://gitlab.com/axelsommerfeldt/caption/-/tree/feature/lwarp} +% +% \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 +% +% \iffalse +%<*package> +% \fi +% +% \section{Identification} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{caption3}[2020/10/26 v2.2f caption3 kernel (AR)] +% \end{macrocode} +% +% \section{Generic helpers} +% +% \begin{macro}{\@nameundef} +% |\@nameundef|\marg{command name}\\ +% is the opposite to |\@name|\-|def| 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 |\caption|\-|setup|\oarg{type}. +% \begin{macrocode} +\providecommand*\@nameundef[1]{% + \expandafter\let\csname #1\endcsname\@undefined} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\l@addto@macro} +% \changes{v1.5}{2013/04/26}{Revised} +% \changes{v2.0}{2019/09/11}{Relies on \eTeX{} now} +% |\l@addto@macro|\marg{command}\marg{code}\\ +% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which +% globally adds tokens to existing macros, like in |\AtBeginDocument|. +% This one is the same but it works locally, not globally. +% \begin{macrocode} +\providecommand\l@addto@macro[2]{% + \edef#1{\unexpanded\expandafter{#1#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bothIfFirst} +% \changes{v2.2}{2020/09/21}{Usage of \cs{caption@prepare@bothif} added} +% \begin{macro}{\bothIfSecond} +% \changes{v2.2}{2020/09/21}{Usage of \cs{caption@prepare@bothif} added} +% |\bothIfFirst|\marg{code no. 1}\marg{code no. 2}\\ +% |\bothIfSecond|\marg{code no. 1}\marg{code no. 2}\\ +% |\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{\caption@bothif{#1}{#1#2}} +% \end{macrocode} +% \begin{macrocode} +\def\bothIfSecond#1#2{\caption@bothif{#2}{#1#2}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@bothif[2]{% + \begingroup + \caption@prepare@bothif + \protected@xdef\caption@tempa{#1}% + \endgroup + \ifx\caption@tempa\@empty \else + #2% + \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@prepare@bothif} +% \changes{v2.2}{2020/09/21}{This macro added} +% |\caption@prepare@bothif|\\ +% re-defines anything which could disturb either |\both|\-|If|\-|First| or |\both|\-|If|\-|Second| check. +% \begin{macrocode} +\providecommand*\caption@prepare@bothif{} +\g@addto@macro\caption@prepare@bothif{% + \let\inputencoding\@gobble} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifundefined} +% \changes{v1.3a}{2011/08/12}{This macro added} +% \changes{v1.3b}{2011/08/18}{Made expandable} +% |\caption@ifundefined|\marg{command}\marg{yes-code}\marg{no-code}\\ +% is similar to \cs{@ifundefined} offered by the \LaTeX kernel, +% but takes a command as argument instead of a command name. +% \begin{macrocode} +\newcommand*\caption@ifundefined[1]{% + \ifdefined#1% + \ifx#1\relax + \expandafter\expandafter\expandafter\@firstoftwo + \else + \expandafter\expandafter\expandafter\@secondoftwo + \fi + \else + \expandafter\@firstoftwo + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifdefined} +% \changes{v1.8e}{2018/05/11}{This macro added} +% |\caption@ifdefined|\marg{command}\marg{yes-code}\marg{no-code}\\ +% is similar to \cs{@ifundefined} offered by the \LaTeX kernel, +% but takes a command as argument instead of a command name. +% \begin{macrocode} +\newcommand*\caption@ifdefined[1]{% + \ifdefined#1% + \ifx#1\relax + \expandafter\expandafter\expandafter\@secondoftwo + \else + \expandafter\expandafter\expandafter\@firstoftwo + \fi + \else + \expandafter\@secondoftwo + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifinlist} +% \changes{v1.1}{2007/07/29}{Rewritten} +% |\caption@ifinlist|\marg{element}\marg{list}\marg{yes-code}\marg{no-code}\\ +% This helper command checks if the \meta{element} is in the comma separated +% \meta{list}. So for example +% \begin{quote} +% |\caption@ifinlist{frank}{axel,frank,olga,steven}{yes}{no}| +% \end{quote} +% would expand to |yes|.\par +% (Note: Since this command is used by the \package{floatrow} package as well +% its syntax should not change.) +% \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{element}\marg{yes-code}\marg{no-code}\\ +% is the same as |\caption@ifinlist| but with a command (containing a list) +% instead of the list itself. +% \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{element}\\ +% adds an element to a command containing a list. +% (The command will get defined if it isn't defined yet.) +% \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{element}\\ +% is the same as |\caption@g@addto@list| but works locally. +% \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{element}\\ +% removes an element from a command containing a list. +% \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@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{element}\\ +% is the same as |\caption@g@removefrom@list| but works locally. +% \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}\\ +% iterates all elements of the list (within \meta{cmd}) using the given +% \meta{code}. +% \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{yes-code}\marg{no-code}\\ +% This helper command checks if the list (within \meta{cmd}) is empty. +% \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} +% \changes{v1.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added} +% \begin{macro}{\caption@ifbool} +% \changes{v1.1}{2020/08/02}{\cs{caption@if@bool}\marg{value} added} +% \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@if@bool{#2}{\let#1\@firstoftwo}{\let#1\@secondoftwo}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@if@bool[1]{% + \caption@ifinlist{#1}{1,true,yes,on}% + {\@firstoftwo}% + {\caption@ifinlist{#1}{0,false,no,off}% + {}% + {\caption@Error{Undefined boolean value `#1'}}% + \@secondoftwo}} +% \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} +% +% \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}\\ +% expands \meta{cmd} with either argument \marg{star-arg} or +% \meta{non-star-arg}, depending on if the next char is a star (or not).\par +% |\caption@teststar@|\marg{cmd}\marg{star-arg}\marg{non-star-arg}\\ +% will test the catcode of the character \@ additionally. +% \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} +% \end{macro} +% +% \begin{macro}{\caption@ifatletter} +% \changes{v1.1e}{2007/10/28}{This macro added} +% |\caption@ifatletter|\marg{yes-code}\marg{no-code}\\ +% will either expand \meta{yes-code} or \meta{no-code}, +% depending on the catcode of the character \@. +% \begin{macrocode} +\newcommand*\caption@ifatletter{% + \ifnum\the\catcode`\@=11 + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +% \end{macrocode} +% \begin{macrocode} +\AtBeginDocument{\let\caption@ifatletter\@secondoftwo} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@withoptargs} +% \changes{v1.1}{2007/08/12}{This macro added} +% \changes{v1.5}{2012/04/09}{This macro revised} +% |\caption@withoptargs|\marg{cmd}\\ +% collects a star and all optional arguments, and expands \meta{cmd} +% afterwards with the collected stuff as first argument. +% \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{% + \def\caption@tempb{#1}% + \expandafter\caption@tempb\expandafter{\caption@tempa}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@gobble} +% \changes{v1.4}{2011/08/19}{This macro added} +% |\caption@gobble*|\oarg{arg}\oarg{\ldots}\marg{arg}\\ +% is similar to |\@gobble| but gobbles a star and optional arguments as well. +% \begin{macrocode} +\DeclareRobustCommand*\caption@gobble{% + \caption@withoptargs\@gobbletwo} +% \end{macrocode} +% \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}\\ +% is similar to |\AtBeginDocument| but the execution of code will be +% surrounded by two |\Package|\-|Info|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} +% +% \section{Information, Warnings, and Errors} +% +% \begin{macro}{\caption@Info} +% \changes{v1.3}{2010/10/25}{Moved from package to kernel} +% |\caption@Info|\marg{message}\\ +% issues an info message (with code line indication). +% \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}\\ +% issues an info message without code line indication. +% \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]{% + \caption@Info{#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}\\ +% issues a warning message (with code line indication). +% \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}\\ +% issues a warning message without code line indication. +% \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} +% \changes{v2.2a}{2020/09/28}{\cs{caption@eh} renamed to \cs{caption@@eh} and revised} +% |\caption@Error|\marg{message}\\ +% issues an error message (with code line indication). +% \begin{macrocode} +\newcommand*\caption@Error[1]{% + \PackageError{caption}{#1}{\caption@@eh{caption}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@eh[1]{% + If you do not understand this error, please take a closer look\MessageBreak + at the documentation of the `#1' 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} +% |\caption@KV@err|\marg{message}\\ +% will be used to issue an error while parsing the key-value (package) +% options. +% \begin{macrocode} +\let\caption@KV@err\caption@Error +% \end{macrocode} +% \end{macro} +% +% \section{Using the keyval package} +% +% We need the \package{keyval} package for option handling, so we load it here.\par +% \emph{TODO:} Use some recent stuff instead, for example kvdefinekey and kvsetkeys. +% \begin{macrocode} +\RequirePackage{keyval}[1997/11/10] +% \end{macrocode} +% +% \begin{macro}{\undefine@key} +% |\undefine@key|\marg{family}\marg{key}\\ +% 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}\\ +% marks a keyval definition only valid in the document preamble, analogous to +% |\@only|\-|preamble| 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}\\ +% We declare our options using these commands (instead of using +% |\Declare|\-|Option| 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 |\use|\-|package|, but +% \emph{not} with |\caption|\-|setup| 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}}\caption@declare@option{#2}} +\@onlypreamble\caption@declareoption +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declare@option{% + \define@key{caption}} +%% no \@onlypreamble\caption@declare@option since it will be used by \captionsetup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareCaptionOptionNoValue} +% \changes{v1.1c}{2007/10/06}{This macro added} +% |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\\ +% is the same as |\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 |\caption|\-|setup| is used, this will be set to |true|. +% (It will be reset to |false| at the end of |\caption@set|\-|keys|.) +% \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} +% \changes{v1.5}{2012/04/09}{Support of multiple optional arguments added} +% \changes{v1.8h}{2020/01/03}{Syntax check of saved options added} +% |\captionsetup*|\oarg{type}\ldots\marg{keyval-list of options}\\ +% applies the given list of options. +% If the optional argument `type' is specified, we simply save or append +% the option list, otherwise we `execute' it with |\set|\-|keys|. +% (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]{% + \@ifnextchar[%] + {\caption@stepthecounter + \caption@withoptargs{\@expandtwoargs + \caption@setup@options@i{#1}{@\caption@thecounter}}}% + {\caption@setup@options@{#1}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@setup@options@i[4]{% + \caption@declare@option{#2}[]{\captionsetup#3{#4}}% + \caption@setup@options@{#1}{#2}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@setup@options@[2]{% + \@bsphack + \ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi + \caption@checkoptions{#2}% + \expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}% + \@esphack} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@checkoptions} +% \changes{v1.8h}{2020/01/03}{This macro added} +% |\caption@checkoptions|\marg{keyval-list of options}\\ +% checks the syntax of the given options by executing them inside a group. +% \begin{macrocode} +\newcommand*\caption@checkoptions[1]{% + \begingroup + \caption@prepare@optioncheck + \caption@setup{#1}% + \endgroup} +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@prepare@optioncheck{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IfCaptionOptionCheck} +% \changes{v1.10}{2020/05/10}{This macro added} +% |\IfCaptionOptionCheck|\marg{yes-code}\marg{no-code}\\ +% executes the \meta{yes-code} if options are just checked for syntax, +% and \meta{no-code} if not. +% \begin{macrocode} +\let\IfCaptionOptionCheck\@secondoftwo +% \end{macrocode} +% \begin{macrocode} +\g@addto@macro\caption@prepare@optioncheck{% + \let\IfCaptionOptionCheck\@firstoftwo} +% \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}\\ +% 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'}}} +% \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}\\ +% shows the saved option list which is associated with \meta{type} +% (as warning message). +% \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} +% \changes{v1.4b}{2012/01/12}{Option \opt{options*=} removed} +% \begin{macrocode} +\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} +% \changes{v1.4b}{2012/01/12}{Starred variant removed} +% |\caption@setoptions|\marg{type or environment or\ldots}\\ +% applies caption options which have been saved with |\caption|\-|setup|\oarg{type}. +% To prevent multiple application the list will be cleared (locally) afterwards. +% \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} +% +% \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}\\ +% 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} +% \changes{v1.4}{2011/08/24}{Redefinition of \cs{XKV@err} added} +% |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\\ +% expands to |\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\csname ORI@XKV@err\caption@keydepth\endcsname\XKV@err + \edef\caption@keydepth{\caption@keydepth i}% +% \end{macrocode} +% \begin{macrocode} + \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 + \def\KV@errx{\KV@err}% + \def\XKV@err{\let\@tempa\XKV@tkey\KV@err}% +% \end{macrocode} +% \begin{macrocode} + \caption@Debug{\noexpand\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 + \expandafter\let\expandafter\XKV@err\csname ORI@XKV@err\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-value options}\\ +% applies the given options using the keyval interface, so we use this one +% instead of |\Execute|\-|Options| 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}{Starred variant added} +% |\caption@ProcessOptions*|\marg{package}\\ +% processes the given options using the keyval package, so we use this one +% instead of |\Process|\-|Options| offered by \LaTeXe. +% The starred variant does not process the global options. +% (This code was taken from the \package{hyperref} package\cite{hyperref} +% \version{6.74} and modified.) +% \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}\\ +% After application of this command |\caption@Execute|\-|Options| and +% |\use|\-|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@SetupOptions[2]{% + \@namedef{caption@setkeys@#1}##1##2{#2}% + \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname + \@cons\caption@SetupOptions@list{{#1}}} +\@onlypreamble\caption@SetupOptions +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@SetupOptions@list{} +\@onlypreamble\caption@SetupOptions@list +% \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@SetupOptions@list + \@tempa} +\@onlypreamble\caption@onefilewithoptions +% \end{macrocode} +% \end{macro} +% +% \section{Declaring and setting key values} +% +% \begin{macro}{\caption@decl} +% \changes{v2.0}{2019/09/10}{This macro added} +% |\caption@decl|\oarg{command}\marg{option}\marg{name}\\ +% is used for declaring boxes, fonts, formats etc. +% (It defines |\caption@|\meta{option}|@|\meta{name} +% using the given \meta{command}.) +% \begin{macrocode} +\newcommand*\caption@decl[3][\def]{% + \global\long\expandafter#1\csname caption@#2@#3\endcsname} +\@onlypreamble\caption@decl +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifdecl} +% \changes{v2.0}{2019/09/10}{This macro added} +% |\caption@ifdecl|\marg{option}\marg{name}\marg{yes-code}\marg{no-code}\\ +% checks if the given \meta{option} and \meta{name} combination is +% already declared. +% \begin{macrocode} +\newcommand*\caption@ifdecl[2]{% + \@ifundefined{caption@#1@#2}\@secondoftwo\@firstoftwo} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@checkdecl} +% \changes{v2.0}{2019/09/10}{This macro added} +% |\caption@checkdecl|\marg{option}\marg{name}\marg{yes-code}\\ +% behaves similar to |\caption@if|\-|decl| but issues an error message if the +% given \meta{option} plus \meta{name} is not defined. +% \begin{macrocode} +\newcommand*\caption@checkdecl[2]{% + \caption@ifdecl{#1}{#2}% + \@firstofone + {\caption@Error{Undefined #1 `#2'}% + \@gobble}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@set} +% \changes{v2.0}{2019/09/10}{This macro added} +% \changes{v2.0}{2020/07/26}{Uses \cs{def} instead of \cs{let} internally} +% |\caption@set|\marg{option}\marg{name}\\ +% sets the declared \meta{option} to \meta{name}, for example +% |label|\-|format| to |simple|. +% Note that since version \version{2.0} future changes to \meta{name} +% (via |\caption@decl|) will effect the outcome, +% for example |\caption@decl{labelformat}{simple}\ldots| will not only change +% the definition of the label format |simple| but also effect the current +% label format if set to |simple| (via |\caption@set|). +% \begin{macrocode} +\newcommand*\caption@set{% + \caption@maparg\caption@@set}% +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@set[3]{% + \caption@checkdecl{#1}{#3}{% +% \expandafter\edef\csname caption@@#2\endcsname{#3}% could be used for debugging + \expandafter\def\csname caption@#2\expandafter\endcsname\expandafter{\csname caption@#1@#3\endcsname}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SetCaptionDefault} +% \changes{v2.0}{2019/09/10}{This macro added} +% \changes{v2.0}{2020/07/28}{Check for `default' added to prevent infinite loop} +% |\SetCaptionDefault*|\marg{option}\marg{name}\\ +% sets the default value for the \meta{option}. +% The starred variant is only relevant for setting default values for lengths +% like |margin|. (See definition of |\caption@set|\-|default@length| for +% details.) +% \begin{macrocode} +\newcommand*\SetCaptionDefault{% + \caption@teststar\caption@setdefault\def\edef} +\@onlypreamble\SetCaptionDefault +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@setdefault[2]{% + \@ifundefined{caption@setdefault@#2}% + {\caption@maparg\caption@@setdefault}% + {\@nameuse{caption@setdefault@#2}{#1}}% + {#2}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setdefault[3]{% + \caption@ifdefault{#3}% + {\caption@Error{Invalid argument for \string\SetCaptionDefault: `#3'}}% would cause an infinite loop otherwise + {\caption@@set{#1}{#2@default}{#3}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifdefault} +% \changes{v2.0}{2020/08/23}{This macro added} +% |\caption@ifdefault|\marg{value}\marg{yes-code}\marg{no-code}\\ +% expands to \meta{yes-code} if the \meta{value} expands to `default', +% and to \meta{no-code} otherwise. +% \begin{macrocode} +\newcommand*\caption@ifdefault{\caption@ifequal{default}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@ifequal[2]{% + \edef\caption@tempa{#1}% + \edef\caption@tempb{#2}% + \ifx\caption@tempa\caption@tempb + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setmapping} +% \changes{v2.0}{2020/08/23}{This macro added} +% |\caption@setmapping|\marg{source option}\marg{destination option}\\ +% sets a mapping from the \meta{source option} to the +% \meta{destination option}, for example |label|\-|font| to |font| +% since |label|\-|font| does not have any own definitions but shares +% them with |font|. +% \begin{macrocode} +\newcommand*\caption@setmapping[2]{% + \@namedef{caption@map@#1}{#2}} +\@onlypreamble\caption@setmapping +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@maparg} +% \changes{v2.0}{2020/08/23}{This macro added} +% |\caption@maparg|\marg{command}\marg{option}\\ +% similar to |\@dblarg| but either duplicates the given \meta{option} or +% expands it to \meta{destination option} plus \meta{option} if a mapping +% was defined for the given option (via |\caption@set|\-|mapping|). +% \begin{macrocode} +\newcommand*\caption@maparg[2]{% + \@ifundefined{caption@map@#2}% + {#1{#2}}% + {#1{\csname caption@map@#2\endcsname}}% + {#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@switchdefault} +% \changes{v2.0}{2020/08/01}{This macro added} +% |\caption@switchdefault\marg{option}|\marg{code with \#1}\marg{name}\\ +% like |\Set|\-|Caption|\-|Default| but first expands the given code with the +% to-be-overwritten internal command as argument, so it can be stored (and +% restored later on). +% The main purpose of this command is switching default settings in +% \package{babel} language packages, e.g.: +% \begin{quote}|\caption@switchdefault{labelfont}{\babel@save #1}{sc}|\end{quote} +% \begin{macrocode} +\def\caption@switchdefault#1#2{% + \def\caption@tempa##1{#2}% + \expandafter\caption@tempa\csname caption@#1@default\endcsname + \caption@setdefault\def{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@restoredefault} +% \changes{v2.0}{2020/08/01}{This macro added} +% |\caption@restoredefault\marg{option}|\marg{command}\\ +% restores a default setting which was stored to \meta{command} before +% (via |\caption@switch|\-|default|). +% \begin{macrocode} +\def\caption@restoredefault#1#2{% + \caption@checkdecl{#1}{default}{% + \caption@ifdefined#2{% + \expandafter\let\csname caption@#1@default\endcsname#2% + \let#2\@undefined}{}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SetCaptionFallback} +% \changes{v2.2}{2020/09/21}{This macro added} +% |\SetCaptionFallback|\marg{option}\marg{name}\\ +% sets the fallback value for the \meta{option}. +% \begin{macrocode} +\newcommand*\SetCaptionFallback{% + \caption@maparg\caption@@setfallback} +\@onlypreamble\SetCaptionFallback +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setfallback[3]{% + \caption@ifequal{fallback}{#3}% + {\caption@Error{Invalid argument for \string\SetCaptionFallback: `#3'}}% would cause an infinite loop otherwise + {\caption@@set{#1}{#2@fallback}{#3}}} +\@onlypreamble\caption@@setfallback +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@decl@package} +% \changes{v2.0}{2020/07/26}{This macro added} +% |\caption@decl@package|\marg{option}\marg{cmd}\oarg{package}\marg{name}\ldots\\ +% Helper command to declare a caption package option value which is dependent +% on the existence of a specific package, for example the |font| value +% |one|\-|half|\-|spacing| which is dependent on the \package{setspace} +% package. +% \begin{macrocode} +\newcommand*\caption@decl@package[2]{% + \@ifnextchar[%] + {\caption@declare@package{#1}{#2}}% + {\caption@declarepackage{#1}{#2}}} +\@onlypreamble\caption@decl@package +% \end{macrocode} +% \begin{macrocode} +\def\caption@declare@package#1#2[#3]#4{% + \global\@namedef{caption@#1@#4@package}{#3}% + #2{#4}} +\@onlypreamble\caption@declare@package +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declarepackage[3]{% + \global\@nameundef{caption@#1@#3@package}% + #2{#3}} +\@onlypreamble\caption@declarepackage +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@load@package} +% \changes{v2.0}{2020/07/26}{This macro added} +% |\caption@load@package|\marg{option}\marg{value}\\ +% If the given option value needs a package, it will be loaded automatically. +% \begin{macrocode} +\newcommand*\caption@load@package[2]{% + \expandafter\let\expandafter\caption@tempa\csname caption@#1@#2@package\endcsname + \caption@ifdefined\caption@tempa + {\caption@requirepackage\caption@tempa{#1=#2}}% + {}} +% \end{macrocode} +% \end{macro} +% +% \section{Declaring and setting lengths} +% +% \begin{macro}{\DeclareCaptionLength} +% \changes{v2.0}{2020/08/09}{This macro added} +% |\DeclareCaptionLength|\marg{name}\marg{default value}\\ +% \begin{enumerate} +% \item Defines a new length (dimension) +% \item Installes a hook for |\caption@set|\-|default| so +% |\caption@set|\-|default@length| will be used to set a default +% value for this length +% \item Sets a default value using |\Set|\-|Caption|\-|Default*|. +% \end{enumerate} +% \begin{macrocode} +\newcommand*\DeclareCaptionLength[1]{% + \expandafter\newdimen\csname caption#1\endcsname + \@namedef{caption@setdefault@#1}##1{% + \caption@setdefault@length{##1}}% + \SetCaptionDefault*{#1}} +\@onlypreamble\DeclareCaptionLength +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setdefault@length} +% \changes{v2.0}{2020/08/09}{This macro added} +% |\caption@setdefault@length*|\marg{cmd}\marg{name}\marg{value}\\ +% sets a default value for the given \meta{length}, either using |\def| +% (if the starred variant is used) or |\edef| (if the non-starred variant is +% used). +% \begin{macrocode} +\newcommand*\caption@setdefault@length[3]{% + \expandafter#1\csname caption#2@default\endcsname{#3}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setlength} +% \changes{v2.0}{2020/08/09}{This macro added} +% |\caption@setlength|\marg{name}\marg{value}\\ +% sets a length to either the given \meta{value} or to the default value if +% \meta{value} is `default'. +% \begin{macrocode} +\newcommand*\caption@setlength[2]{% + \caption@ifdefault{#2}% + {\expandafter\let\expandafter\caption@tempa\csname caption#1@default\endcsname}% + {\def\caption@tempa{#2}}% + \expandafter\setlength\csname caption#1\endcsname\caption@tempa} +% \end{macrocode} +% \end{macro} +% +% \section{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} of the \package{caption} package.\par +% Note that we can only set one value at a time, `margin' \emph{or} `width'. +% If |\caption|\-|width| is not zero we will take this value afterwards, +% otherwise |\caption|\-|margin| and |\caption|\-|margin@|. +% \begin{macrocode} +\DeclareCaptionLength{margin}{0pt} +\DeclareCaptionLength{margin@}{\the\captionmargin} +\DeclareCaptionLength{width}{0pt} +\newdimen\caption@tempdima +% \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} +\caption@set@bool\caption@iftwoside{\if@twoside 1\else 0\fi} +% \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}\\ +% sets the caption margin to the given \meta{amount}. +% 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{% + \caption@setlength{margin}{#1}% + \caption@setlength{margin@}{#2}% + \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}\\ +% sets the caption width to the given \meta{amount}. +% 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@}% + \caption@setlength{width}{#2}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setcalcmargin} +% \changes{v1.3}{2010/11/07}{This macro added} +% |\caption@setcalcmargin*|\marg{amount}\\ +% sets the caption margin to the given \meta{amount} +% right before the caption will be typeset, i.e.\meta{amount} will +% not be evaluated immediately. +% \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@resetcalcmargin} +% \changes{v1.3}{2010/11/07}{This macro added} +% |\caption@resetcalcmargin|\\ +% clears the value which was stored in |\caption@set|\-|calc|\-|margin|. +% \begin{macrocode} +\newcommand*\caption@resetcalcmargin{% + \let\caption@calcmargin@hook\@empty} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setcalcwidth} +% \changes{v1.3}{2010/11/07}{This macro added} +% |\caption@setcalcwidth*|\marg{amount}\\ +% sets the caption width to the given \meta{amount} +% right before the caption will be typeset, i.e.\meta{amount} will +% not be evaluated immediately. +% \begin{macrocode} +\newcommand*\caption@setcalcwidth{% + \caption@teststar{\caption@@setcalcmargin\caption@setwidth}% + \@secondoftwo\@firstoftwo} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@thecounter} +% \changes{v1.0n}{2007/04/03}{This counter added} +% \changes{v1.1e}{2007/10/28}{Renamed from \cs{caption@counter} to \cs{caption@thecounter}; \cs{caption@stepcounter} added} +% \changes{v1.5}{2012/04/09}{\cs{caption@stepcounter} renamed to \cs{caption@stepthecounter}} +% Internal counter. +% At the moment it will be used inside |\caption@if|\-|odd|\-|page| only. +% \begin{macrocode} +\newcommand*\caption@thecounter{0} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@stepthecounter{% + \@tempcnta\caption@thecounter + \advance\@tempcnta\@ne\relax + \xdef\caption@thecounter{\the\@tempcnta}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@newlabel} +% \changes{v1.0n}{2007/04/03}{This macro added} +% |\caption@newlabel|\marg{name}\marg{value}\\ +% This command is a modified version of |\new|\-|label| 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@if|\-|odd|\-|page|.) +% \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 |\the|\-|page| from \LaTeX2e. +% It will be used inside |\caption@if|\-|odd|\-|page| 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} +% |\caption@label|\marg{name}\\ +% This command is a modified version of |\label| from \LaTeX2e. +% It will be used inside |\caption@if|\-|odd|\-|page| and |\FP@help|\-|Note|. +% \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} +% |\caption@pageref|\marg{name}\\ +% This command is a modified version of |\page|\-|ref| from \LaTeX2e. +% It will be used inside |\caption@if|\-|odd|\-|page| and |\FP@help|\-|Note|. +% \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}} +% Currently this macro uses an own label\ldots ref mechanism, +% but an alternative implementation method would use the +% \package{refcount} package\cite{refcount} and +% |\ifodd\get|\-|page|\-|ref|\-|number{|\ldots|}|. +% Maybe we will change that in a later release. +% \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{command}\marg{off -or- value}\\ +% defines the given \meta{command} to \meta{value}, +% but if \meta{value} if `off' the given \meta{command} is undefined instead. +% \begin{macrocode} +\newcommand*\caption@setoptcmd[2]{% + \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}} +% \end{macrocode} +% \end{macro} +% +% \section{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} +\DeclareCaptionLength{@indent}{0pt} +\DeclareCaptionLength{@parindent}{0pt} +\DeclareCaptionLength{@hangindent}{0pt} +% \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 + \caption@setlength{@indent}{#1}} +\DeclareCaptionOption{indention}[\leftmargini]{% + \caption@setlength{@indent}{#1}} +\DeclareCaptionOption{parindent}{% + \caption@setlength{@parindent}{#1}} +\DeclareCaptionOption{hangindent}{% + \caption@setlength{@hangindent}{#1}} +\DeclareCaptionOption{parskip}{% + \l@addto@macro\caption@@par{\setlength\parskip{#1}}} +% \end{macrocode} +% +% \section{Styles} +% +% \begin{macro}{\DeclareCaptionStyle} +% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm} +% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now} +% \changes{v2.0}{2020/07/27}{\cs{caption@sls} renamed to \cs{caption@slsty}} +% |\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{% + \caption@decl{style}{#1}% + {\def\caption@slsty{#2}% + \def\caption@sty{#3}}% +% \end{macrocode} +% The \package{floatrow} package uses |\@if|\-|undefined{caption@sty@#1}| to +% determine in |\flrow@set|\-|style| if a caption style is defined or not. +% Since the \package{floatrow} package is unmaintained we fake the definition +% so the test will still work. +% \begin{macrocode} + \@namedef{caption@sty@#1}{\@unused}} +\@onlypreamble\caption@declarestyle +% \end{macrocode} +% \end{macro} +% +% \changes{v1.2a}{2008/01/20}{Option \opt{style*=} added} +% \begin{macrocode} +\DeclareCaptionOption{style}{\caption@setstyle{#1}} +\DeclareCaptionOption{style*}{\caption@setstyle*{#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} +% \changes{v2.0}{2019/09/10}{Uses \cs{caption@ifdecl} and \cs{caption@checkdecl} now} +% |\caption@setstyle*|\marg{name}\\ +% Selecting a caption style means saving the additional +% \meta{single-line-list-of-KV} (this will be done by |\caption@sl|\-|sty|), +% resetting the caption options to the base ones (this will be done using +% |\caption@reset|\-|style|) 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\caption@ifdecl\caption@checkdecl} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setstyle[2]{% + #1{style}{#2}% + {\caption@set{style}{#2}% + \caption@style % defines \caption@sty & \caption@slsty + \ifx\caption@setstyle@flag\@undefined + \let\caption@setstyle@flag\relax % prevent \caption@resetstyle if called recursively + \caption@resetstyle + \caption@xsetup\caption@sty + \let\caption@setstyle@flag\@undefined + \else + \caption@xsetup\caption@sty + \fi}% + {}} +% \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 \opt{size=} added} +% \changes{v1.2b}{2008/05/06}{Usage of \opt{rule} added} +% \changes{v1.5}{2012/03/15}{\opt{box=parbox} added} +% \changes{v1.6}{2013/05/01}{\opt{box=none} added, \opt{box=parbox} changed to \opt{parbox=parbox}} +% |\caption@resetstyle|\\ +% 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{% + box=none,boxcolor=white,parbox=parbox,% + format=plain,labelformat=default,labelsep=colon,textformat=simple,% + font=,labelfont=,textfont=,size=,% + justification=justified,slc,rule,strut,% + margin=0pt,minmargin=0,maxmargin=0,% + indent=0pt,parindent=0pt,hangindent=0pt}} +% \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}} +% \changes{v1.5}{2012/03/15}{\opt{box=default} added to 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 |\@make|\-|caption| +% 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]{% + box=default,% + format=default,labelformat=default,labelsep=default,textformat=default,% + font=default,labelfont=default,textfont=default,size=default,% + justification=default,slc=default,margin=default,% + indent=default,parindent=default,hangindent=default} +% \end{macrocode} +% +% \begin{macro}{\DeclareCaptionSinglelinecheck} +% \changes{v2.0}{2019/09/10}{This macro added} +% |\DeclareCaptionSinglelinecheck|\marg{name}\marg{code} +% \begin{macrocode} +\newcommand*\DeclareCaptionSinglelinecheck[2]{% + \caption@decl{singlelinecheck}{#1}{#2}} +\@onlypreamble\DeclareCaptionSinglelinecheck +% \end{macrocode} +% \end{macro} +% +% \changes{v1.2b}{2008/05/06}{Option \opt{slc=} added} +% \begin{macrocode} +\DeclareCaptionOption{singlelinecheck}[1]{\caption@setsinglelinecheck{#1}} +\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}} +% \end{macrocode} +% +% These are the pre-defined single-line-check code snippets. +% \begin{macrocode} +\DeclareCaptionSinglelinecheck{on}{\@firstoftwo} +\DeclareCaptionSinglelinecheck{off}{\@secondoftwo} +% \end{macrocode} +% +% `default' usually maps to `on'. +% \begin{macrocode} +\SetCaptionDefault{singlelinecheck}{on} +% \end{macrocode} +% +% \begin{macro}{\caption@setsinglelinecheck} +% \changes{v2.0}{2018/03/13}{This macro added} +% |\caption@setsinglelinecheck|\marg{value}\\ +% sets the single-line-check either on or off, +% where \meta{value} could be either a \meta{name} or boolean value. +% \begin{macrocode} +\newcommand*\caption@setsinglelinecheck[1]{% + \caption@ifdecl{singlelinecheck}{#1}% + {\caption@set{singlelinecheck}{#1}}% + {\caption@set@bool\caption@singlelinecheck{#1}}} +% \end{macrocode} +% \end{macro} +% +% \section{Boxes} +% +% \begin{macro}{\DeclareCaptionBox} +% \changes{v1.5}{2012/03/15}{This macro added} +% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now} +% \changes{v2.2f}{2020/10/26}{\cs{par} is now allowed as part of the \meta{code} argument} +% |\DeclareCaptionBox|\marg{name}\marg{code with \#1 and \#2} +% \begin{macrocode} +\newcommand\DeclareCaptionBox[2]{% + \caption@decl{box}{#1}##1##2{#2}} +\@onlypreamble\DeclareCaptionBox +% \end{macrocode} +% \end{macro} +% +% \changes{v1.5}{2012/03/15}{Option \opt{box=} added} +% \changes{v1.6}{2013/05/01}{Option \opt{parbox=} added} +% \begin{macrocode} +\DeclareCaptionOption{box}{\caption@set{box}{#1}} +\DeclareCaptionOption{parbox}{\caption@set{parbox}{#1}} +\caption@setmapping{parbox}{box} +% \end{macrocode} +% +% There are four pre-defined boxes, called `empty', `none', +% `parbox', and `colorbox'. +% \changes{v1.0i}{2006/05/13}{We define \cs{captionbox} instead of \cs{caption@start/endbox}} +% \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{captionbox} changed from \cs{parbox-t} to \cs{parbox-b}} +% \changes{v1.2}{2007/11/11}{\cs{captionbox} renamed to \cs{caption@parbox}} +% \changes{v1.5}{2012/03/15}{\cs{caption@parbox} adapted to \cs{DeclareCaptionBox}} +% \changes{v1.6}{2013/05/02}{Option \opt{boxsep=} added} +% \changes{v2.1b}{2020/09/17}{Missing braces re-added to \opt{colorbox} option code} +% \begin{macrocode} +\DeclareCaptionBox{empty}{} +\DeclareCaptionBox{none}{#2} +\DeclareCaptionBox{parbox}{\parbox[b]{#1}{#2}} +\DeclareCaptionBox{colorbox}{% + \colorbox{\caption@boxcolor}{% + \setlength\caption@tempdima{#1}% + \addtolength\caption@tempdima{-2\fboxsep}% + \linewidth\caption@tempdima\relax + \hsize\caption@tempdima\relax + #2}} +\DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}} +\DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}} +% \end{macrocode} +% +% `default' usually maps to `none' resp.~`parbox'. +% \begin{macrocode} +\SetCaptionDefault{box}{none} +%\SetCaptionDefault{parbox}{parbox} +% \end{macrocode} +% +% \section{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} +% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now} +% \changes{v2.0}{2020/07/27}{\cs{caption@ifh} renamed to \cs{caption@ifhmode}} +% |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\\ +% 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{% + \caption@decl[\edef]{format}{#2}{% + \unexpanded{\let\caption@ifhmode#1}% + \unexpanded{\long\def\caption@slfmt}####1####2####3\unexpanded{{#3}}% + \unexpanded{\long\def\caption@fmt}####1####2####3\unexpanded{{#4}}}} +\@onlypreamble\caption@@declareformat +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@useformat} +% \changes{v2.0}{2020/07/31}{This macro added} +% |\caption@useformat|\marg{name}\\ +% expands |\caption@fmt| based on the given format \meta{name}. +% \begin{macrocode} +\newcommand*\caption@useformat[1]{% used by caption-koma.sto + \caption@checkdecl{format}{#1}{% + \begingroup + \@nameuse{caption@format@#1}\global\let\caption@tempa\caption@fmt + \endgroup\caption@tempa}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{format}{\caption@set{format}{#1}} +% \end{macrocode} +% +% \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@iflabelseparatorwithnewline + {\caption@Error{% + The option `labelsep=\caption@labelsep@name' does not work\MessageBreak + with `format=hang'}}% + {\@hangfrom{#1#2}% + \advance\caption@parindent\hangindent\relax + \advance\caption@hangindent\hangindent\relax + \caption@@par#3\par}} +% \end{macrocode} +% +% `default' usually maps to `plain'. +% \begin{macrocode} +\SetCaptionDefault{format}{plain} +% \end{macrocode} +% +% \section{Label formats} +% +% \begin{macro}{\DeclareCaptionLabelFormat} +% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm} +% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now} +% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2} +% \begin{macrocode} +\newcommand*\DeclareCaptionLabelFormat[2]{% + \caption@decl{labelformat}{#1}##1##2{#2}} +\@onlypreamble\DeclareCaptionLabelFormat +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{labelformat}{\caption@set{labelformat}{#1}} +% \end{macrocode} +% +% \changes{v1.2}{2007/12/16}{Caption label format \opt{brace} added} +% \changes{v1.7}{2015/09/16}{Caption label format \opt{autodot} added} +% \changes{v1.7}{2016/05/22}{Caption label format \opt{autodot} fixed} +% \changes{v1.8}{2016/05/22}{Caption label format \opt{unnumbered} added} +% There are six pre-defined label formats, called `empty', `simple', +% `parens', `brace', `autodot', and `unnumbered'. +% +% \begin{macrocode} +\DeclareCaptionLabelFormat{empty}{} +\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2} +\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)} +\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)} +\DeclareCaptionLabelFormat{autodot}{\bothIfFirst{#1}{\nobreakspace}#2\autodot} +\DeclareCaptionLabelFormat{unnumbered}{#1} +% \end{macrocode} +% +% \changes{v2.0}{2020/08/03}{Caption label format \opt{original} added} +% The label format `original' tries to preserve the original definition +% of the label format which was defined by |\fnum@|\meta{environment}. +% If no original definition is available, use the label format `simple' +% as fallback. +% +% \begin{macrocode} +\DeclareCaptionLabelFormat{original}{% + \caption@ifdefined\caption@original@fnum + {\caption@original@fnum}% + {\caption@labelformat@fallback{#1}{#2}}} +% \end{macrocode} +% +% `default' usually maps to `original' resp. `simple'. +% \begin{macrocode} +\SetCaptionDefault{labelformat}{original} +\SetCaptionFallback{labelformat}{simple} +% \end{macrocode} +% +% \section{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} +% \changes{v2.0}{2018/05/15}{Variant with two stars added} +% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now} +% \changes{v2.0}{2020/07/27}{\cs{caption@iflf} renamed to \cs{caption@iflabelfont}} +% \changes{v2.0}{2020/07/27}{\cs{caption@lsep} renamed to \cs{caption@labelsep}} +% \changes{v2.0}{2020/07/27}{Definition of \cs{caption@labelsep@name} added} +% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\ +% |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\\ +% |\DeclareCaptionLabelSeparator**|\marg{name}\marg{condition}\marg{code}\\ +% The starred form causes the label separator to be typeset \emph{without} +% using |\caption|\-|label|\-|font|. +% The two-starred form uses \meta{condition} to decide if the label separator +% should be typeset with or without using |\caption|\-|label|\-|font|. +% \begin{macrocode} +\newcommand\DeclareCaptionLabelSeparator{% + \@ifstar + \DeclareCaptionLabelSeparator@ + {\caption@declarelabelseparator\@firstofone}} +\@onlypreamble\DeclareCaptionLabelSeparator +% \end{macrocode} +% \begin{macrocode} +\newcommand\DeclareCaptionLabelSeparator@{% + \@ifstar + \DeclareCaptionLabelSeparator@@ + {\caption@declarelabelseparator\@gobble}} +\@onlypreamble\DeclareCaptionLabelSeparator@ +% \end{macrocode} +% \begin{macrocode} +\newcommand*\DeclareCaptionLabelSeparator@@[2]{% + \caption@declarelabelseparator + {#2\@gobble\@firstofone}% + {#1}} +\@onlypreamble\DeclareCaptionLabelSeparator@@ +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@declarelabelseparator[3]{% + \caption@decl{labelseparator}{#2}% + {\def\caption@iflabelfont{#1}% + \def\caption@labelsep@name{#2}% + \def\caption@labelsep{#3}}% +% \end{macrocode} +% Unfortunately |\Declare|\-|Float|\-|Separators| of the \package{floatrow} +% package mis-uses |\Declare|\-|Caption|\-|Label|\-|Separator| instead of +% storing the definition on its own. Since the \package{floatrow} package is +% unmaintained we have to store the separator definition inside +% |\caption@lsep@|\meta{name} for \package{floatrow}, too. (Sigh!) +% \begin{macrocode} + \@namedef{caption@lsep@#2}{#3}} +% \end{macrocode} +% Since the `default' caption label separator will usually not be defined +% with |\Declare|\-|Caption|\-|Label|\-|Separator|, we need to define +% |\caption@lsep@default| manually. +% \Note{This definition is used by \package{magyar.ldf} but only needs to be different +% than \cs{caption@lsep} (which is usually undefined).} +% \begin{macrocode} +\newcommand*\caption@lsep@default{\caption@labelseparator@default\caption@labelsep}% +% \end{macrocode} +% \begin{macrocode} +\@onlypreamble\caption@declarelabelseparator +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@LabelSeparatorWithNewline} +% \changes{v2.0}{2020/07/27}{This macro added} +% |\caption@LabelSeparatorWithNewline|\marg{name}\\ +% adds the given label separator to a list of label separators which uses +% |\\| internally. (They are incompatible to the `hang' caption format.) +% \begin{macrocode} +\newcommand*\caption@LabelSeparatorWithNewline[1]{% + \caption@g@addto@list\caption@labelsep@crlist{#1}} +\@onlypreamble\caption@LabelSeparatorWithNewline +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@iflabelseparatorwithnewline} +% \changes{v2.0}{2020/07/31}{This macro added} +% |\caption@iflabelseparatorwithnewline|\marg{yes-code}\marg{no-code}\\ +% tests if the current label separator uses |\\| internally. +% \begin{macrocode} +\newcommand*\caption@iflabelseparatorwithnewline{% + \caption@ifin@list\caption@labelsep@crlist\caption@labelsep@name} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{labelsep}{\caption@set{labelseparator}{#1}} +\DeclareCaptionOption{labelseparator}{\caption@set{labelseparator}{#1}} +% \end{macrocode} +% +% \changes{v1.0e}{2005/06/11}{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} +% \changes{v1.12}{2020/05/30}{Caption label separator \opt{newline} implementation changed from \cs{textbackslash} to \cs{captionnewline}} +% 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}{\captionnewline} +% TODO: \DeclareCaptionLabelSeparator should detect on its own if it contains \captionnewline or not +\caption@LabelSeparatorWithNewline{newline} % does not work with "format=hang" +\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space} +% \end{macrocode} +% +% \changes{v2.2c}{2020/10/10}{Caption label separators \opt{gobble} and \opt{gobbletwo} added} +% +% It's a common hack to mis-use |\fnum@figure| and |\fnum@table| to replace the caption +% label separator, for example changing the separator to a period plus space with +% \begin{quote} +% |\renewcommand\fnum@figure[1]{\figurename~\thefigure.}| +% \end{quote} +% or dropping the label and separator completely with +% \begin{quote} +% |\renewcommand\fnum@figure[1]{\ignorespaces}|\quad +% \end{quote} +% (taken from \url{http://compgroups.net/comp.text.tex/figure-without-caption/1915079}). +% +% We emulate the behaviour of |\@make|\-|caption| of the base document classes +% \class{article}, \class{report}, and \class{book} in this regard (in |\caption@@@make|) +% so these hacks still work if the \package{caption} package is loaded. +% +% These are the label separators used when one or two tokens after the label format +% should be dropped, called `gobble' and `gobbletwo': +% \begin{macrocode} +\DeclareCaptionLabelSeparator{gobble}{ } +\DeclareCaptionLabelSeparator{gobbletwo}{} +% \end{macrocode} +% +% \begin{macro}{\captionnewline} +% \changes{v1.12}{2020/05/30}{This macro added} +% \changes{v2.0}{2020/07/31}{\cs{relax} added to definition} +% |\captionnewline|\\ +% will be used in the caption label separator |new|\-|line|, +% and re-defined for |long|\-|table| environments +% (in package \package{ltcaption}). +% \begin{macrocode} +\newcommand*\captionnewline{\\\relax} +% \end{macrocode} +% \end{macro} +% +% `default' usually maps to `colon'. +% \begin{macrocode} +\SetCaptionDefault{labelseparator}{colon} +% \end{macrocode} +% +% \section{Text formats} +% +% \begin{macro}{\DeclareCaptionTextFormat} +% \changes{v1.0j}{2007/02/18}{This macro added} +% \changes{v2.0}{2019/09/10}{Uses \cs{caption@decl} now} +% \changes{v2.2f}{2020/10/26}{\cs{par} is now allowed as part of the \meta{code} argument} +% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1} +% \begin{macrocode} +\newcommand\DeclareCaptionTextFormat[2]{% + \caption@decl{textformat}{#1}##1{#2}} +\@onlypreamble\DeclareCaptionTextFormat +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{textformat}{\caption@set{textformat}{#1}} +% \end{macrocode} +% +% There are three pre-defined text formats, called `empty', `simple' and `period'. +% \changes{v1.4}{2011/10/05}{Pre-defined text format `empty' added} +% \changes{v1.7}{2015/09/16}{The text format `empty' now takes care of the \cs{label}} +% \begin{macrocode} +\DeclareCaptionTextFormat{empty}{% + \caption@get@label#1\caption@makeanchor{}\@nil + \caption@thelabel + \global\let\caption@thelabel\relax} +\long\def\caption@get@label#1\caption@makeanchor#2#3\@nil{% + \def\caption@tempa{#2}% + \ifx\caption@tempa\@empty + \caption@getlabel{#1}% + \else + \caption@getlabel{#2}% + \fi} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionTextFormat{simple}{#1} +\DeclareCaptionTextFormat{period}{#1.} +% \end{macrocode} +% +% `default' usually maps to `simple'. +% \begin{macrocode} +\SetCaptionDefault{textformat}{simple} +% \end{macrocode} +% +% \begin{macro}{\caption@getlabel} +% \changes{v1.0}{2011/09/03}{\cs{label} can have optional arguments now} +% \changes{v1.7}{2015/09/16}{Moved from \package{bicaption} package to \package{caption3}} +% \changes{v1.8d}{2019/09/01}{Bugfix: Global definition of \cs{caption@thelabel} added} +% \changes{v2.0}{2020/08/23}{Syntax changed} +% |\caption@getlabel|\marg{text}\\ +% gets the label command out of the given caption text and stores it to +% |\caption@the|\-|label|. +% \begin{macrocode} +\newcommand\caption@getlabel[1]{% + \caption@@getlabel#1\label{}\@nil} +\long\def\caption@@getlabel#1\label#2#3\@nil{% + \def\@tempa{#2}% + \ifx\@tempa\@empty + \let\caption@thelabel\relax + \else + \def\@tempb{*}% + \ifx\@tempa\@tempb + \def\caption@thelabel{\label*}% + \caption@@@getlabel#3\@nil + \else + \def\caption@thelabel{\label}% + \caption@@@getlabel{#2}#3\@nil + \fi + \fi} +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@@@getlabel#1#2\@nil{% + \def\@tempa{#1}% + \def\@tempb{[}% + \ifx\@tempa\@tempb + \caption@@@@getlabel#1#2\@nil + \else + \l@addto@macro\caption@thelabel{{#1}}% + \fi} +% \end{macrocode} +% \begin{macrocode} +\long\def\caption@@@@getlabel[#1]#2\@nil{% + \l@addto@macro\caption@thelabel{[{#1}]}% + \caption@@@getlabel#2\@nil} +% \end{macrocode} +% \begin{macrocode} +\let\caption@thelabel\relax +% \end{macrocode} +% \end{macro} +% +% \changes{v1.0c}{2005/02/12}{Option \opt{strut=} added} +% \begin{macrocode} +\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}} +% \end{macrocode} +% +% \section{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} +% \changes{v1.8h}{2020/01/03}{Check for \package{ragged2e} package related options added} +% \changes{v1.10}{2020/05/10}{Optional argument \opt{package} added} +% |\DeclareCaptionFont|\oarg{package}\marg{name}\marg{code} +% \begin{macrocode} +\newcommand*\DeclareCaptionFont{% + \caption@decl@package{font}{\caption@declarefont}} +\@onlypreamble\DeclareCaptionFont +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declarefont[2]{% + \caption@decl{font}{#1}##1{#2}% + \define@key{caption@font}{#1}[]{\caption@addto@font{#1}{##1}}} +\@onlypreamble\caption@@declarefont +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@addto@font[1]{% +% \end{macrocode} +% \begin{macrocode} +% Load package first, if necessary + \caption@load@package{font}{#1}% +% \end{macrocode} +% Add the content to \cs{caption@fnt} +% \begin{macrocode} + \caption@add@to@font{font}{#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@add@to@font[3]{% + \expandafter\g@addto@macro\expandafter\caption@fnt\expandafter{\csname caption@#1@#2\endcsname{#3}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{font}{\caption@setfont{font}{#1}} +\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}} +\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}} +\caption@setmapping{labelfont}{font} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}} +\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}} +\caption@setmapping{textfont}{font} +% \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}\\ +% 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}\\ +% Like |\caption@set|\-|font|, but adds the code snippets to |\caption|\meta{name}. +% Because we use |\set|\-|keys| recursive here we need to do this inside an +% extra group. +% \begin{macrocode} +\newcommand*\caption@addtofont[2]{% + \expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname + \begingroup + \define@key{caption@font}{default}[]{\caption@add@to@font{#1}{default}{##1}}% + \caption@setkeys[caption]{caption@font}{#2}% + \endgroup + \expandafter\let\csname caption#1\endcsname\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} +% +% \changes{v1.7}{2018/05/01}{Missing font sizes \texttt{tiny}, \texttt{LARGE}, \texttt{huge}, and \texttt{Huge} added} +% \begin{macrocode} +\DeclareCaptionFont{tiny}{\tiny} +\DeclareCaptionFont{scriptsize}{\scriptsize} +\DeclareCaptionFont{footnotesize}{\footnotesize} +\DeclareCaptionFont{small}{\small} +\DeclareCaptionFont{normalsize}{\normalsize} +\DeclareCaptionFont{large}{\large} +\DeclareCaptionFont{Large}{\Large} +\DeclareCaptionFont{LARGE}{\LARGE} +\DeclareCaptionFont{huge}{\huge} +\DeclareCaptionFont{Huge}{\Huge} +% \end{macrocode} +% +% \changes{v1.8}{2018/05/01}{Font sizes \texttt{smaller} and \texttt{larger} added} +% \begin{macrocode} +\DeclareCaptionFont{smaller}{\caption@smaller} +\DeclareCaptionFont{larger}{\caption@larger} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareCaptionFont{none}{} +\DeclareCaptionFont{normal}{% + \caption@font@normalcolor\@unused + \caption@font@normalfont\@unused + \caption@font@normalsize\@unused + \caption@font@singlespacing\@unused} +% \end{macrocode} +% +% `default' usually maps to `none'. +% \begin{macrocode} +\SetCaptionDefault{font}{none} +\SetCaptionDefault{labelfont}{none} +\SetCaptionDefault{textfont}{none} +% \end{macrocode} +% +% The \package{floatrow} package uses the fonts `footfont` and `@tempa` additionally, +% so we need to map and define the default value for them, too. +% \begin{macrocode} +\caption@setmapping{footfont}{font} +\SetCaptionDefault{footfont}{none} +\caption@setmapping{@tempa}{font} +\SetCaptionDefault{@tempa}{none} +% \end{macrocode} +% +% \begin{macro}{\caption@smaller} +% |\caption@smaller|\\ +% selects a font size which is smaller than the current one. +% \begin{macrocode} +\newcommand\caption@smaller{% + \ifx\@currsize\tiny + \relax + \else\ifx\@currsize\scriptsize + \tiny + \else\ifx\@currsize\footnotesize + \scriptsize + \else\ifx\@currsize\small + \footnotesize + \else\ifx\@currsize\normalsize + \small + \else\ifx\@currsize\large + \normalsize + \else\ifx\@currsize\Large + \large + \else\ifx\@currsize\LARGE + \Large + \else\ifx\@currsize\huge + \LARGE + \else\ifx\@currsize\Huge + \huge + \else + \caption@Warning{% + Cannot determine current font size.\MessageBreak + Try setting it with `size=' explicitly}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@larger} +% |\caption@larger|\\ +% selects a font size which is larger than the current one. +% \begin{macrocode} +\newcommand\caption@larger{% + \ifx\@currsize\tiny + \scriptsize + \else\ifx\@currsize\scriptsize + \footnotesize + \else\ifx\@currsize\footnotesize + \small + \else\ifx\@currsize\small + \normalsize + \else\ifx\@currsize\normalsize + \large + \else\ifx\@currsize\large + \Large + \else\ifx\@currsize\Large + \LARGE + \else\ifx\@currsize\LARGE + \huge + \else\ifx\@currsize\huge + \Huge + \else\ifx\@currsize\Huge + \relax + \else + \caption@Warning{% + Cannot determine current font size.\MessageBreak + Try setting it with `size=' explicitly}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@hypersetup} +% |\caption@hypersetup|\marg{options}\\ +% expands to |\hypersetup|\marg{options} if defined, to nothing otherwise. +% \begin{macrocode} +\newcommand*\caption@hypersetup{\caption@ifdefined\hypersetup\hypersetup\@gobble} +\DeclareCaptionFont{hypersetup}{\caption@hypersetup{#1}} % for usage in \captionsetup{font={hypersetup=...}} +\DeclareCaptionOption{hypersetup}{\caption@hypersetup{#1}} % for usage in \captionsetup[]{hypersetup=...} +% \end{macrocode} +% \end{macro} +% +% \section{Sizes} +% +% \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}} +\caption@setmapping{size}{font} +% \end{macrocode} +% +% `default' usually maps to `none'. +% \begin{macrocode} +\SetCaptionDefault{size}{none} +% \end{macrocode} +% +% \section{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}} +% \changes{v2.0}{2020/07/26}{Uses \cs{caption@decl} now} +% |\DeclareCaptionJustification|\oarg{package}\marg{name}\marg{code} +% \begin{macrocode} +\newcommand*\DeclareCaptionJustification{% +% \caption@decl@package{justification}{\caption@decl{justification}}} % Because of floatrow it isn't so easy... +% \end{macrocode} +% Unfortunately the (unmaintained) \package{floatrow} uses the old storage scheme +% of the \package{caption} package and therefore expects the justification code +% in |\caption@hj@|\meta{name} instead of |\caption@justification@|\meta{name}. +% For this reason we have to store the code for the \package{floatrow} package +% additionally, so |\flrow@FBo|\-|Align| will still work fine. +% \begin{macrocode} + \caption@withoptargs\caption@declare@justification} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declare@justification[3]{% + \caption@decl@package{justification}{\caption@decl{justification}}#1{#2}{#3}% + \expandafter\let\csname caption@hj@#2\expandafter\endcsname\csname caption@justification@#2\endcsname} +\@onlypreamble\DeclareCaptionJustification +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{justification}{% + \caption@load@package{justification}{#1}% + \caption@set{justification}{#1}} +% \end{macrocode} +% +% 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} +% +% `default' usually maps to `justified'. +% \begin{macrocode} +\SetCaptionDefault{justification}{justified} +% \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 |\center|\-|first| |:-)| +% \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 one 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} +% +% \section{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. +% \begin{macrocode} +\caption@ifundefined\abovecaptionskip{% + \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{} +\caption@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|\\ +% 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} +% +% \section{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{macro}{\caption@declare@position} +% \changes{v2.0}{2020/07/26}{This macro added} +% |\caption@declare@position|\marg{name}\marg{code}\\ +% declares a captionposition setting of the given \meta{name}, +% \meta{code} must either expand to |\@first|\-|of|\-|two| (top) or +% |\@second|\-|of|\-|two| (below). +% \begin{macrocode} +\newcommand*\caption@declare@position[2]{% + \caption@decl{position}{#1}{#2}} +\@onlypreamble\caption@declare@position +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{position}{\caption@setposition{#1}} +% \end{macrocode} +% \changes{v1.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} +% +% \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} +% \changes{v2.0}{2020/07/27}{Uses \cs{caption@set} now} +% |\caption@setposition|\marg{position}\\ +% puts |\caption@position| to the right value. +% (Note: Since this command is used by the \package{floatrow} package as well +% its syntax should not change.) +% \begin{macrocode} +\newcommand*\caption@setposition{\caption@set{position}} +% \end{macrocode} +% \end{macro} +% +% These are the pre-defined position code snippets. +% \begin{macrocode} +\caption@declare@position{t}{\@firstoftwo} +\caption@declare@position{top}{\@firstoftwo} +\caption@declare@position{above}{\@firstoftwo} +\caption@declare@position{b}{\@secondoftwo} +\caption@declare@position{bottom}{\@secondoftwo} +\caption@declare@position{below}{\@secondoftwo} +\caption@declare@position{a}{\caption@autoposition}% needed by floatrow package, \flrow@cappos +\caption@declare@position{auto}{\caption@autoposition} +% \end{macrocode} +% +% \changes{v1.1}{2007/05/08}{Default position changed from `bottom' to `auto'} +% `default' usually maps to `auto'. +% \begin{macrocode} +\SetCaptionDefault{position}{auto} +% \end{macrocode} +% +% \begin{macro}{\caption@autoposition} +% \changes{v2.0}{2020/07/27}{This macro added} +% If in doubt, `position=auto' maps to `position=below'. +% \begin{macrocode} +\let\caption@autoposition\@secondoftwo +% \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'} +% \changes{v2.0}{2020/07/27}{Adapted to current implementation of `auto'} +% |\caption@iftop|\marg{true-code}\marg{false-code}\\ +% Since version \version{2.0} this command is identical to |\caption@position|. +% \begin{macrocode} +\newcommand*\caption@iftop{\caption@position} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@fixposition} +% \changes{v1.0a}{2004/01/23}{\cs{ifvmode} added} +% \changes{v1.0b}{2004/05/16}{Split into \cs{caption@fixposition} & \cs{caption@autoposition}} +% \changes{v2.0}{2020/07/27}{Adapted to current implementation of `auto'} +% |\caption@fixposition|\\ +% We try to guess the current position of the caption by checking |\prev|\-|depth|.\par +% A different solution would be setting the |\space|\-|factor| to something +% not much less than 1000 (for example 994) in |\caption@start| and +% checking this value here by |\ifnum\space|\-|factor=994|. +% (It's implemented in the \package{threeparttable} package\cite{threeparttable} this way.)\par +% Another idea would be checking |\@if|\-|mini|\-|page|, but since some packages +% typeset the caption within a simple |\vbox| this does not seem to be a good one. +% \begin{macrocode} +\newcommand*\caption@fixposition{% + \ifvmode + \edef\caption@tempa{\the\prevdepth}% + \caption@Debug{\protect\prevdepth=\caption@tempa}% + \ifdim\prevdepth>-\p@ + \let\caption@autoposition\@secondoftwo % position=below + \else + \let\caption@autoposition\@firstoftwo % position=above + \fi + \else + \caption@Debug{no \protect\prevdepth}% + \let\caption@autoposition\@secondoftwo % position=below + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setautoposition} +% \changes{v1.1}{2007/06/10}{This macro added} +% \changes{v2.0}{2020/07/27}{Adapted to current implementation of `auto'} +% |\caption@setautoposition|\marg{position}\\ +% replaces the above algorithm by a different one (or a fixed position setting). +% \begin{macrocode} +\newcommand*\caption@setautoposition[1]{% + \def\caption@fixposition{\caption@@set{position}{autoposition}{#1}}} +% \end{macrocode} +% \end{macro} +% +% \section{Hooks} +% +% \begin{macro}{\AtBeginCaption} +% \begin{macro}{\AtEndCaption} +% |\AtBeginCaption|\marg{code}\\ +% |\AtEndCaption|\marg{code}\\ +% These hooks can be used analogous to |\At|\-|Begin|\-|Document| and +% |\At|\-|End|\-|Document|. +% \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} +% +% \section{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 value}\\ +% sets the `list' option to either `off' or `on'. +% \begin{macrocode} +\newcommand*\caption@setlist{\caption@set@bool\caption@iflist} +% \end{macrocode} +% \begin{macrocode} +\caption@setlist{on} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.4}{2011/08/30}{Option \opt{listtype=} added} +% \changes{v1.4}{2011/08/30}{Option \opt{listtype+=} added} +% \begin{macrocode} +\DeclareCaptionOption{listtype}{\caption@setlisttype{#1}} +\DeclareCaptionOption{listtype+}{\caption@setlisttype@ext{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@setlisttype} +% \changes{v1.4}{2011/08/30}{This macro added} +% |\caption@setlisttype|\marg{type}\\ +% sets the `listtype' option to the given \meta{type}. +% \begin{macrocode} +\newcommand*\caption@setlisttype{% + \caption@setlisttype@ext{}% + \caption@@setlisttype\caption@listtype} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setlisttype[2]{% + \edef#1{#2}% + \ifx#1\@empty \let#1\@undefined \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@setlisttype@ext} +% \changes{v1.4}{2011/08/30}{This macro added} +% |\caption@setlisttype@ext|\marg{type extension}\\ +% sets the `listtype' option to the given \meta{type extension}. +% \begin{macrocode} +\newcommand*\caption@setlisttype@ext{% + \caption@@setlisttype\caption@listtype@ext} +% \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}} +% \changes{v2.0}{2020/07/26}{Uses \cs{caption@decl} now} +% |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2} +% \begin{macrocode} +\newcommand*\DeclareCaptionListFormat[2]{% + \caption@decl{listformat}{#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@set{listformat}{#1}} +% \end{macrocode} +% +% There are seven pre-defined list formats. (The first five were taken from the \package{subfig} package.) +% \begin{macrocode} +\DeclareCaptionListFormat{empty}{} +\DeclareCaptionListFormat{simple}{#1#2} +\DeclareCaptionListFormat{subsimple}{#2} +\DeclareCaptionListFormat{parens}{#1(#2)} +\DeclareCaptionListFormat{subparens}{(#2)} +\DeclareCaptionListFormat{period}{#1#2.} +\DeclareCaptionListFormat{subperiod}{#2.} +% \end{macrocode} +% +% `default' usually maps to `subsimple'. +% \begin{macrocode} +\SetCaptionDefault{listformat}{subsimple} +% \end{macrocode} +% +% \begin{macro}{\caption@lstfmt} +% \changes{v2.0}{This macro added} +% To provide backward compatibility we still offer \cs{caption@lstfmt}. +% (\cs{caption@lstfmt} is used in the \package{dgruyter} package.) +% \begin{macrocode} +\newcommand*\caption@lstfmt{\caption@listformat} +% \end{macrocode} +% \end{macro} +% +% \section{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} +% +% \section{Document class support} +% \changes{v2.0}{2018/05/11}{Document class support re-written} +% +% \begin{macro}{\@makecaption@standard} +% \begin{macrocode} +% article|report|book.sty [2005/09/16 v1.4f Standard LaTeX document class] +\newcommand\@makecaption@standard[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} +\@onlypreamble\@makecaption@standard +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@makecaption@arabic} +% \begin{macrocode} +% arabicore.sty [2006/01/01 v1.0 Arabi Core switching commands (may still change)] +\newcommand\@makecaption@arabic[2]{% + \vskip\abovecaptionskip + \sbox\@tempboxa{#1: #2}% + \sbox\@Arabitempboxa{\textRL{#2} : #1}% + \if@rl{ + \ifdim \wd\@Arabitempboxa >\hsize + \textRL{#2} : #1\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@Arabitempboxa\hfil}% + \fi}\else{ + \ifdim \wd\@tempboxa >\hsize + #1: #2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi}\fi + \vskip\belowcaptionskip} +\@onlypreamble\@makecaption@arabic +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@makecaption@latvian} +% \begin{macrocode} +% latvian.ldf [2018/02/19 v2.0b Latvian support from the babel system] +\newcommand\@makecaption@latvian[2]{% + \vskip10\p@ + \sbox\@tempboxa{#1\if\empty#2\else: #2\fi}% + \ifdim\wd\@tempboxa>\hsize + #1: #2\par + \else + \hbox to\hsize{\hfil\box\@tempboxa\hfil}% + \fi} +\@onlypreamble\@makecaption@latvian +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifdocumentclass} +% Boolean switch which is set if the document class could be detected +% successfully, i.e. |\caption@document|\-|class| is set to a proper value. +% (If |\caption@document|\-|class| is already set, this flag will also be set.) +% \begin{macrocode} +\caption@setbool{documentclass}{1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@documentclass} +% \changes{v1.8e}{2018/05/11}{This macro added} +% Determine document class used. +% Set |\caption@document|\-|class| by good-guessing, if not already set. +% \begin{macrocode} +\caption@ifundefined\caption@documentclass{% +% \end{macrocode} +% \begin{macrocode} + \@ifclassloaded{beamer}{% + \caption@InfoNoLine{beamer document class detected}% + \def\caption@documentclass{beamer}% +% \end{macrocode} +% \begin{macrocode} + }{\@ifclassloaded{elsarticle}{% + \caption@InfoNoLine{elsarticle document class detected}% + \def\caption@documentclass{elsarticle}% +% \end{macrocode} +% \begin{macrocode} + }{\@ifclassloaded{memoir}{% + \caption@InfoNoLine{memoir document class detected}% + \def\caption@documentclass{memoir}% +% \end{macrocode} +% \begin{macrocode} + }{\caption@ifdefined\scr@caption{% + \caption@InfoNoLine{KOMA-Script document class detected}% + \def\caption@documentclass{koma}% +% \end{macrocode} +% If |\@captionheadfont| is defined, we assume it's a AMS or SMF document class. +% \begin{macrocode} + }{\caption@ifdefined\@captionheadfont{% + \caption@InfoNoLine{AMS or SMF document class detected}% + \def\caption@documentclass{ams-smf}% +% \end{macrocode} +% If |\CaptionFonts| is defined, we assume it's a NTG Dutch document class. +% \begin{macrocode} + }{\caption@ifdefined\CaptionFonts{% + \caption@InfoNoLine{NTG document class detected}% + \def\caption@documentclass{ntg}% +% \end{macrocode} +% If |\cph@font| and |\cpb@font| are defined, we assume it's the thesis document class. +% \begin{macrocode} + }{\caption@ifdefined\cph@font{% + \caption@ifdefined\cpb@font\@firstoftwo\@secondoftwo + }{% + \@secondoftwo + }{% + \caption@InfoNoLine{thesis document class detected}% + \def\caption@documentclass{thesis}% + }{% +% \end{macrocode} +% If the definition of |\@make|\-|caption| matches the one from the standard +% \LaTeX\ document classes |article|, |report|, or |book|, we assume it's +% either one of them or is compatible to them. +% \begin{macrocode} + \ifx\@makecaption\@undefined + \caption@InfoNoLine{Document class w/o caption stuff detected}% + \else + \ifx\@makecaption\@makecaption@standard + \caption@InfoNoLine{Standard document class detected}% + \else + \ifx\@makecaption\@makecaption@arabic + \caption@InfoNoLine{arabic babel option detected}% + \else + \ifx\@makecaption\@makecaption@latvian + \caption@InfoNoLine{latvian babel option detected}% + \else +% \end{macrocode} +% Otherwise we are clueless and use standard default settings for the captions. +% (And we unset the |document|\-|class| flag to indicate that the content of +% |\caption@document|\-|class| is not correct.) +% \begin{macrocode} + \caption@InfoNoLine{% + Unknown document class (or package),\MessageBreak + standard defaults will be used}% + \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}% + \caption@setbool{documentclass}{0}% unknown document class + \fi + \fi + \fi + \fi +% \end{macrocode} +% \begin{macrocode} + \let\caption@documentclass\@empty % don't load adaption code later on + }}}}}}}% +}{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\AtCaptionPackage} +% \changes{v2.0}{2018/05/14}{This macro added} +% |\AtCaptionPackage|\marg{code}\\ +% can be used by the document class adaption packages to execute extra code +% if the \package{caption} package is loaded (later on). +% This code will by applied right before the package options are evaluated. +% \begin{macrocode} +\newcommand*\AtCaptionPackage{% + \g@addto@macro\caption@documentclass@code} +\@onlypreamble\AtCaptionPackage +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@documentclass@code{} +\@onlypreamble\caption@documentclass@code +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\AfterCaptionPackage} +% \changes{v2.1}{2020/09/12}{This macro added} +% |\AfterCaptionPackage|\marg{code}\\ +% can be used by the document class adaption packages to execute extra code +% if the \package{caption} package is loaded (later on). +% This code will by applied at the very end. +% \begin{macrocode} +\newcommand*\AfterCaptionPackage{% + \g@addto@macro\caption@endtitles@code} +\@onlypreamble\AfterCaptionPackage +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@endtitles@code{} +\@onlypreamble\caption@endtitles@code +% \end{macrocode} +% \end{macro} +% +% \section{Babel support} +% +% \begin{macro}{\caption@IfBabelPackageLoaded} +% |\caption@IfBabelPackageLoaded|\marg{option}\marg{cmd}\marg{yes-code}\marg{no-code}\\ +% expands the given \meta{yes-code} if |\caption@if|\-|babel@|\meta{option} +% is set and \meta{cmd} is defined. +% Otherwise the \meta{no-code} is expanded.\par +% This way the adaption could be prevented by defining +% \begin{quote}|\def\caption@ifbabel@|\meta{option}|{false}|\end{quote} +% \begin{macrocode} +\newcommand*\caption@IfBabelPackageLoaded[4]{% + \caption@ifdefined#2\@firstofone\caption@AtBeginDocument{% + \caption@if@bool{\@nameuse{caption@ifbabel@#1}}% + {\def\caption@tempa{\caption@ifdefined#2}}% + {\let\caption@tempa\@secondoftwo}% + \caption@tempa + {\caption@InfoNoLine{#1 babel package is loaded}#3}% + {#4}}} +\@onlypreamble\caption@IfBabelPackageLoaded +% \end{macrocode} +% \end{macro} +% +% \subsection{The arabic \& farsi babel option} +% \changes{v1.8}{2018/05/20}{\package{arabic} babel support added} +% \changes{v2.0}{2020/08/02}{\package{arabic} babel support updated} +% \changes{v2.0}{2020/08/02}{\package{farsi} babel support added} +% +% \begin{macrocode} +\DeclareCaptionLabelSeparator{arabi}{\if@rl\space\fi: } +% \end{macrocode} +% +% \begin{macro}{\caption@IfBabelArabi} +% |\caption@IfBabelArabic|\marg{yes-code}\marg{no-code} +% \begin{macrocode} +\newcommand*\caption@IfBabelArabi{% + \caption@IfBabelPackageLoaded{arabi}{\ArabiCoreLoaded}} +\@onlypreamble\caption@IfBabelArabi +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@ifbabel@arabi{true} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@IfBabelArabi{% +% \end{macrocode} +% +% \begin{macro}{\caption@rl} +% \changes{v1.8}{2018/05/20}{This macro added} +% \begin{macrocode} + \newcommand\caption@rl[1]{\if@rl\textRL{#1}\else\textLR{#1}\fi}% +% \end{macrocode} +% \end{macro} +% +% If the language `arabic' or `farsi' is selected, we switch the default label separator to `arabi'. +% +% \begin{macrocode} + \caption@ifdefined\extrasarabic{% + \addto\extrasarabic{% + \caption@switchdefault{labelseparator}{\babel@save #1}{arabi}}}{}% + \caption@ifdefined\extrasfarsi{% + \addto\extrasfarsi{% + \caption@switchdefault{labelseparator}{\babel@save #1}{arabi}}}{}% +% \end{macrocode} +% +% \begin{macrocode} +}{% + \let\caption@rl\@firstofone +} +% \end{macrocode} +% +% \subsection{The babel-french package} +% \changes{v1.1}{2006/05/14}{\package{frenchb} babel support added} +% \changes{v2.0}{2020/08/01}{\package{french} babel support updated} +% +% We provide a `french' caption label separator. +% |\caption@french@label|\-|separator| will be defined later on, +% dependent on the `french' package used later on. +% +% \begin{macrocode} +\DeclareCaptionLabelSeparator{french}{\caption@french@labelseparator} +% \end{macrocode} +% +% \begin{macro}{\caption@IfBabelFrench} +% |\caption@IfBabelFrench|\marg{yes-code}\marg{no-code} +% \begin{macrocode} +\newcommand*\caption@IfBabelFrench{% + \caption@IfBabelPackageLoaded{french}{\FB@makecaption}} +\@onlypreamble\caption@IfBabelFrench +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@ifbabel@french{true} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@IfBabelFrench{% +% \end{macrocode} +% +% The \package{babel-french} package uses |\Caption|\-|Separator| as label separator. +% +% \begin{macrocode} + \providecommand\caption@french@labelseparator{\CaptionSeparator}% +% \end{macrocode} +% +% Add a space before the label separator `colon' in French +% in order to avoid problems when |Auto|\-|Space|\-|Punctuation| is set to |false|. +% +% \begin{macrocode} + \ifFB@active@punct + \DeclareCaptionLabelSeparator{colon}{% + \ifFBfrench\penalty\@M\FBcolonspace\fi : }% + \fi +% \end{macrocode} +% +% We switch the default label separator to `french', dependant on the switches +% |Customise|\-|Fig|\-|Tab|\-|Captions| and |Old|\-|Fig|\-|Tab|\-|Captions|. +% +% \begin{macrocode} + \ifFBOldFigTabCaptions + \caption@ifdefined\extrasfrench{% + \addto\extrasfrench{% + \caption@switchdefault{labelseparator}{\babel@save #1}{french}}}{}% + \caption@ifdefined\extrasacadian{% + \addto\extrasacadian{% + \caption@switchdefault{labelseparator}{\babel@save #1}{french}}}{}% + \else + \ifFBCustomiseFigTabCaptions + \caption@AtBeginDocument{% + \ifFB@mainlanguage@FR + \SetCaptionDefault{labelseparator}{french}% + \fi}% + \fi + \fi +% \end{macrocode} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The frenchle \& frenchpro package} +% \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added} +% \changes{v2.0}{2020/08/01}{\package{frenchle/pro} package support updated} +% +% \begin{macro}{\caption@IfFrenchLe} +% |\caption@IfFrenchLe|\marg{yes-code}\marg{no-code} +% \begin{macrocode} +\newcommand*\caption@IfFrenchLe{% + \caption@IfBabelPackageLoaded{frenchle}{\frenchTeXmods}} +\@onlypreamble\caption@IfBabelFrenchLe +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@ifbabel@frenchle{true} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@IfFrenchLe{% +% \end{macrocode} +% +% The \package{frenchle} package uses |\caption|\-|separator| plus |\space| as label separator. +% +% \begin{macrocode} + \providecommand\caption@french@labelseparator{\captionseparator\space}% +% \end{macrocode} +% +% If the language `french' is selected, we switch the default label separator to `french', +% and switch the default font to `it' and the default label font to `up'. +% +% \begin{macrocode} + \g@addto@macro\extrasfrench{% + \caption@switchdefault{labelseparator}{\let\caption@original@labelseparator#1}{french}% + \caption@switchdefault{font}{\let\caption@original@font#1}{it}% + \caption@switchdefault{labelfont}{\let\caption@original@labelfont#1}{up}}% + \g@addto@macro\extrasenglish{% + \caption@restoredefault{labelseparator}{\caption@original@labelseparator}% + \caption@restoredefault{font}{\caption@original@font}% + \caption@restoredefault{labelfont}{\caption@original@labelfont}}% +% \end{macrocode} +% +% Since the \package{frenchle} package overwrites |\caption|\-|font| and |\caption|\-|label|\-|font| +% (within |\GOfrench|) we need to save them beforehand and restore them afterwards. +% +% \begin{macrocode} + \caption@AtBeginDocument{% + \let\captionfont@original\captionfont + \let\captionlabelfont@original\captionlabelfont}% + \g@addto@macro\GOfrench{% + \let\captionfont\captionfont@original + \let\captionlabelfont\captionlabelfont@original}% +% \end{macrocode} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The babel-hungarian package} +% \changes{v1.3}{2009/03/29}{\package{magyar} babel support added} +% \changes{v1.3a}{2011/08/12}{\package{magyar} babel support revised} +% \changes{v1.8b}{2018/08/26}{\package{magyar} babel support revised} +% \changes{v2.0}{2020/08/03}{\package{magyar} babel support updated} +% +% \begin{macrocode} +\DeclareCaptionLabelFormat{magyar}{#2\bothIfSecond{.~}{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@IfBabelHungarian} +% |\caption@IfBabelHungarian|\marg{yes-code}\marg{no-code} +% \begin{macrocode} +\newcommand*\caption@IfBabelHungarian{% + \caption@IfBabelPackageLoaded{hungarian}{\magyar@opt@defaults}} +\@onlypreamble\caption@IfBabelHungarian +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@ifbabel@hungarian{true} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@IfBabelHungarian{% +% \end{macrocode} +% +% If the language `hungarian' or `magyar' is selected, +% we switch the default label format to `magyar', the default separator to `period', +% and the default list format to `subperiod'. +% +% \begin{macrocode} + \caption@ifdefined\extrashungarian{% + \addto\extrashungarian{% + \caption@switchdefault{labelformat}{\babel@save #1}{magyar}% + \caption@switchdefault{labelseparator}{\babel@save #1}{period}% + \caption@switchdefault{listformat}{\babel@save #1}{subperiod}}}{}% + \caption@ifdefined\extrasmagyar{% + \addto\extrasmagyar{% + \caption@switchdefault{labelformat}{\babel@save #1}{magyar}% + \caption@switchdefault{labelseparator}{\babel@save #1}{period}% + \caption@switchdefault{listformat}{\babel@save #1}{subperiod}}}{}% +% \end{macrocode} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \subsection{The latvian babel option} +% +% \begin{macrocode} +\DeclareCaptionLabelFormat{latvian}{#2\bothIfSecond{~}{#1}} +% \end{macrocode} +% +% \begin{macro}{\caption@IfBabelLatvian} +% |\caption@IfBabelLatvian|\marg{yes-code}\marg{no-code} +% \begin{macrocode} +\newcommand*\caption@IfBabelLatvian{% + \caption@IfBabelPackageLoaded{latvian}{\bbl@latvianindent}} +\@onlypreamble\caption@IfBabelLatvian +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@ifbabel@latvian{true} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\caption@IfBabelLatvian{% +% \end{macrocode} +% +% If the language `latvian' is selected, we switch the default label format to `latvian'. +% +% \begin{macrocode} + \caption@ifdefined\extraslatvian{% + \addto\extraslatvian{% + \caption@switchdefault{labelformat}{\babel@save #1}{latvian}}}{}% +% \end{macrocode} +% +% \begin{macrocode} +}{} +% \end{macrocode} +% +% \section{Package support} +% +% \begin{macro}{\caption@ifpackageloaded} +% \changes{v2.0}{2020/07/26}{This macro added} +% |\caption@ifpackageloaded|\marg{package}\marg{yes-code}\marg{no-code}\\ +% expands the given code if the given package is (not) loaded. +% (Note: We cannot use |\@if|\-|package|\-|loaded| here since it's not +% available after |\At|\-|Begin|\-|Document|.) +% \begin{macrocode} +\newcommand*\caption@ifpackageloaded[1]{% + \expandafter\ifx\csname ver@#1.\caption@pkgextension\endcsname\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi} +% \end{macrocode} +% \begin{macrocode} +\let\caption@pkgextension\@pkgextension +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@pkg@list} +% \changes{v1.4b}{2012/01/12}{This macro added} +% We used this in the past as list of packages loaded +% |\At|\-|Begin|\-|Document|. +% (Note: Old |.aux| files could contain +% |\@cons|\-|\caption@pkg@list|\-|{{|\meta{package}|}}|, +% so this macro should always be defined, even if we don't use it anymore.) +% \begin{macrocode} +\newcommand*\caption@pkg@list{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@requirepackage} +% \changes{v1.10}{2020/05/10}{This macro added} +% \changes{v2.0}{2020/07/27}{This macro revised} +% |\caption@requirepackage|\marg{package}\marg{option}\marg{value}\\ +% indicates that the given package option needs a package. +% \begin{macrocode} +\newcommand*\caption@requirepackage[2]{% + \caption@ifpackageloaded{#1}{}{\caption@@requirepackage{#1}{#2}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@requirepackage[2]{% + \@cons\caption@packagelist{{#1}{#2}}} % load package later on +% \end{macrocode} +% \begin{macrocode} +\caption@AtBeginDocument{% + \renewcommand*\caption@@requirepackage[2]{% + \caption@Error{Option `#2' requires the `#1' package}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@packagelist} +% \changes{v1.11}{2020/05/10}{This macro added} +% We use this as list of packages loaded |\At|\-|Begin|\-|Document|. +% \begin{macrocode} +\newcommand*\caption@packagelist{} +\@onlypreamble\caption@packagelist +% \end{macrocode} +% \begin{macrocode} +\caption@AtBeginDocument{% + \def\caption@tempa{\endgroup}% + \begingroup + \def\@elt#1#2{% + \g@addto@macro\caption@tempa{% + \caption@loadpackage{#1}{#2}}}% + \caption@packagelist + \caption@tempa} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@loadpackage} +% \changes{v1.11}{2020/05/10}{This macro added} +% \changes{v2.0}{2020/07/26}{This macro revised} +% |\caption@loadpackage|\marg{package}\marg{option}\marg{value}\\ +% loads the given package immediately. +% \begin{macrocode} +\newcommand*\caption@loadpackage[2]{% + \caption@ifpackageloaded{#1}{}{\caption@@loadpackage{#1}{#2}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@loadpackage[2]{% + \caption@Info{Option `#2' requires the `#1' package}% + \RequirePackage{#1}\relax} +% \end{macrocode} +% \begin{macrocode} +\caption@AtBeginDocument{% + \let\caption@@loadpackage\caption@@requirepackage} +% \end{macrocode} +% \end{macro} +% +% \subsection{The newfloat package} +% +% \begin{macro}{\caption@newfloat} +% \changes{v1.4b}{2012/01/12}{This macro added} +% \changes{v1.8h}{2020/01/03}{Usage of \cs{caption@ifpackageloaded} replaced by \cs{RequirePackage}} +% \changes{v1.11}{2020/05/10}{Usage of \cs{RequirePackage} replaced by \cs{caption@usepackage}} +% \changes{v2.0}{2020/07/27}{This macro revised} +% |\caption@newfloat|\marg{option}\marg{value}\marg{code}\\ +% loads the \package{newfloat} package and executes the given code afterwards. +% (Note: Since the package might use the crappy \package{keyval} +% package, too, we need to save \& restore some macros here, otherwise this +% recursion won't work properly.) +% \begin{macrocode} +\newcommand*\caption@newfloat[2]{% + \IfCaptionOptionCheck + {\caption@requirepackage{newfloat}{#1}}% + {\let\KV@prefix@ORI\KV@prefix + \let\@tempc@ORI\@tempc + \caption@loadpackage{newfloat}{#1}% + #2% + \let\@tempc\@tempc@ORI + \let\KV@prefix\KV@prefix@ORI}} +% \end{macro} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.0c}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added} +% \changes{v1.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written} +% \changes{v1.2}{2007/11/18}{Option \opt{name} added} +% \begin{macrocode} +\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}} +\@onlypreamble@key{caption}{figurename} +\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}} +\@onlypreamble@key{caption}{tablename} +% \end{macrocode} +% +% \changes{v1.2a}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added} +% \begin{macrocode} +\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}} +\@onlypreamble@key{caption}{listfigurename} +\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}} +\@onlypreamble@key{caption}{listtablename} +% \end{macrocode} +% +% \begin{macro}{\caption@SetName} +% \changes{v1.1}{2007/07/04}{This macro added} +% \changes{v1.2}{2007/11/18}{After-preamble variant added} +% \changes{v1.2a}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}} +% \changes{v1.2b}{2008/08/02}{Bugfix: Works now without \cs{addto}, too} +% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package} +% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now} +% |\caption@SetName|\marg{float}\marg{name}\\ +% loads the \package{newfloat} package and uses |\newfloat@set|\-|name|. +% \begin{macrocode} +\newcommand*\caption@SetName[2]{% + \caption@newfloat{#1name}{\newfloat@setname{#1}{#2}}} +\@onlypreamble\caption@SetName +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{name}{% + \IfCaptionOptionCheck{}{\caption@setname\@captype{#1}}} +% \end{macrocode} +% +% \begin{macro}{\caption@setname} +% |\caption@setname|\marg{float}\marg{name}\\ +% sets the given float name, e.g.: `Figure` for `figure`. +% \begin{macrocode} +\newcommand*\caption@setname[2]{% + \@namedef{#1name}{#2}} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.2}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added} +% \changes{v1.2e}{2010/01/09}{The \opt{within} options are now available within the document, too} +% +% \begin{macrocode} +\DeclareCaptionOption{figurewithin}{\caption@within{figure}{#1}} +\DeclareCaptionOptionNoValue{figurewithout}{\caption@within{figure}{none}} +\DeclareCaptionOption{tablewithin}{\caption@within{table}{#1}} +\DeclareCaptionOptionNoValue{tablewithout}{\caption@within{table}{none}} +% \end{macrocode} +% +% \begin{macro}{\caption@within} +% \changes{v1.2}{2007/12/21}{This macro added} +% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package} +% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now} +% |\caption@within|\marg{float}\marg{value}\\ +% loads the \package{newfloat} package and uses |\newfloat@set|\-|within|. +% \begin{macrocode} +\newcommand*\caption@within[2]{% + \caption@newfloat{#1within=#2}{\newfloat@setwithin{#1}{#2}}} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.2b}{2008/04/13}{Option \opt{within} added} +% \changes{v1.2e}{2010/01/09}{The global \opt{within} option will now affect user-defined floats declared with \cs{DeclareCaptionType}, too} +% +% \begin{macrocode} +\DeclareCaptionOption{within}{% + \caption@newfloat{within=#1}{\newfloatsetup{within=#1}}} +\DeclareCaptionOptionNoValue{without}{% + \caption@newfloat{without}{\newfloatsetup{without}}} +% \end{macrocode} +% +% \subsection{The ragged2e package} +% \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support} +% \changes{v1.8h}{2020/01/03}{Revised \package{ragged2e} package support} +% \changes{v1.9}{2020/05/05}{Enhanced \package{ragged2e} package support} +% \changes{v1.10}{2020/05/10}{Revised \package{ragged2e} package support} +% +% We support the upper-case commands offered by the \package{ragged2e} +% package. +% \begin{macrocode} +\DeclareCaptionJustification[ragged2e]{Justified}{\justifying} +\DeclareCaptionJustification[ragged2e]{Centering}{\Centering} +\DeclareCaptionJustification[ragged2e]{RaggedLeft}{\RaggedLeft} +\DeclareCaptionJustification[ragged2e]{RaggedRight}{\RaggedRight} +% \end{macrocode} +% +% \subsection{The sansmath package} +% \changes{v1.3}{2011/01/01}{\package{sansmath} package support added} +% \changes{v1.10}{2020/05/10}{\package{sansmath} package support revised} +% +% \begin{macrocode} +\DeclareCaptionFont[sansmath]{sansmath}{\sansmath} +% \end{macrocode} +% +% \subsection{The setspace package} +% \changes{v1.0n}{2007/04/02}{\package{setspace} package support added} +% \changes{v1.2d}{2009/10/09}{\package{setspace} package support revised} +% +% \begin{macrocode} +\DeclareCaptionFont{singlespacing}{% + \caption@ifdefined\setspace@singlespace{% + \setstretch\setspace@singlespace}{}}% normally 1 +\DeclareCaptionFont[setspace]{onehalfspacing}{\onehalfspacing} +\DeclareCaptionFont[setspace]{doublespacing}{\doublespacing} +\DeclareCaptionFont[setspace]{stretch}{\setstretch{#1}} +% \end{macrocode} +% +% \subsection{The subfig package} +% \changes{v1.1}{2007/07/07}{Adaptions to the \package{subfig} package added} +% \changes{v1.4a}{2011/11/01}{Test for the \package{subfig} package revised} +% \changes{v2.0a}{2020/09/07}{Re-definition of \cs{sf@ifpositiontop} added} +% +% Since the \package{subfig} package is not maintained anymore, +% we have to make adaptions to \thispackage~\version{1.1} here. +% Please note that we only support the version $1.3$ of the \package{subfig} package, +% so older versions do not work with this version of \thispackage, and newer +% versions are expected to be adapted. +% +% \begin{macrocode} +\caption@AtBeginDocument{% + \def\@tempa{2005/06/28 ver: 1.3 subfig package}% + \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa + \caption@InfoNoLine{subfig package v1.3 is loaded}% +% \end{macrocode} +% \begin{macrocode} + \def\caption@eh{\caption@@eh{subfig}}% + \let\caption@setfloattype\@gobble + \let\@dottedxxxline\sf@NEW@dottedxxxline + \let\sf@subfloat\sf@NEW@subfloat + \let\sf@ifpositiontop\caption@iftop +% \end{macrocode} +% \begin{macrocode} + \fi + \let\sf@NEW@dottedxxxline\@undefined + \let\sf@NEW@subfloat\@undefined} +% \end{macrocode} +% +% \begin{macro}{\@dottedxxxline} +% New version of |\@dottedxxxline| +% \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} +% \end{macro} +% +% \begin{macro}{\sf@subfloat} +% \changes{v1.4b}{2011/12/29}{Bugfix 11-12-23: Usage of \cs{caption@warmup} added} +% New version of |\sf@subfloat| +% \begin{macrocode} +\def\sf@NEW@subfloat{% + \begingroup + \@nameuse{caption@warmup}% + \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\relax + \fi + \refstepcounter{sub\@captype}% + \setcounter{sub\@captype @save}{\value{sub\@captype}}% + \@ifnextchar [% %] match left bracket + {\sf@@subfloat}% + {\sf@@subfloat[\@empty]}} +% \end{macrocode} +% \end{macro} +% +% Make the \package{subfig} package documentation compile. +% \begin{macrocode} +\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}} +\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}} +% \end{macrocode} +% +% \section{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} +% \changes{v1.4}{2011/08/19}{Split into three macros} +% \changes{v1.4}{2011/08/30}{Support for option \opt{listtype=} added} +% \changes{v1.5}{2012/01/15}{Usage of \cs{caption@addsubcontentslines} added} +% \changes{v1.7}{2015/09/15}{Argument \#3 which holds the environment name added to \cs{caption@lstfmt}} +% \changes{v1.7}{2015/09/20}{Unfortunately \package{subfig} defines and uses \cs{caption@lstfmt} as well, so I replaced the third argument with \cs{captionlisttype}} +% \changes{v1.8}{2018/09/06}{Adapted to the \package{chkfloat} package} +% |\caption@addcontentsline|\marg{type}\marg{list entry}\\ +% makes an entry in the list-of-whatever, if requested, i.e.~the argument +% \meta{list entry} is not empty and |list|\-|of=| was set to |true|. +% \begin{macrocode} +\newcommand\caption@addcontentsline[2]{% + \caption@ifcontentsline{#2}{% + \begingroup + \let\@tempa\@gobble + \caption@ifdefined\caption@listtype + {\let\@tempa\@firstofone}% + {\edef\caption@listtype{#1}}% + \caption@ifdefined\caption@listtype@ext + {\edef\caption@listtype{\caption@listtype\caption@listtype@ext}% + \let\@tempa\@firstofone}% + {}% + \@tempa + {\caption@Debug{addcontentsline: #1 => \caption@listtype}% +% \caption@setoptions\caption@listtype + \@namedef{the\caption@listtype}{\@nameuse{the#1}}}% + \expandafter\caption@@addcontentsline\expandafter{\caption@listtype}{#2}% + \endgroup}% + \caption@addsubcontentslines{#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@@addcontentsline[2]{% + {\let\\\space + \@ifundefined{ext@#1}% + {\caption@Error{No float type '#1' defined}}% + {\def\captionlisttype{#1}% + \caption@add@contentsline + {\csname ext@#1\endcsname}% + {#1}% + {\caption@listformat{\@nameuse{p@#1}}{\@nameuse{the#1}}}% + {\ignorespaces #2}% + \caption@chkfloat{#1}{#2}}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@add@contentsline{% + \caption@@@addcontentsline} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@@addcontentsline[4]{% +% \caption@ifdefined\main@Arabi@language +% {\addtocontents{#1}{\xstring\select@language{\main@Arabi@language}}}{}% + \addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}} +% \end{macrocode} +% \begin{macrocode} +\let\caption@chkfloat\@gobbletwo +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@ifcontentsline[1]{% + \caption@iflist + {\def\@tempa{#1}}% + {\let\@tempa\@empty}% + \ifx\@tempa\@empty + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@addsubcontentslines[1]{} +% \end{macrocode} +% \end{macro} +% +% \section{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@aboveskip} +% \begin{macro}{\caption@belowskip} +% \changes{v2.0}{2020/08/23}{This macro moved from package to kernel} +% |\caption@aboveskip| and |\caption@belowskip|\\ +% typeset the skip above resp.~below the caption. +% \begin{macrocode} +\newcommand*\caption@aboveskip{% + \vskip\abovecaptionskip} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@belowskip{% + \vskip\belowcaptionskip} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@fnum} +% \changes{v1.1}{2007/08/21}{This macro added} +% \changes{v2.0}{2020/08/03}{The original definition will be stored in \cs{caption@original@fnum}} +% |\caption@fnum|\marg{float type}\\ +% typesets the caption label; this acts as replacement for |\fnum@|\meta{float type}. +% \begin{macrocode} +\newcommand*\caption@fnum[1]{% + \expandafter\let\expandafter\caption@original@fnum\csname caption@fnum@#1\endcsname % for label format `original' + \caption@labelformat{\@nameuse{#1name}}{\@nameuse{the#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@make} +% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\\ +% typesets the caption. +% \begin{macrocode} +\newcommand\caption@make[2]{\caption@@make{\caption@labelformat{#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@ifhmode} 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} +% \changes{v1.5}{2012/03/15}{Uses \cs{caption@tempdima} instead of \cs{@tempdima}} +% \changes{v1.5}{2012/12/26}{max-margin stuff moved to \cs{caption@calcmargin}} +% \changes{v1.6}{2013/05/01}{Usage of \cs{caption@box} added} +% \changes{v1.7}{2016/01/31}{Adapted to the \package{bicaption} package} +% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}} +% |\caption@@make|\marg{caption label}\marg{caption text} +% \begin{macrocode} +\newcommand\caption@@make[2]{% + \begingroup + \caption@@make@{#1}{#2}% + \endgroup + \caption@@make@epilogue} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@@make@[2]{% + \caption@stepthecounter + \caption@beginhook +% \end{macrocode} +% Typeset the outer box |\caption@box| +% \begin{macrocode} + \caption@box\hsize{% +% \end{macrocode} +% Special single-line treatment (option |singlelinecheck=|) +% \begin{macrocode} + \caption@singlelinecheck{\caption@slc{#1}{#2}\caption@singleline\caption@multiline}{\caption@multiline}% +% \end{macrocode} +% Typeset the left margin (option |margin=|) +% \begin{macrocode} + \caption@calcmargin + \caption@tempdima\captionmargin + \ifdim\captionmargin@=\z@ \else + \caption@ifoddpage{}{\advance\caption@tempdima\captionmargin@\relax}% + \fi + \caption@ifhmode{\advance\caption@tempdima\caption@indent\relax}% + \hspace\caption@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} + \caption@tempdima\captionwidth + \caption@ifhmode{\advance\caption@tempdima-\caption@indent\relax}% + \caption@parbox\caption@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@ifhmode{% + \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} + \caption@tempdima\captionmargin + \ifdim\captionmargin@=\z@ \else + \caption@ifoddpage{\advance\caption@tempdima\captionmargin@\relax}{}% + \fi + \hspace\caption@tempdima +% \end{macrocode} +% Close the outer box |\caption@box| +% \begin{macrocode} + }% +% \end{macrocode} +% \begin{macrocode} + \caption@endhook} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@@make@epilogue{% + \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}} +% \changes{v1.5}{2012/12/26}{max-margin stuff moved from \cs{caption@@make} to here} +% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}} +% |\caption@calcmargin|\\ +% calculates |\caption|\-|margin| and |\caption|\-|width|, so both contain +% valid values. +% \begin{macrocode} +\newcommand*\caption@calcmargin{% + \caption@calcmargin@hook +% \end{macrocode} +% Check margin, if |\caption@min|\-|margin| or |\caption@max|\-|margin| 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} +% \begin{macrocode} + \ifdim\captionwidth=\z@ + \captionwidth\hsize\relax + \advance\captionwidth by -2\captionmargin\relax + \advance\captionwidth by -\captionmargin@\relax + \else + \captionmargin\hsize\relax + \advance\captionmargin by -\captionwidth\relax + \divide\captionmargin by 2\relax + \captionmargin@\z@\relax + \fi +% \end{macrocode} +% \begin{macrocode} + \caption@Debug{% + \string\hsize=\the\hsize, + \string\captionwidth=\the\captionwidth,\MessageBreak + \string\captionmargin=\the\captionmargin, + \string\captionmargin@=\the\captionmargin@}% +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@slc} +% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@justification}\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}{\cs{caption@setup}\cs{caption@opt@SingleLine} outsourced to \cs{caption@SingleLine}} +% \changes{v1.3}{2010/09/04}{Split into \cs{caption@slc} and \cs{caption@@slc}} +% \changes{v1.5}{2012/12/26}{Merged into a single macro again} +% \changes{v1.5}{2013/04/14}{Usage of \cs{ifsinglelinecaption} added} +% |\caption@slc|\marg{label}\marg{text}\marg{single-line-code}\marg{multi-line-code}\\ +% This one does the single-line-check. +% \begin{macrocode} +\newcommand\caption@slc[4]{% + \caption@Debug{Begin SLC}% + \singlelinecaptiontrue + \begingroup + \caption@singleline + \let\caption@justification\relax + \caption@calcmargin % calculate \captionwidth + \caption@prepareslc + \sbox\@tempboxa{\caption@@@make{#1}{#2}}% + \ifdim\wd\@tempboxa>\captionwidth + \endgroup + \singlelinecaptionfalse + #4% + \else + \endgroup + #3% + \fi + \caption@Debug{End SLC}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifsinglelinecaption} +% \changes{v1.5}{2013/04/14}{This definition added} +% |\ifsinglelinecaption|\\ +% could be used inside own caption formats to test if the caption is +% currently typeset as single-line caption (or not). +% \begin{macrocode} +\newif\ifsinglelinecaption +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@singleline} +% \changes{v1.1c}{2007/10/14}{This macro extracted from \cs{caption@slc}} +% \changes{v1.1c}{2007/10/14}{Support of \cs{caption@slfmt} added} +% \changes{v1.1d}{2007/10/23}{This macro renamed from \cs{caption@SingleLine} to \cs{caption@singleline} for consistency} +% |\caption@singleline|\\ +% prepares the typesetting of a single-line caption. +% \begin{macrocode} +\newcommand*\caption@singleline{% + \caption@xsetup\caption@slsty % Note: This could change \caption@format + \caption@format % defines \caption@ifhmode, \caption@slfmt, and \caption@fmt + \let\caption@fmt\caption@slfmt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@multiline} +% \changes{v2.0}{2020/07/28}{This macro added} +% |\caption@multiline|\\ +% prepares the typesetting of a multi-line caption. +% \begin{macrocode} +\newcommand*\caption@multiline{% + \caption@format} % defines \caption@ifhmode, \caption@slfmt, and \caption@fmt +% \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@justification}\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@justification}\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} +% \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} +% \changes{v1.4a}{2011/10/22}{Redefinition of \cs{footnote} revised} +% \changes{v1.5}{2013/04/13}{Redefinition os \cs{glsunset} added} +% \changes{v1.8}{2018/01/21}{Redefinition of \cs{endnote} added (thanks to Markus Kohm)} +% \changes{v1.8}{2018/05/16}{Redefinition of \cs{acused} added} +% \changes{v1.8}{2018/05/26}{Definition method changed so it can be pre-defined by other packages} +% \changes{v1.8}{2018/05/27}{Redefinition of \cs{hypertarget} added} +% |\caption@prepareslc|\\ +% re-defines anything which could disturb the single-line-check. +% \begin{macrocode} +\providecommand*\caption@prepareslc{} +\g@addto@macro\caption@prepareslc{% + \let\label\caption@gobble + \let\hypertarget\@gobbletwo +% \end{macrocode} +% We re-define \cs{footnote} so +% \begin{enumerate} +% \item The footnote counter will not be increased twice (but still the +% correct footnote mark will be used within the single-line-check) +% \item The footnote text will not be evaluated twice +% \end{enumerate} +% \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\caption@footnotetext@ORI\@footnotetext + \let\@footnotetext\caption@gobble +% \end{macrocode} +% Same for \cs{endnote} +% \begin{macrocode} + \let\caption@endnote@ORI\endnote + \def\endnote{\caption@withoptargs\caption@endnote}% + \let\caption@endnotemark@ORI\endnotemark + \def\endnotemark{\caption@withoptargs\caption@endnotemark}% + \let\caption@endnotetext@ORI\@endnotetext + \let\@endnotetext\caption@gobble +% \end{macrocode} +% Adaption to the \package{acronym} package\par +% See also \url{https://tex.stackexchange.com/questions/428788} +% \begin{macrocode} + \let\acused\@gobble + \let\AC@placelabel\@gobble +% \end{macrocode} +% Adaption to the \package{glossaries} package.\par +% Please note that while this adaption is usually sufficient +% it could give incorrect measuring results if \cs{gls} is both used +% for the very first time and more than once (for a particular acronym). +% The alternative would be using internal macros of the +% \package{glossaries} package which I would like to avoid.\par +% See also \url{https://tex.stackexchange.com/questions/108368} +% \begin{macrocode} + \let\glsunset\@gobble +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@footnote[2]{% + \caption@footnotemark{#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@footnotemark[1]{% + \begingroup + \let\stepcounter\caption@l@stepcounter + \caption@footnotemark@ORI#1\relax + \endgroup} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@endnote[2]{% + \caption@endnotemark{#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@endnotemark[1]{% + \begingroup + \let\stepcounter\caption@l@stepcounter + \caption@endnotemark@ORI#1\relax + \endgroup} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@l@stepcounter[1]{% + \advance\csname c@#1\endcsname\@ne\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@applyfont} +% \changes{v1.3}{2010/09/04}{This macro added} +% |\caption@applyfont|\\ +% applies the relevant font settings, i.e. by default +% the options set by |justification=|, |font=|, and |size=|. +% \begin{macrocode} +\newcommand*\caption@applyfont{% + \caption@justification\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@textformat} 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} +% \changes{v1.7}{2016/02/01}{Bugfix: \cs{relax} added before \cs{caption@lsep} so the label separator will not be gobbled if the label font command ignores spaces, e.g. by usage of \cs{color}} +% \changes{v1.8}{2018/09/12}{\cs{par} replaced by \cs{caption@textend}} +% \changes{v2.2c}{2020/10/10}{Usage of the label separators \opt{gobble} and \opt{gobbletwo} added} +% \changes{v2.2e}{2020/10/21}{Adaptions to \package{floatrow} package added} +% |\caption@@@make|\marg{caption label}\marg{caption text}\\ +% This one finally typesets the caption paragraph, without margin and indention. +% \begin{macrocode} +\newcommand\caption@@@make[2]{% +% \end{macrocode} +% The \package{floatrow} package uses |\caption@@@make|, too, +% but without using |\caption@single|\-|line| or |\caption@multi|\-|line|. +% For this reason we must expand |\caption@format| if |\caption@fmt| isn't defined yet. +% Furthermore it uses |\caption@lfmt| as argument which was renamed to +% |\caption@label|\-|format| in \package{caption3}\version{2.0}. +% \begin{macrocode} + \ifx\caption@fmt\@undefined\caption@format\fi + \let\caption@lfmt\caption@labelformat +% \end{macrocode} +% If the label is empty, we use the label separator `none'. +% Futhermore we use this check to determine if |#1| ends with either +% |\@gobble|, |\@gobble|\-|two|, and/or |\ignore|\-|spaces|. +% If yes, we use the corresponding label separator. +% \begin{macrocode} + \global\def\caption@tempa{gobbletwo}% + \global\def\caption@tempb{}% + \sbox\@tempboxa{% + \let\caption@ignorespaces\ignorespaces + \def\ignorespaces{% + \global\def\caption@tempb{two}% "gobble" -> "gobbletwo" if \ignorespaces is used addtionally + \caption@ignorespaces}% + #1% + {\global\let\caption@tempa\@undefined\aftergroup\@gobble}% + {\global\def\caption@tempa{gobble\caption@tempb}}}% + \ifdim\wd\@tempboxa=\z@ + \gdef\caption@tempa{none}% +% \@capbreakfalse + \fi + \ifx\caption@tempa\@undefined \else + \@expandtwoargs\caption@set{labelseparator}{\caption@tempa}% + \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}{% + \caption@set{labelseparator}{none}% + \caption@set{textformat}{simple}% +% \@capbreakfalse +% \let\caption@ifstrut\@secondoftwo + }% +% \end{macrocode} +% \begin{macrocode} + \caption@labelseparator % defines \caption@iflabelfont, \caption@labelsep and \caption@labelsep@name (the latter is needed by \caption@fmt) +% \end{macrocode} +% Take care that |\caption@par|\-|indent| and |\caption@hang|\-|indent| +% 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 + \begingroup + \captionlabelfont + #1\relax\relax + \endgroup + \fi}% + {\ifcaption@star\else + \begingroup + \caption@iflabelfont\captionlabelfont + \relax\caption@labelsep + \endgroup + \fi}% + {{\captiontextfont + \caption@textstart + \caption@ifstrut + {\vrule\@height\ht\strutbox\@width\z@}% + {}% + \nobreak\hskip\z@skip % enable hyphenation + \caption@textformat{#2}% +% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}% + \caption@ifstrut + {\ifhmode\@finalstrut\strutbox\fi}% + {}% + \caption@textend}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@textstart{} +\newcommand*\caption@textend{\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{yes-code}\\ +% 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|\\ +% will be expanded with every |\par| inside the caption. +% \begin{macrocode} +\newcommand*\caption@@par{% + \parindent\caption@parindent\hangindent\caption@hangindent}% +% \end{macrocode} +% \end{macro} +% +% \section{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} +% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package} +% |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name}\\ +% loads the \package{newfloat} package and uses |\Declare|\-|Floating|\-|Environment|. +% \begin{macrocode} +\newcommand*\DeclareCaptionType{% + \caption@loadpackage{newfloat}{declare type}% + \DeclareFloatingEnvironment} +\@onlypreamble\DeclareCaptionType +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ForEachCaptionType} +% \changes{v1.4a}{2011/10/29}{This macro added} +% \changes{v1.13}{2020/07/29}{Renamed from \cs{caption@ForEachType} to \cs{ForEachCaptionType} and starred variant added} +% |\ForEachCaptionType*|\marg{code with \#1}\\ +% will execute the given code for each (known) floating environment. +% The starred variant will only work for already existing environments, +% i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment| +% (offered by the \package{newfloat} package). +% \begin{macrocode} +\newcommand*\ForEachCaptionType{% + \@ifstar + {\caption@foreach@type\@gobble}% + {\caption@foreach@type\@iden}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@foreach@type[2]{% + \caption@ifdefined\ForEachFloatingEnvironment + {\ForEachFloatingEnvironment*{#2}}% + {\def\@elt##1{#2}% + \caption@ifdefined\c@figure\@elt\@gobble{figure}% + \caption@ifdefined\c@table\@elt\@gobble{table}% + \let\@elt\relax}% + #1{\newfloat@addtohook{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@addtohook} +% |\newfloat@addtohook|\marg{code with \#1}\\ +% adds code to the hook called in |\Declare|\-|Floating|\-|Environment|.\par +% Note: We use |\provide|\-|command| instead of |\new|\-|command| here since the +% exact same code is defined in the \package{newfloat} package. +% \begin{macrocode} +\providecommand\newfloat@addtohook[1]{% + \toks@=\expandafter{\newfloat@hook{##1}#1}% + \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}% + \@tempa} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@hook} +% Hook used in |\Declare|\-|Floating|\-|Environment|. +% \begin{macrocode} +\providecommand*\newfloat@hook[1]{} +% \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} +% \changes{v1.4}{2011/10/09}{Support of the titletoc package added} +% \changes{v1.5}{2011/12/29}{Usage of \cs{caption@addtoreset} replaced by \cs{@addtoreset}} +% \changes{v1.5}{2013/01/10}{Bugfix: Definition of autoref string corrected} +% \changes{v1.6}{2013/06/17}{Bugfix: \cs{c@tocdepth} will be set (locally) now} +% \changes{v1.8g}{2020/01/02}{Check revised if the sub-type is already defined or not} +% \changes{v1.13}{2020/07/28}{Uses \cs{caption@l@addto@list} instead of \cs{@cons} now} +% \changes{v1.13}{2020/07/29}{Usage of \cs{caption@subtype@hook} added} +% \changes{v1.13}{2020/07/29}{We don't re-use existing counters anymore (This was a bad idea anyway)} +% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\\ +% 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}}% + {\caption@@@declaresubtype{#1}{#2}{#3}{sub#3}}} +\@onlypreamble\caption@@declaresubtype +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@@declaresubtype[4]{% +% \end{macrocode} +% \begin{macrocode} +% Check if the sub-type was already defined by |\Declare|\-|Sub|\-|Type|. +% If not, define the counter and list entry. +% \begin{macrocode} + \caption@ifsubtype{#4}% + {\caption@Debug{Modify subtype `#4'}}% + {\caption@Debug{New subtype `#4'}% + \newcounter{#4}[{#3}]% + \@namedef{ext@#4}{\csname ext@#3\endcsname}% + \caption@declaresublistentry{#3}% + \caption@l@addto@list\caption@subtypelist{#4}% + \caption@subtype@hook{#4}}% +% \end{macrocode} +% Support of \package{titletoc} package +% \begin{macrocode} + \caption@ifdefined\contentsuse{% + \contentsuse{#4}{\csname ext@#4\endcsname}}{}% +% \end{macrocode} +% \begin{macrocode} + \@namedef{#4name}{}% + \@namedef{#4autorefname}{\csname #3autorefname\endcsname}% + #1% is \@firstoftwo in star form, and \@secondoftwo otherwise + {\@namedef{p@#4}{}% + \@namedef{the#4}{\csname the#3\endcsname.\@nameuse{#2}{#4}}}% + {\@namedef{p@#4}{\csname the#3\endcsname}% + \@namedef{the#4}{\@nameuse{#2}{#4}}}% + \@namedef{theH#4}{\csname theH#3\endcsname.\arabic{#4}}} +% \end{macrocode} +% \begin{macrocode} +\@onlypreamble\caption@@@declaresubtype +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declaresublistentry{% + \caption@ifdefined\l@chapter + {\caption@@declaresublistentry\l@subsection}% + {\caption@@declaresublistentry\l@subsubsection}} +\@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}}% + \expandafter\caption@@@@@@declaresublistentry + \expandafter#1\expandafter{\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{c@#2}{}{% + \ifnum ##1>\@nameuse{c@#2}\relax + \let\next\@gobblefour + \else + \c@tocdepth=\@nameuse{c@#2}\relax + \fi}% + \next}% + \fi} +\@onlypreamble\caption@@@@@@declaresublistentry +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@subtypelist} +% A list containing the sub-types defined with +% |\Declare|\-|Caption|\-|Sub|\-|Type|. +% \begin{macrocode} +\newcommand*\caption@subtypelist{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifsubtype} +% \changes{v1.8g}{2020/01/02}{This macro added} +% \changes{v1.13}{2020/07/28}{Uses \cs{caption@ifin@list} now} +% |\caption@ifsubtype|\marg{yes-code}\marg{no-code}\\ +% checks if the given subtype was defined with +% |\Declare|\-|Caption|\-|Sub|\-|Type|. +% \begin{macrocode} +\newcommand*\caption@ifsubtype{% + \caption@ifin@list\caption@subtypelist} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ForEachCaptionSubType} +% \changes{v1.13}{2020/07/29}{This macro added as replacement for \cs{caption@For}} +% |\ForEachCaptionSubType*|\marg{code with \#1}\\ +% will execute the given code for each (known) sub-type. +% The starred variant will only work for already existing sub-types, +% i.e.~no hook will be placed inside |\Declare|\-|Caption|\-|Sub|\-|Type|. +% \begin{macrocode} +\newcommand*\ForEachCaptionSubType{% + \@ifstar + {\caption@foreach@subtype\@gobble}% + {\caption@foreach@subtype\@iden}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@foreach@subtype[2]{% + \caption@for@list\caption@subtypelist{#2}% + #1{\caption@addto@subtype@hook{#2}}} +% \end{macrocode} +% \begin{macrocode} +\providecommand\caption@addto@subtype@hook[1]{% + \toks@=\expandafter{\caption@subtype@hook{##1}#1}% + \edef\@tempa{\def\noexpand\caption@subtype@hook####1{\the\toks@}}% + \@tempa} +% \end{macrocode} +% \begin{macrocode} +\providecommand*\caption@subtype@hook[1]{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@memresetsubcounter} +% \changes{v1.5}{2013/05/01}{The macro \cs{caption@savesubcounters} added} +% \changes{v1.13}{2020/07/28}{Uses \cs{caption@for@list} now for iterating the list} +% \changes{v2.2b}{2020/10/06}{This stuff replaced by a patch of \cs{@memresetsubcounter}} +% The \class{memoir} document class resets the \texttt{subfigure} +% resp.~\texttt{subtable} counter at the begin of floating environments using +% |\@mem|\-|reset|\-|sub|\-|counter|. +% As a side-effect |\continued|\-|float| does not work correctly. +% For that reason we need to patch |\@mem|\-|reset|\-|sub|\-|counter| here, +% suppressing the counter reset if the counter was defined with +% |\Declare|\-|Caption|\-|Sub|\-|Type|. +% \begin{macrocode} +\caption@ifdefined\@memresetsubcounter + {\let\caption@memresetsubcounter\@memresetsubcounter + \renewcommand*\@memresetsubcounter[1]{% + \caption@ifsubtype{sub#1}\@gobble\caption@memresetsubcounter{#1}}}% + {} +% \end{macrocode} +% \end{macro} +% +% \section{Execution of options} +% +% \begin{macrocode} +\ifx\caption@documentclass\@empty\else + \@pushfilename + \edef\@currname{caption-\caption@documentclass} + \edef\@currext{sto} + \InputIfFileExists + {\@currname.\@currext}% + {}% + {\@missingfileerror\@currname\@currext}% + \@popfilename +\fi +% \end{macrocode} +% +% \begin{macrocode} +\captionsetup{style=default,position=default,listformat=default} +% \end{macrocode} +% \begin{macrocode} +\ProcessOptions* +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% \clearpage +% \begin{thebibliography}{99} +% \bibitem{TLC2} +% Frank Mittelbach and Michel Goossens:\\ +% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\ +% \newblock Addison-Wesley, 2004. +% +% \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://www.ctan.org/pkg/hyperref}% +% {\emph{Hypertext marks in \LaTeX}},\\ +% November 12, 2007 +% +% \bibitem{refcount} +% Heiko Oberdiek:\\ +% \href{http://www.ctan.org/pkg/refcount}% +% {\emph{The refcount package}},\\ +% 2006/02/20 +% +% \bibitem{threeparttable} +% Donald Arseneau:\\ +% \href{http://www.ctan.org/pkg/threeparttable}% +% {\emph{Three part tables: title, tabular environment, notes}},\\ +% 2003/06/13 +% \end{thebibliography} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \clearpage +% \Finale +% +\endinput -- cgit v1.2.3