diff options
author | Karl Berry <karl@freefriends.org> | 2020-01-04 22:04:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-01-04 22:04:42 +0000 |
commit | 40fc7787788cdfcaccef2c17d47de2f8cc68643d (patch) | |
tree | a613e7f1dc5153f74dd072b290903322c96c2ecd /Master/texmf-dist/source | |
parent | 8a5a45eae4b27a6b626cb7ba6ebae0cbca86d94f (diff) |
caption (4jan20)
git-svn-id: svn://tug.org/texlive/trunk@53318 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/caption/bicaption.dtx | 13 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption.dtx | 178 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption2.dtx | 32 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption3.dtx | 249 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/ltcaption.dtx | 13 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/subcaption.dtx | 69 |
6 files changed, 348 insertions, 206 deletions
diff --git a/Master/texmf-dist/source/latex/caption/bicaption.dtx b/Master/texmf-dist/source/latex/caption/bicaption.dtx index bf6243a2f61..9008263302a 100644 --- a/Master/texmf-dist/source/latex/caption/bicaption.dtx +++ b/Master/texmf-dist/source/latex/caption/bicaption.dtx @@ -18,11 +18,14 @@ % % This Current Maintainer of this work is Axel Sommerfeldt. % -% This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx, -% the derived files caption.sty, caption2.sty, caption3.sty, -% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty, -% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% This work consists of the files +% caption.ins, caption.dtx, caption2.dtx, caption3.dtx, +% bicaption.dtx, ltcaption.dtx, subcaption.dtx, totalcount.dtx, +% the derived files +% caption.sty, caption2.sty, caption3.sty, +% bicaption.sty, ltcaption.sty, subcaption.sty, totalcount.sty, +% and the user manuals +% caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi % \CheckSum{427} diff --git a/Master/texmf-dist/source/latex/caption/caption.dtx b/Master/texmf-dist/source/latex/caption/caption.dtx index 1bf48731430..1c5a196e139 100644 --- a/Master/texmf-dist/source/latex/caption/caption.dtx +++ b/Master/texmf-dist/source/latex/caption/caption.dtx @@ -18,14 +18,17 @@ % % This Current Maintainer of this work is Axel Sommerfeldt. % -% This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx, -% the derived files caption.sty, caption2.sty, caption3.sty, -% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty, -% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% This work consists of the files +% caption.ins, caption.dtx, caption2.dtx, caption3.dtx, +% bicaption.dtx, ltcaption.dtx, subcaption.dtx, totalcount.dtx, +% the derived files +% caption.sty, caption2.sty, caption3.sty, +% bicaption.sty, ltcaption.sty, subcaption.sty, totalcount.sty, +% and the user manuals +% caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{3006} +% \CheckSum{3044} % % \iffalse %<*driver> @@ -215,13 +218,13 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2020/01/01 v3.4c Customizing captions (AR)] +\ProvidesPackage{caption}[2020/01/03 v3.4h Customizing captions (AR)] % \end{macrocode} % % \section{Loading the kernel} % % \begin{macrocode} -\RequirePackage{caption3}[2019/12/31] % needs v1.8f or newer +\RequirePackage{caption3}[2020/01/03] % needs v1.8h or newer % \end{macrocode} % % \section{Check against unknown document classes} @@ -378,6 +381,7 @@ % % \begin{macro}{\caption@NewFloat} % \changes{v3.2f}{2012/01/12}{This macro added} +% \changes{v3.4h}{2020/01/03}{Usage of \cs{caption@ifpackageloaded} replaced by \cs{RequirePackage}} % |\caption@NewFloat|\marg{code} % loads the \package{newfloat} package and executes the given code afterwards. % Note: Since the \package{newfloat} package uses the crappy \package{keyval} @@ -388,7 +392,8 @@ \newcommand*\caption@NewFloat[1]{% \let\KV@prefix@ORI\KV@prefix \let\@tempc@ORI\@tempc - \caption@ifpackageloaded{newfloat}{#1}{}% + \caption@ifdefined\newfloatsetup{}{\RequirePackage{newfloat}}% + #1% \let\@tempc\@tempc@ORI \let\KV@prefix\KV@prefix@ORI} % \end{macrocode} @@ -1212,6 +1217,7 @@ % % \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} % Like |\captionsetup{type=xxx}|, but also works if \cs{captionsetup} was redefined. % \begin{macrocode} \newcommand\setcaptiontype{% @@ -1246,6 +1252,7 @@ % \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} % |\caption@settype*|\marg{type}\par % sets |\@captype| and executes the options associated with it % (using |\caption@set|\-|options|). @@ -1273,41 +1280,42 @@ \newcommand*\caption@@@settype[3]{% % #1 = "" or "sub" % #2 = \@firstoftwo in star form, \@secondoftwo otherwise -% #3 = <type>, e.g. "figure" or "table" +% #3 = <type>, e.g. "figure" or "subfigure" \caption@Debug{#1type=#3}% - \caption@checkgrouplevel{#1}{% - \captionsetup{#1type#2*\@empty=...}#2{ or - \@backslashchar#1captionof}{}}% + \@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 + \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}% + \@nameuse{caption@#1typehook}% % \end{macrocode} % \begin{macrocode} - \caption@setoptions{#3}% - \ifx\caption@opt\relax - \@nameundef{caption@#1type@warning}% - \else - \@namedef{caption@#1type@warning}{\caption@Warning{% - The #1caption type was already set to - `\csname @#1captype\endcsname'\MessageBreak}}% - \fi + \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}} + #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} % @@ -1320,6 +1328,26 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\caption@checktype} +% \changes{v3.4g}{2020/01/02}{This macro and its usage added} +% |\setcaptiontype| should not be used with a subtype, +% and |\setcaptionsubtype| should not be used with an undefined subtype. +% \begin{macrocode} +\newcommand*\caption@checktype[1]{% + \caption@ifsubtype{#1}% + {\caption@Error{Should not be used with subtype `#1'}% + \@gobble}% + \@firstofone} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@checksubtype[1]{% + \caption@ifsubtype{#1}% + \@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)} @@ -1983,6 +2011,7 @@ % \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} % 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.) @@ -2033,6 +2062,7 @@ % \begin{macrocode} % redefine \caption \let\caption\caption@subcaption + \let\@caption\caption@@caption \let\phantomcaption\caption@subphantom \let\captionlistentry\caption@sublistentry % \let\@captype\@subcaptype @@ -3321,22 +3351,23 @@ % \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@MakeCaption| so the original stuff is nested with % |\caption@begin| and |\caption@end| etc.\par % Unfortunately |\lst@MakeCaption| is sometimes used with |\linewidth| intact but sometimes with |\linewidth| adapted. % So we either could write a bunch of very ugly code which is using internals of the \package{listings} package, or % we could simply ignore this fact since |\hsize| will be left untouched by the \package{listings} package. -% (This is reason why the caption is mis-aligned when using one of the options |linewidth=|, |xleftmargin=|, |yleftmargin=|, or |resetmargins=|, -% even the \package{caption} package isn't used. This needs to be fixed within the \package{listings} package, for example by using +% (This is the reason why the caption is mis-aligned when using one of the options |linewidth=|, |xleftmargin=|, |yleftmargin=|, or |resetmargins=|, +% even if the \package{caption} package isn't used. This needs to be fixed within the \package{listings} package, for example by using % |\lst@MakeCaption| inside a parbox of correct width.) % % The \package{listings} package calls |\lst@MakeCaption| sometimes with original |\linewidth|, sometimes with adapted |\linewidth|. % So we need to detect if |\linewidth| is already adapted or not. % We realize this by setting a flag inside the "Init" hook of the \package{listings} package (where the adaption takes place). % \begin{macrocode} -%% \caption@setbool{lst@Init}{0}% -%% \lst@AddToHook{Init}{\caption@setbool{lst@Init}{1}}% + \caption@setbool{lst@Init}{0}% + \lst@AddToHook{Init}{\caption@setbool{lst@Init}{1}}% % \end{macrocode} % \begin{macrocode} \let\caption@ORI@lst@MakeCaption\lst@MakeCaption @@ -3348,38 +3379,34 @@ \begingroup % \end{macrocode} % \begin{macrocode} -%% \caption@Debug{% -%% linewidth=\lst@linewidth, -%% xleftmargin=\lst@xleftmargin,\MessageBreak -%% xrightmargin=\lst@xrightmargin, -%% resetmargins=\lst@ifresetmargins true\else false\fi}% +%% \caption@Debug{% +%% linewidth=\lst@linewidth, +%% xleftmargin=\lst@xleftmargin,\MessageBreak +%% xrightmargin=\lst@xrightmargin, +%% resetmargins=\lst@ifresetmargins true\else false\fi}% % \end{macrocode} -% If |\linewidth| isn't adapted by the \package{listings} package yet, do the adaption here. +% If |\linewidth| isn't adapted by the \package{listings} package yet, do the adaption now. % \begin{macrocode} -%% \caption@iflst@Init{}{%\lsthk@PreInit\lsthk@Init => has unwanted side-effects (like an extra horizontal line) -%% \linewidth\lst@linewidth\relax -%% \lst@ifresetmargins -%% \advance\linewidth\@totalleftmargin -%% \advance\linewidth\rightmargin -%% \@totalleftmargin\z@ -%% \fi -%% \advance\linewidth-\lst@xleftmargin -%% \advance\linewidth-\lst@xrightmargin -%% \advance\@totalleftmargin\lst@xleftmargin\relax}% +%% \caption@iflst@Init{}{% +%% \linewidth\lst@linewidth\relax +%% \lst@ifresetmargins +%% \advance\linewidth\@totalleftmargin +%% \advance\linewidth\rightmargin +%% \@totalleftmargin\z@ +%% \fi +%% \advance\linewidth-\lst@xleftmargin +%% \advance\linewidth-\lst@xrightmargin +%% \advance\@totalleftmargin\lst@xleftmargin\relax}% % \end{macrocode} % Inside lists the \package{listings} package ignores the left margin (|\@totalleftmargin|) for captions. % We emulate this behaviour by adding a negativ skip which will be typeset ahead of |\caption@box|.\par -% This does not result in correct justification of the caption, but captions inside listings inside -% lists are not justified correctly anyway. (Again, this needs to be fixed by the \package{listings} package.)\par -% Note: We cannot use |\@totalleftmargin| here since it was usually resetted by the \package{listings} package. -% So we have to calculate the total left margin on our own which makes this code even more dirty. +% Note: We only need to do this if the ``Init'' hook of the \package{listings} package wasn't called yet. % \begin{macrocode} - \l@addto@macro\caption@beginhook{% - \@tempdima\leftmargin - \multiply\@tempdima\@listdepth - \hskip-\@tempdima\relax}% + \caption@iflst@Init{}{% + \edef\caption@lst@leftskip{\noexpand\hskip-\the\@totalleftmargin\noexpand\relax}% + \l@addto@macro\caption@beginhook\caption@lst@leftskip}% % \end{macrocode} -% First of all, we set |position=#1| and if it was set to `top', +% 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 @@ -3391,7 +3418,7 @@ \belowcaptionskip\abovecaptionskip \abovecaptionskip\@tempdima}{}% % \end{macrocode} -% Workaround for issue with wrong skips (FIXME: should be examined further) +% Workaround for issue with wrong skips (FIXME: This should be examined further) % \begin{macrocode} \caption@setup{rule=0}% % \end{macrocode} @@ -3698,6 +3725,27 @@ % \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} }{} % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/caption/caption2.dtx b/Master/texmf-dist/source/latex/caption/caption2.dtx index 345fff610ca..2b6f3c73c2b 100644 --- a/Master/texmf-dist/source/latex/caption/caption2.dtx +++ b/Master/texmf-dist/source/latex/caption/caption2.dtx @@ -2,7 +2,7 @@ % % This is file `caption2.dtx'. % -% Copyright (C) 1994-2015 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) +% Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % @@ -18,14 +18,17 @@ % % This Current Maintainer of this work is Axel Sommerfeldt. % -% This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx, -% the derived files caption.sty, caption2.sty, caption3.sty, -% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty, -% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% This work consists of the files +% caption.ins, caption.dtx, caption2.dtx, caption3.dtx, +% bicaption.dtx, ltcaption.dtx, subcaption.dtx, totalcount.dtx, +% the derived files +% caption.sty, caption2.sty, caption3.sty, +% bicaption.sty, ltcaption.sty, subcaption.sty, totalcount.sty, +% and the user manuals +% caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{853} +% \CheckSum{868} % % \iffalse %<*driver> @@ -204,7 +207,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption2}[2015/09/15 v2.2d Customising captions (AR)] +\ProvidesPackage{caption2}[2020/01/02 v2.2e Customising captions (AR)] % \end{macrocode} % % \changes{v2.2b}{2007/06/15}{Made obsolete warning even more annoying} @@ -223,7 +226,16 @@ % \subsection{Loading the caption3 kernel} % % \begin{macrocode} -\RequirePackage{caption3}[2007/09/01] % needs v3.1 or newer +\RequirePackage{caption3}[2019/12/31] % should be used with v1.8f or newer +% \end{macrocode} +% We undefine user commands offered by \package{caption} but not by \package{caption2} +% since they should not be used together with \package{caption2}. +% \begin{macrocode} +\let\captionsetup\@undefined +\let\clearcaptionsetup\@undefined +\let\showcaptionsetup\@undefined +\let\DeclareCaptionType\@undefined +\let\DeclareCaptionSubType\@undefined % \end{macrocode} % % \subsection{Check against the regular caption package} @@ -694,7 +706,7 @@ % \begin{macro}{debug} % This option will put additional debug information in the log file. % \begin{macrocode} -\DeclareOption{debug}{\captionsetup{debug}} +\DeclareOption{debug}{\caption@setup{debug}} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/caption/caption3.dtx b/Master/texmf-dist/source/latex/caption/caption3.dtx index 9837f72142e..5cd6a8d9eab 100644 --- a/Master/texmf-dist/source/latex/caption/caption3.dtx +++ b/Master/texmf-dist/source/latex/caption/caption3.dtx @@ -2,7 +2,7 @@ % % This is file `caption3.dtx'. % -% Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) +% Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % @@ -18,14 +18,17 @@ % % This Current Maintainer of this work is Axel Sommerfeldt. % -% This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx, -% the derived files caption.sty, caption2.sty, caption3.sty, -% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty, -% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% This work consists of the files +% caption.ins, caption.dtx, caption2.dtx, caption3.dtx, +% bicaption.dtx, ltcaption.dtx, subcaption.dtx, totalcount.dtx, +% the derived files +% caption.sty, caption2.sty, caption3.sty, +% bicaption.sty, ltcaption.sty, subcaption.sty, totalcount.sty, +% and the user manuals +% caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{3405} +% \CheckSum{3476} % % \iffalse %<*driver> @@ -188,7 +191,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2019/12/31 v1.8f caption3 kernel (AR)] +\ProvidesPackage{caption3}[2020/01/03 v1.8h caption3 kernel (AR)] % \end{macrocode} % % \section{Workaround for bug in package \package{arabtex}} @@ -724,6 +727,7 @@ % \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}\\ % |\captionsetup*|\oarg{type}\ldots\marg{keyval-list of options}\par % If the optional argument `type' is specified, we simply save or append @@ -753,18 +757,38 @@ % \end{macrocode} % \begin{macrocode} \newcommand*\caption@setup@options@i[4]{% - \caption@setup@options@{#1}{#2}% - \caption@declare@option{#2}[]{\captionsetup#3{#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} +% Check the syntax of the given options by executing them inside a group. +% (This way the \package{ragged2e} package check will be done for these options, too.) +% \begin{macrocode} +\newcommand*\caption@checkoptions[1]{% + \begingroup + \caption@prepare@optioncheck + \caption@setup{#1}% + \endgroup} +% \end{macrocode} +% Some caption options depend on the definition of |\@captype|, +% so we set it to |figure| before executing them. +% \begin{macrocode} +\newcommand*\caption@prepare@optioncheck{% + \def\@captype{figure}} +% \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} @@ -1864,16 +1888,20 @@ % \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.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} % |\DeclareCaptionFont|\marg{name}\marg{code} % \begin{macrocode} \newcommand*\DeclareCaptionFont[2]{% - \define@key{caption@fnt}{#1}[]{\l@addto@macro\caption@fnt{#2}}} + \define@key{caption@fnt}{#1}[]{\caption@addto@fnt{#2}}} \@onlypreamble\DeclareCaptionFont % \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@addto@fnt[1]{% + \caption@check@ragged{#1}% + \l@addto@macro\caption@fnt{#1}} +% \end{macrocode} % \end{macro} % % \begin{macro}{\DeclareCaptionDefaultFont} @@ -2061,9 +2089,15 @@ \DeclareCaptionFont{singlespacing}{% \caption@ifdefined\setspace@singlespace{% \setstretch\setspace@singlespace}{}}% normally 1 -\DeclareCaptionFont{onehalfspacing}{\onehalfspacing} -\DeclareCaptionFont{doublespacing}{\doublespacing} -\DeclareCaptionFont{stretch}{\setstretch{#1}} +\DeclareCaptionFont{onehalfspacing}{% + \caption@setspace{onehalfspacing}\onehalfspacing\relax} +\DeclareCaptionFont{doublespacing}{% + \caption@setspace{doublespacing}\doublespacing\relax} +\DeclareCaptionFont{stretch}{% + \caption@setspace{stretch}\setstretch\@gobble{#1}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@setspace{\caption@ifpackageloaded{setspace}} % \end{macrocode} % % \begin{macrocode} @@ -2171,31 +2205,33 @@ % % \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} % % We also support the upper-case commands offered by the \package{ragged2e} % package. % Note that these just map to their lower-case variants if the % \package{ragged2e} package is not available. % \begin{macrocode} -\DeclareCaptionJustification{Centering}{% - \caption@ragged\Centering\centering} -\DeclareCaptionJustification{RaggedLeft}{% - \caption@ragged\RaggedLeft\raggedleft} -\DeclareCaptionJustification{RaggedRight}{% - \caption@ragged\RaggedRight\raggedright} +\DeclareCaptionJustification{Centering}{\caption@Centering} +\DeclareCaptionJustification{RaggedLeft}{\caption@RaggedLeft} +\DeclareCaptionJustification{RaggedRight}{\caption@RaggedRight} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@Centering{% + \caption@ragged{Centering}\Centering\centering} +\newcommand*\caption@RaggedLeft{% + \caption@ragged{RaggedLeft}\RaggedLeft\raggedleft} +\newcommand*\caption@RaggedRight{% + \caption@ragged{RaggedRight}\RaggedRight\raggedright} % \end{macrocode} % % \begin{macro}{\caption@ragged} -% \changes{v1.0n}{2007/04/07}{The `ragged2e' package will now only been -% loaded when needed} -% \changes{v1.0o}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced -% by \cs{caption@Debug}} +% \changes{v1.0n}{2007/04/07}{The `ragged2e' package will now only been loaded when needed} +% \changes{v1.0o}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced by \cs{caption@Debug}} % \changes{v1.1}{2007/04/16}{A different warning will be given on first \LaTeX\ run} -% \changes{v1.4f}{2012/01/12}{Uses \cs{caption@IfPackageLoaded} now} +% \changes{v1.4f}{2012/01/12}{Uses \cs{caption@ifpackageloaded} now} % |\caption@ragged|\marg{yes-code}\marg{no-code} -% executes the \meta{yes-code} if the \package{ragged2e} package is loaded -% and \meta{no-code} if not. Additionally it tries to load the \package{ragged2e} -% package. +% executes the \meta{yes-code} if the \package{ragged2e} package is loaded and \meta{no-code} if not. % \begin{macrocode} \newcommand*\caption@ragged{\caption@ifpackageloaded{ragged2e}} % \end{macrocode} @@ -2203,61 +2239,80 @@ % % \begin{macro}{\caption@ifpackageloaded} % \changes{v1.4f}{2012/01/12}{This macro added} -% |\caption@ifpackageloaded|\marg{package}\marg{yes-code}\marg{no-code} -% executes the \meta{yes-code} if the given package is loaded -% and \meta{no-code} if not. Additionally it tries to load the package. -% \begin{macrocode} -\newcommand*\caption@ifpackageloaded[1]{% - \@ifundefined{caption@ifpkg@#1}% - {\caption@RequirePackage{#1}% - \caption@pkg@true{#1}}% - {}% - \caption@ifpkg{#1}} -% \end{macrocode} +% \changes{v1.8h}{2020/01/03}{Does not load the package anymore but issue an error message instead} +% |\caption@ifpackageloaded|\marg{package}\marg{option}\marg{yes-code}\marg{no-code} +% executes the \meta{yes-code} if the given package is loaded and \meta{no-code} if not. % \begin{macrocode} -\AtBeginDocument{\renewcommand*\caption@ifpackageloaded[1]{% - \@ifundefined{caption@ifpkg@#1}% - {\caption@addto@pkg@list{#1}% - \caption@pkg@false{#1}% - \caption@Warning{% - `#1' support has been changed.\MessageBreak - Rerun to get captions right}}% - {}% - \caption@ifpkg{#1}}} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@ifpkg[1]{% - \csname caption@ifpkg@#1\endcsname} -\newcommand*\caption@pkg@true[1]{% - \global\expandafter\let\csname caption@ifpkg@#1\endcsname\@firstoftwo} -\newcommand*\caption@pkg@false[1]{% - \global\expandafter\let\csname caption@ifpkg@#1\endcsname\@secondoftwo} +\newcommand*\caption@ifpackageloaded[4]{% + \caption@ifdefined#3#3{% + \caption@Error{Option `#2' requires the `#1' package\MessageBreak + (or an alternative definition of \string#3)}% + #4}} % \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@pkg@list} +% \changes{v1.4f}{2012/01/12}{This macro added} +% We use this as list of packages loaded |\AtBeginDocument|. +% (Note: Old |.aux| files could contain |\@cons|\-|\caption@pkg@list|\-|{{|\meta{package}|}}|, +% so this macro should always be defined, even if we change the following code in the future.) % \begin{macrocode} \newcommand*\caption@pkg@list{} -\newcommand*\caption@addto@pkg@list[1]{% - \protected@write\@auxout{}{% - \string\@cons\string\caption@pkg@list{{#1}}}} % \end{macrocode} % \begin{macrocode} -\AtBeginDocument{% +\caption@AtBeginDocument{% \def\caption@tempa{\endgroup}% \begingroup \def\@elt#1{% \g@addto@macro\caption@tempa{% - \caption@RequirePackage{#1}% - \@namedef{caption@ifpkg@#1}{% - \caption@addto@pkg@list{#1}% - \caption@pkg@true{#1}% - \caption@ifpkg{#1}}}}% + \caption@InfoNoLine{Load package `#1'}% + \RequirePackage{#1}\relax}}% \caption@pkg@list \caption@tempa} % \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@check@ragged} +% \changes{v1.4h}{2020/01/03}{This macro added} +% In the past we tried to load the \package{ragged2e} package automatically if needed. +% But since we have dropped this unreliable code users will get an error message instead. +% To compensate for this change we try to detect the usage of the \package{ragged2e} +% at least within the preamble of the document. +% (Note: Checking the name of the option is not sufficient here since it could have +% been re-defined by the user. So we have to check the option code instead.) +% \begin{macrocode} +\@ifpackageloaded{ragged2e}{\let\caption@check@ragged\@gobble}{% +% \end{macrocode} +% \begin{macrocode} + \newcommand*\caption@check@ragged[1]{% + \begingroup + \def\caption@tempa{#1}% + \caption@check@ragged@{Centering}% + \caption@check@ragged@{RaggedLeft}% + \caption@check@ragged@{RaggedRight}% + \endgroup}% +% \end{macrocode} +% \begin{macrocode} + \newcommand*\caption@check@ragged@[1]{% + \expandafter\def\expandafter\caption@tempb\expandafter{\csname caption@#1\endcsname}% + \ifx\caption@tempa\caption@tempb % our definition of `ragged2e' option? + \@ifundefined{#1}{% + \caption@Info{Usage of `ragged2e' command \expandafter\string\csname #1\endcsname\space detected}% + \@cons\caption@pkg@list{{ragged2e}}% load `ragged2e' package later on + \global\let\caption@check@ragged\@gobble}{}% + \fi + }% +% \end{macrocode} % \begin{macrocode} -\newcommand*\caption@RequirePackage[1]{% - \caption@Info{We need package `#1'}% - \RequirePackage{#1}} -\@onlypreamble\caption@RequirePackage + \caption@AtBeginDocument{% + \let\caption@check@ragged\@gobble + \let\caption@check@ragged@\@undefined}} +% \end{macrocode} +% Make the \package{subfig} package documentation compile. +% \begin{macrocode} +%%\@ifl@aded{dtx}{subfig}{\RequirePackage{ragged2e}\relax}{} % not needed +\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}} +\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}} % \end{macrocode} % \end{macro} % @@ -3604,10 +3659,10 @@ \caption@ifdefined\ForEachFloatingEnvironment {\ForEachFloatingEnvironment{#1}}% {\def\@elt##1{#1}% - \caption@ifdefined\c@figure\@elt\@gobble{figure}% - \caption@ifdefined\c@table\@elt\@gobble{table}% - \let\@elt\relax - \newfloat@addtohook{#1}}} + \caption@ifdefined\c@figure\@elt\@gobble{figure}% + \caption@ifdefined\c@table\@elt\@gobble{table}% + \let\@elt\relax + \newfloat@addtohook{#1}}} % \end{macrocode} % \begin{macrocode} \providecommand\newfloat@addtohook[1]{% @@ -3629,6 +3684,7 @@ % \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} % |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\ % |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\par % The starred variant provides the numbering format @@ -3649,15 +3705,19 @@ \@ifundefined{c@#3}% {\caption@Error{No float type '#3' defined}}% % \end{macrocode} +% Check if the sub-type was already defined by |\Declare|\-|Sub|\-|Type|. +% If not, define the counter and list entry. % \begin{macrocode} - {\@ifundefined{c@sub#3}% - {\caption@Debug{New subtype `sub#3'}% - \newcounter{sub#3}% - \@addtoreset{sub#3}{#3}% - \@namedef{ext@sub#3}{\csname ext@#3\endcsname}% - \caption@declaresublistentry{#3}% - \@cons\caption@subtypelist{{#3}}}% - {\caption@Debug{Modify caption `sub#3'}}% + {\caption@ifsubtype{sub#3}% + {\caption@Debug{Modify subtype `sub#3'}}% + {\caption@Debug{New subtype `sub#3'}% + \@ifundefined{c@sub#3}% + {\newcounter{sub#3}\relax}% + {\caption@Warning{Using already defined counter `sub#3'}}% + \@addtoreset{sub#3}{#3}% + \@namedef{ext@sub#3}{\csname ext@#3\endcsname}% + \caption@declaresublistentry{#3}% + \@cons\caption@subtypelist{{#3}}}% % \end{macrocode} % Support of \package{titletoc} package % \begin{macrocode} @@ -3745,6 +3805,25 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\caption@ifsubtype} +% \changes{v1.8g}{2020/01/02}{This macro added} +% This macro checks if the given subtype was defined +% with |\Declare|\-|Caption|\-|Sub|\-|Type| or not. +% \begin{macrocode} +\newcommand*\caption@ifsubtype[1]{% + \begingroup + \let\next\@secondoftwo + \edef\@tempa{#1}% + \def\@elt##1{% + \def\@tempb{sub##1}% + \ifx\@tempa\@tempb + \let\next\@firstoftwo + \fi}% + \caption@subtypelist + \expandafter\endgroup\next} +% \end{macrocode} +% \end{macro} +% % Unfortunately the \class{memoir} document class resets the % \texttt{subfigure} resp.~\texttt{subtable} counter at the begin % of floating environments, i.e.~at |\@float|. diff --git a/Master/texmf-dist/source/latex/caption/ltcaption.dtx b/Master/texmf-dist/source/latex/caption/ltcaption.dtx index 1365f2ecc88..343dbf695b4 100644 --- a/Master/texmf-dist/source/latex/caption/ltcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/ltcaption.dtx @@ -18,11 +18,14 @@ % % This Current Maintainer of this work is Axel Sommerfeldt. % -% This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx, -% the derived files caption.sty, caption2.sty, caption3.sty, -% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty, -% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% This work consists of the files +% caption.ins, caption.dtx, caption2.dtx, caption3.dtx, +% bicaption.dtx, ltcaption.dtx, subcaption.dtx, totalcount.dtx, +% the derived files +% caption.sty, caption2.sty, caption3.sty, +% bicaption.sty, ltcaption.sty, subcaption.sty, totalcount.sty, +% and the user manuals +% caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi % \CheckSum{378} diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx index 2571963bfea..3b58669d79c 100644 --- a/Master/texmf-dist/source/latex/caption/subcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx @@ -2,7 +2,7 @@ % % This is file `subcaption.dtx'. % -% Copyright (C) 2007-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) +% Copyright (C) 2007-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % @@ -18,14 +18,17 @@ % % This Current Maintainer of this work is Axel Sommerfeldt. % -% This work consists of the files caption.ins, caption.dtx, caption2.dtx, -% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx, -% the derived files caption.sty, caption2.sty, caption3.sty, -% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty, -% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. +% This work consists of the files +% caption.ins, caption.dtx, caption2.dtx, caption3.dtx, +% bicaption.dtx, ltcaption.dtx, subcaption.dtx, totalcount.dtx, +% the derived files +% caption.sty, caption2.sty, caption3.sty, +% bicaption.sty, ltcaption.sty, subcaption.sty, totalcount.sty, +% and the user manuals +% caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{235} +% \CheckSum{229} % % \iffalse %<*driver> @@ -921,7 +924,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{subcaption}[2019/09/01 v1.3a Sub-captions (AR)] +\ProvidesPackage{subcaption}[2020/01/03 v1.3b Sub-captions (AR)] % \end{macrocode} % % \subsection{Initial code} @@ -1211,48 +1214,42 @@ % \changes{v0.4}{2008/03/01}{This macro added} % \changes{v1.0c}{2011/01/22}{This macro removed since it's too incompatible with the one from \package{subfig}} % \changes{v1.3}{2019/08/31}{This macro re-added and revised} -% \changes{v1.3a}{2019/09/01}{\cs{ignorespaces} copied from \cs{\sf@@@subfloat}} +% \changes{v1.3a}{2019/09/01}{\cs{ignorespaces} copied from \cs{sf@@@subfloat}} +% \changes{v1.3b}{2020/01/03}{Previous definition of \cs{subfloat} will be overwritten} % |\subfloat|\oarg{list\_entry}\oarg{sub-caption}\marg{body}\par % If \meta{sub-caption} is given, we map this to |\sub|\-|caption|\-|box| % but transfer the |\label| from \meta{body} to \meta{sub-caption}. % If not, we do the same as |\sub|\-|caption|\-|box| does, but use |\phantom|\-|caption| instead of |\caption|. % In both cases we do a |\ignore|\-|spaces| at the end since the original implementation of |\sub|\-|float| does this, too. % \begin{macrocode} -\caption@ifundefined\subfloat{% +\def\subfloat{% + \@ifnextchar[\@subfloat\subfloat@} % \end{macrocode} % \begin{macrocode} - \newcommand*\subfloat{% - \@ifnextchar[\@subfloat\subfloat@} +\long\def\@subfloat[#1]{% + \@ifnextchar[{\@@subfloat{#1}}{\@@@subfloat\subcaptionbox{#1}}} % \end{macrocode} % \begin{macrocode} - \long\def\@subfloat[#1]{% - \@ifnextchar[{\@@subfloat{#1}}{\@@@subfloat\subcaptionbox{#1}}} +\long\def\@@subfloat#1[#2]{% + \@@@subfloat{\subcaptionbox[{#1}]}{#2}} % \end{macrocode} % \begin{macrocode} - \long\def\@@subfloat#1[#2]{\@@@subfloat{\subcaptionbox[{#1}]}{#2}} +\long\def\@@@subfloat#1#2#3{% + \caption@getlabel#3\label{}\@nil + #1{#2\caption@thelabel}{\let\label\caption@gobble#3}% + \global\let\caption@thelabel\relax + \ignorespaces} % \end{macrocode} % \begin{macrocode} - \newcommand\@@@subfloat[3]{% - \caption@getlabel#3\label{}\@nil - #1{#2\caption@thelabel}{\let\label\caption@gobble#3}% - \global\let\caption@thelabel\relax - \ignorespaces} -% \end{macrocode} -% \begin{macrocode} - \newcommand*\subfloat@[1]{% - \setbox\@tempboxa\hbox{#1}% - \caption@iiiibox\setcaptionsubtype - {\phantomcaption\@gobble}{\phantomcaption\@gobble}% no box with \caption - {}% no optional arguments for \caption - {}% no sub-caption - [\wd\@tempboxa][\caption@hj@default]% - {\unhbox\@tempboxa}% - \ignorespaces} -% \end{macrocode} -% \begin{macrocode} -}{% - \PackageInfo{subcaption}{\protect\subfloat\space is already defined\@gobble} -} +\def\subfloat@#1{% + \setbox\@tempboxa\hbox{#1}% + \caption@iiiibox\setcaptionsubtype + {\phantomcaption\@gobble}{\phantomcaption\@gobble}% no box with \caption + {}% no optional arguments for \caption + {}% no sub-caption + [\wd\@tempboxa][\caption@hj@default]% + {\unhbox\@tempboxa}% + \ignorespaces} % \end{macrocode} % \end{macro} % |