Document Structure

Table of Contents, Lists and Nomenclature in LaTeX

Create a table of contents, lists of figures and tables, and a nomenclature list in LaTeX, control which headings appear, and fix an empty list.

On this page
  1. Create a table of contents
  2. Choose which headings appear
  3. Rename the headings
  4. Lists of figures and tables
  5. Add a nomenclature list
  6. Fix an empty table of contents

LaTeX builds a table of contents, lists of figures and tables, and a list of symbols (nomenclature) from commands in your document. This guide shows the basic commands, how to choose which headings appear, and how to fix a list that comes out empty.

Create a table of contents

Place \tableofcontents where the list should appear. A common spot is right after \maketitle or after \begin{document}:

\documentclass{article}

\begin{document}

\tableofcontents
\newpage

\section{Introduction}
Some text.

\section{Results}
Some text.

\end{document}

LaTeX writes heading information to an auxiliary file on each run. The table of contents is therefore complete only after the second compile. If it looks out of date, compile again.

Choose which headings appear

Two counters control how headings are handled:

  • tocdepth sets the deepest heading level that appears in the table of contents.
  • secnumdepth sets the deepest heading level that gets a number. For more on numbering, see how to have numbered sections in LaTeX.

The levels are numbered from the top down. In article, level 1 is a section and level 2 is a subsection. In book and report, level 0 is a chapter and level 1 is a section. To list sections and subsections, put this in the preamble:

\setcounter{tocdepth}{2}

A starred heading, such as \section*{Acknowledgements}, is not numbered and does not appear in the table of contents. To list it anyway, add the entry by hand:

\section*{Acknowledgements}
\addcontentsline{toc}{section}{Acknowledgements}

In a book or report, use chapter in place of section in the second line.

Rename the headings

The titles of the lists are stored in commands you can redefine. Put these lines in the preamble:

\renewcommand{\contentsname}{Contents}
\renewcommand{\listfigurename}{List of Figures}
\renewcommand{\listtablename}{List of Tables}

Lists of figures and tables

Add these commands where each list should appear:

\listoffigures
\listoftables

Each figure or table needs a \caption to appear in its list. To change the word in table captions, see how to change the table caption name in LaTeX. The list uses the caption text, and it updates on the next compile.

Add a nomenclature list

A nomenclature list explains the symbols used in a document. The nomencl package provides it. The setup has four steps:

  1. Load the package and call \makenomenclature in the preamble.
  2. Add an entry for each symbol with \nomenclature{symbol}{description}.
  3. Place \printnomenclature where the list should appear.
  4. Compile, run makeindex with the nomencl style, and compile again.

Here is a small example:

\documentclass{article}
\usepackage{nomencl}
\makenomenclature
\renewcommand{\nomname}{List of Symbols}

\begin{document}

\nomenclature{$v$}{Velocity}
\nomenclature{$m$}{Mass}

\printnomenclature

Kinetic energy is $E = \frac{1}{2} m v^2$.

\end{document}

The makeindex step reads the .nlo file that LaTeX writes and creates the .nls file that \printnomenclature reads. Replace yourfile with your document’s name:

makeindex yourfile.nlo -s nomencl.ist -o yourfile.nls

Some editors and build tools run this step automatically. If yours does not, run it yourself and then compile again.

Fix an empty table of contents

If the table of contents or a list is empty, check these in order:

  • Compile twice. Lists and references update on the run after the change.
  • Check the headings. A starred heading is left out unless you add it with \addcontentsline.
  • Check the class and packages. A forum example showed a style file that contained \def\addcontentsline#1#2#3{}. That definition discards every entry, so the table of contents and lists stayed empty. Remove or fix the redefinition.

For spacing, dot leaders, or fonts in the table of contents, the tocloft package is a common choice.

Page numbers at the front of a document often use Roman numerals. See page numbering in LaTeX for how to set that up before the table of contents.

The complete guide to document structure

Chapters in LaTeX: Document Classes and Chapter Styles
Read the guide

Keep exploring

Guides from other topics

All topics →