summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries/doc/sample.tex
blob: 1555f0c31d3b0fb3f96db56fb415d4a27b8f3c86 (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
67
68
69
70
71
72
73
74
75
\documentclass[a4paper]{report}

\usepackage[plainpages=false,colorlinks]{hyperref}
\usepackage[style=altlist]{glossaries}

\makeglossaries

\newglossaryentry{glossary}{name=glossary,
description={1) list of technical words, 2) collection of 
glosses},
plural={glossaries}}

\newglossaryentry{Perl}{name=\texttt{Perl},
sort=Perl, % need a sort key because name contains a command
description=A scripting language}

\newglossaryentry{pagelist}{name=page list,
% description value has to be enclosed in braces
% because it contains commas
description={a list of individual pages or page ranges 
(e.g.\ 1,2,4,7-9)}}

\newglossaryentry{mtrx}{name=matrix,
description={rectangular array of quantities},
% plural is not simply obtained by appending an s, so specify
plural=matrices}

\newcommand{\pardescription}{distinct section of piece of 
writing.\par Beginning on new, usually indented, line}
\newglossaryentry{par}{name=paragraph,
description=\pardescription}

\begin{document}

\title{Sample Document Using glossary Package}
\author{Nicola Talbot}
\pagenumbering{alph}% prevent duplicate page link names if using PDF
\maketitle

\pagenumbering{roman}
\tableofcontents

\chapter{Introduction}
\pagenumbering{arabic}

A \gls{glossary} is a very useful addition to any
technical document, although a \gls{glossary} can 
also simply be a collection of glosses, which is
another thing entirely. Some documents have
multiple \glspl{glossary}.

Once you have run your document through \LaTeX, you
will then need to run the \texttt{.glo} file through
\texttt{makeindex}.  You will need to set the output
file so that it creates a \texttt{.gls} file instead
of an \texttt{.ind} file, and change the name of 
the log file so that it doesn't overwrite the index
log file (if you have an index for your document).  
Rather than having to remember all the command line
switches, you can call the \gls{Perl} script
\texttt{makeglossaries} which provides a convenient
wrapper.

If a comma appears within the name or description, grouping
must be used, e.g.\ in the description of \gls{pagelist}.

Plurals are assumed to have the letter s appended, but if
this is not the case, as in \glspl{mtrx}, then you need
to specify the plural when you define the entry.

\Glspl{par} can cause a problem in commands.

\printglossaries

\end{document}