[Tex/LaTex] Glossaries Capitalize Every First Letter

glossaries

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}

Best Answer

\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]{%
  \def\gls@add@space{}%
  \mfu@capitalisewords#1 \@nil\mfu@endcap
}
\def\mfu@capitalisewords#1 #2\mfu@endcap{%
  \def\mfu@cap@first{#1}%
  \def\mfu@cap@second{#2}%
  \gls@add@space
  \oldmakefirstuc{#1}%
  \def\gls@add@space{ }%
  \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]{%
  \def\gls@add@space{}%
  \mfu@capitalisewords#1 \@nil\mfu@endcap
}
\def\mfu@capitalisewords#1 #2\mfu@endcap{%
  \def\mfu@cap@first{#1}%
  \def\mfu@cap@second{#2}%
  \gls@add@space
  \oldmakefirstuc{#1}%
  \def\gls@add@space{ }%
  \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:

enter image description here