0

I've been trying to put a vector in the title of a section but no matter what I've tried, I keep getting the same error message (see below). I am using pdfLaTeX.

\section{Das Drehmoment $\overrightarrow{M}$}

The error message I receive is the following :

! Illegal parameter number in definition of \@themark. 
 to be read again
 \crcr 
 l.71 \section{Das Drehmoment $\overrightarrow{M}$}

Edit: \vec works just fine, but because I've used \overrightarrow for all my other vectors, I don't want to break the tradition.

5
  • you don't provide a test file. this \documentclass{book}\begin{document}\pagestyle{headings}\section{Das Drehmoment $\overrightarrow{M}$}zz\end{document} works in texlive 2019 and texlive 2020. If you can not update your system use \protect\overrightarrow Dec 10, 2020 at 22:37
  • The linked duplicate seems different, but it's the same root cause of the problem - a fragile element within a moving argument.
    – Werner
    Dec 10, 2020 at 22:45
  • @Werner hmm not sure every fragile command error in section error should be a dup but also that one doesn't mention that there is no problem with \angle or \overrightarrow in current releases Dec 10, 2020 at 22:51
  • @DavidCarlisle: I understand. Avoid having a question for \hat, \overrightarrow, \overleftarrow, \vec, \angle, ... in \section (and the same for \chapter and \subsection and \subsubsection... that all say "use \protect" as answer. At that point, they all provide the same resolution to "different" problem, and in my opinion, are duplicates.
    – Werner
    Dec 10, 2020 at 23:15
  • @Werner fair enough, I'll add an updated answer at the dup though in that case Dec 10, 2020 at 23:31

1 Answer 1

0
\documentclass{book}

\begin{document}
\pagestyle{headings}
\section{Das Drehmoment $\overrightarrow{M}$}
zz

\end{document}

Works in current latex releases.

If you can not update your tex system then you can use \protect as you have a fragile command in a moving argument.

\documentclass{book}

\begin{document}
\pagestyle{headings}
\section{Das Drehmoment $\protect\overrightarrow{M}$}
zz

\end{document}

Not the answer you're looking for? Browse other questions tagged .