What's wrong with this:


\MakeUppercase{\cim} works but \StrMid{\MakeUppercase{\cim}}{1}{1} doesn't work. Why?

  • Perhaps try \MakeUppercase{\noexpand\StrMid{\cim}{1}{1}}? Not sure the \noexpand is needed, and I can't test on this computer. Jan 16, 2012 at 18:45

2 Answers 2


Since you don't need to uppercase the string beforehand, this is a way:


We store the extracted string in a temporary macro and then apply \MakeUppercase to the result.

If strings are formed by "safe" characters (printable ASCII characters), the simpler \uppercase can be used:


The xstring package carries out an \edef (exhaustive expansion) on its argument. Stefan has suggested one approach, but depending on what you want to achieve an alternative is to create an expandable version of the upper case command. There is one built-in to expl3, which needs renaming for use in a document:

\cs_gset_eq:NN \MakeExpandableUppercase \text_uppercase:n
\StrMid{\MakeExpandableUppercase{\cim}}{1}{1}\space or 
\StrMid{\expandafter\MakeExpandableUppercase\expandafter{\cim}}{1}{1} ?

As I've indicated, I'm not sure what order you want the case change to happen in, relative to the string extraction.

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.