# Glossaries Capitalize Every First Letter

How can I get the \Gls{...} command to capitalize the first letter of EACH word, not just the first word?

\documentclass[a4paper,12pt]{article}

\usepackage{glossaries}

\newacronym{tla}{TLA}{three lettered acronym}
\makeglossaries

\begin{document}
\glsfirst{tla}

\Glsfirst{tla}

\end{document}


\Gls-like commands use \makefirstuc to capitalize only the first letter of a sentence.

I've redefined the meaning of \makefirstuc to be the same of \capitalisewords which instead capitalizes all words in a sentence.

So, add this in the preamble

\makeatletter
\let\oldmakefirstuc\makefirstuc
\renewcommand*{\makefirstuc}[1]{%
\mfu@capitalisewords#1 \@nil\mfu@endcap
}
\def\mfu@capitalisewords#1 #2\mfu@endcap{%
\def\mfu@cap@first{#1}%
\def\mfu@cap@second{#2}%
\oldmakefirstuc{#1}%
\ifx\mfu@cap@second\@nnil
\let\next@mfu@cap\mfu@noop
\else
\let\next@mfu@cap\mfu@capitalisewords
\fi
\next@mfu@cap#2\mfu@endcap
}
\makeatother


and everything should be as you want.

Complete MWE:

\documentclass[a4paper,12pt]{article}

\usepackage{glossaries}

\makeatletter
\let\oldmakefirstuc\makefirstuc
\renewcommand*{\makefirstuc}[1]{%
\mfu@capitalisewords#1 \@nil\mfu@endcap
}
\def\mfu@capitalisewords#1 #2\mfu@endcap{%
\def\mfu@cap@first{#1}%
\def\mfu@cap@second{#2}%
\oldmakefirstuc{#1}%
\ifx\mfu@cap@second\@nnil
\let\next@mfu@cap\mfu@noop
\else
\let\next@mfu@cap\mfu@capitalisewords
\fi
\next@mfu@cap#2\mfu@endcap
}
\makeatother

\newacronym{tla}{TLA}{three lettered acronym}
\makeglossaries

\begin{document}

\glsfirst{tla}

\Glsfirst{tla}

\end{document}


Output:

• This is excellent, how would it be possible to ignore words such as: to, or, for, the, and, etc... – Nicholas Hamilton Oct 26 '13 at 2:15
• @ADP this is not simple at all, I think. And I haven't any idea at the moment... – karlkoeller Oct 26 '13 at 3:58
• This is a bit of a hack, I am sure, however it works... \newacronym{tla}{TLA}{three~lettered acronym} prevents the 'lettered' word from being capitalized. Therefore, in each definition, joining 'and', 'to', 'for' etc... to the previous words via ~ does the job. – Nicholas Hamilton Oct 26 '13 at 4:12
• Why does Latex "programming" have to look to chaotic?! – winklerrr Apr 19 '20 at 11:02