« Starting and Ending | Table of Contents | Terminal Input and Output »
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. It 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: If you want any of these items to be generated, you cannot have the \nofiles command in your document.
\addcontentsline
Command:
\addcontentsline{file}{sec_unit}{entry}
The \addcontentsline command adds an entry to the specified list or table where:
file- is the extension of the file on which information is to be written: toc (table of contents), lof (list of figures), or lot (list of tables).
sec_unit- controls the formatting of the entry. It should be one of the following, depending upon the value of the file argument:
toc - the name of the sectional unit, such as part or subsection.
lof - figure
lot - table
entry- is the text of the entry.
\addtocontents
Command:
\addtocontents{file}{text}
The \addtocontents command adds text (or formatting commands) directly to the file that generates the table of contents or list of figures or tables.
file- is the extension of the file on which information is to be written: toc (table of contents), lof (list of figures), or lot (list of tables).
text- is the information to be written.
« Starting and Ending | Table of Contents | Terminal Input and Output »