diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/glossaries/samples/sample-chap-hyperfirst.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/glossaries/samples/sample-chap-hyperfirst.tex | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/glossaries/samples/sample-chap-hyperfirst.tex b/Master/texmf-dist/doc/latex/glossaries/samples/sample-chap-hyperfirst.tex new file mode 100644 index 00000000000..4e74e2e059c --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/samples/sample-chap-hyperfirst.tex @@ -0,0 +1,59 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{chapter}{0}{\glschapnum} + +\loadglsentries{example-glossaries-brief} + +\renewcommand*{\glslinkpostsetkeys}{% + \edef\currentchap{\arabic{chapter}}% + \ifnum\currentchap=\glschapnum{\glslabel}\relax + % Already used this entry in the current chapter, so switch + % off the hyperlink. + \setkeys{glslink}{hyper=false}% + \else + % Hasn't been used in the current chapter. Update the value + % of the "chapter" field unless the hyperlink has been switched + % off. + \glsifhyperon + {% + \glsfieldxdef{\glslabel}{chapter}{\currentchap}% + }% + {}% + \fi +} + +\begin{document} +\chapter{Sample} + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\chapter{Another} + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\chapter{Start with a Star} + +Use all entries but suppress hyperlink: +\forglsentries{\thislabel}{\gls*{\thislabel}. } + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\printglossaries + +\end{document} |