Debian Codegraph @

texmf-dist/doc/latex/glossaries/glossary2glossaries.tex

raw
1 % arara: lualatex
2 % arara: bib2gls: { group: on }
3 % arara: lualatex
4 % arara: bib2gls: { group: on } if found ("log", "Glossary entry `sym.")
5 % arara: lualatex
6 % arara: lualatex if found ("log", "Rerun to")
7
8 \documentclass[titlepage=false,oneside,
9 fontsize=12pt,captions=tableheading]{scrarticle}
10
11 \usepackage[noatsymgroup]{nlctuserguide}
12
13 \renewcommand*{\thispackagename}{glossaries}
14
15 \glsxtrnewgls{opt.glostyle.}{\glostyle}
16 \glsxtrnewgls{opt.acrstyle.}{\acrstyle}
17
18 \defsemanticcmd{\glostylefmt}{\textsf}{}
19 \defsemanticcmd{\acrstylefmt}{\textsf}{}
20
21 \glsxtrnewgls{opt.printgloss.}{\printglossopt}
22 \newcommand{\printglossoptval}[2]{\optval{printgloss.#1}{#2}}
23 \newcommand{\printglossoptvalm}[2]{\optval{printgloss.#1}{\marg{#2}}}
24
25 \glsxtrnewgls{opt.gloskey.}{\gloskey}
26 \newcommand{\gloskeyval}[2]{\optval{gloskey.#1}{\marg{#2}}}
27
28 \glsxtrnewgls{opt.storegloskey.}{\storegloskey}
29 \newcommand{\storegloskeyval}[2]{\optval{storegloskey.#1}{\marg{#2}}}
30
31 \glsxtrnewgls{opt.glsopt.}{\glsopt}
32 \newcommand{\glsoptval}[2]{\optval{glsopt.#1}{#2}}
33
34 \glsxtrnewgls{opt.useglsopt.}{\useglsopt}
35 \newcommand{\useglsoptval}[2]{\optval{useglsopt.#1}{#2}}
36
37 \renewcommand{\nlctuserguidecustomentryaliases}{%
38 glossarystyle=index,
39 acronymstyle=index,
40 }
41
42 \nlctuserguidegls
43 {
44 \def\gprintglossopt#1#2{%
45 \glsbibwriteentry{commandoption}{opt.printgloss.#1}{%
46 \field{name}{\csoptfmt{#1}}\parent{printglossary}#2}}%
47 \def\gglosty#1#2{\glsbibwriteentry{glossarystyle}{opt.glostyle.#1}%
48 {\field{name}{\glostylefmt{#1}}\parent{idx.glossarystyle}#2}}%
49 \def\gacrsty#1#2{\glsbibwriteentry{acronymstyle}{opt.acrstyle.#1}%
50 {\field{name}{\acrstylefmt{#1}}\parent{setacronymstyle}#2}}%
51 \def\ggloskey#1#2{%
52 \glsbibwriteentry{commandoption}{opt.gloskey.#1}{%
53 \field{name}{\csoptfmt{#1}}\parent{newglossaryentry}#2}}%
54 \def\gstoregloskey#1#2{%
55 \glsbibwriteentry{commandoption}{opt.storegloskey.#1}{%
56 \field{name}{\csoptfmt{#1}}\parent{storeglosentry}#2}}%
57 \def\gglsopt#1#2{%
58 \glsbibwriteentry{commandoption}{opt.glsopt.#1}{%
59 \field{name}{\csoptfmt{#1}}\parent{gls}#2}}%
60 \def\guseglsopt#1#2{%
61 \glsbibwriteentry{commandoption}{opt.useglsopt.#1}{%
62 \field{name}{\csoptfmt{#1}}\parent{useglosentry}#2}}%
63 \gidx{glossarystyle}{\name{glossary styles}\field{text}{glossary style}}
64 % \newglossarytype
65 \gcmd{new\-glossary\-type}
66 {%
67 \syntax{\oargm{log-ext}\margm{type}\margm{out-ext}\margm{in-ext}\oargm{old style list}}
68 }
69 % \newglossary
70 \gcmd{new\-glossary}
71 {
72 \syntax{\oargm{log-ext}\margm{type}\margm{out-ext}\margm{in-ext}\margm{title}}
73 }
74 % \setglossarystyle
75 \gcmd{set\-glossary\-style}
76 {
77 \syntax{\margm{new-style}}
78 }
79 % \printglossary (glossary.sty)
80 \gcmd{oldprintglossary}
81 {
82 \name{\csfmt{print\-glossary} (\styfmt{glossary.sty})}
83 \field{text}{\csfmt{print\-glossary}}
84 \syntax{\oargm{type}}
85 }
86 % \printglossary (glossaries.sty)
87 \gcmd{print\-glossary}
88 {
89 \name{\csfmt{print\-glossary} (\styfmt{glossaries.sty})}
90 \field{text}{\csfmt{print\-glossary}}
91 \syntax{\oargm{options}}
92 }
93 % \printglossaries
94 \gcmd{print\-glossaries}{}
95 % \printacronym
96 \gcmds{print\-acronym}{}
97 % \acronymtype
98 \gcmd{acronym\-type}{}
99 % \print<type>
100 \gcmdmeta{print}{type}{}{}
101 % \glossaryname
102 \gcmd{glossary\-name}{}
103 % \acronymname
104 \gcmd{acronym\-name}{}
105 % \<glossary-type>name
106 \gcmdmeta{}{glossary\dhyphen type}{name}{}
107 % \short<glossary-type>name
108 \gcmdmeta{short}{glossary\dhyphen type}{name}{}
109 % \make<glossary-type>
110 \gcmdmeta{make}{glossary\dhyphen type}{}{}
111 % \makeglossary
112 \gcmd{make\-glossary}{}
113 % \makeacronym
114 \gcmd{make\-acronym}{}
115 % \makeglossaries
116 \gcmd{make\-glossaries}{}
117 % \glossary
118 \gcmd{glossary}{}
119 % \storeglosentry
120 \gcmd{store\-glos\-entry}
121 {
122 \syntax{\margm{label}\marg{\keyvallist}}
123 }
124 % \newglossaryentry
125 \gcmd{new\-glossary\-entry}
126 {
127 \syntax{\margm{label}\marg{\keyvallist}}
128 }
129 % \glsnumberformat
130 \gcmd{gls\-number\-format}{\syntax{text}}
131 % \gls (glossary.sty)
132 \gcmd{oldgls}{
133 \name{\csfmt{gls} (\styfmt{glossary.sty})}
134 \field{text}{\csfmt{gls}}
135 \syntax{\oargm{options}\margm{label}}
136 }
137 % \gls
138 \gcmd{gls}
139 {
140 \name{\csfmt{gls} (\styfmt{glossaries.sty})}
141 \field{text}{\csfmt{gls}}
142 \syntax{\oargm{options}\margm{label}\oargm{insert}}
143 }
144 % \Gls
145 \gcmd{Gls}
146 {
147 \syntax{\oargm{options}\margm{label}\oargm{insert}}
148 }
149 % \glsadd
150 \gcmd{glsadd}{\syntax{\oargm{new options}\margm{label}}}
151 % \glslink
152 \gcmd{glslink}{\syntax{\oargm{new options}\margm{label}\margm{text}}}
153 % \useglosentry
154 \gcmd{use\-glos\-entry}{\syntax{\oargm{old options}\margm{label}}}
155 % \useGlosentry
156 \gcmd{use\-Glos\-entry}{\syntax{\oargm{old options}\margm{label}\margm{text}}}
157 % \newacronym (glossary.sty)
158 \gcmd{oldnewacronym}
159 {
160 \name{\csfmt{new\-acronym} (\styfmt{glossary.sty})}
161 \field{text}{\csfmt{new\-acronym}}
162 \syntax{\oargm{cmd-name}\margm{acronym}\margm{long}\margm{old-options}}
163 }
164 % \newacronym (glossaries.sty)
165 \gcmd{new\-acronym}
166 {
167 \name{\csfmt{new\-acronym} (\styfmt{glossaries.sty})}
168 \field{text}{\csfmt{new\-acronym}}
169 \syntax{\oargm{options}\margm{label}\margm{abbrv}\margm{long}}
170 }
171 % \oldacronym
172 \gcmd{oldacronym}
173 {
174 \syntax{\oargm{cmd-name}\margm{acronym}\margm{long}\margm{old-options}}
175 }
176 % \setacronymstyle
177 \gcmd{set\-acronym\-style}
178 {
179 \syntax{\oargm{glossary-type}\margm{style-name}}
180 }
181 % \useacronym
182 \gcmds{use\-acronym}
183 {
184 \syntax{\oargm{insert}\margm{acr-name}}
185 }
186 % \acrlong
187 \gcmd{acr\-long}{\syntax{\margm{label}}}
188 % \acrshort
189 \gcmd{acr\-short}{\syntax{\margm{label}}}
190 % \acrlongpl
191 \gcmd{acr\-long\-pl}{\syntax{\margm{label}}}
192 % \acrshort
193 \gcmd{acr\-short\-pl}{\syntax{\margm{label}}}
194 % \acs
195 \gcmd{acs}{\syntax{\margm{label}}}
196 % \acl
197 \gcmd{acl}{\syntax{\margm{label}}}
198 % \acrln
199 \gcmd{acrln}{\syntax{\margm{acr-name}}}
200 % \acrsh
201 \gcmd{acrsh}{\syntax{\margm{acr-name}}}
202 % \ifacronymfirstuse
203 \gcmd{if\-acronym\-first\-use}
204 {
205 \syntax{\margm{acr-name}\margm{not used text}\margm{has been used text}}
206 }
207 % \ifglsused
208 \gcmd{if\-gls\-used}
209 {
210 \syntax{\margm{label}\margm{has been used text}\margm{not used text}}
211 }
212 % \resetacronym
213 \gcmd{reset\-acronym}{\syntax{\margm{acr-name}}}
214 % \unsetacronym
215 \gcmd{unset\-acronym}{\syntax{\margm{acr-name}}}
216 % \resetallacronyms
217 \gcmd{reset\-all\-acronyms}{}
218 % \unsetallacronyms
219 \gcmd{unset\-all\-acronyms}{}
220 % \glsreset
221 \gcmd{gls\-reset}{\syntax{\margm{label}}}
222 % \glslocalreset
223 \gcmd{gls\-local\-reset}{\syntax{\margm{label}}}
224 % \glsunset
225 \gcmd{gls\-unset}{\syntax{\margm{label}}}
226 % \glslocalunset
227 \gcmd{gls\-local\-unset}{\syntax{\margm{label}}}
228 % \glsresetall
229 \gcmd{gls\-reset\-all}{\syntax{\oargm{glossary-types}}}
230 % \glsunsetall
231 \gcmd{gls\-unset\-all}{\syntax{\oargm{glossary-types}}}
232 % \glslocalresetall
233 \gcmd{gls\-local\-reset\-all}{\syntax{\oargm{glossary-types}}}
234 % \glslocalunsetall
235 \gcmd{gls\-local\-unset\-all}{\syntax{\oargm{glossary-types}}}
236 % \<acr-name>
237 \gcmdmeta{}{acr\dhyphen name}{}{\field{modifiers}{*}}
238 % new key: type
239 \ggloskey{type}{\syntax{\meta{glossary-type}}}
240 % new key: name
241 \ggloskey{name}{\syntax{\margm{text}}}
242 % new key: description
243 \ggloskey{description}{\syntax{\margm{text}}}
244 % new key: counter
245 \ggloskey{counter}{\syntax{\margm{counter-name}}}
246 % new key: sort
247 \ggloskey{sort}{\syntax{\margm{text}}}
248 % new key: first
249 \ggloskey{first}{\syntax{\margm{text}}}
250 % new key: firstplural
251 \ggloskey{first\-plural}{\syntax{\margm{text}}}
252 % new key: text
253 \ggloskey{text}{\syntax{\margm{text}}}
254 % new key: plural
255 \ggloskey{plural}{\syntax{\margm{text}}}
256 % old key: name
257 \gstoregloskey{name}{\syntax{\margm{text}}}
258 % old key: description
259 \gstoregloskey{description}{\syntax{\margm{text}}}
260 % old key: format
261 \gstoregloskey{format}{\syntax{\meta{csname}}}
262 % old key: number
263 \gstoregloskey{number}{\syntax{\meta{counter-name}}}
264 % old key: sort
265 \gstoregloskey{sort}{\syntax{\margm{text}}}
266 % gls key: format
267 \gglsopt{format}{\syntax{\meta{csname}}}
268 % gls key: counter
269 \gglsopt{counter}{\syntax{\meta{counter-name}}}
270 % useglosentry key: format
271 \guseglsopt{format}{\syntax{\meta{csname}}}
272 % useglosentry key: number
273 \guseglsopt{number}{\syntax{\margm{counter-name}}}
274 % package option style
275 \gstyopt{style}%
276 {%
277 \syntax{\meta{style-name}}
278 }
279 % package option nonumberlist
280 \gstyopt{nonumberlist}{}
281 % package option counter
282 \gstyopt{counter}%
283 {%
284 \syntax{\meta{counter-name}}
285 }
286 % package option toc
287 \gstyopt{toc}%
288 {%
289 \syntax{\meta{boolean}}
290 }
291 % package option section
292 \gstyopt{section}
293 {
294 \syntax{\meta{value}}
295 }
296 % package option acronym
297 \gstyopt{acronym}%
298 {%
299 \syntax{\meta{boolean}}
300 }
301 % printgloss style
302 \gprintglossopt{style}{%
303 \syntax{\meta{style-name}}
304 }
305 % printgloss type
306 \gprintglossopt{type}{%
307 \syntax{\meta{glossary-label}}
308 }
309 % printgloss nonumberlist
310 \gprintglossopt{no\-number\-list}{}
311 % printgloss toctitle
312 \gprintglossopt{toc\-title}{}
313 % acronym style: long-short-desc
314 \gacrsty{long\dhyphen short\dhyphen desc}{}
315 % glossary style: long
316 \gglosty{long}{}
317 % glossary style: longheader
318 \gglosty{long\-header}{}
319 % glossary style: longborder
320 \gglosty{long\-border}{}
321 % glossary style: longheaderborder
322 \gglosty{long\-header\-border}{}
323 % glossary style: long3col
324 \gglosty{long3col}{}
325 % glossary style: long3colheader
326 \gglosty{long3col\-header}{}
327 % glossary style: long3colborder
328 \gglosty{long3col\-border}{}
329 % glossary style: long3colheaderborder
330 \gglosty{long3col\-header\-border}{}
331 % glossary style: super
332 \gglosty{super}{}
333 % glossary style: superheader
334 \gglosty{super\-header}{}
335 % glossary style: superborder
336 \gglosty{super\-border}{}
337 % glossary style: superheaderborder
338 \gglosty{super\-header\-border}{}
339 % glossary style: super3col
340 \gglosty{super3col}{}
341 % glossary style: super3colheader
342 \gglosty{super3col\-header}{}
343 % glossary style: super3colborder
344 \gglosty{super3col\-border}{}
345 % glossary style: super3colheaderborder
346 \gglosty{super3col\-header\-border}{}
347 % applications:
348 \gapp{makeindex}{}
349 \gapp{xindy}{}
350 \gapp{makeglos}{}
351 \gapp{makeglossaries}{}
352 \gapp{bib2gls}{}
353 % punctuation
354 \gpunc{at}{\name{\code{@}}}
355 \gpunc{excl}{\name{\code{!}}}
356 \gpunc{dblquote}{\name{\code{"}}}
357 \gpunc{vbar}{\name{\code{|}}}
358 % packages
359 \gpkg{xspace}{}
360 \gpkg{glossaries\dhyphen extra}{}
361 % file types
362 \gext{glo}{}
363 \gext{glg}{}
364 \gext{gls}{}
365 }
366
367 \title{Upgrading from the glossary package to the glossaries
368 package}
369 \author{Nicola L.C. Talbot}
370 \date{2026-04-21}
371
372 \newenvironment{oldway}
373 {\begin{codebox*}[title={\styfmt{glossary.sty}}]}
374 {\end{codebox*}}
375
376 \newenvironment{newway}
377 {\begin{codebox*}[title={\styfmt{glossaries.sty}}]}
378 {\end{codebox*}}
379
380 \begin{document}
381 \maketitle
382
383 \htmlavailable
384
385 \begin{abstract}
386 The purpose of this document is to provide advice if you want to
387 convert a \LaTeX\ document from using the obsolete \styfmt{glossary}
388 package to the replacement \styfmt{glossaries} package.
389 The final version of the \styfmt{glossary} package is 2.4 (2006-07-20).
390 It was made obsolete after the release of \styfmt{glossaries}
391 v1.0 (2007-05-16).
392 \end{abstract}
393
394 For the main \styfmt{glossaries} user guide, see
395 \filefmt{glossaries-user.pdf}.
396 \texdocref{glossaries-user}
397 For a shorter guide for beginners, see
398 \filefmt{glossariesbegin.pdf}.
399 \texdocref{glossariesbegin}
400
401 \tableofcontents
402
403 \section{Why the Need for a New Package?}
404 \label{whyglossaries}
405
406 The \styfmt{glossary} package started out as an example in a tutorial,
407 but I decided that I may as well package it up and upload it to CTAN.
408 Unfortunately it was fairly rigid and unable to adapt well to the
409 wide variation in glossary styles. Users began making requests for
410 enhancements, but with each enhancement the code became more
411 complicated and bugs crept in. Each fix in one place seemed to cause
412 another problem elsewhere. In the end, it was taking up too much
413 of my time to maintain, so I decided to replace it with a much
414 better designed package. With the new \styfmt{glossaries} package:
415
416 \begin{itemize}
417 \item you can define irregular plurals;
418
419 \item glossary terms can have an associated symbol in addition
420 to the name and description;
421
422 \item new glossary styles are much easier to design;
423
424 \item you can add dictionaries to supply translations for the
425 fixed names used in headings and by some of the glossary styles;
426
427 \item you can choose between using \app{makeindex} or \app{xindy} to
428 sort the glossary. Using \app{xindy} means that:
429
430 \begin{itemize}
431 \item there is much better support for terms containing accented
432 or non-Latin characters;
433
434 \item there is support for non-standard location numbers;
435 \end{itemize}
436
437 (Additional indexing options have since been added. See
438 the \qt{Indexing Options} section
439 of the \styfmt{glossaries} user manual.)
440
441 \item you don't need to remember to escape \app{makeindex}['s]
442 special characters as this is done internally;
443
444 \item hierarchical entries and homographs are supported (as
445 from v1.17);
446
447 \item there is better support for cross-referencing glossary entries;
448
449 \item acronyms are just another glossary term which helps to
450 maintain consistency;
451
452 \item different acronym styles are supported.
453
454 \end{itemize}
455
456 \section{Package Options}
457
458 When converting a document that currently uses the obsolete
459 \styfmt{glossary} package to the replacement \styfmt{glossaries} package,
460 it should be fairly obvious that the first thing you need to do is
461 replace \code{\cmd{usepackage}\marg{glossary}} with
462 \code{\cmd{usepackage}\marg{glossaries}}, however some of the package options
463 are different, so you may need to change those as well.
464 Table~\ref{tab:pkgopt} shows the mappings from the \styfmt{glossary}
465 to the \styfmt{glossaries} package options.
466
467 \begin{table}[htbp]
468 \caption[Mappings]{Mappings from \styfmt{glossary} to \styfmt{glossaries}
469 package options}
470 \label{tab:pkgopt}
471 \centering
472 \begin{tabular}{ll}
473 \bfseries \styfmt{glossary} option & \bfseries \styfmt{glossaries} option\\
474 style=list & style=list\\
475 style=altlist & style=altlist\\
476 style=long,header=none,border=none,cols=2 & \opt{style}=\glostyle{long}\\
477 style=long,header=plain,border=none,cols=2 & \opt{style}=\glostyle{longheader}\\
478 style=long,header=none,border=plain,cols=2 & \opt{style}=\glostyle{longborder}\\
479 style=long,header=plain,border=plain,cols=2 & \opt{style}=\glostyle{longheaderborder}\\
480 style=long,header=none,border=none,cols=3 & \opt{style}=\glostyle{long3col}\\
481 style=long,header=plain,border=none,cols=3 & \opt{style}=\glostyle{long3colheader}\\
482 style=long,header=none,border=plain,cols=3 & \opt{style}=\glostyle{long3colborder}\\
483 style=long,header=plain,border=plain,cols=3 & \opt{style}=\glostyle{long3colheaderborder}\\
484 style=super,header=none,border=none,cols=2 & \opt{style}=\glostyle{super}\\
485 style=super,header=plain,border=none,cols=2 & \opt{style}=\glostyle{superheader}\\
486 style=super,header=none,border=plain,cols=2 & \opt{style}=\glostyle{superborder}\\
487 style=super,header=plain,border=plain,cols=2 & \opt{style}=\glostyle{superheaderborder}\\
488 style=super,header=none,border=none,cols=3 & \opt{style}=\glostyle{super3col}\\
489 style=super,header=plain,border=none,cols=3 & \opt{style}=\glostyle{super3colheader}\\
490 style=super,header=none,border=plain,cols=3 & \opt{style}=\glostyle{super3colborder}\\
491 style=super,header=plain,border=plain,cols=3 & \opt{style}=\glostyle{super3colheaderborder}\\
492 number=none & \opt{nonumberlist}\\
493 number=\meta{counter name} & \opt{counter}=\meta{counter name}\\
494 toc & \opt{toc}\\
495 hypertoc & \opt{toc}\\
496 hyper & \emph{no corresponding option}\\
497 section=true & \opt{section}\\
498 section=false & \emph{no corresponding option}\\
499 acronym & \opt{acronym}\\
500 global & \emph{no corresponding option}
501 \end{tabular}
502 \end{table}
503
504 \section{Defining new glossary types}
505
506 If you have created new glossary types, you will need to
507 replace all instances of
508 \begin{oldway}
509 \cmddefsyntax{}{newglossarytype}\newline
510 \csfmt{newcommand}\marg{\meta{type}name}\margm{title}
511 \end{oldway}%
512 with
513 \begin{newway}
514 \cmddefsyntax{}{newglossary}
515 \end{newway}%
516 in the preamble, and, if the new glossary requires a different style
517 to the main (default) glossary, you will also need to put
518 \begin{newway}
519 \cmddefsyntax{}{setglossarystyle}
520 \end{newway}%
521 immediately before the glossary is displayed, or you can specify
522 the style when you display the glossary using \gls{printglossary}
523 (see below).
524
525 The \meta{old style list} optional argument can be converted to
526 \meta{new-style} using the same mapping given in
527 Table~\ref{tab:pkgopt}.
528
529 For example, if your document contains the following:
530 \begin{oldway}
531 \gls{newglossarytype}\oarg{nlg}\marg{notation}\marg{not}\marg{ntn}\oarg{style=long,header}
532 \cmd{newcommand}\marg{\cmd{notationname}}\marg{Index of Notation}
533 \end{oldway}
534 You will need to replace the above two lines with:
535 \begin{newway}
536 \gls{newglossary}\oarg{nlg}\marg{notation}\marg{not}\marg{ntn}\marg{Index of Notation}
537 \end{newway}
538 in the preamble and set the style to \glostyle{longheader} with
539 \begin{newway}
540 \gls{setglossarystyle}\marg{\glostyle{longheader}}
541 \end{newway}
542 prior to displaying this glossary. Alternatively, you
543 can specify the style using \opt{style} package option (which makes
544 it the default style) or the \printglossopt{style} key in
545 the optional argument of \gls{printglossary}. For example:
546 \begin{newway}
547 \gls{printglossary}\oarg{\printglossoptval{type}{notation},\printglossoptval{style}{\glostyle{longheader}}}
548 \end{newway}
549
550 Note that the glossary title is no longer specified using
551 \gls{glossary-typename} (except for \gls{glossaryname}
552 and \gls{acronymname}) but is instead specified in the \meta{title}
553 argument of \gls{newglossary}. The short title which is specified in
554 the \styfmt{glossary} package by the command
555 \gls{shortglossary-typename} is now specified using
556 the \printglossopt{toctitle} key in the optional argument to
557 \gls{printglossary}.
558
559 \section{\glsfmttext{makeglossary-type}}
560
561 All instances of \gls{makeglossary-type} (e.g.\
562 \gls{makeglossary} and \gls{makeacronym}) should be replaced
563 by the single command \gls{makeglossaries}. For example, if
564 your document contained the following:
565 \begin{oldway}
566 \gls{makeglossary}
567 \gls{makeacronym}
568 \end{oldway}
569 then you should replace both lines with the single line:
570 \begin{newway}
571 \gls{makeglossaries}
572 \end{newway}
573
574 \section{Storing glossary information}
575
576 With the old \styfmt{glossary} package you could optionally store
577 glossary information for later use, or you could simply use
578 \gls{glossary} whenever you wanted to add information to the glossary.
579 With the new \styfmt{glossaries} package, the latter option is no longer
580 available. (This is mainly because having a key value list in
581 \gls{glossary} caused problems, but it also helps consistency.) If
582 you have stored all the glossary information using
583 \gls{storeglosentry}, then you will need to convert these commands
584 into the equivalent \gls{newglossaryentry}. If you have only
585 used \gls{glossary}, then see \sectionref{sec:csglossary}.
586
587 Substitute all instances of
588 \begin{oldway}
589 \cmddefsyntax{}{storeglosentry}
590 \end{oldway}%
591 with
592 \begin{newway}
593 \cmddefsyntax{}{newglossaryentry}
594 \end{newway}%
595 This should be fairly easy to do using the search and replace
596 facility in your editor (but see notes below).
597
598 If you have used the optional argument of \gls{storeglosentry}
599 (i.e.\ you have multiple glossaries) then you will need to
600 substitute
601 \begin{oldway}
602 \gls{storeglosentry}\oargm{gls-type}\margm{label}\marg{\keyvallist}
603 \end{oldway}%
604 with
605 \begin{newway}
606 \gls{newglossaryentry}\margm{label}\marg{\keyvallist,\gloskeyval{type}{\meta{gls-type}}}
607 \end{newway}
608
609 The glossary entry information \keyvallist\ may also need
610 changing. If \keyvallist\ contains any of \app{makeindex}['s]
611 special characters (i.e.\ \idx{at} \idx{excl} \idx{dblquote} or
612 \idx{vbar}) then they should no longer be escaped with \idx{dblquote}
613 since the \styfmt{glossaries} package deals with these characters
614 internally. For example, if your document contains the following:
615 \begin{oldway}
616 \gls{storeglosentry}\marg{card}\marg{\storegloskeyval{name}{\$\idx{dblquote}\idx{vbar}\cmd{mathcal}\marg{S}\idx{dblquote}\idx{vbar}\$},
617 \storegloskeyval{description}{The cardinality of the set \$\cmd{mathcal}\marg{S}\$}}
618 \end{oldway}
619 then you will need to replace it with:
620 \begin{newway}
621 \gls{newglossaryentry}\marg{card}\marg{\gloskeyval{name}{\$\idx{vbar}\cmd{mathcal}\marg{S}\idx{vbar}\$},
622 \gloskeyval{description}{The cardinality of the set \$\cmd{mathcal}\marg{S}\$}}
623 \end{newway}
624
625 The \storegloskey{number} key available in \gls{storeglosentry}
626 should be replaced with the \gloskey{counter} key in
627 \gls{newglossaryentry}. The \storegloskey{sort} key in \gls{storeglosentry}
628 is also called \gloskey{sort} in \gls{newglossaryentry}.
629
630 The \gls{storeglosentry} \storegloskey{format} key doesn't have a
631 counterpart in \gls{newglossaryentry}. You can, however, specify the
632 format in the optional argument of commands like \gls{gls} or
633 \gls{glsadd} or you can change the default format by redefining
634 \gls{glsnumberformat}.
635
636 \section{Adding an entry to the glossary}
637
638 The \styfmt{glossary} package provided two basic means to add
639 information to the glossary: firstly, the term was defined
640 using \gls{storeglosentry} and the entries for that term were
641 added using \gls{useglosentry}, \gls{useGlosentry} and \gls{gls}.
642 Secondly, the term was added to the glossary using \gls{glossary}.
643 This second approach is unavailable with the \styfmt{glossaries}
644 package, since all entries must be defined before they can be
645 indexed.
646
647 \subsection{\glsfmttext{useglosentry}}
648 \label{sec:useglosentry}
649
650 The \styfmt{glossary} package allows you to add information to the
651 glossary for a predefined term without producing any text in the
652 document using
653 \begin{oldway}
654 \cmddefsyntax{}{useglosentry}
655 \end{oldway}%
656 Any occurrences of this command will need to be replaced with
657 \begin{newway}
658 \cmddefsyntax{}{glsadd}
659 \end{newway}%
660 The \useglsopt{format} key in \meta{old options} is also called
661 \glsopt{format} in \meta{new options}. However the
662 \optdefsyntax{}{useglsopt.number} key in
663 \meta{old options} should be replaced with
664 \optdefsyntax{}{glsopt.counter} in \meta{new options}.
665
666 \subsection{\glsfmttext{useGlosentry}}
667
668 The \styfmt{glossary} package allows you to add information to the
669 glossary for a predefined term with the given text using
670 \begin{oldway}
671 \cmddefsyntax{}{useGlosentry}
672 \end{oldway}%
673 Any occurrences of this command will need to be replaced with
674 \begin{newway}
675 \cmddefsyntax{}{glslink}
676 \end{newway}%
677 The mapping from \meta{old options} to \meta{new options} is
678 the same as that given \sectionref{sec:useglosentry}.
679
680 \subsection{\glsfmttext{oldgls}}
681
682 The \styfmt{glossary} defines:
683 \begin{oldway}
684 \cmddefsyntax{}{oldgls}
685 \end{oldway}
686 The \styfmt{glossaries} package defines a command with the same
687 name, but be aware that it has a final optional argument:
688 \begin{newway}
689 \cmddefsyntax{}{gls}
690 \end{newway}
691 In this case, the only thing you need to
692 change is the \useglsopt{number} key in the optional argument
693 to \glsopt{counter}. The \meta{insert} optional argument in the
694 new form of \gls{gls} can be used to insert text into the
695 automatically generated text, which will put it inside the hyperlink
696 (if hyperlinks are supported).
697
698 \subsection{\glsfmttext{glossary}}
699 \label{sec:csglossary}
700
701 When using the \styfmt{glossaries} package, you should not use
702 \gls{glossary}. This is because the appropriate indexing syntax (including
703 escaping any of \app{makeindex}'s or \app{xindy}'s special
704 characters) is generated when the entry is defined. This reduces
705 overall complexity as it no longer needs to be performed every time
706 an entry is indexed. By placing the glossary definitions within the
707 preamble, it also reduces the chance that the indexing special
708 character may have their category code changed, which can cause
709 interference.
710
711 If, with the old package, you have opted to
712 explicitly use \gls{glossary} instead of storing the glossary
713 information with \gls{storeglosentry}, then converting from
714 \styfmt{glossary} to \styfmt{glossaries} will be more time-consuming,
715 although in the end, I hope you will see the benefits. From
716 the user's point of view, using \gls{glossary} throughout the
717 document is time consuming, and if you use it more than once for the
718 same term, there's a chance extra spaces may creep in which will
719 cause \app{makeindex} to treat the two entries as different
720 terms, even though they look the same in the document. If you have
721 used \gls{glossary} with the old glossary package, you will instead
722 need to define the relevant glossary terms using
723 \gls{newglossaryentry} and reference the terms using
724 \gls{glsadd}, \gls{glslink}, \gls{gls} etc.
725
726 If you don't like the idea of continually scrolling back to the
727 preamble to type all your \gls{newglossaryentry} commands, you may
728 prefer to create a new file, in which to store all these commands,
729 and then input that file in your document's preamble. Most text
730 editors and front-ends allow you to have multiple files open, and
731 you can tab back and forth between them.
732
733 \section{Acronyms}
734
735 In the \styfmt{glossary} package, acronyms were treated differently
736 to glossary entries. This resulted in inconsistencies and sprawling
737 unmaintainable code. The new \styfmt{glossaries} package treats
738 acronyms in exactly the same way as normal glossary terms.
739
740 Both packages provide \csfmt{newacronym}, but the syntax is
741 different. With the \styfmt{glossary} package, the syntax is:
742 \begin{oldway}
743 \cmddefsyntax{}{oldnewacronym}
744 \end{oldway}
745 With the \styfmt{glossaries} package, the default definition of:
746 \begin{newway}
747 \cmddefsyntax{}{newacronym}
748 \end{newway}
749 is a shortcut for:
750 \begin{newway}
751 \gls{newglossaryentry}\margm{label}\marg{type=\gls{acronymtype},
752 \gloskeyval{name}{\meta{abbrv}},
753 \gloskeyval{description}{\meta{long}},
754 \gloskeyval{text}{\meta{abbrv}},
755 \gloskeyval{first}{\meta{long} (\meta{abbrv})},
756 \gloskeyval{plural}{\meta{abbrv}s},
757 \gloskeyval{firstplural}{\meta{long}s (\meta{abbrv}s)},
758 \meta{options}}
759 \end{newway}
760 (Note that this shortcut default is an older method of defining
761 acronyms. If you use \gls{setacronymstyle} introduced to
762 \styfmt{glossaries} v4.02, then a more flexible method is adopted.)
763
764 This is different to the \styfmt{glossary} package which set the
765 \storegloskey{name} key to \meta{long} (\meta{abbrv}) and
766 allowed you to set a description using the
767 \storegloskey{description} key. If you still want to do
768 this, you can use one of the description styles, such as
769 \acrstyle{long-short-desc}, and use
770 the \gloskey{description} key in the optional
771 argument of \gls{newacronym}.
772
773 For example, if your document originally had the following:
774 \begin{oldway}
775 \gls{oldnewacronym}\marg{SVM}\marg{Support Vector Machine}\marg{\storegloskeyval{description}{Statistical
776 pattern recognition technique}}
777 \end{oldway}
778 Then you would need to first set the style:
779 \begin{newway}
780 \gls{setacronymstyle}\marg{\acrstyle{long-short-desc}}
781 \end{newway}
782 and change the acronym definition to:
783 \begin{newway}
784 \gls{newacronym}\oarg{\gloskeyval{description}{Statistical pattern recognition
785 technique}}\marg{svm}\marg{SVM}\marg{Support Vector Machine}
786 \end{newway}
787 You can then reference the acronym using any of the new referencing
788 commands, such as \gls{gls} or \gls{glsadd}.
789
790 With the old \styfmt{glossary} package, when you defined an
791 acronym, it also defined a command \gls{acr-name} which
792 could be used to display the acronym in the text. So the
793 above SVM example would create the command \csfmt{SVM} with the old
794 package. In the new \styfmt{glossaries} package, the acronyms are just
795 another type of glossary entry, so they are displayed using
796 \code{\gls{gls}\margm{label}}. Therefore, in the above example, you will
797 also need to replace all occurrences of \csfmt{SVM} with
798 \code{\gls{gls}\marg{svm}}.
799
800 If you have used \gls{useacronym} instead of \gls{acr-name},
801 then you will need to replace all occurrences of
802 \begin{oldway}
803 \cmddefsyntax{}{useacronym}
804 \end{oldway}%
805 with
806 \begin{newway}
807 \gls{gls}\margm{label}\oargm{insert}
808 \end{newway}%
809 Note that the starred versions of \gls{useacronym} and
810 \gls{acr-name} (which make the first letter uppercase) should
811 be replaced with \code{\gls{Gls}\margm{label}}.
812
813 Alternatively (as from v1.18 of the \styfmt{glossaries} package),
814 you can use \gls{oldacronym} which uses the same syntax as
815 the old \styfmt{glossary} package's \gls{oldnewacronym} and also
816 defines \gls{acr-name}.
817 For example, if your document originally had the following:
818 \begin{oldway}
819 \gls{oldnewacronym}\marg{SVM}\marg{Support Vector Machine}\marg{\storegloskeyval{description}{Statistical
820 pattern recognition technique}}
821 \end{oldway}
822 then you can change this to:
823 \begin{newway}
824 \gls{oldacronym}\marg{SVM}\marg{Support Vector Machine}\marg{\gloskeyval{description}{Statistical
825 pattern recognition technique}}
826 \end{newway}
827 You can then continue to use \csfmt{SVM}\@. However, remember that
828 \LaTeX\ generally ignores spaces after command names that consist of
829 alphabetical characters. You will therefore need to force a space
830 after \gls{acr-name}, unless you also load the \sty{xspace} package.
831 (See the \qt{Acronyms} of the \styfmt{glossaries} documentation for
832 further details.) Note that \gls{oldacronym} uses its first argument
833 to define the acronym's label (as used by commands like \gls{gls}),
834 so in the above example, with the new \styfmt{glossaries} package,
835 \csfmt{SVM} becomes a shortcut for \code{\gls{gls}\marg{SVM}} and
836 \csfmt{SVM*} becomes a shortcut for \code{\gls{Gls}\marg{SVM}}.
837
838 \subsection{\glsfmttext{acrln} and \glsfmttext{acrsh}}
839 \label{sec:acrlnsh}
840
841 In the \styfmt{glossary} package, it is possible to produce the
842 long and short forms of an acronym without adding an entry to
843 the glossary using \gls{acrln} and \gls{acrsh}. With the
844 \styfmt{glossaries} package (provided you defined the acronym using
845 \gls{newacronym} or \gls{oldacronym} and provided you haven't
846 redefined \gls{newacronym})
847 you can replace
848 \begin{oldway}
849 \cmddefsyntax{}{acrsh}
850 \end{oldway}%
851 with
852 \begin{newway}
853 \cmddefsyntax{}{acrshort}
854 \end{newway}%
855 and you can replace
856 \begin{oldway}
857 \cmddefsyntax{}{acrln}
858 \end{oldway}%
859 with
860 \begin{newway}
861 \cmddefsyntax{}{acrlong}
862 \end{newway}%
863 The \styfmt{glossaries} package also provides the related commands
864 \gls{acrshortpl} (plural short form) and \gls{acrlongpl} (plural long
865 form) as well as upper case variations. If you use the
866 \styfmt{glossaries} \qt{shortcuts} package option, you can use
867 \gls{acs} in place of \gls{acrshort} and \gls{acl} in place of
868 \gls{acrlong}.
869
870 See the \qt{Acronyms}
871 of the \styfmt{glossaries} manual for further details of
872 how to use these commands.
873
874 \subsection{\glsfmttext{ifacronymfirstuse}}
875
876 The \styfmt{glossary} package command
877 \begin{oldway}
878 \cmddefsyntax{}{ifacronymfirstuse}
879 \end{oldway}%
880 can be replaced by the \styfmt{glossaries} command:
881 \begin{newway}
882 \cmddefsyntax{}{ifglsused}
883 \end{newway}%
884 Note that \gls{ifglsused} evaluates the opposite condition to
885 that of \gls{ifacronymfirstuse} which is why the last two arguments
886 have been reversed.
887
888 \subsection{\glsfmttext{resetacronym} and \glsfmttext{unsetacronym}}
889 \label{sec:unreset}
890
891 The \styfmt{glossary} package allows you to reset and unset the
892 acronym flag which is used to determine whether the acronym has
893 been used in the document. The \styfmt{glossaries} package also
894 provides a means to do this on either a local or a global level.
895 To reset an acronym, you will need to replace:
896 \begin{oldway}
897 \cmddefsyntax{}{resetacronym}
898 \end{oldway}%
899 with either
900 \begin{newway}
901 \cmddefsyntax{}{glsreset}
902 \end{newway}%
903 or
904 \begin{newway}
905 \cmddefsyntax{}{glslocalreset}
906 \end{newway}
907
908 To unset an acronym, you will need to replace:
909 \begin{oldway}
910 \cmddefsyntax{}{unsetacronym}
911 \end{oldway}%
912 with either
913 \begin{newway}
914 \cmddefsyntax{}{glsunset}
915 \end{newway}%
916 or
917 \begin{newway}
918 \cmddefsyntax{}{glslocalunset}
919 \end{newway}
920
921 To reset all acronyms, you will need to replace:
922 \begin{oldway}
923 \cmddefsyntax{}{resetallacronyms}
924 \end{oldway}
925 with
926 \begin{newway}
927 \gls{glsresetall}\oarg{\gls{acronymtype}}
928 \end{newway}
929 or
930 \begin{newway}
931 \gls{glslocalresetall}\oarg{\gls{acronymtype}}
932 \end{newway}
933 To unset all acronyms, you will need to replace:
934 \begin{oldway}
935 \cmddefsyntax{}{unsetallacronyms}
936 \end{oldway}
937 with
938 \begin{newway}
939 \gls{glsunsetall}\oarg{\gls{acronymtype}}
940 \end{newway}
941 or
942 \begin{newway}
943 \gls{glslocalunsetall}\oarg{\gls{acronymtype}}
944 \end{newway}
945
946 \section{Displaying the glossary}
947 \label{sec:printgloss}
948
949 The \styfmt{glossary} package provides the command \gls{oldprintglossary}
950 (or \gls{printtype} for other glossary types) which
951 can be used to print individual glossaries. The \styfmt{glossaries}
952 package provides the command \gls{printglossaries} which
953 will print all the glossaries which have been defined, or
954 \cmddefsyntax{}{printglossary} to print individual glossaries.
955 So if you just have \gls{oldprintglossary}, then you can leave it as
956 it is, but if you have, say:
957 \begin{oldway}
958 \gls{oldprintglossary}
959 \gls{oldprintglossary}\oarg{acronym}
960 \end{oldway}
961 or
962 \begin{oldway}
963 \gls{oldprintglossary}
964 \gls{printacronym}*
965 \end{oldway}
966 then you will need to replace this with either
967 \begin{newway}
968 \gls{printglossaries}
969 \end{newway}
970 or
971 \begin{newway}
972 \gls{printglossary}
973 \gls{printglossary}\oarg{type=\gls{acronymtype}}
974 \end{newway}
975
976 The \styfmt{glossary} package allows you to specify a short title
977 (for the table of contents and page header) by defining a command of
978 the form \gls{shortglossary-typename}. The
979 \styfmt{glossaries} package doesn't do this, but instead provides
980 the \printglossopt{toctitle} key which can be used in the
981 optional argument to \gls{printglossary}. For example, if you have
982 created a new glossary type called \code{notation}, and you had
983 defined
984 \begin{oldway}
985 \cmd{newcommand}\marg{\cmd{shortnotationname}}\marg{Notation}
986 \end{oldway}
987 then you would need to use the \printglossopt{toctitle} key:
988 \begin{newway}
989 \gls{printglossary}\oarg{\printglossoptval{type}{notation},\printglossoptval{toctitle}{Notation}}
990 \end{newway}
991 The \styfmt{glossaries} package will ignore \csfmt{shortnotationname},
992 so unless you have used it elsewhere in the document, you may as
993 well remove the definition.
994
995 \section{Processing Your Document}
996 \label{sec:makeglos}
997
998 If you convert your document from using the \styfmt{glossary} package
999 to the \styfmt{glossaries} package, you will need to delete any of
1000 the additional files, such as the \ext+{glo} file, that were
1001 created by the \styfmt{glossary} package, as the \styfmt{glossaries}
1002 package uses a different format.
1003 Remember also, that if you used the \app{makeglos} Perl script,
1004 you will need to use the \app{makeglossaries} Perl script
1005 instead. As from v1.17, the \styfmt{glossaries} package can be
1006 used with either \app{makeindex} or \app{xindy}. Since
1007 \app{xindy} was designed to be multilingual, the
1008 new \styfmt{glossaries} package is a much better option for
1009 non-English documents. If you use the extension package,
1010 \sty{glossaries-extra}, then you also have the option of using
1011 \app{bib2gls} instead (which also provides multilingual support).
1012
1013 For further information on using \app{makeglossaries},
1014 \app{makeindex} or \app{xindy} to create your glossaries, see the
1015 \qt{Generating the Associated Glossary Files} section of the
1016 \styfmt{glossaries} documentation.
1017
1018 \section{Troubleshooting}
1019 \label{sec:troubleshooting}
1020
1021 Please check the \dickimawhref{faqs/glossariesfaq.html}{FAQ}
1022 for the \styfmt{glossaries} package if you have any
1023 problems.
1024
1025 \printterms
1026 \printuserguideindex
1027
1028 \end{document}