Latest news 2024-10-15: New blog post: Tales for Our Times Book Launch.

glossaries package FAQ

\glssee at the end of the document doesn’t work if there’s no text on the final page. 🔗

For example:

\documentclass{article}

\usepackage{glossaries}

\makeglossaries
\newglossaryentry{sample1}{name={sample1},description={a test}}
\newglossaryentry{sample2}{name={sample2},description={a test}}

\begin{document}
\gls{sample2}
\printglossaries
\newpage
\glssee{sample1}{sample2}
\end{document}
This is due to the delayed write, which is lost because there’s no content on the final page. The delayed write (rather than an immediate write) is necessary to ensure that the page number is correct. The same problem occurs with \label and \index (and anything else that similarly uses a delayed write without producing any content on the page). For example:
\documentclass{article}

\begin{document}
Test\newpage
\label{test-label}
\end{document}
Note that (as from v4.12) this doesn’t occur with \glsadd, which additionally inserts empty content, so if the document is changed to:
\documentclass{article}

\usepackage{glossaries}

\makeglossaries
\newglossaryentry{sample1}{name={sample1},description={a test}}
\newglossaryentry{sample2}{name={sample2},description={a test}}

\begin{document}
\gls{sample2}
\printglossaries
\newpage
\glsadd{sample1}
\end{document}
Then the indexing does work and you will end up with a two-paged document.

This example is a bit contrived as there’s no benefit in the \newpage. If you actually want a blank page 2 then you’d need some empty content following the page break and the problem would go away. However a similar situation can occur if the final page of a document consists solely of floating content. (It was for this reason that \glsadd was modified in v4.12 to switch to horizontal mode unless it occurs in the preamble.)

Since \glssee doesn’t depend on the page number, the simplest solution is to move it to the preamble.

2021-09-20 20:57:59


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

Category: glossaries package
Topic: Unexpected Output in the Glossaries