summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries/samples/minimalgls.tex
blob: 144f14369770b43f1c7d01f655fb61c7cf22b29d (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
76
77
78
79
80
81
82
83
84
85
86
 % This file is public domain.
 %
 % This is a minimal file for testing and debugging
 % the glossaries package. Change the class file as
 % desired, and add the relevant package options to
 % both the class file and the glossaries package.
 % Change the sample glossary entry and acronym if
 % required. If the problem occurs with an additional
 % glossary, add in the relevant \newglossary command
 % and a sample entry.
 %
 % Only add extra packages or commands if they
 % contribute to whatever problem you are trying to
 % test.
 %
 % Remember that the document will not be complete
 % until you have successfully completed all of the
 % following steps:
 % 1. latex minimalgls
 % 2. makeglossaries minimalgls (note no extension)
 % 3. latex minimalgls
 % A further run through LaTeX will be required to ensure that
 % the table of contents is up to date if the toc option
 % is used.
 % Alternatively, if you use arara, you can add the following
 % directives in your document:
 %
 % arara: pdflatex: { synctex: on }
 % arara: makeglossaries
 % arara: pdflatex: { synctex: on }

\documentclass{article}
\listfiles

\usepackage[colorlinks]{hyperref}
 %\usepackage{glossaries} % acronym will go in main glossary
 \usepackage[acronym]{glossaries} % make a separate list of acronyms

\makeglossaries

 % Setup acronym fonts (e.g. \emph for short form on first use and
 % \textbf for short form on subsequent use):
\renewcommand{\firstacronymfont}[1]{\emph{#1}}
\renewcommand{\acronymfont}[1]{\textbf{#1}}
 % Apply the generic acronym style to just the "acronym" glossary:
\defglsentryfmt[acronym]{\glsgenacfmt}

 % Change acronym first use so that its displayed as
 % short (long)
\renewcommand{\genacrfullformat}[2]{%
  \glsentryshort{#1}#2 (\glsentrylong{#1})%
}
\renewcommand{\genplacrfullformat}[2]{%
  \glsentryshortpl{#1}#2 (\glsentrylongpl{#1})%
}

\longnewglossaryentry{par}{name={par}}%
{%
  A long description with a paragraph break.

  This is the next paragraph.
}

\newglossaryentry{sample}{name={sample},
description={a sample entry}}

\newacronym[\glsshortpluralkey=cas,\glslongpluralkey=contrived
acronyms]{aca}{aca}{a contrived acronym}

\begin{document}
A \gls{sample} entry and \gls{aca}. Second use: \gls{aca}.

Plurals: \glspl{sample}. Reset acronym\glsreset{aca}.
First use: \glspl{aca}. Second use: \glspl{aca}.

\glsresetall
First letter upper case: \Gls{sample}. First use: \Gls{aca}.
Subsequent use: \Gls{aca}.
\glsresetall
Plurals: \Glspl{sample}. First use: \Glspl{aca}. Next: \Glspl{aca}.

If you want paragraph breaks in the description use
\verb|\longnewglossaryentry|, as with entry \gls{par}.

\printglossaries
\end{document}