| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% This is file `caption3.dtx'. |
| 4 |
% |
| 5 |
% Copyright (C) 1994-2022 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, caption2.dtx, caption3.dtx, |
| 23 |
% bicaption.dtx, ltcaption.dtx, subcaption.dtx, |
| 24 |
% the derived files |
| 25 |
% caption.sty, caption2.sty, caption3.sty, |
| 26 |
% bicaption.sty, ltcaption.sty, subcaption.sty, |
| 27 |
% and the user manuals |
| 28 |
% caption-deu.tex, caption-eng.tex, caption-rus.tex. |
| 29 |
% |
| 30 |
% \fi |
| 31 |
% \CheckSum{3606} |
| 32 |
% |
| 33 |
% \iffalse |
| 34 |
%<*driver> |
| 35 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 36 |
\ProvidesFile{caption3.drv}[2019/09/10 v1.13 Implementation of the caption kernel] |
| 37 |
\hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up. |
| 38 |
%\errorcontextlines=3 |
| 39 |
% |
| 40 |
\documentclass{ltxdoc} |
| 41 |
\setlength\parindent{0pt} |
| 42 |
\setlength\parskip{\smallskipamount} |
| 43 |
% |
| 44 |
\makeatletter % make room for subsections like 2.16.14 in the TOC |
| 45 |
%\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}} |
| 46 |
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}} |
| 47 |
\makeatother |
| 48 |
% |
| 49 |
\usepackage{ifpdf} |
| 50 |
\ifpdf |
| 51 |
\usepackage{mathptmx,courier} |
| 52 |
\usepackage[scaled=0.90]{helvet} |
| 53 |
\addtolength\marginparwidth{15pt} |
| 54 |
\fi |
| 55 |
% |
| 56 |
\usepackage{hypdoc} |
| 57 |
\ifpdf\usepackage{hypdestopt}\fi |
| 58 |
\hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}} |
| 59 |
% |
| 60 |
\usepackage{caption3}[2020/05/30] |
| 61 |
% |
| 62 |
\DeclareRobustCommand*\AmS{\texorpdfstring |
| 63 |
{{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}% |
| 64 |
{AMS}} |
| 65 |
\DeclareRobustCommand*\KOMAScript{\texorpdfstring |
| 66 |
{\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}% |
| 67 |
{KOMA-Script}} |
| 68 |
\DeclareRobustCommand*\NTG{NTG} |
| 69 |
\DeclareRobustCommand*\SmF{SMF} |
| 70 |
% |
| 71 |
\begin{document} |
| 72 |
\DocInput{caption3.dtx} |
| 73 |
\end{document} |
| 74 |
%</driver> |
| 75 |
% \fi |
| 76 |
% |
| 77 |
% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}} |
| 78 |
% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}} |
| 79 |
% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}} |
| 80 |
% \let\class\puresf \let\package\puresf |
| 81 |
% \let\env\purett \let\opt\purett |
| 82 |
% |
| 83 |
% \def\thispackage{the \package{caption} kernel} |
| 84 |
% \def\Thispackage{The \package{caption} kernel} |
| 85 |
% |
| 86 |
% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} |
| 87 |
% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} |
| 88 |
% \newcommand*\version[2][]{\textit{v#2}} |
| 89 |
% |
| 90 |
% \GetFileInfo{caption3.sty} |
| 91 |
% |
| 92 |
% \title{The Implementation of |
| 93 |
% \texorpdfstring{\thispackage\thanks{%^^A |
| 94 |
% This package has version number \fileversion, last revised \filedate.}}%^^A |
| 95 |
% {the caption kernel}} |
| 96 |
% \author{Axel Sommerfeldt\\ |
| 97 |
% \url{https://gitlab.com/axelsommerfeldt/caption}} |
| 98 |
% \date{\filedate} |
| 99 |
% \maketitle |
| 100 |
% |
| 101 |
% \begin{abstract} |
| 102 |
% \Thispackage\ consists of two parts -- the kernel |
| 103 |
% (|caption3.sty|) and the main package (|caption.sty|). |
| 104 |
% |
| 105 |
% The kernel provides all the user commands and internal macros which are |
| 106 |
% necessary for typesetting captions and setting parameters regarding these. |
| 107 |
% While the standard \LaTeX\ document classes provide an internal command |
| 108 |
% called |\@makecaption| and no options to control its behavior (except the |
| 109 |
% vertical skips above and below the caption itself), we provide similar |
| 110 |
% commands called |\caption@make| and |\caption@@make|, but with a lot of |
| 111 |
% options which can be selected with |\captionsetup|. |
| 112 |
% Loading the kernel part do not change the output of a \LaTeX\ document |
| 113 |
% -- it just provides functionality which can be used by \LaTeXe\ packages |
| 114 |
% which typesets captions, for example the \package{caption} and |
| 115 |
% \package{subfig} packages. |
| 116 |
% \end{abstract} |
| 117 |
% |
| 118 |
% \StopEventually{} |
| 119 |
% \clearpage |
| 120 |
% \tableofcontents |
| 121 |
% |
| 122 |
% \iffalse |
| 123 |
% --------------------------------------------------------------------------- % |
| 124 |
% \fi |
| 125 |
% |
| 126 |
% \DoNotIndex{\\,\_,\ ,\@@par} |
| 127 |
% \DoNotIndex{\@bsphack} |
| 128 |
% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname} |
| 129 |
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs} |
| 130 |
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo} |
| 131 |
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom} |
| 132 |
% \DoNotIndex{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded} |
| 133 |
% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue} |
| 134 |
% \DoNotIndex{\@namedef,\@nameuse} |
| 135 |
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist} |
| 136 |
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar} |
| 137 |
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc} |
| 138 |
% \DoNotIndex{\@testopt} |
| 139 |
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} |
| 140 |
% \DoNotIndex{\p@,\z@} |
| 141 |
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup} |
| 142 |
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box} |
| 143 |
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow} |
| 144 |
% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter} |
| 145 |
% \DoNotIndex{\fi,\footnotesize,\global} |
| 146 |
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss} |
| 147 |
% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode} |
| 148 |
% \DoNotIndex{\ifx,\ignorespaces,\itshape} |
| 149 |
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth} |
| 150 |
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message} |
| 151 |
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox} |
| 152 |
% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline} |
| 153 |
% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip} |
| 154 |
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write} |
| 155 |
% \DoNotIndex{\providecommand,\quad} |
| 156 |
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage} |
| 157 |
% \DoNotIndex{\rightskip,\rmfamily} |
| 158 |
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape} |
| 159 |
% \DoNotIndex{\small,\string,\space,\strut} |
| 160 |
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily} |
| 161 |
% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage} |
| 162 |
% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip} |
| 163 |
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption} |
| 164 |
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists} |
| 165 |
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak} |
| 166 |
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine} |
| 167 |
% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage} |
| 168 |
% |
| 169 |
% \iffalse |
| 170 |
% --------------------------------------------------------------------------- % |
| 171 |
% \fi |
| 172 |
% |
| 173 |
% \setlength{\parskip}{0pt plus 1pt} |
| 174 |
% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par} |
| 175 |
% |
| 176 |
% \changes{v1.0}{2003/12/20}{Rewritten; many new commands and features} |
| 177 |
% \changes{v1.0c}{2004/11/28}{Split into two packages: |
| 178 |
% \package{caption} \& \package{caption3}} |
| 179 |
% |
| 180 |
% \iffalse |
| 181 |
% --------------------------------------------------------------------------- % |
| 182 |
% \fi |
| 183 |
% |
| 184 |
% \clearpage |
| 185 |
% |
| 186 |
% \iffalse |
| 187 |
%<*package> |
| 188 |
% \fi |
| 189 |
% |
| 190 |
% \section{Identification} |
| 191 |
% |
| 192 |
% \begin{macrocode} |
| 193 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 194 |
\ProvidesPackage{caption3}[2022/04/06 v1.13b caption3 kernel (AR)] |
| 195 |
% \end{macrocode} |
| 196 |
% |
| 197 |
% \section{Workaround for bug in package \package{arabtex}} |
| 198 |
% \package{arabtex} re-defines \cs{@gobble} as not-long so the packages of the |
| 199 |
% \package{caption} package bundle are doomed to fail. |
| 200 |
% Since this fatal bug won't be fixed in \package{arabtex} but we are dependent on a |
| 201 |
% proper definition of \cs{@gobble}, \cs{@firstofone}, \cs{@firstoftwo}, \cs{@secondoftwo}, |
| 202 |
% and so on we fix this here. (Sigh!) |
| 203 |
% \begin{macrocode} |
| 204 |
\providecommand\caption@FixArabTeX{% |
| 205 |
\def\caption@tempa##1{}% |
| 206 |
\ifx\caption@tempa\@gobble |
| 207 |
\PackageInfo{caption3}{Fixing ArabTeX}% |
| 208 |
\long\def\@gobble##1{}% |
| 209 |
\fi} |
| 210 |
% \end{macrocode} |
| 211 |
% Do the fix now and at |\begin{document}|, in case \package{arabtex} will be loaded after \package{caption}. |
| 212 |
% \begin{macrocode} |
| 213 |
\caption@FixArabTeX |
| 214 |
\AtBeginDocument{% |
| 215 |
\caption@FixArabTeX |
| 216 |
\let\caption@FixArabTeX\@undefined} |
| 217 |
% \end{macrocode} |
| 218 |
% |
| 219 |
% \section{Generic helpers} |
| 220 |
% |
| 221 |
% \begin{macro}{\@nameundef} |
| 222 |
% This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel. |
| 223 |
% We use it to remove the definition of some commands and keyval options after |
| 224 |
% |\begin{document}| (to save \TeX\ memory) and to remove caption options defined |
| 225 |
% with |\captionsetup|\oarg{type}. |
| 226 |
% \begin{macrocode} |
| 227 |
\providecommand*\@nameundef[1]{% |
| 228 |
\expandafter\let\csname #1\endcsname\@undefined} |
| 229 |
% \end{macrocode} |
| 230 |
% \end{macro} |
| 231 |
% |
| 232 |
% \begin{macro}{\l@addto@macro} |
| 233 |
% \changes{v1.5}{2013/04/26}{Revised} |
| 234 |
% The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which |
| 235 |
% globally adds tokens to existing macros, like in |\AtBeginDocument|. |
| 236 |
% This is the same but it works local, not global. |
| 237 |
% \begin{macrocode} |
| 238 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 239 |
\expandafter\ifx\csname currentgrouplevel\endcsname\relax |
| 240 |
\PackageInfo{caption3}{TeX engine: TeX} |
| 241 |
\let\caption@ifeTeX\@secondoftwo |
| 242 |
\providecommand\l@addto@macro[2]{% |
| 243 |
\begingroup |
| 244 |
\toks@\expandafter{#1#2}% |
| 245 |
\xdef\caption@addto@temp{\the\toks@}% |
| 246 |
\endgroup |
| 247 |
\let#1\caption@addto@temp} |
| 248 |
\else |
| 249 |
\PackageInfo{caption3}{TeX engine: e-TeX} |
| 250 |
\let\caption@ifeTeX\@firstoftwo |
| 251 |
\providecommand\l@addto@macro[2]{% |
| 252 |
\edef#1{\unexpanded\expandafter{#1#2}}} |
| 253 |
\fi |
| 254 |
% \end{macrocode} |
| 255 |
% \end{macro} |
| 256 |
% |
| 257 |
% \begin{macro}{\bothIfFirst} |
| 258 |
% \begin{macro}{\bothIfSecond} |
| 259 |
% |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond| |
| 260 |
% tests if the second argument is not empty. If yes both arguments get |
| 261 |
% typeset, otherwise none of them. |
| 262 |
% \begin{macrocode} |
| 263 |
\def\bothIfFirst#1#2{% |
| 264 |
\protected@edef\caption@tempa{#1}% |
| 265 |
\ifx\caption@tempa\@empty \else |
| 266 |
#1#2% |
| 267 |
\fi} |
| 268 |
% \end{macrocode} |
| 269 |
% \begin{macrocode} |
| 270 |
\def\bothIfSecond#1#2{% |
| 271 |
\protected@edef\caption@tempa{#2}% |
| 272 |
\ifx\caption@tempa\@empty \else |
| 273 |
#1#2% |
| 274 |
\fi} |
| 275 |
% \end{macrocode} |
| 276 |
% \end{macro} |
| 277 |
% \end{macro} |
| 278 |
% |
| 279 |
% \begin{macro}{\caption@ifundefined} |
| 280 |
% \changes{v1.3a}{2011/08/12}{This macro added} |
| 281 |
% \changes{v1.3b}{2011/08/18}{Made expandable} |
| 282 |
% Similar to \cs{@ifundefined} offered by the \LaTeX kernel, |
| 283 |
% but takes a macro as argument instead of a macro name. |
| 284 |
% \begin{macrocode} |
| 285 |
\newcommand*\caption@ifundefined[1]{% |
| 286 |
\ifx#1\@undefined |
| 287 |
\expandafter\@firstoftwo |
| 288 |
\else\ifx#1\relax |
| 289 |
\expandafter\expandafter\expandafter\@firstoftwo |
| 290 |
\else |
| 291 |
\expandafter\expandafter\expandafter\@secondoftwo |
| 292 |
\fi\fi} |
| 293 |
% \end{macrocode} |
| 294 |
% \end{macro} |
| 295 |
% |
| 296 |
% \begin{macro}{\caption@ifdefined} |
| 297 |
% \changes{v1.8e}{2018/05/11}{This macro added} |
| 298 |
% Similar to \cs{@ifundefined} offered by the \LaTeX kernel, |
| 299 |
% but takes a macro as argument instead of a macro name. |
| 300 |
% \begin{macrocode} |
| 301 |
\newcommand*\caption@ifdefined[1]{% |
| 302 |
\ifx#1\@undefined |
| 303 |
\expandafter\@secondoftwo |
| 304 |
\else\ifx#1\relax |
| 305 |
\expandafter\expandafter\expandafter\@secondoftwo |
| 306 |
\else |
| 307 |
\expandafter\expandafter\expandafter\@firstoftwo |
| 308 |
\fi\fi} |
| 309 |
% \end{macrocode} |
| 310 |
% \end{macro} |
| 311 |
% |
| 312 |
% \begin{macro}{\caption@ifinlist} |
| 313 |
% \changes{v1.1}{2007/07/29}{Rewritten} |
| 314 |
% This helper macro checks if the first argument is in the comma separated |
| 315 |
% list which is offered as second argument. So for example |
| 316 |
% \begin{quote} |
| 317 |
% |\caption@ifinlist{frank}{axel,frank,olga,steven}{yes}{no}| |
| 318 |
% \end{quote} |
| 319 |
% would expand to |yes|. |
| 320 |
% \begin{macrocode} |
| 321 |
\newcommand*\caption@ifinlist{% |
| 322 |
\@expandtwoargs\caption@@ifinlist} |
| 323 |
% \end{macrocode} |
| 324 |
% \begin{macrocode} |
| 325 |
\newcommand*\caption@@ifinlist[2]{% |
| 326 |
\begingroup |
| 327 |
\def\@tempa##1,#1,##2\@nil{% |
| 328 |
\endgroup |
| 329 |
\ifx\relax##2\relax |
| 330 |
\expandafter\@secondoftwo |
| 331 |
\else |
| 332 |
\expandafter\@firstoftwo |
| 333 |
\fi}% |
| 334 |
\@tempa,#2,#1,\@nil}% |
| 335 |
% \end{macrocode} |
| 336 |
% \end{macro} |
| 337 |
% |
| 338 |
% \begin{macro}{\caption@ifin@list} |
| 339 |
% \changes{v1.1}{2007/08/12}{This macro added} |
| 340 |
% |\caption@ifin@list|\marg{cmd}\marg{list entry}\marg{yes}\marg{no} |
| 341 |
% \begin{macrocode} |
| 342 |
\newcommand*\caption@ifin@list[2]{% |
| 343 |
\caption@ifempty@list#1% |
| 344 |
{\@secondoftwo}% |
| 345 |
{\@expandtwoargs\caption@@ifinlist{#2}{#1}}} |
| 346 |
% \end{macrocode} |
| 347 |
% \end{macro} |
| 348 |
% |
| 349 |
% \begin{macro}{\caption@g@addto@list} |
| 350 |
% \changes{v1.1}{2007/07/29}{This macro added} |
| 351 |
% |\caption@g@addto@list|\marg{cmd}\marg{list entry} |
| 352 |
% \begin{macrocode} |
| 353 |
\newcommand*\caption@g@addto@list[2]{% |
| 354 |
\caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}} |
| 355 |
% \end{macrocode} |
| 356 |
% \end{macro} |
| 357 |
% \begin{macro}{\caption@l@addto@list} |
| 358 |
% \changes{v1.1}{2007/07/29}{This macro added} |
| 359 |
% |\caption@l@addto@list|\marg{cmd}\marg{list entry} |
| 360 |
% \begin{macrocode} |
| 361 |
\newcommand*\caption@l@addto@list[2]{% |
| 362 |
\caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}} |
| 363 |
% \end{macrocode} |
| 364 |
% \end{macro} |
| 365 |
% |
| 366 |
% \begin{macro}{\caption@g@removefrom@list} |
| 367 |
% \changes{v1.1}{2007/07/29}{This macro added} |
| 368 |
% |\caption@g@removefrom@list|\marg{cmd}\marg{list entry} |
| 369 |
% \begin{macrocode} |
| 370 |
\newcommand*\caption@g@removefrom@list[2]{% |
| 371 |
\caption@l@removefrom@list#1{#2}% |
| 372 |
\global\let#1#1} |
| 373 |
% \end{macrocode} |
| 374 |
% \end{macro} |
| 375 |
% \begin{macro}{\caption@l@removefrom@list} |
| 376 |
% \changes{v1.1}{2007/07/29}{This macro added} |
| 377 |
% |\caption@l@removefrom@list|\marg{cmd}\marg{list entry}\par |
| 378 |
% \Note[Caveat]{\meta{cmd} will be expanded during this process since |
| 379 |
% \cs{@removeelement} is using \cs{edef} to build the new list!} |
| 380 |
% \begin{macrocode} |
| 381 |
\newcommand*\caption@l@removefrom@list[2]{% |
| 382 |
\caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}} |
| 383 |
% \end{macrocode} |
| 384 |
% \end{macro} |
| 385 |
% |
| 386 |
% \begin{macro}{\caption@for@list} |
| 387 |
% \changes{v1.1}{2007/07/29}{This macro added} |
| 388 |
% |\caption@for@list|\marg{cmd}\marg{code with \#1} |
| 389 |
% \begin{macrocode} |
| 390 |
\newcommand*\caption@for@list[2]{% |
| 391 |
\caption@ifempty@list#1{}{% |
| 392 |
\def\caption@tempb##1{#2}% |
| 393 |
\@for\caption@tempa:=#1\do{% |
| 394 |
\expandafter\caption@tempb\expandafter{\caption@tempa}}}} |
| 395 |
% \end{macrocode} |
| 396 |
% \end{macro} |
| 397 |
% |
| 398 |
% \begin{macro}{\caption@ifempty@list} |
| 399 |
% \changes{v1.1}{2007/07/29}{This macro added} |
| 400 |
% |\caption@ifempty@list|\marg{cmd}\marg{true}\marg{false} |
| 401 |
% \begin{macrocode} |
| 402 |
\newcommand*\caption@ifempty@list[1]{% |
| 403 |
\ifx#1\@undefined |
| 404 |
\expandafter\@firstoftwo |
| 405 |
\else\ifx#1\relax |
| 406 |
\expandafter\expandafter\expandafter\@firstoftwo |
| 407 |
\else\ifx#1\@empty |
| 408 |
\expandafter\expandafter\expandafter\expandafter |
| 409 |
\expandafter\expandafter\expandafter\@firstoftwo |
| 410 |
\else |
| 411 |
\expandafter\expandafter\expandafter\expandafter |
| 412 |
\expandafter\expandafter\expandafter\@secondoftwo |
| 413 |
\fi\fi\fi} |
| 414 |
% \end{macrocode} |
| 415 |
% \end{macro} |
| 416 |
% |
| 417 |
% \pagebreak[3] |
| 418 |
% \begin{macro}{\caption@setbool} |
| 419 |
% \begin{macro}{\caption@set@bool} |
| 420 |
% \changes{v1.1}{2007/04/05}{\cs{caption@set@bool}\marg{cmd}\marg{value} added} |
| 421 |
% \begin{macro}{\caption@ifbool} |
| 422 |
% \begin{macro}{\caption@undefbool} |
| 423 |
% For setting and testing boolean options we offer these three helper macros: |
| 424 |
% \begin{quote} |
| 425 |
% |\caption@setbool|\marg{name}\marg{value}\\ |
| 426 |
% | |(with |value = false/true/no/yes/off/on/0/1|)\\ |
| 427 |
% |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\ |
| 428 |
% |\caption@undefbool|\marg{name} |
| 429 |
% \end{quote} |
| 430 |
% \begin{macrocode} |
| 431 |
\newcommand*\caption@setbool[1]{% |
| 432 |
\expandafter\caption@set@bool\csname caption@if#1\endcsname} |
| 433 |
% \end{macrocode} |
| 434 |
% \begin{macrocode} |
| 435 |
\newcommand*\caption@set@bool[2]{% |
| 436 |
\caption@ifinlist{#2}{1,true,yes,on}{% |
| 437 |
\let#1\@firstoftwo |
| 438 |
}{\caption@ifinlist{#2}{0,false,no,off}{% |
| 439 |
\let#1\@secondoftwo |
| 440 |
}{% |
| 441 |
\caption@Error{Undefined boolean value `#2'}% |
| 442 |
}}} |
| 443 |
% \end{macrocode} |
| 444 |
% \begin{macrocode} |
| 445 |
\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}} |
| 446 |
% \end{macrocode} |
| 447 |
% \begin{macrocode} |
| 448 |
\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}} |
| 449 |
% \end{macrocode} |
| 450 |
% \end{macro} |
| 451 |
% \end{macro} |
| 452 |
% \end{macro} |
| 453 |
% \end{macro} |
| 454 |
% |
| 455 |
% \begin{macro}{\caption@teststar} |
| 456 |
% \changes{v1.1}{2007/05/08}{This macro and its usage added} |
| 457 |
% \changes{v1.1e}{2007/10/28}{\cs{caption@teststar@} added} |
| 458 |
% |\caption@teststar|\marg{cmd}\marg{star arg}\marg{non-star arg}\\ |
| 459 |
% |\caption@teststar@|\marg{cmd}\marg{star arg}\marg{non-star arg} |
| 460 |
% \begin{macrocode} |
| 461 |
\newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}} |
| 462 |
% \end{macrocode} |
| 463 |
% \begin{macrocode} |
| 464 |
\newcommand*\caption@teststar@[3]{% |
| 465 |
\@ifstar{#1{#2}}{\caption@ifatletter{#1{#2}}{#1{#3}}}} |
| 466 |
\AtBeginDocument{\let\caption@teststar@\caption@teststar} |
| 467 |
% \end{macrocode} |
| 468 |
% \begin{macrocode} |
| 469 |
\newcommand*\caption@ifatletter{% |
| 470 |
\ifnum\the\catcode`\@=11 |
| 471 |
\expandafter\@firstoftwo |
| 472 |
\else |
| 473 |
\expandafter\@secondoftwo |
| 474 |
\fi} |
| 475 |
\AtBeginDocument{\let\caption@ifatletter\@secondoftwo} |
| 476 |
% \end{macrocode} |
| 477 |
% \end{macro} |
| 478 |
% |
| 479 |
% \begin{macro}{\caption@withoptargs} |
| 480 |
% \changes{v1.1}{2007/08/12}{This macro added} |
| 481 |
% \changes{v1.5}{2012/04/09}{This macro revised} |
| 482 |
% |\caption@withoptargs|\marg{cmd} |
| 483 |
% \begin{macrocode} |
| 484 |
\newcommand*\caption@withoptargs[1]{% |
| 485 |
\@ifstar |
| 486 |
{\def\caption@tempa{*}\caption@@withoptargs{#1}}% |
| 487 |
{\def\caption@tempa{}\caption@@withoptargs{#1}}} |
| 488 |
% \end{macrocode} |
| 489 |
% \begin{macrocode} |
| 490 |
\def\caption@@withoptargs#1{% |
| 491 |
\@ifnextchar[%] |
| 492 |
{\caption@@@withoptargs{#1}}% |
| 493 |
{\caption@@@@withoptargs{#1}}} |
| 494 |
% \end{macrocode} |
| 495 |
% \begin{macrocode} |
| 496 |
\def\caption@@@withoptargs#1[#2]{% |
| 497 |
\l@addto@macro\caption@tempa{[{#2}]}% |
| 498 |
\caption@@withoptargs{#1}} |
| 499 |
% \end{macrocode} |
| 500 |
% \begin{macrocode} |
| 501 |
\def\caption@@@@withoptargs#1{% |
| 502 |
\def\caption@tempb{#1}% |
| 503 |
\expandafter\caption@tempb\expandafter{\caption@tempa}} |
| 504 |
% \end{macrocode} |
| 505 |
% \end{macro} |
| 506 |
% |
| 507 |
% \begin{macro}{\caption@gobble} |
| 508 |
% \changes{v1.4}{2011/08/19}{This macro added} |
| 509 |
% |\caption@gobble*|\oarg{arg}\oarg{\ldots}\marg{arg}\par |
| 510 |
% Same as |\@gobble|, but gobbles optional arguments as well. |
| 511 |
% \begin{macrocode} |
| 512 |
\DeclareRobustCommand*\caption@gobble{% |
| 513 |
\caption@withoptargs\@gobbletwo} |
| 514 |
% \end{macrocode} |
| 515 |
% \end{macro} |
| 516 |
% |
| 517 |
% \begin{macro}{\caption@AtBeginDocument} |
| 518 |
% \changes{v1.1}{2007/04/13}{This macro and its usage added} |
| 519 |
% \changes{v1.2e}{2010/01/09}{Adapted to the combine document class} |
| 520 |
% |\caption@AtBeginDocument*|\marg{code}\\ |
| 521 |
% Same as |\AtBeginDocument| but the execution of code |
| 522 |
% will be surrounded by two |\PackageInfo|s. |
| 523 |
% The starred variant causes the code to be executed after all code |
| 524 |
% specified using the non-starred variant. |
| 525 |
% \begin{macrocode} |
| 526 |
\let\caption@begindocumenthook\@empty |
| 527 |
\let\caption@@begindocumenthook\@empty |
| 528 |
% \end{macrocode} |
| 529 |
% \begin{macrocode} |
| 530 |
\def\caption@AtBeginDocument{% |
| 531 |
\caption@teststar\g@addto@macro |
| 532 |
\caption@@begindocumenthook\caption@begindocumenthook} |
| 533 |
%\@onlypreamble\caption@AtBeginDocument |
| 534 |
% \end{macrocode} |
| 535 |
% \begin{macrocode} |
| 536 |
\AtBeginDocument{% |
| 537 |
\caption@InfoNoLine{Begin \noexpand\AtBeginDocument code}% |
| 538 |
% \end{macrocode} |
| 539 |
% \begin{macrocode} |
| 540 |
\def\caption@AtBeginDocument{% |
| 541 |
\@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}% |
| 542 |
\caption@begindocumenthook |
| 543 |
\let\caption@begindocumenthook\relax |
| 544 |
% \end{macrocode} |
| 545 |
% \begin{macrocode} |
| 546 |
\def\caption@AtBeginDocument{% |
| 547 |
\@ifstar\@firstofone\@firstofone}% |
| 548 |
\caption@@begindocumenthook |
| 549 |
\let\caption@@begindocumenthook\relax |
| 550 |
% \end{macrocode} |
| 551 |
% \begin{macrocode} |
| 552 |
\caption@InfoNoLine{End \noexpand\AtBeginDocument code}} |
| 553 |
% \end{macrocode} |
| 554 |
% \end{macro} |
| 555 |
% |
| 556 |
% \section{Information, Warnings, and Errors} |
| 557 |
% |
| 558 |
% \begin{macro}{\caption@Info} |
| 559 |
% \changes{v1.3}{2010/10/25}{Moved from package to kernel} |
| 560 |
% |\caption@Info|\marg{message} |
| 561 |
% \begin{macrocode} |
| 562 |
\newcommand*\caption@Info[1]{% |
| 563 |
\PackageInfo{caption}{#1}} |
| 564 |
% \end{macrocode} |
| 565 |
% \end{macro} |
| 566 |
% \begin{macro}{\caption@InfoNoLine} |
| 567 |
% \changes{v1.3}{2010/10/25}{Moved from package to kernel} |
| 568 |
% |\caption@InfoNoLine|\marg{message}\\ |
| 569 |
% \Note{The \cs{@gobble} at the end of the 2nd argument of |
| 570 |
% \cs{PackageInfo} suppresses the line number info. |
| 571 |
% See TLC2\cite{TLC2}, A.4.7, p885 for details.} |
| 572 |
% \begin{macrocode} |
| 573 |
\newcommand*\caption@InfoNoLine[1]{% |
| 574 |
\caption@Info{#1\@gobble}} |
| 575 |
% \end{macrocode} |
| 576 |
% \end{macro} |
| 577 |
% |
| 578 |
% \begin{macro}{\caption@Warning} |
| 579 |
% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings} |
| 580 |
% |\caption@Warning|\marg{message} |
| 581 |
% \begin{macrocode} |
| 582 |
\newcommand*\caption@Warning[1]{% |
| 583 |
\caption@WarningNoLine{#1\on@line}} |
| 584 |
% \end{macrocode} |
| 585 |
% \end{macro} |
| 586 |
% \begin{macro}{\caption@WarningNoLine} |
| 587 |
% \changes{v1.1c}{2007/10/14}{This macro added, will now be used for warnings} |
| 588 |
% |\caption@WarningNoLine|\marg{message} |
| 589 |
% \begin{macrocode} |
| 590 |
\newcommand*\caption@WarningNoLine[1]{% |
| 591 |
\PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}} |
| 592 |
% \end{macrocode} |
| 593 |
% \begin{macrocode} |
| 594 |
\newcommand*\caption@wh{% |
| 595 |
See the caption package documentation for explanation.} |
| 596 |
% \end{macrocode} |
| 597 |
% \end{macro} |
| 598 |
% |
| 599 |
% \begin{macro}{\caption@Error} |
| 600 |
% \changes{v1.0j}{2007/01/20}{This macro added, will now be used for errors} |
| 601 |
% \changes{v1.0o}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}} |
| 602 |
% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed} |
| 603 |
% |\caption@Error|\marg{message} |
| 604 |
% \begin{macrocode} |
| 605 |
\newcommand*\caption@Error[1]{% |
| 606 |
\PackageError{caption}{#1}\caption@eh} |
| 607 |
% \end{macrocode} |
| 608 |
% \begin{macrocode} |
| 609 |
\newcommand*\caption@eh{% |
| 610 |
If you do not understand this error, please take a closer look\MessageBreak |
| 611 |
at the documentation of the `caption' package, especially the\MessageBreak |
| 612 |
section about errors.\MessageBreak\@ehc} |
| 613 |
% \end{macrocode} |
| 614 |
% \end{macro} |
| 615 |
% |
| 616 |
% \begin{macro}{\caption@KV@err} |
| 617 |
% \changes{v1.1b}{2007/09/18}{This macro added} |
| 618 |
% \begin{macrocode} |
| 619 |
\let\caption@KV@err\caption@Error |
| 620 |
% \end{macrocode} |
| 621 |
% \end{macro} |
| 622 |
% |
| 623 |
% \section{Using the keyval package} |
| 624 |
% |
| 625 |
% We need the \package{keyval} package for option handling, so we load it here. |
| 626 |
% \begin{macrocode} |
| 627 |
\RequirePackage{keyval}[1997/11/10] |
| 628 |
% \end{macrocode} |
| 629 |
% |
| 630 |
% \begin{macro}{\undefine@key} |
| 631 |
% |\undefine@key|\marg{family}\marg{key}\par |
| 632 |
% This helper macro is the opposite of |\define@key|, it removes a keyval |
| 633 |
% definition. |
| 634 |
% \begin{macrocode} |
| 635 |
\providecommand*\undefine@key[2]{% |
| 636 |
\@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}} |
| 637 |
% \end{macrocode} |
| 638 |
% \end{macro} |
| 639 |
% |
| 640 |
% \begin{macro}{\@onlypreamble@key} |
| 641 |
% \changes{v1.1}{2007/07/22}{This macro added} |
| 642 |
% \changes{v1.1e}{2007/11/01}{\cs{KV@err} will be used now instead of \cs{@notprerr}} |
| 643 |
% |\onlypreamble@key|\marg{family}\marg{key}\par |
| 644 |
% Analogous to |\@onlypreamble| from \LaTeXe. |
| 645 |
% \begin{macrocode} |
| 646 |
\providecommand*\@preamble@keys{} |
| 647 |
\providecommand*\@onlypreamble@key[2]{\@cons\@preamble@keys{{#1}{#2}}} |
| 648 |
\@onlypreamble\@onlypreamble@key |
| 649 |
\@onlypreamble\@preamble@keys |
| 650 |
% \end{macrocode} |
| 651 |
% \begin{macrocode} |
| 652 |
\providecommand*\@notprerr@key[1]{\KV@err{Can be used only in preamble}} |
| 653 |
% \end{macrocode} |
| 654 |
% \begin{macrocode} |
| 655 |
\caption@AtBeginDocument*{% |
| 656 |
\def\@elt#1#2{\expandafter\let\csname KV@#1@#2\endcsname\@notprerr@key}% |
| 657 |
\@preamble@keys |
| 658 |
\let\@elt\relax} |
| 659 |
% \end{macrocode} |
| 660 |
% \end{macro} |
| 661 |
% |
| 662 |
% \begin{macro}{\DeclareCaptionOption} |
| 663 |
% |\DeclareCaptionOption|\marg{option}\oarg{default value}\marg{code}\\ |
| 664 |
% |\DeclareCaptionOption*|\marg{option}\oarg{default value}\marg{code}\par |
| 665 |
% We declare our options using these commands (instead of using |
| 666 |
% |\DeclareOption| offered by \LaTeXe), so the keyval package is used. |
| 667 |
% The starred form makes the option available during the lifetime of the |
| 668 |
% current package only, so they can be used with |\usepackage|, but |
| 669 |
% \emph{not} with |\captionsetup| later on. |
| 670 |
% \begin{macrocode} |
| 671 |
\newcommand*\DeclareCaptionOption{% |
| 672 |
\caption@teststar\caption@declareoption\AtEndOfPackage\@gobble} |
| 673 |
\@onlypreamble\DeclareCaptionOption |
| 674 |
% \end{macrocode} |
| 675 |
% \begin{macrocode} |
| 676 |
\newcommand*\caption@declareoption[2]{% |
| 677 |
#1{\undefine@key{caption}{#2}}\caption@declare@option{#2}} |
| 678 |
\@onlypreamble\caption@declareoption |
| 679 |
% \end{macrocode} |
| 680 |
% \begin{macrocode} |
| 681 |
\newcommand*\caption@declare@option{% |
| 682 |
\define@key{caption}} |
| 683 |
%% no \@onlypreamble\caption@declare@option, will be used by \captionsetup |
| 684 |
% \end{macrocode} |
| 685 |
% \end{macro} |
| 686 |
% |
| 687 |
% \begin{macro}{\DeclareCaptionOptionNoValue} |
| 688 |
% \changes{v1.1c}{2007/10/06}{This macro added} |
| 689 |
% |\DeclareCaptionOptionNoValue|\marg{option}\marg{code}\\ |
| 690 |
% |\DeclareCaptionOptionNoValue*|\marg{option}\marg{code}\par |
| 691 |
% Same as \cs{DeclareCaptionOption} but issues an error if a value is given. |
| 692 |
% \begin{macrocode} |
| 693 |
\newcommand*\DeclareCaptionOptionNoValue{% |
| 694 |
\caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble} |
| 695 |
\@onlypreamble\DeclareCaptionOptionNoValue |
| 696 |
% \end{macrocode} |
| 697 |
% \begin{macrocode} |
| 698 |
\newcommand\caption@declareoption@novalue[3]{% |
| 699 |
\caption@declareoption{#1}{#2}[\KV@err]{% |
| 700 |
\caption@option@novalue{#2}{##1}{#3}}} |
| 701 |
\@onlypreamble\caption@declareoption@novalue |
| 702 |
% \end{macrocode} |
| 703 |
% \begin{macrocode} |
| 704 |
\newcommand*\caption@option@novalue[2]{% |
| 705 |
\ifx\KV@err#2% |
| 706 |
\expandafter\@firstofone |
| 707 |
\else |
| 708 |
\KV@err{No value allowed for #1}% |
| 709 |
\expandafter\@gobble |
| 710 |
\fi} |
| 711 |
% \end{macrocode} |
| 712 |
% \end{macro} |
| 713 |
% |
| 714 |
% \begin{macro}{\ifcaptionsetup@star} |
| 715 |
% \changes{v1.2a}{2008/01/12}{This macro added} |
| 716 |
% If the starred form of |\captionsetup| is used, this will be set to |true|. |
| 717 |
% (It will be reset to |false| at the end of |\caption@setkeys|.) |
| 718 |
% \begin{macrocode} |
| 719 |
\newif\ifcaptionsetup@star |
| 720 |
% \end{macrocode} |
| 721 |
% \end{macro} |
| 722 |
% |
| 723 |
% \begin{macro}{\captionsetup} |
| 724 |
% \changes{v1.0a}{2004/01/17}{Bugfix: Missing \% added} |
| 725 |
% \changes{v1.1}{2007/07/22}{Starred-variant added} |
| 726 |
% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically} |
| 727 |
% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added} |
| 728 |
% \changes{v1.2a}{2008/01/12}{\cs{ifcaptionsetup@star} will be set now} |
| 729 |
% \changes{v1.5}{2012/04/09}{Support of multiple optional arguments added} |
| 730 |
% \changes{v1.8h}{2020/01/03}{Syntax check of saved options added} |
| 731 |
% \changes{v1.13a}{2022/03/17}{Usage of \cs{captionsetup} inside \cs{caption@setup@options@@} replaced by \cs{caption@setup@options@}} |
| 732 |
% |\captionsetup|\oarg{type}\ldots\marg{keyval-list of options}\\ |
| 733 |
% |\captionsetup*|\oarg{type}\ldots\marg{keyval-list of options}\par |
| 734 |
% If the optional argument `type' is specified, we simply save or append |
| 735 |
% the option list, otherwise we `execute' it with |\setkeys|. |
| 736 |
% (The non-starred variant issues a warning if \meta{keyval-list of options} |
| 737 |
% is not used later on.) |
| 738 |
% \Note{The starred variant will be used inside packages automatically.} |
| 739 |
% \begin{macrocode} |
| 740 |
\newcommand*\captionsetup{% |
| 741 |
\caption@teststar@\@captionsetup\@gobble\@firstofone} |
| 742 |
% \end{macrocode} |
| 743 |
% \begin{macrocode} |
| 744 |
\newcommand*\@captionsetup[1]{% |
| 745 |
\captionsetup@startrue#1\captionsetup@starfalse |
| 746 |
\@ifnextchar[%] |
| 747 |
\caption@setup@options\caption@setup} |
| 748 |
% \end{macrocode} |
| 749 |
% \begin{macrocode} |
| 750 |
\newcommand*\caption@setup{% |
| 751 |
\caption@setkeys{caption}} |
| 752 |
% \end{macrocode} |
| 753 |
% \begin{macrocode} |
| 754 |
\def\caption@setup@options[#1]{% |
| 755 |
\@ifnextchar[%] |
| 756 |
{\caption@stepthecounter |
| 757 |
\@expandtwoargs\caption@setup@options@@{#1}{@\caption@thecounter}}% |
| 758 |
{\caption@setup@options@{#1}}} |
| 759 |
% \end{macrocode} |
| 760 |
% \begin{macrocode} |
| 761 |
\def\caption@setup@options@@#1#2[#3]#4{% |
| 762 |
\caption@declare@option{#2}[]{\caption@setup@options@{#3}{#4}}% |
| 763 |
\caption@setup@options@{#1}{#2}} |
| 764 |
% \end{macrocode} |
| 765 |
% \begin{macrocode} |
| 766 |
\newcommand*\caption@setup@options@[2]{% |
| 767 |
\@bsphack |
| 768 |
\ifcaptionsetup@star\captionsetup@starfalse\else\caption@addtooptlist{#1}\fi |
| 769 |
\caption@checkoptions{#2}% |
| 770 |
\expandafter\caption@l@addto@list\csname caption@opt@#1\endcsname{#2}% |
| 771 |
\@esphack} |
| 772 |
% \end{macrocode} |
| 773 |
% \end{macro} |
| 774 |
% |
| 775 |
% \begin{macro}{\caption@checkoptions} |
| 776 |
% \changes{v1.8h}{2020/01/03}{This macro added} |
| 777 |
% Check the syntax of the given options by executing them inside a group. |
| 778 |
% \begin{macrocode} |
| 779 |
\newcommand*\caption@checkoptions[1]{% |
| 780 |
\begingroup |
| 781 |
\caption@prepare@optioncheck |
| 782 |
\caption@setup{#1}% |
| 783 |
\endgroup} |
| 784 |
% \end{macrocode} |
| 785 |
% \begin{macrocode} |
| 786 |
\providecommand*\caption@prepare@optioncheck{} |
| 787 |
% \end{macrocode} |
| 788 |
% \end{macro} |
| 789 |
% |
| 790 |
% \begin{macro}{\IfCaptionOptionCheck} |
| 791 |
% \changes{v1.10}{2020/05/10}{This macro added} |
| 792 |
% |\IfCaptionOptionCheck|\marg{yes-code}\marg{no-code} |
| 793 |
% executes the \meta{yes-code} if options are just checked for syntax, and \meta{no-code} if not. |
| 794 |
% \begin{macrocode} |
| 795 |
\let\IfCaptionOptionCheck\@secondoftwo |
| 796 |
% \end{macrocode} |
| 797 |
% \begin{macrocode} |
| 798 |
\g@addto@macro\caption@prepare@optioncheck{% |
| 799 |
\let\IfCaptionOptionCheck\@firstoftwo} |
| 800 |
% \end{macrocode} |
| 801 |
% \end{macro} |
| 802 |
% |
| 803 |
% \begin{macro}{\clearcaptionsetup} |
| 804 |
% \changes{v1.1}{2007/07/29}{Optional argument added} |
| 805 |
% \changes{v1.1}{2007/08/17}{Starred variant added} |
| 806 |
% \changes{v1.1e}{2007/07/27}{Inside packages the starred variant will be used automatically} |
| 807 |
% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added} |
| 808 |
% |\clearcaptionsetup|\oarg{option}\marg{type}\\ |
| 809 |
% |\clearcaptionsetup*|\oarg{option}\marg{type}\par |
| 810 |
% This removes the saved option list associated with \meta{type}. |
| 811 |
% If \meta{option} is given, only this option will be removed from the list. |
| 812 |
% (The starred variant does not issue warnings.) |
| 813 |
% \Note{The starred variant will be used inside packages automatically.} |
| 814 |
% \begin{macrocode} |
| 815 |
\newcommand*\clearcaptionsetup{% |
| 816 |
\caption@teststar@\@clearcaptionsetup\@gobble\@firstofone} |
| 817 |
% \end{macrocode} |
| 818 |
% \begin{macrocode} |
| 819 |
\newcommand*\@clearcaptionsetup[1]{% |
| 820 |
\let\caption@tempa#1% |
| 821 |
\@testopt\@@clearcaptionsetup{}} |
| 822 |
% \end{macrocode} |
| 823 |
% \begin{macrocode} |
| 824 |
\def\@@clearcaptionsetup[#1]#2{% |
| 825 |
\@bsphack |
| 826 |
\expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname |
| 827 |
{\caption@tempa{\caption@Warning{Option list `#2' undefined}}}% |
| 828 |
{\ifx,#1,% |
| 829 |
\caption@clearsetup{#2}% |
| 830 |
\else |
| 831 |
\caption@@removefromsetup{#1}{#2}% |
| 832 |
\fi}% |
| 833 |
\@esphack} |
| 834 |
% \end{macrocode} |
| 835 |
% \begin{macrocode} |
| 836 |
\newcommand*\caption@clearsetup[1]{% |
| 837 |
\caption@removefromoptlist{#1}% |
| 838 |
\@nameundef{caption@opt@#1}} |
| 839 |
% \end{macrocode} |
| 840 |
% \begin{macrocode} |
| 841 |
\newcommand*\caption@removefromsetup{% |
| 842 |
\let\caption@tempa\@gobble |
| 843 |
\caption@@removefromsetup} |
| 844 |
% \end{macrocode} |
| 845 |
% \begin{macrocode} |
| 846 |
\newcommand*\caption@@removefromsetup[2]{% |
| 847 |
\expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname |
| 848 |
\expandafter\let\csname caption@opt@#2\endcsname\@undefined |
| 849 |
\def\@tempb##1=##2\@nil{##1}% |
| 850 |
\edef\@tempc{#1}% |
| 851 |
\@for\@tempa:=\@tempa\do{% |
| 852 |
\edef\@tempd{\expandafter\@tempb\@tempa=\@nil}% |
| 853 |
\ifx\@tempd\@tempc |
| 854 |
\let\caption@tempa\@gobble |
| 855 |
\else |
| 856 |
\expandafter\expandafter\expandafter\caption@l@addto@list |
| 857 |
\expandafter\csname caption@opt@#2\expandafter\endcsname |
| 858 |
\expandafter{\@tempa}% |
| 859 |
\fi}% |
| 860 |
\expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname |
| 861 |
{\caption@removefromoptlist{#2}}{}% |
| 862 |
\caption@tempa{\caption@Warning{% |
| 863 |
Option `#1' was not in list `#2'}}} |
| 864 |
% \end{macrocode} |
| 865 |
% \end{macro} |
| 866 |
% |
| 867 |
% \begin{macro}{\showcaptionsetup} |
| 868 |
% \changes{v1.0d}{2005/05/03}{Optimized for memory usage} |
| 869 |
% \changes{v1.1}{2007/07/29}{Bugfix: Does not expand option list anymore} |
| 870 |
% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added} |
| 871 |
% |\showcaptionsetup|\oarg{package}\marg{type}\par |
| 872 |
% This comes for debugging issues: It shows the saved option list which |
| 873 |
% is associated with \meta{type}. |
| 874 |
% \begin{macrocode} |
| 875 |
\newcommand*\showcaptionsetup[2][\@firstofone]{% |
| 876 |
\@bsphack |
| 877 |
\GenericWarning{}{% |
| 878 |
#1 Caption Info: Option list on `#2'\MessageBreak |
| 879 |
#1 Caption Data: \@ifundefined{caption@opt@#2}{% |
| 880 |
-none-% |
| 881 |
}{% |
| 882 |
{\expandafter\expandafter\expandafter\strip@prefix |
| 883 |
\expandafter\meaning\csname caption@opt@#2\endcsname}% |
| 884 |
}}% |
| 885 |
\@esphack} |
| 886 |
% \end{macrocode} |
| 887 |
% \end{macro} |
| 888 |
% |
| 889 |
% \changes{v1.1}{2007/07/02}{Option \opt{options=} added} |
| 890 |
% \changes{v1.3}{2010/09/05}{Option \opt{options*=} added} |
| 891 |
% \changes{v1.4b}{2012/01/12}{Option \opt{options*=} removed} |
| 892 |
% \begin{macrocode} |
| 893 |
\DeclareCaptionOption{options}{\caption@setoptions{#1}} |
| 894 |
% \end{macrocode} |
| 895 |
% |
| 896 |
% \begin{macro}{\caption@setoptions} |
| 897 |
% \changes{v1.0g}{2006/01/03}{Optional argument added} |
| 898 |
% \changes{v1.0h}{2006/01/26}{Revised} |
| 899 |
% \changes{v1.0j}{2007/01/30}{Optional argument removed} |
| 900 |
% \changes{v1.1}{2007/04/11}{Usage of \cs{clearcaptionsetup} added} |
| 901 |
% \changes{v1.1}{2007/05/09}{Renamed from \cs{caption@settype} to \cs{caption@setoptions}} |
| 902 |
% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed} |
| 903 |
% \changes{v1.3}{2010/09/05}{Starred variant added} |
| 904 |
% \changes{v1.4b}{2012/01/12}{Starred variant removed} |
| 905 |
% |\caption@setoptions|\marg{type or environment or\ldots}\par |
| 906 |
% Caption options which have been saved with |\captionsetup|\oarg{type} can |
| 907 |
% be executed by using this command. |
| 908 |
% It simply executes the saved option list (and clears it afterwards), |
| 909 |
% if there is any. |
| 910 |
% \iffalse |
| 911 |
% (The starred variant do not clear the option list.) |
| 912 |
% \fi |
| 913 |
% \begin{macrocode} |
| 914 |
\newcommand*\caption@setoptions[1]{% |
| 915 |
\caption@Debug{options=#1}% |
| 916 |
\expandafter\let\expandafter\caption@opt\csname caption@opt@#1\endcsname |
| 917 |
\ifx\caption@opt\relax \else |
| 918 |
\caption@xsetup\caption@opt |
| 919 |
\caption@clearsetup{#1}% |
| 920 |
\fi} |
| 921 |
% \end{macrocode} |
| 922 |
% \begin{macrocode} |
| 923 |
\newcommand*\caption@xsetup[1]{\expandafter\caption@setup\expandafter{#1}} |
| 924 |
% \end{macrocode} |
| 925 |
% \end{macro} |
| 926 |
% |
| 927 |
% \begin{macro}{\caption@addtooptlist} |
| 928 |
% \changes{v1.1}{2007/07/22}{This macro added} |
| 929 |
% \begin{macro}{\caption@removefromoptlist} |
| 930 |
% \changes{v1.1}{2007/07/22}{This macro added} |
| 931 |
% \changes{v1.2c}{2008/08/24}{Fatal typo corrected} |
| 932 |
% |\caption@addtooptlist|\marg{type}\\ |
| 933 |
% |\caption@removefromoptlist|\marg{type}\par |
| 934 |
% Adds or removes an \meta{type} to the list of unused caption options. |
| 935 |
% Note that the catcodes of \meta{type} are sanitized here so removing |
| 936 |
% \meta{type} from the list do not fail when the \package{float} package |
| 937 |
% is used (since |\float@getstyle| gives a result which tokens have catcode |
| 938 |
% 12 $=$ ``other''). |
| 939 |
% \begin{macrocode} |
| 940 |
\newcommand*\caption@addtooptlist[1]{% |
| 941 |
\@ifundefined{caption@opt@#1@lineno}{% |
| 942 |
\caption@dooptlist\caption@g@addto@list{#1}% |
| 943 |
\expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}% |
| 944 |
}{}} |
| 945 |
% \end{macrocode} |
| 946 |
% \begin{macrocode} |
| 947 |
\newcommand*\caption@removefromoptlist[1]{% |
| 948 |
\caption@dooptlist\caption@g@removefrom@list{#1}% |
| 949 |
\global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined} |
| 950 |
% \end{macrocode} |
| 951 |
% \begin{macrocode} |
| 952 |
\newcommand*\caption@dooptlist[2]{% |
| 953 |
\begingroup |
| 954 |
\edef\@tempa{#2}\@onelevel@sanitize\@tempa |
| 955 |
\expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}% |
| 956 |
\endgroup} |
| 957 |
% \end{macrocode} |
| 958 |
% \begin{macrocode} |
| 959 |
\AtEndDocument{% |
| 960 |
\caption@for@list\caption@optlist{% |
| 961 |
\caption@WarningNoLine{% |
| 962 |
Unused \string\captionsetup[#1] |
| 963 |
on input line \csname caption@opt@#1@lineno\endcsname}}} |
| 964 |
% \end{macrocode} |
| 965 |
% \end{macro} |
| 966 |
% \end{macro} |
| 967 |
% |
| 968 |
% \begin{macro}{\caption@setkeys} |
| 969 |
% \changes{v1.0g}{2006/01/03}{This macro added} |
| 970 |
% \changes{v1.0j}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added} |
| 971 |
% \changes{v1.0j}{2007/01/30}{Optional argument added} |
| 972 |
% \changes{v1.0n}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter} |
| 973 |
% \changes{v1.1b}{2007/09/18}{Usage of \cs{caption@Package} removed, we use \cs{caption@KV@err} instead} |
| 974 |
% \changes{v1.2}{2007/11/16}{Bugfix 07-11-09: `space hack' added} |
| 975 |
% \changes{v1.2a}{2008/01/12}{\cs{captionsetup@starfalse} added} |
| 976 |
% \changes{v1.2d}{2009/09/30}{Bugfix 09-09-29: Missing error handler will be defined automatically} |
| 977 |
% \changes{v1.4}{2011/08/24}{Redefinition of \cs{XKV@err} added} |
| 978 |
% |\caption@setkeys|\oarg{package}\marg{family}\marg{key-values}\par |
| 979 |
% This one simply calls |\setkeys|\marg{family}\marg{key-values} |
| 980 |
% but lets the error messages not refer to the \package{keyval} package, |
| 981 |
% but to the \meta{package} package instead. |
| 982 |
% \begin{macrocode} |
| 983 |
\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys} |
| 984 |
% \end{macrocode} |
| 985 |
% \begin{macrocode} |
| 986 |
\long\def\caption@@setkeys[#1]#2#3{% |
| 987 |
\@bsphack |
| 988 |
% \end{macrocode} |
| 989 |
% \begin{macrocode} |
| 990 |
\expandafter\let\csname ORI@KV@err\caption@keydepth\endcsname\KV@err |
| 991 |
\expandafter\let\csname ORI@KV@errx\caption@keydepth\endcsname\KV@errx |
| 992 |
\expandafter\let\csname ORI@XKV@err\caption@keydepth\endcsname\XKV@err |
| 993 |
\edef\caption@keydepth{\caption@keydepth i}% |
| 994 |
% \end{macrocode} |
| 995 |
% \begin{macrocode} |
| 996 |
\expandafter\let\expandafter\KV@err\csname #1@KV@err\endcsname |
| 997 |
\ifx\KV@err\relax |
| 998 |
\def\KV@err##1{\PackageError{#1}{##1}{% |
| 999 |
See the #1 package documentation for explanation.}}% |
| 1000 |
\fi |
| 1001 |
\def\KV@errx{\KV@err}% |
| 1002 |
\def\XKV@err{\let\@tempa\XKV@tkey\KV@err}% |
| 1003 |
% \end{macrocode} |
| 1004 |
% \begin{macrocode} |
| 1005 |
\caption@Debug{\protect\setkeys{#2}{#3}}% |
| 1006 |
\setkeys{#2}{#3}% |
| 1007 |
% \end{macrocode} |
| 1008 |
% \begin{macrocode} |
| 1009 |
\edef\caption@keydepth{\expandafter\@gobble\caption@keydepth}% |
| 1010 |
\expandafter\let\expandafter\KV@err\csname ORI@KV@err\caption@keydepth\endcsname |
| 1011 |
\expandafter\let\expandafter\KV@errx\csname ORI@KV@errx\caption@keydepth\endcsname |
| 1012 |
\expandafter\let\expandafter\XKV@err\csname ORI@XKV@err\caption@keydepth\endcsname |
| 1013 |
% \end{macrocode} |
| 1014 |
% \begin{macrocode} |
| 1015 |
\ifx\caption@keydepth\@empty \captionsetup@starfalse \fi |
| 1016 |
% \end{macrocode} |
| 1017 |
% \begin{macrocode} |
| 1018 |
\@esphack} |
| 1019 |
% \end{macrocode} |
| 1020 |
% \begin{macrocode} |
| 1021 |
\let\caption@keydepth\@empty |
| 1022 |
% \end{macrocode} |
| 1023 |
% \end{macro} |
| 1024 |
% |
| 1025 |
% \begin{macro}{\caption@ExecuteOptions} |
| 1026 |
% \changes{v1.1}{2007/07/15}{This macro added} |
| 1027 |
% \changes{v1.3}{2010/09/04}{Depends on package now} |
| 1028 |
% |\caption@ExecuteOptions|\marg{package}\marg{key-values}\par |
| 1029 |
% We execute our options using the keyval interface, so we use this one |
| 1030 |
% instead of |\ExecuteOptions| offered by \LaTeXe. |
| 1031 |
% \begin{macrocode} |
| 1032 |
\newcommand*\caption@ExecuteOptions[2]{% |
| 1033 |
\expandafter\@expandtwoargs\csname caption@setkeys@#1\endcsname{#1}{#2}}% |
| 1034 |
\@onlypreamble\caption@ExecuteOptions |
| 1035 |
% \end{macrocode} |
| 1036 |
% \end{macro} |
| 1037 |
% |
| 1038 |
% \begin{macro}{\caption@ProcessOptions} |
| 1039 |
% \changes{v1.0a}{2004/01/23}{Bugfix, see |
| 1040 |
% \purett{news:[email protected]} for details} |
| 1041 |
% \changes{v1.0g}{2006/01/03}{Improvement, uses \cs{caption@setkeys} |
| 1042 |
% instead of \cs{setkeys}} |
| 1043 |
% \changes{v1.0h}{2006/02/23}{Bugfix, now processes only those global |
| 1044 |
% options which have a default value} |
| 1045 |
% \changes{v1.0j}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to |
| 1046 |
% \cs{caption@ProcessOptions} and moved from the package to the kernel} |
| 1047 |
% \changes{v1.1}{2007/04/17}{Star variant added} |
| 1048 |
% |\caption@ProcessOptions*|\marg{package}\par |
| 1049 |
% We process our options using the keyval package, so we use this one |
| 1050 |
% instead of |\ProcessOptions| offered by \LaTeXe. |
| 1051 |
% The starred variant do not process the global options. |
| 1052 |
% (This code was taken from the \package{hyperref} package\cite{hyperref} |
| 1053 |
% \version{6.74} and improved.) |
| 1054 |
% \begin{macrocode} |
| 1055 |
\newcommand*\caption@ProcessOptions{% |
| 1056 |
\caption@teststar\caption@@ProcessOptions\@gobble\@firstofone} |
| 1057 |
\@onlypreamble\caption@ProcessOptions |
| 1058 |
% \end{macrocode} |
| 1059 |
% \begin{macrocode} |
| 1060 |
\newcommand\caption@@ProcessOptions[2]{% |
| 1061 |
\let\@tempc\relax |
| 1062 |
\let\caption@tempa\@empty |
| 1063 |
#1{% \@firstofone -or- \@gobble |
| 1064 |
\@for\CurrentOption:=\@classoptionslist\do{% |
| 1065 |
\@ifundefined{KV@#2@\CurrentOption}{}{% |
| 1066 |
\@ifundefined{KV@#2@\CurrentOption @default}{% |
| 1067 |
\PackageInfo{#2}{Global option `\CurrentOption' ignored}% |
| 1068 |
}{% |
| 1069 |
\PackageInfo{#2}{Global option `\CurrentOption' processed}% |
| 1070 |
\edef\caption@tempa{\caption@tempa\CurrentOption,}% |
| 1071 |
\@expandtwoargs\@removeelement\CurrentOption |
| 1072 |
\@unusedoptionlist\@unusedoptionlist |
| 1073 |
}% |
| 1074 |
}% |
| 1075 |
}% |
| 1076 |
\let\CurrentOption\@empty |
| 1077 |
}% |
| 1078 |
\caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}% |
| 1079 |
\AtEndOfPackage{\let\@unprocessedoptions\relax}} |
| 1080 |
\@onlypreamble\caption@@ProcessOptions |
| 1081 |
% \end{macrocode} |
| 1082 |
% \end{macro} |
| 1083 |
% |
| 1084 |
% \begin{macro}{\caption@SetupOptions} |
| 1085 |
% \changes{v1.3}{2010/09/04}{This macro added} |
| 1086 |
% |\caption@SetupOptions|\marg{package}\marg{code}\par |
| 1087 |
% After calling this macro |\caption@ExecuteOptions| and |
| 1088 |
% |\usepackage|\oarg{options}\marg{package} |
| 1089 |
% will both be mapped to \meta{code} with \meta{package} and \meta{options} |
| 1090 |
% as arguments |#1| and |#2|. (This helps avoiding ``Option clash'' errors.) |
| 1091 |
% \begin{macrocode} |
| 1092 |
\newcommand\caption@SetupOptions[2]{% |
| 1093 |
\@namedef{caption@setkeys@#1}##1##2{#2}% |
| 1094 |
\expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname |
| 1095 |
\@cons\caption@SetupOptions@list{{#1}}} |
| 1096 |
\@onlypreamble\caption@SetupOptions |
| 1097 |
% \end{macrocode} |
| 1098 |
% \begin{macrocode} |
| 1099 |
\newcommand*\caption@SetupOptions@list{} |
| 1100 |
\@onlypreamble\caption@SetupOptions@list |
| 1101 |
% \end{macrocode} |
| 1102 |
% \begin{macrocode} |
| 1103 |
\let\caption@onefilewithoptions\@onefilewithoptions |
| 1104 |
\def\@onefilewithoptions#1[#2]{% |
| 1105 |
\begingroup |
| 1106 |
\def\@tempa{% |
| 1107 |
\endgroup |
| 1108 |
\caption@onefilewithoptions{#1}[{#2}]}% |
| 1109 |
\def\@tempb{#1}% |
| 1110 |
\def\@elt##1{% |
| 1111 |
\def\@tempc{##1}% |
| 1112 |
\ifx\@tempb\@tempc |
| 1113 |
\def\@tempa{% |
| 1114 |
\endgroup |
| 1115 |
\caption@ExecuteOptions{#1}{#2}% |
| 1116 |
\caption@onefilewithoptions{#1}[]}% |
| 1117 |
\fi} |
| 1118 |
\caption@SetupOptions@list |
| 1119 |
\@tempa} |
| 1120 |
\@onlypreamble\caption@onefilewithoptions |
| 1121 |
% \end{macrocode} |
| 1122 |
% \end{macro} |
| 1123 |
% |
| 1124 |
% \section{Margin resp. width} |
| 1125 |
% \changes{v1.0n}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}} |
| 1126 |
% \changes{v1.0n}{2007/04/03}{Option `twoside' added} |
| 1127 |
% \changes{v1.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added} |
| 1128 |
% \changes{v1.2}{2007/11/10}{Option `oneside' added} |
| 1129 |
% |
| 1130 |
% \begin{macro}{\captionmargin} |
| 1131 |
% \begin{macro}{\captionwidth} |
| 1132 |
% |\captionmargin| and |\captionwidth| contain the extra margin |
| 1133 |
% resp. the total width used for captions. Please never set these values in |
| 1134 |
% a direct way, they are just accessible in user documents to provide |
| 1135 |
% compatibility to \version{1.x}.\par |
| 1136 |
% Note that we can only set one value at a time, `margin' \emph{or} `width'. |
| 1137 |
% If |\captionwidth| is not zero we will take this value afterwards, |
| 1138 |
% otherwise |\captionmargin| and |\captionmargin@|. |
| 1139 |
% \begin{macrocode} |
| 1140 |
\newdimen\captionmargin |
| 1141 |
\newdimen\captionmargin@ |
| 1142 |
\newdimen\captionwidth |
| 1143 |
\newdimen\caption@tempdima |
| 1144 |
% \end{macrocode} |
| 1145 |
% \end{macro} |
| 1146 |
% \end{macro} |
| 1147 |
% |
| 1148 |
% \begin{macrocode} |
| 1149 |
\DeclareCaptionOption{margin}{\setcaptionmargin{#1}} |
| 1150 |
\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}} |
| 1151 |
\DeclareCaptionOption{width}{\setcaptionwidth{#1}} |
| 1152 |
\DeclareCaptionOption{width*}{\setcaptionwidth*{#1}} |
| 1153 |
% \end{macrocode} |
| 1154 |
% \begin{macrocode} |
| 1155 |
\DeclareCaptionOption{calcmargin}{\caption@setcalcmargin{#1}} |
| 1156 |
\DeclareCaptionOption{calcmargin*}{\caption@setcalcmargin*{#1}} |
| 1157 |
\DeclareCaptionOption{calcwidth}{\caption@setcalcwidth{#1}} |
| 1158 |
\DeclareCaptionOption{calcwidth*}{\caption@setcalcwidth*{#1}} |
| 1159 |
% \end{macrocode} |
| 1160 |
% \begin{macrocode} |
| 1161 |
\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}} |
| 1162 |
\DeclareCaptionOptionNoValue{oneside}{\caption@set@bool\caption@iftwoside0} |
| 1163 |
% \end{macrocode} |
| 1164 |
% \begin{macrocode} |
| 1165 |
\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}} |
| 1166 |
\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}} |
| 1167 |
% \end{macrocode} |
| 1168 |
% |
| 1169 |
% \begin{macro}{\setcaptionmargin} |
| 1170 |
% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}} |
| 1171 |
% \changes{v1.0f}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take |
| 1172 |
% left+right margin} |
| 1173 |
% \changes{v1.1}{2007/08/11}{Starred variant added} |
| 1174 |
% \changes{v1.1}{2007/08/12}{\cs{setlength}\cs{captionmargin} \& |
| 1175 |
% \cs{setlength}\cs{captionmargin@} swapped so |
| 1176 |
% `\texttt{margin*=}\cs{captionmargin}' works in singleline options} |
| 1177 |
% \changes{v1.3}{2010/11/07}{Support for option \opt{calcmargin} added} |
| 1178 |
% |\setcaptionmargin|\marg{amount}\\ |
| 1179 |
% |\setcaptionmargin*|\marg{amount}\par |
| 1180 |
% Please never use this in user documents, it's just there to |
| 1181 |
% provide compatibility to the \package{caption2} package. |
| 1182 |
% \begin{macrocode} |
| 1183 |
\newcommand*\setcaptionmargin{% |
| 1184 |
\caption@resetcalcmargin |
| 1185 |
\caption@setmargin} |
| 1186 |
% \end{macrocode} |
| 1187 |
% \begin{macrocode} |
| 1188 |
\newcommand*\caption@setmargin{% |
| 1189 |
\caption@teststar\caption@@setmargin\@gobble\@firstofone} |
| 1190 |
% \end{macrocode} |
| 1191 |
% \begin{macrocode} |
| 1192 |
\newcommand*\caption@@setmargin[2]{% |
| 1193 |
#1{\captionwidth\z@}% |
| 1194 |
\caption@@@setmargin#2,#2,\@nil} |
| 1195 |
% \end{macrocode} |
| 1196 |
% \begin{macrocode} |
| 1197 |
\def\caption@@@setmargin#1,#2,#3\@nil{% |
| 1198 |
\setlength\captionmargin@{#2}% |
| 1199 |
\setlength\captionmargin{#1}% |
| 1200 |
\addtolength\captionmargin@{-\captionmargin}} |
| 1201 |
% \end{macrocode} |
| 1202 |
% \end{macro} |
| 1203 |
% |
| 1204 |
% \begin{macro}{\setcaptionwidth} |
| 1205 |
% \changes{v1.0f}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}} |
| 1206 |
% \changes{v1.3}{2010/11/07}{Starred variant added} |
| 1207 |
% \changes{v1.3}{2010/11/07}{Support for option \opt{calcwidth} added} |
| 1208 |
% |\setcaptionwidth|\marg{amount}\\ |
| 1209 |
% |\setcaptionwidth*|\marg{amount}\par |
| 1210 |
% Please never use this in user documents, it's just there to |
| 1211 |
% provide compatibility to the \package{caption2} package. |
| 1212 |
% \begin{macrocode} |
| 1213 |
\newcommand*\setcaptionwidth{% |
| 1214 |
\caption@resetcalcmargin |
| 1215 |
\caption@setwidth} |
| 1216 |
% \end{macrocode} |
| 1217 |
% \begin{macrocode} |
| 1218 |
\newcommand*\caption@setwidth{% |
| 1219 |
\caption@teststar\caption@@setwidth\@gobble\@firstofone} |
| 1220 |
% \end{macrocode} |
| 1221 |
% \begin{macrocode} |
| 1222 |
\newcommand*\caption@@setwidth[2]{% |
| 1223 |
#1{\captionmargin\z@\captionmargin@\z@}% |
| 1224 |
\setlength\captionwidth{#2}}% |
| 1225 |
% \end{macrocode} |
| 1226 |
% \end{macro} |
| 1227 |
% |
| 1228 |
% \begin{macro}{\caption@resetcalcmargin} |
| 1229 |
% \changes{v1.3}{2010/11/07}{This macro added} |
| 1230 |
% \begin{macrocode} |
| 1231 |
\newcommand*\caption@resetcalcmargin{% |
| 1232 |
\let\caption@calcmargin@hook\@empty} |
| 1233 |
% \end{macrocode} |
| 1234 |
% \end{macro} |
| 1235 |
% |
| 1236 |
% \begin{macro}{\caption@setcalcmargin} |
| 1237 |
% \changes{v1.3}{2010/11/07}{This macro added} |
| 1238 |
% \begin{macrocode} |
| 1239 |
\newcommand*\caption@setcalcmargin{% |
| 1240 |
\caption@teststar{\caption@@setcalcmargin\caption@setmargin}% |
| 1241 |
\@secondoftwo\@firstoftwo} |
| 1242 |
% \end{macrocode} |
| 1243 |
% \begin{macrocode} |
| 1244 |
\newcommand*\caption@@setcalcmargin[3]{% |
| 1245 |
#2{\caption@resetcalcmargin |
| 1246 |
\l@addto@macro\caption@calcmargin@hook{#1{#3}}}% |
| 1247 |
{\l@addto@macro\caption@calcmargin@hook{#1*{#3}}}} |
| 1248 |
% \end{macrocode} |
| 1249 |
% \end{macro} |
| 1250 |
% |
| 1251 |
% \begin{macro}{\caption@setcalcwidth} |
| 1252 |
% \changes{v1.3}{2010/11/07}{This macro added} |
| 1253 |
% \begin{macrocode} |
| 1254 |
\newcommand*\caption@setcalcwidth{% |
| 1255 |
\caption@teststar{\caption@@setcalcmargin\caption@setwidth}% |
| 1256 |
\@secondoftwo\@firstoftwo} |
| 1257 |
% \end{macrocode} |
| 1258 |
% \end{macro} |
| 1259 |
% |
| 1260 |
% \begin{macro}{\caption@counter} |
| 1261 |
% \changes{v1.0n}{2007/04/03}{This counter added} |
| 1262 |
% \changes{v1.1e}{2007/10/28}{Renamed to \cs{caption@thecounter}; \cs{caption@stepcounter} added} |
| 1263 |
% \changes{v1.5}{2012/04/09}{\cs{caption@stepcounter} renamed to \cs{caption@stepthecounter}} |
| 1264 |
% Internal counter. At the moment it will be used inside |
| 1265 |
% |\caption@ifoddpage| only. |
| 1266 |
% \begin{macrocode} |
| 1267 |
\newcommand*\caption@thecounter{0} |
| 1268 |
% \end{macrocode} |
| 1269 |
% \begin{macrocode} |
| 1270 |
\newcommand*\caption@stepthecounter{% |
| 1271 |
\@tempcnta\caption@thecounter |
| 1272 |
\advance\@tempcnta\@ne |
| 1273 |
\xdef\caption@thecounter{\the\@tempcnta}} |
| 1274 |
% \end{macrocode} |
| 1275 |
% \end{macro} |
| 1276 |
% |
| 1277 |
% \begin{macro}{\caption@newlabel} |
| 1278 |
% \changes{v1.0n}{2007/04/03}{This macro added} |
| 1279 |
% This command is a modified version of |\newlabel| from \LaTeX2e. |
| 1280 |
% It will be written to the \texttt{.aux} file to |
| 1281 |
% pass label information from one run to another. |
| 1282 |
% (We use it inside |\caption@ifoddpage| and |\caption@ragged|.) |
| 1283 |
% \begin{macrocode} |
| 1284 |
\newcommand*\caption@newlabel{\@newl@bel{caption@r}} |
| 1285 |
% \end{macrocode} |
| 1286 |
% \end{macro} |
| 1287 |
% |
| 1288 |
% \begin{macro}{\caption@thepage} |
| 1289 |
% \changes{v1.0n}{2007/04/03}{This macro added} |
| 1290 |
% This command is a modified version of |\thepage| from \LaTeX2e. |
| 1291 |
% It will be used inside |\caption@ifoddpage| only. |
| 1292 |
% \begin{macrocode} |
| 1293 |
\newcommand*\caption@thepage{\the\c@page} |
| 1294 |
% \end{macrocode} |
| 1295 |
% \end{macro} |
| 1296 |
% |
| 1297 |
% \begin{macro}{\caption@label} |
| 1298 |
% \changes{v1.1}{2007/09/01}{This macro added} |
| 1299 |
% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@newlabel} in AUX file added} |
| 1300 |
% This command is a modified version of |\label| from \LaTeX2e. |
| 1301 |
% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|. |
| 1302 |
% \begin{macrocode} |
| 1303 |
\newcommand*\caption@label[1]{% |
| 1304 |
\caption@@label |
| 1305 |
\protected@write\@auxout{\let\caption@thepage\relax}% |
| 1306 |
{\string\caption@newlabel{#1}{\caption@thepage}}} |
| 1307 |
% \end{macrocode} |
| 1308 |
% \begin{macrocode} |
| 1309 |
\newcommand*\caption@@label{% |
| 1310 |
\global\let\caption@@label\relax |
| 1311 |
\protected@write\@auxout{}% |
| 1312 |
{\string\providecommand*\string\caption@newlabel[2]{}}} |
| 1313 |
% \end{macrocode} |
| 1314 |
% \end{macro} |
| 1315 |
% |
| 1316 |
% \begin{macro}{\caption@pageref} |
| 1317 |
% \changes{v1.1}{2007/09/01}{This macro added} |
| 1318 |
% \changes{v1.2d}{2009/10/09}{Uses \cs{@latex@warning} instead of \cs{caption@Warning} now} |
| 1319 |
% This command is a modified version of |\pageref| from \LaTeX2e. |
| 1320 |
% It will be used inside |\caption@ifoddpage| and |\FP@helpNote|. |
| 1321 |
% \begin{macrocode} |
| 1322 |
\newcommand*\caption@pageref[1]{% |
| 1323 |
\expandafter\ifx\csname caption@r@#1\endcsname\relax |
| 1324 |
\G@refundefinedtrue % => 'There are undefined references.' |
| 1325 |
\@latex@warning{Reference `#1' on page \thepage \space undefined}% |
| 1326 |
\else |
| 1327 |
\expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname |
| 1328 |
\fi} |
| 1329 |
% \end{macrocode} |
| 1330 |
% \end{macro} |
| 1331 |
% |
| 1332 |
% \begin{macro}{\caption@ifoddpage} |
| 1333 |
% \changes{v1.0n}{2007/04/03}{This macro added} |
| 1334 |
% \changes{v1.1e}{2007/10/28}{Incrementation of counter moved to \cs{caption@@make}} |
| 1335 |
% At the moment this macro uses an own label\ldots ref mechanism, |
| 1336 |
% but an alternative implementation method would be using the |
| 1337 |
% \package{refcount} package\cite{refcount} and |\ifodd\getpagerefnumber{|\ldots|}|. |
| 1338 |
% \Note{This macro re-defines itself so the \texttt{.aux} file will |
| 1339 |
% only be used once per group.} |
| 1340 |
% \begin{macrocode} |
| 1341 |
\newcommand*\caption@ifoddpage{% |
| 1342 |
\caption@iftwoside{% |
| 1343 |
\caption@label\caption@thecounter |
| 1344 |
\caption@pageref\caption@thecounter |
| 1345 |
\ifodd\caption@thepage |
| 1346 |
\let\caption@ifoddpage\@firstoftwo |
| 1347 |
\else |
| 1348 |
\let\caption@ifoddpage\@secondoftwo |
| 1349 |
\fi |
| 1350 |
}{\let\caption@ifoddpage\@firstoftwo}% |
| 1351 |
% \end{macrocode} |
| 1352 |
% \begin{macrocode} |
| 1353 |
\caption@ifoddpage} |
| 1354 |
% \end{macrocode} |
| 1355 |
% \end{macro} |
| 1356 |
% |
| 1357 |
% \begin{macro}{\caption@setoptcmd} |
| 1358 |
% \changes{v1.1}{2007/08/11}{This macro added} |
| 1359 |
% |\caption@setoptcmd|\marg{cmd}\marg{off -or- value} |
| 1360 |
% \begin{macrocode} |
| 1361 |
\newcommand*\caption@setoptcmd[2]{% |
| 1362 |
\caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}} |
| 1363 |
% \end{macrocode} |
| 1364 |
% \end{macro} |
| 1365 |
% |
| 1366 |
% \section{Indentions} |
| 1367 |
% |
| 1368 |
% \begin{macro}{\caption@indent} |
| 1369 |
% \changes{v1.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}} |
| 1370 |
% \begin{macro}{\caption@parindent} |
| 1371 |
% \begin{macro}{\caption@hangindent} |
| 1372 |
% These are the indentions we support. |
| 1373 |
% \begin{macrocode} |
| 1374 |
\newdimen\caption@indent |
| 1375 |
\newdimen\caption@parindent |
| 1376 |
\newdimen\caption@hangindent |
| 1377 |
% \end{macrocode} |
| 1378 |
% \end{macro} |
| 1379 |
% \end{macro} |
| 1380 |
% \end{macro} |
| 1381 |
% |
| 1382 |
% \changes{v1.0b}{2004/05/16}{Defaults added for options \opt{parindent=} |
| 1383 |
% and \opt{hangindent=}} |
| 1384 |
% \changes{v1.0f}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption} |
| 1385 |
% replaced by \cs{caption@@par}} |
| 1386 |
% \changes{v1.0f}{2005/08/22}{Undocumented defaults for \opt{parindent=}, |
| 1387 |
% \opt{hangindent=}, and \opt{parskip=} removed} |
| 1388 |
% \begin{macrocode} |
| 1389 |
\DeclareCaptionOption{indent}[\leftmargini]{% obsolete! |
| 1390 |
\setlength\caption@indent{#1}} |
| 1391 |
\DeclareCaptionOption{indention}[\leftmargini]{% |
| 1392 |
\setlength\caption@indent{#1}} |
| 1393 |
\DeclareCaptionOption{parindent}{% |
| 1394 |
\setlength\caption@parindent{#1}} |
| 1395 |
\DeclareCaptionOption{hangindent}{% |
| 1396 |
\setlength\caption@hangindent{#1}} |
| 1397 |
\DeclareCaptionOption{parskip}{% |
| 1398 |
\l@addto@macro\caption@@par{\setlength\parskip{#1}}} |
| 1399 |
% \end{macrocode} |
| 1400 |
% |
| 1401 |
% \section{Styles} |
| 1402 |
% |
| 1403 |
% \begin{macro}{\DeclareCaptionStyle} |
| 1404 |
% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces |
| 1405 |
% between arguments do make any harm} |
| 1406 |
% |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV} |
| 1407 |
% \begin{macrocode} |
| 1408 |
\newcommand*\DeclareCaptionStyle[1]{% |
| 1409 |
\@testopt{\caption@declarestyle{#1}}{}} |
| 1410 |
\@onlypreamble\DeclareCaptionStyle |
| 1411 |
% \end{macrocode} |
| 1412 |
% \begin{macrocode} |
| 1413 |
\def\caption@declarestyle#1[#2]#3{% |
| 1414 |
\global\@namedef{caption@sls@#1}{#2}% |
| 1415 |
\global\@namedef{caption@sty@#1}{#3}} |
| 1416 |
\@onlypreamble\caption@declarestyle |
| 1417 |
% \end{macrocode} |
| 1418 |
% \end{macro} |
| 1419 |
% |
| 1420 |
% \changes{v1.2a}{2008/01/20}{Option \opt{style*=} added} |
| 1421 |
% \begin{macrocode} |
| 1422 |
\DeclareCaptionOption{style}{\caption@setstyle{#1}} |
| 1423 |
\DeclareCaptionOption{style*}{\caption@setstyle*{#1}} |
| 1424 |
% \end{macrocode} |
| 1425 |
% |
| 1426 |
% \begin{macro}{\caption@setstyle} |
| 1427 |
% \changes{v1.0e}{2005/06/01}{Starred variant added} |
| 1428 |
% \changes{v1.1}{2007/07/29}{Recursive style definitions should work now} |
| 1429 |
% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} |
| 1430 |
% \changes{v1.2}{2007/12/03}{Definition of \cs{caption@iftypewarning} removed} |
| 1431 |
% |\caption@setstyle|\marg{name}\\ |
| 1432 |
% |\caption@setstyle*|\marg{name}\par |
| 1433 |
% Selecting a caption style means saving the additional |
| 1434 |
% \meta{single-line-list-of-KV} (this will be done by |\caption@sls|), |
| 1435 |
% resetting the caption options to the base ones (this will be done using |
| 1436 |
% |\caption@resetstyle|) and executing the \meta{list-of-KV} options |
| 1437 |
% (this will be done using |\caption@setup|).\par |
| 1438 |
% The starred version will give no error message if the given style is not |
| 1439 |
% defined. |
| 1440 |
% \begin{macrocode} |
| 1441 |
\newcommand*\caption@setstyle{% |
| 1442 |
\caption@teststar\caption@@setstyle\@gobble\@firstofone} |
| 1443 |
% \end{macrocode} |
| 1444 |
% \begin{macrocode} |
| 1445 |
\newcommand*\caption@@setstyle[2]{% |
| 1446 |
\@ifundefined{caption@sty@#2}% |
| 1447 |
{#1{\caption@Error{Undefined style `#2'}}}% |
| 1448 |
{\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname |
| 1449 |
\ifx\caption@setstyle@flag\@undefined |
| 1450 |
\let\caption@setstyle@flag\relax |
| 1451 |
\caption@resetstyle |
| 1452 |
\caption@xsetup\caption@sty |
| 1453 |
\let\caption@setstyle@flag\@undefined |
| 1454 |
\else |
| 1455 |
\caption@xsetup\caption@sty |
| 1456 |
\fi |
| 1457 |
\expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname |
| 1458 |
\expandafter\caption@l@addto@list\expandafter\caption@opt@singleline |
| 1459 |
\expandafter{\caption@sls}}} |
| 1460 |
% \end{macrocode} |
| 1461 |
% \end{macro} |
| 1462 |
% |
| 1463 |
% \begin{macro}{\caption@resetstyle} |
| 1464 |
% \changes{v1.1}{2007/02/04}{% |
| 1465 |
% This macro renamed from \cs{caption@setdefault} to \cs{caption@resetstyle}} |
| 1466 |
% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} |
| 1467 |
% \changes{v1.2}{2007/11/17}{Usage of \opt{size=} added} |
| 1468 |
% \changes{v1.2b}{2008/05/06}{Usage of \opt{rule} added} |
| 1469 |
% \changes{v1.5}{2012/03/15}{\opt{box=parbox} added} |
| 1470 |
% \changes{v1.6}{2013/05/01}{\opt{box=none} added, \opt{box=parbox} changed to \opt{parbox=parbox}} |
| 1471 |
% This resets (nearly) all caption options to the base ones. |
| 1472 |
% \emph{Note that this does not touch the skips and the positioning!} |
| 1473 |
% \begin{macrocode} |
| 1474 |
\newcommand*\caption@resetstyle{% |
| 1475 |
\caption@setup{% |
| 1476 |
box=none,boxcolor=white,parbox=parbox,% |
| 1477 |
format=plain,labelformat=default,labelsep=colon,textformat=simple,% |
| 1478 |
justification=justified,font=,size=,labelfont=,textfont=,% |
| 1479 |
margin=0pt,minmargin=0,maxmargin=0,% |
| 1480 |
indent=0pt,parindent=0pt,hangindent=0pt,% |
| 1481 |
slc,rule,strut}% |
| 1482 |
\caption@clearsetup{singleline}} |
| 1483 |
% \end{macrocode} |
| 1484 |
% \end{macro} |
| 1485 |
% |
| 1486 |
% \changes{v1.0c}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}} |
| 1487 |
% \changes{v1.1}{2007/02/04}{Caption style `default' renamed to `base', and a new `default' added} |
| 1488 |
% \changes{v1.1}{2007/03/31}{\opt{format=plain} added to caption style \opt{default}} |
| 1489 |
% \changes{v1.1c}{2007/10/14}{\opt{format=plain} removed from caption style \opt{default}} |
| 1490 |
% \changes{v1.5}{2012/03/15}{\opt{box=default} added to caption style \opt{default}} |
| 1491 |
% Currently there are two pre-defined styles, called `base' \& `default'. |
| 1492 |
% The first one is a perfect match to the behavior of |\@makecaption| offered |
| 1493 |
% by the standard \LaTeX\ document classes (and was called `default' in |
| 1494 |
% \thispackage\ \version{1.0}), the second one matches the document |
| 1495 |
% class actually used. |
| 1496 |
% \begin{macrocode} |
| 1497 |
\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{} |
| 1498 |
\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{% |
| 1499 |
box=default,format=default,labelsep=default,textformat=default,% |
| 1500 |
justification=default,font=default,labelfont=default,textfont=default} |
| 1501 |
% \end{macrocode} |
| 1502 |
% |
| 1503 |
% \changes{v1.2b}{2008/05/06}{Option \opt{slc=} added} |
| 1504 |
% \begin{macrocode} |
| 1505 |
\DeclareCaptionOption{singlelinecheck}[1]{\caption@set@bool\caption@ifslc{#1}} |
| 1506 |
\DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}} |
| 1507 |
% \end{macrocode} |
| 1508 |
% |
| 1509 |
% \section{Boxes} |
| 1510 |
% |
| 1511 |
% \begin{macro}{\DeclareCaptionBox} |
| 1512 |
% \changes{v1.5}{2012/03/15}{This macro added} |
| 1513 |
% |\DeclareCaptionBox|\marg{name}\marg{code with \#1 and \#2} |
| 1514 |
% \begin{macrocode} |
| 1515 |
\newcommand*\DeclareCaptionBox[2]{% |
| 1516 |
\global\long\@namedef{caption@box@#1}##1##2{#2}} |
| 1517 |
\@onlypreamble\DeclareCaptionBox |
| 1518 |
% \end{macrocode} |
| 1519 |
% \end{macro} |
| 1520 |
% |
| 1521 |
% \changes{v1.5}{2012/03/15}{Option \opt{box=} added} |
| 1522 |
% \changes{v1.6}{2013/05/01}{Option \opt{parbox=} added} |
| 1523 |
% \begin{macrocode} |
| 1524 |
\DeclareCaptionOption{box}{\caption@setbox{#1}} |
| 1525 |
\DeclareCaptionOption{parbox}{\caption@set@box\caption@parbox{#1}} |
| 1526 |
% \end{macrocode} |
| 1527 |
% |
| 1528 |
% \begin{macro}{\caption@setbox} |
| 1529 |
% |\caption@setbox|\marg{name}\par |
| 1530 |
% Selecting a caption box simply means saving the code (in |\caption@box|). |
| 1531 |
% \begin{macrocode} |
| 1532 |
\newcommand*\caption@setbox{% |
| 1533 |
\caption@set@box\caption@box} |
| 1534 |
% \end{macrocode} |
| 1535 |
% \begin{macrocode} |
| 1536 |
\newcommand*\caption@set@box[2]{% |
| 1537 |
\@ifundefined{caption@box@#2}% |
| 1538 |
{\caption@Error{Undefined box `#2'}}% |
| 1539 |
{\expandafter\let\expandafter#1\csname caption@box@#2\endcsname}} |
| 1540 |
% \end{macrocode} |
| 1541 |
% \end{macro} |
| 1542 |
% |
| 1543 |
% There are four pre-defined boxes, called `empty', `none', |
| 1544 |
% `parbox', and `colorbox'. |
| 1545 |
% \changes{v1.0i}{2006/05/13}{We define \cs{captionbox} instead of |
| 1546 |
% \cs{caption@start/endbox}} |
| 1547 |
% \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{captionbox} changed from |
| 1548 |
% \cs{parbox-t} to \cs{parbox-b}} |
| 1549 |
% \changes{v1.2}{2007/11/11}{\cs{captionbox} renamed to \cs{caption@parbox}} |
| 1550 |
% \changes{v1.5}{2012/03/15}{\cs{caption@parbox} adapted to \cs{DeclareCaptionBox}} |
| 1551 |
% \changes{v1.6}{2013/05/02}{Option \opt{boxsep=} added} |
| 1552 |
% \begin{macrocode} |
| 1553 |
\DeclareCaptionBox{empty}{} |
| 1554 |
\DeclareCaptionBox{none}{#2} |
| 1555 |
\DeclareCaptionBox{parbox}{\parbox[b]{#1}{#2}} |
| 1556 |
%\DeclareCaptionBox{colorbox}{% |
| 1557 |
% \colorbox{\caption@boxcolor}{\caption@box@parbox{\dimexpr #1-2\fboxsep}{#2}}} |
| 1558 |
\DeclareCaptionBox{colorbox}{\colorbox{\caption@boxcolor}{% |
| 1559 |
\setlength\caption@tempdima{#1}% |
| 1560 |
\addtolength\caption@tempdima{-2\fboxsep}% |
| 1561 |
\linewidth\caption@tempdima |
| 1562 |
\hsize\caption@tempdima |
| 1563 |
#2}} |
| 1564 |
\DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}} |
| 1565 |
\DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}} |
| 1566 |
% \end{macrocode} |
| 1567 |
% |
| 1568 |
% `default' usually maps to `none`. |
| 1569 |
% \begin{macrocode} |
| 1570 |
\def\caption@box@default{\caption@box@none} |
| 1571 |
% \end{macrocode} |
| 1572 |
% |
| 1573 |
% \section{Formats} |
| 1574 |
% |
| 1575 |
% \begin{macro}{\DeclareCaptionFormat} |
| 1576 |
% \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces |
| 1577 |
% between arguments do make any harm} |
| 1578 |
% \changes{v1.0c}{2005/02/09}{Starred variant added} |
| 1579 |
% \changes{v1.1c}{2007/10/15}{Optional argument added} |
| 1580 |
% |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\ |
| 1581 |
% |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par |
| 1582 |
% The starred form causes the code being typeset in vertical (instead of |
| 1583 |
% horizontal) mode, but does not support the |indention=| option. |
| 1584 |
% \begin{macrocode} |
| 1585 |
\newcommand*\DeclareCaptionFormat{% |
| 1586 |
\caption@teststar\caption@declareformat\@gobble\@firstofone} |
| 1587 |
\@onlypreamble\DeclareCaptionFormat |
| 1588 |
% \end{macrocode} |
| 1589 |
% \begin{macrocode} |
| 1590 |
\newcommand*\caption@declareformat[2]{% |
| 1591 |
\@dblarg{\caption@@declareformat#1{#2}}} |
| 1592 |
\@onlypreamble\caption@declareformat |
| 1593 |
% \end{macrocode} |
| 1594 |
% \begin{macrocode} |
| 1595 |
\long\def\caption@@declareformat#1#2[#3]#4{% |
| 1596 |
\global\expandafter\let\csname caption@ifh@#2\endcsname#1% |
| 1597 |
\global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}% |
| 1598 |
\global\long\@namedef{caption@fmt@#2}##1##2##3{#4}} |
| 1599 |
\@onlypreamble\caption@@declareformat |
| 1600 |
% \end{macrocode} |
| 1601 |
% \end{macro} |
| 1602 |
% |
| 1603 |
% \begin{macrocode} |
| 1604 |
\DeclareCaptionOption{format}{\caption@setformat{#1}} |
| 1605 |
% \end{macrocode} |
| 1606 |
% |
| 1607 |
% \begin{macro}{\caption@setformat} |
| 1608 |
% |\caption@setformat|\marg{name}\par |
| 1609 |
% Selecting a caption format simply means saving the code (in |\caption@fmt|) |
| 1610 |
% and if the code should be used in horizontal or vertical mode (|\caption@ifh|). |
| 1611 |
% \begin{macrocode} |
| 1612 |
\newcommand*\caption@setformat[1]{% |
| 1613 |
\@ifundefined{caption@fmt@#1}% |
| 1614 |
{\caption@Error{Undefined format `#1'}}% |
| 1615 |
{\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname |
| 1616 |
\expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname |
| 1617 |
\expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}} |
| 1618 |
% \end{macrocode} |
| 1619 |
% \end{macro} |
| 1620 |
% |
| 1621 |
% \begin{macro}{\DeclareCaptionDefaultFormat} |
| 1622 |
% \changes{v1.2a}{2008/01/31}{This macro added} |
| 1623 |
% \begin{macrocode} |
| 1624 |
\newcommand*\DeclareCaptionDefaultFormat[1]{% |
| 1625 |
\expandafter\def\expandafter\caption@fmt@default\expandafter |
| 1626 |
{\csname caption@fmt@#1\endcsname}% |
| 1627 |
\expandafter\def\expandafter\caption@slfmt@default\expandafter |
| 1628 |
{\csname caption@slfmt@#1\endcsname}% |
| 1629 |
\expandafter\def\expandafter\caption@ifh@default\expandafter |
| 1630 |
{\csname caption@ifh@#1\endcsname}} |
| 1631 |
\@onlypreamble\DeclareCaptionDefaultFormat |
| 1632 |
% \end{macrocode} |
| 1633 |
% \end{macro} |
| 1634 |
% |
| 1635 |
% \changes{v1.0a}{2004/01/23}{% |
| 1636 |
% Caption format \opt{default} renamed to \opt{normal}} |
| 1637 |
% \changes{v1.0e}{2005/05/12}{% |
| 1638 |
% Caption format \opt{normal} renamed to \opt{@normal}} |
| 1639 |
% \changes{v1.0f}{2005/08/25}{% |
| 1640 |
% Caption format \opt{@normal} renamed to \opt{plain} and documented} |
| 1641 |
% \changes{v1.1c}{2007/10/14}{% |
| 1642 |
% Single-line variant of caption format \opt{hang} added} |
| 1643 |
% There are two pre-defined formats, called `plain' and `hang'. |
| 1644 |
% \begin{macrocode} |
| 1645 |
\DeclareCaptionFormat{plain}{#1#2#3\par} |
| 1646 |
% \end{macrocode} |
| 1647 |
% \begin{macrocode} |
| 1648 |
\DeclareCaptionFormat{hang}[#1#2#3\par]{% |
| 1649 |
\caption@ifin@list\caption@lsepcrlist\caption@lsepname |
| 1650 |
{\caption@Error{% |
| 1651 |
The option `labelsep=\caption@lsepname' does not work\MessageBreak |
| 1652 |
with `format=hang'}}% |
| 1653 |
{\@hangfrom{#1#2}% |
| 1654 |
\advance\caption@parindent\hangindent |
| 1655 |
\advance\caption@hangindent\hangindent |
| 1656 |
\caption@@par#3\par}} |
| 1657 |
% \end{macrocode} |
| 1658 |
% |
| 1659 |
% \changes{v1.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{plain}} |
| 1660 |
% \changes{v1.0d}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added} |
| 1661 |
% `default' usually maps to `plain'. |
| 1662 |
% \begin{macrocode} |
| 1663 |
\DeclareCaptionDefaultFormat{plain} |
| 1664 |
% \end{macrocode} |
| 1665 |
% |
| 1666 |
% \section{Label formats} |
| 1667 |
% |
| 1668 |
% \begin{macro}{\DeclareCaptionLabelFormat} |
| 1669 |
% \changes{v1.0a}{2004/01/17}{% |
| 1670 |
% Pass through argument \#2 so extra spaces between arguments do make any harm} |
| 1671 |
% |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2} |
| 1672 |
% \begin{macrocode} |
| 1673 |
\newcommand*\DeclareCaptionLabelFormat[2]{% |
| 1674 |
\global\@namedef{caption@lfmt@#1}##1##2{#2}} |
| 1675 |
\@onlypreamble\DeclareCaptionLabelFormat |
| 1676 |
% \end{macrocode} |
| 1677 |
% \end{macro} |
| 1678 |
% |
| 1679 |
% \begin{macrocode} |
| 1680 |
\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}} |
| 1681 |
% \end{macrocode} |
| 1682 |
% |
| 1683 |
% \begin{macro}{\caption@setlabelformat} |
| 1684 |
% |\caption@setlabelformat|\marg{name}\par |
| 1685 |
% Selecting a caption label format simply means saving the code (in |\caption@lfmt|). |
| 1686 |
% \begin{macrocode} |
| 1687 |
\newcommand*\caption@setlabelformat[1]{% |
| 1688 |
\@ifundefined{caption@lfmt@#1}% |
| 1689 |
{\caption@Error{Undefined label format `#1'}}% |
| 1690 |
{\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}} |
| 1691 |
% \end{macrocode} |
| 1692 |
% \end{macro} |
| 1693 |
% |
| 1694 |
% \changes{v1.2}{2007/12/16}{Caption label format \opt{brace} added} |
| 1695 |
% \changes{v1.7}{2015/09/16}{Caption label format \opt{autodot} added} |
| 1696 |
% \changes{v1.7}{2016/05/22}{Caption label format \opt{autodot} fixed} |
| 1697 |
% \changes{v1.8}{2016/05/22}{Caption label format \opt{unnumbered} added} |
| 1698 |
% There are six pre-defined label formats, called `empty', `simple', |
| 1699 |
% `parens', `brace', `autodot', and `unnumbered'. |
| 1700 |
% \begin{macrocode} |
| 1701 |
\DeclareCaptionLabelFormat{empty}{} |
| 1702 |
\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2} |
| 1703 |
\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)} |
| 1704 |
\DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)} |
| 1705 |
\DeclareCaptionLabelFormat{autodot}{\bothIfFirst{#1}{\nobreakspace}#2\autodot} |
| 1706 |
\DeclareCaptionLabelFormat{unnumbered}{#1} |
| 1707 |
% \end{macrocode} |
| 1708 |
% |
| 1709 |
% `default' usually maps to `simple'. |
| 1710 |
% \begin{macrocode} |
| 1711 |
\def\caption@lfmt@default{\caption@lfmt@simple} |
| 1712 |
% \end{macrocode} |
| 1713 |
% |
| 1714 |
% \section{Label separators} |
| 1715 |
% |
| 1716 |
% \begin{macro}{\DeclareCaptionLabelSeparator} |
| 1717 |
% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces |
| 1718 |
% between arguments do make any harm} |
| 1719 |
% \changes{v1.0f}{2005/08/25}{Starred variant added} |
| 1720 |
% \changes{v1.1}{2007/07/13}{Test for CR added} |
| 1721 |
% \changes{v1.3}{2011/08/06}{Test for CR revised} |
| 1722 |
% |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\ |
| 1723 |
% |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par |
| 1724 |
% The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|. |
| 1725 |
% \begin{macrocode} |
| 1726 |
\newcommand\DeclareCaptionLabelSeparator{% |
| 1727 |
\caption@teststar\caption@declarelabelseparator\@gobble\@firstofone} |
| 1728 |
\@onlypreamble\DeclareCaptionLabelSeparator |
| 1729 |
% \end{macrocode} |
| 1730 |
% \begin{macrocode} |
| 1731 |
\newcommand\caption@declarelabelseparator[3]{% |
| 1732 |
\global\@namedef{caption@iflf@#2}{#1}% |
| 1733 |
\global\long\@namedef{caption@lsep@#2}{#3}% |
| 1734 |
\caption@@declarelabelseparator{#2}#3\\\@nil} |
| 1735 |
\@onlypreamble\caption@declarelabelseparator |
| 1736 |
% \end{macrocode} |
| 1737 |
% \begin{macrocode} |
| 1738 |
\long\def\caption@@declarelabelseparator#1#2\\#3\@nil{% |
| 1739 |
\def\@tempa{#3}\ifx\@tempa\@empty \else |
| 1740 |
\caption@g@addto@list\caption@lsepcrlist{#1}% |
| 1741 |
\fi} |
| 1742 |
\@onlypreamble\caption@@declarelabelseparator |
| 1743 |
% \end{macrocode} |
| 1744 |
% \end{macro} |
| 1745 |
% |
| 1746 |
% \begin{macrocode} |
| 1747 |
\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}} |
| 1748 |
\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}} |
| 1749 |
% \end{macrocode} |
| 1750 |
% |
| 1751 |
% \begin{macro}{\caption@setlabelseparator} |
| 1752 |
% |\caption@setlabelseparator|\marg{name}\par |
| 1753 |
% Selecting a caption label separator simply means saving the code (in |\caption@lsep|). |
| 1754 |
% \begin{macrocode} |
| 1755 |
\newcommand*\caption@setlabelseparator[1]{% |
| 1756 |
\@ifundefined{caption@lsep@#1}% |
| 1757 |
{\caption@Error{Undefined label separator `#1'}}% |
| 1758 |
{\edef\caption@lsepname{#1}% |
| 1759 |
\expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname |
| 1760 |
\expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}} |
| 1761 |
% \end{macrocode} |
| 1762 |
% \end{macro} |
| 1763 |
% |
| 1764 |
% \changes{v1.0e}{2005/06/11}{Bugfix 05-03-23: Caption label separator |
| 1765 |
% \opt{newline} implementation changed from \cs{newline} to \cs{\textbackslash}} |
| 1766 |
% \changes{v1.0f}{2005/08/24}{Caption label separator \opt{endash} added} |
| 1767 |
% There are seven pre-defined label separators, called `none', `colon', `period', `space', |
| 1768 |
% `quad', `newline', and `endash'. |
| 1769 |
% \begin{macrocode} |
| 1770 |
\DeclareCaptionLabelSeparator{none}{} |
| 1771 |
\DeclareCaptionLabelSeparator{colon}{: } |
| 1772 |
\DeclareCaptionLabelSeparator{period}{. } |
| 1773 |
\DeclareCaptionLabelSeparator{space}{ } |
| 1774 |
\DeclareCaptionLabelSeparator*{quad}{\quad} |
| 1775 |
\DeclareCaptionLabelSeparator*{newline}{\captionnewline} |
| 1776 |
\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space} |
| 1777 |
% \end{macrocode} |
| 1778 |
% |
| 1779 |
% \begin{macro}{\captionnewline} |
| 1780 |
% \changes{v1.12}{2020/05/30}{This macro added} |
| 1781 |
% Will be used in the caption label separator |new|\-|line|, |
| 1782 |
% and re-defined for |long|\-|table| environments. |
| 1783 |
% \begin{macrocode} |
| 1784 |
\newcommand*\captionnewline{\\} |
| 1785 |
% \end{macrocode} |
| 1786 |
% \end{macro} |
| 1787 |
% |
| 1788 |
% \begin{macro}{\caption@setdefaultlabelsep} |
| 1789 |
% \changes{v1.2d}{2009/03/29}{This macro added} |
| 1790 |
% \begin{macrocode} |
| 1791 |
\newcommand*\caption@setdefaultlabelsep[1]{% |
| 1792 |
\ifx\caption@lsep\caption@lsep@default |
| 1793 |
\caption@set@default@labelsep{#1}% |
| 1794 |
\caption@setlabelseparator{default}% |
| 1795 |
\else |
| 1796 |
\caption@set@default@labelsep{#1}% |
| 1797 |
\fi} |
| 1798 |
% \end{macrocode} |
| 1799 |
% \begin{macrocode} |
| 1800 |
\newcommand*\caption@set@default@labelsep[1]{% |
| 1801 |
\def\caption@lsep@default{\@nameuse{caption@lsep@#1}}% |
| 1802 |
\def\caption@iflf@default{\@nameuse{caption@iflf@#1}}} |
| 1803 |
% \end{macrocode} |
| 1804 |
% \end{macro} |
| 1805 |
% |
| 1806 |
% `default' usually maps to `colon'. |
| 1807 |
% \begin{macrocode} |
| 1808 |
\caption@set@default@labelsep{colon} |
| 1809 |
% \end{macrocode} |
| 1810 |
% |
| 1811 |
% \section{Text formats} |
| 1812 |
% |
| 1813 |
% \begin{macro}{\DeclareCaptionTextFormat} |
| 1814 |
% \changes{v1.0j}{2007/02/18}{This macro added} |
| 1815 |
% |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1} |
| 1816 |
% \begin{macrocode} |
| 1817 |
\newcommand*\DeclareCaptionTextFormat[2]{% |
| 1818 |
\global\long\@namedef{caption@tfmt@#1}##1{#2}} |
| 1819 |
\@onlypreamble\DeclareCaptionTextFormat |
| 1820 |
% \end{macrocode} |
| 1821 |
% \end{macro} |
| 1822 |
% |
| 1823 |
% \changes{v1.0c}{2005/02/12}{Option \opt{strut=} added} |
| 1824 |
% \begin{macrocode} |
| 1825 |
\DeclareCaptionOption{textformat}{\caption@settextformat{#1}} |
| 1826 |
\DeclareCaptionOption{strut}[1]{\caption@set@bool\caption@ifstrut{#1}} |
| 1827 |
% \end{macrocode} |
| 1828 |
% |
| 1829 |
% \begin{macro}{\caption@settextformat} |
| 1830 |
% \changes{v1.0j}{2007/02/18}{This macro added} |
| 1831 |
% |\caption@settextformat|\marg{name}\par |
| 1832 |
% Selecting a caption text format simply means saving the code (in |\caption@tfmt|). |
| 1833 |
% \begin{macrocode} |
| 1834 |
\newcommand*\caption@settextformat[1]{% |
| 1835 |
\@ifundefined{caption@tfmt@#1}% |
| 1836 |
{\caption@Error{Undefined text format `#1'}}% |
| 1837 |
{\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}} |
| 1838 |
% \end{macrocode} |
| 1839 |
% \end{macro} |
| 1840 |
% |
| 1841 |
% There are three pre-defined text formats, called `empty', `simple' and `period'. |
| 1842 |
% \changes{v1.4}{2011/10/05}{Pre-defined text format `empty' added} |
| 1843 |
% \changes{v1.7}{2015/09/16}{The text format `empty' now takes care of the \cs{label}} |
| 1844 |
% \begin{macrocode} |
| 1845 |
\DeclareCaptionTextFormat{empty}{% |
| 1846 |
\caption@get@label#1\caption@makeanchor{}\@nil |
| 1847 |
\caption@thelabel |
| 1848 |
\global\let\caption@thelabel\relax} |
| 1849 |
\long\def\caption@get@label#1\caption@makeanchor#2#3\@nil{% |
| 1850 |
\def\caption@tempa{#2}% |
| 1851 |
\ifx\caption@tempa\@empty |
| 1852 |
\caption@getlabel#1\label{}\@nil |
| 1853 |
\else |
| 1854 |
\caption@getlabel#2\label{}\@nil |
| 1855 |
\fi} |
| 1856 |
% \end{macrocode} |
| 1857 |
% \begin{macrocode} |
| 1858 |
\DeclareCaptionTextFormat{simple}{#1} |
| 1859 |
\DeclareCaptionTextFormat{period}{#1.} |
| 1860 |
% \end{macrocode} |
| 1861 |
% |
| 1862 |
% `default' usually maps to `simple'. |
| 1863 |
% \begin{macrocode} |
| 1864 |
\def\caption@tfmt@default{\caption@tfmt@simple} |
| 1865 |
% \end{macrocode} |
| 1866 |
% |
| 1867 |
% \begin{macro}{\caption@getlabel} |
| 1868 |
% \changes{v1.0}{2011/09/03}{\cs{label} can have optional arguments now} |
| 1869 |
% \changes{v1.7}{2015/09/16}{Moved from \package{bicaption} package to \package{caption3}} |
| 1870 |
% \changes{v1.8d}{2019/09/01}{Bugfix: Global definition of \cs{caption@thelabel} added} |
| 1871 |
% Gets the label command out of the (first) caption text and stores it to |\caption@thelabel|. |
| 1872 |
% \begin{macrocode} |
| 1873 |
\long\def\caption@getlabel#1\label#2#3\@nil{% |
| 1874 |
\def\@tempa{#2}% |
| 1875 |
\ifx\@tempa\@empty |
| 1876 |
\let\caption@thelabel\relax |
| 1877 |
\else |
| 1878 |
\def\@tempb{*}% |
| 1879 |
\ifx\@tempa\@tempb |
| 1880 |
\def\caption@thelabel{\label*}% |
| 1881 |
\caption@@getlabel#3\@nil |
| 1882 |
\else |
| 1883 |
\def\caption@thelabel{\label}% |
| 1884 |
\caption@@getlabel{#2}#3\@nil |
| 1885 |
\fi |
| 1886 |
\fi} |
| 1887 |
% \end{macrocode} |
| 1888 |
% \begin{macrocode} |
| 1889 |
\long\def\caption@@getlabel#1#2\@nil{% |
| 1890 |
\def\@tempa{#1}% |
| 1891 |
\def\@tempb{[}% |
| 1892 |
\ifx\@tempa\@tempb |
| 1893 |
\caption@@@getlabel#1#2\@nil |
| 1894 |
\else |
| 1895 |
\l@addto@macro\caption@thelabel{{#1}}% |
| 1896 |
\fi} |
| 1897 |
% \end{macrocode} |
| 1898 |
% \begin{macrocode} |
| 1899 |
\long\def\caption@@@getlabel[#1]#2\@nil{% |
| 1900 |
\l@addto@macro\caption@thelabel{[{#1}]}% |
| 1901 |
\caption@@getlabel#2\@nil} |
| 1902 |
% \end{macrocode} |
| 1903 |
% \begin{macrocode} |
| 1904 |
\let\caption@thelabel\relax |
| 1905 |
% \end{macrocode} |
| 1906 |
% \end{macro} |
| 1907 |
% |
| 1908 |
% \section{Fonts} |
| 1909 |
% |
| 1910 |
% \begin{macro}{\DeclareCaptionFont} |
| 1911 |
% \changes{v1.0a}{2004/01/22}{Bugfix: Multi token arguments are allowed now} |
| 1912 |
% \changes{v1.1}{2007/05/07}{Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now} |
| 1913 |
% \changes{v1.8h}{2020/01/03}{Check for \package{ragged2e} package related options added} |
| 1914 |
% \changes{v1.10}{2020/05/10}{Optional argument \opt{package} added} |
| 1915 |
% |\DeclareCaptionFont|\oarg{package}\marg{name}\marg{code} |
| 1916 |
% \begin{macrocode} |
| 1917 |
\newcommand*\DeclareCaptionFont{% |
| 1918 |
\@ifnextchar[%] |
| 1919 |
\caption@declare@font |
| 1920 |
\caption@declarefont} |
| 1921 |
\@onlypreamble\DeclareCaptionFont |
| 1922 |
% \end{macrocode} |
| 1923 |
% \begin{macrocode} |
| 1924 |
\def\caption@declare@font[#1]#2{% |
| 1925 |
\global\@namedef{caption@fnt@#2@package}{#1}% |
| 1926 |
\caption@@declarefont{#2}} |
| 1927 |
\@onlypreamble\caption@declare@font |
| 1928 |
% \end{macrocode} |
| 1929 |
% \begin{macrocode} |
| 1930 |
\newcommand*\caption@declarefont[1]{% |
| 1931 |
\global\@nameundef{caption@fnt@#1@package}% |
| 1932 |
\caption@@declarefont{#1}} |
| 1933 |
\@onlypreamble\caption@declarefont |
| 1934 |
% \end{macrocode} |
| 1935 |
% \begin{macrocode} |
| 1936 |
\newcommand*\caption@@declarefont[2]{% |
| 1937 |
\define@key{caption@fnt}{#1}[]{\caption@addto@fnt{#1}{#2}}% |
| 1938 |
\caption@@@declarefont{#1}{#2}} |
| 1939 |
\@onlypreamble\caption@@declarefont |
| 1940 |
% \end{macrocode} |
| 1941 |
% \begin{macrocode} |
| 1942 |
\newcommand*\caption@@@declarefont[2]{}% will be used by \DeclareCaptionJustification |
| 1943 |
\@onlypreamble\caption@@@declarefont |
| 1944 |
% \end{macrocode} |
| 1945 |
% \begin{macrocode} |
| 1946 |
\newcommand*\caption@addto@fnt[2]{% |
| 1947 |
\expandafter\let\expandafter\caption@package\csname caption@fnt@#1@package\endcsname |
| 1948 |
\caption@ifdefined\caption@package |
| 1949 |
{\caption@requirepackage\caption@package{#1}}% load package, if necessary |
| 1950 |
{}% |
| 1951 |
\l@addto@macro\caption@fnt{#2}} |
| 1952 |
% \end{macrocode} |
| 1953 |
% \end{macro} |
| 1954 |
% |
| 1955 |
% \begin{macro}{\DeclareCaptionDefaultFont} |
| 1956 |
% \changes{v1.1}{2006/05/14}{This macro added} |
| 1957 |
% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionFont} to \cs{DeclareCaptionDefaultFont}} |
| 1958 |
% |\DeclareCaptionDefaultFont|\marg{name}\marg{code} |
| 1959 |
% \begin{macrocode} |
| 1960 |
\newcommand*\DeclareCaptionDefaultFont[2]{% |
| 1961 |
\global\@namedef{caption#1@default}{#2}} |
| 1962 |
\@onlypreamble\DeclareCaptionDefaultFont |
| 1963 |
% \end{macrocode} |
| 1964 |
% \end{macro} |
| 1965 |
% |
| 1966 |
% \begin{macrocode} |
| 1967 |
\DeclareCaptionOption{font}{\caption@setfont{font}{#1}} |
| 1968 |
\DeclareCaptionOption{font+}{\caption@addtofont{font}{#1}} |
| 1969 |
\DeclareCaptionDefaultFont{font}{} |
| 1970 |
% \end{macrocode} |
| 1971 |
% \begin{macrocode} |
| 1972 |
\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}} |
| 1973 |
\DeclareCaptionOption{labelfont+}{\caption@addtofont{labelfont}{#1}} |
| 1974 |
\DeclareCaptionDefaultFont{labelfont}{} |
| 1975 |
% \end{macrocode} |
| 1976 |
% \begin{macrocode} |
| 1977 |
\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}} |
| 1978 |
\DeclareCaptionOption{textfont+}{\caption@addtofont{textfont}{#1}} |
| 1979 |
\DeclareCaptionDefaultFont{textfont}{} |
| 1980 |
% \end{macrocode} |
| 1981 |
% |
| 1982 |
% \begin{macro}{\caption@setfont} |
| 1983 |
% \changes{v1.0j}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument} |
| 1984 |
% \changes{v1.1}{2006/05/14}{Support of \cs{DeclareDefaultCaptionFont} added} |
| 1985 |
% |\caption@setfont|\marg{name}\marg{keyval-list of names}\par |
| 1986 |
% Selecting a caption font means saving all the code snippets |
| 1987 |
% in |\caption|\meta{name}. |
| 1988 |
% \begin{macrocode} |
| 1989 |
\newcommand*\caption@setfont[1]{% |
| 1990 |
\expandafter\let\csname caption#1\endcsname\@empty |
| 1991 |
\caption@addtofont{#1}} |
| 1992 |
% \end{macrocode} |
| 1993 |
% \end{macro} |
| 1994 |
% |
| 1995 |
% \begin{macro}{\caption@addtofont} |
| 1996 |
% \changes{v1.2}{2007/11/17}{This macro added} |
| 1997 |
% |\caption@addtofont|\marg{name}\marg{keyval-list of names}\par |
| 1998 |
% Like |\caption@setfont|, but adds the code snippets to |\caption|\meta{name}.\par |
| 1999 |
% Because we use |\setkeys| recursive here we need to do this inside an |
| 2000 |
% extra group. |
| 2001 |
% \begin{macrocode} |
| 2002 |
\newcommand*\caption@addtofont[2]{% |
| 2003 |
\begingroup |
| 2004 |
\expandafter\let\expandafter\caption@fnt\csname caption#1\endcsname |
| 2005 |
\define@key{caption@fnt}{default}[]{% |
| 2006 |
\l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}% |
| 2007 |
\caption@setkeys[caption]{caption@fnt}{#2}% |
| 2008 |
\global\let\caption@tempa\caption@fnt |
| 2009 |
\endgroup |
| 2010 |
\expandafter\let\csname caption#1\endcsname\caption@tempa} |
| 2011 |
% \end{macrocode} |
| 2012 |
% \end{macro} |
| 2013 |
% |
| 2014 |
% \begin{macro}{\caption@font} |
| 2015 |
% \changes{v1.1}{2007/05/07}{This macro added} |
| 2016 |
% |\caption@font|\marg{keyval-list of names}\\ |
| 2017 |
% |\caption@font*|\marg{keyval-code}\par |
| 2018 |
% Sets the given font, e.g.~|\caption@font{small,it}| |
| 2019 |
% is equivalent to |\small\itshape|. |
| 2020 |
% \begin{macrocode} |
| 2021 |
\newcommand*\caption@font{% |
| 2022 |
\caption@teststar\caption@@font\@firstofone |
| 2023 |
{\caption@setkeys[caption]{caption@fnt}}} |
| 2024 |
\newcommand*\caption@@font[2]{% |
| 2025 |
\begingroup |
| 2026 |
\def\caption@fnt{\endgroup}% |
| 2027 |
#1{#2}% |
| 2028 |
\caption@fnt} |
| 2029 |
% \end{macrocode} |
| 2030 |
% \end{macro} |
| 2031 |
% |
| 2032 |
% These are the pre-defined font code snippets. |
| 2033 |
% |
| 2034 |
% \changes{v1.1}{2007/05/07}{Color font support added} |
| 2035 |
% \begin{macrocode} |
| 2036 |
\DeclareCaptionFont{normalcolor}{\normalcolor} |
| 2037 |
\DeclareCaptionFont{color}{\color{#1}} |
| 2038 |
% \end{macrocode} |
| 2039 |
% |
| 2040 |
% \begin{macrocode} |
| 2041 |
\DeclareCaptionFont{normalfont}{\normalfont} |
| 2042 |
\DeclareCaptionFont{up}{\upshape} |
| 2043 |
\DeclareCaptionFont{it}{\itshape} |
| 2044 |
\DeclareCaptionFont{sl}{\slshape} |
| 2045 |
\DeclareCaptionFont{sc}{\scshape} |
| 2046 |
\DeclareCaptionFont{md}{\mdseries} |
| 2047 |
\DeclareCaptionFont{bf}{\bfseries} |
| 2048 |
\DeclareCaptionFont{rm}{\rmfamily} |
| 2049 |
\DeclareCaptionFont{sf}{\sffamily} |
| 2050 |
\DeclareCaptionFont{tt}{\ttfamily} |
| 2051 |
% \end{macrocode} |
| 2052 |
% |
| 2053 |
% \changes{v1.7}{2018/05/01}{Missing font sizes \texttt{tiny}, \texttt{LARGE}, \texttt{huge}, and \texttt{Huge} added} |
| 2054 |
% \begin{macrocode} |
| 2055 |
\DeclareCaptionFont{tiny}{\tiny} |
| 2056 |
\DeclareCaptionFont{scriptsize}{\scriptsize} |
| 2057 |
\DeclareCaptionFont{footnotesize}{\footnotesize} |
| 2058 |
\DeclareCaptionFont{small}{\small} |
| 2059 |
\DeclareCaptionFont{normalsize}{\normalsize} |
| 2060 |
\DeclareCaptionFont{large}{\large} |
| 2061 |
\DeclareCaptionFont{Large}{\Large} |
| 2062 |
\DeclareCaptionFont{LARGE}{\LARGE} |
| 2063 |
\DeclareCaptionFont{huge}{\huge} |
| 2064 |
\DeclareCaptionFont{Huge}{\Huge} |
| 2065 |
% \end{macrocode} |
| 2066 |
% |
| 2067 |
% \changes{v1.8}{2018/05/01}{Font size \texttt{smaller} added} |
| 2068 |
% \begin{macrocode} |
| 2069 |
\newcommand\caption@smaller{% |
| 2070 |
\ifx\@currsize\tiny |
| 2071 |
\relax |
| 2072 |
\else\ifx\@currsize\scriptsize |
| 2073 |
\tiny |
| 2074 |
\else\ifx\@currsize\footnotesize |
| 2075 |
\scriptsize |
| 2076 |
\else\ifx\@currsize\small |
| 2077 |
\footnotesize |
| 2078 |
\else\ifx\@currsize\normalsize |
| 2079 |
\small |
| 2080 |
\else\ifx\@currsize\large |
| 2081 |
\normalsize |
| 2082 |
\else\ifx\@currsize\Large |
| 2083 |
\large |
| 2084 |
\else\ifx\@currsize\LARGE |
| 2085 |
\Large |
| 2086 |
\else\ifx\@currsize\huge |
| 2087 |
\LARGE |
| 2088 |
\else\ifx\@currsize\Huge |
| 2089 |
\huge |
| 2090 |
\else |
| 2091 |
\caption@Warning{% |
| 2092 |
Cannot determine current font size.\MessageBreak |
| 2093 |
Try setting it with `size=' explicitly}% |
| 2094 |
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} |
| 2095 |
\DeclareCaptionFont{smaller}{\caption@smaller} |
| 2096 |
% \end{macrocode} |
| 2097 |
% |
| 2098 |
% \changes{v1.8}{2018/05/02}{Font size \texttt{larger} added} |
| 2099 |
% \begin{macrocode} |
| 2100 |
\newcommand\caption@larger{% |
| 2101 |
\ifx\@currsize\tiny |
| 2102 |
\scriptsize |
| 2103 |
\else\ifx\@currsize\scriptsize |
| 2104 |
\footnotesize |
| 2105 |
\else\ifx\@currsize\footnotesize |
| 2106 |
\small |
| 2107 |
\else\ifx\@currsize\small |
| 2108 |
\normalsize |
| 2109 |
\else\ifx\@currsize\normalsize |
| 2110 |
\large |
| 2111 |
\else\ifx\@currsize\large |
| 2112 |
\Large |
| 2113 |
\else\ifx\@currsize\Large |
| 2114 |
\LARGE |
| 2115 |
\else\ifx\@currsize\LARGE |
| 2116 |
\huge |
| 2117 |
\else\ifx\@currsize\huge |
| 2118 |
\Huge |
| 2119 |
\else\ifx\@currsize\Huge |
| 2120 |
\relax |
| 2121 |
\else |
| 2122 |
\caption@Warning{% |
| 2123 |
Cannot determine current font size.\MessageBreak |
| 2124 |
Try setting it with `size=' explicitly}% |
| 2125 |
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} |
| 2126 |
\DeclareCaptionFont{larger}{\caption@larger} |
| 2127 |
% \end{macrocode} |
| 2128 |
% |
| 2129 |
% \begin{macrocode} |
| 2130 |
\DeclareCaptionFont{singlespacing}{} |
| 2131 |
% \end{macrocode} |
| 2132 |
% |
| 2133 |
% \begin{macrocode} |
| 2134 |
%\DeclareCaptionFont{normal}{% |
| 2135 |
% \caption@font{normalcolor,normalfont,normalsize,singlespacing} |
| 2136 |
\DeclareCaptionFont{normal}{% |
| 2137 |
\caption@font*{% |
| 2138 |
\KV@caption@fnt@normalcolor\@unused |
| 2139 |
\KV@caption@fnt@normalfont\@unused |
| 2140 |
\KV@caption@fnt@normalsize\@unused |
| 2141 |
\KV@caption@fnt@singlespacing\@unused}} |
| 2142 |
% \end{macrocode} |
| 2143 |
% |
| 2144 |
% \changes{v1.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}} |
| 2145 |
% The old versions \version{1.x} of \thispackage\ offered this |
| 2146 |
% command to setup the font size used for captions. We still do |
| 2147 |
% so old documents will work fine. |
| 2148 |
% \begin{macrocode} |
| 2149 |
\DeclareCaptionOption{size}{\caption@setfont{size}{#1}} |
| 2150 |
\DeclareCaptionDefaultFont{size}{} |
| 2151 |
% \end{macrocode} |
| 2152 |
% |
| 2153 |
% \section{Justifications} |
| 2154 |
% |
| 2155 |
% \begin{macro}{\DeclareCaptionJustification} |
| 2156 |
% \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces |
| 2157 |
% between arguments do make any harm} |
| 2158 |
% \changes{v1.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}} |
| 2159 |
% |\DeclareCaptionJustification|\marg{name}\marg{code} |
| 2160 |
% \begin{macrocode} |
| 2161 |
\newcommand*\DeclareCaptionJustification{% |
| 2162 |
\def\caption@@@declarefont##1##2{% |
| 2163 |
\global\@namedef{caption@hj@##1}{##2}% for compatibility to v1.0, needed by floatrow package |
| 2164 |
\let\caption@@@declarefont\@gobbletwo}% |
| 2165 |
\DeclareCaptionFont} |
| 2166 |
\@onlypreamble\DeclareCaptionJustification |
| 2167 |
% \end{macrocode} |
| 2168 |
% \end{macro} |
| 2169 |
% |
| 2170 |
% \begin{macro}{\DeclareCaptionDefaultJustification} |
| 2171 |
% \changes{v1.1}{2007/07/03}{This macro added} |
| 2172 |
% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionJustification} to \cs{DeclareCaptionDefaultJustification}} |
| 2173 |
% |\DeclareCaptionDefaultJustification|\marg{code} |
| 2174 |
% \begin{macrocode} |
| 2175 |
\newcommand*\DeclareCaptionDefaultJustification[1]{% |
| 2176 |
\global\@namedef{caption@hj@default}{#1}% for compatibility to v1.0 |
| 2177 |
\DeclareCaptionDefaultFont{@hj}{#1}} |
| 2178 |
\@onlypreamble\DeclareCaptionDefaultJustification |
| 2179 |
% \end{macrocode} |
| 2180 |
% \end{macro} |
| 2181 |
% |
| 2182 |
% \begin{macrocode} |
| 2183 |
\DeclareCaptionOption{justification}{\caption@setjustification{#1}} |
| 2184 |
\DeclareCaptionDefaultJustification{} |
| 2185 |
% \end{macrocode} |
| 2186 |
% |
| 2187 |
% \begin{macro}{\caption@setjustification} |
| 2188 |
% \changes{v1.1}{2007/07/03}{Mapped to \cs{caption@setfont}} |
| 2189 |
% |\caption@setjustification|\marg{name}\par |
| 2190 |
% Selecting a caption justification simply means saving the code (in |\caption@hj|). |
| 2191 |
% \begin{macrocode} |
| 2192 |
\newcommand*\caption@setjustification{\caption@setfont{@hj}} |
| 2193 |
% \end{macrocode} |
| 2194 |
% \end{macro} |
| 2195 |
% |
| 2196 |
% These are the pre-defined justification code snippets. |
| 2197 |
% \begin{macrocode} |
| 2198 |
\DeclareCaptionJustification{justified}{} |
| 2199 |
\DeclareCaptionJustification{centering}{\centering} |
| 2200 |
\DeclareCaptionJustification{centerfirst}{\centerfirst} |
| 2201 |
\DeclareCaptionJustification{centerlast}{\centerlast} |
| 2202 |
\DeclareCaptionJustification{raggedleft}{\raggedleft} |
| 2203 |
\DeclareCaptionJustification{raggedright}{\raggedright} |
| 2204 |
% \end{macrocode} |
| 2205 |
% |
| 2206 |
% \begin{macro}{\centerfirst} |
| 2207 |
% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)} |
| 2208 |
% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}} |
| 2209 |
% Please blame Frank Mittelbach for the code of |\centerfirst| |:-)| |
| 2210 |
% \begin{macrocode} |
| 2211 |
\providecommand\centerfirst{% |
| 2212 |
\let\\\@centercr |
| 2213 |
\edef\caption@normaladjust{% |
| 2214 |
\leftskip\the\leftskip |
| 2215 |
\rightskip\the\rightskip |
| 2216 |
\parfillskip\the\parfillskip\relax}% |
| 2217 |
\leftskip\z@\@plus -1fil% |
| 2218 |
\rightskip\z@\@plus 1fil% |
| 2219 |
\parfillskip\z@skip |
| 2220 |
\noindent\hskip\z@\@plus 2fil% |
| 2221 |
\@setpar{\@@par\@restorepar\caption@normaladjust}} |
| 2222 |
% \end{macrocode} |
| 2223 |
% \end{macro} |
| 2224 |
% |
| 2225 |
% \begin{macro}{\centerlast} |
| 2226 |
% \changes{v1.0j}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)} |
| 2227 |
% \changes{v1.0j}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}} |
| 2228 |
% This is based on code from Anne Br\"uggemann-Klein\cite{Anne} |
| 2229 |
% \begin{macrocode} |
| 2230 |
\providecommand\centerlast{% |
| 2231 |
\let\\\@centercr |
| 2232 |
\leftskip\z@\@plus 1fil% |
| 2233 |
\rightskip\z@\@plus -1fil% |
| 2234 |
\parfillskip\z@\@plus 2fil\relax} |
| 2235 |
% \end{macrocode} |
| 2236 |
% \end{macro} |
| 2237 |
% |
| 2238 |
% \section{Vertical spaces before and after captions} |
| 2239 |
% |
| 2240 |
% \begin{macro}{\abovecaptionskip} |
| 2241 |
% \begin{macro}{\belowcaptionskip} |
| 2242 |
% Usually these skips are defined within the document class, but some |
| 2243 |
% document classes don't do so. |
| 2244 |
% \begin{macrocode} |
| 2245 |
\caption@ifundefined\abovecaptionskip{% |
| 2246 |
\newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{} |
| 2247 |
\caption@ifundefined\belowcaptionskip{% |
| 2248 |
\newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{} |
| 2249 |
% \end{macrocode} |
| 2250 |
% \end{macro} |
| 2251 |
% \end{macro} |
| 2252 |
% |
| 2253 |
% \changes{v1.0c}{2005/02/12}{Option \opt{skip=} added} |
| 2254 |
% \begin{macrocode} |
| 2255 |
\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}} |
| 2256 |
\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}} |
| 2257 |
\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}} |
| 2258 |
% \end{macrocode} |
| 2259 |
% |
| 2260 |
% \begin{macro}{\caption@rule} |
| 2261 |
% \changes{v1.2b}{2008/05/06}{This macro added} |
| 2262 |
% |\caption@rule|\par |
| 2263 |
% Draws an invisible rule to adjust the ``skip'' setting. |
| 2264 |
% \begin{macrocode} |
| 2265 |
\newcommand*\caption@rule{\caption@ifrule\caption@hrule\relax} |
| 2266 |
% \end{macrocode} |
| 2267 |
% \begin{macrocode} |
| 2268 |
\newcommand*\caption@hrule{\hrule\@height\z@} |
| 2269 |
% \end{macrocode} |
| 2270 |
% \end{macro} |
| 2271 |
% |
| 2272 |
% \changes{v1.2b}{2008/05/06}{Option \opt{rule=} added} |
| 2273 |
% \begin{macrocode} |
| 2274 |
\DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}} |
| 2275 |
% \end{macrocode} |
| 2276 |
% |
| 2277 |
% \section{Positioning} |
| 2278 |
% |
| 2279 |
% These macros handle the right position of the caption. |
| 2280 |
% Note that the position is actually \emph{not} controlled by the |
| 2281 |
% \package{caption3} kernel options, but by the user (or a specific package |
| 2282 |
% like the \package{float} package) instead. |
| 2283 |
% The user can put the |\caption| command wherever he likes! So this stuff |
| 2284 |
% is only to give us a \emph{hint} where to put the right skips, the user |
| 2285 |
% usually has to take care for himself that this hint actually matches the |
| 2286 |
% right position. |
| 2287 |
% |
| 2288 |
% \begin{macrocode} |
| 2289 |
\DeclareCaptionOption{position}{\caption@setposition{#1}} |
| 2290 |
% \end{macrocode} |
| 2291 |
% \changes{v1.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added} |
| 2292 |
% \begin{macrocode} |
| 2293 |
\DeclareCaptionOption{figureposition}{% |
| 2294 |
\captionsetup*[figure]{position=#1}} |
| 2295 |
\@onlypreamble@key{caption}{figureposition} |
| 2296 |
% \end{macrocode} |
| 2297 |
% \begin{macrocode} |
| 2298 |
\DeclareCaptionOption{tableposition}{% |
| 2299 |
\captionsetup*[table]{position=#1}} |
| 2300 |
\@onlypreamble@key{caption}{tableposition} |
| 2301 |
% \end{macrocode} |
| 2302 |
% |
| 2303 |
% \begin{macro}{\caption@setposition} |
| 2304 |
% \changes{v1.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b}, |
| 2305 |
% \opt{below}, and \opt{a} are allowed, too} |
| 2306 |
% \changes{v1.0c}{2004/08/10}{Usage of \cs{caption@defaultpos} added} |
| 2307 |
% |\caption@setposition|\marg{position}\par |
| 2308 |
% Selecting the caption position means that we put |\caption@position| to |
| 2309 |
% the right value. \emph{Please do \textbf{not} use the internal macro |
| 2310 |
% \cs{caption@position} in your own package or document, but use the wrapper |
| 2311 |
% macro \cs{caption@iftop} instead.} |
| 2312 |
% \begin{macrocode} |
| 2313 |
\newcommand*\caption@setposition[1]{% |
| 2314 |
\caption@ifinlist{#1}{d,default}{% |
| 2315 |
\let\caption@position\caption@defaultpos |
| 2316 |
}{\caption@ifinlist{#1}{t,top,above}{% |
| 2317 |
\let\caption@position\@firstoftwo |
| 2318 |
}{\caption@ifinlist{#1}{b,bottom,below}{% |
| 2319 |
\let\caption@position\@secondoftwo |
| 2320 |
}{\caption@ifinlist{#1}{a,auto}{% |
| 2321 |
\let\caption@position\@undefined |
| 2322 |
}{% |
| 2323 |
\caption@Error{Undefined position `#1'}% |
| 2324 |
}}}}} |
| 2325 |
% \end{macrocode} |
| 2326 |
% \end{macro} |
| 2327 |
% |
| 2328 |
% \begin{macro}{\caption@defaultpos} |
| 2329 |
% \changes{v1.1}{2007/05/08}{Default position changed from `bottom' to `auto'} |
| 2330 |
% The default `position' is `auto', this means that \thispackage\ will try |
| 2331 |
% to guess the current position of the caption. |
| 2332 |
% (But in many cases, for example in |longtable|s, this is doomed to fail!)\par |
| 2333 |
% The setting `bottom' correspondents to the |\@makecaption| implementation |
| 2334 |
% in the standard \LaTeX\ document classes, but `auto' should give better |
| 2335 |
% results in most cases. |
| 2336 |
% \begin{macrocode} |
| 2337 |
%\caption@setdefaultpos{a}% default = auto |
| 2338 |
\let\caption@defaultpos\@undefined |
| 2339 |
% \end{macrocode} |
| 2340 |
% \end{macro} |
| 2341 |
% |
| 2342 |
% \begin{macro}{\caption@iftop} |
| 2343 |
% \changes{v1.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}} |
| 2344 |
% \changes{v1.0c}{2005/02/12}{Adapted to \cs{caption@defaultpos}} |
| 2345 |
% \changes{v1.1}{2007/05/08}{Position will be fixed to `bottom' if `auto'} |
| 2346 |
% |\caption@iftop|\marg{true-code}\marg{false-code}\par |
| 2347 |
% (If the |position=| is set to |auto| we assume a |bottom| position here.) |
| 2348 |
% \begin{macrocode} |
| 2349 |
\newcommand*\caption@iftop{% |
| 2350 |
\ifx\caption@position\@undefined |
| 2351 |
\let\caption@position\@secondoftwo |
| 2352 |
% = \caption@setposition b% |
| 2353 |
\fi |
| 2354 |
\caption@position} |
| 2355 |
% \end{macrocode} |
| 2356 |
% \end{macro} |
| 2357 |
% |
| 2358 |
% \begin{macro}{\caption@fixposition} |
| 2359 |
% \changes{v1.0b}{2004/05/16}{% |
| 2360 |
% Split into \cs{caption@fixposition} & \cs{caption@autoposition}} |
| 2361 |
% |\caption@fixposition|\par |
| 2362 |
% This macro checks if the `position' is set to `auto'. |
| 2363 |
% If yes, |\caption@autoposition| will be called to |
| 2364 |
% set |\caption@position| to a proper value we can actually use. |
| 2365 |
% \begin{macrocode} |
| 2366 |
\newcommand*\caption@fixposition{% |
| 2367 |
\ifx\caption@position\@undefined |
| 2368 |
\caption@autoposition |
| 2369 |
\fi} |
| 2370 |
% \end{macrocode} |
| 2371 |
% \end{macro} |
| 2372 |
% |
| 2373 |
% \begin{macro}{\caption@autoposition} |
| 2374 |
% \changes{v1.0a}{2004/01/23}{\cs{ifvmode} added} |
| 2375 |
% |\caption@autoposition|\par |
| 2376 |
% We guess the current position of the caption by checking |\prevdepth|.\par |
| 2377 |
% A different solution would be setting the |\spacefactor| to something |
| 2378 |
% not much less than 1000 (for example 994) in |\caption@start| and |
| 2379 |
% checking this value here by |\ifnum\spacefactor=994|. |
| 2380 |
% (It's implemented in the \package{threeparttable} |
| 2381 |
% package\cite{threeparttable} this way.)\par |
| 2382 |
% Another idea would be checking |\@ifminipage|, but since some packages |
| 2383 |
% typeset the caption within a simple |\vbox| this does not seem to be a |
| 2384 |
% good one. |
| 2385 |
% \begin{macrocode} |
| 2386 |
\newcommand*\caption@autoposition{% |
| 2387 |
\ifvmode |
| 2388 |
\edef\caption@tempa{\the\prevdepth}% |
| 2389 |
\caption@Debug{\protect\prevdepth=\caption@tempa}% |
| 2390 |
\ifdim\prevdepth>-\p@ |
| 2391 |
\let\caption@position\@secondoftwo |
| 2392 |
\else |
| 2393 |
\let\caption@position\@firstoftwo |
| 2394 |
\fi |
| 2395 |
% = \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}% |
| 2396 |
\else |
| 2397 |
\caption@Debug{no \protect\prevdepth}% |
| 2398 |
\let\caption@position\@secondoftwo |
| 2399 |
% = \caption@setposition b% |
| 2400 |
\fi} |
| 2401 |
% \end{macrocode} |
| 2402 |
% \end{macro} |
| 2403 |
% \begin{macro}{\caption@setautoposition} |
| 2404 |
% \changes{v1.1}{2007/06/10}{This macro added} |
| 2405 |
% |\caption@setautoposition|\marg{position}\par |
| 2406 |
% replaces the above algorithm by a different one (or a fixed position setting). |
| 2407 |
% \begin{macrocode} |
| 2408 |
\newcommand*\caption@setautoposition[1]{% |
| 2409 |
\def\caption@autoposition{\caption@setposition{#1}}} |
| 2410 |
% \end{macrocode} |
| 2411 |
% \end{macro} |
| 2412 |
% |
| 2413 |
% \section{Hooks} |
| 2414 |
% |
| 2415 |
% \begin{macro}{\AtBeginCaption} |
| 2416 |
% \begin{macro}{\AtEndCaption} |
| 2417 |
% |\AtBeginCaption| \marg{code}\\ |
| 2418 |
% |\AtEndCaption| \marg{code}\par |
| 2419 |
% These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|. |
| 2420 |
% \begin{macrocode} |
| 2421 |
\newcommand*\caption@beginhook{} |
| 2422 |
\newcommand*\caption@endhook{} |
| 2423 |
\newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook} |
| 2424 |
\newcommand*\AtEndCaption{\l@addto@macro\caption@endhook} |
| 2425 |
% \end{macrocode} |
| 2426 |
% \end{macro} |
| 2427 |
% \end{macro} |
| 2428 |
% |
| 2429 |
% \section{Lists} |
| 2430 |
% |
| 2431 |
% \changes{v1.0b}{2004/05/16}{Option \opt{listof=} added} |
| 2432 |
% \changes{v1.2}{2007/11/17}{Option \opt{list=} added} |
| 2433 |
% \begin{macrocode} |
| 2434 |
\DeclareCaptionOption{list}[1]{\caption@setlist{#1}} |
| 2435 |
\DeclareCaptionOption{listof}[1]{\caption@setlist{#1}} |
| 2436 |
% \end{macrocode} |
| 2437 |
% |
| 2438 |
% \begin{macro}{\caption@setlist} |
| 2439 |
% \changes{v1.2a}{2008/03/20}{This macro added} |
| 2440 |
% |\caption@setlist|\marg{boolean} |
| 2441 |
% \begin{macrocode} |
| 2442 |
\newcommand*\caption@setlist{\caption@set@bool\caption@iflist} |
| 2443 |
% \end{macrocode} |
| 2444 |
% \end{macro} |
| 2445 |
% |
| 2446 |
% \changes{v1.4}{2011/08/30}{Option \opt{listtype=} added} |
| 2447 |
% \changes{v1.4}{2011/08/30}{Option \opt{listtype+=} added} |
| 2448 |
% \begin{macrocode} |
| 2449 |
\DeclareCaptionOption{listtype}{\caption@setlisttype{#1}} |
| 2450 |
\DeclareCaptionOption{listtype+}{\caption@setlisttype@ext{#1}} |
| 2451 |
% \end{macrocode} |
| 2452 |
% |
| 2453 |
% \begin{macro}{\caption@setlisttype} |
| 2454 |
% \changes{v1.4}{2011/08/30}{This macro added} |
| 2455 |
% |\caption@setlisttype|\marg{type} |
| 2456 |
% \begin{macrocode} |
| 2457 |
\newcommand*\caption@setlisttype{% |
| 2458 |
\caption@setlisttype@ext{}% |
| 2459 |
\caption@@setlisttype\caption@listtype} |
| 2460 |
% \end{macrocode} |
| 2461 |
% \begin{macrocode} |
| 2462 |
\newcommand*\caption@@setlisttype[2]{% |
| 2463 |
\edef#1{#2}% |
| 2464 |
\ifx#1\@empty \let#1\@undefined \fi} |
| 2465 |
% \end{macrocode} |
| 2466 |
% \end{macro} |
| 2467 |
% \begin{macro}{\caption@setlisttype@ext} |
| 2468 |
% \changes{v1.4}{2011/08/30}{This macro added} |
| 2469 |
% |\caption@setlisttype@ext|\marg{type extension} |
| 2470 |
% \begin{macrocode} |
| 2471 |
\newcommand*\caption@setlisttype@ext{% |
| 2472 |
\caption@@setlisttype\caption@listtype@ext} |
| 2473 |
% \end{macrocode} |
| 2474 |
% \end{macro} |
| 2475 |
% |
| 2476 |
% \begin{macro}{\DeclareCaptionListFormat} |
| 2477 |
% \changes{v1.1}{2004/07/15}{This macro added} |
| 2478 |
% \changes{v1.2}{2007/11/17}{Renamed from \cs{DeclareCaptionListOfFormat} to \cs{DeclareCaptionListFormat}} |
| 2479 |
% |\DeclareCaptionListFormat|\marg{name}\marg{code with \#1 and \#2} |
| 2480 |
% \begin{macrocode} |
| 2481 |
\newcommand*\DeclareCaptionListFormat[2]{% |
| 2482 |
\global\@namedef{caption@lstfmt@#1}##1##2{#2}} |
| 2483 |
\@onlypreamble\DeclareCaptionListFormat |
| 2484 |
% \end{macrocode} |
| 2485 |
% \end{macro} |
| 2486 |
% |
| 2487 |
% \changes{v1.1}{2007/07/15}{Option \opt{listofformat=} added} |
| 2488 |
% \changes{v1.2}{2007/11/17}{Option \opt{listofformat=} renamed to \opt{listformat=}} |
| 2489 |
% \begin{macrocode} |
| 2490 |
\DeclareCaptionOption{listformat}{\caption@setlistformat{#1}} |
| 2491 |
% \end{macrocode} |
| 2492 |
% |
| 2493 |
% \begin{macro}{\caption@setlistformat} |
| 2494 |
% \changes{v1.1}{2004/07/15}{This macro added} |
| 2495 |
% \changes{v1.2}{2007/11/17}{Renamed from \cs{caption@setlistofformat} to \cs{caption@setlistformat}} |
| 2496 |
% |\caption@setlistformat|\marg{name}\par |
| 2497 |
% Selecting a caption list format simply means saving the code (in |\caption@lstfmt|). |
| 2498 |
% \begin{macrocode} |
| 2499 |
\newcommand*\caption@setlistformat[1]{% |
| 2500 |
\@ifundefined{caption@lstfmt@#1}% |
| 2501 |
{\caption@Error{Undefined list format `#1'}}% |
| 2502 |
{\expandafter\let\expandafter\caption@lstfmt |
| 2503 |
\csname caption@lstfmt@#1\endcsname}} |
| 2504 |
% \end{macrocode} |
| 2505 |
% \end{macro} |
| 2506 |
% |
| 2507 |
% There are five pre-defined list formats, taken from the \package{subfig} package. |
| 2508 |
% \begin{macrocode} |
| 2509 |
\DeclareCaptionListFormat{empty}{} |
| 2510 |
\DeclareCaptionListFormat{simple}{#1#2} |
| 2511 |
\DeclareCaptionListFormat{parens}{#1(#2)} |
| 2512 |
\DeclareCaptionListFormat{subsimple}{#2} |
| 2513 |
\DeclareCaptionListFormat{subparens}{(#2)} |
| 2514 |
% \end{macrocode} |
| 2515 |
% |
| 2516 |
% \begin{macro}{\caption@setdefaultlistformat} |
| 2517 |
% \changes{v1.2d}{2009/03/29}{This macro added} |
| 2518 |
% \begin{macrocode} |
| 2519 |
\newcommand*\caption@setdefaultlistformat[1]{% |
| 2520 |
\ifx\caption@lstfmt\caption@lstfmt@default |
| 2521 |
\caption@set@default@listformat{#1}% |
| 2522 |
\caption@setlistformat{default}% |
| 2523 |
\else |
| 2524 |
\caption@set@default@listformat{#1}% |
| 2525 |
\fi} |
| 2526 |
% \end{macrocode} |
| 2527 |
% \begin{macrocode} |
| 2528 |
\newcommand*\caption@set@default@listformat[1]{% |
| 2529 |
\def\caption@lstfmt@default{\@nameuse{caption@lstfmt@#1}}} |
| 2530 |
% \end{macrocode} |
| 2531 |
% \end{macro} |
| 2532 |
% |
| 2533 |
% `default' usually maps to `subsimple'. |
| 2534 |
% \begin{macrocode} |
| 2535 |
\caption@set@default@listformat{subsimple} |
| 2536 |
% \end{macrocode} |
| 2537 |
% |
| 2538 |
% \section{Debug option} |
| 2539 |
% \changes{v1.0k}{2007/03/04}{Debug option added} |
| 2540 |
% |
| 2541 |
% \begin{macrocode} |
| 2542 |
\DeclareCaptionOption{debug}[1]{% |
| 2543 |
\caption@set@bool\caption@ifdebug{#1}% |
| 2544 |
\caption@ifdebug |
| 2545 |
{\let\caption@Debug\caption@Info}% |
| 2546 |
{\let\caption@Debug\@gobble}} |
| 2547 |
% \end{macrocode} |
| 2548 |
% \begin{macrocode} |
| 2549 |
\DeclareOption{debug}{\setkeys{caption}{debug}} |
| 2550 |
% \end{macrocode} |
| 2551 |
% \begin{macrocode} |
| 2552 |
\setkeys{caption}{debug=0} |
| 2553 |
% \end{macrocode} |
| 2554 |
% |
| 2555 |
% \section{Document classes \& Babel support} |
| 2556 |
% |
| 2557 |
% \begin{macro}{\caption@ifdocumentclass} |
| 2558 |
% Boolean switch which is set if the document class could be detected successfully, |
| 2559 |
% i.e. |\caption@document|\-|class| is set to a proper value. |
| 2560 |
% (If |\caption@document|\-|class| is already set, this flag will also be set.) |
| 2561 |
% \begin{macrocode} |
| 2562 |
\caption@setbool{documentclass}{1} |
| 2563 |
% \end{macrocode} |
| 2564 |
% \end{macro} |
| 2565 |
% |
| 2566 |
% \begin{macro}{\caption@documentclass} |
| 2567 |
% \changes{v1.8e}{2018/05/11}{This macro added} |
| 2568 |
% Determine document class used. |
| 2569 |
% Set |\caption@document|\-|class| by good-guessing, if not already set. |
| 2570 |
% \begin{macrocode} |
| 2571 |
\caption@ifundefined\caption@documentclass{% |
| 2572 |
% \end{macrocode} |
| 2573 |
% \begin{macrocode} |
| 2574 |
\@ifclassloaded{beamer}{% |
| 2575 |
\caption@InfoNoLine{beamer document class detected}% |
| 2576 |
\def\caption@documentclass{beamer}% |
| 2577 |
% \end{macrocode} |
| 2578 |
% \begin{macrocode} |
| 2579 |
}{\@ifclassloaded{elsarticle}{% |
| 2580 |
\caption@InfoNoLine{elsarticle document class detected}% |
| 2581 |
\def\caption@documentclass{elsarticle}% |
| 2582 |
% \end{macrocode} |
| 2583 |
% \begin{macrocode} |
| 2584 |
}{\@ifclassloaded{memoir}{% |
| 2585 |
\caption@InfoNoLine{memoir document class detected}% |
| 2586 |
\def\caption@documentclass{memoir}% |
| 2587 |
% \end{macrocode} |
| 2588 |
% \begin{macrocode} |
| 2589 |
}{\caption@ifdefined\scr@caption{% |
| 2590 |
\caption@InfoNoLine{KOMA-Script document class detected}% |
| 2591 |
\def\caption@documentclass{koma}% |
| 2592 |
% \end{macrocode} |
| 2593 |
% If |\@captionheadfont| is defined, we assume it's a AMS or SMF document class. |
| 2594 |
% \begin{macrocode} |
| 2595 |
}{\caption@ifdefined\@captionheadfont{% |
| 2596 |
\caption@InfoNoLine{AMS or SMF document class detected}% |
| 2597 |
\def\caption@documentclass{ams}% |
| 2598 |
% \end{macrocode} |
| 2599 |
% If |\@CaptionFonts| is defined, we assume it's a NTG Dutch document class. |
| 2600 |
% \begin{macrocode} |
| 2601 |
}{\caption@ifdefined\CaptionFonts{% |
| 2602 |
\caption@InfoNoLine{NTG document class detected}% |
| 2603 |
\def\caption@documentclass{ntg}% |
| 2604 |
% \end{macrocode} |
| 2605 |
% If |\cph@font| and |\cpb@font| are defined, we assume it's a NTG Dutch document class. |
| 2606 |
% \begin{macrocode} |
| 2607 |
}{\caption@ifdefined\cph@font{% |
| 2608 |
\caption@ifdefined\cpb@font\@firstoftwo\@secondoftwo |
| 2609 |
}{% |
| 2610 |
\@secondoftwo |
| 2611 |
}{% |
| 2612 |
\caption@InfoNoLine{thesis document class detected}% |
| 2613 |
\def\caption@documentclass{thesis}% |
| 2614 |
}{% |
| 2615 |
% \end{macrocode} |
| 2616 |
% If the definition of |\@makecaption| matches the one from the standard \LaTeX\ document classes |
| 2617 |
% |article|, |report|, or |book|, we assume it's either one of them or is compatible to them. |
| 2618 |
% \begin{macrocode} |
| 2619 |
% article|report|book [2005/09/16 v1.4f Standard LaTeX document class] |
| 2620 |
\long\def\caption@tempa#1#2{% |
| 2621 |
\vskip\abovecaptionskip |
| 2622 |
\sbox\@tempboxa{#1: #2}% |
| 2623 |
\ifdim \wd\@tempboxa >\hsize |
| 2624 |
#1: #2\par |
| 2625 |
\else |
| 2626 |
\global \@minipagefalse |
| 2627 |
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% |
| 2628 |
\fi |
| 2629 |
\vskip\belowcaptionskip}} |
| 2630 |
\ifx\caption@tempa\@makecaption |
| 2631 |
\caption@InfoNoLine{Standard document class detected}% |
| 2632 |
\else |
| 2633 |
% \end{macrocode} |
| 2634 |
% Otherwise we are clueless and use standard default settings for the captions anyway. |
| 2635 |
% (And we unset the |document|\-|class| flag to indicate that the content of |\caption@document|\-|class| is not correct.) |
| 2636 |
% \begin{macrocode} |
| 2637 |
\caption@InfoNoLine{% |
| 2638 |
Unknown document class (or package),\MessageBreak |
| 2639 |
standard defaults will be used}% |
| 2640 |
\caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}% |
| 2641 |
\caption@setbool{documentclass}{0}% |
| 2642 |
\fi |
| 2643 |
\def\caption@documentclass{base}% |
| 2644 |
}}}}}}% |
| 2645 |
}{} |
| 2646 |
% \end{macrocode} |
| 2647 |
% \end{macro} |
| 2648 |
% |
| 2649 |
% \begin{macro}{\caption@ifclassloaded} |
| 2650 |
% \changes{v1.8e}{2019/09/09}{This macro added} |
| 2651 |
% |\caption@ifclassloaded|\marg{name}\marg{yes-code}\marg{no-code} |
| 2652 |
% \begin{macrocode} |
| 2653 |
\newcommand*\caption@ifclassloaded[1]{% |
| 2654 |
\edef\caption@tempa{#1}% |
| 2655 |
\ifx\caption@tempa\caption@documentclass |
| 2656 |
\expandafter\@firstoftwo |
| 2657 |
\else |
| 2658 |
\expandafter\@secondoftwo |
| 2659 |
\fi} |
| 2660 |
% \end{macrocode} |
| 2661 |
% \end{macro} |
| 2662 |
% |
| 2663 |
% \subsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes} |
| 2664 |
% |
| 2665 |
% Since this is the default, there is no extra work to be done here. |
| 2666 |
% |
| 2667 |
% \subsection{The elsarticle classes} |
| 2668 |
% \changes{v1.5}{2013/01/06}{elsarticle class support added} |
| 2669 |
% |
| 2670 |
% \begin{macrocode} |
| 2671 |
\caption@ifclassloaded{elsarticle}{% |
| 2672 |
% \end{macrocode} |
| 2673 |
% \begin{macrocode} |
| 2674 |
\DeclareCaptionDefaultFont{font}{\footnotesize} |
| 2675 |
% \end{macrocode} |
| 2676 |
% \begin{macrocode} |
| 2677 |
}{} |
| 2678 |
% \end{macrocode} |
| 2679 |
% |
| 2680 |
% \subsection{The \AmS{} \& \SmF{} classes} |
| 2681 |
% \changes{v1.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added} |
| 2682 |
% |
| 2683 |
% \begin{macrocode} |
| 2684 |
\caption@ifclassloaded{ams}{% |
| 2685 |
% \end{macrocode} |
| 2686 |
% \begin{macrocode} |
| 2687 |
\let\captionmargin\captionindent % set to 3pc by AMS class |
| 2688 |
\begingroup\edef\@tempa{\endgroup |
| 2689 |
\noexpand\caption@g@addto@list\noexpand\caption@sty@default |
| 2690 |
{margin=\the\captionmargin |
| 2691 |
\caption@ifdefined\smf@makecaption{,maxmargin=.1\linewidth}{}}} |
| 2692 |
\@tempa |
| 2693 |
\caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin} |
| 2694 |
\DeclareCaptionLabelSeparator{default}{.\enspace} |
| 2695 |
\DeclareCaptionDefaultFont{font}{\@captionfont} |
| 2696 |
\DeclareCaptionDefaultFont{labelfont}{\@captionheadfont} |
| 2697 |
\DeclareCaptionDefaultFont{textfont}{\@captionfont\upshape} |
| 2698 |
\captionsetup[figure]{position=b} |
| 2699 |
\captionsetup[table]{position=t} |
| 2700 |
% \end{macrocode} |
| 2701 |
% \begin{macrocode} |
| 2702 |
}{} |
| 2703 |
% \end{macrocode} |
| 2704 |
% |
| 2705 |
% \subsection{The beamer class (Part one)} |
| 2706 |
% \changes{v1.1}{2007/03/10}{\package{beamer} class support added} |
| 2707 |
% \changes{v1.3}{2011/08/06}{\package{beamer} class support revised} |
| 2708 |
% \changes{v1.5}{2013/04/27}{The \package{beamer} template \texttt{caption label separator} will be used now} |
| 2709 |
% \changes{v1.7}{2016/05/22}{Re-definition of label format \texttt{simpleMagyar} added to \package{beamer} class support} |
| 2710 |
% \changes{v1.7}{2018/04/15}{Re-definition of label format \texttt{simpleMagyar} revised} |
| 2711 |
% \changes{v1.7}{2018/05/01}{Definition of \package{beamer} default label font revised} |
| 2712 |
% |
| 2713 |
% \begin{macrocode} |
| 2714 |
\caption@ifclassloaded{beamer}{% |
| 2715 |
% \end{macrocode} |
| 2716 |
% |
| 2717 |
% \begin{macro}{\caption@ifbeamertemplate} |
| 2718 |
% |\caption@ifbeamertemplate|\marg{caption template name}\marg{yes-code}\marg{no-code}\\ |
| 2719 |
% tests if the given beamer caption template was selected by the user (or not). |
| 2720 |
% \begin{macrocode} |
| 2721 |
\newcommand*\caption@ifbeamertemplate[1]{% |
| 2722 |
\begingroup |
| 2723 |
\let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption |
| 2724 |
\@nameuse{beamer@@tmpop@caption@#1}% |
| 2725 |
\ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption |
| 2726 |
\endgroup\expandafter\@firstoftwo |
| 2727 |
\else |
| 2728 |
\endgroup\expandafter\@secondoftwo |
| 2729 |
\fi} |
| 2730 |
% \end{macrocode} |
| 2731 |
% \end{macro} |
| 2732 |
% |
| 2733 |
% \begin{macrocode} |
| 2734 |
\DeclareCaptionLabelFormat{default}{% |
| 2735 |
\caption@ifbeamertemplate{numbered}% |
| 2736 |
\caption@lfmt@simple |
| 2737 |
\caption@lfmt@unnumbered |
| 2738 |
{#1}{#2}} |
| 2739 |
% \end{macrocode} |
| 2740 |
% The \package{magyar} babel package redefines the current label format to a one called |simple|\-|Magyar|, |
| 2741 |
% defined within |\@@magyar@caption|\-|fix| which will be executed |\At|\-|Begin|\-|Document|. |
| 2742 |
% \begin{macrocode} |
| 2743 |
\DeclareCaptionLabelFormat{default@magyar}{% |
| 2744 |
\caption@ifbeamertemplate{numbered}% |
| 2745 |
\caption@lfmt@simple@magyar |
| 2746 |
\caption@lfmt@unnumbered |
| 2747 |
{#1}{#2}} |
| 2748 |
\@ifundefined{@@magyar@captionfix}\AtBeginDocument\@firstofone{% |
| 2749 |
\@ifundefined{@@magyar@captionfix}{}{% |
| 2750 |
\g@addto@macro\@@magyar@captionfix{% |
| 2751 |
\let\caption@lfmt@simple@magyar\caption@lfmt@simpleMagyar |
| 2752 |
\let\caption@lfmt@simpleMagyar\caption@lfmt@default@magyar}}} |
| 2753 |
% \end{macrocode} |
| 2754 |
% \begin{macrocode} |
| 2755 |
\caption@declarelabelseparator |
| 2756 |
{\caption@ifbeamertemplate{caption name own line}\@gobble\@firstofone} |
| 2757 |
{default} |
| 2758 |
{\caption@ifbeamertemplate{caption name own line}{\\}% |
| 2759 |
{\usebeamertemplate{caption label separator}}} |
| 2760 |
\DeclareCaptionDefaultFont{font}{% |
| 2761 |
\usebeamerfont*{caption}% |
| 2762 |
\usebeamercolor[fg]{caption}} |
| 2763 |
\DeclareCaptionDefaultFont{labelfont}{% |
| 2764 |
\setbeamercolor*{caption}{}% avoid setting "caption" color additionally |
| 2765 |
\usebeamercolor[fg]{caption name}% |
| 2766 |
\setbeamerfont*{caption}{}% avoid setting "caption" font additionally |
| 2767 |
\usebeamerfont{caption name}} |
| 2768 |
\DeclareCaptionDefaultJustification{\raggedright} |
| 2769 |
% \end{macrocode} |
| 2770 |
% \begin{macrocode} |
| 2771 |
\DeclareOption{beamerclass}{% |
| 2772 |
\renewcommand\caption@ifslc{% |
| 2773 |
\caption@ifbeamertemplate{caption name own line}\@secondoftwo\@firstoftwo} |
| 2774 |
% Since the beamer class do not offer a `list of figures' we switch this support off. |
| 2775 |
\captionsetup{list=0}} |
| 2776 |
\PassOptionsToPackage{beamerclass}{caption3} |
| 2777 |
% \end{macrocode} |
| 2778 |
% |
| 2779 |
% If the \package{beamer} document class is used, we offer a beamer |
| 2780 |
% template called `caption3' which can be used with option `beamer' or |
| 2781 |
% |\setbeamertemplate{caption}[caption3]|.\par |
| 2782 |
% (Note that this is of no use when the \package{caption} package is used, too.) |
| 2783 |
% \begin{macrocode} |
| 2784 |
\defbeamertemplate{caption}{caption3}{% |
| 2785 |
\caption@make\insertcaptionname\insertcaptionnumber\insertcaption} |
| 2786 |
% \end{macrocode} |
| 2787 |
% \begin{macrocode} |
| 2788 |
\DeclareOption{beamer}{% |
| 2789 |
% \usebeamertemplate**{caption} will set font |
| 2790 |
\DeclareCaptionDefaultFont{font}{}% |
| 2791 |
\setbeamertemplate{caption}[caption3]} |
| 2792 |
% \end{macrocode} |
| 2793 |
% \begin{macrocode} |
| 2794 |
% |
| 2795 |
% \begin{macrocode] |
| 2796 |
}{} |
| 2797 |
% \end{macrocode} |
| 2798 |
% |
| 2799 |
% \subsection{The KOMA-Script classes} |
| 2800 |
% \changes{v1.1}{2007/03/31}{\KOMAScript\ classes support added} |
| 2801 |
% |
| 2802 |
% \begin{macrocode} |
| 2803 |
\caption@ifclassloaded{koma}{% |
| 2804 |
% \end{macrocode} |
| 2805 |
% \begin{macrocode} |
| 2806 |
\DeclareCaptionFormat{default}[#1#2#3\par]{% |
| 2807 |
\ifdofullc@p |
| 2808 |
\caption@ifin@list\caption@lsepcrlist\caption@lsepname |
| 2809 |
{\caption@Error{% |
| 2810 |
The option `labelsep=\caption@lsepname' does not work\MessageBreak |
| 2811 |
with \noexpand\setcaphanging (which is set by default)}}% |
| 2812 |
{\caption@fmt@hang{#1}{#2}{#3}}% |
| 2813 |
\else |
| 2814 |
#1#2% |
| 2815 |
\ifdim\cap@indent<\z@ |
| 2816 |
\par |
| 2817 |
\noindent\hspace*{-\cap@indent}% |
| 2818 |
\else\if@capbreak |
| 2819 |
\par |
| 2820 |
\fi\fi |
| 2821 |
#3\par |
| 2822 |
\fi} |
| 2823 |
\DeclareCaptionLabelSeparator{default}{\captionformat} |
| 2824 |
\DeclareCaptionDefaultFont{font}{\scr@fnt@caption} |
| 2825 |
\DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel} |
| 2826 |
% \end{macrocode} |
| 2827 |
% |
| 2828 |
% \changes{v1.0f}{2005/08/22}{Increased compatibility to KOMA-Script: |
| 2829 |
% A special version of options `parindent' and `parskip' added} |
| 2830 |
% \changes{v1.0g}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of |
| 2831 |
% `parskip' and `parindent' options revised and moved into caption kernel} |
| 2832 |
% \changes{v1.0h}{2006/02/23}{KOMA-Script variants of `parskip' and |
| 2833 |
% `parindent' are obsolete now, removed} |
| 2834 |
% \changes{v1.0m}{2007/03/30}{KOMA-Script variants of `parskip' and |
| 2835 |
% `parindent' re-added, since they still collide with the current |
| 2836 |
% version of the subfig package (Sigh!)} |
| 2837 |
% |
| 2838 |
% There is an option clash between the \KOMAScript\ document classes |
| 2839 |
% and the \package{caption} kernel, both define the options |parindent| and |
| 2840 |
% |parskip| but with different meaning. |
| 2841 |
% Furthermore the ones defined by the \package{caption} kernel take a |
| 2842 |
% value as parameter but the \KOMAScript\ ones do not. |
| 2843 |
% So we need special versions of the options |parindent| and |parskip| here |
| 2844 |
% which determine if a value is given (and therefore should be treated as |
| 2845 |
% our option) or not (and therefore should be ignored by us).\footnote{%^^A |
| 2846 |
% This problem was completely solved due a change of \cs{caption@ProcessOptions} |
| 2847 |
% in \thispackage\ \version{1.0h}, but we still need this workaround since |
| 2848 |
% these options would otherwise still collide with the current version $1.3$ |
| 2849 |
% of the \package{subfig} package (Sigh!)} |
| 2850 |
% \begin{macrocode} |
| 2851 |
\let\caption@KV@parindent\KV@caption@parindent |
| 2852 |
\DeclareCaptionOption{parindent}[]{% |
| 2853 |
\ifx,#1,% |
| 2854 |
\caption@Debug{Option `parindent' ignored}% |
| 2855 |
\else |
| 2856 |
\caption@KV@parindent{#1}% |
| 2857 |
\fi}% |
| 2858 |
% \end{macrocode} |
| 2859 |
% \begin{macrocode} |
| 2860 |
\let\caption@KV@parskip\KV@caption@parskip |
| 2861 |
\DeclareCaptionOption{parskip}[]{% |
| 2862 |
\ifx,#1,% |
| 2863 |
\caption@Debug{Option `parskip' ignored}% |
| 2864 |
\else |
| 2865 |
\caption@KV@parskip{#1}% |
| 2866 |
\fi}% |
| 2867 |
% \end{macrocode} |
| 2868 |
% \begin{macrocode} |
| 2869 |
}{} |
| 2870 |
% \end{macrocode} |
| 2871 |
% |
| 2872 |
% \subsection{The \NTG{} Dutch classes} |
| 2873 |
% \changes{v1.1}{2007/04/06}{NTG classes support added} |
| 2874 |
% |
| 2875 |
% \begin{macrocode} |
| 2876 |
\caption@ifclassloaded{ntg}{% |
| 2877 |
% \end{macrocode} |
| 2878 |
% \begin{macrocode} |
| 2879 |
\DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont} |
| 2880 |
\DeclareCaptionDefaultFont{textfont}{\CaptionTextFont} |
| 2881 |
% \end{macrocode} |
| 2882 |
% \begin{macrocode} |
| 2883 |
}{} |
| 2884 |
% \end{macrocode} |
| 2885 |
% |
| 2886 |
% \subsection{The thesis class} |
| 2887 |
% \changes{v1.2a}{2008/01/31}{thesis class support added} |
| 2888 |
% \changes{v1.2e}{2009/11/15}{Bugfix 09-11-14: thesis class support revised} |
| 2889 |
% |
| 2890 |
% \begin{macrocode} |
| 2891 |
\caption@ifclassloaded{thesis}{% |
| 2892 |
% \end{macrocode} |
| 2893 |
% \begin{macrocode} |
| 2894 |
\DeclareCaptionDefaultFormat{hang} |
| 2895 |
\DeclareCaptionDefaultFont{labelfont}{\cph@font} |
| 2896 |
\DeclareCaptionDefaultFont{textfont}{\cpb@font} |
| 2897 |
% \end{macrocode} |
| 2898 |
% \begin{macrocode} |
| 2899 |
}{} |
| 2900 |
% \end{macrocode} |
| 2901 |
% |
| 2902 |
% \subsection{The arabic Babel option} |
| 2903 |
% \changes{v1.8}{2018/05/20}{\package{arabic} babel package support added} |
| 2904 |
% |
| 2905 |
% \begin{macrocode} |
| 2906 |
\caption@ifdefined\ArabiCoreLoaded{% |
| 2907 |
% \end{macrocode} |
| 2908 |
% |
| 2909 |
% \begin{macro}{\caption@rl} |
| 2910 |
% \changes{v1.8}{2018/05/20}{This macro added} |
| 2911 |
% \begin{macrocode} |
| 2912 |
\newcommand\caption@rl[1]{\if@rl\textRL{#1}\else\textLR{#1}\fi} |
| 2913 |
% \end{macrocode} |
| 2914 |
% \end{macro} |
| 2915 |
% |
| 2916 |
% \begin{macrocode} |
| 2917 |
\def\fnum@figure{\figurename\nobreakspace\thefigure}% |
| 2918 |
\def\fnum@table{\tablename\nobreakspace\thetable}% |
| 2919 |
% \end{macrocode} |
| 2920 |
% \begin{macrocode} |
| 2921 |
\DeclareCaptionLabelSeparator{arabi}{ : } |
| 2922 |
\DeclareCaptionLabelSeparator{default}{% |
| 2923 |
\if@rl\caption@lsep@arabi\else\caption@lsep@colon\fi} |
| 2924 |
% \end{macrocode} |
| 2925 |
% \begin{macrocode} |
| 2926 |
}{% |
| 2927 |
\let\caption@rl\@firstofone |
| 2928 |
} |
| 2929 |
% \end{macrocode} |
| 2930 |
% |
| 2931 |
% \subsection{The frenchb Babel option} |
| 2932 |
% \changes{v1.1}{2006/05/14}{\package{frenchb} babel package support added} |
| 2933 |
% |
| 2934 |
% \begin{macrocode} |
| 2935 |
\caption@ifdefined\FB@makecaption{% |
| 2936 |
% \end{macrocode} |
| 2937 |
% \begin{macrocode} |
| 2938 |
\ifx\@makecaption\STD@makecaption |
| 2939 |
\DeclareCaptionLabelSeparator{default}{\CaptionSeparator} |
| 2940 |
\def\caption@frenchb{% supress frenchb warning |
| 2941 |
\let\STD@makecaption\@makecaption |
| 2942 |
\let\FB@makecaption\@makecaption} |
| 2943 |
\else |
| 2944 |
\ifx\@makecaption\@undefined\else |
| 2945 |
\caption@InfoNoLine{% |
| 2946 |
The definition of \protect\@makecaption\space |
| 2947 |
has been changed,\MessageBreak |
| 2948 |
frenchb will NOT customize it}% |
| 2949 |
\fi |
| 2950 |
\fi |
| 2951 |
% \end{macrocode} |
| 2952 |
% \begin{macrocode} |
| 2953 |
}{} |
| 2954 |
% \end{macrocode} |
| 2955 |
% |
| 2956 |
% \subsection{The frenchle/pro package} |
| 2957 |
% \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added} |
| 2958 |
% |
| 2959 |
% \begin{macrocode} |
| 2960 |
\caption@ifdefined\frenchTeXmods{% |
| 2961 |
% \end{macrocode} |
| 2962 |
% \begin{macrocode} |
| 2963 |
\DeclareCaptionDefaultFont{textfont}{\itshape}% |
| 2964 |
\DeclareCaptionLabelSeparator{default}{\captionseparator\space}% |
| 2965 |
% \end{macrocode} |
| 2966 |
% \begin{macrocode} |
| 2967 |
}{} |
| 2968 |
% \end{macrocode} |
| 2969 |
% |
| 2970 |
% \subsection{The hungarian and magyar Babel option} |
| 2971 |
% \changes{v1.3}{2009/03/29}{\package{magyar} package support added} |
| 2972 |
% \changes{v1.3a}{2011/08/12}{\package{magyar} package support revised} |
| 2973 |
% \changes{v1.8b}{2018/08/26}{\package{magyar} package support revised} |
| 2974 |
% |
| 2975 |
% \begin{macrocode} |
| 2976 |
\DeclareCaptionListFormat{subperiod}{#2.} |
| 2977 |
% \end{macrocode} |
| 2978 |
% |
| 2979 |
% \begin{macrocode} |
| 2980 |
\def\caption@tempa#1{% |
| 2981 |
\@ifpackagewith{babel}{#1}{% |
| 2982 |
\caption@InfoNoLine{#1 babel option is loaded}% |
| 2983 |
\expandafter\addto\csname extras#1\endcsname{% |
| 2984 |
% change default labelsep and listformat |
| 2985 |
\caption@setdefaultlabelsep{period}% |
| 2986 |
\caption@setdefaultlistformat{subperiod}}% |
| 2987 |
\expandafter\addto\csname noextras#1\endcsname{% |
| 2988 |
% change default labelsep and listformat |
| 2989 |
\caption@setdefaultlabelsep{colon}% |
| 2990 |
\caption@setdefaultlistformat{subsimple}}% |
| 2991 |
}{}} |
| 2992 |
% \end{macrocode} |
| 2993 |
% \begin{macrocode} |
| 2994 |
\caption@tempa{hungarian} |
| 2995 |
\caption@tempa{magyar} |
| 2996 |
% \end{macrocode} |
| 2997 |
% |
| 2998 |
% TODO: babel-latvian/latvian.ldf |
| 2999 |
% |
| 3000 |
% \section{Package support} |
| 3001 |
% |
| 3002 |
% \begin{macro}{\caption@xpackage} |
| 3003 |
% \changes{v1.11}{2020/05/10}{This macro added} |
| 3004 |
% |\caption@xpackage|\marg{macro}\marg{package}\marg{option} |
| 3005 |
% expands the given macro if the given package is not loaded. |
| 3006 |
% (Note: We cannot use |\@ifpackageloaded| here since it's not available after |\AtBeginDocument|.) |
| 3007 |
% \begin{macrocode} |
| 3008 |
\newcommand*\caption@xpackage[2]{% |
| 3009 |
\expandafter\ifx\csname ver@#2.\caption@pkgextension\endcsname\relax |
| 3010 |
\expandafter\@firstofone |
| 3011 |
\else |
| 3012 |
\expandafter\@gobbletwo |
| 3013 |
\fi |
| 3014 |
{#1{#2}}} |
| 3015 |
% \end{macrocode} |
| 3016 |
% \begin{macrocode} |
| 3017 |
\let\caption@pkgextension\@pkgextension |
| 3018 |
% \end{macrocode} |
| 3019 |
% \end{macro} |
| 3020 |
% |
| 3021 |
% \begin{macro}{\caption@loadpackage} |
| 3022 |
% \changes{v1.11}{2020/05/10}{This macro added} |
| 3023 |
% |\caption@loadpackage|\marg{package}\marg{caption option} |
| 3024 |
% loads the given package immediately. |
| 3025 |
% \begin{macrocode} |
| 3026 |
\newcommand*\caption@loadpackage{% |
| 3027 |
\caption@xpackage\caption@@loadpackage} |
| 3028 |
% \end{macrocode} |
| 3029 |
% \begin{macrocode} |
| 3030 |
\newcommand*\caption@@loadpackage[2]{% |
| 3031 |
\caption@Info{Option `#2' requires the `#1' package}% |
| 3032 |
\RequirePackage{#1}\relax} |
| 3033 |
% \end{macrocode} |
| 3034 |
% \end{macro} |
| 3035 |
% |
| 3036 |
% \begin{macro}{\caption@requirepackage} |
| 3037 |
% \changes{v1.10}{2020/05/10}{This macro added} |
| 3038 |
% |\caption@requirepackage|\marg{package}\marg{caption option} |
| 3039 |
% indicates that the given package option needs a package. |
| 3040 |
% \begin{macrocode} |
| 3041 |
\newcommand*\caption@requirepackage{% |
| 3042 |
\caption@xpackage\caption@@requirepackage} |
| 3043 |
% \end{macrocode} |
| 3044 |
% \begin{macrocode} |
| 3045 |
\newcommand*\caption@@requirepackage[2]{% |
| 3046 |
\@cons\caption@packagelist{{#1}{#2}}}% load package later on |
| 3047 |
% \end{macrocode} |
| 3048 |
% \end{macro} |
| 3049 |
% |
| 3050 |
% \begin{macro}{\caption@pkg@list} |
| 3051 |
% \changes{v1.4b}{2012/01/12}{This macro added} |
| 3052 |
% We used this in the past as list of packages loaded |\AtBeginDocument|. |
| 3053 |
% (Note: Old |.aux| files could contain |\@cons|\-|\caption@pkg@list|\-|{{|\meta{package}|}}|, |
| 3054 |
% so this macro should always be defined, even if we change the following code in the future.) |
| 3055 |
% \begin{macrocode} |
| 3056 |
\newcommand*\caption@pkg@list{} |
| 3057 |
% \end{macrocode} |
| 3058 |
% \end{macro} |
| 3059 |
% |
| 3060 |
% \begin{macro}{\caption@packagelist} |
| 3061 |
% \changes{v1.11}{2020/05/10}{This macro added} |
| 3062 |
% We use this as list of packages loaded |\AtBeginDocument|. |
| 3063 |
% \begin{macrocode} |
| 3064 |
\newcommand*\caption@packagelist{} |
| 3065 |
\@onlypreamble\caption@packagelist |
| 3066 |
% \end{macrocode} |
| 3067 |
% \begin{macrocode} |
| 3068 |
\caption@AtBeginDocument{% |
| 3069 |
\def\caption@tempa{\endgroup}% |
| 3070 |
\begingroup |
| 3071 |
\def\@elt#1#2{% |
| 3072 |
\g@addto@macro\caption@tempa{% |
| 3073 |
\caption@loadpackage{#1}{#2}}}% |
| 3074 |
\caption@packagelist |
| 3075 |
\caption@tempa |
| 3076 |
% \end{macrocode} |
| 3077 |
% \begin{macrocode} |
| 3078 |
\renewcommand*\caption@@loadpackage[2]{% |
| 3079 |
\caption@Error{Option `#2' requires the `#1' package}}% |
| 3080 |
\let\caption@@requirepackage\caption@@loadpackage |
| 3081 |
} |
| 3082 |
% \end{macrocode} |
| 3083 |
% \end{macro} |
| 3084 |
% |
| 3085 |
% \begin{macro}{\caption@usepackage} |
| 3086 |
% \changes{v1.11}{2020/05/10}{This macro added} |
| 3087 |
% |\caption@usepackage|\marg{package}\marg{option}\marg{code} |
| 3088 |
% loads the given package and executes the given code. |
| 3089 |
% (Note: Since the package might use the crappy \package{keyval} |
| 3090 |
% package, too, we need to save \& restore some macros here, otherwise this |
| 3091 |
% recursion won't work properly.) |
| 3092 |
% \begin{macrocode} |
| 3093 |
\newcommand*\caption@usepackage[3]{% |
| 3094 |
\IfCaptionOptionCheck |
| 3095 |
{\caption@requirepackage{#1}{#2}}% |
| 3096 |
{\let\KV@prefix@ORI\KV@prefix |
| 3097 |
\let\@tempc@ORI\@tempc |
| 3098 |
\caption@loadpackage{#1}{#2}% |
| 3099 |
#3% |
| 3100 |
\let\@tempc\@tempc@ORI |
| 3101 |
\let\KV@prefix\KV@prefix@ORI}} |
| 3102 |
% \end{macro} |
| 3103 |
% |
| 3104 |
% \subsection{The newfloat package} |
| 3105 |
% |
| 3106 |
% \begin{macro}{\caption@newfloat} |
| 3107 |
% \changes{v1.4b}{2012/01/12}{This macro added} |
| 3108 |
% \changes{v1.8h}{2020/01/03}{Usage of \cs{caption@ifpackageloaded} replaced by \cs{RequirePackage}} |
| 3109 |
% \changes{v1.11}{2020/05/10}{Usage of \cs{RequirePackage} replaced by \cs{caption@usepackage}} |
| 3110 |
% |\caption@newfloat|\marg{option}\marg{code} |
| 3111 |
% loads the \package{newfloat} package and executes the given code afterwards. |
| 3112 |
% \begin{macrocode} |
| 3113 |
\newcommand*\caption@newfloat{\caption@usepackage{newfloat}} |
| 3114 |
% \end{macrocode} |
| 3115 |
% \end{macro} |
| 3116 |
% |
| 3117 |
% \changes{v1.0c}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added} |
| 3118 |
% \changes{v1.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written} |
| 3119 |
% \changes{v1.2}{2007/11/18}{Option \opt{name} added} |
| 3120 |
% \begin{macrocode} |
| 3121 |
\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}} |
| 3122 |
\@onlypreamble@key{caption}{figurename} |
| 3123 |
\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}} |
| 3124 |
\@onlypreamble@key{caption}{tablename} |
| 3125 |
% \end{macrocode} |
| 3126 |
% |
| 3127 |
% \changes{v1.2a}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added} |
| 3128 |
% \begin{macrocode} |
| 3129 |
\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}} |
| 3130 |
\@onlypreamble@key{caption}{listfigurename} |
| 3131 |
\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}} |
| 3132 |
\@onlypreamble@key{caption}{listtablename} |
| 3133 |
% \end{macrocode} |
| 3134 |
% |
| 3135 |
% \begin{macro}{\caption@SetName} |
| 3136 |
% \changes{v1.1}{2007/07/04}{This macro added} |
| 3137 |
% \changes{v1.2}{2007/11/18}{After-preamble variant added} |
| 3138 |
% \changes{v1.2a}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}} |
| 3139 |
% \changes{v1.2b}{2008/08/02}{Bugfix: Works now without \cs{addto}, too} |
| 3140 |
% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package} |
| 3141 |
% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now} |
| 3142 |
% |\caption@SetName|\marg{float}\marg{name} |
| 3143 |
% \begin{macrocode} |
| 3144 |
\newcommand*\caption@SetName[2]{% |
| 3145 |
\caption@newfloat{#1name}{\newfloat@setname{#1}{#2}}} |
| 3146 |
\@onlypreamble\caption@SetName |
| 3147 |
% \end{macrocode} |
| 3148 |
% \end{macro} |
| 3149 |
% |
| 3150 |
% \begin{macrocode} |
| 3151 |
\DeclareCaptionOption{name}{% |
| 3152 |
\IfCaptionOptionCheck{}{\caption@setname\@captype{#1}}} |
| 3153 |
% \end{macrocode} |
| 3154 |
% |
| 3155 |
% \begin{macro}{\caption@setname} |
| 3156 |
% |\caption@setname|\marg{float}\marg{name} |
| 3157 |
% \begin{macrocode} |
| 3158 |
\newcommand*\caption@setname[2]{% |
| 3159 |
\@namedef{#1name}{#2}} |
| 3160 |
% \end{macrocode} |
| 3161 |
% \end{macro} |
| 3162 |
% |
| 3163 |
% \changes{v1.2}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added} |
| 3164 |
% \changes{v1.2e}{2010/01/09}{The \opt{within} options are now available within the document, too} |
| 3165 |
% |
| 3166 |
% \begin{macrocode} |
| 3167 |
\DeclareCaptionOption{figurewithin}{\caption@within{figure}{#1}} |
| 3168 |
\DeclareCaptionOptionNoValue{figurewithout}{\caption@within{figure}{none}} |
| 3169 |
\DeclareCaptionOption{tablewithin}{\caption@within{table}{#1}} |
| 3170 |
\DeclareCaptionOptionNoValue{tablewithout}{\caption@within{table}{none}} |
| 3171 |
% \end{macrocode} |
| 3172 |
% |
| 3173 |
% \begin{macro}{\caption@within} |
| 3174 |
% \changes{v1.2}{2007/12/21}{This macro added} |
| 3175 |
% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package} |
| 3176 |
% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now} |
| 3177 |
% |\caption@within|\marg{float}\marg{value} |
| 3178 |
% \begin{macrocode} |
| 3179 |
\newcommand*\caption@within[2]{% |
| 3180 |
\caption@newfloat{#1within}{\newfloat@setwithin{#1}{#2}}} |
| 3181 |
% \end{macrocode} |
| 3182 |
% \end{macro} |
| 3183 |
% |
| 3184 |
% \changes{v1.2b}{2008/04/13}{Option \opt{within} added} |
| 3185 |
% \changes{v1.2e}{2010/01/09}{The global \opt{within} option will now affect user-defined floats declared with \cs{DeclareCaptionType}, too} |
| 3186 |
% |
| 3187 |
% \begin{macrocode} |
| 3188 |
\DeclareCaptionOption{within}{% |
| 3189 |
\caption@newfloat{within}{\newfloatsetup{within=#1}}} |
| 3190 |
\DeclareCaptionOptionNoValue{without}{% |
| 3191 |
\caption@newfloat{without}{\newfloatsetup{without}}} |
| 3192 |
% \end{macrocode} |
| 3193 |
% |
| 3194 |
% \subsection{The ragged2e package} |
| 3195 |
% \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support} |
| 3196 |
% \changes{v1.8h}{2020/01/03}{Revised \package{ragged2e} package support} |
| 3197 |
% \changes{v1.9}{2020/05/05}{Enhanced \package{ragged2e} package support} |
| 3198 |
% \changes{v1.10}{2020/05/10}{Revised \package{ragged2e} package support} |
| 3199 |
% |
| 3200 |
% We support the upper-case commands offered by the \package{ragged2e} |
| 3201 |
% package. |
| 3202 |
% \begin{macrocode} |
| 3203 |
\DeclareCaptionJustification[ragged2e]{Justified}{\justifying} |
| 3204 |
\DeclareCaptionJustification[ragged2e]{Centering}{\Centering} |
| 3205 |
\DeclareCaptionJustification[ragged2e]{RaggedLeft}{\RaggedLeft} |
| 3206 |
\DeclareCaptionJustification[ragged2e]{RaggedRight}{\RaggedRight} |
| 3207 |
% \end{macrocode} |
| 3208 |
% |
| 3209 |
% \subsection{The sansmath package} |
| 3210 |
% \changes{v1.3}{2011/01/01}{\package{sansmath} package support added} |
| 3211 |
% \changes{v1.10}{2020/05/10}{\package{sansmath} package support revised} |
| 3212 |
% |
| 3213 |
% \begin{macrocode} |
| 3214 |
\DeclareCaptionFont[sansmath]{sansmath}{\sansmath} |
| 3215 |
% \end{macrocode} |
| 3216 |
% |
| 3217 |
% \subsection{The setspace package} |
| 3218 |
% \changes{v1.0n}{2007/04/02}{\package{setspace} package support added} |
| 3219 |
% \changes{v1.2d}{2009/10/09}{\package{setspace} package support revised} |
| 3220 |
% |
| 3221 |
% \begin{macrocode} |
| 3222 |
\DeclareCaptionFont{singlespacing}{% |
| 3223 |
\caption@ifdefined\setspace@singlespace{% |
| 3224 |
\setstretch\setspace@singlespace}{}}% normally 1 |
| 3225 |
\DeclareCaptionFont[setspace]{onehalfspacing}{\onehalfspacing} |
| 3226 |
\DeclareCaptionFont[setspace]{doublespacing}{\doublespacing} |
| 3227 |
\DeclareCaptionFont[setspace]{stretch}{\setstretch{#1}} |
| 3228 |
% \end{macrocode} |
| 3229 |
% |
| 3230 |
% \subsection{The subfig package} |
| 3231 |
% \changes{v1.1}{2007/07/07}{Several adaptions to the \package{subfig} package added} |
| 3232 |
% \changes{v1.4a}{2011/11/01}{Test for the \package{subfig} package revised} |
| 3233 |
% |
| 3234 |
% Since the \package{subfig} package is not maintained anymore, |
| 3235 |
% we have to make several adaptions to \thispackage~\version{1.1} here. |
| 3236 |
% Please note that we only support the version $1.3$ of the \package{subfig} package here. |
| 3237 |
% So older versions do not work with this version of \thispackage, and newer |
| 3238 |
% versions are expected to be adapted. |
| 3239 |
% \begin{macrocode} |
| 3240 |
\caption@AtBeginDocument{% |
| 3241 |
\def\@tempa{2005/06/28 ver: 1.3 subfig package}% |
| 3242 |
\expandafter\ifx\csname [email protected]\endcsname\@tempa |
| 3243 |
\caption@InfoNoLine{subfig package v1.3 is loaded}% |
| 3244 |
% \end{macrocode} |
| 3245 |
% \begin{macrocode} |
| 3246 |
\let\caption@setfloattype\@gobble |
| 3247 |
\let\@dottedxxxline\sf@NEW@dottedxxxline |
| 3248 |
\let\sf@subfloat\sf@NEW@subfloat |
| 3249 |
% \end{macrocode} |
| 3250 |
% \begin{macrocode} |
| 3251 |
\fi |
| 3252 |
\let\sf@NEW@dottedxxxline\@undefined |
| 3253 |
\let\sf@NEW@subfloat\@undefined} |
| 3254 |
% \end{macrocode} |
| 3255 |
% |
| 3256 |
% \begin{macro}{\@dottedxxxline} |
| 3257 |
% New version of |\@dottedxxxline| |
| 3258 |
% \begin{macrocode} |
| 3259 |
\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{% |
| 3260 |
\begingroup |
| 3261 |
\caption@setfloattype{#1}% |
| 3262 |
\caption@setoptions{subfloat}% |
| 3263 |
\caption@setoptions{sub#1}% |
| 3264 |
\ifnum #3>\@nameuse{c@#2depth}\else |
| 3265 |
\@dottedtocline{\z@}{#4}{#5}{#6}{#7}% |
| 3266 |
\fi |
| 3267 |
\endgroup} |
| 3268 |
% \end{macrocode} |
| 3269 |
% \end{macro} |
| 3270 |
% |
| 3271 |
% \begin{macro}{\sf@subfloat} |
| 3272 |
% \changes{v1.4b}{2011/12/29}{Bugfix 11-12-23: Usage of \cs{caption@warmup} added} |
| 3273 |
% New version of |\sf@subfloat| |
| 3274 |
% \begin{macrocode} |
| 3275 |
\def\sf@NEW@subfloat{% |
| 3276 |
\begingroup |
| 3277 |
\@nameuse{caption@warmup}% |
| 3278 |
\caption@setfloattype\@captype |
| 3279 |
\sf@ifpositiontop{% |
| 3280 |
\maincaptiontoptrue |
| 3281 |
}{% |
| 3282 |
\maincaptiontopfalse |
| 3283 |
}% |
| 3284 |
\caption@setoptions{subfloat}% |
| 3285 |
\caption@setoptions{sub\@captype}% |
| 3286 |
\let\sf@oldlabel=\label |
| 3287 |
\let\label=\subfloat@label |
| 3288 |
\ifmaincaptiontop\else |
| 3289 |
\advance\@nameuse{c@\@captype}\@ne |
| 3290 |
\fi |
| 3291 |
\refstepcounter{sub\@captype}% |
| 3292 |
\setcounter{sub\@captype @save}{\value{sub\@captype}}% |
| 3293 |
\@ifnextchar [% %] match left bracket |
| 3294 |
{\sf@@subfloat}% |
| 3295 |
{\sf@@subfloat[\@empty]}} |
| 3296 |
% \end{macrocode} |
| 3297 |
% \end{macro} |
| 3298 |
% |
| 3299 |
% Make the \package{subfig} package documentation compile. |
| 3300 |
% \begin{macrocode} |
| 3301 |
%%\@ifl@aded{dtx}{subfig}{\caption@loadpackage{ragged2e}{}}{} % not needed |
| 3302 |
\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}} |
| 3303 |
\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}} |
| 3304 |
% \end{macrocode} |
| 3305 |
% |
| 3306 |
% \section{Execution of options} |
| 3307 |
% |
| 3308 |
% \begin{macrocode} |
| 3309 |
\captionsetup{style=default,position=default,% |
| 3310 |
list,listformat=default,twoside=\if@twoside 1\else 0\fi} |
| 3311 |
% \end{macrocode} |
| 3312 |
% \begin{macrocode} |
| 3313 |
\ProcessOptions* |
| 3314 |
% \end{macrocode} |
| 3315 |
% |
| 3316 |
% \section{Making an `List of' entry} |
| 3317 |
% |
| 3318 |
% \begin{macro}{\caption@addcontentsline} |
| 3319 |
% \changes{v1.1}{2007/07/01}{This macro added} |
| 3320 |
% \changes{v1.3}{2010/10/26}{Error check added} |
| 3321 |
% \changes{v1.3}{2011/06/24}{Split into two macros} |
| 3322 |
% \changes{v1.4}{2011/08/19}{Split into three macros} |
| 3323 |
% \changes{v1.4}{2011/08/30}{Support for option \opt{listtype=} added} |
| 3324 |
% \changes{v1.5}{2012/01/15}{Usage of \cs{caption@addsubcontentslines} added} |
| 3325 |
% \changes{v1.7}{2015/09/15}{Argument \#3 which holds the environment name added to \cs{caption@lstfmt}} |
| 3326 |
% \changes{v1.7}{2015/09/20}{Unfortunately \package{subfig} defines and uses \cs{caption@lstfmt} as well, so I replaced the third argument with \cs{captionlisttype}} |
| 3327 |
% \changes{v1.8}{2018/09/06}{Adapted to the \package{chkfloat} package} |
| 3328 |
% |\caption@addcontentsline|\marg{type}\marg{list entry}\par |
| 3329 |
% Makes an entry in the list-of-whatever, if requested, |
| 3330 |
% i.e.~the argument \meta{list entry} is not empty and |
| 3331 |
% |listof=| was set to |true|. |
| 3332 |
% \begin{macrocode} |
| 3333 |
\newcommand\caption@addcontentsline[2]{% |
| 3334 |
\caption@ifcontentsline{#2}{% |
| 3335 |
\begingroup |
| 3336 |
\let\@tempa\@gobble |
| 3337 |
\caption@ifdefined\caption@listtype |
| 3338 |
{\let\@tempa\@firstofone}% |
| 3339 |
{\edef\caption@listtype{#1}}% |
| 3340 |
\caption@ifdefined\caption@listtype@ext |
| 3341 |
{\edef\caption@listtype{\caption@listtype\caption@listtype@ext}% |
| 3342 |
\let\@tempa\@firstofone}% |
| 3343 |
{}% |
| 3344 |
\@tempa |
| 3345 |
{\caption@Debug{addcontentsline: #1 => \caption@listtype}% |
| 3346 |
% \caption@setoptions\caption@listtype |
| 3347 |
\@namedef{the\caption@listtype}{\@nameuse{the#1}}}% |
| 3348 |
\expandafter\caption@@addcontentsline\expandafter{\caption@listtype}{#2}% |
| 3349 |
\endgroup}% |
| 3350 |
\caption@addsubcontentslines{#1}} |
| 3351 |
% \end{macrocode} |
| 3352 |
% \begin{macrocode} |
| 3353 |
\newcommand\caption@@addcontentsline[2]{% |
| 3354 |
{\let\\\space |
| 3355 |
\@ifundefined{ext@#1}% |
| 3356 |
{\caption@Error{No float type '#1' defined}}% |
| 3357 |
{\def\captionlisttype{#1}% |
| 3358 |
\caption@add@contentsline |
| 3359 |
{\csname ext@#1\endcsname}% |
| 3360 |
{#1}% |
| 3361 |
{\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}% |
| 3362 |
{\ignorespaces #2}% |
| 3363 |
\caption@chkfloat{#1}{#2}}}} |
| 3364 |
% \end{macrocode} |
| 3365 |
% \begin{macrocode} |
| 3366 |
\newcommand*\caption@add@contentsline{% |
| 3367 |
\caption@@@addcontentsline} |
| 3368 |
% \end{macrocode} |
| 3369 |
% \begin{macrocode} |
| 3370 |
\newcommand*\caption@@@addcontentsline[4]{% |
| 3371 |
% \caption@ifdefined\main@Arabi@language |
| 3372 |
% {\addtocontents{#1}{\xstring\select@language{\main@Arabi@language}}}{}% |
| 3373 |
\addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}} |
| 3374 |
% \end{macrocode} |
| 3375 |
% \begin{macrocode} |
| 3376 |
\let\caption@chkfloat\@gobbletwo |
| 3377 |
% \end{macrocode} |
| 3378 |
% \begin{macrocode} |
| 3379 |
\newcommand\caption@ifcontentsline[1]{% |
| 3380 |
\caption@iflist |
| 3381 |
{\def\@tempa{#1}}% |
| 3382 |
{\let\@tempa\@empty}% |
| 3383 |
\ifx\@tempa\@empty |
| 3384 |
\expandafter\@gobble |
| 3385 |
\else |
| 3386 |
\expandafter\@firstofone |
| 3387 |
\fi} |
| 3388 |
% \end{macrocode} |
| 3389 |
% \begin{macrocode} |
| 3390 |
\newcommand*\caption@addsubcontentslines[1]{} |
| 3391 |
% \end{macrocode} |
| 3392 |
% \end{macro} |
| 3393 |
% |
| 3394 |
% \section{Typesetting the caption} |
| 3395 |
% |
| 3396 |
% \begin{macro}{\ifcaption@star} |
| 3397 |
% If the starred form of |\caption| is used, this will be set to |true|. |
| 3398 |
% (It will be reset to |false| at the end of |\caption@@make|.) |
| 3399 |
% \begin{macrocode} |
| 3400 |
\newif\ifcaption@star |
| 3401 |
% \end{macrocode} |
| 3402 |
% \end{macro} |
| 3403 |
% |
| 3404 |
% \begin{macro}{\caption@fnum} |
| 3405 |
% \changes{v1.1}{2007/08/21}{This macro added} |
| 3406 |
% |\caption@fnum|\marg{float type}\par |
| 3407 |
% Typesets the caption label; as replacement for |\fnum@|\meta{float type}. |
| 3408 |
% \begin{macrocode} |
| 3409 |
\newcommand*\caption@fnum[1]{\caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}} |
| 3410 |
% \end{macrocode} |
| 3411 |
% \end{macro} |
| 3412 |
% |
| 3413 |
% \begin{macro}{\caption@make} |
| 3414 |
% |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}\par |
| 3415 |
% Typesets the caption. |
| 3416 |
% \begin{macrocode} |
| 3417 |
\newcommand\caption@make[2]{\caption@@make{\caption@lfmt{#1}{#2}}} |
| 3418 |
% \end{macrocode} |
| 3419 |
% \end{macro} |
| 3420 |
% |
| 3421 |
% \begin{macro}{\caption@@make} |
| 3422 |
% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added} |
| 3423 |
% \changes{v1.0c}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of |
| 3424 |
% \cs{captionmargin} resp. \cs{captionwidth}; check for \cs{z@} added} |
| 3425 |
% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end |
| 3426 |
% of caption added} |
| 3427 |
% \changes{v1.0c}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}} |
| 3428 |
% \changes{v1.0c}{2005/02/12}{Single-line-check moved up so it can affect margins now} |
| 3429 |
% \changes{v1.0c}{2005/02/09}{Improvement: \cs{caption@ifh} added} |
| 3430 |
% \changes{v1.0c}{2005/02/09}{Bugfix: \cs{leavevmode} added} |
| 3431 |
% \changes{v1.0f}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check} |
| 3432 |
% \changes{v1.0g}{2005/12/04}{Uses \cs{caption@slc} now} |
| 3433 |
% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside |
| 3434 |
% single-line-check replaced by \cs{relax}} |
| 3435 |
% \changes{v1.0g}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be |
| 3436 |
% typeset in horizontal mode} |
| 3437 |
% \changes{v1.0i}{2006/05/13}{Uses \cs{caption@parbox} instead of \cs{caption@start/endbox}} |
| 3438 |
% \changes{v1.0j}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v1.0h, re-added} |
| 3439 |
% \changes{v1.0n}{2007/04/03}{Usage of \cs{caption@ifoddpage} added} |
| 3440 |
% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} moved below single-line-check} |
| 3441 |
% \changes{v1.1e}{2007/10/28}{\cs{caption@stepcounter} added} |
| 3442 |
% \changes{v1.5}{2012/03/15}{Uses \cs{caption@tempdima} instead of \cs{@tempdima}} |
| 3443 |
% \changes{v1.5}{2012/12/26}{max-margin stuff moved to \cs{caption@calcmargin}} |
| 3444 |
% \changes{v1.6}{2013/05/01}{Usage of \cs{caption@box} added} |
| 3445 |
% \changes{v1.7}{2016/01/31}{Adapted to the \package{bicaption} package} |
| 3446 |
% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}} |
| 3447 |
% |\caption@@make|\marg{caption label}\marg{caption text} |
| 3448 |
% \begin{macrocode} |
| 3449 |
\newcommand\caption@@make[2]{% |
| 3450 |
\begingroup |
| 3451 |
\caption@@make@{#1}{#2}% |
| 3452 |
\endgroup |
| 3453 |
\caption@@make@epilogue} |
| 3454 |
% \end{macrocode} |
| 3455 |
% \begin{macrocode} |
| 3456 |
\newcommand\caption@@make@[2]{% |
| 3457 |
\caption@stepthecounter |
| 3458 |
\caption@beginhook |
| 3459 |
% \end{macrocode} |
| 3460 |
% |
| 3461 |
% Typeset the outer box |\caption@box| |
| 3462 |
% \begin{macrocode} |
| 3463 |
\caption@box\hsize{% |
| 3464 |
% \end{macrocode} |
| 3465 |
% |
| 3466 |
% Special single-line treatment (option |singlelinecheck=|) |
| 3467 |
% \begin{macrocode} |
| 3468 |
\caption@ifslc{\caption@slc{#1}{#2}\caption@singleline\relax}{}% |
| 3469 |
% \end{macrocode} |
| 3470 |
% |
| 3471 |
% Typeset the left margin (option |margin=|) |
| 3472 |
% \begin{macrocode} |
| 3473 |
\caption@calcmargin |
| 3474 |
\caption@tempdima\captionmargin |
| 3475 |
\ifdim\captionmargin@=\z@ \else |
| 3476 |
\caption@ifoddpage{}{\advance\caption@tempdima\captionmargin@}% |
| 3477 |
\fi |
| 3478 |
\caption@ifh{\advance\caption@tempdima\caption@indent}% |
| 3479 |
\hspace\caption@tempdima |
| 3480 |
% \end{macrocode} |
| 3481 |
% |
| 3482 |
% We actually use a |\vbox| of width |\captionwidth - \caption@indent| |
| 3483 |
% to typeset the caption. |
| 3484 |
% \Note{\cs{captionindent} is \emph{not} supported if the caption format |
| 3485 |
% was defined with \cs{DeclareCaptionFormat*}.} |
| 3486 |
% \begin{macrocode} |
| 3487 |
\caption@tempdima\captionwidth |
| 3488 |
\caption@ifh{\advance\caption@tempdima-\caption@indent}% |
| 3489 |
\caption@parbox\caption@tempdima{% |
| 3490 |
% \end{macrocode} |
| 3491 |
% |
| 3492 |
% Typeset the indention (option |indention=|)\\ |
| 3493 |
% {\small Bugfix 04-05-05: |
| 3494 |
% |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots} |
| 3495 |
% \begin{macrocode} |
| 3496 |
\caption@ifh{% |
| 3497 |
\ifdim\caption@indent=\z@ |
| 3498 |
\leavevmode |
| 3499 |
\else |
| 3500 |
\hskip-\caption@indent |
| 3501 |
\fi}% |
| 3502 |
% \end{macrocode} |
| 3503 |
% |
| 3504 |
% Typeset the caption itself and close the |\caption@parbox| |
| 3505 |
% \begin{macrocode} |
| 3506 |
\caption@@@make{#1}{#2}}% |
| 3507 |
% \end{macrocode} |
| 3508 |
% |
| 3509 |
% Typeset the right margin (option |margin=|) |
| 3510 |
% \begin{macrocode} |
| 3511 |
\caption@tempdima\captionmargin |
| 3512 |
\ifdim\captionmargin@=\z@ \else |
| 3513 |
\caption@ifoddpage{\advance\caption@tempdima\captionmargin@}{}% |
| 3514 |
\fi |
| 3515 |
\hspace\caption@tempdima |
| 3516 |
% \end{macrocode} |
| 3517 |
% |
| 3518 |
% Close the outer box |\caption@box| |
| 3519 |
% \begin{macrocode} |
| 3520 |
}% |
| 3521 |
% \end{macrocode} |
| 3522 |
% |
| 3523 |
% \begin{macrocode} |
| 3524 |
\caption@endhook} |
| 3525 |
% \end{macrocode} |
| 3526 |
% \begin{macrocode} |
| 3527 |
\newcommand\caption@@make@epilogue{% |
| 3528 |
\global\caption@starfalse} |
| 3529 |
% \end{macrocode} |
| 3530 |
% \end{macro} |
| 3531 |
% |
| 3532 |
% \begin{macro}{\caption@calcmargin} |
| 3533 |
% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by \cs{ifdim}\cs{captionwidth=}\cs{z@}} |
| 3534 |
% \changes{v1.0g}{2006/01/12}{Improvement: Takes care of list environment now} |
| 3535 |
% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore), use \cs{linewidth} instead of \cs{hsize}} |
| 3536 |
% \changes{v1.5}{2012/12/26}{max-margin stuff moved from \cs{caption@@make} to here} |
| 3537 |
% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}} |
| 3538 |
% |\caption@calcmargin|\par |
| 3539 |
% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid |
| 3540 |
% values. |
| 3541 |
% \begin{macrocode} |
| 3542 |
\newcommand*\caption@calcmargin{% |
| 3543 |
\caption@calcmargin@hook |
| 3544 |
% \end{macrocode} |
| 3545 |
% Check margin, if |\caption@minmargin| or |\caption@maxmargin| is set |
| 3546 |
% \begin{macrocode} |
| 3547 |
\ifx\caption@maxmargin\@undefined \else |
| 3548 |
\ifdim\captionmargin>\caption@maxmargin\relax |
| 3549 |
\captionmargin\caption@maxmargin\relax |
| 3550 |
\fi |
| 3551 |
\fi |
| 3552 |
\ifx\caption@minmargin\@undefined \else |
| 3553 |
\ifdim\captionmargin<\caption@minmargin\relax |
| 3554 |
\captionmargin\caption@minmargin\relax |
| 3555 |
\fi |
| 3556 |
\fi |
| 3557 |
% \end{macrocode} |
| 3558 |
% \begin{macrocode} |
| 3559 |
\ifdim\captionwidth=\z@ |
| 3560 |
\captionwidth\hsize |
| 3561 |
\advance\captionwidth by -2\captionmargin |
| 3562 |
\advance\captionwidth by -\captionmargin@ |
| 3563 |
\else |
| 3564 |
\captionmargin\hsize |
| 3565 |
\advance\captionmargin by -\captionwidth |
| 3566 |
\divide\captionmargin by 2 |
| 3567 |
\captionmargin@\z@ |
| 3568 |
\fi |
| 3569 |
% \end{macrocode} |
| 3570 |
% \begin{macrocode} |
| 3571 |
\caption@Debug{% |
| 3572 |
\string\hsize=\the\hsize, |
| 3573 |
\string\captionwidth=\the\captionwidth,\MessageBreak |
| 3574 |
\string\captionmargin=\the\captionmargin, |
| 3575 |
\string\captionmargin@=\the\captionmargin@}% |
| 3576 |
% \end{macrocode} |
| 3577 |
% \begin{macrocode} |
| 3578 |
} |
| 3579 |
% \end{macrocode} |
| 3580 |
% \end{macro} |
| 3581 |
% |
| 3582 |
% \begin{macro}{\caption@slc} |
| 3583 |
% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} added} |
| 3584 |
% \changes{v1.1}{2007/07/29}{\cs{caption@setup}\cs{caption@sls} added after \cs{begingroup}} |
| 3585 |
% \changes{v1.1}{2007/07/29}{\cs{caption@calcmargin} added} |
| 3586 |
% \changes{v1.1c}{2007/10/14}{Support of \cs{caption@slfmt} added} |
| 3587 |
% \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} |
| 3588 |
% \changes{v1.3}{2010/09/04}{Split into \cs{caption@slc} and \cs{caption@@slc}} |
| 3589 |
% \changes{v1.5}{2012/12/26}{Merged into a single macro again} |
| 3590 |
% \changes{v1.5}{2013/04/14}{Definition and usage of \cs{ifsinglelinecaption} added} |
| 3591 |
% |\caption@slc|\marg{label}\marg{text}\marg{single-line-code}\marg{multi-line-code}\par |
| 3592 |
% This one does the single-line-check. |
| 3593 |
% \begin{macrocode} |
| 3594 |
\newcommand\caption@slc[4]{% |
| 3595 |
\caption@Debug{Begin SLC}% |
| 3596 |
\singlelinecaptiontrue |
| 3597 |
\begingroup |
| 3598 |
\caption@singleline |
| 3599 |
\let\caption@hj\@empty |
| 3600 |
\caption@calcmargin % calculate \captionwidth |
| 3601 |
\caption@prepareslc |
| 3602 |
\sbox\@tempboxa{\caption@@@make{#1}{#2}}% |
| 3603 |
\ifdim\wd\@tempboxa>\captionwidth |
| 3604 |
\endgroup |
| 3605 |
\singlelinecaptionfalse |
| 3606 |
#4% |
| 3607 |
\else |
| 3608 |
\endgroup |
| 3609 |
#3% |
| 3610 |
\fi |
| 3611 |
\caption@Debug{End SLC}} |
| 3612 |
% \end{macrocode} |
| 3613 |
% \begin{macrocode} |
| 3614 |
\newif\ifsinglelinecaption |
| 3615 |
% \end{macrocode} |
| 3616 |
% \begin{macrocode} |
| 3617 |
\newcommand*\caption@singleline{% |
| 3618 |
\caption@xsetup\caption@opt@singleline |
| 3619 |
\let\caption@fmt\caption@slfmt} |
| 3620 |
% \end{macrocode} |
| 3621 |
% \end{macro} |
| 3622 |
% |
| 3623 |
% \begin{macro}{\caption@prepareslc} |
| 3624 |
% \changes{v1.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added} |
| 3625 |
% \changes{v1.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}} |
| 3626 |
% \changes{v1.0c}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added} |
| 3627 |
% \changes{v1.0f}{2005/07/09}{Support of \package{endnotes} package added} |
| 3628 |
% \changes{v1.1}{2007/06/13}{\cs{let}\cs{caption@hj}\cs{relax} moved to \cs{caption@slc}} |
| 3629 |
% \changes{v1.1}{2007/06/13}{Redefinition of \cs{(H@)refstepcounter} added} |
| 3630 |
% \changes{v1.1}{2007/08/12}{Redefinition of \cs{label} improved} |
| 3631 |
% \changes{v1.1c}{2007/10/06}{Definition of \cs{caption@l@stepcounter} added} |
| 3632 |
% \changes{v1.3}{2011/07/07}{Bugfix 11-07-06: Redefinition of \cs{footnote} and \cs{footnotemark} added, redefinition of \cs{stepcounter} and \cs{refstepcounter} dropped} |
| 3633 |
% \changes{v1.4a}{2011/10/21}{Redefinition of \cs{pagenote} from \textsf{memoir} document class added} |
| 3634 |
% \changes{v1.4a}{2011/10/22}{Redefinition of \cs{footnote} revised} |
| 3635 |
% \changes{v1.5}{2013/04/13}{Redefinition os \cs{glsunset} added} |
| 3636 |
% \changes{v1.8}{2018/01/21}{Redefinition of \cs{endnote} added (thanks to Markus Kohm)} |
| 3637 |
% \changes{v1.8}{2018/05/16}{Redefinition of \cs{acused} added} |
| 3638 |
% \changes{v1.8}{2018/05/26}{Definition method changed so it can be pre-defined by other packages} |
| 3639 |
% \changes{v1.8}{2018/05/27}{Redefinition of \cs{hypertarget} added} |
| 3640 |
% \changes{v1.12b}{2020/07/20}{Special adaption to \class{beamer} added} |
| 3641 |
% |\caption@prepareslc|\par |
| 3642 |
% Re-define anything which would disturb the single-line-check. |
| 3643 |
% \begin{macrocode} |
| 3644 |
\providecommand*\caption@prepareslc{} |
| 3645 |
\g@addto@macro\caption@prepareslc{% |
| 3646 |
\let\label\caption@gobble |
| 3647 |
\let\hypertarget\@gobbletwo |
| 3648 |
% \end{macrocode} |
| 3649 |
% We re-define \cs{footnote} so |
| 3650 |
% \begin{enumerate} |
| 3651 |
% \item The footnote counter will not be increased twice (but still the correct footnote mark will be used within the single-line-check) |
| 3652 |
% \item The footnote text will not be evaluated twice |
| 3653 |
% \end{enumerate} |
| 3654 |
% \begin{macrocode} |
| 3655 |
\let\caption@footnote@ORI\footnote |
| 3656 |
\def\footnote{\caption@withoptargs\caption@footnote}% |
| 3657 |
\let\caption@footnotemark@ORI\footnotemark |
| 3658 |
\def\footnotemark{\caption@withoptargs\caption@footnotemark}% |
| 3659 |
\let\caption@footnotetext@ORI\@footnotetext |
| 3660 |
\let\@footnotetext\caption@gobble |
| 3661 |
% \end{macrocode} |
| 3662 |
% Same for \cs{endnote} |
| 3663 |
% \begin{macrocode} |
| 3664 |
\let\caption@endnote@ORI\endnote |
| 3665 |
\def\endnote{\caption@withoptargs\caption@endnote}% |
| 3666 |
\let\caption@endnotemark@ORI\endnotemark |
| 3667 |
\def\endnotemark{\caption@withoptargs\caption@endnotemark}% |
| 3668 |
\let\caption@endnotetext@ORI\@endnotetext |
| 3669 |
\let\@endnotetext\caption@gobble |
| 3670 |
% \end{macrocode} |
| 3671 |
% \begin{macrocode} |
| 3672 |
\let\pagenote\caption@gobble |
| 3673 |
% \end{macrocode} |
| 3674 |
% Adaption to the \package{acronym} package\par |
| 3675 |
% See also \url{https://tex.stackexchange.com/questions/428788} |
| 3676 |
% \begin{macrocode} |
| 3677 |
\let\acused\@gobble |
| 3678 |
\let\AC@placelabel\@gobble |
| 3679 |
% \end{macrocode} |
| 3680 |
% Adaption to the \package{glossaries} package.\par |
| 3681 |
% Please note that while this adaption is usually sufficient |
| 3682 |
% it could give incorrect measuring results if \cs{gls} is both used |
| 3683 |
% for the very first time and more than once (for a particular acronym). |
| 3684 |
% The alternative would be using internal macros of the |
| 3685 |
% \package{glossaries} package which I would like to avoid.\par |
| 3686 |
% See also \url{https://tex.stackexchange.com/questions/108368} |
| 3687 |
% \begin{macrocode} |
| 3688 |
\let\glsunset\@gobble |
| 3689 |
% \end{macrocode} |
| 3690 |
% \begin{macrocode} |
| 3691 |
} |
| 3692 |
% \end{macrocode} |
| 3693 |
% \begin{macrocode} |
| 3694 |
\newcommand\caption@footnote[2]{% |
| 3695 |
\caption@footnotemark{#1}} |
| 3696 |
% \end{macrocode} |
| 3697 |
% \begin{macrocode} |
| 3698 |
\newcommand\caption@footnotemark[1]{% |
| 3699 |
\begingroup |
| 3700 |
\let\stepcounter\caption@l@stepcounter |
| 3701 |
\caption@footnotemark@ORI#1\relax |
| 3702 |
\endgroup} |
| 3703 |
% \end{macrocode} |
| 3704 |
% \begin{macrocode} |
| 3705 |
\newcommand\caption@endnote[2]{% |
| 3706 |
\caption@endnotemark{#1}} |
| 3707 |
% \end{macrocode} |
| 3708 |
% \begin{macrocode} |
| 3709 |
\newcommand\caption@endnotemark[1]{% |
| 3710 |
\begingroup |
| 3711 |
\let\stepcounter\caption@l@stepcounter |
| 3712 |
\caption@endnotemark@ORI#1\relax |
| 3713 |
\endgroup} |
| 3714 |
% \end{macrocode} |
| 3715 |
% \begin{macrocode} |
| 3716 |
\newcommand*\caption@l@stepcounter[1]{% |
| 3717 |
\advance\csname c@#1\endcsname\@ne\relax} |
| 3718 |
% \end{macrocode} |
| 3719 |
% The patch above assumes that the optional arguments of \cs{footnote} and |
| 3720 |
% \cs{footnotemark} match. Since this is not the case in \class{beamer} based documents, |
| 3721 |
% and since \class{beamer} extents the syntax of \cs{footnote} in a special way, |
| 3722 |
% we need a special patch here.\par |
| 3723 |
% \emph{Note:} For this patch we assume that \cs{footnote} will always end with the usage of |
| 3724 |
% \cs{beamer@footnotetext}. (Unfortunately \cs{footnote} is defined too monolithic |
| 3725 |
% in \class{beamer} to offer a less dirty patch.) |
| 3726 |
% \begin{macrocode} |
| 3727 |
\caption@ifclassloaded{beamer}{% |
| 3728 |
\g@addto@macro\caption@prepareslc{% |
| 3729 |
\def\footnote{% |
| 3730 |
\begingroup |
| 3731 |
\let\stepcounter\caption@l@stepcounter |
| 3732 |
\renewcommand<>\beamer@framefootnotetext[1]{% |
| 3733 |
\endgroup}% |
| 3734 |
\let\@footnotetext\beamer@framefootnotetext |
| 3735 |
\caption@footnote@ORI}}}{} |
| 3736 |
% \end{macrocode} |
| 3737 |
% \end{macro} |
| 3738 |
% |
| 3739 |
% \begin{macro}{\caption@applyfont} |
| 3740 |
% \changes{v1.3}{2010/09/04}{This macro added} |
| 3741 |
% |\caption@applyfont|\par |
| 3742 |
% This macro executes the font relevant macros, i.e. by default |
| 3743 |
% the options set by |justification=|, |font=|, and |size=|. |
| 3744 |
% \begin{macrocode} |
| 3745 |
\newcommand*\caption@applyfont{% |
| 3746 |
\caption@hj\captionfont\captionsize} |
| 3747 |
% \end{macrocode} |
| 3748 |
% \end{macro} |
| 3749 |
% |
| 3750 |
% \begin{macro}{\caption@@@make} |
| 3751 |
% \changes{v1.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added} |
| 3752 |
% \changes{v1.0c}{2005/02/12}{Bugfix 04-12-16: Use some kind of |
| 3753 |
% \cs{@startstrut}\cs{strutbox} instead of \cs{strut}} |
| 3754 |
% \changes{v1.0c}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added} |
| 3755 |
% \changes{v1.0d}{2005/05/05}{Use \cs{caption@ifempty}; |
| 3756 |
% \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added} |
| 3757 |
% \changes{v1.0d}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed} |
| 3758 |
% \changes{v1.0f}{2005/08/24}{Check for empty label added} |
| 3759 |
% \changes{v1.0f}{2005/08/25}{\cs{caption@iflf} added} |
| 3760 |
% \changes{v1.0j}{2007/02/18}{Usage of \cs{caption@tfmt} added} |
| 3761 |
% \changes{v1.1}{2007/05/07}{Bugfix: \cs{ifhmode} added to \cs{@finalstrut}} |
| 3762 |
% \changes{v1.2}{2007/11/17}{Made option \opt{size=} stronger than \opt{font=}} |
| 3763 |
% \changes{v1.3}{2010/09/04}{Uses \cs{caption@applyfont} now} |
| 3764 |
% \changes{v1.3}{2010/11/01}{Bugfix: If the caption text is empty, the text format will be set to \opt{simple} now} |
| 3765 |
% \changes{v1.7}{2016/02/01}{Bugfix: \cs{relax} added before \cs{caption@lsep} so the label separator |
| 3766 |
% will not be gobbled if the label font command ignores spaces, e.g. by usage of \cs{color}} |
| 3767 |
% \changes{v1.8}{2018/09/12}{\cs{par} replaced by \cs{captiontextend}} |
| 3768 |
% |\caption@@@make|\marg{caption label}\marg{caption text}\par |
| 3769 |
% This one finally typesets the caption paragraph, without margin and indention. |
| 3770 |
% \begin{macrocode} |
| 3771 |
\newcommand\caption@@@make[2]{% |
| 3772 |
% \end{macrocode} |
| 3773 |
% |
| 3774 |
% If the label is empty, we use no caption label separator. |
| 3775 |
% \begin{macrocode} |
| 3776 |
\sbox\@tempboxa{#1}% |
| 3777 |
\ifdim\wd\@tempboxa=\z@ |
| 3778 |
\let\caption@lsep\relax |
| 3779 |
% \@capbreakfalse |
| 3780 |
\fi |
| 3781 |
% \end{macrocode} |
| 3782 |
% |
| 3783 |
% If the text is empty, we use no caption label separator, too. |
| 3784 |
% (And no text format either.) |
| 3785 |
% \begin{macrocode} |
| 3786 |
\caption@ifempty{#2}{% |
| 3787 |
\let\caption@lsep\@empty |
| 3788 |
\let\caption@tfmt\@firstofone |
| 3789 |
% \@capbreakfalse |
| 3790 |
% \let\caption@ifstrut\@secondoftwo |
| 3791 |
}% |
| 3792 |
% \end{macrocode} |
| 3793 |
% |
| 3794 |
% Take care that |\caption@parindent| and |\caption@hangindent| will be used |
| 3795 |
% to typeset the paragraph. |
| 3796 |
% \begin{macrocode} |
| 3797 |
\@setpar{\@@par\caption@@par}\caption@@par |
| 3798 |
% \end{macrocode} |
| 3799 |
% |
| 3800 |
% Finally typeset the caption. |
| 3801 |
% \begin{macrocode} |
| 3802 |
\caption@applyfont |
| 3803 |
\caption@fmt |
| 3804 |
{\ifcaption@star\else |
| 3805 |
\begingroup |
| 3806 |
\captionlabelfont |
| 3807 |
#1% |
| 3808 |
\endgroup |
| 3809 |
\fi}% |
| 3810 |
{\ifcaption@star\else |
| 3811 |
\begingroup |
| 3812 |
\caption@iflf\captionlabelfont |
| 3813 |
\relax\caption@lsep |
| 3814 |
\endgroup |
| 3815 |
\fi}% |
| 3816 |
{{\captiontextfont |
| 3817 |
\captiontextstart |
| 3818 |
\caption@ifstrut |
| 3819 |
{\vrule\@height\ht\strutbox\@width\z@}% |
| 3820 |
{}% |
| 3821 |
\nobreak\hskip\z@skip % enable hyphenation |
| 3822 |
\caption@tfmt{#2}% |
| 3823 |
% \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}% |
| 3824 |
\caption@ifstrut |
| 3825 |
{\ifhmode\@finalstrut\strutbox\fi}% |
| 3826 |
{}% |
| 3827 |
\captiontextend}}} |
| 3828 |
% \end{macrocode} |
| 3829 |
% \begin{macrocode} |
| 3830 |
\newcommand*\captiontextstart{} |
| 3831 |
\newcommand*\captiontextend{\par} |
| 3832 |
% \end{macrocode} |
| 3833 |
% \end{macro} |
| 3834 |
% |
| 3835 |
% \begin{macro}{\caption@ifempty} |
| 3836 |
% \changes{v1.0d}{2005/05/05}{This macro added} |
| 3837 |
% \changes{v1.1}{2007/07/04}{Re-defines itself now} |
| 3838 |
% \changes{v1.2a}{2007/01/22}{Revised so \cs{label} will be detected, too} |
| 3839 |
% \changes{v1.2b}{2008/08/02}{Revised so \cs{index} and \cs{glossary} will be detected, too} |
| 3840 |
% |\caption@ifempty|\marg{text}\marg{true} (\emph{no} \meta{false})\par |
| 3841 |
% This one tests if the \meta{text} is actually empty. |
| 3842 |
% \Note{This will be done without expanding the text, |
| 3843 |
% therefore this is far away from being bullet-proof.} |
| 3844 |
% \Note{This macro is re-defining itself so only |
| 3845 |
% the first test (in a group) will actually be done.} |
| 3846 |
% \begin{macrocode} |
| 3847 |
\newcommand\caption@ifempty[1]{% |
| 3848 |
\caption@if@empty{#1}% |
| 3849 |
\caption@ifempty\@unused} |
| 3850 |
% \end{macrocode} |
| 3851 |
% \begin{macrocode} |
| 3852 |
\newcommand\caption@if@empty[1]{% |
| 3853 |
\def\caption@tempa{#1}% |
| 3854 |
\ifx\caption@tempa\@empty |
| 3855 |
\let\caption@ifempty\@secondoftwo |
| 3856 |
\else |
| 3857 |
\expandafter\def\expandafter\caption@tempa\expandafter{% |
| 3858 |
\caption@car#1\caption@if@empty\caption@nil}% |
| 3859 |
\def\caption@tempb{\caption@if@empty}% |
| 3860 |
\ifx\caption@tempa\caption@tempb |
| 3861 |
\let\caption@ifempty\@secondoftwo |
| 3862 |
\else |
| 3863 |
\def\caption@tempb{\ignorespaces}% |
| 3864 |
\ifx\caption@tempa\caption@tempb |
| 3865 |
\expandafter\caption@if@empty\expandafter{\@gobble#1}% |
| 3866 |
\else |
| 3867 |
\def\caption@tempb{\label}% |
| 3868 |
\ifx\caption@tempa\caption@tempb |
| 3869 |
\expandafter\caption@if@empty\expandafter{\@gobbletwo#1}% |
| 3870 |
\else |
| 3871 |
\def\caption@tempb{\index}% |
| 3872 |
\ifx\caption@tempa\caption@tempb |
| 3873 |
\expandafter\caption@if@empty\expandafter{\@gobbletwo#1}% |
| 3874 |
\else |
| 3875 |
\def\caption@tempb{\glossary}% |
| 3876 |
\ifx\caption@tempa\caption@tempb |
| 3877 |
\expandafter\caption@if@empty\expandafter{\@gobbletwo#1}% |
| 3878 |
\else |
| 3879 |
\let\caption@ifempty\@gobbletwo |
| 3880 |
\fi |
| 3881 |
\fi |
| 3882 |
\fi |
| 3883 |
\fi |
| 3884 |
\fi |
| 3885 |
\fi} |
| 3886 |
% \end{macrocode} |
| 3887 |
% \begin{macrocode} |
| 3888 |
\long\def\caption@car#1#2\caption@nil{#1}% same as \@car, but \long |
| 3889 |
% \end{macrocode} |
| 3890 |
% \end{macro} |
| 3891 |
% |
| 3892 |
% \begin{macro}{\caption@@par} |
| 3893 |
% \changes{v1.0f}{2005/08/22}{Made this definition global} |
| 3894 |
% |\caption@@par|\par |
| 3895 |
% This command will be executed with every |\par| inside the caption. |
| 3896 |
% \begin{macrocode} |
| 3897 |
\newcommand*\caption@@par{% |
| 3898 |
\parindent\caption@parindent\hangindent\caption@hangindent}% |
| 3899 |
% \end{macrocode} |
| 3900 |
% \end{macro} |
| 3901 |
% |
| 3902 |
% \section{Types \& sub-types} |
| 3903 |
% |
| 3904 |
% \begin{macro}{\DeclareCaptionType} |
| 3905 |
% \changes{v1.1}{2007/08/12}{This macro added} |
| 3906 |
% \changes{v1.1a}{2007/09/07}{Three optional arguments added} |
| 3907 |
% \changes{v1.2}{2007/12/06}{Renamed from \cs{DeclareFloatingEnvironment} to \cs{DeclareCaptionType}} |
| 3908 |
% \changes{v1.2}{2007/12/21}{Optional argument revised, uses key-value syntax now} |
| 3909 |
% \changes{v1.2b}{2008/04/13}{Uses \cs{caption@within@default} now} |
| 3910 |
% \changes{v1.2b}{2008/08/02}{Support of \cs{float@exts} and \cs{float@addtolists} added} |
| 3911 |
% \changes{v1.2e}{2010/01/09}{Usage of \cs{caption@DeclareWithinOption} added} |
| 3912 |
% \changes{v1.3}{2011/08/06}{Definition of \cs{listofXXXes} added} |
| 3913 |
% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package} |
| 3914 |
% |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name} |
| 3915 |
% \begin{macrocode} |
| 3916 |
\newcommand*\DeclareCaptionType{% |
| 3917 |
\caption@loadpackage{newfloat}{}% |
| 3918 |
\DeclareFloatingEnvironment} |
| 3919 |
\@onlypreamble\DeclareCaptionType |
| 3920 |
% \end{macrocode} |
| 3921 |
% \end{macro} |
| 3922 |
% |
| 3923 |
% \begin{macro}{\ForEachCaptionType} |
| 3924 |
% \changes{v1.4a}{2011/10/29}{This macro added} |
| 3925 |
% \changes{v1.13}{2020/07/29}{Renamed from \cs{caption@ForEachType} to \cs{ForEachCaptionType} and starred variant added} |
| 3926 |
% |\ForEachCaptionType|\marg{code with \#1}\\ |
| 3927 |
% |\ForEachCaptionType*|\marg{code with \#1}\par |
| 3928 |
% will execute the given code for each (known) floating environment. |
| 3929 |
% The starred variant will only work for already existing environments, |
| 3930 |
% i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment| |
| 3931 |
% (offered by the \package{newfloat} package). |
| 3932 |
% \begin{macrocode} |
| 3933 |
\newcommand*\ForEachCaptionType{% |
| 3934 |
\@ifstar |
| 3935 |
{\caption@foreach@type\@gobble}% |
| 3936 |
{\caption@foreach@type\@iden}} |
| 3937 |
% \end{macrocode} |
| 3938 |
% \begin{macrocode} |
| 3939 |
\newcommand\caption@foreach@type[2]{% |
| 3940 |
\caption@ifdefined\ForEachFloatingEnvironment |
| 3941 |
{\ForEachFloatingEnvironment*{#2}}% |
| 3942 |
{\def\@elt##1{#2}% |
| 3943 |
\caption@ifdefined\c@figure\@elt\@gobble{figure}% |
| 3944 |
\caption@ifdefined\c@table\@elt\@gobble{table}% |
| 3945 |
\let\@elt\relax}% |
| 3946 |
#1{\newfloat@addtohook{#2}}} |
| 3947 |
% \end{macrocode} |
| 3948 |
% \end{macro} |
| 3949 |
% |
| 3950 |
% \begin{macro}{\newfloat@addtohook} |
| 3951 |
% |\newfloat@addtohook|\marg{code with \#1}\par |
| 3952 |
% adds code to the hook called in |\Declare|\-|Floating|\-|Environment|.\par |
| 3953 |
% Note: We use |\provide|\-|command| instead of |\new|\-|command| here since the |
| 3954 |
% exact same code is defined in the \package{newfloat} package. |
| 3955 |
% \begin{macrocode} |
| 3956 |
\providecommand\newfloat@addtohook[1]{% |
| 3957 |
\toks@=\expandafter{\newfloat@hook{##1}#1}% |
| 3958 |
\edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}% |
| 3959 |
\@tempa} |
| 3960 |
% \end{macrocode} |
| 3961 |
% \end{macro} |
| 3962 |
% |
| 3963 |
% \begin{macro}{\newfloat@hook} |
| 3964 |
% Hook used in |\Declare|\-|Floating|\-|Environment|. |
| 3965 |
% \begin{macrocode} |
| 3966 |
\providecommand*\newfloat@hook[1]{} |
| 3967 |
% \end{macrocode} |
| 3968 |
% \end{macro} |
| 3969 |
% |
| 3970 |
% \begin{macro}{\DeclareCaptionSubType} |
| 3971 |
% \changes{v1.2}{2007/11/16}{This macro added} |
| 3972 |
% \changes{v1.2a}{2008/03/11}{Bugfix: \cs{subfigurename} will be defined now} |
| 3973 |
% \changes{v1.2d}{2009/10/09}{Bugfix 08-10-01: Usage of \cs{caption@addtoreset} added} |
| 3974 |
% \changes{v1.3}{2011/01/01}{\cs{@dottedlofline} will be defined \& used now} |
| 3975 |
% \changes{v1.4}{2011/10/09}{Support of the titletoc package added} |
| 3976 |
% \changes{v1.5}{2011/12/29}{Usage of \cs{caption@addtoreset} replaced by \cs{@addtoreset}} |
| 3977 |
% \changes{v1.5}{2013/01/10}{Bugfix: Definition of autoref string corrected} |
| 3978 |
% \changes{v1.6}{2013/06/17}{Bugfix: \cs{c@tocdepth} will be set (locally) now} |
| 3979 |
% \changes{v1.8g}{2020/01/02}{Check revised if the sub-type is already defined or not} |
| 3980 |
% \changes{v1.13}{2020/07/28}{Uses \cs{caption@l@addto@list} instead of \cs{@cons} now} |
| 3981 |
% \changes{v1.13}{2020/07/29}{Usage of \cs{caption@subtype@hook} added} |
| 3982 |
% \changes{v1.13}{2020/07/29}{We don't re-use existing counters anymore (This was a bad idea anyway)} |
| 3983 |
% \changes{v1.13b}{2022/04/06}{We don't re-use existing counters anymore (Part 2)} |
| 3984 |
% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\ |
| 3985 |
% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}\par |
| 3986 |
% The starred variant provides the numbering format |
| 3987 |
% \meta{type}|.|\meta{subtype} while the non-starred variant simply |
| 3988 |
% uses \meta{subtype}. |
| 3989 |
% \begin{macrocode} |
| 3990 |
\newcommand*\DeclareCaptionSubType{% |
| 3991 |
\caption@teststar\caption@declaresubtype\@firstoftwo\@secondoftwo} |
| 3992 |
\@onlypreamble\DeclareCaptionSubType |
| 3993 |
% \end{macrocode} |
| 3994 |
% \begin{macrocode} |
| 3995 |
\newcommand*\caption@declaresubtype[1]{% |
| 3996 |
\@testopt{\caption@@declaresubtype{#1}}{alph}} |
| 3997 |
\@onlypreamble\caption@declaresubtype |
| 3998 |
% \end{macrocode} |
| 3999 |
% \begin{macrocode} |
| 4000 |
\def\caption@@declaresubtype#1[#2]#3{% |
| 4001 |
\@ifundefined{c@#3}% |
| 4002 |
{\caption@Error{No float type '#3' defined}}% |
| 4003 |
{\caption@@@declaresubtype{#1}{#2}{#3}{sub#3}}} |
| 4004 |
\@onlypreamble\caption@@declaresubtype |
| 4005 |
% \end{macrocode} |
| 4006 |
% \begin{macrocode} |
| 4007 |
\newcommand*\caption@@@declaresubtype[4]{% |
| 4008 |
% \end{macrocode} |
| 4009 |
% \begin{macrocode} |
| 4010 |
% Check if the sub-type was already defined by |\Declare|\-|Sub|\-|Type|. |
| 4011 |
% If not, define the counter and list entry. |
| 4012 |
% \begin{macrocode} |
| 4013 |
\caption@ifin@list\caption@subtypelist{#4}% |
| 4014 |
{\caption@Debug{Modify subtype `#4'}}% |
| 4015 |
{\caption@Debug{New subtype `#4'}% |
| 4016 |
\newcounter{#4}[#3]% |
| 4017 |
\@namedef{ext@#4}{\csname ext@#3\endcsname}% |
| 4018 |
\caption@declaresublistentry{#3}% |
| 4019 |
\caption@l@addto@list\caption@subtypelist{#4}% |
| 4020 |
\caption@subtype@hook{#4}% |
| 4021 |
% \end{macrocode} |
| 4022 |
% Support of \package{titletoc} package |
| 4023 |
% \begin{macrocode} |
| 4024 |
\caption@ifdefined\contentsuse{% |
| 4025 |
\contentsuse{#4}{\csname ext@#4\endcsname}}{}% |
| 4026 |
% \end{macrocode} |
| 4027 |
% \begin{macrocode} |
| 4028 |
\@namedef{#4name}{}% |
| 4029 |
\@namedef{#4autorefname}{\csname #3autorefname\endcsname}}% |
| 4030 |
% \end{macrocode} |
| 4031 |
% \begin{macrocode} |
| 4032 |
#1% is \@firstoftwo in star form, and \@secondoftwo otherwise |
| 4033 |
{\@namedef{p@#4}{}% |
| 4034 |
\@namedef{the#4}{\csname the#3\endcsname.\@nameuse{#2}{#4}}}% |
| 4035 |
{\@namedef{p@#4}{\csname the#3\endcsname}% |
| 4036 |
\@namedef{the#4}{\@nameuse{#2}{#4}}}% |
| 4037 |
\@namedef{theH#4}{\csname theH#3\endcsname.\arabic{#4}}} |
| 4038 |
% \end{macrocode} |
| 4039 |
% \begin{macrocode} |
| 4040 |
\@onlypreamble\caption@@@declaresubtype |
| 4041 |
% \end{macrocode} |
| 4042 |
% \begin{macrocode} |
| 4043 |
\newcommand*\caption@declaresublistentry{% |
| 4044 |
\caption@ifdefined\l@chapter |
| 4045 |
{\caption@@declaresublistentry\l@subsection}% |
| 4046 |
{\caption@@declaresublistentry\l@subsubsection}} |
| 4047 |
\@onlypreamble\caption@declaresublistentry |
| 4048 |
% \end{macrocode} |
| 4049 |
% \begin{macrocode} |
| 4050 |
\newcommand*\caption@@declaresublistentry[2]{% |
| 4051 |
\ifx#1\@undefined |
| 4052 |
\caption@@@declaresublistentry\relax\@dottedtocline\caption@nil{#2}% |
| 4053 |
\else |
| 4054 |
\expandafter\caption@@@declaresublistentry#1{}{}\@dottedtocline\caption@nil{#2}% |
| 4055 |
\fi} |
| 4056 |
\@onlypreamble\caption@@declaresublistentry |
| 4057 |
% \end{macrocode} |
| 4058 |
% \begin{macrocode} |
| 4059 |
\long\def\caption@@@declaresublistentry#1\@dottedtocline#2\caption@nil#3{% |
| 4060 |
\def\@tempa{#1}% |
| 4061 |
% Does \l@(sub)subsection start with \@dottedtocline? |
| 4062 |
\ifx\@tempa\@empty |
| 4063 |
% Yes |
| 4064 |
\caption@@@@declaresublistentry{#3}#2\caption@nil |
| 4065 |
\else |
| 4066 |
% No |
| 4067 |
\caption@@@@declaresublistentry{#3}@{3.8em}{3.2em}\caption@nil |
| 4068 |
\fi} |
| 4069 |
\@onlypreamble\caption@@@declaresublistentry |
| 4070 |
% \end{macrocode} |
| 4071 |
% \begin{macrocode} |
| 4072 |
\def\caption@@@@declaresublistentry#1#2#3#4#5\caption@nil{% |
| 4073 |
\expandafter\caption@@@@@declaresublistentry\expandafter |
| 4074 |
{\csname @dotted\csname ext@#1\endcsname line\endcsname}{#1}{#3}{#4}} |
| 4075 |
\@onlypreamble\caption@@@@declaresublistentry |
| 4076 |
% \end{macrocode} |
| 4077 |
% \begin{macrocode} |
| 4078 |
\newcommand*\caption@@@@@declaresublistentry[4]{% |
| 4079 |
\@namedef{l@sub#2}{#1{2}{#3}{#4}}% |
| 4080 |
\expandafter\caption@@@@@@declaresublistentry |
| 4081 |
\expandafter#1\expandafter{\csname ext@#2\endcsname depth}} |
| 4082 |
\@onlypreamble\caption@@@@@declaresublistentry |
| 4083 |
% \end{macrocode} |
| 4084 |
% \begin{macrocode} |
| 4085 |
\newcommand*\caption@@@@@@declaresublistentry[2]{ |
| 4086 |
\ifx#1\relax |
| 4087 |
\def#1##1{% |
| 4088 |
\def\next{\@dottedtocline{##1}}% |
| 4089 |
\@ifundefined{c@#2}{}{% |
| 4090 |
\ifnum ##1>\@nameuse{c@#2}\relax |
| 4091 |
\let\next\@gobblefour |
| 4092 |
\else |
| 4093 |
\c@tocdepth=\@nameuse{c@#2}\relax |
| 4094 |
\fi}% |
| 4095 |
\next}% |
| 4096 |
\fi} |
| 4097 |
\@onlypreamble\caption@@@@@@declaresublistentry |
| 4098 |
% \end{macrocode} |
| 4099 |
% \end{macro} |
| 4100 |
% |
| 4101 |
% \begin{macro}{\caption@subtypelist} |
| 4102 |
% A list containing the sub-types defined with |\Declare|\-|Caption|\-|Sub|\-|Type|. |
| 4103 |
% \begin{macrocode} |
| 4104 |
\newcommand*\caption@subtypelist{} |
| 4105 |
% \end{macrocode} |
| 4106 |
% \end{macro} |
| 4107 |
% |
| 4108 |
% \begin{macro}{\caption@ifsubtype} |
| 4109 |
% \changes{v1.8g}{2020/01/02}{This macro added} |
| 4110 |
% \changes{v1.13}{2020/07/28}{Uses \cs{caption@ifin@list} now} |
| 4111 |
% This macro checks if the given subtype was defined |
| 4112 |
% with |\Declare|\-|Caption|\-|Sub|\-|Type|. |
| 4113 |
% \begin{macrocode} |
| 4114 |
\newcommand*\caption@ifsubtype{% |
| 4115 |
\caption@ifin@list\caption@subtypelist} |
| 4116 |
% \end{macrocode} |
| 4117 |
% \end{macro} |
| 4118 |
% |
| 4119 |
% \begin{macro}{\ForEachCaptionSubType} |
| 4120 |
% \changes{v1.13}{2020/07/29}{This macro added as replacement for \cs{caption@For}} |
| 4121 |
% |\ForEachCaptionSubType|\marg{code with \#1}\\ |
| 4122 |
% |\ForEachCaptionSubType*|\marg{code with \#1}\par |
| 4123 |
% will execute the given code for each (known) sub-type. |
| 4124 |
% The starred variant will only work for already existing sub-types, |
| 4125 |
% i.e.~no hook will be placed inside |\Declare|\-|Caption|\-|Sub|\-|Type|. |
| 4126 |
% \begin{macrocode} |
| 4127 |
\newcommand*\ForEachCaptionSubType{% |
| 4128 |
\@ifstar |
| 4129 |
{\caption@foreach@subtype\@gobble}% |
| 4130 |
{\caption@foreach@subtype\@iden}} |
| 4131 |
% \end{macrocode} |
| 4132 |
% \begin{macrocode} |
| 4133 |
\newcommand\caption@foreach@subtype[2]{% |
| 4134 |
\caption@for@list\caption@subtypelist{#2}% |
| 4135 |
#1{\caption@addto@subtype@hook{#2}}} |
| 4136 |
% \end{macrocode} |
| 4137 |
% \begin{macrocode} |
| 4138 |
\providecommand\caption@addto@subtype@hook[1]{% |
| 4139 |
\toks@=\expandafter{\caption@subtype@hook{##1}#1}% |
| 4140 |
\edef\@tempa{\def\noexpand\caption@subtype@hook####1{\the\toks@}}% |
| 4141 |
\@tempa} |
| 4142 |
% \end{macrocode} |
| 4143 |
% \begin{macrocode} |
| 4144 |
\providecommand*\caption@subtype@hook[1]{} |
| 4145 |
% \end{macrocode} |
| 4146 |
% \end{macro} |
| 4147 |
% |
| 4148 |
% Unfortunately the \class{memoir} document class resets the |
| 4149 |
% \texttt{subfigure} resp.~\texttt{subtable} counter at the begin |
| 4150 |
% of floating environments, i.e.~at |\@float|. |
| 4151 |
% As a side-effect |\continued|\-|float| does not work correctly. |
| 4152 |
% For that reason we need to introduce macros to save and restore |
| 4153 |
% all sub-caption counters here. |
| 4154 |
% |
| 4155 |
% \begin{macro}{\caption@savesubcounters} |
| 4156 |
% \changes{v1.5}{2013/05/01}{This macro added} |
| 4157 |
% \changes{v1.13}{2020/07/28}{Uses \cs{caption@for@list} now for iterating the list} |
| 4158 |
% |\caption@save|\-|sub|\-|counters| saves all sub-caption counters, |
| 4159 |
% so they can be restored with |\caption@restore|\-|counters| later on. |
| 4160 |
% \begin{macrocode} |
| 4161 |
\newcommand*\caption@savesubcounters{% |
| 4162 |
\caption@for@list\caption@subtypelist{\caption@savecounter{##1}}} |
| 4163 |
% \end{macrocode} |
| 4164 |
% \end{macro} |
| 4165 |
% |
| 4166 |
% \begin{macro}{\caption@savecounter} |
| 4167 |
% \changes{v1.5}{2013/05/01}{This macro added} |
| 4168 |
% |\caption@save|\-|counter|\marg{counter} saves the given counter, |
| 4169 |
% so it can be restored with |\caption@restore|\-|counters| later on. |
| 4170 |
% \begin{macrocode} |
| 4171 |
\newcommand*\caption@savecounter[1]{% |
| 4172 |
\edef\caption@tempa{% |
| 4173 |
\noexpand\l@addto@macro\noexpand\caption@restore@counters |
| 4174 |
{\noexpand\setcounter{#1}{\number\value{#1}}}}% |
| 4175 |
\caption@tempa} |
| 4176 |
% \end{macrocode} |
| 4177 |
% \end{macro} |
| 4178 |
% |
| 4179 |
% \begin{macro}{\caption@restorecounters} |
| 4180 |
% \changes{v1.5}{2013/05/01}{This macro added} |
| 4181 |
% |\caption@restore|\-|counters| restores all counters saved with |
| 4182 |
% |\caption@save|\-|counter|. |
| 4183 |
% \begin{macrocode} |
| 4184 |
\newcommand*\caption@restorecounters{% |
| 4185 |
\caption@restore@counters |
| 4186 |
\global\let\caption@restore@counters\@empty} |
| 4187 |
% \end{macrocode} |
| 4188 |
% \begin{macrocode} |
| 4189 |
\newcommand*\caption@restore@counters{} |
| 4190 |
% \end{macrocode} |
| 4191 |
% \end{macro} |
| 4192 |
% |
| 4193 |
% \iffalse |
| 4194 |
%</package> |
| 4195 |
% \fi |
| 4196 |
% |
| 4197 |
% \clearpage |
| 4198 |
% \begin{thebibliography}{99} |
| 4199 |
% \bibitem{TLC2} |
| 4200 |
% Frank Mittelbach and Michel Goossens:\\ |
| 4201 |
% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\ |
| 4202 |
% \newblock Addison-Wesley, 2004. |
| 4203 |
% |
| 4204 |
% \bibitem{Anne} |
| 4205 |
% Anne Br\"uggemann-Klein:\\ |
| 4206 |
% \emph{Einf\"uhrung in die Dokumentverarbeitung},\\ |
| 4207 |
% B.G. Teubner, Stuttgart, 1989 |
| 4208 |
% |
| 4209 |
% \bibitem{hyperref} |
| 4210 |
% Sebastian Rahtz \& Heiko Oberdiek:\\ |
| 4211 |
% \href{http://www.ctan.org/pkg/hyperref}% |
| 4212 |
% {\emph{Hypertext marks in \LaTeX}},\\ |
| 4213 |
% November 12, 2007 |
| 4214 |
% |
| 4215 |
% \bibitem{refcount} |
| 4216 |
% Heiko Oberdiek:\\ |
| 4217 |
% \href{http://www.ctan.org/pkg/refcount}% |
| 4218 |
% {\emph{The refcount package}},\\ |
| 4219 |
% 2006/02/20 |
| 4220 |
% |
| 4221 |
% \bibitem{threeparttable} |
| 4222 |
% Donald Arseneau:\\ |
| 4223 |
% \href{http://www.ctan.org/pkg/threeparttable}% |
| 4224 |
% {\emph{Three part tables: title, tabular environment, notes}},\\ |
| 4225 |
% 2003/06/13 |
| 4226 |
% \end{thebibliography} |
| 4227 |
% |
| 4228 |
% \iffalse |
| 4229 |
% --------------------------------------------------------------------------- % |
| 4230 |
% \fi |
| 4231 |
% |
| 4232 |
% \clearpage |
| 4233 |
% \Finale |
| 4234 |
% |
| 4235 |
\endinput |