### 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, 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:

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

Of course, the KOMA-Script bundle of classes (scrbook instead of book, scrreprt instead of report, etc.) provide this functionality as a set of class options.

`KOMA-Script bundle`
  macros/latex/contrib/supported/koma-script.tar.gz
`tocbibind.sty`
  macros/latex/contrib/supported/tocbibind.tar.gz