I would like to use all the "low level" macros corresponding to all \gls like commands (\gls, \Gls, \GLS, \glspl, \Glspl, \glsname, glssymbol, etc.): like \glo@myentry@name, \glo@myentry@symbol (with myentry, an already defined glossary entry key).

But I can't find all their names/constructions in the glossary documentation (I probably missed it !).

I only found this two above for name and symbol...


  • What is the complete list of all "low level" macros corresponding to all \gls like commands? (EDIT 1: "all" the macros it's maybe unecessary, but the most common would be great, like those mentioned above).
  • Or, where can I find this list?

Why I need that?

Because, thanks to Marijn's answers, the use the of "low level" macros is the only way I have to write the "output" of the \gls like commands to a text file.

EDIT 1 (Feb 21): I found the following in source code (with label, an already defined glossary entry key):

  • \glo@<label>@text
  • \glo@<label>@name
  • \glo@<label>@desc
  • \glo@<label>@symbol

Let's assume that's enough for my need.

However, I can't find the equivalent of capitalized or plural forms...

Any idea?

EDIT 2 (March 05)
I have the audacity to complement Nikola Talbot's answer which implicitly states that the case changing commands (\GLS, \Gls,...) can't be expanded and so cannot be written to a file (I had confirmation of this by Nicola Talbot in person).

  • 1
    you should not expect to find a documented list of undocumented internal macros you have the full source of the package available and they will be in the source (of course using internal commands means the code may break on any update) Commented Feb 20, 2022 at 12:11
  • @David Thank you for your comment. When you talk about "the source", do you mean something like a "glossary.sty"?
    – zetyty
    Commented Feb 20, 2022 at 12:21
  • 1
    yes or the pdf typeset version of the code comments (texdoc glossaries-code) Commented Feb 20, 2022 at 12:25
  • 1
    instead of using undocumented, internal commands it would be much better to make a feature request for a proper user interface. Commented Feb 20, 2022 at 12:30
  • @Ulrike Fischer Thanks for your comment. I don't know how to make a feature request. I contacted Nicola Talbot (maintainer of the glossary package) about this and he told me that it will not be possible to expand the \gls command.
    – zetyty
    Commented Feb 24, 2022 at 20:21

1 Answer 1


The commands used to reference entries are described in section 5 ("Referencing Entries in the Document") of the glossaries user manual (texdoc glossaries or CTAN mirror). The commands you are looking for come under the second item "Those that display text in the document without indexing or applying any additional formatting (Section 5.2)."

The commands described in section 5.1 (including \gls) are all robust and far too complicated to expand to simple text (which is what's required when writing to an external file). These include the whatsit created by indexing, formatting commands, hyperlink, and the post-link hook, which can be used to append information or lookahead (e.g. for a following punctuation character).

The commands described in section 5.2, don't have all this extra baggage, but some of them still have non-expandable content. The ones you need are all the non-case-changing \glsentry... commands, such as \glsentrytext.



 text={sample (next use)},plural={samples (next use)},
 first={sample (first use)},firstplural={samples (first use)},
 description={an example}}

Robust: \gls{sample}, \gls{sample}, \glsfirst{sample},
\glstext{sample}, \glsname{sample}, \glsdesc{sample},
\glssymbol{sample}. Plurals: \glsfirstplural{sample}, \glsplural{sample}.

\typeout{Robust: \gls{sample}, \gls{sample}, \glsfirst{sample},
\glstext{sample}, \glsname{sample}, \glsdesc{sample},
\glssymbol{sample}. Plurals: \glsfirstplural{sample}, \glsplural{sample}.}

Expandable: \glsentryfirst{sample},
\glsentrytext{sample}, \glsentryname{sample}, 
\glsentrysymbol{sample}.  Plurals: \glsentryfirstplural{sample},

Whether or not these cause a problem in expandable contents (such as
writing to a file) depends on whether or not the associated field
has problematic content.

\typeout{Expandable: \glsentryfirst{sample},
\glsentrytext{sample}, \glsentryname{sample}, 
\glsentrysymbol{sample}.  Plurals: \glsentryfirstplural{sample},

You can also save the contents of a field

\typeout{Symbol: \expandonce{\foo}}

Or test first if the field is set:
{Symbol: \glscurrentfieldvalue.
\typeout{Symbol: \expandonce\glscurrentfieldvalue}}
{No symbol.}


This produces the following in the transcript:

Robust: \gls {sample}, \gls {sample}, \glsfirst {sample}, \glstext {sample}, \glsname {sample}, \glsdesc {sample}, \glssymbol {sample}. Plurals: \glsfirstplural {sample}, \glsplural {sample}.
Expandable: sample (first use), sample (next use), sample, an example, \S . Plurals: samples (first use), samples (next use).
Symbol: \S 
Symbol: \S 

Be careful of the last example in the above MWE. If the write is delayed the definition of \glscurrentfieldvalue may have changed by the time the write is actually performed. The conditional \ifglshasfield is described in section 5.12 ("Conditionals").

  • Thank you very much for this "expanded" answer. I didn't know about the \glsletentryfield and \ifglshasfield commands, which would probaly be usefull for my needs. Also, there's another question here that you're probably the most competent to answer if you may consider offering an answer.
    – zetyty
    Commented Feb 27, 2022 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .