\uppercase doesn't work around text-generating command

You have to expand the \testcommand first, since \uppercase performs the change of characters on a token level.

Better use \MakeUppercase{\testcommand}.

\documentclass{article}

\begin{document}

\newcommand{\testcommand}{A foo Bar.}
\uppercase{abc}
\uppercase\expandafter{\testcommand}

\MakeUppercase{\testcommand}  

\end{document}

enter image description here


Why? Is just because that is how it is defined, it is a token level transformation and the token \testcommand is unchanged , it only affects character tokens.

You should use \MakeUppercase, a latex command that expands before uppercasing, and makes other adjustments.

Tags:

Tex Core