# How to display the unused acronyms and just the used glossary

I am using separated lists for acronyms and for the glossary (definitions). I want to display all the acronyms even the unused (without the number list will be great. I guess we need to use nonumberlist option). However, I want to just display the used glossary with the number list. This is a portion of my code:

\usepackage[xindy,acronym,toc]{glossaries}
\makeglossaries
.
.
.
\printglossary[type=\acronymtype,nonumberlist] % displays the Acronyms without the number list
\glsaddall % displays all the entries before it
\printglossary %displays the glossary


But it does not do what I want for the glossary. It displays even the unused item in the glossary and adds a weird number list to all the items (the page number of the acronyms !)

How can I do so?

Thank you

\glsaddall has an optional argument, which is a comma-separated list of glossaries. The default is all defined glossaries. So if you only want to add all the entries in a particular glossary, you just need to specify that glossary's label in the optional argument.

This command iterates over each glossary in the list and does \glsadd{label} for each entry in that list. This indexes each entry with the current location (which defaults to the current page number). This means that you get the same number for every entry appearing in the location list. (If you have nonumberlist then this isn't a problem as that suppresses the location list.) This is the reason why you have a spurious number in your list.

There is a similar command \glsaddallunused which works like \glsaddall (and again has an optional argument) but it does \glsadd[format=glsignore]{label} for entries that haven't been marked as used, and does nothing for entries that have been marked as used. The glsignore format is a special location format that simply ignores its argument. Since both makeindex and xindy require a location (because they're both general purpose indexing applications), this will be added to the location list as \glsignore{location}. If it's the only location in the list, then it won't be noticeable. However, if there are other locations in the list, then you will end up with a spurious comma. So it's always best to put \glsaddallunused at the end of the document if it's required:

\documentclass{article}

\usepackage[xindy,acronym,toc]{glossaries}
\makeglossaries

\begin{document}
\gls{lorem} and \gls{avf}.

\printglossary
\printglossary[type=\acronymtype]
\end{document}


The above example uses the dummy entries provided with the glossaries package and produces a two-paged document, which starts:

Only the entries that have actually been used in the document have a location (1 in this case as they're all on page 1).

If you prefer to switch to glossaries-extra and bib2gls then glsignore is recognised as a special location format, which indicates that the entry should be selected but no location is added to the location list. However, in this case you can just use the selection=all option to select all entries, regardless of whether or not they've been used in the document. (In fact, iterative commands like \glsaddall and \glsaddallunused don't work with bib2gls as the lists are always empty on the first LaTeX run.)

The bib2gls equivalent to the above is:

\documentclass{article}

\usepackage[record,% using bib2gls
postdot,% add a full stop after the descriptions
acronym]{glossaries-extra}

src={example-glossaries-brief}% data provided in example-glossaries-brief.bib
]
src={example-glossaries-acronym},% data provided in example-glossaries-acronym.bib
selection=all
]

\begin{document}
\gls{lorem} and \gls{avf}.

\printunsrtglossary
\printunsrtglossary[type=\acronymtype]
\end{document}

• Thank you very much for this extended explication. It does exactly what I need.
– Lyes
Sep 6 '18 at 16:45