}
’??}
on the line in question.
Well, no: this is TeX’s cryptic way of hinting that you’ve put a
fragile command in a moving argument.
For example, \
footnote
is fragile, and if we put that in the
moving argument of a \
section
command, as
we get told\section{Mumble\footnote{I couldn't think of anything better}}
The same happens with captions (the following is a simplification of a comp.text.tex post):! Argument of \@sect has an extra }.
giving us the error message\caption{Energy: \[e=mc^2\]}
The similar (but more sensible):! Argument of \@caption has an extra }.
is more tiresome, still: there’s no error when you first run the job … but there is on the second pass, when the list of figures (or tables) is generated, giving:\caption{Energy: \(e=mc^2\)}
in the! LaTeX Error: Bad math environment delimiter.
\
listoffigures
processing.
The solution is usually to use a robust command in place of the one
you are using, or to force your command to be robust by prefixing it
with \
protect
, which in the \
section
case would show as
However, in both the\section{Mumble\protect\footnote{I couldn't think of anything better}}
\
section
case and the \
caption
case,
you can separate the moving argument, as in
\
section[
moving]{
static}
; this gives us another standard
route — simply to omit (or otherwise sanitise) the fragile command
in the moving argument. So, one might rewrite the \
caption
example as:
In practice, inserting mathematics in a moving argument has already been addressed in LaTeX2e by the robust command\caption[Energy: (Einstein's equation)]{Energy: \(E=mc^2\)}
\
ensuremath
:
So: always look for alternatives to the\caption{Energy: \ensuremath{E=mc^2}}
\
protect
route.
Footnotes can be even more complex;
“footnotes in LaTeX section headings”
deals specifically with that issue.
This answer last edited: 2012-02-09
This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=extrabrace