blob: 7979120c455b092924555fbff5e4be1af9e0cf80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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 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}
|