4

If I write:

\documentclass[a4paper]{report}

\begin{document}
\lowercase{Norma}
\end{document}

I get "norma" in the output, lowercased as I want it. However, if I write:

\documentclass[a4paper]{report}
\expandafter\def\csname mw@mu\endcsname{Norma}

\begin{document}
\lowercase{\csname mw@mu\endcsname}
\end{document}

I get "Norma", with the capital letter, which I don't want. I tried putting \noexpand before \lowercase, and surrounding \lowercase with \expandafters, but to no avail: the capital letter is always there. How do I fix this?

MickG
  • 5,426

1 Answers1

5

The commands \lowercase and \uppercase don't expand their contents; they just convert character tokens in their argument and put back the token list in the input stream.

In your code, what's subject to possible case change are m w @ m and u; indeed, if you try

\lowercase{\csname MW@MU\endcsname}

you'll get the same result as

\lowercase{\csname mw@mu\endcsname}

Just to make the example simpler:

\def\Norma{Norma}
\lowercase{\Norma}

will print

Norma

because symbolic tokens are not touched by \lowercase. If you really want to lowercase the expansion of \Norma you have to say

\lowercase\expandafter{\Norma}

but just the first token will be expanded, not other tokens following it. For the macro given with \csname you need

\lowercase\expandafter\expandafter\expandafter{\csname mw@mu\endcsname}
egreg
  • 1,121,712
  • I see. Now it works. Thanks. Is there by any chance a LaTeX3 version of \lowercase that does expand its argument? Is there a way to generate one? – MickG Oct 04 '14 at 17:01
  • 1
    @MickG \begingroup\protected@edef\x{\endgroup\protect\MakeLowercase{<code>}}\x will do. – egreg Oct 04 '14 at 17:09