7

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}
2
  • 2
    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. Jun 1, 2018 at 19:13
  • I generally advise against capitalizing headers (it's rather easy with fancyhdr).
    – egreg
    Jun 1, 2018 at 19:18

2 Answers 2

10

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

enter image description here

\documentclass{book}
\usepackage[overload]{textcase}
\begin{document}
    \section{$n+2=N$}
\end{document}
5
  • Recommending one of your packages?
    – egreg
    Jun 1, 2018 at 19:17
  • 2
    @egreg excellent package is it not? Jun 1, 2018 at 19:20
  • Thanks. This is the solution. (Well, short of changing the source packages, this is really a bug...)
    – tomasz
    Jun 1, 2018 at 19:22
  • @DavidCarlisle writing a package for that is cheating :)
    – Skillmon
    Jun 1, 2018 at 21:01
  • 2
    @Skillmon in that case I've been cheating since 1997:-) Jun 1, 2018 at 21:13
9

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}
1
  • Thanks, this works! (Although the other solution is more elegant.)
    – tomasz
    Jun 1, 2018 at 19:23

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.