Debian Codegraph @

texmf-dist/doc/latex/glossaries/samples/sampleSort.tex

raw
1 % This file is public domain
2 % If you want to use arara, you need the following directives:
3 % arara: pdflatex: { synctex: on }
4 % arara: makeglossaries
5 % arara: pdflatex: { synctex: on }
6 % arara: pdflatex: { synctex: on }
7 %
8 %http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sampleSort
9 \documentclass{report}
10
11 % If you want to add babel to this document, you may have to
12 % replace the : character in the labels if you are using a
13 % language setting (e.g. french) that makes : active.
14
15 \usepackage[plainpages=false,colorlinks]{hyperref}
16 \usepackage[toc,acronym]{glossaries}
17
18 % Define a new glossary type called notation
19 \newglossary[nlg]{notation}{not}{ntn}{Notation}
20
21 \makeglossaries
22
23 \newcounter{sortcount}
24
25 \renewcommand{\glsprestandardsort}[3]{%
26 \ifdefstring{#2}{notation}%
27 {%
28 \stepcounter{sortcount}%
29 \edef#1{\glssortnumberfmt{\arabic{sortcount}}}%
30 }%
31 {%
32 \glsdosanitizesort
33 }%
34 }
35
36 % Notation definitions
37
38 \newglossaryentry{not:set}{type=notation, % glossary type
39 name={$\mathcal{S}$},
40 text={\mathcal{S}},
41 description={A set}}
42
43 \newglossaryentry{not:emptyset}{type=notation,
44 name={$\emptyset$},
45 text={\emptyset},
46 description={The empty set}}
47
48 \newglossaryentry{not:card}{type=notation,
49 name={$\mid\mathcal{S}\mid$},
50 text={\mid\mathcal{S}\mid},
51 description={cardinality of $\mathcal{S}$}}
52
53 % Main glossary definitions
54
55 \newglossaryentry{gls:set}{name=set,
56 description={A collection of distinct objects}}
57
58 \newglossaryentry{gls:card}{name=cardinality,
59 description={The number of elements in the specified set}}
60
61 % Acronym definitions
62
63 \setacronymstyle{long-short}
64
65 \newacronym{zfc}{ZFC}{Zermelo-Fraenkel set theory}
66
67 \newacronym{ad}{AD}{axiom of determinacy}
68
69 \newacronym{nf}{NF}{new foundations}
70
71 \begin{document}
72 \title{Sample Document using the glossaries Package}
73 \author{Nicola Talbot}
74 \pagenumbering{alph}
75 \maketitle
76
77 \begin{abstract}
78 %stop hyperref complaining about duplicate page identifiers:
79 \pagenumbering{Alph}
80 This is a sample document illustrating the use of the
81 \textsf{glossaries} package. In this example, a new glossary type
82 called \texttt{notation} is defined, so that the document can have a
83 separate glossary of terms, list of acronyms and index of notation.
84 \end{abstract}
85
86
87 \pagenumbering{roman}
88 \tableofcontents
89
90 \printglossaries
91
92 \chapter{Introduction}
93 \pagenumbering{arabic}
94
95 \Glspl{gls:set} are denoted by a calligraphic font
96 e.g.\ $\gls{not:set}$.
97
98 The \gls{gls:card} of a set $\mathcal{S}$ is denoted
99 $\gls{not:card}$. The empty set is denoted
100 $\gls{not:emptyset}$.
101
102 Here are some acronyms: \gls{nf}, \gls{zfc} and \gls{ad}.
103
104 \chapter{Another Chapter}
105
106 Another mention of the empty set $\gls{not:emptyset}$.
107
108 Here are the acronyms again: \gls{nf}, \gls{zfc} and \gls{ad}.
109
110 \end{document}