The first letter upper case commands, such as \Gls
, use \makefirstuc
which requires its argument to either be just text or in the form \\
command{
text}
(e.g. \makefirstuc{\emph{text}}
is equivalent to \emph{\MakeUppercase{t}ext}
). What your code is attempting to do is \makefirstuc{\gls{RangeExpansion}}
which becomes \gls{\MakeUppercase{R}angeExpansion}
and the error occurs because \MakeUppercase{R}angeExpansion
is an invalid label.
Another problem with your definition is that you get nested links where \gls{RE}
is attempting to be a hyperlink both to the RE
entry in the list of acronyms and to the RangeExpansion
entry in the main glossary.
A better approach, which overcomes both the above issues is to do something like:
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage[acronym,description]{glossaries}
\makeglossaries
% Define command to create linked entries
% Syntax:
% \newlinkedacr[options]{entry-label}{acr-label}{short}{long}{description}
\newcommand*{\newlinkedacr}[6][]{%
\newglossaryentry{#2}{name={#5},description={#6},#1}%
\newacronym[description={\gls{#2}}]{#3}{#4}{#5}%
}
\newlinkedacr
{RangeExpansion}% main entry label
{RE}% acronym label
{RE}% abbreviation
{range expansion}% long form
{A range expansion etc}% description
\begin{document}
First use: \gls{RE}. Subsequent use: \gls{RE}.
\glsresetall
First use: \Gls{RE}. Subsequent use: \Gls{RE}.
\printglossaries
\end{document}

Here, the description in the acronym list forms a hyperlink to the entry in the main glossary. The acronyms in the main body of the document link to the entry in the list of acronyms. If you prefer the long form in the first use to link to the main glossary rather than the list of acronyms, then this can be achieved although it's more complicated. The following example requires at least v4.0 of glossaries
:
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage[acronym,hyperfirst=false]{glossaries}
\makeglossaries
% Define command to create linked entries
% Syntax:
% \newlinkedacr[options]{entry-label}{acr-label}{short}{long}{description}
\newcommand*{\newlinkedacr}[6][]{%
\newglossaryentry{#2}{name={#5},description={#6},#1}%
\newacronym[description={\glshyperlink{#2}},user1={#2}]{#3}{#4}{#5}%
}
\renewcommand*{\CustomAcronymFields}{name={\the\glsshorttok}}
\renewcommand*{\SetCustomDisplayStyle}[1]{%
\defglsentryfmt[#1]{%
\ifdefempty\glscustomtext
{%
\ifglsused\glslabel
{% subsequent use
\glsgenentryfmt
}%
{% First use
% Get the label of the corresponding main entry (stored in
% user1 field)
\edef\mainlabel{\glsentryuseri{\glslabel}}%
% If empty, then there's no linked entry
\ifdefempty\mainlabel
{% use generic format
\glsgenentryfmt
}%
{%
\glsifplural
{% plural form
\glscapscase
{% no case change
\glshyperlink[\glsentrylongpl{\glslabel}\glsinsert]{\mainlabel}%
\space (\glsentryshortpl{\glslabel})%
}%
{% first letter uppercase
\glshyperlink[\Glsentrylongpl{\glslabel}\glsinsert]{\mainlabel}%
\space (\glsentryshortpl{\glslabel})%
}%
{% all caps
\glshyperlink[\MakeTextUppercase{%
\glsentrylongpl{\glslabel}\glsinsert}]{\mainlabel}%
\MakeTextUppercase{\space (\glsentryshortpl{\glslabel})}%
}%
}%
{% singular form
\glscapscase
{% no case change
\glshyperlink[\glsentrylong{\glslabel}\glsinsert]{\mainlabel}%
\space (\glsentryshort{\glslabel})%
}%
{% first letter uppercase
\glshyperlink[\Glsentrylong{\glslabel}\glsinsert]{\mainlabel}%
\space (\glsentryshort{\glslabel})%
}%
{% all caps
\glshyperlink[\MakeTextUppercase{%
\glsentrylong{\glslabel}\glsinsert}]{\mainlabel}%
\MakeTextUppercase{\space (\glsentryshort{\glslabel})}%
}%
}%
% add main entry to glossary
\glsadd{\mainlabel}%
}%
}%
}%
{% \glsdisp used
\glscustomtext
}%
}%
}
\SetCustomStyle
\newlinkedacr
{RangeExpansion}% main entry label
{RE}% acronym label
{RE}% abbreviation
{range expansion}% long form
{A range expansion etc}% description
\begin{document}
First use: \gls{RE}. Subsequent use: \gls{RE}.
\glsresetall
First use: \Gls{RE}. Subsequent use: \Gls{RE}.
\printglossaries
\end{document}
This produces:

where the first use long form hyperlinks to the entry in the main glossary, the subsequent use acronyms link to the entry in the list of acronyms, and the description in the list of acronyms links to the corresponding entry in the main glossary.
If you have entries in the main glossary that aren't link in this way to the list of acronyms, you may need to do \glsunsetall[main]
to counteract the effect of hyperfirst=false
option.
\glsentrytext
instead of\gls