summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries-extra/sample-unitentrycount.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/glossaries-extra/sample-unitentrycount.tex')
-rw-r--r--Master/texmf-dist/doc/latex/glossaries-extra/sample-unitentrycount.tex90
1 files changed, 90 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/glossaries-extra/sample-unitentrycount.tex b/Master/texmf-dist/doc/latex/glossaries-extra/sample-unitentrycount.tex
new file mode 100644
index 00000000000..03623a42023
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/glossaries-extra/sample-unitentrycount.tex
@@ -0,0 +1,90 @@
+% 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 to 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}