| 1 |
% This file is embedded in glossaries-extra-manual.pdf |
| 2 |
% Example 124 Enabling unit counting to hook into hyperlink setting |
| 3 |
% Label: "ex:unitentrycounthyper" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdflatex |
| 6 |
% arara: makeglossaries |
| 7 |
% arara: pdflatex |
| 8 |
% arara: pdfcrop |
| 9 |
\documentclass[12pt]{article} |
| 10 |
\pagestyle{empty} |
| 11 |
\usepackage[colorlinks]{hyperref} |
| 12 |
\usepackage{glossaries-extra} |
| 13 |
|
| 14 |
|
| 15 |
\makeglossaries |
| 16 |
|
| 17 |
|
| 18 |
\GlsXtrEnableEntryUnitCounting{general}{0}{page} |
| 19 |
|
| 20 |
|
| 21 |
\newglossaryentry{sample}{name={sample},description={an example}} |
| 22 |
|
| 23 |
|
| 24 |
\renewcommand*{\glslinkcheckfirsthyperhook}{% |
| 25 |
\ifnum\glsentrycurrcount{\glslabel}>0 |
| 26 |
\setupglslink{hyper=false}% |
| 27 |
\fi |
| 28 |
} |
| 29 |
\begin{document} |
| 30 |
A \gls{sample} entry. Next use: \gls{sample}. |
| 31 |
|
| 32 |
\newpage |
| 33 |
Next page: \gls{sample}. Again: \gls{sample}. |
| 34 |
|
| 35 |
\printglossaries |
| 36 |
\end{document} |