summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries/samples/samplePeople.tex
blob: 258dc3e8eb6c27801d79526c4fe93e1b44e5ad54 (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
 % This file is public domain
 % If you are using arara, you need the following directives:
 % If you want to use arara, you need the following directives:
 % arara: pdflatex: { synctex: on }
 % arara: makeglossaries
 % arara: pdflatex: { synctex: on }
 % arara: pdflatex: { synctex: on }
\documentclass{report}

\usepackage[colorlinks]{hyperref}
\usepackage[toc,style=listgroup]{glossaries}

\makeglossaries

\newcommand{\sortname}[2]{#2, #1}
\newcommand{\textname}[2]{#1 #2}

 % Syntax: \name{first name}{surname}
 \let\name\textname

\renewcommand{\glsprestandardsort}[3]{%
 \let\name\sortname
 \edef#1{\expandafter\expandonce\expandafter{#1}}%
 \let\name\textname
 \glsdosanitizesort
}

\newglossaryentry{joebloggs}{name={\name{Joe}{Bloggs}},description={\nopostdesc}}

\newglossaryentry{johnsmith}{name={\name{John}{Smith}},description={\nopostdesc}}

\newglossaryentry{zoeadams}{name={\name{Zo\'e}{Adams}},description={\nopostdesc}}

\newglossaryentry{maryadams}{name={\name{Mary}{Adams}},description={\nopostdesc}}

\begin{document}
\tableofcontents

\chapter{\glsentrytext{joebloggs}}

\gls{joebloggs} was a fairly ordinary person.

\chapter{\glsentrytext{johnsmith}}

\gls{johnsmith} was great friends with \gls{joebloggs}.

\chapter{\glsentrytext{maryadams}}

\gls{maryadams} worked with \gls{johnsmith} but never met
\gls{joebloggs}.

\chapter{\glsentrytext{zoeadams}}

\gls{zoeadams} was \gls{maryadams}['s] sister.
\printglossaries

\end{document}