[Tex/LaTex] custom text in “list of figures”

table of contents

I am using a template for writing a long document. It automatically creates a list of figures at the start. In the list every entry is nothing but a caption of the figure. In some figures caption string is too long and it doesn't look good. How can I put custom strings in "list of figures"?

Best Answer

The \caption has two arguments - one optional and the other mandatory. The contents of optional argument (which is enclosed within []) is used for the list of figures (if given). If you want to put custom (short) description in the list of figures, use it in the optional argument like:

\caption[<custom string>]{<regular caption>}

A sample code:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\tableofcontents
\listoffigures
\section{some section}
  \begin{figure}[htb]
    \centering
    \includegraphics[width=2cm]{example-image-a}
    \caption[Short caption]{Here comes the long caption}
  \end{figure}
\end{document}

enter image description here