I put together this list of 10 ways to customize the Table of Contents, List of Figures and List of Tables. Some of them are pretty common, some may be new to you. Hope you enjoy the list…
Some pieces of code below require the tocloft package which provides extensive customization functionality for table of contents, list of figures and list of tables. It will be indicated wherever the tocloft or any other package needs to be loaded in the preamble.
Note: I will use the abbreviations toc for table-of-contents, lof for list-of-figures and lot for list-of-tables in the article below.
1. Change the lists headings
Change the heading can be done without loading any specific package. Obviously, the name has to be changed before creating the list.
\renewcommand\contentsname{} \tableofcontents \renewcommand\listfigurename{} \listoffigures \renewcommand\listtablename{} \listoftables
2. Add “Page” above page numbers
Several people asked me how to place the word “Page” on top of the page numbers in toc/lof/lot. Here is how you do it:
\tableofcontents \addtocontents{toc}{~\hfill\textbf{Page}\par} \chapter{...}
It works the same way with lof and lot. The code was taken from here.
3. Change depth of entries
You can change the depth, i.e. how many levels shall be printed using the respective counter:
\setcounter{tocdepth}{1} \tableofcontents
0: chapter (not available for \documentclass{article
),
1: section,
2: subsection, etc.
The default depth is 3, subsubsection.
Similarly, including subfigures and subtables can be achieved using:
\setcounter{lofdepth}{2} \setcounter{lotdepth}{2}
4. Roman page numbers for toc/lof/lot
To get a different page number style for toc/lof/lot, use:
\pagenumbering{}
and change it back to arabic
before the first chapter starts.
Available styles are arabic
, roman
, Roman
, alph
and Alph
.
Complete code example:
... \pagenumbering{roman} \tableofcontents \listoffigures \listoftables \clearpage \pagenumbering{arabic} \chapter{...} ...
5. Hyperlinks to content
Loading the hyperref
package will let you navigate from toc/lof/lot entries directly to the respective content:
\usepackage{hyperref}
If you only want the page number to be clickable, you’ll need to load the package with the following option:
\usepackage[linktocpage=true]{hyperref}
6. Adding the lists to toc
Adding entries to toc/lof/lot can be done manually with a single command. Usually, to be sure the page number is correct, it’s advisable to add entries directly before or after the actual content to list. And here is how:
\addcontentsline{}{}{}
The file line(s) shall be added (toc
, lof
or lot
), the type of the entry (chapter
, figure
, etc.) and the entry text itself.
To add the three lists to the toc use:
\tableofcontents \addcontentsline{toc}{chapter}{Contents} \listoffigures \addcontentsline{toc}{chapter}{List of Figures} \listoftables \addcontentsline{toc}{chapter}{List of Tables}
7. Changing the font of entries
To change the way the actual entries look, you can make use of a command provided by the tocloft
package. The command will affect the number as well as the text. However, it will not change the page number and the separator (if there are any). The nice thing here is that since it’s placed just in front of the sequence number, you can also use it to add words such as “Chapter 1: Biology … Here are a few examples for illustration:
\usepackage{tocloft} \renewcommand{\cftchapfont}{\scshape} \renewcommand{\cftsecfont}{\bfseries} \renewcommand{\cftfigfont}{Figure } \renewcommand{\cfttabfont}{Table }
Try it and make sure you don’t forget the space behind Figure_
and Table_
, otherwise it will be glued to the number.
8. Creating you own list of …
Again, the tocloft
package has to be loaded. First, define a new list environment as well as the item which are later being listed. In this case, we are defining lemmas, but it could also be proofs, equations, a special list of figures, footnotes, anything. The last line of the lemma command defines how lemmas should be numbered, here “chapter.lemma”.
\usepackage{tocloft} ... \newcommand{\listlemmaname}{List of Lemmas} \newlistof{lemma}{lem}{\listlemmaname} \newcommand{\lemma}[1]{% \refstepcounter{lemma} \par\noindent\textbf{Lemma \thelemma. #1} \addcontentsline{lem}{lemma} {\protect\numberline{\thechapter.\thelemma}#1}\par } ... \listoflemma ... \lemma{My first lemma} \label{lem:lemma1}
You can find a complete code example here.
9. Alternative text in toc/lof/lot for headings and captions
In case your caption is too long for the lof/lot, you can give it an alternative text. Similarly, the headings can be given an alternative name in the toc:
\caption[]{} \chapter[]{}
10. Chapter specific tocs with minitoc
Finally, minitoc
produces beautiful tocs at the beginning of every chapter (or any other heading) and therefore, I will dedicate this 10th and last entry to that package:
\usepackage{minitoc} ... \dominitoc \tableofcontents ... \chapter{...} \minitoc
Here is an earlier post I wrote about the package as well as the complete documentation.
Wow, that’s the longest post I ever wrote. Hope you’ve enjoyed my list, have fun customizing :-).