I came across this problem when I tried to write my dissertation.
Figures were not showing in contents: List of Figures. Neither were the tables. When I tried to compile with \caption{some figure} added, I had an error message.
! Undefined control sequence.
\l@figure #1#2->\ifnum \c@lofdepth
>\z@ \vskip \cftbeforefigskip {\leftskip ...
l.2 ...paces normal \relax }}{3}{figure.caption.6}
%
?
I tried and found a helpful question that was answered by others. Include Appendix as a Chapter in LOF and LOT, and chapters formatting in both lof and lot
So I loaded the code before \begin{document}.
\makeatletter
\def\thisparttitle{}\def\thispartnumber{}
\newtoggle{noFigs}
\apptocmd{\@part}%
{\gdef\thisparttitle{#1}\gdef\thispartnumber{\thepart}%
\global\toggletrue{noFigs}}{}{}
\AtBeginDocument{%
\AtBeginEnvironment{figure}{%
\iftoggle{noFigs}{
\addtocontents{lof}{\protect\contentsline {part}%
{\protect\numberline {\thispartnumber} {\thisparttitle}}{}{} }
\global\togglefalse{noFigs}
}{}
}%
}
\makeatother
However, after loading the helpful setting code into my code before \begin{document}. I found the package subcaption was not compatible. The subfigure package can be an alternative, but its not as good. Additionally, I found the \floatfoot command also produced an error message after I compiled with setting code.
Any thoughts? Thank you!