2

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!

  • 2
    Welcome to TeX.SX! Can you show the exact code you're using for a caption that raises the error? – egreg Sep 12 '15 at 21:29
  • Try \caption[short title \protect $\pm$...] – user31729 Sep 12 '15 at 21:29
  • The caption with math you provided works fine, so we need some more info. And unrelated, but that should be $\pm 10^{5}$. It's one piece of math, use just one math environment. – Torbjørn T. Sep 12 '15 at 21:39
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.