diff options
Diffstat (limited to 'Master/texmf-dist/source/latex')
15 files changed, 703 insertions, 447 deletions
diff --git a/Master/texmf-dist/source/latex/caption/bicaption.dtx b/Master/texmf-dist/source/latex/caption/bicaption.dtx index f2a52185c93..5bba05cb2ff 100644 --- a/Master/texmf-dist/source/latex/caption/bicaption.dtx +++ b/Master/texmf-dist/source/latex/caption/bicaption.dtx @@ -2,7 +2,7 @@ % % This is file `bicaption.dtx'. % -% Copyright (C) 2010-2018 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) +% Copyright (C) 2010-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % @@ -32,12 +32,12 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{431} +% \CheckSum{457} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{bicaption.drv}[2016/03/27 v1.2 Adds a bilingual caption feature to the caption package] +\ProvidesFile{bicaption.drv}[2020/10/25 v1.3 Adds a bilingual caption feature to the caption package] \hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up. %\errorcontextlines=3 % @@ -45,17 +45,11 @@ \setlength\parindent{0pt} \setlength\parskip{\smallskipamount} % -\newcommand\LineBreak{\linebreak[3]} -\newcommand\PageBreak{\pagebreak[3]} \usepackage{ifpdf} \ifpdf \usepackage{mathptmx,courier} \usepackage[scaled=0.90]{helvet} \addtolength\marginparwidth{15pt} - \ifdim\paperheight=297mm % a4paper - \renewcommand\LineBreak{\\} - \renewcommand\PageBreak{\clearpage} - \fi \fi % \usepackage[T1]{fontenc} @@ -79,7 +73,7 @@ % \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} -\newcommand*\version[2][]{$v#2$} +\newcommand*\version[2][]{v$#2$} % \usepackage{marvosym} \makeatletter @@ -167,16 +161,17 @@ % \label{sec:options} % % \DescribeMacro{\captionsetup} +% The command % \begin{quote} % |\captionsetup[bi]|\marg{options} % \end{quote} -% do setup options which will be used for bilanguage captions \emph{additionally} +% does setup options which will be used for bilanguage captions \emph{additionally} % to the ones which are setup for the specific floating environment. % % \begin{quote} % |\captionsetup[bi-first]|\marg{options} % \end{quote} -% do setup options which will be used for the \emph{first} heading +% does setup options which will be used for the \emph{first} heading % of the bilanguage captions \emph{additionally} % to the ones which are setup for the specific floating environment % and the ones which are setup by |\captionsetup[bi]{|\ldots|}|. @@ -184,16 +179,16 @@ % \begin{quote} % |\captionsetup[bi-second]|\marg{options} % \end{quote} -% do setup options which will be used for the \emph{second} heading +% does setup options which will be used for the \emph{second} heading % of the bilanguage captions \emph{additionally} % to the ones which are setup for the specific floating environment % and the ones which are setup by |\captionsetup[bi]{|\ldots|}|. % % \bigskip % -% Options specified with |\use|\-|package[|\ldots|]{bi|\-|caption}| and -% |\caption|\-|setup[bi|\ldots|]{|\ldots|}| will override the ones specified by -% |\caption|\-|setup{|\ldots|}| and |\caption|\-|setup[fig|\-|ure]{|\ldots|}| +% Options specified with |\use|\-|package[|\ldots|]{bi|\-|cap|\-|tion}| and +% |\cap|\-|tion|\-|setup[bi|\ldots|]{|\ldots|}| will override the ones specified by +% |\cap|\-|tion|\-|setup{|\ldots|}| and |\cap|\-|tion|\-|setup[fig|\-|ure]{|\ldots|}| % (same for `table'). So finally we have the following order how % settings for bilingual captions are applied: % \begin{enumerate} @@ -242,7 +237,6 @@ % % \begin{Options}{language=} % \item[lang=] -% \DescribeMacro{language=} % Sets the language of the caption, e.g. % \begin{quote}|\use|\-|package|\-|[lang=eng|\-|lish]{bi|\-|caption}|\end{quote} % will typeset the second caption of bilingual captions in English. @@ -250,7 +244,6 @@ % see \autoref{sec:babel} for details.) % % \item[bi-lang=] -% \DescribeMacro{bi-lang=} % Causes a selection of the headings of bilingual captions. % \begin{quote}|\captionsetup{bi-lang=both}|\end{quote} % will cause that both caption headings are being typeset.\\ @@ -261,18 +254,42 @@ % will cause that only the \emph{second} heading is being typeset. % % \item[bi-slc=] -% \DescribeMacro{bi-singlelinecheck=} -% Switches the common single-line-check |on| or |off|, i.e.~when switched on +% \begin{quote}|\captionsetup{bi-slc=|\meta{bool}|}|\end{quote} +% switches the common single-line-check |on| or |off|, i.e.~when switched on % only a single check will be done for both captions, and the result will affect % both captions afterwards. So if only one caption is longer than a single line, % both captions will be treated as if they are longer than a single line, even if % the second one isn't. (The default is |on|.) % % \item[bi-swap=] -% \DescribeMacro{bi-swap=} % \begin{quote}|\captionsetup{bi-swap}|\end{quote} % will swap the primary and secondary language, % making the first language the second one and vice versa. (The default is |false|.) +% +% \NEWfeature{v1.3} +% \item[bi-separator=] +% \begin{quote}|\captionsetup{bi-separator=|\meta{name}|}|\end{quote} +% will select a separator between first and second bilingual caption. +% You could choose one of the following: `none' (which is the default one +% and could also be addressed as `default'), `smallskip', `medskip', +% `largeskip', or a self-defined one using +% \DescribeMacro{\DeclareBiCaptionSeparator} +% \begin{quote}|\DeclareBiCaptionSeparator|\marg{name}\marg{code}\end{quote} +% Examples: +% \begin{quote} +% |\captionsetup{bi-separator=smallskip}| +% \end{quote} +% will put a |\smallskip| between the two bilingual captions. +% \begin{quote} +% |\DeclareBiCaptionSeparator{hrule}{\hrule}|\\ +% |\captionsetup{bi-separator=hrule}| +% \end{quote} +% will draw a horizontal line between the two bilingual captions. +% \begin{quote} +% |\DeclareBiCaptionSeparator{3pt}{\vspace{3pt}}|\\ +% |\captionsetup{bi-separator=3pt}| +% \end{quote} +% will put |3pt| vertical space between the two bilingual captions. % \end{Options} % % \section{The \cs{bicaption} commands} @@ -337,7 +354,7 @@ % \cs{subcaptionbox}.) % \endgroup % -% \PageBreak +% \pagebreak[3] % \section{A sample document} % \label{sec:example} % @@ -444,7 +461,7 @@ % |\end{document}| % \end{quote} % -% \PageBreak +% \pagebreak[3] % \captionsetup[bi-first]{lang=german} % \captionsetup[bi-second]{lang=english,font=it} % \captionsetup[sub]{format=hang,list=on} @@ -535,7 +552,7 @@ % {Short English heading} % \end{figure} % -% \PageBreak +% \pagebreak[3] % \section{Customising lists} % \label{sec:lists} % @@ -831,7 +848,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{bicaption}[2020/08/23 v1.2a Bilingual Captions (AR)] +\ProvidesPackage{bicaption}[2020/10/25 v1.3 Bilingual Captions (AR)] % \end{macrocode} % \begin{macrocode} \RequirePackage{caption}[2020/08/23] % needs v3.5 or newer @@ -953,6 +970,37 @@ \caption@set@bool\bicaption@ifswap{#1}} % \end{macrocode} % +% The option |bi-separator| will setup the separator between +% the two bi-lingual captions. +% \begin{macrocode} +\DeclareCaptionOption{bi-separator}[1]{% + \caption@set{biseparator}{#1}} +% \end{macrocode} +% +% \begin{macro}{\DeclareBiCaptionSeparator} +% \changes{v1.3}{2020/10/25}{This macro added} +% |\DeclareBiCaptionSeparator|\marg{name}\marg{code} +% \begin{macrocode} +\newcommand\DeclareBiCaptionSeparator[2]{% + \caption@decl{biseparator}{#1}{#2}} +\@onlypreamble\DeclareBiCaptionSeparator +% \end{macrocode} +% \end{macro} +% +% There are four pre-defined separators, called `none', +% `smallskip', `medskip', and `bigskip'. +% \begin{macrocode} +\DeclareBiCaptionSeparator{none}{} +\DeclareBiCaptionSeparator{smallskip}{\smallskip} +\DeclareBiCaptionSeparator{medskip}{\medskip} +\DeclareBiCaptionSeparator{bigskip}{\bigskip} +% \end{macrocode} +% +% The default separator usually maps to `none'. +% \begin{macrocode} +\SetCaptionDefault{biseparator}{none} +% \end{macrocode} +% % The option |lang=|\meta{language} will setup the language of the caption. % We can't set the language immediately because otherwise we will get in trouble, e.g. when % using the \package{microtype} package via |\usepackage[babel]{microtype}|. @@ -1052,9 +1100,10 @@ % \pagebreak[3] % \subsection{Execution of options} % -% Setup default values for |bi-lang| and |bi-singlelinecheck|. +% Setup default values for |bi-lang|, |bi-single|\-|line|\-|check|, +% |bi-swap|, and |bi-separator|. % \begin{macrocode} -\caption@ExecuteOptions{caption}{bi-lang=0,bi-slc=1,bi-swap=0} +\caption@ExecuteOptions{caption}{bi-lang=0,bi-slc=1,bi-swap=0,bi-separator=default} % \end{macrocode} % % Set the language for the first caption. @@ -1178,6 +1227,7 @@ % % \begin{macro}{\bicaption@@make} % \changes{v1.1}{2015/09/16}{\cs{bicaption@label} replaced by \cs{caption@thelabel}} +% \changes{v1.3}{2020/10/25}{Usage of \cs{caption@biseparator} added} % |\bicaption@@make|\marg{text \#2}\marg{label}\marg{text \#1}\par % Typeset both captions using the original version of \cs{caption@@make}. % \begin{macrocode} @@ -1191,8 +1241,8 @@ % \begin{macrocode} \ifnum\bicaption@lang=0\relax \bicaption@ifslc - {\caption@slc{#2}{#3}{}{\KV@caption@singlelinecheck0}% - \caption@slc{#2}{#1}{}{\KV@caption@singlelinecheck0}}% + {\caption@slc{#2}{#3}{}{\caption@setsinglelinecheck0}% + \caption@slc{#2}{#1}{}{\caption@setsinglelinecheck0}}% {}% \fi % \end{macrocode} @@ -1202,17 +1252,20 @@ \ifnum\bicaption@lang=2\relax \caption@thelabel \global\let\caption@thelabel\relax + \let\bicaption@tempa\relax \else \begingroup \caption@setoptions{bi-first}% \caption@@make@{#2}{#3}% \endgroup + \def\bicaption@tempa{\bicaption@separator\caption@biseparator}% \fi % \end{macrocode} % Typeset the second caption, if requested. % \begin{macrocode} \ifnum\bicaption@lang=1\relax \else + \bicaption@tempa \begingroup \caption@setoptions{bi-second}% \caption@@make@{#2}{#1}% @@ -1220,6 +1273,9 @@ \fi } % \end{macrocode} +% \begin{macrocode} +\newcommand*\bicaption@separator{\par} +% \end{macrocode} % \end{macro} % % \pagebreak[3] diff --git a/Master/texmf-dist/source/latex/caption/caption-ams-smf.dtx b/Master/texmf-dist/source/latex/caption/caption-ams-smf.dtx index e36d586fb5b..cc036505c66 100644 --- a/Master/texmf-dist/source/latex/caption/caption-ams-smf.dtx +++ b/Master/texmf-dist/source/latex/caption/caption-ams-smf.dtx @@ -80,7 +80,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$} % % \GetFileInfo{caption-ams-smf.drv} % \let\docdate\filedate diff --git a/Master/texmf-dist/source/latex/caption/caption-beamer.dtx b/Master/texmf-dist/source/latex/caption/caption-beamer.dtx index 57993b5c49e..934f489f4a5 100644 --- a/Master/texmf-dist/source/latex/caption/caption-beamer.dtx +++ b/Master/texmf-dist/source/latex/caption/caption-beamer.dtx @@ -75,7 +75,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$} % % \GetFileInfo{caption-beamer.drv} % \let\docdate\filedate diff --git a/Master/texmf-dist/source/latex/caption/caption-elsarticle.dtx b/Master/texmf-dist/source/latex/caption/caption-elsarticle.dtx index c7f0922c145..878e8550229 100644 --- a/Master/texmf-dist/source/latex/caption/caption-elsarticle.dtx +++ b/Master/texmf-dist/source/latex/caption/caption-elsarticle.dtx @@ -75,7 +75,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$} % % \GetFileInfo{caption-elsarticle.drv} % \let\docdate\filedate diff --git a/Master/texmf-dist/source/latex/caption/caption-eng.tex b/Master/texmf-dist/source/latex/caption/caption-eng.tex index a26aa0ca3b3..21a61546bef 100644 --- a/Master/texmf-dist/source/latex/caption/caption-eng.tex +++ b/Master/texmf-dist/source/latex/caption/caption-eng.tex @@ -31,7 +31,7 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{caption-eng.tex}[2020/09/12 v3.5 The caption package] +\ProvidesFile{caption-eng.tex}[2020/09/21 v3.5 The caption package] \hbadness=9999 \newcount\hbadness \hfuzz=20pt % Make TeX shut up. %\errorcontextlines=3 @@ -115,7 +115,7 @@ \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} -\newcommand*\version[2][]{$v#2$} +\newcommand*\version[2][]{v$#2$} \newcommand*\x{\discretionary{}{}{}} \newenvironment{Annotation}% @@ -253,7 +253,7 @@ It documents the options and commands available in version \version{3.1} of the What now? \begin{itemize} \item - I will start revising this documentation in the next weeks, finally bringing it up-to-date. + I will update this documentation in the next weeks, finally bringing it up-to-date. \item Until the revised documentation is ready the most recent version could be found at \url{https://gitlab.com/axelsommerfeldt/caption/-/blob/master/doc/caption-eng.pdf} @@ -447,10 +447,14 @@ you specify how the caption label will be typeset. There are five standard caption label formats: \begin{Options}{\OptionLabel} - \item[default] + \item[original] The caption label will be typeset as specified by the document class, usually this means the name and the number (like \texttt{simple}). - (This is the default behaviour.) + + Until \version{3.4} of \thispackage\ this label format was called `default'. + Since \version{3.5} it is called `original' and usually is the default label + format, so |label|\-|format=|\-|default| will still select this label format, + unless the default was changed by either a document class or babel language package. \item[empty] The caption label will be empty. @@ -4147,36 +4151,51 @@ could be used to adapt the \package{caption} package default values: \DescribeMacro{\SetCaptionDefault} The command -\begin{quote}|\SetCaptionDefault*|\marg{option}\marg{default value}\end{quote} +\begin{quote} + |\SetCaptionDefault*|\marg{option}\marg{default value} +\end{quote} changes the default value for the option \meta{option}, for example: \begin{quote} -|\SetCaptionDefault{format}{hang}|\\ -|\SetCaptionDefault{justification}{raggedright}|\\ -|\DeclareCaptionLabelSeparator{silly}{ +++ }|\\ -|\SetCaptionDefault{labelseparator}{silly}| + |\SetCaptionDefault{format}{hang}|\\ + |\SetCaptionDefault{justification}{raggedright}|\\ + |\DeclareCaptionLabelSeparator{silly}{ +++ }|\\ + |\SetCaptionDefault{labelseparator}{silly}| \end{quote} This command is available for the options -|box|, -|font|, -|format|, -|justification|, -|label|\-|font|, -|label|\-|format|, -|label|\-|separator|, -|list|\-|format|, -|margin|, -|parbox|, -|position|, -|single|\-|line|\-|check|, -|text|\-|font|, -|text|\-|format|, and -|width|. + |box|, + |font|, + |format|, + |justification|, + |label|\-|font|, + |label|\-|format|, + |label|\-|separator|, + |list|\-|format|, + |margin|, + |parbox|, + |position|, + |single|\-|line|\-|check|, + |text|\-|font|, + |text|\-|format|, and + |width|. The starred variant only makes a difference when setting the default length of either |margin| or |width|, in this case it will use |\def| internally instead of |\edef| to store the value so the actual margin will be calculated when used (and not when set). +\DescribeMacro{\SetCaptionFallback} +The command +\begin{quote} + |\SetCaptionFallback|\marg{option}\marg{fallback value} +\end{quote} +changes the fallback value for the option \meta{option}, for example: +\begin{quote} + |\SetCaptionFallback{labelformat}{simple}| +\end{quote} +Currently only the pre-defined label format `original' uses a fallback +value when |\fnum@|\meta{environment} is not defined for the current (floating) +environment. + \DescribeMacro{\AtCaptionPackage} The adaption file will be loaded when the \package{caption} kernel |caption3.sty| will be loaded so the given adaptions will be done for the \package{floatrow} diff --git a/Master/texmf-dist/source/latex/caption/caption-koma.dtx b/Master/texmf-dist/source/latex/caption/caption-koma.dtx index dc76dbad1cb..380a054df98 100644 --- a/Master/texmf-dist/source/latex/caption/caption-koma.dtx +++ b/Master/texmf-dist/source/latex/caption/caption-koma.dtx @@ -79,7 +79,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$} % % \GetFileInfo{caption-koma.drv} % \let\docdate\filedate @@ -193,7 +193,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{caption-koma.sto}[2020/09/12 v2.0a Adaption of the caption package to the KOMA-Script document classes (AR)] +\ProvidesFile{caption-koma.sto}[2020/09/21 v2.0b Adaption of the caption package to the KOMA-Script document classes (AR)] % \end{macrocode} % % \section{Margin resp. width} @@ -380,9 +380,9 @@ % % \section{Label format} % -% The `default' caption label format maps to `autodot'. +% The `fallback' caption label format maps to `autodot'. % \begin{macrocode} -\SetCaptionDefault{labelformat}{autodot} +\SetCaptionFallback{labelformat}{autodot} % \end{macrocode} % % \section{Label separator} diff --git a/Master/texmf-dist/source/latex/caption/caption-light.dtx b/Master/texmf-dist/source/latex/caption/caption-light.dtx index 3b9b9071121..c56734a4142 100644 --- a/Master/texmf-dist/source/latex/caption/caption-light.dtx +++ b/Master/texmf-dist/source/latex/caption/caption-light.dtx @@ -75,7 +75,7 @@ % \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} -\newcommand*\version[2][]{$v#2$} +\newcommand*\version[2][]{v$#2$} % \usepackage{marvosym} \makeatletter diff --git a/Master/texmf-dist/source/latex/caption/caption-memoir.dtx b/Master/texmf-dist/source/latex/caption/caption-memoir.dtx index 1233515b1c8..1f29e68cb80 100644 --- a/Master/texmf-dist/source/latex/caption/caption-memoir.dtx +++ b/Master/texmf-dist/source/latex/caption/caption-memoir.dtx @@ -32,12 +32,12 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{7} +% \CheckSum{56} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{caption-memoir.drv}[2018/05/24 v2.0 Implementation of the caption-memoir package] +\ProvidesFile{caption-memoir.drv}[2020/10/10 v2.1 Implementation of the caption-memoir package] \hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up. %\errorcontextlines=3 % @@ -75,7 +75,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$} % % \GetFileInfo{caption-memoir.drv} % \let\docdate\filedate @@ -183,7 +183,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{caption-memoir.sto}[2020/07/31 v2.0 Adaption of the caption package to the memoir document class (AR)] +\ProvidesFile{caption-memoir.sto}[2020/10/10 v2.1 Adaption of the caption package to the memoir document class (AR)] % \end{macrocode} % % \section{Adaptions already included in the caption package} @@ -193,24 +193,115 @@ % \item \cs{@caption} expands \cs{memcaptioninfo} % \item \cs{caption@prepareanchor} expands \cs{M@gettitle} % \item \cs{caption@refstepcounter} expands \cs{donemaincaptiontrue} -% \item Since the \class{memoir} document class resets the sub-caption -% counter at |\@float|, right after |\done|\-|main|\-|caption|\-|false|, -% all sub-caption counters will be saved at |\done|\-|main|\-|caption|\-|false| -% so they can (and will) be restored using |\caption@|\-|restore|\-|counters| -% at |\continued|\-|float|. +% \item All sub-caption counters will be reset at |\@mem|\-|reset|\-|sub|\-|counter|, +% even if they weren't defined by the \class{memoir} document class itself. +% As work-around this command will be patched to protect the counters +% defined by |\Declare|\-|Caption|\-|Sub|\-|Type|. % \end{itemize} % % \section{Single-line-check} % % \begin{macro}{\caption@prepareslc} -% \changes{v1.4a}{2011/10/21}{Redefinition of \cs{pagenote} from \textsf{memoir} document class added} -% We re-define \cs{pagenote} here so it won't disturb the single-line-check. +% \changes{v1.4a}{2011/10/21}{Re-definition of \cs{pagenote} added} +% We re-define \cs{pagenote} here so it won't disturb the single-line-check. % \begin{macrocode} \g@addto@macro\caption@prepareslc{% \let\pagenote\caption@gobble} % \end{macrocode} % \end{macro} % +% \section{Label separator} +% +% The `default' caption label separator maps to \cs{@contdelim}. +% \begin{macrocode} +\DeclareCaptionLabelSeparator{@contdelim}{\@contdelim} +\SetCaptionDefault{labelseparator}{@contdelim} +% \end{macrocode} +% +% \begin{macro}{\captiondelim} +% \changes{v2.1}{2020/10/10}{Re-definition of \cs{captiondelim} added} +% We re-define |\caption|\-|delim| so it will set the \package{caption3} label separator setting, too. +% \begin{macrocode} +\let\caption@memoir@delim\captiondelim +\renewcommand\captiondelim{% + \captionsetup{labelsep=@contdelim}% + \caption@memoir@delim} +% \end{macrocode} +% \end{macro} +% +% \changes{v2.0a}{2020/10/10}{Re-definition of label separator `gobble' added} +% If |\fnum@figure| (or |\fnum@table| or\ldots) ends with |\@gobble|, the `:' part of the caption +% label separator will be suppressed when a standard document class (\class{article}, \class{report}, +% or \class{book}) will be used, leaving the following space character intact. +% This is different when using the \class{memoir} document class, in this case the complete +% label separator will be suppressed. For this reason we re-define the pre-defined caption label +% separator `gobble' to emulate this behaviour. +% +% \begin{macrocode} +\DeclareCaptionLabelSeparator{gobble}{} +% \end{macrocode} +% +% \section{Fonts} +% +% The `default' caption fonts map to \cs{@contnfont} resp.~\cs{conttfont}. +% \begin{macrocode} +\DeclareCaptionFont{@contnfont}{\@contnfont} +\SetCaptionDefault{labelfont}{@contnfont} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionFont{@conttfont}{\@conttfont} +\SetCaptionDefault{textfont}{@conttfont} +% \end{macrocode} +% +% \begin{macro}{\captionnamefont} +% \changes{v2.1}{2020/10/10}{Re-definition of \cs{captionnamefont} added} +% We re-define |\caption|\-|delim| so it will set the \package{caption3} label separator setting, too. +% \begin{macrocode} +\let\caption@memoir@namefont\captionnamefont +\renewcommand\captionnamefont{% + \captionsetup{labelfont=@contnfont}% + \caption@memoir@namefont} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\captiontitlefont} +% \changes{v2.1}{2020/10/10}{Re-definition of \cs{captiontitlefont} added} +% We re-define |\caption|\-|delim| so it will set the \package{caption3} label separator setting, too. +% \begin{macrocode} +\let\caption@memoir@titlefont\captiontitlefont +\renewcommand\captiontitlefont{% + \captionsetup{textfont=@conttfont}% + \caption@memoir@titlefont} +% \end{macrocode} +% \end{macro} +% +% \section{Vertical spaces before and after captions} +% +% The \class{memoir} document classes uses |\above|\-|caption|\-|skip| and |\below|\-|caption|\-|skip| +% different than the standard document classes and the \package{caption} package: +% They always typeset |\above|\-|caption|\-|skip| before the caption and +% |\below|\-|caption|\-|skip| after the captions. Both are preset to |0.5\one|\-|line|\-|skip|. +% +% For this reason we have to set the |\below|\-|caption|\-|skip| to |0pt| if the \package{caption} +% package is used, so no extra vertical space will be created. +% +% \begin{macrocode} +\AtCaptionPackage{\setlength\belowcaptionskip{0pt}} +% \end{macrocode} +% +% \section{TODO} +% +% \begin{macrocode} +% TODO: \captionstyle +% TODO: \captionwidth, \changecaptionwidth, \normalcaptionwidth +% TODO: \hangcaption, \indentcaption, \normalcaption +% TODO: \precaption, \postcaption, \midbicaption +% TODO: \captiontitlefinal +% TODO: \contcaption +% TODO: \newfixedcaption, \renewfixedcaption, \providefixedcaption +% +% \end{macrocode} +% % \iffalse %</package> % \fi diff --git a/Master/texmf-dist/source/latex/caption/caption-ntg.dtx b/Master/texmf-dist/source/latex/caption/caption-ntg.dtx index 61c6ed8116c..97e0379f5f5 100644 --- a/Master/texmf-dist/source/latex/caption/caption-ntg.dtx +++ b/Master/texmf-dist/source/latex/caption/caption-ntg.dtx @@ -77,7 +77,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$} % % \GetFileInfo{caption-ntg.drv} % \let\docdate\filedate diff --git a/Master/texmf-dist/source/latex/caption/caption-thesis.dtx b/Master/texmf-dist/source/latex/caption/caption-thesis.dtx index a26ea7b31a2..c358eadff1c 100644 --- a/Master/texmf-dist/source/latex/caption/caption-thesis.dtx +++ b/Master/texmf-dist/source/latex/caption/caption-thesis.dtx @@ -75,7 +75,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$} % % \GetFileInfo{caption-thesis.drv} % \let\docdate\filedate 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 diff --git a/Master/texmf-dist/source/latex/caption/caption2.dtx b/Master/texmf-dist/source/latex/caption/caption2.dtx index 074dd7c6303..9e6850dfe69 100644 --- a/Master/texmf-dist/source/latex/caption/caption2.dtx +++ b/Master/texmf-dist/source/latex/caption/caption2.dtx @@ -32,7 +32,7 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{868} +% \CheckSum{864} % % \iffalse %<*driver> @@ -211,7 +211,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption2}[2020/01/02 v2.2e Customising captions (AR)] +\ProvidesPackage{caption2}[2020/09/28 v2.2f Customising captions (AR)] % \end{macrocode} % % \changes{v2.2b}{2007/06/15}{Made obsolete warning even more annoying} @@ -230,7 +230,7 @@ % \subsection{Loading the caption3 kernel} % % \begin{macrocode} -\RequirePackage{caption3}[2019/12/31] % should be used with v1.8f or newer +\RequirePackage{caption3}[2020/09/28] % needs v2.2a 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}. @@ -242,15 +242,25 @@ \let\DeclareCaptionSubType\@undefined % \end{macrocode} % +% \begin{macro}{\captiontwo@Error} +% \changes{v2.2f}{2020/09/28}{This macro added} +% |\captiontwo@Error|\marg{message}\\ +% issues an error message (with code line indication). +% \begin{macrocode} +\newcommand*\captiontwo@Error[2][]{% + \PackageError{caption2}{#2}{#1\caption@@eh{caption2}}} +% \end{macrocode} +% \end{macro} +% % \subsection{Check against the regular caption package} % \changes{v2.2}{2007/04/06}{Check against regular \package{caption} package added} % \changes{v2.2a}{2007/04/11}{Bugfix: Usage of \cs{caption@error} replaced by \cs{PackageError}} % % \begin{macrocode} \@ifpackageloaded{caption}{% - \PackageError{caption2}{% + \captiontwo@Error{% You can't use both, the (current) caption *and*\MessageBreak - the (obsolete) caption2 package}\caption@eh + the (obsolete) caption2 package}% \endinput }{} % \end{macrocode} @@ -347,7 +357,9 @@ % % \begin{macro}{\defcaptionstyle} % \begin{macro}{\newcaptionstyle} +% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} % \begin{macro}{\renewcaptionstyle} +% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} % These macros will define a new caption style. \cs{newcaptionstyle} and \cs{renewcaptionstyle} % will additionally check if the caption style already exists or not. % \begin{macrocode} @@ -359,7 +371,7 @@ \expandafter\ifx\csname caption@@#1\endcsname\relax \expandafter\defcaptionstyle \else - \PackageError{caption2}{Caption style `#1' already defined}{\caption@eh}% + \captiontwo@Error{Caption style `#1' already defined}% \expandafter\@gobbletwo \fi {#1}} @@ -367,7 +379,7 @@ % \begin{macrocode} \newcommand*\renewcaptionstyle[1]{% \expandafter\ifx\csname caption@@#1\endcsname\relax - \PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}% + \captiontwo@Error{Caption style `#1' undefined}% \expandafter\@gobbletwo \else \expandafter\defcaptionstyle @@ -379,6 +391,7 @@ % \end{macro} % % \begin{macro}{\dummycaptionstyle} +% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} % This macro will also define a new caption style, but a one which is based on the % actual set caption style. Therefore you can't set a caption style made with this % command with \cs{captionstyle} -- we check this to avoid an endless recursion. @@ -387,11 +400,11 @@ \defcaptionstyle{#1}{% \expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname% \csname caption@@#1\endcsname - \PackageError{caption2}{You can't use the caption style `#1' directy}{% - The caption style `#1' is only a dummy and does not really exists.% - \MessageBreak You have to redefine it (with \protect\renewcaptionstyle) - before you can select\MessageBreak it with \protect\captionstyle. - \space\caption@eh}% + \captiontwo@Error + [The caption style `#1' is only a dummy and does not really exists.% + \MessageBreak You have to redefine it (with \protect\renewcaptionstyle) + before you can select\MessageBreak it with \protect\captionstyle.\space]% + {You can't use the caption style `#1' directy}% \else #2\usecaptionstyle\caption@style \fi}} @@ -399,12 +412,13 @@ % \end{macro} % % \begin{macro}{\captionstyle} +% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} % \cs{captionstyle} sets the actual caption style. It includes a check if the given caption % style is defined or not. % \begin{macrocode} \newcommand*\captionstyle[1]{% \expandafter\ifx\csname caption@@#1\endcsname\relax - \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}% + \captiontwo@Error{Undefined caption style `#1'}% \else \def\caption@style{#1}% \fi} @@ -824,22 +838,22 @@ % \end{macro} % % \begin{macro}{\usecaptionstyle} -% First we check if we are inside a caption -- if \cs{captiontext} is undefined we are not. -% If we are we call the appropriate caption definition. -% % \changes{v2.1b}{2004/04/16}{Missing percent added (and extra space removed)} % \changes{v2.2}{2007/04/06}{\cs{let}\cs{caption@make}\cs{caption@makecaption} added} +% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} +% First we check if we are inside a caption -- if \cs{captiontext} is undefined we are not. +% If we are we call the appropriate caption definition. % \begin{macrocode} \newcommand*\usecaptionstyle[1]{% \caption@ifundefined\captiontext{% - \PackageError{caption2}{You can't use \protect#1 - in normal text}{The usage of \protect#1 is only - allowed inside code declared with\MessageBreak \protect\defcaptionstyle, - \protect\newcaptionstyle \space or \protect\renewcaptionstyle. - \space\caption@eh} + \captiontwo@Error + [The usage of \protect#1 is only + allowed inside code declared with\MessageBreak \protect\defcaptionstyle, + \protect\newcaptionstyle \space or \protect\renewcaptionstyle.\space]% + {You can't use \protect#1 in normal text}% }{% \@ifundefined{caption@@#1}% - {\PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}}% + {\captiontwo@Error{Caption style `#1' undefined}}% {\let\caption@make\caption@makecaption \@nameuse{caption@@#1}}% }} @@ -1301,12 +1315,13 @@ % \end{macro} % % \begin{macro}{\subcapstyle} +% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} % Analogous to \cs{captionstyle} we define \cs{subcapstyle} % and set it (via \cs{setsubcapstyle}) to a appropriate value. % \begin{macrocode} \newcommand*\subcapstyle[1]{% \expandafter\ifx\csname caption@@#1\endcsname\relax - \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}% + \captiontwo@Error{Undefined caption style `#1'}% \else \def\caption@substyle{#1}% \fi} diff --git a/Master/texmf-dist/source/latex/caption/caption3.dtx b/Master/texmf-dist/source/latex/caption/caption3.dtx index ea759a3c87b..96b2bc8ea95 100644 --- a/Master/texmf-dist/source/latex/caption/caption3.dtx +++ b/Master/texmf-dist/source/latex/caption/caption3.dtx @@ -32,12 +32,12 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{3648} +% \CheckSum{3674} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{caption3.drv}[2020/09/12 v2.1 Implementation of the caption kernel] +\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 % @@ -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$} % % \GetFileInfo{caption3.drv} % \let\docdate\filedate @@ -117,6 +117,56 @@ % \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 @@ -192,17 +242,17 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2020/09/17 v2.1b caption3 kernel (AR)] +\ProvidesPackage{caption3}[2020/10/21 v2.2e caption3 kernel (AR)] % \end{macrocode} % % \section{Generic helpers} % % \begin{macro}{\@nameundef} % |\@nameundef|\marg{command name}\\ -% is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel. +% 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 |\captionsetup|\oarg{type}. +% with |\caption|\-|setup|\oarg{type}. % \begin{macrocode} \providecommand*\@nameundef[1]{% \expandafter\let\csname #1\endcsname\@undefined} @@ -223,29 +273,44 @@ % \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{% - \protected@edef\caption@tempa{#1}% - \ifx\caption@tempa\@empty \else - #1#2% - \fi} +\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} -\def\bothIfSecond#1#2{% - \protected@edef\caption@tempa{#2}% +\newcommand*\caption@bothif[2]{% + \begingroup + \caption@prepare@bothif + \protected@xdef\caption@tempa{#1}% + \endgroup \ifx\caption@tempa\@empty \else - #1#2% + #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} @@ -612,16 +677,17 @@ % \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} + \PackageError{caption}{#1}{\caption@@eh{caption}}} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@eh{% +\newcommand*\caption@@eh[1]{% If you do not understand this error, please take a closer look\MessageBreak - at the documentation of the `caption' package, especially the\MessageBreak + at the documentation of the `#1' package, especially the\MessageBreak section about errors.\MessageBreak\@ehc} % \end{macrocode} % \end{macro} @@ -729,7 +795,7 @@ % % \begin{macro}{\ifcaptionsetup@star} % \changes{v1.2a}{2008/01/12}{This macro added} -% If the starred form of |\captionsetup| is used, this will be set to |true|. +% 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 @@ -1225,9 +1291,12 @@ % expands to \meta{yes-code} if the \meta{value} expands to `default', % and to \meta{no-code} otherwise. % \begin{macrocode} -\newcommand*\caption@ifdefault[1]{% +\newcommand*\caption@ifdefault{\caption@ifequal{default}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@ifequal[2]{% \edef\caption@tempa{#1}% - \def\caption@tempb{default}% + \edef\caption@tempb{#2}% \ifx\caption@tempa\caption@tempb \expandafter\@firstoftwo \else @@ -1296,6 +1365,24 @@ % \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\\ @@ -1529,9 +1616,9 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@counter} +% \begin{macro}{\caption@thecounter} % \changes{v1.0n}{2007/04/03}{This counter added} -% \changes{v1.1e}{2007/10/28}{Renamed to \cs{caption@thecounter}; \cs{caption@stepcounter} 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. @@ -1541,7 +1628,7 @@ % \begin{macrocode} \newcommand*\caption@stepthecounter{% \@tempcnta\caption@thecounter - \advance\@tempcnta\@ne + \advance\@tempcnta\@ne\relax \xdef\caption@thecounter{\the\@tempcnta}} % \end{macrocode} % \end{macro} @@ -1862,8 +1949,8 @@ \colorbox{\caption@boxcolor}{% \setlength\caption@tempdima{#1}% \addtolength\caption@tempdima{-2\fboxsep}% - \linewidth\caption@tempdima - \hsize\caption@tempdima + \linewidth\caption@tempdima\relax + \hsize\caption@tempdima\relax #2}} \DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}} \DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}} @@ -1938,8 +2025,8 @@ The option `labelsep=\caption@labelsep@name' does not work\MessageBreak with `format=hang'}}% {\@hangfrom{#1#2}% - \advance\caption@parindent\hangindent - \advance\caption@hangindent\hangindent + \advance\caption@parindent\hangindent\relax + \advance\caption@hangindent\hangindent\relax \caption@@par#3\par}} % \end{macrocode} % @@ -1991,12 +2078,13 @@ \DeclareCaptionLabelFormat{original}{% \caption@ifdefined\caption@original@fnum {\caption@original@fnum}% - {\caption@labelformat@simple{#1}{#2}}} + {\caption@labelformat@fallback{#1}{#2}}} % \end{macrocode} % -% `default' usually maps to `original'. +% `default' usually maps to `original' resp. `simple'. % \begin{macrocode} \SetCaptionDefault{labelformat}{original} +\SetCaptionFallback{labelformat}{simple} % \end{macrocode} % % \section{Label separators} @@ -2094,8 +2182,9 @@ \DeclareCaptionOption{labelseparator}{\caption@set{labelseparator}{#1}} % \end{macrocode} % -% \changes{v1.0e}{2005/06/11}{Bugfix 05-03-23: Caption label separator \opt{newline} implementation changed from \cs{newline} to \cs{\textbackslash}} +% \changes{v1.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} @@ -2105,10 +2194,35 @@ \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} @@ -2358,6 +2472,15 @@ \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. @@ -2612,9 +2735,6 @@ % \changes{v2.0}{2020/07/27}{Uses \cs{caption@set} now} % |\caption@setposition|\marg{position}\\ % puts |\caption@position| to the right value. -% \emph{Please do \textbf{not} use the internal macro -% \cs{caption@position} in your own package or document, but use the -% wrapper command \cs{caption@iftop} instead.}\par % (Note: Since this command is used by the \package{floatrow} package as well % its syntax should not change.) % \begin{macrocode} @@ -3093,7 +3213,7 @@ } % \end{macrocode} % -% \subsection{The french babel option} +% \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} % @@ -3131,7 +3251,10 @@ % in order to avoid problems when |Auto|\-|Space|\-|Punctuation| is set to |false|. % % \begin{macrocode} - \DeclareCaptionLabelSeparator{colon}{\autospace@beforeFDP : }% + \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 @@ -3215,7 +3338,7 @@ }{} % \end{macrocode} % -% \subsection{The hungarian \& magyar babel option} +% \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} @@ -3388,84 +3511,6 @@ % \end{macrocode} % \end{macro} % -% \subsection{The floatrow package} -% \changes{v2.0}{2020/07/28}{Adaptions to the \package{floatrow} package added} -% -% Since the \package{floatrow} package is not maintained anymore, -% we have to make adaptions to \thispackage~\version{2.0} here. -% Please note that we only support the version $0.3b$ of the \package{floatrow} 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{2008/08/02 v0.3b floatrow: float package extension}% - \expandafter\ifx\csname ver@floatrow.sty\endcsname\@tempa - \caption@InfoNoLine{floatrow package v0.3b is loaded}% -% \end{macrocode} -% -% \begin{macro}{\captionlabel} -% |\caption@format| needs to be expanded prior the use of |\caption@@@make|. -% \begin{macrocode} - \renewcommand\captionlabel[1]{{% l.559 - \def\FR@tmp{\@captype}% - \ifnum\floatbox@depth>\@ne - \def\FR@tmp{sub\@captype}\caption@setsubtype*{\FR@tmp}\stepcounter{\FR@tmp}% - \fi - \caption@format % <= This line added - \caption@@@make{\caption@fnum\FR@tmp}{#1}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\flrow@setstyle} -% This patch isn't working since |\flrow@setstyle| will be used by -% \package{floatrow} right after loading \package{caption3}. -% For this reason we still define |\caption@sty@|\meta{name} in -% |\Declare|\-|Caption|\-|Style| instead. -% \begin{macrocode} -% \renewcommand*\flrow@setstyle[1]{% l.986 -% \@ifundefined{flrow@sty@#1}% -% {\flrow@error{Undefined float style `#1'}}% -% {\FBstyle@reset -% \def\flrow@capsetup{% -% \caption@ifdecl{style}{#1}{\caption@setstyle*{#1}}{}% -% \caption@setoptions{#1}}% -% \flrow@esetup{\csname flrow@sty@#1\endcsname}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\flrow@FBoAlign} -% This patch isn't working since |\flrow@FBoAlign| will be used by -% \package{floatrow} right after loading \package{caption3}. -% For this reason we still define |\caption@hj@|\meta{name} in -% |\Declare|\-|Caption|\-|Justification| instead. -% \begin{macrocode} -% \renewcommand*\flrow@FBoAlign[1]{% l.1168 -% \caption@ifdecl{justification}{#1}% -% {\expandafter\let\expandafter\floatobjectset -% \csname caption@justification@#1\endcsname}% -% {\flrow@error{Undefined object setting `#1'}}}% -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\flrow@setFRsep} -% This patch isn't working since |\flrow@setFRsep| will be used by -% \package{floatrow} right after loading \package{caption3}. -% For this reason we still define |\caption@lsep@|\meta{name} in -% |\Declare|\-|Caption|\-|Label|\-|Separator| instead. -% \begin{macrocode} -% \renewcommand*\flrow@setFRsep[2]{% l.1187 -% \caption@ifdecl{labelseparator}{#2}% -% {\@nameuse{caption@labelseparator@#2}% defines \caption@labelsep -% \let#1\caption@labelsep}% -% {\flrow@error{Undefined float separator `#2'}}}% -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} - \fi} -% \end{macrocode} -% % \subsection{The newfloat package} % % \begin{macro}{\caption@newfloat} @@ -3626,6 +3671,7 @@ \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 @@ -3670,7 +3716,7 @@ \let\sf@oldlabel=\label \let\label=\subfloat@label \ifmaincaptiontop\else - \advance\@nameuse{c@\@captype}\@ne + \advance\@nameuse{c@\@captype}\@ne\relax \fi \refstepcounter{sub\@captype}% \setcounter{sub\@captype @save}{\value{sub\@captype}}% @@ -3857,9 +3903,9 @@ \caption@calcmargin \caption@tempdima\captionmargin \ifdim\captionmargin@=\z@ \else - \caption@ifoddpage{}{\advance\caption@tempdima\captionmargin@}% + \caption@ifoddpage{}{\advance\caption@tempdima\captionmargin@\relax}% \fi - \caption@ifhmode{\advance\caption@tempdima\caption@indent}% + \caption@ifhmode{\advance\caption@tempdima\caption@indent\relax}% \hspace\caption@tempdima % \end{macrocode} % We actually use a |\vbox| of width |\captionwidth - \caption@indent| @@ -3868,7 +3914,7 @@ % was defined with \cs{DeclareCaptionFormat*}.} % \begin{macrocode} \caption@tempdima\captionwidth - \caption@ifhmode{\advance\caption@tempdima-\caption@indent}% + \caption@ifhmode{\advance\caption@tempdima-\caption@indent\relax}% \caption@parbox\caption@tempdima{% % \end{macrocode} % Typeset the indention (option |indention=|)\\ @@ -3890,7 +3936,7 @@ % \begin{macrocode} \caption@tempdima\captionmargin \ifdim\captionmargin@=\z@ \else - \caption@ifoddpage{\advance\caption@tempdima\captionmargin@}{}% + \caption@ifoddpage{\advance\caption@tempdima\captionmargin@\relax}{}% \fi \hspace\caption@tempdima % \end{macrocode} @@ -3935,14 +3981,14 @@ % \end{macrocode} % \begin{macrocode} \ifdim\captionwidth=\z@ - \captionwidth\hsize - \advance\captionwidth by -2\captionmargin - \advance\captionwidth by -\captionmargin@ + \captionwidth\hsize\relax + \advance\captionwidth by -2\captionmargin\relax + \advance\captionwidth by -\captionmargin@\relax \else - \captionmargin\hsize - \advance\captionmargin by -\captionwidth - \divide\captionmargin by 2 - \captionmargin@\z@ + \captionmargin\hsize\relax + \advance\captionmargin by -\captionwidth\relax + \divide\captionmargin by 2\relax + \captionmargin@\z@\relax \fi % \end{macrocode} % \begin{macrocode} @@ -3959,9 +4005,9 @@ % % \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@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.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} @@ -4143,18 +4189,44 @@ % \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} -% If the label is empty, we use no caption label separator. -% \begin{macrocode} - \sbox\@tempboxa{#1}% +% 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@ - \caption@set{labelseparator}{none}% + \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.) @@ -4181,7 +4253,7 @@ {\ifcaption@star\else \begingroup \captionlabelfont - #1% + #1\relax\relax \endgroup \fi}% {\ifcaption@star\else @@ -4385,7 +4457,7 @@ % Check if the sub-type was already defined by |\Declare|\-|Sub|\-|Type|. % If not, define the counter and list entry. % \begin{macrocode} - \caption@ifin@list\caption@subtypelist{#4}% + \caption@ifsubtype{#4}% {\caption@Debug{Modify subtype `#4'}}% {\caption@Debug{New subtype `#4'}% \newcounter{#4}[{#3}]% @@ -4519,50 +4591,23 @@ % \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|. -% As a side-effect |\continued|\-|float| does not work correctly. -% For that reason we need to introduce macros to save and restore -% all sub-caption counters here. -% -% \begin{macro}{\caption@savesubcounters} -% \changes{v1.5}{2013/05/01}{This macro added} +% \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} -% |\caption@save|\-|sub|\-|counters|\\ -% saves all sub-caption counters, -% so they can be restored with |\caption@restore|\-|counters| later on. -% \begin{macrocode} -\newcommand*\caption@savesubcounters{% - \caption@for@list\caption@subtypelist{\caption@savecounter{##1}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@savecounter} -% \changes{v1.5}{2013/05/01}{This macro added} -% |\caption@save|\-|counter|\marg{counter}\\ -% saves the given counter, so it can be restored with -% |\caption@restore|\-|counters| later on. -% \begin{macrocode} -\newcommand*\caption@savecounter[1]{% - \edef\caption@tempa{% - \noexpand\l@addto@macro\noexpand\caption@restore@counters - {\noexpand\setcounter{#1}{\number\value{#1}}}}% - \caption@tempa} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@restorecounters} -% \changes{v1.5}{2013/05/01}{This macro added} -% |\caption@restore|\-|counters| -% restores all counters saved with |\caption@save|\-|counter|. -% \begin{macrocode} -\newcommand*\caption@restorecounters{% - \caption@restore@counters - \global\let\caption@restore@counters\@empty} -% \end{macrocode} +% \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} -\newcommand*\caption@restore@counters{} +\caption@ifdefined\@memresetsubcounter + {\let\caption@memresetsubcounter\@memresetsubcounter + \renewcommand*\@memresetsubcounter[1]{% + \caption@ifsubtype{sub#1}\@gobble\caption@memresetsubcounter{#1}}}% + {} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/caption/ltcaption.dtx b/Master/texmf-dist/source/latex/caption/ltcaption.dtx index a4f75ae72a2..fab8a4c05ea 100644 --- a/Master/texmf-dist/source/latex/caption/ltcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/ltcaption.dtx @@ -79,7 +79,7 @@ % % \def\thispackage{the \package{ltcaption} package} % \def\Thispackage{The \package{ltcaption} package} -% \newcommand*\version[2][]{\textit{v#2}} +% \newcommand*\version[2][]{v$#2$} % % \GetFileInfo{ltcaption.drv} % \let\docdate\filedate diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx index 90586d10d99..3dc8cca22e0 100644 --- a/Master/texmf-dist/source/latex/caption/subcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx @@ -32,7 +32,7 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{228} +% \CheckSum{221} % % \iffalse %<*driver> @@ -78,7 +78,7 @@ % \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} -\newcommand*\version[2][]{$v#2$} +\newcommand*\version[2][]{v$#2$} % \usepackage{marvosym} \makeatletter @@ -935,16 +935,26 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{subcaption}[2020/08/23 v1.3g Sub-captions (AR)] +\ProvidesPackage{subcaption}[2020/10/07 v1.3j Sub-captions (AR)] % \end{macrocode} % % \subsection{Initial code} % % Since we base on the \package{caption} package we load it here. % \begin{macrocode} -\RequirePackage{caption}[2020/08/23] % needs v3.5 or newer +\RequirePackage{caption}[2020/09/28] % needs v3.5c or newer % \end{macrocode} % +% \begin{macro}{\subcaption@Error} +% \changes{v1.3h}{2020/09/28}{This macro added} +% |\subcaption@Error|\marg{message}\\ +% issues an error message (with code line indication). +% \begin{macrocode} +\newcommand*\subcaption@Error[1]{% + \PackageError{subcaption}{#1}{\caption@@eh{subcaption}}} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\subcaption@CheckCompatibility} % \changes{v1.1}{2011/09/01}{Compatibility error added} % \changes{v1.1}{2016/05/22}{The presence of \package{subfigure} or \package{subfig} will be checked \cs{AtBeginDocument}, too} @@ -956,38 +966,29 @@ % \end{macrocode} % \begin{macrocode} \caption@ifcompatibility{% - \PackageError{subcaption}% + \subcaption@Error {This package does not work with\MessageBreak caption option `compatibility=v1'}% - {\subcaption@eh}% \endinput}{}% % \end{macrocode} % \begin{macrocode} \@ifpackageloaded{subfigure}{% - \PackageError{subcaption}% + \subcaption@Error {This package can't be used in cooperation\MessageBreak with the subfigure package}% - {\subcaption@eh}% \endinput}{}% % \end{macrocode} % \begin{macrocode} \@ifpackageloaded{subfig}{% - \PackageError{subcaption}% + \subcaption@Error {This package can't be used in cooperation\MessageBreak with the subfig package}% - {\subcaption@eh}% \endinput}{}% % \end{macrocode} % \begin{macrocode} } % \end{macrocode} % \begin{macrocode} -\newcommand*\subcaption@eh{% - If you do not understand this error, please take a closer look\MessageBreak - at the documentation of the `subcaption' package, especially the\MessageBreak - section about errors.\MessageBreak\@ehc} -% \end{macrocode} -% \begin{macrocode} \subcaption@CheckCompatibility \caption@AtBeginDocument{% \subcaption@CheckCompatibility @@ -997,29 +998,12 @@ % % \subsection{Main code} % -% \changes{v1.1}{2011/10/30}{Adapted to the newfloat package} -% We call |\Declare|\-|Caption|\-|Sub|\-|Type| for |figure|, |table|, -% and each floating environment declared with |\Declare|\-|Floating|\-|Environment| here. -% \begin{macrocode} -\ForEachCaptionType{\DeclareCaptionSubType{#1}} -% \end{macrocode} -% -% \begin{macro}{\newsubfloat} -% \changes{v1.1}{2016/01/31}{Adapted to the memoir document class} -% We re-define |\new|\-|sub|\-|float| (offered by the \package{memoir} document class), -% so our stuff will be used instead. -% \begin{macrocode} -\caption@ifundefined\newsubfloat{}{% - \renewcommand*\newsubfloat{\DeclareCaptionSubType}} -% \end{macrocode} -% \end{macro} -% % \pagebreak[3] % \subsubsection{The \cs{subcaption} command} % % \begin{macro}{\subcaption} -% \changes{v1.1}{2012/04/06}{\cs{newcommand} changed to \cs{def} -% so it works with the \package{memoir} document class, too} +% \changes{v1.1}{2012/04/06}{\cs{newcommand} changed to \cs{def} so it works with the \package{memoir} document class, too} +% \changes{v1.3h}{2020/09/28}{Usage of \cs{caption@Error} replaced by \cs{subcaption@Error}} % Without a prefacing |\set|\-|caption|\-|sub|\-|type|, |\sub|\-|caption| is some kind % of |\caption|\-|of{sub|\-|\@cap|\-|type}|. % \Note{Like \cs{captionof}, this command is designed to be used inside an @@ -1028,7 +1012,7 @@ \def\subcaption{% \caption@iftype {\setcaptionsubtype*\caption}% - {\caption@Error{\noexpand\subcaption outside float}% + {\subcaption@Error{\noexpand\subcaption outside float}% \caption@gobble}}% % \end{macrocode} % But with a prefacing |\set|\-|caption|\-|sub|\-|type|, |\sub|\-|caption| is simply @@ -1044,12 +1028,13 @@ % % \begin{macro}{\phantomsubcaption} % \changes{v1.1}{2011/08/17}{This macro added} +% \changes{v1.3h}{2020/09/28}{Usage of \cs{caption@Error} replaced by \cs{subcaption@Error}} % Same as |\phantom|\-|caption|, but for subfigures. % \begin{macrocode} \newcommand*\phantomsubcaption{% \caption@iftype {\setcaptionsubtype*\phantomcaption}% - {\caption@Error{\noexpand\phantomsubcaption outside float}}}% + {\subcaption@Error{\noexpand\phantomsubcaption outside float}}}% % \end{macrocode} % \begin{macrocode} \g@addto@macro\caption@subtypehook{% @@ -1194,25 +1179,33 @@ % % \begin{macro}{\subcaption@setrefformat} % \changes{v1.3g}{2020/07/27}{Adapted to \package{caption3} v2.0} +% \changes{v1.3h}{2020/09/28}{Usage of \cs{caption@Error} replaced by \cs{subcaption@Error}} +% \changes{v1.3j}{2020/10/07}{Definition of the label formats \texttt{subsimple} and \texttt{subparens} added} % |\subcaption@setrefformat|\marg{name}\par % Selecting a subref format simply means saving the code (in |\subcaption@reffmt|). % \begin{macrocode} \newcommand*\subcaption@setrefformat[1]{% \@ifundefined{caption@labelformat@#1}% - {\caption@Error{Undefined label format `#1'}}% + {\subcaption@Error{Undefined label format `#1'}}% {\expandafter\let\expandafter\subcaption@reffmt\csname caption@labelformat@#1\endcsname}} % \end{macrocode} % \begin{macrocode} \subcaption@setrefformat{simple} % \end{macrocode} +% To offer a smooth transition from the \package{subfig} to the \package{subcaption} package +% we offer the options |sub|\-|ref|\-|format=sub|\-|simple| and |sub|\-|ref|\-|format=sub|\-|parens|, too. +% \begin{macrocode} +\DeclareCaptionLabelFormat{subsimple}{#2} +\DeclareCaptionLabelFormat{subparens}{(#2)} +% \end{macrocode} % \end{macro} % % \subsection{Execution of options} % -% We use |\caption@ExecuteOptions| and |\caption@ProcessOptions| here to add -% the options to the `|sub|' option list instead of executing them immediately. % \changes{v1.1}{2018/05/01}{Option \texttt{font+=smaller} changed to \texttt{size=smaller}} % \changes{v1.3e}{2020/07/27}{Option \texttt{size=smaller} changed back to \texttt{font+=smaller}} +% We use |\caption@Execute|\-|Options| and |\caption@Process|\-|Options| here to add +% the options to the `|sub|' option list instead of executing them immediately. % \begin{macrocode} \caption@SetupOptions{subcaption}{\captionsetup[sub]{#2}}% \caption@ExecuteOptions{subcaption}{% @@ -1220,6 +1213,13 @@ \caption@ProcessOptions*{subcaption} % \end{macrocode} % +% \changes{v1.1}{2011/10/30}{Adapted to the newfloat package} +% We call |\Declare|\-|Caption|\-|Sub|\-|Type| for |figure|, |table|, +% and each floating environment declared with |\Declare|\-|Floating|\-|Environment| here. +% \begin{macrocode} +\ForEachCaptionType{\DeclareCaptionSubType{#1}} +% \end{macrocode} +% % \subsection{Bonus material} % % \subsubsection{The \cs{subfloat} command} @@ -1231,32 +1231,37 @@ % \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} % \changes{v1.3f}{2020/07/29}{Bugfix: Usage of \cs{caption@hj@default} replaced by \cs{captionbox@innerpos@default}} +% \changes{v1.3i}{2020/09/28}{This macro will be defined with \cs{providecommand} now to preserve an original definition} % |\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} -\def\subfloat{% - \@ifnextchar[\@subfloat\subfloat@} +\caption@AtBeginDocument{\providecommand*\subfloat{% + \@ifnextchar[%] + \subcaption@subfloat + \subcaption@subfloat@}} % \end{macrocode} % \begin{macrocode} -\long\def\@subfloat[#1]{% - \@ifnextchar[{\@@subfloat{#1}}{\@@@subfloat\subcaptionbox{#1}}} +\long\def\subcaption@subfloat[#1]{% + \@ifnextchar[%] + {\subcaption@@subfloat{#1}}% + {\subcaption@@@subfloat\subcaptionbox{#1}}} % \end{macrocode} % \begin{macrocode} -\long\def\@@subfloat#1[#2]{% - \@@@subfloat{\subcaptionbox[{#1}]}{#2}} +\long\def\subcaption@@subfloat#1[#2]{% + \subcaption@@@subfloat{\subcaptionbox[{#1}]}{#2}} % \end{macrocode} % \begin{macrocode} -\long\def\@@@subfloat#1#2#3{% +\long\def\subcaption@@@subfloat#1#2#3{% \caption@getlabel{#3}% #1{#2\caption@thelabel}{\let\label\caption@gobble#3}% \global\let\caption@thelabel\relax \ignorespaces} % \end{macrocode} % \begin{macrocode} -\def\subfloat@#1{% +\def\subcaption@subfloat@#1{% \setbox\@tempboxa\hbox{#1}% \caption@iiiibox \setcaptionsubtype |