diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /usergrps/uktug/baskervi/4_4/bailey.tex |
Initial commit
Diffstat (limited to 'usergrps/uktug/baskervi/4_4/bailey.tex')
-rw-r--r-- | usergrps/uktug/baskervi/4_4/bailey.tex | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/usergrps/uktug/baskervi/4_4/bailey.tex b/usergrps/uktug/baskervi/4_4/bailey.tex new file mode 100644 index 0000000000..f7001cdd20 --- /dev/null +++ b/usergrps/uktug/baskervi/4_4/bailey.tex @@ -0,0 +1,52 @@ +\title{Topical Tip: making the TOC tick} +\author[R.~A. Bailey]{R.~A. Bailey\\Goldsmiths' + College, University of London} +\begin{Article} +\renewcommand{\thepreanswer}{} + +\begin{question} +I have a problem that I have not been able to solve by reading \lamport. +How can I force a table of contents to have entries for +`preface', `bibliography' and `index' (for example, like the table of contents +of \shortlamp\ itself has)? For example, if I use the +\verb+\chapter*{preface}+ +sectioning command, no entry for the table of contents +is generated; if I use +explicit commands such as +\verb+\addcontentsline{toc}{chapter}{Preface}+, it +works for the preface but it generates incorrect page numbers for the +index and bibliography (maybe I put the commands in the wrong place, +but it is not obvious to me where exactly I should put them). +\label{fabrizzio} +\end{question} + +\begin{answer} +The best way to get headings of funny `sections' like +prefaces in the the table of contents is to use the +counter \latexword{secnumdepth} described on pages~157 and~160 of +\shortlamp. I use +\begin{verbatim} + \setcounter{secnumdepth}{-1} + \chapter{preface} +\end{verbatim} +Of course, you have to set \latexword{secnumdepth} back to its usual value +(which is~2 in the standard styles, I think) before you do +any `section' which you want to be numbered. + +This is why it works. +\verb+\chapter+ + without the star does +\begin{enumerate} +\item put something in the \latexword{.toc} file; +\item write the chapter title; +\item if $\mbox{\latexword{secnumdepth}} \geq 0$ + then increase the counter for the + chapter and write it out. +\end{enumerate} + +The above behaviour is much more predictable than +\verb+\addtocontents+, +which, in my opinion, should be avoided if at all possible. +\end{answer} +\end{Article} + |