# Capitalizing mathematical parts in section mark

In book documentclass, the section marks in the header are put in all caps. For normal text, that is okay.

However, I've just noticed that the same happens to letters in math mode, which is obviously bad, as the meaning of the letter may change depending on the capitalization. Is there a simple way to fix it? (Hopefully without having to rewrite all headers via fancyhdr or something.)

MWE:

\documentclass{book}
\begin{document}
\section{$n+2=N$}
\end{document}

• the document class amsbook contains a definition for \uppercasenonmath for just this purpose. it's a bit complicated, and i haven't time to dig it out now, but it could serve as a model. – barbara beeton Jun 1 '18 at 19:13
• I generally advise against capitalizing headers (it's rather easy with fancyhdr). – egreg Jun 1 '18 at 19:18

You can switch out \MakeUppercase for \MakeTextUppecase which skips math mode:

\documentclass{book}
\begin{document}
\section{$n+2=N$}
\end{document}

• Recommending one of your packages? – egreg Jun 1 '18 at 19:17
• @egreg excellent package is it not? – David Carlisle Jun 1 '18 at 19:20
• Thanks. This is the solution. (Well, short of changing the source packages, this is really a bug...) – tomasz Jun 1 '18 at 19:22
• @DavidCarlisle writing a package for that is cheating :) – Skillmon likes topanswers.xyz Jun 1 '18 at 21:01
• @Skillmon in that case I've been cheating since 1997:-) – David Carlisle Jun 1 '18 at 21:13

You can manually protect single characters (or a range in which everything is lowercase) by using \lowercase:

\documentclass{book}
\begin{document}
\section{$\lowercase{n+n-n}+2=N$}
\end{document}

• Thanks, this works! (Although the other solution is more elegant.) – tomasz Jun 1 '18 at 19:23