summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries-extra/sample-postlink.tex
blob: 42adeda7df4eab75f08b736a6847e78ffa4a7f71 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[style=tree]{glossaries-extra}

\makeglossaries

% Append the description in parentheses on first use
% for entries with the "describe" category:

\glssetregularcategory{describe}

\newcommand*{\glsxtrpostlinkdescribe}{%
  \glsxtrpostlinkAddDescOnFirstUse
}

\newglossaryentry{sample1}{name={sample1},
  category=describe,
  description={the first sample entry}}

% Append the symbol in parentheses on first use for
% entries with the "symbol" category:

\glssetregularcategory{symbol}

\newcommand*{\glsxtrpostlinksymbol}{%
  \glsxtrifwasfirstuse
  {%
    \space (denoted: \glsentrysymbol{\glslabel})%
  }%
  {}%
}

\newglossaryentry{sample2}{name={sample2},
 symbol={\ensuremath{\mathcal{S}_2}},
 category=symbol,
 description={the second sample entry}}

% Append the description as a footnote for general entries
% on first use:

%\newcommand*{\glsxtrpostlinkgeneral}{%
%  \glsxtrifwasfirstuse{\footnote{\glsentrydesc{\glslabel}}}{}%
%}

% or (defer footnote mark until after any following punctuation):

\newcommand*{\glsxtrpostlinkgeneral}{%
  \glsxtrifwasfirstuse
  {\glsxtrdopostpunc{\footnote{\glsentrydesc{\glslabel}}}}%
  {}%
}

% Disable hyperlink of first use for those entries in the "general"
% category:

\glssetcategoryattribute{general}{nohyperfirst}{true}

\newglossaryentry{sample3}{name={sample3},
 description={the third sample entry}}

\begin{document}

First use: \gls{sample1}, \gls{sample2} and \gls{sample3}.

Next use: \gls{sample1}, \gls{sample2} and \gls{sample3}.

Value of first field (post-link hook is still used): \glsfirst{sample1}, \glsfirst{sample2}
and \glsfirst{sample3}. (The last one isn't considered first use by
the hook that determines whether or not to hyperlink on first use.)

\printglossaries

\end{document}