I am currently using the following code to print the section and subsection in the header.

\rfoot{\textit{Page \thepage}}


However, if I try to use \mathcal in the section titles, it causes an error. How do I get around this?

  • How does this differ from your earlier question: tex.stackexchange.com/q/533524 ? Apr 3 '20 at 20:42
  • 1
    Put \protect before \mathcal when the latter is used in a section (or similar) heading. Apr 3 '20 at 20:43
  • @barbarabeeton it doesn't, but no one answered my previous question
    – Manj
    Apr 3 '20 at 21:38
  • Suppose the heading is \section{Properties of \mathcal{S}_n}. Where would I add \protect?
    – Manj
    Apr 3 '20 at 21:45
  • \section{Properties of \protect\mathcal{S} ... Apr 3 '20 at 22:02

LaTeX will define \leftmark and \rightmark for you, don't force it.


\usepackage{lipsum} % for mock text


\fancyfoot[R]{\itshape Page \thepage}





\section{Test section}

\subsection{Test subsection $\mathcal{A}$}



enter image description here

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.