Bibliography, index, etc., in TOC

The standard LaTeX classes (and many others) use \section* or \chapter* for auto-generated parts of the document (the tables of contents, lists of figures and tables, the bibliography and the index). As a result, these items aren't numbered (which most people don't mind), and (more importantly) they don't appear in the table of contents.

The correct solution (as always) is to have a class of your own that formats your document according to your requirements. The macro to do the job (\addcontentsline) is fairly simple, but there is always an issue of ensuring that the contents entry quotes the correct page. Supposing that our the document is chapter-based (class report or book, for example), the text:

\bibliography{frooble}
\addcontentsline{toc}{chapter}{Bibliography}
will produce the wrong answer if the bibliography is more than one page long. Instead, one should say:
\cleardoublepage
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{frooble}
(Note that \cleardoublepage does the right thing, even if your document is single-sided - in that case, it's a synonym for \clearpage). Ensuring that the entry refers to the right place is trickier still in a \section-based class.

The common solution, therefore, is to use the tocbibind package, which provides many facilities to control the way these entries appear in the table of contents.

Classes of the KOMA-script bundle provide this functionality as a set of class options; the memoir class includes tocbibind itself.

KOMA script bundle
macros/latex/contrib/koma-script (zip, browse)
memoir.cls
macros/latex/contrib/memoir (zip, browse)
tocbibind.sty
macros/latex/contrib/tocbibind (zip, browse)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=tocbibind