% arara: pdflatex % arara: pdflatex % arara: makeglossaries % arara: pdflatex \documentclass{report} \usepackage[colorlinks]{hyperref} \usepackage{glossaries-extra} \GlsXtrEnableEntryUnitCounting{abbreviation}{2}{chapter} \makeglossaries \newabbreviation{html}{HTML}{hypertext markup language} \newabbreviation{xml}{XML}{extensible markup language} \newabbreviation{css}{CSS}{cascading style sheet} \newglossaryentry{sample}{name={sample},description={sample}} \newcommand*{\lastruncount}[1]{% Overall number of times the \texttt{#1} entry is used in this chapter: \glsentryprevcount{#1}. (Information obtained from previous run.)% } \newcommand*{\currentruncount}[1]{% Number of times the \texttt{#1} entry has been used this chapter so far: \glsentrycurrcount{#1}.% } \newcommand*{\triggertest}[1]{% Normal usage of \texttt{\char`\\gls} \glsxtrifcounttrigger{#1}{has}{hasn't} been suppressed for the \texttt{#1} entry in this chapter.% } \begin{document} This is a sample document that uses entry counting per unit. The unit entry counting has been enabled on the \texttt{abbreviation} category. The unit has been set to ``\glsgetcategoryattribute{abbreviation}{unitcount}''. This means that abbreviations will only be added to the glossary if they are used more than $n$ times per \glsgetcategoryattribute{abbreviation}{unitcount}, where in this document $n$ has been set to \glsgetcategoryattribute{abbreviation}{entrycount}. Entries in other categories behave as normal. \chapter{Sample} \lastruncount{xml} Used once: \gls{html}. Used twice: \gls{xml} and \gls{xml}. Used three times: \gls{css} and \gls{css} and \gls{css}. Used once but this entry is in the ``general'' category which doesn't have the entry unit counting set: \gls{sample}. \currentruncount{xml} \triggertest{xml} \currentruncount{css} \triggertest{css} \chapter{Another Sample} Used once in this chapter: \gls{xml}. Used twice in this chapter: \gls{css} and \gls{css}. \currentruncount{css} \triggertest{css} Total number of times the \texttt{css} entry was used throughout the document on the previous run: \glsentryprevtotalcount{css}. Total number of times the \texttt{xml} entry was used throughout the document on the previous run: \glsentryprevtotalcount{xml}. \printglossaries \end{document}