| 1 |
%% |
| 2 |
%% This is file `caption2_1995-10-09.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% fallback/v2.0/caption2.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% Copyright (C) 1994-2022 Axel Sommerfeldt ([email protected]) |
| 10 |
%% |
| 11 |
%% https://gitlab.com/axelsommerfeldt/caption |
| 12 |
%% |
| 13 |
%% -------------------------------------------------------------------------- |
| 14 |
%% |
| 15 |
%% This work may be distributed and/or modified under the |
| 16 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 17 |
%% of this license or (at your option) any later version. |
| 18 |
%% The latest version of this license is in |
| 19 |
%% http://www.latex-project.org/lppl.txt |
| 20 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 21 |
%% version 2003/12/01 or later. |
| 22 |
%% |
| 23 |
%% This work has the LPPL maintenance status "maintained". |
| 24 |
%% |
| 25 |
%% This Current Maintainer of this work is Axel Sommerfeldt. |
| 26 |
%% |
| 27 |
%% This work consists of the files |
| 28 |
%% caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx, |
| 29 |
%% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx, |
| 30 |
%% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx, |
| 31 |
%% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, |
| 32 |
%% the derived files |
| 33 |
%% caption.sty, caption-light.sty, caption2.sty, caption3.sty, |
| 34 |
%% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto, |
| 35 |
%% caption-koma.sto, caption-memoir.sto, caption-ntg.sto, |
| 36 |
%% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty. |
| 37 |
%% |
| 38 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 39 |
\ProvidesPackage{caption2}[1995/10/09 v2.0 caption package (AS)] |
| 40 |
\let\caption@message\undefined |
| 41 |
\newcommand*\caption@package[1]{% |
| 42 |
\ifx\caption@message\undefined |
| 43 |
\message{\space\space\space\space\space\space\space\space\space |
| 44 |
packages detected:} |
| 45 |
\let\caption@message\empty |
| 46 |
\fi |
| 47 |
\message{#1}} |
| 48 |
\newlength\realcaptionwidth |
| 49 |
\newsavebox\captionbox |
| 50 |
\newcommand*\captionsize{} |
| 51 |
\newcommand*\captionfont{\captionsize} |
| 52 |
\newcommand*\captionlabelfont{} |
| 53 |
\newcommand*\captionlabeldelim{:} |
| 54 |
\newdimen\captionlabelsep |
| 55 |
\sbox\captionbox{ } |
| 56 |
\setlength\captionlabelsep{\wd\captionbox} |
| 57 |
\newdimen\captionmargin |
| 58 |
\newdimen\captionwidth |
| 59 |
\newdimen\captionindent |
| 60 |
\newif\ifonelinecaptions |
| 61 |
\newif\iftakecaptionwidth |
| 62 |
\newcommand*\setcaptionmargin[1]{% |
| 63 |
\setlength\captionmargin{#1}% |
| 64 |
\takecaptionwidthfalse} |
| 65 |
\newcommand*\setcaptionwidth[1]{% |
| 66 |
\setlength\captionwidth{#1}% |
| 67 |
\takecaptionwidthtrue} |
| 68 |
\newcommand\newcaptionstyle[2]{% |
| 69 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 70 |
\defcaptionstyle{#1}{#2}% |
| 71 |
\else |
| 72 |
\PackageError{caption}{Caption style `#1' already defined}{}% |
| 73 |
\fi} |
| 74 |
\newcommand\renewcaptionstyle[2]{% |
| 75 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 76 |
\PackageError{caption}{Caption style `#1' undefined}{}% |
| 77 |
\else |
| 78 |
\defcaptionstyle{#1}{#2}% |
| 79 |
\fi} |
| 80 |
\newcommand\defcaptionstyle[2]{% |
| 81 |
\@namedef{caption@@#1}{#2}} |
| 82 |
\newcommand*\dummycaptionstyle[2]{% |
| 83 |
\defcaptionstyle{#1}{% |
| 84 |
\expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname% |
| 85 |
\csname caption@@#1\endcsname |
| 86 |
\PackageError{caption}{You can't use the caption style `#1' directy}{% |
| 87 |
The caption style `#1' is only a dummy and does not really exists.% |
| 88 |
\MessageBreak You have to redefine it (with \protect\renewcaptionstyle) |
| 89 |
before you can select\MessageBreak it with \protect\captionstyle.}% |
| 90 |
\else |
| 91 |
#2\usecaptionstyle{\caption@style}% |
| 92 |
\fi}} |
| 93 |
\newcaptionstyle{normal}{\caption@make{normal}} |
| 94 |
\newcaptionstyle{center}{\caption@make{center}} |
| 95 |
\newcaptionstyle{flushleft}{\caption@make{flushleft}} |
| 96 |
\newcaptionstyle{flushright}{\caption@make{flushright}} |
| 97 |
\newcaptionstyle{centerlast}{\caption@make{centerlast}} |
| 98 |
\newcaptionstyle{hang}{\caption@make{hang}} |
| 99 |
\newcaptionstyle{indent}{\caption@make{indent}} |
| 100 |
\newcommand*\captionstyle[1]{% |
| 101 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 102 |
\PackageError{caption}{Undefined caption style `#1'}{}% |
| 103 |
\else |
| 104 |
\def\caption@style{#1}% |
| 105 |
\fi} |
| 106 |
\DeclareOption{normal}{\captionstyle{normal}} |
| 107 |
\DeclareOption{center}{\captionstyle{center}} |
| 108 |
\DeclareOption{flushleft}{\captionstyle{flushleft}} |
| 109 |
\DeclareOption{flushright}{\captionstyle{flushright}} |
| 110 |
\DeclareOption{centerlast}{\captionstyle{centerlast}} |
| 111 |
\DeclareOption{anne}{\ExecuteOptions{centerlast}} |
| 112 |
\DeclareOption{hang}{\captionstyle{hang}} |
| 113 |
\DeclareOption{isu}{\ExecuteOptions{hang}} |
| 114 |
\DeclareOption{indent}{\captionstyle{indent}} |
| 115 |
\DeclareOption{oneline}{\onelinecaptionstrue} |
| 116 |
\DeclareOption{nooneline}{\onelinecaptionsfalse} |
| 117 |
\DeclareOption{scriptsize}{\renewcommand*\captionsize{\scriptsize}} |
| 118 |
\DeclareOption{footnotesize}{\renewcommand*\captionsize{\footnotesize}} |
| 119 |
\DeclareOption{small}{\renewcommand*\captionsize{\small}} |
| 120 |
\DeclareOption{normalsize}{\renewcommand*\captionsize{\normalsize}} |
| 121 |
\DeclareOption{large}{\renewcommand*\captionsize{\large}} |
| 122 |
\DeclareOption{Large}{\renewcommand*\captionsize{\Large}} |
| 123 |
\DeclareOption{up}{\renewcommand*\captionlabelfont{\upshape}} |
| 124 |
\DeclareOption{it}{\renewcommand*\captionlabelfont{\itshape}} |
| 125 |
\DeclareOption{sl}{\renewcommand*\captionlabelfont{\slshape}} |
| 126 |
\DeclareOption{sc}{\renewcommand*\captionlabelfont{\scshape}} |
| 127 |
\DeclareOption{md}{\renewcommand*\captionlabelfont{\mdseries}} |
| 128 |
\DeclareOption{bf}{\renewcommand*\captionlabelfont{\bfseries}} |
| 129 |
\DeclareOption{rm}{\renewcommand*\captionlabelfont{\rmfamily}} |
| 130 |
\DeclareOption{sf}{\renewcommand*\captionlabelfont{\sffamily}} |
| 131 |
\DeclareOption{tt}{\renewcommand*\captionlabelfont{\ttfamily}} |
| 132 |
\DeclareOption{boxed}{\AtEndOfPackage{% |
| 133 |
\ifx\caption@@ruled\undefined |
| 134 |
\PackageWarningNoLine{caption}{% |
| 135 |
Option `boxed' is set but there is no `float' package\MessageBreak |
| 136 |
around here, so this option will be totally ignored} |
| 137 |
\else |
| 138 |
\dummycaptionstyle{boxed}{}% |
| 139 |
\fi}} |
| 140 |
\DeclareOption{ruled}{\AtEndOfPackage{% |
| 141 |
\ifx\caption@@ruled\undefined |
| 142 |
\PackageWarningNoLine{caption}{% |
| 143 |
Option `ruled' is set but there is no `float' package\MessageBreak |
| 144 |
around here, so this option will be totally ignored} |
| 145 |
\else |
| 146 |
\dummycaptionstyle{ruled}{\onelinecaptionsfalse\setcaptionmargin{0pt}}% |
| 147 |
\fi}} |
| 148 |
\DeclareOption{longtable}{\AtEndOfPackage{% |
| 149 |
\ifx\caption@@longtable\undefined |
| 150 |
\PackageWarningNoLine{caption}{% |
| 151 |
Option `longtable' is set but there is no `longtable' package\MessageBreak |
| 152 |
around here, so this option will be totally ignored} |
| 153 |
\else |
| 154 |
\dummycaptionstyle{longtable}{}% |
| 155 |
\fi}} |
| 156 |
\DeclareOption*{\AtEndOfPackage{% |
| 157 |
\InputIfFileExists{\CurrentOption.caption}{}{% |
| 158 |
\PackageError{caption}{File `\CurrentOption.caption' not found}{% |
| 159 |
You selected the unknown package option `\CurrentOption', so I |
| 160 |
thought you want to\MessageBreak |
| 161 |
input the definition file `\CurrentOption.caption' here |
| 162 |
-- but there is no one!}}}} |
| 163 |
\ExecuteOptions{normal,oneline} |
| 164 |
\ProcessOptions |
| 165 |
\renewcommand\@makecaption[2]{% |
| 166 |
\vskip\abovecaptionskip |
| 167 |
\realcaptionwidth\linewidth |
| 168 |
\def\captionlabel{#1}% |
| 169 |
\def\captiontext{#2}% |
| 170 |
\usecaptionstyle{\caption@style}% |
| 171 |
\vskip\belowcaptionskip} |
| 172 |
\newcommand*\caption@canterr[1]{% |
| 173 |
\PackageError{caption}{You can't use \protect#1 |
| 174 |
in normal text}{The usage of \protect#1 is only |
| 175 |
allowed inside code declared with\MessageBreak \protect\defcaptionstyle, |
| 176 |
\protect\newcaptionstyle \space or \protect\renewcaptionstyle.}} |
| 177 |
\newcommand\onelinecaption[2]{% |
| 178 |
\ifx\captiontext\undefined |
| 179 |
\caption@canterr{\onelinecaption}% |
| 180 |
\else |
| 181 |
\def\caption@temp{#2}% |
| 182 |
\ifonelinecaptions |
| 183 |
\sbox\captionbox{#1}% |
| 184 |
\ifdim\wd\captionbox >\realcaptionwidth |
| 185 |
\caption@temp |
| 186 |
\else |
| 187 |
{\centering\usebox{\captionbox}\par}% |
| 188 |
\fi |
| 189 |
\else |
| 190 |
\caption@temp |
| 191 |
\fi |
| 192 |
\let\caption@temp\undefined |
| 193 |
\fi} |
| 194 |
\newcommand*\usecaptionmargin{% |
| 195 |
\ifx\captiontext\undefined |
| 196 |
\caption@canterr{\usecaptionmargin}% |
| 197 |
\else |
| 198 |
\iftakecaptionwidth |
| 199 |
\leftskip\realcaptionwidth |
| 200 |
\advance\leftskip by -\captionwidth |
| 201 |
\divide\leftskip by 2 |
| 202 |
\rightskip\leftskip |
| 203 |
\realcaptionwidth\captionwidth |
| 204 |
\else |
| 205 |
\leftskip\captionmargin |
| 206 |
\rightskip\captionmargin |
| 207 |
\advance\realcaptionwidth by -2\captionmargin |
| 208 |
\fi |
| 209 |
\fi} |
| 210 |
\newcommand*\usecaptionstyle[1]{% |
| 211 |
\ifx\captiontext\undefined |
| 212 |
\caption@canterr{\usecaptionstyle}% |
| 213 |
\else |
| 214 |
\@ifundefined{caption@@#1}% |
| 215 |
{\PackageError{caption}{Caption style `#1' undefined}{}}% |
| 216 |
{\@nameuse{caption@@#1}} |
| 217 |
\fi} |
| 218 |
\newcommand*\caption@make[1]{% |
| 219 |
\usecaptionmargin\captionfont |
| 220 |
\def\caption@label{% |
| 221 |
{\captionlabelfont\captionlabel\captionlabeldelim}% |
| 222 |
\hskip\captionlabelsep}% |
| 223 |
\onelinecaption{\caption@label\captiontext}% |
| 224 |
{\@nameuse{caption@@@#1}}} |
| 225 |
\newcommand*\caption@@@normal{% |
| 226 |
\caption@label\captiontext\par} |
| 227 |
\newcommand*\caption@@@center{% |
| 228 |
\parbox[t]{\realcaptionwidth}{\centering |
| 229 |
\caption@label\captiontext\par}}% |
| 230 |
\newcommand*\caption@@@flushleft{% |
| 231 |
\parbox[t]{\realcaptionwidth}{\raggedright |
| 232 |
\caption@label\captiontext\par}}% |
| 233 |
\newcommand*\caption@@@flushright{% |
| 234 |
\parbox[t]{\realcaptionwidth}{\raggedleft |
| 235 |
\caption@label\captiontext\par}}% |
| 236 |
\newcommand*\caption@@@centerlast{% |
| 237 |
\advance\leftskip by 0pt plus 1fil% |
| 238 |
\advance\rightskip by 0pt plus -1fil% |
| 239 |
\parfillskip0pt plus 2fil% |
| 240 |
\caption@label\captiontext\par} |
| 241 |
\newcommand*\caption@@@hang{% |
| 242 |
\sbox\captionbox{\caption@label}% |
| 243 |
\hangindent\wd\captionbox\noindent |
| 244 |
\usebox\captionbox\captiontext\par} |
| 245 |
\newcommand*\caption@@@indent{% |
| 246 |
\hangindent\captionindent\noindent |
| 247 |
\caption@label\captiontext\par} |
| 248 |
\ifx\floatc@plain\undefined |
| 249 |
\else |
| 250 |
\caption@package{float} |
| 251 |
\newcommand\caption@floatc[3]{% |
| 252 |
\realcaptionwidth\linewidth |
| 253 |
\def\captionlabel{#2}% |
| 254 |
\def\captiontext{#3}% |
| 255 |
\usecaptionstyle{#1}} |
| 256 |
\renewcommand\floatc@plain{\caption@floatc{\caption@style}} |
| 257 |
\dummycaptionstyle{boxed}{\def\captionlabelfont{\bfseries}} |
| 258 |
\newcommand\floatc@boxed{\caption@floatc{boxed}} |
| 259 |
\let\caption@boxed\fs@boxed |
| 260 |
\renewcommand\fs@boxed{\let\floatc@plain\floatc@boxed\caption@boxed} |
| 261 |
\newcaptionstyle{ruled}{{\bfseries\captionlabel} \captiontext\par} |
| 262 |
\renewcommand*\floatc@ruled{\caption@floatc{ruled}} |
| 263 |
\fi |
| 264 |
\ifx\LT@makecaption\undefined |
| 265 |
\else |
| 266 |
\caption@package{longtable} |
| 267 |
\dummycaptionstyle{longtable}{\setcaptionwidth\LTcapwidth} |
| 268 |
\renewcommand\LT@makecaption[3]{% |
| 269 |
\LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\linewidth{% |
| 270 |
\realcaptionwidth\linewidth |
| 271 |
\ifx#1\@gobble |
| 272 |
\def\captionlabel{}% |
| 273 |
\def\captionlabeldelim{}% |
| 274 |
\captionlabelsep\z@ |
| 275 |
\else |
| 276 |
\def\captionlabel{#2}% |
| 277 |
\fi |
| 278 |
\def\captiontext{#3}% |
| 279 |
\usecaptionstyle{longtable}% |
| 280 |
\endgraf\vskip\baselineskip}% |
| 281 |
\hss}}} |
| 282 |
\fi |
| 283 |
\newcommand*\addtosubcaption[1]{} |
| 284 |
\@ifundefined{@makesubfigurecaption}{}{% |
| 285 |
\caption@package{subfigure} |
| 286 |
\newcommand*\subcapstyle[1]{% |
| 287 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 288 |
\PackageError{caption}{Undefined caption style `#1'}{}% |
| 289 |
\else |
| 290 |
\def\caption@substyle{#1}% |
| 291 |
\fi} |
| 292 |
\subcapstyle{normal} |
| 293 |
\ifsubcaphang |
| 294 |
\subcapstyle{hang} |
| 295 |
\fi |
| 296 |
\ifsubcapcenter |
| 297 |
\subcapstyle{center} |
| 298 |
\fi |
| 299 |
\ifsubcapcenterlast |
| 300 |
\subcapstyle{centerlast} |
| 301 |
\fi |
| 302 |
\newif\iftakesubfigcapwidth |
| 303 |
\newcommand*\subfigcapwidth{0pt} |
| 304 |
\newlength\subcapindent |
| 305 |
\newcommand*\setsubcapmargin[1]{% |
| 306 |
\renewcommand*\subcapfigmargin{#1}% |
| 307 |
\takesubfigcapwidthfalse} |
| 308 |
\newcommand*\setsubcapwidth[1]{% |
| 309 |
\renewcommand*\subcapfigwidth{#1}% |
| 310 |
\takesubfigcapwidthtrue} |
| 311 |
\renewcommand\@makesubfigurecaption[2]{% |
| 312 |
\realcaptionwidth\@tempdima |
| 313 |
\def\captionlabel{#1}% |
| 314 |
\def\captiontext{#2}% |
| 315 |
\let\captionfont\subcapsize |
| 316 |
\let\captionlabelfont\relax |
| 317 |
\let\captionlabeldelim\empty |
| 318 |
\captionlabelsep0pt |
| 319 |
\ifsubcapnooneline\onelinecaptionsfalse\else\onelinecaptionstrue\fi |
| 320 |
\iftakesubfigcapwidth\takecaptionwidthtrue\else\takecaptionwidthfalse\fi |
| 321 |
\setlength\captionmargin{\subfigcapmargin}% |
| 322 |
\setlength\captionwidth{\subfigcapwidth}% |
| 323 |
\captionindent\subcapindent |
| 324 |
\hbox{\parbox[t]\@tempdima{\strut\usecaptionstyle{\caption@substyle}}}} |
| 325 |
\renewcommand*\addtosubcaption[1]{% |
| 326 |
\let\caption@makesubfigurecaption\@makesubfigurecaption |
| 327 |
\renewcommand\@makesubfigurecaption[2]{% |
| 328 |
#1\caption@makesubfigurecaption} |
| 329 |
\let\@makesubtablecaption\@makesubfigurecaption}} |
| 330 |
\ifx\caption@message\undefined |
| 331 |
\else\message{^^J}\let\caption@message\undefined\fi |
| 332 |
\let\caption@package\undefined |
| 333 |
\let\caption@subcapsize\undefined |
| 334 |
\endinput |
| 335 |
%% |
| 336 |
%% End of file `caption2_1995-10-09.sty'. |