Debian Codegraph @

texmf-dist/source/latex/caption/fallback/v1/caption.dtx

raw
1 % \iffalse
2 % caption.dtx - The caption package
3 % (c) 1994-95 Axel Sommerfeldt ([email protected])
4 %
5 % --------------------------------------------------------------------------
6 %
7 % It may be distributed and/or modified under the
8 % conditions of the LaTeX Project Public License, either version 1.2
9 % of this license or (at your option) any later version.
10 % The latest version of this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.2 or later is part of all distributions of LaTeX
13 % version 1999/12/01 or later.
14 %
15 %<*driver>
16 \documentclass{ltxdoc}
17 \setlength{\parindent}{0pt}
18 \setlength{\parskip}{\smallskipamount}
19 \usepackage[hang,small,bf]{caption}[1995/01/30]
20 \setlength{\captionmargin}{20pt}
21 \begin{document}
22 \DocInput{caption.dtx}
23 \end{document}
24 %</driver>
25 % \fi
26 %
27 % \providecommand{\LaTeXcomp}{The \LaTeX{} Companion}
28 % \newcommand{\purerm}[1]{{\upshape\mdseries\rmfamily #1}}
29 % \newcommand{\puresf}[1]{{\upshape\mdseries\sffamily #1}}
30 % \newenvironment{Options}[1]%
31 % {\begin{list}{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}%
32 % \settowidth{\labelwidth}{\texttt{#1\space}}%
33 % \setlength{\leftmargin}{\labelwidth}%
34 % \addtolength{\leftmargin}{\labelsep}}}%
35 % {\end{list}}
36 %
37 % \def\packageversion{1.4b}
38 % \def\packagedate{1995/04/05}
39 % \changes{v1.0}{27 Oct 94}{First release}
40 % \changes{v1.2}{28 Nov 94}{Works now with the {\tt figure*} and {\tt table*} environments, too}
41 %
42 % \title{The \puresf{caption} package\thanks{This package has version number
43 % \packageversion, last revised \packagedate.}}
44 % \author{Axel Sommerfeldt\\\texttt{[email protected]}}
45 % \date{1995/04/05}
46 % \maketitle
47 %
48 % \begin{abstract}
49 % The \textsf{caption} package provides many ways to customise the captions
50 % in floating environments such |figure| and |table|.
51 % The |\rotcaption| command and the |sidewaysfigure| and |sidewaystable|
52 % environments provided by the \textsf{rotating} package from S.~Rahtz and
53 % L.~Barroca are also supported.
54 % The \textsf{caption} package also cooperates with the \textsf{float}
55 % package written by A.~Lingnau and the \textsf{subfigure} package written by
56 % S.D.~Cochran.
57 % \end{abstract}
58 %
59 % \section{The user interface}
60 % \changes{v1.1}{3 Nov 94}{New captiontype: {\tt centerlast}}
61 % \changes{v1.4}{30 Jan 95}{New option: {\tt nooneline}}
62 %
63 % To use this package just type
64 % \begin{quote}
65 % |\usepackage|\oarg{options}|{caption}|
66 % \end{quote}
67 % in the preamble of your document,
68 % where the following options are supported:
69 % \begin{quote}\begin{Options}{scriptsize\purerm{, \ldots,\ }Large}
70 % \item[normal]
71 % provides `normal' captions, this is the default
72 % \item[hang \purerm{or} isu]
73 % provides captions with hanging indention
74 % \item[center]
75 % provides captions where each line is centered
76 % \item[centerlast]
77 % provides captions where the last line of the paragraph is centered
78 % \item[nooneline]
79 % if a caption fits on \emph{one} line on the page, it will be centered.
80 % If you don't like this behaviour, just select this option.
81 % \item[scriptsize\purerm{, \ldots,\ }Large]
82 % sets the font size of the captions
83 % \item[\vbox{\hbox{up{\rm,} it{\rm,} sl{\rm,} sc{\rm,}}
84 % \hbox{md{\rm,} bf{\rm,} rm{\rm,} sf{\rm, or} tt}}]
85 % sets the font attribute of the caption labels.
86 % \item[ruled] supports ruled floats of the \textsf{float} package, see
87 % section \ref{sec:float} for details
88 % \end{Options}\end{quote}
89 %
90 % \changes{v1.4}{29 Jan 95}{{\tt\protect\bslash captionsize} changed to {\tt\protect\bslash captionfont}}
91 % \DescribeMacro{\captionfont}
92 % \DescribeMacro{\captionlabelfont}
93 % To setup the font size and attributes of the captions, this package also provides
94 % the commands |\captionfont| and |\captionlabelfont| to allow a more
95 % flexible way to customize the captions than the above options could do.
96 % |\captionfont| is called before each caption, |\captionlabelfont| is
97 % called just before the label of the caption, so the whole caption
98 % will be created as
99 % \begin{quote}
100 % |{\captionfont{\captionlabelfont |\meta{label}|: }|\meta{caption}|}| \quad.
101 % \end{quote}
102 % Note that these commands are used by the options, e.g.\ the options
103 % |small| and |sf| are identical to
104 % \begin{quote} |\renewcommand{\captionfont}{\small}| \quad and\\
105 % |\renewcommand{\captionlabelfont}{\sffamily}| \quad. \end{quote}
106 %
107 % \DescribeMacro{\captionmargin}
108 % Furthermore there is a new length |\captionmargin| to setup an extra left and
109 % right margin for the captions, e.g.\ the command
110 % \begin{quote} |\setlength{\captionmargin}{10pt}| \end{quote}
111 % sets this margin to 10pt.
112 %
113 % \DescribeMacro{\abovecaptionskip}
114 % \DescribeMacro{\belowcaptionskip}
115 % The lengths |\abovecaptionskip| and |\belowcaptionskip| contain the amount of
116 % white space to leave above and below the caption.
117 % |\abovecaptionskip| is preset (in the \textsf{article}, \textsf{report} and
118 % \textsf{book} document class) to 10pt, |\belowcaptionskip| to 0pt.
119 %
120 % \subsection{The \puresf{rotating}, \puresf{float} and \puresf{subfigure} package}
121 % \changes{v1.2}{28 Nov 94}{Support of the {\sf float} package}
122 % \label{sec:float}
123 %
124 % If you want to use this package together with the \textsf{rotating}\cite{rotating},
125 % \textsf{float}\cite{float} and/or the \textsf{subfigure} package, you have to
126 % input this package \emph{after} the other ones, like
127 % \begin{quote}
128 % |\usepackage{float,rotating,subfigure}|\\
129 % |\usepackage[centerlast,small,sc]{caption}|
130 % \end{quote}
131 % The \textsf{caption} package now redefines the |sidewaysfigure| and
132 % |sidewaystable| environments and the |\rotcaption| command provided
133 % by the \textsf{rotating} package from S.~Rahtz and L.~Barroca.
134 % Note that the |\captionmargin| does not affect the |\rotcaption| command.
135 %
136 % It also redefines the captions of the |plain| and |boxed| styled floats
137 % provided by the \textsf{float} package from A.~Lingnau.
138 % |ruled| floats are not supported by default, but you can change this via
139 % setting the option |ruled|.
140 % Note that the |\captionmargin| is not supported in ruled floats.
141 %
142 % \changes{v1.3}{8 Jan 95}{Support of {\tt\protect\bslash captionlabelfont} in subcaptions}
143 % If the \textsf{subfigure} package from S.D.~Cochran is detected, the options
144 % |scriptsize|, \ldots, |large| will redefine |\subcapsize| in an adequate way.
145 % If you redefine |\captionfont| by yourself and use the \textsf{subfigure}
146 % package, you also have to redefine |\subcapsize| by yourself.
147 % Also the commands |\@thesubfigure| and |\@thesubtable| will be redefined to
148 % use the |\captionlabelfont| command, please take this into consideration if
149 % you redefine |\@thesubfigure| or |\@thesubtable| by yourself.
150 % E.g.\ a adequate version of the second example in |subfigure.sty| will be:
151 % \begin{verbatim}
152 % \renewcommand{\thesubfigure}{\thefigure.\arabic{subfigure}}
153 % \makeatletter
154 % \renewcommand{\@thesubfigure}{{\captionlabelfont\thesubfigure:}\space}
155 % \renewcommand{\p@subfigure}{}
156 % \makeatother
157 % ...
158 % \end{verbatim}
159 %
160 % \changes{v1.4b}{5 Apr 95}{Adapted to version 2.8 of the rotating package}
161 % This package cooperates with the version 2.8 (1995/04/02) of the
162 % \textsf{rotating} package, version 1.2c (1995/03/29) of the \textsf{float}
163 % package and version 1.6 (1993/05/13) of the \textsf{subfigure} package,
164 % but will hopefully work with future versions, too.
165 %
166 % \section{Example}
167 % Here's an example figure which was produced with the following code in the
168 % preamble of this document:
169 % \begin{quote}
170 % |\usepackage[hang,small,bf]{caption}|\\
171 % |\setlength{\captionmargin}{20pt}|
172 % \end{quote}
173 % \begin{figure}[!ht]
174 % \centerline{EXAMPLE FIGURE}
175 % \caption[Huba]{This is an example caption with a small font and a sans serif label.
176 % The hang option was used. There is a left and right margin of 20pt.}
177 % \end{figure}
178 %
179 % \StopEventually{
180 % \begin{thebibliography}{9}
181 % \bibitem{rotating}
182 % Sebastian Rahtz and Leonor Barroca:
183 % \emph{A style option for rotated objects in \LaTeX},
184 % 1994/10/02
185 % \bibitem{float}
186 % Anselm Lingnau:
187 % \emph{An Improved Environment for Floats},
188 % 1995/03/25
189 % \bibitem{A-W:GMS94}
190 % Michel Goossens, Frank Mittelbach and Alexander Samarin:
191 % \newblock {\em The {\LaTeX} Companion},
192 % \newblock Addison-Wesley, Reading, Massachusetts, 1994.
193 % \bibitem{Anne}
194 % Anne Br\"uggemann-Klein:
195 % \emph{Einf\"uhrung in die Dokumentverarbeitung},
196 % B.G. Teubner, Stuttgart, 1989
197 % \bibitem{Kopka-E}
198 % Helmut Kopka:
199 % \emph{\LaTeX -- Erweiterungsm\"oglichkeiten},
200 % 3. \"uberarbeitete Auf\/lage, Addison-Wesley, Bonn, 1991
201 % \end{thebibliography}
202 % }
203 % \setlength{\parskip}{0pt plus 1pt}
204 %
205 % \CheckSum{295}
206 % \DoNotIndex{\\,\_,\ }
207 % \DoNotIndex{\p@}
208 % \DoNotIndex{\active,\addtolength,\begin,\bfseries}
209 % \DoNotIndex{\catcode,\def,\else,\empty,\end,\fi,\footnotesize,\global}
210 % \DoNotIndex{\hangindent,\hspace,\ifcase,\ifdim,\ifx,\itshape}
211 % \DoNotIndex{\Large,\large,\leavevmode,\leftskip,\let,\linewidth}
212 % \DoNotIndex{\mdseries,\newcommand,\newlength,\newsavebox,\noindent,\normalsize}
213 % \DoNotIndex{\or,\par,\parbox,\parfillskip,\renewcommand,\rightskip,\rmfamily}
214 % \DoNotIndex{\sbox,\scriptsize,\scshape,\setlength,\sffamily,\slshape,\small,\space}
215 % \DoNotIndex{\textheight,\typeout,\ttfamily,\undefined,\upshape,\usebox}
216 % \DoNotIndex{\vsize,\vskip,\wd}
217 % \DoNotIndex{\AtBeginDocument,\DeclareOption,\ExecuteOptions,\NeedsTeXFormat}
218 % \DoNotIndex{\ProcessOptions,\ProvidesPackage}
219 %
220 % \section{The code}
221 % \iffalse
222 %<*package>
223 % \fi
224 %
225 % \subsection{Identification}
226 % \begin{macrocode}
227 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
228 \ProvidesPackage{caption}[1995/04/05 v1.4b caption package (AS)]
229 % \end{macrocode}
230 %
231 % \subsection{Initial code}
232 % \begin{macro}{\captionfont}
233 % \begin{macro}{\captionlabelfont}
234 % \begin{macro}{\captionmargin}
235 % |\captionsize| is defined for backward compatibility with v1.3
236 % of this package.
237 % \begin{macrocode}
238 \newcommand{\captionsize}{}
239 \newcommand{\captionfont}{\captionsize}
240 \newcommand{\captionlabelfont}{}
241 \newlength{\captionmargin}
242 % \end{macrocode}
243 % \end{macro}
244 % \end{macro}
245 % \end{macro}
246 %
247 % Here are the different basic types of captions implemented:
248 % \begin{macro}{\as@normalcaption}
249 % \changes{v1.4a}{12 Feb 95}{{\tt\protect\bslash par} added}
250 % The `normal' caption
251 % \begin{macrocode}
252 \newcommand{\as@normalcaption}[2]{%
253 #1 #2\par}
254 % \end{macrocode}
255 % \end{macro}
256 % \begin{macro}{\as@isucaption}
257 % \changes{v1.4}{27 Jan 95}{{\tt\protect\bslash leavevmode} added}
258 % The `iso' or `hang' caption;
259 % this code was taken from \LaTeXcomp\cite[p155]{A-W:GMS94} and modified
260 % \iffalse
261 % \hangindent\wd\as@captionbox\noindent\usebox{\as@captionbox}#2}
262 % \fi
263 % \begin{macrocode}
264 \newcommand{\as@isucaption}[2]{%
265 \sbox{\as@captionbox}{#1\space}%
266 \addtolength{\as@captionwidth}{-\wd\as@captionbox}%
267 \usebox{\as@captionbox}\parbox[t]{\as@captionwidth}{\leavevmode#2}}
268 % \end{macrocode}
269 % \end{macro}
270 % \begin{macro}{\as@centercaption}
271 % \changes{v1.4a}{12 Feb 95}{{\tt center} environment changed to {\tt\protect\bslash centering}}
272 % The `center' caption
273 % \begin{macrocode}
274 \newcommand{\as@centercaption}[2]{%
275 \parbox[t]{\as@captionwidth}{{\centering#1 #2\par}}}
276 % \end{macrocode}
277 % \end{macro}
278 % \begin{macro}{\as@annecaption}
279 % \changes{v1.4a}{12 Feb 95}{{\tt\protect\bslash par} added}
280 % The `centerlast' caption; the idea how to do this was taken from Br\"uggemann-Klein\cite{Anne},
281 % it is also mentioned in Kopka\cite[p227]{Kopka-E}
282 % \begin{macrocode}
283 \newcommand{\as@annecaption}[2]{%
284 \addtolength{\leftskip}{0pt plus 1fil}%
285 \addtolength{\rightskip}{0pt plus -1fil}%
286 \setlength{\parfillskip}{0pt plus 2fil}%
287 #1 #2\par}
288 % \end{macrocode}
289 % \end{macro}
290 % \begin{macro}{\as@shortcaption}
291 % Short captions are centered by default
292 % \begin{macrocode}
293 \let\as@shortcaption\as@centercaption
294 % \end{macrocode}
295 % \end{macro}
296 %
297 % \subsection{Detection of the \puresf{subfigure} package}
298 % \begin{macro}{\as@subcapsize}
299 % \begin{macro}{\@thesubfigure}
300 % \begin{macro}{\@thesubtable}
301 % If the \textsf{subfigure} package is loaded, a little message will be typeout
302 % and |\as@subcapsize| -- which sets the size of the subcaptions -- will be
303 % defined. Also |\@thesubfigure| and |\@thesubtable| will be redefined here to
304 % support the |\captionlabelfont| in subcaptions, too (thanks to Kevin Ruland for
305 % this idea!).
306 % If you don't like this behaviour, just load the |caption| package \emph{after}
307 % the |subfigure| package (and eventually redefine the |\subcapsize| by yourself)
308 % or redefine |\@thesubfigure| and |\@thesubtable| after loading the |caption|
309 % package as shown in the documentation of the \textsf{subfigure} package.
310 % \begin{macrocode}
311 \ifx\thesubfigure\undefined
312 \newcommand{\as@subcapsize}[1]{}
313 \else%
314 \typeout{\space\space\space\space\space\space\space\space\space
315 `subfigure' package detected}
316 \let\as@subcapsize\subcapsize
317 \renewcommand{\@thesubfigure}{{\captionlabelfont\thesubfigure}\space}
318 \renewcommand{\@thesubtable}{{\captionlabelfont\thesubtable}\space}
319 \fi
320 % \end{macrocode}
321 % \end{macro}
322 % \end{macro}
323 % \end{macro}
324 %
325 % \subsection{Declaration of options}
326 % There are four different types of captions supported: |normal|,
327 % |isu|, |center| and |centerlast|. |hang| is exactly the same as |isu|.
328 % \begin{macrocode}
329 \DeclareOption{normal}{\let\as@caption\as@normalcaption}
330 \DeclareOption{isu}{\let\as@caption\as@isucaption}
331 \DeclareOption{hang}{\ExecuteOptions{isu}}
332 \DeclareOption{center}{\let\as@caption\as@centercaption}
333 \DeclareOption{anne}{\let\as@caption\as@annecaption}
334 \DeclareOption{centerlast}{\ExecuteOptions{anne}}
335 % \end{macrocode}
336 % If option |nooneline| is set, only-one-line captions will behave like normal
337 % ones.
338 % \begin{macrocode}
339 \DeclareOption{nooneline}{\AtBeginDocument{\let\as@shortcaption\as@caption}}
340 % \end{macrocode}
341 % There are options for six different font sizes available, they also
342 % redefine the |\subcapsize| provided by the \textsf{subfigure} package
343 % (if detected).
344 % \begin{macrocode}
345 \DeclareOption{scriptsize}{%
346 \renewcommand{\captionsize}{\scriptsize}
347 \as@subcapsize{\scriptsize}}
348 \DeclareOption{footnotesize}{%
349 \renewcommand{\captionsize}{\footnotesize}
350 \as@subcapsize{\scriptsize}}
351 \DeclareOption{small}{%
352 \renewcommand{\captionsize}{\small}
353 \as@subcapsize{\footnotesize}}
354 \DeclareOption{normalsize}{%
355 \renewcommand{\captionsize}{\normalsize}
356 \as@subcapsize{\footnotesize}}
357 \DeclareOption{large}{%
358 \renewcommand{\captionsize}{\large}
359 \as@subcapsize{\normalsize}}
360 \DeclareOption{Large}{%
361 \renewcommand{\captionsize}{\Large}
362 \as@subcapsize{\large}}
363 % \end{macrocode}
364 % There are nine options available to set the font attributes of the caption labels.
365 % \begin{macrocode}
366 \DeclareOption{up}{\renewcommand{\captionlabelfont}{\upshape}}
367 \DeclareOption{it}{\renewcommand{\captionlabelfont}{\itshape}}
368 \DeclareOption{sl}{\renewcommand{\captionlabelfont}{\slshape}}
369 \DeclareOption{sc}{\renewcommand{\captionlabelfont}{\scshape}}
370 \DeclareOption{md}{\renewcommand{\captionlabelfont}{\mdseries}}
371 \DeclareOption{bf}{\renewcommand{\captionlabelfont}{\bfseries}}
372 \DeclareOption{rm}{\renewcommand{\captionlabelfont}{\rmfamily}}
373 \DeclareOption{sf}{\renewcommand{\captionlabelfont}{\sffamily}}
374 \DeclareOption{tt}{\renewcommand{\captionlabelfont}{\ttfamily}}
375 % \end{macrocode}
376 % If the option |ruled| is set, the captions of ruled floats provided
377 % by the \textsf{float} package will also be supported.
378 % \begin{macrocode}
379 \DeclareOption{ruled}{\newcommand\as@ruled{}}
380 % \end{macrocode}
381 %
382 % \subsection{Execution of options}
383 % The `normal' type of caption is preselected.
384 % \begin{macrocode}
385 \ExecuteOptions{normal}
386 \ProcessOptions
387 % \end{macrocode}
388 %
389 % \subsection{Main code}
390 % \begin{macro}{\as@captionbox}
391 % \begin{macro}{\as@captionwidth}
392 % \begin{macro}{\as@makecaption}
393 % \begin{macro}{\@makecaption}
394 % \changes{v1.4}{30 Jan 95}{{\tt center} environment changed to {\tt\protect\bslash as@shortcaption}}
395 % \changes{v1.4a}{12 Feb 95}{{\tt\protect\bslash par} removed}
396 % And now \ldots\ it's \ldots\ the new |\@makecaption| code!
397 % \begin{macrocode}
398 \newsavebox{\as@captionbox}
399 \newlength{\as@captionwidth}
400 \newcommand{\as@makecaption}[2]{%
401 \setlength{\leftskip}{\captionmargin}%
402 \setlength{\rightskip}{\captionmargin}%
403 \addtolength{\as@captionwidth}{-2\captionmargin}%
404 \captionfont%
405 \sbox{\as@captionbox}{{\captionlabelfont #1:} #2}%
406 \ifdim \wd\as@captionbox >\as@captionwidth
407 \as@caption{{\captionlabelfont #1:}}{#2}%
408 \else%
409 \as@shortcaption{{\captionlabelfont #1:}}{#2}%
410 \fi}
411 \renewcommand{\@makecaption}[2]{%
412 \vskip\abovecaptionskip%
413 \setlength{\as@captionwidth}{\linewidth}%
414 \as@makecaption{#1}{#2}%
415 \vskip\belowcaptionskip}
416 % \end{macrocode}
417 % \end{macro}
418 % \end{macro}
419 % \end{macro}
420 % \end{macro}
421 %
422 % \subsection{Support of the \puresf{rotating} package}
423 % \begin{macro}{\@makercaption}
424 % \changes{v1.4b}{5 Apr 95}{{\tt\protect\bslash @makercaption} removed}
425 % \begin{macro}{\@makerotcaption}
426 % If the \textsf{rotating} package is loaded, the command |\@makerotcaption|
427 % (for support of |\rotcaption|) will be
428 % redefined here. The code was taken from the \textsf{rotating} package
429 % \cite{rotating} itself and adapted.
430 % \begin{macrocode}
431 \ifx\@makerotcaption\undefined
432 \else
433 \typeout{\space\space\space\space\space\space\space\space\space
434 `rotating' package detected}
435 % \let\@makercaption\undefined
436 \renewcommand{\@makerotcaption}[2]{%
437 \captionfont%
438 \sbox{\as@captionbox}{{\captionlabelfont #1:} #2}%
439 \ifdim \wd\as@captionbox > .8\vsize
440 \rotatebox{90}{%
441 \setlength{\as@captionwidth}{.8\textheight}%
442 \begin{minipage}{\as@captionwidth}%
443 \as@caption{{\captionlabelfont #1:}}{#2}%
444 \end{minipage}}\par
445 \else%
446 \rotatebox{90}{\usebox{\as@captionbox}}%
447 \fi
448 \hspace{12pt}}
449 \fi
450 % \end{macrocode}
451 % \end{macro}
452 % \end{macro}
453 %
454 % \subsection{Support of the \puresf{float} package}
455 % \begin{macro}{\floatc@plain}
456 % \begin{macro}{\floatc@ruled}
457 % \changes{v1.3}{8 Jan 95}{{\tt\protect\bslash as@normalcaption} changed to {\tt\protect\bslash as@caption}}
458 % \changes{v1.4a}{12 Feb 95}{{\tt\protect\bslash par} removed}
459 % If the \textsf{float} package is loaded, the command |\floatc@plain|
460 % (and the command |\floatc@ruled| if the option |ruled| is given)
461 % will be redefined here.
462 % \begin{macrocode}
463 \ifx\floatc@plain\undefined
464 \else
465 \typeout{\space\space\space\space\space\space\space\space\space
466 `float' package detected}
467 \renewcommand\floatc@plain[2]{%
468 \setlength{\as@captionwidth}{\linewidth}%
469 \as@makecaption{#1}{#2}}
470 \ifx\as@ruled\undefined
471 \else
472 \renewcommand\floatc@ruled[2]{%
473 \setlength{\as@captionwidth}{\linewidth}%
474 \captionfont%
475 \as@caption{{\captionlabelfont #1:}}{#2}}
476 \fi
477 \fi
478 % \end{macrocode}
479 % \end{macro}
480 % \end{macro}
481 %
482 % \iffalse
483 %</package>
484 % \fi
485 %
486 % \Finale
487 %
488 \endinput
489