tcblistof, book class and vertical spacing

It deals with the displaying of the tcblistof feature with the package tcolorbox, which differs from the classic \listoffigures when used with the book class. In the example below (with tcolorbox v 3.05), you can see vertical space added between chapters inside the List of Figures, but not inside the List of Theorems.

\documentclass{book}
\usepackage[theorems]{tcolorbox}

\newtcbtheorem[auto counter,number within=chapter,list inside=thm]{theo}{Theorem}{}{}

\begin{document}
\listoffigures{}
\tcblistof[\chapter*]{thm}{List of Theorems}

\chapter{Chapter No1}
\begin{figure}
\caption{Figure No1}
\end{figure}
\begin{figure}
\caption{Figure No2}
\end{figure}
\begin{theo}{Theorem No1}{}
\end{theo}
\begin{theo}{Theorem No2}{}
\end{theo}

\chapter{Chapter No2}
\begin{figure}
\caption{Figure No3}
\end{figure}
\begin{figure}
\caption{Figure No4}
\end{figure}
\begin{theo}{Theorem No3}{}
\end{theo}
\begin{theo}{Theorem No4}{}
\end{theo}

\end{document}


Is it possible to achieve the same displaying for both? (more precisely, I'd like to make tcblistof behave like the List of Figures).

You have to teach \chapter to add the vertical space also in the list of theorems as it does for the lists of figures and tables.

The easiest way is patching \@chapter with etoolbox:

\documentclass{book}
\usepackage[theorems]{tcolorbox}
\usepackage{etoolbox}

\newtcbtheorem[auto counter,number within=chapter,list inside=thm]{theo}{Theorem}{}{}

\makeatletter
\patchcmd{\@chapter}
{\chaptermark{#1}}% search
{}{}
\makeatother

\begin{document}
\listoffigures{}
\tcblistof[\chapter*]{thm}{List of Theorems}

\chapter{Chapter No1}
\begin{figure}
\caption{Figure No1}
\end{figure}
\begin{figure}
\caption{Figure No2}
\end{figure}
\begin{theo}{Theorem No1}{}
\end{theo}
\begin{theo}{Theorem No2}{}
\end{theo}

\chapter{Chapter No2}
\begin{figure}
\caption{Figure No3}
\end{figure}
\begin{figure}
\caption{Figure No4}
\end{figure}
\begin{theo}{Theorem No3}{}
\end{theo}
\begin{theo}{Theorem No4}{}
\end{theo}

\end{document}


If you have more lists, you can use just one patch instead of many:

\makeatletter
\patchcmd{\@chapter}
{\chaptermark{#1}}% search
{}{}

\@for\next:=\listoftocs\do{%

Just define \listoftocs to a comma separated list with the file extensions pertaining to each list.
• Just for the sake of completness, if hyperref is loaded, this works only is it is loaded after the patch. In case hyperref has to be loaded before (e.g. if it is loaded by the class), it should be enough to use \makeatletter \xapptocmd{\Hy@org@chapter}{% \addtocontents{thm}{\protect\addvspace{10\p@}}% }{}{} \makeatother – Denis Bitouzé Jul 9 '14 at 18:29