General ⇒ glossaries | Capitalize first Character in final List
glossaries | Capitalize first Character in final List
I have been having some trouble in trying to capitalize just the first character of the acronym in the final listing alone.
i.e. I want the acronym to be small in the normal text but for the List of Acronym, the listing should have the first character of each word in the text to be capitalized.
e.g. a sample acronym (ABC)
Whereas, in the listing (\printglossaries) it should be:
ABC A Sample Acronym
Any help or lead in the right direction would be great
Thanks
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
glossaries | Capitalize first Character in final List
Code: Select all
\documentclass{article}
\usepackage{glossaries}
\renewcommand*{\CustomAcronymFields}{%
name={\the\glsshorttok},%
description={\noexpand\makefirstuc{\the\glslongtok}},%
first={\noexpand\acrfullformat{\the\glslongtok}{\the\glsshorttok}},%
firstplural={\noexpand\acrfullformat
{\the\glslongtok\noexpand\acrpluralsuffix}{\the\glsshorttok}}%
text={\the\glsshorttok},%
plural={\the\glsshorttok\noexpand\acrpluralsuffix}%
}
\SetCustomStyle
\makeglossaries
\newacronym{ABC}{ABC}{a sample acronym}
\begin{document}
Test: \gls{ABC}. \gls{ABC}.
\printglossaries
\end{document}
Nicola Talbot
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
Re: glossaries | Capitalize first Character in final List
Thanks a lot for your response.
I tried playing around with \makefirstuc and \glsmakefirstuc or \xmakefirstuc.
Though the description field only seems to apply it to the first word in the acronym.
Is there any way to make each word in the list of acronym start with an upper case.
e.g. ABC A Sample Acronym, should be in the listing, whereas the text will have a sample acronym.
Thanks for your help,
glossaries | Capitalize first Character in final List
Code: Select all
\documentclass{article}
\usepackage{glossaries}
\usepackage{etoolbox}
\DeclareListParser{\wordlist}{ }%
\DeclareRobustCommand{\capitalise}[1]{%
\def\addspace{}%
\renewcommand*{\do}[1]{\addspace\makefirstuc{##1}\def\addspace{ }}%
\wordlist{#1}%
}
\renewcommand*{\CustomAcronymFields}{%
name={\the\glsshorttok},%
description={\capitalise{\the\glslongtok}},%
first={\noexpand\acrfullformat{\the\glslongtok}{\the\glsshorttok}},%
firstplural={\noexpand\acrfullformat
{\the\glslongtok\noexpand\acrpluralsuffix}{\the\glsshorttok}}%
text={\the\glsshorttok},%
plural={\the\glsshorttok\noexpand\acrpluralsuffix}%
}
\SetCustomStyle
\makeglossaries
\newacronym{ABC}{ABC}{a sample acronym}
\begin{document}
Test: \gls{ABC}. \gls{ABC}.
\printglossaries
\end{document}
Nicola Talbot
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
Re: glossaries | Capitalize first Character in final List
Thanks a lot, that works just fine for my picky requirements!
Never thought about trying with a capitalize and creating custom command, as was done in the above code.
Great package!