| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% This is file `subcaption.dtx'. |
| 4 |
% |
| 5 |
% Copyright (C) 2007-2023 Axel Sommerfeldt ([email protected]) |
| 6 |
% |
| 7 |
% -------------------------------------------------------------------------- |
| 8 |
% |
| 9 |
% This work may be distributed and/or modified under the |
| 10 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 11 |
% of this license or (at your option) any later version. |
| 12 |
% The latest version of this license is in |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 15 |
% version 2003/12/01 or later. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status "maintained". |
| 18 |
% |
| 19 |
% This Current Maintainer of this work is Axel Sommerfeldt. |
| 20 |
% |
| 21 |
% This work consists of the files |
| 22 |
% caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx, |
| 23 |
% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx, |
| 24 |
% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx, |
| 25 |
% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, |
| 26 |
% the derived files |
| 27 |
% caption.sty, caption-light.sty, caption2.sty, caption3.sty, |
| 28 |
% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto, |
| 29 |
% caption-koma.sto, caption-memoir.sto, caption-ntg.sto, |
| 30 |
% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty. |
| 31 |
% |
| 32 |
% \fi |
| 33 |
% |
| 34 |
% \CheckSum{511} |
| 35 |
% |
| 36 |
% \iffalse |
| 37 |
%<*driver> |
| 38 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 39 |
\ProvidesFile{subcaption.drv}[2023/08/13 v1.6 Adds a sub-caption feature to the caption package] |
| 40 |
%\errorcontextlines=3 |
| 41 |
% |
| 42 |
\documentclass{captiondoc} |
| 43 |
\hypersetup{pdfkeywords={LaTeX, package, subcaption}} |
| 44 |
% |
| 45 |
\usepackage{caption}[2022/01/07] % needs v3.6 or newer to typeset this document |
| 46 |
\usepackage{subcaption}[2022/01/07] % needs v1.5 or newer to typeset this document |
| 47 |
\DeclareCaptionSubType*[arabic]{table} |
| 48 |
\captionsetup[subtable]{labelformat=simple,labelsep=colon} |
| 49 |
% |
| 50 |
\usepackage{array,diagbox,graphicx,overpic,pict2e,stackengine,tikz} |
| 51 |
% |
| 52 |
\begin{document} |
| 53 |
\DocInput{subcaption.dtx} |
| 54 |
\end{document} |
| 55 |
%</driver> |
| 56 |
% \fi |
| 57 |
% |
| 58 |
% \def\thispackage{the \pkg{subcaption} package} |
| 59 |
% \def\Thispackage{The \pkg{subcaption} package} |
| 60 |
% |
| 61 |
% \GetFileInfo{subcaption.drv} |
| 62 |
% \let\docdate\filedate |
| 63 |
% \let\docversion\fileversion |
| 64 |
% \GetFileInfo{subcaption.sty} |
| 65 |
% |
| 66 |
% \title{\texorpdfstring{\Thispackage\thanks{%^^A |
| 67 |
% This package has version number \docversion.}}%^^A |
| 68 |
% {The subcaption package}} |
| 69 |
% \author{Axel Sommerfeldt\\ |
| 70 |
% \url{https://gitlab.com/axelsommerfeldt/caption}} |
| 71 |
% \date{\docdate} |
| 72 |
% \maketitle |
| 73 |
% |
| 74 |
% \begin{abstract} |
| 75 |
% This package offers an user interface to typeset sub-captions. |
| 76 |
% \end{abstract} |
| 77 |
% |
| 78 |
% \begin{background} |
| 79 |
% At the end of each section, text marked with the mountain symbol |
| 80 |
% will contain background knowledge on how the particular command or |
| 81 |
% environment is actually implemented. |
| 82 |
% If you just want to use this package as it is, you don't have to read or |
| 83 |
% understand them. |
| 84 |
% \end{background} |
| 85 |
% |
| 86 |
% \begin{background*} |
| 87 |
% Since version $3.1$ the \pkg{caption} package offers a low-level interface to typeset sub-captions: |
| 88 |
% |\Declare|\-|Caption|\-|Sub|\-|Type| defines the required counters and internal commands, |
| 89 |
% |\set|\-|caption|\-|sub|\-|type| switches to the sub-caption mode, and |
| 90 |
% |\caption@sub|\-|type|\-|hook| could be extended to apply own code when a switch to the sub-caption mode is in progress. |
| 91 |
% |
| 92 |
% This package demonstrates its usage by offering a high-level user interface additionally. |
| 93 |
% \end{background*} |
| 94 |
% |
| 95 |
% \clearpage |
| 96 |
% \setcounter{tocdepth}{2} |
| 97 |
% \tableofcontents |
| 98 |
% |
| 99 |
% \iffalse |
| 100 |
% --------------------------------------------------------------------------- % |
| 101 |
% \fi |
| 102 |
% |
| 103 |
% \clearpage |
| 104 |
% \section{Loading the package} |
| 105 |
% |
| 106 |
% Load this package using |
| 107 |
% \begin{quote} |
| 108 |
% |\usepackage|\oarg{options}|{subcaption}|\quad. |
| 109 |
% \end{quote} |
| 110 |
% The options for \thispackage\ are the same ones as for the \pkg{caption} |
| 111 |
% package, but specify settings which are used for sub-captions |
| 112 |
% \emph{additionally}. |
| 113 |
% In fact |
| 114 |
% \begin{quote} |
| 115 |
% |\usepackage|\oarg{options}|{subcaption}| |
| 116 |
% \end{quote} |
| 117 |
% is identical to |
| 118 |
% \begin{quote} |
| 119 |
% |\usepackage{subcaption}|\\ |
| 120 |
% |\subcaptionsetup|\marg{options}\quad. |
| 121 |
% \end{quote} |
| 122 |
% |
| 123 |
% \bigskip |
| 124 |
% |
| 125 |
% \pagebreak[3] |
| 126 |
% The default settings for sub-captions are: |
| 127 |
% \begin{quote} |
| 128 |
% |margin=0pt,font+=smaller,labelformat=parens,labelsep=space,|\\ |
| 129 |
% |skip=6pt,list=false,hypcap=false|~\footnote{%^^A |
| 130 |
% This means that sub-captions are not listed in the List of Figures |
| 131 |
% or Tables by default, but you can enable it by |
| 132 |
% specifying the option \texttt{list=true}.} |
| 133 |
% \end{quote} |
| 134 |
% |
| 135 |
% \iffalse |
| 136 |
% --------------------------------------------------------------------------- % |
| 137 |
% \fi |
| 138 |
% |
| 139 |
% \PageBreak |
| 140 |
% \section{Setting options} |
| 141 |
% \label{sec:options} |
| 142 |
% |
| 143 |
% \DescribeMacro\subcaptionsetup |
| 144 |
% \NEWfeature*{v1.6} |
| 145 |
% The |\subcaptionsetup| command sets options specifically for sub-captions. |
| 146 |
% |
| 147 |
% \begin{quote} |
| 148 |
% |\subcaptionsetup|\marg{options} |
| 149 |
% \end{quote} |
| 150 |
% sets options valid for all sub-captions. |
| 151 |
% |
| 152 |
% \pagebreak[3] |
| 153 |
% An example: |
| 154 |
% \begin{quote} |
| 155 |
% |\subcaptionsetup{font=it}| |
| 156 |
% \end{quote} |
| 157 |
% sets the font to ``italic'' for all sub-captions. |
| 158 |
% |
| 159 |
% \medskip |
| 160 |
% |
| 161 |
% \begin{quote} |
| 162 |
% |\subcaptionsetup|\oarg{environment}\marg{options} |
| 163 |
% \end{quote} |
| 164 |
% is an alternative syntax to |
| 165 |
% \begin{quote} |
| 166 |
% |\caption|\-|setup[sub|\meta{environment}|]|\marg{options}\quad. |
| 167 |
% \end{quote} |
| 168 |
% |
| 169 |
% \pagebreak[3] |
| 170 |
% An example: |
| 171 |
% \begin{quote} |
| 172 |
% |\subcaptionsetup[table]{labelformat=simple}| |
| 173 |
% \end{quote} |
| 174 |
% is identical to |
| 175 |
% \begin{quote} |
| 176 |
% |\captionsetup[subtable]{labelformat=simple}| |
| 177 |
% \end{quote} |
| 178 |
% and sets the labelformat to ``simple'' for all sub-captions inside tables. |
| 179 |
% |
| 180 |
% \bigskip |
| 181 |
% |
| 182 |
% Options specified with |\usepackage[|\ldots|]{sub|\-|caption}| and |
| 183 |
% |\sub|\-|caption|\-|setup{|\ldots|}| will override the ones specified by |
| 184 |
% |\caption|\-|setup{|\ldots|}| and |\caption|\-|setup[fig|\-|ure]{|\ldots|}|, |
| 185 |
% but are again overwritten by |\subcaption|\-|setup[figure]{|\ldots|}| |
| 186 |
% (same for `table'). So finally we have the following order how |
| 187 |
% settings for sub-captions are applied: |
| 188 |
% \begin{enumerate} |
| 189 |
% \item Global settings |
| 190 |
% {\small(|\usepackage[|\ldots|]{caption}| and |\captionsetup{|\ldots|}|)} |
| 191 |
% \item Environmental settings |
| 192 |
% {\small(|\captionsetup[figure|\emph{ -or- }|table]{|\ldots|}|)} |
| 193 |
% \item Local settings |
| 194 |
% {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)} |
| 195 |
% \item Default `sub' settings |
| 196 |
% {\small(|margin=0pt,font+=smaller,|\ldots, see above)} |
| 197 |
% \item Custom `sub' settings |
| 198 |
% {\small(|\usepackage[|\ldots|]{subcaption}| and |\subcaptionsetup{|\ldots|}|)} |
| 199 |
% \item Environmental `sub' settings |
| 200 |
% {\small(|\subcaptionsetup[figure|\emph{ -or- }|table]{|\ldots|}|)} |
| 201 |
% \item Local `sub' settings |
| 202 |
% {\small(|\captionsetup{|\ldots|}| inside |sub|\-|figure| or |sub|\-|table|)} |
| 203 |
% \end{enumerate} |
| 204 |
% |
| 205 |
% \pagebreak[3] |
| 206 |
% An example: |
| 207 |
% \begin{quote} |
| 208 |
% |\usepackage[labelsep=quad,indention=10pt]{caption}|\\ |
| 209 |
% |\usepackage[labelfont=bf,list=true]{subcaption}|\\ |
| 210 |
% |\captionsetup[table]{textfont=it,position=top}|\\ |
| 211 |
% |\subcaptionsetup[table]{textfont=sf}| |
| 212 |
% \end{quote} |
| 213 |
% causes sub-captions inside |table| environments to be typeset with |
| 214 |
% the settings |
| 215 |
% \begin{quote} |
| 216 |
% |indention=10pt,position=top,margin=0pt,font=small,|\\ |
| 217 |
% |labelformat=parens,labelsep=space,skip=6pt,hypcap=false,|\\ |
| 218 |
% |labelfont=bf,list=true,textfont=sf|\quad. |
| 219 |
% \end{quote} |
| 220 |
% |
| 221 |
% \iffalse |
| 222 |
% --------------------------------------------------------------------------- % |
| 223 |
% \fi |
| 224 |
% |
| 225 |
% \PageBreak |
| 226 |
% \section{The \cs{subcaptionbox} command} |
| 227 |
% |
| 228 |
% \DescribeMacro\subcaptionbox |
| 229 |
% The |\sub|\-|caption|\-|box| command typesets given content and caption. |
| 230 |
% It automatically aligns the sub-figures or sub-tables by their very first caption line. |
| 231 |
% |
| 232 |
% \pagebreak[3] |
| 233 |
% Its syntax is: |
| 234 |
% \begingroup |
| 235 |
% \leftmargini=12pt |
| 236 |
% \begin{quote} |
| 237 |
% |\subcaptionbox|\oarg{list entry}\marg{heading}\oarg{width}\oarg{inner-pos}\marg{contents}\\ |
| 238 |
% |\subcaptionbox*|\marg{heading}\oarg{width}\oarg{inner-pos}\marg{contents} |
| 239 |
% \end{quote} |
| 240 |
% \endgroup |
| 241 |
% \begin{small} |
| 242 |
% The arguments \meta{list entry} \& \meta{heading} will be used for typesetting the |\caption|. |
| 243 |
% |
| 244 |
% \meta{width} is the width of the resulting |\par|\-|box|; the default value is the width of the contents. |
| 245 |
% |
| 246 |
% \meta{inner-pos} specifies how the contents will be justified inside the resulting |\parbox|; |
| 247 |
% it can be either `c' (centered, using |\centering|), `l' (left-justified, using |\ragged|\-|right|), |
| 248 |
% `r' (right-justified, using |\ragged|\-|left|), or `s' (for no special justification). |
| 249 |
% The default is `c'. |
| 250 |
% (But you can use any justification defined with |
| 251 |
% |\Declare|\-|Caption|\-|Jus|\-|ti|\-|fi|\-|ca|\-|tion| as well, |
| 252 |
% e.g.: `|center|\-|last|') |
| 253 |
% \end{small} |
| 254 |
% |
| 255 |
% \bigskip |
| 256 |
% |
| 257 |
% When using |\sub|\-|caption|\-|box|, the baseline of the resulting box will be placed |
| 258 |
% right between contents and heading. So usually you don't have to care about the |
| 259 |
% vertical alignment of the sub-figures for yourself. |
| 260 |
% Also the hyperlink anchor is placed properly with respect to the |hyp|\-|cap=| setting. |
| 261 |
% |
| 262 |
% \pagebreak[3] |
| 263 |
% An example: |
| 264 |
% \begin{quote} |
| 265 |
% |\begin{figure}|\\ |
| 266 |
% | \centering|\\ |
| 267 |
% | \subcaptionbox{A cat\label{cat}}|\\ |
| 268 |
% | {\includegraphics{cat}}|\\ |
| 269 |
% | \subcaptionbox{An elephant\label{elephant}}|\\ |
| 270 |
% | {\includegraphics{elephant}}|\\ |
| 271 |
% | \caption{Two animals}\label{animals}|\\ |
| 272 |
% |\end{figure}| |
| 273 |
% \end{quote} |
| 274 |
% \noindent\begin{minipage}{\linewidth} |
| 275 |
% \captionsetup{type=figure} |
| 276 |
% \centering |
| 277 |
% \subcaptionbox{A cat\label{cat}} |
| 278 |
% {\includegraphics[width=30pt]{cat}} |
| 279 |
% \subcaptionbox{An elephant\label{elephant}} |
| 280 |
% {\includegraphics[width=140pt]{elephant}} |
| 281 |
% \caption[Two animals]{Two animals~\footnotemark}\label{animals} |
| 282 |
% \end{minipage} |
| 283 |
% \footnotetext{The pictures were taken with permission from the |
| 284 |
% \LaTeX\ Companion\cite{TLC2} examples.} |
| 285 |
% |
| 286 |
% \bigskip |
| 287 |
% |
| 288 |
% As you see the result is not satisfying; |
| 289 |
% the caption below the cat looks ugly because of the small width of the |
| 290 |
% graphic. This can be solved by using the optional arguments of |
| 291 |
% |\sub|\-|caption|\-|box|, increasing the width of the resulting box: |
| 292 |
% \begin{quote} |
| 293 |
% | |\ldots\\ |
| 294 |
% | \subcaptionbox{A cat\label{cat}}|\\ |
| 295 |
% | |\textcolor{blue}{\csoarg{2.5cm}}|{\includegraphics{cat}}|\\ |
| 296 |
% | |\ldots |
| 297 |
% \end{quote} |
| 298 |
% \noindent\begin{minipage}{\linewidth} |
| 299 |
% \captionsetup{type=figure} |
| 300 |
% \centering |
| 301 |
% \subcaptionbox{A cat\label{cat2}} |
| 302 |
% [2.5cm]{\includegraphics[width=30pt]{cat}} |
| 303 |
% \subcaptionbox{An elephant\label{elephant2}} |
| 304 |
% {\includegraphics[width=140pt]{elephant}} |
| 305 |
% \caption{Two animals}\label{animals2} |
| 306 |
% \end{minipage} |
| 307 |
% |
| 308 |
% \bigskip |
| 309 |
% |
| 310 |
% Furthermore the main caption, which is centered with respect to the |
| 311 |
% |\text|\-|width|, looks mis-aligned with respect to the sub-captions. |
| 312 |
% This can (again) be solved by using the optional arguments of |
| 313 |
% |\sub|\-|caption|\-|box|, giving both boxes the same width, for example: |
| 314 |
% \begin{quote} |
| 315 |
% | |\ldots\\ |
| 316 |
% | \subcaptionbox{A cat\label{cat}}|\\ |
| 317 |
% | |\textcolor{blue}{\csoarg{.4\cs{textwidth}}}|{\includegraphics{cat}}%|\\ |
| 318 |
% | \subcaptionbox{An elephant\label{elephant}}|\\ |
| 319 |
% | |\textcolor{blue}{\csoarg{.4\cs{textwidth}}}|{\includegraphics{elephant}}|\\ |
| 320 |
% | |\ldots |
| 321 |
% \end{quote} |
| 322 |
% \noindent\begin{minipage}{\linewidth} |
| 323 |
% \captionsetup{type=figure} |
| 324 |
% \centering |
| 325 |
% \subcaptionbox{A cat\label{cat3}} |
| 326 |
% [.4\textwidth]{\includegraphics[width=30pt]{cat}}%^^A |
| 327 |
% \subcaptionbox{An elephant\label{elephant3}} |
| 328 |
% [.4\textwidth]{\includegraphics[width=140pt]{elephant}} |
| 329 |
% \caption{Two animals}\label{animals3} |
| 330 |
% \end{minipage} |
| 331 |
% |
| 332 |
% \bigskip |
| 333 |
% |
| 334 |
% \begin{background} |
| 335 |
% The |\sub|\-|caption|\-|box| is a |\par|\-|box| with |
| 336 |
% |\set|\-|caption|\-|sub|\-|type| as first contents line. |
| 337 |
% \end{background} |
| 338 |
% |
| 339 |
% \subsection{Comparison with \cs{captionbox}} |
| 340 |
% |
| 341 |
% Both, |\caption|\-|box| (offered by the \pkg{caption} package) and |\sub|\-|caption|\-|box|, |
| 342 |
% put its contents and caption into a |\par|\-|box| of either natural or given width and share the |
| 343 |
% same (mandatory and optional) arguments, but while |\caption|\-|box| uses a regular caption, |
| 344 |
% |\sub|\-|caption|\-|box| uses a sub-caption instead, like ``(a)'' or ``2.1''. |
| 345 |
% |
| 346 |
% \pagebreak[3] |
| 347 |
% So for example the last example would look like this when using |\caption|\-|box| |
| 348 |
% instead of |\sub|\-|caption|\-|box|: |
| 349 |
% \begin{quote} |
| 350 |
% |\begin{figure}|\\ |
| 351 |
% | \centering|\\ |
| 352 |
% | \captionbox{A cat\label{cat}}|\\ |
| 353 |
% | |\csoarg{.4\cs{textwidth}}|{\includegraphics{cat}}%|\\ |
| 354 |
% | \captionbox{An elephant\label{elephant}}|\\ |
| 355 |
% | |\csoarg{.4\cs{textwidth}}|{\includegraphics{elephant}}|\\ |
| 356 |
% |\end{figure}| |
| 357 |
% \end{quote} |
| 358 |
% \noindent\begin{minipage}{\linewidth} |
| 359 |
% \captionsetup{type=figure} |
| 360 |
% \centering |
| 361 |
% \captionbox{A cat\label{cat3.1}} |
| 362 |
% [.4\textwidth]{\includegraphics[width=30pt]{cat}}%^^A |
| 363 |
% \captionbox{An elephant\label{elephant3.1}} |
| 364 |
% [.4\textwidth]{\includegraphics[width=140pt]{elephant}} |
| 365 |
% \end{minipage} |
| 366 |
% |
| 367 |
% \iffalse |
| 368 |
% --------------------------------------------------------------------------- % |
| 369 |
% \fi |
| 370 |
% |
| 371 |
% \PageBreak |
| 372 |
% \section{The \env{subcaptionblock} environment} |
| 373 |
% |
| 374 |
% \DescribeEnv{subcaptionblock} |
| 375 |
% \NEWfeature*{v1.5} |
| 376 |
% The |sub|\-|caption|\-|block| environment makes a box with given width. |
| 377 |
% Inside this box the regular caption commands (like |\caption|, |\phantom|\-|caption|, \ldots) could be used to typeset sub-captions. |
| 378 |
% |
| 379 |
% \pagebreak[3] |
| 380 |
% |sub|\-|caption|\-|block| has the same (optional \& mandatory) arguments as the |mini|\-|page| environment: |
| 381 |
% \begingroup |
| 382 |
% \leftmargini=12pt |
| 383 |
% \begin{quote} |
| 384 |
% |\begin{subcaptionblock}|\oarg{outer-pos}\oarg{height}\oarg{inner-pos}\marg{width}\\ |
| 385 |
% | |\ldots\\ |
| 386 |
% |\end{subcaptionblock}| |
| 387 |
% \end{quote} |
| 388 |
% \endgroup |
| 389 |
% |
| 390 |
% The default value for \meta{outer-pos} is either `b' (if no main caption was typeset so far) or `t' (if a main caption was already typeset), |
| 391 |
% and the default value for \meta{inner-pos} is `s'. |
| 392 |
% |
| 393 |
% \NEWfeature{v1.2} |
| 394 |
% Beside the \meta{outer-pos} values of `c', `t', and `b', \thispackage\ also offers the |
| 395 |
% values `T' and `B' additionally which align the contents at the |
| 396 |
% very top or bottom. (In contrast `t' and `b' align the contents at the |
| 397 |
% top or bottom \textit{baseline}.) |
| 398 |
% |
| 399 |
% \bigskip |
| 400 |
% |
| 401 |
% \pagebreak[3] |
| 402 |
% The same example as \autoref{animals3}, but this time using the |sub|\-|caption|\-|block| environment |
| 403 |
% instead of |\sub|\-|caption|\-|box|: |
| 404 |
% \begin{quote} |
| 405 |
% |\begin{figure}|\\ |
| 406 |
% | \centering|\\ |
| 407 |
% | |\textcolor{blue}{\cs{begin}\csmarg{subcaptionblock}\csmarg{.4\cs{textwidth}}}\\ |
| 408 |
% | \centering|\\ |
| 409 |
% | \includegraphics{cat}|\\ |
| 410 |
% | |\textcolor{blue}{\cs{caption}}|{A cat}\label{cat}|\\ |
| 411 |
% | |\textcolor{blue}{\cs{end}\csmarg{subcaptionblock}}|%|\\ |
| 412 |
% | |\textcolor{blue}{\cs{begin}\csmarg{subcaptionblock}\csmarg{.4\cs{textwidth}}}\\ |
| 413 |
% | \centering|\\ |
| 414 |
% | \includegraphics{elephant}|\\ |
| 415 |
% | |\textcolor{blue}{\cs{caption}}|{An elephant}\label{elephant}|\\ |
| 416 |
% | |\textcolor{blue}{\cs{end}\csmarg{subcaptionblock}}|%|\\ |
| 417 |
% | \caption{Two animals}\label{animals}|\\ |
| 418 |
% |\end{figure}| |
| 419 |
% \end{quote} |
| 420 |
% \noindent\begin{minipage}{\linewidth} |
| 421 |
% \captionsetup{type=figure} |
| 422 |
% \centering |
| 423 |
% \begin{subcaptionblock}{.4\textwidth} |
| 424 |
% \centering |
| 425 |
% \includegraphics[width=30pt]{cat} |
| 426 |
% \caption{A cat}\label{cat4} |
| 427 |
% \end{subcaptionblock}% |
| 428 |
% \begin{subcaptionblock}{.4\textwidth} |
| 429 |
% \centering |
| 430 |
% \includegraphics[width=140pt]{elephant} |
| 431 |
% \caption{An elephant}\label{elephant4} |
| 432 |
% \end{subcaptionblock} |
| 433 |
% \caption{Two animals}\label{animals4} |
| 434 |
% \end{minipage} |
| 435 |
% |
| 436 |
% \medskip |
| 437 |
% |
| 438 |
% \pagebreak[3] |
| 439 |
% Some additional notes: |
| 440 |
% \begin{itemize} |
| 441 |
% \item |
| 442 |
% You can override the setttings for a specific subcaption |
| 443 |
% with a |\caption|\-|setup| inside the |sub|\-|caption|\-|block|, e.g.: |
| 444 |
% \begin{quote} |
| 445 |
% |\begin{subcaptionblock}{.4\textwidth}|\\ |
| 446 |
% | \centering|\\ |
| 447 |
% | \includegraphics{owl}|\\ |
| 448 |
% | |\textcolor{blue}{\cs{captionsetup}\csmarg{skip=3pt}}\\ |
| 449 |
% | \caption{An owl}\label{owl}|\\ |
| 450 |
% |\end{subcaptionblock}| |
| 451 |
% \end{quote} |
| 452 |
% \item |
| 453 |
% Just like |figure| or |table|, a |sub|\-|caption|\-|block| could have multiple captions, e.g.: |
| 454 |
% \begin{quote} |
| 455 |
% |\begin{subcaptionblock}{.4\textwidth}|\\ |
| 456 |
% | \centering|\\ |
| 457 |
% | \includegraphics{cat}|\\ |
| 458 |
% | \caption{A cat}\label{cat}|\\ |
| 459 |
% | \medskip|\\ |
| 460 |
% | \includegraphics{elephant}|\\ |
| 461 |
% | \caption{An elephant}\label{elephant}|\\ |
| 462 |
% |\end{subcaptionblock}| |
| 463 |
% \end{quote} |
| 464 |
% \item |
| 465 |
% Hyperlinks targeted to this sub-figure will jump to the beginning |
| 466 |
% of the |sub|\-|caption|\-|block|, and not to the |\caption| inside it |
| 467 |
% (if |hypcap=true| is set for sub-captions). |
| 468 |
% \See{\longref{hypcap}} |
| 469 |
% \end{itemize} |
| 470 |
% |
| 471 |
% \DescribeEnv{subfigure} |
| 472 |
% \DescribeEnv{subtable} |
| 473 |
% The |sub|\-|caption|\-|block| environment is also offered as |sub|\-|figure| or |sub|\-|table|. |
| 474 |
% (And prior version $1.5$ of \thispackage\ it was only available as |sub|\-|figure| or |sub|\-|table|.) |
| 475 |
% |
| 476 |
% There is no difference in them except the environment name should match the current floating environment, |
| 477 |
% i.e. inside a |figure| a |sub|\-|figure| should be used, and inside a |table| a |sub|\-|table| should be used. |
| 478 |
% Using the wrong sub-environment will cause a warning since \version{1.5} of the \pkg{subcaption} package. |
| 479 |
% |
| 480 |
% So if in doubt, or when writing own \LaTeX\ commands which should work in every floating environment, |
| 481 |
% using |sub|\-|caption|\-|block| is the correct choice. |
| 482 |
% |
| 483 |
% (Note that the default value for \meta{outer-pos} has changed from `c' to either `b' or `t' in version $1.5$ of \thispackage.) |
| 484 |
% |
| 485 |
% \smallskip |
| 486 |
% |
| 487 |
% \begin{background} |
| 488 |
% The |sub|\-|caption|\-|block|, |sub|\-|figure|, and |sub|\-|table| environments are |mini|\-|page| |
| 489 |
% environments with |\set|\-|caption|\-|sub|\-|type| as first contents line. |
| 490 |
% |
| 491 |
% |sub|\-|figure| and |sub|\-|table| are defined with the help of |
| 492 |
% |\For|\-|Each|\-|Caption|\-|Sub|\-|Type| offered by the \pkg{caption} package, |
| 493 |
% which executes code for every sub-type declared with |\Declare|\-|Caption|\-|Sub|\-|Type|. |
| 494 |
% \end{background} |
| 495 |
% |
| 496 |
% \iffalse |
| 497 |
% --------------------------------------------------------------------------- % |
| 498 |
% \fi |
| 499 |
% |
| 500 |
% \PageBreak |
| 501 |
% \section{The \env{subcaptiongroup} environment} |
| 502 |
% |
| 503 |
% \DescribeEnv{subcaptiongroup} |
| 504 |
% \NEWfeature*{v1.5} |
| 505 |
% The |sub|\-|caption|\-|group| environment is only switching to the sub-caption mode inside an own \TeX\ group. |
| 506 |
% Inside this environment the regular caption commands (like |\caption|, |\phantom|\-|caption|, \ldots) could be used to typeset sub-captions. |
| 507 |
% |
| 508 |
% \pagebreak[3] |
| 509 |
% Its syntax is: |
| 510 |
% \begingroup |
| 511 |
% \leftmargini=12pt |
| 512 |
% \begin{quote} |
| 513 |
% |\begin{subcaptiongroup}|\\ |
| 514 |
% | |\ldots\\ |
| 515 |
% |\end{subcaptiongroup}| |
| 516 |
% \end{quote} |
| 517 |
% \endgroup |
| 518 |
% |
| 519 |
% \pagebreak[3] |
| 520 |
% There is a starred variant of this environment as well which uses |\set|\-|caption|\-|sub|\-|type*| |
| 521 |
% instead of |\set|\-|caption|\-|sub|\-|type| internally: |
| 522 |
% \begingroup |
| 523 |
% \leftmargini=12pt |
| 524 |
% \begin{quote} |
| 525 |
% |\begin{subcaptiongroup*}|\\ |
| 526 |
% | |\ldots\\ |
| 527 |
% |\end{subcaptiongroup*}| |
| 528 |
% \end{quote} |
| 529 |
% \endgroup |
| 530 |
% |
| 531 |
% While this gives you great flexibility, it also offers you no help formatting its contents. |
| 532 |
% |
| 533 |
% \pagebreak[3] |
| 534 |
% The same example as \autoref{animals4}, but this time using the |sub|\-|caption|\-|group| environment |
| 535 |
% instead of |\sub|\-|caption|\-|block|: |
| 536 |
% \begin{quote} |
| 537 |
% |\begin{figure}|\\ |
| 538 |
% | \centering|\\ |
| 539 |
% | |\textcolor{blue}{\cs{begin}\csmarg{subcaptiongroup}}\\ |
| 540 |
% | \centering|\\ |
| 541 |
% | \parbox[b]{.4\textwidth}{%|\\ |
| 542 |
% | \centering|\\ |
| 543 |
% | \includegraphics{cat}|\\ |
| 544 |
% | \caption{A cat}\label{cat}}%|\\ |
| 545 |
% | \parbox[b]{.4\textwidth}{%|\\ |
| 546 |
% | \centering|\\ |
| 547 |
% | \includegraphics{elephant}|\\ |
| 548 |
% | \caption{An elephant}\label{elephant}}%|\\ |
| 549 |
% | |\textcolor{blue}{\cs{end}\csmarg{subcaptiongroup}}\\ |
| 550 |
% | \caption{Two animals}\label{animals}|\\ |
| 551 |
% |\end{figure}| |
| 552 |
% \end{quote} |
| 553 |
% --or-- |
| 554 |
% \begin{quote} |
| 555 |
% |\begin{figure}|\\ |
| 556 |
% | \centering|\\ |
| 557 |
% | |\textcolor{blue}{\cs{begin}\csmarg{subcaptiongroup}}\\ |
| 558 |
% | \centering|\\ |
| 559 |
% | \begin{minipage}[b]{.4\textwidth}|\\ |
| 560 |
% | \centering|\\ |
| 561 |
% | \includegraphics{cat}|\\ |
| 562 |
% | \caption{A cat}\label{cat}|\\ |
| 563 |
% | \end{minipage}%|\\ |
| 564 |
% | \begin{minipage}[b]{.4\textwidth}|\\ |
| 565 |
% | \centering|\\ |
| 566 |
% | \includegraphics{elephant}|\\ |
| 567 |
% | \caption{An elephant}\label{elephant}|\\ |
| 568 |
% | \end{minipage}|\\ |
| 569 |
% | |\textcolor{blue}{\cs{end}\csmarg{subcaptiongroup}}\\ |
| 570 |
% | \caption{Two animals}\label{animals}|\\ |
| 571 |
% |\end{figure}| |
| 572 |
% \end{quote} |
| 573 |
% \noindent\begin{minipage}{\linewidth} |
| 574 |
% \captionsetup{type=figure} |
| 575 |
% \centering |
| 576 |
% \begin{subcaptiongroup} |
| 577 |
% \centering |
| 578 |
% \begin{minipage}[b]{.4\textwidth} |
| 579 |
% \centering |
| 580 |
% \includegraphics[width=30pt]{cat} |
| 581 |
% \caption{A cat}\label{cat5} |
| 582 |
% \end{minipage}% |
| 583 |
% \begin{minipage}[b]{.4\textwidth} |
| 584 |
% \centering |
| 585 |
% \includegraphics[width=140pt]{elephant} |
| 586 |
% \caption{An elephant}\label{elephant5} |
| 587 |
% \end{minipage} |
| 588 |
% \end{subcaptiongroup} |
| 589 |
% \caption{Two animals}\label{animals5} |
| 590 |
% \end{minipage} |
| 591 |
% |
| 592 |
% \bigskip |
| 593 |
% |
| 594 |
% \begin{background} |
| 595 |
% The |sub|\-|caption|\-|group| environment is a \LaTeX\ environment |
| 596 |
% with |\set|\-|caption|\-|sub|\-|type| as first contents line. |
| 597 |
% \end{background} |
| 598 |
% |
| 599 |
% \iffalse |
| 600 |
% --------------------------------------------------------------------------- % |
| 601 |
% \fi |
| 602 |
% |
| 603 |
% \PageBreak |
| 604 |
% \section{The \cs{DeclareCaptionSubType} command} |
| 605 |
% |
| 606 |
% \DescribeMacro\DeclareCaptionSubType |
| 607 |
% For using the sub-caption feature of the \pkg{caption} package some |
| 608 |
% commands and counters must be prepared. This is done with |
| 609 |
% \begin{quote} |
| 610 |
% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\ |
| 611 |
% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type} |
| 612 |
% \end{quote} |
| 613 |
% For the environments |figure| \& |table|, and all the ones |
| 614 |
% defined with |\Declare|\-|Floating|\-|Environment| offered by the |
| 615 |
% \pkg{newfloat} package, this will be done automatically, |
| 616 |
% but for other environments (e.g.~the ones defined with |\newfloat| offered by the |
| 617 |
% \pkg{float} package or |\Declare|\-|New|\-|Float|\-|Type| offered by the |
| 618 |
% \pkg{floatrow} package) this has to be done manually. |
| 619 |
% |
| 620 |
% \medskip |
| 621 |
% |
| 622 |
% The starred variant provides the sub-caption numbering format |
| 623 |
% \meta{type}|.|\meta{subtype} (for example `|1.2|') while the non-starred variant |
| 624 |
% simply uses \meta{subtype} (for example `|a|'). |
| 625 |
% |
| 626 |
% \pagebreak[3] |
| 627 |
% Own numbering formats can be created by redefining |\thesub|\meta{type}, e.g.: |
| 628 |
% \begingroup |
| 629 |
% \leftmargini=12pt |
| 630 |
% \begin{quote} |
| 631 |
% |\DeclareCaptionSubType*{figure}|\\ |
| 632 |
% |\renewcommand\thesubfigure{\thefigure\alph{subfigure}}| |
| 633 |
% \end{quote} |
| 634 |
% \endgroup |
| 635 |
% would give you sub-caption numbers like `|1b|'. |
| 636 |
% |
| 637 |
% The default numbering scheme is |alph|, but you can use any \LaTeX\ (or self-defined) |
| 638 |
% command name here which converts a counter to a text value, e.g.: |arabic|, |roman|, |
| 639 |
% |Roman|, |alph|, |Alph|, |fnsymbol|, \ldots |
| 640 |
% |
| 641 |
% \pagebreak[3] |
| 642 |
% But |\DeclareCaptionSubType| is not only for defining new sub-caption types, |
| 643 |
% you can use this command for re-definitions as well, e.g.: |
| 644 |
% \begingroup |
| 645 |
% \leftmargini=12pt |
| 646 |
% \begin{quote} |
| 647 |
% |\DeclareCaptionSubType*[arabic]{table}|\\ |
| 648 |
% |\subcaptionsetup[table]{labelformat=simple,labelsep=colon}| |
| 649 |
% \end{quote} |
| 650 |
% \endgroup |
| 651 |
% \pagebreak[2] |
| 652 |
% will give you sub-captions in |table|s like these ones: |
| 653 |
% \par\bigskip |
| 654 |
% \noindent\begin{minipage}{\linewidth} |
| 655 |
% \captionsetup{type=table} |
| 656 |
% \centering |
| 657 |
% \caption{Two tables} |
| 658 |
% \subcaptionbox{Table one}[3cm][c]{\begin{tabular}{cc}A & B\\ C & D\\ \end{tabular}} |
| 659 |
% \subcaptionbox{Table two}[3cm][c]{\begin{tabular}{cc}E & F\\ G & H\\ \end{tabular}} |
| 660 |
% \end{minipage} |
| 661 |
% |
| 662 |
% \begin{background} |
| 663 |
% |\Declare|\-|Caption|\-|Sub|\-|Type| and |\For|\-|Each|\-|Caption|\-|Sub|\-|Type| |
| 664 |
% are integral parts of the \pkg{caption} package kernel. |
| 665 |
% \end{background} |
| 666 |
% |
| 667 |
% \iffalse |
| 668 |
% --------------------------------------------------------------------------- % |
| 669 |
% \fi |
| 670 |
% |
| 671 |
% \PageBreak |
| 672 |
% \section{Cross Referencing} |
| 673 |
% \label{crossreferencing} |
| 674 |
% |
| 675 |
% The macro |\the|\-\meta{counter} is not only responsible for the look of the \meta{counter}, |
| 676 |
% but for the look of the references typeset with |\ref|, too. References will be prefixed by |
| 677 |
% \LaTeX{} with the internal macro |\p@|\-\meta{counter}. |
| 678 |
% |
| 679 |
% |\Declare|\-|Caption|\-|Sub|\-|Type| will define both of them for sub-captions |
| 680 |
% (e.g. |sub|\-|figure| and |sub|\-|table|), and as you have seen in the last section |
| 681 |
% |\Declare|\-|Caption|\-|Sub|\-|Type| will give you some options to control the |
| 682 |
% internal (re-)definition of |\the|\-\meta{counter} and |\p@|\-\meta{counter}. |
| 683 |
% |
| 684 |
% \pagebreak[3] |
| 685 |
% \DescribeMacro\thesubfigure |
| 686 |
% \DescribeMacro\p@subfigure |
| 687 |
% For example |\thesubfigure| and |\p@subfigure| are (as default) internally defined as |
| 688 |
% \begin{quote} |
| 689 |
% |\newcommand\thesubfigure{\alph{subfigure}}|\\ |
| 690 |
% |\newcommand\p@subfigure{\thefigure}| |
| 691 |
% \end{quote} |
| 692 |
% so the label of sub-captions will look like `|a|' (decorated by the selected label format), |
| 693 |
% while references will look like `|1a|' since they are prefixed by |\p@sub|\-|figure| $=$ |
| 694 |
% |\the|\-|figure|. |
| 695 |
% |
| 696 |
% After |\Declare|\-|Caption|\-|Sub|\-|Type*[arabic]{figure}|, |\the|\-|sub|\-|figure| and |
| 697 |
% |\p@sub|\-|figure| will look like |
| 698 |
% \begin{quote} |
| 699 |
% |\renewcommand\thesubfigure{\thefigure.\arabic{subfigure}}|\\ |
| 700 |
% |\renewcommand\p@subfigure{}| |
| 701 |
% \end{quote} |
| 702 |
% |
| 703 |
% But if you want detailed control on how the references will look like, |
| 704 |
% the options of |\Declare|\-|Caption|\-|Sub|\-|Type| are potentially not sufficient. |
| 705 |
% In this case one need to redefine these two macros on his/her own. |
| 706 |
% Some examples: |
| 707 |
% |
| 708 |
% If you want parentheses around the sub-figure part of the reference, |
| 709 |
% so they will look like `|1(a)|', you may get them this way: |
| 710 |
% \begin{quote} |
| 711 |
% |\usepackage[labelformat=simple]{subcaption}|\\ |
| 712 |
% |\renewcommand\thesubfigure{(\alph{subfigure})}| |
| 713 |
% \end{quote} |
| 714 |
% {\small (\emph{Note:} Since |parens| is the default label format you will get double |
| 715 |
% parentheses in sub-captions when not specifiying a different label format, e.g. |simple|.)} |
| 716 |
% |
| 717 |
% But if you want only a closing parenthesis, so references will look like `|1a)|', |
| 718 |
% but the sub-captions itself should still look like `|(a)|', |
| 719 |
% this would be a possible solution: |
| 720 |
% \begin{quote} |
| 721 |
% |\usepackage{subcaption}|\\ |
| 722 |
% |\renewcommand\thesubfigure{\alph{subfigure})}|\\ |
| 723 |
% |\DeclareCaptionLabelFormat{opening}{(#2}|\\ |
| 724 |
% |\subcaptionsetup[figure]{labelformat=opening}| |
| 725 |
% \end{quote} |
| 726 |
% |
| 727 |
% \bigskip |
| 728 |
% |
| 729 |
% \pagebreak[3] |
| 730 |
% \INFO |
| 731 |
% {\small Please note that you need to surround redefinitions of |\p@|\-\meta{counter} |
| 732 |
% with |\make|\-|at|\-|letter| and |\make|\-|at|\-|other|. See |
| 733 |
% \url{http://tex.stackexchange.com/questions/8351/} |
| 734 |
% for details. |
| 735 |
% |
| 736 |
% Since October 2019 |\p@|\-\meta{counter} could be redefined using |\label|\-|format| instead, |
| 737 |
% dropping the need to use |\make|\-|at|\-|letter| and |\make|\-|at|\-|other|. |
| 738 |
% Furthermore not only prefixes could be specified this way, |
| 739 |
% instead the counter representation could be used at any position in the text. |
| 740 |
% So for example |
| 741 |
% \begin{quote} |
| 742 |
% |\makeatletter|\\ |
| 743 |
% |\renewcommand\p@subfigure{\thefigure}|\\ |
| 744 |
% |\makeatother|\\ |
| 745 |
% \end{quote} |
| 746 |
% (which prefixes the subfigure counter representation with the figure counter representation) |
| 747 |
% could be replaced by |
| 748 |
% \begin{quote} |
| 749 |
% |\labelformat{subfigure}{\thefigure #1}| |
| 750 |
% \end{quote}} |
| 751 |
% |
| 752 |
% \pagebreak[3] |
| 753 |
% \subsection{The \cs{subref} command} |
| 754 |
% \label{subref} |
| 755 |
% |
| 756 |
% While |\ref|\marg{key} (and |\ref*|\marg{key}, if the \pkg{hyperref} |
| 757 |
% package is used) usually gives a combined result representing the main |
| 758 |
% caption counter and the sub-caption one, it is sometimes useful to have |
| 759 |
% a reference to the sub-caption only. For this purpose you can use |
| 760 |
% \begin{quote} |
| 761 |
% |\subref|\marg{key}\\ |
| 762 |
% |\subref*|\marg{key}~\footnote{%^^A |
| 763 |
% Like \cs{ref*}, \cs{subref*} is only available if the \pkg{hyperref} |
| 764 |
% package\cite{hyperref} is used.}%^^A |
| 765 |
% \qquad. |
| 766 |
% \end{quote} |
| 767 |
% So for example |\ref{cat}| gives the result `\ref{cat}' but |\subref{cat}| |
| 768 |
% gives `\subref{cat}'. |
| 769 |
% |
| 770 |
% \begin{small} |
| 771 |
% \emph{Note:} If the sub-caption was (re-)defined with the starred variant |
| 772 |
% |\Declare|\-|Caption|\-|Sub|\-|Type*|, both |\ref| and |\sub|\-|ref| usually gives |
| 773 |
% the same result. |
| 774 |
% \end{small} |
| 775 |
% |
| 776 |
% \begin{background} |
| 777 |
% The |\sub|\-|ref| command demonstrates the usage of |\caption@sub|\-|type|\-|hook| |
| 778 |
% which will be called during |\caption|\-|setup{sub|\-|type}|. |
| 779 |
% \end{background} |
| 780 |
% |
| 781 |
% \pagebreak[3] |
| 782 |
% \subsection{The \opt{subrefformat=} option} |
| 783 |
% \label{subrefformat} |
| 784 |
% |
| 785 |
% \DescribeMacro{subrefformat=} |
| 786 |
% \NEWfeature*{v1.1} |
| 787 |
% By applying |\Declare|\-|Caption|\-|Sub|\-|Type|, or by redefining |\the|\-\meta{counter} |
| 788 |
% and |\p@|\-\meta{counter}, you will change the look of references typeset with |\ref| |
| 789 |
% \emph{and} |\sub|\-|ref|. |
| 790 |
% |
| 791 |
% But maybe you only want to change the output of |\sub|\-|ref| without |
| 792 |
% affecting the references typeset with |\ref|? |
| 793 |
% |
| 794 |
% \pagebreak[3] |
| 795 |
% This is possible, too, by using the option \opt{subrefformat}: |
| 796 |
% \begin{quote} |
| 797 |
% |\captionsetup{subrefformat=|\meta{label format}|}| |
| 798 |
% \end{quote} |
| 799 |
% This one will choose a label format (either a pre-defined one, or a one defined with |
| 800 |
% |\Declare|\-|Caption|\-|Label|\-|Format|) as decorative element to sub-references. |
| 801 |
% The default one is |simple| which has no decorative elements but simply typeset |
| 802 |
% the reference as it is. |
| 803 |
% |
| 804 |
% \pagebreak[3] |
| 805 |
% For example |
| 806 |
% \begin{quote} |
| 807 |
% |\captionsetup{subrefformat=parens}| |
| 808 |
% \end{quote} |
| 809 |
% will result in references (typeset with |\ref|) like `|1a|' but sub-references |
| 810 |
% (typeset with |\subref|) like `|(a)|'. |
| 811 |
% |
| 812 |
% \subsection{Referencing sub-figures without sub-captions} |
| 813 |
% \label{without} |
| 814 |
% |
| 815 |
% \DescribeMacro\phantomcaption |
| 816 |
% If you don't want to give a sub-figure a caption (yet), because the picture itself |
| 817 |
% already contains the caption, or for some other reason, you could use the command |
| 818 |
% \begin{quote} |
| 819 |
% |\phantomcaption| |
| 820 |
% \end{quote} |
| 821 |
% instead of |\caption|. |
| 822 |
% |
| 823 |
% |\phantom|\-|caption| is offered by the \pkg{caption} package since version $3.2$ and |
| 824 |
% does not generate any output but increases the sub-figure or sub-table counter |
| 825 |
% and gives you an anchor for a |\label| command which can be placed after it. |
| 826 |
% |
| 827 |
% \pagebreak[3] |
| 828 |
% An example: |
| 829 |
% \begin{quote} |
| 830 |
% |\begin{figure}|\\ |
| 831 |
% | \centering|\\ |
| 832 |
% | \begin{subcaptiongroup}|\\ |
| 833 |
% | \includegraphics{cat_with_a}|\\ |
| 834 |
% | |\textcolor{blue}{\cs{phantomcaption}}|\label{cat}|\\ |
| 835 |
% | \includegraphics{elephant_with_b}|\\ |
| 836 |
% | |\textcolor{blue}{\cs{phantomcaption}}|\label{elephant}|\\ |
| 837 |
% | \end{subcaptiongroup}|\\ |
| 838 |
% | \captionsetup{subrefformat=parens}|\\ |
| 839 |
% | \caption{Two animals: \subref{cat} a cat,|\\ |
| 840 |
% | and \subref{elephant} an elephant}|\\ |
| 841 |
% | \label{animals}|\\ |
| 842 |
% |\end{figure}| |
| 843 |
% \end{quote} |
| 844 |
% \noindent\begin{minipage}{\linewidth} |
| 845 |
% \captionsetup{type=figure} |
| 846 |
% \centering |
| 847 |
% \begin{subcaptiongroup} |
| 848 |
% \phantomcaption\label{cat6.3} |
| 849 |
% \begin{overpic}[width=30pt]{cat} |
| 850 |
% \put(40,34){\captiontext*{}} |
| 851 |
% \end{overpic} |
| 852 |
% \phantomcaption\label{elephant6.3} |
| 853 |
% \begin{overpic}[width=140pt]{elephant} |
| 854 |
% \put(58,40){\captiontext*{}} |
| 855 |
% \end{overpic} |
| 856 |
% \end{subcaptiongroup} |
| 857 |
% \captionsetup{subrefformat=parens} |
| 858 |
% \caption{Two animals: \subref{cat6.3} a cat, and \subref{elephant6.3} an elephant} |
| 859 |
% \end{minipage} |
| 860 |
% |
| 861 |
% \bigskip |
| 862 |
% |
| 863 |
% \pagebreak[3] |
| 864 |
% \DescribeMacro\captionlistentry |
| 865 |
% If you don't want to give a sub-figure a caption (yet), because the picture itself |
| 866 |
% already contains the caption, or for some other reason, you could also use the command |
| 867 |
% \begin{quote} |
| 868 |
% |\captionlistentry|\marg{list entry} |
| 869 |
% \end{quote} |
| 870 |
% instead of |\caption|. |
| 871 |
% |
| 872 |
% |\caption|\-|list|\-|entry| is offered by the \pkg{caption} package since version $3.3$ and |
| 873 |
% (just like |\phantom|\-|caption|) does not generate any output but increases |
| 874 |
% the sub-figure or sub-table counter |
| 875 |
% and gives you an anchor for a |\label| command which can be placed after it. |
| 876 |
% Additionally to |\phantom|\-|caption| this command puts an entry into the list |
| 877 |
% of figures or tables. |
| 878 |
% |
| 879 |
% \pagebreak[3] |
| 880 |
% An example: |
| 881 |
% \begin{quote} |
| 882 |
% |\begin{figure}|\\ |
| 883 |
% | \centering|\\ |
| 884 |
% | \begin{subcaptiongroup}|\\ |
| 885 |
% | \includegraphics{cat_with_a}|\\ |
| 886 |
% | |\textcolor{blue}{\cs{captionlistentry}\csmarg{A cat}}\\ |
| 887 |
% | \label{cat}|\\ |
| 888 |
% | \includegraphics{elephant_with_b}|\\ |
| 889 |
% | |\textcolor{blue}{\cs{captionlistentry}\csmarg{An elephant}}\\ |
| 890 |
% | \label{elephant}|\\ |
| 891 |
% | \end{subcaptiongroup}|\\ |
| 892 |
% | \captionsetup{subrefformat=parens}|\\ |
| 893 |
% | \caption{Two animals: \subref{cat} a cat,|\\ |
| 894 |
% | and \subref{elephant} an elephant}|\\ |
| 895 |
% | \label{animals}|\\ |
| 896 |
% |\end{figure}| |
| 897 |
% \end{quote} |
| 898 |
% |
| 899 |
% \pagebreak[3] |
| 900 |
% \subsection{Typesetting sub-captions without generating a (new) reference} |
| 901 |
% \label{without2} |
| 902 |
% |
| 903 |
% The |\caption| command is a multi-purpose command: |
| 904 |
% \begin{enumerate} |
| 905 |
% \item It increments the sub-figure or sub-table counter and generates an internal reference which could be used with |\label| |
| 906 |
% \item It puts an entry into the list of figures or tables |
| 907 |
% \item It finally typesets a caption |
| 908 |
% \end{enumerate} |
| 909 |
% |
| 910 |
% When put into a command or into an environment which either evaluates its content more than once or |
| 911 |
% does not like one of the first two actions (for whatever reason), the result could be either an error message or an incorrect |
| 912 |
% result, for example a sub-figure or sub-table counter which was incremented more than once. |
| 913 |
% |
| 914 |
% \DescribeMacro\captiontext |
| 915 |
% In these cases the |\caption| command could be split into |
| 916 |
% |\phantom|\-|caption| which performs step one only (or |\caption|\-|list|\-|entry| which performs steps one and two), |
| 917 |
% and |\caption|\-|text| which performs step three only. |
| 918 |
% This way critical steps could be out-sourced from the target command or environment, |
| 919 |
% for example by prepending |\phantom|\-|caption| and using |\caption|\-|text| inside. |
| 920 |
% |
| 921 |
% \pagebreak[3] |
| 922 |
% The syntax of |caption|\-|text| is |
| 923 |
% \begin{quote} |
| 924 |
% |\captiontext|\oarg{number}\marg{text of sub-caption}\\ |
| 925 |
% |\captiontext*|\oarg{number}\marg{text of sub-caption} |
| 926 |
% \end{quote} |
| 927 |
% |\caption|\-|text| is offered by the \pkg{caption} package since version $3.6$ and |
| 928 |
% as opposite to |\caption| it does not increase the sub-figure or sub-table counter |
| 929 |
% and does not give you an anchor for a |\label| command. |
| 930 |
% It typesets the caption only, using existing counter values unless a \meta{number} is given explicitly. |
| 931 |
% |
| 932 |
% For example code please take a look at \longref{inside}. |
| 933 |
% |
| 934 |
% \pagebreak[3] |
| 935 |
% \subsection{Where to place the \cs{label} command?} |
| 936 |
% \label{label} |
| 937 |
% |
| 938 |
% When |\caption| |
| 939 |
% inside a |caption|\-|sub|\-|block|, |sub|\-|figure|, |sub|\-|table|, or |caption|\-|sub|\-|group| environment, |
| 940 |
% the |\label| can be either placed inside the caption text or right after the command, e.g.: |
| 941 |
% \begin{quote} |
| 942 |
% |\caption{Some text here\label{text}}|\\ |
| 943 |
% \ldots\\ |
| 944 |
% |\caption{Some other text}\label{othertext}|\\ |
| 945 |
% \ldots\\ |
| 946 |
% |\caption{Something completely different}|\\ |
| 947 |
% |\label{differenttext}| |
| 948 |
% \end{quote} |
| 949 |
% |
| 950 |
% When using |\phantom|\-|caption| or |\caption|\-|list|\-|entry| |
| 951 |
% inside a |caption|\-|sub|\-|block|, |sub|\-|figure|, |sub|\-|table|, or |caption|\-|sub|\-|group| environment, |
| 952 |
% the |\label| should be placed right after the command, e.g.: |
| 953 |
% \begin{quote} |
| 954 |
% |\phantomcaption\label{this}|\\ |
| 955 |
% \ldots\\ |
| 956 |
% |\phantomcaption|\\ |
| 957 |
% |\label{that}| |
| 958 |
% \end{quote} |
| 959 |
% |
| 960 |
% But when using the |\sub|\-|caption|\-|box| command, the |\label| should be placed inside |
| 961 |
% the caption text, e.g.: |
| 962 |
% \begin{quote} |
| 963 |
% |\subcaptionbox{A description here\label{todo1}}|\\ |
| 964 |
% | {Some content here}|\\ |
| 965 |
% \ldots\\ |
| 966 |
% |\subcaptionbox[List-of-Figures entry]|\\ |
| 967 |
% | {A description here\label{todo2}}|\\ |
| 968 |
% | {Some content here}| |
| 969 |
% \end{quote} |
| 970 |
% Placing |\label| outside the |\sub|\-|caption|\-|box| would produce an incorrect reference. |
| 971 |
% |
| 972 |
% \pagebreak[3] |
| 973 |
% \subsection{Where do hyperlinks jump?} |
| 974 |
% \label{hypcap} |
| 975 |
% |
| 976 |
% For the |caption|\-|sub|\-|block|, |sub|\-|figure|, |sub|\-|table|, and |caption|\-|sub|\-|group| environments, |
| 977 |
% and for the |\sub|\-|caption|\-|box| command (and all other constructs which use |\set|\-|caption|\-|sub|\-|type|) |
| 978 |
% the hyperlink anchors will be placed in respect to the |hypcap=| setting. |
| 979 |
% While usage of this option is straight-forward for ordinary captions, |
| 980 |
% the usage for sub-captions depends on the setting regarding the main captions. |
| 981 |
% |
| 982 |
% This table gives you an overview where the hyperlinks will jump: |
| 983 |
% |
| 984 |
% \bigskip |
| 985 |
% |
| 986 |
% \begin{small} |
| 987 |
% \centering |
| 988 |
% \DeleteShortVerb{\|} |
| 989 |
% \renewcommand\arraystretch{1.5} |
| 990 |
% \begin{tabular}{|l|p{3cm}p{3cm}|} |
| 991 |
% \hline |
| 992 |
% \backslashbox{subcaption}{caption} & |
| 993 |
% \multicolumn{1}{c}{\texttt{hypcap=false}} & |
| 994 |
% \multicolumn{1}{c|}{\texttt{hypcap=true}} \\ |
| 995 |
% \hline |
| 996 |
% \raisebox{-1.5ex}[1.5ex]{\texttt{hypcap=false}} & |
| 997 |
% sub-caption & figure or table\par\hfill\textit{(default setting)}\\ |
| 998 |
% \raisebox{-1.5ex}[1.5ex]{\texttt{hypcap=true}} & |
| 999 |
% sub-figure or\par sub-table & sub-figure or\par sub-table \\ |
| 1000 |
% \hline |
| 1001 |
% \end{tabular}\par |
| 1002 |
% \MakeShortVerb{\|} |
| 1003 |
% \end{small} |
| 1004 |
% \bigskip |
| 1005 |
% |
| 1006 |
% But if the |caption|\-|sub|\-|group*| environment is used |
| 1007 |
% (or a different construct which uses |\set|\-|caption|\-|sub|\-|type*|) |
| 1008 |
% and |hypcap=true| is set for sub-captions, |
| 1009 |
% \thispackage\ does not know where the sub-figure or sub-table actually |
| 1010 |
% begins, so it will jump to the sub-caption instead. |
| 1011 |
% |
| 1012 |
% \medskip |
| 1013 |
% \emph{Remember:} If you use the \pkg{hypcap} package\cite{hypcap}, |
| 1014 |
% it controls the placement of the hyperlink anchors, making the rules |
| 1015 |
% above invalid. |
| 1016 |
% |
| 1017 |
% \bigskip |
| 1018 |
% {\small(See also the documentation of the \pkg{caption} package, |
| 1019 |
% sections about \pkg{hyperref} \& \pkg{hypcap}.)} |
| 1020 |
% |
| 1021 |
% \iffalse |
| 1022 |
% --------------------------------------------------------------------------- % |
| 1023 |
% \fi |
| 1024 |
% |
| 1025 |
% \PageBreak |
| 1026 |
% \section{Captions inside sub-figures} |
| 1027 |
% \label{inside} |
| 1028 |
% |
| 1029 |
% Nearly all code examples so far have placed the caption either above or below the sub-figure. |
| 1030 |
% But it is possible to put the caption inside the sub-figure, too: |
| 1031 |
% \begin{itemize} |
| 1032 |
% \item The caption could already be part of the image. (This case is already handled in \longref{without}.) |
| 1033 |
% \item \LaTeX\ packages like \pkg{overpic}, \pkg{stackengine}, or \pkg{tikz} could be used. |
| 1034 |
% Note that the commands or environments offered by these packages usually evaluate their content more than once, |
| 1035 |
% resulting in either errors or wrong reference counters. |
| 1036 |
% For this reason |\caption| should not be used here, instead |
| 1037 |
% |\phantomcaption| or |\captionlistentry| should be used outside the command or environment and |
| 1038 |
% |\captiontext| should be used inside it. |
| 1039 |
% See also \longref{without2} |
| 1040 |
% \item The options |skip=| and |margin=| could be used to place the caption onto the image. |
| 1041 |
% \end{itemize} |
| 1042 |
% |
| 1043 |
% \pagebreak[3] |
| 1044 |
% \subsection{Using the overpic package} |
| 1045 |
% \label{overpic} |
| 1046 |
% |
| 1047 |
% The same example as in section \longref{without}, but using the \env{overpic} environment |
| 1048 |
% offered by the \pkg{overpic} package~\cite{overpic} |
| 1049 |
% to place the captions inside the pictures: |
| 1050 |
% \begin{quote} |
| 1051 |
% |\usepackage{overpic}|\\ |
| 1052 |
% \ldots\\ |
| 1053 |
% |\begin{figure}|\\ |
| 1054 |
% | \centering|\\ |
| 1055 |
% | \begin{subcaptiongroup}|\\ |
| 1056 |
% | |\textcolor{blue}{\cs{subcaptionlistentry}\csmarg{A cat}}\\ |
| 1057 |
% | \label{cat}|\\ |
| 1058 |
% | \begin{overpic}[width=60pt]{cat}|\\ |
| 1059 |
% | \put(40,34){|\textcolor{blue}{\cs{captiontext*}\csmarg{}}|}|\\ |
| 1060 |
% | \end{overpic}|\\ |
| 1061 |
% | |\textcolor{blue}{\cs{subcaptionlistentry}\csmarg{An elephant}}\\ |
| 1062 |
% | \label{elephant}|\\ |
| 1063 |
% | \begin{overpic}[width=140pt]{elephant}|\\ |
| 1064 |
% | \put(58,40){|\textcolor{blue}{\cs{captiontext*}\csmarg{}}|}|\\ |
| 1065 |
% | \end{overpic}|\\ |
| 1066 |
% | \end{subcaptiongroup}|\\ |
| 1067 |
% | \captionsetup{subrefformat=parens}|\\ |
| 1068 |
% | \caption{Two animals: \subref{cat} a huge cat,|\\ |
| 1069 |
% | and \subref{elephant} an elephant}|\\ |
| 1070 |
% |\end{figure}| |
| 1071 |
% \end{quote} |
| 1072 |
% \noindent\begin{minipage}{\linewidth} |
| 1073 |
% \captionsetup{type=figure} |
| 1074 |
% \centering |
| 1075 |
% \begin{subcaptiongroup} |
| 1076 |
% \subcaptionlistentry{A cat}\label{cat7.1} |
| 1077 |
% \begin{overpic}[width=60pt]{cat} |
| 1078 |
% \put(40,34){\captiontext*{}} |
| 1079 |
% \end{overpic} |
| 1080 |
% \subcaptionlistentry{An elephant}\label{elephant7.1} |
| 1081 |
% \begin{overpic}[width=140pt]{elephant} |
| 1082 |
% \put(58,40){\captiontext*{}} |
| 1083 |
% \end{overpic} |
| 1084 |
% \end{subcaptiongroup} |
| 1085 |
% \captionsetup{subrefformat=parens} |
| 1086 |
% \caption{Two animals: \subref{cat7.1} a huge cat, and \subref{elephant7.1} an elephant} |
| 1087 |
% \end{minipage} |
| 1088 |
% |
| 1089 |
% \bigskip |
| 1090 |
% |
| 1091 |
% If neither a reference to the sub-figures nor an entry in the List of Figures is needed, |
| 1092 |
% the usage of |\phantom|\-|caption| or |\caption|\-|list|\-|entry| could be dropped. |
| 1093 |
% Since this leaves |\caption|\-|text| without a valid sub-figure number value it must be |
| 1094 |
% given to it explicitly as optional argument. |
| 1095 |
% |
| 1096 |
% Furthermore the usage of the |sub|\-|caption|\-|group| environment could be dropped here, |
| 1097 |
% instead it would be sufficient to replace |\caption|\-|text| with |\sub|\-|caption|\-|text|. |
| 1098 |
% \See{\longref{subcaption}} |
| 1099 |
% |
| 1100 |
% \begin{quote} |
| 1101 |
% |\usepackage{overpic}|\\ |
| 1102 |
% \ldots\\ |
| 1103 |
% |\begin{figure}|\\ |
| 1104 |
% | \centering|\\ |
| 1105 |
% | \begin{overpic}[width=60pt]{cat}|\\ |
| 1106 |
% | \put(40,34){|\textcolor{blue}{\cs{subcaptiontext*}\csoarg{1}\csmarg{}}|}|\\ |
| 1107 |
% | \end{overpic}|\\ |
| 1108 |
% | \begin{overpic}[width=140pt]{elephant}|\\ |
| 1109 |
% | \put(58,40){|\textcolor{blue}{\cs{subcaptiontext*}\csoarg{2}\csmarg{}}|}|\\ |
| 1110 |
% | \end{overpic}|\\ |
| 1111 |
% | \caption{Two animals: A huge cat and an elephant}|\\ |
| 1112 |
% |\end{figure}| |
| 1113 |
% \end{quote} |
| 1114 |
% |
| 1115 |
% \pagebreak[3] |
| 1116 |
% \subsection{Using the stackengine package} |
| 1117 |
% \label{stackengine} |
| 1118 |
% |
| 1119 |
% The same example as in section \longref{without}, but using the |\stack|\-|inset| command |
| 1120 |
% offered by the \pkg{stackengine} package~\cite{stackengine} |
| 1121 |
% to place the captions inside the pictures: |
| 1122 |
% \begin{quote} |
| 1123 |
% |\usepackage{stackengine}|\\ |
| 1124 |
% \ldots\\ |
| 1125 |
% |\begin{figure}|\\ |
| 1126 |
% | \centering|\\ |
| 1127 |
% | \begin{subcaptiongroup}|\\ |
| 1128 |
% | |\textcolor{blue}{\cs{subcaptionlistentry}\csmarg{A cat}}\\ |
| 1129 |
% | \label{cat}|\\ |
| 1130 |
% | \stackinset{l}{25pt}{b}{20pt}{|\textcolor{blue}{\cs{captiontext*}\csmarg{}}|}|\\ |
| 1131 |
% | {\includegraphics[width=60pt]{cat}}|\\ |
| 1132 |
% | |\textcolor{blue}{\cs{subcaptionlistentry}\csmarg{An elephant}}\\ |
| 1133 |
% | \label{elephant}|\\ |
| 1134 |
% | \stackinset{l}{80pt}{b}{60pt}{|\textcolor{blue}{\cs{captiontext*}\csmarg{}}|}|\\ |
| 1135 |
% | {\includegraphics[width=140pt]{elephant}}|\\ |
| 1136 |
% | \end{subcaptiongroup}|\\ |
| 1137 |
% | \captionsetup{subrefformat=parens}|\\ |
| 1138 |
% | \caption{Two animals: \subref{cat} a huge cat,|\\ |
| 1139 |
% | and \subref{elephant} an elephant}|\\ |
| 1140 |
% |\end{figure}| |
| 1141 |
% \end{quote} |
| 1142 |
% \noindent\begin{minipage}{\linewidth} |
| 1143 |
% \captionsetup{type=figure} |
| 1144 |
% \centering |
| 1145 |
% \begin{subcaptiongroup} |
| 1146 |
% \subcaptionlistentry{A cat}\label{cat7.2} |
| 1147 |
% \stackinset{l}{25pt}{b}{20pt}{\captiontext*{}}{\includegraphics[width=60pt]{cat}} |
| 1148 |
% \subcaptionlistentry{An elephant}\label{elephant7.2} |
| 1149 |
% \stackinset{l}{80pt}{b}{60pt}{\captiontext*{}}{\includegraphics[width=140pt]{elephant}} |
| 1150 |
% \end{subcaptiongroup} |
| 1151 |
% \captionsetup{subrefformat=parens} |
| 1152 |
% \caption{Two animals: \subref{cat7.2} a huge cat, and \subref{elephant7.2} an elephant} |
| 1153 |
% \end{minipage} |
| 1154 |
% |
| 1155 |
% \bigskip |
| 1156 |
% |
| 1157 |
% \pagebreak[3] |
| 1158 |
% If neither a reference to the sub-figures nor an entry in the List of Figures is needed, |
| 1159 |
% this code could be simpified to: |
| 1160 |
% \begin{quote} |
| 1161 |
% |\usepackage{stackengine}|\\ |
| 1162 |
% \ldots\\ |
| 1163 |
% |\begin{figure}|\\ |
| 1164 |
% | \centering|\\ |
| 1165 |
% | \stackinset{l}{25pt}{b}{20pt}{|\textcolor{blue}{\cs{subcaptiontext*}\csoarg{1}\csmarg{}}|}|\\ |
| 1166 |
% | {\includegraphics[width=60pt]{cat}}|\\ |
| 1167 |
% | \stackinset{l}{80pt}{b}{60pt}{|\textcolor{blue}{\cs{subcaptiontext*}\csoarg{2}\csmarg{}}|}|\\ |
| 1168 |
% | {\includegraphics[width=140pt]{elephant}}|\\ |
| 1169 |
% | \caption{Two animals: A huge cat and an elephant}|\\ |
| 1170 |
% |\end{figure}| |
| 1171 |
% \end{quote} |
| 1172 |
% |
| 1173 |
% \pagebreak[3] |
| 1174 |
% \subsection{Using the tikz package} |
| 1175 |
% \label{tikz} |
| 1176 |
% |
| 1177 |
% The same example as in section \longref{without}, but using the \env{tikzpicture} environment |
| 1178 |
% offered by the \pkg{tikz} package~\cite{tikz} |
| 1179 |
% to place the captions inside the pictures: |
| 1180 |
% \begin{quote} |
| 1181 |
% |\usepackage{tikz}|\\ |
| 1182 |
% \ldots\\ |
| 1183 |
% |\begin{figure}|\\ |
| 1184 |
% | \centering|\\ |
| 1185 |
% | \begin{subcaptiongroup}|\\ |
| 1186 |
% | |\textcolor{blue}{\cs{subcaptionlistentry}\csmarg{A cat}}\\ |
| 1187 |
% | \label{cat}|\\ |
| 1188 |
% | \begin{tikzpicture}|\\ |
| 1189 |
% | \node (cat) at (0,0)|\\ |
| 1190 |
% | {\includegraphics[width=60pt]{cat}};|\\ |
| 1191 |
% | \node at (0.1,-0.1) {|\textcolor{blue}{\cs{captiontext*}\csmarg{}}|};|\\ |
| 1192 |
% | \end{tikzpicture}|\\ |
| 1193 |
% | |\textcolor{blue}{\cs{subcaptionlistentry}\csmarg{An elephant}}\\ |
| 1194 |
% | \label{elephant}|\\ |
| 1195 |
% | \begin{tikzpicture}|\\ |
| 1196 |
% | \node (elephant) at (0,0)|\\ |
| 1197 |
% | {\includegraphics[width=140pt]{elephant}};|\\ |
| 1198 |
% | \node at (0.5,-0.1) {|\textcolor{blue}{\cs{captiontext*}\csmarg{}}|};|\\ |
| 1199 |
% | \end{tikzpicture}|\\ |
| 1200 |
% | \end{subcaptiongroup}|\\ |
| 1201 |
% | \captionsetup{subrefformat=parens}|\\ |
| 1202 |
% | \caption{Two animals: \subref{cat} a huge cat,|\\ |
| 1203 |
% | and \subref{elephant} an elephant}|\\ |
| 1204 |
% |\end{figure}| |
| 1205 |
% \end{quote} |
| 1206 |
% |
| 1207 |
% \noindent\begin{minipage}{\linewidth} |
| 1208 |
% \captionsetup{type=figure} |
| 1209 |
% \centering |
| 1210 |
% \begin{subcaptiongroup} |
| 1211 |
% \subcaptionlistentry{A cat}\label{cat7.3} |
| 1212 |
% \begin{tikzpicture} |
| 1213 |
% \node (cat) at (0,0) {\includegraphics[width=60pt]{cat}}; |
| 1214 |
% \node at (0.1,-0.1) {\captiontext*{}}; |
| 1215 |
% \end{tikzpicture} |
| 1216 |
% \subcaptionlistentry{An elephant}\label{elephant7.3} |
| 1217 |
% \begin{tikzpicture} |
| 1218 |
% \node (cat) at (0,0) {\includegraphics[width=140pt]{elephant}}; |
| 1219 |
% \node at (0.5,-0.1) {\captiontext*{}}; |
| 1220 |
% \end{tikzpicture} |
| 1221 |
% \end{subcaptiongroup} |
| 1222 |
% \captionsetup{subrefformat=parens} |
| 1223 |
% \caption{Two animals: \subref{cat7.3} a huge cat, and \subref{elephant7.3} an elephant} |
| 1224 |
% \end{minipage} |
| 1225 |
% |
| 1226 |
% \bigskip |
| 1227 |
% |
| 1228 |
% \pagebreak[3] |
| 1229 |
% If neither a reference to the sub-figures nor an entry in the List of Figures is needed, |
| 1230 |
% this code could be simpified to: |
| 1231 |
% \begin{quote} |
| 1232 |
% |\usepackage{tikz}|\\ |
| 1233 |
% \ldots\\ |
| 1234 |
% |\begin{figure}|\\ |
| 1235 |
% | \centering|\\ |
| 1236 |
% | \begin{tikzpicture}|\\ |
| 1237 |
% | \node (cat) at (0,0)|\\ |
| 1238 |
% | {\includegraphics[width=60pt]{cat}};|\\ |
| 1239 |
% | \node at (0.1,-0.1) {|\textcolor{blue}{\cs{subcaptiontext*}\csoarg{1}\csmarg{}}|};|\\ |
| 1240 |
% | \end{tikzpicture}|\\ |
| 1241 |
% | \begin{tikzpicture}|\\ |
| 1242 |
% | \node (elephant) at (0,0)|\\ |
| 1243 |
% | {\includegraphics[width=140pt]{elephant}};|\\ |
| 1244 |
% | \node at (0.5,-0.1) {|\textcolor{blue}{\cs{subcaptiontext*}\csoarg{2}\csmarg{}}|};|\\ |
| 1245 |
% | \end{tikzpicture}|\\ |
| 1246 |
% | \caption{Two animals: A huge cat and an elephant}|\\ |
| 1247 |
% |\end{figure}| |
| 1248 |
% \end{quote} |
| 1249 |
% |
| 1250 |
% \pagebreak[3] |
| 1251 |
% \subsection{Using the skip and margin options} |
| 1252 |
% For a particular sub-caption the |skip=|\ldots could be set to a negative value so it will overlap with the image. |
| 1253 |
% Combined with |singlelinecheck=off| (to switch off the centering of short captions) and |margin=|\ldots it could be placed |
| 1254 |
% at a specific horizontal position within the image, too. |
| 1255 |
% |
| 1256 |
% \pagebreak[3] |
| 1257 |
% The same example as in section \longref{without}, but using the |skip=|\ldots and |margin=|\ldots options: |
| 1258 |
% \begin{quote} |
| 1259 |
% |\begin{figure}|\\ |
| 1260 |
% | \centering|\\ |
| 1261 |
% | \subcaptionsetup[figure]|\\ |
| 1262 |
% | {skip=-28pt,slc=off,margin={25pt,0pt}}|\\ |
| 1263 |
% | \subcaptionbox{\label{cat}}|\\ |
| 1264 |
% | {\includegraphics[width=60pt]{cat}}|\\ |
| 1265 |
% | \subcaptionsetup[figure]|\\ |
| 1266 |
% | {skip=-60pt,slc=off,margin={80pt,0pt}}|\\ |
| 1267 |
% | \subcaptionbox{\label{elephant}}|\\ |
| 1268 |
% | {\includegraphics[width=140pt]{elephant}}|\\ |
| 1269 |
% | \captionsetup{subrefformat=parens}|\\ |
| 1270 |
% | \caption{Two animals: \subref{cat} a huge cat,|\\ |
| 1271 |
% | and \subref{elephant} an elephant}|\\ |
| 1272 |
% |\end{figure}| |
| 1273 |
% \end{quote} |
| 1274 |
% |
| 1275 |
% \noindent\begin{minipage}{\linewidth} |
| 1276 |
% \captionsetup{type=figure} |
| 1277 |
% \centering |
| 1278 |
% \captionsetup[subfigure]{skip=-28pt,slc=off,margin={25pt,0pt}} |
| 1279 |
% \subcaptionbox{\label{cat7.4}}{\includegraphics[width=60pt]{cat}} |
| 1280 |
% \captionsetup[subfigure]{skip=-60pt,slc=off,margin={80pt,0pt}} |
| 1281 |
% \subcaptionbox{\label{elephant7.4}}{\includegraphics[width=140pt]{elephant}} |
| 1282 |
% \captionsetup{subrefformat=parens} |
| 1283 |
% \caption{Two animals: \subref{cat7.4} a huge cat, and \subref{elephant7.4} an elephant} |
| 1284 |
% \end{minipage} |
| 1285 |
% |
| 1286 |
% \iffalse |
| 1287 |
% --------------------------------------------------------------------------- % |
| 1288 |
% \fi |
| 1289 |
% |
| 1290 |
% \PageBreak |
| 1291 |
% \section{Numbering} |
| 1292 |
% |
| 1293 |
% \subsection{Pittfall \#1: Using multiple main captions} |
| 1294 |
% |
| 1295 |
% When multiple main captions are used within a figure or table, and sub-captions |
| 1296 |
% are used as well, how does the \pkg{subcaption} package know which |
| 1297 |
% sub-captions belong to which caption, i.e. what is the main counter value for |
| 1298 |
% the sub-captions? |
| 1299 |
% |
| 1300 |
% \pagebreak[3] |
| 1301 |
% Let's illustrate this problem with an example document: |
| 1302 |
% \begin{quote} |
| 1303 |
% |\documentclass{article}|\\ |
| 1304 |
% |\usepackage{graphicx,subcaption}|\\ |
| 1305 |
% |\begin{document}|\\ |
| 1306 |
% |\begin{figure}|\\ |
| 1307 |
% | \centering|\\ |
| 1308 |
% | \includegraphics[width=4cm]{example-image-c}|\\ |
| 1309 |
% | \caption{Caption no. 1}|\\ |
| 1310 |
% | \bigskip|\\ |
| 1311 |
% | \subcaptionbox|\\ |
| 1312 |
% | {\label{fig:2a}}|\\ |
| 1313 |
% | {\includegraphics[width=2cm]{example-image-a}}|\\ |
| 1314 |
% | \subcaptionbox|\\ |
| 1315 |
% | {\label{fig:2b}}|\\ |
| 1316 |
% | {\includegraphics[width=2cm]{example-image-b}}|\\ |
| 1317 |
% | \caption{Caption no. 2}|\\ |
| 1318 |
% |\end{figure}|\\ |
| 1319 |
% |Look at sub-figures \ref{fig:2a} and \ref{fig:2b}.|\\ |
| 1320 |
% |\end{document}| |
| 1321 |
% \end{quote} |
| 1322 |
% |
| 1323 |
% It's obvious that the sub-captions belong to 2nd caption, and therefore |
| 1324 |
% |\ref{fig:2a}| will become ``2a'', isn't it? |
| 1325 |
% But since the \pkg{subcaption} package is only involved when using |
| 1326 |
% \LaTeX\ commands either defined or patched by the \pkg{caption} or |
| 1327 |
% \pkg{subcaption} package, this is what the \pkg{caption} package |
| 1328 |
% is aware of: |
| 1329 |
% \begin{quote} |
| 1330 |
% |\usepackage{subcaption}|\\ |
| 1331 |
% |\begin{document}|\\ |
| 1332 |
% |\begin{figure}|\\ |
| 1333 |
% | \caption{Caption no. 1}|\\ |
| 1334 |
% | \subcaptionbox|\\ |
| 1335 |
% | {\label{fig:2a}}|\\ |
| 1336 |
% | {|\meta{unknown content}|}|\\ |
| 1337 |
% | \subcaptionbox|\\ |
| 1338 |
% | {\label{fig:2b}}|\\ |
| 1339 |
% | {|\meta{unknown content}|}|\\ |
| 1340 |
% | \caption{Caption no. 2}|\\ |
| 1341 |
% |\end{figure}|\\ |
| 1342 |
% |\end{document}| |
| 1343 |
% \end{quote} |
| 1344 |
% |
| 1345 |
% So from \pkg{caption}s point of view it's not easy to decide if the |
| 1346 |
% sub-captions belong to the 1st or 2nd main caption since they are placed |
| 1347 |
% between them. (Note: The \pkg{subcaption} package is only offering |
| 1348 |
% an user interface to the sub-caption feature of the \pkg{caption} package, |
| 1349 |
% and therefore this decision is the responsibility of the \pkg{caption} package.) |
| 1350 |
% |
| 1351 |
% But how does the \pkg{caption} package makes a decision? |
| 1352 |
% If in doubt, it rather clings to the past than to the future, i.e.~in this |
| 1353 |
% case it decides that the sub-captions belong to the 1st caption and therefore |
| 1354 |
% the result of |\ref{fig:2a}| is not ``2a'' but ``1a''. |
| 1355 |
% If the \pkg{caption} package is unsure about its decision (like in this |
| 1356 |
% case), a warning will be issued: |
| 1357 |
% \begingroup |
| 1358 |
% \leftmargini=12pt |
| 1359 |
% \begin{quote} |
| 1360 |
% |Package caption Warning: Ambiguous sub-caption(s),|\\ |
| 1361 |
% | use \nextfloat on input line 15.|\\ |
| 1362 |
% |See the caption package documentation for explanation.| |
| 1363 |
% \end{quote} |
| 1364 |
% \endgroup |
| 1365 |
% |
| 1366 |
% \pagebreak[3] |
| 1367 |
% How to fix it? Use |\next|\-|float| to tell the \pkg{caption} package |
| 1368 |
% where the 2nd figure within the |figure| environment starts: |
| 1369 |
% \begin{quote} |
| 1370 |
% |\documentclass{article}|\\ |
| 1371 |
% |\usepackage{graphicx,subcaption}|\\ |
| 1372 |
% |\begin{document}|\\ |
| 1373 |
% |\begin{figure}|\\ |
| 1374 |
% | \centering|\\ |
| 1375 |
% | \includegraphics[width=4cm]{example-image-c}|\\ |
| 1376 |
% | \caption{Caption no. 1}|\\ |
| 1377 |
% | \bigskip|\\ |
| 1378 |
% ||\textcolor{blue}{\cs{nextfloat}}\\ |
| 1379 |
% | \subcaptionbox|\\ |
| 1380 |
% | {\label{fig:2a}}|\\ |
| 1381 |
% | {\includegraphics[width=2cm]{example-image-a}}|\\ |
| 1382 |
% | \subcaptionbox|\\ |
| 1383 |
% | {\label{fig:2b}}|\\ |
| 1384 |
% | {\includegraphics[width=2cm]{example-image-b}}|\\ |
| 1385 |
% | \caption{Caption no. 2}|\\ |
| 1386 |
% |\end{figure}|\\ |
| 1387 |
% |Look at sub-figures \ref{fig:2a} and \ref{fig:2b}.|\\ |
| 1388 |
% |\end{document}| |
| 1389 |
% \end{quote} |
| 1390 |
% |
| 1391 |
% \INFO |
| 1392 |
% Note that the |\next|\-|float| command was introduced in \pkg{caption} package |
| 1393 |
% \version{3.6}. |
| 1394 |
% Previous versions of the \pkg{caption} package have bound the decision to the |
| 1395 |
% |position=| setting of the floating environment instead, i.e.~sub-captions belonged to |
| 1396 |
% the caption above if |position=top| was set and they belonged to the caption below |
| 1397 |
% if |position=below| was set. |
| 1398 |
% While this would be beneficial in this case, there were several cases were it was not |
| 1399 |
% and especially it was not always comprehensible to the user why his references got an |
| 1400 |
% incorrect numbering. |
| 1401 |
% |
| 1402 |
% Furthermore the new decision algorithm always succeeds if there is only one caption |
| 1403 |
% within the figure or table (which is the case most of the time) while the old one did not. |
| 1404 |
% |
| 1405 |
% \pagebreak[3] |
| 1406 |
% If you still prefer the old decision algorithm (for example because you want to process |
| 1407 |
% an already existing document), you need to specify the \pkg{caption} package version |
| 1408 |
% explicitly, for example: |
| 1409 |
% \begin{quote} |
| 1410 |
% |\documentclass{article}|\\ |
| 1411 |
% |\usepackage{caption}[=v3.5]|\\ |
| 1412 |
% |\usepackage{graphicx,subcaption}|\\ |
| 1413 |
% \ldots |
| 1414 |
% \end{quote} |
| 1415 |
% |
| 1416 |
% See also: \longref{sec:caption} |
| 1417 |
% |
| 1418 |
% \subsection{Pittfall \#2: Expecting \cs{caption} to increment the counter} |
| 1419 |
% |
| 1420 |
% \pagebreak[3] |
| 1421 |
% Usually |\caption| increments the figure or table counter and therefore |
| 1422 |
% it is usally safe to assume that the counter was not incremented yet in code |
| 1423 |
% used before |\caption|: |
| 1424 |
% \begin{quote} |
| 1425 |
% |\documentclass{article}|\\ |
| 1426 |
% |\begin{document}|\\ |
| 1427 |
% |\begin{figure}|\\ |
| 1428 |
% | Figure counter before caption: \thefigure|\\ |
| 1429 |
% | \caption{Some text}|\\ |
| 1430 |
% | Figure counter after caption: \thefigure|\\ |
| 1431 |
% |\end{figure}|\\ |
| 1432 |
% |\end{document}| |
| 1433 |
% \end{quote} |
| 1434 |
% |
| 1435 |
% Unsurprisingly the results are 0 and 1 for the counter values. |
| 1436 |
% |
| 1437 |
% \pagebreak[3] |
| 1438 |
% But this happens if we use the \pkg{subcaption} package: |
| 1439 |
% \begin{quote} |
| 1440 |
% |\documentclass{article}|\\ |
| 1441 |
% |\usepackage{subcaption}|\\ |
| 1442 |
% |\begin{document}|\\ |
| 1443 |
% |\begin{figure}|\\ |
| 1444 |
% | \subcaptionbox{}{some content}|\\ |
| 1445 |
% | \subcaptionbox{}{some content}|\\ |
| 1446 |
% | Figure counter before caption: \thefigure|\\ |
| 1447 |
% | \caption{Some text}|\\ |
| 1448 |
% | Figure counter after caption: \thefigure|\\ |
| 1449 |
% |\end{figure}|\\ |
| 1450 |
% |\end{document}| |
| 1451 |
% \end{quote} |
| 1452 |
% |
| 1453 |
% Here the results are 1 and 1 for the counter values. Why? |
| 1454 |
% |
| 1455 |
% Since the \pkg{caption} package assumes that there will be a |\caption| |
| 1456 |
% following |\sub|\-|caption|\-|box| it decides that the sub-captions belong |
| 1457 |
% to the upcoming main caption and therefore share the same main counter value |
| 1458 |
% which needs to be incremented before its use. |
| 1459 |
% Therefore the first |\sub|\-|caption|\-|box| in the figure increments the |
| 1460 |
% figure counter while the second one and especially the |\caption| does not. |
| 1461 |
% |
| 1462 |
% Usually this is no problem at all but keep this in mind if you are doing |
| 1463 |
% tricky stuff with the figure or table counter within figures or tables. |
| 1464 |
% |
| 1465 |
% \iffalse |
| 1466 |
% --------------------------------------------------------------------------- % |
| 1467 |
% \fi |
| 1468 |
% |
| 1469 |
% \PageBreak |
| 1470 |
% \section{Abbreviatory commands} |
| 1471 |
% \label{subcaption} |
| 1472 |
% |
| 1473 |
% \DescribeMacro\subcaption |
| 1474 |
% \DescribeMacro\phantomsubcaption |
| 1475 |
% \DescribeMacro\subcaptionlistentry |
| 1476 |
% \DescribeMacro\subcaptiontext |
| 1477 |
% \hskip1pt %^^A work-around for bug in \DescribeMacro to prevent red colored margin note |
| 1478 |
% As we have seen in sections {\longref{overpic}, \longref{stackengine}, and \longref{tikz}} |
| 1479 |
% it's sometimes inconvenient to use the commands and environments |
| 1480 |
% described so far. |
| 1481 |
% |
| 1482 |
% \pagebreak[3] |
| 1483 |
% For example it would be inconvenient to use \env{captiongroup} just for |
| 1484 |
% a single |\caption|\-|text| in this particular case: |
| 1485 |
% \begin{quote} |
| 1486 |
% \ldots\\ |
| 1487 |
% |\begin{overpic}[width=60pt]{cat}|\\ |
| 1488 |
% | \put(40,34)|\\ |
| 1489 |
% | {\begin{captiongroup*}|\\ |
| 1490 |
% | \captiontext*[1]{}|\\ |
| 1491 |
% | \end{captiongroup*}}|\\ |
| 1492 |
% |\end{overpic}|\\ |
| 1493 |
% \ldots |
| 1494 |
% \end{quote} |
| 1495 |
% |
| 1496 |
% \pagebreak[3] |
| 1497 |
% Since |\caption|\-|text| is already used in an extra environment (|overpic|) |
| 1498 |
% we don't need an extra |caption|\-|group*| here, |
| 1499 |
% instead using |\set|\-|caption|\-|sub|\-|type*| (which switches into the |
| 1500 |
% sub-caption mode without making an \pkg{hyperref} anchor) would be sufficient: |
| 1501 |
% \begin{quote} |
| 1502 |
% \ldots\\ |
| 1503 |
% |\begin{overpic}[width=60pt]{cat}|\\ |
| 1504 |
% | \put(40,34)|\\ |
| 1505 |
% | {\setcaptionsubtype*|\\ |
| 1506 |
% | \captiontext*[1]{}}|\\ |
| 1507 |
% |\end{overpic}|\\ |
| 1508 |
% \ldots |
| 1509 |
% \end{quote} |
| 1510 |
% |
| 1511 |
% \pagebreak[3] |
| 1512 |
% But this is still inconvenient when used many times, and therefore \thispackage\ defines |
| 1513 |
% several extra commands which are prefixed with |\set|\-|caption|\-|sub|\-|type*|: |
| 1514 |
% |
| 1515 |
% \medskip |
| 1516 |
% |
| 1517 |
% \begin{minipage}{\textwidth} |
| 1518 |
% \centering |
| 1519 |
% \begin{tabular}{l|l|l} |
| 1520 |
% Regular command & using \cs{setcaptionsubtype*} & available since \\ |
| 1521 |
% \hline |
| 1522 |
% |\caption| & |\subcaption| & \version{1.0} \\ |
| 1523 |
% |\phantomcaption| & |\phantomsubcaption| & \version{1.1} \\ |
| 1524 |
% |\captionlistentry| & |\subcaptionlistentry| & \version{1.5} \\ |
| 1525 |
% |\captiontext| & |\subcaptiontext| & \version{1.5} \\ |
| 1526 |
% \end{tabular} |
| 1527 |
% \end{minipage} |
| 1528 |
% |
| 1529 |
% \bigskip |
| 1530 |
% |
| 1531 |
% \pagebreak[3] |
| 1532 |
% This way our code snipped above could be simplified to: |
| 1533 |
% \begin{quote} |
| 1534 |
% \ldots\\ |
| 1535 |
% |\begin{overpic}[width=60pt]{cat}|\\ |
| 1536 |
% | \put(40,34){\subcaptiontext*[1]{}}|\\ |
| 1537 |
% |\end{overpic}|\\ |
| 1538 |
% \ldots |
| 1539 |
% \end{quote} |
| 1540 |
% |
| 1541 |
% \INFO |
| 1542 |
% Since |\set|\-|caption|\-|sub|\-|type| should only be used within an |
| 1543 |
% extra group or environment, the same applies to these commands as well. |
| 1544 |
% (In this case |\sub|\-|caption|\-|text| is encapsulated by the |
| 1545 |
% |overpic| environment, so we are ok here. |
| 1546 |
% |
| 1547 |
% \begin{background} |
| 1548 |
% The |\sub|\-|caption| command is just a simple combination of |
| 1549 |
% |\set|\-|caption|\-|sub|\-|type*| and |\caption|. Same for all other |
| 1550 |
% abbreviatory commands here. |
| 1551 |
% \end{background} |
| 1552 |
% |
| 1553 |
% \iffalse |
| 1554 |
% --------------------------------------------------------------------------- % |
| 1555 |
% \fi |
| 1556 |
% |
| 1557 |
% \PageBreak |
| 1558 |
% \section{The \cs{subfloat} command} |
| 1559 |
% \label{subfloat} |
| 1560 |
% |
| 1561 |
% \DescribeMacro\subfloat |
| 1562 |
% \NEWfeature*{v1.3} |
| 1563 |
% To allow a smoother transition from the \pkg{subfig} package~\cite{subfig} |
| 1564 |
% (which is unmaintained for over 16 years) |
| 1565 |
% this package also offers |\sub|\-|float| with the same syntax: |
| 1566 |
% \begin{quote} |
| 1567 |
% |\subfloat|\oarg{list\_entry}\oarg{sub-caption}\marg{body} |
| 1568 |
% \end{quote} |
| 1569 |
% |
| 1570 |
% \iffalse |
| 1571 |
% --------------------------------------------------------------------------- % |
| 1572 |
% \fi |
| 1573 |
% |
| 1574 |
% \section{Required packages} |
| 1575 |
% \label{sec:caption} |
| 1576 |
% |
| 1577 |
% \NEWfeature{v1.4} |
| 1578 |
% Starting with version $1.4$ the \pkg{subcaption} package requires at least version $3.1$ |
| 1579 |
% of the \pkg{caption} package and loads it automatically. |
| 1580 |
% (Older versions of the \pkg{subcaption} package have required exactly the version of the |
| 1581 |
% \pkg{caption} package which was released with it.) |
| 1582 |
% |
| 1583 |
% \pagebreak[3] |
| 1584 |
% If you need to use a specific version of the \pkg{caption} package you need to load it |
| 1585 |
% \emph{before} the \pkg{subcaption} package, e.g.: |
| 1586 |
% \begin{quote} |
| 1587 |
% |\usepackage[| \ldots |]{caption}[=v3.5]|\\ |
| 1588 |
% |\usepackage[| \ldots |]{subcaption}| |
| 1589 |
% \end{quote} |
| 1590 |
% |
| 1591 |
% \pagebreak[3] |
| 1592 |
% Note that there are limitations if an older version of the \pkg{caption} package |
| 1593 |
% is used: |
| 1594 |
% \begin{itemize} |
| 1595 |
% \item The |\phantomsubcaption| command needs at least \pkg{caption} \version{3.2}. |
| 1596 |
% \item The |\subcaptionlistentry| command needs at least \pkg{caption} \version{3.3}. |
| 1597 |
% \item The |\subfloat| emulation needs at least \pkg{caption} \version{3.4}. |
| 1598 |
% \item The |\subcaptiontext| command needs at least \pkg{caption} \version{3.6}. |
| 1599 |
% \item The |\subcaptionsetup| command needs at least \pkg{caption} \version{3.6l}. |
| 1600 |
% \end{itemize} |
| 1601 |
% |
| 1602 |
% \iffalse |
| 1603 |
% --------------------------------------------------------------------------- % |
| 1604 |
% \fi |
| 1605 |
% |
| 1606 |
% \section{Other packages with similar offerings} |
| 1607 |
% \label{sec:otherpackages} |
| 1608 |
% |
| 1609 |
% The \pkg{subcaption} package is not the only one defining sub-figure counters and offering commands or environments to typeset sub-figures. |
| 1610 |
% The most established are: |
| 1611 |
% \begin{itemize} |
| 1612 |
% \item The \cls{memoir} document class |
| 1613 |
% \item The \pkg{subfigure} package and its successor, the \pkg{subfig} package |
| 1614 |
% \end{itemize} |
| 1615 |
% |
| 1616 |
% \NEWfeature{v1.6} |
| 1617 |
% Prior subcaption version $1.6$ an error message was issued if the `subfigure' or `subtable' counter was already defined by any of them. |
| 1618 |
% Since subcaption version $1.6$ the `subfigure' and `subtable' counters will only be defined by the \pkg{subcaption} package if they are not defined yet, |
| 1619 |
% but the usage of any of the commands or environments described in this document will result in an error message ``The counter sub\ldots was defined by \ldots'' |
| 1620 |
% if the corresponding counter was not defined by the \pkg{subcaption} package. |
| 1621 |
% Equally the commands or environments offered by the above document classes or packages should not be used with counters defined by the \pkg{subcaption} package, |
| 1622 |
% this will result in either \LaTeX\ errors or unwanted behaviour. |
| 1623 |
% |
| 1624 |
% So the rule of thumb is: |
| 1625 |
% If the counter `subfigure' or `subtable' is defined by document class or package \textit{xyz}, |
| 1626 |
% then the corresponding commands and environments offered by the document class or package \textit{xyz} should be used. |
| 1627 |
% |
| 1628 |
% \pagebreak[3] |
| 1629 |
% An example document: |
| 1630 |
% \begingroup\small\leftmargini=12pt\relax |
| 1631 |
% \begin{quote} |
| 1632 |
% |\documentclass{memoir}|\\ |
| 1633 |
% |\newsubfloat{table} % defines the `subtable' counter|\\ |
| 1634 |
% |\usepackage{subcaption} % defines the `subfigure' counter|\\ |
| 1635 |
% |\begin{document}|\\ |
| 1636 |
% |\begin{figure}|\\ |
| 1637 |
% |\subcaptionbox{...}{...} % <- This is fine|\\ |
| 1638 |
% |\caption{...}|\\ |
| 1639 |
% |\end{figure}|\\ |
| 1640 |
% |\begin{table}|\\ |
| 1641 |
% |\caption{...}|\\ |
| 1642 |
% |\subcaptionbox{...}{...} % <- This results in an error,|\\ |
| 1643 |
% |\end{table} \subtop should be used instead|\\ |
| 1644 |
% |\end{document}|\\ |
| 1645 |
% \end{quote} |
| 1646 |
% \endgroup |
| 1647 |
% |
| 1648 |
% \iffalse |
| 1649 |
% --------------------------------------------------------------------------- % |
| 1650 |
% \fi |
| 1651 |
% |
| 1652 |
% \PageBreak |
| 1653 |
% \section{Beyond this package} |
| 1654 |
% \label{keyfloat}\label{floatrow} |
| 1655 |
% |
| 1656 |
% For a more advanced usage of the sub-caption feature of the |
| 1657 |
% \pkg{caption} package, please take a look at the excellent |
| 1658 |
% \pkg{keyfloat} package\cite{keyfloat} which provides the environments |
| 1659 |
% |key|\-|sub|\-|figs|, |key|\-|sub|\-|tabs|, and |key|\-|sub|\-|floats| for |
| 1660 |
% typesetting sub-figures and sub-tables. |
| 1661 |
% |
| 1662 |
% Furthermore the \pkg{floatrow} package\cite{floatrow} provides the |
| 1663 |
% |sub|\-|float|\-|row| environment for typesetting sub-figures. |
| 1664 |
% |
| 1665 |
% \iffalse |
| 1666 |
% --------------------------------------------------------------------------- % |
| 1667 |
% \fi |
| 1668 |
% |
| 1669 |
% \PageBreak |
| 1670 |
% \section{Thanks} |
| 1671 |
% |
| 1672 |
% I would like to thank |
| 1673 |
% Stephen Dalton |
| 1674 |
% who helped to make this package a better one. |
| 1675 |
% |
| 1676 |
% \iffalse |
| 1677 |
% --------------------------------------------------------------------------- % |
| 1678 |
% \fi |
| 1679 |
% |
| 1680 |
% \StopEventually{%^^A |
| 1681 |
% \begin{thebibliography}{9} |
| 1682 |
% |
| 1683 |
% \bibitem{TLC2} |
| 1684 |
% Frank Mittelbach and Michel Goossens:\\ |
| 1685 |
% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\ |
| 1686 |
% \newblock Addison-Wesley, 2004. |
| 1687 |
% |
| 1688 |
% \bibitem{caption} |
| 1689 |
% Axel Sommerfeldt:\\ |
| 1690 |
% \href{http://www.ctan.org/pkg/caption}% |
| 1691 |
% {\emph{Customizing captions of floating environments}},\\ |
| 1692 |
% 2022/01/07 |
| 1693 |
% |
| 1694 |
% \bibitem{floatrow} |
| 1695 |
% Olga Lapko:\\ |
| 1696 |
% \href{http://www.ctan.org/pkg/floatrow}% |
| 1697 |
% {\emph{The floatrow package documentation}},\\ |
| 1698 |
% 2007/12/24 |
| 1699 |
% |
| 1700 |
% \bibitem{hyperref} |
| 1701 |
% Sebastian Rahtz \& Heiko Oberdiek:\\ |
| 1702 |
% \href{http://www.ctan.org/pkg/hyperref}% |
| 1703 |
% {\emph{Hypertext marks in \LaTeX}},\\ |
| 1704 |
% November 12, 2007 |
| 1705 |
% |
| 1706 |
% \bibitem{hypcap} |
| 1707 |
% Heiko Oberdiek:\\ |
| 1708 |
% \href{http://www.ctan.org/pkg/hypcap}% |
| 1709 |
% {\emph{The hypcap package -- Adjusting anchors of captions}},\\ |
| 1710 |
% 2007/04/09 |
| 1711 |
% |
| 1712 |
% \bibitem{keyfloat} |
| 1713 |
% Brian Duun:\\ |
| 1714 |
% \href{http://www.ctan.org/pkg/keyfloat}% |
| 1715 |
% {\emph{The \LaTeX\ keyfloat Package}},\\ |
| 1716 |
% 2019/09/23 |
| 1717 |
% |
| 1718 |
% \bibitem{overpic} |
| 1719 |
% Rolf Niepraschk:\\ |
| 1720 |
% \href{http://www.ctan.org/pkg/overpic}% |
| 1721 |
% {\emph{The overpic package}},\\ |
| 1722 |
% 2020/02/22 |
| 1723 |
% |
| 1724 |
% \bibitem{stackengine} |
| 1725 |
% Steven B. Segletes:\\ |
| 1726 |
% \href{http://www.ctan.org/pkg/stackengine}% |
| 1727 |
% {\emph{The stackengine Package}},\\ |
| 1728 |
% July 22, 2021 |
| 1729 |
% |
| 1730 |
% \bibitem{tikz} |
| 1731 |
% Till Tantau:\\ |
| 1732 |
% \href{http://www.ctan.org/pkg/tikz}% |
| 1733 |
% {\emph{The TikZ and PGF Packages}},\\ |
| 1734 |
% May 15, 2021 |
| 1735 |
% |
| 1736 |
% \bibitem{subfig} |
| 1737 |
% Steven D. Cochran:\\ |
| 1738 |
% \href{http://www.ctan.org/pkg/subfig}% |
| 1739 |
% {\emph{The subfig package}},\\ |
| 1740 |
% 2005/07/05 |
| 1741 |
% |
| 1742 |
% \end{thebibliography} |
| 1743 |
% } |
| 1744 |
% |
| 1745 |
% \iffalse |
| 1746 |
% --------------------------------------------------------------------------- % |
| 1747 |
% \fi |
| 1748 |
% |
| 1749 |
% \DoNotIndex{\\,\_,\ ,\@@par} |
| 1750 |
% \DoNotIndex{\@bsphack} |
| 1751 |
% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname} |
| 1752 |
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs} |
| 1753 |
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo} |
| 1754 |
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom} |
| 1755 |
% \DoNotIndex{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded} |
| 1756 |
% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse} |
| 1757 |
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist} |
| 1758 |
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar} |
| 1759 |
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc} |
| 1760 |
% \DoNotIndex{\@testopt} |
| 1761 |
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} |
| 1762 |
% \DoNotIndex{\p@,\z@} |
| 1763 |
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup} |
| 1764 |
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box} |
| 1765 |
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow} |
| 1766 |
% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter} |
| 1767 |
% \DoNotIndex{\fi,\footnotesize,\global} |
| 1768 |
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss} |
| 1769 |
% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode} |
| 1770 |
% \DoNotIndex{\ifx,\ignorespaces,\itshape} |
| 1771 |
% \DoNotIndex{\kernel@ifnextchar} |
| 1772 |
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth} |
| 1773 |
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message} |
| 1774 |
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox} |
| 1775 |
% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline} |
| 1776 |
% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip} |
| 1777 |
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write} |
| 1778 |
% \DoNotIndex{\providecommand,\quad} |
| 1779 |
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage} |
| 1780 |
% \DoNotIndex{\rightskip,\rmfamily} |
| 1781 |
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape} |
| 1782 |
% \DoNotIndex{\small,\string,\space,\strut} |
| 1783 |
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily} |
| 1784 |
% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage} |
| 1785 |
% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip} |
| 1786 |
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption} |
| 1787 |
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists} |
| 1788 |
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak} |
| 1789 |
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine} |
| 1790 |
% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage} |
| 1791 |
% |
| 1792 |
% \iffalse |
| 1793 |
% --------------------------------------------------------------------------- % |
| 1794 |
% \fi |
| 1795 |
% |
| 1796 |
% \setlength{\parskip}{0pt plus 1pt} |
| 1797 |
% \changes{v0.1}{2007/09/01}{First demo} |
| 1798 |
% \changes{v0.2}{2007/11/11}{\cs{subcaptionbox} added} |
| 1799 |
% \changes{v0.3}{2007/12/06}{Adapted to \pkg{caption} package \version{3.1f}} |
| 1800 |
% \changes{v1.0}{2008/03/16}{\cs{subfloat} added} |
| 1801 |
% \changes{v1.0}{2010/10/27}{An error message will be issued when the subfigure or subfig package is loaded} |
| 1802 |
% \changes{v1.0}{2011/01/22}{Undocumented command \cs{subfloat} removed} |
| 1803 |
% |
| 1804 |
% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}} |
| 1805 |
% |
| 1806 |
% \iffalse |
| 1807 |
% --------------------------------------------------------------------------- % |
| 1808 |
% \fi |
| 1809 |
% |
| 1810 |
% \clearpage |
| 1811 |
% \section{The implementation} |
| 1812 |
% |
| 1813 |
% \iffalse |
| 1814 |
%<*package> |
| 1815 |
% \fi |
| 1816 |
% |
| 1817 |
% \subsection{Identification} |
| 1818 |
% |
| 1819 |
% We need at least \LaTeX2e\ version 1994/12/01. |
| 1820 |
% \begin{macrocode} |
| 1821 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 1822 |
% \end{macrocode} |
| 1823 |
% |
| 1824 |
% Bypass the release declarations in case the \LaTeX\ kernel doesn’t know how to deal with them |
| 1825 |
% (as suggested by \url{https://www.latex-project.org/publications/2018-FMi-TUB-tb122mitt-version-rollback.pdf}). |
| 1826 |
% \begin{macrocode} |
| 1827 |
\providecommand\DeclareRelease[3]{} |
| 1828 |
\providecommand\DeclareCurrentRelease[2]{} |
| 1829 |
% \end{macrocode} |
| 1830 |
% |
| 1831 |
% Declare all supported releases. |
| 1832 |
% \begin{macrocode} |
| 1833 |
\DeclareCurrentRelease{v1}{2007/12/06} |
| 1834 |
% \end{macrocode} |
| 1835 |
% |
| 1836 |
% Identify the current version of the package. |
| 1837 |
% \begin{macrocode} |
| 1838 |
\ProvidesPackage{subcaption}[2023/07/28 v1.6b Sub-captions (AR)] |
| 1839 |
% \end{macrocode} |
| 1840 |
% |
| 1841 |
% Since we base on the \pkg{caption} package we load it here. |
| 1842 |
% \begin{macrocode} |
| 1843 |
\RequirePackage{caption}[2010/01/09] % we need at least v3.1m |
| 1844 |
% \end{macrocode} |
| 1845 |
% |
| 1846 |
% \subsection{Initial code} |
| 1847 |
% |
| 1848 |
% \begin{macro}{\subcaption@Info} |
| 1849 |
% \changes{v1.6}{2022/04/07}{This macro added} |
| 1850 |
% |\subcaption@Info|\marg{message}\\ |
| 1851 |
% issues an info message (with code line indication). |
| 1852 |
% \begin{macrocode} |
| 1853 |
\newcommand*\subcaption@Info{% |
| 1854 |
\PackageInfo{subcaption}} |
| 1855 |
% \end{macrocode} |
| 1856 |
% \end{macro} |
| 1857 |
% |
| 1858 |
% \begin{macro}{\subcaption@Warning} |
| 1859 |
% \changes{v1.5}{2022/01/06}{This macro added} |
| 1860 |
% |\subcaption@Warning|\marg{message}\\ |
| 1861 |
% issues an warning message (with code line indication). |
| 1862 |
% \begin{macrocode} |
| 1863 |
\newcommand*\subcaption@Warning{% |
| 1864 |
\PackageWarning{subcaption}} |
| 1865 |
% \end{macrocode} |
| 1866 |
% \end{macro} |
| 1867 |
% |
| 1868 |
% \begin{macro}{\subcaption@Error} |
| 1869 |
% \changes{v1.3h}{2020/09/28}{This macro added} |
| 1870 |
% |\subcaption@Error|\marg{message}\\ |
| 1871 |
% issues an error message (with code line indication). |
| 1872 |
% \begin{macrocode} |
| 1873 |
\newcommand*\subcaption@Error[1]{% |
| 1874 |
\PackageError{subcaption}{#1}{\caption@@eh{subcaption}}} |
| 1875 |
% \end{macrocode} |
| 1876 |
% \begin{macrocode} |
| 1877 |
\providecommand*\caption@@eh[1]{% |
| 1878 |
If you do not understand this error, please take a closer look\MessageBreak |
| 1879 |
at the documentation of the `#1' package, especially the\MessageBreak |
| 1880 |
section about errors.\MessageBreak\@ehc} |
| 1881 |
% \end{macrocode} |
| 1882 |
% \end{macro} |
| 1883 |
% |
| 1884 |
% \begin{macro}{\subcaption@OutsideFloat} |
| 1885 |
% \changes{v1.5}{2022/01/07}{This macro definition added} |
| 1886 |
% |\subcaption@OutsideFloat}| issues a ``\meta{command} outside float'' error. |
| 1887 |
% \begin{macrocode} |
| 1888 |
\newcommand*\subcaption@OutsideFloat[1]{% |
| 1889 |
\subcaption@Error{\string#1 outside float}} |
| 1890 |
% \end{macrocode} |
| 1891 |
% \end{macro} |
| 1892 |
% |
| 1893 |
% \subsection{Main code} |
| 1894 |
% |
| 1895 |
% \begin{macro}{\setcaptionsubtype} |
| 1896 |
% \changes{v1.4}{2020/12/24}{This macro definition added} |
| 1897 |
% \changes{v1.5}{2022/01/07}{Check added if used inside a floating environment} |
| 1898 |
% |\setcaptionsubtype| is available since \pkg{caption} package \version{3.2}, |
| 1899 |
% so we need to define it first if only an older version is loaded (in fallback mode). |
| 1900 |
% \begin{macrocode} |
| 1901 |
\providecommand\setcaptionsubtype{% |
| 1902 |
\caption@iftype |
| 1903 |
{\@ifstar{\captionsetup{subtype*}}{\captionsetup{subtype}}}% |
| 1904 |
{\subcaption@OutsideFloat\setcaptionsubtype}} |
| 1905 |
% \end{macrocode} |
| 1906 |
% \end{macro} |
| 1907 |
% |
| 1908 |
% \subsubsection{The \env{subcaptiongroup} environment} |
| 1909 |
% |
| 1910 |
% \begin{environment}{subcaptiongroup} |
| 1911 |
% \changes{v1.5}{2022/01/07}{This environment definition added} |
| 1912 |
% \env{subcaptiongroup} is the simplest of all environments or commands this package has to offer. |
| 1913 |
% It's simply an environment containing |\set|\-|caption|\-|sub|\-|type|, that's all. |
| 1914 |
% A starred variant of this environment is available, too, which uses |\set|\-|caption|\-|sub|\-|type*|. |
| 1915 |
% \begin{macrocode} |
| 1916 |
\newenvironment{subcaptiongroup} |
| 1917 |
{\caption@iftype |
| 1918 |
{\setcaptionsubtype\relax}% |
| 1919 |
{\subcaption@OutsideFloat{subcaptiongroup}}} |
| 1920 |
{} |
| 1921 |
% \end{macrocode} |
| 1922 |
% \begin{macrocode} |
| 1923 |
\newenvironment{subcaptiongroup*} |
| 1924 |
{\caption@iftype |
| 1925 |
{\setcaptionsubtype*}% |
| 1926 |
{\subcaption@OutsideFloat{subcaptiongroup*}}} |
| 1927 |
{} |
| 1928 |
% \end{macrocode} |
| 1929 |
% \end{environment} |
| 1930 |
% |
| 1931 |
% \subsubsection{The \env{subcaptionblock} environment (and aliases)} |
| 1932 |
% |
| 1933 |
% \begin{macro}{\subcaption@minipage} |
| 1934 |
% \changes{v1.2}{2016/02/21}{Optional argument values `B' and `T' added} |
| 1935 |
% \changes{v1.3d}{2020/01/22}{Definition and usage of \cs{@subfloatboxreset} added} |
| 1936 |
% \changes{v1.5}{2022/01/07}{This macro definition out-sourced from \cs{subcaption@newminipage}} |
| 1937 |
% \changes{v1.5}{2022/01/07}{Usage of \cs{@ifnextchar} replaced by \cs{@testopt}} |
| 1938 |
% \changes{v1.5}{2022/01/07}{Default value of \meta{outer-pos} changed from `c' to `b'} |
| 1939 |
% \changes{v1.5a}{2022/04/16}{Default value of \meta{outer-pos} changed from `b' to either `b' or `t'} |
| 1940 |
% This is a \env{minipage} with |\set|\-|caption|\-|sub|\-|type| as first contents line. |
| 1941 |
% \begin{macrocode} |
| 1942 |
\newcommand*\subcaption@minipage{% |
| 1943 |
\kernel@ifnextchar[%] |
| 1944 |
\subcaption@iminipage |
| 1945 |
{\caption@ifcaption{\subcaption@iminipage[t]}{\subcaption@iminipage[b]}}} |
| 1946 |
% \end{macrocode} |
| 1947 |
% We pass all other optional arguments using the generic helper macro |
| 1948 |
% |\caption@with|\-|opt|\-|args| offered by the \pkg{caption} kernel). |
| 1949 |
% \begin{macrocode} |
| 1950 |
\def\subcaption@iminipage[#1]{% |
| 1951 |
% \caption@withoptargs{\subcaption@iiminipage{#1}}} % would need at least caption3 v1.5 |
| 1952 |
\def\subcaption@tempa{\subcaption@iiminipage{#1}}% |
| 1953 |
\caption@withoptargs\subcaption@tempa} |
| 1954 |
% \end{macrocode} |
| 1955 |
% `B' and `T' will add a |\vspace{0pt}|, all other values (and additional |
| 1956 |
% optional arguments) will be passed unseen to the |minipage| environment. |
| 1957 |
% \begin{macrocode} |
| 1958 |
\newcommand*\subcaption@iiminipage[3]{% |
| 1959 |
\let\subcaption@endminipage@hook\@empty |
| 1960 |
\if#1B% |
| 1961 |
\minipage[b]#2{#3}% |
| 1962 |
\def\subcaption@endminipage@hook{\vspace{0pt}}% |
| 1963 |
\else\if#1T% |
| 1964 |
\minipage[t]#2{#3}% |
| 1965 |
\vspace{0pt}% |
| 1966 |
\else |
| 1967 |
\minipage[#1]#2{#3}% |
| 1968 |
\fi\fi |
| 1969 |
\@subfloatboxreset |
| 1970 |
\setcaptionsubtype\relax} |
| 1971 |
% \end{macrocode} |
| 1972 |
% \begin{macrocode} |
| 1973 |
\newcommand*\subcaption@endminipage{% |
| 1974 |
\subcaption@endminipage@hook |
| 1975 |
\endminipage} |
| 1976 |
% \end{macrocode} |
| 1977 |
% \begin{macrocode} |
| 1978 |
\providecommand*\@subfloatboxreset{} |
| 1979 |
% \end{macrocode} |
| 1980 |
% \begin{macrocode} |
| 1981 |
\providecommand*\caption@ifcaption{\caption@ifflag2} % caption >= v3.3 < v3.6 |
| 1982 |
\providecommand*\caption@ifflag[1]{\@secondoftwo} % caption < v3.3 |
| 1983 |
% \end{macrocode} |
| 1984 |
% \end{macro} |
| 1985 |
% |
| 1986 |
% \begin{environment}{subcaptionblock} |
| 1987 |
% \changes{v1.5}{2022/01/07}{This environment definition added} |
| 1988 |
% \env{subcaptionblock} is a \env{minipage} with |\set|\-|caption|\-|sub|\-|type| as first contents line. |
| 1989 |
% \begin{macrocode} |
| 1990 |
\newenvironment{subcaptionblock}{\subcaption@minipage}{\subcaption@endminipage} |
| 1991 |
% \end{macrocode} |
| 1992 |
% \end{environment} |
| 1993 |
% |
| 1994 |
% \begin{macro}{\subcaption@newminipage} |
| 1995 |
% \changes{v1.4d}{2022/01/04}{Test of environment name added, should match `sub\cs{@captype}'} |
| 1996 |
% \changes{v1.5}{2022/01/06}{Test of environment name revised, results in a warning now instead of an error} |
| 1997 |
% \changes{v1.5}{2022/01/07}{This command renamed from \cs{subcaption@newenvironment} to \cs{subcaption@newminipage} and revised} |
| 1998 |
% |\subcaption@newminipage|\marg{name of new environment}\\ |
| 1999 |
% defines a new environment containing |\sub|\-|caption@mini|\-|page| and |\sub|\-|caption@end|\-|mini|\-|page|. |
| 2000 |
% Furthermore a test will be included which checks if the environment name matches |sub\@captype|. |
| 2001 |
% \begin{macrocode} |
| 2002 |
\newcommand*\subcaption@newminipage[1]{% |
| 2003 |
\newenvironment{#1}{\subcaption@minipage@{#1}}{\subcaption@endminipage}} |
| 2004 |
% \end{macrocode} |
| 2005 |
% \begin{macrocode} |
| 2006 |
\newcommand*\subcaption@minipage@[1]{% |
| 2007 |
\caption@iftype |
| 2008 |
{\edef\caption@tempa{#1}% |
| 2009 |
\edef\caption@tempb{sub\@captype}% |
| 2010 |
\ifx\caption@tempa\caption@tempb \else |
| 2011 |
\subcaption@Warning{% |
| 2012 |
`\caption@tempa' is treated as `\caption@tempb'\MessageBreak}% |
| 2013 |
\fi}% |
| 2014 |
{\subcaption@OutsideFloat{#1}}% |
| 2015 |
\subcaption@minipage} |
| 2016 |
% \end{macrocode} |
| 2017 |
% \end{macro} |
| 2018 |
% |
| 2019 |
% \begin{environment}{subfigure} |
| 2020 |
% \begin{environment}{subtable} |
| 2021 |
% \changes{v1.3e}{2020/07/29}{Uses \cs{ForEachCaptionSubType} (instead of \cs{caption@For}) to define the environments now} |
| 2022 |
% The sub-environments will be defined using the helper macro |\For|\-|Each|\-|Caption|\-|Sub|\-|Type| |
| 2023 |
% offered by the \pkg{caption} kernel v1.13 (2020/07/29), so for every caption sub-type |
| 2024 |
% declared with |\Declare|\-|Caption|\-|Sub|\-|Type| a corresponding `sub' environment will be defined automatically. |
| 2025 |
% (If the \pkg{caption} kernel v1.13 is not available we use \cs{caption@For} as fallback.) |
| 2026 |
% \begin{macrocode} |
| 2027 |
\@ifundefined{ForEachCaptionSubType} % caption3 v1.13 |
| 2028 |
{\caption@For{subtypelist}{\subcaption@newminipage{sub#1}}} |
| 2029 |
{\ForEachCaptionSubType{\subcaption@newminipage{#1}}} |
| 2030 |
% \end{macrocode} |
| 2031 |
% \end{environment} |
| 2032 |
% \end{environment} |
| 2033 |
% |
| 2034 |
% \subsubsection{The \cs{subcaptionbox} command} |
| 2035 |
% |
| 2036 |
% \begin{macro}{\subcaptionbox} |
| 2037 |
% \changes{v1.0}{2008/05/06}{Adapted to the \opt{rule} option of the \pkg{caption} package} |
| 2038 |
% \changes{v1.0}{2008/08/31}{Definition and usage of \cs{subcaption@hrule} added} |
| 2039 |
% \changes{v1.0}{2010/12/17}{Uses \cs{caption@box} now} |
| 2040 |
% \changes{v1.1}{2011/08/16}{Adapted to actual version of \cs{caption@box}} |
| 2041 |
% \changes{v1.1}{2012/04/09}{Adapted to actual version of \cs{caption@ibox}} |
| 2042 |
% \changes{v1.4}{2020/12/24}{Fallback definition of \cs{caption@ibox} added} |
| 2043 |
% A |\parbox| with contents and sub-caption, separated by an invisible |\hrule|.\par |
| 2044 |
% The code of this macro was moved to the \pkg{caption} package \version{3.2} |
| 2045 |
% (so it could offer it as |\caption|\-|box| as well), so since then it's |
| 2046 |
% sufficient to simply use |\caption@ibox| here.\par |
| 2047 |
% But if only \pkg{caption} package \version{3.1} is available (since the user |
| 2048 |
% decided to use this particular fallback version), we still must define the code |
| 2049 |
% on our own. |
| 2050 |
% \begin{macrocode} |
| 2051 |
\@ifundefined{caption@ibox}{% |
| 2052 |
% \end{macrocode} |
| 2053 |
% \begin{macrocode} |
| 2054 |
\newcommand*\subcaptionbox{% caption v3.1 |
| 2055 |
\def\subcaption@tempa{\caption@ibox\setcaptionsubtype\relax}% |
| 2056 |
\caption@withoptargs\subcaption@tempa} |
| 2057 |
% \end{macrocode} |
| 2058 |
% \begin{macrocode} |
| 2059 |
\newcommand\caption@ibox[3]{% |
| 2060 |
\kernel@ifnextchar[%] |
| 2061 |
{\caption@iibox{#1}{#2}{#3}}% |
| 2062 |
{\caption@iibox@{#1}{#2}{#3}}} |
| 2063 |
% \end{macrocode} |
| 2064 |
% \begin{macrocode} |
| 2065 |
\long\def\caption@iibox#1#2#3[#4]{% |
| 2066 |
\@testopt{\caption@iiibox{#1}{#2}{#3}[{#4}]}\captionbox@innerpos@default} |
| 2067 |
% \end{macrocode} |
| 2068 |
% \begin{macrocode} |
| 2069 |
\long\def\caption@iibox@#1#2#3#4{% |
| 2070 |
\setbox\@tempboxa\hbox{#4}% |
| 2071 |
\caption@iiibox{#1}{#2}{#3}% |
| 2072 |
[\wd\@tempboxa]% |
| 2073 |
[\captionbox@innerpos@default]% |
| 2074 |
{\unhbox\@tempboxa}} |
| 2075 |
% \end{macrocode} |
| 2076 |
% \begin{macrocode} |
| 2077 |
\long\def\caption@iiibox#1{% |
| 2078 |
\caption@iiiibox{#1}\vbox\vtop} |
| 2079 |
% \end{macrocode} |
| 2080 |
% \begin{macrocode} |
| 2081 |
\long\def\caption@iiiibox#1#2#3#4#5[#6][#7]#8{% |
| 2082 |
\@ifundefined{caption@hj@#7}% |
| 2083 |
{\subcaption@Error{Undefined justification `#7'}\@gobble}% |
| 2084 |
{\@firstofone}% |
| 2085 |
{\begingroup |
| 2086 |
#1*% set \caption@position so \caption@iftop expands correctly |
| 2087 |
\caption@iftop{% |
| 2088 |
\endgroup |
| 2089 |
\parbox[t]{#6}{% |
| 2090 |
#1\relax |
| 2091 |
\caption@setposition t% |
| 2092 |
#2{\caption#4{#5}}% |
| 2093 |
\captionbox@hrule |
| 2094 |
\csname caption@hj@#7\endcsname |
| 2095 |
#8}% |
| 2096 |
}{% |
| 2097 |
\endgroup |
| 2098 |
\parbox[b]{#6}{% |
| 2099 |
#1\relax |
| 2100 |
\caption@setposition b% |
| 2101 |
\csname caption@hj@#7\endcsname |
| 2102 |
#8% |
| 2103 |
\captionbox@hrule |
| 2104 |
#3{\caption#4{#5}}}% |
| 2105 |
}}} |
| 2106 |
% \end{macrocode} |
| 2107 |
% \begin{macrocode} |
| 2108 |
\newcommand*\captionbox@innerpos@default{c} |
| 2109 |
\newcommand*\captionbox@hrule{\hrule\@height\z@\relax} |
| 2110 |
% \end{macrocode} |
| 2111 |
% \begin{macrocode} |
| 2112 |
\providecommand*\caption@hj@c{\centering} |
| 2113 |
\providecommand*\caption@hj@l{\raggedright} |
| 2114 |
\providecommand*\caption@hj@r{\raggedleft} |
| 2115 |
\providecommand*\caption@hj@s{} |
| 2116 |
% \end{macrocode} |
| 2117 |
% \begin{macrocode} |
| 2118 |
}{\@ifundefined{caption@iiibox}{% |
| 2119 |
% \end{macrocode} |
| 2120 |
% \begin{macrocode} |
| 2121 |
\newcommand*\subcaptionbox{% caption v3.2 |
| 2122 |
\def\captionbox@type{subtype}% |
| 2123 |
\let\captionbox@settype\setcaptionsubtype |
| 2124 |
\caption@withoptargs\caption@box} |
| 2125 |
% \end{macrocode} |
| 2126 |
% \begin{macrocode} |
| 2127 |
}{% |
| 2128 |
% \end{macrocode} |
| 2129 |
% \begin{macrocode} |
| 2130 |
\newcommand*\subcaptionbox{% caption >= v3.3 |
| 2131 |
\caption@withoptargs{\caption@ibox\setcaptionsubtype}} |
| 2132 |
% \end{macrocode} |
| 2133 |
% \begin{macrocode} |
| 2134 |
}} |
| 2135 |
% \end{macrocode} |
| 2136 |
% \end{macro} |
| 2137 |
% |
| 2138 |
% \subsubsection{The \cs{subref} command} |
| 2139 |
% |
| 2140 |
% We redefine |\label| to |\subcaption@label| at |\setcaptionsubtype|. |
| 2141 |
% \begin{macrocode} |
| 2142 |
\g@addto@macro\caption@subtypehook{% |
| 2143 |
\ifx\label\subcaption@label \else |
| 2144 |
\let\subcaption@ORI@label\label |
| 2145 |
\let\label\subcaption@label |
| 2146 |
\fi} |
| 2147 |
% \end{macrocode} |
| 2148 |
% |
| 2149 |
% \begin{macro}{\subcaption@label} |
| 2150 |
% \changes{v1.1}{2011/09/12}{Adapted to the \pkg{showkeys} package} |
| 2151 |
% \changes{v1.1}{2011/09/12}{Uses \cs{caption@withoptargs} now} |
| 2152 |
% \changes{v1.1}{2016/02/20}{Unwanted space removed} |
| 2153 |
% \changes{v1.4b}{2021/01/08}{Local re-definitions of \cs{@bsphack} and \cs{@esphack} added} |
| 2154 |
% \changes{v1.4c}{2021/04/10}{Adaption to the \pkg{showkeys} package out-sourced to \cs{subcaption@prepare@label}} |
| 2155 |
% When a label will be placed for a sub-caption, we automatically place |
| 2156 |
% a second one for |\sub|\-|ref|, too. This second label will contain |
| 2157 |
% the sub-type counter only. |
| 2158 |
% \begin{macrocode} |
| 2159 |
\newcommand*\subcaption@label{% |
| 2160 |
\caption@withoptargs\subcaption@@label} |
| 2161 |
% \end{macrocode} |
| 2162 |
% \begin{macrocode} |
| 2163 |
\newcommand*\subcaption@@label[2]{% |
| 2164 |
\@bsphack\begingroup |
| 2165 |
\let\@bsphack\relax |
| 2166 |
\let\@esphack\relax |
| 2167 |
% \end{macrocode} |
| 2168 |
% Label |\@currentlabel| by expanding the original |\label| code. |
| 2169 |
% \begin{macrocode} |
| 2170 |
\subcaption@ORI@label#1{#2}% |
| 2171 |
% \end{macrocode} |
| 2172 |
% Set |\@currentlabel| to the `sub' counter value and expand the original |\label| code again. |
| 2173 |
% (But this time without optional arguments.) |
| 2174 |
% \begin{macrocode} |
| 2175 |
\subcaption@prepare@label |
| 2176 |
\protected@edef\@currentlabel{\csname thesub\@captype\endcsname}% |
| 2177 |
\subcaption@ORI@label{sub@#2}% |
| 2178 |
\endgroup\@esphack} |
| 2179 |
% \end{macrocode} |
| 2180 |
% \end{macro} |
| 2181 |
% |
| 2182 |
% \begin{macro}{\subcaption@prepare@label} |
| 2183 |
% \changes{v1.4c}{2021/04/10}{This macro added} |
| 2184 |
% \changes{v1.4c}{2021/04/10}{Adapted to the \pkg{showlabels} package} |
| 2185 |
% \begin{macrocode} |
| 2186 |
\newcommand*\subcaption@prepare@label{% |
| 2187 |
% \end{macrocode} |
| 2188 |
% Adaption to the \pkg{showkeys} package: Hide the `sub' label from it. |
| 2189 |
% \begin{macrocode} |
| 2190 |
\let\SK@\@gobbletwo |
| 2191 |
% \end{macrocode} |
| 2192 |
% Adaption to the \pkg{showlabels} package: Hide the `sub' label from it |
| 2193 |
% by expanding to the original definition saved to |\SL@orig#1| |
| 2194 |
% (with |#1| $=$ |\SL@orig|\-|label|, \ldots). |
| 2195 |
% \begin{macrocode} |
| 2196 |
\def\SL@showlabels##1{\@nameuse{SL@orig##1}}} |
| 2197 |
% \end{macrocode} |
| 2198 |
% \end{macro} |
| 2199 |
% |
| 2200 |
% \begin{macro}{\subref} |
| 2201 |
% \changes{v1.1}{2011/08/14}{Caption option \opt{subrefformat=} added} |
| 2202 |
% \changes{v1.1}{2011/08/18}{Uses \cs{caption@setoptions*} now} |
| 2203 |
% \changes{v1.1}{2012/01/12}{Usage of \cs{caption@setoptions*} replaced by \cs{caption@setoptions}} |
| 2204 |
% \changes{v1.1}{2012/04/09}{Revised} |
| 2205 |
% \changes{v1.1}{2018/12/26}{Bugfix: Missing curly braces added} |
| 2206 |
% This one calls |\ref| with the second label. (see |\subcaption@label|) |
| 2207 |
% \begin{macrocode} |
| 2208 |
\DeclareRobustCommand*\subref{% |
| 2209 |
\@ifstar |
| 2210 |
{\caption@withoptargs\subcaption@ref*}% |
| 2211 |
{\caption@withoptargs\@subref}} |
| 2212 |
\newcommand*\@subref[2]{% |
| 2213 |
\@ifundefined{hyperref}% |
| 2214 |
{\subcaption@ref{#1}{#2}}% |
| 2215 |
{\hyperref[{#2}]{\subcaption@ref{*#1}{#2}}}} |
| 2216 |
% \end{macrocode} |
| 2217 |
% \begin{macrocode} |
| 2218 |
\newcommand*\subcaption@ref[2]{% |
| 2219 |
\begingroup |
| 2220 |
\caption@setoptions{sub}% |
| 2221 |
\subcaption@reffmt\p@subref{\ref#1{sub@#2}}% |
| 2222 |
\endgroup} |
| 2223 |
% \end{macrocode} |
| 2224 |
% \begin{macrocode} |
| 2225 |
\newcommand*\p@subref{} |
| 2226 |
% \end{macrocode} |
| 2227 |
% \end{macro} |
| 2228 |
% |
| 2229 |
% \begin{macrocode} |
| 2230 |
\DeclareCaptionOption{subrefformat}{\subcaption@setrefformat{#1}} |
| 2231 |
% \end{macrocode} |
| 2232 |
% |
| 2233 |
% \begin{macro}{\subcaption@setrefformat} |
| 2234 |
% \changes{v1.3g}{2020/07/27}{Adapted to \pkg{caption3} v2.0} |
| 2235 |
% \changes{v1.3h}{2020/09/28}{Usage of \cs{caption@Error} replaced by \cs{subcaption@Error}} |
| 2236 |
% \changes{v1.3j}{2020/10/07}{Definition of the label formats \texttt{subsimple} and \texttt{subparens} added} |
| 2237 |
% \changes{v1.4}{2020/12/24}{Adapted to older versions of the caption package (fallback)} |
| 2238 |
% \changes{v1.6b}{2023/07/28}{Adapted to the \pkg{subfig} package} |
| 2239 |
% |\subcaption@setrefformat|\marg{name}\par |
| 2240 |
% Selecting a subref format simply means saving the code (in |\subcaption@reffmt|). |
| 2241 |
% \begin{macrocode} |
| 2242 |
\newcommand*\subcaption@setrefformat[1]{% |
| 2243 |
\@ifundefined{caption@labelformat@#1}% caption3 v2.x |
| 2244 |
{\@ifundefined{caption@lfmt@#1}% caption3 v1.x |
| 2245 |
{\@ifundefined{caption@subreffmt@#1}{\subcaption@Error{Undefined label format `#1'}}{}}% |
| 2246 |
{\expandafter\let\expandafter\subcaption@reffmt\csname caption@lfmt@#1\endcsname}}% |
| 2247 |
{\expandafter\let\expandafter\subcaption@reffmt\csname caption@labelformat@#1\endcsname}% |
| 2248 |
\@ifundefined{caption@subreffmt@#1}{}{\caption@setsubrefformat{#1}}} % subfig v1.3 |
| 2249 |
% \end{macrocode} |
| 2250 |
% \begin{macrocode} |
| 2251 |
\subcaption@setrefformat{simple} |
| 2252 |
% \end{macrocode} |
| 2253 |
% To offer a smooth transition from the \pkg{subfig} to the \pkg{subcaption} package |
| 2254 |
% we offer the options |sub|\-|ref|\-|format=sub|\-|simple| and |sub|\-|ref|\-|format=sub|\-|parens|, too. |
| 2255 |
% \begin{macrocode} |
| 2256 |
\DeclareCaptionLabelFormat{subsimple}{#2} |
| 2257 |
\DeclareCaptionLabelFormat{subparens}{(#2)} |
| 2258 |
% \end{macrocode} |
| 2259 |
% \end{macro} |
| 2260 |
% |
| 2261 |
% \subsection{Execution of options} |
| 2262 |
% |
| 2263 |
% \changes{v1.1}{2018/05/01}{Option \texttt{font+=small} changed to \texttt{font+=smaller}} \changenote{released 2018/05/02} |
| 2264 |
% \changes{v1.2}{2018/05/13}{Option \texttt{font+=smaller} changed to \texttt{size=smaller}} \changenote{merged from former SVN/trunk 2019/03/16, released 2019/08/18} |
| 2265 |
% \changes{v1.3e}{2020/07/27}{Option \texttt{size=smaller} changed back to \texttt{font+=smaller}} \changenote{merged from feature/documentclass 2020/07/29, released 2020/08/30} |
| 2266 |
% We use |\caption@Execute|\-|Options| and |\caption@Process|\-|Options| here to add |
| 2267 |
% the options to the `|sub|' option list instead of executing them immediately. |
| 2268 |
% \begin{macrocode} |
| 2269 |
\let\caption@setkeys@ORI\caption@setkeys |
| 2270 |
\@ifundefined{caption@SetupOptions} % caption3 v1.3 |
| 2271 |
{\renewcommand\caption@setkeys[2]{\captionsetup[sub]{#2}}} |
| 2272 |
{\caption@SetupOptions{subcaption}{\captionsetup[sub]{#2}}} |
| 2273 |
% \end{macrocode} |
| 2274 |
% \begin{macrocode} |
| 2275 |
\@ifundefined{caption@smaller} % caption3 v1.7-169 |
| 2276 |
{\caption@ExecuteOptions{subcaption}{% |
| 2277 |
font+=small,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0}} |
| 2278 |
{\caption@ExecuteOptions{subcaption}{% |
| 2279 |
font+=smaller,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0}} |
| 2280 |
% \end{macrocode} |
| 2281 |
% \begin{macrocode} |
| 2282 |
\caption@ProcessOptions*{subcaption} |
| 2283 |
% \end{macrocode} |
| 2284 |
% \begin{macrocode} |
| 2285 |
\let\caption@setkeys\caption@setkeys@ORI |
| 2286 |
\let\caption@setkeys@ORI\@undefined |
| 2287 |
% \end{macrocode} |
| 2288 |
% |
| 2289 |
% \begin{macro}{\subcaption@DeclareType} |
| 2290 |
% \changes{v1.6}{2022/04/07}{This macro added} |
| 2291 |
% |\subcaption@DeclareType|\marg{type}\\ |
| 2292 |
% defines the sub-counter via |\Declare|\-|Caption|\-|Sub|\-|Type| offered by the \pkg{caption} package. |
| 2293 |
% \begin{macrocode} |
| 2294 |
\newcommand*\subcaption@DeclareType[1]{% |
| 2295 |
\@ifundefined{c@sub#1}% |
| 2296 |
{\DeclareCaptionSubType{#1}}% |
| 2297 |
{\caption@subtypesource\caption@subtype@source{sub#1}% |
| 2298 |
\subcaption@Info{The counter `sub#1' was already defined by\MessageBreak\caption@subtype@source}}} |
| 2299 |
% \end{macrocode} |
| 2300 |
% \begin{macrocode} |
| 2301 |
\providecommand*\caption@subtypesource[2]{\def#1{a different package}} % caption3 v2.4 |
| 2302 |
% \end{macrocode} |
| 2303 |
% \end{macro} |
| 2304 |
% |
| 2305 |
% We call |\Declare|\-|Caption|\-|Sub|\-|Type| for |figure| and |table|, |
| 2306 |
% and each floating environment declared with |\Declare|\-|Floating|\-|Environment| here. |
| 2307 |
% \begin{macrocode} |
| 2308 |
\@ifundefined{ForEachCaptionType} % caption3 v1.13 |
| 2309 |
{\@ifundefined{caption@ForEachType} % caption3 v1.4a |
| 2310 |
{\@ifundefined{c@figure}{}{\subcaption@DeclareType{figure}}% |
| 2311 |
\@ifundefined{c@table}{}{\subcaption@DeclareType{table}}% |
| 2312 |
\caption@For{typelist}{\subcaption@DeclareType{#1}}} |
| 2313 |
{\caption@ForEachType{\subcaption@DeclareType{#1}}}} |
| 2314 |
{\ForEachCaptionType{\subcaption@DeclareType{#1}}} |
| 2315 |
% \end{macrocode} |
| 2316 |
% |
| 2317 |
% \subsection{Bonus material} |
| 2318 |
% |
| 2319 |
% \subsubsection{The \cs{subcaption}, \cs{phantomsubcaption}, \cs{subcaptionlistentry}, and \cs{subcaptiontext} commands} |
| 2320 |
% |
| 2321 |
% \begin{macro}{\subcaption@newabbreviation} |
| 2322 |
% \changes{v1.5}{2022/01/07}{This macro added} |
| 2323 |
% |\subcaption@newabbreviation|\marg{new command}\marg{existing command}\marg{extra code in case of error}\\ |
| 2324 |
% defines a new command as abbreviation of |\set|\-|caption|\-|sub|\-|type*| plus \meta{command}. |
| 2325 |
% (With a prefacing |\set|\-|caption|\-|sub|\-|type|, \meta{new command} is reduced to \meta{command}. |
| 2326 |
% Unfortunately we have to do this on our own since using |\set|\-|caption|\-|sub|\-|type| multiple times |
| 2327 |
% is not suppressed until \pkg{caption} package \version{3.6}.) |
| 2328 |
% \Note{Since \cs{setcaptionsubtype} is used, the new command is designed to be used inside an own group!} |
| 2329 |
% \begin{macrocode} |
| 2330 |
\newcommand*\subcaption@newabbreviation[3]{% |
| 2331 |
% \end{macrocode} |
| 2332 |
% \begin{macrocode} |
| 2333 |
\newcommand*{#1}{% |
| 2334 |
\caption@iftype |
| 2335 |
{\setcaptionsubtype*#2}% |
| 2336 |
{\subcaption@OutsideFloat#1#3}}% |
| 2337 |
% \end{macrocode} |
| 2338 |
% \begin{macrocode} |
| 2339 |
\g@addto@macro\caption@subtypehook{\let#1#2}}% needed for caption < 3.6 |
| 2340 |
% \end{macrocode} |
| 2341 |
% \begin{macrocode} |
| 2342 |
\@onlypreamble\subcaption@newabbreviation |
| 2343 |
% \end{macrocode} |
| 2344 |
% \end{macro} |
| 2345 |
% |
| 2346 |
% \begin{macro}{\caption@gobble} |
| 2347 |
% \changes{v1.4}{2020/12/24}{This macro added} |
| 2348 |
% |\caption@gobble*|\oarg{arg}\oarg{\ldots}\marg{arg}\\ |
| 2349 |
% is similar to |\@gobble| but gobbles a star and optional arguments as well. |
| 2350 |
% \begin{macrocode} |
| 2351 |
\@ifundefined{caption@gobble}{% |
| 2352 |
\DeclareRobustCommand*\caption@gobble{% caption3 < v1.4 |
| 2353 |
\caption@withoptargs\@gobbletwo}% |
| 2354 |
}{} |
| 2355 |
% \end{macrocode} |
| 2356 |
% \end{macro} |
| 2357 |
% |
| 2358 |
% \begin{macro}{\subcaption} |
| 2359 |
% \changes{v1.1}{2012/04/06}{Overwrites the definition defined by the \pkg{memoir} document class} |
| 2360 |
% |\subcaption| is an abbreviation of |\set|\-|caption|\-|sub|\-|type*| plus |\caption|. |
| 2361 |
% \begin{macrocode} |
| 2362 |
\@ifclassloaded{memoir}{\let\subcaption\undefined}{} |
| 2363 |
\subcaption@newabbreviation\subcaption\caption\caption@gobble |
| 2364 |
% \end{macrocode} |
| 2365 |
% \end{macro} |
| 2366 |
% |
| 2367 |
% \begin{macro}{\phantomsubcaption} |
| 2368 |
% \changes{v1.1}{2011/08/17}{This macro added} |
| 2369 |
% \changes{v1.3h}{2020/09/28}{Usage of \cs{caption@Error} replaced by \cs{subcaption@Error}} |
| 2370 |
% |\phantom|\-|sub|\-|caption| is an abbreviation of |\set|\-|caption|\-|sub|\-|type*| plus |\phantom|\-|caption|. |
| 2371 |
% \Note{This commands needs at least \pkg{caption} package \version{3.2}.} |
| 2372 |
% \begin{macrocode} |
| 2373 |
\subcaption@newabbreviation\phantomsubcaption\phantomcaption\relax |
| 2374 |
% \end{macrocode} |
| 2375 |
% \end{macro} |
| 2376 |
% |
| 2377 |
% \begin{macro}{\subcaptionlistentry} |
| 2378 |
% \changes{v1.5}{2022/01/05}{This macro added} |
| 2379 |
% |\sub|\-|caption|\-|list|\-|entry| is an abbreviation of |\set|\-|caption|\-|sub|\-|type*| plus |\caption|\-|list|\-|entry|. |
| 2380 |
% \Note{This commands needs at least \pkg{caption} package \version{3.3}.} |
| 2381 |
% \begin{macrocode} |
| 2382 |
\subcaption@newabbreviation\subcaptionlistentry\captionlistentry\caption@gobble |
| 2383 |
% \end{macrocode} |
| 2384 |
% \end{macro} |
| 2385 |
% |
| 2386 |
% \begin{macro}{\subcaptiontext} |
| 2387 |
% \changes{v1.5}{2022/01/05}{This macro added} |
| 2388 |
% |\sub|\-|caption|\-|text| is an abbreviation of |\set|\-|caption|\-|sub|\-|type*| plus |\caption|\-|text|. |
| 2389 |
% \Note{This commands needs at least \pkg{caption} package \version{3.6}.} |
| 2390 |
% \begin{macrocode} |
| 2391 |
\subcaption@newabbreviation\subcaptiontext\captiontext\caption@gobble |
| 2392 |
% \end{macrocode} |
| 2393 |
% \end{macro} |
| 2394 |
% |
| 2395 |
% \begin{macro}{\caption@subfloatrow@hook} |
| 2396 |
% \changes{v1.6}{2022/04/17}{Support of this hook added} |
| 2397 |
% Inside the |sub|\-|float|\-|row| environment offered by the \pkg{floatrow} package |
| 2398 |
% the usage of |\caption| etc.~needs to be mapped to |\sub|\-|caption| etc. |
| 2399 |
% \begin{macrocode} |
| 2400 |
\providecommand*\caption@subfloatrow@hook{} % caption < v3.7 |
| 2401 |
% \end{macrocode} |
| 2402 |
% \begin{macrocode} |
| 2403 |
\g@addto@macro\caption@subfloatrow@hook{% |
| 2404 |
\let\caption\subcaption |
| 2405 |
\let\phantomcaption\phantomsubcaption |
| 2406 |
\let\captionlistentry\subcaptionlistentry |
| 2407 |
\let\captiontext\subcaptiontext} |
| 2408 |
% \end{macrocode} |
| 2409 |
% \end{macro} |
| 2410 |
% |
| 2411 |
% \subsubsection{The \cs{subfloat} command} |
| 2412 |
% |
| 2413 |
% \begin{macro}{\subfloat} |
| 2414 |
% \changes{v0.4}{2008/03/01}{This macro added} |
| 2415 |
% \changes{v1.0c}{2011/01/22}{This macro removed since it's too incompatible with the one from \pkg{subfig}} |
| 2416 |
% \changes{v1.3}{2019/08/31}{This macro re-added and revised} |
| 2417 |
% \changes{v1.3a}{2019/09/01}{\cs{ignorespaces} copied from \cs{sf@@@subfloat}} |
| 2418 |
% \changes{v1.3b}{2020/01/03}{Previous definition of \cs{subfloat} will be overwritten} |
| 2419 |
% \changes{v1.3f}{2020/07/29}{Bugfix: Usage of \cs{caption@hj@default} replaced by \cs{captionbox@innerpos@default}} |
| 2420 |
% \changes{v1.3i}{2020/09/28}{This macro will be defined with \cs{providecommand} now to preserve an original definition} |
| 2421 |
% \changes{v1.4}{2020/12/24}{Usage of \cs{caption@getlabel} replaced by \cs{subcaption@getlabel}} |
| 2422 |
% \changes{v1.4a}{2020/12/26}{Clearance of \cs{caption@thelabel} replaced by \cs{subcaption@clrlabel}} |
| 2423 |
% \changes{v1.5}{2022/01/07}{Usage of \cs{@ifnextchar} replaced by \cs{kernel@ifnextchar}} |
| 2424 |
% \changes{v1.5}{2022/01/07}{Overwrites the definition done by the \cls{memoir} document class} |
| 2425 |
% \changes{v1.6}{2022/04/16}{Emulates the definition done by the \cls{memoir} document class} |
| 2426 |
% |\subfloat|\oarg{list\_entry}\oarg{sub-caption}\marg{body}\par |
| 2427 |
% If \meta{sub-caption} is given, we map this to |\sub|\-|caption|\-|box| |
| 2428 |
% but transfer the |\label| from \meta{body} to \meta{sub-caption}. |
| 2429 |
% If not, we do the same as |\sub|\-|caption|\-|box| does, but use |\phantom|\-|caption| instead of |\caption|. |
| 2430 |
% In both cases we do a |\ignore|\-|spaces| at the end since the original implementation of |\sub|\-|float| does this, too. |
| 2431 |
% \begin{macrocode} |
| 2432 |
\caption@AtBeginDocument{% |
| 2433 |
\begingroup |
| 2434 |
\newenvironment{subcaption@memoir@subfloat}{}{}% |
| 2435 |
\ifx\subfloat\subcaption@memoir@subfloat |
| 2436 |
\endgroup |
| 2437 |
% "subfloat" = empty environment, defined by memoir |
| 2438 |
\renewcommand*\subfloat{% |
| 2439 |
\def\subcaption@currenvir{subfloat}% |
| 2440 |
\ifx\@currenvir\subcaption@currenvir |
| 2441 |
% emulate (empty) subfloat environment |
| 2442 |
\else |
| 2443 |
\expandafter\subcaption@subfloat |
| 2444 |
\fi}% |
| 2445 |
\else |
| 2446 |
\endgroup |
| 2447 |
\providecommand*\subfloat{\subcaption@subfloat}% |
| 2448 |
\fi} |
| 2449 |
% \end{macrocode} |
| 2450 |
% \begin{macrocode} |
| 2451 |
\newcommand*\subcaption@subfloat{% |
| 2452 |
\kernel@ifnextchar[%] |
| 2453 |
\subcaption@@subfloat |
| 2454 |
\subcaption@subfloat@} |
| 2455 |
% \end{macrocode} |
| 2456 |
% \begin{macrocode} |
| 2457 |
\long\def\subcaption@@subfloat[#1]{% |
| 2458 |
\kernel@ifnextchar[%] |
| 2459 |
{\subcaption@@@subfloat{#1}}% |
| 2460 |
{\subcaption@@subfloat@\subcaptionbox{#1}}} |
| 2461 |
% \end{macrocode} |
| 2462 |
% \begin{macrocode} |
| 2463 |
\long\def\subcaption@@@subfloat#1[#2]{% |
| 2464 |
\subcaption@@subfloat@{\subcaptionbox[{#1}]}{#2}} |
| 2465 |
% \end{macrocode} |
| 2466 |
% \begin{macrocode} |
| 2467 |
\long\def\subcaption@@subfloat@#1#2#3{% |
| 2468 |
\subcaption@getlabel{#3}% |
| 2469 |
#1{#2\caption@thelabel}{\let\label\caption@gobble#3}% |
| 2470 |
\subcaption@clrlabel |
| 2471 |
\ignorespaces} |
| 2472 |
% \end{macrocode} |
| 2473 |
% \begin{macrocode} |
| 2474 |
\def\subcaption@subfloat@#1{% |
| 2475 |
\setbox\@tempboxa\hbox{#1}% |
| 2476 |
\caption@iiiibox |
| 2477 |
\setcaptionsubtype |
| 2478 |
{\phantomcaption\@gobble}{\phantomcaption\@gobble}% no box with \caption |
| 2479 |
{}% no optional arguments for \caption |
| 2480 |
{}% no sub-caption |
| 2481 |
[\wd\@tempboxa][\captionbox@innerpos@default]% |
| 2482 |
{\unhbox\@tempboxa}% |
| 2483 |
\ignorespaces} |
| 2484 |
% \end{macrocode} |
| 2485 |
% \end{macro} |
| 2486 |
% |
| 2487 |
% \begin{macro}{\subcaption@getlabel} |
| 2488 |
% \changes{v1.4}{2020/12/24}{This macro added} |
| 2489 |
% |\subcaption@getlabel|\marg{text}\\ |
| 2490 |
% gets the label command out of the given caption text and stores it to |\caption@the|\-|label|. |
| 2491 |
% It uses |\caption@get|\-|label| for this purpose which interface unfortunately has changed over time. |
| 2492 |
% (Changing the interface was a bad idea in the first place but now it is as it is). |
| 2493 |
% \begin{macrocode} |
| 2494 |
\@ifundefined{caption@getlabel}{% |
| 2495 |
% \end{macrocode} |
| 2496 |
% \begin{macrocode} |
| 2497 |
\newcommand\subcaption@getlabel[1]{% caption3 < v1.7 |
| 2498 |
\subcaption@Error{\noexpand\subfloat needs at least caption v3.4}% |
| 2499 |
\let\caption@thelabel\relax} |
| 2500 |
% \end{macrocode} |
| 2501 |
% \begin{macrocode} |
| 2502 |
}{\@ifundefined{caption@@@@getlabel}{% |
| 2503 |
% \end{macrocode} |
| 2504 |
% \begin{macrocode} |
| 2505 |
\newcommand\subcaption@getlabel[1]{% caption3 >= v1.7 |
| 2506 |
\caption@getlabel#1\label{}\@nil} |
| 2507 |
% \end{macrocode} |
| 2508 |
% \begin{macrocode} |
| 2509 |
}{% |
| 2510 |
% \end{macrocode} |
| 2511 |
% \begin{macrocode} |
| 2512 |
\newcommand*\subcaption@getlabel{% caption3 >= v2.0 |
| 2513 |
\caption@getlabel} |
| 2514 |
% \end{macrocode} |
| 2515 |
% \begin{macrocode} |
| 2516 |
}} |
| 2517 |
% \end{macrocode} |
| 2518 |
% \end{macro} |
| 2519 |
% |
| 2520 |
% \begin{macro}{\subcaption@clrlabel} |
| 2521 |
% \changes{v1.4a}{2020/12/26}{This macro added} |
| 2522 |
% |\subcaption@clrlabel|\\ |
| 2523 |
% resets |\caption@the|\-|label| to |\relax|. |
| 2524 |
% \begin{macrocode} |
| 2525 |
\@ifundefined{caption@clrlabel}{% |
| 2526 |
% \end{macrocode} |
| 2527 |
% \begin{macrocode} |
| 2528 |
\newcommand*\subcaption@clrlabel{\let\caption@thelabel\relax} % caption3 < v2.3 |
| 2529 |
% \end{macrocode} |
| 2530 |
% \begin{macrocode} |
| 2531 |
}{% |
| 2532 |
% \end{macrocode} |
| 2533 |
% \begin{macrocode} |
| 2534 |
\newcommand*\subcaption@clrlabel{\caption@clrlabel} % caption3 >= v2.3 |
| 2535 |
% \end{macrocode} |
| 2536 |
% \begin{macrocode} |
| 2537 |
} |
| 2538 |
% \end{macrocode} |
| 2539 |
% \end{macro} |
| 2540 |
% |
| 2541 |
% \iffalse |
| 2542 |
%</package> |
| 2543 |
% \fi |
| 2544 |
% |
| 2545 |
% \iffalse |
| 2546 |
% --------------------------------------------------------------------------- % |
| 2547 |
% \fi |
| 2548 |
% |
| 2549 |
% \Finale |
| 2550 |
% |
| 2551 |
\endinput |