I tried to use \uppercase
in \newcommand
:
\newcommand\universidad{My University}
\newcommand\Universidad{\uppercase{\universidad}}
When I use it I get this,
My University
and not, as expected, this
MY UNIVERSITY
Why?
EDIT
I can't use \MakeUppercase
because I need use latin quote, example: ingeniería. And this latin case has problems with \MakeUppercase
Best Answer
With both
latin1
andutf8
encodings I get correct output fromThe problem with your definition is that
\uppercase
acts on the token list\universidad
and doesn't do nothing, because at that level there's no letter to be uppercased;\universidad
is expanded only later. With\expandafter
we perform the expansion before\MakeUppercase
comes into action.Just as an exercise, here is a macro
\Capitalize
that takes as argument a control sequence and defines its "uppercase variant"After this magic code you can say
will define also
\Universidad
and\Facultad
that will print "UNIVERSIDAD DE LUGAR" and "INGENIERÍA".Note that
\MakeUppercase
does not go along with hyperref, so in case you use these commands where this package extracts something for building bookmarks you should give it a safe token list; for exampleand, in the automatic defining command, change the line
into
In case one's using
utf8x
, the definitions must be preceded by\PrerenderUnicode
:The
\Capitalize
macro could beso that
\PrerenderUnicode
is performed automatically when needed.