Is there a way to prevent \MakeUppercase
from affecting in-text equations? In this example, abc
should change to ABC
, but n
should be left as it is.
\documentclass{article}
\begin{document}
\MakeUppercase{abc $n$}
\end{document}
The following works for individual characters, but I would like something more general.
\documentclass{article}
\begin{document}
\newcount\mycount
\mycount\mathcode`n
\MakeUppercase{abc $\mathchar\mycount$}
\end{document}
Best Answer
The
textcase
package was already mentioned. But if you are forced to stay with an unchanged\MakeUppercase
for some reason then you still have the poor man's choice of "hiding" the math:The
\protect
is needed as\MakeUppercase
in LaTeX is essentially an\edef
that only stops expanding at\protect
.Or the alternative with eTeX which has protection at the macro definition level: