mfirstuc.sty v1.05: uppercasing first letter

mfirstuc.sty v1.05: uppercasing first letter

Nicola L.C. Talbot
School of Computing Sciences
University of East Anglia
Norwich. Norfolk
NR4 7TJ. United Kingdom.
http://theoval.cmp.uea.ac.uk/~nlct/

2011-04-02

The glossaries bundle is supplied with the package mfirstuc which provides the command:


\makefirstuc  \makefirstuc{stuff }

This makes the first object of stuff uppercase unless stuff starts with a control sequence followed by a non-empty group, in which case the first object in the group is converted to uppercase. Examples:

Note that non-Latin or accented characters appearing at the start of the text must be placed in a group (even if you are using the inputenc package) due to expansion issues.

In version 1.02 of mfirstuc, a bug fix resulted in a change in output if the first object is a control sequence followed by an empty group. Prior to version 1.02, \makefirstuc{\ae{}bc} produced æBc. However as from version 1.02, it now produces Æbc.

Note also that

\newcommand{\abc}{abc}  
\makefirstuc{\abc}

produces: ABC. This is because the first object in the argument of \makefirstuc is \abc, so it does \MakeUppercase{\abc}. Whereas:

\newcommand{\abc}{abc}  
\expandafter\makefirstuc\expandafter{\abc}

produces: Abc. There is a short cut command which will do this:


\xmakefirstuc  \xmakefirstuc{stuff }

This is equivalent to \expandafter\makefirstuc\expandafter{stuff }. So

\newcommand{\abc}{abc}  
\xmakefirstuc{\abc}

produces: Abc.

\xmakefirstuc only performs one level expansion on the first object in its argument. It does not fully expand the entire argument.

If you want to use an alternative command to convert to uppercase, for example \MakeTextUppercase,1 you can redefine \glsmakefirstuc. For example:

\renewcommand{\glsmakefirstuc}[1]{\MakeTextUppercase #1}

1defined in the textcase package