I have a string stored in a variable \word, and I want to store its upper case counterpart in another variable \WORD. If I try


then the message generated by \show is \MakeUppercase {abc}. Presumably I need to adjust the order of expansion in the first line. How do I do this?

1 Answer 1


In fact, \MakeUppercase expands its argument before uppercasing it, so we can do the following.


\noexpand prevents the expansion of \WORD, but \word is expanded. Then \MakeUppercase uppercases the whole definition. The definition must be made global because \MakeUppercase works inside a group.

  • @Bruno - this doesn't seem to work. I get the error ! Undefined control sequence. <argument> \def \WORD {abc} Mar 10, 2011 at 9:52
  • @Ian: right. I get where the problem is: \MakeUppercase tries to expand everything. Let me think a bit. A short solution is to replace \MakeUppercase by \uppercase, but it's not optimal. Mar 10, 2011 at 10:19
  • @Ian: that's fixed, and we now don't need all those expandafters. Mar 10, 2011 at 10:54
  • Very nice. I taught myself a lot about \expandafter trying to figure out my own solution, only to find out that \MakeUppercase expands its own argument. Putting the \gdef inside the \MakeUppercase had eluded me. Mar 10, 2011 at 13:27
  • @Matthew: my first (wrong) answer involved some expandafters as well. I'm still wondering why the authors of \MakeUppercase enclosed the whole definition in {...}, rather than using the standard \begingroup...\uppercase{\endgroup...}. Mar 10, 2011 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .