glossaries-extra package FAQ

My document only contains \printunsrtglossary with no section header and no PDF is created. 🔗

Suppose you have a document that looks like:

\documentclass{article}

\usepackage[record]{glossaries-extra}

\GlsXtrLoadResources[src=example-glossaries-brief,
 selection=all]

\begin{document}
\printunsrtglossary
\end{document}

On the first LaTeX run this will just create a single-paged document with the glossary section header but no glossary content. This is sufficient for the complete document build (LaTeX+bib2gls+LaTeX). A problem occurs if you suppress the section heading by redefining \glossarysection to do nothing:

\renewcommand{\glossarysection}[2][]{}

Now there’s no text on the first LaTeX run (before the .glstex file has been created). This means that no PDF file can be created and the .aux file simply contains \relax. There’s no information for bib2gls so the document build fails.

The analogous \printglossary inserts \null if the glossary file isn’t present to prevent this situation. (Why does \printglossary use \null when the glossary file is missing?) In this case, the section heading is inside the glossary file so there’s no text at all to display if the document simply contains \printglossary. This makes it far more problematic and there’s a greater need for the workaround that uses \null.

In the case of \printunsrtglossary, the only time this becomes a problem is when the document consists solely of a headerless glossary. This is far less likely to occur so adding \null to \printunsrtglossary doesn’t have a sufficient benefit to outweigh the possible problems it might cause.

If you require this particular situation, you will need to insert something (such as \null or \mbox{}) to ensure a page is output.

2020-07-14 19:33:08


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

Category: glossaries-extra package
Topic: Problems related to selection and indexing with bib2gls