[Tex/LaTex] list of figures/tables shortened name with math symbols

table of contents

I am trying to get some shortened figure/table captions into my list of figures/tables for my thesis. Currently, it displays all the text in the figure caption but I only want the first sentence to be shown in the lof/lot.

Saw that this can 'easily' be done using

\caption[short title for list of figures]{long title for text} 

in this previous post \tableofcontents and \listoffigures help.

BUT… I need to introduce something like

\caption[short title $\pm$ 10$^{5}$]{long title for text}  

and I get an error when compiling.

Any way this can be done?

Thanks!

Best Answer

The short and long caption titles of the question should work fine. A typical problem with caption titles for the list of figures is that fragile macros can break. Then they can be protected by \protect. Example, if \foobar is such a macro, then it is protected the following way:

\caption[Some text \protect\foobar]{Long caption text}

Another typical problem is, when stuff in the optional argument also contains optional arguments or square brackets. TeX does not check for matched square brackets unlike it does with curly braces. Then they can be protected by curly braces, e.g.:

\caption[{Some [short] text}]{Long caption text}

The following example shows, that the caption of the question does not cause problems. The only macro is \pm, which is not fragile, when defined by LaTeX. Also the example shows the usage of package siunitx for the number, a powerful package for numbers, units and both. It takes care of formatting and spaces.

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\listoffigures
\begin{figure}
\caption[short title $\pm$ 10$^{5}$]{long title for text}
\end{figure}
\begin{figure}
\caption[short title \num{+-e5}]{long title for text}
\end{figure}
\end{document}

Result