General ⇒ Capitalize first letter of names in Glossaries list
-
- Posts: 52
- Joined: Sat Jun 07, 2008 11:56 am
Capitalize first letter of names in Glossaries list
Hello,
I'm using the glossaries package. It prints my glossary at the end of the document, but all the entry names are in lowercase. I'd like to know how I can make the first letter of each entry name in the glossary uppercase. The same for the list of acronyms would also be appreciated.
Note: I don't want to know how to make the first letter uppercase in the text (I know about \Gls instead of \gls), only in the glossary list at the end.
Thanks,
Rich
I'm using the glossaries package. It prints my glossary at the end of the document, but all the entry names are in lowercase. I'd like to know how I can make the first letter of each entry name in the glossary uppercase. The same for the list of acronyms would also be appreciated.
Note: I don't want to know how to make the first letter uppercase in the text (I know about \Gls instead of \gls), only in the glossary list at the end.
Thanks,
Rich
Last edited by stinkinrich88 on Thu Sep 02, 2010 7:47 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 52
- Joined: Sat Jun 07, 2008 11:56 am
Capitalize first letter of names in Glossaries list
Of course, I've tried the following code in my preamble:
But I get several errors in my .acr file, saying I've got an extra } or forgotten a $....
Any ideas?
Code: Select all
\renewcommand{\glsnamefont}[1]{\makefirstuc{#1}}
Any ideas?
Capitalize first letter of names in Glossaries list
You need to redefine \glsnamefont:
However it looks a bit odd for an acronym to start with a capital and have the rest in lower case as it makes it look like an ordinary word. The following will make the acronym all upper case in the list of acronyms:
You haven't mentioned if you are using the 'smallcaps' option. If you have and you are using a font that doesn't support bold small caps, then try:
Regards
Nicola Talbot
Code: Select all
\documentclass{article}
\usepackage[acronym]{glossaries}
\makeglossaries
\renewcommand{\glsnamefont}[1]{\makefirstuc{#1}}
\newglossaryentry{sample}{name=sample,description=a sample entry}
\newacronym{abc}{abc}{a sample acronym}
\begin{document}
\gls{sample}. \gls{abc}.
\printglossaries
\end{document}
Code: Select all
\documentclass{article}
\usepackage[acronym]{glossaries}
\makeglossaries
\newglossaryentry{sample}{name=sample,description=a sample entry}
\newacronym{abc}{abc}{a sample acronym}
\begin{document}
\gls{sample}. \gls{abc}.
\renewcommand{\glsnamefont}[1]{\makefirstuc{#1}}
\printglossary
\renewcommand{\glsnamefont}[1]{\MakeUppercase{#1}}
\printglossary[type=acronym]
\end{document}
Code: Select all
\documentclass{article}
\usepackage[acronym,smallcaps]{glossaries}
\makeglossaries
\newglossaryentry{sample}{name=sample,description=a sample entry}
\newacronym{abc}{abc}{a sample acronym}
\begin{document}
\gls{sample}. \gls{abc}.
\renewcommand{\glsnamefont}[1]{\makefirstuc{#1}}
\printglossary
\renewcommand{\glsnamefont}[1]{\textmd{#1}}
\printglossary[type=acronym]
\end{document}
Nicola Talbot
LaTeX Resources: http://www.dickimaw-books.com/latexresources.html
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
-
- Posts: 52
- Joined: Sat Jun 07, 2008 11:56 am
Capitalize first letter of names in Glossaries list
Oh wow, thanks a lot! You covered just about everything, there!
I found out why I was getting an error with \makefirstuc: there are math symbols in my list of acronyms. E.g. I have an entry like this:
However, I would still like to use \makefirstuc in my list of acronyms as some of my acronyms are displayed in smallcaps and I'd like the first letter to be bigcaps. All other acronyms are defined in capital letters anyway, so it shouldn't look strange.
E.g. I have like DTN, RWP, opnet (this is displayed in small caps, but I want the o to be big).
Just a small annoyance, though. If you know the answer I'd love to hear it!
Thanks again,
Rich
I found out why I was getting an error with \makefirstuc: there are math symbols in my list of acronyms. E.g. I have an entry like this:
Code: Select all
\newacronym{velocity}{$\sigma$}{node velocity}
E.g. I have like DTN, RWP, opnet (this is displayed in small caps, but I want the o to be big).
Just a small annoyance, though. If you know the answer I'd love to hear it!
Thanks again,
Rich
Capitalize first letter of names in Glossaries list
You could trystinkinrich88 wrote: I found out why I was getting an error with \makefirstuc: there are math symbols in my list of acronyms. E.g. I have an entry like this:
Code: Select all
\newacronym{velocity}{$\sigma$}{node velocity}
Code: Select all
\newacronym{velocity}{\null$\sigma$}{node velocity}
Code: Select all
\documentclass{article}
\usepackage[acronym,smallcaps]{glossaries}
\makeglossaries
\newglossaryentry{sample}{name=sample,description=a sample entry}
\newacronym{abc}{abc}{a sample acronym}
\newacronym[sort=sigma]{velocity}{\null$\sigma$}{node velocity}
\begin{document}
\gls{sample}. \gls{abc}. \gls{velocity}.
\renewcommand{\glsnamefont}[1]{\makefirstuc{#1}}
\printglossary
\renewcommand{\glsnamefont}[1]{\textmd{\makefirstuc{#1}}}
\printglossary[type=acronym]
\end{document}
Nicola Talbot
LaTeX Resources: http://www.dickimaw-books.com/latexresources.html
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
-
- Posts: 52
- Joined: Sat Jun 07, 2008 11:56 am
Re: Capitalize first letter of names in Glossaries list
Ace! Thanks a lot. I really enjoy your Glossaries package 

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Capitalize first letter of names in Glossaries list
Now that the problem is solved, please be so kind and mark the topic accordingly as described in Section 3 of the Board Rules. You are not new to the forum so by now you should know that.
Best regards
Thorsten
Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Capitalize first letter of names in Glossaries list
I'm trying to do something slightly different.
I would like to define the acronym in the text using lowercase letters as follows:
sample acronym (SA)
degrees of freedom (DOF)
While recurrences will be displayed as:
SA
DOF
but, at the acronyms list, I would like it to appear with uppercase letters as:
SA - Sample Acronym
DOF - Degrees of Freedom
Using your code with the following slight changes, I can't get it right:
Help will be appreciated.
I would like to define the acronym in the text using lowercase letters as follows:
sample acronym (SA)
degrees of freedom (DOF)
While recurrences will be displayed as:
SA
DOF
but, at the acronyms list, I would like it to appear with uppercase letters as:
SA - Sample Acronym
DOF - Degrees of Freedom
Using your code with the following slight changes, I can't get it right:
Code: Select all
\documentclass{article}
\usepackage[acronym]{glossaries}
\makeglossaries
\newglossaryentry{sample}{name=sample,description=a sample entry}
\newacronym{sa}{SA}{Sample Acronym}
\newacronym{dof}{DOF}{Degrees of Freedom}
\begin{document}
This is a \gls{sample}. And this is a \gls{sa} while another one will be \gls{dof}.
Recurrences are \gls{sa} and \gls{dof}.
\renewcommand{\glsnamefont}[1]{\makefirstuc{#1}}
\printglossary
\printglossary[type=acronym,style = super]
\end{document}