I would like to know how to show Appendices' name in LOF if they contain figures.
% % % % % % % % % % PACKAGES % % % % % % % % % % % % %
\documentclass[11pt,a4paper]{report}
\usepackage[english]{babel} % english language
\usepackage{graphicx} % images in the document
\usepackage{float} % containers
\usepackage{wrapfig} % wrap text around figure
\usepackage{subfig} % some images in a environment
\usepackage{appendix}
\usepackage{titlesec}
\usepackage{chngcntr}
% code to put chapter name in LOF (hyperref must be loaded after it)
\usepackage{etoolbox}
\makeatletter
% initial definitions of the chapter info (name and number)
\def\thischaptertitle{}\def\thischapternumber{}
\newtoggle{noFigs}
\apptocmd{\@chapter}%
{\gdef\thischaptertitle{#1}\gdef\thischapternumber{\thechapter}%
\global\toggletrue{noFigs}}{}{}
% the figure environment does the job: the first time it is used after a \chapter command it writes the information of the chapter to the LoF
\AtBeginDocument{%
\AtBeginEnvironment{figure}{%
\iftoggle{noFigs}{
\addtocontents{lof}{\protect\contentsline {chapter}%
{\protect\numberline {\thischapternumber} {\thischaptertitle}}{}{} }
\global\togglefalse{noFigs}
}{}
}%
}
% hyperlinks typesettings
\usepackage[
% comment this out to avoid backref in bibliography
%backref=true, % allows to add links inside...
%pagebackref=true,% ...the bibliography
hyperindex=true, % add links in the index
bookmarks=true, % show bookmarks bar when displaying the document} {hyperref}
]{hyperref}
\hypersetup{
colorlinks=true, % colored links
breaklinks=true, % allows return line in too long links
urlcolor= blue, % links color
linkcolor= blue, % internal links color
citecolor= blue, % green by defaut, color of citation links (bibliography)
bookmarksopen=true,
}
% code to make appendices' sections look like chapters and subsections like sections in the body of the document
\makeatletter
\newcommand\changesections{%
\renewcommand\thesection{\Alph{section}}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\renewcommand\thefigure{\thesection.\arabic{figure}}
\titleclass{\section}{top}
\newcommand\sectionbreak{\cleardoublepage}
\titleformat{\section}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thesection}{20pt}{\Huge}
\titlespacing*{\section}
{0pt}{50pt}{40pt}
\titleformat{\subsection}
{\normalfont\Large\bfseries}{\thesubsection}{1em}{}
\titlespacing*{\subsection}
{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
}
\makeatother
% % % % % % % % % % RAPPORT % % % % % % % % % % % % %
\begin{document}
\listoffigures
\newpage
% chapter 1:
\chapter{Introduction}
\section{Problem overview}
\begin{figure}[H]
\caption{Comparative table 1}
\end{figure}
\section{Application description}
\begin{figure}[H]
\caption{Comparative table 2}
\end{figure}
\newpage
% end chapter 1
% appendices
\appendix
\clearpage % or \cleardoublepage
\appendixpage
\addappheadtotoc
% code to show appendices at section level in TOC
\begin{appendices}
\changesections
\section{Installation requirements}
\section{Performance evaluation I appendix}
\subsection{Strahov}
\begin{figure}[H]
\caption{Comparative table 3}
\end{figure}
\subsection{University laboratory}
\begin{figure}[H]
\caption{Comparative table 4}
\end{figure}
\end{appendices}
% end appendices
\end{document}
Now, LOF is displayed like this:
Notice the piece of code to show Chapters' name in LOF if they contain figures, and the piece of code to make appendices' sections look like chapters and subsections like sections in the body of the document.