Debian Codegraph @

texmf-dist/doc/latex/glossaries-extra/glossaries-extra-manual-examples/glossaries-extra-manual-example125.tex

raw
1 % This file is embedded in glossaries-extra-manual.pdf
2 % Example 125 Link counting used to selectively suppress hyperlinks
3 % Label: "ex:linkcount"
4 % arara: pdflatex
5 % arara: makeglossaries
6 % arara: pdflatex
7 % arara: pdfcrop
8 \documentclass[12pt]{article}
9 \pagestyle{empty}
10 \usepackage[colorlinks]{hyperref}
11 \usepackage{glossaries-extra}
12
13 \makeglossaries
14
15 \renewcommand*{\glslinkpresetkeys}{%
16 \ifnum\GlsXtrLinkCounterValue{\glslabel}>1
17 \setupglslink{hyper=false}%
18 \fi }
19
20 \GlsXtrEnableLinkCounting{general}
21
22 \newglossaryentry{sample1}{name={sample1},description={an example}}
23 \newglossaryentry{sample2}{name={sample2},description={another example}}
24
25 \newabbreviation{ex}{ex}{example}
26
27
28 \begin{document}
29 \section{Sample Section}
30
31
32 \Gls{sample1}, \gls{sample2} and \gls{ex}.
33 \Glstext{sample1} and \gls{ex} again.
34
35
36 \section{Another Sample Section}
37
38
39 \Gls{sample1}, \gls{sample2} and \gls{ex}.
40
41
42 \printglossaries
43 \end{document}