Menu

HowTo_ListOfNoChapterGap

How to set floating environment directories such as the list of tables or figures in scrreprt or scrbook without spacing for new chapters

The scrreprt and scrbook classes normally insert a small vertical space into floating environment directories when starting a new chapter. In particular, if you change the numbering of the floating environments, for example using:

\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}

independently of the chapter numbering and thus being continual throughout the document, it can be useful to switch off this spacing. The easiest way to do this with the two KOMA-Script classes is with the option listof=nochaptergap:

\documentclass[listof=nochaptergap]{scrbook}
\usepackage{mwe}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\chapter{The first chapter}
\blindtext
\begin{figure}
  \centering
  \includegraphics{example-image-a}
  \caption{Example A image in chapter \thechapter}
\end{figure}
\begin{table}
  \caption{Example for a missing table}  
\end{table}

\blindtext
\begin{table}
  \caption{Example for another missing table}  
\end{table}
\begin{figure}
  \centering
  \includegraphics{example-image-b}
  \caption{Example B image in chapter \thechapter}
\end{figure}

\chapter{One more chapter}
\blindtext
\begin{figure}
  \centering
  \includegraphics{example-image-a}
  \caption{Example A image in chapter \thechapter}
\end{figure}
\begin{table}
  \caption{Example for a missing table}  
\end{table}

\blindtext
\begin{table}
  \caption{Example for another missing table}  
\end{table}
\begin{figure}
  \centering
  \includegraphics{example-image-b}
  \caption{Example B image in chapter \thechapter}
\end{figure}
\end{document}

Note: After changing option listof you need at least two LaTeX runs to see the difference in the resulting PDF.


Related

Wiki (English): HowTo_ToCConfiguration

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.