# Spurious comma by use of \glsaddallunused

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}

\printglossaries

\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:

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

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}


• @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. Jul 2 '15 at 11:33