Debian Codegraph @

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

raw
1 % This file is public domain
2 % If you are using arara, you need the following directives:
3 % If you want to use arara, you need the following directives:
4 % arara: pdflatex: { synctex: on }
5 % arara: makeglossaries
6 % arara: pdflatex: { synctex: on }
7 % arara: pdflatex: { synctex: on }
8 %
9 %http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#samplePeople
10 \documentclass{report}
11
12 \usepackage[colorlinks]{hyperref}
13 \usepackage[toc,style=listgroup]{glossaries}
14
15 \makeglossaries
16
17 \newcommand{\sortname}[2]{#2, #1}
18 \newcommand{\textname}[2]{#1 #2}
19
20 % Syntax: \name{first name}{surname}
21 \let\name\textname
22
23 \renewcommand{\glsprestandardsort}[3]{%
24 \let\name\sortname
25 \edef#1{\expandafter\expandonce\expandafter{#1}}%
26 \let\name\textname
27 \glsdosanitizesort
28 }
29
30 \newglossaryentry{joebloggs}{name={\name{Joe}{Bloggs}},description={\nopostdesc}}
31
32 \newglossaryentry{johnsmith}{name={\name{John}{Smith}},description={\nopostdesc}}
33
34 \newglossaryentry{zoeadams}{name={\name{Zo\'e}{Adams}},description={\nopostdesc}}
35
36 \newglossaryentry{maryadams}{name={\name{Mary}{Adams}},description={\nopostdesc}}
37
38 \begin{document}
39 \tableofcontents
40
41 \chapter{\glsentrytext{joebloggs}}
42
43 \gls{joebloggs} was a fairly ordinary person.
44
45 \chapter{\glsentrytext{johnsmith}}
46
47 \gls{johnsmith} was great friends with \gls{joebloggs}.
48
49 \chapter{\glsentrytext{maryadams}}
50
51 \gls{maryadams} worked with \gls{johnsmith} but never met
52 \gls{joebloggs}.
53
54 \chapter{\glsentrytext{zoeadams}}
55
56 \gls{zoeadams} was \gls{maryadams}['s] sister.
57 \printglossaries
58
59 \end{document}