Welcome to the UK List of
TeX Frequently Asked Questions
on the Web


The index of Frequently Asked Questions about TeX is searchable.

Please enter your keyword here:   then press here: ,    or:

Case-changing oddities

TeX provides two primitive commands \uppercase and \lowercase to change the case of text; they’re not much used, but are capable creating confusion.

The two commands do not expand the text that is their parameter — the result of \uppercase{abc} is ‘ABC’, but \uppercase{\abc} is always ‘\abc’, whatever the meaning of \abc. The commands are simply interpreting a table of equivalences between upper- and lowercase characters. They have (for example) no mathematical sense, and

\uppercase{About $y=f(x)$}

will produce


which is probably not what is wanted.

In addition, \uppercase and \lowercase do not deal very well with non-American characters, for example \uppercase{\ae} is the same as \ae.

LaTeX provides commands \MakeUppercase and \MakeLowercase which fixes the latter problem. These commands are used in the standard classes to produce upper case running heads for chapters and sections.

Unfortunately \MakeUppercase and \MakeLowercase do not solve the other problems with \uppercase, so for example a section title containing \begin{tabular}\end{tabular} will produce a running head containing \begin{TABULAR}. The simplest solution to this problem is using a user-defined command, for example:

\section{A section title \protect\mytable{}
  with a table}

Note that \mytable has to be protected, otherwise it will be expanded and made upper case; you can achieve the same result by declaring it with \DeclareRobustCommand, in which case the \protect won’t be necessary.

David Carlisle’s textcase package addresses many of these problems in a transparent way. It defines commands \MakeTextUppercase and \MakeTextLowercase which do upper- or lowercase, with the fancier features of the LaTeX standard \Make*-commands but without the problems mentioned above. Load the package with \usepackage[overload]{textcase}, and it will redefine the LaTeX commands (not the TeX primitive commands \uppercase and \lowercase), so that section headings and the like don’t produce broken page headings.

macros/latex/contrib/textcase (or browse the directory); catalogue entry

Go to previous question, or next question

Go to FAQ home.

URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=casechange

Comments, suggestions, or error reports? - see “how to improve the FAQ”.

This is FAQ version 3.27, released on 2013-06-07.