1

I would like to use the tocloft package for customizing the table of contents in my "book" document. However, when I include this package, the table of contents shifts upward by the line width of a single TOC entry. What could be the issue?

The minimal example in this case is surprisingly minimal:

\documentclass{book}
\usepackage{tocloft}

\begin{document}
\tableofcontents
\chapter{First chapter}
\section{A section}
\end{document}

A tip for those who don't immediately see a visual difference: It helps to print out page 1 before and after commenting out \usepackage{tocloft} and then place the sheets of paper on top of each other and hold them up to the light. (I'm serious.)

  • 1
    The table of contents title is implemented (in book class) using \chapter*{\contentsname}. Not sure what tocloft does. – John Kormylo Mar 13 at 4:59
3

When you load the tocloft without options, it constructs the header of the \tableofcontents in a manual fashion that is similar to that of the default document classes. This is done so that tocloft will cover the setting of ToCs to a broader audience than just the basic classes - it's easier to construct your own way of setting the header/title rather than rely on whatever custom class someone might be using.

If you want to use the default document class' \tableofcontents, then you can load tocloft with the titles option. This leaves the original definition of \tableofcontents' header/title in place yet still allows for updating of the formatting.


Under the hood, the main difference stems from book using \chapter* to set \tableofcontents, while tocloft's default behaviour is to mimic if via similar \vspaces and font selection, but not actually set a \chapter*.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.