[Tex/LaTex] Remove indentation of multiline entries in list of figures

table of contents

I have several long figure titles which span over multiple lines in the list of figures. How can I remove the indentation of the first line? I tried \setlength{\cftfignumwidth}{6 em} but this changes the spacing for all lines of the entry. (see below – NB. I would like to keep the full titles and so using a short title is not an option)

enter image description here

MWE:

\documentclass[a4paper, 12pt]{report}

\usepackage[titles]{tocloft}

\setlength{\cftfignumwidth}{6 em}
\setlength{\cftfigindent}{0 em}  % remove indentation from figures in lof
\renewcommand{\cftfigfont}{\footnotesize{Fig. }}
\renewcommand\cftfigpagefont{\footnotesize}

\begin{document}

\tableofcontents

\addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures

\newpage

\begin{figure}[h!]
\caption{This figure has an extremely long title spanning more than one line in the list of figures}
\end{figure}

\begin{figure}[h!]
\caption{This figure has a short title}
\end{figure}

\end{document}

Best Answer

The command \cftfigfont is intended for defining the format of the entry, not for adding material. Replace the corresponding line by

\renewcommand\cftfigfont{\footnotesize}
\renewcommand\cftfigpresnum{Fig. }

then the list of figures looks as intended:

enter image description here

Note that you have to precede the \addcontentsline for the list of figures by a \clearpage command, otherwise the toc entry for the list of figures will show the wrong page number.

\documentclass[a4paper, 12pt]{report}

\usepackage[titles]{tocloft}

\setlength{\cftfignumwidth}{6 em}
\setlength{\cftfigindent}{0 em}  % remove indentation from figures in lof
\renewcommand\cftfigfont{\footnotesize}
\renewcommand\cftfigpresnum{Fig. }
\renewcommand\cftfigpagefont{\footnotesize}

\begin{document}

\tableofcontents

\clearpage
\addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures

\newpage

\begin{figure}[h!]
\caption{This figure has an extremely long title spanning more than one line in the list of figures}
\end{figure}

\begin{figure}[h!]
\caption{This figure has a short title}
\end{figure}

\end{document}