summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/caption/subcaption.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-08-31 03:02:58 +0000
committerNorbert Preining <norbert@preining.info>2020-08-31 03:02:58 +0000
commit568fe838cef40f671837d9348dd73c93d9ea962b (patch)
treeba2b2c6ab585927a89adae8c1cc2a594010ab933 /macros/latex/contrib/caption/subcaption.dtx
parentc6a1b1f6422e10f363a9de80c4f103f0c155d8bb (diff)
CTAN sync 202008310302
Diffstat (limited to 'macros/latex/contrib/caption/subcaption.dtx')
-rw-r--r--macros/latex/contrib/caption/subcaption.dtx127
1 files changed, 70 insertions, 57 deletions
diff --git a/macros/latex/contrib/caption/subcaption.dtx b/macros/latex/contrib/caption/subcaption.dtx
index a3b8bdb2ee..90586d10d9 100644
--- a/macros/latex/contrib/caption/subcaption.dtx
+++ b/macros/latex/contrib/caption/subcaption.dtx
@@ -19,21 +19,25 @@
% 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, totalcount.dtx,
+% caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx,
+% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx,
+% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx,
+% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx,
% the derived files
-% caption.sty, caption2.sty, caption3.sty,
-% bicaption.sty, ltcaption.sty, subcaption.sty, totalcount.sty,
+% caption.sty, caption-light.sty, caption2.sty, caption3.sty,
+% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto,
+% caption-koma.sto, caption-memoir.sto, caption-ntg.sto,
+% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty,
% and the user manuals
% caption-deu.tex, caption-eng.tex, caption-rus.tex.
%
% \fi
-% \CheckSum{232}
+% \CheckSum{228}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesFile{subcaption.drv}[2019/09/10 v1.3 Adds a sub-caption feature to the caption package]
+\ProvidesFile{subcaption.drv}[2020/08/24 v1.3 Adds a sub-caption feature to the caption package]
\hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up.
%\errorcontextlines=3
%
@@ -176,7 +180,7 @@
%
% The default settings for |sub|captions are:
% \begin{quote}
-% |margin=0pt,size=smaller,labelformat=parens,labelsep=space,|\\
+% |margin=0pt,font+=smaller,labelformat=parens,labelsep=space,|\\
% |skip=6pt,list=false,hypcap=false|~\footnote{%^^A
% This means that sub-captions are not listed in the List of Figures
% or Tables by default, but you can enable that by
@@ -197,7 +201,7 @@
% \item Local settings
% {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)}
% \item Default `sub' settings
-% {\small(|margin=0pt,size=smaller,|\ldots, see above)}
+% {\small(|margin=0pt,font+=smaller,|\ldots, see above)}
% \item Custom `sub' settings
% {\small(|\usepackage[|\ldots|]{subcaption}| and |\captionsetup[sub]{|\ldots|}|)}
% \item Environmental `sub' settings
@@ -349,7 +353,16 @@
% \begin{background}
% The |\sub|\-|caption|\-|box| is a |\par|\-|box| with
% |\set|\-|caption|\-|sub|\-|type| as first contents line.
-% \iffalse See implementation for details.\fi
+% \iffalse
+% Prepared with |\Declare|\-|Caption|\-|Sub|\-|Type| (offered by the
+% \package{caption} package), the caption package command |\set|\-|caption|\-|sub|\-|type|
+% becames available.
+% Analogous to the |\set|\-|caption|\-|type| command of the \package{caption} package,
+% the |\set|\-|caption|\-|sub|\-|type| command sets the sub-type of the box or environment
+% (so |\caption| will typeset a sub-caption instead of an ordinary one),
+% places a proper hyperlink anchor (non-starred variant only),
+% executes options associated with the sub-type etc.
+% \fi
% \end{background}
%
% \PageBreak
@@ -416,7 +429,7 @@
% The |subfigure| \& |subtable| environments are just simple |minipage|
% environments with |\set|\-|caption|\-|sub|\-|type| as first contents line.
% These environments are defined with the help of
-% |\caption@For{subtypelist}|, which executes code for every sub-type
+% |\For|\-|Each|\-|Caption|\-|Sub|\-|Type|, which executes code for every sub-type
% declared with |\Declare|\-|Caption|\-|Sub|\-|Type|.
% \end{background}
%
@@ -466,14 +479,6 @@
% \bigskip
%
% \begin{background}
-% Prepared with |\Declare|\-|Caption|\-|Sub|\-|Type| (offered by the
-% \package{caption} package), the caption package command |\set|\-|caption|\-|sub|\-|type|
-% becames available.
-% Analogous to the |\set|\-|caption|\-|type| command of the \package{caption} package,
-% the |\set|\-|caption|\-|sub|\-|type| command sets the sub-type of the box or environment
-% (so |\caption| will typeset a sub-caption instead of an ordinary one),
-% places a proper hyperlink anchor (non-starred variant only),
-% executes options associated with the sub-type etc.\par
% The |\subcaption| command is just a simple combination of
% |\set|\-|caption|\-|sub|\-|type*| and |\caption|.
% \end{background}
@@ -484,9 +489,6 @@
% \DescribeMacro\DeclareCaptionSubType
% For using the sub-caption feature of the \package{caption} package some
% commands and counters must be prepared. This is done with
-% \iffalse\footnote{%^^A
-% \cs{newsubfloat} offered by the \package{subfig} package\cite{subfig}
-% could be used for this purpose as well.}\fi
% \begin{quote}
% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\
% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}
@@ -536,8 +538,8 @@
% \end{minipage}
%
% \begin{background}
-% |\Declare|\-|Caption|\-|Sub|\-|Type| is an integral part of the \package{caption}
-% package kernel.
+% |\Declare|\-|Caption|\-|Sub|\-|Type| and |\For|\-|Each|\-|Caption|\-|Sub|\-|Type|
+% are integral parts of the \package{caption} package kernel.
% \end{background}
%
% \PageBreak
@@ -797,12 +799,16 @@
%
% \pagebreak[3]
% \section{Beyond this package}
-% \label{floatrow}
+% \label{keyfloat}\label{floatrow}
%
% For a more advanced usage of the sub-caption feature of the
-% \package{caption} package, please take a look at the \package{floatrow}
-% package\cite{floatrow} which provides the powerful \texttt{subfloatrow}
-% environment for typesetting sub-figures.
+% \package{caption} package, please take a look at the excellent
+% \package{keyfloat} package\cite{keyfloat} which provides the environments
+% |key|\-|sub|\-|figs|, |key|\-|sub|\-|tabs|, and |key|\-|sub|\-|floats| for
+% typesetting sub-figures and sub-tables.
+%
+% Furthermore the \package{floatrow} package\cite{floatrow} provides the
+% |sub|\-|float|\-|row| environment for typesetting sub-figures.
%
% \iffalse
% --------------------------------------------------------------------------- %
@@ -840,6 +846,11 @@
% \href{http://www.ctan.org/pkg/hypcap}%
% {\emph{The hypcap package -- Adjusting anchors of captions}},
% 2007/04/09
+% \bibitem{keyfloat}
+% Brian Duun:\\
+% \href{http://www.ctan.org/pkg/keyfloat}%
+% {\emph{The \LaTeX\ keyfloat Package}},
+% 2019/09/23
% \iffalse
% \bibitem{subfig}
% Steven D. Cochran:\\
@@ -924,37 +935,39 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{subcaption}[2020/01/22 v1.3d Sub-captions (AR)]
+\ProvidesPackage{subcaption}[2020/08/23 v1.3g 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/01/03] % needs v3.4h or newer
+\RequirePackage{caption}[2020/08/23] % needs v3.5 or newer
% \end{macrocode}
%
% \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}
+% \changes{v1.3g}{2020/08/01}{Error text adapted to \package{caption} package~\version{4.0}}
% Since we are incompatible to them an error message will be issued when
% the \package{subfigure} or \package{subfig} package is loaded.
% \begin{macrocode}
-\newcommand\subcaption@CheckCompatibility{%
+\newcommand*\subcaption@CheckCompatibility{%
% \end{macrocode}
% \begin{macrocode}
- \@ifundefined{caption@ifcompatibility}{}{%
- \caption@ifcompatibility{%
- \caption@Error{%
- The `subcaption' package does not work correctly\MessageBreak
- in compatibility mode}}{}}%
+ \caption@ifcompatibility{%
+ \PackageError{subcaption}%
+ {This package does not work with\MessageBreak
+ caption option `compatibility=v1'}%
+ {\subcaption@eh}%
+ \endinput}{}%
% \end{macrocode}
% \begin{macrocode}
\@ifpackageloaded{subfigure}{%
\PackageError{subcaption}%
{This package can't be used in cooperation\MessageBreak
with the subfigure package}%
- {\subcaption@EH}%
+ {\subcaption@eh}%
\endinput}{}%
% \end{macrocode}
% \begin{macrocode}
@@ -962,27 +975,23 @@
\PackageError{subcaption}%
{This package can't be used in cooperation\MessageBreak
with the subfig package}%
- {\subcaption@EH}%
+ {\subcaption@eh}%
\endinput}{}%
% \end{macrocode}
% \begin{macrocode}
}
% \end{macrocode}
% \begin{macrocode}
-\newcommand*\subcaption@EH{%
+\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
-% \end{macrocode}
-% \begin{macrocode}
\caption@AtBeginDocument{%
\subcaption@CheckCompatibility
- \let\subcaption@CheckCompatibility\@undefined
- \let\subcaption@EH\@undefined
-}
+ \let\subcaption@CheckCompatibility\@undefined}
% \end{macrocode}
% \end{macro}
%
@@ -990,9 +999,9 @@
%
% \changes{v1.1}{2011/10/30}{Adapted to the newfloat package}
% We call |\Declare|\-|Caption|\-|Sub|\-|Type| for |figure|, |table|,
-% and each caption type declared with |\Declare|\-|Floating|\-|Environment| here.
+% and each floating environment declared with |\Declare|\-|Floating|\-|Environment| here.
% \begin{macrocode}
-\caption@ForEachType{\DeclareCaptionSubType{#1}}
+\ForEachCaptionType{\DeclareCaptionSubType{#1}}
% \end{macrocode}
%
% \begin{macro}{\newsubfloat}
@@ -1055,20 +1064,21 @@
% \begin{macro}{subtable}
% \changes{v1.2}{2016/02/21}{Optional argument values `B' and `T' added}
% \changes{v1.3d}{2020/01/22}{Definition and usage of \cs{@subfloatboxreset} added}
+% \changes{v1.3e}{2020/07/29}{Uses \cs{ForEachCaptionSubType} (instead of \cs{caption@For}) to define the environments now}
% This is just an ordinary \env{minipage} environment with
% |\setcaptionsubtype| as first contents line.
-% It will be defined using the helper macro |\caption@For{sub|\-|type|\-|list}|
-% offered by the \package{caption} kernel, so for every caption type
-% declared with |\Declare|\-|Floating|\-|Environment| a corresponding
+% It will be defined using the helper macro |\For|\-|Each|\-|Caption|\-|Sub|\-|Type|
+% offered by the \package{caption} kernel, so for every caption sub-type
+% declared with |\Declare|\-|Caption|\-|Sub|\-|Type| a corresponding
% `sub' environment will be defined automatically.
% \begin{macrocode}
-\caption@For{subtypelist}{%
- \newenvironment{sub#1}%
+\ForEachCaptionSubType{%
+ \newenvironment{#1}%
{\@ifnextchar[%]
\subcaption@iminipage
{\subcaption@iminipage[c]}}%
{\subcaption@endminipage
- \endminipage}}%
+ \endminipage}}
% \end{macrocode}
% We pass all other optional arguments using the generic helper macro
% |\caption@with|\-|opt|\-|args| offered by the \package{caption} kernel).
@@ -1183,13 +1193,14 @@
% \end{macrocode}
%
% \begin{macro}{\subcaption@setrefformat}
+% \changes{v1.3g}{2020/07/27}{Adapted to \package{caption3} v2.0}
% |\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@lfmt@#1}%
+ \@ifundefined{caption@labelformat@#1}%
{\caption@Error{Undefined label format `#1'}}%
- {\expandafter\let\expandafter\subcaption@reffmt\csname caption@lfmt@#1\endcsname}}
+ {\expandafter\let\expandafter\subcaption@reffmt\csname caption@labelformat@#1\endcsname}}
% \end{macrocode}
% \begin{macrocode}
\subcaption@setrefformat{simple}
@@ -1200,11 +1211,12 @@
%
% 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}{Bugfix: Option \texttt{font+=small} changed to \texttt{size=smaller}}
+% \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}}
% \begin{macrocode}
\caption@SetupOptions{subcaption}{\captionsetup[sub]{#2}}%
\caption@ExecuteOptions{subcaption}{%
- size=smaller,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0}
+ font+=smaller,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0}
\caption@ProcessOptions*{subcaption}
% \end{macrocode}
%
@@ -1218,6 +1230,7 @@
% \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.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}}
% |\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}.
@@ -1237,7 +1250,7 @@
% \end{macrocode}
% \begin{macrocode}
\long\def\@@@subfloat#1#2#3{%
- \caption@getlabel#3\label{}\@nil
+ \caption@getlabel{#3}%
#1{#2\caption@thelabel}{\let\label\caption@gobble#3}%
\global\let\caption@thelabel\relax
\ignorespaces}
@@ -1250,7 +1263,7 @@
{\phantomcaption\@gobble}{\phantomcaption\@gobble}% no box with \caption
{}% no optional arguments for \caption
{}% no sub-caption
- [\wd\@tempboxa][\caption@hj@default]%
+ [\wd\@tempboxa][\captionbox@innerpos@default]%
{\unhbox\@tempboxa}%
\ignorespaces}
% \end{macrocode}