Latest news 2024-09-23: new blog post "Tales for Our Times: Raising Funds and Awareness for St Martins Housing Trust".

glossaries package FAQ

How do I change the page numbers to another type of number in the glossary page lists? 🔗

The location list shown after each entry in the glossary defaults to the list of page numbers where the entry was indexed in the document. The location counter determines those numbers. By default, the location counter is the page counter. You can change the default location counter with the counter package option. For example, to use the section counter instead:

\usepackage[counter=section]{glossaries}
You can also change it later in the document with \setupglossaries. For example:
\setupglossaries{counter=section}
This will change the location counter from that point onwards. Any indexing that has already occurred, won’t be affected.

It’s also possible to change the location counter for a specific instance using the counter option in the optional argument of commands like \gls. For example:

\gls[counter=section]{label}

You can set the default counter for a specific glossary when you define the glossary. For example, the following will set the default location counter to the equation counter for all entries in this new glossary:

\newglossary*{notation}{Notation}[equation]

Obviously, if you use a counter such as equation, you need to take care if you try indexing an entry outside of the context of that counter. Such as in text mode where the counter is equation.

The glossaries-extra package additionally provides the package options: equations, which automatically switches the location counter to equation when in a numbered equation environment, and floats, which will automatically switch to the corresponding counter, such as figure or table, when indexing occurs in a float. (Bear in mind that the float counter is incremented by \caption so any indexing within a float before the caption will have an incorrect location if the corresponding float counter is used.)

With glossaries-extra, it’s also possible to redefine the hook \glslinkpresetkeys to set the counter according to some condition, such as for a particular value of the category field.

2023-07-08 13:56:08


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

Category: glossaries package
Topic: Glossary Formatting