I often use the term range expansion in a text. Thus I'd like to abbreviate it using RE. When it first occurs in a chapter, The abbreviation should be expalained like this: Range expansion (RE). In my glossary I'd like to have an entry for both, RE and Range expansion. To make it easier for the reader to find the explanation for RE, I linked the description to the entry for Range expansion using \gls
:
\newacronym{RE}{RE}{\gls{RangeExpansion}}
\newglossaryentry{RangeExpansion}{
name = {range expansion},
description = {A range expansion ...}
}
Now I can use \gls{RE}
in my text. The first time this happens each chapter, range expansion (RE) and afterwards it uses RE. At the beginning of a chapter I used the term at the beginning of a sentence – that made me use \Gls{RE}
, since I'd like the sentence to start with an uppercase letter. But using \Gls
resulted in the following error messages:
Missing \endcsname inserted \Glspl{RE}
and
glossaries: Glossary entry `\MakeUppercase {R}angeExpansion' has not
been defined. \Glspl{RE}\index
When I don't link the explanation for RE
, \Gls
works fine:
\newacronym{RE}{RE}{range expansion}
\newglossaryentry{RangeExpansion}{
name = {range expansion},
description = {A range expansion ...}
}
I also tried using \newacronym{RE}{RE}{\Gls{RangeExpansion}}
, but this didn't work at all.
How do I have to call the Link to RangeExpansion
within the description of the acronym, so that \gls
and \Gls
work?
Best Answer
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 theRE
entry in the list of acronyms and to theRangeExpansion
entry in the main glossary.A better approach, which overcomes both the above issues is to do something like:
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
: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 ofhyperfirst=false
option.