glossaries package FAQ

How do I change the way the text appears when I use commands like \gls for a given glossary? 🔗

As from version 4.0, you can use \defglsentryfmt (see How do I change the way the text appears when I use commands like \gls?) to change the way glossary entries appear when using commands like \gls or \glsdisp. See the section Changing the format of the link text in the user manual for further information.

Versions prior to v4.0:

If you have multiple glossaries, changing \glsdisplayfirst and \glsdisplay (see How do I change the way the text appears when I use commands like \gls?) will change the way all glossary entries appear when using commands like \gls. If you only want the change to affect entries for a given glossary, then you need to use \defglsdisplay and \defglsdisplayfirst instead of redefining \glsdisplay and \glsdisplayfirst.

Both \defglsdisplay and \defglsdisplayfirst take two arguments: the first is the glossary name and the second is how the term should be displayed when it is invoked using commands like \gls and \glspl. This is similar to the way \glsdisplayfirst was redefined in How do I change the way the text appears when I use commands like \gls? except that you must use ##1, ##2, ##3 and ##4 instead of #1, #2, #3 and #4.

For example, suppose you have created a new glossary called notation and you want to change the way the entry is displayed on first use so that it includes the symbol, you can do:

\defglsdisplayfirst{notation}{##1##4 (denoted ##3)}
Now suppose you have defined an entry as follows:
\newglossaryentry{set}{type=notation,
name=set,
description={A collection of objects},
symbol={$S$},
}
The first time you reference this entry using \gls it will be displayed as: “set (denoted S)” (similarly for \glspl and the other variants).

2020-07-01 14:15:28


Permalink: https://www.dickimaw-books.com/faq.php?id=54
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=defglsdisplay

Category: glossaries package
Topic: Referencing Terms