\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}