Debian Codegraph @

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

raw
1 % This file is public domain
2 %
3 % This is a sample document illustrating how to use the
4 % glossaries package with xindy. To create the document:
5 %
6 % pdflatex samplexdy2
7 % makeglossaries samplexdy2
8 % pdflatex samplexdy2
9 %
10 % This sample file won't work with makeindex
11 %
12 % If you want to use arara, you need the following directives:
13 % arara: pdflatex: { synctex: on }
14 % arara: makeglossaries
15 % arara: pdflatex: { synctex: on }
16 %
17 %http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#samplexdy2
18 \documentclass{report}
19
20 \usepackage[utf8]{inputenc}
21 \usepackage[T1]{fontenc}
22 \usepackage[colorlinks]{hyperref}
23 \usepackage[xindy,counter=section]{glossaries}
24
25 % Set up somewhat eccentric section numbering system:
26
27 \renewcommand*{\thesection}{[\thechapter]\arabic{section}}
28
29 \renewcommand*{\theHsection}{\thepart.\thesection}
30 \renewcommand*{\thepart}{\Roman{part}}
31
32 \GlsAddXdyLocation["roman-numbers-uppercase"]{section}{:sep "["
33 "arabic-numbers" :sep "]" "arabic-numbers"
34 }
35
36 % If part is 0, then \thepart will be empty, so add an extra
37 % case to catch this:
38
39 \GlsAddXdyLocation{zero.section}{:sep "["
40 "arabic-numbers" :sep "]" "arabic-numbers"
41 }
42
43 % (Note that the above will stop xindy giving a warning, but the
44 % location hyper links will be invalid if no \part is used.)
45
46 \makeglossaries
47
48 \newglossaryentry{sample}{name=sample,description={an example}}
49 \newglossaryentry{sample2}{name=sample2,description={another example}}
50
51 \begin{document}
52 This is a sample document illustrating Xindy specific commands in
53 the glossaries package.
54
55 \part{First Part}
56
57 \chapter{Sample Chapter}
58 This example document has an eccentric section numbering system
59 where the section number is prefixed by the chapter number in square
60 brackets.
61
62 \section{First Section}
63
64 \gls{sample}. \gls{sample2}.
65
66 \section{Second Section}
67
68 \gls{sample2}.
69
70 \section{Third Section}
71
72 \gls{sample}. \gls{sample2}.
73
74 \printglossaries
75 \end{document}