\printglossaries and friends insert the content of files created by makeglossary (or \null if that does not exist), see \@print@glossary in glossaries.sty. makeglossaries initializes the respective files with \\null\n before it executes xindy or makeindex to make really, really sure that something is inserted at the place of \printglossaries. The documentation states that as well:

While the external files are missing, these commands will just do \null for each missing glossary to assist dic- tionary style documents that just use \glsaddall without inserting any text.

This is a problem in some situations where this \null changes the output to the worse (e.g., glossaries: count the number of used abbreviations (i.e. those to be output by \printacronyms)). Apparently I am not the only one noticing this caveat because someone worked around it by jumping through a few hoops: https://github.com/egraff/ult-base/blob/master/texmf-tds/tex/latex/ult-base/ult-printglossary.sty

Why does glossaries do that at all (I don't get the explanation in the manual)? Are there better workarounds?

  • 1
    If a document contains only a printglossary command it would be a problem if it wouldn't create a page. But instead of hardcoding the \null it would be better if there was some option e.g. forcepage or if the command could be redefined. Make a feature request. Jan 30, 2020 at 7:35
  • Why would that be a problem? If there is nothing to print... then don't print anything? Report sent (but requires approval by Nicola). Will post a link/further updates as they become available.
    – stefanct
    Jan 30, 2020 at 12:17
  • 1
    if there are no pages some stuff can not be written to the aux-file as it needs a "shipout". Jan 30, 2020 at 12:21


Your Answer

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

Browse other questions tagged or ask your own question.