glossaries package FAQ

How can automated build tools determine whether or not to run makeglossaries etc? 🔗

The glossaries package writes information to the aux file that can be used for this purpose. This information is described in the section Note to Front-End and Script Developers in the glossaries user manual. These no-op commands were specifically provided for external tools and do nothing in the LaTeX document.

Please provide a method for your tool to search for those commands in the aux file rather than encouraging hacks that could break in future releases.

The existence of the command \@istfilename{basename.ext} indicates that makeindex or xindy is required. If the file extension ext is xdy then xindy is required with -M basename otherwise makeindex is needed with -s basename.ext.

Each non-ignored glossary that has been defined in the document is identified with \@newglossary{glossary-label}{log}{out-ext}{in-ext} where in-ext is the extension of the indexing application’s input file (the output file from the glossaries package’s point of view), such as glo, out-ext is the extension of the indexing application’s output file (the input file from the glossaries package’s point of view), such as gls, and log is the extension of the indexing application’s transcript file, such as glg.

Note that the \@newglossary lines are always written, regardless of the indexing method. The existence of \@newglossary in the aux file is not an indication of whether or not to use makeindex/xindy. Check for the \@istfilename file to determine this. With glossaries-extra there is also the possibility of a hybrid \printnoidxglossary and \printglossary combination. This is indicated by \glsxtr@makeglossaries, which lists the labels of the glossaries that need to have their files created by makeindex/xindy.

Once you have determined that makeindex/xindy is required, you can then test if jobname.out-file doesn’t exist or is older than jobname.in-file which will indicate that the indexing application needs to be run if jobname.in-file exists. If the input file doesn’t exist then there’s no corresponding \printglossary or \nofiles has been used.

Additional information, such as the letter/word order, language and codepage can also be obtained from the aux file from the commands \@glsorder{order}, \@xdylanguage{glossary-label}{language} and \@gls@codepage{code-page}.

If \glsxtr@resource{options}{basename} is found, then bib2gls is required. This is more complicated if you want to find out if the glstex files requiring updating as you’ll need to parse options for src={bib list} to find the list of bib files. The indexing output file in this case is basename.glstex. In general the simplest thing to do is just run bib2gls if \glsxtr@resource is found rather than trying to work out if the indexing information has changed.

2023-04-16 12:59:52


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

Category: glossaries package
Topic: Sorting and Collating Entries