summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/subcaption.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-08-28 23:41:01 +0000
committerKarl Berry <karl@freefriends.org>2019-08-28 23:41:01 +0000
commit4e320246605fb61cf69b3ce53fa9c4a2a9bce1d8 (patch)
tree85af38099066303b40350bce3cf0434f4e4ef4e7 /Master/texmf-dist/source/latex/caption/subcaption.dtx
parent54424c2bc9fd7804517082053c023fb6b0cb70fa (diff)
caption (29aug19)
git-svn-id: svn://tug.org/texlive/trunk@51973 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/subcaption.dtx')
-rw-r--r--Master/texmf-dist/source/latex/caption/subcaption.dtx326
1 files changed, 175 insertions, 151 deletions
diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx
index 9ca69077b26..fc394d6b04b 100644
--- a/Master/texmf-dist/source/latex/caption/subcaption.dtx
+++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx
@@ -25,12 +25,12 @@
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{156}
+% \CheckSum{178}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesFile{subcaption.drv}[2018/05/01 v1.1 Adds a sub-caption feature to the caption package]
+\ProvidesFile{subcaption.drv}[2018/05/13 v1.2 Adds a sub-caption feature to the caption package]
\hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up.
%\errorcontextlines=3
%
@@ -47,7 +47,7 @@
\addtolength\marginparwidth{15pt}
\ifdim\paperheight=297mm % a4paper
\renewcommand\LineBreak{\\}
- \renewcommand\PageBreak{\clearpage}
+ \renewcommand\PageBreak{\clearpage}
\fi
\fi
%
@@ -109,10 +109,11 @@
%
% \GetFileInfo{subcaption.drv}
% \let\docdate\filedate
+% \let\docversion\fileversion
% \GetFileInfo{subcaption.sty}
%
% \title{\texorpdfstring{\Thispackage\thanks{%^^A
-% This package has version number \fileversion, last revised \filedate.}}%^^A
+% This package has version number \docversion.}}%^^A
% {The subcaption package}}
% \author{Axel Sommerfeldt\\
% \url{https://gitlab.com/axelsommerfeldt/caption}}
@@ -172,7 +173,7 @@
%
% The default settings for |sub|captions are:
% \begin{quote}
-% |margin=0pt,font+=smaller,labelformat=parens,labelsep=space,|\\
+% |margin=0pt,size=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
@@ -193,7 +194,7 @@
% \item Local settings
% {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)}
% \item Default `sub' settings
-% {\small(|margin=0pt,font+=smaller,|\ldots, see above)}
+% {\small(|margin=0pt,size=smaller,|\ldots, see above)}
% \item Custom `sub' settings
% {\small(|\usepackage[|\ldots|]{subcaption}| and |\captionsetup[sub]{|\ldots|}|)}
% \item Environmental `sub' settings
@@ -217,133 +218,12 @@
% \end{quote}
%
% \PageBreak
-% \section{The \cs{subcaption} command}
-%
-% \DescribeMacro\subcaption
-% The easiest and most flexible method to apply a sub-caption is by using the
-% |\subcaption| command. Its syntax is analogous to the one of the |\caption|
-% command and shares its features:
-% \begin{quote}
-% |\subcaption|\oarg{list entry}\marg{heading}\\
-% |\subcaption*|\marg{heading}
-% \end{quote}
-% Please note that the |\subcaption| command \emph{must} be applied inside
-% its own box or environment.
-%
-% An example:
-% \begin{quote}
-% |\begin{figure}|\\
-% | \begin{minipage}[b]{.5\linewidth}|\\
-% | \centering\large A|\\
-% | \subcaption{A subfigure}\label{fig:1a}|\\
-% | \end{minipage}%|\\
-% | \begin{minipage}[b]{.5\linewidth}|\\
-% | \centering\large B|\\
-% | \subcaption{Another subfigure}\label{fig:1b}|\\
-% | \end{minipage}|\\
-% | \caption{A figure}\label{fig:1}|\\
-% |\end{figure}|
-% \end{quote}
-% gives the result:
-% \par\bigskip
-% \noindent\begin{minipage}{\linewidth}
-% \setcaptiontype{figure}
-% \begin{minipage}[b]{.5\linewidth}
-% \centering\large A
-% \subcaption{A subfigure}\label{fig:1a}
-% \end{minipage}%^^A
-% \begin{minipage}[b]{.5\linewidth}
-% \centering\large B
-% \subcaption{Another subfigure}\label{fig:1b}
-% \end{minipage}
-% \caption{A figure}\label{fig:1}
-% \end{minipage}
-%
-% \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}
-%
-% \PageBreak
-% \section{The subfigure \& subtable environments}
-%
-% \DescribeEnv{subfigure}
-% \DescribeEnv{subtable}
-% After loading \thispackage\ the new environments |sub|\-|figure| and
-% |sub|\-|table| are available, which have the same (optional \& mandatory)
-% arguments as the |mini|\-|page| environment:
-% \begin{quote}
-% |\begin{subfigure}|\oarg{pos}\marg{width}\\
-% \ldots\\
-% |\end{subfigure}|
-% \end{quote}
-% and
-% \begin{quote}
-% |\begin{subtable}|\oarg{pos}\marg{width}\\
-% \ldots\\
-% |\end{subtable}|
-% \end{quote}
-% Inside these environments you use the ordinary |\caption| command
-% for typesetting captions. So this example is the same as the last one,
-% but uses the |sub|\-|figure| environment:
-% \begin{quote}
-% |\begin{figure}|\\
-% | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\
-% | \centering\large A|\\
-% | |\textcolor{blue}{\cs{caption}}|{A subfigure}\label{fig:1a}|\\
-% | \end{|\textcolor{blue}{\texttt{subfigure}}|}%|\\
-% | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\
-% | \centering\large B|\\
-% | |\textcolor{blue}{\cs{caption}}|{Another subfigure}\label{fig:1b}|\\
-% | \end{|\textcolor{blue}{\texttt{subfigure}}|}|\\
-% | \caption{A figure}\label{fig:1}|\\
-% |\end{figure}|
-% \end{quote}
-% Using the |sub|\-|figure| or |sub|\-|table| environment instead of |\subcaption|
-% has two advantages:
-% \begin{itemize}
-% \item You can override the setttings for a specific subcaption
-% with a |\caption|\-|setup| inside the |sub|\-|figure| or |sub|\-|table| environment, e.g.:
-% \begin{quote}
-% |\begin{subfigure}[b]{.5\linewidth}|\\
-% | \centering\large A|\\
-% | |\textcolor{blue}{\cs{captionsetup}\csmarg{skip=3pt}}\\
-% | \caption{A subfigure}\label{fig:1a}|\\
-% |\end{subfigure}|\\
-% \end{quote}
-% \item Hyperlinks targeted to this subfigure will jump to the beginning
-% of the subfigure, and not to the caption of the subfigure
-% (if |hypcap=true| is set for sub-captions).
-% \See{\Ref{hypcap}}
-% \end{itemize}
-%
-% \bigskip
-%
-% \begin{background}
-% 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
-% declared with |\Declare|\-|Caption|\-|Sub|\-|Type|.
-% \end{background}
-%
-% \PageBreak
% \section{The \cs{subcaptionbox} command}
%
% \DescribeMacro\subcaptionbox
-% A different way of setting sub-figures is
-% offered by the |\sub|\-|caption|\-|box| command, which automatically
-% aligns the sub-figures resp.~sub-tables by their very first caption line.
+% The easiest way to apply a sub-caption is by using the
+% |\sub|\-|caption|\-|box| command, which automatically aligns the
+% sub-figures resp.~sub-tables by their very first caption line.
%
% Its syntax is:
% \begingroup
@@ -470,6 +350,131 @@
% \end{background}
%
% \PageBreak
+% \section{The subfigure \& subtable environments}
+%
+% \DescribeEnv{subfigure}
+% \DescribeEnv{subtable}
+% After loading \thispackage\ the new environments |sub|\-|figure| and
+% |sub|\-|table| are available, which have the same (optional \& mandatory)
+% arguments as the |mini|\-|page| environment:
+% \begin{quote}
+% |\begin{subfigure}|\oarg{outer-pos}\oarg{height}\oarg{inner-pos}\marg{width}\\
+% \ldots\\
+% |\end{subfigure}|
+% \end{quote}
+% and
+% \begin{quote}
+% |\begin{subtable}|\oarg{outer-pos}\oarg{height}\oarg{inner-pos}\marg{width}\\
+% \ldots\\
+% |\end{subtable}|
+% \end{quote}
+% Inside these environments you use the ordinary |\caption| command
+% for typesetting captions. So this example is the same as the last one,
+% but uses the |sub|\-|figure| environment:
+% \begin{quote}
+% |\begin{figure}|\\
+% | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\
+% | \centering\large A|\\
+% | |\textcolor{blue}{\cs{caption}}|{A subfigure}\label{fig:1a}|\\
+% | \end{|\textcolor{blue}{\texttt{subfigure}}|}%|\\
+% | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\
+% | \centering\large B|\\
+% | |\textcolor{blue}{\cs{caption}}|{Another subfigure}\label{fig:1b}|\\
+% | \end{|\textcolor{blue}{\texttt{subfigure}}|}|\\
+% | \caption{A figure}\label{fig:1}|\\
+% |\end{figure}|
+% \end{quote}
+% Some additional notes:
+% \begin{itemize}
+% \item You can override the setttings for a specific subcaption
+% with a |\caption|\-|setup| inside the |sub|\-|figure| or |sub|\-|table| environment, e.g.:
+% \begin{quote}
+% |\begin{subfigure}[b]{.5\linewidth}|\\
+% | \centering\large A|\\
+% | |\textcolor{blue}{\cs{captionsetup}\csmarg{skip=3pt}}\\
+% | \caption{A subfigure}\label{fig:1a}|\\
+% |\end{subfigure}|\\
+% \end{quote}
+% \item Hyperlinks targeted to this subfigure will jump to the beginning
+% of the subfigure, and not to the caption of the subfigure
+% (if |hypcap=true| is set for sub-captions).
+% \See{\Ref{hypcap}}
+% \end{itemize}
+%
+% Beside the \meta{inner-pos} values of `c', `t', and `b', \thispackage\ also offers the
+% values `T' and `B' additionally which align the |sub|\-|figure| at the
+% very top resp.~bottom. (In contrast `t' and `b' align the |sub|\-|figure| at the
+% top resp.~bottom \textit{baseline}.)
+%
+% \bigskip
+%
+% \begin{background}
+% 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
+% declared with |\Declare|\-|Caption|\-|Sub|\-|Type|.
+% \end{background}
+%
+% \iffalse\PageBreak\fi
+% \section{The \cs{subcaption} command}
+%
+% \DescribeMacro\subcaption
+% The most flexible way to apply a sub-caption is by using the
+% |\subcaption| command. Its syntax is analogous to the one of the |\caption|
+% command and shares its features:
+% \begin{quote}
+% |\subcaption|\oarg{list entry}\marg{heading}\\
+% |\subcaption*|\marg{heading}
+% \end{quote}
+% Please note that the |\subcaption| command \emph{must} be applied inside
+% its own box or environment.
+%
+% An example:
+% \begin{quote}
+% |\begin{figure}|\\
+% | \begin{minipage}[b]{.5\linewidth}|\\
+% | \centering\large A|\\
+% | \subcaption{A subfigure}\label{fig:1a}|\\
+% | \end{minipage}%|\\
+% | \begin{minipage}[b]{.5\linewidth}|\\
+% | \centering\large B|\\
+% | \subcaption{Another subfigure}\label{fig:1b}|\\
+% | \end{minipage}|\\
+% | \caption{A figure}\label{fig:1}|\\
+% |\end{figure}|
+% \end{quote}
+% gives the result:
+% \par\bigskip
+% \noindent\begin{minipage}{\linewidth}
+% \setcaptiontype{figure}
+% \begin{minipage}[b]{.5\linewidth}
+% \centering\large A
+% \subcaption{A subfigure}\label{fig:1a}
+% \end{minipage}%^^A
+% \begin{minipage}[b]{.5\linewidth}
+% \centering\large B
+% \subcaption{Another subfigure}\label{fig:1b}
+% \end{minipage}
+% \caption{A figure}\label{fig:1}
+% \end{minipage}
+%
+% \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}
+%
+% \PageBreak
% \section{The \cs{DeclareCaptionSubType} command}
%
% \DescribeMacro\DeclareCaptionSubType
@@ -898,14 +903,14 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{subcaption}[2018/05/01 v1.1-162 Sub-captions (AR)]
+\ProvidesPackage{subcaption}[2018/05/13 v1.2 Sub-captions (AR)]
% \end{macrocode}
%
% \subsection{Initial code}
%
% Since we base on the \package{caption} package we load it here.
% \begin{macrocode}
-\RequirePackage{caption}[2018/05/01] % needs v3.3-147 or newer
+\RequirePackage{caption}[2018/05/11] % needs v3.4 or newer
% \end{macrocode}
%
% \begin{macro}{\subcaption@CheckCompatibility}
@@ -917,6 +922,13 @@
\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}}{}}%
+% \end{macrocode}
+% \begin{macrocode}
\@ifpackageloaded{subfigure}{%
\PackageError{subcaption}%
{This package can't be used in cooperation\MessageBreak
@@ -946,19 +958,9 @@
% \end{macrocode}
% \begin{macrocode}
\caption@AtBeginDocument{%
-% \end{macrocode}
-% \begin{macrocode}
- \caption@ifcompatibility{%
- \caption@Error{%
- The `subcaption' package does not work correctly\MessageBreak
- in compatibility mode}}{}%
-% \end{macrocode}
-% \begin{macrocode}
\subcaption@CheckCompatibility
\let\subcaption@CheckCompatibility\@undefined
\let\subcaption@EH\@undefined
-% \end{macrocode}
-% \begin{macrocode}
}
% \end{macrocode}
% \end{macro}
@@ -972,11 +974,11 @@
%
% 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{font+=smaller}}
+% \changes{v1.1}{2018/05/01}{Bugfix: Option \texttt{font+=small} changed to \texttt{size=smaller}}
% \begin{macrocode}
\caption@SetupOptions{subcaption}{\captionsetup[sub]{#2}}%
\caption@ExecuteOptions{subcaption}{%
- font+=smaller,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0}
+ size=smaller,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0}
\caption@ProcessOptions*{subcaption}
% \end{macrocode}
%
@@ -1047,21 +1049,42 @@
%
% \begin{macro}{subfigure}
% \begin{macro}{subtable}
+% \changes{v1.2}{2016/02/21}{Optional argument values `B' and `T' added}
% 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 `sub' environment
-% will be defined automatically.
+% declared with |\Declare|\-|Floating|\-|Environment| a corresponding
+% `sub' environment will be defined automatically.
% \begin{macrocode}
\caption@For{subtypelist}{%
\newenvironment{sub#1}%
- {\caption@withoptargs\subcaption@minipage}%
- {\endminipage}}%
+ {\@ifnextchar[%]
+ \subcaption@iminipage
+ {\subcaption@iminipage[c]}}%
+ {\subcaption@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).
+% \begin{macrocode}
+\def\subcaption@iminipage[#1]{%
+ \caption@withoptargs{\subcaption@iiminipage{#1}}}
% \end{macrocode}
+% `B' and `T' will add a |\vspace{0pt}|, all other values (and additional
+% optional arguments) will be passed unseen to the |minipage| environment.
% \begin{macrocode}
-\newcommand*\subcaption@minipage[2]{%
- \minipage#1{#2}%
+\newcommand*\subcaption@iiminipage[3]{%
+ \let\subcaption@endminipage\@empty
+ \if#1B%
+ \minipage[b]#2{#3}%
+ \def\subcaption@endminipage{\vspace{0pt}}%
+ \else\if#1T%
+ \minipage[t]#2{#3}%
+ \vspace{0pt}%
+ \else
+ \minipage[#1]#2{#3}%
+ \fi\fi
\setcaptionsubtype\relax}
% \end{macrocode}
% \end{macro}
@@ -1122,6 +1145,7 @@
% \changes{v1.1}{2011/08/18}{Uses \cs{caption@setoptions*} now}
% \changes{v1.1}{2012/01/12}{Usage of \cs{caption@setoptions*} replaced by \cs{caption@setoptions}}
% \changes{v1.1}{2012/04/09}{Revised}
+% \changes{v1.1}{2018/12/26}{Bugfix: Missing curly braces added}
% This one calls |\ref| with the second label. (see |\subcaption@label|)
% \begin{macrocode}
\DeclareRobustCommand*\subref{%
@@ -1131,7 +1155,7 @@
\newcommand*\@subref[2]{%
\caption@ifundefined\hyperref
{\subcaption@ref{#1}{#2}}%
- {\hyperref[#2]{\subcaption@ref{*#1}{#2}}}}
+ {\hyperref[{#2}]{\subcaption@ref{*#1}{#2}}}}
% \end{macrocode}
% \begin{macrocode}
\newcommand*\subcaption@ref[2]{%