| 1 |
% \iffalse |
| 2 |
% caption.dtx - The caption package |
| 3 |
% (c) 1994-95 Axel Sommerfeldt ([email protected]) |
| 4 |
% |
| 5 |
%<*driver> |
| 6 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 7 |
\documentclass{ltxdoc} |
| 8 |
\newlength\artparindent |
| 9 |
\setlength\artparindent{\parindent} |
| 10 |
\setlength\parindent{0pt} |
| 11 |
\setlength\parskip{\smallskipamount} |
| 12 |
\usepackage{caption2}[1995/10/09] |
| 13 |
\IfFileExists{ltxdoc.cfg}{}{\OnlyDescription\RecordChanges\CodelineIndex} |
| 14 |
\begin{document} |
| 15 |
\DocInput{caption2.dtx} |
| 16 |
\IfFileExists{ltxdoc.cfg}{}{\PrintChanges\PrintIndex} |
| 17 |
\end{document} |
| 18 |
%</driver> |
| 19 |
% \fi |
| 20 |
% |
| 21 |
% \providecommand{\LaTeXcomp}{The \LaTeX{} Companion} |
| 22 |
% \newcommand{\purerm}[1]{{\upshape\mdseries\rmfamily #1}} |
| 23 |
% \newcommand{\puresf}[1]{{\upshape\mdseries\sffamily #1}} |
| 24 |
% \newenvironment{Options}[1]% |
| 25 |
% {\begin{list}{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}% |
| 26 |
% \settowidth{\labelwidth}{\texttt{#1\space}}% |
| 27 |
% \setlength{\leftmargin}{\labelwidth}% |
| 28 |
% \addtolength{\leftmargin}{\labelsep}}}% |
| 29 |
% {\end{list}} |
| 30 |
% |
| 31 |
% \def\packageversion{2.0(BETA)} |
| 32 |
% \def\packagedate{1995/10/09} |
| 33 |
% \changes{v1.0}{27 Oct 94}{First release} |
| 34 |
% \changes{v1.2}{28 Nov 94}{Works now with the {\tt figure*} and {\tt table*} |
| 35 |
% environments, too} |
| 36 |
% \changes{v2.0}{ 9 Oct 95}{Totally rewritten; many new commands and features} |
| 37 |
% |
| 38 |
% \title{The \puresf{caption} package\thanks{This package has version number |
| 39 |
% \packageversion, last revised \packagedate.}} |
| 40 |
% \author{Axel Sommerfeldt\\ |
| 41 |
% {\small [email protected]}} |
| 42 |
% \date{1995/10/09} |
| 43 |
% \maketitle |
| 44 |
% |
| 45 |
% \begin{abstract} |
| 46 |
% The \textsf{caption} package provides many ways to customise the captions |
| 47 |
% in floating environments such |figure|, |table|, |sidewaysfigure|, and |
| 48 |
% |sidewaystable|. |
| 49 |
% The following \LaTeXe\ packages are supported: |
| 50 |
% float, longtable, and subfigure. |
| 51 |
% But it works fine with the following packages as well: |
| 52 |
% floatfig, rotating, supertabular, and wrapfig. |
| 53 |
% \end{abstract} |
| 54 |
% |
| 55 |
% \section{Documentation? What documentation?} |
| 56 |
% I'm sorry to say this, but there is no documentation provided with the |
| 57 |
% new version of this package, yet. And it's still beta. I hope I can |
| 58 |
% eleminate both circumstances in the near future; at the moment my spare time |
| 59 |
% is very very very limited, so I decided to make this beta public. |
| 60 |
% |
| 61 |
% This new version is nearly compatible with the lastest official release |
| 62 |
% (version 1.4b), so you can use the old documentation so far. |
| 63 |
% Here is what differs this version from version 1.4b: |
| 64 |
% |
| 65 |
% \begin{itemize} |
| 66 |
% \item |
| 67 |
% If the caption package will detect a loaded float package, it will |
| 68 |
% \emph{not} redefine the boxed style of floats anymore. If you want to |
| 69 |
% have the old behaviour, you have to specify the new option |boxed| to |
| 70 |
% the caption2 package. |
| 71 |
% \item |
| 72 |
% Anything said about the subfigure package in the old doc isn't |
| 73 |
% true anymore; the caption package is now adapted to the new version |
| 74 |
% 2.0 of this package. Especially the caption package will \emph{not} |
| 75 |
% redefine |\@thesubfigure| and |\@thesubtable| anymore and it will |
| 76 |
% \emph{not} set |\subcapsize| -- you have to do this now for yourself |
| 77 |
% if you want to, e.g.\ with the following code: |
| 78 |
% \begin{quote} |
| 79 |
% |\usepackage[normalsize]{subfigure}|\\ |
| 80 |
% |\usepackage[large]{caption}| |
| 81 |
% \end{quote} |
| 82 |
% |
| 83 |
% So you can load the caption2 package \emph{before} loading the subfigure |
| 84 |
% package now without problems, in fact this is recommend now. Don't care |
| 85 |
% about what the old doc or the doc of the subfigure package is telling you! |
| 86 |
% \end{itemize} |
| 87 |
% |
| 88 |
% As a summary, the new caption package won't lead into different results |
| 89 |
% of your documents just because of loading it (without options). |
| 90 |
% |
| 91 |
% If you are really interested in the (many!) new features of this totally |
| 92 |
% rewritten package, take a look in the provided test document (test2.tex) |
| 93 |
% to get a idea of the new commands and possibilities. |
| 94 |
% And feel yourself free to write a email to me, if any questions occur. |
| 95 |
% |
| 96 |
% \subsection{Just a few notes\dots} |
| 97 |
% If you use the new command |\setcaptionwidth| to set the absolut width of a |
| 98 |
% caption, you are not allowed to change |\captionmargin| anymore! |
| 99 |
% Instead, use the new command |\setcaptionmargin| to do this. |
| 100 |
% |
| 101 |
% Longtables will still take care of |\LTcapwidth|, even if you are setting |
| 102 |
% your own width via |\setcaptionwidth| or |\setcaptionmargin|. To get rid |
| 103 |
% of this, use the following code just after loading the caption2 package: |
| 104 |
% \begin{quote} |
| 105 |
% |\dummycaptionstyle{longtable}{}| |
| 106 |
% \end{quote} |
| 107 |
% or just specify the new package option |longtable|. |
| 108 |
% |
| 109 |
% This package was developed and tested with following versions of the |
| 110 |
% other packages: |
| 111 |
% \begin{quote}\begin{tabular}{lll} |
| 112 |
% package & version & date \\\hline |
| 113 |
% float & 1.2c & 1995/03/29 \\ |
| 114 |
% longtable & 3.15 & 1995/06/15 \\ |
| 115 |
% rotating & 2.9 & 1995/04/07 \\ |
| 116 |
% subfigure & 2.0 & 1995/03/06 \\ |
| 117 |
% \end{tabular}\end{quote} |
| 118 |
% |
| 119 |
% Maybe it will work with older versions, maybe not\dots |
| 120 |
% |
| 121 |
% BTW: |
| 122 |
% If you are interested in rotated versions (like |sidewaysfigure| or |
| 123 |
% |sidewaystable|) of new floats (defined with the float package), take a look |
| 124 |
% at the rotfloat package, which comes from a very talented young man with a |
| 125 |
% very german style of writing english docs (if he ever writes any!) and a |
| 126 |
% very big mouth - myself |:-)| |
| 127 |
% |
| 128 |
% \section{Thanks} |
| 129 |
% I would like to thank David Carlisle for his help writing the longtable |
| 130 |
% support; without the changes in his package this wouldn't become possible. |
| 131 |
% |
| 132 |
% \changes{v1.1}{ 3 Nov 94}{New captiontype: {\tt centerlast}} |
| 133 |
% \changes{v1.4}{30 Jan 95}{New option: {\tt nooneline}} |
| 134 |
% \changes{v1.4}{29 Jan 95}{{\tt\protect\bslash captionsize} changed to |
| 135 |
% {\tt\protect\bslash captionfont}} |
| 136 |
% \changes{v1.2}{28 Nov 94}{Support of the {\sf float} package} |
| 137 |
% \changes{v1.3}{ 8 Jan 95}{Support of {\tt\protect\bslash captionlabelfont} in |
| 138 |
% subcaptions} |
| 139 |
% \changes{v1.4b}{5 Apr 95}{Adapted to version 2.8 of the rotating package} |
| 140 |
% \changes{v2.0}{ 9 Oct 95}{support of the longtable package} |
| 141 |
% |
| 142 |
% \StopEventually{ |
| 143 |
% \begin{thebibliography}{9} |
| 144 |
% \bibitem{float} |
| 145 |
% Anselm Lingnau: |
| 146 |
% \textsl{An Improved Environment for Floats}, |
| 147 |
% 1995/03/25 |
| 148 |
% \bibitem{rotating} |
| 149 |
% Sebastian Rahtz and Leonor Barroca: |
| 150 |
% \textsl{A style option for rotated objects in \LaTeX}, |
| 151 |
% 1994/10/02 |
| 152 |
% \bibitem{rotfloat} |
| 153 |
% Axel Sommerfeldt: |
| 154 |
% \textsl{The rotfloat package}, |
| 155 |
% 1995/03/30 |
| 156 |
% \bibitem{subfigure} |
| 157 |
% Steven Douglas Cochran: |
| 158 |
% \textsl{The subfigure package}, |
| 159 |
% 1995/03/06 |
| 160 |
% \bibitem{A-W:GMS94} |
| 161 |
% Michel Goossens, Frank Mittelbach and Alexander Samarin: |
| 162 |
% \newblock \textsl{The {\LaTeX} Companion}, |
| 163 |
% \newblock Addison-Wesley, Reading, Massachusetts, 1994. |
| 164 |
% \bibitem{Anne} |
| 165 |
% Anne Br\"uggemann-Klein: |
| 166 |
% \textsl{Einf\"uhrung in die Dokumentverarbeitung}, |
| 167 |
% B.G. Teubner, Stuttgart, 1989 |
| 168 |
% \bibitem{Kopka-E} |
| 169 |
% Helmut Kopka: |
| 170 |
% \textsl{\LaTeX -- Erweiterungsm\"oglichkeiten}, |
| 171 |
% 3. \"uberarbeitete Auf\/lage, Addison-Wesley, Bonn, 1991 |
| 172 |
% \end{thebibliography} |
| 173 |
% } |
| 174 |
% \setlength{\parskip}{0pt plus 1pt} |
| 175 |
% |
| 176 |
% \CheckSum{647} |
| 177 |
% \DoNotIndex{\\,\_,\ } |
| 178 |
% \DoNotIndex{\@gobble,\@ifundefined,\@namedef,\@nameuse,\@tempdima} |
| 179 |
% \DoNotIndex{\p@,\z@} |
| 180 |
% \DoNotIndex{\active,\addtolength,\advance,\begin,\bfseries} |
| 181 |
% \DoNotIndex{\catcode,\centering,\csname,\def,\divide} |
| 182 |
% \DoNotIndex{\else,\empty,\end,\endcsname,\endgraf,\expandafter} |
| 183 |
% \DoNotIndex{\fi,\footnotesize,\global} |
| 184 |
% \DoNotIndex{\hangindent,\hbox,\hskip,\hspace,\hss} |
| 185 |
% \DoNotIndex{\ifcase,\ifdim,\ifx,\itshape} |
| 186 |
% \DoNotIndex{\Large,\large,\leavevmode,\leftskip,\let,\linewidth} |
| 187 |
% \DoNotIndex{\mdseries,\message} |
| 188 |
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newif,\newsavebox,\noindent} |
| 189 |
% \DoNotIndex{\normalsize,\or} |
| 190 |
% \DoNotIndex{\par,\parbox,\parfillskip,\protect} |
| 191 |
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\rightskip} |
| 192 |
% \DoNotIndex{\rmfamily} |
| 193 |
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setlength,\sffamily,\slshape,\small} |
| 194 |
% \DoNotIndex{\space,\strut} |
| 195 |
% \DoNotIndex{\textheight,\typeout,\ttfamily,\undefined,\upshape,\usebox} |
| 196 |
% \DoNotIndex{\vsize,\vskip,\wd} |
| 197 |
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption} |
| 198 |
% \DoNotIndex{\ExecuteOptions,\InputIfFileExists,\NeedsTeXFormat,\MessageBreak} |
| 199 |
% \DoNotIndex{\PackageError,\PackageWarningNoLine,\ProcessOptions} |
| 200 |
% \DoNotIndex{\ProvidesPackage} |
| 201 |
% |
| 202 |
% \clearpage |
| 203 |
% \section{The (not well documented) code} |
| 204 |
% \iffalse |
| 205 |
%<*package> |
| 206 |
% \fi |
| 207 |
% |
| 208 |
% \begin{macrocode} |
| 209 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 210 |
\ProvidesPackage{caption2}[1995/10/09 v2.0 caption package (AS)] |
| 211 |
% |
| 212 |
% package detection message |
| 213 |
\let\caption@message\undefined |
| 214 |
\newcommand*\caption@package[1]{% |
| 215 |
\ifx\caption@message\undefined |
| 216 |
\message{\space\space\space\space\space\space\space\space\space |
| 217 |
packages detected:} |
| 218 |
\let\caption@message\empty |
| 219 |
\fi |
| 220 |
\message{#1}} |
| 221 |
% |
| 222 |
% `internal' stuff |
| 223 |
\newlength\realcaptionwidth |
| 224 |
\newsavebox\captionbox |
| 225 |
% |
| 226 |
% Code initialisation, `normal' stuff |
| 227 |
\newcommand*\captionsize{} |
| 228 |
\newcommand*\captionfont{\captionsize} |
| 229 |
\newcommand*\captionlabelfont{} |
| 230 |
\newcommand*\captionlabeldelim{:} |
| 231 |
\newdimen\captionlabelsep |
| 232 |
\sbox\captionbox{ } |
| 233 |
\setlength\captionlabelsep{\wd\captionbox} |
| 234 |
\newdimen\captionmargin |
| 235 |
\newdimen\captionwidth |
| 236 |
% only used by captionstyle `indent', but can be used in user-defines styles |
| 237 |
\newdimen\captionindent |
| 238 |
\newif\ifonelinecaptions |
| 239 |
\newif\iftakecaptionwidth |
| 240 |
% |
| 241 |
%\newcommand*\setcaptionfont[1]{% |
| 242 |
% \def\captionfont{#1}} |
| 243 |
%\newcommand*\setcaptionlabelfont[1]{% |
| 244 |
% \def\captionlabelfont{#1}} |
| 245 |
\newcommand*\setcaptionmargin[1]{% |
| 246 |
\setlength\captionmargin{#1}% |
| 247 |
\takecaptionwidthfalse} |
| 248 |
\newcommand*\setcaptionwidth[1]{% |
| 249 |
\setlength\captionwidth{#1}% |
| 250 |
\takecaptionwidthtrue} |
| 251 |
% |
| 252 |
% \newcaptionstyle, \renewcaptionstyle & \defcaptionstyle |
| 253 |
\newcommand\newcaptionstyle[2]{% |
| 254 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 255 |
\defcaptionstyle{#1}{#2}% |
| 256 |
\else |
| 257 |
\PackageError{caption}{Caption style `#1' already defined}{}% |
| 258 |
\fi} |
| 259 |
\newcommand\renewcaptionstyle[2]{% |
| 260 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 261 |
\PackageError{caption}{Caption style `#1' undefined}{}% |
| 262 |
\else |
| 263 |
\defcaptionstyle{#1}{#2}% |
| 264 |
\fi} |
| 265 |
\newcommand\defcaptionstyle[2]{% |
| 266 |
\@namedef{caption@@#1}{#2}} |
| 267 |
\newcommand*\dummycaptionstyle[2]{% |
| 268 |
\defcaptionstyle{#1}{% |
| 269 |
\expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname% |
| 270 |
\csname caption@@#1\endcsname |
| 271 |
\PackageError{caption}{You can't use the caption style `#1' directy}{% |
| 272 |
The caption style `#1' is only a dummy and does not really exists.% |
| 273 |
\MessageBreak You have to redefine it (with \protect\renewcaptionstyle) |
| 274 |
before you can select\MessageBreak it with \protect\captionstyle.}% |
| 275 |
\else |
| 276 |
#2\usecaptionstyle{\caption@style}% |
| 277 |
\fi}} |
| 278 |
% |
| 279 |
% preimplemented types of captions, all with a label and text, |
| 280 |
% separated by \captionlabeldelim |
| 281 |
\newcaptionstyle{normal}{\caption@make{normal}} |
| 282 |
\newcaptionstyle{center}{\caption@make{center}} |
| 283 |
\newcaptionstyle{flushleft}{\caption@make{flushleft}} |
| 284 |
\newcaptionstyle{flushright}{\caption@make{flushright}} |
| 285 |
\newcaptionstyle{centerlast}{\caption@make{centerlast}} |
| 286 |
\newcaptionstyle{hang}{\caption@make{hang}} |
| 287 |
\newcaptionstyle{indent}{\caption@make{indent}} |
| 288 |
% |
| 289 |
% \captionstyle |
| 290 |
\newcommand*\captionstyle[1]{% |
| 291 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 292 |
\PackageError{caption}{Undefined caption style `#1'}{}% |
| 293 |
\else |
| 294 |
\def\caption@style{#1}% |
| 295 |
\fi} |
| 296 |
% |
| 297 |
% Options |
| 298 |
\DeclareOption{normal}{\captionstyle{normal}} |
| 299 |
\DeclareOption{center}{\captionstyle{center}} |
| 300 |
\DeclareOption{flushleft}{\captionstyle{flushleft}} |
| 301 |
\DeclareOption{flushright}{\captionstyle{flushright}} |
| 302 |
\DeclareOption{centerlast}{\captionstyle{centerlast}} |
| 303 |
\DeclareOption{anne}{\ExecuteOptions{centerlast}} |
| 304 |
\DeclareOption{hang}{\captionstyle{hang}} |
| 305 |
\DeclareOption{isu}{\ExecuteOptions{hang}} |
| 306 |
\DeclareOption{indent}{\captionstyle{indent}} |
| 307 |
% |
| 308 |
\DeclareOption{oneline}{\onelinecaptionstrue} |
| 309 |
\DeclareOption{nooneline}{\onelinecaptionsfalse} |
| 310 |
% |
| 311 |
\DeclareOption{scriptsize}{\renewcommand*\captionsize{\scriptsize}} |
| 312 |
\DeclareOption{footnotesize}{\renewcommand*\captionsize{\footnotesize}} |
| 313 |
\DeclareOption{small}{\renewcommand*\captionsize{\small}} |
| 314 |
\DeclareOption{normalsize}{\renewcommand*\captionsize{\normalsize}} |
| 315 |
\DeclareOption{large}{\renewcommand*\captionsize{\large}} |
| 316 |
\DeclareOption{Large}{\renewcommand*\captionsize{\Large}} |
| 317 |
% |
| 318 |
\DeclareOption{up}{\renewcommand*\captionlabelfont{\upshape}} |
| 319 |
\DeclareOption{it}{\renewcommand*\captionlabelfont{\itshape}} |
| 320 |
\DeclareOption{sl}{\renewcommand*\captionlabelfont{\slshape}} |
| 321 |
\DeclareOption{sc}{\renewcommand*\captionlabelfont{\scshape}} |
| 322 |
\DeclareOption{md}{\renewcommand*\captionlabelfont{\mdseries}} |
| 323 |
\DeclareOption{bf}{\renewcommand*\captionlabelfont{\bfseries}} |
| 324 |
\DeclareOption{rm}{\renewcommand*\captionlabelfont{\rmfamily}} |
| 325 |
\DeclareOption{sf}{\renewcommand*\captionlabelfont{\sffamily}} |
| 326 |
\DeclareOption{tt}{\renewcommand*\captionlabelfont{\ttfamily}} |
| 327 |
% |
| 328 |
\DeclareOption{boxed}{\AtEndOfPackage{% |
| 329 |
\ifx\caption@@ruled\undefined |
| 330 |
\PackageWarningNoLine{caption}{% |
| 331 |
Option `boxed' is set but there is no `float' package\MessageBreak |
| 332 |
around here, so this option will be totally ignored} |
| 333 |
\else |
| 334 |
\dummycaptionstyle{boxed}{}% |
| 335 |
\fi}} |
| 336 |
\DeclareOption{ruled}{\AtEndOfPackage{% |
| 337 |
\ifx\caption@@ruled\undefined |
| 338 |
\PackageWarningNoLine{caption}{% |
| 339 |
Option `ruled' is set but there is no `float' package\MessageBreak |
| 340 |
around here, so this option will be totally ignored} |
| 341 |
\else |
| 342 |
\dummycaptionstyle{ruled}{\onelinecaptionsfalse\setcaptionmargin{0pt}}% |
| 343 |
\fi}} |
| 344 |
% |
| 345 |
\DeclareOption{longtable}{\AtEndOfPackage{% |
| 346 |
\ifx\caption@@longtable\undefined |
| 347 |
\PackageWarningNoLine{caption}{% |
| 348 |
Option `longtable' is set but there is no `longtable' package\MessageBreak |
| 349 |
around here, so this option will be totally ignored} |
| 350 |
\else |
| 351 |
\dummycaptionstyle{longtable}{}% |
| 352 |
\fi}} |
| 353 |
% |
| 354 |
\DeclareOption*{\AtEndOfPackage{% |
| 355 |
\InputIfFileExists{\CurrentOption.caption}{}{% |
| 356 |
\PackageError{caption}{File `\CurrentOption.caption' not found}{% |
| 357 |
You selected the unknown package option `\CurrentOption', so I |
| 358 |
thought you want to\MessageBreak |
| 359 |
input the definition file `\CurrentOption.caption' here |
| 360 |
-- but there is no one!}}}} |
| 361 |
% |
| 362 |
\ExecuteOptions{normal,oneline} |
| 363 |
\ProcessOptions |
| 364 |
% |
| 365 |
% \@makecaption |
| 366 |
\renewcommand\@makecaption[2]{% |
| 367 |
\vskip\abovecaptionskip |
| 368 |
\realcaptionwidth\linewidth |
| 369 |
\def\captionlabel{#1}% |
| 370 |
\def\captiontext{#2}% |
| 371 |
\usecaptionstyle{\caption@style}% |
| 372 |
\vskip\belowcaptionskip} |
| 373 |
% |
| 374 |
% Helpers for caption style authors |
| 375 |
\newcommand*\caption@canterr[1]{% |
| 376 |
\PackageError{caption}{You can't use \protect#1 |
| 377 |
in normal text}{The usage of \protect#1 is only |
| 378 |
allowed inside code declared with\MessageBreak \protect\defcaptionstyle, |
| 379 |
\protect\newcaptionstyle \space or \protect\renewcaptionstyle.}} |
| 380 |
\newcommand\onelinecaption[2]{% |
| 381 |
\ifx\captiontext\undefined |
| 382 |
\caption@canterr{\onelinecaption}% |
| 383 |
\else |
| 384 |
\def\caption@temp{#2}% |
| 385 |
\ifonelinecaptions |
| 386 |
\sbox\captionbox{#1}% |
| 387 |
\ifdim\wd\captionbox >\realcaptionwidth |
| 388 |
\caption@temp |
| 389 |
\else |
| 390 |
{\centering\usebox{\captionbox}\par}% |
| 391 |
\fi |
| 392 |
\else |
| 393 |
\caption@temp |
| 394 |
\fi |
| 395 |
\let\caption@temp\undefined |
| 396 |
\fi} |
| 397 |
\newcommand*\usecaptionmargin{% |
| 398 |
\ifx\captiontext\undefined |
| 399 |
\caption@canterr{\usecaptionmargin}% |
| 400 |
\else |
| 401 |
\iftakecaptionwidth |
| 402 |
\leftskip\realcaptionwidth |
| 403 |
\advance\leftskip by -\captionwidth |
| 404 |
\divide\leftskip by 2 |
| 405 |
\rightskip\leftskip |
| 406 |
\realcaptionwidth\captionwidth |
| 407 |
\else |
| 408 |
\leftskip\captionmargin |
| 409 |
\rightskip\captionmargin |
| 410 |
\advance\realcaptionwidth by -2\captionmargin |
| 411 |
\fi |
| 412 |
\fi} |
| 413 |
\newcommand*\usecaptionstyle[1]{% |
| 414 |
\ifx\captiontext\undefined |
| 415 |
\caption@canterr{\usecaptionstyle}% |
| 416 |
\else |
| 417 |
\@ifundefined{caption@@#1}% |
| 418 |
{\PackageError{caption}{Caption style `#1' undefined}{}}% |
| 419 |
{\@nameuse{caption@@#1}} |
| 420 |
\fi} |
| 421 |
% |
| 422 |
% equal code for normal, center, centerlast, hang, and indent |
| 423 |
\newcommand*\caption@make[1]{% |
| 424 |
\usecaptionmargin\captionfont |
| 425 |
\def\caption@label{% |
| 426 |
{\captionlabelfont\captionlabel\captionlabeldelim}% |
| 427 |
\hskip\captionlabelsep}% |
| 428 |
\onelinecaption{\caption@label\captiontext}% |
| 429 |
{\@nameuse{caption@@@#1}}} |
| 430 |
% |
| 431 |
% the preimplemented caption styles |
| 432 |
\newcommand*\caption@@@normal{% |
| 433 |
\caption@label\captiontext\par} |
| 434 |
\newcommand*\caption@@@center{% |
| 435 |
\parbox[t]{\realcaptionwidth}{\centering |
| 436 |
\caption@label\captiontext\par}}% |
| 437 |
\newcommand*\caption@@@flushleft{% |
| 438 |
\parbox[t]{\realcaptionwidth}{\raggedright |
| 439 |
\caption@label\captiontext\par}}% |
| 440 |
\newcommand*\caption@@@flushright{% |
| 441 |
\parbox[t]{\realcaptionwidth}{\raggedleft |
| 442 |
\caption@label\captiontext\par}}% |
| 443 |
\newcommand*\caption@@@centerlast{% |
| 444 |
\advance\leftskip by 0pt plus 1fil% |
| 445 |
\advance\rightskip by 0pt plus -1fil% |
| 446 |
\parfillskip0pt plus 2fil% |
| 447 |
\caption@label\captiontext\par} |
| 448 |
\newcommand*\caption@@@hang{% |
| 449 |
\sbox\captionbox{\caption@label}% |
| 450 |
\hangindent\wd\captionbox\noindent |
| 451 |
\usebox\captionbox\captiontext\par} |
| 452 |
\newcommand*\caption@@@indent{% |
| 453 |
\hangindent\captionindent\noindent |
| 454 |
\caption@label\captiontext\par} |
| 455 |
% \end{macrocode} |
| 456 |
% |
| 457 |
% \subsection*{Support of the float package} |
| 458 |
% \begin{macrocode} |
| 459 |
\ifx\floatc@plain\undefined |
| 460 |
\else |
| 461 |
\caption@package{float} |
| 462 |
% |
| 463 |
% interface float package -> caption package |
| 464 |
\newcommand\caption@floatc[3]{% |
| 465 |
\realcaptionwidth\linewidth |
| 466 |
\def\captionlabel{#2}% |
| 467 |
\def\captiontext{#3}% |
| 468 |
\usecaptionstyle{#1}} |
| 469 |
% |
| 470 |
% floatstyle plain verwendet jetzt den gesetzten captionstyle |
| 471 |
\renewcommand\floatc@plain{\caption@floatc{\caption@style}} |
| 472 |
% |
| 473 |
% floatstyle boxed auch (kann aber mit \renewcaptionstyle geaendert werden) |
| 474 |
\dummycaptionstyle{boxed}{\def\captionlabelfont{\bfseries}} |
| 475 |
\newcommand\floatc@boxed{\caption@floatc{boxed}} |
| 476 |
% jetzt muessen wir nur noch dafuer sorgen, dass es auch (statt floatc@plain) |
| 477 |
% in \fs@boxed verwendet wird... |
| 478 |
\let\caption@boxed\fs@boxed |
| 479 |
\renewcommand\fs@boxed{\let\floatc@plain\floatc@boxed\caption@boxed} |
| 480 |
% |
| 481 |
% floatstyle ruled, dies geht zum Glueck wieder geradeaus |
| 482 |
\newcaptionstyle{ruled}{{\bfseries\captionlabel} \captiontext\par} |
| 483 |
\renewcommand*\floatc@ruled{\caption@floatc{ruled}} |
| 484 |
% |
| 485 |
\fi |
| 486 |
% \end{macrocode} |
| 487 |
% |
| 488 |
% \subsection*{Support of the longtable package} |
| 489 |
% \begin{macrocode} |
| 490 |
\ifx\LT@makecaption\undefined |
| 491 |
\else |
| 492 |
\caption@package{longtable} |
| 493 |
\dummycaptionstyle{longtable}{\setcaptionwidth\LTcapwidth} |
| 494 |
\renewcommand\LT@makecaption[3]{% |
| 495 |
\LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\linewidth{% |
| 496 |
\realcaptionwidth\linewidth |
| 497 |
\ifx#1\@gobble |
| 498 |
\def\captionlabel{}% |
| 499 |
\def\captionlabeldelim{}% |
| 500 |
\captionlabelsep\z@ |
| 501 |
\else |
| 502 |
\def\captionlabel{#2}% |
| 503 |
\fi |
| 504 |
\def\captiontext{#3}% |
| 505 |
\usecaptionstyle{longtable}% |
| 506 |
\endgraf\vskip\baselineskip}% |
| 507 |
\hss}}} |
| 508 |
\fi |
| 509 |
% \end{macrocode} |
| 510 |
% |
| 511 |
% \subsection*{Support of the subfigure package} |
| 512 |
% \begin{macrocode} |
| 513 |
\newcommand*\addtosubcaption[1]{} |
| 514 |
\@ifundefined{@makesubfigurecaption}{}{% |
| 515 |
\caption@package{subfigure} |
| 516 |
% \end{macrocode} |
| 517 |
% |
| 518 |
% \begin{macro}{\subcapsize} |
| 519 |
% \begin{macrocode} |
| 520 |
\newcommand*\subcapstyle[1]{% |
| 521 |
\expandafter\ifx\csname caption@@#1\endcsname\relax |
| 522 |
\PackageError{caption}{Undefined caption style `#1'}{}% |
| 523 |
\else |
| 524 |
\def\caption@substyle{#1}% |
| 525 |
\fi} |
| 526 |
% \end{macrocode} |
| 527 |
% \end{macro} |
| 528 |
% |
| 529 |
% Detection of |\caption@substyle|. |
| 530 |
% \begin{macrocode} |
| 531 |
\subcapstyle{normal} |
| 532 |
\ifsubcaphang |
| 533 |
\subcapstyle{hang} |
| 534 |
\fi |
| 535 |
\ifsubcapcenter |
| 536 |
\subcapstyle{center} |
| 537 |
\fi |
| 538 |
\ifsubcapcenterlast |
| 539 |
\subcapstyle{centerlast} |
| 540 |
\fi |
| 541 |
% \end{macrocode} |
| 542 |
% |
| 543 |
% NOTE: \cs{subfigcapmargin} is \emph{not} a length, it's a command. |
| 544 |
% So we make \cs{subfigcapwidth} also a command! |
| 545 |
% \begin{macrocode} |
| 546 |
\newif\iftakesubfigcapwidth |
| 547 |
\newcommand*\subfigcapwidth{0pt} |
| 548 |
% only used by captionstyle `indent', but can be used in user-defines styles |
| 549 |
\newlength\subcapindent |
| 550 |
% \end{macrocode} |
| 551 |
% |
| 552 |
% \begin{macro}{\setsubcapmargin} |
| 553 |
% \begin{macro}{\setsubcapwidth} |
| 554 |
% \begin{macrocode} |
| 555 |
\newcommand*\setsubcapmargin[1]{% |
| 556 |
\renewcommand*\subcapfigmargin{#1}% |
| 557 |
\takesubfigcapwidthfalse} |
| 558 |
\newcommand*\setsubcapwidth[1]{% |
| 559 |
\renewcommand*\subcapfigwidth{#1}% |
| 560 |
\takesubfigcapwidthtrue} |
| 561 |
% \end{macrocode} |
| 562 |
% \end{macro} |
| 563 |
% \end{macro} |
| 564 |
% |
| 565 |
% \begin{macrocode} |
| 566 |
\renewcommand\@makesubfigurecaption[2]{% |
| 567 |
\realcaptionwidth\@tempdima |
| 568 |
\def\captionlabel{#1}% |
| 569 |
\def\captiontext{#2}% |
| 570 |
\let\captionfont\subcapsize |
| 571 |
\let\captionlabelfont\relax |
| 572 |
\let\captionlabeldelim\empty |
| 573 |
\captionlabelsep0pt |
| 574 |
\ifsubcapnooneline\onelinecaptionsfalse\else\onelinecaptionstrue\fi |
| 575 |
\iftakesubfigcapwidth\takecaptionwidthtrue\else\takecaptionwidthfalse\fi |
| 576 |
\setlength\captionmargin{\subfigcapmargin}% |
| 577 |
\setlength\captionwidth{\subfigcapwidth}% |
| 578 |
\captionindent\subcapindent |
| 579 |
\hbox{\parbox[t]\@tempdima{\strut\usecaptionstyle{\caption@substyle}}}} |
| 580 |
% \end{macrocode} |
| 581 |
% |
| 582 |
% \begin{macrocode} |
| 583 |
\renewcommand*\addtosubcaption[1]{% |
| 584 |
\let\caption@makesubfigurecaption\@makesubfigurecaption |
| 585 |
\renewcommand\@makesubfigurecaption[2]{% |
| 586 |
#1\caption@makesubfigurecaption} |
| 587 |
\let\@makesubtablecaption\@makesubfigurecaption}} |
| 588 |
% \end{macrocode} |
| 589 |
% |
| 590 |
% \subsection*{Cleaning up} |
| 591 |
% \begin{macrocode} |
| 592 |
\ifx\caption@message\undefined |
| 593 |
\else\message{^^J}\let\caption@message\undefined\fi |
| 594 |
\let\caption@package\undefined |
| 595 |
\let\caption@subcapsize\undefined |
| 596 |
% \end{macrocode} |
| 597 |
% \clearpage |
| 598 |
% |
| 599 |
% \iffalse |
| 600 |
%</package> |
| 601 |
% \fi |
| 602 |
% |
| 603 |
% \Finale |
| 604 |
% |
| 605 |
\endinput |
| 606 |
|