diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/caption.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption.dtx | 273 |
1 files changed, 149 insertions, 124 deletions
diff --git a/Master/texmf-dist/source/latex/caption/caption.dtx b/Master/texmf-dist/source/latex/caption/caption.dtx index 3e79199f558..09cef7fb865 100644 --- a/Master/texmf-dist/source/latex/caption/caption.dtx +++ b/Master/texmf-dist/source/latex/caption/caption.dtx @@ -32,12 +32,12 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{2697} +% \CheckSum{2692} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{caption.drv}[2015/09/16 v3.5 Implementation of the caption package] +\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 % @@ -84,7 +84,7 @@ % % \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} % \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} -% \newcommand*\version[2][]{\textit{v#2}} +% \newcommand*\version[2][]{v$#2$} % % \newcommand*\issue[1]{GitLab~\##1} % @@ -136,6 +136,30 @@ % \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 @@ -217,13 +241,13 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2020/09/12 v3.5b Customizing captions (AR)] +\ProvidesPackage{caption}[2020/10/26 v3.5g Customizing captions (AR)] % \end{macrocode} % % \section{Loading the kernel} % % \begin{macrocode} -\RequirePackage{caption3}[2020/09/12] % needs v2.1 or newer +\RequirePackage{caption3}[2020/10/06] % needs v2.2b or newer % \end{macrocode} % % \section{Check against unknown document classes} @@ -311,36 +335,105 @@ \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} -\newcommand*\caption@setparboxrestore[1]{% - \caption@ifinlist{#1}{full}{% - \caption@setfullparboxrestore - }{\caption@ifinlist{#1}{default,light,partial}{% - \let\caption@parboxrestore\@secondoftwo - }{% - \caption@Error{Undefined parboxrestore `#1'}% - }}} +% 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@setfullparboxrestore} -% \changes{v3.2}{2010/11/07}{This macro added} -% |\caption@setfullparboxrestore|\par -% This is an abbreviation for |\caption@setparboxrestore{full}|. +% \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} -\newcommand*\caption@setfullparboxrestore{% - \let\caption@parboxrestore\@firstoftwo} +\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} @@ -644,14 +737,10 @@ % \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@beginex| \& -% |\caption@end| instead of |\begingroup| \& |\endgroup|. -% Furthermore we use |\caption@boxrestore| instead of |\@parboxrestore| -% so this code also works correctly inside list-based environments -% like |wide| \& |addmargin|. (This, and the fact that we use -% |\linewidth| instead of |\hsize| inside |\@makecaption|, solves -% \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2472}%^^A -% {\LaTeX\ PR \texttt{latex/2472}}.) +% 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} @@ -666,7 +755,7 @@ \par \caption@beginex{#1}{#2}{#3}% \caption@setfloatcapt{% - \caption@boxrestore + \caption@parboxrestore \if@minipage \@setminipage \fi @@ -916,16 +1005,17 @@ % \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 \cs{captionsetup} was redefined. +% Like |\captionsetup{type=xxx}|, but also works if |\caption|\-|setup| was redefined. % \begin{macrocode} \def\setcaptiontype{% - \caption@boxrestore@mini + \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{% @@ -935,9 +1025,11 @@ % \end{macrocode} % \begin{macrocode} \newcommand\caption@setsubtype{% - \@ifstar - {\caption@@settype{sub}*{sub\@captype}}% - {\caption@@settype{sub}{sub\@captype}}}% + \caption@teststar\caption@@setsubtype\@firstoftwo\@secondoftwo} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@setsubtype[1]{% + \caption@@@settype{sub}{#1}{sub\@captype}} % \end{macrocode} % \end{macro} % @@ -951,6 +1043,7 @@ % \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|). @@ -968,17 +1061,17 @@ % \end{macrocode} % \begin{macrocode} \newcommand*\caption@set@type{% - \caption@@settype{}} + \caption@teststar\caption@@settype\@firstoftwo\@secondoftwo} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@@settype[1]{% - \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo} +\newcommand*\caption@@settype{% + \caption@@@settype{}} % \end{macrocode} % \begin{macrocode} \newcommand*\caption@@@settype[3]{% % #1 = "" or "sub" % #2 = \@firstoftwo in star form, \@secondoftwo otherwise -% #3 = <type>, e.g. "figure" or "subfigure" +% #3 = <type>, e.g.: "figure" or "subfigure" \caption@Debug{#1type=#3}% \@nameuse{caption@check#1type}{#3}% {\caption@checkgrouplevel{#1}{% @@ -1273,6 +1366,7 @@ % \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 @@ -1308,7 +1402,6 @@ \newcommand*\caption@continued@float[1]{% \edef\caption@tempa{#1}% \ifx\caption@tempa\caption@CFtype - \caption@restorecounters \caption@@continuedfloat{#1}% \else \caption@Error{Continued `#1' after `\caption@CFtype'}% @@ -1381,18 +1474,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\donemaincaptionfalse} -% Since the \class{memoir} document class resets the sub-caption -% counter at |\@float|, right after |\done|\-|main|\-|caption|\-|false|, -% we save all sub-caption counters at |\done|\-|main|\-|caption|\-|false| -% so we can restore them using |\caption@restore|\-|counters| -% inside |\continued|\-|float|. -% \begin{macrocode} -\caption@ifdefined\donemaincaptionfalse{% - \g@addto@macro\donemaincaptionfalse\caption@savesubcounters}{} -% \end{macrocode} -% \end{macro} -% % \section{Internal helpers} % % \begin{macro}{\caption@refstepcounter} @@ -1400,6 +1481,7 @@ % \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} @@ -1433,7 +1515,7 @@ \let\caption@tempa\caption@@refstepcounter \caption@ifflag2{}{% caption \caption@ifflag4{% subcaption -% Counter was already incremented by content, so we suppress \stepcounter{#1} here + % Counter was already incremented by content, so we suppress \stepcounter{#1} here \let\caption@tempa\caption@@refcounter }{}% }% @@ -1444,8 +1526,8 @@ \newcommand*\caption@@refcounter[1]{% \let\caption@stepcounter@ORI\stepcounter \def\stepcounter##1{% - \def\caption@tempa{#1}% - \def\caption@tempb{##1}% + \edef\caption@tempa{#1}% + \edef\caption@tempb{##1}% \ifx\caption@tempa\caption@tempb \else \caption@stepcounter@ORI{##1}% \fi}% @@ -1477,8 +1559,7 @@ % % \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.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[]{}|). @@ -1572,62 +1653,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@boxrestore} -% \changes{v3.1}{2007/03/03}{This macro and its usage added} -% \changes{v3.1b}{2007/09/17}{Bugfix: Redefinition of CR added} -% \changes{v3.2}{2010/11/07}{Support of option \opt{parboxrestore} added} -% The original code (from |latex/base/ltboxes.dtx|): -% \begin{verbatim} -% \def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr} -% \def\@arrayparboxrestore{% -% \let\if@nobreak\iffalse -% \let\if@noskipsec\iffalse -% \let\par\@@par -% \let\-\@dischyph -% \let\'\@acci\let\`\@accii\let\=\@acciii -% \parindent\z@ \parskip\z@skip -% \everypar{}% -% \linewidth\hsize -% \@totalleftmargin\z@ -% \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip -% \parfillskip\@flushglue \lineskip\normallineskip -% \baselineskip\normalbaselineskip -% \sloppy} -% \end{verbatim}%^^A -% This one will be used by |\@caption| instead of |\@parboxrestore|. -% \begin{macrocode} -\newcommand*\caption@boxrestore{% - \caption@parboxrestore{\@parboxrestore}{% - \let\if@nobreak\iffalse - \let\if@noskipsec\iffalse - \let\par\@@par -% \let\-\@dischyph -% \let\'\@acci\let\`\@accii\let\=\@acciii - \parindent\z@ \parskip\z@skip - \everypar{}% -% \linewidth\hsize -% \@totalleftmargin\z@ - \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip - \parfillskip\@flushglue \lineskip\normallineskip - \baselineskip\normalbaselineskip - \sloppy - \let\\\@normalcr - }} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@boxrestore@mini} -% \changes{v3.2}{2010/10/24}{This macro added} -% Resets \cs{par} so the very first \cs{par} in \cs{@caption} behaves quite the same as in floating environments. -% Will be used by \cs{setcaptiontype}. -% \begin{macrocode} -\newcommand\caption@boxrestore@mini{% - \let\par\@@par - \parindent\z@ \parskip\z@skip - \sloppy} -% \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} @@ -1776,7 +1801,8 @@ \caption@AtBeginDocument{% \caption@ifundefined\@subfloatrowtrue {\newif\if@subfloatrow - \caption@ifundefined\subfloatrow{}% + \caption@ifundefined\subfloatrow + {}% {\caption@Debug{Patching subfloatrow environment}% \g@addto@macro\capsubrowsettings{\@subfloatrowtrue}% \g@addto@macro\killfloatstyle{% @@ -1831,8 +1857,7 @@ % \end{macro} % % \begin{macro}{\caption@addsubcontentsline} -% \changes{v3.1i}{2008/08/02}{Bugfix 08-07-28: -% \cs{label}, \cs{index}, and \cs{glossary} are allowed inside the list entry now} +% \changes{v3.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} @@ -2551,14 +2576,14 @@ % |\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@box|\-|restore| we have to map this to +% 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@setfullparboxrestore + \caption@setparboxrestore{full}% \caption@setoptions{floating#1}}% % \end{macrocode} % \end{macro} @@ -3451,7 +3476,7 @@ % % \begin{macro}{\caption@window} % \changes{v3.1c}{2007/10/06}{Bugfix: \cs{caption@clearmargin} added} -% Beside calling |\caption@settype| we redefine |\caption@boxrestore| +% 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} @@ -3460,7 +3485,7 @@ \caption@setautoposition b% \caption@settype{#1}% \caption@clearmargin - \caption@setfullparboxrestore}% + \caption@setparboxrestore{full}}% % \end{macrocode} % \end{macro} % @@ -3567,9 +3592,9 @@ % \item We use |\caption@setoptions{parpic}| so % |\captionsetup[parpic]{|\ldots|}| is supported. % \item |\linewidth| must be set correctly. -% Usually this is done by |\@parboxrestore| inside |\@caption|, -% but since we use |\@caption@boxrestore| we have to map this to -% |\@parboxrestore| instead. +% 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. @@ -3588,7 +3613,7 @@ % \else % \captionwidth\z@ % do not use "width=" setting % \fi - \caption@setfullparboxrestore + \caption@setparboxrestore{full}% \caption@setoptions{parpic}% \caption@setautoposition b% % \end{macrocode} @@ -3905,7 +3930,7 @@ % \end{macrocode} % \begin{macrocode} \caption@beginex{#1}{#2}{#3}% - \caption@boxrestore + \caption@parboxrestore \caption@normalsize \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par \caption@end}% @@ -3972,7 +3997,7 @@ % \begin{macrocode} \@initisotab \caption@beginex{#1}{#2}{#3}% - \caption@boxrestore + \caption@parboxrestore \caption@normalsize \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par \caption@end |