The easiest way to get headings of funny 'sections' such as
prefaces in the table of contents is to use the
counter secnumdepth
described in Appendix C of the LaTeX
manual. For example:
\setcounter{secnumdepth}{-1} \chapter{Preface}Of course, you have to set
secnumdepth
back to its usual value
(which is 2 in the standard styles) before you do
any 'section' which you want to be numbered.
Similar settings are made automatically in the LaTeX book class by
the \frontmatter
and \backmatter
commands.
This is why it works:
\chapter
without the star does
.toc
file;
secnumdepth
counter is greater than or equal to zero,
increase the counter for the chapter and write it out.
The value of the counter tocdepth
controls which headings will be
finally printed in the table of contents. This normally has to be set
in the preamble and is a constant for the document. The package
tocvsec2 package provides a convenient
interface to allow you to change the secnumdepth
and/or the
tocdepth
counter values at any point in the body of the document;
this provides convenient independent controls over the sectional
numbering and the table of contents.
The package abstract (see
one-column abstracts)
includes an option to add the abstract
to the table of contents,
while the package tocbibind
has options to include the table of contents itself, the
bibliography
, index
, etc., to the table of contents.