[Tex/LaTex] List of figures by chapter in classic thesis

classicthesiskoma-scripttable of contents

I'm writing my thesis with classic thesis. It is possible to include the title of the chapter, but only when figure are present therein to the lof?

The use of listof = chapterentry in the option to KOMA also include chapters without figures, and I would avoid these.

Thank you!!

MWE

\documentclass[10pt, a4paper, twoside, openright, titlepage, fleqn, headinclude, footinclude, BCOR5mm, numbers=noenddot, cleardoublepage=empty, 
listof = withchapterentry]{scrbook}
%classic thesis template
\usepackage[eulerchapternumbers, eulermath, pdfspacing, listings, floatperchapter,parts]{classicthesis}
\begin{document}
\listoffigures
\chapter{Introduction with no Figures}

\chapter{Test Chapter with Figures}
\begin{figure}
\caption{caption text}
\end{figure}
\begin{figure}
\caption{caption text}
\end{figure}

\chapter{Test Chapter with no Figures}

\chapter{Another Test Chapter with Figures}
\begin{figure}
\caption{caption text}
\end{figure}

\end{document}

As you can see in the picture introduction and chapter one are also listed but contain no figures. I would avoid listing chapter without figures.

enter image description here

Best Answer

tof

\documentclass[10pt, a4paper, twoside, openright, titlepage, fleqn, headinclude, footinclude, BCOR5mm, numbers=noenddot, cleardoublepage=emptyast]{scrbook}
%classic thesis template
\usepackage[eulerchapternumbers, eulermath, pdfspacing, listings, floatperchapter,parts]{classicthesis}

\makeatletter
\newcommand{\chapterwithfigures}{\addxcontentsline{lof}{chapteratlist}[{\thechapter}]{\scr@ds@tocentry}}%
\makeatother

\begin{document}
\listoffigures
\chapter{Introduction with no Figures}

\chapter{Test Chapter with Figures}
\chapterwithfigures
\begin{figure}
\caption{caption text}
\end{figure}
\begin{figure}
\caption{caption text}
\end{figure}

\chapter{Test Chapter with no Figures}

\chapter{Another Test Chapter with Figures}
\chapterwithfigures
\begin{figure}
\caption{caption text}
\end{figure}

\end{document}