1

I am eperimenting with the glossaries-extra package and use bib2gls. Currently every abbreviation used in my document via \gls (for example \gls{gpu}) shows the full form on first use (that I like) but also generates an entry in the glossary, even if the abbreviation is used only exactly once.

Reading the documentation and usage guides on glossaries and glossaries-extra have not helped me in this regard. From my previous experience, the package acro has a package option single=true to achieve this but maybe you have a solution before I consider switching (at least for abbreviations).

Question

Is it possible to omit single uses of abbreviations from the glossary (shown via \printunsrtglossaries for example)?

1

I have found a way to filter the output of \printunsrtglossaries via the printunsrtglossaryhandler hook.

This particular solution requires the bib2gls with the extra parameter --record-count: bib2gls --record-count <filename>.

Adding this to the preamble will then filter by record count:

\renewcommand{\printunsrtglossaryhandler}[1]{%
  \ifthenelse{\GlsXtrTotalRecordCount{#1}>1}%
  {\glsxtrunsrtdo{#1}}%
  {}%
}

EDIT: A significant drawback is the compilation failure in case the resulting glossary is empty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.