24

I am using the book documentclass and have a list of figures. After much trouble I noticed that there is a blank line to separate figures that are in different chapters, but not if they are within the same chapter. Since I changed the numbering of my figures to be {1, 2, 3, etc.} instead of {2.1, 2.2, 3.1, etc.} this looks silly and I'd rather have a blank line between each figure, no matter what.

How do I do that?

Similar:

damusnet
  • 1,317
  • 2
  • 12
  • 11

4 Answers4

41

In the book class there's an internal macro \@chapter that's adding the space by this line:

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

You could redefine this macro. Alternatively, you could disable \addvspace in the list of figures, for instance by

\newcommand*{\noaddvspace}{\renewcommand*{\addvspace}[1]{}}
\addtocontents{lof}{\protect\noaddvspace}

The effect should end with the list of figures, but of course you could group it to limit the scope.

If you disabled it you could use an environment or a declaration of the setspace package, to get more space between the lines of the list of figures. Or you just use \linespread locally:

\addtocontents{lof}{\linespread{2}\selectfont}
hpesoj626
  • 17,282
Stefan Kottwitz
  • 231,401
  • The redefinition of the macro does disable \addvspace ; however, I'd rather have the space between each figure. Do you think it's possible? – damusnet Aug 02 '10 at 19:31
  • 1
    Hi Damien, I've added linespread. That would increase the line spacing equally. Otherwise one could redefine \caption or \caption to add the desired space. – Stefan Kottwitz Aug 03 '10 at 12:06
  • 2
    THis is the only answer that worked for me in 2020. For variable spacing, I modified the noaddvspace to \newcommand*{\lofvspace}[1]{\renewcommand*{\addvspace}[1]{\vspace{#1}}} \addtocontents{lof}{\protect\lofvspace{5pt}} – jay Jan 15 '20 at 14:39
  • 1
    Tried a lot of answers! Finally, this worked for me! – Shahad Mahmud Mar 05 '21 at 17:58
10

If you happen to use a KOMA-Script class, simply add the listof=nochaptergap class option. (By default, KOMA-Script uses listof=chaptergapsmall which will produce an additional vertical space of 10 pt, equal to the behaviour of the standard classes.)

\documentclass[listof=nochaptergap]{scrbook}

\begin{document}

\listoffigures

\chapter{foo}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{A figure}
\end{figure}

\chapter{bar}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{Another figure}
\end{figure}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{And another one}
\end{figure}

\end{document}

enter image description here

lockstep
  • 250,273
6

Using the etoolbox package, you can patch this out of the code.

\makeatletter
\patchcmd{\@chapter}{%
        \addtocontents{lof}{\protect\addvspace{10\p@}}%
        \addtocontents{lot}{\protect\addvspace{10\p@}}%
}{}{}{\message{Failed to patch \string\@chapter}}
\makeatother

For adding space between figures and tables, you can use the tocloft package.

\setlength\cftbeforefigskip{\cftbeforechapskip}
\setlength\cftbeforetabskip{\cftbeforechapskip}

This puts the same space between entries in the list of figures/tables as goes between chapters in the table of contents.

TH.
  • 62,639
2

In the memoir document class, you can add the code \renewcommand{\insertchapterspace}{} to the preamble of your document. This will remove the chapter spacing in your listings of figures or tables. Details of this, as quoted below, are contained in Section 6.5 of the manual.

By default a \chapter inserts a small amount of vertical space into the List of Figures and List of Tables. It calls \insertchapterspace to do this. The default definition is:

\newcommand{\insertchapterspace}{%
\addtocontents{lof}{\protect\addvspace{10pt}}%
\addtocontents{lot}{\protect\addvspace{10pt}}%
}

If you would prefer no inserted spaces then \renewcommand{\insertchapterspace}{} will do the job. Different spacing can be inserted by changing the value of the length arguments to \addvspace. By making suitable changes to the above macros you can make some simple modifications to the layout.

The following is an example based on the one lockstep used in their answer.

\documentclass[oneside]{memoir}
\renewcommand{\insertchapterspace}{}

\begin{document}

\listoffigures

\chapter{foo}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{A figure}
\end{figure}

\chapter{bar}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{Another figure}
\end{figure}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{And another one}
\end{figure}

\end{document}

Picture of result

grg
  • 107
gman
  • 1,807