glossaries package FAQ

Why does glossaries create a file with the extension .glsdefs? 🔗

When the glossary is displayed with \printglossary the entry information (such as the name, description and symbol) has to be accessed in order for it to be shown. If you have a glossary at the start of your document, but only define the entries later then the information isn’t available when the glossary is displayed. In order to make the information available at the start of the document, the information has to be saved at the end of the document (in the .glsdefs file) so it can be read in at the start of the document on the next LaTeX run.

If you define all your entries in the preamble then the information will be available for the entire document, so there’s no need to save it. Therefore the creation of the .glsdefs file is only triggered if you define an entry within the document environment.

If at all possible, it’s best to avoid defining entries within the document environment. Not all information can be saved to the .glsdefs file. In particular, with just the base glossaries the see field isn’t saved. It can also interfere with both the base acronym styles and the glossaries-extra abbreviation styles (since the entry information is written using the generic \newglossaryentry command).

If all your \printglossary commands (or \printglossaries) are at the end of the document, you may want to consider using glossaries-extra with the docdef=restricted option.

See the section Drawbacks With Defining Entries in the Document Environment in the user manual for further details.

Note that if you want to put \loadglsentries (or \input) in the begin document hook in order to load a file containing glossary definitions at the start of the document, then this will trigger the creation of the .glsdefs file unless you append to the hook before loading glossaries. Alternatively use glossaries-extra with docdef=restricted.

2020-07-01 13:16:12

Alternative link:

Category: glossaries package
Topic: Defining Terms