| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% This is file `caption2.dtx'. |
| 4 |
% |
| 5 |
% Copyright (C) 1994-2023 Axel Sommerfeldt ([email protected]) |
| 6 |
% |
| 7 |
% -------------------------------------------------------------------------- |
| 8 |
% |
| 9 |
% This work may be distributed and/or modified under the |
| 10 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 11 |
% of this license or (at your option) any later version. |
| 12 |
% The latest version of this license is in |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 15 |
% version 2003/12/01 or later. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status "maintained". |
| 18 |
% |
| 19 |
% This Current Maintainer of this work is Axel Sommerfeldt. |
| 20 |
% |
| 21 |
% This work consists of the files |
| 22 |
% caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx, |
| 23 |
% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx, |
| 24 |
% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx, |
| 25 |
% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, |
| 26 |
% the derived files |
| 27 |
% caption.sty, caption-light.sty, caption2.sty, caption3.sty, |
| 28 |
% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto, |
| 29 |
% caption-koma.sto, caption-memoir.sto, caption-ntg.sto, |
| 30 |
% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty. |
| 31 |
% |
| 32 |
% \fi |
| 33 |
% |
| 34 |
% \CheckSum{818} |
| 35 |
% |
| 36 |
% \iffalse |
| 37 |
%<*driver> |
| 38 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 39 |
\ProvidesFile{caption2.drv}[2023/07/10 v2.2 The (obsolete) caption2 package] |
| 40 |
%\errorcontextlines=3 |
| 41 |
% |
| 42 |
\documentclass{captiondoc} |
| 43 |
\hypersetup{pdfkeywords={LaTeX, package, caption2}} |
| 44 |
% |
| 45 |
\usepackage{caption2}[2008/07/01] |
| 46 |
% |
| 47 |
%<+driver>\OnlyDescription |
| 48 |
% |
| 49 |
\begin{document} |
| 50 |
\DocInput{caption2.dtx} |
| 51 |
\end{document} |
| 52 |
%</driver> |
| 53 |
% \fi |
| 54 |
% |
| 55 |
% \def\thispackage{the \pkg{caption2} package} |
| 56 |
% \def\Thispackage{The \pkg{caption2} package} |
| 57 |
% |
| 58 |
% \GetFileInfo{caption2.drv} |
| 59 |
% \let\docdate\filedate |
| 60 |
% \let\docversion\fileversion |
| 61 |
% \GetFileInfo{caption2.sty} |
| 62 |
% |
| 63 |
% \title{The (obsolete) \texorpdfstring{\pkg{caption2} package\thanks{%^^A |
| 64 |
% This package has version number \docversion.}}%^^A |
| 65 |
% {caption2 package}} |
| 66 |
% \author{Axel Sommerfeldt\\ |
| 67 |
% \url{https://gitlab.com/axelsommerfeldt/caption}} |
| 68 |
% \date{\docdate} |
| 69 |
% \maketitle |
| 70 |
% |
| 71 |
% \changes{v2.0}{1995/10/09}{New experimental version: Many new commands and features} |
| 72 |
% \changes{v2.0}{1995/10/09}{Support of the longtable package added} |
| 73 |
% \changes{v2.1}{2002/02/26}{Adapted to version 2.1 of the subfigure package} |
| 74 |
% \changes{v2.1a}{2003/11/12}{Some minor bug fixes and improved compatibility to v2.0} |
| 75 |
% \changes{v2.1b}{2004/04/16}{Some minor bug fixes and improved compatibility to v2.0} |
| 76 |
% \changes{v2.1c}{2004/05/10}{Some minor bug fixes and improved compatibility to v2.0} |
| 77 |
% \changes{v2.1d}{2005/10/03}{Some superfluous brackets removed; warning added} |
| 78 |
% \changes{v2.2}{2007/04/06}{Uses the caption3 kernel now} |
| 79 |
% |
| 80 |
% \providecommand\LaTeXcomp{The \LaTeX{} Companion} |
| 81 |
% |
| 82 |
% \section*{THIS PACKAGE IS OBSOLETE!} |
| 83 |
% |
| 84 |
% The \pkg{caption2} package used to be an experimental side-version of |
| 85 |
% the regular \pkg{caption} package. It was made public as beta test version |
| 86 |
% without documentation in 1995 because of the strong demand for new features and |
| 87 |
% adaptations to other packages like the \pkg{longtable} and |
| 88 |
% \pkg{subfigure} one. |
| 89 |
% |
| 90 |
% But within the next years I found no time to reintegrate some of the |
| 91 |
% well-tried features into the regular \pkg{caption} package. So I |
| 92 |
% decided to release a version $2.1$ of the \pkg{caption2} package in 2002 |
| 93 |
% instead, which included some minor bug fixes and adaptations to the new |
| 94 |
% version $2.1$ of the \pkg{subfigure} package. Furthermore I started |
| 95 |
% to write a documentation for this package, but unfortunately did not get |
| 96 |
% very far with this\ldots |
| 97 |
% |
| 98 |
% In 2003 I finally found some (more) time, so a new regular release $3.0$ |
| 99 |
% of the \pkg{caption} package could be build in cooperation with |
| 100 |
% Frank Mittelbach and Steven Cochran. |
| 101 |
% It was released in December 2003 and superseded the neglected |
| 102 |
% \pkg{caption2} package. |
| 103 |
% |
| 104 |
% {\small (In parallel, Steven Cochran released the \pkg{subfig} package which |
| 105 |
% superseded the \pkg{subfigure} package.)} |
| 106 |
% |
| 107 |
% So please don't use this package for new documents. It's old, it's obsolete |
| 108 |
% and it starts to begin smell bad! |
| 109 |
% Please ignore all hints in books or other documents which try to tell you |
| 110 |
% that the \pkg{caption2} package should be used instead of the |
| 111 |
% \pkg{caption} package -- these hints are outdated since December 2003. |
| 112 |
% |
| 113 |
% \vfill |
| 114 |
% \bigskip |
| 115 |
% \pagebreak[4] |
| 116 |
% |
| 117 |
% \section*{How to migrate to the regular \pkg{caption} package?} |
| 118 |
% |
| 119 |
% Usually replacing \pkg{caption2} by \pkg{caption} is sufficient |
| 120 |
% because the \pkg{caption} package emulates most of the options and |
| 121 |
% commands offered by the \pkg{caption2} package. |
| 122 |
% If you get some errors or wired results afterwards, please take a closer |
| 123 |
% look at the \pkg{caption} package documentation which will hopefully |
| 124 |
% help you clearing these problems. You will also find a section called |
| 125 |
% `Compatibility to older versions' there which should help you with the |
| 126 |
% migration process. |
| 127 |
% If all this should fail you can write me an e-mail asking for help. |
| 128 |
% |
| 129 |
% \section*{What will happen to this package?} |
| 130 |
% |
| 131 |
% The \pkg{caption2} package is still some kind of supported, that means |
| 132 |
% it will be part of future releases of the \pkg{caption} package bundle, |
| 133 |
% and bugs will still be fixed so existing documents using this package will |
| 134 |
% still compile. |
| 135 |
% But it will \emph{not} be enhanced in the future. |
| 136 |
% |
| 137 |
% This means migrating to the actual \pkg{caption} package should not be |
| 138 |
% necessary for old documents -- they should still compile fine as they are. |
| 139 |
% If not, please don't hesitate to write me an e-mail to |
| 140 |
% \href{mailto:[email protected]}{\texttt{[email protected]}} |
| 141 |
% asking for maintainance. |
| 142 |
% |
| 143 |
% \StopEventually{} |
| 144 |
% |
| 145 |
% \DoNotIndex{\\,\_,\ ,\@@par} |
| 146 |
% \DoNotIndex{\@bsphack} |
| 147 |
% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname} |
| 148 |
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs} |
| 149 |
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo} |
| 150 |
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom} |
| 151 |
% \DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined,\@latex@error} |
| 152 |
% \DoNotIndex{\@namedef,\@nameuse} |
| 153 |
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist} |
| 154 |
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar} |
| 155 |
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempb,\@tempc} |
| 156 |
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} |
| 157 |
% \DoNotIndex{\p@,\z@} |
| 158 |
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance} |
| 159 |
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\bgroup,\box} |
| 160 |
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow} |
| 161 |
% \DoNotIndex{\edef,\egroup,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter} |
| 162 |
% \DoNotIndex{\fi,\footnotesize,\global} |
| 163 |
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss} |
| 164 |
% \DoNotIndex{\if,\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode} |
| 165 |
% \DoNotIndex{\ifx,\ignorespaces,\itshape} |
| 166 |
% \DoNotIndex{\kernel@ifnextchar} |
| 167 |
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth} |
| 168 |
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message} |
| 169 |
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox} |
| 170 |
% \DoNotIndex{\next,\nobreakspace,\noexpand,\noindent,\numberline} |
| 171 |
% \DoNotIndex{\normalsize,\or,\par,\parbox,\parfillskip} |
| 172 |
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\providecommand} |
| 173 |
% \DoNotIndex{\quad} |
| 174 |
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage} |
| 175 |
% \DoNotIndex{\rightskip,\rmfamily} |
| 176 |
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape} |
| 177 |
% \DoNotIndex{\small,\string,\space,\strut} |
| 178 |
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily} |
| 179 |
% \DoNotIndex{\undefined,\unvbox,\uparrow,\upshape,\usebox,\usepackage} |
| 180 |
% \DoNotIndex{\vbox,\vsize,\vskip,\wd,\width,\z@skip} |
| 181 |
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption} |
| 182 |
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists} |
| 183 |
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak} |
| 184 |
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine} |
| 185 |
% \DoNotIndex{\ProcessOptions,\ProvidesPackage} |
| 186 |
% |
| 187 |
% \clearpage |
| 188 |
% |
| 189 |
% \section{The Implementation} |
| 190 |
% \iffalse |
| 191 |
%<*package> |
| 192 |
% \fi |
| 193 |
% |
| 194 |
% \subsection{Identificaton} |
| 195 |
% |
| 196 |
% We need at least \LaTeX2e\ version 1994/12/01. |
| 197 |
% \begin{macrocode} |
| 198 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 199 |
% \end{macrocode} |
| 200 |
% |
| 201 |
% Bypass the release declarations in case the \LaTeX\ kernel doesn’t know how to deal with them |
| 202 |
% (as suggested by \url{https://www.latex-project.org/publications/2018-FMi-TUB-tb122mitt-version-rollback.pdf}). |
| 203 |
% \begin{macrocode} |
| 204 |
\providecommand\DeclareRelease[3]{} |
| 205 |
\providecommand\DeclareCurrentRelease[2]{} |
| 206 |
% \end{macrocode} |
| 207 |
% |
| 208 |
% Declare all supported releases. |
| 209 |
% \begin{macrocode} |
| 210 |
\DeclareRelease{v2.0}{1995-10-09}{caption2_1995-10-09.sty} |
| 211 |
\DeclareRelease{v2.1}{2002-08-03}{caption2_2005-10-03.sty} |
| 212 |
\DeclareCurrentRelease{v2.2}{2007-04-09} % 1st version using caption3 |
| 213 |
% \end{macrocode} |
| 214 |
% |
| 215 |
% Identify the current version of the package. |
| 216 |
% \begin{macrocode} |
| 217 |
\ProvidesPackage{caption2}[2021/01/20 v2.2i Customising captions (AR)] |
| 218 |
%\PackageWarning{caption2}{THIS PACKAGE IS OBSOLETE, PLEASE USE caption INSTEAD} |
| 219 |
% \end{macrocode} |
| 220 |
% |
| 221 |
% \subsection{Loading the caption3 kernel} |
| 222 |
% |
| 223 |
% \begin{macrocode} |
| 224 |
\RequirePackage{caption3}[2007/03/04] |
| 225 |
% \end{macrocode} |
| 226 |
% |
| 227 |
% \begin{macro}{\captiontwo@Error} |
| 228 |
% \changes{v2.2f}{2020/09/28}{This macro added} |
| 229 |
% \changes{v2.2g}{2020/12/25}{Fallback definition of \cs{caption@@eh} added} |
| 230 |
% |\captiontwo@Error|\marg{message}\\ |
| 231 |
% issues an error message (with code line indication). |
| 232 |
% \begin{macrocode} |
| 233 |
\newcommand*\captiontwo@Error[2][]{% |
| 234 |
\PackageError{caption2}{#2}{#1\caption@@eh{caption2}}} |
| 235 |
% \end{macrocode} |
| 236 |
% \begin{macrocode} |
| 237 |
\providecommand*\caption@@eh[1]{% |
| 238 |
If you do not understand this error, please take a closer look\MessageBreak |
| 239 |
at the documentation of the `#1' package, especially the\MessageBreak |
| 240 |
section about errors.\MessageBreak\@ehc} |
| 241 |
% \end{macrocode} |
| 242 |
% \end{macro} |
| 243 |
% |
| 244 |
% \subsection{Check against the regular caption package} |
| 245 |
% \changes{v2.2}{2007/04/06}{Check against regular \pkg{caption} package added} |
| 246 |
% \changes{v2.2a}{2007/04/11}{Bugfix: Usage of \cs{caption@error} replaced by \cs{PackageError}} |
| 247 |
% |
| 248 |
% \begin{macrocode} |
| 249 |
\@ifpackageloaded{caption}{% |
| 250 |
\captiontwo@Error{% |
| 251 |
You can't use both, the (current) caption *and*\MessageBreak |
| 252 |
the (obsolete) caption2 package}% |
| 253 |
\endinput |
| 254 |
}{} |
| 255 |
% \end{macrocode} |
| 256 |
% |
| 257 |
% \subsection{Preliminary declarations} |
| 258 |
% |
| 259 |
% \begin{macro}{\captionlabeldelim} |
| 260 |
% \begin{macro}{\captionlabelsep} |
| 261 |
% \cs{captionlabeldelim} \& \cs{captionlabelsep} will hold the iterim |
| 262 |
% space between caption label and text. |
| 263 |
% (\cs{captionlabeldelim} will be typeset within \cs{captionlabelfont}, |
| 264 |
% \cs{captionlabelsep} not.) |
| 265 |
% \begin{macrocode} |
| 266 |
\newcommand*\captionlabeldelim{} |
| 267 |
\newcommand*\captionlabelsep{} |
| 268 |
% \end{macrocode} |
| 269 |
% \end{macro} |
| 270 |
% \end{macro} |
| 271 |
% |
| 272 |
% \begin{macro}{\captionwidth} |
| 273 |
% \changes{v2.2h}{2021/01/19}{Re-added since the \pkg{caption3} kernel uses \cs{caption@width} now} |
| 274 |
% \begin{macrocode} |
| 275 |
\@ifundefined{captionwidth} |
| 276 |
{\let\captionwidth\caption@width} |
| 277 |
{} |
| 278 |
% \end{macrocode} |
| 279 |
% \end{macro} |
| 280 |
% |
| 281 |
% \begin{macro}{\ifcaptionwidth} |
| 282 |
% \changes{v2.2}{2007/04/06}{New implementation, based on \cs{captionwidth}} |
| 283 |
% Either \cs{captionmargin} (with specifies an extra margin) or \cs{captionwidth} |
| 284 |
% (with specifies an explicit width) can be set, therefore we need the flag \cs{ifcaptionwidth} |
| 285 |
% to determine with parameter we should pay attention to. |
| 286 |
% \begin{macrocode} |
| 287 |
\newcommand*\ifcaptionwidth{\ifdim\captionwidth>\z@} |
| 288 |
% \end{macrocode} |
| 289 |
% \end{macro} |
| 290 |
% |
| 291 |
% \begin{macro}{\captionindent} |
| 292 |
% \changes{v2.2b}{2007/08/12}{Re-added since the \pkg{caption3} kernel uses \cs{caption@indent} now} |
| 293 |
% \changes{v2.2g}{2020/12/25}{Will only be defined if it is not defined yet} |
| 294 |
% \cs{captionindent} will be used in caption style \texttt{indent} and specifies the indention |
| 295 |
% after the first line. (In \pkg{caption3} \version{1.1} \cs{captionindent} was renamed to |
| 296 |
% \cs{caption@indent} to improve compatibility to the AMS \& SMF document classes.) |
| 297 |
% \begin{macrocode} |
| 298 |
\@ifundefined{captionindent} |
| 299 |
{\let\captionindent\caption@indent} |
| 300 |
{} |
| 301 |
% \end{macrocode} |
| 302 |
% \end{macro} |
| 303 |
% |
| 304 |
% \begin{macro}{\ifcaptionlabel} |
| 305 |
% \changes{v2.1}{2002/02/20}{New switch \cs{ifcaptionlabel}} |
| 306 |
% If \cs{ifcaptionlabel} is not set the caption label should be suppressed; |
| 307 |
% we need this flag to support the \cs{caption*} command. |
| 308 |
% \changes{v2.2}{2007/04/06}{New implementation, based on \cs{ifcaption@star}} |
| 309 |
% \begin{macrocode} |
| 310 |
\def\ifcaptionlabel{% |
| 311 |
\ifcaption@star |
| 312 |
\@tempswafalse |
| 313 |
\else |
| 314 |
\@tempswatrue |
| 315 |
\fi |
| 316 |
\if@tempswa} |
| 317 |
\def\captionlabeltrue{\caption@starfalse} |
| 318 |
\def\captionlabelfalse{\caption@startrue} |
| 319 |
% \end{macrocode} |
| 320 |
% \end{macro} |
| 321 |
% |
| 322 |
% \begin{macro}{\ifonelinecaptions} |
| 323 |
% If \cs{ifonelinecaptions} is set we support the \LaTeX\ base style 'one line captions', |
| 324 |
% that means the caption will be typeset centered if it fits to one line. |
| 325 |
% \changes{v2.2}{2007/04/06}{New definition, based on \cs{caption@ifslc}} |
| 326 |
% \begin{macrocode} |
| 327 |
\def\ifonelinecaptions{% |
| 328 |
\caption@ifslc{\@tempswatrue}{\@tempswafalse}% |
| 329 |
\if@tempswa} |
| 330 |
\def\onelinecaptionstrue{\caption@setbool{slc}{1}} |
| 331 |
\def\onelinecaptionsfalse{\caption@setbool{slc}{0}} |
| 332 |
% \end{macrocode} |
| 333 |
% \end{macro} |
| 334 |
% |
| 335 |
% \begin{macro}{\ifignoreLTcapwidth} |
| 336 |
% \changes{v2.1}{2002/02/20}{New switch \cs{ifignoreLTcapwidth}} |
| 337 |
% If \cs{ifignoreLTcapwidth} is set we ignore the \cs{LTcapwidth} of \textsf{longtable}. |
| 338 |
% \begin{macrocode} |
| 339 |
\newif\ifignoreLTcapwidth |
| 340 |
% \end{macrocode} |
| 341 |
% \end{macro} |
| 342 |
% |
| 343 |
% \begin{macro}{\setcaptionmargin} |
| 344 |
% \changes{v2.2h}{2021/01/19}{Re-added since the \pkg{caption3} kernel does not define it anymore} |
| 345 |
% \begin{macro}{\setcaptionwidth} |
| 346 |
% \changes{v2.2h}{2021/01/19}{Re-added since the \pkg{caption3} kernel does not define it anymore} |
| 347 |
% User-friendly commands to set the caption margin or width. |
| 348 |
% Note that they additionally set the \cs{ifcaptionwidth} flag. |
| 349 |
% \begin{macrocode} |
| 350 |
\providecommand*\setcaptionmargin{% |
| 351 |
\setlength\captionwidth\z@ |
| 352 |
\setlength\captionmargin} |
| 353 |
\providecommand*\setcaptionwidth{% |
| 354 |
\setlength\captionmargin\z@ |
| 355 |
\setlength\captionwidth} |
| 356 |
% \end{macrocode} |
| 357 |
% \end{macro} |
| 358 |
% \end{macro} |
| 359 |
% |
| 360 |
% \begin{macro}{\normalcaptionparams} |
| 361 |
% \cs{normalcaptionparams} resets all caption related parameters to it's normal default values. |
| 362 |
% \cs{captionfont} will be set to \cs{captionsize} so setting the obsolete \cs{captionsize} will still work. |
| 363 |
% Same story with \cs{captiondelim} and the obsolete \cs{captionlabeldelim}. |
| 364 |
% \changes{v2.1}{2002/01/29}{New command \cs{normalcaptionparams}} |
| 365 |
% \begin{macrocode} |
| 366 |
\newcommand*\normalcaptionparams{% |
| 367 |
\let\captionsize\@empty |
| 368 |
\renewcommand*\captionfont{\captionsize}% |
| 369 |
\let\captionlabelfont\@empty |
| 370 |
\renewcommand*\captionlabeldelim{:}% |
| 371 |
\renewcommand*\captionlabelsep{\space}% |
| 372 |
\setcaptionmargin\z@ |
| 373 |
\setlength\captionindent\z@ |
| 374 |
\onelinecaptionstrue} |
| 375 |
% \end{macrocode} |
| 376 |
% \end{macro} |
| 377 |
% |
| 378 |
% \begin{macro}{\defcaptionstyle} |
| 379 |
% \begin{macro}{\newcaptionstyle} |
| 380 |
% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} |
| 381 |
% \begin{macro}{\renewcaptionstyle} |
| 382 |
% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} |
| 383 |
% These macros will define a new caption style. \cs{newcaptionstyle} and \cs{renewcaptionstyle} |
| 384 |
% will additionally check if the caption style already exists or not. |
| 385 |
% \begin{macrocode} |
| 386 |
\newcommand*\defcaptionstyle[1]{% |
| 387 |
\@namedef{caption@@#1}} |
| 388 |
% \end{macrocode} |
| 389 |
% \begin{macrocode} |
| 390 |
\newcommand*\newcaptionstyle[1]{% |
| 391 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 392 |
\expandafter\defcaptionstyle |
| 393 |
\else |
| 394 |
\captiontwo@Error{Caption style `#1' already defined}% |
| 395 |
\expandafter\@gobbletwo |
| 396 |
\fi |
| 397 |
{#1}} |
| 398 |
% \end{macrocode} |
| 399 |
% \begin{macrocode} |
| 400 |
\newcommand*\renewcaptionstyle[1]{% |
| 401 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 402 |
\captiontwo@Error{Caption style `#1' undefined}% |
| 403 |
\expandafter\@gobbletwo |
| 404 |
\else |
| 405 |
\expandafter\defcaptionstyle |
| 406 |
\fi |
| 407 |
{#1}} |
| 408 |
% \end{macrocode} |
| 409 |
% \end{macro} |
| 410 |
% \end{macro} |
| 411 |
% \end{macro} |
| 412 |
% |
| 413 |
% \begin{macro}{\dummycaptionstyle} |
| 414 |
% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} |
| 415 |
% This macro will also define a new caption style, but a one which is based on the |
| 416 |
% actual set caption style. Therefore you can't set a caption style made with this |
| 417 |
% command with \cs{captionstyle} -- we check this to avoid an endless recursion. |
| 418 |
% \begin{macrocode} |
| 419 |
\newcommand*\dummycaptionstyle[2]{% |
| 420 |
\defcaptionstyle{#1}{% |
| 421 |
\expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname% |
| 422 |
\csname caption@@#1\endcsname |
| 423 |
\captiontwo@Error |
| 424 |
[The caption style `#1' is only a dummy and does not really exists.% |
| 425 |
\MessageBreak You have to redefine it (with \protect\renewcaptionstyle) |
| 426 |
before you can select\MessageBreak it with \protect\captionstyle.\space]% |
| 427 |
{You can't use the caption style `#1' directy}% |
| 428 |
\else |
| 429 |
#2\usecaptionstyle\caption@style |
| 430 |
\fi}} |
| 431 |
% \end{macrocode} |
| 432 |
% \end{macro} |
| 433 |
% |
| 434 |
% \begin{macro}{\captionstyle} |
| 435 |
% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} |
| 436 |
% \cs{captionstyle} sets the actual caption style. It includes a check if the given caption |
| 437 |
% style is defined or not. |
| 438 |
% \begin{macrocode} |
| 439 |
\newcommand*\captionstyle[1]{% |
| 440 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 441 |
\captiontwo@Error{Undefined caption style `#1'}% |
| 442 |
\else |
| 443 |
\def\caption@style{#1}% |
| 444 |
\fi} |
| 445 |
% \end{macrocode} |
| 446 |
% \end{macro} |
| 447 |
% |
| 448 |
% \begin{macro}{style `normal'} |
| 449 |
% \begin{macro}{style `center'} |
| 450 |
% \begin{macro}{style `centerlast'} |
| 451 |
% \begin{macro}{style `flushleft'} |
| 452 |
% \begin{macro}{style `flushright'} |
| 453 |
% \begin{macro}{style `hang'} |
| 454 |
% \begin{macro}{style `indent'} |
| 455 |
% The predefined caption styles `normal', `center', `flushleft', `flushright', `centerlast', |
| 456 |
% `hang', `hang+X', and `indent'. Because they are quite similar they all are based on the macro |
| 457 |
% \cs{caption@make}. |
| 458 |
% \begin{macrocode} |
| 459 |
\newcaptionstyle{normal}{\caption@make{normal}} |
| 460 |
\newcaptionstyle{center}{\caption@make{center}} |
| 461 |
\newcaptionstyle{centerlast}{\caption@make{centerlast}} |
| 462 |
\newcaptionstyle{flushleft}{\caption@make{flushleft}} |
| 463 |
\newcaptionstyle{flushright}{\caption@make{flushright}} |
| 464 |
\newcaptionstyle{hang}{\caption@make{hang}} |
| 465 |
\newcaptionstyle{hang+center}{\caption@make{hang@center}} |
| 466 |
\newcaptionstyle{hang+centerlast}{\caption@make{hang@centerlast}} |
| 467 |
\newcaptionstyle{hang+flushleft}{\caption@make{hang@flushleft}} |
| 468 |
\newcaptionstyle{indent}{\caption@make{indent}} |
| 469 |
% \end{macrocode} |
| 470 |
% \end{macro} |
| 471 |
% \end{macro} |
| 472 |
% \end{macro} |
| 473 |
% \end{macro} |
| 474 |
% \end{macro} |
| 475 |
% \end{macro} |
| 476 |
% \end{macro} |
| 477 |
% |
| 478 |
% \begin{macro}{\caption@makecaption} |
| 479 |
% Our predefined caption styles. \cs{caption@makecaption} takes the style |
| 480 |
% name as parameter, it does the common stuff and calls a macro |
| 481 |
% (build out of the style name) to do the uncommon stuff if neccessary. |
| 482 |
% \changes{v2.1}{2002/02/26}{Renamed from \cs{caption@make} to \cs{caption@makecaption}} |
| 483 |
% \changes{v2.1b}{2004/04/16}{We offer and use \cs{caption@make}, again} |
| 484 |
% \changes{v2.1c}{2004/05/10}{Bugfix: Extra \cs{par} added} |
| 485 |
% \begin{macrocode} |
| 486 |
\newcommand*\caption@makecaption[1]{% |
| 487 |
\usecaptionmargin |
| 488 |
\ifcaptionlabel |
| 489 |
\def\caption@label{% |
| 490 |
{\captionlabelfont\captionlabel\captionlabeldelim}\captionlabelsep}% |
| 491 |
\else |
| 492 |
\let\caption@label\@empty |
| 493 |
\fi |
| 494 |
\captionfont |
| 495 |
\onelinecaption |
| 496 |
{\caption@label\captiontext}% |
| 497 |
{\parbox[b]\captionlinewidth{\strut\@nameuse{caption@@@#1}\par}\par}} |
| 498 |
% \end{macrocode} |
| 499 |
% \end{macro} |
| 500 |
% |
| 501 |
% \changes{v2.1}{2002/02/26}{Removed all extra parboxes from caption styles} |
| 502 |
% \changes{v2.1a}{2003/11/12}{\ldots and put the parbox into \cs{caption@makecaption} instead} |
| 503 |
% |
| 504 |
% \begin{macro}{\caption@@@normal} |
| 505 |
% The `normal' caption style. Just typeset caption (label \& text) as paragraph. |
| 506 |
% \begin{macrocode} |
| 507 |
\newcommand*\caption@@@normal{% |
| 508 |
\caption@label\captiontext} |
| 509 |
% \end{macrocode} |
| 510 |
% \end{macro} |
| 511 |
% |
| 512 |
% \begin{macro}{\caption@@@center} |
| 513 |
% The `center' caption style. Typeset the caption centered within a parbox. |
| 514 |
% \begin{macrocode} |
| 515 |
\newcommand*\caption@@@center{% |
| 516 |
\centering\caption@label\captiontext}% |
| 517 |
% \end{macrocode} |
| 518 |
% \end{macro} |
| 519 |
% |
| 520 |
% \begin{macro}{\caption@@@centerlast} |
| 521 |
% The `centerlast' caption style. |
| 522 |
% The idea how to do this was taken from Br\"uggemann-Klein\cite{Anne}, |
| 523 |
% it is also mentioned in Kopka\cite[p227]{Kopka-E}. |
| 524 |
% \begin{macrocode} |
| 525 |
% \end{macrocode} |
| 526 |
% \begin{macrocode} |
| 527 |
\newcommand*\caption@@@centerlast{% |
| 528 |
\centerlast\caption@label\captiontext} |
| 529 |
% \end{macrocode} |
| 530 |
% \end{macro} |
| 531 |
% |
| 532 |
% \begin{macro}{\caption@@@flushleft} |
| 533 |
% The `flushleft' caption style. Typeset the caption raggedright within a parbox. |
| 534 |
% \begin{macrocode} |
| 535 |
\newcommand*\caption@@@flushleft{% |
| 536 |
\raggedright\caption@label\captiontext}% |
| 537 |
% \end{macrocode} |
| 538 |
% \end{macro} |
| 539 |
% |
| 540 |
% \begin{macro}{\caption@@@flushright} |
| 541 |
% The `flushright' caption style. Typeset the caption raggedleft within a parbox. |
| 542 |
% \begin{macrocode} |
| 543 |
\newcommand*\caption@@@flushright{% |
| 544 |
\raggedleft\caption@label\captiontext}% |
| 545 |
% \end{macrocode} |
| 546 |
% \end{macro} |
| 547 |
% |
| 548 |
% \begin{macro}{\caption@@@hang} |
| 549 |
% \begin{macro}{\caption@hangplus} |
| 550 |
% The `hang' caption style. |
| 551 |
% This code was taken from \LaTeXcomp\cite[p155]{A-W:GMS94} and modified. |
| 552 |
% \begin{macrocode} |
| 553 |
\newcommand*\caption@@@hang{% |
| 554 |
\sbox\@tempboxa{\caption@label}% |
| 555 |
\hangindent\wd\@tempboxa\noindent |
| 556 |
\usebox\@tempboxa\caption@hangplus\captiontext} |
| 557 |
% \end{macrocode} |
| 558 |
% \begin{macrocode} |
| 559 |
\newcommand*\caption@hangplus{} |
| 560 |
% \end{macrocode} |
| 561 |
% \end{macro} |
| 562 |
% \end{macro} |
| 563 |
% |
| 564 |
% \begin{macro}{\caption@@@hang@center} |
| 565 |
% The `hang+flushleft' caption style. |
| 566 |
% \begin{macrocode} |
| 567 |
\newcommand*\caption@@@hang@center{% |
| 568 |
\let\caption@hangplus\centering\caption@@@hang} |
| 569 |
% \end{macrocode} |
| 570 |
% \end{macro} |
| 571 |
% |
| 572 |
% \begin{macro}{\caption@@@hang@centerlast} |
| 573 |
% The `hang+flushleft' caption style. |
| 574 |
% \begin{macrocode} |
| 575 |
\newcommand*\caption@@@hang@centerlast{% |
| 576 |
\let\caption@hangplus\centerlast\caption@@@hang} |
| 577 |
% \end{macrocode} |
| 578 |
% \end{macro} |
| 579 |
% |
| 580 |
% \begin{macro}{\caption@@@hang@flushleft} |
| 581 |
% The `hang+flushleft' caption style. |
| 582 |
% \begin{macrocode} |
| 583 |
\newcommand*\caption@@@hang@flushleft{% |
| 584 |
\let\caption@hangplus\raggedright\caption@@@hang} |
| 585 |
% \end{macrocode} |
| 586 |
% \end{macro} |
| 587 |
% |
| 588 |
% \begin{macro}{\caption@@@indent} |
| 589 |
% The `indent' caption style. Is is quite like the `hang' style but the |
| 590 |
% indention is given as \cs{captionindent}. |
| 591 |
% \begin{macrocode} |
| 592 |
\newcommand*\caption@@@indent{% |
| 593 |
\hangindent\captionindent\noindent |
| 594 |
\caption@label\captiontext} |
| 595 |
% \end{macrocode} |
| 596 |
% \end{macro} |
| 597 |
% |
| 598 |
% \subsection{Declaration of options} |
| 599 |
% |
| 600 |
% \begin{macro}{normal} |
| 601 |
% \begin{macro}{center} |
| 602 |
% \begin{macro}{centerlast,anne} |
| 603 |
% \begin{macro}{flushleft} |
| 604 |
% \begin{macro}{flushright} |
| 605 |
% \begin{macro}{hang,isu} |
| 606 |
% \begin{macro}{indent} |
| 607 |
% These options will set the caption style. |
| 608 |
% (`normal' is the default one.) |
| 609 |
% |
| 610 |
% The options `anne' and `isu' are for |
| 611 |
% backward compatibility only. |
| 612 |
% \begin{macrocode} |
| 613 |
\DeclareOption{normal}{\captionstyle{normal}} |
| 614 |
\DeclareOption{center}{\captionstyle{center}} |
| 615 |
\DeclareOption{centerlast}{\captionstyle{centerlast}} |
| 616 |
\DeclareOption{flushleft}{\captionstyle{flushleft}} |
| 617 |
\DeclareOption{flushright}{\captionstyle{flushright}} |
| 618 |
\DeclareOption{anne}{\ExecuteOptions{centerlast}} |
| 619 |
\DeclareOption{hang}{\captionstyle{hang}} |
| 620 |
\DeclareOption{hang+center}{\captionstyle{hang+center}} |
| 621 |
\DeclareOption{hang+centerlast}{\captionstyle{hang+centerlast}} |
| 622 |
\DeclareOption{hang+flushleft}{\captionstyle{hang+flushleft}} |
| 623 |
\DeclareOption{isu}{\ExecuteOptions{hang}} |
| 624 |
\DeclareOption{indent}{\captionstyle{indent}} |
| 625 |
% \end{macrocode} |
| 626 |
% \end{macro} |
| 627 |
% \end{macro} |
| 628 |
% \end{macro} |
| 629 |
% \end{macro} |
| 630 |
% \end{macro} |
| 631 |
% \end{macro} |
| 632 |
% \end{macro} |
| 633 |
% |
| 634 |
% \begin{macro}{scriptsize} |
| 635 |
% \begin{macro}{footnotesize} |
| 636 |
% \begin{macro}{small} |
| 637 |
% \begin{macro}{normalsize} |
| 638 |
% \begin{macro}{large,Large} |
| 639 |
% These options will set the caption size. We use \cs{g@addto@macro} so more that one |
| 640 |
% option can be set. |
| 641 |
% \begin{macrocode} |
| 642 |
\DeclareOption{scriptsize}{\g@addto@macro\captionsize\scriptsize} |
| 643 |
\DeclareOption{footnotesize}{\g@addto@macro\captionsize\footnotesize} |
| 644 |
\DeclareOption{small}{\g@addto@macro\captionsize\small} |
| 645 |
\DeclareOption{normalsize}{\g@addto@macro\captionsize\normalsize} |
| 646 |
\DeclareOption{large}{\g@addto@macro\captionsize\large} |
| 647 |
\DeclareOption{Large}{\g@addto@macro\captionsize\Large} |
| 648 |
% \end{macrocode} |
| 649 |
% \end{macro} |
| 650 |
% \end{macro} |
| 651 |
% \end{macro} |
| 652 |
% \end{macro} |
| 653 |
% \end{macro} |
| 654 |
% |
| 655 |
% \begin{macro}{up,it,sl,sc} |
| 656 |
% \begin{macro}{md,bf} |
| 657 |
% \begin{macro}{rm,sf,tt} |
| 658 |
% These options will set the caption label. |
| 659 |
% \begin{macrocode} |
| 660 |
\DeclareOption{up}{\g@addto@macro\captionlabelfont\upshape} |
| 661 |
\DeclareOption{it}{\g@addto@macro\captionlabelfont\itshape} |
| 662 |
\DeclareOption{sl}{\g@addto@macro\captionlabelfont\slshape} |
| 663 |
\DeclareOption{sc}{\g@addto@macro\captionlabelfont\scshape} |
| 664 |
\DeclareOption{md}{\g@addto@macro\captionlabelfont\mdseries} |
| 665 |
\DeclareOption{bf}{\g@addto@macro\captionlabelfont\bfseries} |
| 666 |
\DeclareOption{rm}{\g@addto@macro\captionlabelfont\rmfamily} |
| 667 |
\DeclareOption{sf}{\g@addto@macro\captionlabelfont\sffamily} |
| 668 |
\DeclareOption{tt}{\g@addto@macro\captionlabelfont\ttfamily} |
| 669 |
% \end{macrocode} |
| 670 |
% \end{macro} |
| 671 |
% \end{macro} |
| 672 |
% \end{macro} |
| 673 |
% |
| 674 |
% \begin{macro}{oneline} |
| 675 |
% \begin{macro}{nooneline} |
| 676 |
% These options will set the `oneline' flag. |
| 677 |
% (`oneline' is the default.) |
| 678 |
% \begin{macrocode} |
| 679 |
\DeclareOption{oneline}{\onelinecaptionstrue} |
| 680 |
\DeclareOption{nooneline}{\onelinecaptionsfalse} |
| 681 |
% \end{macrocode} |
| 682 |
% \end{macro} |
| 683 |
% \end{macro} |
| 684 |
% |
| 685 |
% \begin{macro}{\caption@setpackage} |
| 686 |
% A helper macro, a value of 1 within parameter \#2 will activate the support |
| 687 |
% of the package given in parameter \#1, a value of 0 will deactivate it. |
| 688 |
% \begin{macrocode} |
| 689 |
\newcommand*\caption@setpackage[1]{\@namedef{caption@pkt@#1}} |
| 690 |
\@onlypreamble\caption@setpackage |
| 691 |
% \end{macrocode} |
| 692 |
% \end{macro} |
| 693 |
% |
| 694 |
% \begin{macro}{float} |
| 695 |
% \begin{macro}{longtable} |
| 696 |
% \begin{macro}{subfigure} |
| 697 |
% \changes{v2.1}{2002/02/19}{New options for interaction with other packages} |
| 698 |
% These options will enable or suppress the support of the packages |
| 699 |
% \textsf{float}, \textsf{longtable}, and \textsf{subfigure}. |
| 700 |
% \begin{macrocode} |
| 701 |
\DeclareOption{float}{% |
| 702 |
\caption@twozerofalse\caption@setpackage{float}{1}} |
| 703 |
\DeclareOption{longtable}{% |
| 704 |
\caption@twozerofalse\caption@setpackage{longtable}{1}} |
| 705 |
\DeclareOption{subfigure}{% |
| 706 |
\caption@twozerofalse\caption@setpackage{subfigure}{1}} |
| 707 |
% \end{macrocode} |
| 708 |
% \end{macro} |
| 709 |
% \end{macro} |
| 710 |
% \end{macro} |
| 711 |
% |
| 712 |
% \begin{macro}{none} |
| 713 |
% \begin{macro}{all} |
| 714 |
% These options will enable or suppress the support of all the above packages. |
| 715 |
% \begin{macrocode} |
| 716 |
\DeclareOption{none}{% |
| 717 |
\caption@twozerofalse |
| 718 |
\caption@setpackage{float}{0}\caption@setpackage{longtable}{0}% |
| 719 |
\caption@setpackage{subfigure}{0}} |
| 720 |
\DeclareOption{all}{\ExecuteOptions{float,longtable,subfigure}} |
| 721 |
% \end{macrocode} |
| 722 |
% \end{macro} |
| 723 |
% \end{macro} |
| 724 |
% |
| 725 |
% \begin{macro}{ruled} |
| 726 |
% \begin{macro}{boxed} |
| 727 |
% The option `ruled' introduced in \textsf{caption} v1.2 is obsolete now, but |
| 728 |
% we will still support it. The option `boxed' was introduced in version 2.0 |
| 729 |
% and is obsolete now, too. |
| 730 |
% \begin{macrocode} |
| 731 |
\newif\ifcaption@ruled |
| 732 |
\DeclareOption{ruled}{\caption@ruledtrue} |
| 733 |
\DeclareOption{boxed}{} |
| 734 |
% \end{macrocode} |
| 735 |
% \end{macro} |
| 736 |
% \end{macro} |
| 737 |
% |
| 738 |
% \begin{macro}{ignoreLTcapwidth} |
| 739 |
% This option will make the caption code ignore the setting of \cs{LTcapwidth} |
| 740 |
% and use the setting of \cs{setcaptionmargin} or \cs{setcaptionwidth} instead. |
| 741 |
% \begin{macrocode} |
| 742 |
\DeclareOption{ignoreLTcapwidth}{\ignoreLTcapwidthtrue} |
| 743 |
% \end{macrocode} |
| 744 |
% \end{macro} |
| 745 |
% |
| 746 |
% \subsection{Execution of options} |
| 747 |
% |
| 748 |
% Now we set the default values and start processing the options. |
| 749 |
% (If \cs{caption@twozero} is set to true (default) we will emulate the package |
| 750 |
% load algorithm of \textsf{caption} v2.0: If the package is already loaded |
| 751 |
% patch it, otherwise do nothing.) |
| 752 |
% \changes{v2.1}{2002/02/19}{\cs{ProcessOptions} changed to \cs{ProcessOptions*}} |
| 753 |
% \begin{macrocode} |
| 754 |
\newif\ifcaption@twozero |
| 755 |
\normalcaptionparams |
| 756 |
\ExecuteOptions{none,normal} |
| 757 |
\caption@twozerotrue |
| 758 |
\ProcessOptions* |
| 759 |
\ifcaption@twozero |
| 760 |
\PackageInfo{caption2}{Running in caption2 v2.0 compatibility mode} |
| 761 |
\fi |
| 762 |
% \end{macrocode} |
| 763 |
% |
| 764 |
% \subsection{More declarations} |
| 765 |
% |
| 766 |
% \begin{macro}{\captionof} |
| 767 |
% \begin{macro}{\captionof*} |
| 768 |
% \cs{captionof} or \cs{captionof*} will just set \cs{@captype} and do the normal |
| 769 |
% \cs{caption} or \cs{caption*}, so we can also typeset captions outside floating |
| 770 |
% environments. |
| 771 |
% \changes{v2.1}{2002/02/19}{New commands \cs{captionof} and \cs{captionof*}} |
| 772 |
% \begin{macrocode} |
| 773 |
\def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}} |
| 774 |
\newcommand*\caption@of[2]{\def\@captype{#2}#1} |
| 775 |
% \end{macrocode} |
| 776 |
% \end{macro} |
| 777 |
% \end{macro} |
| 778 |
% |
| 779 |
% \begin{macro}{\abovecaptionskip} |
| 780 |
% \begin{macro}{\belowcaptionskip} |
| 781 |
% Not all document classes define \cs{abovecaptionskip} and \cs{belowcaptionskip} |
| 782 |
% (like \textsf{ucthesis}), so we do it here if not already done. |
| 783 |
% \changes{v2.1}{2002/02/19}{\cs{abovecaptionskip} and \cs{belowcaptionskip} will be defined if neccessary} |
| 784 |
% \begin{macrocode} |
| 785 |
\@ifundefined{abovecaptionskip}{% |
| 786 |
\newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{} |
| 787 |
\@ifundefined{belowcaptionskip}{% |
| 788 |
\newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{} |
| 789 |
% \end{macrocode} |
| 790 |
% \end{macro} |
| 791 |
% \end{macro} |
| 792 |
% |
| 793 |
% \begin{macro}{\captionlinewidth} |
| 794 |
% \changes{v2.1}{2002/02/26}{Renamed from \cs{realcaptionwidth} to \cs{captionlinewidth}} |
| 795 |
% \changes{v2.1a}{2003/11/12}{We offer \cs{realcaptionwidth}, again} |
| 796 |
% \begin{macro}{\captionlabel} |
| 797 |
% \begin{macro}{\captiontext} |
| 798 |
% These values are only set and used within the caption code itself. |
| 799 |
% \cs{captionlinewidth} will be set to the given vertical space for the caption, |
| 800 |
% normally this is \cs{linewidth}. (This value was called \cs{realcaptionwidth} |
| 801 |
% within \thispackage\ \version{2.0}, so we will offer this, too.) |
| 802 |
% |
| 803 |
% \cs{captionlabel} and \cs{captiontext} will be set to the caption label |
| 804 |
% or the caption text. |
| 805 |
% (Because \cs{captionlabel} and \cs{captiontext} will be locally defined with |
| 806 |
% \cs{def} we do not need to define them here.) |
| 807 |
% \begin{macrocode} |
| 808 |
\newdimen\captionlinewidth |
| 809 |
\newdimen\realcaptionwidth |
| 810 |
% \end{macrocode} |
| 811 |
% \end{macro} |
| 812 |
% \end{macro} |
| 813 |
% \end{macro} |
| 814 |
% |
| 815 |
% \begin{macro}{\usecaptionmargin} |
| 816 |
% A helper macro for caption style authors: |
| 817 |
% It calculates \cs{leftskip} and \cs{rightskip} out of |
| 818 |
% \cs{captionlinewidth} and \cs{captionmargin} or \cs{captionwidth}. |
| 819 |
% Also \cs{captionlinewidth} will be corrected to the appropriate value. |
| 820 |
% \begin{macrocode} |
| 821 |
\newcommand*\usecaptionmargin{% |
| 822 |
\ifcaptionwidth |
| 823 |
\leftskip\captionlinewidth |
| 824 |
\advance\leftskip by -\captionwidth |
| 825 |
\divide\leftskip by 2 |
| 826 |
\rightskip\leftskip |
| 827 |
\captionlinewidth\captionwidth |
| 828 |
\else |
| 829 |
\leftskip\captionmargin |
| 830 |
\rightskip\captionmargin |
| 831 |
\advance\captionlinewidth by -2\captionmargin |
| 832 |
\fi |
| 833 |
\realcaptionwidth\captionlinewidth} |
| 834 |
% \end{macrocode} |
| 835 |
% \end{macro} |
| 836 |
% |
| 837 |
% \begin{macro}{\onelinecaption} |
| 838 |
% This macro definition helps setting captions the \LaTeX\ base classes way: |
| 839 |
% If \cs{ifonelinecaptions} is set and the 1st argument fits within \cs{captionlinewidth}, |
| 840 |
% we typeset it centered -- otherway we typeset the 2nd argument. |
| 841 |
% (We use the savebox \cs{@tempboxa} as helper for this.) |
| 842 |
% \begin{macrocode} |
| 843 |
\newcommand\onelinecaption[1]{% |
| 844 |
\let\next\@firstofone |
| 845 |
\ifonelinecaptions |
| 846 |
\sbox\@tempboxa{#1}% |
| 847 |
\ifdim\wd\@tempboxa >\captionlinewidth |
| 848 |
\else |
| 849 |
\def\next{{\centering\usebox\@tempboxa\par}\@gobble}% |
| 850 |
\fi |
| 851 |
\fi\next} |
| 852 |
% \end{macrocode} |
| 853 |
% \end{macro} |
| 854 |
% |
| 855 |
% \begin{macro}{\usecaptionstyle} |
| 856 |
% \changes{v2.1b}{2004/04/16}{Missing percent added (and extra space removed)} |
| 857 |
% \changes{v2.2}{2007/04/06}{\cs{let}\cs{caption@make}\cs{caption@makecaption} added} |
| 858 |
% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} |
| 859 |
% First we check if we are inside a caption -- if \cs{captiontext} is undefined we are not. |
| 860 |
% If we are we call the appropriate caption definition. |
| 861 |
% \begin{macrocode} |
| 862 |
\newcommand*\usecaptionstyle[1]{% |
| 863 |
\@ifundefined{captiontext}{% |
| 864 |
\captiontwo@Error |
| 865 |
[The usage of \protect#1 is only |
| 866 |
allowed inside code declared with\MessageBreak \protect\defcaptionstyle, |
| 867 |
\protect\newcaptionstyle \space or \protect\renewcaptionstyle.\space]% |
| 868 |
{You can't use \protect#1 in normal text}% |
| 869 |
}{% |
| 870 |
\@ifundefined{caption@@#1}% |
| 871 |
{\captiontwo@Error{Caption style `#1' undefined}}% |
| 872 |
{\let\caption@make\caption@makecaption |
| 873 |
\@nameuse{caption@@#1}}% |
| 874 |
}} |
| 875 |
% \end{macrocode} |
| 876 |
% \end{macro} |
| 877 |
% |
| 878 |
% \begin{macro}{\@makecaption} |
| 879 |
% This is the heart of the \thispackage{} -- the redefinition of the |
| 880 |
% core caption code. It was taken from the \LaTeXe\ standard classes and modified. |
| 881 |
% It's very easy -- apart from using \cs{abovecaptionskip} and \cs{belowcaptionskip} |
| 882 |
% we just set \cs{captionlinewidth}, \cs{captionlabel} and \cs{captiontext} |
| 883 |
% to its appropriate values and using the code of the actual caption style via |
| 884 |
% \cs{usecaptionstyle}. |
| 885 |
% \begin{macrocode} |
| 886 |
\renewcommand\@makecaption[2]{% |
| 887 |
\vskip\abovecaptionskip |
| 888 |
\captionlinewidth\hsize |
| 889 |
\realcaptionwidth\hsize |
| 890 |
\def\captionlabel{#1}% |
| 891 |
\def\captiontext{#2}% |
| 892 |
\usecaptionstyle\caption@style |
| 893 |
\vskip\belowcaptionskip} |
| 894 |
% \end{macrocode} |
| 895 |
% \end{macro} |
| 896 |
% |
| 897 |
% \subsection{Support of other packages} |
| 898 |
% |
| 899 |
% \begin{macro}{\caption@ifpackage} |
| 900 |
% This macro will execute the code needed to support the package named within |
| 901 |
% argument \#1. |
| 902 |
% The parameter \#2 contains code which will be executed if the package is loaded. |
| 903 |
% The parameter \#3 contains code which will be executed if no support is |
| 904 |
% required -- this is for cleanup purposes. |
| 905 |
% \changes{v2.1c}{2004/05/09}{Compatibility warning removed} |
| 906 |
% \changes{v2.2i}{2021/01/20}{Interface and code revised (uses \cs{@ifpackageloaded} now)} |
| 907 |
% \begin{macrocode} |
| 908 |
\newcommand\caption@ifpackage[3]{% |
| 909 |
\ifcaption@twozero |
| 910 |
\let\next\@firstofone |
| 911 |
\else\if1\@nameuse{caption@pkt@#1}% |
| 912 |
\def\next{\@ifpackageloaded{#1}\@firstofone\AtBeginDocument}% |
| 913 |
\else |
| 914 |
\PackageInfo{caption2}{#1 package is disabled}% |
| 915 |
#3% |
| 916 |
\let\next\@gobble |
| 917 |
\fi\fi |
| 918 |
\@nameundef{caption@pkt@#1}% |
| 919 |
% \end{macrocode} |
| 920 |
% \begin{macrocode} |
| 921 |
\next{% |
| 922 |
\@ifpackageloaded{#1}{% |
| 923 |
\PackageInfo{caption2}{#1 package is loaded}% |
| 924 |
#2}{% |
| 925 |
\PackageInfo{caption2}{#1 package is not loaded}% |
| 926 |
#3}}} |
| 927 |
\@onlypreamble\caption@ifpackage |
| 928 |
% \end{macrocode} |
| 929 |
% \end{macro} |
| 930 |
% |
| 931 |
% \subsubsection{Support of the float package} |
| 932 |
% |
| 933 |
% \begin{macrocode} |
| 934 |
\caption@ifpackage{float}{% |
| 935 |
% \end{macrocode} |
| 936 |
% |
| 937 |
% \begin{macro}{\caption@floatc} |
| 938 |
% First we define a helper macro to typeset the caption via \cs{usecaptionstyle}, |
| 939 |
% the 1st parameter is the caption style name, |
| 940 |
% the 2nd and 3rd are the caption label and text. |
| 941 |
% |
| 942 |
% \textsf{caption2} has the goal not to modify the output just by |
| 943 |
% loading it (without options), therefore we have to be tricky here to |
| 944 |
% support \cs{@fs@cfont} which is in fact the same as our \cs{captionlabelfont}. |
| 945 |
% So we test if a \cs{captionlabelfont} has been set by the user -- if not |
| 946 |
% \cs{@fs@cfont} will be used, otherwise \cs{captionlabelfont}. |
| 947 |
% |
| 948 |
% \changes{v2.1b}{2004/03/19}{\cs{realcaptionwidth}$=$\cs{hsize} was missing here} |
| 949 |
% \begin{macrocode} |
| 950 |
\newcommand\caption@floatc[3]{% |
| 951 |
\ifx\captionlabelfont\@empty |
| 952 |
\let\captionlabelfont\@fs@cfont |
| 953 |
\fi |
| 954 |
\captionlinewidth\hsize |
| 955 |
\realcaptionwidth\hsize |
| 956 |
\def\captionlabel{#2}% |
| 957 |
\def\captiontext{#3}% |
| 958 |
\usecaptionstyle{#1}}% |
| 959 |
% \end{macrocode} |
| 960 |
% \end{macro} |
| 961 |
% |
| 962 |
% \begin{macro}{\floatc@plain} |
| 963 |
% Now we can redefine the caption code of the \textsf{float} package. |
| 964 |
% Here we redefine \cs{floatc@plain} to use our caption code, so |
| 965 |
% \texttt{plain} and \texttt{boxed} float types will use the actual |
| 966 |
% caption style set by the user. |
| 967 |
% \begin{macrocode} |
| 968 |
\renewcommand*\floatc@plain{\caption@floatc{\caption@style}}% |
| 969 |
% \end{macrocode} |
| 970 |
% \end{macro} |
| 971 |
% |
| 972 |
% \begin{macro}{\floatc@ruled} |
| 973 |
% The support of the \texttt{ruled} float type is a little |
| 974 |
% more complex. First we define a caption style `ruled' so the end-user |
| 975 |
% can change this caption style afterwards. If the (obsolete) option |
| 976 |
% `ruled' is set, we define it in a \textsf{caption} v1.x compatible way, |
| 977 |
% otherwise we define it in a \textsf{float} compatible way. |
| 978 |
% |
| 979 |
% Then we redefine \cs{floatc@ruled} so the caption style `ruled' will |
| 980 |
% be used. |
| 981 |
% \begin{macrocode} |
| 982 |
\ifcaption@ruled |
| 983 |
\dummycaptionstyle{ruled}{\onelinecaptionsfalse\setcaptionmargin{\z@}}% |
| 984 |
\else |
| 985 |
\newcaptionstyle{ruled}{% |
| 986 |
\ifcaptionlabel |
| 987 |
{\@fs@cfont\captionlabel}\space% |
| 988 |
\fi\captiontext\par}% |
| 989 |
\fi |
| 990 |
% \end{macrocode} |
| 991 |
% \begin{macrocode} |
| 992 |
\renewcommand*\floatc@ruled{\caption@floatc{ruled}}% |
| 993 |
% \end{macrocode} |
| 994 |
% \end{macro} |
| 995 |
% |
| 996 |
% \begin{macro}{\caption@of} |
| 997 |
% Typesetting captions outside floats is not so easy with redefined floats, |
| 998 |
% because |
| 999 |
% \begin{itemize} |
| 1000 |
% \item The caption code of the \textsf{float} package needs not only |
| 1001 |
% \cs{@captype} defined, but \cs{@fs@capt} (the command which will typeset the |
| 1002 |
% caption itself) either. |
| 1003 |
% \item The caption is only saved within a \cs{vbox}, so the \textsf{float} |
| 1004 |
% package can typeset the caption later at it's float style specific place |
| 1005 |
% (that means at top or at the bottom of the float). |
| 1006 |
% \end{itemize} |
| 1007 |
% |
| 1008 |
% Here is the new code: First we check if it's a restyled float by checking if |
| 1009 |
% \cs{fst@<floattype>} is defined. If yes, we use this command (it will define |
| 1010 |
% \cs{@fs@capt}). |
| 1011 |
% Then we execute \cs{@float@setevery}, if it exists (that means we are |
| 1012 |
% dealing with the \textsf{float} package 1.3 or newer here). |
| 1013 |
% Now comes the basic trick: |
| 1014 |
% We redefine the caption typesetting command \cs{@fs@capt}, so it will close |
| 1015 |
% the \cs{vbox}, typeset the caption outside the vbox and finally start the |
| 1016 |
% group again so the original \cs{@fs@capt} is happy with closing the group. |
| 1017 |
% |
| 1018 |
% \begin{macrocode} |
| 1019 |
\renewcommand*\caption@of[2]{% |
| 1020 |
\def\@captype{#2}% |
| 1021 |
\@ifundefined{fst@#2}{}{% |
| 1022 |
\@nameuse{fst@#2}% |
| 1023 |
\@ifundefined{@float@setevery}{}{\@float@setevery{#2}}% |
| 1024 |
\let\caption@fs@capt\@fs@capt |
| 1025 |
\let\@fs@capt\caption@of@float}% |
| 1026 |
#1}% |
| 1027 |
% \end{macrocode} |
| 1028 |
% |
| 1029 |
% \begin{macrocode} |
| 1030 |
\newcommand\caption@of@float[2]{\egroup |
| 1031 |
\vskip\abovecaptionskip |
| 1032 |
\normalsize\caption@fs@capt{#1}{#2}% |
| 1033 |
\vskip\belowcaptionskip |
| 1034 |
\bgroup}% |
| 1035 |
% \end{macrocode} |
| 1036 |
% \end{macro} |
| 1037 |
% |
| 1038 |
% \begin{macrocode} |
| 1039 |
}{} |
| 1040 |
% \end{macrocode} |
| 1041 |
% |
| 1042 |
% \subsubsection{Support of the longtable package} |
| 1043 |
% |
| 1044 |
% \begin{macrocode} |
| 1045 |
\caption@ifpackage{longtable}{% |
| 1046 |
% \end{macrocode} |
| 1047 |
% |
| 1048 |
% \begin{macro}{\LT@makecaption} |
| 1049 |
% David Carlisle was so kind to introduce a macro called |
| 1050 |
% \cs{LT@makecaption} in version 3.15 of the \textsf{longtable} |
| 1051 |
% package which typeset the caption and can be easily redefined. |
| 1052 |
% |
| 1053 |
% This is the original definition: |
| 1054 |
% \begin{quote} |
| 1055 |
% |\def\LT@makecaption#1#2#3{%|\\ |
| 1056 |
% | \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%|\\ |
| 1057 |
% | |$\langle$\textit{typeset} |#1{#2: }#3| \textit{as caption}$\rangle$\\ |
| 1058 |
% | \endgraf\vskip\baselineskip}%|\\ |
| 1059 |
% | \hss}}}| |
| 1060 |
% \end{quote} |
| 1061 |
% |
| 1062 |
% So we do here: |
| 1063 |
% First we define a new (dummy) caption style `longtable', |
| 1064 |
% than we redefine \cs{LT@makecaption} so this style will be used. |
| 1065 |
% (Remember: |#1| is |\@gobble| in star form of |\caption|, |
| 1066 |
% and |\@firstofone| otherwise.) |
| 1067 |
% \begin{macrocode} |
| 1068 |
\dummycaptionstyle{longtable}{}% |
| 1069 |
% \end{macrocode} |
| 1070 |
% \begin{macrocode} |
| 1071 |
\renewcommand\LT@makecaption[3]{% |
| 1072 |
\LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{% |
| 1073 |
\ifignoreLTcapwidth |
| 1074 |
\else |
| 1075 |
\setcaptionwidth\LTcapwidth |
| 1076 |
\fi |
| 1077 |
\captionlinewidth\hsize |
| 1078 |
\realcaptionwidth\hsize |
| 1079 |
\captionlabelfalse#1\captionlabeltrue |
| 1080 |
\def\captionlabel{#2}% |
| 1081 |
\def\captiontext{#3}% |
| 1082 |
\usecaptionstyle{longtable}% |
| 1083 |
\endgraf\vskip\baselineskip}% |
| 1084 |
\hss}}}% |
| 1085 |
% \end{macrocode} |
| 1086 |
% \end{macro} |
| 1087 |
% |
| 1088 |
% \begin{macrocode} |
| 1089 |
}{} |
| 1090 |
% \end{macrocode} |
| 1091 |
% |
| 1092 |
% \subsubsection{Support of the subfigure package} |
| 1093 |
% |
| 1094 |
% Some of the following code will not work within \cs{if}, |
| 1095 |
% because of the (yet) undefined \cs{if}\textit{xxx}s. So we simply define |
| 1096 |
% the critical code within the helper commands \cs{setsubcapstyle} |
| 1097 |
% and \cs{caption@makesubcaption} already here. |
| 1098 |
% |
| 1099 |
% \begin{macro}{\setsubcapstyle} |
| 1100 |
% This sets the subcaptionstyle to a appropriate value. |
| 1101 |
% \begin{macrocode} |
| 1102 |
\newcommand*\setsubcapstyle{% |
| 1103 |
\ifsubcaphang |
| 1104 |
\ifsubcapcenter |
| 1105 |
\subcapstyle{hang+center}% |
| 1106 |
\else\ifsubcapcenterlast |
| 1107 |
\subcapstyle{hang+centerlast}% |
| 1108 |
\else\ifsubcapraggedright |
| 1109 |
\subcapstyle{hang+flushleft}% |
| 1110 |
\else |
| 1111 |
\subcapstyle{hang}% |
| 1112 |
\fi\fi\fi |
| 1113 |
\else\ifsubcapcenter |
| 1114 |
\subcapstyle{center}% |
| 1115 |
\else\ifsubcapcenterlast |
| 1116 |
\subcapstyle{centerlast}% |
| 1117 |
\else\ifsubcapraggedright |
| 1118 |
\subcapstyle{flushleft}% |
| 1119 |
\else |
| 1120 |
\subcapstyle{normal}% |
| 1121 |
\fi\fi\fi\fi} |
| 1122 |
% \end{macrocode} |
| 1123 |
% If \cs{ifsubcapraggedright} is undefined (it was introduced |
| 1124 |
% in \version{2.1} of the \textsf{subfigure} package) we define it first. |
| 1125 |
% \begin{macrocode} |
| 1126 |
\AtBeginDocument{% |
| 1127 |
\@ifundefined{subcapraggedrightfalse}{% |
| 1128 |
\newif\ifsubcapraggedright}{}} |
| 1129 |
% \end{macrocode} |
| 1130 |
% \end{macro} |
| 1131 |
% |
| 1132 |
% \begin{macro}{\caption@makesubcaption} |
| 1133 |
% \changes{v2.2c}{2008/07/01}{Bugfix: Usage of \cs{ifcaptionwidth} removed} |
| 1134 |
% This will typeset the subcaption. |
| 1135 |
% We just set all our \cs{caption}\textit{xxx} values to |
| 1136 |
% the values of \cs{subcap}\textit{xxx} and typeset the |
| 1137 |
% caption like \textsf{subfigure} within a \cs{hbox}, |
| 1138 |
% but with the help of \cs{usecaptionstyle}. |
| 1139 |
% |
| 1140 |
% But this is not as easy as it seems. We typeset the caption like this: |
| 1141 |
% \begin{quote} |
| 1142 |
% |\captionfont|\\ |
| 1143 |
% | {\capionlabelfont\captionlabel\captionlabeldelim}%|\\ |
| 1144 |
% |\captionlabelsep\captiontext| |
| 1145 |
% \end{quote} |
| 1146 |
% Within \textsf{subfigure} 2.0 the caption will be set quite similar to: |
| 1147 |
% \begin{quote} |
| 1148 |
% |\subcapsize|\\ |
| 1149 |
% | {\subcaplabelfont\captionlabel}%|\\ |
| 1150 |
% |\space\captiontext| |
| 1151 |
% \end{quote} |
| 1152 |
% But within \textsf{subfigure} 2.1 this has changed to: |
| 1153 |
% \begin{quote} |
| 1154 |
% |\subcapsize|\\ |
| 1155 |
% | {\subcaplabelfont\captionlabel}%|\\ |
| 1156 |
% |\hskip\subfiglabelskip|\\ |
| 1157 |
% | {\subcapfont\captiontext}}| |
| 1158 |
% \end{quote} |
| 1159 |
% So we have to be tricky here: We set \cs{captionlabelfont} to \cs{normalfont} plus |
| 1160 |
% \cs{subcapsize} \& \cs{subcaplabelfont}, so the font setting in \cs{captionfont} |
| 1161 |
% will not affect the caption label in subfigure captions. |
| 1162 |
% |
| 1163 |
% Note that \cs{hfil} has changed to \cs{hss} from subfigure 2.0 to 2.1, |
| 1164 |
% so we use \cs{caption@subfig@hss} instead. (We will define this later on.) |
| 1165 |
% \begin{macrocode} |
| 1166 |
\newcommand\caption@makesubcaption[2]{% |
| 1167 |
\renewcommand*\captionfont{\subcapsize\subcapfont}% |
| 1168 |
\renewcommand*\captionlabelfont{\normalfont\subcapsize\subcaplabelfont}% |
| 1169 |
\let\captionlabeldelim\subcaplabeldelim |
| 1170 |
\let\captionlabelsep\subcaplabelsep |
| 1171 |
\ifsubfigcapwidth |
| 1172 |
\setcaptionwidth\subfigcapwidth |
| 1173 |
\else |
| 1174 |
\setcaptionmargin\subfigcapmargin |
| 1175 |
\fi |
| 1176 |
\setlength\captionmargin\subfigcapmargin |
| 1177 |
\setlength\captionwidth\subfigcapwidth |
| 1178 |
\captionindent\subcapindent |
| 1179 |
\ifsubcapnooneline |
| 1180 |
\onelinecaptionsfalse |
| 1181 |
\else |
| 1182 |
\onelinecaptionstrue |
| 1183 |
\fi |
| 1184 |
\hbox to\@tempdima{% |
| 1185 |
\caption@subfig@hss\parbox[t]\@tempdima{% |
| 1186 |
\captionlinewidth\@tempdima |
| 1187 |
\realcaptionwidth\@tempdima |
| 1188 |
\captionlabeltrue |
| 1189 |
\def\captionlabel{#1}% |
| 1190 |
\def\captiontext{\ignorespaces #2}% |
| 1191 |
\usecaptionstyle\caption@substyle}% |
| 1192 |
\caption@subfig@hss}} |
| 1193 |
% \end{macrocode} |
| 1194 |
% \end{macro} |
| 1195 |
% |
| 1196 |
% If the subfigure support is not needed, we throw |
| 1197 |
% the helper macros in the garbage can. |
| 1198 |
% |
| 1199 |
% \begin{macrocode} |
| 1200 |
\caption@ifpackage{subfigure}{% |
| 1201 |
% \end{macrocode} |
| 1202 |
% |
| 1203 |
% Some stuff has changed from version 2.0 to 2.1 of the |
| 1204 |
% \textsf{subfigure} package, so we make a branch here. |
| 1205 |
% If \cs{subcapfont} is undefined we assume v2.0, |
| 1206 |
% otherwise we assume v2.1 or newer. |
| 1207 |
% |
| 1208 |
% \begin{macrocode} |
| 1209 |
\ifx\subcapfont\@undefined |
| 1210 |
\PackageInfo{caption2}{subfigure package v2.0 detected}% |
| 1211 |
% \end{macrocode} |
| 1212 |
% |
| 1213 |
% \begin{macro}{\subcapfont} |
| 1214 |
% We define \cs{subcapfont} here so we can use it later |
| 1215 |
% in common code for \textsf{subfigure} v2.0 and v2.1 (or newer). |
| 1216 |
% \begin{macrocode} |
| 1217 |
\let\subcapfont\@empty |
| 1218 |
% \end{macrocode} |
| 1219 |
% \end{macro} |
| 1220 |
% |
| 1221 |
% \begin{macro}{\subfigcapwidth} |
| 1222 |
% \begin{macro}{\setsubcapmargin} |
| 1223 |
% \begin{macro}{\setsubcapwidth} |
| 1224 |
% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and |
| 1225 |
% \cs{setcaptionwidth} we define \cs{subfigcapwidth}, |
| 1226 |
% \cs{setsubcapmargin}, and \cs{setsubcapwidth}. |
| 1227 |
% |
| 1228 |
% Note: \cs{subfigcapmargin} is a command in v2.0 of \textsf{subfigure}. |
| 1229 |
% So we make \cs{subfigcapwidth} a command, too. |
| 1230 |
% \begin{macrocode} |
| 1231 |
\newcommand*\subfigcapwidth{\z@}% |
| 1232 |
\newcommand*\setsubcapmargin{% |
| 1233 |
\subfigcapwidthfalse |
| 1234 |
\renewcommand*\subfigcapmargin}% |
| 1235 |
\newcommand*\setsubcapwidth{% |
| 1236 |
\subfigcapwidthtrue |
| 1237 |
\renewcommand*\subfigcapwidth}% |
| 1238 |
% \end{macrocode} |
| 1239 |
% \end{macro} |
| 1240 |
% \end{macro} |
| 1241 |
% \end{macro} |
| 1242 |
% |
| 1243 |
% \begin{macro}{\subcaplabelsep} |
| 1244 |
% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}. |
| 1245 |
% \begin{macrocode} |
| 1246 |
\newcommand*\subcaplabelsep{\space}% |
| 1247 |
% \end{macrocode} |
| 1248 |
% \end{macro} |
| 1249 |
% |
| 1250 |
% \begin{macro}{\caption@subfig@hss} |
| 1251 |
% This will be uses within the caption code itself. |
| 1252 |
% \begin{macrocode} |
| 1253 |
\let\caption@subfig@hss\hfil |
| 1254 |
% \end{macrocode} |
| 1255 |
% \end{macro} |
| 1256 |
% |
| 1257 |
% \begin{macrocode} |
| 1258 |
\else |
| 1259 |
\PackageInfo{caption2}{subfigure package v2.1 (or newer) detected}% |
| 1260 |
% \end{macrocode} |
| 1261 |
% |
| 1262 |
% \begin{macro}{\subfigcapwidth} |
| 1263 |
% \begin{macro}{\setsubcapmargin} |
| 1264 |
% \begin{macro}{\setsubcapwidth} |
| 1265 |
% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and |
| 1266 |
% \cs{setcaptionwidth} we define \cs{subfigcapwidth}, |
| 1267 |
% \cs{setsubcapmargin}, and \cs{setsubcapwidth}. |
| 1268 |
% |
| 1269 |
% Note: \cs{subfigcapmargin} is a length in v2.1 of \textsf{subfigure}. |
| 1270 |
% So we make \cs{subfigcapwidth} a length, too. |
| 1271 |
% \begin{macrocode} |
| 1272 |
\newdimen\subfigcapwidth |
| 1273 |
\newcommand*\setsubcapmargin{% |
| 1274 |
\subfigcapwidthfalse |
| 1275 |
\setlength\subfigcapmargin}% |
| 1276 |
\newcommand*\setsubcapwidth{% |
| 1277 |
\subfigcapwidthtrue |
| 1278 |
\setlength\subfigcapwidth}% |
| 1279 |
% \end{macrocode} |
| 1280 |
% \end{macro} |
| 1281 |
% \end{macro} |
| 1282 |
% \end{macro} |
| 1283 |
% |
| 1284 |
% \begin{macro}{\subcaplabelsep} |
| 1285 |
% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}. |
| 1286 |
% \begin{macrocode} |
| 1287 |
\newcommand*\subcaplabelsep{\hskip\subfiglabelskip}% |
| 1288 |
% \end{macrocode} |
| 1289 |
% \end{macro} |
| 1290 |
% |
| 1291 |
% \begin{macro}{\caption@subfig@hss} |
| 1292 |
% This will be uses within the caption code itself. |
| 1293 |
% \begin{macrocode} |
| 1294 |
\let\caption@subfig@hss\hss |
| 1295 |
% \end{macrocode} |
| 1296 |
% |
| 1297 |
% \end{macro} |
| 1298 |
% \begin{macrocode} |
| 1299 |
\fi |
| 1300 |
% \end{macrocode} |
| 1301 |
% |
| 1302 |
% Here starts the common code for \textsf{subfigure} v2.0 and v2.1. |
| 1303 |
% |
| 1304 |
% \begin{macro}{\ifsubfigcapwidth} |
| 1305 |
% \begin{macro}{\subcapindent} |
| 1306 |
% \begin{macro}{\subcaplabeldelim} |
| 1307 |
% Analogous to \cs{ifcaptionwidth}, \cs{captionindent} \& \cs{captionlabeldelim} |
| 1308 |
% we define \cs{ifsubfigcapwidth}, \cs{subcapindent} \& \cs{subcaplabeldelim} |
| 1309 |
% \begin{macrocode} |
| 1310 |
\newif\ifsubfigcapwidth |
| 1311 |
\newdimen\subcapindent |
| 1312 |
\newcommand*\subcaplabeldelim{}% |
| 1313 |
% \end{macrocode} |
| 1314 |
% \end{macro} |
| 1315 |
% \end{macro} |
| 1316 |
% \end{macro} |
| 1317 |
% |
| 1318 |
% \begin{macro}{\subcapstyle} |
| 1319 |
% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now} |
| 1320 |
% Analogous to \cs{captionstyle} we define \cs{subcapstyle} |
| 1321 |
% and set it (via \cs{setsubcapstyle}) to a appropriate value. |
| 1322 |
% \begin{macrocode} |
| 1323 |
\newcommand*\subcapstyle[1]{% |
| 1324 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 1325 |
\captiontwo@Error{Undefined caption style `#1'}% |
| 1326 |
\else |
| 1327 |
\def\caption@substyle{#1}% |
| 1328 |
\fi}% |
| 1329 |
\setsubcapstyle |
| 1330 |
% \end{macrocode} |
| 1331 |
% \end{macro} |
| 1332 |
% |
| 1333 |
% \begin{macro}{\@thesubfigure} |
| 1334 |
% \begin{macro}{\@thesubtable} |
| 1335 |
% The \textsf{subfigure} package makes use of \cs{subcaplabelfont} and |
| 1336 |
% \cs{subfiglabelskip} within its \cs{@thesub}\textit{xxx} macros. |
| 1337 |
% This is totally in contrast to the way the \textsf{caption2} package |
| 1338 |
% handle these settings. So we redefine the \cs{@thesub}\textit{xxx} |
| 1339 |
% to be just the plain label and nothing else. |
| 1340 |
% |
| 1341 |
% \begin{macrocode} |
| 1342 |
\renewcommand*\@thesubfigure{\thesubfigure}% |
| 1343 |
\renewcommand*\@thesubtable{\thesubtable}% |
| 1344 |
% \end{macrocode} |
| 1345 |
% \end{macro} |
| 1346 |
% \end{macro} |
| 1347 |
% |
| 1348 |
% \begin{macro}{\@makesubfigurecaption} |
| 1349 |
% \begin{macro}{\@makesubtablecaption} |
| 1350 |
% Now we are ready to redefine \cs{@makesubfigurecaption}. |
| 1351 |
% \begin{macrocode} |
| 1352 |
\let\@makesubfigurecaption\caption@makesubcaption |
| 1353 |
\let\@makesubtablecaption\caption@makesubcaption |
| 1354 |
% \end{macrocode} |
| 1355 |
% \end{macro} |
| 1356 |
% \end{macro} |
| 1357 |
% |
| 1358 |
% \begin{macrocode} |
| 1359 |
}{% |
| 1360 |
\let\setsubcapstyle\@undefined |
| 1361 |
\let\caption@makesubcaption\@undefined |
| 1362 |
} |
| 1363 |
% \end{macrocode} |
| 1364 |
% |
| 1365 |
% \iffalse |
| 1366 |
%</package> |
| 1367 |
% \fi |
| 1368 |
% |
| 1369 |
% \clearpage |
| 1370 |
% \begin{thebibliography}{9} |
| 1371 |
% \bibitem{float} |
| 1372 |
% Anselm Lingnau: |
| 1373 |
% \href{http://www.ctan.org/pkg/float}% |
| 1374 |
% {\emph{An Improved Environment for Floats}}, |
| 1375 |
% 2001/11/08 |
| 1376 |
% |
| 1377 |
% \bibitem{longtable} |
| 1378 |
% David Carlisle: |
| 1379 |
% \href{http://www.ctan.org/pkg/longtable}% |
| 1380 |
% {\emph{The longtable package}}, |
| 1381 |
% 2000/10/22 |
| 1382 |
% |
| 1383 |
% \bibitem{rotating} |
| 1384 |
% Sebastian Rahtz and Leonor Barroca: |
| 1385 |
% \href{http://www.ctan.org/pkg/rotating}% |
| 1386 |
% {\emph{A style option for rotated objects in \LaTeX}},\\ |
| 1387 |
% 1997/09/26 |
| 1388 |
% |
| 1389 |
% \bibitem{subfigure} |
| 1390 |
% Steven D. Cochran: |
| 1391 |
% \href{http://www.ctan.org/pkg/subfigure}% |
| 1392 |
% {\emph{The subfigure package}}, |
| 1393 |
% 2002/02/14 |
| 1394 |
% |
| 1395 |
% \bibitem{A-W:GMS94} |
| 1396 |
% Michel Goossens, Frank Mittelbach and Alexander Samarin: |
| 1397 |
% \newblock \textsl{The {\LaTeX} Companion}, |
| 1398 |
% \newblock Addison-Wesley, Reading, Massachusetts, 1994. |
| 1399 |
% |
| 1400 |
% \bibitem{Anne} |
| 1401 |
% Anne Br\"uggemann-Klein: |
| 1402 |
% \textsl{Einf\"uhrung in die Dokumentverarbeitung}, |
| 1403 |
% B.G. Teubner, Stuttgart, 1989 |
| 1404 |
% |
| 1405 |
% \bibitem{Kopka-E} |
| 1406 |
% Helmut Kopka: |
| 1407 |
% \textsl{\LaTeX -- Erweiterungsm\"oglichkeiten}, |
| 1408 |
% 3. \"uberarbeitete Auf\/lage, Addison-Wesley, Bonn, 1991 |
| 1409 |
% \end{thebibliography} |
| 1410 |
% |
| 1411 |
% \Finale |
| 1412 |
% |
| 1413 |
\endinput |