summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries-extra/sample-onelink.tex
blob: 1d9a71876c627c84a132cf6b09c1c3981f2e7311 (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
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage{lipsum}
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries-extra}

\makeglossaries

\GlsXtrEnableEntryUnitCounting{general}{0}{page}

\newglossaryentry{sample}{name={sample},description={an example}}
\newglossaryentry{sample2}{name={another sample},description={another example}}

\renewcommand*{\glslinkcheckfirsthyperhook}{%
  \ifnum\glsentrycurrcount\glslabel>0
   \setkeys{glslink}{hyper=false}%
  \fi
}

\begin{document}

A \gls{sample} entry. \Gls{sample2}.
Next use: \gls{sample}, \gls{sample2}.

\lipsum[1]

\Gls{sample} and more \glspl{sample}.
\Gls{sample2} and \gls{sample2}.

\newpage

Next page: \gls{sample} and \gls{sample2}.

Again: \gls{sample} and \gls{sample2}.

\lipsum[2-5]

Now for a \gls{sample} paragraph that spans the page break.
\lipsum*[6-7] The entry in the final sentence in this \gls{sample} paragraph
is incrementing and testing the count from the previous page.

Another \gls{sample} paragraph.

\printglossaries

\end{document}