I'm trying to put a mathematics symbols in the caption of my figure with this:

    \caption{Vecteur $\overrightarrow{CM}$ à un moment donné}

And LaTeX show an error:

Illegal parameter number in definition of \reserved@a.
<to be read again> 
l.76 ...$\overrightarrow{CM}$ à un moment donné}

Do I have to use any package to do this?

migrated from stackoverflow.com Jun 27 '14 at 13:32

This question came from our site for professional and enthusiast programmers.


Figure captions are considered a "movable argument" as they could end up in the List of Figures (a Table of Contents of sorts). And, such things that move end up being written to file (the .aux, .toc, .lof, ...) for use later on. This writing requires care so that certain fragile commands don't expand prematurely. \protection helps here:

enter image description here

  \caption{Vecteur $\protect\overrightarrow{CM}$ à un moment donné}
  • Surely there is an easier way? A \captionmath that avoids having to protect everything? – AbstractDissonance Nov 27 '18 at 13:24

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.