Press "Enter" to skip to content

Removing unwanted space in LoF and LoT between chapters’ extries

In LaTeX, when using book or report class, there may be extra space in LoF (List of Figures) and LoT (List of Tables) that doesn’t go away no matter how hard you try. The extra space is probably caused by the use of \chapter. For example, consider the following dummy code:

\usepackage{graphicx, titlesec, setspace, hyperref}

\titleformat{\chapter}[hang]{\filcenter}{Chapter\ \thechapter}{0.5in}{}[]

\chapter{Chapter 1}\addfig\addfig
\chapter{Chapter 2}\addfig\addfig

The generated PDF (using pdflatex) contains the following list of figures:

See the extra space between List of Figures and the entry 1.1 and also between the extry of 1.2 and 2.1?

Before you found this page, you probably already found some solutions that patch the command \@chapter. For example, the best answer to this StackExchange question:

The explanations from those solutions are basically correct: the extra space is caused by that \chapter calls an internal command \@chapter, which adds the extra space to LoF through \addtocontents{lof}{\protect\addvspace{10\p@}}. Assuming your TeX file is called main.tex, then in the generated LoF file, main.lof, you can see \addvspace{10\p@} above the first entry of each chapter.

However, the solution to patch \@chapter does not work in many situations, for example, in the dummy TeX code we had above. Why?

In our dummy code, the solution patching \@chapter doesn’t work because \@chapter is overwritten by the package hyperref. So the internal command that puts \addvspace{10\p@} in LoF is not \@chapter anymore. After loading hyperref, the command responsible for adding the extra space is now \Hy@org@chapter. That’s the one we should patch. We can patch the command by adding the following code to the preamble:


Now, the generated LoF should look like


The hyperref package is the commonly seen cause that renders the patching of \@chapter failed. Sometimes even if you don’t use hyperref explicitly, some of your loaded packages actually load hyperref silently. And that’s why patching \@chapter doesn’t work even when you’re not using hyperref. In such a case, instead, patch the command \Hy@org@chapter.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.