\documentclass{nlctdoc} \usepackage{alltt} \usepackage{mfirstuc} \usepackage{pifont} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[colorlinks, bookmarks, hyperindex=false, pdfauthor={Nicola L.C. Talbot}, pdftitle={mfirstuc.sty: uppercasing first letter}, pdfkeywords={LaTeX,package,uppercase}]{hyperref} \begin{document} \title{mfirstuc.sty v1.05: uppercasing first letter} \author{Nicola L.C. Talbot\\[10pt] School of Computing Sciences\\ University of East Anglia\\ Norwich. Norfolk\\ NR4 7TJ. United Kingdom.\\ \url{http://theoval.cmp.uea.ac.uk/~nlct/}} \date{2011-04-02} \maketitle The \styfmt{glossaries} bundle is supplied with the package \sty{mfirstuc} which provides the command: \begin{definition}[\DescribeMacro{\makefirstuc}] \cs{makefirstuc}\marg{stuff} \end{definition} This makes the first object of \meta{stuff} uppercase unless \meta{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: \begin{itemize} \item |\makefirstuc{abc}| produces \makefirstuc{abc}. \item |\makefirstuc{\emph{abc}}| produces \makefirstuc{\emph{abc}} (\ics{MakeUppercase} has been applied to the letter \qt{a} rather than \cs{emph}). Note however that \begin{verbatim} \makefirstuc{{\em abc}} \end{verbatim} produces \makefirstuc{{\em abc}} (first object is |{\em abc}| so equivalent to |\MakeUppercase{\em abc}|), and \begin{verbatim} {\makefirstuc{\em abc}} \end{verbatim} produces {\makefirstuc{\em abc}} (|\em| doesn't have an argument therefore first object is |\em| so equivalent to |{\MakeUppercase{\em}abc}|). \item |\makefirstuc{{\'a}bc}| produces \makefirstuc{{\'a}bc}. \item |\makefirstuc{\ae bc}| produces \makefirstuc{\ae bc}. \item |\makefirstuc{{\ae}bc}| produces \makefirstuc{{\ae}bc}. \item |\makefirstuc{{ä}bc}| produces \makefirstuc{{ä}bc}. \end{itemize} 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 \sty{inputenc} package) due to expansion issues. \begin{important} In version 1.02 of \styfmt{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 \ae Bc. However as from version 1.02, it now produces \AE bc. \end{important} Note also that \begin{verbatim} \newcommand{\abc}{abc} \makefirstuc{\abc} \end{verbatim} produces: ABC. This is because the first object in the argument of \cs{makefirstuc} is \cs{abc}, so it does |\MakeUppercase{\abc}|. Whereas: \begin{verbatim} \newcommand{\abc}{abc} \expandafter\makefirstuc\expandafter{\abc} \end{verbatim} produces: Abc. There is a short cut command which will do this: \begin{definition}[\DescribeMacro{\xmakefirstuc}] \cs{xmakefirstuc}\marg{stuff} \end{definition} This is equivalent to \cs{expandafter}\cs{makefirstuc}\cs{expandafter}\marg{stuff}. So \begin{verbatim} \newcommand{\abc}{abc} \xmakefirstuc{\abc} \end{verbatim} produces: \newcommand{\abc}{abc}% \xmakefirstuc{\abc}. \begin{important} \cs{xmakefirstuc} only performs one level expansion on the first object in its argument. It does not fully expand the entire argument. \end{important} If you want to use an alternative command to convert to uppercase, for example \cs{MakeTextUppercase},\footnote{defined in the \styfmt{textcase} package} you can redefine \cs{glsmakefirstuc}. For example: \begin{verbatim} \renewcommand{\glsmakefirstuc}[1]{\MakeTextUppercase #1} \end{verbatim} \end{document}