Next: , Previous: , Up: Special insertions   [Contents][Index]


23.2 Upper and lower case

Synopsis:

\uppercase{text}
\lowercase{text}
\MakeUppercase{text}
\MakeLowercase{text}

Change the case of characters. The TeX primitive commands \uppercase and \lowercase are set up by default to work only with the 26 letters a–z and A–Z. The LaTeX commands \MakeUppercase and \MakeLowercase commands also change characters accessed by commands such as \ae or \aa. The commands \MakeUppercase and \MakeLowercase are robust but they have moving arguments (see \protect).

These commands do not change the case of letters used in the name of a command within text. But they do change the case of every other Latin letter inside the argument text. Thus, \MakeUppercase{Let $y=f(x)$} produces ‘LET Y=F(X)’. Another example is that the name of an environment will be changed, so that \MakeUppercase{\begin{tabular} ... \end{tabular}} will produce an error because the first half is changed to \begin{TABULAR}.

LaTeX uses the same fixed table for changing case throughout a document, The table used is designed for the font encoding T1; this works well with the standard TeX fonts for all Latin alphabets but will cause problems when using other alphabets.

To change the case of text that results from a macro inside text you need to do expansion. Here the \Schoolname produces ‘COLLEGE OF MATHEMATICS’.

\newcommand{\schoolname}{College of Mathematics}
\newcommand{\Schoolname}{\expandafter\MakeUppercase
                           \expandafter{\schoolname}}

The textcase package brings some of the missing feature of the standard LaTeX commands \MakeUppercase and \MakeLowerCase.

To uppercase only the first letter of words, you can use the package mfirstuc.

Handling all the casing rules specified by Unicode, e.g., for non-Latin scripts, is a much bigger job than anything envisioned in the original TeX and LaTeX. It has been implemented in the expl3 package as of 2020. The article “Case changing: From TeX primitives to the Unicode algorithm”, (Joseph Wright, TUGboat 41:1, https://tug.org/TUGboat/tb41-1/tb127wright-case.pdf), gives a good overview of the topic, past and present.


Unofficial LaTeX2e reference manual