6

I am compiling the following document with glossaries v4.11:

\documentclass[a4paper]{report}

\usepackage{glossaries}
\makeglossaries

\newglossaryentry{foo}{name={foo},description={Foo}}
\newglossaryentry{bar}{name={bar},description={Bar}}
\newglossaryentry{baz}{name={baz},description={Baz}}

\begin{document}

\gls{foo} \glsadd{bar}

\printglossaries

\glsaddallunused

\end{document}

The entries "foo" and "baz" appear as intended, but there is a spurious comma in the "bar" entry that was added using \glsadd:

glossary with spurious comma

Removing \glsaddallunused fixes the problem, but then the "baz" entry does not appear any more.

5

The entry bar is added twice without using it by \glsadd{bar} and \glsaddallunused. In the description of the latter, the documentation says:

If you want to use \glsaddallunused, it's best to place the command at the end of the document to ensure that all the commands you intend to use have already been used. Otherwise you could end up with a spurious comma or dash in the location list.

Apparently, this also applies, when an entry is added twice.

Possible workaround: Using bar by putting it in an unused box: \sbox0{\gls{bar}} or \glsunset{bar} to mark it used:

\documentclass[a4paper]{report}

\usepackage{glossaries}
\makeglossaries

\newglossaryentry{foo}{name={foo},description={Foo}}
\newglossaryentry{bar}{name={bar},description={Bar}}
\newglossaryentry{baz}{name={baz},description={Baz}}

\begin{document}

\gls{foo} \glsadd{bar}\glsunset{bar}

\printglossaries

\glsaddallunused

\end{document}

Result

  • 1
    @SörenSchulze \sbox0{\gls{bar}} is intended as addition to \glsadd{bar}. The command for this purpose is \glsunset if I have understood the documentation correctly. Answer updated. – Heiko Oberdiek Jul 2 '15 at 11:33

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.