diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/caption/caption.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/caption/caption.sty | 228 |
1 files changed, 131 insertions, 97 deletions
diff --git a/Master/texmf-dist/tex/latex/caption/caption.sty b/Master/texmf-dist/tex/latex/caption/caption.sty index c3381e7671d..656d39a32db 100644 --- a/Master/texmf-dist/tex/latex/caption/caption.sty +++ b/Master/texmf-dist/tex/latex/caption/caption.sty @@ -6,7 +6,7 @@ %% %% caption.dtx (with options: `package') %% -%% Copyright (C) 1994-2022 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) +%% Copyright (C) 1994-2023 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) %% %% https://gitlab.com/axelsommerfeldt/caption %% @@ -46,8 +46,8 @@ \DeclareRelease{v3.4}{2019-11-24}{caption_2020-07-29.sty} \DeclareRelease{v3.5}{2020-08-30}{caption_2020-10-26.sty} \DeclareCurrentRelease{v3.6}{2022-02-20} -\ProvidesPackage{caption}[2022/03/01 v3.6b Customizing captions (AR)] -\RequirePackage{caption3}[2022/01/07] % needs v2.3 or newer +\ProvidesPackage{caption}[2023/03/12 v3.6j Customizing captions (AR)] +\RequirePackage{caption3}[2022/04/06] % needs v2.4 or newer \caption@ifbool{documentclass}{}{% \caption@WarningNoLine{% Unknown document class (or package),\MessageBreak @@ -104,10 +104,12 @@ please use either \string\usepackage{caption}[=v1]\MessageBreak or \string\usepackage{caption-light} instead}% }{\caption@ifinlist{#1}{0,false,no,off}{% - % nothing to do + \let\caption@ifcompatibility\@secondoftwo % not used; for backward compatibility only }{% \caption@Error{Undefined compatibility value `#1'}% }}} +\@onlypreamble@key{caption}{compatibility} +\caption@setbool{compatibility}{0} % default: Try not to be compatible to v1.x \DeclareCaptionOptionNoValue*{normal}{% \caption@setup{format=plain,justification=justified}} \DeclareCaptionOptionNoValue*{isu}{% @@ -268,6 +270,7 @@ \def\caption@xfloat#1[#2]{% \caption@ORI@xfloat{#1}[#2]% \caption@settype{#1}% + \caption@setanchor \caption@xfloat@hook} \newcommand*\caption@xfloat@hook{} \def\caption@xdblfloat#1[#2]{% @@ -282,57 +285,56 @@ \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}% } \def\setcaptiontype{% + \caption@teststar\@setcaptiontype\@gobble\@iden} +\newcommand*\@setcaptiontype[1]{% + \kernel@ifnextchar[%] + {\@setcaptiontype@#1}% + {\@@setcaptiontype#1\relax}} +\def\@setcaptiontype@#1[#2]{% + \@@setcaptiontype{#1}{\caption@setoptions{#2}}} +\newcommand*\@@setcaptiontype[3]{% + \caption@settype{#3}#2% \caption@parboxrestore@light - \caption@settype} + #1\caption@setanchor} \newcommand*\caption@settype{% \caption@initposition \caption@clrflags \aftergroup\flushsubcaptionlistentries - \caption@@settype} -\newcommand*\caption@@settype{% - \caption@teststar\caption@@settype@\@firstoftwo\@secondoftwo} -\newcommand*\caption@@settype@[1]{% - \@ifnextchar[%] - {\caption@@settype@@{#1}}% - {\caption@@@settype{}{#1}}} -\def\caption@@settype@@#1[#2]#3{% - \caption@@@settype{}{#1}{#3}% - \caption@setoptions{#2}} -\newcommand*\setcaptionsubtype{% - \caption@setsubtype} -\newcommand*\caption@setsubtype{% used by the floatrow package - \caption@teststar\caption@@setsubtype\@firstoftwo\@secondoftwo} -\newcommand*\caption@@setsubtype[1]{% - \caption@iftype - {\caption@ifsubtype - {\caption@Debug{subtype=\@subcaptype}}% - {\caption@@@settype{sub}{#1}{sub\@captype}}}% - {\caption@OutsideFloat\setcaptionsubtype}} -\newcommand*\caption@@@settype[3]{% - \caption@Debug{#1type:=#3}% - \@nameuse{caption@check#1type}{#3}% - {\caption@checkgrouplevel{#1}{% - \captionsetup{#1type#2*\@empty=...}#2{ or - \@backslashchar#1captionof}{}}% - \edef\caption@tempa{#3}% + \caption@@settype{}} +\newcommand*\caption@@settype[2]{% + \caption@Debug{#1type:=#2}% + \@nameuse{caption@check#1type}{#2}% + {\caption@checkgrouplevel{#1}{\setcaption#1type}% + \edef\caption@tempa{#2}% \expandafter\ifx\csname @#1captype\endcsname\caption@tempa \else - \ifcaptionsetup@star\else\@nameuse{caption@#1type@warning}\fi + \@nameuse{caption@#1type@warning}% \fi \expandafter\let\csname @#1captype\endcsname\caption@tempa \@nameuse{caption@#1typehook}% - \caption@setoptions{#3}% + \caption@setoptions{#2}% \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 - #2{}{\caption@reset@currentlabel\caption@start}}} + \fi}} +\newcommand*\setcaptionsubtype{% + \caption@teststar\@setcaptionsubtype\@gobble\@iden} +\newcommand*\@setcaptionsubtype[1]{% + \caption@iftype + {\caption@ifsubtype + {\caption@Debug{type=\@captype, subtype=\@subcaptype}}% + {\caption@@settype{sub}{sub\@captype}% + #1\caption@setanchor}}% + {\caption@OutsideFloat\setcaptionsubtype}} \newcommand*\caption@parboxrestore@light{% \let\par\@@par \parindent\z@ \parskip\z@skip \sloppy} +\newcommand*\caption@setanchor{% + \caption@reset@currentlabel + \caption@start} \newcommand*\caption@reset@currentlabel{% \let\@currentlabel\caption@undefinedlabel \ifx\caption@x@label\@undefined @@ -349,15 +351,11 @@ \newcommand*\caption@checksubtype[1]{% \caption@ifdefined@subtype{#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}}} + {\@ifundefined{c@#1}% + {\caption@Error{Undefined counter `#1'}}% + {\caption@subtypesource\caption@subtype@source{#1}% + \caption@Error{The counter `#1' was defined by\MessageBreak\caption@subtype@source}}% + \@gobble}} \newcommand*\caption@checkgrouplevel[2]{% \@ifundefined{#1caption@grouplevel}{% \caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}% @@ -397,7 +395,7 @@ \newcommand*\captionlistentry{% \caption@teststar\caption@listentry\@firstoftwo\@secondoftwo} \newcommand*\caption@listentry[1]{% - \@ifnextchar[%] + \kernel@ifnextchar[%] {\caption@listentry@{#1}}% {\caption@@listentry{#1}}} \def\caption@listentry@#1[#2]{% @@ -598,7 +596,6 @@ {\let\caption@next\@firstoftwo}% #3% \caption@next} -\@ifundefined{kernel@ifnextchar}{\let\kernel@ifnextchar\@ifnextchar}{} \newcommand\caption@dblarg[1]{% \kernel@ifnextchar[%] {\caption@ydblarg{#1}}% @@ -648,36 +645,16 @@ \caption@iflist{}{\let\caption@setlist\@gobble}% \caption@setoptions{sub}% \caption@setoptions{subfloat}% for subfig-package compatibility - \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}% + \renewcommand*\caption@settype[1]{% + \caption@Error{##1 inside \@subcaptype}}% \let\caption\caption@subcaption \let\@caption\caption@@caption \let\phantomcaption\caption@subphantom \let\captionlistentry\caption@sublistentry \let\captiontext\caption@subtext \let\caption@refstepcounter\caption@refstepcounter@ - \if@subfloatrow - \caption@Debug{Keeping \string\@makecaption}% - \else - \let\@makecaption\caption@makecaption - \fi + \let\@makecaption\caption@makecaption \fi}% -\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}}}% \newcommand*\caption@subcaption{% \caption@checkgrouplevel{sub}\subcaption \caption@star @@ -773,7 +750,7 @@ \caption@AtBeginDocument*{% \caption@ifneedfreeze{% \newcommand*\caption@freezetype[1]{% - \caption@settype*{#1}% + \caption@settype{#1}% \captionsetup*[sub]{hypcap=true}% Note: This is just a (q&d) workaround! \caption@freeze}% \newcommand*\caption@freeze{% @@ -823,7 +800,7 @@ \newcommand*\caption@freeze@error{% \caption@Error{Only one \noexpand\caption can be placed in this environment}} \newcommand*\caption@prepare@defrost{% - \let\caption@settype\caption@@settype} + \def\caption@settype{\caption@@settype{}}} \newcommand*\caption@defrost{% \ifx\caption@frozen@caption\@undefined \caption@frozen@content @@ -835,20 +812,21 @@ \caption@undefbool{needfreeze}} \let\caption@warmup\relax \caption@IfPackageLoaded{changepage}[2008/07/23 memoir-v3.7k]{% + \providecommand*\caption@patch@adjustwidth[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 + \ignorespaces}}% + \caption@patch@adjustwidth{adjustwidth}% + \caption@patch@adjustwidth{adjustwidth*}% + \let\caption@patch@adjustwidth\relax \newdimen\caption@adjustwidth@hsize \newdimen\caption@adjustwidth@linewidth \providecommand*\caption@set@adjustwidth{% \caption@adjustwidth@hsize\hsize \caption@adjustwidth@linewidth\linewidth \l@addto@macro\caption@beginex@hook\caption@test@adjustwidth}% - \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 \providecommand\caption@test@adjustwidth{% \ifdim\hsize=\caption@adjustwidth@hsize \ifdim\linewidth=\caption@adjustwidth@linewidth @@ -893,9 +871,12 @@ \caption@ORI@float@makebox{#1\relax \caption@defrostHref}}% }% \newcommand*\caption@float@setname[1]{% - \expandafter\ifx\csname #1name\endcsname\relax - \expandafter\let\csname #1name\expandafter\endcsname\csname fname@#1\endcsname + \expandafter\ifx\csname #1name\endcsname\relax % either undefined or \relax + \@namedef{#1name}{\@nameuse{fname@#1}}% \fi}% + \renewcommand*\caption@setname[2]{% + \@ifundefined{fname@#1}{}{\caption@ifdefined\floatname\floatname\@gobbletwo{#1}{#2}}% + \@namedef{#1name}{#2}}% \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}% \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}% \providecommand*\float@getstyle[2]{% @@ -933,7 +914,25 @@ \newcommand*\caption@floatflt[1]{% \caption@settype{#1}% \caption@clearmargin - \caption@setoptions{floating#1}}% + \caption@setoptions{floating#1}% + \caption@setanchor}% +}{} +\caption@IfPackageLoaded{floatrow}[2008/08/02 v0.3b]{% + \renewcommand\captionlabel[1]{{\def\FR@tmp{\@captype}\ifnum\floatbox@depth>\@ne + \def\FR@tmp{sub\@captype}\setcaptionsubtype*\stepcounter{\FR@tmp}\fi + \caption@@@make{\caption@fnum\FR@tmp}{#1}}} + \renewenvironment{subfloatrow}{\capsubrowsettings + \caption@subfloatrow@hook % as replacement for \captionsetup{subtype} + \@nameuse{subfloatrow*}}{\@nameuse{endsubfloatrow*}} + \providecommand*\caption@subfloatrow@hook{} + \renewenvironment{subfloatrow*}[1][2]{\let\flrow@to\empty + \let\Xhsize\sXhsize%\let\Zhsize\sZhsize + \FR@ifunloc{\let\FR@ifcountH\@firstoftwo}\let\c@FRobj\c@FRsobj + \def\FRleftmargin{}\def\FRrightmargin{}\let\floatrowsep\subfloatrowsep + \floatrow[#1]\killfloatstyle + \let\caption@makecaption\flrow@makecaption}% <- This line added + {\ifdim\lastskip>\z@\unskip\fi + \@ifundefined{adjustsubfloats}\relax\adjustsubfloats\endfloatrow} }{} \caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{% \caption@setbool{needfreeze}{1}% @@ -1142,7 +1141,7 @@ \@ifstar\@captionsetup\@captionsetup}% gobble * \def\@captionsetup#1{\LT@captionsetup{#1}\egroup}% \def\LT@captionsetup#1{% - \captionsetup@startrue\caption@setup@options[@longtable]{#1}% + \caption@setup@options\@gobble[@longtable]{#1}% \global\let\caption@opt@@longtable\caption@opt@@longtable}% \def\captionlistentry{% \noalign\bgroup @@ -1180,7 +1179,7 @@ \caption@listentry\@firstoftwo[{#1}]{#2}% \endgroup\ignorespaces}% \newcommand*\caption@LT@settype[1]{% - \caption@settype*{#1}% + \caption@settype{#1}% \ifdim\LTcapwidth=4in \else \caption@setwidth\LTcapwidth \fi @@ -1215,7 +1214,8 @@ \let\@makecaption\caption@@make \caption@setautoposition b% \caption@settype{#1}% - \caption@clearmargin}% + \caption@clearmargin + \caption@setanchor}% \newcommand\caption@wincaption[1]{% \ifdim\picwd=\z@ \let\caption@makecurrent\@gobbletwo @@ -1256,6 +1256,7 @@ \caption@clearmargin \caption@setoptions{parpic}% \caption@setautoposition b% + \caption@setanchor \expandafter\expandafter\expandafter\caption@ORI \expandafter\expandafter\expandafter[% \expandafter\expandafter\expandafter{% @@ -1290,6 +1291,33 @@ \caption@@make{#1}{#2}}% \nobreak\hspace{12pt}}% }{} +\caption@ifdefined\scr@caption{% + \long\def\caption@IfKomaPackageLoaded#1[#2]#3#4{% + \caption@InfoNoLine{KOMA-Script #1 package detected} + #3}}{% + \let\caption@IfKomaPackageLoaded\caption@IfPackageLoaded + } +\caption@IfKomaPackageLoaded{scrextend}[2002/07/01 v3.0]{% + \let\caption@addmargin@env\@addmargin + \renewcommand*\@addmargin{% + \@testopt\caption@@addmargin\@tempa}% + \def\caption@@addmargin[#1]#2{% + \caption@addmargin@env[{#1}]{#2}% + \caption@set@addmargin + \ignorespaces}% + \newdimen\caption@addmargin@hsize + \newdimen\caption@addmargin@linewidth + \providecommand*\caption@set@addmargin{% + \caption@addmargin@hsize\hsize + \caption@addmargin@linewidth\linewidth + \l@addto@macro\caption@beginex@hook\caption@test@addmargin}% + \providecommand\caption@test@addmargin{% + \ifdim\hsize=\caption@addmargin@hsize + \ifdim\linewidth=\caption@addmargin@linewidth + \hsize=\linewidth + \fi + \fi}% + }{}% \caption@IfPackageLoaded{sidecap}[2003/06/06 v1.6f]{% \caption@setbool{needfreeze}{1}% \let\caption@ORI@SC@zfloat\SC@zfloat @@ -1297,7 +1325,8 @@ \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]% \SC@RestoreCommands \caption@freezetype{#2}% - \let\SC@label\label}% + \let\SC@label\label + \ignorespaces}% \providecommand*\SC@RestoreCommands{% \let\caption=\SC@orig@caption \let\label=\SC@orig@label}% \let\caption@ORI@endSC@FLOAT\endSC@FLOAT @@ -1346,7 +1375,7 @@ \caption@gettitle{#2}% \caption@ORI@xtablecaption[{#1}]{#2}}% \long\def\ST@caption#1[#2]#3{\par% - \caption@settype*{#1}% + \caption@settype{#1}% \caption@setoptions{supertabular}% \caption@setposition{\if@topcaption t\else b\fi}% \caption@beginex{#1}{#2}{#3}% @@ -1365,7 +1394,7 @@ \caption@gettitle{#2}% \caption@ORI@xtablecaption[{#1}]{#2}}% \long\def\ST@caption#1[#2]#3{\par% - \caption@settype*{#1}% + \caption@settype{#1}% \caption@setoptions{xtabular}% \caption@set{position}{\if@topcaption t\else b\fi}% \@initisotab @@ -1380,18 +1409,22 @@ \caption@IfPackageLoaded{threeparttable}[2003/06/13 v3.0]{% \let\caption@ORI@threeparttable\threeparttable \renewcommand*\threeparttable{% - \caption@settype{\@ifundefined{@captype}{table}{\@captype}}% -%%% \caption@setposition{auto}% ? - \caption@clearmargin - \caption@setoptions{threeparttable}% + \caption@setthreeparttabletype{threepart}{table}% \caption@ORI@threeparttable}% \let\caption@ORI@measuredfigure\measuredfigure \renewcommand*\measuredfigure{% - \caption@settype{\@ifundefined{@captype}{figure}{\@captype}}% + \caption@setthreeparttabletype{measured}{figure}% + \caption@ORI@measuredfigure}% + \newcommand*\caption@setthreeparttabletype[2]{% + \caption@ifsubtype + {\def\caption@threeparttabletype{#1sub#2}% + \let\caption@setanchor\relax}% + {\caption@settype{\@ifundefined{@captype}{#2}{\@captype}}% + \def\caption@threeparttabletype{#1#2}}% %%% \caption@setposition{auto}% ? \caption@clearmargin - \caption@setoptions{measuredfigure}% - \caption@ORI@measuredfigure}% + \caption@setoptions\caption@threeparttabletype + \caption@setanchor}% \def\TPT@caption#1[#2]#3{% \gdef\TPT@docapt{% \global\let\TPT@docapt\@undefined @@ -1430,7 +1463,8 @@ \caption@settype{#1}% \caption@clearmargin %%% \caption@setoptions{wrap}% - \caption@setoptions{wrap#1}}% + \caption@setoptions{wrap#1}% + \caption@setanchor}% }{} \newcommand*\caption@checkcounter[1]{% \caption@check{\the#1}{\@nameuse{the#1}}} |