A table of contents is produced with the \tableofcontents command. You put the command right where you want the table of contents to go; LaTeX does the rest for you. Entries are taken from the Sectioning commands.
\tableofcontents produces a heading, but it does not automatically start a new page. If you want a new page after the table of contents, include a \newpage command after the \tableofcontents command.
There are similar commands \listoffigures and \listoftables for producing a list of figures and a list of tables, respectively. Everything works exactly the same as for the table of contents.
NOTE: Information for these tables and lists are placed in an auxiliary file and you may have to run latex twice to get it to come out correctly. If you want any of these items to be generated, you can not have the \nofiles command in your document as that would suppress writing of the auxiliary files. See also
Return to LaTeX Table of Contents