# How to get acronyms entries in uppercase letters and capitalize only the first letter of the entries from the glossary?

I found a lot of information on this forum about how to present the entries into a glossary (uppercase, lowercase, first letter capitalized); but I don't understand how to have two different styles for the acronyms list and the glossary, and present the entries differently. Here is the code I use to capitalize the first letter into the glossary; but this affects the acronym list and the glossary. It's OK for the glossary, but I want the acronym entries in uppercase for the whole words...

Here is a full MWE...

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[acronym,shortcuts,automake,nopostdot]{glossaries}

\usepackage{glossary-tree}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Capitalize the first letter of the entry %%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\ignore}[1]{}

\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\capitalize}{>{\SplitList{~}}m}
{
\seq_clear:N \l_capitalize_words_seq
\ProcessList{#1}{\CapitalizeFirst}
\seq_use:Nn \l_capitalize_words_seq { ~ }
}
\NewDocumentCommand{\CapitalizeFirst}{m}
{
\capitalize_word:n { #1 }
}

\sys_if_engine_pdftex:TF
{
\cs_set_eq:Nc \capitalize_tl_set:Nn { protected@edef }
}
{
\cs_set_eq:NN \capitalize_tl_set:Nn \tl_set:Nn
}

\cs_new_protected:Nn \capitalize_word:n
{
\capitalize_tl_set:Nn \l_capitalize_word_tl { #1 }
\seq_if_in:NfTF \g_capitalize_exceptions_seq { \tl_to_str:n { #1 } }
% exception word
{ \seq_put_right:Nn \l_capitalize_words_seq { #1 } } % exception word
% to be uppercased
{ \seq_put_right:Nx \l_capitalize_words_seq { \tl_mixed_case:V \l_capitalize_word_tl } }
}
\cs_generate_variant:Nn \tl_mixed_case:n { V }
\NewDocumentCommand{\AppendToList}{m}
{
\clist_map_inline:nn { #1 }
{
\seq_gput_right:Nx \g_capitalize_exceptions_seq { \tl_to_str:n { ##1 } }
}
}
\cs_generate_variant:Nn \seq_if_in:NnTF { Nf }
\seq_new:N \l_capitalize_words_seq
\seq_new:N \g_capitalize_exceptions_seq
\ExplSyntaxOff

\renewcommand{\glsnamefont}[1]{\capitalize{#1}}

%%%%%%%%%%%%%%%%%%

\makeglossaries

\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited for
scientific documents}
}

\newglossaryentry{maths}
{
name=mathematics,
description={Mathematics is what mathematicians do}
}

\newglossaryentry{formula}
{
name=formula,
description={A mathematical expression}
}

\newacronym{gcd}{GCD}{Greatest Common Divisor}

\newacronym{lcm}{LCM}{Least Common Multiple}

\begin{document}

The \Gls{latex} typesetting markup language is specially suitable
for documents that include \gls{maths}. \Glspl{formula} are
rendered properly an easily once one gets used to the commands.

Given a set of numbers, there are elementary methods to compute
its \acrlong{gcd}, which is abbreviated \acrshort{gcd}. This
process is similar to that used for the \acrfull{lcm}.

\printglossary[type=\acronymtype]

\printglossary

\end{document}

• Please provide a full MWE. From what you have written in question, I guess you are looking for commands \setglossarystyle, \setacronymstyle and such. If so, they are described in package docs. And thumbs up for using ExplSyntax ;) Sep 21 '20 at 14:43
• Thanks ; I edited my previous message providing a full MWE. \setacronymstyle{short-sc-long} doesn't work for me with \usepackage[style=tree]{glossaries-extra} ? Sep 24 '20 at 20:28
• Well, the part with Expl3 definition is too complex for me, but you might look at this question: tex.stackexchange.com/questions/562957/… where some else had similar requirement, but he just created new abbreviation (acronym) style. I think you could reuse most of the code there, and have different style for your main glossary. All the same you could translate that to Expl3 if you like. Sep 25 '20 at 7:09
• Thanks ! I get the answer below... Aug 6 '21 at 16:38