LaTeX table of contents, list of figures and list of tables
To make a LaTeX table of contents, put \tableofcontents where the contents should appear and compile twice. LaTeX builds it from your \chapter, \section and \subsection headings, with page numbers. \listoffigures and \listoftables work the same way, from the captions of your figures and tables. You never type the entries yourself.
- Write your headings with
\chapter{…},\section{…}and\subsection{…}. Every numbered heading goes into the contents by itself. - After the abstract, add
\tableofcontents, then\listoffiguresand\listoftablesif you have captioned figures and tables. - Compile twice (Overleaf and
latexmkdo this for you). The first run writes the entries to a.tocfile; the second prints them. - To list fewer or more levels, put
\setcounter{tocdepth}{1}(chapters and sections) or{3}in the preamble.
01Insert the table of contents
The command \tableofcontents prints the contents page wherever you place it. In the report and book classes it starts a new page headed "Contents"; in article it prints a "Contents" heading in place. Most theses put it after the abstract, followed by \listoffigures and \listoftables, and the entries appear on the second compile.
A thesis is usually written in the report or book class, because both have \chapter. The skeleton below is the front of my fictional thesis, Brand trust and customer loyalty in subscription services. It gives roman page numbers to the front matter, then starts Chapter 1 on page 1.
\documentclass[12pt,a4paper]{report}
\usepackage[british]{babel}
\usepackage[nottoc]{tocbibind}
\usepackage[hidelinks]{hyperref} % last
\begin{document}
\pagenumbering{roman}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
...
\tableofcontents
\listoffigures
\listoftables
\clearpage
\pagenumbering{arabic}
\chapter{Introduction}
\section{Background and motivation}
\chapter{Literature review}
\section{Brand trust}
\subsection{Defining trust}
...
\end{document}
tocbibind puts the lists and the references in the contents (section 03), and hyperref makes the entries clickable (section 06). Neither is needed for a basic contents page.
- Put
\tableofcontentswhere the contents page belongs. Inreportandbookit starts on a new page with the heading "Contents". - Add
\listoffiguresand\listoftablesafter it, if your guide asks for them. - Compile. On Overleaf, click Recompile. On your own computer, run
latexmk -pdf main.tex, or runpdflatex main.textwice. - Check the contents page in the PDF. If it shows only the heading, compile once more.
\tableofcontents reads that file and typesets it. In the standard report class, chapter entries are bold with no dots; sections and subsections get dot leaders.That two-step process explains most contents problems. LaTeX stores the entries in an auxiliary file, a helper file it writes next to your PDF, named after your main file (main.toc, and main.lof and main.lot for the lists) and reads them back on the following run. So the very first compile of a new document gives a contents page with nothing but its heading, and any change to a heading shows up one run late. Overleaf compiles with latexmk, which runs the whole sequence for you, so you rarely notice.
02Choose how many levels appear: tocdepth
Each sectioning command has a level number. The counter tocdepth sets the deepest level the contents lists, and a separate counter, secnumdepth, sets the deepest level that gets a number.
\partis level −1 inreportandbook(0 inarticle)\chapteris level 0\sectionis level 1\subsectionis level 2\subsubsectionis level 3,\paragraph4,\subparagraph5
In report and book both counters default to 2, so chapters, sections and subsections are numbered and listed. In article both default to 3. To change them, put these lines in the preamble, the part of main.tex between \documentclass and \begin{document}:
\setcounter{tocdepth}{1}lists chapters and sections only, a common requirement in thesis guides.\setcounter{tocdepth}{3}also lists subsubsections. Add\setcounter{secnumdepth}{3}as well, or they appear in the contents without their number (such as 2.1.1.1).
The two counters are independent. Raising tocdepth alone gives you unnumbered lines in the contents, and raising secnumdepth alone gives you numbered headings that the contents ignores.
A long heading can have a shorter version for the contents. Write \section[Customer loyalty]{Customer loyalty in subscription services: attitudinal and behavioural views}. The text in square brackets goes into the contents and the running head; the full title stays in the text.
The heading levels themselves, and how deep a thesis should go, are covered in my guide to writing a thesis in LaTeX.
03Abstract, references and other unnumbered entries
The starred commands, such as \chapter*{Abstract}, print a heading without a number and leave it out of the contents. Thesis guides usually want the abstract, acknowledgements, lists and references in the contents anyway, so each one needs a line added.
Add an unnumbered chapter
- Write the heading with the star:
\chapter*{Acknowledgements}. - On the next line, add
\addcontentsline{toc}{chapter}{Acknowledgements}. The three arguments are the file (toc), the level the entry should look like (chapter), and the text. - Compile twice. LaTeX takes the page number from the point where
\addcontentslinestands, so keep it right after the heading.
For a section-level entry, use \section* and \addcontentsline{toc}{section}{…}. If the entry should line up with the chapter titles rather than flush left, add an empty number box: \addcontentsline{toc}{chapter}{\protect\numberline{}Preface}.
Roman numbers for the front matter
The contents copies each page's number as it is, so the numbering has to be right first. In report, put \pagenumbering{roman} at the start of the document and \clearpage followed by \pagenumbering{arabic} just before Chapter 1, as in the skeleton above. \pagenumbering restarts the count at once, so the \clearpage keeps the last front page from becoming page 1. In book, \frontmatter and \mainmatter do both jobs. My guide to LaTeX page numbering covers the title page and the cases that go wrong.
List the lists, the bibliography and the index
The standard classes print the lists of figures and tables and the bibliography with starred headings, so they aren't in the contents either. Which fix you use depends on your class and bibliography package:
- Standard classes (
report,book,article): load\usepackage[nottoc]{tocbibind}. It adds the list of figures, list of tables, bibliography and index to the contents. Withoutnottocit also adds the contents page to itself, which a contents page normally does not show.notlof,notlot,notbibandnotindexleave out the others. - biblatex: print the references with
\printbibliography[heading=bibintoc]. - KOMA-Script (
scrreprt,scrbook): use the class optionstoc=listofandtoc=bibliography. - memoir:
\tableofcontents,\listoffiguresand\listoftablesalready add themselves. The starred forms (\tableofcontents*) leave them out.
Abstract, declaration, glossary and six appendices to list in the right order?I can set up the front matter for you
04List of figures and list of tables
\listoffigures and \listoftables work like the contents, but they read the captions. Each \caption inside a figure or table environment writes one entry to main.lof or main.lot. A figure without \caption, or with a title typed as ordinary text, isn't listed.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{research-model}
\caption[Research model]{Research model linking brand
trust, satisfaction and perceived value to loyalty
and word of mouth}
\label{fig:model}
\end{figure}
The text in square brackets is the short caption. It is what the list of figures shows; the full caption stays under the figure. Use it whenever a caption runs to more than a line, or has a source note or citation in it.
Lists of tables work the same way with \caption inside table. To change the headings, write \renewcommand{\listfigurename}{List of Illustrations} or \renewcommand{\listtablename}{…} (with babel, see renaming the headings). How the captions themselves should look, above or below, numbered by chapter or straight through, is in my guide to captions in LaTeX, and placing the figures is in figures in LaTeX.
05Dots, fonts and spacing with tocloft
The standard classes set the look of the contents and offer no options to change it. A dot leader is the row of dots that runs from an entry's title to its page number. If your guide wants dots after the chapter titles, a different font or more space between entries, load the tocloft package. Each kind of entry gets its own commands, with a short name in the middle: chap, sec, subsec, fig and tab.
\usepackage{tocloft}
% dot leaders after chapter titles too
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
% chapter entries not bold (title and page number)
\renewcommand{\cftchapfont}{\normalfont}
\renewcommand{\cftchappagefont}{\normalfont}
% more room before each chapter entry
\setlength{\cftbeforechapskip}{8pt}
% wider number box for sections such as 10.12
\setlength{\cftsecnumwidth}{3em}
\setlength{\cftsubsecindent}{4.5em}
Two things catch people out with tocloft:
- With tocloft, the contents and lists no longer start on a new page by themselves. Put
\clearpagebefore\tableofcontents,\listoffiguresand\listoftables. - tocloft's manual says it is not compatible with the KOMA-Script classes (KOMA-Script itself warns against loading it), and the memoir class has the same commands built in. In KOMA-Script, use its own
\DeclareTOCStyleEntry; in memoir, use the commands without loading the package.
If you change the number width of one level, move the next level's indent by the same amount (above: 1.5em indent + 3em number box = 4.5em), or the subsections stop lining up under the section titles.
Rename the LaTeX contents heading
The heading comes from \contentsname ("Contents"), \listfigurename and \listtablename. To call it "Table of Contents", write \renewcommand{\contentsname}{Table of Contents} in the preamble. If you load babel, that line is overwritten when the document starts, and you still get "Contents". Wrap it in the hook for your babel language instead:
\addto\captionsbritish{\renewcommand{\contentsname}{Table of Contents}}
Use \captionsenglish, \captionsamerican or \captionsportuguese to match the language you gave babel.
Your guide wants the LaTeX contents to match its Word template line for line?I can match it for you
06Clickable entries with hyperref
Load hyperref and every entry in the contents and lists becomes a link to its page in the PDF, and the headings become PDF bookmarks. Load it after your other packages, as the last one in most preambles.
\usepackage[hidelinks]{hyperref}keeps the links but removes the coloured boxes around them, so the PDF looks the same on screen and on paper.\usepackage[linktocpage]{hyperref}makes the page number the link instead of the title.- If a link from an
\addcontentslineentry lands on the wrong page, put\phantomsectionjust before\addcontentsline. It sets a link target at that point. This matters most for entries that have no heading command of their own, such as an index printed with\printindex.
Maths or formatting in a heading gives the warning "Token not allowed in a PDF string", because a bookmark can only hold plain text. Give hyperref a plain version: \chapter{Effect of \texorpdfstring{$\beta$}{beta} on loyalty}. The contents shows β; the bookmark shows "beta".
07Table of contents empty or wrong? Fixes
These are the problems I see most in theses that arrive in LaTeX. After each fix, compile twice before you judge the result.
The contents page is empty
Compile again. If it stays empty, look at the log for an error that stops the run: LaTeX only finishes writing main.toc when it reaches the end of the document. In Overleaf, open the logs, fix the first error, and recompile.
Old or duplicated entries that won't go away
The auxiliary files can keep stale entries after an error or a renamed file. On Overleaf, choose Recompile › Recompile from scratch (the arrow next to the Recompile button), or click Logs and output files and then Clear cached files. On your own computer, delete main.aux, main.toc, main.lof and main.lot, and compile twice.
Subsubsections or sections are missing
Their level is deeper than tocdepth. In report and book, subsubsections are level 3 and the default depth is 2. Set \setcounter{tocdepth}{3} (and secnumdepth to 3 if they should be numbered), as in section 02.
The abstract or acknowledgements are missing
They use \chapter*, which never writes an entry. Add \addcontentsline{toc}{chapter}{Abstract} right after the heading (section 03).
An entry has the wrong page number
If it is an \addcontentsline entry, the line probably sits before a page break: before \chapter* rather than after it, or before a \clearpage. Move it to just after the heading. If the front matter shows 1, 2, 3 instead of i, ii, iii, fix the page numbering, not the contents.
Entries come out in the wrong order
An \addcontentsline or \addtocontents written in main.tex just before \include{chapter3} can land in the wrong place in the contents. Move the line into the included file.
Numbers run into the titles
"12.12Brand trust" means the number is wider than its box. Widen it with tocloft: \setlength{\cftsecnumwidth}{3em}, or \cftsubsecnumwidth for subsections, and move the next level's indent to match (section 05).
The heading says "Contents" after you renamed it
babel is resetting it. Put the \renewcommand inside \addto\captionsbritish{…} for your language, as shown under renaming the heading.
The references aren't in the contents
Use tocbibind with the standard classes and BibTeX or natbib, heading=bibintoc with biblatex, or toc=bibliography in KOMA-Script. My guide to the LaTeX bibliography explains which package you are using.
Fighting LaTeX the week before submission?Send it to me and I'll fix it
08What your university decides
LaTeX gives you a working contents page with no settings at all, but no university asks for exactly the default. Their guides differ on all of these, so check yours before you submit:
- Which front pages are listed (abstract, acknowledgements, lists, abbreviations) and whether the contents lists itself.
- How many levels to show: two (chapters and sections) or three.
- Whether chapter entries are bold, in capitals, or have dot leaders.
- Roman numbers for the front matter, and page 1 on the first page of Chapter 1.
- How appendices are listed: each one by letter, or a single "Appendices" line.
What a dissertation contents page usually contains, with a sample page, is in my guide to the dissertation table of contents. Margins and binding offset, which change where every line of the contents sits, are in my guide to LaTeX margins.
If your university supplies a LaTeX class, it usually sets most of this already: change it only where the written guide disagrees. The full list of checks before submission is in my thesis formatting checklist. Writing in Word instead? The same job there is in how to make a table of contents in Word.
09Questions people ask
How do I add a table of contents in Overleaf?
Type \tableofcontents where it should go and click Recompile. Overleaf compiles with latexmk, which reruns LaTeX until the cross-references settle (latexmk's manual says it runs LaTeX "enough times to resolve cross-references"), so the entries normally appear after one click. If they don't, use Recompile › Recompile from scratch.
Why is my LaTeX table of contents empty?
LaTeX reads the entries from the .toc file written on the previous run. After the first compile the file doesn't exist yet, so compile again. If it stays empty, an error is stopping the run before the end of the document.
How do I show only chapters and sections?
Put \setcounter{tocdepth}{1} in the preamble. Level 1 is \section, so subsections and anything deeper are left out.
How do I stop the contents from listing itself?
With tocbibind, load it as \usepackage[nottoc]{tocbibind}. In memoir, use \tableofcontents*. The standard classes on their own never list the contents page.
How do I put "Page" above the page numbers?
Right after \tableofcontents, add \addtocontents{toc}{~\hfill\textbf{Page}\par}. It writes a line with "Page" at the right margin into the contents.
How are appendices listed?
After \appendix, each \chapter is lettered (A, B, C) and listed like a chapter. For a single "Appendices" line instead, add \addcontentsline{toc}{chapter}{Appendices} and use starred headings for the appendices themselves.
Can I make a table of contents in an article?
Yes. \tableofcontents works in article too, listing sections, subsections and subsubsections. It doesn't start a new page, so add \newpage after it if you want one.
I compiled every example on this page with TeX Live 2025 (pdfTeX 1.40.27, latexmk) on Windows 11 in October 2026, and checked the commands against the LaTeX2e unofficial reference manual, Overleaf's documentation and the manuals of tocloft, tocbibind, hyperref, biblatex, KOMA-Script, memoir and latexmk. The KOMA-Script toc= options, biblatex's heading=bibintoc and memoir's starred commands come from their manuals and were not compiled. All pages are listed under Sources.
Sources
- Table of contents, list of figures, list of tables LaTeX2e unofficial reference manual
- Sectioning (tocdepth and secnumdepth) LaTeX2e unofficial reference manual
- \addcontentsline LaTeX2e unofficial reference manual
- \addtocontents LaTeX2e unofficial reference manual
- figure (short captions) LaTeX2e unofficial reference manual
- Table of contents Overleaf
- Lists of tables and figures Overleaf
- Sections and chapters Overleaf
- Page numbering Overleaf
- Hyperlinks Overleaf
- Clearing the project cache Overleaf docs
- The latexmkrc file Overleaf docs
- The tocloft package (manual, v3.0c) CTAN
- The tocbibind package (manual) CTAN
- The hyperref package (manual) CTAN
- The biblatex package (manual: heading=bibintoc) CTAN
- KOMA-Script (scrguide: toc= options) CTAN
- The memoir class (memman: \tableofcontents*) CTAN
- latexmk CTAN
- latexmk (manual) CTAN