summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries/mfirstuc-manual.tex
blob: d01adf94f705b6d855f6c8e8903eca92ebcd19b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
\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}