Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % tocloft.dtx
4 % Author: Peter Wilson, Herries Press
5 % Maintainer: Will Robertson (will dot robertson at latex-project dot org)
6 % Copyright 1998-2003 Peter R. Wilson
7 % Copyright 2009-2017 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 \documentclass{ltxdoc}
22 \usepackage{hypdoc}
23 \EnableCrossrefs
24 \CodelineIndex
25 \setcounter{StandardModuleDepth}{1}
26 \begin{document}
27 \DocInput{tocloft.dtx}
28 \end{document}
29 %</driver>
30 %
31 %<*usc>
32 \NeedsTeXFormat{LaTeX2e}
33 \ProvidesPackage{tocloft}[2017/08/31 v2.3i parameterised ToC, etc., typesetting]
34 %</usc>
35 %
36 % \fi
37 %
38 % \changes{v0.1}{1998/12/31}{First public (alpha) release}
39 % \changes{v0.1a}{1999/01/15}{Improved documentation}
40 % \changes{v0.2}{1999/01/17}{Uses the stdclsdv package}
41 % \changes{v0.2a}{1999/01/17}{Interfaced with the tocbibind package}
42 % \changes{v0.2b}{1999/03/07}{Corrected failure when used with float package}
43 % \changes{v0.2c}{1999/06/30}{Added raggedright example}
44 % \changes{v0.3}{1999/08/22}{Added option to prevent ToC head change}
45 % \changes{v1.0}{1999/09/19}{Added PackageNote reporting}
46 % \changes{v1.1}{2000/02/11}{Added cftXpresnum commands}
47 % \changes{v1.1}{2000/02/11}{Added support for subfigure package}
48 % \changes{v1.1a}{2000/02/11}{Changed X to Z in section 2.2}
49 % \changes{v2.0}{2001/03/03}{Added command for new list of...}
50 % \changes{v2.0}{2001/03/03}{Removed requirement for stdclsdv package}
51 % \changes{v2.0}{2001/03/15}{Removed requirement for hyperref option}
52 % \changes{v2.1}{2001/04/08}{Added control over parskip in ToC etc.}
53 % \changes{v2.2}{2001/04/17}{Another fix for hyperref}
54 % \changes{v2.3}{2002/06/15}{Made to work with the koma classes}
55 % \changes{v2.3a}{2002/10/03}{Partial fix for Part changes}
56 % \changes{v2.3b}{2003/01/20}{More fixes for Part changes}
57 % \changes{v2.3c}{2003/09/26}{More fixes for hyperref}
58 % \changes{v2.3d}{2009/09/04}{New maintainer and tiny bug fix}
59 % \changes{v2.3e}{2010/10/13}{Remove a message from the console output}
60 %
61 % \def\dtxfile{\texttt{tocloft.dtx}}
62 % \def\fileversion{v1.1a} \def\filedate{2000/02/11}
63 % \def\fileversion{v2.0} \def\filedate{2001/03/15}
64 % \def\fileversion{v2.1} \def\filedate{2001/04/08}
65 % \def\fileversion{v2.2} \def\filedate{2001/04/17}
66 % \def\fileversion{v2.3} \def\filedate{2002/06/15}
67 % \def\fileversion{v2.3a} \def\filedate{2002/10/03}
68 % \def\fileversion{v2.3b} \def\filedate{2003/01/20}
69 % \def\fileversion{v2.3c} \def\filedate{2003/09/26}
70 % \def\fileversion{v2.3d} \def\filedate{2009/09/04}
71 % \def\fileversion{v2.3e} \def\filedate{2010/10/13}
72 % \def\fileversion{v2.3f} \def\filedate{2013/05/02}
73 % \def\fileversion{v2.3g} \def\filedate{2014/06/14}
74 % \def\fileversion{v2.3h} \def\filedate{2017/08/29}
75 % \def\fileversion{v2.3i} \def\filedate{2017/08/31}
76 % \def\fileversion{v2.3j} \def\filedate{2020/01/10}
77 %
78 % \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
79 % \DoNotIndex{\@centercr,\@cite}
80 % \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
81 % \DoNotIndex{\@input,\@ixpt,\@m}
82 % \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
83 % \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
84 % \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
85 % \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
86 % \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
87 % \DoNotIndex{\advance,\Alph,\alph}
88 % \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
89 % \DoNotIndex{\bullet}
90 % \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
91 % \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
92 % \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
93 % \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
94 % \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
95 % \DoNotIndex{\fbox}
96 % \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
97 % \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
98 % \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
99 % \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
100 % \DoNotIndex{\input}
101 % \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
102 % \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
103 % \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
104 % \DoNotIndex{\NeedsTeXFormat,\newdimen}
105 % \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
106 % \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
107 % \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
108 % \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
109 % \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
110 % \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
111 % \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
112 % \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
113 % \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
114 % \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
115 % \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
116 % \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
117 % \DoNotIndex{\wd,\xiipt,\year,\z@}
118 %
119 % \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
120 % \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
121 % \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
122 % \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
123 % \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
124 % \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
125 % \providecommand{\bs}{\textbackslash}
126 %
127 % \title{The \Lpack{tocloft} package\thanks{This
128 % file (\dtxfile) has version number \fileversion, last revised
129 % \filedate.}}
130 %
131 % \author{
132 % Author: Peter Wilson, Herries Press \\
133 % Maintainer: Will Robertson \\
134 % \texttt{will dot robertson at latex-project dot org}
135 % }
136 % \date{\filedate}
137 % \maketitle
138 % \begin{abstract}
139 % The \Lpack{tocloft} package provides means of controlling the
140 % typographic design of the Table of Contents, List of Figures and List of
141 % Tables. New kinds of `List of \ldots' can be defined.
142 %
143 % The package has been tested with the
144 % \Lpack{tocbibind},
145 % \Lpack{minitoc},
146 % \Lpack{ccaption},
147 % \Lpack{subfigure},
148 % \Lpack{float},
149 % \Lpack{fncychap}, and
150 % \Lpack{hyperref}
151 % packages.
152 % \end{abstract}
153 % \tableofcontents
154 % \makeatletter \renewcommand{\@dotsep}{9.0} \makeatother
155 % \listoffigures
156 % \listoftables
157 % \StopEventually{}
158 %
159 %
160 %
161 % \section{Introduction}
162 %
163 % In the standard classes the typographic design of the Table of Contents
164 % (ToC), the List of Figures (LoF) and List of Tables (LoT) is fixed or,
165 % more precisely, it is buried within the class definitions.
166 % The \Lpack{tocloft} package provides handles for an author to
167 % change the design to meet the needs of the particular document.
168 %
169 % Elements of the package were developed as part of a class
170 % and package bundle for typesetting ISO standards~\cite{PRW96i}.
171 % This manual is typeset according to the conventions of the
172 % \LaTeX{} \textsc{docstrip} utility which enables the automatic
173 % extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
174 %
175 % Section~\ref{sec:usc} describes the usage of the package.
176 % Commented source code for the package is in Section~\ref{sec:code}.
177 %
178 % The package has been tested in combination with at least
179 % the \Lpack{tocbibind} package~\cite{TOCBIBIND},
180 % the \Lpack{minitoc} package~\cite{MINITOC},
181 % the \Lpack{ccaption} package~\cite{CCAPTION},
182 % the \Lpack{subfigure} package~\cite{SUBFIGURE} (versions 2.0 and 2.1),
183 % the \Lpack{algorithm} package~\cite{ALGORITHM} (which, in turn, calls the
184 % \Lpack{float} package~\cite{FLOAT}) and the \Lpack{fncychap} package~\cite{FNCYCHAP}.
185 % It also works with the \Lpack{hyperref} package.
186 % Please send me any comments as to how you think
187 % that the package can be improved, or of any interesting examples of
188 % how you have used
189 % it.\footnote{Thanks to Rowland (\texttt{[email protected]}),
190 % John Foster (\texttt{[email protected]}),
191 % Kasper (\texttt{[email protected]}),
192 % Lee Nave (\texttt{[email protected]}),
193 % and Andrew Thurber (\texttt{[email protected]})
194 % for their suggestions.}
195 %
196 % \subsection{\LaTeX 's methods}
197 %
198 % This is a general description of how \LaTeX{} does the processing
199 % for a Table of Contents. As the processing for List of Figures and
200 % List of Tables is similar I will, without loss of generality, just
201 % discuss the ToC.
202 %
203 % \DescribeMacro{\addcontentsline}
204 % \LaTeX{} generates a \file{.toc} file if the document contains a
205 % |\tableofcontents| command. The sectioning
206 % commands\footnote{For figures and tables it is the \texttt{\bs caption} command
207 % that populates the \file{.lof} and \file{.lot} files.}
208 % put entries into the \file{.toc} file by calling the \LaTeX{}
209 % |\addcontentsline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}|
210 % command, where \meta{file} is the file extension (e.g., |toc|),
211 % \meta{kind} is the kind of entry (e.g., |section| or |subsection|),
212 % and \meta{title} is the (numberered) title text. In the cases where
213 % there is a number, the \meta{title} argument is given in the
214 % form |{\numberline{number} title-text}|.
215 %
216 % NOTE: The \Lpack{hyperref} package dislikes authors using
217 % |\addcontentsline|. To get it to work properly with \Lpack{hyperref}
218 % you normally have to put |\phantomsection| (a macro defined within
219 % the \Lpack{hyperref} package) immediately
220 % before |\addcontentsline|.
221 %
222 % \DescribeMacro{\contentsline}
223 % The |\addcontentsline| command writes an entry to the given file
224 % in the form |\contentsline{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}|
225 % where \meta{page} is the page number.
226 % For each \meta{kind}, \LaTeX{} provides a command
227 % |\l@kind{|\meta{title}|}{|\meta{page}|}| which performs the actual
228 % typesetting of the |\contentsline| entry.
229 %
230 % \newcommand{\maxx}{120} ^^A picture width
231 % \newcommand{\maxxm}{118} ^^A \maxx - 2\
232 % \newcommand{\maxy}{55} ^^A picture height
233 % \newcommand{\maxym}{53} ^^A \maxy - 2
234 % \newcommand{\findent}{20} ^^A indent
235 % \newcommand{\findentp}{22} ^^A \findent + 2
236 % \newcommand{\fnumwidth}{10} ^^A numwidth
237 % \newcommand{\ftocrmarg}{30} ^^A \@tocrmarg
238 % \newcommand{\fpnumwidth}{20} ^^A \@pnumwidth
239 % \newcommand{\fipn}{30} ^^A \findent + \fnumwidth
240 % \newcommand{\frmarg}{90} ^^A \maxx - \ftocrmarg
241 % \newcommand{\frnum}{100} ^^A \maxx - \fpnumwidth
242 % \newcommand{\fyi}{10} ^^A 1st y height
243 % \newcommand{\fyim}{8} ^^A \fyi - 2
244 % \newcommand{\fyii}{20} ^^A 2nd y height
245 % \newcommand{\fyiii}{25} ^^A 3rd y height
246 % \newcommand{\fyiv}{30} ^^A 4th y height
247 % \newcommand{\fyv}{40} ^^A 5th y height
248 % \newcommand{\fyvp}{42} ^^A \fyv + 2
249 % \newcommand{\flin}{4} ^^A length of leader lines
250 % \newcommand{\frmargm}{89} ^^A \frmarg (90) - a little bit
251 %
252 % \providecommand{\bs}{\textbackslash}
253 % \begin{figure}
254 % \centering
255 % \setlength{\unitlength}{1mm}
256 % \begin{picture}(\maxx,\maxy)
257 % ^^A side lines and linewidth
258 % \put(0,0){\line(0,1){\maxy}}
259 % \put(\maxx,0){\line(0,1){\maxy}}
260 % \put(0,\maxy){\vector(1,0){\maxx}}
261 % \put(2,\maxym){\makebox(0,0)[tl]{\texttt{\bs linewidth}}}
262 % ^^A \@pnumwidth
263 % \put(\maxx,\fyi){\vector(-1,0){\fpnumwidth}}
264 % \put(\maxxm,\fyim){\makebox(0,0)[tr]{\texttt{\bs @pnumwidth}}}
265 % \put(\frnum,\fyi){\line(0,1){\flin}}
266 % ^^A \@tocrmarg
267 % \put(\maxx,\fyv){\vector(-1,0){\ftocrmarg}}
268 % \put(\maxxm,\fyvp){\makebox(0,0)[br]{\texttt{\bs @tocrmarg}}}
269 % \put(\frmarg,\fyv){\line(0,-1){\flin}}
270 % ^^A indent
271 % \put(0,\fyv){\vector(1,0){\findent}}
272 % \put(2,\fyvp){\makebox(0,0)[bl]{\textit{indent}}}
273 % \put(\findent,\fyv){\line(0,-1){\flin}}
274 % ^^A numwidth
275 % \put(\findent,\fyv){\vector(1,0){\fnumwidth}}
276 % \put(\findentp,\fyvp){\makebox(0,0)[bl]{\textit{numwidth}}}
277 % \put(\fipn,\fyv){\line(0,-1){\flin}}
278 % ^^A last title line
279 % \put(\maxx,\fyii){\makebox(0,0)[br]{487}}
280 % \put(\fipn,\fyii){title end}
281 % ^^A second title line
282 % \put(\fipn,\fyiii){continue\ldots}
283 % \put(\frmarg,\fyiii){\makebox(0,0)[br]{\ldots title}}
284 % ^^A first title line
285 % \put(\findent,\fyiv){\textbf{3.5}}
286 % \put(\fipn,\fyiv){Heading\ldots}
287 % \put(\frmarg,\fyiv){\makebox(0,0)[br]{\ldots title}}
288 % ^^A dotted leader
289 % \multiput(\frmargm,\fyii)(-\flin,0){12}{.}
290 % \multiput(\frmarg,\fyi)(-\flin,0){2}{\line(0,1){\flin}}
291 % \put(\frmarg,\fyi){\vector(-1,0){\flin}}
292 % \put(\frmarg,\fyi){\vector(1,0){0}}
293 % \put(\frmarg,\fyim){\makebox(0,0)[tr]{\texttt{\bs @dotsep}}}
294 %
295 % \end{picture}
296 % \setlength{\unitlength}{1pt}
297 % \caption{Layout of a ToC (LoF, LoT) entry} \label{fig:ltoc}
298 % \end{figure}
299 %
300 %
301 % \DescribeMacro{\@pnumwidth}
302 % \DescribeMacro{\@tocrmarg}
303 % \DescribeMacro{\@dotsep}
304 % The general layout of a
305 % typeset entry is illustrated in Figure~\ref{fig:ltoc}. There are three
306 % internal \LaTeX{} commands that are used in the typesetting. The page
307 % number is typeset flushright in a box of width |\@pnumwidth|, and the box
308 % is at the righthand margin. If the page number is too long to fit into
309 % the box it will stick out into the righthand margin. The title text
310 % is indented from the righthand margin by an amount given by |\@tocrmarg|.
311 % Note that |\@tocrmarg| should be greater than |\@pnumwidth|. Some
312 % entries are typeset with a dotted leader between the end of the title
313 % title text and the righthand margin indentation. The distance, in
314 % \emph{math units}\footnote{There are 18mu to 1em.} between the dots
315 % in the leader is given by the value of |\@dotsep|. In the standard
316 % classes the same values are used for the ToC, LoF and the LoT.
317 %
318 % The standard values for these internal commands are:
319 % \begin{itemize}
320 % \item |\@pnumwidth| = 1.55em
321 % \item |\@tocrmarg| = 2.55em
322 % \item |\@dotsep| = 4.5
323 % \end{itemize}
324 % The values can be changed by using |\renewcommand|, in spite of the
325 % fact that the first two appear to be lengths.
326 %
327 % Dotted leaders are not available for Part and Chapter ToC entries
328 % (nor for Section entries in the \Lpack{article} class and its derivatives).
329 %
330 % \DescribeMacro{\numberline}
331 % Each |\l@kind| macro is responsible for setting the general
332 % \textit{indent} from the lefthand margin, and the \textit{numwidth}.
333 % The |\numberline{|\meta{number}|}| macro is responsible for typesetting
334 % the number flushleft in a box of width
335 % \textit{numwidth}. If the number is too long for the box then it will
336 % protrude into the title text. The title text is indented by
337 % (\textit{indent + numwidth}) from the lefthand margin. That is, the title
338 % text is typeset in a block of width \\
339 % (|\linewidth| - \textit{indent} - \textit{numwidth} - |\@tocrmarg|).
340 %
341 % \begin{table}
342 % \centering
343 % \caption[Indents and Numwidths]{Indents and Numwidths (in ems)} \label{tab:indents}
344 % \begin{tabular}{lcrrrr} \hline
345 % Entry & Level & \multicolumn{2}{c}{Chaptered} & \multicolumn{2}{c}{Otherwise} \\
346 % & & indent & numwidth & indent & numwidth \\ \hline
347 % part & -1 & 0 & --- & 0 & --- \\
348 % chapter & 0 & 0 & 1.5 & & \\
349 % section & 1 & 1.5 & 2.3 & 0 & 1.5 \\
350 % subsection & 2 & 3.8 & 3.2 & 1.5 & 2.3 \\
351 % subsubsection & 3 & 7.0 & 4.1 & 3.8 & 3.2 \\
352 % paragraph & 4 & 10.0 & 5.0 & 7.0 & 4.1 \\
353 % subparagraph & 5 & 12.0 & 6.0 & 10.0 & 5.0 \\
354 % figure/table & (1) & 1.5 & 2.3 & 1.5 & 2.3 \\ \hline
355 % \end{tabular}
356 % \end{table}
357 %
358 % Table~\ref{tab:indents} lists the standard values for the \textit{indent}
359 % and \textit{numwidth}. There is no explicit \textit{numwidth} for a
360 % part; instead a gap of 1em is put between the number and the title text.
361 % Note that for a sectioning command the values
362 % depend on whether or not the document class provides the |\chapter|
363 % command. Also, which somewhat surprises me, the table and figure entries
364 % are all indented.
365 %
366 % \DescribeMacro{\@dottedtocline}
367 % Most of the |\l@kind| commands are defined in terms of the
368 % |\@dottedtocline| command. This command takes three arguments: \\
369 % |\@dottedtocline{|\meta{seclevel}|}{|\meta{indent}|}{|\meta{numwidth}|}|. \\
370 % For example, one definition of the |\l@section| command is: \\
371 % |\newcommand*{\l@section}{\@dottedtocline{1}{1.5em}{2.3em}}| \\
372 % If it is necessary to change the default typesetting of the entries,
373 % then it is usually necessary to change these definitions (but the
374 % \Lpack{tocloft} package gives you handles to easily alter things without
375 % having to know the \LaTeX{} internals).
376 %
377 % You can use the |\addcontentsline| command to add |\contentsline|
378 % commands to a file.
379 %
380 % \DescribeMacro{\addtocontents}
381 % \LaTeX{} also provides the |\addtocontents{|\meta{file}|}{|\meta{text}|}|
382 % command that will insert \meta{text} into \meta{file}. You can use
383 % this for adding extra text and/or macros into the file, for processing
384 % when the file is typeset by |\tableofcontents| (or whatever other
385 % command is used for \meta{file} processing, such as |\listoftables|
386 % for a \file{.lot} file).
387 %
388 % As |\addcontentsline| and |\addtocontents| write their arguments to a
389 % file, any fragile commands used in their arguments must be |\protect|ed.
390 %
391 % You can make certain adjustments to the ToC etc., layout without
392 % using any package. Some examples are:
393 % \begin{itemize}
394 % \item If your page numbers stick out into the righthand margin
395 % \begin{verbatim}
396 % \renewcommand{\@pnumwidth}{3em} \renewcommand{\@tocrmarg}{4em}
397 % \end{verbatim}
398 % but using lengths appropriate to your document.
399 %
400 % \item To have the (sectional) titles in the ToC, etc., typeset ragged right with no
401 % hyphenation
402 % \begin{verbatim}
403 % \renewcommand{\@tocrmarg}{2.55em plus1fil}
404 % \end{verbatim}
405 % where the value |2.55em| can be changed for whatever margin space you want.
406 %
407 % \item The dots in the leaders can be eliminated by increasing |\@dotsep|
408 % to a large value:
409 % \begin{verbatim}
410 % \renewcommand{\@dotsep}{10000}
411 % \end{verbatim}
412 %
413 % \item To have dotted leaders in your ToC and LoF but not in your LoT:
414 % \begin{verbatim}
415 % ...
416 % \tableofcontents
417 % \makeatletter \renewcommand{\@dotsep}{10000} \makeatother
418 % \listoftables
419 % \makeatletter \renewcommand{\@dotsep}{4.5} \makeatother
420 % \listoffigures
421 % ...
422 % \end{verbatim}
423 % For this document I used this method to double the dot spacing for
424 % the LoF with respect to that for the ToC. As you can see, it is much
425 % better that all dot leaders have the same spacing.
426 %
427 % \item To add a horizontal line across the whole width of the ToC below
428 % an entry for a Part:
429 % \begin{verbatim}
430 % \part{Part title}
431 % \addtocontents{toc}{\protect\mbox{}\protect\hrulefill\par}
432 % \end{verbatim}
433 % Note that as both |\addtocontents| and |\addcontentsline| write their
434 % arguments to a file, it means that any \emph{fragile} commands in
435 % their arguments must be protected
436 % by preceding each fragile command with |\protect|.
437 % The result of the example above
438 % would be the following two lines in the \file{.toc} file (assuming that it
439 % is the second Part and is on page 34):
440 % \begin{verbatim}
441 % \contentsline {part}{II\hspace {1em}Part title}{34}
442 % \mbox {}\hrulefill \par
443 % \end{verbatim}
444 % If the |\protect|s were not used, then the second line would instead be:
445 % \begin{small}
446 % \begin{verbatim}
447 % \unhbox \voidb@x \hbox {}\unhbox \voidb@x \leaders \hrule \hfill \kern \z@ \par
448 % \end{verbatim}
449 % \end{small}
450 %
451 % \item You may get undesired page breaks in the ToC. For example you
452 % may have a long multiline section title and in the ToC there is a page
453 % break between the lines. After your document is stable you can use
454 % |\addtocontents| at appropriate places in the body of the document
455 % to adjust the page breaking in the ToC. As examples:
456 % \begin{itemize}
457 % \item |\addtocontents{toc}{\protect\newpage}| to force a page break.
458 % \item |\addtocontents{toc}{\protect\enlargethispage{2\baselineskip}}| to
459 % make the page longer.
460 % \item |\addtocontents{toc}{\protect\needspace{2\baselineskip}}| to specify
461 % that if there is not a vertical space of two baselines left on
462 % the page then start a new page (the |\needspace| macro is defined
463 % in the \Lpack{needspace} package).
464 % \end{itemize}
465 %
466 % \end{itemize}
467 % Remember, if you are modifying any command that includes an |@| sign then this
468 % must be done in either a \file{.sty} file or if in the document itself
469 % it must be
470 % surrounded by |\makeatletter| and |\makeatother|. For example, if you
471 % want to modify |\@dotsep| in the preamble to your document you have
472 % to do it like this:
473 % \begin{verbatim}
474 % \makeatletter
475 % \renewcommand{\@dotsep}{9.0}
476 % \makeatother
477 % \end{verbatim}
478 %
479 %
480 % \section{The \Lpack{tocloft} package} \label{sec:usc}
481 %
482 % The \Lpack{tocloft} package provides means of specifying the
483 % typography of the Table of Contents (ToC), the List of Figures (LoF)
484 % and the List of Tables (LoT).
485 %
486 % \DescribeMacro{\tableofcontents}
487 % \DescribeMacro{\listoffigures}
488 % \DescribeMacro{\listoftables}
489 % The ToC, LoF, and LoT are printed at the point in the document where
490 % these commands are called, as per normal \LaTeX. However, there is
491 % one difference between the standard \LaTeX{} behaviour and the behaviour
492 % with the \Lpack{tocloft} package. In the standard \LaTeX{} classes
493 % that have |\chapter| headings, the ToC, LoF and LoT each appear on
494 % a new page. With the \Lpack{tocloft} package they do not necessarily
495 % start new pages; if you want them to be on new pages you may have to
496 % specifically issue an appropriate command beforehand. For example:
497 % \begin{verbatim}
498 % ...
499 % \clearpage
500 % \tableofcontents
501 % \clearpage
502 % \listoftables
503 % ...
504 % \end{verbatim}
505 %
506 % \DescribeMacro{\tocloftpagestyle}
507 % The |\thispagestyle| page style of the ToC, LoF and/or LoT is set
508 % by the command
509 % |\tocloftpagestyle{|\meta{style}|}|, where \meta{style} is one of
510 % the available page styles. The package initially
511 % sets |\tocloftpagestyle{plain}|.
512 %
513 % \subsection{Package options}
514 %
515 % The package takes the following options:
516 % \begin{itemize}
517 % \item[\Lopt{subfigure}] This option is required if, and only if,
518 % the \Lpack{tocloft} and
519 % \Lpack{subfigure} packages are being used together. The two packages
520 % can be specified in any order.
521 %
522 % \item[\Lopt{titles}]
523 % The \Lopt{titles} option causes
524 % the titles of the ToC, LoF, and LoT lists to be typeset using the
525 % default \LaTeX{} methods. This can be useful, for example, when the
526 % \Lpack{tocloft} and \Lpack{fncychap} packages are used together and
527 % the `fancy' chapter styles should be used for the ToC, etc., titles.
528 %
529 % \end{itemize}
530 %
531 % If you use the \Lopt{titles} option you can ignore the next
532 % section and continue reading at section~\ref{sec:entries}.
533 %
534 % \subsection{Changing the titles} \label{sec:titles}
535 %
536 % Commands are provided for controlling the appearance of the
537 % titles. Following \LaTeX{} custom, the title texts are the values
538 % of the |\contentsname|, |\listfigurename| and |\listtablename| commands.
539 %
540 % Similar sets of commands are provided for ToC, LoF and LoT title
541 % typsetting control. For convenience (certainly mine, and hopefully yours)
542 % in the following
543 % descriptions I will use |Z| to stand for `toc' or `lof' or `lot'. For
544 % example, |\cftmarkZ| stands for |\cftmarktoc| or |\cftmarklof| or
545 % |\cftmarklot|.
546 %
547 % \DescribeMacro{\cftmarkZ}
548 % These macros set the appearance of the running heads on the ToC, LoF, and
549 % LoT pages. You probably don't need to change these.
550 %
551 % \DescribeMacro{\cftbeforeZtitleskip}
552 % \DescribeMacro{\cftafterZtitleskip}
553 % These lengths control the vertical spacing before and after the titles.
554 % You can change them from their default values by using |\setlength|.
555 %
556 % \DescribeMacro{\cftZtitlefont}
557 % \DescribeMacro{\cftafterZtitle}
558 % The code used for typesetting the ToC title looks like
559 % \begin{verbatim}
560 % {\cfttoctitlefont \contentsname}{\cftaftertoctitle}\par
561 % \end{verbatim}
562 % By default, |\cftZtitlefont| is defined as a font specification
563 % (e.g., |\Large\bfseries|), and |\cftafterZtitle| is empty.
564 % These commands can be changed (via |\renewcommand|) to change
565 % the typesetting. As examples:
566 % \begin{itemize}
567 % \item |\renewcommand{\cftZtitlefont}{\hfill\Large\itshape}| will
568 % result in a Large italic title typeset flushright.
569 % \item |\renewcommand{\cftZtitlefont}{\hfill\Large\bfseries}| together
570 % with |\renewcommand{\cftafterZtitle}{\hfill}| will give
571 % a centered Large bold title.
572 % \item Doing
573 % \begin{verbatim}
574 % \renewcommand{\cftafterZtitle}{%
575 % \\[\baselineskip]\mbox{}\hfill{\normalfont Page}}
576 % \end{verbatim}
577 % will put the word `Page' flushright on the line following the title.
578 % (If you do this, then you may need to decrease
579 % |\cftafterZtitleskip|).
580 % \item |\renewcommand{\cftafterZtitle}{\thispagestyle{empty}}| will
581 % make the page with the title empty (i.e., the page
582 % number will not be printed).
583 % \end{itemize}
584 %
585 %
586 % \subsection{Typesetting the entries} \label{sec:entries}
587 %
588 % Commands are also provided to enable finer control over the typesetting
589 % of the different kinds of entries. The parameters defining the default
590 % layout of the entries are illustrated as part of the \Lpack{layouts}
591 % package or in~\cite[page 34]{GOOSSENS94}, and are repeated in
592 % Figure~\ref{fig:ltoc}.
593 %
594 % \DescribeMacro{\Zdepth}
595 % The command |\Zdepth{|\meta{number}|}| is analogous to the standard
596 % |\tocdepth{|\meta{number}|}| command, in that it specifies that entries
597 % in the new listing should not be typeset if their numbering level
598 % is greater
599 % than \meta{number}. The default definition is
600 % |\setcounter{Zdepth}{1}|.
601 % These commands are needed, for instance by users of packages such as |subcaption|,
602 % which will generate subfigure and subtable captions corresponding to a |lofdepth| and
603 % |lotdepth| of |2|.
604 %
605 % \DescribeMacro{\cftdot}
606 % In the default ToC typesetting only the more minor entries have dotted
607 % leader lines between the sectioning title and the page number. The
608 % \Lpack{tocloft} package provides for general leaders for all entries.
609 % The `dot' in a leader is given by the value of |\cftdot|. Its default
610 % definition is |\newcommand{\cftdot}{.}| which gives the default
611 % dotted leader. By changing |\cftdot| you can use symbols other than
612 % a period in the leader. For example
613 % \begin{verbatim}
614 % \renewcommand{\cftdot}{\ensuremath{\ast}}
615 % \end{verbatim}
616 % will result in a dotted leader using asterisks as the symbol.
617 %
618 % \DescribeMacro{\cftdotsep}
619 % \DescribeMacro{\cftnodots}
620 % Each kind of entry can control the separation between the dots
621 % in its leader (see below). For consistency though, all dotted leaders
622 % should use the same spacing. The macro |\cftdotsep| specifies the
623 % default spacing. Its value is a number.
624 % However, if the separation is too large
625 % then no dots will be actually typeset. The macro |\cftnodots| is
626 % a separation value that is `too large'.
627 %
628 % \DescribeMacro{\cftsetpnumwidth}
629 % \DescribeMacro{\cftsetrmarg}
630 % The page numbers are typeset in a fixed width box. The command
631 % |\cftsetpnumwidth{|\meta{length}|}| can be used to change the width
632 % of the box (\LaTeX 's internal |\@pnumwidth|).
633 % The title texts will end before reaching the righthand margin.
634 % |\cftsetrmarg{|\meta{length}|}| can be used to set this distance
635 % (\LaTeX 's internal |\@tocrmarg|).
636 % Note that the length used in |\cftsetrmarg| should be greater
637 % than the length set in |\cftsetpnumwidth|. These values should remain
638 % constant in any given document.
639 %
640 % \DescribeMacro{\cftpnumalign}
641 % The page numbers are typeset in a box as described above.
642 % By default they are right-aligned which is suitable when the page numbers are aligned vertically on the page so their digits line up.
643 % For a design with fixed width between a ToC entry and its page number, say, a left alignment may be more suitable.
644 % This can be controlled by setting the \cs{cftpnumalign} macro to \verb|l|, \verb|c|, or \verb|r| (just like \cs{makebox}):
645 % \begin{verbatim}
646 % \renewcommand{\cftpnumalign}{l}
647 % \end{verbatim}
648 %
649 % \DescribeMacro{\cftparskip}
650 % Normally the |\parskip| in the ToC, etc., is zero. This may be changed
651 % by changing the |\cftparskip| length. Note that the current value
652 % of |\cftparskip| is used for the ToC, LoF and LoT, but you can change
653 % the value before calling |\tableofcontents| or |\listoffigures| or
654 % |\listoftables| if one or other of these should have different values
655 % (which is not a good idea).
656 %
657 %
658 % In the following I will use |X| to stand for the following:
659 % \begin{itemize}
660 % \item |part| for |\part| titles
661 % \item |chap| for |\chapter| titles
662 % \item |sec| for |\section| titles
663 % \item |subsec| for |\subsection| titles
664 % \item |subsubsec| for |\subsubsection| titles
665 % \item |para| for |\paragraph| titles
666 % \item |subpara| for |\subparagraph| titles
667 % \item |fig| for figure |\caption| titles
668 % \item |subfig| for subfigure |\caption| titles
669 % \item |tab| for table |\caption| titles
670 % \item |subtab| for subtable |\caption| titles
671 % \end{itemize}
672 %
673 % \DescribeMacro{\cftbeforeXskip}
674 % This controls the vertical space before an entry. It can be changed
675 % by using |\setlength|.
676 %
677 % \DescribeMacro{\cftXindent}
678 % This controls the indentation of an entry from the left margin
679 % (\textit{indent} in Figure~\ref{fig:ltoc}). It
680 % can be changed using |\setlength|.
681 %
682 % \DescribeMacro{\cftXnumwidth}
683 % This controls the space allowed for typesetting title numbers
684 % (\textit{numwidth} in Figure~\ref{fig:ltoc}). It can
685 % be changed using |\setlength|. Second and subsequent lines of a multiline
686 % title will be indented by this amount.
687 %
688 % The remaining commands are related to the specifics of typesetting
689 % an entry.
690 % This is a simplified pseudo-code version for the typesetting of numbered
691 % and unnumbered entries.
692 % \begin{verbatim}
693 % {\cftXfont {\cftXpresnum SNUM\cftXaftersnum\hfil} \cftXaftersnumb TITLE}%
694 % {\cftXleader}{\cftXpagefont PAGE}\cftXafterpnum\par
695 %
696 % {\cftXfont TITLE}{\cftXleader}{\cftXpagefont PAGE}\cftXafterpnum\par
697 % \end{verbatim}
698 % where |SNUM| is the section number, |TITLE| is the title text and |PAGE|
699 % is the page number. In the numbered entry the pseudo-code \\
700 % |{\cftXpresnum SNUM\cftaftersnum\hfil}| \\
701 % is typeset within a box of width |\cftXnumwidth|.
702 %
703 % \DescribeMacro{\cftXfont}
704 % This controls the appearance of the title (and its preceding number,
705 % if any). It may be changed using |\renewcommand|.
706 %
707 % \DescribeMacro{\cftXpresnum}
708 % \DescribeMacro{\cftXaftersnum}
709 % \DescribeMacro{\cftXaftersnumb}
710 % \changes{v1.1}{2000/02/11}{Added description of \cs{cftXpresnum}}
711 % Normally the section number is typeset within a box of width |\cftXnumwidth|.
712 % Within the box the macro |\cftXpresnum| is first called, then the
713 % number is typeset, and next the |\cftXaftersnum|
714 % macro is called after the number is typeset. The last command
715 % within the box is |\hfil| to make the box contents flushleft.
716 % After the box is
717 % typeset the |\cftXaftersnumb| macro is called before typesetting
718 % the title text. All three of these can be changed by |\renewcommand|.
719 % By default they are defined to do nothing.
720 %
721 % In the standard classes the ToC entry for a |\part| is just typeset as
722 % the number and title, followed by the page number, with the
723 % |\cftpartpresnum|
724 % macro being called before typesetting the number and title.
725 % Due to \LaTeX\ ideosyncracies, |\cftpartpresnum| may become doubled in the output
726 % if a third-party package behaves differently to that of the default internal \LaTeX\ commands.
727 % The |tocloft| package contains specific code to prevent this in the case of
728 % the KomaScript classes and for the |titlesec| package; please contact the maintainer
729 % to add further corrections if you discover other packages which also exhibit this mis-behaviour.
730 %
731 % When a standard class is used the |\cftpartaftersnum| and
732 % |\cftpartaftersnumb| macros have no effect, but they may do something
733 % if a non-standard class is used.
734 %
735 %
736 % \DescribeMacro{\cftXleader}
737 % \DescribeMacro{\cftXdotsep}
738 % |\cftXleader| defines the leader between the title and the page number;
739 % it can be changed by |\renewcommand|.
740 % The spacing between any dots in the leader is controlled by |\cftXdotsep|
741 % (|\@dotsep| in Figure~\ref{fig:ltoc}).
742 % It can be changed by |\renewcommand| and its value must be either a
743 % number (e.g., 6.6 or |\cftdotsep|) or |\cftnodots| (to disable the dots).
744 % The spacing
745 % is in terms of \emph{math units} where there are 18mu to 1em.
746 %
747 % \DescribeMacro{\cftXpagefont}
748 % This defines the font to be used for typesetting the page number. It
749 % can be changed by |\renewcommand|.
750 %
751 % \DescribeMacro{\cftXafterpnum}
752 % This macro is called after the page number has been typeset. Its default
753 % is to do nothing. It can be changed by |\renewcommand|.
754 %
755 % \DescribeMacro{\cftsetindents}
756 % The command
757 % |\cftsetindents{|\meta{entry}|}{|\meta{indent}|}{|\meta{numwidth}|}|
758 % sets the \meta{entry}'s \textit{indent} to the length \meta{indent} and its
759 % \textit{numwidth} to the length \meta{numwidth}. The \meta{entry} argument
760 % is the name of one of the standard entries (e.g., |subsection|) or the name of
761 % entry that has been defined with the \Lpack{tocloft} package.
762 % For example \\
763 % |\cftsetindents{figure}{0em}{1.5em}| \\
764 % will make figure entries left justified.
765 %
766 %
767 % Various effects can be achieved by changing the definitions of |\cftXfont|,
768 % |\cftXaftersnum|, |\cftXaftersnumb|, |\cftXleader| and |\cftXafterpnum|,
769 % either singly or in combination.
770 % For the sake of some examples, assume that we have the following initial
771 % definitions
772 % \begin{verbatim}
773 % \newcommand{\cftXfont}{}
774 % \newcommand{\cftXaftersnum}{}
775 % \newcommand{\cftXaftersnumb}{}
776 % \newcommand{\cftXleader}{\cftdotfill{\cftXdotsep}}
777 % \newcommand{\cftXdotsep}{\cftdotsep}
778 % \newcommand{\cftXpagefont}{}
779 % \newcommand{\cftXafterpnum}{}
780 % \end{verbatim}
781 % (Note that the same font should be used for the title, leader and page
782 % number to provide a coherent appearance).
783 %
784 % \begin{itemize}
785 % \item To eliminate the dots in the leader:
786 % \begin{verbatim}
787 % \renewcommand{\cftXdotsep}{\cftnodots}
788 % \end{verbatim}
789 %
790 % \item To put something (e.g., a name) before the title (number):
791 % \begin{verbatim}
792 % \renewcommand{\cftXpresnum}{SOMETHING }
793 % \end{verbatim}
794 %
795 % \item To add a colon after the section number:
796 % \begin{verbatim}
797 % \renewcommand{\cftXaftersnum}{:}
798 % \end{verbatim}
799 %
800 % \item To put something before the title number, add a colon after the
801 % the title number, set everything in bold font,
802 % and start the title text on the following line:
803 % \begin{verbatim}
804 % \renewcommand{\cftXfont}{\bfseries}
805 % \renewcommand{\cftXleader}{\bfseries\cftdotfill{\cftXdotsep}}
806 % \renewcommand{\cftXpagefont}{\bfseries}
807 % \renewcommand{\cftXpresnum}{SOMETHING }
808 % \renewcommand{\cftXaftersnum}{:}
809 % \renewcommand{\cftXaftersnumb}{\\}
810 % \end{verbatim}
811 %
812 % If you are adding text in the number box in addition to the number,
813 % then you will probably have to increase the width of the box so that
814 % multiline titles have a neat vertical alignment; changing box widths
815 % usually implies that the indents will require modification as
816 % well.\footnote{Lyndon Dudding (\texttt{[email protected]})
817 % discovered this.}
818 % One possible method of adjusting the box width for the above example
819 % is:
820 % \begin{verbatim}
821 % \newlength{\mylen} % a "scratch" length
822 % \settowidth{\mylen}{\bfseries\cftXpresnum\cftXaftersnum} % extra space
823 % \addtolength{\cftXnumwidth}{\mylen} % add the extra space
824 % \end{verbatim}
825 %
826 % \item To set the section numbers flushright:\footnote{With thanks to
827 % David Holz (\texttt{[email protected]}) for requesting this.}
828 % \begin{verbatim}
829 % \setlength{\mylen}{0.5em} % need some extra space at end of number
830 % \renewcommand{\cftXpresnum}{\hfill} % note the double `l'
831 % \renewcommand{\cftXaftersnum}{\hspace*{\mylen}}
832 % \addtolength{\cftXnumwidth}{\mylen}
833 % \end{verbatim}
834 % In the above, the added initial |\hfill| in the box overrides the
835 % final |\hfil| in the box, thus shifting everything to the right hand
836 % end of the box. The extra space is so that the number is not typeset
837 % immediately at the left of the title text.
838 %
839 % \item To set the entry ragged left (but this only looks good for single
840 % line titles):
841 % \begin{verbatim}
842 % \renewcommand{\cftXfont}{\hfill\bfseries}
843 % \renewcommand{\cftXleader}{}
844 % \end{verbatim}
845 %
846 % \item To set the page number immediately after the entry text instead of at
847 % the righthand margin:
848 % \begin{verbatim}
849 % \renewcommand{\cftXleader}{}
850 % \renewcommand{\cftXafterpnum}{\cftparfillskip}
851 % \renewcommand{\cftpnumalign}{l}
852 % \end{verbatim}
853 % By default the |\parfillskip| value is locally set to fill up the last
854 % line of a paragraph. Just changing |\cftXleader| puts horrible interword
855 % spaces into the last line of the title. The |\cftparfillskip|
856 % command
857 % is part of the \Lpack{tocloft} package and is provided just so that
858 % the above effect can be achieved.
859 % In addition, this is a good example of when it would be suitable to change the alignment of the page number box.
860 %
861 % \item To remove the space inserted between table and figure caption entries between chapters:
862 % \begin{verbatim}
863 % \begingroup
864 % \renewcommand*{\addvspace}[1]{}
865 % \listoftables
866 % \listoffigures
867 % \endgroup
868 % \end{verbatim}
869 % \end{itemize}
870 %
871 % \DescribeMacro{\cftpagenumbersoff}
872 % \DescribeMacro{\cftpagenumberson}
873 % The command |\cftpagenumbersoff{|\meta{entry}|}| will
874 % eliminate the page numbers for \meta{entry} in the listing, where
875 % \meta{entry} is the name of one of the standard
876 % kinds of entries (e.g., |subsection|, or |figure| --- including |subfigure|
877 % if the \Lpack{subfigure} package is used --- etc.), or the name of a
878 % new entry defined with the \Lpack{tocloft} package.
879 %
880 % The command |\cftpagenumberson{|\meta{entry}|}| reverses
881 % the effect of a corresponding |\cftpagenumbersoff|.
882 %
883 % One question that appeared on the \file{comp.text.tex} newsgroup asked
884 % how to get the titles of Appendices list in the ToC \emph{without}
885 % page numbers. Here is a simple way of doing it, assuming the document
886 % has chapters
887 % \begin{verbatim}
888 % ...
889 % \appendix
890 % \addtocontents{toc}{\cftpagenumbersoff{chapter}}
891 % \chapter{First appendix}
892 % \end{verbatim}
893 % If there are other chaptered headings to go into the ToC after the
894 % appendices, then it will be necessary to do a similar \\
895 % |\addtocontents{toc}{\cftpagenumberson{chapter}}| \\
896 % to restore the page numbering in the ToC.
897 %
898 % Similarly, if you are using the \Lpack{subfigure} package you may
899 % want to eliminate the page numbers for the subfigure captions. This
900 % can be accomplished by: \\
901 % |\cftpagenumbersoff{subfigure}|
902 %
903 % At this point, I leave it up to your ingenuity as to other effects that
904 % you can achieve. However, if you come up with further examples, let me
905 % know for possible inclusion in a later version of this document.
906 %
907 % \subsection{New list of\ldots}
908 %
909 % \DescribeMacro{\newlistof}
910 % The command |\newlistof[|\meta{within}|]{|\meta{entry}|}{|\meta{ext}|}{|\meta{listofname}|}|
911 % creates a new List of \ldots, and assorted commands to go along with it.
912 %
913 % The first required argument, \meta{entry} is used to define a new
914 % counter called |entry|. The optional \meta{within} argument can
915 % be used so that |entry| gets reset to one every time the counter called
916 % |within| is changed. That is, the first two arguments are equivalent to
917 % calling |\newcounter{|\meta{entry}|}[|\meta{within}|]|.
918 %
919 % The next argument, \meta{ext}, is the file extension for the new List of.
920 % The last argument, \meta{listofname}, is the text for the heading of the
921 % new List of. As an example:
922 % \begin{verbatim}
923 % \newcommand{\listanswername}{List of Answers}
924 % \newlistof[chapter]{answer}{ans}{\listanswername}
925 % \end{verbatim}
926 % will create a new |answer| counter that will be reset at the start of each
927 % |\chapter{...}|. Any answer titles will be written to the file
928 % \file{jobname.ans} and |\listanswername| will be used as the list heading.
929 % A command |\listofanswer| is created which can be used just like the
930 % |\listoftables| or |tableofcontents| commands to generate a listing.
931 % It is up to you to specify how the entries are put into the
932 % new List of Answers. Here is a very simple example, remembering that an
933 % |answer| counter has been created.
934 % \begin{verbatim}
935 % \newcommand{\answer}[1]{%
936 % \refstepcounter{answer}
937 % \par\noindent\textbf{Answer \theanswer. #1}
938 % \addcontentsline{ans}{answer}{\protect\numberline{\theanswer}#1}\par}
939 % \end{verbatim}
940 % which, when used like: \\
941 % |\answer{Hard} The \ldots| will print as:
942 % \par\noindent\textbf{Answer 1. Hard}\par The \ldots
943 %
944 % As mentioned above, the |\newlistof| command creates several new
945 % commands, most of which you should now be familiar with. For convenience,
946 % assume that |\newlistof{X}{Z}{...}| has been issued; so |X| is the name
947 % of the new counter and corresponds to the |X| in section~\ref{sec:entries},
948 % and |Z| is the new file extension and corresponds to the |Z| in
949 % section~\ref{sec:titles}. Then, among others, the following new commands
950 % will be made available.
951 %
952 % The five commands, |\cftmarkZ|,
953 % |\cftbeforeZtitleskip|,
954 % |\cftafterZtitleskip|,
955 % |\cftZtitlefont|, and
956 % |\cftafterZtitle|,
957 % are analogous to the commands of the same names
958 % described in section~\ref{sec:titles}.
959 %
960 % \DescribeMacro{\listofX}
961 % The command |\listofX| is similar to |\listoftables|, etc.,
962 % in that it typesets
963 % the new listing at the point where it is called.
964 %
965 % \DescribeMacro{\Zdepth}
966 % The command |\Zdepth{|\meta{number}|}| is analogous to the standard
967 % |\tocdepth{|\meta{number}|}| command, in that it specifies that entries
968 % in the new listing should not be typeset if their numbering level
969 % is greater
970 % than \meta{number}. The default definition is
971 % |\setcounter{Zdepth}{1}|.
972 %
973 % \DescribeMacro{\newlistentry}
974 % The command
975 % |\newlistentry[|\meta{within}|]{|\meta{entry}|}{|\meta{ext}|}{|\meta{level-1}|}| creates
976 % new commands for typesetting a new kind of entry in a listing. It is used
977 % internally by the |\newlistof| command but may be used independently.
978 %
979 % The first required argument, \meta{entry} is used to define a new
980 % counter called |entry|. The optional \meta{within} argument can
981 % be used so that |entry| gets reset to one every time the counter called
982 % |within| is changed. That is, the first two arguments are equivalent to
983 % calling |\newcounter{|\meta{entry}|}[|\meta{within}|]|.
984 % The second required argument, \meta{ext}, is the file extension for the
985 % entry listing.
986 % The last argument, \meta{level-1}, is a number specifying the numbering
987 % level minus one,
988 % of the entry in a listing.
989 % For example, the command \\
990 % |\newlistof[chapter]{answer}{ans}{\listanswername}| \\
991 % will call the command: \\
992 % |\newlistentry[chapter]{answer}{ans}{0}| \\
993 %
994 %
995 % Calling |\newlistentry| creates several new commands. Assuming that
996 % it is called as |\newlistentry[within]{X}{Z}{N}|, where |X| and |Z| are
997 % similar to the
998 % previous uses of them, and |N| is an integer number, then the following
999 % commands are made available.
1000 %
1001 % The set of commands |\cftbeforeXskip|,
1002 % |\cftXfont|,
1003 % |\cftXpresnum|,
1004 % |\cftXaftersnum|,
1005 % |\cftXaftersnumb|,
1006 % |\cftXleader|,
1007 % |\cftXdotsep|,
1008 % |\cftXpagefont|, and
1009 % |\cftXafterpnum|,
1010 % are analogous to the commands of the same names
1011 % described in section~\ref{sec:entries}. Their default values are also
1012 % as described earlier.
1013 %
1014 % The default values of |\cftXindent| and |\cftXnumwidth| are set according
1015 % to the value of the \meta{level-1} argument (i.e., |N| in this example).
1016 % For |N=0| the settings correspond to those for
1017 % sections in non-chaptered documents, as listed in Table~\ref{tab:indents}.
1018 % For |N=4| the settings correspond
1019 % to subparagraphs in non-chaptered documents, and for intermediate values
1020 % correspond to the matching sectional division in chaptered documents.
1021 % For values of |N| less than zero or greater than four,
1022 % or for non-default values, use the
1023 % |\cftsetindents| command to set the values.
1024 %
1025 %
1026 % \DescribeMacro{\l@X}
1027 % |\l@X| is an internal command that typesets an entry in the list, and
1028 % is defined in terms of the above |\cft*X*| commands. It will not typeset
1029 % an entry if |\Zdepth| is |N| or less, where |Z| is the listing's file
1030 % extension.
1031 %
1032 % \DescribeMacro{\theX}
1033 % The command |\theX| prints the value of the |X| counter. It is initially
1034 % defined so that it prints arabic numerals. If the optional \meta{within}
1035 % argument is used, |\theX| is defined as \\
1036 % |\renewcommand{\theX}{\thewithin.\arabic{X}}| otherwise as \\
1037 % |\renewcommand{\theX}{\arabic{X}}|.
1038 %
1039 %
1040 % As an example of the independent use of |\newlistentry|, the following
1041 % will set up for sub-answers.
1042 % \begin{verbatim}
1043 % \newlistentry[answer]{subanswer}{1}
1044 % \cftsetindents{subanswer}{1.5em}{3.0em}
1045 % \renewcommand{\thesubanswer}{\theanswer.\alph{subanswer}}
1046 % \newcommand{\subanswer}[1]{%
1047 % \refstepcounter{subanswer}
1048 % \par\textbf{\thesubanswer) #1}
1049 % \addcontentsline{ans}{subanswer{\protect\numberline{\thesubanswer}#1}}
1050 % \setcounter{ansdepth}{2}
1051 % \end{verbatim}
1052 % And then:
1053 % \begin{verbatim}
1054 % \answer{Harder} The \ldots
1055 % \subanswer{Reformulate the problem} It assists \ldots
1056 % \end{verbatim}
1057 % will be typeset as:
1058 % \par\noindent\textbf{Answer 2. Harder}\par The \ldots
1059 % \par\textbf{2.a) Reformulate the problem} It assists \ldots
1060 %
1061 % By default the answer entries will appear in the List of Answers listing
1062 % (typeset by the |\listofanswer| command).
1063 % In order to get the subanswers to appear,
1064 % the |\setcounter{ansdepth}{2}| command was used above.
1065 %
1066 % To turn off page numbering for the subanswers, do \\
1067 % |\cftpagenumbersoff{subanswer}|
1068 %
1069 % As another example of |\newlistentry|, suppose that an extra sectioning
1070 % division below |subparagraph| is required, called |subsubpara|.
1071 % The |\subsubpara| command itself can be defined via the LaTeX kernel
1072 % |\@startsection| command.
1073 % Also it is necessary to define a |\subsubparamark| macro,
1074 % a new |subsubpara| counter, a |\thesubsubpara| macro and a |\l@subsubpara|
1075 % macro. Using the \Lpack{tocloft} package's |\newlistentry|
1076 % takes care of most of these as shown below (remember
1077 % the caveats about commands with |@| signs in them).
1078 % \begin{verbatim}
1079 % \newcommand{\subsubpara}{\@startsection{subpara}%
1080 % {6}% level
1081 % {\parindent}% indent from left margin
1082 % {3.25ex \@plus1ex \@minus .2ex}% skip above heading
1083 % {-1em}% runin heading with 1em between title & text
1084 % {\normalfont\normalsize\itshape}% italic number and title
1085 % }
1086 % \newlistentry[subparagraph]{subsubpara}{toc}{5}
1087 % \cftsetindents{subsubpara}{14.0em}{7.0em}
1088 % \newcommand*{\subsubparamark}[1]{} % gobble heading mark
1089 % \end{verbatim}
1090 %
1091 %
1092 % Each List of\ldots uses a file to store the list entries, and these
1093 % files must remain open for writing throughout the document processing.
1094 % TeX has only a limited number of files that it can keep open, and this
1095 % puts a limit on the number of listings that can be used. For a document
1096 % that includes a ToC but no other extra ancillary files (e.g., no
1097 % index or bibliography output files) the maximum number of LoX's, including
1098 % a LoF and LoT, is no more than about eleven. If you try and create too many
1099 % new listings LaTeX will respond with the error message:
1100 % \begin{center}
1101 % |No room for a new write|
1102 % \end{center}
1103 % If you get such a message the only recourse is to redesign your document.
1104 %
1105 % The \Lpack{tocloft} package does not provide a simple means of specifying
1106 % new Lists of Floats or float environments.
1107 % For those, I recommend the \Lpack{ccaption} package~\cite{CCAPTION}.
1108 %
1109 % \subsection{Experimental utilities}
1110 %
1111 % The macros described in this section are even more experimental than
1112 % those described previously.
1113 %
1114 % \DescribeMacro{\cftchapterprecis}
1115 % Some old style novels, and even some modern text
1116 % books,\footnote{For example, Robert Sedgewick, \textit{Algorithms},
1117 % Addison-Wesley, 1983.} include a short synopsis of the contents of
1118 % the chapter either immediately
1119 % after the chapter heading or in the Toc, or in both places.
1120 %
1121 % The command |\cftchapterprecis{|\meta{text}|}| prints its argument
1122 % both at the
1123 % point in the document where it is called, and also adds it to the \file{.toc}
1124 % file. For example:
1125 % \begin{verbatim}
1126 % ...
1127 % \chapter{} % first chapter
1128 % \cftchapterprecis{Our hero is introduced; family tree; early days.}
1129 % ...
1130 % \end{verbatim}
1131 %
1132 % \DescribeMacro{\cftchapterprecishere}
1133 % \DescribeMacro{\cftchapterprecistoc}
1134 % The |\cftchapterprecis| command calls these two commands to print the
1135 % text in the document (the |\...here{|\meta{text}|}| command)
1136 % and to put it into the ToC (the |\...toc{|\meta{text}|}| command).
1137 % These can be used individually if required.
1138 %
1139 % Sometimes it may be desirable to make a change to the global parameters
1140 % for an individual entry. For example, a figure might be placed on
1141 % the end paper of a book (the inside of the front or back cover), and
1142 % this needs to be placed in a LoF with the page number set as, say
1143 % `inside front cover'. If `inside front cover' is typeset as an ordinary
1144 % page number it will stick out into the margin. Therefore, the parameters
1145 % for this particular entry need to be changed.
1146 %
1147 % \DescribeMacro{\cftlocalchange}
1148 % The command |\cftlocalchange{|\meta{file}|}{|\meta{pnumwidth}|}{|\meta{tocrmarg}|}|
1149 % will write an entry into \meta{file} to reset the global parameters.
1150 % The command should be called again after any special entry to reset
1151 % the parameters back to their usual values. Any fragile commands used
1152 % in the arguments must be protected.
1153 %
1154 % \DescribeMacro{\cftaddtitleline}
1155 % The command |\cftaddtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}|
1156 % will write a |\contentsline| entry into \meta{file} for a \meta{kind}
1157 % entry with title \meta{title} and page number \meta{page}. That is,
1158 % an entry is made of the form: \\
1159 % |\contentsline{kind}{title}{page}| \\
1160 % Any fragile commands used in the arguments must be protected.
1161 %
1162 % \DescribeMacro{\cftaddnumtitleline}
1163 % The command |\cftaddnumtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{num}|}{|\meta{title}|}{|\meta{page}|}|
1164 % is similar except that it also includes \meta{num} as the argument to
1165 % the |\numberline|. That is, an entry is made of the form: \\
1166 % |\contentsline{kind}{\numberline{num} title}{page}| \\
1167 % Any fragile commands used in the arguments must be protected.
1168 %
1169 % As an example of the use of these commands,
1170 % noting that the default \LaTeX{} values for
1171 % |\@pnumwidth| and |\@tocrmarg| are 1.55em and 2.55em respectively,
1172 % one might do the
1173 % following for a figure on the frontispiece page.
1174 % \begin{verbatim}
1175 % ...
1176 % % this is the frontispiece page with no number
1177 % % draw or import the picture (with no \caption)
1178 % \cftlocalchange{lof}{4em}{5em} % make pnumwidth big enough for
1179 % % frontispiece and change margin to suit
1180 % \cftaddtitleline{lof}{figure}{The title}{frontispiece}
1181 % \cftlocalchange{lof}{1.55em}{2.55em} % return to normal settings
1182 % ...
1183 % \end{verbatim}
1184 % Recall that a |\caption| command will put an entry in the \file{.lof}
1185 % file, which is not wanted here. If a caption is required, then you can
1186 % either craft one yourself or, assuming that your general captions are not
1187 % too exotic, use the |\legend| command from the
1188 % \Lpack{ccaption} package. If the illustration is numbered, use the
1189 % |\cftaddnumtitleline| command instead of |\cftaddtitleline|.
1190 %
1191 % \DescribeMacro{\cftZprehook}
1192 % \DescribeMacro{\cftZposthook}
1193 % It's surprisingly difficult to achieve multicolumn ToCs; can you guess what the problem is to write the following?
1194 % \begin{verbatim}
1195 % \begin{multicols}{2}
1196 % \tableofcontents
1197 % \end{multicols}
1198 % \end{verbatim}
1199 % Probably the easiest way to do it in regular \LaTeX{} is something like
1200 % \begin{verbatim}
1201 % \RequirePackage{multicol}
1202 % \AtBeginDocument{\addtocontents{toc}{\protect\begin{multicols}{2}}}
1203 % \AtEndDocument {\addtocontents{toc}{\protect\end {multicols}}}
1204 % \end{verbatim}
1205 % This method of writing to the |.toc| file is most flexible for trying to control the typesetting output within the table of contents.
1206 %
1207 % To make this \emph{slightly} easier with \Lpack{tocloft}, the following macros are available: \cs{cftZprehook} and \cs{cftZprehook}, where |Z| is |toc|, |lof|, |lot|, etc.
1208 % If these are defined, they insert material just before the actual typesetting of the entries of the table of contents and so on.
1209 % A multicolumn ToC can therefore be achieved with this:
1210 % \begin{verbatim}
1211 % \RequirePackage{multicol}
1212 % \renewcommand\cfttocprehook{\begin{multicols}{2}}
1213 % \renewcommand\cfttocposthook{\end{multicols}}
1214 % \end{verbatim}
1215 %
1216 % \subsection{Usage with other packages}
1217 %
1218 % The \Lpack{tocloft} and \Lpack{tocbibind} packages can be used together
1219 % in the same document. The \Lpack{tocbibind} package provides easy means
1220 % of adding document elements like the bibliography or the index to the
1221 % Table of Contents. However there is one known potential problem:
1222 % \begin{itemize}
1223 % \item If the argument to the |\tocotherhead| command is other than one
1224 % of the normal sectioning divisions (i.e., part through to sub-paragraph)
1225 % such as |\tocotherhead{clause}|,
1226 % then this will almost certainly cause a problem (as the \Lpack{tocloft}
1227 % package will not know how to define the corresponding |\l@clause| command).
1228 % In such a case you will have to supply the appropriate macros yourself.
1229 % \end{itemize}
1230 %
1231 % \DescribeMacro{\@cftbsnum}
1232 % \DescribeMacro{\@cftasnum}
1233 % \DescribeMacro{\@cftasnumb}
1234 % Some packages, like the \Lpack{float} package by Anselm Lingnau,
1235 % enable the creation of other kinds of \textit{List of \ldots}.
1236 % The \Lpack{tocloft} package is only minimally able to change the
1237 % formatting of these,
1238 % principally because the packages are independent of each other and, in
1239 % the case of the \Lpack{float} package, new kinds of float environments
1240 % and their associated lists can be created on the fly at any point in
1241 % a document. Some aspects of the typesetting
1242 % are controlled by |\@cftbsnum|, |\@cftasnum| and |\@cftasnumb| commands.
1243 % These are equivalent to the |\cftXpresnum|, |\cftXaftersnum| and |\cftXaftersnumb|
1244 % commands described earlier. By default they are defined to do nothing, but
1245 % may be renewed to do something.
1246 %
1247 % The \Lpack{tocloft} and \Lpack{minitoc} packages have an unfortunate
1248 % interaction,\footnote{Discovered by Lyndon Dudding
1249 % (\texttt{[email protected]}).} which fortunately can be fixed.
1250 % In the normal course of events, when \Lpack{minitoc} is used in a chaptered
1251 % document it will typeset section
1252 % entries in the minitocs in bold font. If \Lpack{tocloft} is used in
1253 % conjunction with \Lpack{minitoc}, then the minitoc section entries are
1254 % typeset in the normal font, except for the page numbers which are in
1255 % bold font, while the ToC section entries are all in normal font.
1256 %
1257 % One cure, if you want the minitoc section entries to be all in normal
1258 % font is to put:
1259 % \begin{verbatim}
1260 % \renewcommand{\mtcSfont}{\small\normalfont}
1261 % \end{verbatim}
1262 % in the preamble.
1263 %
1264 % Otherwise, the cure is the following incantation:
1265 % \begin{verbatim}
1266 % \renewcommand{\cftsecfont}{\bfseries}
1267 % \renewcommand{\cftsecleader}{\bfseries\cftdotfill{\cftdotsep}}
1268 % \renewcommand{\cftsecpagefont}{\bfseries}
1269 % \end{verbatim}
1270 % To have the section entries in both the ToC and the minitocs in bold then
1271 % put the incantation in the preamble. To have only the minitoc section
1272 % entries in bold while the ToC entries are in the normal font,
1273 % put the incantation between the |\tableofcontents|
1274 % command and the first |\chapter| command.
1275 %
1276 %
1277 % In general, use with other packages that redefine any of the macros that
1278 % \Lpack{tocloft} also modifies is likely to be problematic.
1279 %
1280 % \section{The package code} \label{sec:code}
1281 %
1282 % \begin{macrocode}
1283 %<*usc>
1284 % \end{macrocode}
1285 %
1286 % In order to try and avoid name clashes with other packages, each internal
1287 % name will include the character string \texttt{@cft}.
1288 %
1289 % \begin{macro}{\@cftifundefined}
1290 % \changes{v2.3h}{2017/08/29}{Use internal ifundefined macro to fix conflict with fancyhdr}
1291 % Due to a conflict with how this package and fancyhdr checked for undefinedness.
1292 % \begin{macrocode}
1293 \newcommand\@cftifundefined[1]{%
1294 \begingroup\expandafter\expandafter\expandafter\endgroup
1295 \expandafter\ifx\csname #1\endcsname\relax
1296 \expandafter\@firstoftwo
1297 \else
1298 \expandafter\@secondoftwo
1299 \fi}
1300 % \end{macrocode}
1301 % \end{macro}
1302 %
1303 % \begin{macro}{\@cftquit}
1304 % \begin{macro}{\if@cfthaschapter}
1305 % We will be using either chapter or section type headings for the ToC, etc.,
1306 % so we need to know which of these the document class supports.
1307 % \changes{v2.0}{2001/03/03}{Revamped chapter checking so the stdclsdv package no longer required}
1308 % \begin{macrocode}
1309 \newcommand{\@cftquit}{}
1310 \newif\if@cfthaschapter
1311 % \end{macrocode}
1312 % \end{macro}
1313 % \end{macro}
1314 %
1315 % \begin{macro}{\if@cftkoma}
1316 % The \Lpack{koma} classes have different defaults than the standard classes,
1317 % so we need to know if a \Lpack{koma} class has been loaded.
1318 % \changes{v2.3}{2002/06/15}{Added check for a koma class}
1319 % \begin{macrocode}
1320 \newif\if@cftkoma
1321 \@cftkomafalse
1322 \@ifclassloaded{scrartcl}{\@cftkomatrue}{}
1323 \@ifclassloaded{scrreprt}{\@cftkomatrue}{}
1324 \@ifclassloaded{scrbook}{\@cftkomatrue}{}
1325 % \end{macrocode}
1326 % \end{macro}
1327 %
1328 % \begin{macro}{\if@cfttitlesec}
1329 % \changes{v2.3f}{2013/04/30}{Added check for titlesec package}
1330 % \begin{macrocode}
1331 \newif\if@cfttitlesec
1332 \AtBeginDocument{\@ifpackageloaded{titlesec}{\@cfttitlesectrue}{}}
1333 % \end{macrocode}
1334 % \end{macro}
1335 %
1336 % Issue a warning if there are no recognised sectional divisions
1337 % and then skip the rest of the package code.
1338 % \begin{macrocode}
1339 \@cftifundefined{chapter}{%
1340 \@cfthaschapterfalse
1341 \@cftifundefined{section}{%
1342 \PackageWarning{tocloft}%
1343 {I don't recognize any sectional divisions so I'll do nothing}
1344 \renewcommand{\@cftquit}{\endinput}
1345 }{\PackageInfo{tocloft}{The document has section divisions}}
1346 }{\@cfthaschaptertrue
1347 \PackageInfo{tocloft}{The document has chapter divisions}}
1348 % \end{macrocode}
1349 % Perhaps quit now.
1350 % \begin{macrocode}
1351 \@cftquit
1352 % \end{macrocode}
1353 %
1354 % Use chapter style if |\if@cfthaschapter| is TRUE, otherwise section style.
1355 %
1356 % \begin{macro}{\if@cfttocbibind}
1357 % A flag that is set TRUE iff the \Lpack{tocbibind} package has been loaded.
1358 % The 1998/11/15 version of \Lpack{tocbibind} does not necessarily work well
1359 % with \Lpack{tocloft}.
1360 % \begin{macrocode}
1361 \newif\if@cfttocbibind
1362 \AtBeginDocument{%
1363 \@ifpackageloaded{tocbibind}{\@cfttocbibindtrue}{\@cfttocbibindfalse}
1364 \if@cfttocbibind
1365 \@ifpackagelater{tocbibind}{1998/11/16}{}{%
1366 \PackageWarning{tocloft}{%
1367 You are using a version of the tocbibind package\MessageBreak
1368 that is not compatible with tocloft.\MessageBreak
1369 The results may be surprising.\MessageBreak
1370 Consider installing the current version of tocbibind.}}
1371 \fi
1372 }
1373 % \end{macrocode}
1374 % \end{macro}
1375 %
1376 % \begin{macro}{\if@cftnctoc}
1377 % A boolean used to implement the \Lopt{titles} option. It is TRUE
1378 % if the ToC, LoT, LoF titles should use the default styles.
1379 % \begin{macrocode}
1380 \newif\if@cftnctoc\@cftnctocfalse
1381 \DeclareOption{titles}{\@cftnctoctrue}
1382 %% \ProcessOptions\relax
1383 % \end{macrocode}
1384 % \end{macro}
1385 %
1386 % \begin{macro}{\if@cftsubfigopt}
1387 % A boolean used to implement the \Lopt{subfigure} option.
1388 % \begin{macrocode}
1389 \newif\if@cftsubfigopt\@cftsubfigoptfalse
1390 \DeclareOption{subfigure}{\@cftsubfigopttrue}
1391 % \end{macrocode}
1392 % \end{macro}
1393 %
1394 % Process the options.
1395 %
1396 % \begin{macrocode}
1397
1398 \ProcessOptions\relax
1399
1400 % \end{macrocode}
1401 %
1402 % \begin{macro}{\tocloftpagestyle}
1403 % \begin{macro}{\@cftpagestyle}
1404 % A user-level macro to set the pagestyle for the first page of the ToC, etc.
1405 % The default is the |plain| pagestyle.
1406 % \changes{v2.3}{2002/06/15}{Added \cs{tocloftpagestyle}}
1407 % \begin{macrocode}
1408 \newcommand{\tocloftpagestyle}[1]{%
1409 \def\@cftpagestyle{\thispagestyle{#1}}}
1410 \tocloftpagestyle{plain}
1411
1412 % \end{macrocode}
1413 % \end{macro}
1414 % \end{macro}
1415 %
1416 % \begin{macro}{\cftmarktoc}
1417 % \begin{macro}{\cftmarklof}
1418 % \begin{macro}{\cftmarklot}
1419 % These three macros set the style for running heads. They are initialised
1420 % to give the default appearance.
1421 % \changes{v2.3}{2002/06/15}{Marking commands are different for koma}
1422 % \begin{macrocode}
1423 \newcommand{\cftmarktoc}{%
1424 \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
1425 \newcommand{\cftmarklof}{%
1426 \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}}
1427 \newcommand{\cftmarklot}{%
1428 \@mkboth{\MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
1429 \if@cftkoma
1430 \renewcommand{\cftmarktoc}{%
1431 \@mkboth{\contentsname}{\contentsname}}
1432 \renewcommand{\cftmarklof}{%
1433 \@mkboth{\listfigurename}{\listfigurename}}
1434 \renewcommand{\cftmarklot}{%
1435 \@mkboth{\listtablename}{\listtablename}}
1436 \fi
1437 % \end{macrocode}
1438 % \end{macro}
1439 % \end{macro}
1440 % \end{macro}
1441 %
1442 % \begin{macro}{\@cfttocstart}
1443 % \begin{macro}{\@cfttocfinish}
1444 % Two macros to perform the actions at the beginning and end of the
1445 % |\tableofcontents| command (and friends). |\@cfttocstart| deals with
1446 % chaptered documents, ensuring that the ToC is typeset in a single
1447 % column (see \file{classes.dtx} for the original code).
1448 % These macros are also provided by the \Lpack{ccaption} package.
1449 % \begin{macrocode}
1450 \providecommand{\@cfttocstart}{%
1451 \if@cfthaschapter
1452 \if@twocolumn
1453 \@restonecoltrue\onecolumn
1454 \else
1455 \@restonecolfalse
1456 \fi
1457 \fi}
1458 % \end{macrocode}
1459 % |\@cfttocfinish| resets, if required, twocolumn typesetting.
1460 % \begin{macrocode}
1461 \providecommand{\@cfttocfinish}{%
1462 \if@cfthaschapter
1463 \if@restonecol\twocolumn\fi
1464 \fi}
1465 % \end{macrocode}
1466 % \end{macro}
1467 % \end{macro}
1468 %
1469 % \begin{macro}{\phantomsection}
1470 % This is provided because the \Lopt{hyperref} package screws with
1471 % |\addcontentsline|.
1472 % \changes{v2.2}{2001/04/17}{Provided \cs{phantomsection}}
1473 % \changes{v2.2}{2001/04/17}{Added \cs{phantomsection} before \cs{addcontentsline} commands}
1474 % \begin{macrocode}
1475 \providecommand{\phantomsection}{}
1476
1477 % \end{macrocode}
1478 % \end{macro}
1479 %
1480 % \begin{macro}{\@cftdobibtoc}
1481 % If the \Lpack{tocbibind} package has been used and it has
1482 % redefined |\tableofcontents| we need to cater for that. The contents
1483 % of the definition are defined in \Lpack{tocbibind}.
1484 % \begin{macrocode}
1485 \newcommand{\@cftdobibtoc}{%
1486 \if@dotoctoc
1487 \if@bibchapter
1488 \phantomsection
1489 \addcontentsline{toc}{chapter}{\contentsname}
1490 \else
1491 \phantomsection
1492 \addcontentsline{toc}{\@tocextra}{\contentsname}
1493 \fi
1494 \fi}
1495
1496 % \end{macrocode}
1497 % \end{macro}
1498 %
1499 % \begin{macro}{\cftparskip}
1500 % The |\parskip| local to the ToC, etc., is set to the length |\cftparskip|.
1501 % \changes{v2.1}{2001/04/08}{Added \cs{cftparskip} for local parskip in ToC, etc.}
1502 % \begin{macrocode}
1503 \newlength{\cftparskip}
1504 \setlength{\cftparskip}{0pt}
1505
1506 % \end{macrocode}
1507 % \end{macro}
1508 %
1509 %
1510 % \begin{macro}{\tableofcontents}
1511 % This is a parameterised version of the default |\tableofcontents| command.
1512 % Each class has its own definition, but we have to cater for all classes
1513 % in one definition, hence some of the checks. The definition is
1514 % modified after all packages have been loaded.
1515 %
1516 % If the \Lopt{titles} option has been used, then the command is not modified.
1517 %
1518 % \begin{macrocode}
1519 \AtBeginDocument{%
1520 \if@cftnctoc
1521 % ensure \cftparskip is still set properly
1522 \let\OLD@starttoc\@starttoc
1523 \renewcommand{\@starttoc}[1]{%
1524 \begingroup
1525 \parskip=\cftparskip
1526 \OLD@starttoc{#1}%
1527 \endgroup
1528 }
1529 \else
1530 \renewcommand{\tableofcontents}{%
1531 \@cfttocstart
1532 % \end{macrocode}
1533 % Ensure that any previous paragraph has been finished. Within a group set
1534 % the local paragraphing style and typeset the title.
1535 % \begin{macrocode}
1536 \par
1537 \begingroup
1538 \parindent\z@ \parskip\cftparskip
1539 \@cftmaketoctitle
1540 % \end{macrocode}
1541 % If \Lpack{tocbibind} has been used, then add the ToC
1542 % name to the ToC.
1543 % \begin{macrocode}
1544 \if@cfttocbibind
1545 \@cftdobibtoc
1546 \fi
1547 % \end{macrocode}
1548 % Finally, read the \file{.toc} file and finish up.
1549 % \begin{macrocode}
1550 \@starttoc{toc}%
1551 \endgroup
1552 \@cfttocfinish}
1553 \fi
1554 }
1555 % \end{macrocode}
1556 % \end{macro}
1557 %
1558 % \begin{macro}{\@cftmaketoctitle}
1559 % This command typesets the title for the ToC.
1560 % \changes{v2.3}{2002/06/15}{Added \cs{@secpenalty} to \cs{@cftmaketoctitle}}
1561 % \changes{v2.3}{2002/06/15}{Added \cs{@cftpagestyle} to \cs{@cftmaketoctitle}}
1562 % \begin{macrocode}
1563 \newcommand{\@cftmaketoctitle}{%
1564 \addpenalty\@secpenalty
1565 \if@cfthaschapter
1566 \vspace*{\cftbeforetoctitleskip}%
1567 \else
1568 \vspace{\cftbeforetoctitleskip}%
1569 \fi
1570 \@cftpagestyle
1571 {\interlinepenalty\@M
1572 {\cfttoctitlefont\contentsname}{\cftaftertoctitle}%
1573 \cftmarktoc
1574 \par\nobreak
1575 \vskip \cftaftertoctitleskip
1576 \@afterheading}}
1577 % \end{macrocode}
1578 % \end{macro}
1579 %
1580 % \begin{macro}{\cftbeforetoctitleskip}
1581 % \begin{macro}{\cftaftertoctitleskip}
1582 % These two lengths control the vertical spacing before and after the
1583 % ToC title.
1584 % \begin{macrocode}
1585 \newlength{\cftbeforetoctitleskip}
1586 \newlength{\cftaftertoctitleskip}
1587 % \end{macrocode}
1588 % Their values depend on whether the document has chapters or not. In
1589 % chaptered documents the default ToC title is typeset as a |\chapter*|,
1590 % otherwise as a |\section*|.
1591 % \begin{macrocode}
1592 \if@cfthaschapter
1593 \setlength{\cftbeforetoctitleskip}{50pt}
1594 \setlength{\cftaftertoctitleskip}{40pt}
1595 \else
1596 \setlength{\cftbeforetoctitleskip}{3.5ex \@plus 1ex \@minus .2ex}
1597 \setlength{\cftaftertoctitleskip}{2.3ex \@plus.2ex}
1598 \fi
1599 % \end{macrocode}
1600 % \end{macro}
1601 % \end{macro}
1602 %
1603 % \begin{macro}{\cfttoctitlefont}
1604 % \begin{macro}{\cftaftertoctitle}
1605 % The ToC title is typeset in the style given by |\cfttoctitlefont|.
1606 % The macro |\cftaftertoctitle| is called after typesetting the title.
1607 % This is initialised to do nothing.
1608 % Both these macros can be redefined to do other things (e.g., adding
1609 % an |\hfill| to |\cfttoctitlefont| will make the title flushright).
1610 % \changes{v2.3}{2002/06/15}{koma changes the title fonts}
1611 % \begin{macrocode}
1612 \if@cfthaschapter
1613 \newcommand{\cfttoctitlefont}{\normalfont\Huge\bfseries}
1614 \if@cftkoma\renewcommand{\cfttoctitlefont}{\size@chapter\sectfont}\fi
1615 \else
1616 \newcommand{\cfttoctitlefont}{\normalfont\Large\bfseries}
1617 \if@cftkoma\renewcommand{\cfttoctitlefont}{\size@section\sectfont}\fi
1618 \fi
1619 \newcommand{\cftaftertoctitle}{}
1620 % \end{macrocode}
1621 % \end{macro}
1622 % \end{macro}
1623 %
1624 % \begin{macro}{\cftsetpnumwidth}
1625 % \begin{macro}{\cftsetrmarg}
1626 % Users commands for setting |\@pnumwidth| and |\@tocrmarg|.
1627 % \begin{macrocode}
1628 \newcommand{\cftsetpnumwidth}[1]{\renewcommand{\@pnumwidth}{#1}}
1629 \newcommand{\cftsetrmarg}[1]{\renewcommand{\@tocrmarg}{#1}}
1630 % \end{macrocode}
1631 % \end{macro}
1632 % \end{macro}
1633 %
1634 % \begin{macro}{\cftpnumalign}
1635 % \changes{v2.3f}{2013/05/02}{Add \cs{cftpnumalign} for page number alignment}
1636 % Alignment string (as input to \cs{makebox} for the page number box.
1637 % \begin{macrocode}
1638 \newcommand{\cftpnumalign}{r}
1639 % \end{macrocode}
1640 % \end{macro}
1641 %
1642 % \begin{macro}{\cftdot}
1643 % \begin{macro}{\cftdotfill}
1644 % In the default ToC, a dotted line can be used to provide a leader between
1645 % a title and the page number. The definition of this leader is buried
1646 % in the |\@dottedtocline| command. The |\cftdotfill{|\meta{sep}|}|
1647 % command provides a parameterised version of the leader code, where
1648 % \meta{sep} is the separation between the dots in mu units.
1649 % The symbol used for the `dots' in the leader is given by the value
1650 % of |\cftdot|. These macros are also provided by the \Lpack{ccaption} package.
1651 % \begin{macrocode}
1652 \providecommand{\cftdot}{.}
1653 \providecommand{\cftdotfill}[1]{%
1654 \def\@tempa{#1}%
1655 \def\@tempb{\cftnodots}%
1656 \ifx\@tempa\@tempb
1657 \hfill
1658 \else
1659 \leaders\hbox{$\m@th\mkern #1 mu\hbox{\cftdot}\mkern #1 mu$}\hfill
1660 \fi
1661 }
1662 % \end{macrocode}
1663 % \changes{v2.3f}{2013/04/30}{Specifically avoid placing dots when \cs{cftnodots} is used}
1664 % \end{macro}
1665 % \end{macro}
1666 %
1667 % \begin{macro}{\cftdotsep}
1668 % \begin{macro}{\cftnodots}
1669 % |\cftdotsep| holds the default dot separation, and is also provided
1670 % by the \Lpack{ccaption} package.
1671 % If the kerns in |\cftdotfill| are large enough, then no dots will
1672 % be printed. |\cftnodots| should be `large enough'.
1673 % (Actually, |\cftnodots| is now used as a flag for a conditional branch, so its numerical value isn't as important now.)
1674 % \begin{macrocode}
1675 \providecommand{\cftdotsep}{4.5}
1676 \newcommand{\cftnodots}{5000}
1677 % \end{macrocode}
1678 % \changes{v2.3f}{2013/04/30}{Reduce \cs{cftnodots} to avoid very large dotsep sizes.}
1679 % \end{macro}
1680 % \end{macro}
1681 %
1682 % Now for the trickier bits regarding the typesetting of the ToC
1683 % entries.
1684 %
1685 % A \file{.toc} (also \file{.lof} and \file{.lot}) file consists
1686 % of a list of
1687 % |\contentsline{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}|
1688 % commands, where \meta{kind} is the kind of heading (e.g., |part| or
1689 % |section| or |figure|), \meta{title} is the title text (including the number),
1690 % and \meta{page} is the page number. The entries are inserted into the
1691 % file by calling the
1692 % |\addcontentsline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}|
1693 % command, where \meta{file} is the file extension (e.g., |toc|, |lot|)
1694 % and the other arguments are the same as for the |\contentsline|
1695 % command. (Arbitrary stuff may also be put into the file via the
1696 % |\addtocontents{|\meta{file}|}{|\meta{text}|}| command).
1697 % The typesetting of the |\contentsline| entries is performed by
1698 % commands of the form |\l@kind|. The sectioning and captioning commands
1699 % call |\addcontentsline| to insert their titles into the \file{.toc}
1700 % etc., files.
1701 %
1702 % For the purposes at hand it is generally impossible to treat
1703 % the typesetting
1704 % of a title and its number separately, as both are bundled into the
1705 % \meta{title} argument within |\contentsline|. They could be handled
1706 % separately if the |\contentsline| command was suitably modified. If
1707 % this was done, then the |\addtocontentsline| command would also need
1708 % to be changed which would then require the sectioning and captioning
1709 % commands to be modified as well. This is certainly possible, but would
1710 % cause problems if any other package also modified the sectioning or
1711 % captioning commands, and there are several packages which do this.
1712 %
1713 % Having said this, for all but Part entries, the sectional number
1714 % is typeset via the |\numberline| command. We can take advantage of
1715 % this fact.
1716 %
1717 % I have taken the decision to not touch the |\contentsline| macro
1718 % and instead to do what can be done with it as it exists. That is, I will
1719 % modify the |\l@kind| commands. Essentially, my new definitions
1720 % consist of inlined versions of the code for |\@dottedtocline|.
1721 %
1722 % \begin{macro}{\cftparfillskip}
1723 % The |\l@kind| commands modify (locally) the value of |\parfillskip|.
1724 % |\cftparfillskip| is a copy of the default \textit{\TeX book}
1725 % |\parfillskip| definition.
1726 % \begin{macrocode}
1727 \newcommand{\cftparfillskip}{\parfillskip=0pt plus1fil}
1728 % \end{macrocode}
1729 % \end{macro}
1730 %
1731 % \begin{macro}{\numberline}
1732 % \changes{v1.1}{2000/02/11}{Added \cs{@cftbsnum} to \cs{numberline}}
1733 % The purpose of the |\numberline{|\meta{secnum}|}| command is to typeset
1734 % \meta{secnum} left justified in a box of width |\@tempdima|. I redefine
1735 % it to add three additional parameters, namely |\@cftbsnum|,
1736 % |\@cftasnum| and |\@cftasnumb|
1737 % (see \file{ltsect.dtx} for the original
1738 % definition).
1739 % \begin{macrocode}
1740 \renewcommand{\numberline}[1]{%
1741 \hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
1742 % \end{macrocode}
1743 % \end{macro}
1744 %
1745 % \begin{macro}{\@cftbsnum}
1746 % \begin{macro}{\@cftasnum}
1747 % \begin{macro}{\@cftasnumb}
1748 % \changes{v0.2b}{1999/03/07}{Added empty definitions for @cftasnum and @cftasnumb commands}
1749 % \changes{v1.1}{2000/02/11}{Added empty definition of \cs{@cftbsnum}}
1750 % Originally these were not defined but were |\let| to appropriate commands
1751 % in the |\l@...| commands, but they
1752 % have to be defined in case something unexpected calls |\numberline|,
1753 % for example through use of the \Lpack{float} package.\footnote{This bug
1754 % was discovered by Andrew Thurber when using the \Lpack{tocloft} and
1755 % \Lpack{algorithm} packages together.}
1756 % \begin{macrocode}
1757 \newcommand{\@cftbsnum}{}
1758 \newcommand{\@cftasnum}{}
1759 \newcommand{\@cftasnumb}{}
1760 % \end{macrocode}
1761 % \end{macro}
1762 % \end{macro}
1763 % \end{macro}
1764 %
1765 %
1766 %
1767 % \begin{macro}{\l@part}
1768 % \begin{macro}{\if@cftdopart}
1769 % \changes{v1.1}{2000/02/11}{Added \cs{@cftbsnum} and \cs{cftXpresnum} to
1770 % all \cs{\l@X} commands}
1771 % \changes{v1.1}{2000/02/11}{Added \cs{cftXpresnum} commands}
1772 % |\l@part{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
1773 % a |part| heading. It is a parameterised copy of the default |\l@part|
1774 % (see \file{classes.dtx} for the original definition and the code
1775 % below for |\l@subsection| for an explanation of most of this
1776 % code). By default, Parts
1777 % (and Chapters) do not have dotted leaders. This package provides
1778 % for all entries to have dotted leaders.
1779 % \changes{v0.2a}{1999/01/24}{In article class, Part level is 0 not -1}
1780 % \changes{v2.0}{2001/03/03}{Checked directly for \cs{part} definition}
1781 % \changes{v2.3a}{2002/10/03}{Added \cs{cftpartpresnum} to \cs{l@part}}
1782 %
1783 % \begin{macrocode}
1784 \newif\if@cftdopart
1785 \newif\if@cfthaspart
1786 \@cftifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue}
1787 \if@cfthaspart
1788 \renewcommand*{\l@part}[2]{%
1789 \@cftdopartfalse
1790 \ifnum \c@tocdepth >-2\relax
1791 \if@cfthaschapter
1792 \@cftdoparttrue
1793 \fi
1794 \ifnum \c@tocdepth >\m@ne
1795 \if@cfthaschapter\else
1796 \@cftdoparttrue
1797 \fi
1798 \fi
1799 \fi
1800 \if@cftdopart
1801 \if@cfthaschapter
1802 \addpenalty{-\@highpenalty}%
1803 \else
1804 \addpenalty\@secpenalty
1805 \fi
1806 \addvspace{\cftbeforepartskip}%
1807 \begingroup
1808 {\leftskip \cftpartindent\relax
1809 \rightskip \@tocrmarg
1810 \parfillskip -\rightskip
1811 \parindent \cftpartindent\relax\@afterindenttrue
1812 \interlinepenalty\@M
1813 \leavevmode
1814 \@tempdima \cftpartnumwidth\relax
1815 \let\@cftbsnum \cftpartpresnum
1816 \let\@cftasnum \cftpartaftersnum
1817 \let\@cftasnumb \cftpartaftersnumb
1818 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
1819 % \end{macrocode}
1820 % In default \LaTeX, the part ToC entry is written without \verb|\numberline|
1821 % and hence the `presnum' needs to be inserted manually.
1822 % In Koma-Script and titlesec (and probably others---let me know!), however, this is not the case.
1823 % \begin{macrocode}
1824 {\cftpartfont \if@cftkoma\else\if@cfttitlesec\else\cftpartpresnum\fi\fi #1}%
1825 \cftpartfillnum{#2}}
1826 \nobreak
1827 \if@cfthaschapter
1828 \global\@nobreaktrue
1829 \everypar{\global\@nobreakfalse\everypar{}}%
1830 \else
1831 \if@compatibility
1832 \global\@nobreaktrue
1833 \everypar{\global\@nobreakfalse\everypar{}}%
1834 \fi
1835 \fi
1836 \endgroup
1837 \fi}
1838 \fi
1839 % \end{macrocode}
1840 % \end{macro}
1841 % \end{macro}
1842 %
1843 % \begin{macro}{\cftbeforepartskip}
1844 % \begin{macro}{\cftpartnumwidth}
1845 % \begin{macro}{\cftpartfont}
1846 % \begin{macro}{\cftpartpresnum}
1847 % \begin{macro}{\cftpartaftersnum}
1848 % \begin{macro}{\cftpartaftersnumb}
1849 % \begin{macro}{\cftpartleader}
1850 % \begin{macro}{\cftpartdotsep}
1851 % \begin{macro}{\cftpartpagefont}
1852 % \begin{macro}{\cftpartafterpnum}
1853 % \begin{macro}{\cftpartindent}
1854 % \begin{macro}{\cftpartfillnum}
1855 % These are the user commands to control the typesetting of Part entries.
1856 % They are initialised to give the standard appearance.
1857 % \changes{v2.3a}{2002/10/03}{Deleted \cs{cftpartaftersnum} and \cs{cftpartaftersnumb}}
1858 % \changes{v2.3b}{2003/01/20}{Reinstated \cs{cftpartaftersnum} and \cs{cftpartaftersnumb}}
1859 % \begin{macrocode}
1860 \if@cfthaspart
1861 \newlength{\cftbeforepartskip}
1862 \setlength{\cftbeforepartskip}{2.25em \@plus\p@}
1863 \newlength{\cftpartnumwidth}
1864 \setlength{\cftpartnumwidth}{0em}
1865 \newcommand{\cftpartfont}{\large\bfseries}
1866 \newcommand{\cftpartpresnum}{}
1867 \newcommand{\cftpartaftersnum}{}
1868 \newcommand{\cftpartaftersnumb}{}
1869 \newcommand{\cftpartleader}{\large\bfseries\cftdotfill{\cftpartdotsep}}
1870 \newcommand{\cftpartdotsep}{\cftnodots}
1871 \newcommand{\cftpartpagefont}{\large\bfseries}
1872 \newcommand{\cftpartafterpnum}{}
1873 \newlength{\cftpartindent}
1874 \setlength{\cftpartindent}{0em}
1875 \newcommand{\cftpartfillnum}[1]{%
1876 {\cftpartleader}%
1877 {\makebox[\@pnumwidth][\cftpnumalign]{\cftpartpagefont #1}\cftpartafterpnum\par}%
1878 }
1879 % \end{macrocode}
1880 % \Lpack{koma} classes use some different settings.
1881 % \changes{v2.3}{2002/06/15}{koma has different part settings}
1882 % \begin{macrocode}
1883 \if@cftkoma
1884 \setlength{\cftpartnumwidth}{2em}
1885 \renewcommand{\cftpartfont}{\sectfont\large}
1886 \renewcommand{\cftpartpagefont}{\sectfont\large}
1887 \fi
1888 \fi
1889 % \end{macrocode}
1890 % \end{macro}
1891 % \end{macro}
1892 % \end{macro}
1893 % \end{macro}
1894 % \end{macro}
1895 % \end{macro}
1896 % \end{macro}
1897 % \end{macro}
1898 % \end{macro}
1899 % \end{macro}
1900 % \end{macro}
1901 % \end{macro}
1902 %
1903 % \begin{macro}{\l@chapter}
1904 % |\l@chapter{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
1905 % a |chapter| heading. It is a parameterised copy of the default |\l@chapter|
1906 % (see \file{classes.dtx} for the original definition). This only applies
1907 % to chaptered documents.
1908 % \begin{macrocode}
1909 \if@cfthaschapter
1910 \renewcommand*{\l@chapter}[2]{%
1911 \ifnum \c@tocdepth >\m@ne
1912 \addpenalty{-\@highpenalty}%
1913 \vskip \cftbeforechapskip
1914 {\leftskip \cftchapindent\relax
1915 \rightskip \@tocrmarg
1916 \parfillskip -\rightskip
1917 \parindent \cftchapindent\relax\@afterindenttrue
1918 \interlinepenalty\@M
1919 \leavevmode
1920 \@tempdima \cftchapnumwidth\relax
1921 \let\@cftbsnum \cftchappresnum
1922 \let\@cftasnum \cftchapaftersnum
1923 \let\@cftasnumb \cftchapaftersnumb
1924 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
1925 {\cftchapfont #1}\nobreak
1926 \cftchapfillnum{#2}}%
1927 \fi}%
1928 \fi
1929 % \end{macrocode}
1930 % \end{macro}
1931 %
1932 % \begin{macro}{\cftbeforechapskip}
1933 % \begin{macro}{\cftchapindent}
1934 % \begin{macro}{\cftchapnumwidth}
1935 % \begin{macro}{\cftchapfont}
1936 % \begin{macro}{\cftchappresnum}
1937 % \begin{macro}{\cftchapaftersnum}
1938 % \begin{macro}{\cftchapaftersnumb}
1939 % \begin{macro}{\cftchapleader}
1940 % \begin{macro}{\cftchapdotsep}
1941 % \begin{macro}{\cftchappagefont}
1942 % \begin{macro}{\cftchapafterpnum}
1943 % \begin{macro}{\cftchapfillnum}
1944 % These are the user commands to control the typesetting of Chapter entries.
1945 % They are initialised to give the standard appearance.
1946 % \begin{macrocode}
1947 \if@cfthaschapter
1948 \newlength{\cftbeforechapskip}
1949 \setlength{\cftbeforechapskip}{1.0em \@plus\p@}
1950 \newlength{\cftchapindent}
1951 \setlength{\cftchapindent}{0em}
1952 \newlength{\cftchapnumwidth}
1953 \setlength{\cftchapnumwidth}{1.5em}
1954 \newcommand{\cftchapfont}{\bfseries}
1955 \newcommand{\cftchappresnum}{}
1956 \newcommand{\cftchapaftersnum}{}
1957 \newcommand{\cftchapaftersnumb}{}
1958 \newcommand{\cftchapleader}{\bfseries\cftdotfill{\cftchapdotsep}}
1959 \newcommand{\cftchapdotsep}{\cftnodots}
1960 \newcommand{\cftchappagefont}{\bfseries}
1961 \newcommand{\cftchapafterpnum}{}
1962 \newcommand{\cftchapfillnum}[1]{%
1963 {\cftchapleader}\nobreak
1964 \makebox[\@pnumwidth][\cftpnumalign]{\cftchappagefont #1}\cftchapafterpnum\par
1965 }
1966 % \end{macrocode}
1967 % \Lpack{koma} classes have different chapter settings.
1968 % \changes{v2.3}{2002/06/15}{koma has different chapter settings}
1969 % \begin{macrocode}
1970 \if@cftkoma
1971 \renewcommand{\cftchapfont}{\sectfont}
1972 \fi
1973 \fi
1974
1975 % \end{macrocode}
1976 % \end{macro}
1977 % \end{macro}
1978 % \end{macro}
1979 % \end{macro}
1980 % \end{macro}
1981 % \end{macro}
1982 % \end{macro}
1983 % \end{macro}
1984 % \end{macro}
1985 % \end{macro}
1986 % \end{macro}
1987 % \end{macro}
1988 %
1989 % \begin{macro}{\l@section}
1990 % |\l@section{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
1991 % a |section| heading. It is a parameterised copy of the default |\l@section|
1992 % (see \file{classes.dtx} for the original definition).
1993 % \begin{macrocode}
1994 \renewcommand*{\l@section}[2]{%
1995 \ifnum \c@tocdepth >\z@
1996 \if@cfthaschapter
1997 \vskip \cftbeforesecskip
1998 \else
1999 \addpenalty\@secpenalty
2000 \addvspace{\cftbeforesecskip}
2001 \fi
2002 {\leftskip \cftsecindent\relax
2003 \rightskip \@tocrmarg
2004 \parfillskip -\rightskip
2005 \parindent \cftsecindent\relax\@afterindenttrue
2006 \interlinepenalty\@M
2007 \leavevmode
2008 \@tempdima \cftsecnumwidth\relax
2009 \let\@cftbsnum \cftsecpresnum
2010 \let\@cftasnum \cftsecaftersnum
2011 \let\@cftasnumb \cftsecaftersnumb
2012 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
2013 {\cftsecfont #1}\nobreak
2014 \cftsecfillnum{#2}}%
2015 \fi}
2016 % \end{macrocode}
2017 % \end{macro}
2018 %
2019 % \begin{macro}{\cftbeforesecskip}
2020 % \begin{macro}{\cftsecindent}
2021 % \begin{macro}{\cftsecnumwidth}
2022 % \begin{macro}{\cftsecfont}
2023 % \begin{macro}{\cftsecpresnum}
2024 % \begin{macro}{\cftsecaftersnum}
2025 % \begin{macro}{\cftsecaftersnumb}
2026 % \begin{macro}{\cftsecleader}
2027 % \begin{macro}{\cftsecdotsep}
2028 % \begin{macro}{\cftsecpagefont}
2029 % \begin{macro}{\cftsecafterpnum}
2030 % \begin{macro}{\cftsecfillnum}
2031 % These are the user commands to control the typesetting of Section entries.
2032 % They are initialised to give the standard appearance.
2033 % \begin{macrocode}
2034 \newlength{\cftbeforesecskip}
2035 \newlength{\cftsecindent}
2036 \newlength{\cftsecnumwidth}
2037 \newcommand{\cftsecpresnum}{}
2038 \newcommand{\cftsecaftersnum}{}
2039 \newcommand{\cftsecaftersnumb}{}
2040 \if@cfthaschapter
2041 \setlength{\cftbeforesecskip}{\z@ \@plus.2\p@}
2042 \setlength{\cftsecindent}{1.5em}
2043 \setlength{\cftsecnumwidth}{2.3em}
2044 \newcommand{\cftsecfont}{\normalfont}
2045 \newcommand{\cftsecleader}{\normalfont\cftdotfill{\cftsecdotsep}}
2046 \newcommand{\cftsecdotsep}{\cftdotsep}
2047 \newcommand{\cftsecpagefont}{\normalfont}
2048 \else
2049 \setlength{\cftbeforesecskip}{1.0em \@plus\p@}
2050 \setlength{\cftsecindent}{0em}
2051 \setlength{\cftsecnumwidth}{1.5em}
2052 \newcommand{\cftsecfont}{\bfseries}
2053 \newcommand{\cftsecleader}{\bfseries\cftdotfill{\cftsecdotsep}}
2054 \newcommand{\cftsecdotsep}{\cftnodots}
2055 \newcommand{\cftsecpagefont}{\bfseries}
2056 \fi
2057 \newcommand{\cftsecafterpnum}{}
2058 \newcommand{\cftsecfillnum}[1]{%
2059 {\cftsecleader}\nobreak
2060 \makebox[\@pnumwidth][\cftpnumalign]{\cftsecpagefont #1}\cftsecafterpnum\par
2061 }
2062 % \end{macrocode}
2063 % \end{macro}
2064 % \end{macro}
2065 % \end{macro}
2066 % \end{macro}
2067 % \end{macro}
2068 % \end{macro}
2069 % \end{macro}
2070 % \end{macro}
2071 % \end{macro}
2072 % \end{macro}
2073 % \end{macro}
2074 % \end{macro}
2075 %
2076 % \begin{macro}{\l@subsection}
2077 % |\l@subsection{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
2078 % a |subsection| heading. It is a parameterised copy of the default
2079 % |\l@subsection|
2080 % (see \file{classes.dtx} for the original definition).
2081 % \begin{macrocode}
2082 \renewcommand*{\l@subsection}[2]{%
2083 % \end{macrocode}
2084 % Only typeset the entry if it falls within the |tocdepth|.
2085 % \begin{macrocode}
2086 \ifnum \c@tocdepth >\@ne
2087 % \end{macrocode}
2088 % Add some vertical space.
2089 % \begin{macrocode}
2090 \vskip \cftbeforesubsecskip
2091 % \end{macrocode}
2092 % Start a group to keep paragraphing changes local. Set the |\leftskip|
2093 % to the entry's indentation.
2094 % \begin{macrocode}
2095 {\leftskip \cftsubsecindent\relax
2096 % \end{macrocode}
2097 % Set the |\rightskip| to |\@tocrmarg| to leave room for the page number.
2098 % \begin{macrocode}
2099 \rightskip \@tocrmarg
2100 % \end{macrocode}
2101 % Ensure that the last line of the entry will be filled. Setting
2102 % |\parfillskip| to a negative number prevents any overfull box messages.
2103 % \begin{macrocode}
2104 \parfillskip -\rightskip
2105 % \end{macrocode}
2106 % Set the paragraph indent to the entry's indentation.
2107 % \begin{macrocode}
2108 \parindent \cftsubsecindent\relax\@afterindenttrue
2109 % \end{macrocode}
2110 % Try and prevent breaks between lines in a multiple line entry.
2111 % \begin{macrocode}
2112 \interlinepenalty\@M
2113 % \end{macrocode}
2114 % Make sure that we have left vertical mode.
2115 % \begin{macrocode}
2116 \leavevmode
2117 % \end{macrocode}
2118 % Our version of |\numberline| expects that the width of the number box
2119 % is in |\@tempdima|, and that the three macros |\@cftbsnum|,
2120 % |\@cftasnum| and |\@cftasnumb|
2121 % are defined. We set all these to the values for this entry.
2122 % \begin{macrocode}
2123 \@tempdima \cftsubsecnumwidth\relax
2124 \let\@cftbsnum \cftsubsecpresnum
2125 \let\@cftasnum \cftsubsecaftersnum
2126 \let\@cftasnumb \cftsubsecaftersnumb
2127 % \end{macrocode}
2128 % Arrange that the (section number and) first line of the title is set
2129 % at the current indent, and any further lines are further indented.
2130 % \begin{macrocode}
2131 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
2132 % \end{macrocode}
2133 % Print the (number and) title, prohibiting any breaking.
2134 % \begin{macrocode}
2135 {\cftsubsecfont #1}\nobreak
2136 % \end{macrocode}
2137 % Print the leader and the page number, and close the group.
2138 % \begin{macrocode}
2139 \cftsubsecfillnum{#2}}%
2140 \fi}
2141 % \end{macrocode}
2142 % \end{macro}
2143 %
2144 % \begin{macro}{\cftbeforesubsecskip}
2145 % \begin{macro}{\cftsubsecindent}
2146 % \begin{macro}{\cftsubsecnumwidth}
2147 % \begin{macro}{\cftsubsecfont}
2148 % \begin{macro}{\cftsubsecpresnum}
2149 % \begin{macro}{\cftsubsecaftersnum}
2150 % \begin{macro}{\cftsubsecaftersnumb}
2151 % \begin{macro}{\cftsubsecleader}
2152 % \begin{macro}{\cftsubsecdotsep}
2153 % \begin{macro}{\cftsubsecpagefont}
2154 % \begin{macro}{\cftsubsecafterpnum}
2155 % These are the user commands to control the typesetting of Sub-section entries.
2156 % They are initialised to give the standard appearance.
2157 % \begin{macrocode}
2158 \newlength{\cftbeforesubsecskip}
2159 \setlength{\cftbeforesubsecskip}{\z@ \@plus.2\p@}
2160 \newlength{\cftsubsecindent}
2161 \newlength{\cftsubsecnumwidth}
2162 \if@cfthaschapter
2163 \setlength{\cftsubsecindent}{3.8em}
2164 \setlength{\cftsubsecnumwidth}{3.2em}
2165 \else
2166 \setlength{\cftsubsecindent}{1.5em}
2167 \setlength{\cftsubsecnumwidth}{2.3em}
2168 \fi
2169 \newcommand{\cftsubsecfont}{\normalfont}
2170 \newcommand{\cftsubsecpresnum}{}
2171 \newcommand{\cftsubsecaftersnum}{}
2172 \newcommand{\cftsubsecaftersnumb}{}
2173 \newcommand{\cftsubsecleader}{\normalfont\cftdotfill{\cftsubsecdotsep}}
2174 \newcommand{\cftsubsecdotsep}{\cftdotsep}
2175 \newcommand{\cftsubsecpagefont}{\normalfont}
2176 \newcommand{\cftsubsecafterpnum}{}
2177 % \end{macrocode}
2178 % \end{macro}
2179 % \end{macro}
2180 % \end{macro}
2181 % \end{macro}
2182 % \end{macro}
2183 % \end{macro}
2184 % \end{macro}
2185 % \end{macro}
2186 % \end{macro}
2187 % \end{macro}
2188 % \end{macro}
2189 %
2190 % \begin{macro}{\cftsubsecfillnum}
2191 % |\cftsubsecfillnum{|\meta{page}|}| typesets the leader and the \meta{page}
2192 % number of a |subsection| entry.
2193 % First print the leader and then, with no break, set the page number
2194 % flushright in a box of width |\@pnumwidth|,
2195 % not forgetting to finish the paragraph.
2196 % \begin{macrocode}
2197 \newcommand{\cftsubsecfillnum}[1]{%
2198 {\cftsubsecleader}\nobreak
2199 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubsecpagefont #1}\cftsubsecafterpnum\par
2200 }
2201 % \end{macrocode}
2202 % \end{macro}
2203 %
2204 % \begin{macro}{\l@subsubsection}
2205 % |\l@subsubsection{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
2206 % a |subsubsection| heading. It is a parameterised copy of the default
2207 % |\l@subsubsection|
2208 % (see \file{classes.dtx} for the original definition).
2209 % \begin{macrocode}
2210 \renewcommand*{\l@subsubsection}[2]{%
2211 \ifnum \c@tocdepth >\tw@
2212 \vskip \cftbeforesubsubsecskip
2213 {\leftskip \cftsubsubsecindent\relax
2214 \rightskip \@tocrmarg
2215 \parfillskip -\rightskip
2216 \parindent \cftsubsubsecindent\relax\@afterindenttrue
2217 \interlinepenalty\@M
2218 \leavevmode
2219 \@tempdima \cftsubsubsecnumwidth\relax
2220 \let\@cftbsnum \cftsubsubsecpresnum
2221 \let\@cftasnum \cftsubsubsecaftersnum
2222 \let\@cftasnumb \cftsubsubsecaftersnumb
2223 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
2224 {\cftsubsubsecfont #1}\nobreak
2225 \cftsubsubsecfillnum{#2}}%
2226 \fi}
2227 % \end{macrocode}
2228 % \end{macro}
2229 %
2230 % \begin{macro}{\cftbeforesubsubsecskip}
2231 % \begin{macro}{\cftsubsubsecindent}
2232 % \begin{macro}{\cftsubsubsecnumwidth}
2233 % \begin{macro}{\cftsubsubsecfont}
2234 % \begin{macro}{\cftsubsubsecpresnum}
2235 % \begin{macro}{\cftsubsubsecaftersnum}
2236 % \begin{macro}{\cftsubsubsecaftersnumb}
2237 % \begin{macro}{\cftsubsubsecleader}
2238 % \begin{macro}{\cftsubsubsecdotsep}
2239 % \begin{macro}{\cftsubsubsecpagefont}
2240 % \begin{macro}{\cftsubsubsecafterpnum}
2241 % \begin{macro}{\cftsubsubsecfillnum}
2242 % These are the user commands to control the typesetting of Sub-sub-section entries.
2243 % They are initialised to give the standard appearance.
2244 % \begin{macrocode}
2245 \newlength{\cftbeforesubsubsecskip}
2246 \setlength{\cftbeforesubsubsecskip}{\z@ \@plus.2\p@}
2247 \newlength{\cftsubsubsecindent}
2248 \newlength{\cftsubsubsecnumwidth}
2249 \if@cfthaschapter
2250 \setlength{\cftsubsubsecindent}{7.0em}
2251 \setlength{\cftsubsubsecnumwidth}{4.1em}
2252 \else
2253 \setlength{\cftsubsubsecindent}{3.8em}
2254 \setlength{\cftsubsubsecnumwidth}{3.2em}
2255 \fi
2256 \newcommand{\cftsubsubsecfont}{\normalfont}
2257 \newcommand{\cftsubsubsecpresnum}{}
2258 \newcommand{\cftsubsubsecaftersnum}{}
2259 \newcommand{\cftsubsubsecaftersnumb}{}
2260 \newcommand{\cftsubsubsecleader}{\normalfont\cftdotfill{\cftsubsubsecdotsep}}
2261 \newcommand{\cftsubsubsecdotsep}{\cftdotsep}
2262 \newcommand{\cftsubsubsecpagefont}{\normalfont}
2263 \newcommand{\cftsubsubsecafterpnum}{}
2264 \newcommand{\cftsubsubsecfillnum}[1]{%
2265 {\cftsubsubsecleader}\nobreak
2266 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubsubsecpagefont #1}\cftsubsubsecafterpnum\par
2267 }
2268 % \end{macrocode}
2269 % \end{macro}
2270 % \end{macro}
2271 % \end{macro}
2272 % \end{macro}
2273 % \end{macro}
2274 % \end{macro}
2275 % \end{macro}
2276 % \end{macro}
2277 % \end{macro}
2278 % \end{macro}
2279 % \end{macro}
2280 % \end{macro}
2281 %
2282 % \begin{macro}{\l@paragraph}
2283 % |\l@paragraph{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
2284 % a |paragraph| heading. It is a parameterised copy of the default
2285 % |\l@paragraph|
2286 % (see \file{classes.dtx} for the original definition).
2287 % \begin{macrocode}
2288 \renewcommand*{\l@paragraph}[2]{%
2289 \ifnum \c@tocdepth >3\relax
2290 \vskip \cftbeforeparaskip
2291 {\leftskip \cftparaindent\relax
2292 \rightskip \@tocrmarg
2293 \parfillskip -\rightskip
2294 \parindent \cftparaindent\relax\@afterindenttrue
2295 \interlinepenalty\@M
2296 \leavevmode
2297 \@tempdima \cftparanumwidth\relax
2298 \let\@cftbsnum \cftparapresnum
2299 \let\@cftasnum \cftparaaftersnum
2300 \let\@cftasnumb \cftparaaftersnumb
2301 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
2302 {\cftparafont #1}\nobreak
2303 \cftparafillnum{#2}}%
2304 \fi}
2305 % \end{macrocode}
2306 % \end{macro}
2307 %
2308 % \begin{macro}{\cftbeforeparaskip}
2309 % \begin{macro}{\cftparaindent}
2310 % \begin{macro}{\cftparanumwidth}
2311 % \begin{macro}{\cftparafont}
2312 % \begin{macro}{\cftparapresnum}
2313 % \begin{macro}{\cftparaaftersnum}
2314 % \begin{macro}{\cftparaaftersnumb}
2315 % \begin{macro}{\cftparaleader}
2316 % \begin{macro}{\cftparadotsep}
2317 % \begin{macro}{\cftparapagefont}
2318 % \begin{macro}{\cftparaafterpnum}
2319 % \begin{macro}{\cftparafillnum}
2320 % These are the user commands to control the typesetting of Paragraph entries.
2321 % They are initialised to give the standard appearance.
2322 % \begin{macrocode}
2323 \newlength{\cftbeforeparaskip}
2324 \setlength{\cftbeforeparaskip}{\z@ \@plus.2\p@}
2325 \newlength{\cftparaindent}
2326 \newlength{\cftparanumwidth}
2327 \if@cfthaschapter
2328 \setlength{\cftparaindent}{10em}
2329 \setlength{\cftparanumwidth}{5em}
2330 \else
2331 \setlength{\cftparaindent}{7.0em}
2332 \setlength{\cftparanumwidth}{4.1em}
2333 \fi
2334 \newcommand{\cftparafont}{\normalfont}
2335 \newcommand{\cftparapresnum}{}
2336 \newcommand{\cftparaaftersnum}{}
2337 \newcommand{\cftparaaftersnumb}{}
2338 \newcommand{\cftparaleader}{\normalfont\cftdotfill{\cftparadotsep}}
2339 \newcommand{\cftparadotsep}{\cftdotsep}
2340 \newcommand{\cftparapagefont}{\normalfont}
2341 \newcommand{\cftparaafterpnum}{}
2342 \newcommand{\cftparafillnum}[1]{%
2343 {\cftparaleader}\nobreak
2344 \makebox[\@pnumwidth][\cftpnumalign]{\cftparapagefont #1}\cftparaafterpnum\par
2345 }
2346 % \end{macrocode}
2347 % \end{macro}
2348 % \end{macro}
2349 % \end{macro}
2350 % \end{macro}
2351 % \end{macro}
2352 % \end{macro}
2353 % \end{macro}
2354 % \end{macro}
2355 % \end{macro}
2356 % \end{macro}
2357 % \end{macro}
2358 % \end{macro}
2359 %
2360 % \begin{macro}{\l@subparagraph}
2361 % |\l@subparagraph{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
2362 % a |subparagraph| heading. It is a parameterised copy of the default
2363 % |\l@subparagraph|
2364 % (see \file{classes.dtx} for the original definition).
2365 % \begin{macrocode}
2366 \renewcommand*{\l@subparagraph}[2]{%
2367 \ifnum \c@tocdepth >4\relax
2368 \vskip \cftbeforesubparaskip
2369 {\leftskip \cftsubparaindent\relax
2370 \rightskip \@tocrmarg
2371 \parfillskip -\rightskip
2372 \parindent \cftsubparaindent\relax\@afterindenttrue
2373 \interlinepenalty\@M
2374 \leavevmode
2375 \@tempdima \cftsubparanumwidth\relax
2376 \let\@cftbsnum \cftsubparapresnum
2377 \let\@cftasnum \cftsubparaaftersnum
2378 \let\@cftasnumb \cftsubparaaftersnumb
2379 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
2380 {\cftsubparafont #1}\nobreak
2381 \cftsubparafillnum{#2}}%
2382 \fi}
2383 % \end{macrocode}
2384 % \end{macro}
2385 %
2386 % \begin{macro}{\cftbeforesubparaskip}
2387 % \begin{macro}{\cftsubparaindent}
2388 % \begin{macro}{\cftsubparanumwidth}
2389 % \begin{macro}{\cftsubparafont}
2390 % \begin{macro}{\cftsubparapresnum}
2391 % \begin{macro}{\cftsubparaaftersnum}
2392 % \begin{macro}{\cftsubparaaftersnumb}
2393 % \begin{macro}{\cftsubparaleader}
2394 % \begin{macro}{\cftsubparadotsep}
2395 % \begin{macro}{\cftsubparapagefont}
2396 % \begin{macro}{\cftsubparaafterpnum}
2397 % \begin{macro}{\cftsubparafillnum}
2398 % These are the user commands to control the typesetting of Sub-paragraph entries.
2399 % They are initialised to give the standard appearance.
2400 % \begin{macrocode}
2401 \newlength{\cftbeforesubparaskip}
2402 \setlength{\cftbeforesubparaskip}{\z@ \@plus.2\p@}
2403 \newlength{\cftsubparaindent}
2404 \newlength{\cftsubparanumwidth}
2405 \if@cfthaschapter
2406 \setlength{\cftsubparaindent}{12em}
2407 \setlength{\cftsubparanumwidth}{6em}
2408 \else
2409 \setlength{\cftsubparaindent}{10em}
2410 \setlength{\cftsubparanumwidth}{5em}
2411 \fi
2412 \newcommand{\cftsubparafont}{\normalfont}
2413 \newcommand{\cftsubparapresnum}{}
2414 \newcommand{\cftsubparaaftersnum}{}
2415 \newcommand{\cftsubparaaftersnumb}{}
2416 \newcommand{\cftsubparaleader}{\normalfont\cftdotfill{\cftsubparadotsep}}
2417 \newcommand{\cftsubparadotsep}{\cftdotsep}
2418 \newcommand{\cftsubparapagefont}{\normalfont}
2419 \newcommand{\cftsubparaafterpnum}{}
2420 \newcommand{\cftsubparafillnum}[1]{%
2421 {\cftsubparaleader}\nobreak
2422 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubparapagefont #1}\cftsubparaafterpnum\par
2423 }
2424 % \end{macrocode}
2425 % \end{macro}
2426 % \end{macro}
2427 % \end{macro}
2428 % \end{macro}
2429 % \end{macro}
2430 % \end{macro}
2431 % \end{macro}
2432 % \end{macro}
2433 % \end{macro}
2434 % \end{macro}
2435 % \end{macro}
2436 % \end{macro}
2437 %
2438 %
2439 % \begin{macro}{\@cftdobiblof}
2440 % If the \Lpack{tocbibind} package has been used and it has
2441 % redefined |\listoffigures| we need to cater for that. The contents
2442 % of the definition are defined in \Lpack{tocbibind}.
2443 % \begin{macrocode}
2444 \newcommand{\@cftdobiblof}{%
2445 \if@dotoclof
2446 \if@bibchapter
2447 \phantomsection
2448 \addcontentsline{toc}{chapter}{\listfigurename}
2449 \else
2450 \phantomsection
2451 \addcontentsline{toc}{\@tocextra}{\listfigurename}
2452 \fi
2453 \fi}
2454
2455 % \end{macrocode}
2456 % \end{macro}
2457 %
2458 %
2459 % \begin{macro}{\listoffigures}
2460 % This is a parameterised version of the default |\listoffigures| command.
2461 % The changes are postponed until after all packages have been loaded.
2462 % Each class has its own definition, but we have to cater for all classes
2463 % in one definition, hence some of the checks. First, perform the default
2464 % checks for multicolumns. (Do nothing if \Lopt{titles} option is used).
2465 % \begin{macrocode}
2466 \AtBeginDocument{%
2467 \if@cftnctoc\else
2468 \renewcommand{\listoffigures}{%
2469 \@cfttocstart
2470 % \end{macrocode}
2471 % Ensure that any previous paragraph has been finished. Within a group set
2472 % the local paragraphing style. Typeset the title and then do the contents
2473 % of the \file{.lof} file.
2474 % \begin{macrocode}
2475 \par
2476 \begingroup
2477 \parindent\z@ \parskip\cftparskip
2478 \@cftmakeloftitle
2479 \if@cfttocbibind
2480 \@cftdobiblof
2481 \fi
2482 \@starttoc{lof}%
2483 \endgroup
2484 % \end{macrocode}
2485 % Finally, restore any multicolumn typesetting.
2486 % \begin{macrocode}
2487 \@cfttocfinish}%
2488 \fi
2489 }
2490
2491 % \end{macrocode}
2492 % \end{macro}
2493 %
2494 % \begin{macro}{\@cftmakeloftitle}
2495 % This command typesets the title for the LoF.
2496 % \changes{v2.3}{2002/06/15}{Added \cs{@secpenalty} to \cs{cftmakeloftitle}}
2497 % \changes{v2.3}{2002/06/15}{Added \cs{@cftpagestyle} to \cs{cftmakeloftitle}}
2498 % \begin{macrocode}
2499 \newcommand{\@cftmakeloftitle}{%
2500 \addpenalty\@secpenalty
2501 \if@cfthaschapter
2502 \vspace*{\cftbeforeloftitleskip}
2503 \else
2504 \vspace{\cftbeforeloftitleskip}
2505 \fi
2506 \@cftpagestyle
2507 {\interlinepenalty\@M
2508 {\cftloftitlefont\listfigurename}{\cftafterloftitle}
2509 \cftmarklof
2510 \par\nobreak
2511 \vskip \cftafterloftitleskip
2512 \@afterheading}}
2513
2514 % \end{macrocode}
2515 % \end{macro}
2516 %
2517 % \begin{macro}{\cftbeforeloftitleskip}
2518 % \begin{macro}{\cftafterloftitleskip}
2519 % These two lengths control the vertical spacing before and after the
2520 % LoF title.
2521 % \begin{macrocode}
2522 \newlength{\cftbeforeloftitleskip}
2523 \newlength{\cftafterloftitleskip}
2524 % \end{macrocode}
2525 % Their values depend on whether the document has chapters or not. In
2526 % chaptered documents the default LoF title is typeset as a |\chapter*|,
2527 % otherwise as a |\section*|.
2528 % \begin{macrocode}
2529 \if@cfthaschapter
2530 \setlength{\cftbeforeloftitleskip}{50pt}
2531 \setlength{\cftafterloftitleskip}{40pt}
2532 \else
2533 \setlength{\cftbeforeloftitleskip}{3.5ex \@plus 1ex \@minus .2ex}
2534 \setlength{\cftafterloftitleskip}{2.3ex \@plus.2ex}
2535 \fi
2536 % \end{macrocode}
2537 % \end{macro}
2538 % \end{macro}
2539 %
2540 % \begin{macro}{\cftloftitlefont}
2541 % \begin{macro}{\cftafterloftitle}
2542 % The LoF title is typeset in the style given by |\cftloftitlefont|.
2543 % The macro |\cftafterloftitle| is called after typesetting the title.
2544 % This is initialised to do nothing.
2545 % Both these macros can be redefined to do other things (e.g., adding
2546 % an |\hfill| to |\cftloftitlefont| will make the title flushright).
2547 % \changes{v2.3}{2002/06/15}{koma has different settings for LoF titles}
2548 % \begin{macrocode}
2549 \if@cfthaschapter
2550 \newcommand{\cftloftitlefont}{\normalfont\Huge\bfseries}
2551 \if@cftkoma\renewcommand{\cftloftitlefont}{\size@chapter\sectfont}\fi
2552 \else
2553 \newcommand{\cftloftitlefont}{\normalfont\Large\bfseries}
2554 \if@cftkoma\renewcommand{\cftloftitlefont}{\size@section\sectfont}\fi
2555 \fi
2556 \newcommand{\cftafterloftitle}{}
2557
2558 % \end{macrocode}
2559 % \end{macro}
2560 % \end{macro}
2561 %
2562 % \begin{macro}{\l@figure}
2563 % |\l@figure{|\meta{title}|}{|\meta{page}|}| typesets the LoF entry for
2564 % a |figure| caption heading. It is a parameterised copy of the default
2565 % |\l@figure|
2566 % (see \file{classes.dtx} for the original definition).
2567 % \begin{macrocode}
2568 \renewcommand*{\l@figure}[2]{%
2569 \ifnum \c@lofdepth >\z@
2570 \vskip \cftbeforefigskip
2571 {\leftskip \cftfigindent\relax
2572 \rightskip \@tocrmarg
2573 \parfillskip -\rightskip
2574 \parindent \cftfigindent\relax\@afterindenttrue
2575 \interlinepenalty\@M
2576 \leavevmode
2577 \@tempdima \cftfignumwidth\relax
2578 \let\@cftbsnum \cftfigpresnum
2579 \let\@cftasnum \cftfigaftersnum
2580 \let\@cftasnumb \cftfigaftersnumb
2581 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
2582 {\cftfigfont #1}\nobreak
2583 \cftfigfillnum{#2}}%
2584 \fi
2585 }
2586 % \end{macrocode}
2587 % \end{macro}
2588 %
2589 % \begin{macro}{\cftbeforefigskip}
2590 % \begin{macro}{\cftfigindent}
2591 % \begin{macro}{\cftfignumwidth}
2592 % \begin{macro}{\cftfigfont}
2593 % \begin{macro}{\cftfigpresnum}
2594 % \begin{macro}{\cftfigaftersnum}
2595 % \begin{macro}{\cftfigaftersnumb}
2596 % \begin{macro}{\cftfigleader}
2597 % \begin{macro}{\cftfigdotsep}
2598 % \begin{macro}{\cftfigpagefont}
2599 % \begin{macro}{\cftfigafterpnum}
2600 % \begin{macro}{\cftfigfillnum}
2601 % These are the user commands to control the typesetting of Figure caption entries.
2602 % They are initialised to give the standard appearance.
2603 % \begin{macrocode}
2604 \newlength{\cftbeforefigskip}
2605 \setlength{\cftbeforefigskip}{\z@ \@plus.2\p@}
2606 \newlength{\cftfigindent}
2607 \setlength{\cftfigindent}{1.5em}
2608 \newlength{\cftfignumwidth}
2609 \setlength{\cftfignumwidth}{2.3em}
2610 \newcommand{\cftfigfont}{\normalfont}
2611 \newcommand{\cftfigpresnum}{}
2612 \newcommand{\cftfigaftersnum}{}
2613 \newcommand{\cftfigaftersnumb}{}
2614 \newcommand{\cftfigleader}{\normalfont\cftdotfill{\cftfigdotsep}}
2615 \newcommand{\cftfigdotsep}{\cftdotsep}
2616 \newcommand{\cftfigpagefont}{\normalfont}
2617 \newcommand{\cftfigafterpnum}{}
2618 \newcommand{\cftfigfillnum}[1]{%
2619 {\cftfigleader}\nobreak
2620 \makebox[\@pnumwidth][\cftpnumalign]{\cftfigpagefont #1}\cftfigafterpnum\par
2621 }
2622 % \end{macrocode}
2623 % \end{macro}
2624 % \end{macro}
2625 % \end{macro}
2626 % \end{macro}
2627 % \end{macro}
2628 % \end{macro}
2629 % \end{macro}
2630 % \end{macro}
2631 % \end{macro}
2632 % \end{macro}
2633 % \end{macro}
2634 % \end{macro}
2635 %
2636 % \begin{macro}{lofdepth}
2637 % \begin{macro}{lotdepth}
2638 % The counters |lofdepth| and |lotdepth| are defined by the
2639 % \Lpack{subfigure} package.
2640 % Define them here if that package is not used.
2641 % \begin{macrocode}
2642 \if@cftsubfigopt\else
2643 \newcounter{lofdepth}\setcounter{lofdepth}{1}
2644 \newcounter{lotdepth}\setcounter{lotdepth}{1}
2645 \fi
2646
2647 % \end{macrocode}
2648 % \end{macro}
2649 % \end{macro}
2650 %
2651 % \begin{macro}{\@cftdobiblot}
2652 % If the \Lpack{tocbibind} package has been used and it has
2653 % redefined |\listoftables| we need to cater for that. The contents
2654 % of the definition are defined in \Lpack{tocbibind}.
2655 % \begin{macrocode}
2656 \newcommand{\@cftdobiblot}{%
2657 \if@dotoclot
2658 \if@bibchapter
2659 \phantomsection
2660 \addcontentsline{toc}{chapter}{\listtablename}
2661 \else
2662 \phantomsection
2663 \addcontentsline{toc}{\@tocextra}{\listtablename}
2664 \fi
2665 \fi}
2666
2667 % \end{macrocode}
2668 % \end{macro}
2669 %
2670 %
2671 % \begin{macro}{\listoftables}
2672 % This is a parameterised version of the default |\listoftables| command.
2673 % The changes are postponed until after all packages have been loaded.
2674 % Each class has its own definition, but we have to cater for all classes
2675 % in one definition, hence some of the checks. First, perform the default
2676 % checks for multicolumns. (Do nothing if the \Lopt{titles} option has
2677 % been used).
2678 % \begin{macrocode}
2679 \AtBeginDocument{%
2680 \if@cftnctoc\else
2681 \renewcommand{\listoftables}{%
2682 \@cfttocstart
2683 % \end{macrocode}
2684 % Ensure that any previous paragraph has been finished. Within a group set
2685 % the local paragraphing style. Typeset the title and then do the contents
2686 % of the \file{.lot} file.
2687 % \begin{macrocode}
2688 \par
2689 \begingroup
2690 \parindent\z@ \parskip\cftparskip
2691 \@cftmakelottitle
2692 \if@cfttocbibind
2693 \@cftdobiblot
2694 \fi
2695 \@starttoc{lot}%
2696 \endgroup
2697 % \end{macrocode}
2698 % Finally, restore any multicolumn typesetting.
2699 % \begin{macrocode}
2700 \@cfttocfinish}%
2701 \fi
2702 }
2703
2704 % \end{macrocode}
2705 % \end{macro}
2706 %
2707 % \begin{macro}{\@cftmakelottitle}
2708 % This command typesets the title for the LoT.
2709 % \changes{v2.3}{2002/06/15}{Added \cs{@secpenalty} to \cs{@cftmakelottitle}}
2710 % \changes{v2.3}{2002/06/15}{Added \cs{@cftpagestyle} to \cs{@cftmakelottitle}}
2711 % \begin{macrocode}
2712 \newcommand{\@cftmakelottitle}{%
2713 \addpenalty\@secpenalty
2714 \if@cfthaschapter
2715 \vspace*{\cftbeforelottitleskip}
2716 \else
2717 \vspace{\cftbeforelottitleskip}
2718 \fi
2719 \@cftpagestyle
2720 {\interlinepenalty\@M
2721 {\cftlottitlefont\listtablename}{\cftafterlottitle}
2722 \cftmarklot
2723 \par\nobreak
2724 \vskip \cftafterlottitleskip
2725 \@afterheading}}
2726
2727 % \end{macrocode}
2728 % \end{macro}
2729 %
2730 % \begin{macro}{\cftbeforelottitleskip}
2731 % \begin{macro}{\cftafterlottitleskip}
2732 % These two lengths control the vertical spacing before and after the
2733 % LoT title.
2734 % \begin{macrocode}
2735 \newlength{\cftbeforelottitleskip}
2736 \newlength{\cftafterlottitleskip}
2737 % \end{macrocode}
2738 % Their values depend on whether the document has chapters or not. In
2739 % chaptered documents the default LoT title is typeset as a |\chapter*|,
2740 % otherwise as a |\section*|.
2741 % \begin{macrocode}
2742 \if@cfthaschapter
2743 \setlength{\cftbeforelottitleskip}{50pt}
2744 \setlength{\cftafterlottitleskip}{40pt}
2745 \else
2746 \setlength{\cftbeforelottitleskip}{3.5ex \@plus 1ex \@minus .2ex}
2747 \setlength{\cftafterlottitleskip}{2.3ex \@plus.2ex}
2748 \fi
2749 % \end{macrocode}
2750 % \end{macro}
2751 % \end{macro}
2752 %
2753 % \begin{macro}{\cftlottitlefont}
2754 % \begin{macro}{\cftafterlottitle}
2755 % The LoT title is typeset in the style given by |\cftlottitlefont|.
2756 % The macro |\cftafterlottitle| is called after typesetting the title.
2757 % This is initialised to do nothing.
2758 % Both these macros can be redefined to do other things (e.g., adding
2759 % an |\hfill| to |\cftlottitlefont| will make the title flushright).
2760 % \changes{v2.3}{2002/06/15}{koma has different settings for LoT titles}
2761 % \begin{macrocode}
2762 \if@cfthaschapter
2763 \newcommand{\cftlottitlefont}{\normalfont\Huge\bfseries}
2764 \if@cftkoma\renewcommand{\cftlottitlefont}{\size@chapter\sectfont}\fi
2765 \else
2766 \newcommand{\cftlottitlefont}{\normalfont\Large\bfseries}
2767 \if@cftkoma\renewcommand{\cftlottitlefont}{\size@section\sectfont}\fi
2768 \fi
2769 \newcommand{\cftafterlottitle}{}
2770
2771 % \end{macrocode}
2772 % \end{macro}
2773 % \end{macro}
2774 %
2775 % \begin{macro}{\l@table}
2776 % |\l@table{|\meta{title}|}{|\meta{page}|}| typesets the LoT entry for
2777 % a |table| caption heading. It is a parameterised copy of the default
2778 % |\l@table|
2779 % (see \file{classes.dtx} for the original definition).
2780 % \begin{macrocode}
2781 \renewcommand*{\l@table}[2]{%
2782 \ifnum\c@lotdepth >\z@
2783 \vskip \cftbeforetabskip
2784 {\leftskip \cfttabindent\relax
2785 \rightskip \@tocrmarg
2786 \parfillskip -\rightskip
2787 \parindent \cfttabindent\relax\@afterindenttrue
2788 \interlinepenalty\@M
2789 \leavevmode
2790 \@tempdima \cfttabnumwidth\relax
2791 \let\@cftbsnum \cfttabpresnum
2792 \let\@cftasnum \cfttabaftersnum
2793 \let\@cftasnumb \cfttabaftersnumb
2794 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
2795 {\cfttabfont #1}\nobreak
2796 \cfttabfillnum{#2}}%
2797 \fi
2798 }
2799 % \end{macrocode}
2800 % \end{macro}
2801 %
2802 % \begin{macro}{\cftbeforetabskip}
2803 % \begin{macro}{\cfttabindent}
2804 % \begin{macro}{\cfttabnumwidth}
2805 % \begin{macro}{\cfttabfont}
2806 % \begin{macro}{\cfttabpresnum}
2807 % \begin{macro}{\cfttabaftersnum}
2808 % \begin{macro}{\cfttabaftersnumb}
2809 % \begin{macro}{\cfttableader}
2810 % \begin{macro}{\cfttabdotsep}
2811 % \begin{macro}{\cfttabpagefont}
2812 % \begin{macro}{\cfttabafterpnum}
2813 % \begin{macro}{\cfttabfillnum}
2814 % These are the user commands to control the typesetting of Table caption entries.
2815 % They are initialised to give the standard appearance.
2816 % \begin{macrocode}
2817 \newlength{\cftbeforetabskip}
2818 \setlength{\cftbeforetabskip}{\z@ \@plus.2\p@}
2819 \newlength{\cfttabindent}
2820 \setlength{\cfttabindent}{1.5em}
2821 \newlength{\cfttabnumwidth}
2822 \setlength{\cfttabnumwidth}{2.3em}
2823 \newcommand{\cfttabfont}{\normalfont}
2824 \newcommand{\cfttabpresnum}{}
2825 \newcommand{\cfttabaftersnum}{}
2826 \newcommand{\cfttabaftersnumb}{}
2827 \newcommand{\cfttableader}{\normalfont\cftdotfill{\cfttabdotsep}}
2828 \newcommand{\cfttabdotsep}{\cftdotsep}
2829 \newcommand{\cfttabpagefont}{\normalfont}
2830 \newcommand{\cfttabafterpnum}{}
2831 \newcommand{\cfttabfillnum}[1]{%
2832 {\cfttableader}\nobreak
2833 \makebox[\@pnumwidth][\cftpnumalign]{\cfttabpagefont #1}\cfttabafterpnum\par
2834 }
2835 % \end{macrocode}
2836 % \end{macro}
2837 % \end{macro}
2838 % \end{macro}
2839 % \end{macro}
2840 % \end{macro}
2841 % \end{macro}
2842 % \end{macro}
2843 % \end{macro}
2844 % \end{macro}
2845 % \end{macro}
2846 % \end{macro}
2847 % \end{macro}
2848 %
2849 % \subsection{Support for the \Lpack{subfigure} package}
2850 % \changes{v1.1}{2000/02/12}{Added subfigure support}
2851 %
2852 % The code for supporting the \Lpack{subfigure} package is, in all
2853 % essentials, the same as that for the figure and table captions; only the
2854 % names are changed. However, the code need only be executed if the
2855 % \Lpack{subfigure} package is actually loaded.
2856 %
2857 % \begin{macro}{\@cftl@subfig}
2858 % This command redefines the |\l@subfigure| command.
2859 % \begin{macrocode}
2860 \newcommand{\@cftl@subfig}{%
2861 % \end{macrocode}
2862 % \begin{macro}{\l@subfigure}
2863 % |\l@subfigure{|\meta{title}|}{|\meta{page}|}| typesets the LoF entry for
2864 % a |subfigure| caption heading. It is essentially the same as the
2865 % parameterised code for |\l@figure| except that account has to be taken
2866 % of |lofdepth|.
2867 % \begin{macrocode}
2868 \renewcommand*{\l@subfigure}[2]{%
2869 \ifnum \c@lofdepth > \toclevel@subfigure
2870 \vskip \cftbeforesubfigskip
2871 {\leftskip \cftsubfigindent\relax
2872 \rightskip \@tocrmarg
2873 \parfillskip -\rightskip
2874 \parindent \cftsubfigindent\relax\@afterindenttrue
2875 \interlinepenalty\@M
2876 \leavevmode
2877 \@tempdima \cftsubfignumwidth\relax
2878 \let\@cftbsnum \cftsubfigpresnum
2879 \let\@cftasnum \cftsubfigaftersnum
2880 \let\@cftasnumb \cftsubfigaftersnumb
2881 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
2882 {\cftsubfigfont ##1}\nobreak
2883 \cftsubfigfillnum{##2}}%
2884 \fi
2885 }%
2886 }
2887
2888 % \end{macrocode}
2889 % \end{macro}
2890 % \end{macro}
2891 %
2892 % \begin{macro}{\@cftsetsubfig}
2893 % This command initialises the setup for subfigure captions in the LoF.
2894 % \begin{macrocode}
2895 \newcommand{\@cftsetsubfig}{%
2896 % \end{macrocode}
2897 % \begin{macro}{\cftbeforesubfigskip}
2898 % \begin{macro}{\cftsubfigindent}
2899 % \begin{macro}{\cftsubfignumwidth}
2900 % \begin{macro}{\cftsubfigfont}
2901 % \begin{macro}{\cftsubfigpresnum}
2902 % \begin{macro}{\cftsubfigaftersnum}
2903 % \begin{macro}{\cftsubfigaftersnumb}
2904 % \begin{macro}{\cftsubfigleader}
2905 % \begin{macro}{\cftsubfigdotsep}
2906 % \begin{macro}{\cftsubfigpagefont}
2907 % \begin{macro}{\cftsubfigafterpnum}
2908 % \begin{macro}{\toclevel@subfig}
2909 % \begin{macro}{\cftsubfigfillnum}
2910 % \begin{macrocode}
2911 \newlength{\cftbeforesubfigskip}
2912 \setlength{\cftbeforesubfigskip}{\z@ \@plus.2\p@}
2913 \newlength{\cftsubfigindent}
2914 \setlength{\cftsubfigindent}{3.8em}
2915 \newlength{\cftsubfignumwidth}
2916 \setlength{\cftsubfignumwidth}{2.5em}
2917 \newcommand{\cftsubfigfont}{\normalfont}
2918 \newcommand{\cftsubfigpresnum}{}
2919 \newcommand{\cftsubfigaftersnum}{}
2920 \newcommand{\cftsubfigaftersnumb}{}
2921 \newcommand{\cftsubfigleader}{\normalfont\cftdotfill{\cftsubtabdotsep}}
2922 \newcommand{\cftsubfigdotsep}{\cftdotsep}
2923 \newcommand{\cftsubfigpagefont}{\normalfont}
2924 \newcommand{\cftsubfigafterpnum}{}
2925 \providecommand{\toclevel@subfigure}{1}
2926 \newcommand{\cftsubfigfillnum}[1]{%
2927 {\cftsubfigleader}\nobreak
2928 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubfigpagefont ##1}\cftsubfigafterpnum\par
2929 }
2930 % \end{macrocode}
2931 % \end{macro}
2932 % \end{macro}
2933 % \end{macro}
2934 % \end{macro}
2935 % \end{macro}
2936 % \end{macro}
2937 % \end{macro}
2938 % \end{macro}
2939 % \end{macro}
2940 % \end{macro}
2941 % \end{macro}
2942 % \end{macro}
2943 % \end{macro}
2944 % This is the end of |\@cftsetsubfig|.
2945 % \begin{macrocode}
2946 }
2947
2948 % \end{macrocode}
2949 % \end{macro}
2950 %
2951 % \begin{macro}{\@cftl@subtab}
2952 % This code redefines the code for |\l@subtable|.
2953 % \begin{macrocode}
2954 \newcommand{\@cftl@subtab}{%
2955 % \end{macrocode}
2956 % \begin{macro}{\l@subtable}
2957 % |\l@subtable{|\meta{title}|}{|\meta{page}|}| typesets the LoT entry for
2958 % a |subtable| caption heading. It is essentially the same as the
2959 % parameterised code for |\l@table| except account has to be taken of
2960 % |lotdepth|.
2961 % \begin{macrocode}
2962 \renewcommand*{\l@subtable}[2]{%
2963 \ifnum \c@lotdepth > \toclevel@subtable
2964 \vskip \cftbeforesubtabskip
2965 {\leftskip \cftsubtabindent\relax
2966 \rightskip \@tocrmarg
2967 \parfillskip -\rightskip
2968 \parindent \cftsubtabindent\relax\@afterindenttrue
2969 \interlinepenalty\@M
2970 \leavevmode
2971 \@tempdima \cftsubtabnumwidth\relax
2972 \let\@cftbsnum \cftsubtabpresnum
2973 \let\@cftasnum \cftsubtabaftersnum
2974 \let\@cftasnumb \cftsubtabaftersnumb
2975 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
2976 {\cftsubtabfont ##1}\nobreak
2977 \cftsubtabfillnum{##2}}%
2978 \fi
2979 }%
2980 }
2981 % \end{macrocode}
2982 % \end{macro}
2983 % \end{macro}
2984 %
2985 % \begin{macro}{\@cftsetsubtab}
2986 % This command sets up the defaults for subtable entries in the LoT.
2987 % \begin{macrocode}
2988 \newcommand{\@cftsetsubtab}{%
2989 % \end{macrocode}
2990 % \begin{macro}{\cftbeforesubtabskip}
2991 % \begin{macro}{\cftsubtabindent}
2992 % \begin{macro}{\cftsubtabnumwidth}
2993 % \begin{macro}{\cftsubtabfont}
2994 % \begin{macro}{\cftsubtabpresnum}
2995 % \begin{macro}{\cftsubtabaftersnum}
2996 % \begin{macro}{\cftsubtabaftersnumb}
2997 % \begin{macro}{\cftsubtableader}
2998 % \begin{macro}{\cftsubtabdotsep}
2999 % \begin{macro}{\cftsubtabpagefont}
3000 % \begin{macro}{\cftsubtabafterpnum}
3001 % \begin{macro}{\toclevel@subtable}
3002 % \begin{macro}{\cftsubtabfillnum}
3003 % These are the user commands to control the typesetting of Subtable
3004 % caption entries.
3005 % They are initialised to give the standard appearance.
3006 % \begin{macrocode}
3007 \newlength{\cftbeforesubtabskip}
3008 \setlength{\cftbeforesubtabskip}{\z@ \@plus.2\p@}
3009 \newlength{\cftsubtabindent}
3010 \setlength{\cftsubtabindent}{3.8em}
3011 \newlength{\cftsubtabnumwidth}
3012 \setlength{\cftsubtabnumwidth}{2.5em}
3013 \newcommand{\cftsubtabfont}{\normalfont}
3014 \newcommand{\cftsubtabpresnum}{}
3015 \newcommand{\cftsubtabaftersnum}{}
3016 \newcommand{\cftsubtabaftersnumb}{}
3017 \newcommand{\cftsubtableader}{\normalfont\cftdotfill{\cftsubtabdotsep}}
3018 \newcommand{\cftsubtabdotsep}{\cftdotsep}
3019 \newcommand{\cftsubtabpagefont}{\normalfont}
3020 \newcommand{\cftsubtabafterpnum}{}
3021 \providecommand{\toclevel@subtable}{1}
3022 \newcommand{\cftsubtabfillnum}[1]{%
3023 {\cftsubtableader}\nobreak
3024 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubtabpagefont ##1}\cftsubtabafterpnum\par
3025 }
3026 % \end{macrocode}
3027 % \end{macro}
3028 % \end{macro}
3029 % \end{macro}
3030 % \end{macro}
3031 % \end{macro}
3032 % \end{macro}
3033 % \end{macro}
3034 % \end{macro}
3035 % \end{macro}
3036 % \end{macro}
3037 % \end{macro}
3038 % \end{macro}
3039 % \end{macro}
3040 % This is the end of |\@cftsetsubtab|.
3041 % \begin{macrocode}
3042 }
3043
3044 % \end{macrocode}
3045 % \end{macro}
3046 %
3047 % Call the \Lpack{subfigure} package setup code only if the
3048 % \Lopt{subfigure} option is specified. The |\l@...| redefinitions have to
3049 % come after the \Lpack{subfigure} package is loaded.
3050 % \begin{macrocode}
3051
3052 \if@cftsubfigopt
3053 \@cftsetsubfig\@cftsetsubtab
3054 \AtBeginDocument{\@cftl@subfig\@cftl@subtab}
3055 \fi
3056 %% \AtBeginDocument{\if@cftsubfigopt
3057 %% \@cftsetsubfig\@cftsetsubtab
3058 %% \@cftl@subfig\@cftl@subtab
3059 %% \fi}
3060
3061 % \end{macrocode}
3062 %
3063 %
3064 % \subsection{New list of\ldots}
3065 % \changes{v2.0}{2001/03/03}{Added \cs{newlistof} and \cs{newlistentry}}
3066 %
3067 % \begin{macro}{\newlistentry}
3068 % |\newlistentry[|\meta{within}|]{|\meta{counter}|}{|\meta{ext}|}{|\meta{level-1}|}| creates a set of commands for a new kind of entry into a List of.
3069 % \begin{macrocode}
3070 \newcommand{\newlistentry}[4][\@empty]{%
3071 % \end{macrocode}
3072 % \begin{macro}{\c@X}
3073 % \begin{macro}{\theX}
3074 % Check if \meta{within} and \meta{counter} have been defined. It is
3075 % an error if \meta{within} has not been defined, and an error if
3076 % \meta{counter} has been defined. Set the default counter values.
3077 % \begin{macrocode}
3078 \@ifundefined{c@#2}{% check & set the counter
3079 \ifx \@empty#1\relax
3080 \newcounter{#2}
3081 \else
3082 \@ifundefined{c@#1}{\PackageWarning{tocloft}%
3083 {#1 has no counter for use as a `within'}
3084 \newcounter{#2}}%
3085 {\newcounter{#2}[#1]%
3086 \expandafter\edef\csname the#2\endcsname{%
3087 \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}}
3088 \fi
3089 \setcounter{#2}{0}
3090 }
3091 {\PackageError{tocloft}{#2 has been previously defined}{\@eha}}
3092
3093 % \end{macrocode}
3094 % \end{macro}
3095 % \end{macro}
3096 %
3097 % That finishes off the error checking. No matter what the result, the
3098 % rest of the new commands are defined.
3099 %
3100 % \begin{macro}{\l@X}
3101 % |\l@X{|\meta{title}|}{|\meta{page}|}| typesets the entry.
3102 % \begin{macrocode}
3103 \@namedef{l@#2}##1##2{%
3104 % \end{macrocode}
3105 % Only typeset if the |\Zdepth| is greater than \meta{level-1}.
3106 % \begin{macrocode}
3107 \ifnum \@nameuse{c@#3depth} > #4\relax
3108 \vskip \@nameuse{cftbefore#2skip}
3109 {\leftskip \@nameuse{cft#2indent}\relax
3110 \rightskip \@tocrmarg
3111 \parfillskip -\rightskip
3112 \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue
3113 \interlinepenalty\@M
3114 \leavevmode
3115 \@tempdima \@nameuse{cft#2numwidth}\relax
3116 \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname
3117 \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname
3118 \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname
3119 \advance\leftskip\@tempdima \null\nobreak\hskip -\leftskip
3120 {\@nameuse{cft#2font}##1}\nobreak
3121 \@nameuse{cft#2fillnum}{##2}}%
3122 \fi
3123 } % end of \l@#2
3124
3125 % \end{macrocode}
3126 % \end{macro}
3127 %
3128 % Now define all the layout commands used by |\l@X|. The default
3129 % values of these correspond to those for section entries in
3130 % non-chaptered documents.
3131 % \begin{macro}{\cftbeforeXskip}
3132 % \begin{macrocode}
3133 \expandafter\newlength\csname cftbefore#2skip\endcsname
3134 \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@}
3135 % \end{macrocode}
3136 % \end{macro}
3137 % \begin{macro}{\cftXindent}
3138 % \begin{macro}{\cftXnumwidth}
3139 % \begin{macrocode}
3140 \expandafter\newlength\csname cft#2indent\endcsname
3141 \expandafter\newlength\csname cft#2numwidth\endcsname
3142 % \end{macrocode}
3143 % Set the default values for the indent and numwidth depending on
3144 % the entry's level. A level of 1 corresponds to a figure entry.
3145 % \begin{macrocode}
3146 \ifcase #4\relax % 0
3147 \setlength{\@nameuse{cft#2indent}}{0em}
3148 \setlength{\@nameuse{cft#2numwidth}}{1.5em}
3149 \or % 1
3150 \setlength{\@nameuse{cft#2indent}}{1.5em}
3151 \setlength{\@nameuse{cft#2numwidth}}{2.3em}
3152 \or % 2
3153 \setlength{\@nameuse{cft#2indent}}{3.8em}
3154 \setlength{\@nameuse{cft#2numwidth}}{3.2em}
3155 \or % 3
3156 \setlength{\@nameuse{cft#2indent}}{7.0em}
3157 \setlength{\@nameuse{cft#2numwidth}}{4.1em}
3158 \else % anything else
3159 \setlength{\@nameuse{cft#2indent}}{10.0em}
3160 \setlength{\@nameuse{cft#2numwidth}}{5.0em}
3161 \fi
3162 % \end{macrocode}
3163 % \end{macro}
3164 % \end{macro}
3165 % \begin{macro}{\cftXfont}
3166 % \begin{macro}{\cftXpresnum}
3167 % \begin{macro}{\cftXaftersnum}
3168 % \begin{macro}{\cftXaftersnumb}
3169 % \begin{macro}{\cftXdotsep}
3170 % \begin{macro}{\cftXleader}
3171 % \begin{macro}{\cftXpagefont}
3172 % \begin{macro}{\cftXafterpnum}
3173 % And the remaining commands.
3174 % \begin{macrocode}
3175 \@namedef{cft#2font}{\normalfont}
3176 \@namedef{cft#2presnum}{}
3177 \@namedef{cft#2aftersnum}{}
3178 \@namedef{cft#2aftersnumb}{}
3179 \@namedef{cft#2dotsep}{\cftdotsep}
3180 \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}}
3181 \@namedef{cft#2pagefont}{\normalfont}
3182 \@namedef{cft#2afterpnum}{}
3183 % \end{macrocode}
3184 % \end{macro}
3185 % \end{macro}
3186 % \end{macro}
3187 % \end{macro}
3188 % \end{macro}
3189 % \end{macro}
3190 % \end{macro}
3191 % \end{macro}
3192 %
3193 % \begin{macro}{\toclevel@X}
3194 % The hyperref package needs a command |\toclevel@X|, holding
3195 % the \meta{level-1} value.
3196 % \begin{macrocode}
3197 \@namedef{toclevel@#2}{#4}
3198 % \end{macrocode}
3199 % \end{macro}
3200 %
3201 % \begin{macro}{\cftXfillnum}
3202 % Typeset the leader and page number.
3203 % \begin{macrocode}
3204 \@namedef{cft#2fillnum}##1{%
3205 {\@nameuse{cft#2leader}}\nobreak
3206 \makebox[\@pnumwidth][\cftpnumalign]{\@nameuse{cft#2pagefont}##1}\@nameuse{cft#2afterpnum}\par
3207 }
3208 % \end{macrocode}
3209 % \end{macro}
3210 % This ends the definition of |\newlistentry|.
3211 % \begin{macrocode}
3212 }
3213 % \end{macrocode}
3214 % \end{macro}
3215 %
3216 % \begin{macro}{\newlistof}
3217 % |\newlistof[|\meta{within}|]{|\meta{entry}|}{|\meta{ext}|}{|\meta{listofname}|}|
3218 % creates the commands for a new List of.
3219 % \begin{macrocode}
3220 \newcommand{\newlistof}[4][\@empty]{%
3221 % \end{macrocode}
3222 % Call |\newlistentry| to set up the first level entry.
3223 % \begin{macrocode}
3224 \ifx \@empty#1\relax
3225 \newlistentry{#2}{#3}{0}
3226 \else
3227 \newlistentry[#1]{#2}{#3}{0}
3228 \fi
3229 % \end{macrocode}
3230 % \end{macro}
3231 %
3232 % \begin{macro}{\ext@Z}
3233 % \begin{macro}{\Zdepth}
3234 % The file extension and listing depth.
3235 % \begin{macrocode}
3236 \@namedef{ext@#2}{#3}
3237 \newcounter{#3depth}
3238 \setcounter{#3depth}{1}
3239 % \end{macrocode}
3240 % \end{macro}
3241 % \end{macro}
3242 %
3243 % \begin{macro}{\cftmarkZ}
3244 % The heading marks for the listing.
3245 % \changes{v2.3}{2002/06/15}{different koma settings in \cs{newlistof}}
3246 % \begin{macrocode}
3247 \if@cftkoma
3248 \@namedef{cftmark#3}{%
3249 \@mkboth{#4}{#4}}
3250 \else
3251 \@namedef{cftmark#3}{%
3252 \@mkboth{\MakeUppercase{#4}}{\MakeUppercase{#4}}}
3253 \fi
3254 % \end{macrocode}
3255 % \end{macro}
3256 %
3257 % \begin{macro}{\listofX}
3258 % Typeset the listing title and entries.
3259 % \begin{macrocode}
3260 \if@cftnctoc
3261 % \end{macrocode}
3262 % For the \Lopt{titles} option, basically copy the code from
3263 % the standard |\tableofcontents| command.
3264 % \begin{macrocode}
3265 \@namedef{listof#2}{%
3266 \@cfttocstart
3267 \if@cfthaschapter
3268 \chapter*{#4}
3269 \else
3270 \section*{#4}
3271 \fi
3272 \@nameuse{cftmark#3}
3273 \@starttoc{#3}%
3274 \@cfttocfinish}
3275 \else
3276 % \end{macrocode}
3277 % Otherwise use the fully parameterised definition.
3278 % \begin{macrocode}
3279 \@namedef{listof#2}{%
3280 \@cfttocstart
3281 \par
3282 \begingroup
3283 \parindent\z@ \parskip\cftparskip
3284 \@nameuse{@cftmake#3title}
3285 \@starttoc{#3}%
3286 \endgroup
3287 \@cfttocfinish}
3288 \fi
3289
3290 % \end{macrocode}
3291 % \end{macro}
3292 %
3293 % \begin{macro}{\@cftmakeZtitle}
3294 % Typeset the title.
3295 % \changes{v2.3}{2002/06/15}{Added \cs{@secpenalty} to \cs{@cftmakeZtitle}}
3296 % \changes{v2.3}{2002/06/15}{Added \cs{@cftpagestyle} to \cs{@cftmakeZtitle}}
3297 % \begin{macrocode}
3298 \@namedef{@cftmake#3title}{%
3299 \addpenalty\@secpenalty
3300 \if@cfthaschapter
3301 \vspace*{\@nameuse{cftbefore#3titleskip}}%
3302 \else
3303 \vspace{\@nameuse{cftbefore#3titleskip}}%
3304 \fi
3305 \@cftpagestyle
3306 {\interlinepenalty\@M
3307 {\@nameuse{cft#3titlefont}#4}{\@nameuse{cftafter#3title}}%
3308 \@nameuse{cftmark#3}%
3309 \par\nobreak
3310 \vskip \@nameuse{cftafter#3titleskip}%
3311 \@afterheading}}
3312
3313 % \end{macrocode}
3314 % \end{macro}
3315 %
3316 % \begin{macro}{\cftbeforeZtitleskip}
3317 % \begin{macro}{\cftafterZtitleskip}
3318 % \begin{macro}{\cftZtitlefont}
3319 % The skips before and after the title heading, and the title font.
3320 % The default values depend on whether or not the document class
3321 % has chapters.
3322 % \begin{macrocode}
3323 \expandafter\newlength\csname cftbefore#3titleskip\endcsname
3324 \expandafter\newlength\csname cftafter#3titleskip\endcsname
3325 \if@cfthaschapter
3326 \setlength{\@nameuse{cftbefore#3titleskip}}{50pt}
3327 \setlength{\@nameuse{cftafter#3titleskip}}{40pt}
3328 \if@cftkoma
3329 \@namedef{cft#3titlefont}{\size@chapter\sectfont}
3330 \else
3331 \@namedef{cft#3titlefont}{\normalfont\Huge\bfseries}
3332 \fi
3333 \else
3334 \setlength{\@nameuse{cftbefore#3titleskip}}{3.5ex \@plus 1ex \@minus .2ex}
3335 \setlength{\@nameuse{cftafter#3titleskip}}{2.3ex \@plus .2ex}
3336 \if@cftkoma
3337 \@namedef{cft#3titlefont}{\size@section\sectfont}
3338 \else
3339 \@namedef{cft#3titlefont}{\normalfont\Huge\bfseries}
3340 \fi
3341 \fi
3342 % \end{macrocode}
3343 % \end{macro}
3344 % \end{macro}
3345 % \end{macro}
3346 %
3347 % \begin{macro}{\cftafterZtitle}
3348 % Something to go after the title.
3349 % \begin{macrocode}
3350 \@namedef{cftafter#3title}{}
3351 % \end{macrocode}
3352 % \end{macro}
3353 %
3354 % \begin{macro}{\cftZprehook}
3355 % \begin{macro}{\cftZposthook}
3356 % Hooks before and after the list of entries.
3357 % \begin{macrocode}
3358 \@namedef{cft#3prehook}{}
3359 \@namedef{cft#3posthook}{}
3360 % \end{macrocode}
3361 % \end{macro}
3362 %
3363 % This is the end of the definition of |\newlistof|.
3364 % \begin{macrocode}
3365 }
3366 % \end{macrocode}
3367 % \end{macro}
3368 %
3369 % \begin{macro}{\cftsetindents}
3370 % \changes{v2.0}{2001/03/15}{Added \cs{cftsetindents}}
3371 % |\cftsetindents{|\meta{entry}|}{|\meta{indent}|}{|\meta{numwidth}|}| sets
3372 % the \textit{indent} and \textit{numwidth} for entry \meta{entry}. The macro
3373 % has to map between the external entry name and the internal shorthand.
3374 % \begin{macrocode}
3375 \newcommand{\cftsetindents}[3]{%
3376 \def\@cftemp{#1}
3377 \ifx\@cftemp\cftchapname
3378 \@cftsetindents{chap}{#2}{#3}
3379 \else
3380 \ifx\@cftemp\cftsecname \@cftsetindents{sec}{#2}{#3}
3381 \else
3382 \ifx\@cftemp\cftsubsecname \@cftsetindents{subsec}{#2}{#3}
3383 \else
3384 \ifx\@cftemp\cftsubsubsecname \@cftsetindents{subsubsec}{#2}{#3}
3385 \else
3386 \ifx\@cftemp\cftparaname \@cftsetindents{para}{#2}{#3}
3387 \else
3388 \ifx\@cftemp\cftsubparaname \@cftsetindents{subpara}{#2}{#3}
3389 \else
3390 \ifx\@cftemp\cftfigname \@cftsetindents{fig}{#2}{#3}
3391 \else
3392 \ifx\@cftemp\cftsubfigname \@cftsetindents{subfig}{#2}{#3}
3393 \else
3394 \ifx\@cftemp\cfttabname \@cftsetindents{tab}{#2}{#3}
3395 \else
3396 \ifx\@cftemp\cftsubtabname \@cftsetindents{subtab}{#2}{#3}
3397 \else
3398 \@cftsetindents{#1}{#2}{#3}
3399 \fi
3400 \fi
3401 \fi
3402 \fi
3403 \fi
3404 \fi
3405 \fi
3406 \fi
3407 \fi
3408 \fi
3409 }
3410
3411 % \end{macrocode}
3412 % \end{macro}
3413 %
3414 % \begin{macro}{\@cftsetindents}
3415 % |\@cftsetindents{|\meta{X}|}{|\meta{indent}|}{|\meta{numwidth}|}| is
3416 % the internal version of |\cftsetindents|, where in this case \meta{X}
3417 % is the internal (shorthand) name of the entry.
3418 % \begin{macrocode}
3419 \newcommand{\@cftsetindents}[3]{%
3420 \setlength{\@nameuse{cft#1indent}}{#2}
3421 \setlength{\@nameuse{cft#1numwidth}}{#3}
3422 }
3423
3424 % \end{macrocode}
3425 % \end{macro}
3426 %
3427 %
3428 % \subsection{Switching page numbering}
3429 % \changes{v2.0}{2001/03/03}{Added page number switching off/on}
3430 %
3431 % \begin{macro}{\@cftpnumoff}
3432 % |\@cftpnumoff{|\meta{shorthand}|}| is the workhorse
3433 % for switching page numbering off. The \meta{shorthand} argument is the
3434 % shorthand name of the entry (e.g. |subsec| for |subsection|).
3435 % The macro redefines the |\cftXnumfill| command so that there is no leader
3436 % and the page number is ignored.
3437 % \begin{macrocode}
3438 \newcommand{\@cftpnumoff}[1]{%
3439 \@namedef{cft#1fillnum}##1{%
3440 \cftparfillskip\@nameuse{cft#1afterpnum}\par}}
3441
3442 % \end{macrocode}
3443 % \end{macro}
3444 %
3445 % \begin{macro}{\cftchapname}
3446 % \begin{macro}{\cftsecname}
3447 % \begin{macro}{\cftsubsecname}
3448 % \begin{macro}{\cftsubsubsecname}
3449 % \begin{macro}{\cftparaname}
3450 % \begin{macro}{\cftsubparaname}
3451 % \begin{macro}{\cftfigname}
3452 % \begin{macro}{\cftsubfigname}
3453 % \begin{macro}{\cfttabname}
3454 % \begin{macro}{\cftsubtabname}
3455 % Unfortunately an early design decision was the use shorthands like |sec|
3456 % for |section|. For the page switching I need to be able to correlate the
3457 % shorthands and longhands.
3458 % \begin{macrocode}
3459 \newcommand*{\cftchapname}{chapter}
3460 \newcommand*{\cftsecname}{section}
3461 \newcommand*{\cftsubsecname}{subsection}
3462 \newcommand*{\cftsubsubsecname}{subsubsection}
3463 \newcommand*{\cftparaname}{paragraph}
3464 \newcommand*{\cftsubparaname}{subparagraph}
3465 \newcommand*{\cftfigname}{figure}
3466 \newcommand*{\cftsubfigname}{subfigure}
3467 \newcommand*{\cfttabname}{table}
3468 \newcommand*{\cftsubtabname}{subtable}
3469
3470 % \end{macrocode}
3471 % \end{macro}
3472 % \end{macro}
3473 % \end{macro}
3474 % \end{macro}
3475 % \end{macro}
3476 % \end{macro}
3477 % \end{macro}
3478 % \end{macro}
3479 % \end{macro}
3480 % \end{macro}
3481 %
3482 % \begin{macro}{\cftpagenumbersoff}
3483 % The user level command for switching off page numbers is
3484 % |\cftpagenumbersoff{|\meta{entry}|}| where \meta{entry} is the longhand
3485 % name of the entry. The principal task opf this macro is to determine
3486 % the corresponding shorthand name of the \meta{entry} and then call
3487 % |\@cftpnumoff| to do the work. For |part| and user-defined entries
3488 % the long- and short-hand entry names are identical.
3489 % \begin{macrocode}
3490 \DeclareRobustCommand{\cftpagenumbersoff}[1]{%
3491 \def\@cftemp{#1}
3492 \ifx\@cftemp\cftchapname
3493 \@cftpnumoff{chap}
3494 \else
3495 \ifx\@cftemp\cftsecname \@cftpnumoff{sec}
3496 \else
3497 \ifx\@cftemp\cftsubsecname \@cftpnumoff{subsec}
3498 \else
3499 \ifx\@cftemp\cftsubsubsecname \@cftpnumoff{subsubsec}
3500 \else
3501 \ifx\@cftemp\cftparaname \@cftpnumoff{para}
3502 \else
3503 \ifx\@cftemp\cftsubparaname \@cftpnumoff{subpara}
3504 \else
3505 \ifx\@cftemp\cftfigname \@cftpnumoff{fig}
3506 \else
3507 \ifx\@cftemp\cftsubfigname \@cftpnumoff{subfig}
3508 \else
3509 \ifx\@cftemp\cfttabname \@cftpnumoff{tab}
3510 \else
3511 \ifx\@cftemp\cftsubtabname \@cftpnumoff{subtab}
3512 \else
3513 \@cftpnumoff{#1}
3514 \fi
3515 \fi
3516 \fi
3517 \fi
3518 \fi
3519 \fi
3520 \fi
3521 \fi
3522 \fi
3523 \fi
3524 }
3525
3526 % \end{macrocode}
3527 % \end{macro}
3528 %
3529 % \begin{macro}{\cftpagenumberson}
3530 % |\cftpagenumberson{|\meta{entry}|}| is the user level command for
3531 % reversing the corresponding |\cftpagenumbersoff|.
3532 % \begin{macrocode}
3533 \DeclareRobustCommand{\cftpagenumberson}[1]{%
3534 \def\@cftemp{#1}
3535 \ifx\@cftemp\cftchapname
3536 \@cftpnumon{chap}
3537 \else
3538 \ifx\@cftemp\cftsecname \@cftpnumon{sec}
3539 \else
3540 \ifx\@cftemp\cftsubsecname \@cftpnumon{subsec}
3541 \else
3542 \ifx\@cftemp\cftsubsubsecname \@cftpnumon{subsubsec}
3543 \else
3544 \ifx\@cftemp\cftparaname \@cftpnumon{para}
3545 \else
3546 \ifx\@cftemp\cftsubparaname \@cftpnumon{subpara}
3547 \else
3548 \ifx\@cftemp\cftfigname \@cftpnumon{fig}
3549 \else
3550 \ifx\@cftemp\cftsubfigname \@cftpnumon{subfig}
3551 \else
3552 \ifx\@cftemp\cfttabname \@cftpnumon{tab}
3553 \else
3554 \ifx\@cftemp\cftsubtabname \@cftpnumon{subtab}
3555 \else
3556 \@cftpnumon{#1}
3557 \fi
3558 \fi
3559 \fi
3560 \fi
3561 \fi
3562 \fi
3563 \fi
3564 \fi
3565 \fi
3566 \fi
3567 }
3568
3569 % \end{macrocode}
3570 % \end{macro}
3571 %
3572 %
3573 % \begin{macro}{\@cftpnumon}
3574 % |\@cftpnumon{|\meta{shorthand}|}| is the workhorse
3575 % for switching page numbering off. The \meta{shorthand} argument is the
3576 % shorthand name of the entry (e.g. |subsec| for |subsection|).
3577 % The macro defines the |\cftXnumfill| command to correspond to
3578 % the default definition.
3579 % \begin{macrocode}
3580 \newcommand{\@cftpnumon}[1]{%
3581 \@namedef{cft#1fillnum}##1{%
3582 {\@nameuse{cft#1leader}}\nobreak
3583 \makebox[\@pnumwidth][\cftpnumalign]{\@nameuse{cft#1pagefont}##1}\@nameuse{cft#1afterpnum}\par
3584 }%
3585 }
3586 % \end{macrocode}
3587 % \end{macro}
3588 %
3589 %
3590 %
3591 %
3592 %
3593 %
3594 % \subsection{Experimental utilities}
3595 %
3596 % The code in this section is experimental but in the sense that the
3597 % capabilities might be modified in the future rather than that the code
3598 % does not work.
3599 %
3600 % \begin{macro}{\cftchapterprecis}
3601 % This is experimental. |\cftchapterprecis{|\meta{text}|}| typesets
3602 % \meta{text} at the point where it is called, and also adds \meta{text}
3603 % to the \file{.toc} file. It is expects to be called immediately after
3604 % a |\chapter| command.
3605 % \begin{macrocode}
3606 \newcommand{\cftchapterprecis}[1]{%
3607 \cftchapterprecishere{#1}
3608 \cftchapterprecistoc{#1}}
3609 % \end{macrocode}
3610 % \end{macro}
3611 %
3612 % \begin{macro}{\cftchapterprecishere}
3613 % |\cftchapterprecishere{|\meta{text}|}| typesets \meta{text}. It expects
3614 % to be called immediately after a |\chapter| command. First add some
3615 % negative vertical space to move it closer to the chapter heading.
3616 % \begin{macrocode}
3617 \newcommand{\cftchapterprecishere}[1]{%
3618 \vspace*{-2\baselineskip}
3619 % \end{macrocode}
3620 % Typeset its argument using italic font in a |quote| environment.
3621 % \begin{macrocode}
3622 \begin{quote}\textit{#1}\end{quote}}
3623 % \end{macrocode}
3624 % \end{macro}
3625 %
3626 % \begin{macro}{\cftchapterprecistoc}
3627 % |\cftchapterprecistoc{|\meta{text}|}| adds \meta{text} to the \file{.toc}
3628 % file. The \meta{text} will be typeset within the same margins as the
3629 % the title text of a |\chapter| heading, using an italic font.
3630 % \begin{macrocode}
3631 \newcommand{\cftchapterprecistoc}[1]{\addtocontents{toc}{%
3632 % \end{macrocode}
3633 % Start a group to localize changes to the paragraphing. Set the
3634 % left margin to the chapter indent plus the chapter number width.
3635 % \begin{macrocode}
3636 {\leftskip \cftchapindent\relax
3637 \advance\leftskip \cftchapnumwidth\relax
3638 % \end{macrocode}
3639 % Set the right hand margin to |\@tocrmarg|.
3640 % \begin{macrocode}
3641 \rightskip \@tocrmarg\relax
3642 % \end{macrocode}
3643 % Typeset \meta{text} using an italic font, then ensure that the paragraph
3644 % is finished (to use the local skips). Finally close the group and we
3645 % are done.
3646 % \begin{macrocode}
3647 \textit{#1}\protect\par}}}
3648
3649 % \end{macrocode}
3650 % \end{macro}
3651 %
3652 % \begin{macro}{\cftlocalchange}
3653 % |\cftmakelocalchange{|\meta{file}|}{|\meta{pnumwidth}|}{|\meta{tocrmarg}|}|
3654 % makes an entry into \meta{file} to change the |\@pnumwidth| and
3655 % the |\@tocrmarg| values.
3656 % \begin{macrocode}
3657 \newcommand{\cftlocalchange}[3]{%
3658 \addtocontents{#1}{\protect\cftsetpnumwidth{#2} \protect\cftsetrmarg{#3}}}
3659 % \end{macrocode}
3660 % \end{macro}
3661 %
3662 % \begin{macro}{\cftaddtitleline}
3663 % |\cftaddtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}|
3664 % adds a |\contentsline| entry to \meta{file} with the given information.
3665 % \begin{macrocode}
3666 \newcommand{\cftaddtitleline}[4]{\addtocontents{#1}{%
3667 \protect\contentsline{#2}{#3}{#4}}}
3668 % \end{macrocode}
3669 % \end{macro}
3670 %
3671 % \begin{macro}{\cftaddnumtitleline}
3672 % |\cftaddtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{num}|}{|\meta{title}|}{|\meta{page}|}|
3673 % adds a |\contentsline| entry to \meta{file} with the given information.
3674 % \changes{v2.3c}{2003/09/26}{Removed \cs{ignorespaces} from \cs{cftaddnumtitleline}}
3675 % \begin{macrocode}
3676 \newcommand{\cftaddnumtitleline}[5]{\addtocontents{#1}{%
3677 \protect\contentsline{#2}{\protect\numberline{#3}#4}{#5}}}
3678 % \end{macrocode}
3679 % \end{macro}
3680 %
3681 % And, if dear old \Lpack{hyperref} has been used, we have to fix up these
3682 % two macros.
3683 % \changes{2003/09/26}{v2.3c}{Hyperref fix for \cs{cftaddtitleline} and
3684 % \cs{cftaddnumtitleline}}
3685 % \begin{macrocode}
3686 \AtBeginDocument{%
3687 \@ifpackageloaded{hyperref}{%
3688 \renewcommand{\cftaddtitleline}[4]{\addtocontents{#1}{%
3689 \protect\contentsline{#2}{#3}{#4}{\@currentHref}}}
3690 \renewcommand{\cftaddnumtitleline}[5]{\addtocontents{#1}{%
3691 \protect\contentsline{#2}{\protect\numberline{#3}#4}{#5}{\@currentHref}}}
3692 }{}
3693 }
3694
3695 % \end{macrocode}
3696 %
3697 %
3698 % \begin{macro}{\@starttoc}
3699 %
3700 % Okay, here's a roughly-comprehensive list where \cs{@starttoc} is redefined in \TeX{} Live 2014.
3701 % \begin{itemize}
3702 % \item amsart, amsbook, amsdtx, amsproc
3703 % \item asect
3704 % \item latx.ltx (of course)
3705 % \item newfloat
3706 % \item flowfram
3707 % \item gmampulex (?), gmtypos
3708 % \item hyperref, memhfixc
3709 % \item ijmart
3710 % \item scrartcl, scrbook, scrreprt
3711 % \item scrwtfile
3712 % \item tocbasic
3713 % \item tocstyle
3714 % \item memoir
3715 % \item multitoc
3716 % \item nccsect
3717 % \item notoccite
3718 % \item artikel3, boek3, rapport3,
3719 % \item rerunfilecheck
3720 % \item parskip
3721 % \item pdfwin
3722 % \item revtex4
3723 % \item devanagari
3724 % \end{itemize}
3725 % This makes things difficult if we want to redefine \cs{@starttoc} here.
3726 % Many of the packages/classes above will not be used in conjunction with tocloft; on the other hand, we don't want to trample too much on others' code.
3727 %
3728 % So for our own work here, let's be extra conservative, at least for now, and only hook into \cs{starttoc} if it's the standard \LaTeX{} version.
3729 % \begin{macrocode}
3730 \def\@starttoc@latex@orig#1{%
3731 \begingroup
3732 \makeatletter
3733 \@input{\jobname.#1}%
3734 \if@filesw
3735 \expandafter\newwrite\csname tf@#1\endcsname
3736 \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
3737 \fi
3738 \@nobreakfalse
3739 \endgroup}
3740 \ifx\@starttoc\@starttoc@latex@orig
3741 \def\@starttoc#1{%
3742 \csname cft#1prehook\endcsname
3743 \begingroup
3744 \makeatletter
3745 \@input{\jobname.#1}%
3746 \if@filesw
3747 \expandafter\newwrite\csname tf@#1\endcsname
3748 \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
3749 \fi
3750 \@nobreakfalse
3751 \endgroup
3752 \csname cft#1posthook\endcsname}
3753 \newcommand\cfttocprehook{}
3754 \newcommand\cftlofprehook{}
3755 \newcommand\cftlotprehook{}
3756 \newcommand\cfttocposthook{}
3757 \newcommand\cftlofposthook{}
3758 \newcommand\cftlotposthook{}
3759 \else
3760 \PackageWarning{tocloft}{\string\@starttoc\space has already been redefined; tocloft bailing out.}
3761 \fi
3762 % \end{macrocode}
3763 % \end{macro}
3764 %
3765 %
3766 %
3767 %
3768 % The end of this package.
3769 % \begin{macrocode}
3770 %</usc>
3771 % \end{macrocode}
3772 %
3773 %
3774 % \bibliographystyle{alpha}
3775 %
3776 % \begin{thebibliography}{GMS94}
3777 %
3778 % \bibitem[Coc95]{SUBFIGURE}
3779 % Steven Douglas Cochran.
3780 % \newblock \emph{{The subfigure package}}.
3781 % \newblock March 1995.
3782 % \newblock (Available from CTAN as file \texttt{subfigure.dtx})
3783 %
3784 % \bibitem[Dru99]{MINITOC}
3785 % Jean-Pierre Drucbert.
3786 % \newblock \emph{{The minitoc package}}.
3787 % \newblock August 1999.
3788 % \newblock (Available from CTAN in subdirectory \texttt{/minitoc})
3789 %
3790 % \bibitem[GMS94]{GOOSSENS94}
3791 % Michel Goossens, Frank Mittelbach, and Alexander Samarin.
3792 % \newblock {\em The LaTeX Companion}.
3793 % \newblock Addison-Wesley Publishing Company, 1994.
3794 %
3795 % \bibitem[Lin97]{FNCYCHAP}
3796 % Ulf~A. Lindgren.
3797 % \newblock \emph{{FncyChap V1.11}}.
3798 % \newblock April 1997.
3799 % \newblock (Available from CTAN in subdirectory \texttt{/fncychap})
3800 %
3801 % \bibitem[Lin95]{FLOAT}
3802 % Anselm Lingnau.
3803 % \newblock \emph{{An Improved Environment for Floats}}.
3804 % \newblock March 1995.
3805 % \newblock (Available from CTAN in subdirectory \texttt{/float})
3806 %
3807 % \bibitem[Wil96a]{ALGORITHM}
3808 % Peter Williams.
3809 % \newblock \emph{{Algorithms}}.
3810 % \newblock April 1996.
3811 % \newblock (Available from CTAN in subdirectory \texttt{/algorithm})
3812 %
3813 % \bibitem[Wil96b]{PRW96i}
3814 % Peter~R. Wilson.
3815 % \newblock \emph{{LaTeX for standards: The LaTeX package files user manual}}.
3816 % \newblock NIST Report NISTIR, June 1996.
3817 %
3818 % \bibitem[Wil00]{TOCBIBIND}
3819 % Peter~R. Wilson.
3820 % \newblock \emph{{The tocbibind package}}.
3821 % \newblock March 2000.
3822 % \newblock (Available from CTAN as file \texttt{tocbibind.dtx})
3823 %
3824 % \bibitem[Wil01]{CCAPTION}
3825 % Peter~R. Wilson.
3826 % \newblock \emph{{The ccaption package}}.
3827 % \newblock March 2001.
3828 % \newblock (Available from CTAN as file \texttt{ccaption.dtx})
3829 %
3830 % \end{thebibliography}
3831 %
3832 %
3833 % \Finale
3834 % \PrintIndex
3835 %
3836 \endinput
3837
3838 %% \CharacterTable
3839 %% {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
3840 %% 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
3841 %% Digits \0\1\2\3\4\5\6\7\8\9
3842 %% Exclamation \! Double quote \" Hash (number) \#
3843 %% Dollar \$ Percent \% Ampersand \&
3844 %% Acute accent \' Left paren \( Right paren \)
3845 %% Asterisk \* Plus \+ Comma \,
3846 %% Minus \- Point \. Solidus \/
3847 %% Colon \: Semicolon \; Less than \<
3848 %% Equals \= Greater than \> Question mark \?
3849 %% Commercial at \@ Left bracket \[ Backslash \\
3850 %% Right bracket \] Circumflex \^ Underscore \_
3851 %% Grave accent \` Left brace \{ Vertical bar \|
3852 %% Right brace \} Tilde \~}
3853
3854