4

I want to remove the gap between the figures of different chapters in my table of figures. I have a screenshot here:

enter image description here

Is there some kind of command to disable the gap? I'm not sure what kind of MWE I can give, as its the table of figures in a large document.

And
  • 269

2 Answers2

3

Here is a solution for book.cls

The gap is introduced by the \chapter command (actually \@chapter`), using

\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%

each time a new chapter is set up, i.e. vertical space (the gap!) is set to the relevant .lof or .lot file.

This can be patched out with \xpatchcmd{}, replacing the commands in \@chapter with 'nothing'.

\documentclass{book}


\usepackage{xpatch}

\makeatletter
\xpatchcmd{\@chapter}{%
  \addtocontents{lof}{\protect\addvspace{10\p@}}%
  \addtocontents{lot}{\protect\addvspace{10\p@}}%
}{}{}{}
\makeatother


\begin{document}

\listoffigures

\chapter{First}
\begin{figure}
\caption{Dummy figure}
\end{figure}

\begin{figure}
\caption{Dummy figure}
\end{figure}

\chapter{Second}
\begin{figure}
\caption{Dummy figure}
\end{figure}


\end{document}

enter image description here

2

If you are using a KOMA-Script class (scrbook or srcreprt) you can use the option listof=nochaptergap to disable the gap:

\documentclass[listof=nochaptergap]{scrbook}
\usepackage[ngerman]{babel}
\begin{document}

\listoffigures
\chapter{First}
\captionof{figure}{Eine Abbildung}
\captionof{figure}{Eine zweite Abbildung}

\chapter{Second}
\captionof{figure}{Eine Abbildung im zweiten Kapitel}
\end{document}

enter image description here

esdd
  • 85,675