summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries-extra/glossaries-extra-manual-examples/glossaries-extra-manual-example097.tex
blob: e058dc68e1d06c2b5f971f62dbcd0d007469226e (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
% This file is embedded in glossaries-extra-manual.pdf
% Example 97 Link text styles: outer, middle, inner, hyperlinks and post-link hooks (custom and abbreviation style)
% Label: "ex:linktextstylescustom"
% arara: pdflatex
% arara: pdfcrop
\documentclass[14pt]{extarticle}
\pagestyle{empty}
 \usepackage{courier}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{soul}
\usepackage[colorlinks]{hyperref}
\usepackage[nogroupskip]{glossaries-extra}
% outer formatting:
\renewcommand{\glstextformat}[1]{\texttt{#1}}
% middle formatting:
\renewcommand{\glsxtrregularfont}[1]{\textbf{#1}}
\renewcommand{\glsxtrabbreviationfont}[1]{\textit{#1}}
% inner formatting:
\renewcommand{\glsxtrdefaultentrytextfmt}[1]{\hl{#1}}
% post-link hook for 'general' category:
\glsdefpostlink{general}{\glsxtrifwasfirstuse{ (\glsentrydesc{\glslabel})}{}}
% this style sets the post-link hook for 'abbreviation' category:
\setabbreviationstyle{long-postshort-user}
% this style sets the post-link hook for 'acronym' category:
\setabbreviationstyle[acronym]{short-postfootnote}
% define entries:
\newglossaryentry{sample}{name={sample},description={an example}}
\newabbreviation{html}{HTML}{hypertext markup language}
\newacronym{nasa}{NASA}{National Aeronautics and Space Administration} 
\begin{document}
 First use: \gls{sample}, \gls{html}, \gls{nasa}. 

Next use: \gls{sample}, \gls{html}, \gls{nasa}. 

\printunsrtglossaries 
\end{document}