The tocloft package
Author: Peter Wilson, Herries Press
Maintainer: Will Robertson
will dot robertson at latex-project dot org
2020/01/10
Abstract
The tocloft package provides means of controlling the typographic design
of the Table of Contents, List of Figures and List of Tables. New kinds of
‘List of . . . can be defined.
The package has been tested with the tocbibind, minitoc, ccaption, sub-
figure, float, fncychap, and hyperref packages.
Contents
1 Introduction 2
1.1 L
A
T
E
X’s methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 The tocloft package 6
2.1 Package options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Changing the titles . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Typesetting the entries . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 New list of. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.5 Experimental utilities . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.6 Usage with other packages . . . . . . . . . . . . . . . . . . . . . . . 18
3 The package code 19
3.1 Support for the subfigure package . . . . . . . . . . . . . . . . . . . 39
3.2 New list of. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.3 Switching page numbering . . . . . . . . . . . . . . . . . . . . . . . 47
3.4 Experimental utilities . . . . . . . . . . . . . . . . . . . . . . . . . 49
List of Figures
1 Layout of a ToC (LoF, LoT) entry . . . . . . . . . . . 3
This file (tocloft.dtx) has version number v2.3j, last revised 2020/01/10.
1
List of Tables
1 Indents and Numwidths . . . . . . . . . . . . . . 4
1 Introduction
In the standard classes the typographic design of the Table of Contents (ToC),
the List of Figures (LoF) and List of Tables (LoT) is fixed or, more precisely, it
is buried within the class definitions. The tocloft package provides handles for an
author to change the design to meet the needs of the particular document.
Elements of the package were developed as part of a class and package bundle
for typesetting ISO standards [Wil96b]. This manual is typeset according to the
conventions of the L
A
T
E
X docstrip utility which enables the automatic extraction
of the L
A
T
E
X macro source files [GMS94].
Section 2 describes the usage of the package. Commented source code for the
package is in Section 3.
The package has been tested in combination with at least the tocbibind pack-
age [Wil00], the minitoc package [Dru99], the ccaption package [Wil01], the subfig-
ure package [Coc95] (versions 2.0 and 2.1), the algorithm package [Wil96a] (which,
in turn, calls the float package [Lin95]) and the fncychap package [Lin97]. It also
works with the hyperref package. Please send me any comments as to how you
think that the package can be improved, or of any interesting examples of how
you have used it.
1
1.1 L
A
T
E
X’s methods
This is a general description of how L
A
T
E
X does the processing for a Table of
Contents. As the processing for List of Figures and List of Tables is similar I will,
without loss of generality, just discuss the ToC.
L
A
T
E
X generates a .toc file if the document contains a \tableofcontents\addcontentsline
command. The sectioning commands
2
put entries into the .toc file by calling the
L
A
T
E
X \addcontentsline{hfilei}{hkindi}{htitlei} command, where hfilei is the
file extension (e.g., toc), hkindi is the kind of entry (e.g., section or subsection),
and htitlei is the (numberered) title text. In the cases where there is a number,
the htitlei argument is given in the form {\numberline{number} title-text}.
NOTE: The hyperref package dislikes authors using \addcontentsline. To get
it to work properly with hyperref you normally have to put \phantomsection (a
macro defined within the hyperref package) immediately before \addcontentsline.
The \addcontentsline command writes an entry to the given file in the form\contentsline
\contentsline{hkindi}{htitlei}{hpagei} where hpagei is the page number. For
each hkind i, L
A
T
E
X provides a command \l@kind{htitlei}{hpagei} which performs
the actual typesetting of the \contentsline entry.
The general layout of a typeset entry is illustrated in Figure 1. There are three\@pnumwidth
\@tocrmarg
\@dotsep
1
Thanks to Rowland ([email protected]), John Foster ([email protected]),
Kasper ([email protected]), Lee Nave ([email protected]), and Andrew Thurber
2
-
\linewidth
\@pnumwidth
\@tocrmarg
-
indent
-
numwidth
487title end
continue. . . . . . title
3.5 Heading. . . . . . title
............
-
\@dotsep
Figure 1: Layout of a ToC (LoF, LoT) entry
internal L
A
T
E
X commands that are used in the typesetting. The page number is
typeset flushright in a box of width \@pnumwidth, and the box is at the righthand
margin. If the page number is too long to fit into the box it will stick out into
the righthand margin. The title text is indented from the righthand margin by
an amount given by \@tocrmarg. Note that \@tocrmarg should be greater than
\@pnumwidth. Some entries are typeset with a dotted leader between the end of
the title title text and the righthand margin indentation. The distance, in math
units
3
between the dots in the leader is given by the value of \@dotsep. In the
standard classes the same values are used for the ToC, LoF and the LoT.
The standard values for these internal commands are:
\@pnumwidth = 1.55em
\@tocrmarg = 2.55em
\@dotsep = 4.5
The values can be changed by using \renewcommand, in spite of the fact that the
first two appear to be lengths.
Dotted leaders are not available for Part and Chapter ToC entries (nor for
Section entries in the article class and its derivatives).
Each \l@kind macro is responsible for setting the general indent from the\numberline
lefthand margin, and the numwidth. The \numberline{hnumber i} macro is re-
sponsible for typesetting the number flushleft in a box of width numwidth. If the
number is too long for the box then it will protrude into the title text. The title
text is indented by (indent + numwidth) from the lefthand margin. That is, the
title text is typeset in a block of width
(\linewidth - indent - numwidth - \@tocrmarg).
([email protected]) for their suggestions.
2
For figures and tables it is the \caption command that populates the .lof and .lot files.
3
There are 18mu to 1em.
3
Table 1: Indents and Numwidths (in ems)
Entry Level Chaptered Otherwise
indent numwidth indent numwidth
part -1 0 0
chapter 0 0 1.5
section 1 1.5 2.3 0 1.5
subsection 2 3.8 3.2 1.5 2.3
subsubsection 3 7.0 4.1 3.8 3.2
paragraph 4 10.0 5.0 7.0 4.1
subparagraph 5 12.0 6.0 10.0 5.0
figure/table (1) 1.5 2.3 1.5 2.3
Table 1 lists the standard values for the indent and numwidth. There is no
explicit numwidth for a part; instead a gap of 1em is put between the number
and the title text. Note that for a sectioning command the values depend on
whether or not the document class provides the \chapter command. Also, which
somewhat surprises me, the table and figure entries are all indented.
Most of the \l@kind commands are defined in terms of the \@dottedtocline\@dottedtocline
command. This command takes three arguments:
\@dottedtocline{hsecleveli}{hindenti}{hnumwidthi}.
For example, one definition of the \l@section command is:
\newcommand*{\l@section}{\@dottedtocline{1}{1.5em}{2.3em}}
If it is necessary to change the default typesetting of the entries, then it is usually
necessary to change these definitions (but the tocloft package gives you handles to
easily alter things without having to know the L
A
T
E
X internals).
You can use the \addcontentsline command to add \contentsline com-
mands to a file.
L
A
T
E
X also provides the \addtocontents{hfilei}{htexti} command that will\addtocontents
insert htext i into hfilei. You can use this for adding extra text and/or macros into
the file, for processing when the file is typeset by \tableofcontents (or whatever
other command is used for hfilei processing, such as \listoftables for a .lot
file).
As \addcontentsline and \addtocontents write their arguments to a file,
any fragile commands used in their arguments must be \protected.
You can make certain adjustments to the ToC etc., layout without using any
package. Some examples are:
If your page numbers stick out into the righthand margin
\renewcommand{\@pnumwidth}{3em} \renewcommand{\@tocrmarg}{4em}
but using lengths appropriate to your document.
4
To have the (sectional) titles in the ToC, etc., typeset ragged right with no
hyphenation
\renewcommand{\@tocrmarg}{2.55em plus1fil}
where the value 2.55em can be changed for whatever margin space you want.
The dots in the leaders can be eliminated by increasing \@dotsep to a large
value:
\renewcommand{\@dotsep}{10000}
To have dotted leaders in your ToC and LoF but not in your LoT:
...
\tableofcontents
\makeatletter \renewcommand{\@dotsep}{10000} \makeatother
\listoftables
\makeatletter \renewcommand{\@dotsep}{4.5} \makeatother
\listoffigures
...
For this document I used this method to double the dot spacing for the LoF
with respect to that for the ToC. As you can see, it is much better that all
dot leaders have the same spacing.
To add a horizontal line across the whole width of the ToC below an entry
for a Part:
\part{Part title}
\addtocontents{toc}{\protect\mbox{}\protect\hrulefill\par}
Note that as both \addtocontents and \addcontentsline write their ar-
guments to a file, it means that any fragile commands in their arguments
must be protected by preceding each fragile command with \protect. The
result of the example above would be the following two lines in the .toc file
(assuming that it is the second Part and is on page 34):
\contentsline {part}{II\hspace {1em}Part title}{34}
\mbox {}\hrulefill \par
If the \protects were not used, then the second line would instead be:
\unhbox \voidb@x \hbox {}\unhbox \voidb@x \leaders \hrule \hfill \kern \z@ \par
5
You may get undesired page breaks in the ToC. For example you may have
a long multiline section title and in the ToC there is a page break between
the lines. After your document is stable you can use \addtocontents at
appropriate places in the body of the document to adjust the page breaking
in the ToC. As examples:
\addtocontents{toc}{\protect\newpage} to force a page break.
\addtocontents{toc}{\protect\enlargethispage{2\baselineskip}}
to make the page longer.
\addtocontents{toc}{\protect\needspace{2\baselineskip}} to spec-
ify that if there is not a vertical space of two baselines left on the page
then start a new page (the \needspace macro is defined in the needspace
package).
Remember, if you are modifying any command that includes an @ sign then this
must be done in either a .sty file or if in the document itself it must be sur-
rounded by \makeatletter and \makeatother. For example, if you want to
modify \@dotsep in the preamble to your document you have to do it like this:
\makeatletter
\renewcommand{\@dotsep}{9.0}
\makeatother
2 The tocloft package
The tocloft package provides means of specifying the typography of the Table of
Contents (ToC), the List of Figures (LoF) and the List of Tables (LoT).
The ToC, LoF, and LoT are printed at the point in the document where these\tableofcontents
\listoffigures
\listoftables
commands are called, as per normal L
A
T
E
X. However, there is one difference be-
tween the standard L
A
T
E
X behaviour and the behaviour with the tocloft package.
In the standard L
A
T
E
X classes that have \chapter headings, the ToC, LoF and
LoT each appear on a new page. With the tocloft package they do not necessarily
start new pages; if you want them to be on new pages you may have to specifically
issue an appropriate command beforehand. For example:
...
\clearpage
\tableofcontents
\clearpage
\listoftables
...
The \thispagestyle page style of the ToC, LoF and/or LoT is set by the\tocloftpagestyle
command \tocloftpagestyle{hstylei}, where hstylei is one of the available page
styles. The package initially sets \tocloftpagestyle{plain}.
6
2.1 Package options
The package takes the following options:
subfigure This option is required if, and only if, the tocloft and subfigure packages are
being used together. The two packages can be specified in any order.
titles The titles option causes the titles of the ToC, LoF, and LoT lists to be
typeset using the default L
A
T
E
X methods. This can be useful, for example,
when the tocloft and fncychap packages are used together and the ‘fancy’
chapter styles should be used for the ToC, etc., titles.
If you use the titles option you can ignore the next section and continue reading
at section 2.3.
2.2 Changing the titles
Commands are provided for controlling the appearance of the titles. Fol-
lowing L
A
T
E
X custom, the title texts are the values of the \contentsname,
\listfigurename and \listtablename commands.
Similar sets of commands are provided for ToC, LoF and LoT title typsetting
control. For convenience (certainly mine, and hopefully yours) in the following
descriptions I will use Z to stand for ‘toc’ or ‘lof’ or ‘lot’. For example, \cftmarkZ
stands for \cftmarktoc or \cftmarklof or \cftmarklot.
These macros set the appearance of the running heads on the ToC, LoF, and\cftmarkZ
LoT pages. You probably don’t need to change these.
These lengths control the vertical spacing before and after the titles. You can\cftbeforeZtitleskip
\cftafterZtitleskip change them from their default values by using \setlength.
The code used for typesetting the ToC title looks like\cftZtitlefont
\cftafterZtitle
{\cfttoctitlefont \contentsname}{\cftaftertoctitle}\par
By default, \cftZtitlefont is defined as a font specification (e.g., \Large\bfseries),
and \cftafterZtitle is empty. These commands can be changed (via \renewcommand)
to change the typesetting. As examples:
\renewcommand{\cftZtitlefont}{\hfill\Large\itshape} will result in
a Large italic title typeset flushright.
\renewcommand{\cftZtitlefont}{\hfill\Large\bfseries} together with
\renewcommand{\cftafterZtitle}{\hfill} will give a centered Large
bold title.
Doing
\renewcommand{\cftafterZtitle}{%
\\[\baselineskip]\mbox{}\hfill{\normalfont Page}}
7
will put the word ‘Page’ flushright on the line following the title. (If you do
this, then you may need to decrease \cftafterZtitleskip).
\renewcommand{\cftafterZtitle}{\thispagestyle{empty}} will make
the page with the title empty (i.e., the page number will not be printed).
2.3 Typesetting the entries
Commands are also provided to enable finer control over the typesetting of the
different kinds of entries. The parameters defining the default layout of the entries
are illustrated as part of the layouts package or in [GMS94, page 34], and are
repeated in Figure 1.
The command \Zdepth{hnumberi} is analogous to the standard \tocdepth{hnumberi}\Zdepth
command, in that it specifies that entries in the new listing should not be type-
set if their numbering level is greater than hnumberi. The default definition is
\setcounter{Zdepth}{1}. These commands are needed, for instance by users of
packages such as subcaption, which will generate subfigure and subtable captions
corresponding to a lofdepth and lotdepth of 2.
In the default ToC typesetting only the more minor entries have dotted leader\cftdot
lines between the sectioning title and the page number. The tocloft package pro-
vides for general leaders for all entries. The ‘dot’ in a leader is given by the value
of \cftdot. Its default definition is \newcommand{\cftdot}{.} which gives the
default dotted leader. By changing \cftdot you can use symbols other than a
period in the leader. For example
\renewcommand{\cftdot}{\ensuremath{\ast}}
will result in a dotted leader using asterisks as the symbol.
Each kind of entry can control the separation between the dots in its leader\cftdotsep
\cftnodots (see below). For consistency though, all dotted leaders should use the same spac-
ing. The macro \cftdotsep specifies the default spacing. Its value is a number.
However, if the separation is too large then no dots will be actually typeset. The
macro \cftnodots is a separation value that is ‘too large’.
The page numbers are typeset in a fixed width box. The command\cftsetpnumwidth
\cftsetrmarg \cftsetpnumwidth{hlengthi} can be used to change the width of the box (L
A
T
E
X’s
internal \@pnumwidth). The title texts will end before reaching the righthand mar-
gin. \cftsetrmarg{hlengthi} can be used to set this distance (L
A
T
E
X’s internal
\@tocrmarg). Note that the length used in \cftsetrmarg should be greater than
the length set in \cftsetpnumwidth. These values should remain constant in any
given document.
The page numbers are typeset in a box as described above. By default they\cftpnumalign
are right-aligned which is suitable when the page numbers are aligned vertically
on the page so their digits line up. For a design with fixed width between a ToC
entry and its page number, say, a left alignment may be more suitable. This can be
controlled by setting the \cftpnumalign macro to l, c, or r (just like \makebox):
\renewcommand{\cftpnumalign}{l}
8
Normally the \parskip in the ToC, etc., is zero. This may be changed by\cftparskip
changing the \cftparskip length. Note that the current value of \cftparskip
is used for the ToC, LoF and LoT, but you can change the value before calling
\tableofcontents or \listoffigures or \listoftables if one or other of these
should have different values (which is not a good idea).
In the following I will use X to stand for the following:
part for \part titles
chap for \chapter titles
sec for \section titles
subsec for \subsection titles
subsubsec for \subsubsection titles
para for \paragraph titles
subpara for \subparagraph titles
fig for figure \caption titles
subfig for subfigure \caption titles
tab for table \caption titles
subtab for subtable \caption titles
This controls the vertical space before an entry. It can be changed by using\cftbeforeXskip
\setlength.
This controls the indentation of an entry from the left margin (indent in Fig-\cftXindent
ure 1). It can be changed using \setlength.
This controls the space allowed for typesetting title numbers (numwidth in\cftXnumwidth
Figure 1). It can be changed using \setlength. Second and subsequent lines of
a multiline title will be indented by this amount.
The remaining commands are related to the specifics of typesetting an en-
try. This is a simplified pseudo-code version for the typesetting of numbered and
unnumbered entries.
{\cftXfont {\cftXpresnum SNUM\cftXaftersnum\hfil} \cftXaftersnumb TITLE}%
{\cftXleader}{\cftXpagefont PAGE}\cftXafterpnum\par
{\cftXfont TITLE}{\cftXleader}{\cftXpagefont PAGE}\cftXafterpnum\par
where SNUM is the section number, TITLE is the title text and PAGE is the page
number. In the numbered entry the pseudo-code
{\cftXpresnum SNUM\cftaftersnum\hfil}
is typeset within a box of width \cftXnumwidth.
9
This controls the appearance of the title (and its preceding number, if any). It\cftXfont
may be changed using \renewcommand.
Normally the section number is typeset within a box of width \cftXnumwidth.\cftXpresnum
\cftXaftersnum
\cftXaftersnumb
Within the box the macro \cftXpresnum is first called, then the number is typeset,
and next the \cftXaftersnum macro is called after the number is typeset. The
last command within the box is \hfil to make the box contents flushleft. After
the box is typeset the \cftXaftersnumb macro is called before typesetting the
title text. All three of these can be changed by \renewcommand. By default they
are defined to do nothing.
In the standard classes the ToC entry for a \part is just typeset as the num-
ber and title, followed by the page number, with the \cftpartpresnum macro
being called before typesetting the number and title. Due to L
A
T
E
X ideosyncra-
cies, \cftpartpresnum may become doubled in the output if a third-party package
behaves differently to that of the default internal L
A
T
E
X commands. The tocloft
package contains specific code to prevent this in the case of the KomaScript classes
and for the titlesec package; please contact the maintainer to add further cor-
rections if you discover other packages which also exhibit this mis-behaviour.
When a standard class is used the \cftpartaftersnum and \cftpartaftersnumb
macros have no effect, but they may do something if a non-standard class is used.
\cftXleader defines the leader between the title and the page number; it\cftXleader
\cftXdotsep can be changed by \renewcommand. The spacing between any dots in the leader
is controlled by \cftXdotsep (\@dotsep in Figure 1). It can be changed by
\renewcommand and its value must be either a number (e.g., 6.6 or \cftdotsep)
or \cftnodots (to disable the dots). The spacing is in terms of math units where
there are 18mu to 1em.
This defines the font to be used for typesetting the page number. It can be\cftXpagefont
changed by \renewcommand.
This macro is called after the page number has been typeset. Its default is to\cftXafterpnum
do nothing. It can be changed by \renewcommand.
The command \cftsetindents{hentryi}{hindenti}{hnumwidthi} sets the\cftsetindents
hentryi’s indent to the length hindenti and its numwidth to the length hnumwidthi.
The hentryi argument is the name of one of the standard entries (e.g., subsection)
or the name of entry that has been defined with the tocloft package. For example
\cftsetindents{figure}{0em}{1.5em}
will make figure entries left justified.
Various effects can be achieved by changing the definitions of \cftXfont,
\cftXaftersnum, \cftXaftersnumb, \cftXleader and \cftXafterpnum, either
singly or in combination. For the sake of some examples, assume that we have the
following initial definitions
\newcommand{\cftXfont}{}
\newcommand{\cftXaftersnum}{}
\newcommand{\cftXaftersnumb}{}
\newcommand{\cftXleader}{\cftdotfill{\cftXdotsep}}
\newcommand{\cftXdotsep}{\cftdotsep}
\newcommand{\cftXpagefont}{}
\newcommand{\cftXafterpnum}{}
10
(Note that the same font should be used for the title, leader and page number to
provide a coherent appearance).
To eliminate the dots in the leader:
\renewcommand{\cftXdotsep}{\cftnodots}
To put something (e.g., a name) before the title (number):
\renewcommand{\cftXpresnum}{SOMETHING }
To add a colon after the section number:
\renewcommand{\cftXaftersnum}{:}
To put something before the title number, add a colon after the the title
number, set everything in bold font, and start the title text on the following
line:
\renewcommand{\cftXfont}{\bfseries}
\renewcommand{\cftXleader}{\bfseries\cftdotfill{\cftXdotsep}}
\renewcommand{\cftXpagefont}{\bfseries}
\renewcommand{\cftXpresnum}{SOMETHING }
\renewcommand{\cftXaftersnum}{:}
\renewcommand{\cftXaftersnumb}{\\}
If you are adding text in the number box in addition to the number, then
you will probably have to increase the width of the box so that multiline
titles have a neat vertical alignment; changing box widths usually implies
that the indents will require modification as well.
4
One possible method of
adjusting the box width for the above example is:
\newlength{\mylen} % a "scratch" length
\settowidth{\mylen}{\bfseries\cftXpresnum\cftXaftersnum} % extra space
\addtolength{\cftXnumwidth}{\mylen} % add the extra space
To set the section numbers flushright:
5
\setlength{\mylen}{0.5em} % need some extra space at end of number
\renewcommand{\cftXpresnum}{\hfill} % note the double ‘l’
\renewcommand{\cftXaftersnum}{\hspace*{\mylen}}
\addtolength{\cftXnumwidth}{\mylen}
4
Lyndon Dudding ([email protected]) discovered this.
5
With thanks to David Holz ([email protected]) for requesting this.
11
In the above, the added initial \hfill in the box overrides the final \hfil
in the box, thus shifting everything to the right hand end of the box. The
extra space is so that the number is not typeset immediately at the left of
the title text.
To set the entry ragged left (but this only looks good for single line titles):
\renewcommand{\cftXfont}{\hfill\bfseries}
\renewcommand{\cftXleader}{}
To set the page number immediately after the entry text instead of at the
righthand margin:
\renewcommand{\cftXleader}{}
\renewcommand{\cftXafterpnum}{\cftparfillskip}
\renewcommand{\cftpnumalign}{l}
By default the \parfillskip value is locally set to fill up the last line of a
paragraph. Just changing \cftXleader puts horrible interword spaces into
the last line of the title. The \cftparfillskip command is part of the
tocloft package and is provided just so that the above effect can be achieved.
In addition, this is a good example of when it would be suitable to change
the alignment of the page number box.
To remove the space inserted between table and figure caption entries be-
tween chapters:
\begingroup
\renewcommand*{\addvspace}[1]{}
\listoftables
\listoffigures
\endgroup
The command \cftpagenumbersoff{hentryi} will eliminate the page numbers\cftpagenumbersoff
\cftpagenumberson for hentryi in the listing, where hentryi is the name of one of the standard kinds
of entries (e.g., subsection, or figure including subfigure if the subfigure
package is used etc.), or the name of a new entry defined with the tocloft
package.
The command \cftpagenumberson{hentryi} reverses the effect of a corre-
sponding \cftpagenumbersoff.
One question that appeared on the comp.text.tex newsgroup asked how to
get the titles of Appendices list in the ToC without page numbers. Here is a simple
way of doing it, assuming the document has chapters
...
12
\appendix
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\chapter{First appendix}
If there are other chaptered headings to go into the ToC after the appendices, then
it will be necessary to do a similar
\addtocontents{toc}{\cftpagenumberson{chapter}}
to restore the page numbering in the ToC.
Similarly, if you are using the subfigure package you may want to eliminate the
page numbers for the subfigure captions. This can be accomplished by:
\cftpagenumbersoff{subfigure}
At this point, I leave it up to your ingenuity as to other effects that you can
achieve. However, if you come up with further examples, let me know for possible
inclusion in a later version of this document.
2.4 New list of. . .
The command \newlistof[hwithini]{hentryi}{hexti}{hlistofnamei} creates a\newlistof
new List of . . . , and assorted commands to go along with it.
The first required argument, hentryi is used to define a new counter called
entry. The optional hwithini argument can be used so that entry gets reset
to one every time the counter called within is changed. That is, the first two
arguments are equivalent to calling \newcounter{hentryi}[hwithini].
The next argument, hext i, is the file extension for the new List of. The last
argument, hlistofnamei, is the text for the heading of the new List of. As an
example:
\newcommand{\listanswername}{List of Answers}
\newlistof[chapter]{answer}{ans}{\listanswername}
will create a new answer counter that will be reset at the start of each
\chapter{...}. Any answer titles will be written to the file jobname.ans and
\listanswername will be used as the list heading. A command \listofanswer
is created which can be used just like the \listoftables or tableofcontents
commands to generate a listing. It is up to you to specify how the entries are put
into the new List of Answers. Here is a very simple example, remembering that
an answer counter has been created.
\newcommand{\answer}[1]{%
\refstepcounter{answer}
\par\noindent\textbf{Answer \theanswer. #1}
\addcontentsline{ans}{answer}{\protect\numberline{\theanswer}#1}\par}
which, when used like:
\answer{Hard} The \ldots will print as:
Answer 1. Hard
13
The . . .
As mentioned above, the \newlistof command creates several new commands,
most of which you should now be familiar with. For convenience, assume that
\newlistof{X}{Z}{...} has been issued; so X is the name of the new counter and
corresponds to the X in section 2.3, and Z is the new file extension and corresponds
to the Z in section 2.2. Then, among others, the following new commands will be
made available.
The five commands, \cftmarkZ, \cftbeforeZtitleskip, \cftafterZtitleskip,
\cftZtitlefont, and \cftafterZtitle, are analogous to the commands of the
same names described in section 2.2.
The command \listofX is similar to \listoftables, etc., in that it typesets\listofX
the new listing at the point where it is called.
The command \Zdepth{hnumberi} is analogous to the standard \tocdepth{hnumberi}\Zdepth
command, in that it specifies that entries in the new listing should not be type-
set if their numbering level is greater than hnumberi. The default definition is
\setcounter{Zdepth}{1}.
The command \newlistentry[hwithini]{hentryi}{hexti}{hlevel-1 i} creates\newlistentry
new commands for typesetting a new kind of entry in a listing. It is used in-
ternally by the \newlistof command but may be used independently.
The first required argument, hentryi is used to define a new counter called
entry. The optional hwithini argument can be used so that entry gets reset to
one every time the counter called within is changed. That is, the first two ar-
guments are equivalent to calling \newcounter{hentryi}[hwithini]. The second
required argument, hexti, is the file extension for the entry listing. The last ar-
gument, hlevel-1 i, is a number specifying the numbering level minus one, of the
entry in a listing. For example, the command
\newlistof[chapter]{answer}{ans}{\listanswername}
will call the command:
\newlistentry[chapter]{answer}{ans}{0}
Calling \newlistentry creates several new commands. Assuming that it is
called as \newlistentry[within]{X}{Z}{N}, where X and Z are similar to the
previous uses of them, and N is an integer number, then the following commands
are made available.
The set of commands \cftbeforeXskip, \cftXfont, \cftXpresnum, \cftXaftersnum,
\cftXaftersnumb, \cftXleader, \cftXdotsep, \cftXpagefont, and \cftXafterpnum,
are analogous to the commands of the same names described in section 2.3. Their
default values are also as described earlier.
The default values of \cftXindent and \cftXnumwidth are set according to
the value of the hlevel-1 i argument (i.e., N in this example). For N=0 the set-
tings correspond to those for sections in non-chaptered documents, as listed in
Table 1. For N=4 the settings correspond to subparagraphs in non-chaptered doc-
uments, and for intermediate values correspond to the matching sectional division
in chaptered documents. For values of N less than zero or greater than four, or for
non-default values, use the \cftsetindents command to set the values.
\l@X is an internal command that typesets an entry in the list, and is defined\l@X
14
in terms of the above \cft*X* commands. It will not typeset an entry if \Zdepth
is N or less, where Z is the listing’s file extension.
The command \theX prints the value of the X counter. It is initially defined so\theX
that it prints arabic numerals. If the optional hwithini argument is used, \theX is
defined as
\renewcommand{\theX}{\thewithin.\arabic{X}} otherwise as
\renewcommand{\theX}{\arabic{X}}.
As an example of the independent use of \newlistentry, the following will
set up for sub-answers.
\newlistentry[answer]{subanswer}{1}
\cftsetindents{subanswer}{1.5em}{3.0em}
\renewcommand{\thesubanswer}{\theanswer.\alph{subanswer}}
\newcommand{\subanswer}[1]{%
\refstepcounter{subanswer}
\par\textbf{\thesubanswer) #1}
\addcontentsline{ans}{subanswer{\protect\numberline{\thesubanswer}#1}}
\setcounter{ansdepth}{2}
And then:
\answer{Harder} The \ldots
\subanswer{Reformulate the problem} It assists \ldots
will be typeset as:
Answer 2. Harder
The . . .
2.a) Reformulate the problem It assists . . .
By default the answer entries will appear in the List of Answers listing (typeset
by the \listofanswer command). In order to get the subanswers to appear, the
\setcounter{ansdepth}{2} command was used above.
To turn off page numbering for the subanswers, do
\cftpagenumbersoff{subanswer}
As another example of \newlistentry, suppose that an extra sectioning divi-
sion below subparagraph is required, called subsubpara. The \subsubpara com-
mand itself can be defined via the LaTeX kernel \@startsection command. Also
it is necessary to define a \subsubparamark macro, a new subsubpara counter, a
\thesubsubpara macro and a \l@subsubpara macro. Using the tocloft package’s
\newlistentry takes care of most of these as shown below (remember the caveats
about commands with @ signs in them).
\newcommand{\subsubpara}{\@startsection{subpara}%
{6}% level
{\parindent}% indent from left margin
{3.25ex \@plus1ex \@minus .2ex}% skip above heading
{-1em}% runin heading with 1em between title & text
{\normalfont\normalsize\itshape}% italic number and title
15
}
\newlistentry[subparagraph]{subsubpara}{toc}{5}
\cftsetindents{subsubpara}{14.0em}{7.0em}
\newcommand*{\subsubparamark}[1]{} % gobble heading mark
Each List of. . . uses a file to store the list entries, and these files must remain
open for writing throughout the document processing. TeX has only a limited
number of files that it can keep open, and this puts a limit on the number of
listings that can be used. For a document that includes a ToC but no other extra
ancillary files (e.g., no index or bibliography output files) the maximum number
of LoX’s, including a LoF and LoT, is no more than about eleven. If you try and
create too many new listings LaTeX will respond with the error message:
No room for a new write
If you get such a message the only recourse is to redesign your document.
The tocloft package does not provide a simple means of specifying new Lists of
Floats or float environments. For those, I recommend the ccaption package [Wil01].
2.5 Experimental utilities
The macros described in this section are even more experimental than those de-
scribed previously.
Some old style novels, and even some modern text books,
6
include a short\cftchapterprecis
synopsis of the contents of the chapter either immediately after the chapter heading
or in the Toc, or in both places.
The command \cftchapterprecis{htexti} prints its argument both at the
point in the document where it is called, and also adds it to the .toc file. For
example:
...
\chapter{} % first chapter
\cftchapterprecis{Our hero is introduced; family tree; early days.}
...
The \cftchapterprecis command calls these two commands to print the text\cftchapterprecishere
\cftchapterprecistoc in the document (the \...here{htext i} command) and to put it into the ToC (the
\...toc{htexti} command). These can be used individually if required.
Sometimes it may be desirable to make a change to the global parameters for
an individual entry. For example, a figure might be placed on the end paper of
a book (the inside of the front or back cover), and this needs to be placed in a
LoF with the page number set as, say ‘inside front cover’. If ‘inside front cover’ is
typeset as an ordinary page number it will stick out into the margin. Therefore,
the parameters for this particular entry need to be changed.
The command \cftlocalchange{hfilei}{hpnumwidthi}{htocrmargi} will write\cftlocalchange
6
For example, Robert Sedgewick, Algorithms, Addison-Wesley, 1983.
16
an entry into hfilei to reset the global parameters. The command should be called
again after any special entry to reset the parameters back to their usual values.
Any fragile commands used in the arguments must be protected.
The command \cftaddtitleline{hfilei}{hkindi}{htitlei}{hpagei} will write\cftaddtitleline
a \contentsline entry into hfilei for a hkind i entry with title htitlei and page
number hpagei. That is, an entry is made of the form:
\contentsline{kind}{title}{page}
Any fragile commands used in the arguments must be protected.
The command \cftaddnumtitleline{hfilei}{hkindi}{hnumi}{htitlei}{hpagei}\cftaddnumtitleline
is similar except that it also includes hnumi as the argument to the \numberline.
That is, an entry is made of the form:
\contentsline{kind}{\numberline{num} title}{page}
Any fragile commands used in the arguments must be protected.
As an example of the use of these commands, noting that the default L
A
T
E
X
values for \@pnumwidth and \@tocrmarg are 1.55em and 2.55em respectively, one
might do the following for a figure on the frontispiece page.
...
% this is the frontispiece page with no number
% draw or import the picture (with no \caption)
\cftlocalchange{lof}{4em}{5em} % make pnumwidth big enough for
% frontispiece and change margin to suit
\cftaddtitleline{lof}{figure}{The title}{frontispiece}
\cftlocalchange{lof}{1.55em}{2.55em} % return to normal settings
...
Recall that a \caption command will put an entry in the .lof file, which is
not wanted here. If a caption is required, then you can either craft one your-
self or, assuming that your general captions are not too exotic, use the \legend
command from the ccaption package. If the illustration is numbered, use the
\cftaddnumtitleline command instead of \cftaddtitleline.
It’s surprisingly difficult to achieve multicolumn ToCs; can you guess what the\cftZprehook
\cftZposthook problem is to write the following?
\begin{multicols}{2}
\tableofcontents
\end{multicols}
Probably the easiest way to do it in regular L
A
T
E
X is something like
\RequirePackage{multicol}
\AtBeginDocument{\addtocontents{toc}{\protect\begin{multicols}{2}}}
\AtEndDocument {\addtocontents{toc}{\protect\end {multicols}}}
This method of writing to the .toc file is most flexible for trying to control the
typesetting output within the table of contents.
17
To make this slightly easier with tocloft, the following macros are available:
\cftZprehook and \cftZprehook, where Z is toc, lof, lot, etc. If these are
defined, they insert material just before the actual typesetting of the entries of the
table of contents and so on. A multicolumn ToC can therefore be achieved with
this:
\RequirePackage{multicol}
\renewcommand\cfttocprehook{\begin{multicols}{2}}
\renewcommand\cfttocposthook{\end{multicols}}
2.6 Usage with other packages
The tocloft and tocbibind packages can be used together in the same document.
The tocbibind package provides easy means of adding document elements like the
bibliography or the index to the Table of Contents. However there is one known
potential problem:
If the argument to the \tocotherhead command is other than one of the
normal sectioning divisions (i.e., part through to sub-paragraph) such as
\tocotherhead{clause}, then this will almost certainly cause a problem (as
the tocloft package will not know how to define the corresponding \l@clause
command). In such a case you will have to supply the appropriate macros
yourself.
Some packages, like the float package by Anselm Lingnau, enable the creation of\@cftbsnum
\@cftasnum
\@cftasnumb
other kinds of List of . . . . The tocloft package is only minimally able to change the
formatting of these, principally because the packages are independent of each other
and, in the case of the float package, new kinds of float environments and their
associated lists can be created on the fly at any point in a document. Some aspects
of the typesetting are controlled by \@cftbsnum, \@cftasnum and \@cftasnumb
commands. These are equivalent to the \cftXpresnum, \cftXaftersnum and
\cftXaftersnumb commands described earlier. By default they are defined to do
nothing, but may be renewed to do something.
The tocloft and minitoc packages have an unfortunate interaction,
7
which for-
tunately can be fixed. In the normal course of events, when minitoc is used in a
chaptered document it will typeset section entries in the minitocs in bold font. If
tocloft is used in conjunction with minitoc, then the minitoc section entries are
typeset in the normal font, except for the page numbers which are in bold font,
while the ToC section entries are all in normal font.
One cure, if you want the minitoc section entries to be all in normal font is to
put:
\renewcommand{\mtcSfont}{\small\normalfont}
7
Discovered by Lyndon Dudding ([email protected]).
18
in the preamble.
Otherwise, the cure is the following incantation:
\renewcommand{\cftsecfont}{\bfseries}
\renewcommand{\cftsecleader}{\bfseries\cftdotfill{\cftdotsep}}
\renewcommand{\cftsecpagefont}{\bfseries}
To have the section entries in both the ToC and the minitocs in bold then put
the incantation in the preamble. To have only the minitoc section entries in bold
while the ToC entries are in the normal font, put the incantation between the
\tableofcontents command and the first \chapter command.
In general, use with other packages that redefine any of the macros that tocloft
also modifies is likely to be problematic.
3 The package code
1 h*usci
In order to try and avoid name clashes with other packages, each internal name
will include the character string @cft.
\@cftifundefined Due to a conflict with how this package and fancyhdr checked for undefinedness.
2 \newcommand\@cftifundefined[1]{%
3 \begingroup\expandafter\expandafter\expandafter\endgroup
4 \expandafter\ifx\csname #1\endcsname\relax
5 \expandafter\@firstoftwo
6 \else
7 \expandafter\@secondoftwo
8 \fi}
\@cftquit
\if@cfthaschapter
We will be using either chapter or section type headings for the ToC, etc., so we
need to know which of these the document class supports.
9 \newcommand{\@cftquit}{}
10 \newif\if@cfthaschapter
\if@cftkoma The koma classes have different defaults than the standard classes, so we need to
know if a koma class has been loaded.
11 \newif\if@cftkoma
12 \@cftkomafalse
13 \@ifclassloaded{scrartcl}{\@cftkomatrue}{}
14 \@ifclassloaded{scrreprt}{\@cftkomatrue}{}
15 \@ifclassloaded{scrbook}{\@cftkomatrue}{}
\if@cfttitlesec
16 \newif\if@cfttitlesec
17 \AtBeginDocument{\@ifpackageloaded{titlesec}{\@cfttitlesectrue}{}}
19
Issue a warning if there are no recognised sectional divisions and then skip the
rest of the package code.
18 \@cftifundefined{chapter}{%
19 \@cfthaschapterfalse
20 \@cftifundefined{section}{%
21 \PackageWarning{tocloft}%
22 {I don’t recognize any sectional divisions so I’ll do nothing}
23 \renewcommand{\@cftquit}{\endinput}
24 }{\PackageInfo{tocloft}{The document has section divisions}}
25 }{\@cfthaschaptertrue
26 \PackageInfo{tocloft}{The document has chapter divisions}}
Perhaps quit now.
27 \@cftquit
Use chapter style if \if@cfthaschapter is TRUE, otherwise section style.
\if@cfttocbibind A flag that is set TRUE iff the tocbibind package has been loaded. The 1998/11/15
version of tocbibind does not necessarily work well with tocloft.
28 \newif\if@cfttocbibind
29 \AtBeginDocument{%
30 \@ifpackageloaded{tocbibind}{\@cfttocbibindtrue}{\@cfttocbibindfalse}
31 \if@cfttocbibind
32 \@ifpackagelater{tocbibind}{1998/11/16}{}{%
33 \PackageWarning{tocloft}{%
34 You are using a version of the tocbibind package\MessageBreak
35 that is not compatible with tocloft.\MessageBreak
36 The results may be surprising.\MessageBreak
37 Consider installing the current version of tocbibind.}}
38 \fi
39 }
\if@cftnctoc A boolean used to implement the titles option. It is TRUE if the ToC, LoT, LoF
titles should use the default styles.
40 \newif\if@cftnctoc\@cftnctocfalse
41 \DeclareOption{titles}{\@cftnctoctrue}
42 %% \ProcessOptions\relax
\if@cftsubfigopt A boolean used to implement the subfigure option.
43 \newif\if@cftsubfigopt\@cftsubfigoptfalse
44 \DeclareOption{subfigure}{\@cftsubfigopttrue}
Process the options.
45
46 \ProcessOptions\relax
47
\tocloftpagestyle
\@cftpagestyle
A user-level macro to set the pagestyle for the first page of the ToC, etc. The
default is the plain pagestyle.
20
48 \newcommand{\tocloftpagestyle}[1]{%
49 \def\@cftpagestyle{\thispagestyle{#1}}}
50 \tocloftpagestyle{plain}
51
\cftmarktoc
\cftmarklof
\cftmarklot
These three macros set the style for running heads. They are initialised to give
the default appearance.
52 \newcommand{\cftmarktoc}{%
53 \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
54 \newcommand{\cftmarklof}{%
55 \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}}
56 \newcommand{\cftmarklot}{%
57 \@mkboth{\MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
58 \if@cftkoma
59 \renewcommand{\cftmarktoc}{%
60 \@mkboth{\contentsname}{\contentsname}}
61 \renewcommand{\cftmarklof}{%
62 \@mkboth{\listfigurename}{\listfigurename}}
63 \renewcommand{\cftmarklot}{%
64 \@mkboth{\listtablename}{\listtablename}}
65 \fi
\@cfttocstart
\@cfttocfinish
Two macros to perform the actions at the beginning and end of the \tableofcontents
command (and friends). \@cfttocstart deals with chaptered documents, ensur-
ing that the ToC is typeset in a single column (see classes.dtx for the original
code). These macros are also provided by the ccaption package.
66 \providecommand{\@cfttocstart}{%
67 \if@cfthaschapter
68 \if@twocolumn
69 \@restonecoltrue\onecolumn
70 \else
71 \@restonecolfalse
72 \fi
73 \fi}
\@cfttocfinish resets, if required, twocolumn typesetting.
74 \providecommand{\@cfttocfinish}{%
75 \if@cfthaschapter
76 \if@restonecol\twocolumn\fi
77 \fi}
\phantomsection This is provided because the hyperref package screws with \addcontentsline.
78 \providecommand{\phantomsection}{}
79
\@cftdobibtoc If the tocbibind package has been used and it has redefined \tableofcontents we
need to cater for that. The contents of the definition are defined in tocbibind.
80 \newcommand{\@cftdobibtoc}{%
81 \if@dotoctoc
21
82 \if@bibchapter
83 \phantomsection
84 \addcontentsline{toc}{chapter}{\contentsname}
85 \else
86 \phantomsection
87 \addcontentsline{toc}{\@tocextra}{\contentsname}
88 \fi
89 \fi}
90
\cftparskip The \parskip local to the ToC, etc., is set to the length \cftparskip.
91 \newlength{\cftparskip}
92 \setlength{\cftparskip}{0pt}
93
\tableofcontents This is a parameterised version of the default \tableofcontents command. Each
class has its own definition, but we have to cater for all classes in one definition,
hence some of the checks. The definition is modified after all packages have been
loaded.
If the titles option has been used, then the command is not modified.
94 \AtBeginDocument{%
95 \if@cftnctoc
96 % ensure \cftparskip is still set properly
97 \let\OLD@starttoc\@starttoc
98 \renewcommand{\@starttoc}[1]{%
99 \begingroup
100 \parskip=\cftparskip
101 \OLD@starttoc{#1}%
102 \endgroup
103 }
104 \else
105 \renewcommand{\tableofcontents}{%
106 \@cfttocstart
Ensure that any previous paragraph has been finished. Within a group set the
local paragraphing style and typeset the title.
107 \par
108 \begingroup
109 \parindent\z@ \parskip\cftparskip
110 \@cftmaketoctitle
If tocbibind has been used, then add the ToC name to the ToC.
111 \if@cfttocbibind
112 \@cftdobibtoc
113 \fi
Finally, read the .toc file and finish up.
114 \@starttoc{toc}%
115 \endgroup
116 \@cfttocfinish}
22
117 \fi
118 }
\@cftmaketoctitle This command typesets the title for the ToC.
119 \newcommand{\@cftmaketoctitle}{%
120 \addpenalty\@secpenalty
121 \if@cfthaschapter
122 \vspace*{\cftbeforetoctitleskip}%
123 \else
124 \vspace{\cftbeforetoctitleskip}%
125 \fi
126 \@cftpagestyle
127 {\interlinepenalty\@M
128 {\cfttoctitlefont\contentsname}{\cftaftertoctitle}%
129 \cftmarktoc
130 \par\nobreak
131 \vskip \cftaftertoctitleskip
132 \@afterheading}}
\cftbeforetoctitleskip
\cftaftertoctitleskip
These two lengths control the vertical spacing before and after the ToC title.
133 \newlength{\cftbeforetoctitleskip}
134 \newlength{\cftaftertoctitleskip}
Their values depend on whether the document has chapters or not. In chap-
tered documents the default ToC title is typeset as a \chapter*, otherwise as a
\section*.
135 \if@cfthaschapter
136 \setlength{\cftbeforetoctitleskip}{50pt}
137 \setlength{\cftaftertoctitleskip}{40pt}
138 \else
139 \setlength{\cftbeforetoctitleskip}{3.5ex \@plus 1ex \@minus .2ex}
140 \setlength{\cftaftertoctitleskip}{2.3ex \@plus.2ex}
141 \fi
\cfttoctitlefont
\cftaftertoctitle
The ToC title is typeset in the style given by \cfttoctitlefont. The macro
\cftaftertoctitle is called after typesetting the title. This is initialised to do
nothing. Both these macros can be redefined to do other things (e.g., adding an
\hfill to \cfttoctitlefont will make the title flushright).
142 \if@cfthaschapter
143 \newcommand{\cfttoctitlefont}{\normalfont\Huge\bfseries}
144 \if@cftkoma\renewcommand{\cfttoctitlefont}{\size@chapter\sectfont}\fi
145 \else
146 \newcommand{\cfttoctitlefont}{\normalfont\Large\bfseries}
147 \if@cftkoma\renewcommand{\cfttoctitlefont}{\size@section\sectfont}\fi
148 \fi
149 \newcommand{\cftaftertoctitle}{}
\cftsetpnumwidth
\cftsetrmarg
Users commands for setting \@pnumwidth and \@tocrmarg.
150 \newcommand{\cftsetpnumwidth}[1]{\renewcommand{\@pnumwidth}{#1}}
151 \newcommand{\cftsetrmarg}[1]{\renewcommand{\@tocrmarg}{#1}}
23
\cftpnumalign Alignment string (as input to \makebox for the page number box.
152 \newcommand{\cftpnumalign}{r}
\cftdot
\cftdotfill
In the default ToC, a dotted line can be used to provide a leader between a title and
the page number. The definition of this leader is buried in the \@dottedtocline
command. The \cftdotfill{hsepi} command provides a parameterised version
of the leader code, where hsepi is the separation between the dots in mu units.
The symbol used for the ‘dots’ in the leader is given by the value of \cftdot.
These macros are also provided by the ccaption package.
153 \providecommand{\cftdot}{.}
154 \providecommand{\cftdotfill}[1]{%
155 \def\@tempa{#1}%
156 \def\@tempb{\cftnodots}%
157 \ifx\@tempa\@tempb
158 \hfill
159 \else
160 \leaders\hbox{$\m@th\mkern #1 mu\hbox{\cftdot}\mkern #1 mu$}\hfill
161 \fi
162 }
\cftdotsep
\cftnodots
\cftdotsep holds the default dot separation, and is also provided by the ccaption
package. If the kerns in \cftdotfill are large enough, then no dots will be
printed. \cftnodots should be ‘large enough’. (Actually, \cftnodots is now
used as a flag for a conditional branch, so its numerical value isn’t as important
now.)
163 \providecommand{\cftdotsep}{4.5}
164 \newcommand{\cftnodots}{5000}
Now for the trickier bits regarding the typesetting of the ToC entries.
A .toc (also .lof and .lot) file consists of a list of \contentsline{hkind i}{htitlei}{hpagei}
commands, where hkindi is the kind of heading (e.g., part or section or figure),
htitlei is the title text (including the number), and hpagei is the page number. The
entries are inserted into the file by calling the \addcontentsline{hfilei}{hkind i}{htitlei}
command, where hfilei is the file extension (e.g., toc, lot) and the other argu-
ments are the same as for the \contentsline command. (Arbitrary stuff may
also be put into the file via the \addtocontents{hfilei}{htexti} command). The
typesetting of the \contentsline entries is performed by commands of the form
\l@kind. The sectioning and captioning commands call \addcontentsline to
insert their titles into the .toc etc., files.
For the purposes at hand it is generally impossible to treat the typesetting of
a title and its number separately, as both are bundled into the htitlei argument
within \contentsline. They could be handled separately if the \contentsline
command was suitably modified. If this was done, then the \addtocontentsline
command would also need to be changed which would then require the section-
ing and captioning commands to be modified as well. This is certainly possible,
but would cause problems if any other package also modified the sectioning or
captioning commands, and there are several packages which do this.
24
Having said this, for all but Part entries, the sectional number is typeset via
the \numberline command. We can take advantage of this fact.
I have taken the decision to not touch the \contentsline macro and instead
to do what can be done with it as it exists. That is, I will modify the \l@kind
commands. Essentially, my new definitions consist of inlined versions of the code
for \@dottedtocline.
\cftparfillskip The \l@kind commands modify (locally) the value of \parfillskip. \cftparfillskip
is a copy of the default T
E
Xbook \parfillskip definition.
165 \newcommand{\cftparfillskip}{\parfillskip=0pt plus1fil}
\numberline The purpose of the \numberline{hsecnumi} command is to typeset hsecnumi
left justified in a box of width \@tempdima. I redefine it to add three additional
parameters, namely \@cftbsnum, \@cftasnum and \@cftasnumb (see ltsect.dtx
for the original definition).
166 \renewcommand{\numberline}[1]{%
167 \hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
\@cftbsnum
\@cftasnum
\@cftasnumb
Originally these were not defined but were \let to appropriate commands in the
\l@... commands, but they have to be defined in case something unexpected calls
\numberline, for example through use of the float package.
8
168 \newcommand{\@cftbsnum}{}
169 \newcommand{\@cftasnum}{}
170 \newcommand{\@cftasnumb}{}
\l@part
\if@cftdopart
\l@part{htitlei}{hpagei} typesets the ToC entry for a part heading. It is a pa-
rameterised copy of the default \l@part (see classes.dtx for the original defi-
nition and the code below for \l@subsection for an explanation of most of this
code). By default, Parts (and Chapters) do not have dotted leaders. This package
provides for all entries to have dotted leaders.
171 \newif\if@cftdopart
172 \newif\if@cfthaspart
173 \@cftifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue}
174 \if@cfthaspart
175 \renewcommand*{\l@part}[2]{%
176 \@cftdopartfalse
177 \ifnum \c@tocdepth >-2\relax
178 \if@cfthaschapter
179 \@cftdoparttrue
180 \fi
181 \ifnum \c@tocdepth >\m@ne
182 \if@cfthaschapter\else
183 \@cftdoparttrue
184 \fi
185 \fi
8
This bug was discovered by Andrew Thurber when using the tocloft and algorithm packages
together.
25
186 \fi
187 \if@cftdopart
188 \if@cfthaschapter
189 \addpenalty{-\@highpenalty}%
190 \else
191 \addpenalty\@secpenalty
192 \fi
193 \addvspace{\cftbeforepartskip}%
194 \begingroup
195 {\leftskip \cftpartindent\relax
196 \rightskip \@tocrmarg
197 \parfillskip -\rightskip
198 \parindent \cftpartindent\relax\@afterindenttrue
199 \interlinepenalty\@M
200 \leavevmode
201 \@tempdima \cftpartnumwidth\relax
202 \let\@cftbsnum \cftpartpresnum
203 \let\@cftasnum \cftpartaftersnum
204 \let\@cftasnumb \cftpartaftersnumb
205 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
In default L
A
T
E
X, the part ToC entry is written without \numberline and hence
the ‘presnum’ needs to be inserted manually. In Koma-Script and titlesec (and
probably others—let me know!), however, this is not the case.
206 {\cftpartfont \if@cftkoma\else\if@cfttitlesec\else\cftpartpresnum\fi\fi #1}%
207 \cftpartfillnum{#2}}
208 \nobreak
209 \if@cfthaschapter
210 \global\@nobreaktrue
211 \everypar{\global\@nobreakfalse\everypar{}}%
212 \else
213 \if@compatibility
214 \global\@nobreaktrue
215 \everypar{\global\@nobreakfalse\everypar{}}%
216 \fi
217 \fi
218 \endgroup
219 \fi}
220 \fi
\cftbeforepartskip
\cftpartnumwidth
\cftpartfont
\cftpartpresnum
\cftpartaftersnum
\cftpartaftersnumb
\cftpartleader
\cftpartdotsep
\cftpartpagefont
\cftpartafterpnum
\cftpartindent
\cftpartfillnum
These are the user commands to control the typesetting of Part entries. They are
initialised to give the standard appearance.
221 \if@cfthaspart
222 \newlength{\cftbeforepartskip}
223 \setlength{\cftbeforepartskip}{2.25em \@plus\p@}
224 \newlength{\cftpartnumwidth}
225 \setlength{\cftpartnumwidth}{0em}
226 \newcommand{\cftpartfont}{\large\bfseries}
227 \newcommand{\cftpartpresnum}{}
228 \newcommand{\cftpartaftersnum}{}
26
229 \newcommand{\cftpartaftersnumb}{}
230 \newcommand{\cftpartleader}{\large\bfseries\cftdotfill{\cftpartdotsep}}
231 \newcommand{\cftpartdotsep}{\cftnodots}
232 \newcommand{\cftpartpagefont}{\large\bfseries}
233 \newcommand{\cftpartafterpnum}{}
234 \newlength{\cftpartindent}
235 \setlength{\cftpartindent}{0em}
236 \newcommand{\cftpartfillnum}[1]{%
237 {\cftpartleader}%
238 {\makebox[\@pnumwidth][\cftpnumalign]{\cftpartpagefont #1}\cftpartafterpnum\par}%
239 }
koma classes use some different settings.
240 \if@cftkoma
241 \setlength{\cftpartnumwidth}{2em}
242 \renewcommand{\cftpartfont}{\sectfont\large}
243 \renewcommand{\cftpartpagefont}{\sectfont\large}
244 \fi
245 \fi
\l@chapter \l@chapter{htitlei}{hpagei} typesets the ToC entry for a chapter heading. It is
a parameterised copy of the default \l@chapter (see classes.dtx for the original
definition). This only applies to chaptered documents.
246 \if@cfthaschapter
247 \renewcommand*{\l@chapter}[2]{%
248 \ifnum \c@tocdepth >\m@ne
249 \addpenalty{-\@highpenalty}%
250 \vskip \cftbeforechapskip
251 {\leftskip \cftchapindent\relax
252 \rightskip \@tocrmarg
253 \parfillskip -\rightskip
254 \parindent \cftchapindent\relax\@afterindenttrue
255 \interlinepenalty\@M
256 \leavevmode
257 \@tempdima \cftchapnumwidth\relax
258 \let\@cftbsnum \cftchappresnum
259 \let\@cftasnum \cftchapaftersnum
260 \let\@cftasnumb \cftchapaftersnumb
261 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
262 {\cftchapfont #1}\nobreak
263 \cftchapfillnum{#2}}%
264 \fi}%
265 \fi
\cftbeforechapskip
\cftchapindent
\cftchapnumwidth
\cftchapfont
\cftchappresnum
\cftchapaftersnum
\cftchapaftersnumb
\cftchapleader
\cftchapdotsep
\cftchappagefont
\cftchapafterpnum
\cftchapfillnum
These are the user commands to control the typesetting of Chapter entries. They
are initialised to give the standard appearance.
266 \if@cfthaschapter
267 \newlength{\cftbeforechapskip}
268 \setlength{\cftbeforechapskip}{1.0em \@plus\p@}
269 \newlength{\cftchapindent}
27
270 \setlength{\cftchapindent}{0em}
271 \newlength{\cftchapnumwidth}
272 \setlength{\cftchapnumwidth}{1.5em}
273 \newcommand{\cftchapfont}{\bfseries}
274 \newcommand{\cftchappresnum}{}
275 \newcommand{\cftchapaftersnum}{}
276 \newcommand{\cftchapaftersnumb}{}
277 \newcommand{\cftchapleader}{\bfseries\cftdotfill{\cftchapdotsep}}
278 \newcommand{\cftchapdotsep}{\cftnodots}
279 \newcommand{\cftchappagefont}{\bfseries}
280 \newcommand{\cftchapafterpnum}{}
281 \newcommand{\cftchapfillnum}[1]{%
282 {\cftchapleader}\nobreak
283 \makebox[\@pnumwidth][\cftpnumalign]{\cftchappagefont #1}\cftchapafterpnum\par
284 }
koma classes have different chapter settings.
285 \if@cftkoma
286 \renewcommand{\cftchapfont}{\sectfont}
287 \fi
288 \fi
289
\l@section \l@section{htitlei}{hpagei} typesets the ToC entry for a section heading. It is
a parameterised copy of the default \l@section (see classes.dtx for the original
definition).
290 \renewcommand*{\l@section}[2]{%
291 \ifnum \c@tocdepth >\z@
292 \if@cfthaschapter
293 \vskip \cftbeforesecskip
294 \else
295 \addpenalty\@secpenalty
296 \addvspace{\cftbeforesecskip}
297 \fi
298 {\leftskip \cftsecindent\relax
299 \rightskip \@tocrmarg
300 \parfillskip -\rightskip
301 \parindent \cftsecindent\relax\@afterindenttrue
302 \interlinepenalty\@M
303 \leavevmode
304 \@tempdima \cftsecnumwidth\relax
305 \let\@cftbsnum \cftsecpresnum
306 \let\@cftasnum \cftsecaftersnum
307 \let\@cftasnumb \cftsecaftersnumb
308 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
309 {\cftsecfont #1}\nobreak
310 \cftsecfillnum{#2}}%
311 \fi}
\cftbeforesecskip
\cftsecindent
\cftsecnumwidth
\cftsecfont
\cftsecpresnum
\cftsecaftersnum
\cftsecaftersnumb
\cftsecleader
\cftsecdotsep
\cftsecpagefont
\cftsecafterpnum
\cftsecfillnum
These are the user commands to control the typesetting of Section entries. They
28
are initialised to give the standard appearance.
312 \newlength{\cftbeforesecskip}
313 \newlength{\cftsecindent}
314 \newlength{\cftsecnumwidth}
315 \newcommand{\cftsecpresnum}{}
316 \newcommand{\cftsecaftersnum}{}
317 \newcommand{\cftsecaftersnumb}{}
318 \if@cfthaschapter
319 \setlength{\cftbeforesecskip}{\z@ \@plus.2\p@}
320 \setlength{\cftsecindent}{1.5em}
321 \setlength{\cftsecnumwidth}{2.3em}
322 \newcommand{\cftsecfont}{\normalfont}
323 \newcommand{\cftsecleader}{\normalfont\cftdotfill{\cftsecdotsep}}
324 \newcommand{\cftsecdotsep}{\cftdotsep}
325 \newcommand{\cftsecpagefont}{\normalfont}
326 \else
327 \setlength{\cftbeforesecskip}{1.0em \@plus\p@}
328 \setlength{\cftsecindent}{0em}
329 \setlength{\cftsecnumwidth}{1.5em}
330 \newcommand{\cftsecfont}{\bfseries}
331 \newcommand{\cftsecleader}{\bfseries\cftdotfill{\cftsecdotsep}}
332 \newcommand{\cftsecdotsep}{\cftnodots}
333 \newcommand{\cftsecpagefont}{\bfseries}
334 \fi
335 \newcommand{\cftsecafterpnum}{}
336 \newcommand{\cftsecfillnum}[1]{%
337 {\cftsecleader}\nobreak
338 \makebox[\@pnumwidth][\cftpnumalign]{\cftsecpagefont #1}\cftsecafterpnum\par
339 }
\l@subsection \l@subsection{htitlei}{hpagei} typesets the ToC entry for a subsection head-
ing. It is a parameterised copy of the default \l@subsection (see classes.dtx
for the original definition).
340 \renewcommand*{\l@subsection}[2]{%
Only typeset the entry if it falls within the tocdepth.
341 \ifnum \c@tocdepth >\@ne
Add some vertical space.
342 \vskip \cftbeforesubsecskip
Start a group to keep paragraphing changes local. Set the \leftskip to the entry’s
indentation.
343 {\leftskip \cftsubsecindent\relax
Set the \rightskip to \@tocrmarg to leave room for the page number.
344 \rightskip \@tocrmarg
Ensure that the last line of the entry will be filled. Setting \parfillskip to a
negative number prevents any overfull box messages.
345 \parfillskip -\rightskip
29
Set the paragraph indent to the entry’s indentation.
346 \parindent \cftsubsecindent\relax\@afterindenttrue
Try and prevent breaks between lines in a multiple line entry.
347 \interlinepenalty\@M
Make sure that we have left vertical mode.
348 \leavevmode
Our version of \numberline expects that the width of the number box is in
\@tempdima, and that the three macros \@cftbsnum, \@cftasnum and \@cftasnumb
are defined. We set all these to the values for this entry.
349 \@tempdima \cftsubsecnumwidth\relax
350 \let\@cftbsnum \cftsubsecpresnum
351 \let\@cftasnum \cftsubsecaftersnum
352 \let\@cftasnumb \cftsubsecaftersnumb
Arrange that the (section number and) first line of the title is set at the current
indent, and any further lines are further indented.
353 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
Print the (number and) title, prohibiting any breaking.
354 {\cftsubsecfont #1}\nobreak
Print the leader and the page number, and close the group.
355 \cftsubsecfillnum{#2}}%
356 \fi}
\cftbeforesubsecskip
\cftsubsecindent
\cftsubsecnumwidth
\cftsubsecfont
\cftsubsecpresnum
\cftsubsecaftersnum
\cftsubsecaftersnumb
\cftsubsecleader
\cftsubsecdotsep
\cftsubsecpagefont
\cftsubsecafterpnum
These are the user commands to control the typesetting of Sub-section entries.
They are initialised to give the standard appearance.
357 \newlength{\cftbeforesubsecskip}
358 \setlength{\cftbeforesubsecskip}{\z@ \@plus.2\p@}
359 \newlength{\cftsubsecindent}
360 \newlength{\cftsubsecnumwidth}
361 \if@cfthaschapter
362 \setlength{\cftsubsecindent}{3.8em}
363 \setlength{\cftsubsecnumwidth}{3.2em}
364 \else
365 \setlength{\cftsubsecindent}{1.5em}
366 \setlength{\cftsubsecnumwidth}{2.3em}
367 \fi
368 \newcommand{\cftsubsecfont}{\normalfont}
369 \newcommand{\cftsubsecpresnum}{}
370 \newcommand{\cftsubsecaftersnum}{}
371 \newcommand{\cftsubsecaftersnumb}{}
372 \newcommand{\cftsubsecleader}{\normalfont\cftdotfill{\cftsubsecdotsep}}
373 \newcommand{\cftsubsecdotsep}{\cftdotsep}
374 \newcommand{\cftsubsecpagefont}{\normalfont}
375 \newcommand{\cftsubsecafterpnum}{}
30
\cftsubsecfillnum \cftsubsecfillnum{hpagei} typesets the leader and the hpagei number of a
subsection entry. First print the leader and then, with no break, set the page
number flushright in a box of width \@pnumwidth, not forgetting to finish the
paragraph.
376 \newcommand{\cftsubsecfillnum}[1]{%
377 {\cftsubsecleader}\nobreak
378 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubsecpagefont #1}\cftsubsecafterpnum\par
379 }
\l@subsubsection \l@subsubsection{htitlei}{hpagei} typesets the ToC entry for a subsubsection
heading. It is a parameterised copy of the default \l@subsubsection (see
classes.dtx for the original definition).
380 \renewcommand*{\l@subsubsection}[2]{%
381 \ifnum \c@tocdepth >\tw@
382 \vskip \cftbeforesubsubsecskip
383 {\leftskip \cftsubsubsecindent\relax
384 \rightskip \@tocrmarg
385 \parfillskip -\rightskip
386 \parindent \cftsubsubsecindent\relax\@afterindenttrue
387 \interlinepenalty\@M
388 \leavevmode
389 \@tempdima \cftsubsubsecnumwidth\relax
390 \let\@cftbsnum \cftsubsubsecpresnum
391 \let\@cftasnum \cftsubsubsecaftersnum
392 \let\@cftasnumb \cftsubsubsecaftersnumb
393 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
394 {\cftsubsubsecfont #1}\nobreak
395 \cftsubsubsecfillnum{#2}}%
396 \fi}
\cftbeforesubsubsecskip
\cftsubsubsecindent
\cftsubsubsecnumwidth
\cftsubsubsecfont
\cftsubsubsecpresnum
\cftsubsubsecaftersnum
\cftsubsubsecaftersnumb
\cftsubsubsecleader
\cftsubsubsecdotsep
\cftsubsubsecpagefont
\cftsubsubsecafterpnum
\cftsubsubsecfillnum
These are the user commands to control the typesetting of Sub-sub-section entries.
They are initialised to give the standard appearance.
397 \newlength{\cftbeforesubsubsecskip}
398 \setlength{\cftbeforesubsubsecskip}{\z@ \@plus.2\p@}
399 \newlength{\cftsubsubsecindent}
400 \newlength{\cftsubsubsecnumwidth}
401 \if@cfthaschapter
402 \setlength{\cftsubsubsecindent}{7.0em}
403 \setlength{\cftsubsubsecnumwidth}{4.1em}
404 \else
405 \setlength{\cftsubsubsecindent}{3.8em}
406 \setlength{\cftsubsubsecnumwidth}{3.2em}
407 \fi
408 \newcommand{\cftsubsubsecfont}{\normalfont}
409 \newcommand{\cftsubsubsecpresnum}{}
410 \newcommand{\cftsubsubsecaftersnum}{}
411 \newcommand{\cftsubsubsecaftersnumb}{}
412 \newcommand{\cftsubsubsecleader}{\normalfont\cftdotfill{\cftsubsubsecdotsep}}
413 \newcommand{\cftsubsubsecdotsep}{\cftdotsep}
31
414 \newcommand{\cftsubsubsecpagefont}{\normalfont}
415 \newcommand{\cftsubsubsecafterpnum}{}
416 \newcommand{\cftsubsubsecfillnum}[1]{%
417 {\cftsubsubsecleader}\nobreak
418 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubsubsecpagefont #1}\cftsubsubsecafterpnum\par
419 }
\l@paragraph \l@paragraph{htitlei}{hpagei} typesets the ToC entry for a paragraph heading.
It is a parameterised copy of the default \l@paragraph (see classes.dtx for the
original definition).
420 \renewcommand*{\l@paragraph}[2]{%
421 \ifnum \c@tocdepth >3\relax
422 \vskip \cftbeforeparaskip
423 {\leftskip \cftparaindent\relax
424 \rightskip \@tocrmarg
425 \parfillskip -\rightskip
426 \parindent \cftparaindent\relax\@afterindenttrue
427 \interlinepenalty\@M
428 \leavevmode
429 \@tempdima \cftparanumwidth\relax
430 \let\@cftbsnum \cftparapresnum
431 \let\@cftasnum \cftparaaftersnum
432 \let\@cftasnumb \cftparaaftersnumb
433 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
434 {\cftparafont #1}\nobreak
435 \cftparafillnum{#2}}%
436 \fi}
\cftbeforeparaskip
\cftparaindent
\cftparanumwidth
\cftparafont
\cftparapresnum
\cftparaaftersnum
\cftparaaftersnumb
\cftparaleader
\cftparadotsep
\cftparapagefont
\cftparaafterpnum
\cftparafillnum
These are the user commands to control the typesetting of Paragraph entries.
They are initialised to give the standard appearance.
437 \newlength{\cftbeforeparaskip}
438 \setlength{\cftbeforeparaskip}{\z@ \@plus.2\p@}
439 \newlength{\cftparaindent}
440 \newlength{\cftparanumwidth}
441 \if@cfthaschapter
442 \setlength{\cftparaindent}{10em}
443 \setlength{\cftparanumwidth}{5em}
444 \else
445 \setlength{\cftparaindent}{7.0em}
446 \setlength{\cftparanumwidth}{4.1em}
447 \fi
448 \newcommand{\cftparafont}{\normalfont}
449 \newcommand{\cftparapresnum}{}
450 \newcommand{\cftparaaftersnum}{}
451 \newcommand{\cftparaaftersnumb}{}
452 \newcommand{\cftparaleader}{\normalfont\cftdotfill{\cftparadotsep}}
453 \newcommand{\cftparadotsep}{\cftdotsep}
454 \newcommand{\cftparapagefont}{\normalfont}
455 \newcommand{\cftparaafterpnum}{}
32
456 \newcommand{\cftparafillnum}[1]{%
457 {\cftparaleader}\nobreak
458 \makebox[\@pnumwidth][\cftpnumalign]{\cftparapagefont #1}\cftparaafterpnum\par
459 }
\l@subparagraph \l@subparagraph{htitlei}{hpagei} typesets the ToC entry for a subparagraph
heading. It is a parameterised copy of the default \l@subparagraph (see
classes.dtx for the original definition).
460 \renewcommand*{\l@subparagraph}[2]{%
461 \ifnum \c@tocdepth >4\relax
462 \vskip \cftbeforesubparaskip
463 {\leftskip \cftsubparaindent\relax
464 \rightskip \@tocrmarg
465 \parfillskip -\rightskip
466 \parindent \cftsubparaindent\relax\@afterindenttrue
467 \interlinepenalty\@M
468 \leavevmode
469 \@tempdima \cftsubparanumwidth\relax
470 \let\@cftbsnum \cftsubparapresnum
471 \let\@cftasnum \cftsubparaaftersnum
472 \let\@cftasnumb \cftsubparaaftersnumb
473 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
474 {\cftsubparafont #1}\nobreak
475 \cftsubparafillnum{#2}}%
476 \fi}
\cftbeforesubparaskip
\cftsubparaindent
\cftsubparanumwidth
\cftsubparafont
\cftsubparapresnum
\cftsubparaaftersnum
\cftsubparaaftersnumb
\cftsubparaleader
\cftsubparadotsep
\cftsubparapagefont
\cftsubparaafterpnum
\cftsubparafillnum
These are the user commands to control the typesetting of Sub-paragraph entries.
They are initialised to give the standard appearance.
477 \newlength{\cftbeforesubparaskip}
478 \setlength{\cftbeforesubparaskip}{\z@ \@plus.2\p@}
479 \newlength{\cftsubparaindent}
480 \newlength{\cftsubparanumwidth}
481 \if@cfthaschapter
482 \setlength{\cftsubparaindent}{12em}
483 \setlength{\cftsubparanumwidth}{6em}
484 \else
485 \setlength{\cftsubparaindent}{10em}
486 \setlength{\cftsubparanumwidth}{5em}
487 \fi
488 \newcommand{\cftsubparafont}{\normalfont}
489 \newcommand{\cftsubparapresnum}{}
490 \newcommand{\cftsubparaaftersnum}{}
491 \newcommand{\cftsubparaaftersnumb}{}
492 \newcommand{\cftsubparaleader}{\normalfont\cftdotfill{\cftsubparadotsep}}
493 \newcommand{\cftsubparadotsep}{\cftdotsep}
494 \newcommand{\cftsubparapagefont}{\normalfont}
495 \newcommand{\cftsubparaafterpnum}{}
496 \newcommand{\cftsubparafillnum}[1]{%
497 {\cftsubparaleader}\nobreak
33
498 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubparapagefont #1}\cftsubparaafterpnum\par
499 }
\@cftdobiblof If the tocbibind package has been used and it has redefined \listoffigures we
need to cater for that. The contents of the definition are defined in tocbibind.
500 \newcommand{\@cftdobiblof}{%
501 \if@dotoclof
502 \if@bibchapter
503 \phantomsection
504 \addcontentsline{toc}{chapter}{\listfigurename}
505 \else
506 \phantomsection
507 \addcontentsline{toc}{\@tocextra}{\listfigurename}
508 \fi
509 \fi}
510
\listoffigures This is a parameterised version of the default \listoffigures command. The
changes are postponed until after all packages have been loaded. Each class has
its own definition, but we have to cater for all classes in one definition, hence some
of the checks. First, perform the default checks for multicolumns. (Do nothing if
titles option is used).
511 \AtBeginDocument{%
512 \if@cftnctoc\else
513 \renewcommand{\listoffigures}{%
514 \@cfttocstart
Ensure that any previous paragraph has been finished. Within a group set the
local paragraphing style. Typeset the title and then do the contents of the .lof
file.
515 \par
516 \begingroup
517 \parindent\z@ \parskip\cftparskip
518 \@cftmakeloftitle
519 \if@cfttocbibind
520 \@cftdobiblof
521 \fi
522 \@starttoc{lof}%
523 \endgroup
Finally, restore any multicolumn typesetting.
524 \@cfttocfinish}%
525 \fi
526 }
527
\@cftmakeloftitle This command typesets the title for the LoF.
528 \newcommand{\@cftmakeloftitle}{%
529 \addpenalty\@secpenalty
530 \if@cfthaschapter
34
531 \vspace*{\cftbeforeloftitleskip}
532 \else
533 \vspace{\cftbeforeloftitleskip}
534 \fi
535 \@cftpagestyle
536 {\interlinepenalty\@M
537 {\cftloftitlefont\listfigurename}{\cftafterloftitle}
538 \cftmarklof
539 \par\nobreak
540 \vskip \cftafterloftitleskip
541 \@afterheading}}
542
\cftbeforeloftitleskip
\cftafterloftitleskip
These two lengths control the vertical spacing before and after the LoF title.
543 \newlength{\cftbeforeloftitleskip}
544 \newlength{\cftafterloftitleskip}
Their values depend on whether the document has chapters or not. In chap-
tered documents the default LoF title is typeset as a \chapter*, otherwise as a
\section*.
545 \if@cfthaschapter
546 \setlength{\cftbeforeloftitleskip}{50pt}
547 \setlength{\cftafterloftitleskip}{40pt}
548 \else
549 \setlength{\cftbeforeloftitleskip}{3.5ex \@plus 1ex \@minus .2ex}
550 \setlength{\cftafterloftitleskip}{2.3ex \@plus.2ex}
551 \fi
\cftloftitlefont
\cftafterloftitle
The LoF title is typeset in the style given by \cftloftitlefont. The macro
\cftafterloftitle is called after typesetting the title. This is initialised to do
nothing. Both these macros can be redefined to do other things (e.g., adding an
\hfill to \cftloftitlefont will make the title flushright).
552 \if@cfthaschapter
553 \newcommand{\cftloftitlefont}{\normalfont\Huge\bfseries}
554 \if@cftkoma\renewcommand{\cftloftitlefont}{\size@chapter\sectfont}\fi
555 \else
556 \newcommand{\cftloftitlefont}{\normalfont\Large\bfseries}
557 \if@cftkoma\renewcommand{\cftloftitlefont}{\size@section\sectfont}\fi
558 \fi
559 \newcommand{\cftafterloftitle}{}
560
\l@figure \l@figure{htitlei}{hpagei} typesets the LoF entry for a figure caption heading.
It is a parameterised copy of the default \l@figure (see classes.dtx for the
original definition).
561 \renewcommand*{\l@figure}[2]{%
562 \ifnum \c@lofdepth >\z@
563 \vskip \cftbeforefigskip
564 {\leftskip \cftfigindent\relax
35
565 \rightskip \@tocrmarg
566 \parfillskip -\rightskip
567 \parindent \cftfigindent\relax\@afterindenttrue
568 \interlinepenalty\@M
569 \leavevmode
570 \@tempdima \cftfignumwidth\relax
571 \let\@cftbsnum \cftfigpresnum
572 \let\@cftasnum \cftfigaftersnum
573 \let\@cftasnumb \cftfigaftersnumb
574 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
575 {\cftfigfont #1}\nobreak
576 \cftfigfillnum{#2}}%
577 \fi
578 }
\cftbeforefigskip
\cftfigindent
\cftfignumwidth
\cftfigfont
\cftfigpresnum
\cftfigaftersnum
\cftfigaftersnumb
\cftfigleader
\cftfigdotsep
\cftfigpagefont
\cftfigafterpnum
\cftfigfillnum
These are the user commands to control the typesetting of Figure caption entries.
They are initialised to give the standard appearance.
579 \newlength{\cftbeforefigskip}
580 \setlength{\cftbeforefigskip}{\z@ \@plus.2\p@}
581 \newlength{\cftfigindent}
582 \setlength{\cftfigindent}{1.5em}
583 \newlength{\cftfignumwidth}
584 \setlength{\cftfignumwidth}{2.3em}
585 \newcommand{\cftfigfont}{\normalfont}
586 \newcommand{\cftfigpresnum}{}
587 \newcommand{\cftfigaftersnum}{}
588 \newcommand{\cftfigaftersnumb}{}
589 \newcommand{\cftfigleader}{\normalfont\cftdotfill{\cftfigdotsep}}
590 \newcommand{\cftfigdotsep}{\cftdotsep}
591 \newcommand{\cftfigpagefont}{\normalfont}
592 \newcommand{\cftfigafterpnum}{}
593 \newcommand{\cftfigfillnum}[1]{%
594 {\cftfigleader}\nobreak
595 \makebox[\@pnumwidth][\cftpnumalign]{\cftfigpagefont #1}\cftfigafterpnum\par
596 }
lofdepth
lotdepth
The counters lofdepth and lotdepth are defined by the subfigure package. Define
them here if that package is not used.
597 \if@cftsubfigopt\else
598 \newcounter{lofdepth}\setcounter{lofdepth}{1}
599 \newcounter{lotdepth}\setcounter{lotdepth}{1}
600 \fi
601
\@cftdobiblot If the tocbibind package has been used and it has redefined \listoftables we
need to cater for that. The contents of the definition are defined in tocbibind.
602 \newcommand{\@cftdobiblot}{%
603 \if@dotoclot
604 \if@bibchapter
36
605 \phantomsection
606 \addcontentsline{toc}{chapter}{\listtablename}
607 \else
608 \phantomsection
609 \addcontentsline{toc}{\@tocextra}{\listtablename}
610 \fi
611 \fi}
612
\listoftables This is a parameterised version of the default \listoftables command. The
changes are postponed until after all packages have been loaded. Each class has
its own definition, but we have to cater for all classes in one definition, hence some
of the checks. First, perform the default checks for multicolumns. (Do nothing if
the titles option has been used).
613 \AtBeginDocument{%
614 \if@cftnctoc\else
615 \renewcommand{\listoftables}{%
616 \@cfttocstart
Ensure that any previous paragraph has been finished. Within a group set the
local paragraphing style. Typeset the title and then do the contents of the .lot
file.
617 \par
618 \begingroup
619 \parindent\z@ \parskip\cftparskip
620 \@cftmakelottitle
621 \if@cfttocbibind
622 \@cftdobiblot
623 \fi
624 \@starttoc{lot}%
625 \endgroup
Finally, restore any multicolumn typesetting.
626 \@cfttocfinish}%
627 \fi
628 }
629
\@cftmakelottitle This command typesets the title for the LoT.
630 \newcommand{\@cftmakelottitle}{%
631 \addpenalty\@secpenalty
632 \if@cfthaschapter
633 \vspace*{\cftbeforelottitleskip}
634 \else
635 \vspace{\cftbeforelottitleskip}
636 \fi
637 \@cftpagestyle
638 {\interlinepenalty\@M
639 {\cftlottitlefont\listtablename}{\cftafterlottitle}
640 \cftmarklot
37
641 \par\nobreak
642 \vskip \cftafterlottitleskip
643 \@afterheading}}
644
\cftbeforelottitleskip
\cftafterlottitleskip
These two lengths control the vertical spacing before and after the LoT title.
645 \newlength{\cftbeforelottitleskip}
646 \newlength{\cftafterlottitleskip}
Their values depend on whether the document has chapters or not. In chap-
tered documents the default LoT title is typeset as a \chapter*, otherwise as a
\section*.
647 \if@cfthaschapter
648 \setlength{\cftbeforelottitleskip}{50pt}
649 \setlength{\cftafterlottitleskip}{40pt}
650 \else
651 \setlength{\cftbeforelottitleskip}{3.5ex \@plus 1ex \@minus .2ex}
652 \setlength{\cftafterlottitleskip}{2.3ex \@plus.2ex}
653 \fi
\cftlottitlefont
\cftafterlottitle
The LoT title is typeset in the style given by \cftlottitlefont. The macro
\cftafterlottitle is called after typesetting the title. This is initialised to do
nothing. Both these macros can be redefined to do other things (e.g., adding an
\hfill to \cftlottitlefont will make the title flushright).
654 \if@cfthaschapter
655 \newcommand{\cftlottitlefont}{\normalfont\Huge\bfseries}
656 \if@cftkoma\renewcommand{\cftlottitlefont}{\size@chapter\sectfont}\fi
657 \else
658 \newcommand{\cftlottitlefont}{\normalfont\Large\bfseries}
659 \if@cftkoma\renewcommand{\cftlottitlefont}{\size@section\sectfont}\fi
660 \fi
661 \newcommand{\cftafterlottitle}{}
662
\l@table \l@table{htitlei}{hpagei} typesets the LoT entry for a table caption heading. It
is a parameterised copy of the default \l@table (see classes.dtx for the original
definition).
663 \renewcommand*{\l@table}[2]{%
664 \ifnum\c@lotdepth >\z@
665 \vskip \cftbeforetabskip
666 {\leftskip \cfttabindent\relax
667 \rightskip \@tocrmarg
668 \parfillskip -\rightskip
669 \parindent \cfttabindent\relax\@afterindenttrue
670 \interlinepenalty\@M
671 \leavevmode
672 \@tempdima \cfttabnumwidth\relax
673 \let\@cftbsnum \cfttabpresnum
674 \let\@cftasnum \cfttabaftersnum
38
675 \let\@cftasnumb \cfttabaftersnumb
676 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
677 {\cfttabfont #1}\nobreak
678 \cfttabfillnum{#2}}%
679 \fi
680 }
\cftbeforetabskip
\cfttabindent
\cfttabnumwidth
\cfttabfont
\cfttabpresnum
\cfttabaftersnum
\cfttabaftersnumb
\cfttableader
\cfttabdotsep
\cfttabpagefont
\cfttabafterpnum
\cfttabfillnum
These are the user commands to control the typesetting of Table caption entries.
They are initialised to give the standard appearance.
681 \newlength{\cftbeforetabskip}
682 \setlength{\cftbeforetabskip}{\z@ \@plus.2\p@}
683 \newlength{\cfttabindent}
684 \setlength{\cfttabindent}{1.5em}
685 \newlength{\cfttabnumwidth}
686 \setlength{\cfttabnumwidth}{2.3em}
687 \newcommand{\cfttabfont}{\normalfont}
688 \newcommand{\cfttabpresnum}{}
689 \newcommand{\cfttabaftersnum}{}
690 \newcommand{\cfttabaftersnumb}{}
691 \newcommand{\cfttableader}{\normalfont\cftdotfill{\cfttabdotsep}}
692 \newcommand{\cfttabdotsep}{\cftdotsep}
693 \newcommand{\cfttabpagefont}{\normalfont}
694 \newcommand{\cfttabafterpnum}{}
695 \newcommand{\cfttabfillnum}[1]{%
696 {\cfttableader}\nobreak
697 \makebox[\@pnumwidth][\cftpnumalign]{\cfttabpagefont #1}\cfttabafterpnum\par
698 }
3.1 Support for the subfigure package
The code for supporting the subfigure package is, in all essentials, the same as that
for the figure and table captions; only the names are changed. However, the code
need only be executed if the subfigure package is actually loaded.
\@cftl@subfig This command redefines the \l@subfigure command.
699 \newcommand{\@cftl@subfig}{%
\l@subfigure \l@subfigure{htitlei}{hpagei} typesets the LoF entry for a subfigure caption
heading. It is essentially the same as the parameterised code for \l@figure except
that account has to be taken of lofdepth.
700 \renewcommand*{\l@subfigure}[2]{%
701 \ifnum \c@lofdepth > \toclevel@subfigure
702 \vskip \cftbeforesubfigskip
703 {\leftskip \cftsubfigindent\relax
704 \rightskip \@tocrmarg
705 \parfillskip -\rightskip
706 \parindent \cftsubfigindent\relax\@afterindenttrue
707 \interlinepenalty\@M
708 \leavevmode
39
709 \@tempdima \cftsubfignumwidth\relax
710 \let\@cftbsnum \cftsubfigpresnum
711 \let\@cftasnum \cftsubfigaftersnum
712 \let\@cftasnumb \cftsubfigaftersnumb
713 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
714 {\cftsubfigfont ##1}\nobreak
715 \cftsubfigfillnum{##2}}%
716 \fi
717 }%
718 }
719
\@cftsetsubfig This command initialises the setup for subfigure captions in the LoF.
720 \newcommand{\@cftsetsubfig}{%
\cftbeforesubfigskip
\cftsubfigindent
\cftsubfignumwidth
\cftsubfigfont
\cftsubfigpresnum
\cftsubfigaftersnum
\cftsubfigaftersnumb
\cftsubfigleader
\cftsubfigdotsep
\cftsubfigpagefont
\cftsubfigafterpnum
\toclevel@subfig
\cftsubfigfillnum
721 \newlength{\cftbeforesubfigskip}
722 \setlength{\cftbeforesubfigskip}{\z@ \@plus.2\p@}
723 \newlength{\cftsubfigindent}
724 \setlength{\cftsubfigindent}{3.8em}
725 \newlength{\cftsubfignumwidth}
726 \setlength{\cftsubfignumwidth}{2.5em}
727 \newcommand{\cftsubfigfont}{\normalfont}
728 \newcommand{\cftsubfigpresnum}{}
729 \newcommand{\cftsubfigaftersnum}{}
730 \newcommand{\cftsubfigaftersnumb}{}
731 \newcommand{\cftsubfigleader}{\normalfont\cftdotfill{\cftsubtabdotsep}}
732 \newcommand{\cftsubfigdotsep}{\cftdotsep}
733 \newcommand{\cftsubfigpagefont}{\normalfont}
734 \newcommand{\cftsubfigafterpnum}{}
735 \providecommand{\toclevel@subfigure}{1}
736 \newcommand{\cftsubfigfillnum}[1]{%
737 {\cftsubfigleader}\nobreak
738 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubfigpagefont ##1}\cftsubfigafterpnum\par
739 }
This is the end of \@cftsetsubfig.
740 }
741
\@cftl@subtab This code redefines the code for \l@subtable.
742 \newcommand{\@cftl@subtab}{%
\l@subtable \l@subtable{htitlei}{hpagei} typesets the LoT entry for a subtable caption
heading. It is essentially the same as the parameterised code for \l@table ex-
cept account has to be taken of lotdepth.
743 \renewcommand*{\l@subtable}[2]{%
744 \ifnum \c@lotdepth > \toclevel@subtable
745 \vskip \cftbeforesubtabskip
40
746 {\leftskip \cftsubtabindent\relax
747 \rightskip \@tocrmarg
748 \parfillskip -\rightskip
749 \parindent \cftsubtabindent\relax\@afterindenttrue
750 \interlinepenalty\@M
751 \leavevmode
752 \@tempdima \cftsubtabnumwidth\relax
753 \let\@cftbsnum \cftsubtabpresnum
754 \let\@cftasnum \cftsubtabaftersnum
755 \let\@cftasnumb \cftsubtabaftersnumb
756 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
757 {\cftsubtabfont ##1}\nobreak
758 \cftsubtabfillnum{##2}}%
759 \fi
760 }%
761 }
\@cftsetsubtab This command sets up the defaults for subtable entries in the LoT.
762 \newcommand{\@cftsetsubtab}{%
\cftbeforesubtabskip
\cftsubtabindent
\cftsubtabnumwidth
\cftsubtabfont
\cftsubtabpresnum
\cftsubtabaftersnum
\cftsubtabaftersnumb
\cftsubtableader
\cftsubtabdotsep
\cftsubtabpagefont
\cftsubtabafterpnum
\toclevel@subtable
\cftsubtabfillnum
These are the user commands to control the typesetting of Subtable caption en-
tries. They are initialised to give the standard appearance.
763 \newlength{\cftbeforesubtabskip}
764 \setlength{\cftbeforesubtabskip}{\z@ \@plus.2\p@}
765 \newlength{\cftsubtabindent}
766 \setlength{\cftsubtabindent}{3.8em}
767 \newlength{\cftsubtabnumwidth}
768 \setlength{\cftsubtabnumwidth}{2.5em}
769 \newcommand{\cftsubtabfont}{\normalfont}
770 \newcommand{\cftsubtabpresnum}{}
771 \newcommand{\cftsubtabaftersnum}{}
772 \newcommand{\cftsubtabaftersnumb}{}
773 \newcommand{\cftsubtableader}{\normalfont\cftdotfill{\cftsubtabdotsep}}
774 \newcommand{\cftsubtabdotsep}{\cftdotsep}
775 \newcommand{\cftsubtabpagefont}{\normalfont}
776 \newcommand{\cftsubtabafterpnum}{}
777 \providecommand{\toclevel@subtable}{1}
778 \newcommand{\cftsubtabfillnum}[1]{%
779 {\cftsubtableader}\nobreak
780 \makebox[\@pnumwidth][\cftpnumalign]{\cftsubtabpagefont ##1}\cftsubtabafterpnum\par
781 }
This is the end of \@cftsetsubtab.
782 }
783
Call the subfigure package setup code only if the subfigure option is specified.
The \l@... redefinitions have to come after the subfigure package is loaded.
784
41
785 \if@cftsubfigopt
786 \@cftsetsubfig\@cftsetsubtab
787 \AtBeginDocument{\@cftl@subfig\@cftl@subtab}
788 \fi
789 %% \AtBeginDocument{\if@cftsubfigopt
790 %% \@cftsetsubfig\@cftsetsubtab
791 %% \@cftl@subfig\@cftl@subtab
792 %% \fi}
793
3.2 New list of. . .
\newlistentry \newlistentry[hwithini]{hcounter i}{hexti}{hlevel-1 i} creates a set of com-
mands for a new kind of entry into a List of.
794 \newcommand{\newlistentry}[4][\@empty]{%
\c@X
\theX
Check if hwithini and hcounter i have been defined. It is an error if hwithini has not
been defined, and an error if hcounteri has been defined. Set the default counter
values.
795 \@ifundefined{c@#2}{% check & set the counter
796 \ifx \@empty#1\relax
797 \newcounter{#2}
798 \else
799 \@ifundefined{c@#1}{\PackageWarning{tocloft}%
800 {#1 has no counter for use as a ‘within’}
801 \newcounter{#2}}%
802 {\newcounter{#2}[#1]%
803 \expandafter\edef\csname the#2\endcsname{%
804 \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}}
805 \fi
806 \setcounter{#2}{0}
807 }
808 {\PackageError{tocloft}{#2 has been previously defined}{\@eha}}
809
That finishes off the error checking. No matter what the result, the rest of the
new commands are defined.
\l@X \l@X{htitlei}{hpagei} typesets the entry.
810 \@namedef{l@#2}##1##2{%
Only typeset if the \Zdepth is greater than hlevel-1 i.
811 \ifnum \@nameuse{c@#3depth} > #4\relax
812 \vskip \@nameuse{cftbefore#2skip}
813 {\leftskip \@nameuse{cft#2indent}\relax
814 \rightskip \@tocrmarg
815 \parfillskip -\rightskip
816 \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue
817 \interlinepenalty\@M
42
818 \leavevmode
819 \@tempdima \@nameuse{cft#2numwidth}\relax
820 \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname
821 \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname
822 \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname
823 \advance\leftskip\@tempdima \null\nobreak\hskip -\leftskip
824 {\@nameuse{cft#2font}##1}\nobreak
825 \@nameuse{cft#2fillnum}{##2}}%
826 \fi
827 } % end of \l@#2
828
Now define all the layout commands used by \l@X. The default values of these
correspond to those for section entries in non-chaptered documents.
\cftbeforeXskip
829 \expandafter\newlength\csname cftbefore#2skip\endcsname
830 \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@}
\cftXindent
\cftXnumwidth
831 \expandafter\newlength\csname cft#2indent\endcsname
832 \expandafter\newlength\csname cft#2numwidth\endcsname
Set the default values for the indent and numwidth depending on the entry’s level.
A level of 1 corresponds to a figure entry.
833 \ifcase #4\relax % 0
834 \setlength{\@nameuse{cft#2indent}}{0em}
835 \setlength{\@nameuse{cft#2numwidth}}{1.5em}
836 \or % 1
837 \setlength{\@nameuse{cft#2indent}}{1.5em}
838 \setlength{\@nameuse{cft#2numwidth}}{2.3em}
839 \or % 2
840 \setlength{\@nameuse{cft#2indent}}{3.8em}
841 \setlength{\@nameuse{cft#2numwidth}}{3.2em}
842 \or % 3
843 \setlength{\@nameuse{cft#2indent}}{7.0em}
844 \setlength{\@nameuse{cft#2numwidth}}{4.1em}
845 \else % anything else
846 \setlength{\@nameuse{cft#2indent}}{10.0em}
847 \setlength{\@nameuse{cft#2numwidth}}{5.0em}
848 \fi
\cftXfont
\cftXpresnum
\cftXaftersnum
\cftXaftersnumb
\cftXdotsep
\cftXleader
\cftXpagefont
\cftXafterpnum
And the remaining commands.
849 \@namedef{cft#2font}{\normalfont}
850 \@namedef{cft#2presnum}{}
851 \@namedef{cft#2aftersnum}{}
852 \@namedef{cft#2aftersnumb}{}
853 \@namedef{cft#2dotsep}{\cftdotsep}
854 \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}}
855 \@namedef{cft#2pagefont}{\normalfont}
856 \@namedef{cft#2afterpnum}{}
43
\toclevel@X The hyperref package needs a command \toclevel@X, holding the hlevel-1 i value.
857 \@namedef{toclevel@#2}{#4}
\cftXfillnum Typeset the leader and page number.
858 \@namedef{cft#2fillnum}##1{%
859 {\@nameuse{cft#2leader}}\nobreak
860 \makebox[\@pnumwidth][\cftpnumalign]{\@nameuse{cft#2pagefont}##1}\@nameuse{cft#2afterpnum}\par
861 }
This ends the definition of \newlistentry.
862 }
\newlistof \newlistof[hwithini]{hentryi}{hexti}{hlistofnamei} creates the commands for
a new List of.
863 \newcommand{\newlistof}[4][\@empty]{%
Call \newlistentry to set up the first level entry.
864 \ifx \@empty#1\relax
865 \newlistentry{#2}{#3}{0}
866 \else
867 \newlistentry[#1]{#2}{#3}{0}
868 \fi
\ext@Z
\Zdepth
The file extension and listing depth.
869 \@namedef{ext@#2}{#3}
870 \newcounter{#3depth}
871 \setcounter{#3depth}{1}
\cftmarkZ The heading marks for the listing.
872 \if@cftkoma
873 \@namedef{cftmark#3}{%
874 \@mkboth{#4}{#4}}
875 \else
876 \@namedef{cftmark#3}{%
877 \@mkboth{\MakeUppercase{#4}}{\MakeUppercase{#4}}}
878 \fi
\listofX Typeset the listing title and entries.
879 \if@cftnctoc
For the titles option, basically copy the code from the standard \tableofcontents
command.
880 \@namedef{listof#2}{%
881 \@cfttocstart
882 \if@cfthaschapter
883 \chapter*{#4}
884 \else
885 \section*{#4}
886 \fi
44
887 \@nameuse{cftmark#3}
888 \@starttoc{#3}%
889 \@cfttocfinish}
890 \else
Otherwise use the fully parameterised definition.
891 \@namedef{listof#2}{%
892 \@cfttocstart
893 \par
894 \begingroup
895 \parindent\z@ \parskip\cftparskip
896 \@nameuse{@cftmake#3title}
897 \@starttoc{#3}%
898 \endgroup
899 \@cfttocfinish}
900 \fi
901
\@cftmakeZtitle Typeset the title.
902 \@namedef{@cftmake#3title}{%
903 \addpenalty\@secpenalty
904 \if@cfthaschapter
905 \vspace*{\@nameuse{cftbefore#3titleskip}}%
906 \else
907 \vspace{\@nameuse{cftbefore#3titleskip}}%
908 \fi
909 \@cftpagestyle
910 {\interlinepenalty\@M
911 {\@nameuse{cft#3titlefont}#4}{\@nameuse{cftafter#3title}}%
912 \@nameuse{cftmark#3}%
913 \par\nobreak
914 \vskip \@nameuse{cftafter#3titleskip}%
915 \@afterheading}}
916
\cftbeforeZtitleskip
\cftafterZtitleskip
\cftZtitlefont
The skips before and after the title heading, and the title font. The default values
depend on whether or not the document class has chapters.
917 \expandafter\newlength\csname cftbefore#3titleskip\endcsname
918 \expandafter\newlength\csname cftafter#3titleskip\endcsname
919 \if@cfthaschapter
920 \setlength{\@nameuse{cftbefore#3titleskip}}{50pt}
921 \setlength{\@nameuse{cftafter#3titleskip}}{40pt}
922 \if@cftkoma
923 \@namedef{cft#3titlefont}{\size@chapter\sectfont}
924 \else
925 \@namedef{cft#3titlefont}{\normalfont\Huge\bfseries}
926 \fi
927 \else
928 \setlength{\@nameuse{cftbefore#3titleskip}}{3.5ex \@plus 1ex \@minus .2ex}
929 \setlength{\@nameuse{cftafter#3titleskip}}{2.3ex \@plus .2ex}
45
930 \if@cftkoma
931 \@namedef{cft#3titlefont}{\size@section\sectfont}
932 \else
933 \@namedef{cft#3titlefont}{\normalfont\Huge\bfseries}
934 \fi
935 \fi
\cftafterZtitle Something to go after the title.
936 \@namedef{cftafter#3title}{}
\cftZprehook
\cftZposthook
Hooks before and after the list of entries.
937 \@namedef{cft#3prehook}{}
938 \@namedef{cft#3posthook}{}
This is the end of the definition of \newlistof.
939 }
\cftsetindents \cftsetindents{hentryi}{hindenti}{hnumwidthi} sets the indent and numwidth
for entry hentryi. The macro has to map between the external entry name and
the internal shorthand.
940 \newcommand{\cftsetindents}[3]{%
941 \def\@cftemp{#1}
942 \ifx\@cftemp\cftchapname
943 \@cftsetindents{chap}{#2}{#3}
944 \else
945 \ifx\@cftemp\cftsecname \@cftsetindents{sec}{#2}{#3}
946 \else
947 \ifx\@cftemp\cftsubsecname \@cftsetindents{subsec}{#2}{#3}
948 \else
949 \ifx\@cftemp\cftsubsubsecname \@cftsetindents{subsubsec}{#2}{#3}
950 \else
951 \ifx\@cftemp\cftparaname \@cftsetindents{para}{#2}{#3}
952 \else
953 \ifx\@cftemp\cftsubparaname \@cftsetindents{subpara}{#2}{#3}
954 \else
955 \ifx\@cftemp\cftfigname \@cftsetindents{fig}{#2}{#3}
956 \else
957 \ifx\@cftemp\cftsubfigname \@cftsetindents{subfig}{#2}{#3}
958 \else
959 \ifx\@cftemp\cfttabname \@cftsetindents{tab}{#2}{#3}
960 \else
961 \ifx\@cftemp\cftsubtabname \@cftsetindents{subtab}{#2}{#3}
962 \else
963 \@cftsetindents{#1}{#2}{#3}
964 \fi
965 \fi
966 \fi
967 \fi
968 \fi
969 \fi
46
970 \fi
971 \fi
972 \fi
973 \fi
974 }
975
\@cftsetindents \@cftsetindents{hX i}{hindenti}{hnumwidthi} is the internal version of \cftsetindents,
where in this case hX i is the internal (shorthand) name of the entry.
976 \newcommand{\@cftsetindents}[3]{%
977 \setlength{\@nameuse{cft#1indent}}{#2}
978 \setlength{\@nameuse{cft#1numwidth}}{#3}
979 }
980
3.3 Switching page numbering
\@cftpnumoff \@cftpnumoff{hshorthandi} is the workhorse for switching page numbering off.
The hshorthand i argument is the shorthand name of the entry (e.g. subsec for
subsection). The macro redefines the \cftXnumfill command so that there is
no leader and the page number is ignored.
981 \newcommand{\@cftpnumoff}[1]{%
982 \@namedef{cft#1fillnum}##1{%
983 \cftparfillskip\@nameuse{cft#1afterpnum}\par}}
984
\cftchapname
\cftsecname
\cftsubsecname
\cftsubsubsecname
\cftparaname
\cftsubparaname
\cftfigname
\cftsubfigname
\cfttabname
\cftsubtabname
Unfortunately an early design decision was the use shorthands like sec for
section. For the page switching I need to be able to correlate the shorthands
and longhands.
985 \newcommand*{\cftchapname}{chapter}
986 \newcommand*{\cftsecname}{section}
987 \newcommand*{\cftsubsecname}{subsection}
988 \newcommand*{\cftsubsubsecname}{subsubsection}
989 \newcommand*{\cftparaname}{paragraph}
990 \newcommand*{\cftsubparaname}{subparagraph}
991 \newcommand*{\cftfigname}{figure}
992 \newcommand*{\cftsubfigname}{subfigure}
993 \newcommand*{\cfttabname}{table}
994 \newcommand*{\cftsubtabname}{subtable}
995
\cftpagenumbersoff The user level command for switching off page numbers is \cftpagenumbersoff{hentryi}
where hentryi is the longhand name of the entry. The principal task opf this macro
is to determine the corresponding shorthand name of the hentryi and then call
\@cftpnumoff to do the work. For part and user-defined entries the long- and
short-hand entry names are identical.
996 \DeclareRobustCommand{\cftpagenumbersoff}[1]{%
997 \def\@cftemp{#1}
47
998 \ifx\@cftemp\cftchapname
999 \@cftpnumoff{chap}
1000 \else
1001 \ifx\@cftemp\cftsecname \@cftpnumoff{sec}
1002 \else
1003 \ifx\@cftemp\cftsubsecname \@cftpnumoff{subsec}
1004 \else
1005 \ifx\@cftemp\cftsubsubsecname \@cftpnumoff{subsubsec}
1006 \else
1007 \ifx\@cftemp\cftparaname \@cftpnumoff{para}
1008 \else
1009 \ifx\@cftemp\cftsubparaname \@cftpnumoff{subpara}
1010 \else
1011 \ifx\@cftemp\cftfigname \@cftpnumoff{fig}
1012 \else
1013 \ifx\@cftemp\cftsubfigname \@cftpnumoff{subfig}
1014 \else
1015 \ifx\@cftemp\cfttabname \@cftpnumoff{tab}
1016 \else
1017 \ifx\@cftemp\cftsubtabname \@cftpnumoff{subtab}
1018 \else
1019 \@cftpnumoff{#1}
1020 \fi
1021 \fi
1022 \fi
1023 \fi
1024 \fi
1025 \fi
1026 \fi
1027 \fi
1028 \fi
1029 \fi
1030 }
1031
\cftpagenumberson \cftpagenumberson{hentryi} is the user level command for reversing the corre-
sponding \cftpagenumbersoff.
1032 \DeclareRobustCommand{\cftpagenumberson}[1]{%
1033 \def\@cftemp{#1}
1034 \ifx\@cftemp\cftchapname
1035 \@cftpnumon{chap}
1036 \else
1037 \ifx\@cftemp\cftsecname \@cftpnumon{sec}
1038 \else
1039 \ifx\@cftemp\cftsubsecname \@cftpnumon{subsec}
1040 \else
1041 \ifx\@cftemp\cftsubsubsecname \@cftpnumon{subsubsec}
1042 \else
1043 \ifx\@cftemp\cftparaname \@cftpnumon{para}
1044 \else
48
1045 \ifx\@cftemp\cftsubparaname \@cftpnumon{subpara}
1046 \else
1047 \ifx\@cftemp\cftfigname \@cftpnumon{fig}
1048 \else
1049 \ifx\@cftemp\cftsubfigname \@cftpnumon{subfig}
1050 \else
1051 \ifx\@cftemp\cfttabname \@cftpnumon{tab}
1052 \else
1053 \ifx\@cftemp\cftsubtabname \@cftpnumon{subtab}
1054 \else
1055 \@cftpnumon{#1}
1056 \fi
1057 \fi
1058 \fi
1059 \fi
1060 \fi
1061 \fi
1062 \fi
1063 \fi
1064 \fi
1065 \fi
1066 }
1067
\@cftpnumon \@cftpnumon{hshorthandi} is the workhorse for switching page numbering off.
The hshorthand i argument is the shorthand name of the entry (e.g. subsec for
subsection). The macro defines the \cftXnumfill command to correspond to
the default definition.
1068 \newcommand{\@cftpnumon}[1]{%
1069 \@namedef{cft#1fillnum}##1{%
1070 {\@nameuse{cft#1leader}}\nobreak
1071 \makebox[\@pnumwidth][\cftpnumalign]{\@nameuse{cft#1pagefont}##1}\@nameuse{cft#1afterpnum}\par
1072 }%
1073 }
3.4 Experimental utilities
The code in this section is experimental but in the sense that the capabilities
might be modified in the future rather than that the code does not work.
\cftchapterprecis This is experimental. \cftchapterprecis{htext i} typesets htexti at the point
where it is called, and also adds htexti to the .toc file. It is expects to be called
immediately after a \chapter command.
1074 \newcommand{\cftchapterprecis}[1]{%
1075 \cftchapterprecishere{#1}
1076 \cftchapterprecistoc{#1}}
\cftchapterprecishere \cftchapterprecishere{htexti} typesets htexti. It expects to be called immedi-
ately after a \chapter command. First add some negative vertical space to move
49
it closer to the chapter heading.
1077 \newcommand{\cftchapterprecishere}[1]{%
1078 \vspace*{-2\baselineskip}
Typeset its argument using italic font in a quote environment.
1079 \begin{quote}\textit{#1}\end{quote}}
\cftchapterprecistoc \cftchapterprecistoc{htexti} adds htext i to the .toc file. The htexti will be
typeset within the same margins as the the title text of a \chapter heading, using
an italic font.
1080 \newcommand{\cftchapterprecistoc}[1]{\addtocontents{toc}{%
Start a group to localize changes to the paragraphing. Set the left margin to the
chapter indent plus the chapter number width.
1081 {\leftskip \cftchapindent\relax
1082 \advance\leftskip \cftchapnumwidth\relax
Set the right hand margin to \@tocrmarg.
1083 \rightskip \@tocrmarg\relax
Typeset htexti using an italic font, then ensure that the paragraph is finished (to
use the local skips). Finally close the group and we are done.
1084 \textit{#1}\protect\par}}}
1085
\cftlocalchange \cftmakelocalchange{hfilei}{hpnumwidthi}{htocrmargi} makes an entry into
hfilei to change the \@pnumwidth and the \@tocrmarg values.
1086 \newcommand{\cftlocalchange}[3]{%
1087 \addtocontents{#1}{\protect\cftsetpnumwidth{#2} \protect\cftsetrmarg{#3}}}
\cftaddtitleline \cftaddtitleline{hfilei}{hkind i}{htitlei}{hpagei} adds a \contentsline entry
to hfilei with the given information.
1088 \newcommand{\cftaddtitleline}[4]{\addtocontents{#1}{%
1089 \protect\contentsline{#2}{#3}{#4}}}
\cftaddnumtitleline \cftaddtitleline{hfilei}{hkind i}{hnumi}{htitlei}{hpagei} adds a \contentsline
entry to hfilei with the given information.
1090 \newcommand{\cftaddnumtitleline}[5]{\addtocontents{#1}{%
1091 \protect\contentsline{#2}{\protect\numberline{#3}#4}{#5}}}
And, if dear old hyperref has been used, we have to fix up these two macros.
1092 \AtBeginDocument{%
1093 \@ifpackageloaded{hyperref}{%
1094 \renewcommand{\cftaddtitleline}[4]{\addtocontents{#1}{%
1095 \protect\contentsline{#2}{#3}{#4}{\@currentHref}}}
1096 \renewcommand{\cftaddnumtitleline}[5]{\addtocontents{#1}{%
1097 \protect\contentsline{#2}{\protect\numberline{#3}#4}{#5}{\@currentHref}}}
1098 }{}
1099 }
1100
50
\@starttoc Okay, here’s a roughly-comprehensive list where \@starttoc is redefined in T
E
X
Live 2014.
amsart, amsbook, amsdtx, amsproc
asect
latx.ltx (of course)
newfloat
flowfram
gmampulex (?), gmtypos
hyperref, memhfixc
ijmart
scrartcl, scrbook, scrreprt
scrwtfile
tocbasic
tocstyle
memoir
multitoc
nccsect
notoccite
artikel3, boek3, rapport3,
rerunfilecheck
parskip
pdfwin
revtex4
devanagari
This makes things difficult if we want to redefine \@starttoc here. 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.
So for our own work here, let’s be extra conservative, at least for now, and
only hook into \starttoc if it’s the standard L
A
T
E
X version.
1101 \def\@starttoc@latex@orig#1{%
1102 \begingroup
51
1103 \makeatletter
1104 \@input{\jobname.#1}%
1105 \if@filesw
1106 \expandafter\newwrite\csname tf@#1\endcsname
1107 \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
1108 \fi
1109 \@nobreakfalse
1110 \endgroup}
1111 \ifx\@starttoc\@starttoc@latex@orig
1112 \def\@starttoc#1{%
1113 \csname cft#1prehook\endcsname
1114 \begingroup
1115 \makeatletter
1116 \@input{\jobname.#1}%
1117 \if@filesw
1118 \expandafter\newwrite\csname tf@#1\endcsname
1119 \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
1120 \fi
1121 \@nobreakfalse
1122 \endgroup
1123 \csname cft#1posthook\endcsname}
1124 \newcommand\cfttocprehook{}
1125 \newcommand\cftlofprehook{}
1126 \newcommand\cftlotprehook{}
1127 \newcommand\cfttocposthook{}
1128 \newcommand\cftlofposthook{}
1129 \newcommand\cftlotposthook{}
1130 \else
1131 \PackageWarning{tocloft}{\string\@starttoc\space has already been redefined; tocloft bailing out.}
1132 \fi
The end of this package.
1133 h/usci
References
[Coc95] Steven Douglas Cochran. The subfigure package. March 1995. (Available
from CTAN as file subfigure.dtx)
[Dru99] Jean-Pierre Drucbert. The minitoc package. August 1999. (Available
from CTAN in subdirectory /minitoc)
[GMS94] Michel Goossens, Frank Mittelbach, and Alexander Samarin. The LaTeX
Companion. Addison-Wesley Publishing Company, 1994.
[Lin97] Ulf A. Lindgren. FncyChap V1.11. April 1997. (Available from CTAN
in subdirectory /fncychap)
52
[Lin95] Anselm Lingnau. An Improved Environment for Floats. March 1995.
(Available from CTAN in subdirectory /float)
[Wil96a] Peter Williams. Algorithms. April 1996. (Available from CTAN in
subdirectory /algorithm)
[Wil96b] Peter R. Wilson. LaTeX for standards: The LaTeX package files user
manual. NIST Report NISTIR, June 1996.
[Wil00] Peter R. Wilson. The tocbibind package. March 2000. (Available from
CTAN as file tocbibind.dtx)
[Wil01] Peter R. Wilson. The ccaption package. March 2001. (Available from
CTAN as file ccaption.dtx)
Index
Numbers written in italic refer to the page where the corresponding entry is de-
scribed; numbers underlined refer to the code line of the definition; numbers in
roman refer to the code lines where the entry is used.
Symbols
\@afterheading . . . .
. 132, 541, 643, 915
\@afterindenttrue .
. . . . 198, 254,
301, 346, 386,
426, 466, 567,
669, 706, 749, 816
\@cftasnum . 18, 167,
168, 203, 259,
306, 351, 391,
431, 471, 572,
674, 711, 754, 821
\@cftasnumb . 18, 167,
168, 204, 260,
307, 352, 392,
432, 472, 573,
675, 712, 755, 822
\@cftbsnum . 18, 167,
168, 202, 258,
305, 350, 390,
430, 470, 571,
673, 710, 753, 820
\@cftdobiblof . 500, 520
\@cftdobiblot . 602, 622
\@cftdobibtoc . . 80, 112
\@cftdopartfalse . . 176
\@cftdoparttrue 179, 183
\@cftemp . . 941, 942,
945, 947, 949,
951, 953, 955,
957, 959, 961,
997, 998, 1001,
1003, 1005,
1007, 1009,
1011, 1013,
1015, 1017,
1033, 1034,
1037, 1039,
1041, 1043,
1045, 1047,
1049, 1051, 1053
\@cfthaschapterfalse 19
\@cfthaschaptertrue 25
\@cfthaspartfalse . 173
\@cfthasparttrue . . 173
\@cftifundefined . .
. . . . 2, 18, 20, 173
\@cftkomafalse . . . . 12
\@cftkomatrue 13, 14, 15
\@cftl@subfig . . . . .
. . . . 699, 787, 791
\@cftl@subtab . . . . .
. . . . 742, 787, 791
\@cftmakeZtitle . . . 902
\@cftmakeloftitle .
. . . . . . . . 518, 528
\@cftmakelottitle .
. . . . . . . . 620, 630
\@cftmaketoctitle .
. . . . . . . . 110, 119
\@cftnctocfalse . . . 40
\@cftnctoctrue . . . . 41
\@cftpagestyle . 48,
126, 535, 637, 909
\@cftpnumoff . . . . . .
981, 999, 1001,
1003, 1005,
1007, 1009,
1011, 1013,
1015, 1017, 1019
\@cftpnumon . . . 1035,
1037, 1039,
1041, 1043,
1045, 1047,
1049, 1051,
1053, 1055, 1068
\@cftquit . . . . 9, 23, 27
\@cftsetindents . . .
. . . . 943, 945,
947, 949, 951,
53
953, 955, 957,
959, 961, 963, 976
\@cftsetsubfig . . . .
. . . . 720, 786, 790
\@cftsetsubtab . . . .
. . . . 762, 786, 790
\@cftsubfigoptfalse 43
\@cftsubfigopttrue . 44
\@cfttitlesectrue . 17
\@cfttocbibindfalse 30
\@cfttocbibindtrue . 30
\@cfttocfinish . . . .
. . . . . 66, 116,
524, 626, 889, 899
\@cfttocstart 66, 106,
514, 616, 881, 892
\@currentHref 1095, 1097
\@dotsep . . . . . . . . . . 2
\@dottedtocline . . . . 4
\@eha . . . . . . . . . . . . 808
\@firstoftwo . . . . . . . 5
\@highpenalty . 189, 249
\@ifclassloaded . . .
. . . . . . . 13, 14, 15
\@ifpackagelater . . 32
\@ifpackageloaded .
. . . . . 17, 30, 1093
\@ifundefined . 795, 799
\@namedef . . . . 810,
849, 850, 851,
852, 853, 854,
855, 856, 857,
858, 869, 873,
876, 880, 891,
902, 923, 925,
931, 933, 936,
937, 938, 982, 1069
\@nameuse . . . . . . . .
. 811, 812, 813,
816, 819, 824,
825, 830, 834,
835, 837, 838,
840, 841, 843,
844, 846, 847,
854, 859, 860,
887, 896, 905,
907, 911, 912,
914, 920, 921,
928, 929, 977,
978, 983, 1070, 1071
\@nobreakfalse . . . .
211, 215, 1109, 1121
\@nobreaktrue . 210, 214
\@pnumwidth . . 2, 150,
238, 283, 338,
378, 418, 458,
498, 595, 697,
738, 780, 860, 1071
\@restonecolfalse . 71
\@restonecoltrue . . 69
\@secondoftwo . . . . . . 7
\@secpenalty 120, 191,
295, 529, 631, 903
\@starttoc . . . . . . .
97, 98, 114, 522,
624, 888, 897, 1101
\@starttoc@latex@orig
. . . . . . 1101, 1111
\@tempa . . . . . . 155, 157
\@tempb . . . . . . 156, 157
\@tocextra 87, 507, 609
\@tocrmarg . . 2, 151,
196, 252, 299,
344, 384, 424,
464, 565, 667,
704, 747, 814, 1083
A
\addcontentsline . .
. . . . 2, 84, 87,
504, 507, 606, 609
\addtocontents . . . .
. . . . . 4, 1080,
1087, 1088,
1090, 1094, 1096
\AtBeginDocument . .
17, 29, 94, 511,
613, 787, 789, 1092
B
\baselineskip . . . . 1078
C
\c@lofdepth . . . 562, 701
\c@lotdepth . . . 664, 744
\c@tocdepth . . . 177,
181, 248, 291,
341, 381, 421, 461
\c@X . . . . . . . . . . . . . 795
\cftaddnumtitleline
. . . 17, 1090, 1096
\cftaddtitleline . .
. . . 17, 1088, 1094
\cftafterloftitle .
. . . . . . . . 537, 552
\cftafterloftitleskip
. . . . . . . . 540, 543
\cftafterlottitle .
. . . . . . . . 639, 654
\cftafterlottitleskip
. . . . . . . . 642, 645
\cftaftertoctitle .
. . . . . . . . 128, 142
\cftaftertoctitleskip
. . . . . . . . 131, 133
\cftafterZtitle . 7, 936
\cftafterZtitleskip
. . . . . . . . . 7, 917
\cftbeforechapskip .
. . . . . . . . 250, 266
\cftbeforefigskip .
. . . . . . . . 563, 579
\cftbeforeloftitleskip
. . . . 531, 533, 543
\cftbeforelottitleskip
. . . . 633, 635, 645
\cftbeforeparaskip .
. . . . . . . . 422, 437
\cftbeforepartskip .
. . . . . . . . 193, 221
\cftbeforesecskip .
. . . . 293, 296, 312
\cftbeforesubfigskip
. . . . . . . . 702, 721
\cftbeforesubparaskip
. . . . . . . . 462, 477
\cftbeforesubsecskip
. . . . . . . . 342, 357
\cftbeforesubsubsecskip
. . . . . . . . 382, 397
\cftbeforesubtabskip
. . . . . . . . 745, 763
\cftbeforetabskip .
. . . . . . . . 665, 681
\cftbeforetoctitleskip
. . . . 122, 124, 133
\cftbeforeXskip . 9, 829
\cftbeforeZtitleskip
. . . . . . . . . 7, 917
54
\cftchapafterpnum . 266
\cftchapaftersnum .
. . . . . . . . 259, 266
\cftchapaftersnumb .
. . . . . . . . 260, 266
\cftchapdotsep . . . . 266
\cftchapfillnum 263, 266
\cftchapfont . . 262, 266
\cftchapindent . . . .
251, 254, 266, 1081
\cftchapleader . . . . 266
\cftchapname . . . . . .
942, 985, 998, 1034
\cftchapnumwidth . .
. . . 257, 266, 1082
\cftchappagefont . . 266
\cftchappresnum 258, 266
\cftchapterprecis .
. . . . . . . . 16, 1074
\cftchapterprecishere
. . . 16, 1075, 1077
\cftchapterprecistoc
. . . 16, 1076, 1080
\cftdot . . . . . . . . 8, 153
\cftdotfill . . . 153,
230, 277, 323,
331, 372, 412,
452, 492, 589,
691, 731, 773, 854
\cftdotsep . . 8, 163,
324, 373, 413,
453, 493, 590,
692, 732, 774, 853
\cftfigafterpnum . . 579
\cftfigaftersnum . .
. . . . . . . . 572, 579
\cftfigaftersnumb .
. . . . . . . . 573, 579
\cftfigdotsep . . . . . 579
\cftfigfillnum 576, 579
\cftfigfont . . . 575, 579
\cftfigindent . . . . .
. . . . 564, 567, 579
\cftfigleader . . . . . 579
\cftfigname . . . . . . .
955, 985, 1011, 1047
\cftfignumwidth 570, 579
\cftfigpagefont . . . 579
\cftfigpresnum 571, 579
\cftlocalchange 16, 1086
\cftlofposthook . . 1128
\cftlofprehook . . . 1125
\cftloftitlefont . .
. . . . . . . . 537, 552
\cftlotposthook . . 1129
\cftlotprehook . . . 1126
\cftlottitlefont . .
. . . . . . . . 639, 654
\cftmarklof . . . . 52, 538
\cftmarklot . . . . 52, 640
\cftmarktoc . . . . 52, 129
\cftmarkZ . . . . . . 7, 872
\cftnodots . . 8, 156,
163, 231, 278, 332
\cftpagenumbersoff .
. . . . . . . . 12, 996
\cftpagenumberson .
. . . . . . . . 12, 1032
\cftparaafterpnum . 437
\cftparaaftersnum .
. . . . . . . . 431, 437
\cftparaaftersnumb .
. . . . . . . . 432, 437
\cftparadotsep . . . . 437
\cftparafillnum 435, 437
\cftparafont . . 434, 437
\cftparaindent . . . .
. . . . 423, 426, 437
\cftparaleader . . . . 437
\cftparaname . . . . . .
951, 985, 1007, 1043
\cftparanumwidth . .
. . . . . . . . 429, 437
\cftparapagefont . . 437
\cftparapresnum 430, 437
\cftparfillskip 165, 983
\cftparskip . . . . . . .
. 9, 91, 96, 100,
109, 517, 619, 895
\cftpartafterpnum . 221
\cftpartaftersnum .
. . . . . . . . 203, 221
\cftpartaftersnumb .
. . . . . . . . 204, 221
\cftpartdotsep . . . . 221
\cftpartfillnum 207, 221
\cftpartfont . . 206, 221
\cftpartindent . . . .
. . . . 195, 198, 221
\cftpartleader . . . . 221
\cftpartnumwidth . .
. . . . . . . . 201, 221
\cftpartpagefont . . 221
\cftpartpresnum . . .
. . . . 202, 206, 221
\cftpnumalign 8, 152,
238, 283, 338,
378, 418, 458,
498, 595, 697,
738, 780, 860, 1071
\cftsecafterpnum . . 312
\cftsecaftersnum . .
. . . . . . . . 306, 312
\cftsecaftersnumb .
. . . . . . . . 307, 312
\cftsecdotsep . . . . . 312
\cftsecfillnum 310, 312
\cftsecfont . . . 309, 312
\cftsecindent . . . . .
. . . . 298, 301, 312
\cftsecleader . . . . . 312
\cftsecname . . . . . . .
945, 985, 1001, 1037
\cftsecnumwidth 304, 312
\cftsecpagefont . . . 312
\cftsecpresnum 305, 312
\cftsetindents . 10, 940
\cftsetpnumwidth . .
. . . . . 8, 150, 1087
\cftsetrmarg 8, 150, 1087
\cftsubfigafterpnum 721
\cftsubfigaftersnum
. . . . . . . . 711, 721
\cftsubfigaftersnumb
. . . . . . . . 712, 721
\cftsubfigdotsep . . 721
\cftsubfigfillnum .
. . . . . . . . 715, 721
\cftsubfigfont 714, 721
\cftsubfigindent . .
. . . . 703, 706, 721
\cftsubfigleader . . 721
\cftsubfigname . . . .
957, 985, 1013, 1049
\cftsubfignumwidth .
. . . . . . . . 709, 721
\cftsubfigpagefont . 721
\cftsubfigpresnum .
. . . . . . . . 710, 721
55
\cftsubparaafterpnum
. . . . . . . . . . . 477
\cftsubparaaftersnum
. . . . . . . . 471, 477
\cftsubparaaftersnumb
. . . . . . . . 472, 477
\cftsubparadotsep . 477
\cftsubparafillnum .
. . . . . . . . 475, 477
\cftsubparafont 474, 477
\cftsubparaindent .
. . . . 463, 466, 477
\cftsubparaleader . 477
\cftsubparaname . . .
953, 985, 1009, 1045
\cftsubparanumwidth
. . . . . . . . 469, 477
\cftsubparapagefont 477
\cftsubparapresnum .
. . . . . . . . 470, 477
\cftsubsecafterpnum
. . . . . . . . 357, 378
\cftsubsecaftersnum
. . . . . . . . 351, 357
\cftsubsecaftersnumb
. . . . . . . . 352, 357
\cftsubsecdotsep . . 357
\cftsubsecfillnum .
. . . . . . . . 355, 376
\cftsubsecfont 354, 357
\cftsubsecindent . .
. . . . 343, 346, 357
\cftsubsecleader . .
. . . . . . . . 357, 377
\cftsubsecname . . . .
947, 985, 1003, 1039
\cftsubsecnumwidth .
. . . . . . . . 349, 357
\cftsubsecpagefont .
. . . . . . . . 357, 378
\cftsubsecpresnum .
. . . . . . . . 350, 357
\cftsubsubsecafterpnum
. . . . . . . . . . . 397
\cftsubsubsecaftersnum
. . . . . . . . 391, 397
\cftsubsubsecaftersnumb
. . . . . . . . 392, 397
\cftsubsubsecdotsep 397
\cftsubsubsecfillnum
. . . . . . . . 395, 397
\cftsubsubsecfont .
. . . . . . . . 394, 397
\cftsubsubsecindent
. . . . 383, 386, 397
\cftsubsubsecleader 397
\cftsubsubsecname .
949, 985, 1005, 1041
\cftsubsubsecnumwidth
. . . . . . . . 389, 397
\cftsubsubsecpagefont
. . . . . . . . . . . 397
\cftsubsubsecpresnum
. . . . . . . . 390, 397
\cftsubtabafterpnum 763
\cftsubtabaftersnum
. . . . . . . . 754, 763
\cftsubtabaftersnumb
. . . . . . . . 755, 763
\cftsubtabdotsep . .
. . . . . . . . 731, 763
\cftsubtabfillnum .
. . . . . . . . 758, 763
\cftsubtabfont 757, 763
\cftsubtabindent . .
. . . . 746, 749, 763
\cftsubtableader . . 763
\cftsubtabname . . . .
961, 985, 1017, 1053
\cftsubtabnumwidth .
. . . . . . . . 752, 763
\cftsubtabpagefont . 763
\cftsubtabpresnum .
. . . . . . . . 753, 763
\cfttabafterpnum . . 681
\cfttabaftersnum . .
. . . . . . . . 674, 681
\cfttabaftersnumb .
. . . . . . . . 675, 681
\cfttabdotsep . . . . . 681
\cfttabfillnum 678, 681
\cfttabfont . . . 677, 681
\cfttabindent . . . . .
. . . . 666, 669, 681
\cfttableader . . . . . 681
\cfttabname . . . . . . .
959, 985, 1015, 1051
\cfttabnumwidth 672, 681
\cfttabpagefont . . . 681
\cfttabpresnum 673, 681
\cfttocposthook . . 1127
\cfttocprehook . . . 1124
\cfttoctitlefont . .
. . . . . . . . 128, 142
\cftXafterpnum . 10, 849
\cftXaftersnum . 10, 849
\cftXaftersnumb 10, 849
\cftXdotsep . . . . 10, 849
\cftXfillnum . . . . . . 858
\cftXfont . . . . . 10, 849
\cftXindent . . . . . 9, 831
\cftXleader . . . . 10, 849
\cftXnumwidth . . . 9, 831
\cftXpagefont . . 10, 849
\cftXpresnum . . . 10, 849
\cftZposthook . . 17, 937
\cftZprehook . . . 17, 937
\cftZtitlefont . . 7, 917
\chapter . . . . . . . . . 883
\contentsline 2, 1089,
1091, 1095, 1097
\contentsname . . . . .
53, 60, 84, 87, 128
\csname . 4, 803, 804,
820, 821, 822,
829, 831, 832,
917, 918, 1106,
1107, 1113,
1118, 1119, 1123
D
\DeclareRobustCommand
. . . . . . . 996, 1032
E
\edef . . . . . . . . . . . . 803
\endcsname 4, 803, 804,
820, 821, 822,
829, 831, 832,
917, 918, 1106,
1107, 1113,
1118, 1119, 1123
\endinput . . . . . . . . 23
\ext@Z . . . . . . . . . . . 869
H
\hb@xt@ . . . . . . . . . . 167
\Huge . . . . . . . . 143,
553, 655, 925, 933
56
I
\if@bibchapter . . . .
. . . . . 82, 502, 604
\if@cftdopart . . . . . 171
\if@cfthaschapter 9,
67, 75, 121, 135,
142, 178, 182,
188, 209, 246,
266, 292, 318,
361, 401, 441,
481, 530, 545,
552, 632, 647,
654, 882, 904, 919
\if@cfthaspart . . . .
. . . . 172, 174, 221
\if@cftkoma . . . . . . .
11, 58, 144, 147,
206, 240, 285,
554, 557, 656,
659, 872, 922, 930
\if@cftnctoc . . . . . .
40, 95, 512, 614, 879
\if@cftsubfigopt . .
. 43, 597, 785, 789
\if@cfttitlesec 16, 206
\if@cfttocbibind . .
. 28, 111, 519, 621
\if@compatibility . 213
\if@dotoclof . . . . . . 501
\if@dotoclot . . . . . . 603
\if@dotoctoc . . . . . . 81
\if@filesw . 1105, 1117
\if@restonecol . . . . 76
\if@twocolumn . . . . . 68
\immediate . 1107, 1119
\interlinepenalty .
. 127, 199, 255,
302, 347, 387,
427, 467, 536,
568, 638, 670,
707, 750, 817, 910
L
\l@ . . . . . . . . . . . . . 827
\l@chapter . . . . . . . 246
\l@figure . . . . . . . . 561
\l@paragraph . . . . . . 420
\l@part . . . . . . . . . . 171
\l@section . . . . . . . 290
\l@subfigure . . . . . . 700
\l@subparagraph . . . 460
\l@subsection . . . . . 340
\l@subsubsection . . 380
\l@subtable . . . . . . . 743
\l@table . . . . . . . . . 663
\l@X . . . . . . . . . . 14, 810
\Large . . . . 146, 556, 658
\large . . . . . . . 226,
230, 232, 242, 243
\leaders . . . . . . . . . 160
\leftskip . . . . 195,
205, 251, 261,
298, 308, 343,
353, 383, 393,
423, 433, 463,
473, 564, 574,
666, 676, 703,
713, 746, 756,
813, 823, 1081, 1082
\listfigurename . . .
55, 62, 504, 507, 537
\listoffigures . . 6, 511
\listoftables . . . 6, 613
\listofX . . . . . . 14, 879
\listtablename . . . .
57, 64, 606, 609, 639
\lofdepth . . . . . . . . 597
\lotdepth . . . . . . . . 597
M
\makeatletter 1103, 1115
\makebox 238, 283, 338,
378, 418, 458,
498, 595, 697,
738, 780, 860, 1071
\MakeUppercase . . . .
. . . 53, 55, 57, 877
\MessageBreak 34, 35, 36
\mkern . . . . . . . . . . . 160
N
\newif . . . 10, 11, 16,
28, 40, 43, 171, 172
\newlistentry . . . . .
. 14, 794, 865, 867
\newlistof . . . . 13, 863
\newwrite . . 1106, 1118
\noexpand . . . . . . . . 804
\normalfont . . . 143,
146, 322, 323,
325, 368, 372,
374, 408, 412,
414, 448, 452,
454, 488, 492,
494, 553, 556,
585, 589, 591,
655, 658, 687,
691, 693, 727,
731, 733, 769,
773, 775, 849,
854, 855, 925, 933
\numberline . . . . . 3, 166
O
\OLD@starttoc . . 97, 101
\onecolumn . . . . . . . 69
\openout . . . 1107, 1119
P
\PackageError . . . . . 808
\PackageInfo . . . . 24, 26
\PackageWarning . . .
. 21, 33, 799, 1131
\parindent . . . . . . .
. 109, 198, 254,
301, 346, 386,
426, 466, 517,
567, 619, 669,
706, 749, 816, 895
\parskip . . . . . 100,
109, 517, 619, 895
\phantomsection . . .
. . . 78, 83, 86,
503, 506, 605, 608
\providecommand . . .
66, 74, 78, 153,
154, 163, 735, 777
S
\sectfont . . . . 144,
147, 242, 243,
286, 554, 557,
656, 659, 923, 931
\section . . . . . . . . . 885
\size@chapter . . . . .
. 144, 554, 656, 923
\size@section . . . . .
. 147, 557, 659, 931
\string . . . . . . . . . 1131
57
T
\tableofcontents . 6, 94
\textit . . . . 1079, 1084
\theX . . . . . . . . . 15, 795
\thispagestyle . . . . 49
\toclevel@subfig . . 721
\toclevel@subfigure
. . . . . . . . 701, 735
\toclevel@subtable .
. . . . . . . . 744, 763
\toclevel@X . . . . . . . 857
\tocloftpagestyle 6, 48
\twocolumn . . . . . . . 76
Z
\Zdepth . . . . . 8, 14, 869
58