Debian Codegraph @

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

raw
1 % This file is embedded in glossaries-extra-manual.pdf
2 % Example 98 Link text styles: outer, middle, inner, hyperlinks and post-link hooks (custom and abbreviation style)
3 % Label: "ex:linktextstylescustom"
4 % arara: pdflatex
5 % arara: pdfcrop
6 \documentclass[14pt]{extarticle}
7 \pagestyle{empty}
8 \usepackage{courier}
9 \usepackage[T1]{fontenc}
10 \usepackage{xcolor}
11 \usepackage{soul}
12 \usepackage[colorlinks]{hyperref}
13 \usepackage[nogroupskip]{glossaries-extra}
14 % outer formatting:
15 \renewcommand{\glstextformat}[1]{\texttt{#1}}
16 % middle formatting:
17 \renewcommand{\glsxtrregularfont}[1]{\textbf{#1}}
18 \renewcommand{\glsxtrabbreviationfont}[1]{\textit{#1}}
19 % inner formatting:
20 \renewcommand{\glsxtrdefaultentrytextfmt}[1]{\hl{#1}}
21 % post-link hook for 'general' category:
22 \glsdefpostlink{general}{\glsxtrifwasfirstuse{ (\glsentrydesc{\glslabel})}{}}
23 % this style sets the post-link hook for 'abbreviation' category:
24 \setabbreviationstyle{long-postshort-user}
25 % this style sets the post-link hook for 'acronym' category:
26 \setabbreviationstyle[acronym]{short-postfootnote}
27 % define entries:
28 \newglossaryentry{sample}{name={sample},description={an example}}
29 \newabbreviation{html}{HTML}{hypertext markup language}
30 \newacronym{nasa}{NASA}{National Aeronautics and Space Administration}
31 \begin{document}
32 First use: \gls{sample}, \gls{html}, \gls{nasa}.
33
34 Next use: \gls{sample}, \gls{html}, \gls{nasa}.
35
36 \printunsrtglossaries
37 \end{document}