% \iffalse meta-comment
%
% tocloft.dtx
% Copyright 1998, 1999 Peter R. Wilson
%
% This program is provided under the terms of the
% LaTeX Project Public License distributed from CTAN
% archives in directory macros/latex/base/lppl.txt.
%
% Author: Peter Wilson (CUA) (now at: peter.r.wilson@boeing.com)
% 
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\setcounter{StandardModuleDepth}{1}
\begin{document}
  \DocInput{tocloft.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{1288}
%
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
% \DoNotIndex{\@centercr,\@cite}
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
% \DoNotIndex{\@input,\@ixpt,\@m}
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
% \DoNotIndex{\advance,\Alph,\alph}
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
% \DoNotIndex{\bullet}
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
% \DoNotIndex{\fbox}
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
% \DoNotIndex{\input}
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
% \DoNotIndex{\NeedsTeXFormat,\newdimen}
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
% \DoNotIndex{\wd,\xiipt,\year,\z@}
%
% \changes{v0.1}{1998/12/31}{First public (alpha) release}
% \changes{v0.1a}{1999/01/15}{Improved documentation}
% \changes{v0.2}{1999/01/17}{Uses the stdclsdv package}
% \changes{v0.2a}{1999/01/17}{Interfaced with the tocbibind package}
% \changes{v0.2b}{1999/03/07}{Corrected failure when used with float package}
% \changes{v0.2c}{1999/06/30}{Added raggedright example}
% \changes{v0.3}{1999/08/22}{Added option to prevent ToC head change}
% \changes{v1.0}{1999/09/19}{Added PackageNote reporting}
%
% \def\fileversion{v1.0}
% \def\filedate{1999/09/19}
% \newcommand*{\Lpack}[1]{\textsf {#1}}           ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}}            ^^A typeset an option
% \newcommand*{\file}[1]{\texttt {#1}}            ^^A typeset a file
% \newcommand*{\Lcount}[1]{\textsl {\small#1}}    ^^A typeset a counter
% \newcommand*{\pstyle}[1]{\textsl {#1}}          ^^A typeset a pagestyle
% \newcommand*{\Lenv}[1]{\texttt {#1}}            ^^A typeset an environment
% \providecommand{\bs}{\textbackslash}
%
% \title{The \Lpack{tocloft} package\thanks{This
%        file has version number \fileversion, last revised
%        \filedate.}}
%
% \author{%
% Peter Wilson\\
% Catholic University of America \\
% Now at {\tt peter.r.wilson@boeing.com}
% }
% \date{\filedate}
% \maketitle
% \begin{abstract}
%    The \Lpack{tocloft} package provides means of controlling the 
% typographic design of the Table of Contents, List of Figures and List of
% Tables. Use of this package requires the \Lpack{stdclsdv} package.
%
% The package has been tested with the 
% \Lpack{tocbibind}, \Lpack{float} and \Lpack{fncychap} packages, 
% and maybe others.
% \end{abstract}
% \tableofcontents
% \makeatletter \renewcommand{\@dotsep}{9.0} \makeatother
% \listoffigures
% \StopEventually{}
%
% 
%
% \section{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 \Lpack{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~\cite{PRW96i}.
% This manual is typeset according to the conventions of the
% \LaTeX{} \textsc{docstrip} utility which enables the automatic
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
%
%    Section~\ref{sec:usc} describes the usage of the package.
% Commented source code for the package is in Section~\ref{sec:code}.
% The package requires the \Lpack{stdclsdv} package.
%
% The package has been tested in combination with at least the \Lpack{tocbibind}
% package, the \Lpack{algorithm} package (which, in turn, calls the
% \Lpack{float} package) and the \Lpack{fncychap} 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.\footnote{Thanks to Rowland (\texttt{rebecca@astrid.u-net.com}),
%   John Foster (\texttt{john@isjf.demon.co.uk}),
%   Kasper (\texttt{kbg@dkik.dk}),
%   Lee Nave (\texttt{nave@math.washington.edu}),
%   and Andrew Thurber (\texttt{athurber@emba.uvm.edu})
%   for their suggestions.}
%
% \subsection{\LaTeX 's methods}
%
%    This is a general description of how \LaTeX{} 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.
%
% \DescribeMacro{\addcontentsline}
%    \LaTeX{} generates a \file{.toc} file if the document contains a
% |\tableofcontents| command. The sectioning 
% commands\footnote{For figures and tables it is the \texttt{\bs caption} command
% that populates the \file{.lof} and \file{.lot} files.}
% put entries into the \file{.toc} file by calling the \LaTeX{}
% |\addcontentsline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}|
% command, where \meta{file} is the file extension (e.g., |toc|),
% \meta{kind} is the kind of entry (e.g., |section| or |subsection|),
% and \meta{title} is the (numberered) title text. In the cases where
% there is a number, the \meta{title} argument is given in the
% form |{\numberline{number} title-text}|.
%
% \DescribeMacro{\contentsline}
%     The |\addcontentsline| command writes an entry to the given file
% in the form |\contentsline{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}|
% where \meta{page} is the page number.
%     For each \meta{kind}, \LaTeX{} provides a command 
% |\l@kind{|\meta{title}|}{|\meta{page}|}| which performs the actual
% typesetting of the |\contentsline| entry. 
%
% \newcommand{\maxx}{120}       ^^A picture width
% \newcommand{\maxxm}{118}      ^^A \maxx - 2\
% \newcommand{\maxy}{55}        ^^A picture height
% \newcommand{\maxym}{53}       ^^A \maxy - 2
% \newcommand{\findent}{20}     ^^A indent
% \newcommand{\findentp}{22}    ^^A \findent + 2
% \newcommand{\fnumwidth}{10}   ^^A numwidth
% \newcommand{\ftocrmarg}{30}   ^^A \@tocrmarg
% \newcommand{\fpnumwidth}{20}  ^^A \@pnumwidth
% \newcommand{\fipn}{30}        ^^A \findent + \fnumwidth
% \newcommand{\frmarg}{90}      ^^A \maxx - \ftocrmarg
% \newcommand{\frnum}{100}      ^^A \maxx - \fpnumwidth
% \newcommand{\fyi}{10}         ^^A 1st y height
% \newcommand{\fyim}{8}         ^^A \fyi - 2
% \newcommand{\fyii}{20}        ^^A 2nd y height
% \newcommand{\fyiii}{25}       ^^A 3rd y height
% \newcommand{\fyiv}{30}        ^^A 4th y height
% \newcommand{\fyv}{40}         ^^A 5th y height
% \newcommand{\fyvp}{42}        ^^A \fyv + 2
% \newcommand{\flin}{4}         ^^A length of leader lines
% \newcommand{\frmargm}{89}     ^^A \frmarg (90) - a little bit
% 
% \providecommand{\bs}{\textbackslash}
% \begin{figure}
% \centering
% \setlength{\unitlength}{1mm}
% \begin{picture}(\maxx,\maxy)
%     ^^A side lines and linewidth
%   \put(0,0){\line(0,1){\maxy}}
%   \put(\maxx,0){\line(0,1){\maxy}}
%   \put(0,\maxy){\vector(1,0){\maxx}}
%   \put(2,\maxym){\makebox(0,0)[tl]{\texttt{\bs linewidth}}}
%     ^^A \@pnumwidth
%   \put(\maxx,\fyi){\vector(-1,0){\fpnumwidth}}
%   \put(\maxxm,\fyim){\makebox(0,0)[tr]{\texttt{\bs @pnumwidth}}}
%   \put(\frnum,\fyi){\line(0,1){\flin}}
%     ^^A \@tocrmarg
%   \put(\maxx,\fyv){\vector(-1,0){\ftocrmarg}}
%   \put(\maxxm,\fyvp){\makebox(0,0)[br]{\texttt{\bs @tocrmarg}}}
%   \put(\frmarg,\fyv){\line(0,-1){\flin}}
%     ^^A indent
%   \put(0,\fyv){\vector(1,0){\findent}}
%   \put(2,\fyvp){\makebox(0,0)[bl]{\textit{indent}}}
%   \put(\findent,\fyv){\line(0,-1){\flin}}
%     ^^A numwidth
%   \put(\findent,\fyv){\vector(1,0){\fnumwidth}}
%   \put(\findentp,\fyvp){\makebox(0,0)[bl]{\textit{numwidth}}}
%   \put(\fipn,\fyv){\line(0,-1){\flin}}
%     ^^A last title line
%   \put(\maxx,\fyii){\makebox(0,0)[br]{487}}
%   \put(\fipn,\fyii){title end}
%     ^^A second title line
%   \put(\fipn,\fyiii){continue\ldots}
%   \put(\frmarg,\fyiii){\makebox(0,0)[br]{\ldots title}}
%     ^^A first title line
%   \put(\findent,\fyiv){\textbf{3.5}}
%   \put(\fipn,\fyiv){Heading\ldots}
%   \put(\frmarg,\fyiv){\makebox(0,0)[br]{\ldots title}}
%     ^^A dotted leader
%   \multiput(\frmargm,\fyii)(-\flin,0){12}{.}
%   \multiput(\frmarg,\fyi)(-\flin,0){2}{\line(0,1){\flin}}
%   \put(\frmarg,\fyi){\vector(-1,0){\flin}}
%   \put(\frmarg,\fyi){\vector(1,0){0}}
%   \put(\frmarg,\fyim){\makebox(0,0)[tr]{\texttt{\bs @dotsep}}}
% 
% \end{picture}
% \setlength{\unitlength}{1pt}
% \caption{Layout of a ToC (LoF, LoT) entry} \label{fig:ltoc}
% \end{figure}
% 
% 
% \DescribeMacro{\@pnumwidth}
% \DescribeMacro{\@tocrmarg}
% \DescribeMacro{\@dotsep}
% The general layout of a
% typeset entry is illustrated in Figure~\ref{fig:ltoc}. There are three
% internal \LaTeX{} 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
% \emph{math units}\footnote{There are 18mu to 1em.} 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:
% \begin{itemize}
% \item |\@pnumwidth| = 1.55em
% \item |\@tocrmarg| = 2.55em 
% \item |\@dotsep| = 4.5
% \end{itemize}
% 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 \Lpack{article} class and its derivatives).
%
% \DescribeMacro{\numberline}
%    Each |\l@kind| macro is responsible for setting the general 
% \textit{indent} from the lefthand margin, and the \textit{numwidth}.
% The |\numberline{|\meta{number}|}| macro is responsible for typesetting
% the number flushleft in a box of width 
% \textit{numwidth}. If the number is too long for the box then it will
% protrude into the title text. The title text is indented by
% (\textit{indent + numwidth}) from the lefthand margin. That is, the title
% text is typeset in a block of width \\
% (|\linewidth| - \textit{indent} - \textit{numwidth} - |\@tocrmarg|).
%
% \DescribeMacro{\@dottedtocline}
%    Most of the |\l@kind| commands are defined in terms of the
% |\@dottedtocline| command. This command takes three arguments: \\
% |\@dottedtocline{|\meta{seclevel}|}{|\meta{indent}|}{|\meta{numwidth}|}|. \\
% 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
% \Lpack{tocloft} package gives you handles to easily alter things without
% having to know the \LaTeX{} internals).
%
%    You can use the |\addcontentsline| command to add |\contentsline|
% commands to a file. 
%
% \DescribeMacro{\addtocontents}
%    \LaTeX{} also provides the |\addtocontents{|\meta{file}|}{|\meta{text}|}|
% command that will insert \meta{text} into \meta{file}. 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 \meta{file} processing, such as |\listoftables|
% for a \file{.lot} file).
%
% As |\addcontentsline| and |\addtocontents| write their arguments to a
% file, any fragile commands used in their arguments must be |\protect|ed.
% 
%    You can make certain adjustments to the ToC etc., layout without
% using any package. Some examples are:
% \begin{itemize}
% \item If your page numbers stick out into the righthand margin
%  \begin{verbatim}
%  \renewcommand{\@pnumwidth}{3em} \renewcommand{\@tocrmarg}{4em}
%  \end{verbatim}
% but using lengths appropriate to your document.
%
% \item To have the (sectional) titles in the ToC, etc., typeset ragged right with no
% hyphenation
% \begin{verbatim}
% \renewcommand{\@tocrmarg}{2.55em plus1fil}
% \end{verbatim}
% where the value |2.55em| can be changed for whatever margin space you want.
%
% \item The dots in the leaders can be eliminated by increasing |\@dotsep|
% to a large value:
%  \begin{verbatim}
%  \renewcommand{\@dotsep}{10000}
%  \end{verbatim}
%
% \item To have dotted leaders in your ToC and LoF but not in your LoT:
% \begin{verbatim}
% ...
% \tableofcontents
% \makeatletter \renewcommand{\@dotsep}{10000} \makeatother
% \listoftables
% \makeatletter \renewcommand{\@dotsep}{4.5} \makeatother
% \listoffigures
% ...
% \end{verbatim}
% 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.
%
% \item To add a horizontal line across the whole width of the ToC below 
% an entry for a Part:
% \begin{verbatim}
% \part{Part title}
% \addtocontents{toc}{\protect\mbox{}\protect\hrulefill\par}
% \end{verbatim}
% Note that as both |\addtocontents| and |\addcontentsline| write their
% arguments to a file, it means that any \emph{fragile} commands in
% their arguments must be protected
% by preceeding each fragile command with |\protect|. 
% The result of the example above
% would be the following two lines in the \file{.toc} file (assuming that it
% is the second Part and is on page 34):
% \begin{verbatim}
% \contentsline {part}{II\hspace {1em}Part title}{34}
% \mbox {}\hrulefill \par
% \end{verbatim}
% If the |\protect|s were not used, then the second line would instead be:
% \begin{small}
% \begin{verbatim}
% \unhbox \voidb@x \hbox {}\unhbox \voidb@x \leaders \hrule \hfill \kern \z@ \par
% \end{verbatim}
% \end{small}
%
% \end{itemize}
% Remember, if you are modifying any command that includes an |@| sign then this
% must be done in either a \file{.sty} file or if in the document itself
% it must be 
% surrounded 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:
% \begin{verbatim}
% \makeatletter
% \renewcommand{\@dotsep}{9.0}
% \makeatother
% \end{verbatim}
% 
%
% \section{The \Lpack{tocloft} package} \label{sec:usc}
%
% The \Lpack{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).
%
% \DescribeMacro{\tableofcontents}
% \DescribeMacro{\listoffigures}
% \DescribeMacro{\listoftables}
% The ToC, LoF, and LoT are printed at the point in the document where
% these commands are called, as per normal \LaTeX. However, there is
% one difference between the standard \LaTeX{} behaviour and the behaviour
% with the \Lpack{tocloft} package. In the standard \LaTeX{} classes
% that have |\chapter| headings, the ToC, LoF and LoT each appear on
% a new page. With the \Lpack{tocloft} package they do not automatically
% start new pages; if you want them to be on new pages you have to
% specifically issue an appropriate command beforehand. For example:
% \begin{verbatim}
%  ...
% \clearpage
% \tableofcontents
% \clearpage
% \listoftables
% ...
% \end{verbatim}
%
% \subsection{Changing the titles}
%
%    Commands are provided for controlling the appearance of the
% titles. Following \LaTeX{} 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 `X' to stand for `toc' or `lof' or `lot'. For
% example, |\cftmarkX| stands for |\cftmarktoc| or |\cftmarklof| or
% |\cftmarklot|.
%
% The package takes one option, namely \Lopt{titles}. This option causes
% the titles of the ToC, LoF, and LoT lists to be typeset using the
% default \LaTeX{} methods. This can be useful, for example, when the
% \Lpack{tocloft} and \Lpack{fncychap} packages are used together and
% the `fancy' chapter styles should be used for the ToC, etc., titles.
% If you use the \Lopt{titles} option you can ignore the rest of this
% section and continue reading at section~\ref{sec:entries}.
%
% \DescribeMacro{\cftmarkX}
% These macros set the appearance of the running heads on the ToC, LoF, and
% LoT pages. You probably don't need to change these.
%
% \DescribeMacro{\cftbeforeXtitleskip}
% \DescribeMacro{\cftafterXtitleskip}
% These lengths control the vertical spacing before and after the titles.
% You can change them from their default values by using |\setlength|.
%
% \DescribeMacro{\cftXtitlefont}
% \DescribeMacro{\cftafterXtitle}
% The code used for typesetting the ToC title looks like
% \begin{verbatim}
% {\cfttoctitlefont \contentsname}{\cftaftertoctitle}\par
% \end{verbatim}
% By default, |\cftXtitlefont| is defined as a font specification
% (e.g., |\Large\bfseries|), and |\cftafterXtitle| is empty.
% These commands can be changed (via |\renewcommand|) to change
% the typesetting. As examples:
% \begin{itemize}
% \item |\renewcommand{\cftXtitlefont}{\hfill\Large\itshape}| will
%       result in a Large italic title typeset flushright.
% \item |\renewcommand{\cftXtitlefont}{\hfill\Large\bfseries}| together
%       with |\renewcommand{\cftafterXtitle}{\hfill}| will give
%       a centered Large bold title.
% \item Doing
% \begin{verbatim}
% \renewcommand{\cftafterXtitle}{%
%   \\[\baselineskip]\mbox{}\hfill{\normalfont Page}}
% \end{verbatim}
%       will put the word `Page' flushright on the line following the title.
%       (If you do this, then you may need to decrease 
%        |\cftafterXtitleskip|).
% \end{itemize}
%
%
% \subsection{Typesetting the entries} \label{sec: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 \Lpack{layouts}
% package or in~\cite[page 34]{GOOSSENS94}, and are repeated in
% Figure~\ref{fig:ltoc}.
%
% \DescribeMacro{\cftdot}
%  In the default ToC typsetting only the more minor entries have dotted
% leader lines between the sectioning title and the page number. The
% \Lpack{tocloft} package provides 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 
% \begin{verbatim}
% \renewcommand{\cftdot}{\ensuremath{\ast}}
% \end{verbatim}
% will result in a dotted leader using asterisks as the symbol.
%
% \DescribeMacro{\cftdotsep}
% \DescribeMacro{\cftnodots}
%    Each kind of entry can control the seperation between the dots
% in its leader (see below). For consistency though, all dotted leaders
% should use the same spacing. The macro |\cftdotsep| specifies the
% default spacing. Its value is a number. 
% However, if the seperation is too large
% then no dots will be actually typeset. The macro |\cftnodots| is
% a seperation value that is `too large'.
%
% \DescribeMacro{\cftsetpnumwidth}
% \DescribeMacro{\cftsetrmarg}
% The page numbers are typeset in a fixed width box. The command
% |\cftsetpnumwidth{|\meta{length}|}| can be used to change the width
% of the box (\LaTeX 's internal |\@pnumwidth|). 
% The title texts will end before reaching the righthand margin.
% |\cftsetrmarg{|\meta{length}|}| can be used to set this distance 
% (\LaTeX '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.
%
%    In the following I will use |X| to stand for the following:
% \begin{itemize}
% \item |part| for |\part| titles
% \item |chap| for |\chapter| titles
% \item |sec| for |\section| titles
% \item |subsec| for |\subsection| titles
% \item |subsubsec| for |\subsubsection| titles
% \item |para| for |\paragraph| titles
% \item |subpara| for |\subparagraph| titles
% \item |fig| for figure |\caption| titles
% \item |tab| for table |\caption| titles
% \end{itemize}
%
% \DescribeMacro{\cftbeforeXskip}
% This controls the vertical space before an entry. It can be changed
% by using |\setlength|. 
%
% \DescribeMacro{\cftXindent}
% This controls the indentation of an entry from the left margin 
% (\textit{indent} in Figure~\ref{fig:ltoc}). It
% can be changed using |\setlength|. NOTE: This command is not provided
% for |part| as their entries will have no indentation (they are the
% highest level document divisions).
%
% \DescribeMacro{\cftXnumwidth}
% This controls the space allowed for typesetting title numbers 
% (\textit{numwidth} in Figure~\ref{fig:ltoc}). 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 entry.
% This is a simplified version of the code for typesetting numbered entry
% and unnumbered entries.
% \begin{verbatim}
% {\cftXfont SNUM\cftXaftersnum \cftXaftersnumb TITLE}%
%         {\cftXleader}{\cftXpagefont PAGE}\cftXafterpnum\par
%
% {\cftXfont TITLE}{\cftXleader}{\cftXpagefont PAGE}\cftXafterpnum\par
% \end{verbatim}
% where |SNUM| is the section number, |TITLE| is the title text and |PAGE| 
% is the page number. Note that for a Part entry the unnumbered style
% is used, whether or not the Part has a number.
%
% \DescribeMacro{\cftXfont}
% This controls the appearance of the title (and its preceeding number, 
% if any). It may be changed using |\renewcommand|.
%
% \DescribeMacro{\cftXaftersnum}
% \DescribeMacro{\cftXaftersnumb}
% The section number is typeset within a box and the |\cftXaftersnum|
% macro is called after the number is typeset but before the box is 
% completed. After the box is
% typeset the |\cftXaftersnumb| macro is called before typesetting
% the title text. Both of these can be changed by |\renewcommand|.
% By default they are defined to do nothing.
%
% \DescribeMacro{\cftXleader}
% \DescribeMacro{\cftXdotsep}
% |\cftXleader| defines the leader between the title and the page number;
% it can be changed by |\renewcommand|.
% The spacing between any dots in the leader is controlled by |\cftXdotsep| 
% (|\@dotsep| in Figure~\ref{fig:ltoc}).
% 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 \emph{math units} where there are 18mu to 1em.
%
% \DescribeMacro{\cftXpagefont}
% This defines the font to be used for typesetting the page number. It
% can be changed by |\renewcommand|.
%
% \DescribeMacro{\cftXafterpnum}
% This macro is called after the page number has been typeset. Its default
% is to do nothing. It can be changed by |\renewcommand|.
%
% 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
% \begin{verbatim}
% \newcommand{\cftXfont}{\bfseries}
% \newcommand{\cftXaftersnum}{}
% \newcommand{\cftXaftersnumb}{}
% \newcommand{\cftXleader}{\bfseries\@cftdotfill{\cftXdotsep}}
% \newcommand{\cftXdotsep}{\cftdotsep}
% \newcommand{\cftXpagefont}{\bfseries}
% \newcommand{\cftXafterpnum}{}
% \end{verbatim}
% (Note that the same font should be used for the title, leader and page 
% number to provide a coherent appearance).
%
% \begin{itemize}
% \item To eliminate the dots in the leader:
% \begin{verbatim}
% \renewcommand{\cftXdotsep}{\cftnodots}
% \end{verbatim}
%
% \item To put something (e.g., a name) before the title (number):
% \begin{verbatim}
% \renewcommand{\cftXfont}{\bfseries SOMETHING }
% \end{verbatim}
%
% \item To add a colon after the section number:
% \begin{verbatim}
% \renewcommand{\cftXaftersnum}{:}
% \end{verbatim}
%
% \item To put something before the title number, add a colon after the
%    the title number, and start the title text on the following line:
% \begin{verbatim}
% \renewcommand{\cftXfont}{\bfseries SOMETHING }
% \renewcommand{\cftXaftersnum}{:}
% \renewcommand{\cftXaftersnumb}{\\}
% \end{verbatim}
%
%
% \item To set the title ragged left (but this only looks good for single
%       line titles):
% \begin{verbatim}
% \renewcommand{\cftXfont}{\hfill\bfseries}
% \renewcommand{\cftXleader}{}
% \end{verbatim}
%
% \item To set the page number immediately after the title instead of at
%       the righthand margin:
% \begin{verbatim}
% \renewcommand{\cftXleader}{}
% \renewcommand{\cftXafterpnum}{\cftparfillskip}
% \end{verbatim}
% 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\footnote{Is there a better name for this?}
% is part of the \Lpack{tocloft} package and is provided just so that
% the above effect can be achieved.
% \end{itemize}
%
% One question that appeared on the \file{comp.text.tex} newsgroup asked
% how to get the titles of Appendices list in the ToC \emph{without} 
% page numbers.
% This is one way of using \Lpack{tocloft} to do this (assuming that
% the document has |\chapter|s).
% \begin{verbatim}
% ...
% \appendix
% \addtocontents{toc}{%
%    % ensure no leaders
%    \protect\renewcommand{\protect\cftchapleader}{} % 
%    % ensure last title line is ragged right
%    \protect\renewcommand{\protect\cftchapafterpnum}{\cftparfillskip}
%    % gobble the page number
%    \protect\renewcommand{\protect\cftchappagefont}[1]{}}
% \chapter{First appendix}
% \end{verbatim}
% If there are other headings to go into the ToC after the appendices, then
% it will probably be necessary to do a similar |\addtocontents| restoring
% the renewed commands to their pre-appendices state.
%
% 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.
%
% \subsection{Experimental utilities}
%
% The macros described in this section are even more experimental than
% those described previously.
%
% \DescribeMacro{\cftchapterprecis}
%   Some old style novels, and even some modern text 
% books,\footnote{For example, Robert Sedgewick, \textit{Algorithms},
% Addison-Wesley, 1983.} include a short synopsis of the contents of 
% the chapter either immediately
% after the chapter heading or in the Toc, or in both places.
%
%     The command |\cftchapterprecis{|\meta{text}|}| prints its argument 
% both at the
% point in the document where it is called, and also adds it to the \file{.toc}
% file. For example:
% \begin{verbatim}
% ...
% \chapter{} % first chapter
% \cftchapterprecis{Our hero is introduced; family tree; early days.}
% ...
% \end{verbatim}
%
% \DescribeMacro{\cftchapterprecishere}
% \DescribeMacro{\cftchapterprecistoc}
% The |\cftchapterprecis| command calls these two commands to print the
% text in the document (the |\...here{|\meta{text}|}| command) 
% and to put it into the ToC (the |\...toc{|\meta{text}|}| 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.
%
% \DescribeMacro{\cftlocalchange}
% The command |\cftlocalchange{|\meta{file}|}{|\meta{pnumwidth}|}{|\meta{tocrmarg}|}|
% will write an entry into \meta{file} 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.
%
% \DescribeMacro{\cftaddtitleline}
% The command |\cftaddtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}|
% will write a |\contentsline| entry into \meta{file} for a \meta{kind}
% entry with title \meta{title} and page number \meta{page}. That is,
% an entry is made of the form: \\
% |\contentsline{kind}{title}{page}| \\
% Any fragile commands used in the arguments must be protected.
%
% \DescribeMacro{\cftaddnumtitleline}
% The command |\cftaddnumtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{num}|}{|\meta{title}|}{|\meta{page}|}|
% is similar except that it also includes \meta{num} 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 \LaTeX{} values for 
% |\@pnumwidth| and |\@tocrmarg| are 1.55em and 2.55em respectively, 
% one might do the
% following for a figure on the frontispiece page.
% \begin{verbatim}
% ...
% % 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
% ...
% \end{verbatim}
%    Recall that a |\caption| command will put an entry in the \file{.lof}
% file, which is not wanted here. If a caption is required, then you can 
% either craft one youself or, assuming that your general captions are not
% too exotic, use the |\legend| command from the
% \Lpack{ccaption} package. If the illustration is numbered, use the
% |\cftaddnumtitleline| command instead of |\cftaddtitleline|.
%
% \subsection{Usage with other packages}
%
%    The \Lpack{tocloft} and \Lpack{tocbibind} packages can be used together
% in the same document. The \Lpack{tocbibind} package provides easy means
% of adding document elements like the bibliography or the index to the 
% Table of Contents. However there are two known potential problems:
% \begin{itemize}
% \item The 1998/11/15 version of \Lpack{tocbibind} may give surprising
% results if the |\toctocname|, |\toclotname| or |\toclofname| commands
% have been used. You should consider getting the current version of
% \Lpack{tocbibind}.
% \item 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 \Lpack{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 youself.
% \end{itemize}
%
% \DescribeMacro{\@cftasnum}
% \DescribeMacro{\@cftasnumb}
%    Some packages, like the \Lpack{float} package by Anselm Lingnau,
% enable the creation of other kinds of \textit{List of \ldots}. 
% The \Lpack{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 \Lpack{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 |\@cftasnum| and |\@cftasnumb| commands.
% These are equivalent to the |\cftXaftersnum| and |\cftXaftersnumb|
% commands described earlier. By default they are defined to do nothing, but
% may be renewed to do something.
%
%
%
% In general, use with other packages that redefine any of the macros that
% \Lpack{tocloft} also modifies is likely to be problematic.
%
% \section{The package code} \label{sec:code}
%
%    Announce the name and version of the package, which requires
% \LaTeXe{} and the \Lpack{stdclsdv} package.
%    \begin{macrocode}
%<*usc>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tocloft}[1999/09/19 v1.0 parameterised ToC, etc., typesetting]
\RequirePackage{stdclsdv}
%    \end{macrocode}
%
% \begin{macro}{\PRWPackageNote}
% \begin{macro}{\PRWPackageNoteNoLine}
% These two commands write a Package Note to the terminal and the log file.
% Use as: |\PRWPackageNote{|\meta{package name}|}{|\meta{note text}|}|.
% The NoLine version does not show the line number. The commands are intermediate
% between the kernel |\PackageWarning| and |\PackageInfo| commands.
% I have |\provide|d the |\PRW...| commands as other packages (of mine)
% may also incorporate them. The code is based on \file{lterror.dtx}.
% \changes{v1.0}{1999/09/19}{Added PRWPackageNote and PRWPackageNoteNoLine
%                            commands}
%    \begin{macrocode}
\providecommand{\PRWPackageNote}[2]{%
  \GenericWarning{%
    (#1)\@spaces\@spaces\@spaces\@spaces
  }{%
   Package #1 Note: #2%
   }%
}
\providecommand{\PRWPackageNoteNoLine}[2]{%
  \PRWPackageNote{#1}{#2\@gobble}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% In order to try and avoid name clashes with other packages, each internal
% name will include the character string \texttt{@cft}.
%
% The \Lpack{stdclsdv} package is used to determine what sectioning
% commands may be used in the document. We assume that if the class is
% known and it has |\chapter| commands, then it is either a \Lpack{book}
% of \Lpack{report} class; if it has |\section| commands then it is
% an \Lpack{article} class or one of its derivatives. 
%
% Issue a warning if there are no recognised sectional divisions 
% and then skip the rest of the package code.
%    \begin{macrocode}
\ifSCDnodivs
  \PackageWarning{tocloft}%
    {I don't recognize any sectional divisions so I'll do nothing}
  \renewcommand{\SCDquit}{\endinput}
\fi
%    \end{macrocode}
% Perhaps quit now.
%    \begin{macrocode}
\SCDquit
%    \end{macrocode}
% 
% Issue a warning if the class is unknown. Use chapter style if |\chapter|
% is defined, else use the |\section| style if it is defined, 
% otherwise quit.
% \changes{v1.0}{1999/09/19}{changed some Warnings to Notes}
%    \begin{macrocode}
\ifSCDknownclass\else
  \PackageWarning{tocloft}%
    {I don't recognize the class but I'll do my best}
  \ifSCDnodivs
    \PackageWarning{tocloft}%
      {I don't recognize any sectional divisions so I'll do nothing}
    \renewcommand{\SCDquit}{\endinput}
  \else
    \ifSCDchapter
      \PRWPackageNoteNoLine{tocloft}{The document class has chapter divisions}
    \else
      \ifSCDsection
        \PRWPackageNoteNoLine{tocloft}{The document class has section divisions}
      \else
        \PackageWarning{tocloft}%
          {The class has neither chapters nor sections, so I'll do nothing}
        \renewcommand{\SCDquit}{\endinput}
      \fi
    \fi
  \fi
\fi
\SCDquit
%    \end{macrocode}
%
% \begin{macro}{\if@cfttocbibind}
% A flag that is set TRUE iff the \Lpack{tocbibind} package has been loaded.
% The 1998/11/15 version of \Lpack{tocbibind} does not necessarily work well
% with \Lpack{tocloft}.
%    \begin{macrocode}
\newif\if@cfttocbibind
\AtBeginDocument{%
  \@ifpackageloaded{tocbibind}{\@cfttocbibindtrue}{\@cfttocbibindfalse}
  \if@cfttocbibind
    \@ifpackagelater{tocbibind}{1998/11/16}{}{%
      \PackageWarning{tocloft}{%
You are using a version of the tocbibind package\MessageBreak
that is not compatible with tocloft.\MessageBreak
The results may be surprising.\MessageBreak
Consider installing the current version of tocbibind.}}
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@cftnctoc}
% A boolean used to implement the \Lopt{titles} option. It is TRUE
% if the ToC, LoT, LoF titles should use the default styles.
%    \begin{macrocode}
\newif\if@cftnctoc\@cftnctocfalse
\DeclareOption{titles}{\@cftnctoctrue}
\ProcessOptions\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftmarktoc}
% \begin{macro}{\cftmarklof}
% \begin{macro}{\cftmarklot}
%  These three macros set the style for running heads. They are initialised
% to give the default appearance.
%    \begin{macrocode}
\newcommand{\cftmarktoc}{%
  \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
\newcommand{\cftmarklof}{%
  \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}}
\newcommand{\cftmarklot}{%
  \@mkboth{\MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@cfttocstart}
% \begin{macro}{\@cfttocfinish}
% Two macros to perform the actions at the beginning and end of the
% |\tableofcontents| command (and friends). |\@cfttocstart| deals with
% chaptered documents, ensuring that the ToC is typeset in a single
% column (see \file{classes.dtx} for the original code).
%    \begin{macrocode}
\newcommand{\@cfttocstart}{%
  \ifSCDchapter
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
  \fi}
%    \end{macrocode}
% |\@cfttocfinish| resets, if required, twocolumn typesetting.
%    \begin{macrocode}
\newcommand{\@cfttocfinish}{%
  \ifSCDchapter
    \if@restonecol\twocolumn\fi
  \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@cftdobibtoc}
% If the \Lpack{tocbibind} package has been used and it has 
% redefined |\tableofcontents| we need to cater for that. The contents
% of the definition are defined in \Lpack{tocbibind}.
%    \begin{macrocode}
\newcommand{\@cftdobibtoc}{%
  \if@dotoctoc
    \if@bibchapter
      \addcontentsline{toc}{chapter}{\contentsname}
    \else
      \addcontentsline{toc}{\@tocextra}{\contentsname}
    \fi
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\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 \Lopt{titles} option has been used, then the command is not modified.
%
%    \begin{macrocode}
\AtBeginDocument{%
\if@cftnctoc\else
  \renewcommand{\tableofcontents}{%
    \@cfttocstart
%    \end{macrocode}
% Ensure that any previous paragraph has been finished. Within a group set
% the local paragraphing style and typeset the title.
%    \begin{macrocode}
    \par
    \begingroup
      \parindent\z@ \parskip\z@
      \@cftmaketoctitle
%    \end{macrocode}
% If \Lpack{tocbibind} has been used, then add the ToC 
% name to the ToC.
%    \begin{macrocode}
      \if@cfttocbibind
        \@cftdobibtoc
      \fi
%    \end{macrocode}
% Finally, read the \file{.toc} file and finish up.
%    \begin{macrocode}
      \@starttoc{toc}%
    \endgroup
    \@cfttocfinish}
\fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@cftmaketoctitle}
% This command typesets the title for the ToC.
%    \begin{macrocode}
\newcommand{\@cftmaketoctitle}{%
  \vspace*{\cftbeforetoctitleskip}
  \interlinepenalty\@M
  {\cfttoctitlefont\contentsname}{\cftaftertoctitle}
  \cftmarktoc
  \par\nobreak
  \vskip \cftaftertoctitleskip
  \@afterheading}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforetoctitleskip}
% \begin{macro}{\cftaftertoctitleskip}
%  These two lengths control the vertical spacing before and after the 
%  ToC title.
%    \begin{macrocode}
\newlength{\cftbeforetoctitleskip}
\newlength{\cftaftertoctitleskip}
%    \end{macrocode}
% Their values depend on whether the document has chapters or not. In
% chaptered documents the default ToC title is typeset as a |\chapter*|,
% otherwise as a |\section*|.
%    \begin{macrocode}
\ifSCDchapter
  \setlength{\cftbeforetoctitleskip}{50pt}
  \setlength{\cftaftertoctitleskip}{40pt}
\else
  \setlength{\cftbeforetoctitleskip}{3.5ex \@plus 1ex \@minus .2ex}
  \setlength{\cftaftertoctitleskip}{2.3ex \@plus.2ex}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cfttoctitlefont}
% \begin{macro}{\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).
%    \begin{macrocode}
\ifSCDchapter
  \newcommand{\cfttoctitlefont}{\normalfont\Huge\bfseries}
\else
  \newcommand{\cfttoctitlefont}{\normalfont\Large\bfseries}
\fi
\newcommand{\cftaftertoctitle}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cftsetpnumwidth}
% \begin{macro}{\cftsetrmarg}
%  Users commands for setting |\@pnumwidth| and |\@tocrmarg|.
%    \begin{macrocode}
\newcommand{\cftsetpnumwidth}[1]{\renewcommand{\@pnumwidth}{#1}}
\newcommand{\cftsetrmarg}[1]{\renewcommand{\@tocrmarg}{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cftdot}
% \begin{macro}{\@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{|\meta{sep}|}|
% command provides a parameterised version of the leader code, where
% \meta{sep} is the seperation between the dots in mu units.
% The symbol used for the `dots' in the leader is given by the value
% of |\cftdot|.
%    \begin{macrocode}
\newcommand{\cftdot}{.}
\newcommand{\@cftdotfill}[1]{%
  \leaders\hbox{$\m@th\mkern #1 mu\hbox{\cftdot}\mkern #1 mu$}\hfill}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cftdotsep}
% \begin{macro}{\cftnodots}
% |\cftdotsep| holds the default dot seperation.
% If the kerns in |\@cftdotfill| are large enough, then no dots will
% be printed. |\cftnodots| should be `large enough'.
%    \begin{macrocode}
\newcommand{\cftdotsep}{4.5}
\newcommand{\cftnodots}{10000}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%     Now for the trickier bits regarding the typesetting of the ToC
% entries.
%
%     A \file{.toc} (also \file{.lof} and \file{.lot}) file consists
% of a list of 
% |\contentsline{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}|
% commands, where \meta{kind} is the kind of heading (e.g., |part| or
% |section| or |figure|), \meta{title} is the title text (including the number),
% and \meta{page} is the page number. The entries are inserted into the
% file by calling the 
% |\addcontentsline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}|
% command, where \meta{file} is the file extension (e.g., |toc|, |lot|)
% and the other arguments are the same as for the |\contentsline|
% command. (Arbitrary stuff may also be put into the file via the
% |\addtocontents{|\meta{file}|}{|\meta{text}|}| 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 \file{.toc}
% etc., files.
%
%     For the purposes at hand it is generally impossible to teat 
% the typesetting
% of a title and its number seperately, as both are bundled into the
% \meta{title} argument within |\contentsline|. They could be handled
% seperately 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 sectioning 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.
%
%     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|.
%
% \begin{macro}{\cftparfillskip}
% The |\l@kind| commands modify (locally) the value of |\parfillskip|.
% |\cftparfillskip| is a copy of the default \textit{\TeX book}
% |\parfillskip| definition.
%    \begin{macrocode}
\newcommand{\cftparfillskip}{\parfillskip=0pt plus1fil}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\numberline}
% The purpose of the |\numberline{|\meta{secnum}|}| command is to typeset
% \meta{secnum} left justified in a box of width |\@tempdima|. I redefine
% it to add two additional parameters, namely |\@cftasnum| and |\@cftasnumb| 
% (see \file{ltsect.dtx} for the original
% definition).
%    \begin{macrocode}
\renewcommand{\numberline}[1]{% 
  \hb@xt@\@tempdima{#1\@cftasnum\hfil}\@cftasnumb}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@cftasnum}
% \begin{macro}{\@cftasnumb}
% \changes{v0.2b}{1999/03/07}{Added empty definitions for @cftasnum and @cftasnumb commands}
% 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 \Lpack{float} package.\footnote{This bug
% was discovered by Andrew Thurber when using the \Lpack{tocloft} and
% \Lpack{algorithm} packages together.}
%    \begin{macrocode}
\newcommand{\@cftasnum}{}
\newcommand{\@cftasnumb}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% 
% 
%
% \begin{macro}{\l@part}
% \begin{macro}{\if@cftdopart}
%  |\l@part{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
% a |part| heading. It is a parameterised copy of the default |\l@part|
% (see \file{classes.dtx} for the original definition 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.
% \changes{v0.2a}{1999/01/24}{In article class, Part level is 0 not -1}
% 
%    \begin{macrocode}
\newif\if@cftdopart
\ifSCDpart
\renewcommand*{\l@part}[2]{%
  \@cftdopartfalse
  \ifnum \c@tocdepth >-2\relax
    \ifSCDchapter
      \@cftdoparttrue
    \fi
    \ifnum \c@tocdepth >\m@ne
      \ifSCDchapter\else
        \@cftdoparttrue
      \fi
    \fi
  \fi
  \if@cftdopart
    \ifSCDchapter
      \addpenalty{-\@highpenalty}%
    \else
      \addpenalty\@secpenalty
    \fi
    \addvspace{\cftbeforepartskip}%
    \@tempdima \cftpartnumwidth\relax
    \let\@cftasnum \cftpartaftersnum
    \let\@cftasnumb \cftpartaftersnumb
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
      {\cftpartfont #1}{\cftpartleader}
        {\hb@xt@\@pnumwidth{\hss {\cftpartpagefont #2}}}\cftpartafterpnum}\par
      \nobreak
      \ifSCDchapter
        \global\@nobreaktrue
        \everypar{\global\@nobreakfalse\everypar{}}%
      \else
        \if@compatibility
          \global\@nobreaktrue
          \everypar{\global\@nobreakfalse\everypar{}}%
        \fi
      \fi
    \endgroup
  \fi}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cftbeforepartskip}
% \begin{macro}{\cftpartnumwidth}
% \begin{macro}{\cftpartfont}
% \begin{macro}{\cftpartaftersnum}
% \begin{macro}{\cftpartaftersnumb}
% \begin{macro}{\cftpartleader}
% \begin{macro}{\cftpartdotsep}
% \begin{macro}{\cftpartpagefont}
% \begin{macro}{\cftpartafterpnum}
%  These are the user commands to control the typesetting of Part entries.
%  They are initialised to give the standard appearance.
%    \begin{macrocode}
\newlength{\cftbeforepartskip}
  \setlength{\cftbeforepartskip}{2.25em \@plus\p@}
\newlength{\cftpartnumwidth}
  \setlength{\cftpartnumwidth}{3em}
\newcommand{\cftpartfont}{\large\bfseries}
\newcommand{\cftpartaftersnum}{}
\newcommand{\cftpartaftersnumb}{}
\newcommand{\cftpartleader}{\large\bfseries\@cftdotfill{\cftpartdotsep}}
\newcommand{\cftpartdotsep}{\cftnodots}
\newcommand{\cftpartpagefont}{\large\bfseries}
\newcommand{\cftpartafterpnum}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@chapter}
%  |\l@chapter{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
% a |chapter| heading. It is a parameterised copy of the default |\l@chapter|
% (see \file{classes.dtx} for the original definition). This only applies
% to chaptered documents.
%    \begin{macrocode}
\ifSCDchapter
\renewcommand*{\l@chapter}[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip \cftbeforechapskip
    {\leftskip \cftchapindent\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \cftchapindent\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \cftchapnumwidth\relax
     \let\@cftasnum \cftchapaftersnum
     \let\@cftasnumb \cftchapaftersnumb
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\cftchapfont #1}\nobreak
     {\cftchapleader}
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\cftchappagefont #2}\cftchapafterpnum\par}%
  \fi}
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforechapskip}
% \begin{macro}{\cftchapindent}
% \begin{macro}{\cftchapnumwidth}
% \begin{macro}{\cftchapfont}
% \begin{macro}{\cftchapaftersnum}
% \begin{macro}{\cftchapaftersnumb}
% \begin{macro}{\cftchapleader}
% \begin{macro}{\cftchapdotsep}
% \begin{macro}{\cftchappagefont}
% \begin{macro}{\cftchapafterpnum}
%  These are the user commands to control the typesetting of Chapter entries.
%  They are initialised to give the standard appearance.
%    \begin{macrocode}
\newlength{\cftbeforechapskip}
  \setlength{\cftbeforechapskip}{1.0em \@plus\p@}
\newlength{\cftchapindent}
  \setlength{\cftchapindent}{0em}
\newlength{\cftchapnumwidth}
  \setlength{\cftchapnumwidth}{1.5em}
\newcommand{\cftchapfont}{\bfseries}
\newcommand{\cftchapaftersnum}{}
\newcommand{\cftchapaftersnumb}{}
\newcommand{\cftchapleader}{\bfseries\@cftdotfill{\cftchapdotsep}}
\newcommand{\cftchapdotsep}{\cftnodots}
\newcommand{\cftchappagefont}{\bfseries}
\newcommand{\cftchapafterpnum}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@section}
%  |\l@section{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
% a |section| heading. It is a parameterised copy of the default |\l@section|
% (see \file{classes.dtx} for the original definition). 
%    \begin{macrocode}
\renewcommand*{\l@section}[2]{%
  \ifnum \c@tocdepth >\z@
    \ifSCDchapter
      \vskip \cftbeforesecskip
    \else
      \addpenalty\@secpenalty
      \addvspace{\cftbeforesecskip}
    \fi
    {\leftskip \cftsecindent\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \cftsecindent\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \cftsecnumwidth\relax
     \let\@cftasnum \cftsecaftersnum
     \let\@cftasnumb \cftsecaftersnumb
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\cftsecfont #1}\nobreak
     {\cftsecleader}
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\cftsecpagefont #2}\cftsecafterpnum\par}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforesecskip}
% \begin{macro}{\cftsecindent}
% \begin{macro}{\cftsecnumwidth}
% \begin{macro}{\cftsecfont}
% \begin{macro}{\cftsecaftersnum}
% \begin{macro}{\cftsecaftersnumb}
% \begin{macro}{\cftsecleader}
% \begin{macro}{\cftsecdotsep}
% \begin{macro}{\cftsecpagefont}
% \begin{macro}{\cftsecafterpnum}
%  These are the user commands to control the typesetting of Section entries.
%  They are initialised to give the standard appearance.
%    \begin{macrocode}
\newlength{\cftbeforesecskip}
\ifSCDchapter
  \setlength{\cftbeforesecskip}{\z@ \@plus.2\p@}
\else
  \setlength{\cftbeforesecskip}{1.0em \@plus\p@}
\fi
\newlength{\cftsecindent}
\ifSCDchapter
  \setlength{\cftsecindent}{1.5em}
\else
  \setlength{\cftsecindent}{0em}
\fi
\newlength{\cftsecnumwidth}
\ifSCDchapter
  \setlength{\cftsecnumwidth}{2.3em}
\else
  \setlength{\cftsecnumwidth}{1.5em}
\fi
\ifSCDchapter
  \newcommand{\cftsecfont}{\normalfont}
\else
  \newcommand{\cftsecfont}{\bfseries}
\fi
\newcommand{\cftsecaftersnum}{}
\newcommand{\cftsecaftersnumb}{}
\ifSCDchapter
  \newcommand{\cftsecleader}{\normalfont\@cftdotfill{\cftsecdotsep}}
\else
  \newcommand{\cftsecleader}{\bfseries\@cftdotfill{\cftsecdotsep}}
\fi
\ifSCDchapter
  \newcommand{\cftsecdotsep}{\cftdotsep}
\else
  \newcommand{\cftsecdotsep}{\cftnodots}
\fi
\ifSCDchapter
  \newcommand{\cftsecpagefont}{\normalfont}
\else
  \newcommand{\cftsecpagefont}{\bfseries}
\fi
\newcommand{\cftsecafterpnum}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@subsection}
%  |\l@subsection{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
% a |subsection| heading. It is a parameterised copy of the default 
% |\l@subsection|
% (see \file{classes.dtx} for the original definition). 
%    \begin{macrocode}
\renewcommand*{\l@subsection}[2]{%
%    \end{macrocode}
% Only typeset the entry if it falls within the |tocdepth|.
%    \begin{macrocode}
  \ifnum \c@tocdepth >\@ne
%    \end{macrocode}
% Add some vertical space.
%    \begin{macrocode}
    \vskip \cftbeforesubsecskip
%    \end{macrocode}
% Start a group to keep paragraphing changes local. Set the |\leftskip|
% to the entry's indentation.
%    \begin{macrocode}
    {\leftskip \cftsubsecindent\relax
%    \end{macrocode}
% Set the |\rightskip| to |\@tocrmarg| to leave room for the page number.
%    \begin{macrocode}
     \rightskip \@tocrmarg
%    \end{macrocode}
% Ensure that the last line of the entry will be filled. Setting 
% |\parfillskip| to a negative number prevents any overfull box messages.
%    \begin{macrocode}
     \parfillskip -\rightskip
%    \end{macrocode}
% Set the paragraph indent to the entry's indentation.
%    \begin{macrocode}
     \parindent \cftsubsecindent\relax\@afterindenttrue
%    \end{macrocode}
% Try and prevent breaks between lines in a multiple line entry.
%    \begin{macrocode}
     \interlinepenalty\@M
%    \end{macrocode}
% Make sure that we have left vertical mode.
%    \begin{macrocode}
     \leavevmode
%    \end{macrocode}
% Our version of |\numberline| expects that the width of the number box
% is in |\@tempdima|, and that the two macros |\@cftasnum| and |\@cftasnumb|
% are defined. We set all these to the values for this entry.
%    \begin{macrocode}
     \@tempdima \cftsubsecnumwidth\relax
     \let\@cftasnum \cftsubsecaftersnum
     \let\@cftasnumb \cftsubsecaftersnumb
%    \end{macrocode}
% Arrange that the (section number and) first line of the title is set
% at the current indent, and any further lines are further indented.
%    \begin{macrocode}
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
%    \end{macrocode}
% Print the (number and) title, prohibiting any breaking.
%    \begin{macrocode}
     {\cftsubsecfont #1}\nobreak
%    \end{macrocode}
% Print the leader between the title and the page number, again asking 
% for no breaks.
%    \begin{macrocode}
     {\cftsubsecleader}
     \nobreak
%    \end{macrocode}
% Finally, set the page number flushright in a box of width |\@pnumwidth|,
% not forgetting to finish the paragraph and close the group.
%    \begin{macrocode}
     \hb@xt@\@pnumwidth{\hfil\cftsubsecpagefont #2}\cftsubsecafterpnum\par}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforesubsecskip}
% \begin{macro}{\cftsubsecindent}
% \begin{macro}{\cftsubsecnumwidth}
% \begin{macro}{\cftsubsecfont}
% \begin{macro}{\cftsubsecaftersnum}
% \begin{macro}{\cftsubsecaftersnumb}
% \begin{macro}{\cftsubsecleader}
% \begin{macro}{\cftsubsecdotsep}
% \begin{macro}{\cftsubsecpagefont}
% \begin{macro}{\cftsubsecafterpnum}
%  These are the user commands to control the typesetting of Sub-section entries.
%  They are initialised to give the standard appearance.
%    \begin{macrocode}
\newlength{\cftbeforesubsecskip}
  \setlength{\cftbeforesubsecskip}{\z@ \@plus.2\p@}
\newlength{\cftsubsecindent}
\ifSCDchapter
  \setlength{\cftsubsecindent}{3.8em}
\else
  \setlength{\cftsubsecindent}{1.5em}
\fi
\newlength{\cftsubsecnumwidth}
\ifSCDchapter
  \setlength{\cftsubsecnumwidth}{3.2em}
\else
  \setlength{\cftsubsecnumwidth}{2.3em}
\fi
\newcommand{\cftsubsecfont}{\normalfont}
\newcommand{\cftsubsecaftersnum}{}
\newcommand{\cftsubsecaftersnumb}{}
\newcommand{\cftsubsecleader}{\normalfont\@cftdotfill{\cftsubsecdotsep}}
\newcommand{\cftsubsecdotsep}{\cftdotsep}
\newcommand{\cftsubsecpagefont}{\normalfont}
\newcommand{\cftsubsecafterpnum}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@subsubsection}
%  |\l@subsubsection{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
% a |subsubsection| heading. It is a parameterised copy of the default 
% |\l@subsubsection|
% (see \file{classes.dtx} for the original definition). 
%    \begin{macrocode}
\renewcommand*{\l@subsubsection}[2]{%
  \ifnum \c@tocdepth >\tw@
    \vskip \cftbeforesubsubsecskip
    {\leftskip \cftsubsubsecindent\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \cftsubsubsecindent\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \cftsubsubsecnumwidth\relax
     \let\@cftasnum \cftsubsubsecaftersnum
     \let\@cftasnumb \cftsubsubsecaftersnumb
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\cftsubsubsecfont #1}\nobreak
     {\cftsubsubsecleader}
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\cftsubsubsecpagefont #2}\cftsubsubsecafterpnum\par}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforesubsubsecskip}
% \begin{macro}{\cftsubsubsecindent}
% \begin{macro}{\cftsubsubsecnumwidth}
% \begin{macro}{\cftsubsubsecfont}
% \begin{macro}{\cftsubsubsecaftersnum}
% \begin{macro}{\cftsubsubsecaftersnumb}
% \begin{macro}{\cftsubsubsecleader}
% \begin{macro}{\cftsubsubsecdotsep}
% \begin{macro}{\cftsubsubsecpagefont}
% \begin{macro}{\cftsubsubsecafterpnum}
%  These are the user commands to control the typesetting of Sub-sub-section entries.
%  They are initialised to give the standard appearance.
%    \begin{macrocode}
\newlength{\cftbeforesubsubsecskip}
  \setlength{\cftbeforesubsubsecskip}{\z@ \@plus.2\p@}
\newlength{\cftsubsubsecindent}
\ifSCDchapter
  \setlength{\cftsubsubsecindent}{7.0em}
\else
  \setlength{\cftsubsubsecindent}{3.8em}
\fi
\newlength{\cftsubsubsecnumwidth}
\ifSCDchapter
  \setlength{\cftsubsubsecnumwidth}{4.1em}
\else
  \setlength{\cftsubsubsecnumwidth}{3.2em}
\fi
\newcommand{\cftsubsubsecfont}{\normalfont}
\newcommand{\cftsubsubsecaftersnum}{}
\newcommand{\cftsubsubsecaftersnumb}{}
\newcommand{\cftsubsubsecleader}{\normalfont\@cftdotfill{\cftsubsubsecdotsep}}
\newcommand{\cftsubsubsecdotsep}{\cftdotsep}
\newcommand{\cftsubsubsecpagefont}{\normalfont}
\newcommand{\cftsubsubsecafterpnum}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@paragraph}
%  |\l@paragraph{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
% a |paragraph| heading. It is a parameterised copy of the default 
% |\l@paragraph|
% (see \file{classes.dtx} for the original definition). 
%    \begin{macrocode}
\renewcommand*{\l@paragraph}[2]{%
  \ifnum \c@tocdepth >3\relax
    \vskip \cftbeforeparaskip
    {\leftskip \cftparaindent\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \cftparaindent\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \cftparanumwidth\relax
     \let\@cftasnum \cftparaaftersnum
     \let\@cftasnumb \cftparaaftersnumb
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\cftparafont #1}\nobreak
     {\cftparaleader}
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\cftparapagefont #2}\cftparaafterpnum\par}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforeparaskip}
% \begin{macro}{\cftparaindent}
% \begin{macro}{\cftparanumwidth}
% \begin{macro}{\cftparafont}
% \begin{macro}{\cftparaaftersnum}
% \begin{macro}{\cftparaaftersnumb}
% \begin{macro}{\cftparaleader}
% \begin{macro}{\cftparadotsep}
% \begin{macro}{\cftparapagefont}
% \begin{macro}{\cftparaafterpnum}
%  These are the user commands to control the typesetting of Paragraph entries.
%  They are initialised to give the standard appearance.
%    \begin{macrocode}
\newlength{\cftbeforeparaskip}
  \setlength{\cftbeforeparaskip}{\z@ \@plus.2\p@}
\newlength{\cftparaindent}
\ifSCDchapter
  \setlength{\cftparaindent}{10em}
\else
  \setlength{\cftparaindent}{7.0em}
\fi
\newlength{\cftparanumwidth}
\ifSCDchapter
  \setlength{\cftparanumwidth}{5em}
\else
  \setlength{\cftparanumwidth}{4.1em}
\fi
\newcommand{\cftparafont}{\normalfont}
\newcommand{\cftparaaftersnum}{}
\newcommand{\cftparaaftersnumb}{}
\newcommand{\cftparaleader}{\normalfont\@cftdotfill{\cftparadotsep}}
\newcommand{\cftparadotsep}{\cftdotsep}
\newcommand{\cftparapagefont}{\normalfont}
\newcommand{\cftparaafterpnum}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@subparagraph}
%  |\l@subparagraph{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for
% a |subparagraph| heading. It is a parameterised copy of the default 
% |\l@subparagraph|
% (see \file{classes.dtx} for the original definition). 
%    \begin{macrocode}
\renewcommand*{\l@subparagraph}[2]{%
  \ifnum \c@tocdepth >4\relax
    \vskip \cftbeforesubparaskip
    {\leftskip \cftsubparaindent\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \cftsubparaindent\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \cftsubparanumwidth\relax
     \let\@cftasnum \cftsubparaaftersnum
     \let\@cftasnumb \cftsubparaaftersnumb
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\cftsubparafont #1}\nobreak
     {\cftsubparaleader}
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\cftsubparapagefont #2}\cftsubparaafterpnum\par}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforesubparaskip}
% \begin{macro}{\cftsubparaindent}
% \begin{macro}{\cftsubparanumwidth}
% \begin{macro}{\cftsubparafont}
% \begin{macro}{\cftsubparaaftersnum}
% \begin{macro}{\cftsubparaaftersnumb}
% \begin{macro}{\cftsubparaleader}
% \begin{macro}{\cftsubparadotsep}
% \begin{macro}{\cftsubparapagefont}
% \begin{macro}{\cftsubparaafterpnum}
%  These are the user commands to control the typesetting of Sub-paragraph entries.
%  They are initialised to give the standard appearance.
%    \begin{macrocode}
\newlength{\cftbeforesubparaskip}
  \setlength{\cftbeforesubparaskip}{\z@ \@plus.2\p@}
\newlength{\cftsubparaindent}
\ifSCDchapter
  \setlength{\cftsubparaindent}{12em}
\else
  \setlength{\cftsubparaindent}{10em}
\fi
\newlength{\cftsubparanumwidth}
\ifSCDchapter
  \setlength{\cftsubparanumwidth}{6em}
\else
  \setlength{\cftsubparanumwidth}{5em}
\fi
\newcommand{\cftsubparafont}{\normalfont}
\newcommand{\cftsubparaaftersnum}{}
\newcommand{\cftsubparaaftersnumb}{}
\newcommand{\cftsubparaleader}{\normalfont\@cftdotfill{\cftsubparadotsep}}
\newcommand{\cftsubparadotsep}{\cftdotsep}
\newcommand{\cftsubparapagefont}{\normalfont}
\newcommand{\cftsubparaafterpnum}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\@cftdobiblof}
% If the \Lpack{tocbibind} package has been used and it has 
% redefined |\listoffigures| we need to cater for that. The contents
% of the definition are defined in \Lpack{tocbibind}.
%    \begin{macrocode}
\newcommand{\@cftdobiblof}{%
  \if@dotoclof
    \if@bibchapter
      \addcontentsline{toc}{chapter}{\listfigurename}
    \else
      \addcontentsline{toc}{\@tocextra}{\listfigurename}
    \fi
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\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 \Lopt{titles} option is used).
%    \begin{macrocode}
\AtBeginDocument{
\if@cftnctoc\else
\renewcommand{\listoffigures}{%
  \@cfttocstart
%    \end{macrocode}
% 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 \file{.lof} file.
%    \begin{macrocode}
  \par
  \begingroup
    \parindent\z@ \parskip\z@
    \@cftmakeloftitle
    \if@cfttocbibind
      \@cftdobiblof
    \fi
    \@starttoc{lof}%
  \endgroup
%    \end{macrocode}
% Finally, restore any multicolumn typesetting.
%    \begin{macrocode}
  \@cfttocfinish}
\fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@cftmakeloftitle}
% This command typesets the title for the LoF.
%    \begin{macrocode}
\newcommand{\@cftmakeloftitle}{%
  \vspace*{\cftbeforeloftitleskip}
  \interlinepenalty\@M
  {\cftloftitlefont\listfigurename}{\cftafterloftitle}
  \cftmarklof
  \par\nobreak
  \vskip \cftafterloftitleskip
  \@afterheading}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforeloftitleskip}
% \begin{macro}{\cftafterloftitleskip}
%  These two lengths control the vertical spacing before and after the 
%  LoF title.
%    \begin{macrocode}
\newlength{\cftbeforeloftitleskip}
\newlength{\cftafterloftitleskip}
%    \end{macrocode}
% Their values depend on whether the document has chapters or not. In
% chaptered documents the default LoF title is typeset as a |\chapter*|,
% otherwise as a |\section*|.
%    \begin{macrocode}
\ifSCDchapter
  \setlength{\cftbeforeloftitleskip}{50pt}
  \setlength{\cftafterloftitleskip}{40pt}
\else
  \setlength{\cftbeforeloftitleskip}{3.5ex \@plus 1ex \@minus .2ex}
  \setlength{\cftafterloftitleskip}{2.3ex \@plus.2ex}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cftloftitlefont}
% \begin{macro}{\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).
%    \begin{macrocode}
\ifSCDchapter
  \newcommand{\cftloftitlefont}{\normalfont\Huge\bfseries}
\else
  \newcommand{\cftloftitlefont}{\normalfont\Large\bfseries}
\fi
\newcommand{\cftafterloftitle}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@figure}
%  |\l@figure{|\meta{title}|}{|\meta{page}|}| typesets the LoF entry for
% a |figure| caption heading. It is a parameterised copy of the default 
% |\l@figure|
% (see \file{classes.dtx} for the original definition). 
%    \begin{macrocode}
\renewcommand*{\l@figure}[2]{%
    \vskip \cftbeforefigskip
    {\leftskip \cftfigindent\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \cftfigindent\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \cftfignumwidth\relax
     \let\@cftasnum \cftfigaftersnum
     \let\@cftasnumb \cftfigaftersnumb
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\cftfigfont #1}\nobreak
     {\cftfigleader}
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\cftfigpagefont #2}\cftfigafterpnum\par}%
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforefigskip}
% \begin{macro}{\cftfigindent}
% \begin{macro}{\cftfignumwidth}
% \begin{macro}{\cftfigfont}
% \begin{macro}{\cftfigaftersnum}
% \begin{macro}{\cftfigaftersnumb}
% \begin{macro}{\cftfigleader}
% \begin{macro}{\cftfigdotsep}
% \begin{macro}{\cftfigpagefont}
% \begin{macro}{\cftfigafterpnum}
%  These are the user commands to control the typesetting of Figure caption entries.
%  They are initialised to give the standard appearance.
%    \begin{macrocode}
\newlength{\cftbeforefigskip}
  \setlength{\cftbeforefigskip}{\z@ \@plus.2\p@}
\newlength{\cftfigindent}
  \setlength{\cftfigindent}{1.5em}
\newlength{\cftfignumwidth}
  \setlength{\cftfignumwidth}{2.3em}
\newcommand{\cftfigfont}{\normalfont}
\newcommand{\cftfigaftersnum}{}
\newcommand{\cftfigaftersnumb}{}
\newcommand{\cftfigleader}{\normalfont\@cftdotfill{\cftfigdotsep}}
\newcommand{\cftfigdotsep}{\cftdotsep}
\newcommand{\cftfigpagefont}{\normalfont}
\newcommand{\cftfigafterpnum}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\@cftdobiblot}
% If the \Lpack{tocbibind} package has been used and it has 
% redefined |\listoftables| we need to cater for that. The contents
% of the definition are defined in \Lpack{tocbibind}.
%    \begin{macrocode}
\newcommand{\@cftdobiblot}{%
  \if@dotoclot
    \if@bibchapter
      \addcontentsline{toc}{chapter}{\listtablename}
    \else
      \addcontentsline{toc}{\@tocextra}{\listtablename}
    \fi
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\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 \Lopt{titles} option has
%  been used).
%    \begin{macrocode}
\AtBeginDocument{
\if@cftnctoc\else
\renewcommand{\listoftables}{%
  \@cfttocstart
%    \end{macrocode}
% 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 \file{.lot} file.
%    \begin{macrocode}
  \par
  \begingroup
    \parindent\z@ \parskip\z@
    \@cftmakelottitle
    \if@cfttocbibind
      \@cftdobiblot
    \fi
    \@starttoc{lot}%
  \endgroup
%    \end{macrocode}
% Finally, restore any multicolumn typesetting.
%    \begin{macrocode}
  \@cfttocfinish}
\fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@cftmakelottitle}
% This command typesets the title for the LoT.
%    \begin{macrocode}
\newcommand{\@cftmakelottitle}{%
  \vspace*{\cftbeforelottitleskip}
  \interlinepenalty\@M
  {\cftlottitlefont\listtablename}{\cftafterlottitle}
  \cftmarklot
  \par\nobreak
  \vskip \cftafterlottitleskip
  \@afterheading}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforelottitleskip}
% \begin{macro}{\cftafterlottitleskip}
%  These two lengths control the vertical spacing before and after the 
%  LoT title.
%    \begin{macrocode}
\newlength{\cftbeforelottitleskip}
\newlength{\cftafterlottitleskip}
%    \end{macrocode}
% Their values depend on whether the document has chapters or not. In
% chaptered documents the default LoT title is typeset as a |\chapter*|,
% otherwise as a |\section*|.
%    \begin{macrocode}
\ifSCDchapter
  \setlength{\cftbeforelottitleskip}{50pt}
  \setlength{\cftafterlottitleskip}{40pt}
\else
  \setlength{\cftbeforelottitleskip}{3.5ex \@plus 1ex \@minus .2ex}
  \setlength{\cftafterlottitleskip}{2.3ex \@plus.2ex}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cftlottitlefont}
% \begin{macro}{\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).
%    \begin{macrocode}
\ifSCDchapter
  \newcommand{\cftlottitlefont}{\normalfont\Huge\bfseries}
\else
  \newcommand{\cftlottitlefont}{\normalfont\Large\bfseries}
\fi
\newcommand{\cftafterlottitle}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@table}
%  |\l@table{|\meta{title}|}{|\meta{page}|}| typesets the LoT entry for
% a |table| caption heading. It is a parameterised copy of the default 
% |\l@table|
% (see \file{classes.dtx} for the original definition). 
%    \begin{macrocode}
\renewcommand*{\l@table}[2]{%
    \vskip \cftbeforetabskip
    {\leftskip \cfttabindent\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \cfttabindent\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \cfttabnumwidth\relax
     \let\@cftasnum \cfttabaftersnum
     \let\@cftasnumb \cfttabaftersnumb
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\cfttabfont #1}\nobreak
     {\cfttableader}
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\cfttabpagefont #2}\cfttabafterpnum\par}%
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftbeforetabskip}
% \begin{macro}{\cfttabindent}
% \begin{macro}{\cfttabnumwidth}
% \begin{macro}{\cfttabfont}
% \begin{macro}{\cfttabaftersnum}
% \begin{macro}{\cfttabaftersnumb}
% \begin{macro}{\cfttableader}
% \begin{macro}{\cfttabdotsep}
% \begin{macro}{\cfttabpagefont}
% \begin{macro}{\cfttabafterpnum}
%  These are the user commands to control the typesetting of Table caption entries.
%  They are initialised to give the standard appearance.
%    \begin{macrocode}
\newlength{\cftbeforetabskip}
  \setlength{\cftbeforetabskip}{\z@ \@plus.2\p@}
\newlength{\cfttabindent}
  \setlength{\cfttabindent}{1.5em}
\newlength{\cfttabnumwidth}
  \setlength{\cfttabnumwidth}{2.3em}
\newcommand{\cfttabfont}{\normalfont}
\newcommand{\cfttabaftersnum}{}
\newcommand{\cfttabaftersnumb}{}
\newcommand{\cfttableader}{\normalfont\@cftdotfill{\cfttabdotsep}}
\newcommand{\cfttabdotsep}{\cftdotsep}
\newcommand{\cfttabpagefont}{\normalfont}
\newcommand{\cfttabafterpnum}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cftchapterprecis}
% This is experimental. |\cftchapterprecis{|\meta{text}|}| typesets
% \meta{text} at the point where it is called, and also adds \meta{text}
% to the \file{.toc} file. It is expects to be called immediately after
% a |\chapter| command.
%    \begin{macrocode}
\newcommand{\cftchapterprecis}[1]{%
  \cftchapterprecishere{#1}
  \cftchapterprecistoc{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftchapterprecishere}
% |\cftchapterprecishere{|\meta{text}|}| typesets \meta{text}. It expects
% to be called immediately after a |\chapter| command. First add some
% negative vertical space to move it closer to the chapter heading.
%    \begin{macrocode}
\newcommand{\cftchapterprecishere}[1]{%
  \vspace*{-2\baselineskip}
%    \end{macrocode}
% Typeset its argument using italic font in a |quote| environment.
%    \begin{macrocode}
  \begin{quote}\textit{#1}\end{quote}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftchapterprecistoc}
% |\cftchapterprecistoc{|\meta{text}|}| adds \meta{text} to the \file{.toc}
% file. The \meta{text} will be typeset within the same margins as the
% the title text of a |\chapter| heading, using an italic font.
%    \begin{macrocode}
\newcommand{\cftchapterprecistoc}[1]{\addtocontents{toc}{%
%    \end{macrocode}
% Start a group to localize changes to the paragraphing. Set the 
% left margin to the chapter indent plus the chapter number width.
%    \begin{macrocode}
  {\leftskip \cftchapindent\relax
   \advance\leftskip \cftchapnumwidth\relax
%    \end{macrocode}
% Set the right hand margin to |\@tocrmarg|.
%    \begin{macrocode}
   \rightskip \@tocrmarg\relax
%    \end{macrocode}
% Typeset \meta{text} using an italic font, then ensure that the paragraph
% is finished (to use the local skips). Finally close the group and we 
% are done.
%    \begin{macrocode}
   \textit{#1}\protect\par}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftlocalchange}
% |\cftmakelocalchange{|\meta{file}|}{|\meta{pnumwidth}|}{|\meta{tocrmarg}|}|
% makes an entry into \meta{file} to change the |\@pnumwidth| and
% the |\@tocrmarg| values.
%    \begin{macrocode}
\newcommand{\cftlocalchange}[3]{%
  \addtocontents{#1}{\protect\cftsetpnumwidth{#2} \protect\cftsetrmarg{#3}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftaddtitleline}
% |\cftaddtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}|
% adds a |\contentsline| entry to \meta{file} with the given information.
%    \begin{macrocode}
\newcommand{\cftaddtitleline}[4]{%
  \addtocontents{#1}{\protect\contentsline{#2}{#3}{#4}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cftaddnumtitleline}
% |\cftaddtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{num}|}{|\meta{title}|}{|\meta{page}|}|
% adds a |\contentsline| entry to \meta{file} with the given information.
%    \begin{macrocode}
\newcommand{\cftaddnumtitleline}[5]{%
  \addtocontents{#1}%
    {\protect\contentsline{#2}{\protect\numberline{#3}{\protect\ignorespaces #4}}{#5}}}
%    \end{macrocode}
% \end{macro}
%
%
%
%
%    The end of this package.
%    \begin{macrocode}
%</usc>
%    \end{macrocode}
%
%
% \bibliographystyle{alpha}
%
% \begin{thebibliography}{GMS94}
%
% \bibitem[GMS94]{GOOSSENS94}
% Michel Goossens, Frank Mittelbach, and Alexander Samarin.
% \newblock {\em The LaTeX Companion}.
% \newblock Addison-Wesley Publishing Company, 1994.
%
% \bibitem[Wil96]{PRW96i}
% Peter~R. Wilson.
% \newblock {\em {LaTeX for standards: The LaTeX package files user manual}}.
% \newblock NIST Report NISTIR, June 1996.
%
% \end{thebibliography}
%
%
% \Finale
% \PrintIndex
%
\endinput

%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}


