[Tex/LaTex] Grouping by chapter in List of Figures and Tables with ClassicThesis

classicthesisspacingtable of contents

I checked extensively the forum and the net in order to solve this seemingly simple problem, without success. I know that there are a lot of posts regarding this problem, but I was unable to find the one that was fitting my purpose.

I would like to add an extra line inside the List of Figures and Tables when switching from one chapter to another, when using the scrbook class of ClassicThesis.

So for example it should be:

  1. Figure 1.1
  2. Figure 1.2

  3. Figure 2.1

  4. Figure 3.1

while what I obtain now is:

  1. Figure 1.1
  2. Figure 1.2
  3. Figure 2.1
  4. Figure 3.1

Here is the MWE that reproduces my problem, with a possible solution that I took from here, which unfortunately doesn't work in my case:

\documentclass{scrbook}
\usepackage{classicthesis}
\usepackage{classicthesis-ldpkg}
\usepackage{subfig}
\usepackage{graphicx}
\begin{document}

\makeatletter
\let\my@chapter\@chapter
\renewcommand*{\@chapter}{%
  \addtocontents{lof}{\protect\addvspace{10pt}}%
  \my@chapter}
\makeatother

\listoffigures

\clearpage

\chapter{1}

\begin{figure}
\centering
\includegraphics[scale=.9]{fig1}
\caption{Figure 1 of the chapter 1}
\end{figure}

\begin{figure}
\centering
\includegraphics[scale=.9]{fig2}
\caption{Figure 2 of the chapter 1}
\end{figure}
1
\chapter{2}

\begin{figure}
\centering
\includegraphics[scale=.9]{fig3}
\caption{Figure 1 of the chapter 2}
\end{figure}

\chapter{3}

\begin{figure}
\centering
\includegraphics[scale=.9]{fig4}
\caption{Figure 1 of the chapter 3}
\end{figure}

\end{document}

Thanks for your kind help.

Best Answer

classicthesis adds a \deactivateaddvspace macro at the start the .lof file. This macro does exactly what its name suggests, and so your patch fails. Looking into the package code, this behaviour seems to be related to a listsseparated option (and associated boolean) that is set to false. I wasn't able to set it to true again, so here's a brute force method: Define a new macro \killdeactivateadddvspace that will cause \deactiveateaddvspace to do nothing, and add the former macro at the very start of the .lof file -- I've used the etoolbox package and its \AtEndPreamble macro to do so.

Notes: I didn't use the classicthesis-ldpkg package as it is not available at CTAN. Also, adding the demo option to the graphicx package makes it easier for helpers to test your code.

\documentclass{scrbook}
\usepackage{classicthesis}
%\usepackage{classicthesis-ldpkg}
\usepackage{subfig}
\usepackage[demo]{graphicx}

\usepackage{etoolbox}
\newcommand{\killdeactivateaddvspace}{\let\deactivateaddvspace\relax}
\AtEndPreamble{\addtocontents{lof}{\protect\killdeactivateaddvspace}}

\begin{document}

\listoffigures

\clearpage

\chapter{1}

\begin{figure}
\centering
\includegraphics[scale=.9]{fig1}
\caption{Figure 1 of the chapter 1}
\end{figure}

\begin{figure}
\centering
\includegraphics[scale=.9]{fig2}
\caption{Figure 2 of the chapter 1}
\end{figure}
1
\chapter{2}

\begin{figure}
\centering
\includegraphics[scale=.9]{fig3}
\caption{Figure 1 of the chapter 2}
\end{figure}

\chapter{3}

\begin{figure}
\centering
\includegraphics[scale=.9]{fig4}
\caption{Figure 1 of the chapter 3}
\end{figure}

\end{document}

enter image description here