summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries/samples/samplexdy2.tex
blob: d6d12d8087d6ae9ce832581aead1747d7db62744 (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
 % This file is public domain
 %
 % This is a sample document illustrating how to use the
 % glossaries package with xindy. To create the document:
 %
 % pdflatex samplexdy2
 % makeglossaries samplexdy2
 % pdflatex samplexdy2
 %
 % This sample file won't work with makeindex
 %
\documentclass{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}
\usepackage[xindy,counter=section]{glossaries}

 % Set up somewhat eccentric section numbering system:

\renewcommand*{\thesection}{[\thechapter]\arabic{section}}

\renewcommand*{\theHsection}{\thepart.\thesection}
\renewcommand*{\thepart}{\Roman{part}}

\GlsAddXdyLocation["roman-numbers-uppercase"]{section}{:sep "["
  "arabic-numbers" :sep "]" "arabic-numbers"
}

 % If part is 0, then \thepart will be empty, so add an extra
 % case to catch this:

\GlsAddXdyLocation{zero.section}{:sep "["
  "arabic-numbers" :sep "]" "arabic-numbers"
}

 % (Note that the above will stop xindy giving a warning, but the
 % location hyper links will be invalid if no \part is used.)

\makeglossaries

\newglossaryentry{sample}{name=sample,description={an example}}
\newglossaryentry{sample2}{name=sample2,description={another example}}

\begin{document}
This is a sample document illustrating Xindy specific commands in
the glossaries package.

\part{First Part}

\chapter{Sample Chapter}

\section{First Section}

\gls{sample}. \gls{sample2}.

\section{Second Section}

\gls{sample2}.

\section{Third Section}

\gls{sample}. \gls{sample2}.

\printglossaries
\end{document}