bib2gls application FAQ
indexonlyfirst
attribute doesn’t work 🔗Consider the following example:
\documentclass{report} \usepackage[record]{glossaries-extra} \GlsXtrLoadResources[src=example-glossaries-acronym,category=abbreviation] \glssetcategoryattribute{abbreviation}{indexonlyfirst}{true} \begin{document} \chapter{Sample} \gls{lid} \chapter{Another Sample} \gls{lid} \printunsrtglossary \end{document}The usual document build sequence LaTeX+bib2gls+LaTeX results in two locations in the location list for the “lid” dummy entry. The
indexonlyfirst
attribute should only index (record) the first use.
The problem here is that the entry isn’t defined on the first LaTeX run. This means that \gls
is unable to determine the category for the entry (since it doesn’t exist yet, from LaTeX’s point of view). So \gls
is unable to pick up the attribute. This means that an extra bib2gls call is needed.
Here’s the sequence starting from a clean directory (no aux or glstex files) where the document is saved in the file myDoc.tex:
pdflatex myDoc
The aux file is created containing two records for “lid”.bib2gls myDoc
The glstex file is created with the location list for “lid” containing two locations.pdflatex myDoc
The aux file is created containing one record for “lid” but the location list contains two locations (obtained from the glstex file created in the previous step).bib2gls myDoc
The glstex file is created with the location list for “lid” containing one location.pdflatex myDoc
The aux file is created containing one record for “lid” and the location list contains one location (obtained from the glstex file created in the previous step).
2023-01-31 21:48:15
Permalink: https://www.dickimaw-books.com/faq.php?id=272
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=b2gindexonlyfirstattr
Category: bib2gls application
Topic:
Indexing (Recording)