I use the package glossaries-extra
and address the same terms multiple times in my writing. I needed to have control over what page numbers appear in my glossaries and found this thread.
The solution linked above excludes the terms not marked with >
from the glossary altogether. Is there a way to include all the terms mentioned in a document but provide page numbers only for the marked instances?
Thank you in advance for any help!
\documentclass[10pt]{article}
\usepackage[colorlinks=true]{hyperref}
\usepackage[acronyms]{glossaries-extra}
\setabbreviationstyle[acronym]{nolong-short}
\makeglossaries
\GlsXtrSetDefaultGlsOpts{noindex}
\GlsXtrSetAltModifier{>}{noindex=false}
% Used in text, not marked as `>` -- add to glossary without page number
\newglossaryentry{charger}{
name={charger},
description={A device for charging mobile phones}}
% Used in text, marked as `>` -- add to glossary with page number
\newacronym{usb}{USB}{Universal Serial Bus}
% Not used in text -- do not add to glossary
\newacronym{api}{API}{Application Programming Interface}
\begin{document}
\section*{In English}
The \gls{charger} has three \glsxtrfull>{usb} ports.
\printglossaries
\end{document}
Desired result:
Edit
Updated my MWE and included the picture of a glossary that I would like to have.
Background: I have a long list of term definitions. Collaborators write different chapters and use different terms, marking some term occurrences with >
to add page numbers to glossaries.
I compile the final document and need to make sure that all used terms are included in the glossary, even those that are not originally marked with >
.
As a result, I either need to have a mechanism to include all used terms (and only those marked with >
will have page numbers).
If it is not possible, I need to somehow automatically identify which used terms have no single occurrence marked with >
and mark them so that they appear in the glossary. Of course, I can find unmarked terms manually, but it will take hours.