Debian Codegraph @

texmf-dist/doc/latex/glossaries-extra/samples/sample-mixture.tex

raw
1 % arara: pdflatex
2 % arara: makeglossaries
3 % arara: pdflatex
4 % arara: makeglossaries
5 % arara: pdflatex
6 \documentclass{report}
7
8 \usepackage[T1]{fontenc}
9 \usepackage[colorlinks]{hyperref}
10 \usepackage[nopostdot=false]{glossaries-extra}
11
12 \makeglossaries
13
14 % regular terms:
15
16 % (Version 1.04+) The following will make regular terms appear
17 % in sans-serif when used with \gls etc but won't affect the
18 % abbreviations:
19
20 %\renewcommand*{\glsxtrregularfont}[1]{\textsf{#1}}
21
22 % or limit to just the "general" category:
23 %\renewcommand*{\glsxtrregularfont}[1]{%
24 % \glsifcategory{\glslabel}{general}{\textsf{#1}}{#1}}
25
26 % or limit to a particular attribute:
27
28 %\glssetcategoryattribute{general}{font}{sf}
29 %\glssetcategoryattribute{acronym}{font}{sf}
30
31 %\renewcommand*{\glsxtrregularfont}[1]{%
32 % \glsifattribute{\glslabel}{font}{sf}{\textsf{#1}}{#1}}
33
34 % or use the attribute to store the font control sequence name:
35
36 %\glssetcategoryattribute{general}{font}{textsf}
37 %\glssetcategoryattribute{acronym}{font}{emph}
38 %
39 %\renewcommand*{\glsxtrregularfont}[1]{%
40 % \glshasattribute{\glslabel}{font}%
41 % {\csuse{\glsgetattribute{\glslabel}{font}}{#1}}%
42 % {#1}%
43 %}
44
45 % The following will make the first letter of the name upper case
46 % in the glossary for the general entries:
47 \glssetcategoryattribute{general}{glossname}{firstuc}
48
49 % The following will make the first letter of the description upper case
50 % in the glossary for the general entries:
51 \glssetcategoryattribute{general}{glossdesc}{firstuc}
52
53 % (version 1.04+) The following will make the description
54 % appear in italic in the glossary for general entries:
55
56 %\glssetcategoryattribute{general}{glossdescfont}{emph}
57
58 % (version 1.04+) The following will make the name
59 % appear in italic in the glossary for general entries:
60
61 %\glssetcategoryattribute{general}{glossnamefont}{emph}
62
63 \newglossaryentry{duck}{name=duck,%
64 description={a waterbird with webbed feet}}
65
66 \newglossaryentry{parrot}{name=parrot,%
67 description={mainly tropical bird with bright plumage}}
68
69 % acronyms:
70
71 % The following redefinition will add the provided text to the end of the
72 % description in the glossary.
73
74 \renewcommand*{\glsxtrpostdescacronym}{%
75 \space(\textsc{acronym:} \glsentrylong{\glscurrententrylabel})%
76 }
77
78 % The following will make the first letter of the name upper case
79 % in the glossary for the acronym entries:
80 \glssetcategoryattribute{acronym}{glossname}{firstuc}
81
82 % The following will make the first letter of the description upper case
83 % in the glossary for the acronym entries:
84 \glssetcategoryattribute{acronym}{glossdesc}{firstuc}
85
86 % Enable tagging of initials. The second argument is the name of
87 % the command you want to use to tag initial letters. The
88 % command will be defined robustly and will only be activated
89 % in the glossary for the categories listed in the first
90 % argument.
91 % If the specified tagging command (\itag here) is used
92 % anywhere else it will just do its argument.
93 \GlsXtrEnableInitialTagging{acronym,abbreviation}{\itag}
94
95 \newacronym[description={a device that emits a narrow intense
96 beam of light}]{laser}{laser}
97 {\itag{l}ight \itag{a}mplification by \itag{s}timulated
98 \itag{e}mission of \itag{r}adiation}
99
100 \newacronym[description={a form of \gls{laser} generating a beam of
101 microwaves}]{maser}{maser}
102 {\itag{m}icrowave \itag{a}mplification by \itag{s}timulated
103 \itag{e}mission of \itag{r}adiation}
104
105 \newacronym[description={a system for detecting the location and
106 speed of ships, aircraft, etc, through the use of radio waves}]{radar}{radar}
107 {\itag{ra}dio \itag{d}etection \itag{a}nd \itag{r}anging}
108
109 \newacronym[description={portable breathing apparatus for divers}]{scuba}{scuba}
110 {\itag{s}elf-\itag{c}ontained \itag{u}nderwater
111 \itag{b}reathing \itag{a}pparatus}
112
113 % The following redefinition will add the provided text to the end of the
114 % description in the glossary.
115
116 \renewcommand*{\glsxtrpostdescabbreviation}{%
117 \space (abbreviation)%
118 }
119
120 % The following will set the description in title case
121 % in the glossary for the abbreviations:
122 \glssetcategoryattribute{abbreviation}{glossdesc}{title}
123
124 % The following will convert the abbreviations to all capitals
125 % in the glossary:
126 \glssetcategoryattribute{abbreviation}{glossname}{uc}
127
128 % Use \textsc in the abbreviations:
129 \setabbreviationstyle{long-short-sc}
130
131 % Some other attributes you might want to try:
132
133 % Use 's (apostrophe s) for the plural suffix
134 % (only affects the short plural not the long plural)
135 %\glssetcategoryattribute{abbreviation}{aposplural}{true}
136
137 % Suppress the default suffix for the short plural.
138 % (Don't use with the above for the same category.)
139 %\glssetcategoryattribute{abbreviation}{noshortplural}{true}
140
141 % abbreviations:
142
143 \newabbreviation
144 {html}% identifying label
145 {html}% short form
146 {\itag{h}yper\itag{t}ext \itag{m}arkup \itag{l}anguage}% long form
147
148 \newabbreviation
149 {xml}% identifying label
150 {xml}% short form
151 {e\itag{x}tensible \itag{m}arkup \itag{l}anguage}% long form
152
153 \newabbreviation
154 {svg}% identifying label
155 {svg}% short form
156 {\itag{s}calable \itag{v}ector \itag{g}raphics}% long form
157
158 \newabbreviation
159 {svm}% identifying label
160 {svm}% short form
161 {\itag{s}upport \itag{v}ector \itag{m}achine}% long form
162
163 \title{Sample Document Illustrating the glossaries-extra Package}
164 \author{Nicola Talbot}
165
166 \begin{document}
167 \pagenumbering{alph}
168 \maketitle
169
170 \pagenumbering{roman}
171 \tableofcontents
172
173 \pagenumbering{arabic}
174 \chapter{Categories}
175
176 The \texttt{glossaries-extra} package provides an extra key called
177 \texttt{category}, which is used to assign a category to each entry.
178 For example, the category for the ``duck'' entry is:
179 \glscategory{duck}.
180
181 The category value is just a label, which needs to be expandable, so
182 make sure you avoid problematic characters in it. You can test the
183 category with \verb|\glsifcategory|.
184
185 The entry ``duck'' \glsifcategory{duck}{general}{is}{isn't} a
186 general entry.
187 The entry ``laser'' \glsifcategory{laser}{general}{is}{isn't} a
188 general entry.
189
190 A category can have attributes set. For example, both the
191 ``general'' category and the ``acronym'' category have the attribute
192 ``regular'' set to ``true''.
193
194 You can obtain the value of an attribute for a given category with
195 \begin{verbatim}
196 \glsgetcategoryattribute{category}{attribute}
197 \end{verbatim}
198 This does nothing if the category
199 or attribute aren't defined.
200
201 Category ``general'' has the attribute ``regular'' set to
202 ``\glsgetcategoryattribute{general}{regular}''.
203 Category ``acronym'' has the attribute ``regular'' set to
204 ``\glsgetcategoryattribute{acronym}{regular}''.
205 Category ``abbreviation'' has the attribute ``regular'' set to
206 ``\glsgetcategoryattribute{abbreviation}{regular}''.
207
208 You can test if a category has an attribute set to a given value
209 with
210 \begin{verbatim}
211 \glsifcategoryattribute{category}{attribute}{value}{true code}{false
212 code}
213 \end{verbatim}
214
215 Category ``general''
216 \glsifcategoryattribute{general}{regular}{true}{has}{doesn't have}
217 the ``regular'' attribute set to ``true''.
218 Category ``acronym''
219 \glsifcategoryattribute{acronym}{regular}{true}{has}{doesn't have}
220 the ``regular'' attribute set to ``true''.
221 Category ``abbreviation''
222 \glsifcategoryattribute{abbreviation}{regular}{true}{has}{doesn't have}
223 the ``regular'' attribute set to ``true''.
224
225 \chapter{Regular Terms}
226
227 By default glossary entries have the category ``general''.
228 For
229 example\glsforeachincategory{general}{\thistype}{\thislabel}{,
230 \gls{\thislabel}} have the category field set to ``general''.
231
232 Commands like \verb|\newabbreviation| and \verb|\newacronym|
233 override this.
234
235 Regular terms are those entries whose category has the ``regular''
236 attribute set to ``true''. There's a convenient shortcut to
237 determine if an entry has a category with the ``regular'' attribute
238 set:
239 \begin{verbatim}
240 \glsifregular{entry-label}{true code}{false code}
241 \end{verbatim}
242
243 For example: \gls{duck} \glsifregular{duck}{is}{isn't} a regular
244 term;
245 \gls{laser} \glsifregular{laser}{is}{isn't} a regular
246 term.
247
248 The regular attribute determines what \verb|\gls| (and plural and
249 case-changing variants) should do. A regular entry (even if
250 it's been defined using \verb|\newacronym| or
251 \verb|\newabbreviation|) uses the \texttt{first} (or
252 \texttt{firstplural}) key on first use and the \texttt{text}
253 (or \texttt{plural}) key on subsequent use.
254
255 An abbreviation whose category doesn't have the regular attribute
256 set to ``true'' will use the abbreviation style assigned
257 to that category for first and subsequent use, which will use
258 the values of the \texttt{long} (or \texttt{longplural})
259 and \texttt{short} (or \texttt{shortplural}) keys.
260 The first use of \verb|\gls| may or may not match \verb|\glsfirst|
261 for non-regular entries, depending on the abbreviation style.
262
263 \chapter{Abbreviations}
264
265 Abbreviations include acronyms, initialisms and contractions.
266 Some abbreviation styles may set category attributes.
267 For example, the ``short'' style sets the ``regular'' attribute for
268 the category used by the abbreviations with that style applied.
269 Whereas the ``long-short'' style will switch off the ``regular'' attribute
270 if it has previously been switched on.
271 Styles must be set before defining abbreviations, but you may set
272 different styles for different categories.
273
274 For example, by default the ``short'' style is set for abbreviations
275 with the ``acronym'' category using:
276 \begin{verbatim}
277 \setabbreviationstyle[acronym]{short}
278 \end{verbatim}
279 whereas the ``short-long'' style is set for abbreviations with the
280 ``abbreviation'' category:
281 \begin{verbatim}
282 \setabbreviationstyle{long-short}
283 \end{verbatim}
284 (The optional argument defaults to ``abbreviation''.)
285
286 If no style has been set for a particular category, the style for the
287 ``abbreviation'' category is used instead.
288
289 \section{Acronyms}
290
291 An acronym is a word formed from the initial letters of other words.
292 Since it's a word, an acronym is pronounced as a word rather than as
293 a series of letters. Examples of acronyms: \gls{laser}, \gls{maser},
294 \gls{radar} and \gls{scuba}.
295
296 Since acronyms are treated as words, the ``acronym'' category
297 has the ``regular'' attribute set to ``true''. The default
298 abbreviation style for acronyms is ``short'', which doesn't expand
299 the entry on first use.
300
301 The description defaults to the long
302 form with the ``short'' style. This example document overrides
303 the default description by using the \texttt{description}
304 key in the optional argument of \verb|\newacronym|. This
305 document also sets the post description hook
306 (\verb|\glsxtrpostdescacronym|) to insert the long form in
307 parentheses after the description when it's displayed in the glossary.
308
309 \section{Initialism}
310
311 Initialisms are formed from initial letters of words where the
312 letters are sounded out. Examples of initialisms:
313 \gls{svm}, \gls{html}, \gls{svg} and \gls{xml}.
314
315 The \texttt{glossaries-extra} package sets the default abbreviation
316 style to \texttt{long-short}. This document has changed it to
317 \texttt{long-short-sc} (use small caps). Next use:
318 \gls{svm}, \gls{html}, \gls{svg} and \gls{xml}.
319
320 Note that the acronyms (like \gls{laser}) don't use small caps.
321 This is because the acronyms and initialisms have separate styles
322 applied since they are in separate categories.
323
324 \section{Plurals}
325
326 The default plural for the short form is obtained by appending
327 the abbreviation plural suffix to the singular form. You can
328 override this on a per-entry basis using the \texttt{shortplural}
329 key in the optional argument of \verb|\newabbreviation|
330 (or \verb|\newacronym|) or you can prevent the suffix from
331 being added to all entries in a particular category (or categories)
332 by setting the \texttt{noshortplural} attribute to ``true'' for
333 the relevant category (before defining the entries).
334
335 Alternatively you can automatically insert an apostrophe before
336 the plural suffix by setting the \texttt{aposplural} attribute to
337 ``true''. The \texttt{aposplural} attribute overrides the
338 \texttt{noshortplural} attribute.
339
340 Plurals: \glspl{svm}, \glspl{laser}.
341
342 \printglossaries
343
344 \end{document}