Debian Codegraph @

texmf-dist/source/latex/ccaption/ccaption.dtx

raw
1 % \iffalse meta-comment
2 %
3 % ccaption.dtx
4 % Author: Peter Wilson (Herries Press)
5 % Maintainer: Will Robertson (will dot robertson at latex-project dot org)
6 % Copyright 1998-2005 Peter R. Wilson
7 % Copyright 2011 Will Robertson
8 %
9 % This work may be distributed and/or modified under the
10 % conditions of the LaTeX Project Public License, either
11 % version 1.3c of this license or (at your option) any
12 % later version: <http://www.latex-project.org/lppl.txt>
13 %
14 % This work has the LPPL maintenance status "maintained".
15 % The Current Maintainer of this work is Will Robertson.
16 %
17 % This work consists of the files listed in the README file.
18 %
19 %
20 %<*driver>
21 \NeedsTeXFormat{LaTeX2e}
22 \ProvidesFile{ccaption.dtx}
23 %</driver>
24 %<usc>\ProvidesPackage{ccaption}
25 %<*usc>
26 [2011/08/07 v3.2c Extended captioning and new floats]
27 %</usc>
28 %<*driver>
29 \documentclass[twoside]{ltxdoc}
30 \usepackage{url}
31 \usepackage[draft=false,
32 plainpages=false,
33 pdfpagelabels,
34 bookmarksnumbered,
35 hyperindex=false,
36 linktocpage=true,
37 ]{hyperref}
38 \providecommand{\phantomsection}{}
39 \makeatletter
40 \@mparswitchfalse
41 \makeatother
42 % a simpler version of chngpage,sty's adjustwidth
43 \newenvironment{addtomargins}[1]{
44 \begin{list}{}{%
45 \topsep 0pt
46 \addtolength{\leftmargin}{#1}%
47 \addtolength{\rightmargin}{#1}%
48 \listparindent\parindent
49 \itemindent\parindent
50 \parsep\parskip
51 }%
52 \item[]}{\end{list}}
53 \usepackage{ccaption}
54 %%\usepackage[subfigure]{ccaption}
55 %%\usepackage{subfigure}
56 \EnableCrossrefs
57 \CodelineIndex
58 \RecordChanges
59 \renewcommand{\MakeUppercase}[1]{#1}
60 \pagestyle{headings}
61 \setcounter{StandardModuleDepth}{1}
62 %\setcounter{IndexColumns}{2}
63 \begin{document}
64 \raggedbottom
65 \DocInput{ccaption.dtx}
66 \end{document}
67 %</driver>
68 %
69 % \fi
70 %
71 % \CheckSum{1457}
72 %
73 % \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
74 % \DoNotIndex{\@centercr,\@cite}
75 % \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
76 % \DoNotIndex{\@input,\@ixpt,\@m}
77 % \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
78 % \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
79 % \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
80 % \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
81 % \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
82 % \DoNotIndex{\advance,\Alph,\alph}
83 % \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
84 % \DoNotIndex{\bullet}
85 % \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
86 % \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
87 % \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
88 % \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
89 % \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
90 % \DoNotIndex{\fbox}
91 % \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
92 % \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
93 % \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
94 % \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
95 % \DoNotIndex{\input}
96 % \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
97 % \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
98 % \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
99 % \DoNotIndex{\NeedsTeXFormat,\newdimen}
100 % \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
101 % \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
102 % \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
103 % \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
104 % \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
105 % \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
106 % \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
107 % \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
108 % \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
109 % \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
110 % \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
111 % \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
112 % \DoNotIndex{\wd,\xiipt,\year,\z@}
113 %
114 % \changes{v11}{1997/09/30}{Output character table to class and package files only}
115 % \changes{v2.1}{1998/10/14}{Added legends}
116 % \changes{v2.2}{1998/12/19}{Added fixed captions and new floats}
117 % \changes{v2.2a}{1999/01/23}{Improved documentation}
118 % \changes{v2.3}{1999/01/24}{Added namedlegend command}
119 % \changes{v2.3a}{1999/08/06}{Fixed uppercasing bug. Changed UpperCase to MakeUppercase}
120 % \changes{v2.4}{1999/09/20}{Added subfigure v2.0 package support}
121 % \changes{v2.5}{2000/02/20}{Added subfigure v2.1 package support}
122 % \changes{v2.6}{2000/02/26}{Added bilingual captions}
123 % \changes{v2.6a}{2000/02/29}{Improved facilities for subfigure captions}
124 % \changes{v2.6b}{2000/02/29}{Facility to define new subfloat captions}
125 % \changes{v2.6c}{2000/02/29}{Fixed potential failures in empty argument test}
126 % \changes{v2.6d}{2001/01/02}{Fixed fragile failures in contsub... commands}
127 % \changes{v2.6d}{2001/01/02}{Fixed problem with continued captions in new floats with subfigure 2.1}
128 % \changes{v2.6e}{2001/01/12}{Fixed problem with new floats and hyperref}
129 % \changes{v2.7}{2001/02/24}{Subsumes caption2 functions}
130 % \changes{v3.0}{2001/03/03}{Major revision of new float code to match the tocloft package}
131 % \changes{v3.0a}{2001/08/03}{Fix for \cs{@tempa} with old amsmath package}
132 % \changes{v3.1}{2002/02/20}{Support for released subfigure v2.1 package}
133 % \changes{v3.1a}{2002/04/01}{Support for subfigure v2.1.2 package}
134 % \changes{v3.1b}{2002/10/18}{Fixed bug wrt brackets in argument to
135 % \cs{caption} with subfigure option}
136 % \changes{v3.1c}{2003/11/14}{Made \cs{label} work after \cs{contcaption}}
137 % \changes{v3.2}{2005/03/21}{Support for bilingual captions in longtable}
138 % \changes{v3.2a}{2005/03/29}{Fix bicaption labels}
139 % \changes{v3.2b}{2009/09/02}{New maintainer (Will Robertson)}
140 %
141 % \def\dtxfile{ccaption.dtx}
142 % \GetFileInfo{\dtxfile}
143 % \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
144 % \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
145 % \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
146 % \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
147 % \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
148 % \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
149 % \newcommand*{\pname}{ccaption} ^^A name of the package
150 %
151 % \title{The \Lpack{\pname} package}
152 % \author{%
153 % Author: Peter Wilson, Herries Press\\
154 % Maintainer: Will Robertson\\
155 % \texttt{will dot robertson at latex-project dot org}
156 % }
157 % \date{\fileversion\qquad\filedate}
158 % \maketitle
159 % \begin{abstract}
160 % The \Lpack{\pname} package enables restyling of captions and
161 % provides for `continuation' captions,
162 % unnumbered captions, bilingual captions, and
163 % an `anonymous' caption (a legend) that can be used in any
164 % environment. It also provides commands to define captions
165 % that can be used outside float environments as well as
166 % a mechanism for creating new types of float environments and subfloats.
167 %
168 % The package has been tested in conjunction with the
169 % \Lpack{tocloft}, \Lpack{rotating},
170 % \Lpack{caption2}, \Lpack{sidecap}, \Lpack{subfigure}, \Lpack{endfloat},
171 % \Lpack{longtable}, \Lpack{xtab} and \Lpack{hyperref}
172 % packages.
173 % \end{abstract}
174 % \tableofcontents
175 % \listoftables
176 % \listoffigures
177 %
178 % \StopEventually{}
179 %
180 % \section{Introduction}
181 %
182 % Some publishers require and some authors prefer captioning styles
183 % other than the one style provided by LaTeX. The \Lpack{\pname}
184 % package provides the tools to design your own captioning styles.
185 %
186 % Some publishers require that documents that include multi-part
187 % tables use a \textit{continuation caption} on all but the first
188 % part of the multi-part table. For the times where such a table
189 % is specified by the author as a set of tables, the \Lpack{\pname} package
190 % provides a simple `continuation' caption command to meet this
191 % requirement. It also provides
192 % a facility for an `anonymous' caption which can be used in any
193 % float environment. The package has been tested with the
194 % \Lpack{rotating}, \Lpack{caption2}, \Lpack{sidecap},
195 % \Lpack{subfigure} (v2.0 and the current version),
196 % \Lpack{endfloat}, \Lpack{longtable}, \Lpack{xtab}
197 % and the \Lpack{hyperref} packages.
198 %
199 % Captions can be defined that are suitable for use in non-float
200 % environments, such as placing a picture in a minipage and captioning
201 % it just as though it had been put into a normal figure environment.
202 % Further, a mechanism is provided for defining new float environments.
203 %
204 %
205 % These facilities were originally developed in support of a suite
206 % for typesetting ISO international standard~\cite{PRW96i},
207 % but they are generally applicable.
208 % This manual is typeset according to the conventions of the
209 % LaTeX \textsc{docstrip} utility which enables the automatic
210 % extraction of the LaTeX macro source files~\cite{GOOSSENS94}.
211 %
212 % Section~\ref{sec:usc} provides a short overview of the commands
213 % in the package and shows some examples of their use. This section
214 % also gives examples of how LaTeX's captioning style can be changed
215 % to a limited extent without the use of any package and provides
216 % general information on floats. For a more comprehensive description
217 % of floats read Keith Reckdahl's excellent \textit{Using Imported
218 % Graphics in LaTeX2e}~\cite{EPSLATEX},
219 % although this was written before the advent
220 % of the \Lpack{ccaption} package.
221 % The implementation is given in Section~\ref{sec:code}.
222 %
223 % \section{The \Lpack{\pname} package} \label{sec:usc}
224 %
225 % \subsection{Options}
226 %
227 % The package may take one or more options, depending on which other
228 % packages are used in conjunction with \Lpack{\pname}. The options are
229 % designed so that the package loading order does not matter.
230 % The current options are:
231 % \begin{itemize}
232 % \item[\Lopt{subfigure}] for use with the current version
233 % of Steven Douglas Cochran's \Lpack{subfigure} package~\cite{SUBFIGURE}.
234 % \item[\Lopt{subfigure20}] when used together with the old
235 % version~2.0 of the \Lpack{subfigure} package.
236 % \item[\Lopt{caption2}] when used together with Harald Axel Sommerfeldt's
237 % \Lopt{caption} or \Lopt{caption2} package~\cite{CAPTION2}.
238 % \item[\Lopt{titles}] When new floats, and their corresponding
239 % `List of\ldots', are defined, the list headings may be individually
240 % configured. The \Lopt{titles} option disables the configuration
241 % mechanism. This may be useful if, say, the \Lpack{fncychap} package
242 % is used to redefine the appearance of chapter titles.
243 % \end{itemize}
244 %
245 % For example, if the package is being used
246 % with both \Lpack{subfigure} version~2.1 and \Lpack{caption} then it
247 % should be called as: \\
248 % |\usepackage[subfigure,caption2]{ccaption}|
249 %
250 % \subsection{Changing the caption style}
251 %
252 % The discussion in \S\ref{sec:ltx} includes example methods for
253 % changing the typeset appearance of captions without the benefit of
254 % any package. The \Lpack{caption2} and \Lpack{caption} packages
255 % provides a set of predefined
256 % captioning styles, and the \Lopt{\pname} package
257 % also provides an easy means
258 % of changing the style.
259 %
260 % The style of subcaptions is controlled by the
261 % \Lpack{subfigure} package.
262 %
263 % \emph{Note that if the \Lopt{caption2} option is used
264 % then it is assumed that the \Lpack{caption(2)} package is being used
265 % and the facilities described in this section are unavailable.}
266 %
267 % \DescribeMacro{\captiondelim}
268 % The default captioning style is to put a delimeter in the form
269 % of a colon between the caption
270 % number and the caption title. The command |\captiondelim{|\meta{delim}|}|
271 % can be used to change the delimeter. For example, to have an en-dash instead
272 % \verb*?\captiondelim{-- }? will do the trick. Notice that no space is
273 % put between the delimeter and the title unless it is specified in the
274 % \meta{delim} parameter.
275 % The package initially specifies |\captiondelim{: }|
276 % to give the normal delimeter.
277 %
278 % \DescribeMacro{\captionnamefont}
279 % The \meta{font} specified by |\captionnamefont{|\meta{font}|}| is used
280 % for typesetting the caption name; that is, the first part of the caption
281 % upto and including the delimeter (e.g., the portion `Table 3:').
282 % \meta{font} can be any kind of font specification and/or command and/or
283 % text. This first part of the caption is treated like: |{<font> Table 3; }|,
284 % so font declarations, not font text-style commands, are needed,
285 % like |\captionnamefont{\Large\sffamily}| to specify a large sans-serif font.
286 % The package initially specifies |\captionnamefont{}|
287 % to give the normal font.
288 %
289 %
290 % \DescribeMacro{\captiontitlefont}
291 % Similarly, the \meta{font} specified by |\captiontitlefont{|\meta{font}|}|
292 % is used for typesetting the title text of a caption. For example,
293 % |\captiontitlefont{\itshape}| for an italic title text.
294 % The package initially specifies |\captiontitlefont{}|
295 % to give the normal font.
296 %
297 % \DescribeMacro{\captionstyle}
298 % By default the name and title of a caption are typeset as a block
299 % (non-indented)
300 % paragraph. |\captionstyle{|\meta{style}|}| can be used to alter this.
301 % Sensible values for \meta{style} are: |\centering|, |\raggedleft| or
302 % |\raggedright| for styles corresponding to these declarations.
303 % The |\centerlastline| style gives a block paragraph but with the last line
304 % centered.
305 % The package initially specifies |\captionstyle{}|
306 % to give the normal block paragraph style.
307 %
308 % \DescribeMacro{\hangcaption}
309 % \DescribeMacro{\indentcaption}
310 % \DescribeMacro{\normalcaption}
311 % The command |\hangcaption| will cause captions to be typeset with the second
312 % and later lines of a multiline caption title indented by the width
313 % of the caption name. The command |\indentcaption{|\meta{length}|}|
314 % will indent title lines after the first by \meta{length}. These
315 % commands are independent of the |\captionstyle{...}|. Note that a
316 % caption will not be simultaneously hung and indented. The |\normalcaption|
317 % command undoes any previous |\hangcaption| or |\indentcaption| command.
318 % The package initially specifies |\normalcaption|
319 % to give the normal non-indented paragraph style.
320 %
321 % \DescribeMacro{\changecaptionwidth}
322 % \DescribeMacro{\normalcaptionwidth}
323 % \DescribeMacro{\captionwidth}
324 % Issuing the command |\changecaptionwidth| will cause the captions to
325 % be typeset within a total width \meta{length} as specified by
326 % |\captionwidth{|\meta{length}|}|. Issuing the command |\normalcaptionwidth|
327 % will cause captions to be typeset as normal full width captions.
328 % The package initially specifies |\normalcaptionwidth| and
329 % |\captionwidth{\linewidth}|
330 % to give the normal width. If a caption is being set within the
331 % side captioned environments from the \Lpack{sidecap} package~\cite{SIDECAP}
332 % then it must be a |\normalcaptionwidth| caption.
333 %
334 % \DescribeMacro{\precaption}
335 % \DescribeMacro{\postcaption}
336 % The commands |\precaption{|\meta{pretext}|}| and
337 % |\postcaption{|\meta{posttext}|}|
338 % specify \meta{pretext} and \meta{posttext} that will be processed at the
339 % start and end of a caption. For example \\
340 % |\precaption{\rule{\linewidth}{0.4pt}\par}| \\
341 % |\postcaption{\rule{\linewidth}{0.4pt}}| \\
342 % will draw a horizontal line above and below the captions.
343 % The package initially specifies |\precaption{}| and |\postcaption{}|
344 % to give the normal appearance.
345 %
346 %
347 % If any of the above commands are used in a float, or other, environment
348 % their effect is limited to the environment. If they are used in the preamble
349 % or the main text, their effect persists until replaced by a similar
350 % command with a different parameter value. The commands do not affect the
351 % apperance of the title in any \textbf{List of\ldots}.
352 %
353 % \DescribeMacro{\\}
354 % The normal LaTeX command |\\[|\meta{length}|]| can be used within the
355 % caption text to start a new line. Remember that |\\| is a fragile
356 % command, so if it is
357 % used within text that will be added to a \textbf{List of\ldots}
358 % it must be protected.
359 % As examples: \\
360 % |\caption{Title with a \protect\\ new line in both the body and List of}| \\
361 % |\caption[List of entry with no new line]{Title with a \\ new line}| \\
362 % |\caption[List of entry with a \protect\\ new line]{Title text}|
363 %
364 % Effectively, a caption is typeset as though it were:
365 % \begin{verbatim}
366 % \precaption
367 % {\captionnamefont NAME NUMBER \captiondelim}
368 % {\captionstyle\captiontitlefont THE TITLE}
369 % \postcaption
370 % \end{verbatim}
371 % Replacing the above commands by their defaults leads to the simple
372 % format: \\
373 % |{NAME NUMBER: }{THE TITLE}|
374 %
375 % As well as using the styling commands to make simple changes to the
376 % captioning style more noticeable modifications can also be made.
377 % To change the captioning style so that the name and title are typeset in
378 % a sans font it is sufficient to do:
379 % \begin{verbatim}
380 % \captionnamefont{\sffamily}
381 % \captiontitlefont{\sffamily}
382 % \end{verbatim}
383 %
384 % \begin{table}
385 % \centering
386 % \captionnamefont{\sffamily}
387 % \captiondelim{}
388 % \captionstyle{\\}
389 % \captiontitlefont{\scshape}
390 % \setlength{\belowcaptionskip}{10pt}
391 % \caption{Redesigned table caption style} \label{tab:style}
392 % \begin{tabular}{lr} \hline
393 % three & III \\
394 % five & V \\
395 % eight & VIII \\ \hline
396 % \end{tabular}
397 % \end{table}
398 %
399 % A more obvious change in styling is shown in table~\ref{tab:style},
400 % which was coded as:
401 % \begin{verbatim}
402 % \begin{table}
403 % \centering
404 % \captionnamefont{\sffamily}
405 % \captiondelim{}
406 % \captionstyle{\\}
407 % \captiontitlefont{\scshape}
408 % \setlength{\belowcaptionskip}{10pt}
409 % \caption{Redesigned table caption style} \label{tab:style}
410 % \begin{tabular}{lr} \hline
411 % ...
412 % \end{table}
413 % \end{verbatim}
414 % This leads to the approximate caption format (processed within |\centering|): \\
415 % |{\sffamily NAME NUMBER}{\\ \scshape THE TITLE}| \\
416 % Note that the newline command (|\\|) cannot be put in the first part
417 % of the format (i.e., the |{\sffamily NAME NUMBER}|); it has to go into
418 % the second part, which is why it is specified via |\captionstyle{\\}|
419 % and not |\captiondelim{\\}|.
420 %
421 % If a mixture of captioning styles will be used you may want to
422 % define a special caption command for each non-standard style. For
423 % example for the style of the caption in table~\ref{tab:style}:
424 % \begin{verbatim}
425 % \newcommand{\mycaption}[2][\@empty]{%
426 % \captionnamefont{\sffamily\hfill}
427 % \captiondelim{\hfill}
428 % \captionstyle{\centerlastline\\}
429 % \captiontitlefont{\scshape}
430 % \setlength{\belowcaptionskip}{10pt}
431 % \ifx\@empty#1 \caption{#2}\else \caption[#1]{#2}}
432 % \end{verbatim}
433 % \textbf{NOTE:} Any code that involves the |@| sign must be either in
434 % a package (|.sty|) file or enclosed between a |\makeatletter| \ldots
435 % |\makeatother| pairing.
436 %
437 % The code for the table~\ref{tab:style} example can now be written as:
438 % \begin{verbatim}
439 % \begin{table}
440 % \centering
441 % \mycaption{Redesigned table caption style} \label{tab:style}
442 % \begin{tabular}{lr} \hline
443 % ...
444 % \end{table}
445 % \end{verbatim}
446 % Note that in the code for |\mycaption| I have added two
447 % |\hfill| commands and |\centerlastline| compared with the original
448 % specification.
449 % It turned out that the original definitions
450 % worked for a single line caption but not for a multiline caption.
451 % The additional commands makes it work in both cases, forcing the
452 % name to be centered as well as the last line of a multiline title,
453 % thus giving a balanced appearence.
454 %
455 %
456 %
457 %
458 % \subsection{Continuation captions and legends}
459 %
460 % \DescribeMacro{\contcaption}
461 % The |\contcaption{|\meta{text}|}| command can be used to put
462 % a `continuation' or `concluded'
463 % caption into a float environment. It neither increments the
464 % float number nor makes any entry into a float listing, but it
465 % does repeat the numbering of the previous |\caption| command.
466 %
467 %
468 % Table~\ref{tab:m} illustrates the use of the |\contcaption|
469 % command. The table was produced from the following code.
470 % \begin{verbatim}
471 % \begin{table}
472 % \centering
473 % \caption{A multi-part table} \label{tab:m}
474 % \begin{tabular}{lc} \hline
475 % just a single line & 1 \\ \hline
476 % \end{tabular}
477 % \end{table}
478 %
479 % \begin{table}
480 % \centering
481 % \contcaption{Continued}
482 % \begin{tabular}{lc} \hline
483 % just a single line & 2 \\ \hline
484 % \end{tabular}
485 % \end{table}
486 %
487 % \begin{table}
488 % \centering
489 % \contcaption{Concluded}
490 % \begin{tabular}{lc} \hline
491 % just a single line & 3 \\ \hline
492 % \end{tabular}
493 % \end{table}
494 % \end{verbatim}
495 %
496 % \begin{table}
497 % \centering
498 % \caption{A multi-part table} \label{tab:m}
499 % \begin{tabular}{lc} \hline
500 % just a single line & 1 \\ \hline
501 % \end{tabular}
502 % \end{table}
503 %
504 % \begin{table}
505 % \centering
506 % \contcaption{Continued}
507 % \begin{tabular}{lc} \hline
508 % just a single line & 2 \\ \hline
509 % \end{tabular}
510 % \end{table}
511 %
512 % \begin{table}
513 % \centering
514 % \contcaption{Concluded}
515 % \begin{tabular}{lc} \hline
516 % just a single line & 3 \\ \hline
517 % \end{tabular}
518 % \end{table}
519 %
520 % \DescribeMacro{\legend}
521 % The |\legend{|\meta{text}|}| command is intended to be used to put an
522 % anonymous
523 % caption into a float environment, but may be used anywhere.
524 %
525 % \begin{table}
526 % \centering
527 % \caption{Another table} \label{tab:legend}
528 % \begin{tabular}{lc} \hline
529 % A legendary table & 5 \\
530 % with two lines & 6 \\ \hline
531 % \end{tabular}
532 % \legend{The legend}
533 % \end{table}
534 %
535 % For example, the following code was used to produce the two-line
536 % table~\ref{tab:legend}. The |\legend| command can be used within a float
537 % independently of any |\caption| command.
538 % \begin{verbatim}
539 % \begin{table}
540 % \centering
541 % \caption{Another table} \label{tab:legend}
542 % \begin{tabular}{lc} \hline
543 % A legendary table & 5 \\
544 % with two lines & 6 \\ \hline
545 % \end{tabular}
546 % \legend{The legend}
547 % \end{table}
548 % \end{verbatim}
549 %
550 % \marginpar{\legend{Title legend}
551 % This is a marginal note with a legend.}
552 %
553 % Captioned floats are usually thought of in terms of the |table|
554 % and |figure| environments. There can be other kinds of float.
555 % As perhaps a more interesting example, the following code produces
556 % the titled marginal note which should be displayed near here.
557 % \begin{verbatim}
558 % \marginpar{\legend{Title legend}
559 % This is a marginal note with a legend.}
560 % \end{verbatim}
561 %
562 % You can even \legend{Legend in running text} use the |\legend|
563 % command in running text, as has been done in this sentence,
564 % but I'm not sure why one might want to do that as LaTeX already
565 % provides the |center| environment.
566 %
567 % If you want the legend text to be included in the \textbf{List of\ldots}
568 % use the |\addcontentsline| command in conjunction with the
569 % |\legend|. For example:
570 % \begin{verbatim}
571 % \addcontentsline{lot}{table}{Titling text} % left justifified
572 % \addcontentsline{lot}{table}{\protect\numberline{}Titling text} % indented
573 % \end{verbatim}
574 % The first of these forms will align the first line of the legend text
575 % under the normal table numbers. The second form will align the first
576 % line of the legend text under the normal table titles. In either case,
577 % second and later lines of a multi-line text will be aligned under
578 % the normal title lines.
579 %
580 % \begin{table}
581 % \centering
582 % \captiontitlefont{\sffamily}
583 % \legend{Legendary table}
584 % \addcontentsline{lot}{table}{Legendary table (toc 1)}
585 % \addcontentsline{lot}{table}{\protect\numberline{}Legendary table (toc 2)}
586 % \begin{tabular}{lc} \hline
587 % An anonymous table & 5 \\
588 % with two lines & 6 \\ \hline
589 % \end{tabular}
590 % \end{table}
591 %
592 % As an example, the \textsf{Legendary table} is produced by the following code:
593 % \begin{verbatim}
594 % \begin{table}
595 % \centering
596 % \captiontitlefont{\sffamily}
597 % \legend{Legendary table}
598 % \addcontentsline{lot}{table}{Legendary table (toc 1)}
599 % \addcontentsline{lot}{table}{\protect\numberline{}Legendary table (toc 2)}
600 % \begin{tabular}{lc} \hline
601 % An anonymous table & 5 \\
602 % with two lines & 6 \\ \hline
603 % \end{tabular}
604 % \end{table}
605 % \end{verbatim}
606 % Look at the List of Tables to see how the two forms of |\addcontentsline|
607 % are typeset.
608 %
609 % \DescribeMacro{\abovelegendskip}
610 % \DescribeMacro{\belowlegendskip}
611 % Correspondingly to the |\abovecaptionskip| and |\belowcaptionskip|
612 % commands associated with the |\caption| command, the spacing before
613 % and after
614 % a legend is controlled by the |\abovelegendskip| and |\belowlegendskip|
615 % commands. If necessary, these can be modified via the |\setlength|
616 % command. By default these are defined to give a half baseline spacing
617 % before and after the legend.
618 %
619 % \DescribeMacro{\namedlegend}
620 % As a convenience, the |\namedlegend[|\meta{short-title}|]{|\meta{long-title}|}|
621 % command is like the |\caption| command except that it does not number
622 % the caption and, by default, puts no entry into a \textbf{List of\ldots} file. Like
623 % the |\caption| command, it picks up the name to be prepended to the
624 % title text from the float environment in which it is called (e.g.,
625 % it may use |\tablename| if called within a |table| environment). The
626 % following code is the source of the \textit{Named legendary table}.
627 % \begin{verbatim}
628 % \begin{table}
629 % \centering
630 % \captionnamefont{\sffamily}
631 % \captiontitlefont{\itshape}
632 % \namedlegend{Named legendary table}
633 % \begin{tabular}{lr} \hline
634 % seven & VII \\
635 % eight & VIII \\ \hline
636 % \end{tabular}
637 % \end{table}
638 % \end{verbatim}
639 %
640 % \begin{table}
641 % \centering
642 % \captionnamefont{\sffamily}
643 % \captiontitlefont{\itshape}
644 % \namedlegend{Named legendary table}
645 % \begin{tabular}{lr} \hline
646 % seven & VII \\
647 % eight & VIII \\ \hline
648 % \end{tabular}
649 % \end{table}
650 %
651 %
652 % \DescribeMacro{\fleg@type}
653 % The macro |\fleg@type{|\meta{name}|}|, where |type| is the name
654 % of a float environment
655 % (e.g., |table|) is called by the |\namedlegend| macro. It is provided
656 % as a hook that defines the \meta{name} to be used as the name in
657 % |\namedlegend|. Two defaults are provided, namely:
658 % \begin{verbatim}
659 % \newcommand{\fleg@table}{\tablename}
660 % \newcommand{\fleg@figure}{\figurename}
661 % \end{verbatim}
662 % which may be altered via |\renewcommand| if desired (put between
663 % a |\makeatletter| and |\makeatother| pair if done in the document).
664 %
665 % \DescribeMacro{\flegtoc@type}
666 % The macro |\flegtoc@type{|\meta{title}|}|, where |type| is the name
667 % of a float environment
668 % (e.g., |table|) is called by the |\namedlegend| macro. It is provided
669 % as a hook that can be used to add \meta{title} to the listof file.
670 % By default it is defined to do nothing, and can be changed via
671 % |\renewcommand|. For instance, it could be changed for tables as:
672 % \begin{verbatim}
673 % \makeatletter
674 % \renewcommand{\flegtoc@table}[1]{%
675 % \addcontentsline{lot}{table}{#1}}
676 % \makeatother
677 % \end{verbatim}
678 %
679 %
680 % \DescribeMacro{\newfixedcaption}
681 % \DescribeMacro{\renewfixedcaption}
682 % \DescribeMacro{\providefixedcaption}
683 % The |\legend| command produces a plain, unnumbered heading. It can also
684 % be useful sometimes to have named and numbered captions outside
685 % a floating environment, perhaps in a |minipage| if you want the table
686 % or picture to appear at a precise location in your document.
687 %
688 % The |\newfixedcaption[|\meta{capcommand}|]{|\meta{command}|}{|\meta{env}|}|
689 % command, and its friends, can be used to create a new captioning
690 % \meta{command} that may be used outside the float environment \meta{env}.
691 % Both the environment \meta{env} and a captioning command,
692 % \meta{capcommand}, for that environment must have been defined before
693 % calling |\newfixedcaption|. Note that |\namedlegend| can be used
694 % as \meta{capcommand}.
695 %
696 % The |\renewfixedcaption| and |\providefixedcaption| commands take the same
697 % arguments as |\newfixedcaption|; the three commands are analagous
698 % to those in the |\newcommand| family.
699 %
700 % For example, to define a new |\figcaption| command for captioning pictures
701 % outside the |figure| environment, do\\
702 % |\newfixedcaption{\figcaption}{figure}| \\
703 % The optional \meta{capcommand} argument is the name of the float
704 % captioning command that is being aliased. It defaults to |\caption|.
705 % As another example, where the optional argument is required, if you
706 % want to create a new continuation caption command for non-floating
707 % tables, say |\ctabcaption|, then do \\
708 % |\newfixedcaption[\contcaption]{\ctabcaption}{table}|
709 %
710 % Captioning commands created by |\newfixedcaption| will be named and
711 % numbered in the same style as the original \meta{capcommand}, can
712 % be given a |\label|, and will appear in the appropriate
713 % \textbf{List of \ldots}. They can also be used within floating
714 % environments, but will not use the environment name as a guide to
715 % the caption name or entry into the \textbf{List of \ldots}. For
716 % example, using |\ctabcaption| in a |figure| environment will still
717 % produce a \textbf{Table\ldots} named caption.
718 %
719 % Sometimes captions are required on the opposite page to a figure, and
720 % |\newfixedcaption| can be useful in this context. For example, if figure
721 % captions should be placed on an otherwise empty page immediately before
722 % the actual figure, then this can be accomplished by the following hack:
723 % \begin{verbatim}
724 % \newfixedcaption{\figcaption}{figure}
725 % ...
726 % \afterpage{% fill current page then flush pending floats
727 % \clearpage
728 % \begin{midpage} % vertically center the caption
729 % \figcaption{The caption} % the caption
730 % \end{midpage}
731 % \clearpage
732 % \begin{figure}THE FIGURE, NO CAPTION HERE\end{figure}
733 % \clearpage
734 % } % end of \afterpage
735 % \end{verbatim}
736 % Note that the \Lpack{afterpage} package is required, which is part of the
737 % required tools bundle. The \Lpack{midpage} package supplies the |midpage|
738 % environment, which can be simply defined as:
739 % \begin{verbatim}
740 % \newenvironment{midpage}{\vspace*{\fill}}{\vspace*{\fill}}
741 % \end{verbatim}
742 % The code might need adjusting to meet your particular requirements.
743 % The \Lpack{nextpage} package might also be useful in this context as it
744 % provides a |\cleartoevenpage| command which ensures that you get to the next
745 % even-numbered page (the |\cleardoublepage| gets you to the next odd-numbered
746 % page and |\clearpage| gets you to the next page which may be odd or even).
747 %
748 % \subsection{Bilingual captions}
749 %
750 % Some documents require bilingual (or more) captions. The package
751 % provides a set of commands for bilingual captions. Extensions to the
752 % set, perhaps to support trilingual captioning, are left as an exercise
753 % for the document author.
754 %
755 % \DescribeMacro{\bitwonumcaption}
756 % \DescribeMacro{\bionenumcaption}
757 % Bilingual captions can be typeset by the |\bitwonumcaption|
758 % command. This
759 % takes 6 arguments as: \\
760 % |\bitwonumcaption[|\meta{label}|]{|\meta{short-1}|}{|\meta{long-1}|}{|\meta{NAME}|}{|\meta{short-2}|}{|\meta{long-2}|}|
761 %
762 % The first, optional argument \meta{label}, is the name of a label, if
763 % required.
764 % \meta{short-1} and \meta{long-1} are the short (i.e., equivalent
765 % to the optional argument
766 % to the |\caption| command) and long caption texts for
767 % the main language of the document. The value of the \meta{NAME} argument
768 % is used as the caption name for the second language caption, while
769 % \meta{short-2} and \meta{long-2} are the short and long caption texts
770 % for the second language. For example, if the main and secondary languages
771 % are English and German and a figure is being captioned: \\
772 % |\bitwonumcaption{Short}{Long}{Bild}{Kurz}{Lang}| \\
773 %
774 % If the short title text(s) is not required, then leave the appropriate
775 % argument(s) either empty or as one or more spaces, like: \\
776 % |\bitwonumcaption[fig:bi1]{}{Long}{Bild}{ }{Lang}| \\
777 % Both language texts are entered into the appropriate List of \ldots,
778 % and both texts are numbered.
779 %
780 % Figure~\ref{fig:bi1} is an example of using the above code.
781 % \begin{figure}
782 % \centering
783 % EXAMPLE FIGURE WITH BITWONUMCAPTION
784 % \bitwonumcaption[fig:bi1]{}{Long}{Bild}{ }{Lang}
785 % \end{figure}
786 %
787 % The |\bionenumcaption| command takes the same arguments as |\bitwonumcaption|.
788 % The difference between the two commands is that |\bionenumcaption| does
789 % not number the second language text in the List of.
790 % Figure~\ref{fig:bi3} is an example of using |\bionenumcaption|.
791 % \begin{figure}
792 % \centering
793 % EXAMPLE FIGURE WITH BIONENUMCAPTION
794 % \bionenumcaption[fig:bi3]{}{Long English}{Bild}{ }{Lang Deutsch}
795 % \end{figure}
796 %
797 %
798 % \DescribeMacro{\bicaption}
799 % When bilingual captions are typeset via the |\bicaption|
800 % command the second language text is not put into
801 % the List of \ldots. The command
802 % takes 5 arguments as: \\
803 % |\bicaption[|\meta{label}|]{|\meta{short-1}|}{|\meta{long-1}|}{|\meta{NAME}|}{|\meta{long-2}|}|
804 %
805 % The optional \meta{label} is for a label if required.
806 % \meta{short-1} and \meta{long-1} are the short and long caption texts for
807 % the main language of the document. The value of the \meta{NAME} argument
808 % is used as the caption name for the second language caption. The last
809 % argument, \meta{long-2}, is the caption text
810 % for the second language (which is not put into the List of).
811 % For example, if the main and secondary languages
812 % are English and German: \\
813 % |\bicaption{Short}{Long}{Bild}{Langlauf}| \\
814 % If the short title text is not required, then leave the appropriate
815 % argument either empty or as one or more spaces.
816 %
817 % Figure~\ref{fig:bi2} is an example of using |\bicaption| and was
818 % produced by the following code:
819 % \begin{verbatim}
820 % \begin{figure}
821 % \centering
822 % EXAMPLE FIGURE WITH A RULED BICAPTION
823 % \precaption{\rule{\linewidth}{0.4pt}\par}
824 % \midbicaption{\precaption{}\postcaption{\rule{\linewidth}{0.4pt}}}
825 % \bicaption[fig:bi2]{Short English}{Longingly}{Bild}{Langlauf}
826 % \end{figure}
827 % \end{verbatim}
828 %
829 % \begin{figure}
830 % \centering
831 % EXAMPLE FIGURE WITH A RULED BICAPTION
832 % \precaption{\rule{\linewidth}{0.4pt}\par}
833 % \midbicaption{\precaption{}\postcaption{\rule{\linewidth}{0.4pt}}}
834 % \bicaption[fig:bi2]{Short English}{Longingly}{Bild}{Langlauf}
835 % \end{figure}
836 %
837 %
838 % \DescribeMacro{\bicontcaption}
839 % Bilingual continuation captions can be typeset via the |\bicontcaption|
840 % command. In this case, neither language text is put into
841 % the List of \ldots. This command
842 % takes 3 arguments as: \\
843 % |\bicontcaption{|\meta{long-1}|}{|\meta{NAME}|}{|\meta{long-2}|}|
844 %
845 % \meta{long-1} is the caption text for
846 % the main language of the document. The value of the \meta{NAME} argument
847 % is used as the caption name for the second language caption. The last
848 % argument, \meta{long-2}, is the caption text
849 % for the second language.
850 % For example, if the main and secondary languages
851 % are again English and German: \\
852 % |\bicontcaption{Continued}{Bild}{Fortgefahren}|
853 %
854 % \DescribeMacro{\midbicaption}
855 % The bilingual captions are implemented by calling |\caption| twice,
856 % once for each language. The command |\midbicaption{|\meta{midtext}|}|,
857 % which is similar to the |\precaption| and |\postcaption| commands,
858 % is executed
859 % just before calling the second |\caption|. Among other things,
860 % this can be used to
861 % modify the style of the second caption with respect to the first.
862 % For example, if there is normally a line above and below normal
863 % captions, it is probably undesirable to have a double line in the
864 % middle of a bilingual caption. So, for bilingual captions the
865 % following may be done within the float before the caption:
866 % \begin{verbatim}
867 % \precaption{\rule{\linewidth}{0.4pt}\par}
868 % \postcaption{}
869 % \midbicaption{\precaption{}\postcaption{\rule{\linewidth}{0.4pt}}}
870 % \end{verbatim}
871 % This sets a line before the first of the two captions, then the
872 % |\midbicaption{...}| nulls the pre-caption line and adds a post-caption
873 % line for the second caption. The package initially specifies
874 % |\midbicaption{}|.
875 %
876 % \subsubsection{Bilingual captions with \Lpack{longtable}}
877 %
878 % If \Lpack{ccaption} and \Lpack{longtable} are both being used,
879 % the \Lpack{longtable} package must be loaded before the \Lpack{ccaption}
880 % package as the \Lpack{ccaption} package makes some changes to
881 % \Lpack{lontable}'s code.
882 %
883 % Captions in a |longtable| work slightly differently than in
884 % other floats. This necessitates special versions of the bilingual
885 % caption commands for use in a |longtable|. These are similar
886 % to the commands described earlier but they do not take the optional
887 % \meta{label} argument. If you need a \cs{label} put it in the
888 % second argument (\meta{long-1}).
889 %
890 % \DescribeMacro{\longbitwonumcaption}
891 % This corresponds to the \cs{bitwonumcaption} command and takes 5 arguments as: \\
892 % |\longbitwonumcaption|\marg{short-1}\marg{long-1}\marg{NAME}\marg{short-2}\marg{long-2}. \\
893 % Both captions are numbered and both are put into the List of Tables (LoT).
894 %
895 % \DescribeMacro{\longbionenumcaption}
896 % This corresponds to the \cs{bionenumcaption} command and takes 5 arguments as: \\
897 % |\longbionenumcaption|\marg{short-1}\marg{long-1}\marg{NAME}\marg{short-2}\marg{long-2}. \\
898 % Both captions are numbered. Both are put into the ToC but only
899 % first is numbered there.
900 %
901 % \DescribeMacro{\longbicaption}
902 % This corresponds to the \cs{bicaption} command and takes 4 arguments as: \\
903 % |\longbicaption|\marg{short-1}\marg{long-1}\marg{NAME}\marg{long-2}. \\
904 % The first caption is numbered and put into the ToC. The second is neither
905 % numbered nor put into the ToC.
906 %
907 % \DescribeMacro{\midbicaption}
908 % This is not used by the \cs{longbi...} caption commands; the style of both
909 % captions is the same. The spacing after a longtable caption, though,
910 % is controlled
911 % by the value of \cs{belowcaptionskip}.
912 %
913 %
914 % \subsection{Use with the \Lpack{subfigure} package}
915 %
916 % The \Lpack{subfigure} package enables the captioning of sub-figures
917 % within a larger figure, and similarly for tables. If a figure that
918 % includes sub-figures is itself continued then it may be desireable to
919 % continue the captioning of the sub-figures. For example, if Figure~3
920 % has three sub-figures, say A, B and C, and Figure~3 is continued then
921 % the sub-figures in the continuation should be D, E, etc.
922 %
923 % \DescribeMacro{\contsubtop}
924 % \DescribeMacro{\contsubbottom}
925 % The command |\contsubtop[|\meta{list-entry}|][|\meta{subcaption}|]{|\meta{text}|}|
926 % will continue the sub-caption numbering scheme across (continued) floats,
927 % putting the \meta{subcaption} at the top of the \meta{text}. If both
928 % optional arguments are supplied, \meta{list-entry} will be the entry in the
929 % List of\ldots and \meta{subcaption} will be used as the text for the
930 % subcaption.
931 % The |\contsubbottom| command is similar but puts the \meta{subcaption}
932 % at the bottom of the \meta{text}. In either case, the main caption can
933 % be at the top or bottom of the float.
934 %
935 % \DescribeMacro{\subconcluded}
936 % The |\subconcluded| command is used to indicate that the continued
937 % (sub) float has been concluded and the numbering
938 % scheme is reinitialized. The command should be placed immediately
939 % before the end of the last continued environment.
940 %
941 % \DescribeMacro{\subtop}
942 % \DescribeMacro{\subbottom}
943 % The command |\subtop[|\meta{list-entry}|][|\meta{subcaption}|]{|\meta{text}|}| is in addition
944 % to the \Lpack{subfigure} package commands |\subfigure| and |\subtable|.
945 % It puts the \meta{subcaption} at the top of the \meta{text}, and similarly
946 % |\subbottom[|\meta{subcaption}|]{|\meta{text}|}| puts \meta{subcaption}
947 % at the bottom of the \meta{text}.
948 %
949 % For example:
950 % \begin{verbatim}
951 % \begin{figure}
952 % \subbottom{...} % captioned as (a) below
953 % \subbottom{...} % captioned as (b) below
954 % \caption{...}
955 % \end{figure}
956 % \begin{figure}
957 % \contsubtop{...} % captioned as (c) above
958 % \contsubtop{...} % captioned as (d) above
959 % \contcaption{Concluded}
960 % \subconcluded
961 % \end{figure}
962 % ...
963 % \begin{table}
964 % \caption{...}
965 % \subtop{...} % captioned as (a) above
966 % \subbottom{...} % captioned as (b) below
967 % \end{table}
968 % \end{verbatim}
969 %
970 % Depending on the age of your LaTeX distribution, you may find that
971 % you have either version~2.0 or a later version of the \Lpack{subfigure}
972 % package. If you have version~2.0,
973 % then call the \Lpack{\pname} package
974 % as: \\
975 % |\usepackage[subfigure20]{ccaption}|, otherwise as: \\
976 % |\usepackage[subfigure]{ccaption}|.
977 %
978 % Version~2.1 of the \Lpack{subfigure} package uses many package options
979 % some of which had been provided as commands in version~2.0.
980 % The \Lpack{\pname} commands just described apply to the current version. They
981 % also apply to version~2.0 except that the |\...top| and |\...bottom|
982 % commands do \emph{not} take the first optional argument as:
983 % |\...top[|\meta{subcaption}|]{|\meta{text}|}|.
984 %
985 % Both versions of \Lpack{subfigure} provide the commands
986 % |\subfigure| and |\subtable| which may be used with the \Lpack{\pname}
987 % package (which also provides matching |\contsubfigure| and |\contsubtable|
988 % commands) but I recommend using the generic |\...top| and |\...bottom|
989 % commands instead. One reason being that the generic commands can be used
990 % for subcaptions in new kinds of floats, whereas the specific |\...figure|
991 % and |\...table| commands cannot.
992 % In the current version of \Lpack{subfigure} the placement (top or bottom) of
993 % the subcaptions and the expected placement of the main caption are set
994 % by package options. Using these options in conjunction with the
995 % \Lpack{\pname} package may cause unexpected results, which is another
996 % reason for using the generic subcaption commands.
997 %
998 %
999 % \subsection{Use with the \Lpack{endfloat} package}
1000 %
1001 % The \Lpack{endfloat} package~\cite{ENDFLOAT} has the capability
1002 % of putting all floats at the end of the printed document and inserting
1003 % comments in the main text that a float should be placed about \emph{there}.% There is a slight problem if continuation captions are used in conjunction
1004 % with the package, as \Lpack{endfloat} effectively numbers each float
1005 % whether or not it is captioned, and thus will increment the numbering for
1006 % and continued float.
1007 %
1008 % One way of getting \Lpack{endfloat} and \Lpack{\pname} continued
1009 % captions to cooperate is to put the following in the document preamble
1010 % (modifying or extending it to suit):
1011 % \begin{verbatim}
1012 % \newcommand{\contendfloat}{}
1013 % \renewcommand{\tableplace}{%
1014 % \begin{center}
1015 % [\tablename~\theposttbl\ \contendfloat\ about here.]
1016 % \end{center}
1017 % \newenvironment{conttable}{%
1018 % \addtocounter{posttbl}{-1}%
1019 % \def\contendfloat{(continued)}}{}
1020 % \renewcommand{\figureplace}{%
1021 % \begin{center}
1022 % [\figurename~\thepostfig\ \contendfloat\ about here.]
1023 % \end{center}
1024 % \newenvironment{contfigure}{%
1025 % \addtocounter{postfig}{-1}%
1026 % \def\contendfloat{(continued)}}{}
1027 % \end{verbatim}
1028 % and then, for a table, in the document:
1029 % \begin{verbatim}
1030 % ...
1031 % \begin{table}
1032 % \caption{...}
1033 % ...
1034 % \end{table}
1035 % ...
1036 % \begin{conttable}
1037 % \begin{table}
1038 % \contcaption{Continued}
1039 % ...
1040 % \end{table}
1041 % \end{conttable}
1042 % \end{verbatim}
1043 % and similarly for any continued figures.
1044 %
1045 %
1046 %
1047 % \subsection{New float environments}
1048 %
1049 % The commands in the previous sections have been tested with
1050 % the \Lpack{caption2} and
1051 % \Lpack{rotating} packages. They will most likely fail if used with
1052 % the \Lpack{float} package because of the way this package redefines
1053 % the basic |\caption| command.
1054 %
1055 % The \Lpack{float} package, developed by Anselm Lingnau~\cite{LINGNAU95},
1056 % provides a simple scheme for creating new kinds
1057 % of floats with a variety of captioning styles. Unfortunately the package
1058 % does not effectively seperate the float creation aspects and the captioning
1059 % styles. I have therefore included in the \Lpack{\pname} package a
1060 % poor man's version of some aspects of the float creation elements that are
1061 % in \Lpack{float}. Both the commands and their coding differ from those
1062 % in the \Lpack{float} package.
1063 %
1064 % \DescribeMacro{\newfloatlist}
1065 % The command
1066 % |\newfloatlist[|\meta{within}|]{|\meta{fenv}|}{|\meta{ext}|}{|\meta{listname}|}{|\meta{capname}|}|
1067 % creates both a new kind of floating environment called \meta{fenv}
1068 % and a new kind of `List of' for \meta{fenv}; the title of this
1069 % new listing is \meta{listname}. A caption within
1070 % the environment will be written out to a file with extension \meta{ext}.
1071 % The caption, if present, will start with \meta{capname}. For example, if this
1072 % command had been used to create the |figure| environment for the \Lpack{article}
1073 % class it would have been used as (remembering that LaTeX uses
1074 % |\listfigurename| to store the `List of Figures' text
1075 % and |\figurename| to store the `Figure' text): \\
1076 % |\newfloatlist{figure}{lof}{\listfigurename}{\figurename}| \\
1077 % and the command |\listoffigure| (generated by |\newfloatlist|)
1078 % would typeset the List of Figures.
1079 %
1080 % The optional \meta{within} argument can be used if you want the captions to be
1081 % numbered within a particular document division, as figures are within the
1082 % \Lpack{book} and \Lpack{report} classes with the numbering starting afresh with
1083 % each new chapter. Creating the figure environment for either of these classes
1084 % would have used: \\
1085 % |\newfloatlist[chapter]{figure}{lof}{\listfigurename}{\figurename}|
1086 %
1087 % The captioning style for floats defined with |\newfloatlist| is the same as
1088 % for figures and tables in the standard classes.
1089 %
1090 % The |\newfloatlist| command generates several new commands that you can
1091 % use for styling the new listing, similar to the facilities given by
1092 % the \Lpack{tocloft} package~\cite{TOCLOFT}; for more detailed information
1093 % you may wish to read the \Lpack{tocloft} documentation.
1094 % For ease of explanation, assume that
1095 % the command was called as |\newfloatlist{X}{Z}{flist}{fcap}|, so that |X|
1096 % corresponds to the name of the new environment \meta{fenv} and |Z|
1097 % corresponds to the file extension \meta{ext}. The following float environment
1098 % and commands
1099 % are then created.
1100 %
1101 % \DescribeEnv{X}
1102 % The new float environment is called |X|, and can be used as either
1103 % |\begin{X}| or |\begin{X*}|, with the matching |\end{X}| or |\end{X*}|.
1104 %
1105 % \DescribeMacro{\listofX}
1106 % |\listofX| is similar to |\listoffigures|, etc., in that it typesets the new
1107 % listing, and heads the list with the value of |flist|.
1108 %
1109 % \DescribeMacro{Zdepth}
1110 % The |Zdepth| counter is analogous to the standard |tocdepth| counter
1111 % in that it specifies that entries in the new listing should not be
1112 % typeset if their numbering level is greater than |Zdepth|. The
1113 % default definition is |\setcounter{Zdepth}{1}|. To have a subfloat
1114 % of |Z| appear in the listing do |\setcounter{Zdepth}{2}|.
1115 %
1116 % \DescribeMacro{\cftmarkZ}
1117 % This macro sets the appearance of the running heads on the new listing pages.
1118 % The default definition gives the same appearance as for the LoF or LoT.
1119 %
1120 % \DescribeMacro{\cftbeforeZtitleskip}
1121 % \DescribeMacro{\cftafterZtitleskip}
1122 % The lengths |\cftbeforeZtitleskip| and |\cftafterZtitleskip| control
1123 % the vertical spacing before and after the title of the new listing. By
1124 % default they are set to give the normal spacing, but you can change them
1125 % with |\setlength| if you wish.
1126 %
1127 % \DescribeMacro{\cftZtitlefont}
1128 % \DescribeMacro{\cftafterZtitle}
1129 % The code for typesetting the title of the new listing looks
1130 % roughly like this
1131 % \begin{verbatim}
1132 % \vspace*{\cftbeforeZtitleskip}
1133 % {\cftZtitlefont flist}{\cftafterZtitle}
1134 % \cftmarkZ
1135 % \vskip \cftafterZtitleskip
1136 % \end{verbatim}
1137 % The default definition of |\cftZtitlefont| is for a bold font. If,
1138 % for example, you would prefer the title to be in a large italic font
1139 % and set flushright you could: \\
1140 % |\renewcommand{\cftZtitlefont}{\hfill\Large\itshape}| \\
1141 % By default |\cftafterZtitle| is defined to do nothing; you can
1142 % change it to serve your own purposes. For example: \\
1143 % |\renewcommand{\cftafterZtitle}{\thispagestyle{empty}}| \\
1144 % will set the page style of the first page of the new listing to
1145 % be |empty|.
1146 %
1147 % \DescribeMacro{\newfloatentry}
1148 % The command
1149 % |\newfloatentry[|\meta{within}|]{|\meta{counter}|}{|\meta{ext}|}{|\meta{level-1}|}|
1150 % is used internally by |\newfloatlist| to generate a new counter for the new
1151 % float environment and to generate the typesetting code for entries in the
1152 % new listing. The required \meta{counter} argument is the name for a new
1153 % counter. If the optional \meta{within} argument is used, the counter
1154 % \meta{counter} will be reset each time the counter \meta{within} is changed.
1155 % These first two arguments have the same effect as calling
1156 % |\newcounter{|\meta{counter}|}[|\meta{within}|]|. The \meta{ext} argument
1157 % is the extension for the file holding the entries, and \meta{level-1} is
1158 % one less than the `level' of the entry. Continuing the figure example, \\
1159 % |\newfloatlist[chapter]{figure}{lof}{\listfigurename}{\figurename}| \\
1160 % will internally call \\
1161 % |\newfloatentry[chapter]{figure}{lof}{0}|.
1162 %
1163 % |\newfloatentry| generates a set of commands in addition to those directly
1164 % generated by |\newfloatlist|. Assuming, as above, that we had \\
1165 % |\newfloatlist{X}{Z}{flist}{fcap}|
1166 % then we will also have \\
1167 % |\newfloatentry{X}{Z}{0}|. This generates the following.
1168 %
1169 % \DescribeMacro{X}
1170 % The counter |X| matches the environment |X|. This counter is used for numbering
1171 % captions. Remember that it will be reset according to the \meta{within} argument.
1172 %
1173 % \DescribeMacro{\theX}
1174 % The command |\theX| prints the value of the |X| counter. It is initially
1175 % defined so that it prints arabic numerals. If the optional \meta{within}
1176 % argument is used, |\theX| is defined as \\
1177 % |\renewcommand{\theX}{\thewithin.\arabic{X}}| otherwise as \\
1178 % |\renewcommand{\theX}{\arabic{X}}|.
1179 %
1180 % \DescribeMacro{\cftbeforeXskip}
1181 % This length controls the vertical space above a caption entry in the listing.
1182 % It can be changed by using |\setlength|.
1183 %
1184 % \DescribeMacro{\cftXindent}
1185 % \DescribeMacro{\cftXnumwidth}
1186 % The indentation of a caption entry in the listing from the left margin is
1187 % given by the length |\cftXindent|, and the space for the caption number is
1188 % set by the length |\cftXnumwidth|. These may be changed via |\setlength|
1189 % or by |\setnewfloatindents|. The default values for these depend
1190 % on the value of the \meta{level-1} argument. A value of zero for
1191 % this sets the defaults to the figure and table values. A value of one
1192 % sets them to the defaults for subfigure and subtable values.
1193 %
1194 % The code for typesetting a caption entry is roughly like:
1195 % \begin{verbatim}
1196 % {\cftXfont {\cftXpresnum SNUM\cftXaftersnum\hfil} \cftXaftersnumb TITLE}%
1197 % {\cftXleader}{\cftXpagefont PAGE}\cftXafterpnum\par
1198 % \end{verbatim}
1199 % where |SNUM| is the caption number, |TITLE| is the caption text, and |PAGE|
1200 % is the page number. The other commands are described below.
1201 %
1202 % \DescribeMacro{\cftXfont}
1203 % This controls the appearance of the number and title. By default it is defined
1204 % to use the normal font but it can be changed with
1205 % |\renewcommand|.
1206 %
1207 % \DescribeMacro{\cftXpresnum}
1208 % \DescribeMacro{\cftXaftersnum}
1209 % \DescribeMacro{\cftXaftersnumnb}
1210 % The caption number is typeset in a box of width |\cftXnumwidth|. Within the
1211 % box, |\cftXpresnum| is first called, then the number is typeset, then
1212 % |\cftXaftersnum| is called and finally there is a |\hfil| to make the box
1213 % contents flush left. After the number box is typeset |\cftXaftersnumb| is
1214 % called and then the caption text is typeset. By default these three macros
1215 % are defined to do nothing, but |\renewcommand| can be used to make them do
1216 % something interesting.
1217 %
1218 % \DescribeMacro{\cftXleader}
1219 % \DescribeMacro{\cftXdotsep}
1220 % |\cftXleader| defines the leader between the text and the page number; it can be
1221 % changed by |\renewcommand|. By default it produces a dotted leader with
1222 % |\cftXdotsep| space between the dots. It default definition is \\
1223 % |\newcommand{\cftXdotsep}{4.5}| which gives a 4.5mu (math units) seperation.
1224 % In spite of it appearing to be a length, changes to |\cftXdotsep| must be
1225 % made by |\renewcommand|.
1226 %
1227 % \DescribeMacro{\cftXpagefont}
1228 % \DescribeMacro{\cftXafterpnum}
1229 % |\cftXpagefont| specifies the font to be used for typesetting the page number.
1230 % By default it is set to the normal font. Finally, |\cftXafterpnum| is called
1231 % after setting the page number; by default is does nothing. Both these commands
1232 % can be changed by |\renewcommand|.
1233 %
1234 % Note that |\newfloatlist| effectively generates all the above commands. Their
1235 % defaults are set so that the typesetting mimics that for figure and table captions.
1236 % It is probable that you can ignore all of them, but if you do want to change
1237 % something the \Lpack{tocloft} documentation provides many examples.
1238 %
1239 % \DescribeMacro{\setnewfloatindents}
1240 % The command
1241 % |\setnewfloatindents{|\meta{fenv}|}{|\meta{indent}|}{|\meta{numwidth}|}|
1242 % sets the \meta{fenv}'s entry indent to the length \meta{indent}
1243 % and its numwidth to the length \meta{numwidth}. The \meta{fenv}
1244 % argument is the full name of the (sub)float.
1245 %
1246 % As a fuller example of |\newfloatlist|, suppose you wanted both
1247 % figures (which come with the
1248 % standard classes), and diagrams. You could then do something like the following.
1249 % \begin{verbatim}
1250 % \usepackage{ccaption}
1251 % ...
1252 % \newcommand{\diagramname}{Diagram}
1253 % \newcommand{\listdiagramname}{List of Diagrams}
1254 % \newfloatlist{diagram}{dgm}{\listdiagramname}{\diagramname}
1255 % \newfixedcaption{\fdiagcaption}{diagram}
1256 % \begin{document}
1257 % ...
1258 % \listoffigures
1259 % \listfofdiagram
1260 % ...
1261 % \begin{diagram}
1262 % \caption{A diagram} \label{diag1}
1263 % ...
1264 % \end{diagram}
1265 % As diagram~\ref{diag1} shows ...
1266 % \begin{minipage}{.9\textwidth}
1267 % \fdiagcaption{Another diagram} \label{diag2}
1268 % ...
1269 % \end{minipage}
1270 %
1271 % In contrast to diagram~\ref{diag1}, diagram~\ref{diag2} provides ...
1272 % \end{verbatim}
1273 %
1274 % As a word of warning, if you mix both floats and fixed environments with the
1275 % same kind of caption you have to ensure that they get printed in the correct
1276 % order in the final document. If you do not do this, then the |\list...| of
1277 % captions will come out in the wrong order (the lists are ordered according the
1278 % page number in the typeset document, \emph{not} your source input order).
1279 %
1280 % \DescribeMacro{\newsubfloat}
1281 % The |\newsubfloat{|\meta{fenv}|}| command, which is only of use with
1282 % the \Lpack{subfigure} package and the \Lopt{subfigure20} or
1283 % \Lopt{subfigure} option,
1284 % creates
1285 % subcaptions (|\subtop| and |\subbottom|, together with their continued
1286 % forms) for use within the float
1287 % environment \meta{fenv} previously
1288 % defined via |\newfloatlist[...]{|\meta{fenv}|}{...}|.
1289 %
1290 % The |\newsubfloat| macro internally calls the |\newfloatentry| command
1291 % and assuming our usual
1292 % |\newfloatlist{X}{Z}{flist}{fcap}|
1293 % then |\newsubfloat{X}| calls \\
1294 % |\newfloatentry[X]{subX}{Z}{1}| \\
1295 % so there is a further set of |\cftsubX...| commands generated for adjusting
1296 % the typesetting of the subcaption entries. Note that the full name of the
1297 % entry in the listing is `sub\meta{fenv}', not just simply `\meta{fenv}'.
1298 %
1299 % \DescribeMacro{\newfloatpagesoff}
1300 % The |\newfloatpagesoff{|\meta{fenv}|}| command will turn off page numbering for
1301 % list entries for \meta{fenv}. This is probably most likely to be used
1302 % for switching off page numbers for subfloat entries, in which case
1303 % it should be called as |\newfloatpagesoff{sub|\meta{fenv}|}|.
1304 %
1305 % \DescribeMacro{\newfloatpageson}
1306 % The |\newfloatpageson{|\meta{fenv}|}| command reverses the effect of a
1307 % corresponding |\newfloatpagesoff{|\meta{fenv}|}|.
1308 %
1309 %
1310 % \DescribeMacro{\newfloatenv}
1311 % \DescribeMacro{\listfloats}
1312 % \textbf{NOTE:} These two macros were in version 2.7 of the package but were
1313 % replaced in version 3.0 by the functionally extended
1314 % |\newfloatlist| and |\listofX| commands, respectively.
1315 %
1316 % There is a limit to the number of List of\ldots listings that (La)TeX
1317 % can handle. Each kind of listing requires a |\jobname.ext| file and
1318 % the TeX program has an upper limit on the number of files it can
1319 % handle. In the most limited circumstance LaTeX requires three files
1320 % --- the \file{log}, \file{aux} and \file{dvi} files. Further files are
1321 % required for things like a ToC (\file{toc}) or an index (\file{idx}).
1322 % If you try and create
1323 % too many new listings LaTeX will respond with the error message:
1324 % \begin{center}
1325 % \texttt{No room for a new write}
1326 % \end{center}
1327 % If you get such a message the only recourse is to redesign your document.
1328 %
1329 % \section{How LaTeX makes captions} \label{sec:ltx}
1330 %
1331 % This section provides an overview of how LaTeX creates captions and
1332 % gives some examples of how to change the captioning style without
1333 % having to use any package.
1334 % The section need not be looked at more than once unless you like
1335 % reading LaTeX code
1336 % or you want to make changes to LaTeX's style of captioning.
1337 %
1338 % The LaTeX kernel provides tools to help in the definition of captions,
1339 % but it is the particular class that decides on their format.
1340 %
1341 % \DescribeMacro{\caption}
1342 % The kernel (in \file{ltfloat.dtx}) defines the caption command via \\
1343 % |\def\caption{\refstepcounter\@captype \@dblarg{\@caption\@captype}}|
1344 %
1345 % \DescribeMacro{\@captype}
1346 % |\@captype| is defined by the code that creates a new float environment
1347 % and is set to the environment's name (see the code for |\@xfloat|
1348 % in \file{ltfloat.dtx}). For a |figure| environment,
1349 % there is an equivalent to \\
1350 % |\def\@captype{figure}|.
1351 %
1352 % \DescribeMacro{\@caption}
1353 % The kernel also provides the
1354 % |\@caption{|\meta{type}|}[|\meta{short-title}|]{|\meta{full-title}|}|
1355 % command as:
1356 % \begin{verbatim}
1357 % \long\def\@caption#1[#2]#3{%
1358 % \par
1359 % \addcontentsline{\csname ext@#1\endcsname}{#1}% <----
1360 % {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
1361 % \begingroup
1362 % \@parboxrestore
1363 % \if@minipage
1364 % \@setminipage
1365 % \fi
1366 % \normalsize
1367 % \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par % <----
1368 % \endgroup}
1369 % \end{verbatim}
1370 % where \meta{type} is the name of the environment in which the caption
1371 % will be used.
1372 % Putting these three commands together results in the user's view of the caption
1373 % command as |\caption[|\meta{short-title}|]{|\meta{full-title}|}|.
1374 %
1375 % It is the responsibilty of the class (or package) which defines floats
1376 % to provide definitions for |\ext@type|, |\fnum@type| and |\@makecaption|
1377 % which appear in the definition of |\@caption| (in the lines marked
1378 % |<----| above).
1379 %
1380 % \DescribeMacro{\ext@type}
1381 % This macro holds the name of the extension for a `List of\ldots' file.
1382 % For example for the |figure| float environment there is the
1383 % definition equivalent to \\
1384 % |\newcommand{\ext@figure}{lof}|.
1385 %
1386 % \DescribeMacro{\fnum@type}
1387 % This macro is responsible for typesetting the caption number. For example,
1388 % for the |figure| environment there is the definition equivalent to \\
1389 % |\newcommand{\fnum@figure}{\figurename~\thefigure}|.
1390 %
1391 % \DescribeMacro{\@makecaption}
1392 % The |\@makecaption{|\meta{number}|}{|\meta{text}|}|, where \meta{number}
1393 % is a string such as `Table~5.3' and \meta{text} is the caption text,
1394 % performs the typesetting of the caption, and
1395 % is defined in the standard classes (in \file{classes.dtx}) as the
1396 % equivalent of:
1397 % \begin{verbatim}
1398 % \newcommand{\@makecaption}[2]{%
1399 % \vskip\abovecaptionskip % <- 1
1400 % \sbox\@tempboxa{#1: #2}% % <- 2
1401 % \ifdim \wd\@tempboxa >\hsize
1402 % #1: #2\par % <- 3
1403 % \else
1404 % \global \@minipagefalse
1405 % \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
1406 % \fi
1407 % \vskip\belowcaptionskip} % <- 4
1408 % \end{verbatim}
1409 %
1410 % \DescribeMacro{\abovecaptionskip}
1411 % \DescribeMacro{\belowcaptionskip}
1412 % Vertical space is added before and after a caption (lines marked 1 and 4
1413 % in the code for |\@makecaption| above) and the amount of space is given
1414 % by the lengths |\abovecaptionskip| and |\belowcaptionskip|. The
1415 % standard classes set these to 10pt and 0pt respectively. If you want
1416 % to change the space before or after a caption, use |\setlength| to change
1417 % the values. In figures, the caption is usually placed below the
1418 % illustration. The actual space between the bottom of the illustration
1419 % and the baseline of the first line of the caption
1420 % is the |\abovecaptionskip| plus the |\parskip| plus the |\baselineskip|.
1421 % If the illustration is in a |center| environment then additional space
1422 % will be added by the |\end{center}|; it is usually better to use
1423 % the |\centering| command rather than the |center| environment.
1424 %
1425 % The actual typesetting of a caption is effectively performed by the code
1426 % in lines marked 2 and 3 in the code for |\@makecaption|; note that
1427 % these are where the colon that is typeset after the number is specified.
1428 % If you want to
1429 % make complex changes to the default captioning style you may have to
1430 % create your own version of |\@caption| using
1431 % |\renewcommand|. On the other hand, many such changes can be achieved
1432 % by changing the definition of the
1433 % the appropriate |\fnum@type| command(s). For example, to make the
1434 % figure name and number bold: \\
1435 % |\renewcommand{\fnum@figure}{\textbf{\figurename~\thefigure}}|
1436 %
1437 % REMEMBER: If you are doing anything involving commands that include
1438 % the |@| character, and it's not in a class or package file, you have
1439 % to do it within a |\makeatletter| and |\makeatother| pairing. So,
1440 % if you modify the |\fnum@figure| command anywhere in your document
1441 % it has to be done as:
1442 % \begin{verbatim}
1443 % \makeatletter
1444 % \renewcommand{\fnum@figure}{......}
1445 % \makeatother
1446 % \end{verbatim}
1447 %
1448 % \makeatletter
1449 % \renewcommand{\fnum@figure}{\textsc{\figurename~\thefigure}}
1450 % \makeatother
1451 % \begin{figure}
1452 % \centering
1453 % A THOUSAND WORDS\ldots
1454 % \caption{A picture is worth a thousand words}\label{fig:sc}
1455 % \end{figure}
1456 %
1457 % As an example, Figure~\ref{fig:sc} was created by the following code:
1458 % \begin{verbatim}
1459 % \makeatletter
1460 % \renewcommand{\fnum@figure}{\textsc{\figurename~\thefigure}}
1461 % \makeatother
1462 % \begin{figure}
1463 % \centering
1464 % A THOUSAND WORDS\ldots
1465 % \caption{A picture is worth a thousand words}\label{fig:sc}
1466 % \end{figure}
1467 % \end{verbatim}
1468 %
1469 % As another example, suppose that you needed to typeset the |\figurename|
1470 % and its number in a bold font, replace the colon that normally appears
1471 % after the number by a long dash, and typeset the actual title text in
1472 % a sans-serif font, as is illustrated by the caption for
1473 % Figure~\ref{fig:sf}. The following code does this.
1474 %
1475 % \makeatletter
1476 % \renewcommand{\fnum@figure}[1]{\textbf{\figurename~\thefigure} --- \sffamily}
1477 % \makeatother
1478 % \begin{figure}
1479 % \centering
1480 % ANOTHER THOUSAND WORDS\ldots
1481 % \caption{A different kind of figure caption}\label{fig:sf}
1482 % \end{figure}
1483 %
1484 % \begin{verbatim}
1485 % \makeatletter
1486 % \renewcommand{\fnum@figure}[1]{\textbf{\figurename~\thefigure} --- \sffamily}
1487 % \makeatother
1488 % \begin{figure}
1489 % \centering
1490 % ANOTHER THOUSAND WORDS\ldots
1491 % \caption{A different kind of figure caption}\label{fig:sf}
1492 % \end{figure}
1493 % \end{verbatim}
1494 % Perhaps a little description of how this works is in order.
1495 % Doing a little bit of \TeX 's macro processing by hand, the typesetting
1496 % lines in |\@makecaption| (lines 2 and 3) get instantiated like: \\
1497 % |\fnum@figure{\figurename~\thefigure}: text| \\
1498 % Redefining |\fnum@figure| to take one argument and then not using the
1499 % value of the argument essentially gobbles up the colon. Using \\
1500 % |\textbf{\figurename~\thefigure}| \\
1501 % in the definition causes |\figurename| and the number to be typeset in
1502 % a bold font. After this comes the long dash. Finally, putting |\sffamily|
1503 % at the end of the redefinition causes any following text (i.e., the actual
1504 % title) to be typeset using the sans-serif font.
1505 %
1506 % If you do modify |\@makecaption|, then spaces in the definition may be
1507 % important; also you must use the comment (\%) character in the same
1508 % places as I have done above.
1509 %
1510 % You may also want to take a look at the \Lpack{caption2} package by
1511 % Harald Axel Sommerfeldt which provides a ready-made set of differing
1512 % captioning styles. This basically works by redefining the
1513 % |\@makecaption| command to provide some hooks. Of course the \Lpack{\pname}
1514 % package provides the tools that you need to make most, if not all,
1515 % of any likely caption styles.
1516 %
1517 % \subsection{Changing the numbering scheme}
1518 %
1519 % In the \Lpack{article} class and its derivatives, captions are numbered
1520 % continuously throughout the document, while in the \Lpack{book} and
1521 % \Lpack{report} classes, numbering starts anew in each chapter.
1522 %
1523 % If you want captions to be numbered anew with sections in the
1524 % \Lpack{article} class you can do this:
1525 % \begin{verbatim}
1526 % \makeatletter
1527 % \@addtoreset{table}{section}
1528 % \renewcommand{\thetable}{\thesection.\arabic{table}}
1529 % \makeatletter
1530 % \end{verbatim}
1531 % and similarly for all the other float environments.
1532 %
1533 % If you are using the \Lpack{book} or \Lpack{report} class and you want
1534 % the captions to be numbered consecutively throughout the document you
1535 % can do this:
1536 % \begin{verbatim}
1537 % \makeatletter
1538 % \@removefromreset{table}{chapter}
1539 % \renewcommand{\thetable}{\arabic{table}}
1540 % \makeatother
1541 % \end{verbatim}
1542 % and similarly for all the other float environments. Note that you
1543 % will need the \Lpack{remreset} package\footnote{Available on CTAN in
1544 % \texttt{tex-archive/macros/latex/contrib/supported/carlise}.}
1545 % which provides the definition of |\@removefromreset|.
1546 %
1547 % You can play with other combinations of |\@addtoreset|, |\@removefromreset|,
1548 % and |\renewcommand{\the...}{...}|
1549 % to get the numbering scheme you want.
1550 %
1551 % \subsection{Captions with footnotes}
1552 %
1553 % If you want to have a caption with a footnote, think long and hard
1554 % as to whether this is really essential. It is not normally considered
1555 % to be good typographic practice, and to rub the point in LaTeX does not
1556 % make it necessarily easy to do. However, if you (or your publisher)
1557 % insists, read on.
1558 %
1559 % If it is present, the optional argument to |\caption| is put into
1560 % the LoF/LoT as appropriate. If the argument is not present, then the
1561 % text of the required argument is put into the LoF. In the first case,
1562 % the optional argument is moving, and in the second case the required
1563 % argument is moving. The |\footnote| command is fragile and must be
1564 % |\protect|ed (i.e., |\protect\footnote{}|) if it is used in a moving
1565 % argument. If you don't want the footnote to appear in the LoF, use a
1566 % footnoteless optional argument and a footnoted required argument.
1567 %
1568 % You will probably be surprised if you just do, for example:
1569 % \begin{verbatim}
1570 % \begin{figure}
1571 % ...
1572 % \caption[For LoF]{For figure\footnote{The footnote}}
1573 % \end{figure}
1574 % \end{verbatim}
1575 % because (a) the footnote number may be greater than you thought, and (b)
1576 % the footnote text has vanished. This later is because LaTeX won't typeset
1577 % footnotes from a float. To get an actual footnote within the float you
1578 % have to use a minipage, like:
1579 % \begin{verbatim}
1580 % \begin{figure}
1581 % \begin{minipage}{\linewidth}
1582 % ...
1583 % \caption[For LoF]{For figure\footnote{The footnote}}
1584 % \end{minipage}
1585 % \end{figure}
1586 % \end{verbatim}
1587 % Now you may find that you get two footnotes for the price of one.
1588 % Fortunately, if you use the \Lpack{\pname} package \emph{without} the
1589 % \Lopt{caption2} option, this will not occur.
1590 %
1591 % When using a minipage as above, the footnote text is typeset at the
1592 % bottom of the minipage (i.e., within the float). If you want the footnote
1593 % text typeset at the bottom of the page, then you have to use the
1594 % |\footnotemark| and |\footnotetext| commands like:
1595 % \begin{verbatim}
1596 % \begin{figure}
1597 % ...
1598 % \caption[For LoF]{For figure\footnotemark}
1599 % \end{figure}
1600 % \footnotetext{The footnote}
1601 % \end{verbatim}
1602 % This will typeset the argument of the |\footnotetext| command at the
1603 % bottom of the page where you called the command. Of course, the figure
1604 % might have floated to a later page, and then it's a matter of some
1605 % manual fiddling to get everything on the same page, and possibly
1606 % to get the footnote marks to match correctly with the footnote text.
1607 %
1608 % At this point, you are on your own.
1609 %
1610 % \section{Floats}
1611 %
1612 % As far as LaTeX is concerned, a float is a box which certain
1613 % restrictions as to where it can be placed.
1614 %
1615 % \subsection{Multiple floats}
1616 %
1617 % You can effectively
1618 % put what you like inside a float box. Normally there is just a single
1619 % picture or tabular in a float but you can put as many of these as will
1620 % fit inside a float.
1621 %
1622 % \begin{figure}
1623 % \centering
1624 % \hspace*{\fill} {ILLUSTRATION 1} \hfill {ILLUSTRATION 2} \hspace*{\fill}
1625 % \caption{Float with two illustrations} \label{fig:mult1}
1626 % \end{figure}
1627 %
1628 % Three typical cases of multiple figures/tables in a single
1629 % float come to mind:
1630 % \begin{itemize}
1631 % \item Multiple illustrations/tabulars with a single caption.
1632 % \item Multiple illustrations/tabulars each individually captioned.
1633 % \item Multiple illustrations/tabulars with one main caption and
1634 % individual subcaptions.
1635 % \end{itemize}
1636 %
1637 % The \Lpack{subfigure} package is designed for the last of these cases;
1638 % the others do not require a package.
1639 %
1640 % Figure~\ref{fig:mult1} is an example of multiple illustrations
1641 % in a single float with a single caption.
1642 % This figure was produced by the following code.
1643 % \begin{verbatim}
1644 % \begin{figure}
1645 % \centering
1646 % \hspace*{\fill} {ILLUSTRATION 1} \hfill {ILLUSTRATION 2} \hspace*{\fill}
1647 % \caption{Float with two illustrations} \label{fig:mult1}
1648 % \end{figure}
1649 % \end{verbatim}
1650 % The |\hspace*{\fill}| and |\hfill| commands were used to space the two
1651 % illustrations equally. Of course |\includegraphics| or |tabular|
1652 % environments could just as well
1653 % be used instead of the |{ILLUSTRATION N}| text.
1654 %
1655 % The following code produces Figures~\ref{fig:mult2} and~\ref{fig:mult3}
1656 % which are examples of two seperately captioned illustrations in one
1657 % float.
1658 % \begin{verbatim}
1659 % \begin{figure}
1660 % \centering
1661 % \begin{minipage}{0.4\textwidth}
1662 % \centering
1663 % ILLUSTRATION 3
1664 % \caption{Illustration 3} \label{fig:mult2}
1665 % \end{minipage}
1666 % \hfill
1667 % \begin{minipage}{0.4\textwidth}
1668 % \centering
1669 % ILLUSTRATION 4
1670 % \caption{Illustration 4} \label{fig:mult3}
1671 % \end{minipage}
1672 % \end{figure}
1673 % \end{verbatim}
1674 % In this case the illustrations (or graphics or tabulars) are put into
1675 % seperate |minipage| environments within the float, and the captions
1676 % are also put within the |minipage|s. Note that any required |\label|
1677 % must also be inside the |minipage|. If you wished, you could add yet
1678 % another caption after the end of the two |minipage|s.
1679 %
1680 % \begin{figure}
1681 % \centering
1682 % \begin{minipage}{0.4\textwidth}
1683 % \centering
1684 % ILLUSTRATION 3
1685 % \caption{Illustration 3} \label{fig:mult2}
1686 % \end{minipage}
1687 % \hfill
1688 % \begin{minipage}{0.4\textwidth}
1689 % \centering
1690 % ILLUSTRATION 4
1691 % \caption{Illustration 4} \label{fig:mult3}
1692 % \end{minipage}
1693 % \end{figure}
1694 %
1695 % Keith Reckdahl~\cite{EPSLATEX} provides more examples of this
1696 % kind of thing.
1697 %
1698 %
1699 %
1700 %
1701 % \subsection{Where LaTeX puts floats}
1702 %
1703 % The general format for a float environment is: \\
1704 % |\begin{float}[|\meta{loc}|] ... \end{float}| or for double column floats: \\
1705 % |\begin{float*}[|\meta{loc}|] ... \end{float*}| \\
1706 % where the optional argument \meta{loc}, consisting of one or more characters,
1707 % specifies a location where the float may be placed. Note that the
1708 % \Lpack{multicol} package only supports the starred floats and it will not
1709 % let you have a single column float. The possible \meta{loc} values are one
1710 % or more of the following:
1711 % \begin{itemize}
1712 % \item[\texttt{b}] \textit{bottom}: at the bottom of a page. This does not apply
1713 % to double column floats as they may only be placed at the top of a page.
1714 % \item[\texttt{h}] \textit{here}: if possible exactly where the float environment
1715 % is defined. It does not apply to double column floats.
1716 % \item[\texttt{p}] \textit{page}: on a seperate page containing only
1717 % floats (no text).
1718 % \item[\texttt{t}] \textit{top}: at the top of a page.
1719 % \item[\texttt{!}] make an extra effort to place the float at the earliest place
1720 % specified by the rest of the argument.
1721 % \end{itemize}
1722 % The default for \meta{loc} is |tbp|, so the float may be placed at the top,
1723 % or bottom, or on a float-only page; the default works well 95\% of the time.
1724 % Floats of the same kind are output in
1725 % definition order, except that a double column float may be output before
1726 % a later single column float of the same kind, or
1727 % \textit{vice-versa}\footnote{This little quirk
1728 % is fixed by the \Lpack{fixltx2e} package, at least for tables and figures.
1729 % The package is part of a normal LaTeX distribution.}.
1730 % A float is never put on
1731 % an earlier page than its definition but may be put on the same or later page
1732 % of its definition. If a float cannot be placed, all
1733 % suceeding floats will be held up, and LaTeX can store no more than 16 held
1734 % up floats. A float cannot
1735 % be placed if it would cause an overfull page, or it otherwise cannot be fitted
1736 % according the the float parameters.
1737 % A |\clearpage| or |\cleardoublepage| or |\end{document}| flushes
1738 % out all unprocessed floats, irrespective of the \meta{loc} and float
1739 % parameters, putting them on float-only pages.
1740 %
1741 % \DescribeMacro{\suppressfloats}
1742 % You can use the command |\suppressfloats[|\meta{pos}|]| to suppress floats
1743 % at a given \meta{pos} on the current page. |\suppressfloats[t]| prevents
1744 % any floats at the top of the page and |\suppressfloats[b]| prevents any
1745 % floats at the bottom of the page. The simple |\suppressfloats| prevents
1746 % both top and bottom floats.
1747 %
1748 % The \Lpack{flafter} package, which should have come with your LaTeX
1749 % distribution, provides a means of preventing floats from moving
1750 % backwards from their definition position in the text. This can be useful to
1751 % ensure, for example, that a float early in a |\section{}| is not typeset before
1752 % the section heading.
1753 %
1754 % \begin{table}
1755 % \begin{addtomargins}{-0.67in}
1756 % ^^A \centering
1757 % \captionnamefont{\small\sffamily}
1758 % \captiontitlefont{\small\sffamily}
1759 % \setlength{\belowcaptionskip}{10pt}
1760 % \caption{Float placement parameters}\label{tab:fpp}
1761 % \begin{tabular}{lp{0.5\textwidth}r} \hline
1762 % Parameter & Controls & Default \\ \hline
1763 % \multicolumn{3}{c}{Counters --- change with \cs{setcounter} } \\ \hline
1764 % |topnumber| & max number of floats at top of a page & 2 \\
1765 % |bottomnumber| & max number of floats at bottom of a page & 1 \\
1766 % |totalnumber| & max number of floats on a text page & 3 \\
1767 % |dbltopnumber| & like |topnumber| for double column floats & 2 \\ \hline
1768 % \multicolumn{3}{c}{Commands --- change with \cs{renewcommand} } \\ \hline
1769 % |\topfraction| & max fraction of page reserved for top floats & 0.7 \\
1770 % |\bottomfraction| & max fraction of page reserved for bottom floats & 0.3 \\
1771 % |\textfraction| & min fraction of page that must have text & 0.2 \\
1772 % |\dbltopfraction| & like |\topfraction| for double column floats & 0.7 \\
1773 % |\floatpagefraction| & min fraction of a float page that must have float(s) & 0.5 \\
1774 % |\dblfloatpagefraction| & like |\floatpagefraction| for double column floats & 0.5 \\ \hline
1775 % \multicolumn{3}{c}{Text page lengths --- change with \cs{setlength} } \\ \hline
1776 % |\floatsep| & vertical space between floats & 12pt \\
1777 % |\textfloatsep| & vertical space between a top (bottom) float and suceeding (preceeding) text & 20pt \\
1778 % |\intextsep| & vertical space above and below an \texttt{h} float & 12pt \\
1779 % |\dblfloatsep| & like |\floatsep| for double column floats & 12pt \\
1780 % |\dbltextfloatsep| & like |\textfloatsep| for double column floats & 20pt \\ \hline
1781 % \multicolumn{3}{c}{Float page lengths --- change with \cs{setlength} } \\ \hline
1782 % |\@fptop| & space at the top of the page & |0pt plus 1fil| \\
1783 % |\@fpsep| & space between floats & |8pt plus 2fil| \\
1784 % |\@fpbot| & space at the bottom of the page & |0pt plus 1fil| \\
1785 % |\@dblfptop| & like |\@fptop| for double column floats & |0pt plus 1fil| \\
1786 % |\@dblfpsep| & like |\@fpsep| for double column floats & |8pt plus 2fil| \\
1787 % |\@dblfpbot| & like |\@fpbot| for double column floats & |0pt plus 1fil| \\ \hline
1788 % \end{tabular}
1789 % \end{addtomargins}
1790 % \end{table}
1791 %
1792 % Table~\ref{tab:fpp} lists the various float parameters and typical
1793 % default values. All the lengths are rubber lengths, and the actual
1794 % defaults depend on both the class and its size option.
1795 %
1796 % Given the displayed defaults, the height of a top float must be
1797 % less than 70\% of the textheight and there can be no more than 2 top floats
1798 % on a text page. Similarly, the height of a bottom float must not
1799 % exceed 30\% of the textheight and there can be no more than 1 bottom
1800 % float on a text page. There can be no more than 3 floats (top, bottom and here)
1801 % on the page. At least 20\% of a text page with floats must be text.
1802 % On a float page (one that has no text, only floats) the sum of the heights
1803 % of the floats must be at least 50\% of the textheight. The floats on a float
1804 % page should be vertically centered.
1805 %
1806 % It can be seen that with the defaults LaTeX might have trouble finding
1807 % a place for a float. Consider what will happen if a float is a bottom float
1808 % whose height is 40\% of the textheight and this is followed by a float whose
1809 % height is 90\% of the textheight. The first is too large to actually go at the
1810 % bottom of a text page but too small to go on a float page by itself. The second
1811 % has to go on a float page but it is too large to share the float page with the
1812 % first float. LaTeX is stuck!
1813 %
1814 % At this point it is worthwhile to be precise about the effect of a
1815 % one character \meta{loc} argument:
1816 % \begin{itemize}
1817 % \item[\texttt{[b]}] means: `put the float at the bottom of a page with some
1818 % text above it, and nowhere else'. The float must fit into the
1819 % |\bottomfraction| space otherwise it and subsequent floats will be held up.
1820 % \item[\texttt{[h]}] means: `put the float at this point and nowhere else'.
1821 % The float must fit into the space left on the page otherwise it and
1822 % subsequent floats will be held up.
1823 % \item[\texttt{[p]}] means: `put the float on a page that has no text but may
1824 % have other floats on it'. There must be at least `|\floatpagefraction|'
1825 % worth of floats to go on a float only page before the float will be
1826 % be output.
1827 % \item[\texttt{[t]}] means: `put the float at the top of a page with some
1828 % text below it, and nowhere else'. The float must fit into the
1829 % |\topfraction| space otherwise it and subsequent floats will be held up.
1830 % \item[\texttt{[!...]}] means: `ignore the |\...fraction| values for this
1831 % float'.
1832 % \end{itemize}
1833 %
1834 % You must try and pick a combination from these that will let LaTeX find
1835 % a place to put your floats. However, you can
1836 % also can change the float parameters to make it easier to find places
1837 % to put floats. Some examples are:
1838 % \begin{itemize}
1839 % \item Decrease |\textfraction| to get more `float' on a text page, but
1840 % the sum of |\textfraction| and |\topfraction| and the sum of |\textfraction|
1841 % and |\bottomfraction| should not exceed 1, otherwise the placement algorithm
1842 % falls apart. A minimum value for |\textfraction| is about 0.10 --- a page
1843 % with less than 10\% text looks better with no text at all, just floats.
1844 %
1845 % \item Both |\topfraction| and |\bottomfraction| can be increased, and it does
1846 % not matter if their sum exceeds 1.0. A good typographic style is that floats
1847 % are encouraged to go at the top of a page, and a better balance is achieved
1848 % if the float space on a page is larger
1849 % at the top than the bottom.
1850 %
1851 % \item Making |\floatpagefraction| too small might have the effect of a
1852 % float page just having one small float. However, to make sure that a float
1853 % page never has more than one float on it, do: \\
1854 % |\renewcommand{\floatpagefraction}{0.01}| \\
1855 % |\setlength{\@fpsep}{\textheight}|
1856 %
1857 % \item Setting |\@fptop| to |0pt|, |\@fpsep| to |8pt| and |\@fpbot|
1858 % to |0pt plus 1fil| will force floats on a float page to start at the top
1859 % of the page.
1860 % \end{itemize}
1861 % If you are experimenting, a reasonable starting position is:
1862 % \begin{verbatim}
1863 % \setcounter{topnumber}{3}
1864 % \setcounter{bottomnumber}{2}
1865 % \setcounter{totalnumber}{4}
1866 % \renewcommand{\topfraction}{0.85}
1867 % \renewcommand{\bottomfraction}{0.5}
1868 % \renewcommand{\textfraction}{0.15}
1869 % \renewcommand{\floatpagefraction}{0.7}
1870 % \end{verbatim}
1871 % and similarly for double column floats if you will have any.
1872 %
1873 % One of LaTeX's little quirks is that on a text page, the `height' of a float
1874 % is its actual height plus |\textfloatsep| or |\floatsep|, while on a float
1875 % page the `height' is the actual height. This means that when using the default
1876 % \meta{loc} of |[tbp]| at least one of the text page float fractions
1877 % (|\topfraction| and/or |\bottomfraction|) must be
1878 % larger than the |\floatpagefraction| by an amount sufficient to take account
1879 % of the maximum text page seperation value.
1880 %
1881 %
1882 % \section{The package code} \label{sec:code}
1883 %
1884 % \begin{macrocode}
1885 %<*usc>
1886 % \end{macrocode}
1887 % In an attempt to avoid name clashes with other packages, all internal
1888 % commands include the string |@cont|.
1889 %
1890 % Note (2001/08/03): Older versions of the \Lpack{amsmath} package did
1891 % odd things with
1892 % |\@tempa|, |\@tempb| and |\@tempc|. I have replaced any original use
1893 % of these by |\@conttempa|, etc.
1894 %
1895 % Do the options first.
1896 %
1897 % \begin{macro}{\if@contsubfigxx}
1898 % \begin{macro}{\if@contsubfigxxi}
1899 % \begin{macro}{\if@contsubfig}
1900 % These three |\if...| are used to remember if the \Lopt{subfigure20}
1901 % or \Lopt{subfigure} option has been given.
1902 % \changes{v3.1}{2002/02/20}{Change to subfigure options, deprecate subfigure21}
1903 % \begin{macrocode}
1904 \newif\if@contsubfigxx
1905 \@contsubfigxxfalse
1906 \newif\if@contsubfigxxi
1907 \@contsubfigxxifalse
1908 \newif\if@contsubfig
1909 \@contsubfigfalse
1910 \DeclareOption{subfigure20}{\@contsubfigxxtrue\@contsubfigxxifalse\@contsubfigtrue}
1911 \DeclareOption{subfigure21}{\@contsubfigxxfalse\@contsubfigxxitrue\@contsubfigtrue
1912 \PackageWarningNoLine{ccaption}{%
1913 The subfigure21 option is deprecated.\MessageBreak
1914 Try and use the subfigure option instead}}
1915 \DeclareOption{subfigure}{\@contsubfigxxfalse\@contsubfigxxitrue\@contsubfigtrue}
1916 % \end{macrocode}
1917 % \end{macro}
1918 % \end{macro}
1919 % \end{macro}
1920 %
1921 % \begin{macro}{\if@contcapoption}
1922 % This |\if...| is used to remember if the \Lopt{caption2}
1923 % option has been given
1924 % \begin{macrocode}
1925 \newif\if@contcapoption
1926 \@contcapoptionfalse
1927 \DeclareOption{caption2}{\@contcapoptiontrue}
1928 % \end{macrocode}
1929 % \end{macro}
1930 %
1931 % \begin{macro}{\if@conttitleopt}
1932 % This |\if...| is used to remember if the \Lopt{titles}
1933 % option has been given
1934 % \begin{macrocode}
1935 \newif\if@conttitleopt
1936 \@conttitleoptfalse
1937 \DeclareOption{titles}{\@conttitleopttrue}
1938 % \end{macrocode}
1939 % \end{macro}
1940 %
1941 % \begin{macro}{\ProcessOptions}
1942 % Now process the options.
1943 % \begin{macrocode}
1944
1945 \ProcessOptions\relax
1946
1947 % \end{macrocode}
1948 % \end{macro}
1949 %
1950 % \subsection{Caption styling}
1951 %
1952 % The caption styling\footnote{Thanks to Donald Arseneau and Arash
1953 % Esbatil for their perceptive comments on early versions of the
1954 % styling code.}
1955 % is accomplished by redefining the |\@makecaption|
1956 % command. First, though, define and initialise the user-level commands.
1957 % \changes{v2.7}{2001/01/27}{Added all the styling commands}
1958 %
1959 % The styling is only defined if the \Lopt{caption2} option
1960 % is \emph{not} given.
1961 % But first we have to declare some new |\if| commands before testing
1962 % the option.
1963 % \begin{macro}{\if@contcw}
1964 % \begin{macro}{\if@conthang}
1965 % \begin{macro}{\if@contindent}
1966 % For use when checking caption width and captioning styles styles.
1967 % \begin{macrocode}
1968 \newif\if@contcw
1969 \newif\if@conthang
1970 \newif\if@contindent
1971
1972 % \end{macrocode}
1973 % \end{macro}
1974 % \end{macro}
1975 % \end{macro}
1976 % Issue a warning if the \Lopt{caption2} option has been used.
1977 % \begin{macrocode}
1978 \if@contcapoption
1979 \PackageWarningNoLine{ccaption)}%
1980 {You have used the caption2 option.\MessageBreak
1981 The ccaption styling commands\MessageBreak
1982 are unavailable to you}
1983 \else
1984
1985 % \end{macrocode}
1986 %
1987 % \begin{macro}{\captiondelim}
1988 % \begin{macro}{\@contdelim}
1989 % For the caption delimeter.
1990 % \begin{macrocode}
1991 \newcommand{\captiondelim}[1]{\def\@contdelim{#1}}
1992 \captiondelim{: }
1993
1994 % \end{macrocode}
1995 % \end{macro}
1996 % \end{macro}
1997 %
1998 % \begin{macro}{\captionnamefont}
1999 % \begin{macro}{\@contnfont}
2000 % The font for the caption name.
2001 % \begin{macrocode}
2002 \newcommand{\captionnamefont}[1]{\def\@contnfont{#1}}
2003 \captionnamefont{}
2004
2005 % \end{macrocode}
2006 % \end{macro}
2007 % \end{macro}
2008 %
2009 % \begin{macro}{\captiontitlefont}
2010 % \begin{macro}{\@conttfont}
2011 % The font for the caption title.
2012 % \begin{macrocode}
2013 \newcommand{\captiontitlefont}[1]{\def\@conttfont{#1}}
2014 \captiontitlefont{}
2015
2016 % \end{macrocode}
2017 % \end{macro}
2018 % \end{macro}
2019 %
2020 % \begin{macro}{\flushleftright}
2021 % \begin{macro}{\centerlastline}
2022 % These are in addition to the |\centering|, |\raggedleft| and |\raggedright|
2023 % declarations for paragraphing. |\flushleftright| sets the skips to TeX's
2024 % normal (block) paragraphing values,
2025 % while |\centerlastline| sets the skips to give a centered last line in
2026 % a block paragraph.
2027 % \begin{macrocode}
2028 \newcommand{\flushleftright}{%
2029 \leftskip\z@ \rightskip\z@
2030 \parfillskip=\z@ plus 1fil}
2031 \newcommand{\centerlastline}{%
2032 \leftskip=\z@ plus 1fil
2033 \rightskip=\z@ plus -1fil
2034 \parfillskip=\z@ plus 2fil}
2035
2036 % \end{macrocode}
2037 % \end{macro}
2038 % \end{macro}
2039 %
2040 % \begin{macro}{\captionstyle}
2041 % \begin{macro}{\@contcstyle}
2042 % The paragraphing style for the caption.
2043 % \begin{macrocode}
2044 \newcommand{\captionstyle}[1]{\def\@contcstyle{#1}}
2045 \captionstyle{}
2046
2047 % \end{macrocode}
2048 % \end{macro}
2049 % \end{macro}
2050 %
2051 % \begin{macro}{\@contcwidth}
2052 % \begin{macro}{\captionwidth}
2053 % \begin{macro}{\changecaptionwidth}
2054 % \begin{macro}{\normalcaptionwidth}
2055 % The macros for dealing with the caption width.
2056 % \begin{macrocode}
2057 \newlength{\@contcwidth}
2058 \newcommand{\captionwidth}[1]{\setlength{\@contcwidth}{#1}}
2059 \captionwidth{\linewidth}
2060 \newcommand{\changecaptionwidth}{\@contcwtrue}
2061 \newcommand{\normalcaptionwidth}{\@contcwfalse}
2062 \normalcaptionwidth
2063
2064 % \end{macrocode}
2065 % \end{macro}
2066 % \end{macro}
2067 % \end{macro}
2068 % \end{macro}
2069 %
2070 % \begin{macro}{\@contindw}
2071 % \begin{macro}{\hangcaption}
2072 % \begin{macro}{\indentcaption}
2073 % \begin{macro}{\normalcaption}
2074 % The macros for hanging and indented captions.
2075 % \begin{macrocode}
2076 \newlength{\@contindw}
2077 \newcommand{\hangcaption}{\@conthangtrue\@contindentfalse}
2078 \newcommand{\indentcaption}[1]{\setlength{\@contindw}{#1}%
2079 \@conthangfalse\@contindenttrue}
2080 \newcommand{\normalcaption}{\@conthangfalse\@contindentfalse}
2081 \normalcaption
2082
2083 % \end{macrocode}
2084 % \end{macro}
2085 % \end{macro}
2086 % \end{macro}
2087 % \end{macro}
2088 %
2089 % \begin{macro}{\precaption}
2090 % \begin{macro}{\@contpre}
2091 % \begin{macro}{\postcaption}
2092 % \begin{macro}{\@contpost}
2093 % \begin{macro}{\midbicaption}
2094 % \begin{macro}{\@contmidbi}
2095 % The macros for the pre- and post-caption text/commands, and
2096 % for the mid-caption command for bilingual captions.
2097 % \begin{macrocode}
2098 \newcommand{\precaption}[1]{\def\@contpre{#1}}
2099 \precaption{}
2100 \newcommand{\postcaption}[1]{\def\@contpost{#1}}
2101 \postcaption{}
2102 \newcommand{\midbicaption}[1]{\def\@contmidbi{#1}}
2103 \midbicaption{}
2104
2105 % \end{macrocode}
2106 % \end{macro}
2107 % \end{macro}
2108 % \end{macro}
2109 % \end{macro}
2110 % \end{macro}
2111 % \end{macro}
2112 %
2113 % \begin{macro}{\@makecaption}
2114 % This is a reimplementation of the kernel |\@makecaption| command.
2115 % As well as including the caption typesetting commands it enables
2116 % captions that include forced newlines (e.g., by |\\|).
2117 %
2118 % The first part is due to
2119 % Donald Arseneau\footnote{Email: \texttt{[email protected]}} from postings
2120 % to the CTT newsgroup and Email discussions. The |\topskip| strut is
2121 % used whenever the caption is the first part of the float. This means,
2122 % among other things, that if a caption comes at the
2123 % top of a page, then the first line of the caption will be aligned with
2124 % the normal first line of a page. The |\abovecaptionskip| is only used
2125 % when there is something above the caption in the current float.
2126 % \changes{v2.7}{2001/01/27}{Major surgery to \cs{@makecaption}}
2127 % \changes{v3.0a}{2001/08/03}{Replaced \cs{@tempa} by \cs{@conttempa} to foil
2128 % old versions of amsmath package}
2129 % \begin{macrocode}
2130 \long\def\@makecaption#1#2{\let\@conttempa\relax
2131 \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip
2132 \else \def\@conttempa{\vbox to\topskip{}}\fi
2133 % \end{macrocode}
2134 % \begin{macro}{\@contfnote}
2135 % \begin{macro}{\@contfmark}
2136 % The caption title will be typeset twice, firstly to measure its width
2137 % and secondly to actually typeset it. To avoid problems caused by
2138 % a footnote in the caption getting processed twice, we temporarily
2139 % disable the expected relevant commands.
2140 % \changes{v3.1b}{2002/10/18}{Added \cs{label} to nulled macros in
2141 % \cs{@makecaption} to stop hyperref claiming
2142 % multiple anchor points}
2143 % \begin{macrocode}
2144 \let\@contfnote\footnote \renewcommand{\footnote}[2][]{}
2145 \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{}
2146 \let\@contlabel\label \renewcommand{\label}[1]{}
2147 % \end{macrocode}
2148 % \end{macro}
2149 % \end{macro}
2150 % Now measure the width of the total caption, not forgetting to take account
2151 % of the font specifications, and then restore the footnoting.
2152 % \begin{macrocode}
2153 \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2}
2154 \let\footnote\@contfnote
2155 \let\footnotemark\@contfmark
2156 \let\label\@contlabel
2157 % \end{macrocode}
2158 % If the caption is less than one
2159 % line, then the whole caption needs to be centered on the page (otherwise
2160 % the short caption may be typeset flushleft).
2161 % \begin{macrocode}
2162 \ifdim\wd\@tempboxa<\linewidth \centering \fi
2163 \if@contcw
2164 % \end{macrocode}
2165 % For typesetting at anything other than the normal width, put the caption
2166 % into a |\parbox| of the specified width. This must be centered.
2167 % \begin{macrocode}
2168 \centering
2169 \parbox{\@contcwidth}{%
2170 \fi
2171 \if@conthang
2172 % \end{macrocode}
2173 % For a hanging caption we have to measure the width of the caption name,
2174 % then typeset the whole caption in a hanging paragraph.
2175 % \begin{macrocode}
2176 \sbox\@tempboxa{\@contnfont #1\@contdelim}
2177 \@contpre%
2178 {\@contnfont #1\@contdelim}\@conttempa
2179 {\@contcstyle\hangindent=\wd\@tempboxa\hangafter=\@ne\@conttfont #2\par}
2180 \else
2181 \if@contindent
2182 % \end{macrocode}
2183 % An indented caption is similar, except the amount of indentation is
2184 % kept in |\@contindw|.
2185 % \begin{macrocode}
2186 \@contpre%
2187 {\@contnfont #1\@contdelim}\@conttempa
2188 {\@contcstyle\hangindent=\@contindw\hangafter=\@ne\@conttfont #2\par}
2189 \else
2190 % \end{macrocode}
2191 % For the normal style, just typeset the caption.
2192 % \begin{macrocode}
2193 \@contpre%
2194 {\@contnfont #1\@contdelim}\@conttempa
2195 {\@contcstyle\@conttfont #2\par}
2196 \fi
2197 \fi
2198 % \end{macrocode}
2199 % Finish off the typesetting by processing the post-text, and if not using
2200 % the normal width then close off the |\parbox|, and lastly put in some
2201 % vertical space.
2202 % \begin{macrocode}
2203 \@contpost
2204 \if@contcw
2205 \par
2206 } % end of parbox
2207 \fi
2208 \vskip\belowcaptionskip}
2209
2210 % \end{macrocode}
2211 % \end{macro}
2212 %
2213 % This finishes off the non \Lopt{caption2} option.
2214 % \begin{macrocode}
2215 \fi % end of test (\if@contcapoption) on caption2 option
2216
2217 % \end{macrocode}
2218 %
2219 %
2220 %
2221 %
2222 % \subsection{Continuation captions and legends}
2223 %
2224 % \begin{macro}{\contcaption}
2225 % |\contcaption{|\meta{text}|}| is a user-level command.
2226 % It is a simplified
2227 % version of the normal |\caption| command as it doesn't have to deal
2228 % too much with numbering or list of \dots entries.
2229 % \changes{v3.1c}{2003/11/14}{Added number resetting to \cs{contcaption}}
2230 % \begin{macrocode}
2231 \newcommand{\contcaption}{%
2232 \addtocounter{\@captype}{\m@ne}%
2233 \refstepcounter{\@captype}%
2234 \@contcaption\@captype}
2235
2236 % \end{macrocode}
2237 % \end{macro}
2238 %
2239 %
2240 % \begin{macro}{\@contcaption}
2241 % This is the workhorse for the |\contcaption| command. In turn,
2242 % it uses the |\@makecaption| command (defined in the usual classes)
2243 % to do most of its work. It
2244 % uses the number of the previous |\caption| command in the same
2245 % type of float and its implementation includes much of the code
2246 % used in the LaTeX |\@caption| command.
2247 %
2248 % \begin{macrocode}
2249 \long\def\@contcaption#1#2{%
2250 \par
2251 \begingroup
2252 \@parboxrestore
2253 \if@minipage
2254 \@setminipage
2255 \fi
2256 \normalsize
2257 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #2}\par
2258 \endgroup}
2259
2260 % \end{macrocode}
2261 % \end{macro}
2262 %
2263 %
2264 % \begin{macro}{\abovelegendskip}
2265 % \begin{macro}{\belowlegendskip}
2266 % These two lengths control the vertical spacing before and after a
2267 % legend. We will give these values such that a legend will ocupy an
2268 % integral number of lines.
2269 % \begin{macrocode}
2270 \newlength{\abovelegendskip}
2271 \setlength{\abovelegendskip}{0.5\baselineskip}
2272 \newlength{\belowlegendskip}
2273 \setlength{\belowlegendskip}{\abovelegendskip}
2274
2275 % \end{macrocode}
2276 % \end{macro}
2277 % \end{macro}
2278 %
2279 % \begin{macro}{\legend}
2280 % The command is called as |\legend{|\meta{text}|}|. It is intended
2281 % to be used in a float environment for an `anonymous' caption, but can be
2282 % used anywhere.
2283 %
2284 % The implementation is similar to the |\caption| command but we have
2285 % to eliminate printing of a delimeter.
2286 % \changes{v2.7}{2001/01/27}{Changed \cs{legend} to use \cs{@makecaption} instead of \cs{@makelegend}}
2287 % \changes{v2.7}{2001/01/27}{Deleted \cs{@makelegend} and \cs{formatlegend}}
2288 % \begin{macrocode}
2289 \newcommand{\legend}[1]{%
2290 \par
2291 \begingroup
2292 \@parboxrestore
2293 \if@minipage
2294 \@setminipage
2295 \fi
2296 \normalsize
2297 \captiondelim{\mbox{}}
2298 \@makecaption{}{\ignorespaces #1}\par
2299 \endgroup}
2300
2301 % \end{macrocode}
2302 % \end{macro}
2303 %
2304 %
2305 % \begin{macro}{\namedlegend}
2306 % |\namedlegend[|\meta{short-title}|]{|\meta{long-title}|}| is like the
2307 % |\caption| command except that it does not number the caption.
2308 % \begin{macrocode}
2309 \newcommand{\namedlegend}{\@dblarg{\@legend\@captype}}
2310
2311 % \end{macrocode}
2312 % \end{macro}
2313 %
2314 % \begin{macro}{\@legend}
2315 % |\@legend{|\meta{type}|}[|\meta{short-title}|]{|\meta{long-title}|}|
2316 % is the workhorse for the |\namedlegend| command. In turn, it calls
2317 % |\@makelegend|. It requires two commands to have been defined, namely
2318 % |\flegtoc@type| and |\fleg@type|. The command |\flegtoc@type{|\meta{text}|}|
2319 % is responsible for writing a title text to the appropriate listof file.
2320 % |\fleg@type| is responsible for typeseting the name of the legend.
2321 % \changes{v2.7}{2001/01/27}{Changed \cs{@legend} to use \cs{@makecaption}
2322 % instead of \cs{@makelegend}}
2323 % \begin{macrocode}
2324 \long\def\@legend#1[#2]#3{%
2325 \par
2326 \csname flegtoc@#1\endcsname{#2}%
2327 \begingroup
2328 \@parboxrestore
2329 \if@minipage
2330 \@setminipage
2331 \fi
2332 \normalsize
2333 \@makecaption{\csname fleg@#1\endcsname}{\ignorespaces #3}\par
2334 \endgroup}
2335
2336 % \end{macrocode}
2337 % \end{macro}
2338 %
2339 % \begin{macro}{\flegtoc@table}
2340 % \begin{macro}{\flegtoc@figure}
2341 % These macros write a |\namedlegend| title to the respective listof file.
2342 % By default they do nothing.
2343 % \begin{macrocode}
2344 \newcommand{\flegtoc@table}[1]{}
2345 \newcommand{\flegtoc@figure}[1]{}
2346
2347 % \end{macrocode}
2348 % \end{macro}
2349 % \end{macro}
2350 %
2351 % \begin{macro}{\fleg@table}
2352 % \begin{macro}{\fleg@figure}
2353 % These macros typeset the name before the title of a |\namedlegend|. By
2354 % default they are defined to mimic the normal captioning style.
2355 % \changes{v2.7}{2001/01/27}{Deleted the : delimeter from \cs{fleg@table}
2356 % and \cs{fleg@figure}}
2357 % \begin{macrocode}
2358 \newcommand{\fleg@table}{\tablename}
2359 \newcommand{\fleg@figure}{\figurename}
2360
2361 % \end{macrocode}
2362 % \end{macro}
2363 % \end{macro}
2364 %
2365 %
2366 % \subsection{Non-float captions}
2367 %
2368 % \begin{macro}{\newfixedcaption}
2369 % \begin{macro}{\renewfixedcaption}
2370 % \begin{macro}{\providefixedcaption}
2371 % These commands are defined in terms of their |\...command| counterparts.\\
2372 % Call as |\...fixedcaption[|\meta{capcommand}|]{|\meta{command}|}{|\meta{env}|}|
2373 % \begin{macrocode}
2374 \newcommand{\newfixedcaption}[3][\caption]{%
2375 \newcommand{#2}{\def\@captype{#3}#1}}
2376 \newcommand{\renewfixedcaption}[3][\caption]{%
2377 \renewcommand{#2}{\def\@captype{#3}#1}}
2378 \newcommand{\providefixedcaption}[3][\caption]{%
2379 \providecommand{#2}{\def\@captype{#3}#1}}
2380
2381 % \end{macrocode}
2382 % \end{macro}
2383 % \end{macro}
2384 % \end{macro}
2385 %
2386 % \subsection{Bilingual captions}
2387 %
2388 % The bilingual caption commands all use internal grouping so
2389 % that any changes are kept local. This has the unfortunate side-effect
2390 % that any |\label| command must be within the grouping otherwise the
2391 % wrong number is picked up. To make the coding, if not necessarily the
2392 % use, of the commands simpler, I have not used the traditional style
2393 % of square brackets for optional caption text arguments. Instead, empty
2394 % `required' arguments are used as the implementation means.
2395 %
2396 % \begin{macro}{\@if@contemptyarg}
2397 % For dealing with empty arguments.
2398 % |\@if@contemptyarg{|\meta{testarg}|}{|\meta{YES}|}{|\meta{NO}|}| checks
2399 % if \meta{testarg} is empty (consists of zero or more spaces only). If
2400 % it is empty then the \meta{YES} argument is processed otherwise the
2401 % \meta{NO} argument is processed. The implementation uses code suggested
2402 % by Donald Arseneau (see section~\ref{sec:peril} for some background on this).
2403 % \changes{v2.6c}{2000/03/15}{Rewrite of \cs{@if@contemptyarg}}
2404 % \begin{macrocode}
2405 \begingroup
2406 \catcode`\Q=3
2407 \long\gdef\@if@contemptyarg#1{\@xif@contmt#1QQ\@secondoftwo\@firstoftwo\@nil}
2408 \long\gdef\@xif@contmt#1#2Q#3#4#5\@nil{#4}
2409 \endgroup
2410
2411 % \end{macrocode}
2412 % \end{macro}
2413 %
2414 % \begin{macro}{\bitwonumcaption}
2415 % \changes{v2.6}{2000/02/26}{New \cs{bitwonumcaption} command}
2416 % The 6 arguments are: optional label, short and long in language 1,
2417 % name in
2418 % language 2, and short and long in language 2. Both texts are put
2419 % into the List of as numbered entries.
2420 % \changes{v3.2a}{2005/03/29}{Fix empty check in \cs{bitwonumcaption}}
2421 % \begin{macrocode}
2422 \newcommand{\bitwonumcaption}[6][\@empty]{%
2423 \begingroup
2424 % \end{macrocode}
2425 % Check if the first language argument is vacuous, then call
2426 % the normal |\caption| for language 1.
2427 % \begin{macrocode}
2428 \@if@contemptyarg{#2}{\caption{#3}}{\caption[#2]{#3}}
2429 % \end{macrocode}
2430 % Do the optional labeling.
2431 % \begin{macrocode}
2432 \ifx\@empty#1\else
2433 \label{#1}
2434 \fi
2435 % \end{macrocode}
2436 % Remove any extra spacing between the captions, and set the
2437 % NAME for the second caption. Use a command to transfer
2438 % the NAME to the renewell code to avoid circularity if
2439 % for example, we are trying to redefine |\tablename| as
2440 % |\tablename|. Decrement the caption counter.
2441 % \begin{macrocode}
2442 \setlength{\abovecaptionskip}{0pt}
2443 \setlength{\belowcaptionskip}{0pt}
2444 \edef\@conttempc{#4}
2445 \expandafter \renewcommand \csname \@captype name\endcsname{\@conttempc}
2446 \addtocounter{\@captype}{-1}
2447 % \end{macrocode}
2448 % Now repeat for the second language caption.
2449 % \changes{v2.7}{2001/01/27}{Added \cs{@contmidbi} to bilingual captions}
2450 % \begin{macrocode}
2451 \@contmidbi
2452 \@if@contemptyarg{#5}{\caption{#6}}{\caption[#5]{#6}}
2453 \endgroup}
2454
2455 % \end{macrocode}
2456 % \end{macro}
2457 %
2458 % \begin{macro}{\bionenumcaption}
2459 % \changes{v2.6}{2000/02/26}{New \cs{bionenumcaption} command}
2460 % The 6 arguments are: optional labelling,
2461 % short and long in language 1, name in
2462 % language 2, and short and long in language 2. Both texts are put
2463 % into the List of, but only the first is numbered.
2464 % \changes{v3.2a}{2005/03/29}{Fix empty check in \cs{bionenumcaption}}
2465 % \begin{macrocode}
2466 \newcommand{\bionenumcaption}[6][\@empty]{%
2467 \begingroup
2468 % \end{macrocode}
2469 % Check if the first language argument is vacuous, then call
2470 % the normal |\caption| for language 1.
2471 % \begin{macrocode}
2472 \@if@contemptyarg{#2}{\caption{#3}}{\caption[#2]{#3}}
2473 % \end{macrocode}
2474 % Do the optional labeling.
2475 % \begin{macrocode}
2476 \ifx\@empty#1\else
2477 \label{#1}
2478 \fi
2479 % \end{macrocode}
2480 % Do the between captions code.
2481 % \begin{macrocode}
2482 \setlength{\abovecaptionskip}{0pt}
2483 \setlength{\belowcaptionskip}{0pt}
2484 \edef\@conttempc{#4}
2485 \expandafter \renewcommand \csname \@captype name\endcsname{\@conttempc}
2486 % \end{macrocode}
2487 % Use a continuation caption for the second language, not forgetting
2488 % to add the appropriate unnumbered text to the List.
2489 % \begin{macrocode}
2490 \@contmidbi
2491 \contcaption{#6}
2492 \@if@contemptyarg{#5}{%
2493 \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
2494 {\protect\numberline{}{\ignorespaces #6}}}{%
2495 \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
2496 {\protect\numberline{}{\ignorespaces #5}}}
2497 \endgroup}
2498
2499 % \end{macrocode}
2500 % \end{macro}
2501 %
2502 % \begin{macro}{\bicaption}
2503 % \changes{v2.6}{2000/02/26}{New \cs{bicaption} command}
2504 % The 5 arguments are: optional labelling,
2505 % short and long in language 1, name in
2506 % language 2, and long in language 2.
2507 % Only the first text is put into the List.
2508 % \changes{v3.2a}{2005/03/29}{Fix empty check in \cs{bicaption}}
2509 % \begin{macrocode}
2510 \newcommand{\bicaption}[5][\@empty]{%
2511 \begingroup
2512 % \end{macrocode}
2513 % Check if the first language argument is vacuous, then call
2514 % the normal |\caption| for language 1.
2515 % \begin{macrocode}
2516 \@if@contemptyarg{#2}{\caption{#3}}{\caption[#2]{#3}}
2517 % \end{macrocode}
2518 % Do the optional labeling.
2519 % \begin{macrocode}
2520 \ifx\@empty#1\else
2521 \label{#1}
2522 \fi
2523 % \end{macrocode}
2524 % Do the between captions code and
2525 % finally just use |\contcaption| for the
2526 % second language.
2527 % \begin{macrocode}
2528 \setlength{\abovecaptionskip}{0pt}
2529 \setlength{\belowcaptionskip}{0pt}
2530 \edef\@conttempc{#4}
2531 \expandafter \renewcommand \csname \@captype name\endcsname{\@conttempc}
2532 \@contmidbi
2533 \contcaption{#5}
2534 \endgroup}
2535
2536 % \end{macrocode}
2537 % \end{macro}
2538 %
2539 % \begin{macro}{\bicontcaption}
2540 % \changes{v2.6}{2000/02/26}{New \cs{bicontcaption} command}
2541 % The 3 arguments are long in language 1, name in
2542 % language 2, and long in language 2.
2543 % \begin{macrocode}
2544 \newcommand{\bicontcaption}[3]{%
2545 \begingroup
2546 % \end{macrocode}
2547 % Call |\contcaption| for language 1.
2548 % \begin{macrocode}
2549 \contcaption{#1}
2550 % \end{macrocode}
2551 % Do the between captions code and use |\contcaption| for the second
2552 % language.
2553 % \begin{macrocode}
2554 \setlength{\abovecaptionskip}{0pt}
2555 \setlength{\belowcaptionskip}{0pt}
2556 \edef\@conttempc{#2}
2557 \expandafter \renewcommand \csname \@captype name\endcsname{\@conttempc}
2558 \@contmidbi
2559 \contcaption{#3}
2560 \endgroup}
2561
2562 % \end{macrocode}
2563 % \end{macro}
2564 %
2565 % \subsection{The code for the \Lpack{longtable} package}
2566 %
2567 % \begin{macro}{\LT@makecaption}
2568 % This is defined in the \Lpack{longtable} package and sets a caption
2569 % essentially as a centered multicolumn entry in the table. To utilize
2570 % \Lpack{ccaption}'s font settings it has to be modified.
2571 % N.B. that |#1| is either |\@firstofone| or |\@gobble| so we need double
2572 % braces to protect the font change.
2573 % \changes{v3.2}{2005/03/21}{Added \cs{LT@makecaption}}
2574 % \changes{v3.2c}{2011/08/07}{Fix bug in longtable compatibility.}
2575 % \begin{macrocode}
2576 \def\LT@makecaption#1#2#3{%
2577 \LT@mcol\LT@cols c{\hb@xt@ \z@{\hss\parbox[t]\LTcapwidth{%
2578 \sbox\@tempboxa{#1{{\@contnfont #2\@contdelim}}\@conttfont #3}%
2579 \ifdim\wd\@tempboxa>\hsize
2580 #1{{\@contnfont #2\@contdelim}}\@conttfont #3%
2581 \else
2582 \hb@xt@ \hsize{\hfil\box\@tempboxa\hfil}%
2583 \fi
2584 \endgraf\vskip\belowcaptionskip}%
2585 \hss}}}
2586 % \end{macrocode}
2587 % \end{macro}
2588 %
2589 % \begin{macro}{\longbitwonumcaption}
2590 % A version of \cs{bitwonumcaption} for use in a |longtable|.
2591 % \changes{v3.2}{2005/03/21}{Added \cs{longbitwonumcaption}}
2592 % \begin{macrocode}
2593 \newcommand*{\longbitwonumcaption}[5]{%
2594 \@if@contemptyarg{#1}{\caption{#2}}{\caption[#1]{#2}}%
2595 \global\let\@cont@oldtablename\tablename
2596 \gdef\tablename{#3}
2597 \\
2598 \@if@contemptyarg{#4}{\caption{#5}}{\caption[#4]{#5}}%
2599 \global\let\tablename\@cont@oldtablename}
2600
2601 % \end{macrocode}
2602 % \end{macro}
2603 %
2604 % \begin{macro}{\@cont@LT@nonumintoc}
2605 % \begin{macro}{\@cont@oldLT@c@ption}
2606 % We need a special version of \Lpack{longtable}'s \cs{LT@c@ption}
2607 % that does not put a number in the ToC.
2608 % \changes{v3.2}{2005/03/21}{Added \cs{@cont@LT@nonumintoc}}
2609 % \begin{macrocode}
2610 \def\@cont@LT@nonumintoc#1[#2]#3{%
2611 \LT@makecaption#1\fnum@table{#3}%
2612 \def\@tempa{#2}%
2613 \ifx\@tempa\@empty\else
2614 {\let\\\space
2615 \addcontentsline{lot}{table}{\protect\numberline{}{#2}}}%
2616 \fi}
2617 \let\@cont@oldLT@c@ption\LT@c@ption
2618
2619 % \end{macrocode}
2620 % \end{macro}
2621 % \end{macro}
2622 %
2623 % \begin{macro}{\longbionenumcaption}
2624 % A version of \cs{bionenumcaption} for use in a |longtable|.
2625 % \changes{v3.2}{2005/03/21}{Added \cs{longbionenumcaption}}
2626 % \begin{macrocode}
2627 \newcommand*{\longbionenumcaption}[5]{%
2628 \@if@contemptyarg{#1}{\caption{#2}}{\caption[#1]{#2}}%
2629 \global\let\@cont@oldtablename\tablename
2630 \gdef\tablename{#3}
2631 \global\let\LT@c@ption\@cont@LT@nonumintoc
2632 \\
2633 \@if@contemptyarg{#4}{\caption{#5}}{\caption[#4]{#5}}%
2634 \global\let\tablename\@cont@oldtablename
2635 \global\let\LT@c@ption\@cont@oldLT@c@ption}
2636
2637 % \end{macrocode}
2638 % \end{macro}
2639 %
2640 % \begin{macro}{\longbicaption}
2641 % A version of \cs{bicaption} for use in a |longtable|.
2642 % \changes{v3.2}{2005/03/21}{Added \cs{longbicaption}}
2643 % \begin{macrocode}
2644 \newcommand*{\longbicaption}[4]{%
2645 \@if@contemptyarg{#1}{\caption{#2}}{\caption[#1]{#2}}%
2646 \\
2647 \caption*{{\normalfont\@contnfont #3\@contdelim} #4}}
2648
2649 % \end{macrocode}
2650 % \end{macro}
2651 %
2652 %
2653 %
2654 % \subsection{The \Lopt{subfigure} options}
2655 %
2656 %
2657 % \begin{macro}{\@contkeep}
2658 % \begin{macro}{\@contset}
2659 % \begin{macro}{\subconcluded}
2660 % \begin{macro}{\subfigold@contcaption}
2661 % These are common to both \Lopt{subfigure} options. |\@contkeep| stores
2662 % the current sub(figure/table) number in counter |@contsubnum| and
2663 % |\@contset| sets the sub(figure/table) number to the value of |@contsubnum|.
2664 % |\subconcluded| sets the sub(figure/table) number to zero. The original
2665 % definition of |\@contcaption| is kept in |\subfigold@contcaption|.
2666 % \begin{macrocode}
2667 \if@contsubfig
2668 \newcounter{@contsubnum}
2669 \newcommand{\@contkeep}{\setcounter{@contsubnum}{\value{sub\@captype}}}
2670 \newcommand{\@contset}{\setcounter{sub\@captype}{\value{@contsubnum}}}
2671 \newcommand{\subconcluded}{\setcounter{sub\@captype}{0}}
2672 \let\subfigold@contcaption\@contcaption
2673 % \end{macrocode}
2674 % \end{macro}
2675 % \end{macro}
2676 % \end{macro}
2677 % \end{macro}
2678 %
2679 % \begin{macro}{\toclevel@subtable}
2680 % \begin{macro}{\toclevel@subfigure}
2681 % These are needed if the \Lpack{hyperref} package is loaded
2682 % as well as subfigures.
2683 % \changes{v2.6e}{2001/01/12}{Added toclevel@subtable and @subfigure commands for hyperref}
2684 % \begin{macrocode}
2685 \providecommand{\toclevel@subtable}{1}
2686 \providecommand{\toclevel@subfigure}{1}
2687 \fi
2688 % \end{macrocode}
2689 % \end{macro}
2690 % \end{macro}
2691 %
2692 % \begin{macro}{\if@contmaincaption}
2693 % This is set TRUE after the (cont)caption in a float has been processed.
2694 % (A |\newif| cannot be used within an |\if...\fi| construct.)
2695 % \begin{macrocode}
2696 \newif\if@contmaincaption
2697 \@contmaincaptionfalse
2698 % \end{macrocode}
2699 % \end{macro}
2700 %
2701 % \begin{macro}{\if@contbotsub}
2702 % A flag indicating whether the subcaption is to be at the bottom or
2703 % top of the subfigure/subtable; TRUE for the subcaption at the bottom.
2704 % \begin{macrocode}
2705 \newif\if@contbotsub
2706 \@contbotsubtrue
2707
2708 % \end{macrocode}
2709 % \end{macro}
2710 %
2711 % \subsubsection{Option \Lopt{subfigure20}}
2712 %
2713 % \changes{v2.5}{2000/02/20}{Addition of subfigure20 section in code portion}
2714 % In order to eliminate an ordering dependency between the
2715 % \Lpack{subfigure} and \Lpack{\pname} packages, modifications to the
2716 % original \Lpack{subfigure} code have to be done at the start of the
2717 % document after all packages have been loaded.
2718 % First for subfigure 2.0, if it is called for.
2719 % \begin{macrocode}
2720 \AtBeginDocument{%
2721 \if@contsubfigxx
2722 % \end{macrocode}
2723 %
2724 % \begin{macro}{\caption}
2725 % \begin{macro}{\contcaption}
2726 % \begin{macro}{\@float}
2727 % \begin{macro}{\@dbflt}
2728 % These original commands are all modified to set the value of
2729 % |\if@contmaincaption|. The (cont)caption commands set it to TRUE and the
2730 % float commands set it FALSE. Additionally, the |\@float| and |\@dbflt|
2731 % commands are modified to zero the subfloat counter, if it is defined.
2732 % \begin{macrocode}
2733 \let\@contoldc\caption
2734 \renewcommand{\caption}{\@contmaincaptiontrue\@contoldc}
2735 \let\@contoldcont\contcaption
2736 \renewcommand{\contcaption}{\@contmaincaptiontrue\@contoldcont}
2737 \let\@contoldf\@float
2738 \renewcommand{\@float}[1]{\@contmaincaptionfalse
2739 \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}
2740 \@contoldf{#1}}
2741 \let\@contoldff\@dbflt
2742 \renewcommand{\@dbflt}[1]{\@contmaincaptionfalse
2743 \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}
2744 \@contoldff{#1}}
2745
2746 % \end{macrocode}
2747 % \end{macro}
2748 % \end{macro}
2749 % \end{macro}
2750 % \end{macro}
2751 %
2752 % \begin{macro}{\@subfloat}
2753 % This macro from \Lopt{subfigure} v2.0 is modified to enable subcaptions
2754 % to be placed at either the top or bottom of the sub... (the original only
2755 % placed them at the bottom). First, the subfigure/table is set in a box.
2756 % \begin{macrocode}
2757 \def\@subfloat#1[#2]#3{%
2758 \setbox\@tempboxa \hbox{#3}%
2759 \@tempdima=\wd\@tempboxa
2760 \if@contbotsub
2761 % \end{macrocode}
2762 % The subcaption is to be put at the bottom, so typeset the figure, followed
2763 % by the caption, if any.
2764 % \begin{macrocode}
2765 \vtop{%
2766 \vbox{\vskip\subfigtopskip
2767 \box\@tempboxa}%
2768 \ifx \@empty#2\relax \else
2769 \vskip\subfigcapskip
2770 \@subcaption{#1}{#2}%
2771 \fi
2772 \vskip\subfigbottomskip}%
2773 \else
2774 % \end{macrocode}
2775 % The subcaption is to be put at the top, so typeset the caption if any,
2776 % followed by the figure.
2777 % \begin{macrocode}
2778 \vtop{%
2779 \ifx \@empty#2\relax \else
2780 \vskip\subfigcapskip
2781 \begingroup\@subcaption{#1}{#2}\endgroup%
2782 \fi
2783 \vbox{\vskip\subfigtopskip
2784 \box\@tempboxa}%
2785 \vskip\subfigbottomskip}%
2786 \fi
2787 \egroup}
2788
2789 % \end{macrocode}
2790 % \end{macro}
2791 %
2792 %
2793 % \begin{macro}{\@subcaption}
2794 % The original |\@subcaption| command produces unexpected results in the
2795 % ToC (i.e., |numberline| appears instead of |\numberline| because of
2796 % the original internal definition of |\protect|). I have also
2797 % modified it so that when a top main caption is being used, it
2798 % adds the subcaption to the ToC directly.
2799 %
2800 % Sebastien Derriere found that there were problems when fragile commands
2801 % were used within a continued subcaption. Steven Douglas Cochran kindly
2802 % provided a fix for this.
2803 % \changes{v2.6d}{2001/01/02}{Applied SDC fix to @subcaption command}
2804 %
2805 % \begin{macrocode}
2806 \renewcommand{\@subcaption}[2]{%
2807 \begingroup
2808 \let\label\@gobble
2809 \let\protect\string % SDC mod
2810 \if@contmaincaption
2811 \addcontentsline{\csname ext@#1\endcsname}{#1}%
2812 {\protect\numberline{\csname p@#1\endcsname\csname the#1\endcsname}%
2813 {\ignorespaces #2}}%
2814 \gdef\@subfigcaptionlist{}
2815 \else
2816 \xdef\@subfigcaptionlist{%
2817 \@subfigcaptionlist,%
2818 %% {\string\numberline {\@currentlabel}% % SDC mod
2819 {\protect\numberline {\@currentlabel}% % SDC mod
2820 \noexpand{\ignorespaces #2}}}%
2821 \fi
2822 \endgroup
2823 \@nameuse{@make#1caption}{\@nameuse{@the#1}}{#2}}
2824
2825 % \end{macrocode}
2826 % \end{macro}
2827 %
2828 % \begin{macro}{\subfigure}
2829 % \begin{macro}{\subtable}
2830 % These are revised versions of the original commands. They are now
2831 % aliases for |\subbottom| and |\subtop| respectively. In their original
2832 % form they were both effectively aliases for |\subbottom| only.
2833 % \begin{macrocode}
2834 \let\subfigure\subbottom
2835 \let\subtable\subtop
2836 % \end{macrocode}
2837 % \end{macro}
2838 % \end{macro}
2839 % \begin{macrocode}
2840 \fi
2841 }
2842 % \end{macrocode}
2843 % The end of the |\AtBeginDocument| code for \Lopt{subfigure20}.
2844 %
2845 %
2846 % Do the remaining code for the \Lopt{subfigure20} option, if called for.
2847 % \begin{macrocode}
2848 \if@contsubfigxx
2849 % \end{macrocode}
2850 % \begin{macro}{\subbottom}
2851 % \begin{macro}{\@contsubbody}
2852 % |\subbottom[|\meta{caption}|]{|\meta{text}|}| typesets a subcaption
2853 % when the main caption is at the end of the float environment. The code
2854 % is a slight modification of the original |\subfigure| command in that
2855 % the bottom flag is added and set to true and the subcaption number is
2856 % stored. The caption number must be locally advanced if the main caption
2857 % has not yet been processed (i.e., is at the bottom of the float). As most
2858 % of the code is common with |\subtop| it is placed into the |\@contsubbody|
2859 % macro.
2860 % \begin{macrocode}
2861 \newcommand{\subbottom}{%
2862 \@contbotsubtrue
2863 \@contsubbody}
2864
2865 \newcommand{\@contsubbody}{%
2866 \bgroup
2867 \if@contmaincaption\else
2868 \advance\csname c@\@captype\endcsname\@ne
2869 \fi
2870 \refstepcounter{sub\@captype}\@contkeep%
2871 \leavevmode
2872 \@ifnextchar [%
2873 {\@subfloat{sub\@captype}}
2874 {\@subfloat{sub\@captype}[\@empty]}}
2875
2876 % \end{macrocode}
2877 % \end{macro}
2878 % \end{macro}
2879 %
2880 % \begin{macro}{\contsubbottom}
2881 % \begin{macro}{\subbody@cont}
2882 % The continued version of |\subbottom|. It restores the kept subcaption
2883 % number before incrementing and keeping it. As most of the code is common
2884 % with |\contsubtop| it is kept in the |\subbody@cont|.
2885 % \begin{macrocode}
2886 \newcommand{\contsubbottom}{%
2887 \@contbotsubtrue
2888 \subbody@cont}
2889
2890 \newcommand{\subbody@cont}{%
2891 \bgroup
2892 \@contset
2893 \refstepcounter{sub\@captype}\@contkeep%
2894 \leavevmode
2895 \@ifnextchar [%
2896 {\@subfloat{sub\@captype}}
2897 {\@subfloat{sub\@captype}[\@empty]}}
2898
2899 % \end{macrocode}
2900 % \end{macro}
2901 % \end{macro}
2902 %
2903 % \begin{macro}{\subtop}
2904 % |\subtop[|\meta{caption}|]{|\meta{text}|}| typesets a subcaption
2905 % at the top of the subfigure/table. This is almost identical to |\subbottom|.
2906 % \begin{macrocode}
2907 \newcommand{\subtop}{%
2908 \@contbotsubfalse
2909 \@contsubbody}
2910
2911 % \end{macrocode}
2912 % \end{macro}
2913 %
2914 % \begin{macro}{\contsubtop}
2915 % The continued version of |\subtop|.
2916 % \begin{macrocode}
2917 \newcommand{\contsubtop}{%
2918 \@contbotsubfalse
2919 \subbody@cont}
2920
2921 % \end{macrocode}
2922 % \end{macro}
2923 %
2924 % \begin{macro}{\@contcaption}
2925 % The |\@contcaption| command must be modified to add the listed
2926 % subcaptions (if any, and there should be none for top main captions)
2927 % to the ToC. A simplified version of the \Lopt{subfigure} redefinition
2928 % of |\@caption|.
2929 % \begin{macrocode}
2930 \long\def\@contcaption#1#2{%
2931 \subfigold@contcaption{#1}{#2}%
2932 \@for \@conttempa:=\@subfigcaptionlist \do {%
2933 \ifx\@empty\@conttempa\relax \else
2934 \addcontentsline
2935 {\@nameuse{ext@sub#1}}%
2936 {sub#1}%
2937 {\@conttempa}%
2938 \fi}%
2939 \gdef\@subfigcaptionlist{}}
2940
2941 % \end{macrocode}
2942 % \end{macro}
2943 %
2944 % \begin{macro}{\contsubtable}
2945 % \begin{macro}{\contsubfigure}
2946 % Aliases for |\contsubtop| and |\contsubbottom|, respectively.
2947 % \begin{macrocode}
2948 \let\contsubtable\contsubtop
2949 \let\contsubfigure\contsubbottom
2950
2951 % \end{macrocode}
2952 % \end{macro}
2953 % \end{macro}
2954 %
2955 % The end of the \Lopt{subfigure20} option code.
2956 % \begin{macrocode}
2957 \fi
2958
2959 % \end{macrocode}
2960 %
2961 % This is the end of the version 2.0 code.
2962 %
2963 % \subsubsection{Option \Lopt{subfigure21}}
2964 %
2965 %
2966 % \begin{macro}{\caption}
2967 % \begin{macro}{\contcaption}
2968 % \begin{macro}{\@float}
2969 % \begin{macro}{\@dbflt}
2970 % These original commands are all modified to set the value of
2971 % |\if@contmaincaption|. The (cont)caption commands set it to TRUE and the
2972 % float commands set it FALSE. Additionally, the |\@float| and |\@dbflt|
2973 % commands are modified to zero the subfloat counter, if it is defined.
2974 % \changes{v3.1a}{2002/04/01}{Added changes to \cs{@float}, etc, to
2975 % subfigure (21) option code}
2976 % \begin{macrocode}
2977 \if@contsubfigxxi
2978 \let\@contoldc\caption
2979 \renewcommand{\caption}{\@contmaincaptiontrue\@contoldc}
2980 \let\@contoldcont\contcaption
2981 \renewcommand{\contcaption}{\@contmaincaptiontrue\@contoldcont}
2982 \let\@contoldf\@float
2983 \renewcommand{\@float}[1]{\@contmaincaptionfalse
2984 \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}
2985 \@contoldf{#1}}
2986 \let\@contoldff\@dbflt
2987 \renewcommand{\@dbflt}[1]{\@contmaincaptionfalse
2988 \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}
2989 \@contoldff{#1}}
2990 \fi
2991
2992 % \end{macrocode}
2993 % \end{macro}
2994 % \end{macro}
2995 % \end{macro}
2996 % \end{macro}
2997 %
2998 % \begin{macro}{\@contsubfloat}
2999 % This is a version of the \Lpack{subfigure} |\subfigure| command.
3000 % The revised version stores the subcounter.
3001 % \changes{v3.1}{2002/02/20}{Replaced \cs{do@contsubfig} by \cs{@contsubfloat}}
3002 % \changes{v3.1a}{2002/04/01}{Added \cs{subfig@oldlabel} to \cs{@contsubfloat}}
3003 % \begin{macrocode}
3004 \newcommand{\@contsubfloat}{%
3005 \bgroup
3006 \let\subfig@oldlabel=\label
3007 \let\label=\sub@label
3008 \refstepcounter{sub\@captype}\@contkeep% % <- change here
3009 \@ifnextchar [%
3010 {\@@cont@subfloat}%
3011 {\@@cont@subfloat[\@empty]}}
3012
3013 % \end{macrocode}
3014 % \end{macro}
3015 %
3016 % \begin{macro}{\@@contsubfloat}
3017 % This is a revised version of the \Lpack{subfigure} |\@subfigure| command
3018 % (just the called macronames are changed).
3019 % \begin{macrocode}
3020 \def\@@contsubfloat[#1]{%
3021 \@ifnextchar [%
3022 {\@@@contsubfloat{sub\@captype}[#1]}%
3023 {\@@@contsubfloat{sub\@captype}[\@empty #1][#1]}}
3024
3025 % \end{macrocode}
3026 % \end{macro}
3027 %
3028 % \begin{macro}{\@@@contsubfloat}
3029 % This is a modified version of the \Lpack{subfigure} |\@subfloat|
3030 % command. Essentially the |\csname if#1topcap\endcsname| constructs are
3031 % replaced by |\if@contbotsub|. This is actually only required for
3032 % user-defined floats where I haven't been able to work out if it is
3033 % possible to create new |\if#1...| commands within a command that has a
3034 % a parameter |#1|.
3035 % \begin{macrocode}
3036 \long\def\@@@contsubfloat#1[#2][#3]#4{%
3037 \@tempcnta=\@ne
3038 \ifsf@tight
3039 \if@minipage
3040 \@tempcnta=\z@
3041 \else
3042 \ifdim\lastskip=\z@
3043 \@tempcnta=\@ne
3044 \else
3045 \@tempcnta=\tw@
3046 \fi
3047 \fi
3048 \fi
3049 \if@contbotsub
3050 \def\subfig@top{\subfigtopskip}%
3051 \def\subfig@bottom{\subfigbottomskip}%
3052 \else
3053 \def\subfig@top{\subfigbottomskip}%
3054 \def\subfig@bottom{\subfigtopskip}%
3055 \fi
3056 \setbox\@tempboxa \hbox{#4}%
3057 \@tempdima=\wd\@tempboxa
3058 \vtop\bgroup
3059 \vbox\bgroup
3060 \ifcase\@tempcnta
3061 \@minipagefalse
3062 \or
3063 \vspace{\subfig@top}
3064 \or
3065 \ifdim \lastskip=\z@ \else
3066 \@tempskipb\subfig@top\relax\@xaddvskip
3067 \fi
3068 \fi
3069 \if@contbotsub
3070 \box\@tempboxa\egroup
3071 \ifx \@empty#3\relax \else
3072 \vskip\subfigcapskip
3073 \@subcaption{#1}{#2}{#3}%
3074 \fi
3075 \else
3076 \ifx\@empty#3\relax \else
3077 \@subcaption{#1}{#2}{#3}%
3078 \vskip\subfigcapskip
3079 \vskip\subfigcaptopadj
3080 \fi\egroup
3081 \box\@tempboxa
3082 \fi
3083 \vspace{\subfig@bottom}
3084 \egroup
3085 \egroup}
3086
3087 % \end{macrocode}
3088 % \end{macro}
3089 %
3090 % \begin{macro}{\cont@subfig@oldcaption}
3091 % Keep the definition of |\@caption|.
3092 % \begin{macrocode}
3093 \let\cont@subfig@oldcaption\@caption
3094
3095 % \end{macrocode}
3096 % \end{macro}
3097 %
3098 % The remainder of the \Lopt{subfigure21} option code.
3099 % \begin{macro}{\doxxi@contcaption}
3100 % This command redefines the |\@contcaption| command to flush out any
3101 % pending subcaptions. The redefinition cannot be done within |\if...\fi|
3102 % because of the internal |\if...| creation. The code is simplified from
3103 % the \Lpack{subfigure} v2.1 redefinition of |\@caption|.
3104 % \begin{macrocode}
3105 \newcommand{\doxxi@contcaption}{%
3106 \long\def\@contcaption##1##2{%
3107 \if@contbotsub
3108 \@listsubcaptions{##1}%
3109 \subfigold@contcaption{##1}{##2}
3110 \else
3111 \subfigold@contcaption{##1}{##2}
3112 \@listsubcaptions{##1}%
3113 \fi}
3114 }
3115
3116 % \end{macrocode}
3117 % \end{macro}
3118 % We can now call the rest of the \Lopt{subfigure21} code, if required.
3119 % \begin{macrocode}
3120 %%%\if@contsubfigxxi
3121
3122 % \end{macrocode}
3123 %
3124 % \begin{macro}{\subbottom}
3125 % \begin{macro}{\@contsubbody}
3126 % |\subbottom[|\meta{list-entry}|][|\meta{subcaption}|]{|\meta{text}|}|
3127 % typesets a subcaption below the \meta{text}. Most of the work is
3128 % performed by the |\@contsubbody| macro.
3129 % \changes{v3.1a}{2002/04/01}{Added \cs{subfig@oldlabel} to \cs{@contsubbody}}
3130 % \begin{macrocode}
3131 \newcommand{\subbottom}{%
3132 \@contbotsubtrue
3133 \@contsubbody}
3134
3135 \newcommand{\@contsubbody}{%
3136 \bgroup
3137 \let\subfig@oldlabel=\label
3138 \let\label=\sub@label
3139 \if@contmaincaption\else
3140 \advance\csname c@\@captype\endcsname\@ne
3141 \fi
3142 \refstepcounter{sub\@captype}\@contkeep%
3143 \leavevmode
3144 \@ifnextchar [%
3145 {\@@contsubfloat}%
3146 {\@@contsubfloat[\@empty]}}
3147
3148 % \end{macrocode}
3149 % \end{macro}
3150 % \end{macro}
3151 %
3152 % \begin{macro}{\contsubbottom}
3153 % \begin{macro}{\subbody@cont}
3154 % These are the continued versions of |\subbottom| and |\@contsubbody|.
3155 % \changes{v3.1a}{2002/04/01}{Added \cs{subfig@oldlabel} to \cs{subbody@cont}}
3156 % \begin{macrocode}
3157 \newcommand{\contsubbottom}{%
3158 \@contbotsubtrue
3159 \subbody@cont}
3160
3161 \newcommand{\subbody@cont}{%
3162 \bgroup
3163 \let\subfig@oldlabel=\label
3164 \let\label=\sub@label
3165 \@contset
3166 \refstepcounter{sub\@captype}\@contkeep%
3167 \leavevmode
3168 \@ifnextchar [%
3169 {\@@contsubfloat}%
3170 {\@@contsubfloat[\@empty]}}
3171
3172 % \end{macrocode}
3173 % \end{macro}
3174 % \end{macro}
3175 %
3176 % \begin{macro}{\subtop}
3177 % \begin{macro}{\contsubtop}
3178 % These are similar to |\subbottom| and |\contsubbottom| except that they
3179 % put the subcaption on top of the \meta{text}.
3180 % \begin{macrocode}
3181 \newcommand{\subtop}{%
3182 \@contbotsubfalse
3183 \@contsubbody}
3184
3185 \newcommand{\contsubtop}{%
3186 \@contbotsubfalse
3187 \subbody@cont}
3188
3189 % \end{macrocode}
3190 % \end{macro}
3191 % \end{macro}
3192 %
3193
3194 % \begin{macro}{\contsubfigure}
3195 % This a simplified version of |\subfigure| in that the main caption counter
3196 % is not incremented (we should be in a continued float), and the subcounter
3197 % is restored before being incremented.
3198 % \changes{v3.1a}{2002/04/01}{Added \cs{subfig@oldlabel} to \cs{contsubfigure}}
3199 % \begin{macrocode}
3200 \newcommand{\contsubfigure}{%
3201 \bgroup
3202 \let\subfig@oldlabel=\label
3203 \let\label=\sub@label
3204 \@contset
3205 \refstepcounter{sub\@captype}\@contkeep%
3206 \@ifnextchar [%
3207 {\@@contsubfloat}%
3208 {\@@contsubfloat[\@empty]}}
3209
3210 % \end{macrocode}
3211 % \end{macro}
3212 %
3213 % \begin{macro}{\@contsf}
3214 % \begin{macro}{\@contst}
3215 % These are versions of the |\subfigure| and |\subtable| macros written
3216 % using the \Lpack{ccaption} style.
3217 % \begin{macrocode}
3218 \newcommand{\@contsf}{\@contbotsubtrue%
3219 \ifsubfiguretopcap\@contbotsubfalse\fi%
3220 \@contsubbody}
3221 \newcommand{\@contst}{\@contbotsubtrue%
3222 \ifsubtabletopcap\@contbotsubfalse\fi%
3223 \@contsubbody}
3224
3225 % \end{macrocode}
3226 % \end{macro}
3227 % \end{macro}
3228 %
3229 %
3230 % Now these can be used if appropriate within the |\AtBeginDocument| code.
3231 % But first call for the new version of |\@contcaption|.
3232 % \changes{v3.1b}{2002/10/18}{Added braces to bracketed arg in
3233 % \cs{cont@subfig@oldcaption}, otherwise brackets
3234 % in the \cs{caption} argument confuse things.}
3235 % \begin{macrocode}
3236 \if@contsubfigxxi
3237
3238 \doxxi@contcaption
3239
3240 \AtBeginDocument{%
3241 \let\@subfloat\@@@contsubfloat
3242 \let\@subfigure\@@contsubfloat
3243 \let\subfigure\@contsf
3244 \let\subtable\@contst
3245 \let\contsubfigure\contsubbottom
3246 \let\contsubtable\contsubtop
3247 \long\def\@caption#1[#2]#3{%
3248 \cont@subfig@oldcaption{#1}[{#2}]{#3}}
3249 }
3250
3251 % \end{macrocode}
3252 %
3253 % The end of the \Lopt{subfigure21} option code.
3254 % \begin{macrocode}
3255 \fi
3256
3257 % \end{macrocode}
3258 %
3259 % \subsection{New floats}
3260 %
3261 % To define a float environment, say |fenv|, the following macros must be defined:
3262 % \begin{itemize}
3263 % \item |\fps@fenv| The default placement specifier (normally |tbp|).
3264 % \item |\ftype@fenv| The type number which is an integer and a power of 2.
3265 % \item |\ext@fenv| The file extension for the contents list.
3266 % \item |\c@fenv| A counter for the environment (for caption numbering).
3267 % \item |\fnum@fenv| A macro to generate the caption `number'.
3268 % \item |\l@fenv| A macro to produce an entry in a list of\ldots.
3269 % \item |\flegtoc@fenv| A macro to write a |\namedlegend| title to a listof file.
3270 % \item |\fleg@fenv| A macro to typeset the name of a |\namedlegend|.
3271 % \item |\toclevel@fenv| Holding a bookmark level.
3272 % \end{itemize}
3273 % Note that the |\fleg...| macros are only required for the \Lpack{\pname}
3274 % package, and |\toclevel@fenv| is only required if the \Lpack{hyperref}
3275 % package is being used.
3276 % The others are required for any new float, whether or not the
3277 % \Lpack{\pname} package is being used.
3278 %
3279 %
3280 %
3281 % \begin{macro}{newflo@tctr}
3282 % A counter for the type number of a new float. Normally
3283 % figures are of type 1, tables type 2, and the next float type is then 4, and so
3284 % on.
3285 % \begin{macrocode}
3286 \newcounter{newflo@tctr}
3287 \@ifundefined{c@figure}{\setcounter{newflo@tctr}{1}}{
3288 \@ifundefined{c@table}{\setcounter{newflo@tctr}{2}}{
3289 \setcounter{newflo@tctr}{4}}}
3290
3291 % \end{macrocode}
3292 % \end{macro}
3293 %
3294 % \begin{macro}{\cftdot}
3295 % \begin{macro}{\cftdotsep}
3296 % \begin{macro}{\cftdotfill}
3297 % \begin{macro}{\@cfttocstart}
3298 % \begin{macro}{\@cfttocfinish}
3299 % These macros are also provided by the \Lpack{tocloft} package, but
3300 % we need them in any event.
3301 % \begin{macrocode}
3302 \providecommand{\cftdot}{.}
3303 \providecommand{\cftdotsep}{4.5}
3304 \providecommand{\cftdotfill}[1]{%
3305 \leaders\hbox{$\m@th\mkern #1 mu \hbox{\cftdot}\mkern #1 mu$}\hfill}
3306 \providecommand{\@cfttocstart}{%
3307 \@ifundefined{chapter}{}{%
3308 \if@twocolumn
3309 \@restonecoltrue\onecolumn
3310 \else
3311 \@restonecolfalse
3312 \fi}}
3313 \providecommand{\@cfttocfinish}{%
3314 \@ifundefined{chapter}{}{\if@restonecol\twocolumn\fi}}
3315
3316 % \end{macrocode}
3317 % \end{macro}
3318 % \end{macro}
3319 % \end{macro}
3320 % \end{macro}
3321 % \end{macro}
3322 %
3323 % \begin{macro}{\newfloatentry}
3324 % |\newfloatentry[|\meta{within}|]{|\meta{counter}|}{|\meta{ext}|}{|\meta{level-1}|}|
3325 % generates the commands for typesetting a caption in a float and a
3326 % caption in a listing.
3327 % \begin{macrocode}
3328 \newcommand{\newfloatentry}[4][\@empty]{%
3329 % \end{macrocode}
3330 % \begin{macro}{\c@X}
3331 % \begin{macro}{\theX}
3332 % Create the new counter. An error if it exists.
3333 % \begin{macrocode}
3334 \@ifundefined{c@#2}{%
3335 \ifx \@empty#1\relax
3336 \newcounter{#2}
3337 \else
3338 \@ifundefined{c@#1}{\PackageWarning{ccaption}%
3339 {#1 has no counter for use as a `within'}
3340 \newcounter{#2}}%
3341 {\newcounter{#2}[#1]%
3342 \expandafter\edef\csname the#2\endcsname{%
3343 \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}}
3344 \fi
3345 \setcounter{#2}{0}
3346 }
3347 {\PackageError{ccaption}{#2 has been previously defined}{\@eha}}
3348
3349 % \end{macrocode}
3350 % \end{macro}
3351 % \end{macro}
3352 %
3353 % That finishes off the error checking, rest is defined in any event
3354 % \begin{macro}{\l@X}
3355 % |\l@X{title}{page}| typesets the entry in the listing, but only if
3356 % the |Zdepth| is greater than \meta{level-1}.
3357 % \begin{macrocode}
3358 \@namedef{l@#2}##1##2{%
3359 \ifnum \@nameuse{c@#3depth} > #4\relax
3360 \vskip \@nameuse{cftbefore#2skip}
3361 {\leftskip \@nameuse{cft#2indent}\relax
3362 \rightskip \@tocrmarg
3363 \parfillskip -\rightskip
3364 \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue
3365 \interlinepenalty\@M
3366 \leavevmode
3367 \@tempdima \@nameuse{cft#2numwidth}\relax
3368 \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname
3369 \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname
3370 \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname
3371 \advance\leftskip\@tempdima \null\nobreak\hskip -\leftskip
3372 {\@nameuse{cft#2font}##1}\nobreak
3373 \@nameuse{cft#2fillnum}{##2}}
3374 \fi
3375 } % end of \l@#2
3376
3377 % \end{macrocode}
3378 % \end{macro}
3379 %
3380 % Now define all the layout commands used by |\l@X|. The default
3381 % values for these correspond to those for figure and table entries.
3382 % \begin{macro}{\cftbeforeXskip}
3383 % \begin{macrocode}
3384 \expandafter\newlength\csname cftbefore#2skip\endcsname
3385 \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@}
3386 % \end{macrocode}
3387 % \end{macro}
3388 %
3389 % \begin{macro}{\cftXindent}
3390 % \begin{macro}{\cftXnumwidth}
3391 % \begin{macrocode}
3392 \expandafter\newlength\csname cft#2indent\endcsname
3393 \expandafter\newlength\csname cft#2numwidth\endcsname
3394 % \end{macrocode}
3395 % Set the default values for the indent and numwidth depending
3396 % on the entry's level. A level of 1 (\meta{level-1} = 0)
3397 % corresponds to a figure.
3398 % \begin{macrocode}
3399 \ifcase #4\relax % 0
3400 \setlength{\@nameuse{cft#2indent}}{1.5em}
3401 \setlength{\@nameuse{cft#2numwidth}}{2.3em}
3402 \or % 1
3403 \setlength{\@nameuse{cft#2indent}}{3.8em}
3404 \setlength{\@nameuse{cft#2numwidth}}{3.2em}
3405 \or % 2
3406 \setlength{\@nameuse{cft#2indent}}{7.0em}
3407 \setlength{\@nameuse{cft#2numwidth}}{4.1em}
3408 \or % 3
3409 \setlength{\@nameuse{cft#2indent}}{10.0em}
3410 \setlength{\@nameuse{cft#2numwidth}}{5.0em}
3411 \else % anything else
3412 \setlength{\@nameuse{cft#2indent}}{1.5em}
3413 \setlength{\@nameuse{cft#2numwidth}}{2.3em}
3414 \fi
3415 % \end{macrocode}
3416 % \end{macro}
3417 % \end{macro}
3418 %
3419 % \begin{macro}{\cftXfont}
3420 % \begin{macro}{\cftXpresnum}
3421 % \begin{macro}{\cftXaftersnum}
3422 % \begin{macro}{\cftXaftersnumb}
3423 % \begin{macro}{\cftXdotsep}
3424 % \begin{macro}{\cftXleader}
3425 % \begin{macro}{\cftXpagefont}
3426 % \begin{macro}{\cftXafterpnum}
3427 % And the rest of the commands
3428 % \begin{macrocode}
3429 \@namedef{cft#2font}{\normalfont}
3430 \@namedef{cft#2presnum}{}
3431 \@namedef{cft#2aftersnum}{}
3432 \@namedef{cft#2aftersnumb}{}
3433 \@namedef{cft#2dotsep}{\cftdotsep}
3434 \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}}
3435 \@namedef{cft#2pagefont}{\normalfont}
3436 \@namedef{cft#2afterpnum}{}
3437 % \end{macrocode}
3438 % \end{macro}
3439 % \end{macro}
3440 % \end{macro}
3441 % \end{macro}
3442 % \end{macro}
3443 % \end{macro}
3444 % \end{macro}
3445 % \end{macro}
3446 %
3447 % \begin{macro}{\cftXfillnum}
3448 % This typesets the leader and the page number.
3449 % \begin{macrocode}
3450 \@namedef{cft#2fillnum}##1{%
3451 {\@nameuse{cft#2leader}}\nobreak
3452 \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}%
3453 \@nameuse{cft#2afterpnum}\par}
3454 % \end{macrocode}
3455 % \end{macro}
3456 %
3457 %
3458 % \begin{macro}{\toclevel@X}
3459 % This is required for the \Lpack{hyperref} package.
3460 % \begin{macrocode}
3461 \@namedef{toclevel@#2}{#4}
3462 % \end{macrocode}
3463 % \end{macro}
3464 % The end of |\newfloatentry|
3465 % \begin{macrocode}
3466 } % end \newfloatentry
3467
3468 % \end{macrocode}
3469 % \end{macro}
3470 %
3471 %
3472 % \begin{macro}{\newfloatlist}
3473 % |\newfloatlist[|\meta{within}|]{|\meta{fenv}|}{|\meta{ext}|}{|\meta{listname}|}{|\meta{capname}|}|
3474 % creates the commands for a new float environment \meta{fenv} (aka |X|)
3475 % and a new List of for \meta{fenv}, using \meta{ext} (aka |Z|) as the
3476 % file extension.
3477 % \begin{macrocode}
3478 \newcommand{\newfloatlist}[5][\@empty]{%
3479 % \end{macrocode}
3480 % Call |\newfloatentry[within]{X}{Z}{0}| to set up for typesetting the entry.
3481 % \begin{macrocode}
3482 \ifx \@empty#1\relax
3483 \newfloatentry{#2}{#3}{0}
3484 \else
3485 \newfloatentry[#1]{#2}{#3}{0}
3486 \fi
3487 % \end{macrocode}
3488 %
3489 % \begin{macro}{\ftype@X}
3490 % Define the float type, set it to the float counter, and double
3491 % the counter afterwards.
3492 % \begin{macrocode}
3493 \@namedef{ftype@#2}{\value{newflo@tctr}}
3494 \addtocounter{newflo@tctr}{\value{newflo@tctr}}
3495 % \end{macrocode}
3496 % \end{macro}
3497 %
3498 % \begin{macro}{\ext@X}
3499 % \begin{macro}{Zdepth}
3500 % Define |\ext@X| for the file extension and set the new |Zdepth|
3501 % depth counter to 1.
3502 % \begin{macrocode}
3503 \@namedef{ext@#2}{#3} % file extension
3504 \newcounter{#3depth}
3505 \setcounter{#3depth}{1}
3506
3507 % \end{macrocode}
3508 % \end{macro}
3509 % \end{macro}
3510 %
3511 % \begin{macro}{\cftmarkZ}
3512 % |\cftmarkZ| specifies the marks for the page headings for the new listing.
3513 % \begin{macrocode}
3514 \@namedef{cftmark#3}{%
3515 \@mkboth{\MakeUppercase{#4}}{\MakeUppercase{#4}}}
3516
3517 % \end{macrocode}
3518 % \end{macro}
3519 %
3520 % \begin{macro}{\listofX}
3521 % |\listofX| typesets the listing.
3522 % \begin{macrocode}
3523 \if@conttitleopt
3524 % \end{macrocode}
3525 % For the \Lopt{titles} option, basically copy the code from the
3526 % standard |\tableofcontents| command definition.
3527 % \begin{macrocode}
3528 \@namedef{listof#2}{%
3529 \@cfttocstart
3530 \@ifundefined{chapter}{\section*{#4}}{\chapter*{#4}}
3531 \@nameuse{cftmark#3}
3532 \@starttoc{#3}%
3533 \@cfttocfinish}
3534 \else
3535 % \end{macrocode}
3536 % Otherwise, provide a fully parameterised heading style.
3537 % \begin{macrocode}
3538 \@namedef{listof#2}{%
3539 \@cfttocstart
3540 \par
3541 \begingroup
3542 \parindent\z@ \parskip\z@
3543 \@nameuse{@cftmake#3title}
3544 \@starttoc{#3}%
3545 \endgroup
3546 \@cfttocfinish}
3547 \fi
3548
3549 % \end{macrocode}
3550 % \end{macro}
3551 %
3552 % \begin{macro}{\@cftmakeZtitle}
3553 % |\@cftmakeZtitle| typeset the title heading for the liusting.
3554 % \begin{macrocode}
3555 \@namedef{@cftmake#3title}{%
3556 \@ifundefined{chapter}{%
3557 \vspace{\@nameuse{cftbefore#3titleskip}}}{%
3558 \vspace*{\@nameuse{cftbefore#3titleskip}}}
3559 \interlinepenalty\@M
3560 {\@nameuse{cft#3titlefont}#4}{\@nameuse{cftafter#3title}}
3561 \@nameuse{cftmark#3}
3562 \par\nobreak
3563 \vskip \@nameuse{cftafter#3titleskip}
3564 \@afterheading}
3565
3566 % \end{macrocode}
3567 % \end{macro}
3568 %
3569 % \begin{macro}{\cftbeforeZtitleskip}
3570 % \begin{macro}{\cftafterZtitleskip}
3571 % \begin{macro}{\cftZtitlefont}
3572 % \begin{macro}{\cftafterZtitle}
3573 % Define the lengths and commands for controlling the title heading
3574 % layout. The values depend on whether the document is chaptered or not.
3575 % \begin{macrocode}
3576 \expandafter\newlength\csname cftbefore#3titleskip\endcsname
3577 \expandafter\newlength\csname cftafter#3titleskip\endcsname
3578 \@ifundefined{chapter}{%
3579 \setlength{\@nameuse{cftbefore#3titleskip}}{3.5ex \@plus 1ex \@minus .2ex}
3580 \setlength{\@nameuse{cftafter#3titleskip}}{2.3ex \@plus .2ex}
3581 \@namedef{cft#3titlefont}{\normalfont\Large\bfseries}
3582 }{%
3583 \setlength{\@nameuse{cftbefore#3titleskip}}{50pt}
3584 \setlength{\@nameuse{cftafter#3titleskip}}{40pt}
3585 \@namedef{cft#3titlefont}{\normalfont\Huge\bfseries}
3586 }
3587 \@namedef{cftafter#3title}{}
3588
3589 % \end{macrocode}
3590 % \end{macro}
3591 % \end{macro}
3592 % \end{macro}
3593 % \end{macro}
3594 %
3595 % \begin{macro}{\fps@X}
3596 % \begin{macro}{\fnum@X}
3597 % \begin{macro}{\flegtoc}
3598 % |\fps@X| is the default float placement specification, |\fnum@X|
3599 % typesets the caption name and number, and |\flegtoc@X| is for
3600 % named legends.
3601 % \begin{macrocode}
3602 \@namedef{fps@#2}{tbp} % position
3603 \@namedef{fnum@#2}{#5~\@nameuse{the#2}} % caption naming
3604 \@namedef{flegtoc@#2}##1{} % named legend
3605
3606 % \end{macrocode}
3607 % \end{macro}
3608 % \end{macro}
3609 % \end{macro}
3610 %
3611 % \begin{environment}{X}
3612 % \begin{environment}{X*}
3613 % Finally define the new float environment, in both normal and starred
3614 % forms.
3615 % \begin{macrocode}
3616 \newenvironment{#2}{\@float{#2}}{\end@float}
3617 \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}
3618 % \end{macrocode}
3619 % \end{environment}
3620 % \end{environment}
3621 %
3622 % This ends the definition of |\newfloatlist|.
3623 % \begin{macrocode}
3624 } % end \newlistof
3625
3626 % \end{macrocode}
3627 % \end{macro}
3628 %
3629 % \begin{macro}{\newfloatenv}
3630 % Up to version 2.7 of the package the command
3631 % |\newfloatenv[|\meta{within}|]{|\meta{fenv}|}{|\meta{ext}|}{|\meta{capname}|}|
3632 % created a new float environment. It was replaced in later versions
3633 % by |\newfloatlist|. Print a warning message if it is used.
3634 % \begin{macrocode}
3635 \newcommand{\newfloatenv}[4][\@empty]{%
3636 \PackageError{ccaption}{\protect\newfloatenv\space has been replaced
3637 by\MessageBreak
3638 \protect\newfloatlist}{\@eha}
3639 }
3640
3641 % \end{macrocode}
3642 % \end{macro}
3643 %
3644 %
3645 % \begin{macro}{\listfloats}
3646 % Up to version 2.7 the |\listfloats{|\meta{fenv}|}{|\meta{heading}|}|
3647 % command produced a list of floats for \meta{fenv}. It was replaced
3648 % in later versions by the generated command |\listoffenv|. Print
3649 % an error message.
3650 % \begin{macrocode}
3651 \newcommand{\listfloats}[2]{%
3652 \PackageError{ccaption}{\protect\listfloats{#1}{...} has been
3653 replaced by\MessageBreak
3654 \protect\listof #1}{\@eha}
3655 }
3656
3657 % \end{macrocode}
3658 % \end{macro}
3659 %
3660 % To define subcaptions for use in a new float environment, say |fenv|, the
3661 % following macros must be defined~\cite{SUBFIGURE}:
3662 % \begin{itemize}
3663 % \item A new counter |subfenv| for subcaption numbering.
3664 % \item A new counter |extdepth|, where |ext| is the file extension
3665 % for the contents list of |fenv|, for setting the contents depth.
3666 % \item |\thesubfenv| for the formatting of the subcaption number.
3667 % \item |\@thesubfenv| for typesetting the number.
3668 % \item |\@@thesubfenv| for alternative label reference.
3669 % \item |\p@subfenv| for prepending to the subcaption number when it is referenced.
3670 % \item |\ext@subfenv| the file extension for the contents list.
3671 % \item |\l@subfenv| for formatting the contents list entry.
3672 % \item |\@makesubfenvcaption| for typesetting the subcaption.
3673 % \item |\toclevel@subfenv| for hyperref bookmarks
3674 % \end{itemize}
3675 %
3676 % \begin{macro}{\newsubfloat}
3677 % |\newsubfloat{|\meta{fenv}|}| creates the commands for a new
3678 % subfloat for \meta{fenv} (aka X).
3679 % \begin{macrocode}
3680 \newcommand{\newsubfloat}[1]{%
3681 % \end{macrocode}
3682 % Call |\newfloatentry[X]{subX}{extX}{1}| to get most of the work done.
3683 % \begin{macrocode}
3684 \newfloatentry[#1]{sub#1}{\@nameuse{ext@#1}}{1}
3685 % \end{macrocode}
3686 %
3687 % \begin{macro}{\ext@subX}
3688 % \begin{macro}{\thesubX}
3689 % \begin{macro}{\@thesubX}
3690 % \begin{macro}{\@@thesubX}
3691 % \begin{macro}{\p@subX}
3692 % \begin{macro}{\@makesubXcaption}
3693 % And now for the rest of the commands for subcaptions.
3694 % \begin{macrocode}
3695 \@namedef{ext@sub#1}{\csname ext@#1\endcsname}
3696 \@namedef{thesub#1}{(\alph{sub#1})}
3697 \@namedef{@thesub#1}{{\subcaplabelfont\@nameuse{thesub#1}}\space}
3698 \@namedef{@@thesub#1}{\@nameuse{thesub#1}}
3699 \@namedef{p@sub#1}{\csname the#1\endcsname}
3700 \@namedef{@makesub#1caption}{\@makesubfigurecaption}
3701 }
3702
3703 % \end{macrocode}
3704 % \end{macro}
3705 % \end{macro}
3706 % \end{macro}
3707 % \end{macro}
3708 % \end{macro}
3709 % \end{macro}
3710 % \end{macro}
3711 %
3712 % \begin{macro}{\newfloatpagesoff}
3713 % |\newfloatpagesoff{|\meta{fenv}|}| switches off page numbers in the
3714 % listing for entries of type \meta{fenv}. It does this by redefining
3715 % the |\cftXfillnum| command.
3716 % \begin{macrocode}
3717 \DeclareRobustCommand{\newfloatpagesoff}[1]{
3718 \@namedef{cft#1fillnum}##1{%
3719 \parfillskip=\z@ plus1fil\@nameuse{cft#1afterpnum}\par}}
3720
3721 % \end{macrocode}
3722 % \end{macro}
3723 %
3724 % \begin{macro}{\newfloatpageson}
3725 % |\newfloatpageson{|\meta{fenv}|}| switches on page numbers in the
3726 % listing for entries of type \meta{fenv}. It does this by redefining
3727 % the |\cftXfillnum| command to its default specification.
3728 % \begin{macrocode}
3729 \DeclareRobustCommand{\newfloatpageson}[1]{
3730 \@namedef{cft#1fillnum}##1{%
3731 {\@nameuse{cft#1leader}}\nobreak
3732 \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#1pagefont}##1}%
3733 \@nameuse{cft#1afterpnum}\par}}
3734
3735 % \end{macrocode}
3736 % \end{macro}
3737 %
3738 % \begin{macro}{\setnewfloatindents}
3739 % |\setnewfloatindents{|\meta{fenv}|}{|\meta{indent}|}{|\meta{width}|}|
3740 % sets the indent and numwidth for the float entry \meta{fenv}.
3741 % \begin{macrocode}
3742 \newcommand{\setnewfloatindents}[3]{%
3743 \setlength{\@nameuse{cft#1indent}}{#2}
3744 \setlength{\@nameuse{cft#1numwidth}}{#3}
3745 }
3746
3747 % \end{macrocode}
3748 % \end{macro}
3749 %
3750 %
3751 %
3752 % The end of this package.
3753 % \begin{macrocode}
3754 %</usc>
3755 % \end{macrocode}
3756 %
3757 % \appendix
3758 % \section{The perils of empty} \label{sec:peril}
3759 %
3760 % My original code for the |\@if@contemptyarg| command was as follows:
3761 % \begin{verbatim}
3762 % \newcommand{\@if@contemptyarg}[3]{%
3763 % \edef\@conttemp{\zap@space#1 \@empty}
3764 % \ifx\@empty\@conttemp\relax #2\else #3\fi}
3765 % \end{verbatim}
3766 % This uses the |\zap@space| kernel command and I wrote the code after looking
3767 % at various code bits in the kernel and other packages, but I can't now
3768 % remember which ones.
3769 %
3770 % Donald Arseneau kindly pointed out the error of my ways and provided
3771 % the robust solution which is used in the body of this package. The following
3772 % is a slightly edited version of an email he sent me on the subject.
3773 % \begin{quotation}
3774 % I'm not sure how exactly it is \emph{supposed} to work because there are
3775 % cases for which it will fail spectacularly. [These involved testing an
3776 % an argument that included macros of various forms]
3777 %
3778 % There are several errors I am sure of though:
3779 % \begin{itemize}
3780 % \item You used |\edef| which is \emph{not} allowed in LaTeX --- this
3781 % creates a moving argument without any protection from |\protect|. Fragile
3782 % commands will produce stack overflows and other errors.
3783 % Even if you use |\protected@edef|, as is correct, you still
3784 % make a moving argument to no purpose.
3785 % \item |\zap@space| is not valid for general arguments. It fails if it
3786 % ever sees an empty macro following a space. [e.g., |\def\none{}| used
3787 % as |\@if@contemptyarg{ \none}{}{}|]
3788 % \item By making |\@if@contemptyarg| skip over one of its parameters
3789 % (|#2|, |#3|) you make it fail for nesting tabular or array environments.
3790 % \item |\@if@contemptyarg| is itself a fragile command, and will require
3791 % |\protect| if it ever appears in a title or other moving argument.
3792 % Since it is possible to do the test by expandable operations alone, it
3793 % should be done that way.
3794 % \end{itemize}
3795 %
3796 % I suggest you read \file{CTAN:tex-archive/info/aro-bend/answer.002}
3797 % for a past discussion of detecting empty arguments, and then use a definition
3798 % of |\@if@contemptyarg| based on that discussion. You'll find it in
3799 % \file{amsgen.dtx}, or use instead the improved version \ldots.
3800 % \end{quotation}
3801 %
3802 % The definition of |\@if@contemptyarg| is based on the improved version
3803 % that Donald supplied, only the macro names being changed.
3804 %
3805 % For checking if an optional argument is present I used code along the
3806 % lines: \\
3807 % \verb?\newcommand{\com}[4][\@empty]{...? \\
3808 % \verb?\ifx \@empty#1\else %argument present? \\
3809 % Unfortunately I was not consistent, as Benjamin Bayart found\footnote{Email
3810 % to me on 2005/03/29.} when he used an optional argument that started with
3811 % a double character, like \verb?\bicaption[ccapt3]{...?, which caused
3812 % nasty things to happen. In these cases I had coded: \\
3813 % \verb?\ifx #1\@empty\else %argument present? \\
3814 % I really should have known better as this results in TRUE with
3815 % \verb?apt3? being left dangling (and typeset).
3816 %
3817 % \bibliographystyle{alpha}
3818 %
3819 % \begin{thebibliography}{MCCG95}
3820 %
3821 % \bibitem[Coc95]{SUBFIGURE}
3822 % Steven Douglas Cochran.
3823 % \newblock \emph{The subfigure package}.
3824 % \newblock February 2002.
3825 % \newblock (Available from CTAN as file \texttt{subfigure.dtx})
3826 %
3827 % \bibitem[GMS94]{GOOSSENS94}
3828 % Michel Goossens, Frank Mittelbach, and Alexander Samarin.
3829 % \newblock \emph{The LaTeX Companion}.
3830 % \newblock Addison-Wesley Publishing Company, 1994.
3831 %
3832 % \bibitem[Lin95]{LINGNAU95}
3833 % Anselm Lingnau.
3834 % \newblock \emph{{An Improved Environment for Floats}}.
3835 % \newblock March 1995.
3836 % \newblock (Available from CTAN as file \texttt{float.dtx})
3837 %
3838 % \bibitem[McCG95]{ENDFLOAT}
3839 % James Darrell McCauley and Jeff Goldberg.
3840 % \newblock \emph{{The endfloat package}}.
3841 % \newblock October 1995.
3842 % \newblock (Available from CTAN as file \texttt{endfloat.dtx})
3843 %
3844 % \bibitem[NiGa98]{SIDECAP}
3845 % Rolf Niepraschk and Hubert G\"{a}\ss lein.
3846 % \newblock \emph{{The sidecap package}}.
3847 % \newblock June 1998.
3848 % \newblock (Available from CTAN as file \texttt{sidecap.dtx})
3849 %
3850 % \bibitem[Rec97]{EPSLATEX}
3851 % Keith Reckdahl.
3852 % \newblock \emph{{Using Imported Graphics in LaTeX2e}}.
3853 % \newblock December 1997.
3854 % \newblock (Available from CTAN as file \texttt{info/epslatex.ps}
3855 % or \texttt{info/epslatex.pdf})
3856 %
3857 % \bibitem[Som95]{CAPTION2}
3858 % Harald Axel Sommerfeldt.
3859 % \newblock \emph{{The caption package}}.
3860 % \newblock October 1995.
3861 % \newblock (Available from CTAN as file \texttt{caption2.dtx})
3862 %
3863 % \bibitem[Wil96]{PRW96i}
3864 % Peter~R. Wilson.
3865 % \newblock \emph{{LaTeX for standards: The LaTeX package files user manual}}.
3866 % \newblock NIST Report NISTIR, June 1996.
3867 %
3868 % \bibitem[Wil01]{TOCLOFT}
3869 % Peter~R. Wilson.
3870 % \newblock \emph{{The tocloft package}}.
3871 % \newblock March 2001.
3872 % \newblock (Available from CTAN as file \texttt{tocloft.dtx})
3873 %
3874 % \end{thebibliography}
3875 %
3876 % \Finale
3877 % \PrintIndex
3878 % \PrintChanges
3879 %
3880 \endinput
3881
3882 %% \CharacterTable
3883 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
3884 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
3885 %% Digits \0\1\2\3\4\5\6\7\8\9
3886 %% Exclamation \! Double quote \" Hash (number) \#
3887 %% Dollar \$ Percent \% Ampersand \&
3888 %% Acute accent \' Left paren \( Right paren \)
3889 %% Asterisk \* Plus \+ Comma \,
3890 %% Minus \- Point \. Solidus \/
3891 %% Colon \: Semicolon \; Less than \<
3892 %% Equals \= Greater than \> Question mark \?
3893 %% Commercial at \@ Left bracket \[ Backslash \\
3894 %% Right bracket \] Circumflex \^ Underscore \_
3895 %% Grave accent \` Left brace \{ Vertical bar \|
3896 %% Right brace \} Tilde \~}
3897
3898