| 1 |
% \iffalse meta-comment |
| 2 |
% tocbibind.dtx |
| 3 |
% Author: Peter Wilson, Herries Press |
| 4 |
% Maintainer: Will Robertson (will dot robertson at latex-project dot org) |
| 5 |
% Copyright 1998--2004 Peter R. Wilson |
| 6 |
% |
| 7 |
% This work may be distributed and/or modified under the |
| 8 |
% conditions of the LaTeX Project Public License, either |
| 9 |
% version 1.3c of this license or (at your option) any |
| 10 |
% later version: <http://www.latex-project.org/lppl.txt> |
| 11 |
% |
| 12 |
% This work has the LPPL maintenance status "maintained". |
| 13 |
% The Current Maintainer of this work is Will Robertson. |
| 14 |
% |
| 15 |
% This work consists of the files listed in the README file. |
| 16 |
% |
| 17 |
% |
| 18 |
%<*driver> |
| 19 |
\documentclass{ltxdoc} |
| 20 |
\EnableCrossrefs |
| 21 |
\CodelineIndex |
| 22 |
\setcounter{StandardModuleDepth}{1} |
| 23 |
\begin{document} |
| 24 |
\DocInput{tocbibind.dtx} |
| 25 |
\end{document} |
| 26 |
%</driver> |
| 27 |
% |
| 28 |
% \fi |
| 29 |
% |
| 30 |
% \CheckSum{464} |
| 31 |
% |
| 32 |
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath} |
| 33 |
% \DoNotIndex{\@centercr,\@cite} |
| 34 |
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue} |
| 35 |
% \DoNotIndex{\@input,\@ixpt,\@m} |
| 36 |
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint} |
| 37 |
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb} |
| 38 |
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt} |
| 39 |
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt} |
| 40 |
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace} |
| 41 |
% \DoNotIndex{\advance,\Alph,\alph} |
| 42 |
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box} |
| 43 |
% \DoNotIndex{\bullet} |
| 44 |
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption} |
| 45 |
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass} |
| 46 |
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist} |
| 47 |
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup} |
| 48 |
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter} |
| 49 |
% \DoNotIndex{\fbox} |
| 50 |
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef} |
| 51 |
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule} |
| 52 |
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi} |
| 53 |
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi} |
| 54 |
% \DoNotIndex{\input} |
| 55 |
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark} |
| 56 |
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright} |
| 57 |
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment} |
| 58 |
% \DoNotIndex{\NeedsTeXFormat,\newdimen} |
| 59 |
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number} |
| 60 |
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@} |
| 61 |
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip} |
| 62 |
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions} |
| 63 |
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright} |
| 64 |
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font} |
| 65 |
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman} |
| 66 |
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength} |
| 67 |
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space} |
| 68 |
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase} |
| 69 |
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt} |
| 70 |
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace} |
| 71 |
% \DoNotIndex{\wd,\xiipt,\year,\z@} |
| 72 |
% |
| 73 |
% \changes{v1.0}{1998/10/24}{First public release} |
| 74 |
% \changes{v1.1}{1998/11/15}{Added the proc class and extra support for unknown classes} |
| 75 |
% \changes{v1.2}{1999/01/17}{Using the stdclsdv package} |
| 76 |
% \changes{v1.2}{1999/01/17}{Made compatible with the tocloft package} |
| 77 |
% \changes{v1.3}{1999/08/22}{Fixed index numbering, options, headings} |
| 78 |
% \changes{v1.3a}{1999/09/12}{Added PackageNote commands} |
| 79 |
% \changes{v1.4}{2000/03/04}{Fixed shift of Index title} |
| 80 |
% \changes{v1.4}{2000/03/04}{Added support for numbered Listof headings} |
| 81 |
% \changes{v1.4a}{2000/03/04}{Added delimeter for simple chapters} |
| 82 |
% \changes{v1.5}{2001/04/17}{Fixed \cs{addcontentsline} problem with hyperref package} |
| 83 |
% \changes{v1.5}{2001/04/17}{Removed requirement for the stdclsdv package} |
| 84 |
% \changes{v1.5a}{2001/08/07}{Made \cs{restorechapter} safer} |
| 85 |
% \changes{v1.5b}{2001/11/10}{Fiddled with page styling} |
| 86 |
% \changes{v1.5c}{2002/03/11}{Fixed \cs{@mkboth}} |
| 87 |
% \changes{v1.5d}{2002/04/09}{Fixed \cs{tocchapter} for article classes} |
| 88 |
% \changes{v1.5e}{2003/01/22}{Changed thebibliography} |
| 89 |
% \changes{v1.5f}{2003/02/04}{Changed theindex} |
| 90 |
% \changes{v1.5h}{2004/05/10}{Changed license from LPPL v1.0 to v1.3} |
| 91 |
% \changes{v1.5i}{2009/09/04}{New maintainer (Will Robertson)} |
| 92 |
% \changes{v1.5k}{2010/10/13}{Remove a message in the console output} |
| 93 |
% |
| 94 |
% \def\dtxfile{tocbibind.dtx} |
| 95 |
% \def\fileversion{v1.4a} \def\filedate{2000/03/05} |
| 96 |
% \def\fileversion{v1.5} \def\filedate{2001/04/17} |
| 97 |
% \def\fileversion{v1.5a} \def\filedate{2001/08/07} |
| 98 |
% \def\fileversion{v1.5b} \def\filedate{2001/11/10} |
| 99 |
% \def\fileversion{v1.5c} \def\filedate{2002/03/11} |
| 100 |
% \def\fileversion{v1.5d} \def\filedate{2002/04/09} |
| 101 |
% \def\fileversion{v1.5e} \def\filedate{2003/01/22} |
| 102 |
% \def\fileversion{v1.5f} \def\filedate{2003/02/04} |
| 103 |
% \def\fileversion{v1.5g} \def\filedate{2003/03/13} |
| 104 |
% \def\fileversion{v1.5h} \def\filedate{2004/05/10} |
| 105 |
% \def\fileversion{v1.5i} \def\filedate{2009/09/04} |
| 106 |
% \def\fileversion{v1.5j} \def\filedate{2009/12/28} |
| 107 |
% \def\fileversion{v1.5k} \def\filedate{2010/10/13} |
| 108 |
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package |
| 109 |
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option |
| 110 |
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file |
| 111 |
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter |
| 112 |
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle |
| 113 |
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment |
| 114 |
% |
| 115 |
% \title{The \Lpack{tocbibind} package\thanks{This |
| 116 |
% file (\texttt{\dtxfile}) has version number \fileversion, last revised |
| 117 |
% \filedate.}} |
| 118 |
% |
| 119 |
% \author{ |
| 120 |
% Author: Peter Wilson, Herries Press\\ |
| 121 |
% Maintainer: Will Robertson\\ |
| 122 |
% \texttt{will dot robertson at latex-project dot org} |
| 123 |
% } |
| 124 |
% \date{\filedate} |
| 125 |
% \maketitle |
| 126 |
% \begin{abstract} |
| 127 |
% The \Lpack{tocbibind} package can be used to add document elements |
| 128 |
% like a bibliography or an index to the Table of Contents. The package |
| 129 |
% is designed to work with the four standard \Lpack{book}, \Lpack{report}, |
| 130 |
% \Lpack{article} and \Lpack{proc} classes, and to a limited extent with the |
| 131 |
% \Lpack{ltxdoc} class. Results with other classes may be |
| 132 |
% problematical. The package has been tested with the \Lpack{tocloft} |
| 133 |
% package, but has not been tested with other packages |
| 134 |
% that change the definitions of the |\chapter*| or |\section*| commands. |
| 135 |
% |
| 136 |
% \end{abstract} |
| 137 |
% \tableofcontents |
| 138 |
% |
| 139 |
% \StopEventually{} |
| 140 |
% |
| 141 |
% |
| 142 |
% |
| 143 |
% \section{Introduction} |
| 144 |
% |
| 145 |
% Questions about adding the bibliography to the Table of Contents |
| 146 |
% seem to pop up fairly regularly on the |
| 147 |
% \texttt{comp.text.tex} newsgroup. |
| 148 |
% |
| 149 |
% The \Lpack{tocbibind} package provides a solution for |
| 150 |
% automatically inserting references to a bibliography or an index, |
| 151 |
% or other headed document elements into the Table of Contents. |
| 152 |
% (\Lpack{tocbibind} is meant to be shorthand for `Table of Contents, |
| 153 |
% Bibliography, Index, etc'). |
| 154 |
% Portions of the package were developed as part of a class |
| 155 |
% and package bundle for typesetting ISO standards~\cite{PRW96i}. |
| 156 |
% This manual is typeset according to the conventions of the |
| 157 |
% \LaTeX{} \textsc{docstrip} utility which enables the automatic |
| 158 |
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}. |
| 159 |
% |
| 160 |
% Section~\ref{sec:usc} describes the usage of the package. |
| 161 |
% Commented source code for the package is in Section~\ref{sec:code}. |
| 162 |
% |
| 163 |
% \section{The \Lpack{tocbibind} package} \label{sec:usc} |
| 164 |
% |
| 165 |
% The \Lpack{tocbibind} package enables the titles of the |
| 166 |
% Table of Contents, the List of Figures, the List of Tables, the |
| 167 |
% Bibliography and the Index all to be added to the Table of Contents. |
| 168 |
% By default, all of these document elements, if they exist, will be |
| 169 |
% incorporated into the Table of Contents (ToC for short). |
| 170 |
% Package options are available to switch off any of these inclusions. |
| 171 |
% \begin{itemize} |
| 172 |
% \item \Lopt{notbib} Disables the inclusion of the Bibliography. |
| 173 |
% \item \Lopt{notindex} Disables the inclusion of the Index (inclusion |
| 174 |
% of the Index of an \Lpack{ltxdoc} class document is permanantly |
| 175 |
% disabled). |
| 176 |
% \item \Lopt{nottoc} Disables the inclusion of the ToC. |
| 177 |
% \item \Lopt{notlot} Disables the inclusion of the List of Tables. |
| 178 |
% \item \Lopt{notlof} Disables the inclusion of the List of Figures. |
| 179 |
% \item \Lopt{chapter} Use chapter-level headings, if possible. |
| 180 |
% \item \Lopt{section} Use section-level headings, if possible. |
| 181 |
% \item \Lopt{numbib} Number the Bibliography heading (default is no number). |
| 182 |
% \item \Lopt{numindex} Number the Index heading (default is no number). |
| 183 |
% \item \Lopt{other} Use a non-traditional heading command. This option |
| 184 |
% effectively requires the use of the |\tocotherhead| command. |
| 185 |
% \item \Lopt{none} Disables everything. |
| 186 |
% \end{itemize} |
| 187 |
% |
| 188 |
% The package is designed to work with the standard \LaTeX{} |
| 189 |
% document classes \Lpack{book}, \Lpack{report}, \Lpack{article}, \Lpack{proc} |
| 190 |
% and \Lpack{ltxdoc} class (which is based to a large extent on |
| 191 |
% the \Lpack{article} class). |
| 192 |
% In the \Lpack{article}, \Lpack{proc} and \Lpack{ltxdoc} classes \LaTeX{} |
| 193 |
% uses the |\section*| heading |
| 194 |
% style for the bibliography etc., while for the other two classes |
| 195 |
% it uses the |\chapter*| heading style. \Lpack{tocbibind} honours |
| 196 |
% these conventions. However, if the package is used with another |
| 197 |
% class (perhaps with a class for typesetting theses which has |
| 198 |
% different conventions), then the |
| 199 |
% \Lopt{chapter} or \Lopt{section} options can be used to select the |
| 200 |
% appropriate style (but the class must define |\chapter*| and |
| 201 |
% |\@makeschapterhead|, or |\section*| respectively). |
| 202 |
% |
| 203 |
% The standard classes, except for \Lpack{ltxdoc}, have a feature whereby the |
| 204 |
% height of the title for an index is at a different height than |
| 205 |
% any other in a document (latex bug~3126). The \Lpack{tocbibind} package |
| 206 |
% disables this feature. |
| 207 |
% The disablement has the side effect that |
| 208 |
% the |\columnseprule| and |\columnsep| lengths can be |
| 209 |
% set via |\setlength| to alter the column seperation and the thickness |
| 210 |
% of a rule between the two columns in the index. |
| 211 |
% The effect of using the \Lopt{none} option is to limit any changes to |
| 212 |
% the single one of disabling this standard feature. |
| 213 |
% |
| 214 |
% \DescribeMacro{\tocotherhead} |
| 215 |
% In the standard \LaTeX{} classes the bibliography and index headings |
| 216 |
% are either both defined in terms of the |\chapter*| command or in |
| 217 |
% terms of the |\section*| command. |
| 218 |
% The package assumes that any class, other than the standard classes |
| 219 |
% already mentioned, will either use code from the standard classes for |
| 220 |
% implementing the bibliography and other headings, or will use very |
| 221 |
% similar code. Some classes (and maybe packages) change the names of |
| 222 |
% the heading commands. One example that I am aware of uses |\clause| |
| 223 |
% instead of |\section|, |\sclause| instead of |\subsection| and so on. |
| 224 |
% If your document's headings are defined like this and the same |
| 225 |
% heading level is used for the bibliography, etc., then you can use |
| 226 |
% the \Lopt{other} option and |
| 227 |
% the |\tocotherhead{|\meta{headingname}|}| command to cater for this. |
| 228 |
% If your document uses |\clause| then put |\tocotherhead{clause}| |
| 229 |
% in the preamble after loading the package. The package then assumes |
| 230 |
% that the bibliography heading is defined in terms of |\clause*|. |
| 231 |
% |
| 232 |
% If you use the |\tocotherhead| command, then it overrides any |
| 233 |
% \Lopt{chapter} or \Lopt{section} option. |
| 234 |
% |
| 235 |
% \DescribeMacro{\tocbibname} |
| 236 |
% The package attempts to pick up the name for the Bibliography from |
| 237 |
% the class definition. (Note that the \Lpack{article} class and |
| 238 |
% its derivatives stores |
| 239 |
% the name text in the |\refname| whilst the \Lpack{book} and \Lpack{report} |
| 240 |
% classes |
| 241 |
% store the name in |\bibname|). This package uses |\tocbibname| |
| 242 |
% to store the name of the bibliography. |
| 243 |
% |
| 244 |
% \changes{v1.2}{1999/01/17}{Replaced toc\ldots name commands by the set\ldots commands.} |
| 245 |
% \DescribeMacro{\setindexname} |
| 246 |
% \DescribeMacro{\settocname} |
| 247 |
% \DescribeMacro{\setlotname} |
| 248 |
% \DescribeMacro{\setlofname} |
| 249 |
% \DescribeMacro{\settocbibname} |
| 250 |
% These commands set the heading texts for the index, |
| 251 |
% ToC, list of tables and list of figures. When used with the three |
| 252 |
% standard classes, the heading text is picked up from the |\indexname|, |
| 253 |
% |\contentsname|, |\listtablename| and |\listfigurename| commands |
| 254 |
% respectively. The heading texts can be changed by changing the standard |
| 255 |
% commands, or by using |\setindexname{|\meta{name}|}|, and similarly for |
| 256 |
% the other headings. Thus, the following two lines of code have the |
| 257 |
% same effect: |
| 258 |
% \begin{verbatim} |
| 259 |
% \renewcommand{\listfigurename}{Figures} |
| 260 |
% \setlofname{Figures} |
| 261 |
% \end{verbatim} |
| 262 |
% \textit{Note that these commands replace the } |\toc...name| |
| 263 |
% \textit{commands that were in version 1.1.} |
| 264 |
% |
| 265 |
% |
| 266 |
% \subsection{Numbering the List of Figures, etc.} |
| 267 |
% |
| 268 |
% Some authors like, or are required, to number the Listof headings. |
| 269 |
% Some commands are provided to simplify doing this. |
| 270 |
% |
| 271 |
% \DescribeMacro{\simplechapter} |
| 272 |
% \DescribeMacro{\simplechapterdelim} |
| 273 |
% \DescribeMacro{\restorechapter} |
| 274 |
% In chaptered documents, the Listof headings are effectively typeset as |
| 275 |
% |\chapter*{}|. The natural way to get numbered headings would be to |
| 276 |
% typeset them as |\chapter{}| but this has the potential disadvantage |
| 277 |
% that the word `Chapter', or equivalent, would be written before the |
| 278 |
% heading, which is probably not what is required. The |
| 279 |
% |\simplechapter[|\meta{name}|]| |
| 280 |
% command modifies any subsequent |\chapter| commands so that the result |
| 281 |
% looks like that of |\chapter*| except that the chapter number is put |
| 282 |
% on the same line as the title and the value of |\simplechapterdelim| |
| 283 |
% is typeset immediately after the number. By default, |\simplechapterdelim| |
| 284 |
% is empty. |
| 285 |
% If the optional \meta{name} argument |
| 286 |
% is present, the \meta{name} is typeset before the number. For example: |
| 287 |
% \begin{verbatim} |
| 288 |
% \renewcommand{\simplechapterdelim}{:} |
| 289 |
% \simplechapter[Chap] |
| 290 |
% \end{verbatim} |
| 291 |
% will result in |\chapter{First chapter}| being typeset like: \\ |
| 292 |
% \quad \textbf{Chap 1: First chapter}. \\ |
| 293 |
% The |\restorechapter| command resets |
| 294 |
% any subsequent |\chapter| commands to their default behaviour. |
| 295 |
% |
| 296 |
% \DescribeMacro{\tocchapter} |
| 297 |
% \DescribeMacro{\tocsection} |
| 298 |
% Internally, the Listof commands in the \Lpack{tocbibind} package use |
| 299 |
% |\toc@chapter| for typesetting |
| 300 |
% the Listof headings in chaptered documents and |\toc@section| for |
| 301 |
% non-chaptered documents. The |\tocchapter| command modifies the |
| 302 |
% |\toc@chapter| command to use a `simple chapter' heading. The |\tocsection| |
| 303 |
% command modifies |\toc@section| to typeset using |\section| instead of |
| 304 |
% |\section*|. |
| 305 |
% |
| 306 |
% For example, to get a numbered List of Figures heading in a chaptered |
| 307 |
% document, put the following in the preamble: |
| 308 |
% \begin{verbatim} |
| 309 |
% \renewcommand{\listoffigures}{\begingroup |
| 310 |
% \tocchapter |
| 311 |
% \tocfile{\listfigurename}{lof} |
| 312 |
% \endgroup} |
| 313 |
% \end{verbatim} |
| 314 |
% while to get a numbered List of Tables in a non-chaptered document: |
| 315 |
% \begin{verbatim} |
| 316 |
% \renewcommand{\listoftables}{\begingroup |
| 317 |
% \tocsection |
| 318 |
% \tocfile{\listtablename}{lot} |
| 319 |
% \endgroup} |
| 320 |
% \end{verbatim} |
| 321 |
% More generally, to number the Table of Contents in a (non-)chaptered document |
| 322 |
% you can do: |
| 323 |
% \begin{verbatim} |
| 324 |
% \renewcommand{\tableofcontents}{\begingroup |
| 325 |
% \tocsection |
| 326 |
% \tocchapter |
| 327 |
% \tocfile{\contentsname}{toc} |
| 328 |
% \endgroup} |
| 329 |
% \end{verbatim} |
| 330 |
% The |\begingroup| |\endgroup| pairing keeps the changes local. |
| 331 |
% |
| 332 |
% \subsection{Page styles} |
| 333 |
% |
| 334 |
% The package, by default, supports the standard |empty|, |plain|, and |
| 335 |
% |headings| page styles. Other page styles, for example ones you specify |
| 336 |
% yourself via the \Lpack{fancyhdr} package, are indirectly supported. |
| 337 |
% |
| 338 |
% As an example, assume that you are using the \Lpack{fancyhdr} package |
| 339 |
% and you use a |fancy| pagestyle in a \Lpack{book/report} class |
| 340 |
% document like: |
| 341 |
% \begin{verbatim} |
| 342 |
% \pagestyle{fancy} |
| 343 |
% \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}} |
| 344 |
% \end{verbatim} |
| 345 |
% then you will find that the chapter titles in headers are in normalcase |
| 346 |
% but the ToC, etc., headers are still in uppercase. |
| 347 |
% |
| 348 |
% \DescribeMacro{\tocetcmark} |
| 349 |
% In this package, the marks for the ToC, LoF\ldots headers are specified |
| 350 |
% via the command |\tocetcmark|\marg{head}. To match the |fancy| pagestyle |
| 351 |
% this must be redefined, like: |
| 352 |
% \begin{verbatim} |
| 353 |
% \pagestyle{fancy} |
| 354 |
% \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}} |
| 355 |
% \renewcommand{\tocetcmark}[1]{\markboth{#1}{}} |
| 356 |
% \end{verbatim} |
| 357 |
% which will give normalcase headers for the ToC, LoF\ldots. As these |
| 358 |
% are not normally numbered, it would be a misjudgement to try and |
| 359 |
% get a non-existent chapter number into the header. |
| 360 |
% |
| 361 |
% Documents with sections, but not chapters, can be treated in a similar |
| 362 |
% manner by redefining |\tocetcmark| appropriately. |
| 363 |
% |
| 364 |
% |
| 365 |
% |
| 366 |
% \subsection{Package Defined Listof...} |
| 367 |
% |
| 368 |
% There are packages, such as \Lpack{listings} and \Lpack{ccaption}, that |
| 369 |
% provide new Listof lists. These can be handled by the \Lpack{tocbibind} |
| 370 |
% package in a similar manner to the usual Listofs. Two examples are given |
| 371 |
% below. |
| 372 |
% |
| 373 |
% The \Lpack{listings} package version 0.2 provides a |\lstlistoflistings| |
| 374 |
% command to print a list of listings. The header name for this list |
| 375 |
% is in |\lstlistingname| and the listing file has the extension |lol|. |
| 376 |
% This can be treated just like the |\listoffigure|, etc., commands. |
| 377 |
% To add the List of Listings header to the ToC do: |
| 378 |
% \begin{verbatim} |
| 379 |
% \renewcommand{\lstlistoflistings}{\begingroup |
| 380 |
% \tocfile{\lstlistingname}{lol} |
| 381 |
% \endgroup} |
| 382 |
% \end{verbatim} |
| 383 |
% and to number the Listof heading do: |
| 384 |
% \begin{verbatim} |
| 385 |
% \renewcommand{\lstlistoflistings}{\begingroup |
| 386 |
% \tocsection |
| 387 |
% \tocchapter |
| 388 |
% \tocfile{\lstlistingname}{lol} |
| 389 |
% \endgroup} |
| 390 |
% \end{verbatim} |
| 391 |
% |
| 392 |
% The \Lpack{ccaption} package enables authors to define new kinds of |
| 393 |
% floats (together with their captions) and Listof for each new kind of float. |
| 394 |
% The command to define a new float is essentially |
| 395 |
% |\newfloatlist{|\meta{fenv}|}{|\meta{ext}|}{|\meta{listname}|}{|\meta{capname}|}|, |
| 396 |
% where \meta{fenv} is the name of the new float environment and \meta{ext} |
| 397 |
% is the file extension for the listof file. The typesetting of the |
| 398 |
% Listof listing is called by the command |
| 399 |
% |\listoffenv|, where |fenv| is the name \meta{fenv}. |
| 400 |
% For example, a new float environment for diagrams could be |
| 401 |
% defined via \\ |
| 402 |
% |\newfloatlist{diagram}{dia}{List of Diagrams}{Diagram}|, and the Listof |
| 403 |
% called for by \\ |
| 404 |
% |\listofdiagram| |
| 405 |
% |
| 406 |
% In this case, to add the `List of Diagrams' to the ToC it is |
| 407 |
% necessary to define a |
| 408 |
% new listof command, and use this in place of the |\listoffenv|. |
| 409 |
% For the diagram example this could be (unnumbered): |
| 410 |
% \begin{verbatim} |
| 411 |
% \newcommand{\listofdia}{\begingroup |
| 412 |
% \tocfile{List of Diagrams}{dia} |
| 413 |
% \endgroup} |
| 414 |
% \end{verbatim} |
| 415 |
% and correspondingly for a numbered version: |
| 416 |
% \begin{verbatim} |
| 417 |
% \newcommand{\listofdia}{\begingroup |
| 418 |
% \tocsection |
| 419 |
% \tocchapter |
| 420 |
% \tocfile{List of Diagrams}{dia} |
| 421 |
% \endgroup} |
| 422 |
% \end{verbatim} |
| 423 |
% and then use |\listofdia| instead of |\listofdiagram|. |
| 424 |
% |
| 425 |
% |
| 426 |
% |
| 427 |
% \subsection{Abstracts} |
| 428 |
% |
| 429 |
% On rare occasions a publisher may want an abstract listed in the |
| 430 |
% ToC. This package does not provide for that, partly because |
| 431 |
% it is easier to do than the other headings. Just proceed along |
| 432 |
% the lines below, where \texttt{section} might have to be |
| 433 |
% \texttt{chapter}, and if you are using the \Lpack{hyperref} package |
| 434 |
% you have to use the |\phantomsection| macro. |
| 435 |
% \begin{verbatim} |
| 436 |
% \begin{abstract} |
| 437 |
% % \phantomsection % required if using hyperref |
| 438 |
% \addcontentsline{toc}{section}{\abstractname} |
| 439 |
% ... rest of the abstract |
| 440 |
% \end{verbatim} |
| 441 |
% |
| 442 |
% |
| 443 |
% |
| 444 |
% \section{The package code} \label{sec:code} |
| 445 |
% |
| 446 |
% Announce the name and version of the package, which requires |
| 447 |
% \LaTeXe. |
| 448 |
% \changes{v1.5}{2001/04/17}{Deleted requirement for stdclsdv package} |
| 449 |
% \begin{macrocode} |
| 450 |
%<*usc> |
| 451 |
\NeedsTeXFormat{LaTeX2e} |
| 452 |
\ProvidesPackage{tocbibind}[2010/10/13 v1.5k extra ToC listings] |
| 453 |
% \end{macrocode} |
| 454 |
% |
| 455 |
% \begin{macro}{\PRWPackageNote} |
| 456 |
% \begin{macro}{\PRWPackageNoteNoLine} |
| 457 |
% These two commands write a package Note to the terminal and log file. |
| 458 |
% Use as |\PRWPackageNote{|\meta{package name}|}{|\meta{note text}|}|. |
| 459 |
% The NoLine version does not show the line number. The commands are |
| 460 |
% intermediate between the kernel |\PackageWarning| and |\PackageInfo| |
| 461 |
% commands. I have provided them as other packages (of mine) may also |
| 462 |
% incorporate them. The code is based on \file{lterror.dtx}. |
| 463 |
% \changes{v1.3a}{1999/09/12}{Provided PRWPackageNote and PRWPackageNoteNoLine |
| 464 |
% commands} |
| 465 |
% \begin{macrocode} |
| 466 |
\providecommand{\PRWPackageNote}[2]{% |
| 467 |
\GenericWarning{% |
| 468 |
(#1)\@spaces\@spaces\@spaces\@spaces |
| 469 |
}{% |
| 470 |
Package #1 Note: #2% |
| 471 |
}% |
| 472 |
} |
| 473 |
\providecommand{\PRWPackageNoteNoLine}[2]{% |
| 474 |
\PRWPackageNote{#1}{#2\@gobble}% |
| 475 |
} |
| 476 |
|
| 477 |
% \end{macrocode} |
| 478 |
% \end{macro} |
| 479 |
% \end{macro} |
| 480 |
% |
| 481 |
% \begin{macro}{\@bibquit} |
| 482 |
% \begin{macro}{\if@bibchapter} |
| 483 |
% We need to know what sectional divisions are supported. |
| 484 |
% \changes{v1.5}{2001/04/17}{Major surgery to code for checking divisions} |
| 485 |
% \begin{macrocode} |
| 486 |
\newcommand{\@bibquit}{} |
| 487 |
\newif\if@bibchapter |
| 488 |
\@ifundefined{chapter}{% |
| 489 |
\@bibchapterfalse |
| 490 |
\@ifundefined{section}{% |
| 491 |
\PackageWarning{tocbibind}% |
| 492 |
{I don't recognize any sectional divisions.\MessageBreak |
| 493 |
I hope you have used the `other' option\MessageBreak |
| 494 |
otherwise I'll ignore the package} |
| 495 |
\renewcommand{\@bibquit}{\endinput} |
| 496 |
}{\PackageInfo{tocbibind}{The document has section divisions}} |
| 497 |
}{\@bibchaptertrue |
| 498 |
\PackageInfo{tocbibind}{The document has chapter divisions}} |
| 499 |
|
| 500 |
% \end{macrocode} |
| 501 |
% \end{macro} |
| 502 |
% \end{macro} |
| 503 |
% |
| 504 |
% \begin{macro}{\if@inltxdoc} |
| 505 |
% This is used as a flag for the \Lpack{ltxdoc} class. This has a |
| 506 |
% particular kind of index that I am not going to mess with. |
| 507 |
% \begin{macrocode} |
| 508 |
\newif\if@inltxdoc |
| 509 |
\@ifclassloaded{ltxdoc}{\@inltxdoctrue}{\@inltxdocfalse} |
| 510 |
|
| 511 |
% \end{macrocode} |
| 512 |
% \end{macro} |
| 513 |
% |
| 514 |
% |
| 515 |
% \begin{macro}{\if@dotocbib} |
| 516 |
% \begin{macro}{\if@dotocind} |
| 517 |
% \begin{macro}{\if@dotoctoc} |
| 518 |
% \begin{macro}{\if@dotoclot} |
| 519 |
% \begin{macro}{\if@dotoclof} |
| 520 |
% A set of booleans for deciding what is to go into the ToC. By |
| 521 |
% default add everything. |
| 522 |
% \begin{macrocode} |
| 523 |
\newif\if@dotocbib\@dotocbibtrue |
| 524 |
\newif\if@dotocind\@dotocindtrue |
| 525 |
\newif\if@dotoctoc\@dotoctoctrue |
| 526 |
\newif\if@dotoclot\@dotoclottrue |
| 527 |
\newif\if@dotoclof\@dotocloftrue |
| 528 |
|
| 529 |
% \end{macrocode} |
| 530 |
% \end{macro} |
| 531 |
% \end{macro} |
| 532 |
% \end{macro} |
| 533 |
% \end{macro} |
| 534 |
% \end{macro} |
| 535 |
% |
| 536 |
% \begin{macro}{\if@donumbib} |
| 537 |
% \begin{macro}{\if@donumindex} |
| 538 |
% A set of booleans for deciding whether or not to produce numbered |
| 539 |
% headings (default is to do unnumbered headings). |
| 540 |
% \begin{macrocode} |
| 541 |
\newif\if@donumbib\@donumbibfalse |
| 542 |
\newif\if@donumindex\@donumindexfalse |
| 543 |
% \end{macrocode} |
| 544 |
% \end{macro} |
| 545 |
% \end{macro} |
| 546 |
% |
| 547 |
% \begin{macro}{\if@dot@cb@bsection} |
| 548 |
% If TRUE, use a section heading for the bibliography no matter what |
| 549 |
% the main document divisions are. |
| 550 |
% \changes{v1.5e}{2003/01/22}{Added \cs{if@dot@cb@bsection}} |
| 551 |
% \begin{macrocode} |
| 552 |
\newif\if@dot@cb@bsection\@dot@cb@bsectionfalse |
| 553 |
|
| 554 |
% \end{macrocode} |
| 555 |
% \end{macro} |
| 556 |
% |
| 557 |
% Now we can do the options. Most of them are easy. |
| 558 |
% \begin{macrocode} |
| 559 |
\DeclareOption{section}{\@bibchapterfalse} |
| 560 |
\DeclareOption{notbib}{\@dotocbibfalse} |
| 561 |
\DeclareOption{notindex}{\@dotocindfalse} |
| 562 |
\DeclareOption{nottoc}{\@dotoctocfalse} |
| 563 |
\DeclareOption{notlot}{\@dotoclotfalse} |
| 564 |
\DeclareOption{notlof}{\@dotocloffalse} |
| 565 |
\DeclareOption{numbib}{\@donumbibtrue} |
| 566 |
\DeclareOption{numindex}{\@donumindextrue} |
| 567 |
|
| 568 |
% \end{macrocode} |
| 569 |
% The \Lopt{chapter} option needs to check whether or not the chapter |
| 570 |
% heading commands are defined. If they are not, then go with the |
| 571 |
% section level headings. |
| 572 |
% \begin{macrocode} |
| 573 |
\DeclareOption{chapter}{% |
| 574 |
\if@bibchapter\else |
| 575 |
\PackageWarning{tocbibind}% |
| 576 |
{Chapters are undefined, using section instead} |
| 577 |
\fi} |
| 578 |
|
| 579 |
% \end{macrocode} |
| 580 |
% |
| 581 |
% The \Lopt{other} option makes |\@bibquit| a no-op and cancels any |
| 582 |
% chapter based processing. |
| 583 |
% \changes{v1.3}{1999/08/22}{Added the `other' option} |
| 584 |
% \begin{macrocode} |
| 585 |
\DeclareOption{other}{\renewcommand{\@bibquit}{} |
| 586 |
\@bibchapterfalse} |
| 587 |
% \end{macrocode} |
| 588 |
% |
| 589 |
% The \Lopt{none} option turns everything off. |
| 590 |
% \changes{v1.}{2000/03/04}{Added the `none' option} |
| 591 |
% \begin{macrocode} |
| 592 |
\DeclareOption{none}{% |
| 593 |
\@dotocbibfalse |
| 594 |
\@dotocindfalse |
| 595 |
\@dotoctocfalse |
| 596 |
\@dotoclotfalse |
| 597 |
\@dotocloffalse |
| 598 |
\@donumbibfalse |
| 599 |
\@donumindexfalse |
| 600 |
} |
| 601 |
% \end{macrocode} |
| 602 |
% |
| 603 |
% Process the options now, and then quit if necessary. |
| 604 |
% \changes{v1.3}{1999/08/22}{Now quit after option processing} |
| 605 |
% \begin{macrocode} |
| 606 |
\ProcessOptions\relax |
| 607 |
\@bibquit |
| 608 |
|
| 609 |
% \end{macrocode} |
| 610 |
% |
| 611 |
% Issue a note about the heading style being used. |
| 612 |
% \changes{v1.3a}{1999/09/12}{Replaced PackageWarning here by PRWPackageNoteNoLine} |
| 613 |
% \begin{macrocode} |
| 614 |
\if@bibchapter |
| 615 |
\PRWPackageNoteNoLine{tocbibind}{Using chapter style headings, unless overridden} |
| 616 |
\else |
| 617 |
\PRWPackageNoteNoLine{tocbibind}{Using section or other style headings} |
| 618 |
\fi |
| 619 |
% \end{macrocode} |
| 620 |
% |
| 621 |
% Ensure that the index is not processed if it is an \Lpack{ltxdoc} class. |
| 622 |
% \begin{macrocode} |
| 623 |
\if@inltxdoc \@dotocindfalse \fi |
| 624 |
|
| 625 |
% \end{macrocode} |
| 626 |
% |
| 627 |
% \begin{macro}{\@tocextra} |
| 628 |
% \begin{macro}{\tocotherhead} |
| 629 |
% |\@tocextra| is the internal command to store the heading command name. |
| 630 |
% |\tocotherhead{|\meta{name}|}| is the user command to set the |
| 631 |
% heading command \meta{name} (without the backslash). |
| 632 |
% The default is section. |
| 633 |
% \changes{v1.3}{1999/08/22}{Renamed tocextrahead command as tocotherhead} |
| 634 |
% \begin{macrocode} |
| 635 |
\newcommand{\@tocextra}{section} |
| 636 |
\newcommand{\tocotherhead}[1]{\renewcommand{\@tocextra}{#1}} |
| 637 |
|
| 638 |
% \end{macrocode} |
| 639 |
% \end{macro} |
| 640 |
% \end{macro} |
| 641 |
% |
| 642 |
% \begin{macro}{\tocetcmark} |
| 643 |
% \begin{macro}{\prw@mkboth} |
| 644 |
% \begin{macro}{\toc@section} |
| 645 |
% \begin{macro}{\toc@headstar} |
| 646 |
% Utility macros, as the code that they represent gets |
| 647 |
% used several times over. They deal with marking for page headers |
| 648 |
% (code taken from \file{classes.dtx}), |
| 649 |
% and adding starred sectional headings to the ToC. |
| 650 |
% |
| 651 |
% |\tocetcmark|\marg{text} is the default mark code as called by |
| 652 |
% sectional headings. |
| 653 |
% \changes{v1.5b}{2001/11/10}{Added \cs{tocetcmark}} |
| 654 |
% \changes{v1.5c}{2002/03/11}{Changed \cs{@markboth} to \cs{@mkboth} in \cs{tocetcmark}} |
| 655 |
% \begin{macrocode} |
| 656 |
\newcommand{\tocetcmark}[1]{% |
| 657 |
\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}} |
| 658 |
% \end{macrocode} |
| 659 |
% |
| 660 |
% |\prw@mkboth|\marg{text} is used later for the ToC headings. |
| 661 |
% \changes{v1.5b}{2001/11/10}{Defined \cs{prw@mkboth} in terms of |
| 662 |
% \cs{tocetcmark}} |
| 663 |
% \begin{macrocode} |
| 664 |
\newcommand{\prw@mkboth}[1]{\tocetcmark{#1}} |
| 665 |
% \end{macrocode} |
| 666 |
% |
| 667 |
% |\toc@section{|\meta{sec}|}{|\meta{text}|}| is a generalised version |
| 668 |
% of |\sec*{|\meta{text}|}| which also makes an entry of \meta{text} into |
| 669 |
% the ToC, where \meta{sec} is the name of a sectional division (with no |
| 670 |
% backslash). |\toc@headstar{|\meta{sec}|}{|\meta{text}|}| is similar except |
| 671 |
% that it makes no entry into the ToC. |
| 672 |
% \changes{v1.5}{2001/04/17}{Added \cs{phantomsection} to \cs{toc@section} |
| 673 |
% and \cs{toc@chapter}} |
| 674 |
% \changes{v1.5j}{2009/12/28}{Removed \cs{phantomsection}} |
| 675 |
% \begin{macrocode} |
| 676 |
\newcommand{\toc@section}[2]{% |
| 677 |
\@nameuse{#1}*{#2\prw@mkboth{#2}} |
| 678 |
\addcontentsline{toc}{#1}{#2}} |
| 679 |
\newcommand{\toc@headstar}[2]{% |
| 680 |
\@nameuse{#1}*{{#2}}} |
| 681 |
% \end{macrocode} |
| 682 |
% \end{macro} |
| 683 |
% \end{macro} |
| 684 |
% \end{macro} |
| 685 |
% \end{macro} |
| 686 |
% |
| 687 |
% \begin{macro}{\toc@chapter} |
| 688 |
% |\toc@chapter{|\meta{text}|}| is equivalent to |\chapter*{|\meta{text}|}| |
| 689 |
% except that it makes an entry into the ToC. |
| 690 |
% |
| 691 |
% Until version 1.5f the chapter part of the code was |\chapter*{#1\prw@mkboth{#1}}|. |
| 692 |
% On 2003/03/12 James Szinger\footnote{\texttt{[email protected]}} wrote that |
| 693 |
% this failed for a bibliography in a two column book; the page headings |
| 694 |
% for the previous chapter continued through the bibliography! James |
| 695 |
% suggested that the mark |
| 696 |
% part should be moved outside the chapter part (as is now done). I have |
| 697 |
% no idea why there should have been this problem. As part of looking at |
| 698 |
% it I even replaced the \cs{toc@chapter} as used in the |thebibliography| |
| 699 |
% environment with the standard book class definition, which failed as |
| 700 |
% well. |
| 701 |
% |
| 702 |
% \changes{v1.5g}{2003/03/13}{Minor, but vital, change to \cs{toc@chapter}} |
| 703 |
% \changes{v1.5j}{2009/12/28}{Removed \cs{phantomsection}} |
| 704 |
% \begin{macrocode} |
| 705 |
\newcommand{\toc@chapter}[1]{% |
| 706 |
\chapter*{#1}\prw@mkboth{#1} |
| 707 |
\addcontentsline{toc}{chapter}{#1}} |
| 708 |
% \end{macrocode} |
| 709 |
% \end{macro} |
| 710 |
% |
| 711 |
% \begin{macro}{\tocbibname} |
| 712 |
% This holds the text for the Bibliography heading. We try and |
| 713 |
% get the text from the class (either |\bibname| or |\refname|). |
| 714 |
% \begin{macrocode} |
| 715 |
\ifx\bibname\undefined |
| 716 |
\ifx\refname\undefined |
| 717 |
\newcommand{\tocbibname}{References} |
| 718 |
\else |
| 719 |
\newcommand{\tocbibname}{\refname} |
| 720 |
\fi |
| 721 |
\else |
| 722 |
\newcommand{\tocbibname}{\bibname} |
| 723 |
\fi |
| 724 |
% \end{macrocode} |
| 725 |
% \end{macro} |
| 726 |
% |
| 727 |
% \begin{macro}{\setindexname} |
| 728 |
% \begin{macro}{\settocname} |
| 729 |
% \begin{macro}{\setlotname} |
| 730 |
% \begin{macro}{\setlofname} |
| 731 |
% \begin{macro}{\settocbibname} |
| 732 |
% The remaining heading texts are simpler as we only need to check |
| 733 |
% if their respective names are defined in the class. Note that these |
| 734 |
% commands in version 1.2 have been changed from version 1.1 in order to |
| 735 |
% integrate with the \Lpack{tocloft} package (which operates with |
| 736 |
% the |\contentsname| etc commands). |
| 737 |
% \begin{macrocode} |
| 738 |
\providecommand{\indexname}{Index} |
| 739 |
\newcommand{\setindexname}[1]{\renewcommand{\indexname}{#1}} |
| 740 |
\providecommand{\contentsname}{Contents} |
| 741 |
\newcommand{\settocname}[1]{\renewcommand{\contentsname}{#1}} |
| 742 |
\providecommand{\listtablename}{List of Tables} |
| 743 |
\newcommand{\setlotname}[1]{\renewcommand{\listtablename}{#1}} |
| 744 |
\providecommand{\listfigurename}{List of Figures} |
| 745 |
\newcommand{\setlofname}[1]{\renewcommand{\listfigurename}{#1}} |
| 746 |
\newcommand{\settocbibname}[1]{\renewcommand{\tocbibname}{#1}} |
| 747 |
% \end{macrocode} |
| 748 |
% \end{macro} |
| 749 |
% \end{macro} |
| 750 |
% \end{macro} |
| 751 |
% \end{macro} |
| 752 |
% \end{macro} |
| 753 |
% |
| 754 |
% The rest is just hacking the various environments and commands |
| 755 |
% from \file{classes.dtx}. |
| 756 |
% |
| 757 |
% Following a suggestion by Donald Arseneau (CTT, `Re: memoir, natbib, and |
| 758 |
% chapterbib', 9 Jan 2003), use |\bibsection| as a hook into |
| 759 |
% |thebibliography| for the style of the heading. |
| 760 |
% |
| 761 |
% \begin{macro}{\t@cb@bchapsection} |
| 762 |
% \begin{macro}{\t@cb@bsection} |
| 763 |
% Internal macros holding the heading for |thebibliography|. |
| 764 |
% \changes{v1.5e}{2003/01/13}{Added \cs{t@cb@bchapsec} and \cs{t@cb@bsection}} |
| 765 |
% \begin{macrocode} |
| 766 |
\newcommand{\t@cb@bchapsec}{% |
| 767 |
\if@bibchapter |
| 768 |
\if@donumbib |
| 769 |
\chapter{\tocbibname}% |
| 770 |
\else |
| 771 |
\toc@chapter{\tocbibname}% |
| 772 |
\fi |
| 773 |
\else |
| 774 |
\if@donumbib |
| 775 |
\@nameuse{\@tocextra}{\tocbibname}% |
| 776 |
\else |
| 777 |
\toc@section{\@tocextra}{\tocbibname}% |
| 778 |
\fi |
| 779 |
\fi} |
| 780 |
\newcommand{\t@cb@bsection}{% |
| 781 |
\if@donumbib |
| 782 |
\@nameuse{\@tocextra}{\tocbibname}% |
| 783 |
\else |
| 784 |
\toc@section{\@tocextra}{\tocbibname}% |
| 785 |
\fi} |
| 786 |
|
| 787 |
% \end{macrocode} |
| 788 |
% \end{macro} |
| 789 |
% \end{macro} |
| 790 |
% |
| 791 |
% |
| 792 |
% Redefine \Lenv{thebibliography}, but only if requested. Take care that |
| 793 |
% the \Lpack{natbib} package has not already modified the environment, noting |
| 794 |
% that \Lpack{natbib} defines and uses |\bibsection|. |
| 795 |
% \changes{v1.5e}{2003/01/13}{Major changes in redefining the thebibliography environment} |
| 796 |
% \begin{macrocode} |
| 797 |
\if@dotocbib |
| 798 |
% \end{macrocode} |
| 799 |
% |
| 800 |
% \begin{macrocode} |
| 801 |
\@ifpackageloaded{natbib}{}{% natbib not loaded |
| 802 |
% \end{macrocode} |
| 803 |
% The natbib package has not been used (yet), so go ahead and change |
| 804 |
% the environment. |
| 805 |
% \begin{macro}{\bibsection} |
| 806 |
% Macro holding heading for |thebibliography|. |
| 807 |
% \changes{v1.5e}{2003/01/13}{Added \cs{bibsection}} |
| 808 |
% \begin{macrocode} |
| 809 |
\newcommand{\bibsection}{\t@cb@bchapsec} |
| 810 |
% \end{macrocode} |
| 811 |
% \end{macro} |
| 812 |
% \begin{environment}{thebibliography} |
| 813 |
% \changes{v1.5e}{2003/01/13}{Changed thebibliography to use \cs{bibsection}} |
| 814 |
% \begin{macrocode} |
| 815 |
\renewenvironment{thebibliography}[1]{% |
| 816 |
\bibsection |
| 817 |
\begin{thebibitemlist}{#1}}{\end{thebibitemlist}}} |
| 818 |
% \end{macrocode} |
| 819 |
% \end{environment} |
| 820 |
% |
| 821 |
% |
| 822 |
% \begin{environment}{thebibitemlist} |
| 823 |
% Just as a matter of style, I have extracted the list making code |
| 824 |
% from the definition of the \Lenv{thebibliography}. It might also |
| 825 |
% make it easier for someone to change the list environment. |
| 826 |
% The code is a straight copy from \file{classes.dtx}. |
| 827 |
% \begin{macrocode} |
| 828 |
\newenvironment{thebibitemlist}[1]{ |
| 829 |
\list{\@biblabel{\@arabic\c@enumiv}}% |
| 830 |
{\settowidth\labelwidth{\@biblabel{#1}}% |
| 831 |
\leftmargin\labelwidth |
| 832 |
\advance\leftmargin\labelsep |
| 833 |
\@openbib@code |
| 834 |
\usecounter{enumiv}% |
| 835 |
\let\p@enumiv\@empty |
| 836 |
\renewcommand\theenumiv{\@arabic\c@enumiv}}% |
| 837 |
\sloppy |
| 838 |
\clubpenalty4000 |
| 839 |
\@clubpenalty \clubpenalty |
| 840 |
\widowpenalty4000% |
| 841 |
\sfcode`\.\@m} |
| 842 |
{\def\@noitemerr |
| 843 |
{\@latex@warning{Empty `thebibliography' environment}}% |
| 844 |
\endlist} |
| 845 |
|
| 846 |
% \end{macrocode} |
| 847 |
% \end{environment} |
| 848 |
% |
| 849 |
% \begin{macro}{\sectionbib} |
| 850 |
% The \Lpack{chapterbib} package defines a macro |\sectionbib| |
| 851 |
% which, if its |sectionbib| option is used, it calls at the beginning |
| 852 |
% of the document to fiddle with |
| 853 |
% the |thebibliography| environment (but it doesn't work when it |
| 854 |
% is renewed as above). We need to disable the macro because we do |
| 855 |
% our own fiddling |
| 856 |
% \changes{v1.5e}{2003/01/22}{Killed \cs{sectionbib} from the chapterbib |
| 857 |
% package} |
| 858 |
% \begin{macrocode} |
| 859 |
\@ifpackagewith{chapterbib}{sectionbib}% |
| 860 |
{\renewcommand{\sectionbib}[2]{}}% |
| 861 |
{} |
| 862 |
|
| 863 |
% \end{macrocode} |
| 864 |
% \end{macro} |
| 865 |
% This is the end of |\if@dotocbib|. |
| 866 |
% \begin{macrocode} |
| 867 |
\fi |
| 868 |
|
| 869 |
% \end{macrocode} |
| 870 |
% |
| 871 |
% At the end of the preamble we have to check if the \Lpack{natbib} |
| 872 |
% and/or \Lpack{chapterbib} packages have been loaded after the |
| 873 |
% \Lpack{tocbibind} package. If this is the case, we have to make sure |
| 874 |
% that we have control with respect to their |sectionbib| options. |
| 875 |
% \changes{v1.5e}{2003/01/22}{Added code to cater for natbib and chapterbib |
| 876 |
% packages} |
| 877 |
% \begin{macrocode} |
| 878 |
\AtBeginDocument{% |
| 879 |
\@ifpackagewith{natbib}{sectionbib}{\@dot@cb@bsectiontrue}{} |
| 880 |
% \end{macrocode} |
| 881 |
% If the \Lpack{chapterbib} package was loaded before \Lpack{tocbibind} |
| 882 |
% we have already killed |\sectionbib|. If \Lpack{chapterbib} has been |
| 883 |
% loaded afterwards |
| 884 |
% we must kill |\sectionbib| now before it gets used. |
| 885 |
% \begin{macrocode} |
| 886 |
\@ifpackagewith{chapterbib}{sectionbib}% |
| 887 |
{\@dot@cb@bsectiontrue |
| 888 |
\@ifundefined{sectionbib}{}{\def\sectionbib#1#2{}}}% |
| 889 |
{} |
| 890 |
|
| 891 |
% \end{macrocode} |
| 892 |
% Lastly, use our definition of |\bibsection| for the |thebibliography| |
| 893 |
% environment. |
| 894 |
% \begin{macrocode} |
| 895 |
\if@dotocbib |
| 896 |
\if@dot@cb@bsection |
| 897 |
\renewcommand{\bibsection}{\t@cb@bsection}% |
| 898 |
\else |
| 899 |
\renewcommand{\bibsection}{\t@cb@bchapsec}% |
| 900 |
\fi |
| 901 |
\fi |
| 902 |
% \end{macrocode} |
| 903 |
% This is the end of |\AtBeginDocument| |
| 904 |
% \begin{macrocode} |
| 905 |
} |
| 906 |
|
| 907 |
% \end{macrocode} |
| 908 |
% |
| 909 |
% \begin{environment}{theindex} |
| 910 |
% In an earlier version of this |
| 911 |
% package, for reasons that I didn't |
| 912 |
% understand, I had to add/remove some vertical space around the Index heading |
| 913 |
% to make its height match other chapter/section headings. In an unrelated |
| 914 |
% thread on the \texttt{comp.text.tex} newsgroup, |
| 915 |
% Donald Arseneau pointed out that |
| 916 |
% that this effect was a known feature of the standard classes and |
| 917 |
% recorded as latex bug~3126, and was caused by misplaced topskips. The |
| 918 |
% following removes this feature for all except the \Lpack{doc} class. |
| 919 |
% \changes{v1.4}{2000/03/04}{Fixed index head spacing for all standard classes} |
| 920 |
% |
| 921 |
% The first bit of code is a copy from \file{classes.dtx}. |
| 922 |
% \begin{macrocode} |
| 923 |
\if@inltxdoc\else |
| 924 |
\renewenvironment{theindex}% |
| 925 |
{\if@twocolumn |
| 926 |
\@restonecolfalse |
| 927 |
\else |
| 928 |
\@restonecoltrue |
| 929 |
\fi |
| 930 |
% \end{macrocode} |
| 931 |
% This next bit is where we make the package changes. Note that in the |
| 932 |
% default definition the values for |\columnseprule| and |\columnsep| |
| 933 |
% were set at this point to be |0pt| and |35pt| respectively. They |
| 934 |
% are not set in this definition so that they can be adjusted by the |
| 935 |
% user, if necessary, before starting the environment. |
| 936 |
% \changes{v1.3}{1999/08/22}{Assorted changes for the index} |
| 937 |
% \changes{v1.5}{2001/04/17}{Added \cs{phantomsection} to the theindex environment} |
| 938 |
% \changes{v1.5f}{2003/02/04}{Replaced \cs{MakeUppercase} code from theindex environment} |
| 939 |
% \changes{v1.5j}{2009/12/28}{Removed \cs{phantomsection}} |
| 940 |
% \begin{macrocode} |
| 941 |
\if@bibchapter |
| 942 |
\if@donumindex |
| 943 |
\refstepcounter{chapter} |
| 944 |
\twocolumn[\vspace*{2\topskip}% |
| 945 |
\@makechapterhead{\indexname}]% |
| 946 |
\addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}\indexname} |
| 947 |
\chaptermark{\indexname} |
| 948 |
\else |
| 949 |
\if@dotocind |
| 950 |
\twocolumn[\vspace*{2\topskip}% |
| 951 |
\@makeschapterhead{\indexname}]% |
| 952 |
\prw@mkboth{\indexname} |
| 953 |
\addcontentsline{toc}{chapter}{\indexname} |
| 954 |
\else |
| 955 |
\twocolumn[\vspace*{2\topskip}% |
| 956 |
\@makeschapterhead{\indexname}]% |
| 957 |
\prw@mkboth{\indexname} |
| 958 |
\fi |
| 959 |
\fi |
| 960 |
\else |
| 961 |
\if@donumindex |
| 962 |
\twocolumn[\vspace*{-1.5\topskip}% |
| 963 |
\@nameuse{\@tocextra}{\indexname}]% |
| 964 |
\csname \@tocextra mark\endcsname{\indexname} |
| 965 |
\else |
| 966 |
\if@dotocind |
| 967 |
\twocolumn[\vspace*{-1.5\topskip}% |
| 968 |
\toc@headstar{\@tocextra}{\indexname}]% |
| 969 |
\prw@mkboth{\indexname} |
| 970 |
\addcontentsline{toc}{\@tocextra}{\indexname} |
| 971 |
\else |
| 972 |
\twocolumn[\vspace*{-1.5\topskip}% |
| 973 |
\toc@headstar{\@tocextra}{\indexname}]% |
| 974 |
\prw@mkboth{\indexname} |
| 975 |
\fi |
| 976 |
\fi |
| 977 |
\fi |
| 978 |
% \end{macrocode} |
| 979 |
% Now we are back to the original code. |
| 980 |
% \begin{macrocode} |
| 981 |
\thispagestyle{plain}\parindent\z@ |
| 982 |
\parskip\z@ \@plus .3\p@\relax |
| 983 |
\let\item\@idxitem} |
| 984 |
{\if@restonecol\onecolumn\else\clearpage\fi} |
| 985 |
\fi |
| 986 |
|
| 987 |
% \end{macrocode} |
| 988 |
% \end{environment} |
| 989 |
% |
| 990 |
% \begin{macro}{\toc@start} |
| 991 |
% \begin{macro}{\toc@finish} |
| 992 |
% These two macros deal with the start and finish of the |\tableofcontents| |
| 993 |
% and friends by adjusting the column settings if need be. |
| 994 |
% \begin{macrocode} |
| 995 |
\newcommand{\toc@start}{% |
| 996 |
\if@bibchapter |
| 997 |
\if@twocolumn |
| 998 |
\@restonecoltrue\onecolumn |
| 999 |
\else |
| 1000 |
\@restonecolfalse |
| 1001 |
\fi |
| 1002 |
\fi} |
| 1003 |
|
| 1004 |
\newcommand{\toc@finish}{% |
| 1005 |
\if@bibchapter |
| 1006 |
\if@restonecol\twocolumn\fi |
| 1007 |
\fi} |
| 1008 |
% \end{macrocode} |
| 1009 |
% \end{macro} |
| 1010 |
% \end{macro} |
| 1011 |
% |
| 1012 |
% \begin{macro}{\tocfile} |
| 1013 |
% The code for |\tableofcontents|, |\listoftables| and |\listoffigures| |
| 1014 |
% is virtually identical in each case, except for the heading text. |
| 1015 |
% |\tocfile| embodies the common code. This is virtually a parameterized copy |
| 1016 |
% from \file{classes.dtx}, except that it handles the differences between |
| 1017 |
% the \Lpack{article} class and the other two, and incorporates the |
| 1018 |
% code for additions to the ToC. It is a useful hook if any other |
| 1019 |
% package wants to extend \Lpack{tocbibind} for other kinds of listings. |
| 1020 |
% |
| 1021 |
% The command is |\tocfile{|\meta{head-text}|}{|\meta{file-extension}|}|, |
| 1022 |
% where \meta{head-text} is the heading (e.g., List of Figures) |
| 1023 |
% and \meta{file-extension} is the file extension (e.g., \file{lof}). |
| 1024 |
% \begin{macrocode} |
| 1025 |
\newcommand{\tocfile}[2]{% |
| 1026 |
\toc@start |
| 1027 |
% \end{macrocode} |
| 1028 |
% The next bit is for the heading changes. |
| 1029 |
% \begin{macrocode} |
| 1030 |
\if@bibchapter |
| 1031 |
\toc@chapter{#1} |
| 1032 |
\else |
| 1033 |
\toc@section{\@tocextra}{#1} |
| 1034 |
\fi |
| 1035 |
% \end{macrocode} |
| 1036 |
% And finish up with a parameterized call to start the listing and tidy up. |
| 1037 |
% \begin{macrocode} |
| 1038 |
\@starttoc{#2} |
| 1039 |
\toc@finish} |
| 1040 |
|
| 1041 |
% \end{macrocode} |
| 1042 |
% \end{macro} |
| 1043 |
% |
| 1044 |
% \begin{macro}{\tableofcontents} |
| 1045 |
% If requested, we redefine this command, using |\tocfile| to do |
| 1046 |
% all the work for us. |
| 1047 |
% \begin{macrocode} |
| 1048 |
\if@dotoctoc |
| 1049 |
\renewcommand{\tableofcontents}{% |
| 1050 |
\tocfile{\contentsname}{toc} |
| 1051 |
} |
| 1052 |
\fi |
| 1053 |
|
| 1054 |
% \end{macrocode} |
| 1055 |
% \end{macro} |
| 1056 |
% |
| 1057 |
% \begin{macro}{\listoftables} |
| 1058 |
% This is almost identical to the code for |\tableofcontents| |
| 1059 |
% \begin{macrocode} |
| 1060 |
\if@dotoclot |
| 1061 |
\renewcommand{\listoftables}{% |
| 1062 |
\tocfile{\listtablename}{lot} |
| 1063 |
} |
| 1064 |
\fi |
| 1065 |
|
| 1066 |
% \end{macrocode} |
| 1067 |
% \end{macro} |
| 1068 |
% |
| 1069 |
% \begin{macro}{\listoffigures} |
| 1070 |
% This is almost identical to the code for |\tableofcontents| |
| 1071 |
% \begin{macrocode} |
| 1072 |
\if@dotoclof |
| 1073 |
\renewcommand{\listoffigures}{% |
| 1074 |
\tocfile{\listfigurename}{lof} |
| 1075 |
} |
| 1076 |
\fi |
| 1077 |
|
| 1078 |
% \end{macrocode} |
| 1079 |
% \end{macro} |
| 1080 |
% |
| 1081 |
% \begin{macro}{\simplechapter} |
| 1082 |
% \begin{macro}{\restorechapter} |
| 1083 |
% \begin{macro}{\simplechapterdelim} |
| 1084 |
% The |\simplechapter| command modifies the |\@makechapterhead| command to |
| 1085 |
% result in an appearance akin to |\@makeschapterhead|, and is based on the |
| 1086 |
% latter. The |\restorechapter| command restores everything back to its |
| 1087 |
% original state. The value of |\simplechapterdelim| is appended to the |
| 1088 |
% chapter number before the title text. |
| 1089 |
% \changes{v1.4}{2000/03/04}{Added \cs{simplechapter} and \cs{restorechapter} |
| 1090 |
% commands} |
| 1091 |
% \changes{v1.4a}{2000/03/05}{Added \cs{simplechapterdelim} command} |
| 1092 |
% \changes{v1.5a}{2000/08/07}{Added undefined test to \cs{restorechapter}} |
| 1093 |
% \begin{macrocode} |
| 1094 |
\newcommand{\simplechapter}[1][\@empty]{% |
| 1095 |
\let\@tbiold@makechapterhead\@makechapterhead |
| 1096 |
\renewcommand{\@makechapterhead}[1]{% |
| 1097 |
\vspace*{50\p@}% |
| 1098 |
{\parindent \z@ \raggedright |
| 1099 |
\normalfont |
| 1100 |
\interlinepenalty\@M |
| 1101 |
\Huge\bfseries #1\space\thechapter\simplechapterdelim\space |
| 1102 |
##1\par\nobreak |
| 1103 |
\vskip 40\p@ |
| 1104 |
}} |
| 1105 |
} |
| 1106 |
\newcommand{\restorechapter}{% |
| 1107 |
\@ifundefined{@tbiold@makechapterhead}{}% |
| 1108 |
{\let\@makechapterhead\@tbiold@makechapterhead} |
| 1109 |
} |
| 1110 |
\newcommand{\simplechapterdelim}{} |
| 1111 |
|
| 1112 |
% \end{macrocode} |
| 1113 |
% \end{macro} |
| 1114 |
% \end{macro} |
| 1115 |
% \end{macro} |
| 1116 |
% |
| 1117 |
% \begin{macro}{\tocchapter} |
| 1118 |
% \begin{macro}{\tocsection} |
| 1119 |
% These two commands modify the |\toc@chapter| and |\toc@section| commands |
| 1120 |
% to make numbered Listof headings. |
| 1121 |
% \changes{v1.4}{2000/03/04}{Added \cs{tocchapter} and \cs{tocsection} |
| 1122 |
% commands} |
| 1123 |
% \changes{v1.5d}{2002/04/09}{Provided \cs{@makechapterhead} in \cs{tocchapter}} |
| 1124 |
% \begin{macrocode} |
| 1125 |
\newcommand{\tocchapter}{% |
| 1126 |
\providecommand{\@makechapterhead}{} |
| 1127 |
\simplechapter |
| 1128 |
\renewcommand{\toc@chapter}[1]{\chapter{##1}} |
| 1129 |
} |
| 1130 |
\newcommand{\tocsection}{% |
| 1131 |
\renewcommand{\toc@section}[2]{\@nameuse{##1}{##2}} |
| 1132 |
} |
| 1133 |
|
| 1134 |
% \end{macrocode} |
| 1135 |
% \end{macro} |
| 1136 |
% \end{macro} |
| 1137 |
% |
| 1138 |
% |
| 1139 |
% The end of this package. |
| 1140 |
% \begin{macrocode} |
| 1141 |
%</usc> |
| 1142 |
% \end{macrocode} |
| 1143 |
% |
| 1144 |
% |
| 1145 |
% \bibliographystyle{alpha} |
| 1146 |
% |
| 1147 |
% \begin{thebibliography}{GMS94} |
| 1148 |
% |
| 1149 |
% \bibitem[GMS94]{GOOSSENS94} |
| 1150 |
% Michel Goossens, Frank Mittelbach, and Alexander Samarin. |
| 1151 |
% \newblock {\em The LaTeX Companion}. |
| 1152 |
% \newblock Addison-Wesley Publishing Company, 1994. |
| 1153 |
% |
| 1154 |
% \bibitem[Wil96]{PRW96i} |
| 1155 |
% Peter~R. Wilson. |
| 1156 |
% \newblock {\em {LaTeX for standards: The LaTeX package files user manual}}. |
| 1157 |
% \newblock NIST Report NISTIR, June 1996. |
| 1158 |
% |
| 1159 |
% \end{thebibliography} |
| 1160 |
% |
| 1161 |
% |
| 1162 |
% \Finale |
| 1163 |
% \PrintIndex |
| 1164 |
% |
| 1165 |
\endinput |
| 1166 |
|
| 1167 |
%% \CharacterTable |
| 1168 |
%% {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 |
| 1169 |
%% 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 |
| 1170 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 1171 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 1172 |
%% Dollar \$ Percent \% Ampersand \& |
| 1173 |
%% Acute accent \' Left paren \( Right paren \) |
| 1174 |
%% Asterisk \* Plus \+ Comma \, |
| 1175 |
%% Minus \- Point \. Solidus \/ |
| 1176 |
%% Colon \: Semicolon \; Less than \< |
| 1177 |
%% Equals \= Greater than \> Question mark \? |
| 1178 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 1179 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 1180 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 1181 |
%% Right brace \} Tilde \~} |
| 1182 |
|
| 1183 |
|