Debian Codegraph @

texmf-dist/doc/latex/acro/acro-manual.tex

raw
1 % !arara: pdflatex
2 % !arara: biber
3 % arara: pdflatex
4 % arara: pdflatex
5 % --------------------------------------------------------------------------
6 % the ACRO package
7 %
8 % Typeset Acronyms
9 %
10 % --------------------------------------------------------------------------
11 % Clemens Niederberger
12 % Web: https://github.com/cgnieder/acro/
13 % E-Mail: [email protected]
14 % --------------------------------------------------------------------------
15 % Copyright 2011--2022 Clemens Niederberger
16 %
17 % This work may be distributed and/or modified under the
18 % conditions of the LaTeX Project Public License, either version 1.3c
19 % of this license or (at your option) any later version.
20 % The latest version of this license is in
21 % http://www.latex-project.org/lppl.txt
22 % and version 1.3c or later is part of all distributions of LaTeX
23 % version 2008/05/04 or later.
24 %
25 % This work has the LPPL maintenance status `maintained'.
26 %
27 % The Current Maintainer of this work is Clemens Niederberger.
28 % --------------------------------------------------------------------------
29 \PassOptionsToPackage{ngerman,latin,english}{babel}
30 \PassOptionsToPackage{upgrade}{acro}
31 \documentclass{acro-manual}
32
33 \begin{filecontents}{\jobname.bib}
34 @online{NewYork,
35 author = {Wikipedia},
36 title = {New York City},
37 urldate = {2020-04-11},
38 url = {http://en.wikipedia.org/wiki/New_York_City},
39 year = {2020}
40 }
41 \end{filecontents}
42
43 \addbibresource{\jobname.bib}
44 \addbibresource{cnltx.bib}
45
46 % declare example acronyms
47 \DeclareAcronym{cd}{
48 short = CD ,
49 long = compact disc
50 }
51 \DeclareAcronym{ctan}{
52 short = ctan ,
53 long = Comprehensive \TeX\ Archive Network ,
54 short-format = \scshape ,
55 pdfstring = CTAN ,
56 short-acc = CTAN ,
57 first-style = short-long ,
58 single-style = short
59 }
60 \DeclareAcronym{ecu}{
61 short = ECU ,
62 long = Steuergerät ,
63 foreign = Electronic Control Unit ,
64 foreign-babel = english ,
65 foreign-locale = englisch
66 }
67 \DeclareAcronym{eg}{
68 short = e.g\acdot ,
69 long = for example ,
70 foreign = exempli gratia ,
71 foreign-babel = latin ,
72 short-format = \textit ,
73 foreign-format = \latin
74 }
75 \DeclareAcronym{etc}{
76 short = etc\acdot ,
77 long = et cetera ,
78 format = \textit ,
79 first-style = long ,
80 plural =
81 }
82 \DeclareAcronym{hadopi}{
83 short = HADOPI ,
84 long = Haute Autorit\'{e} pour la diffusion des \oe uvres et la protection des
85 droits sur l’Internet ,
86 short-definite = l'\nospace ,
87 long-definite = la ,
88 }
89 \DeclareAcronym{id}{
90 short = id ,
91 long = identification string ,
92 short-format = \scshape ,
93 short-acc = ID ,
94 pdfstring = ID ,
95 first-style = short
96 }
97 \DeclareAcronym{jpg}{
98 short = JPEG ,
99 sort = jpeg ,
100 alt = JPG ,
101 long = Joint Photographic Experts Group
102 }
103 \DeclareAcronym{la}{
104 short = LA ,
105 long = Los Angeles,
106 plural = ,
107 tag = city
108 }
109 \DeclareAcronym{lppl}{
110 short = lppl ,
111 long = \LaTeX\ Project Public License ,
112 short-format = \scshape ,
113 pdfstring = LPPL ,
114 short-acc = LPPL ,
115 single-style = long-short
116 }
117 \def\LPPL\ (\lppl){\ac{lppl}}
118
119 \DeclareAcronym{MP}{
120 short = MP ,
121 long = Member of Parliament ,
122 plural-form = Members of Parliament ,
123 long-possessive-form = Member's of Parliament
124 }
125 \DeclareAcronym{nato}{
126 short = nato ,
127 long = Organisation des Nordatlantikvertrags ,
128 foreign = North Atlantic Treaty Organization ,
129 foreign-babel = english ,
130 foreign-locale = englisch ,
131 short-format = \scshape
132 }
133 \DeclareAcronym{ny}{
134 short = NY ,
135 long = New York ,
136 plural = ,
137 tag = city ,
138 cite = NewYork
139 }
140 \DeclareAcronym{pdf}{
141 short = pdf ,
142 long = Portable Document Format ,
143 short-format = \scshape ,
144 pdfstring = PDF ,
145 short-acc = PDF
146 }
147 \DeclareAcronym{png}{
148 short = PNG ,
149 long = Portable Network Graphics ,
150 first-style = short-long ,
151 single-style = short
152 }
153 \DeclareAcronym{PU}{
154 short = PU ,
155 long = Polyurethan ,
156 long-plural = e
157 }
158 \DeclareAcronym{sw}{
159 short = SW ,
160 long = Sammelwerk ,
161 long-plural = e
162 }
163 \DeclareAcronym{tex.sx}{
164 short = \TeX.sx ,
165 sort = TeX.sx ,
166 long = \TeX{} StackExchange
167 }
168 \DeclareAcronym{ufo}{
169 short = UFO ,
170 long = unidentified flying object ,
171 foreign = unbekanntes Flugobjekt ,
172 foreign-plural-form = unbekannte Flugobjekte ,
173 foreign-acc-plural-form = unbekannte Flugobjekte ,
174 foreign-babel = ngerman ,
175 long-indefinite = an
176 }
177
178 % declare glossary terms:
179 \DeclareAcronym{property}{
180 long = A \property*{property} is an option to the second argument of the
181 \cs*{DeclareAcroym} command. They are options of an individual acronym if
182 you will. ,
183 tag = glossary , no-index
184 }
185 \DeclareAcronym{option}{
186 long = {An \option*{option} is a package option of \acro\ which must set
187 with \cs*{acsetup}. It \emph{cannot} be set as option to \cs*{usepackage}.
188 Options usually also can be set in the optional argument of \cs*{ac} and
189 friends.} ,
190 tag = glossary , no-index
191 }
192 \DeclareAcronym{module}{
193 long = {A \module*{module} is something like a superordinate category for
194 options. There are several such modules like \module{list} or
195 \module{pages} for example. Options belonging to a module typically
196 influence certain objects. For instance options belonging to the
197 \module{pages} influence how page numbers in the list of acronyms are
198 handled.} ,
199 tag = glossary , no-index
200 }
201 \DeclareAcronym{load-time option}{
202 long = {A load-time \option*{option} is a package option of \acro\ which
203 \emph{must} be set as option to
204 \cs*{usepackage}\oarg{options}\Marg{acro}.} ,
205 tag = glossary , no-index
206 }
207 \DeclareAcronym{template}{
208 long = {A \template*{template} determines how different objects of \acro\
209 are printed. This includes the acronyms themselves but also for example
210 the list of acronyms as a whole.} ,
211 tag = glossary , no-index
212 }
213 \DeclareAcronym{articles}{
214 long = {Articles are prefixes to acronyms, usually separated with a blank.
215 \emph{Different types of articles are mutually exclusive.}} ,
216 tag = glossary , no-index
217 }
218 \DeclareAcronym{endings}{
219 long = {Endings are postfixes to acronyms, usually not separated from the
220 acronym. \emph{Different types of endings are mutually exclusive.}} ,
221 tag = glossary , no-index
222 }
223 \DeclareAcronym{translations}{
224 long = {Localisation strings which can be modified.} ,
225 tag = glossary , no-index
226 }
227
228 \newcommand*\issues{\url{https://github.com/cgnieder/acro/issues}}
229 \newcommand*\latin[1]{\textit{#1}}
230
231 \begin{document}
232
233 \clearpage
234 \part{Get started with \acro}\label{part:get-started-with}
235
236 \section{Licence}\label{sec:licence}
237 \license
238
239 \section{Glossary}
240 \printacronyms[include=glossary,template=glossary,preamble=This manual
241 repeatedly uses a number of terms which are explained in this section.]
242
243 \section{Reading the manual}
244 This manual uses a certain color code in order to be able to distinguish
245 options, properties and templates visually from each other.
246 \begin{options}
247 \keyval*{option}{value}
248 Options are displayed in \textcolor{option}{yellow}. For the description
249 of options a certain nomenclature is used which is explained in
250 section~\ref{sec:setting-options}. Some options belong to module which are
251 displayed in \textcolor{module}{red}.
252 \end{options}
253 \begin{properties}
254 \propval*{property}{value}
255 In order to distinguish them visually from options properties are
256 displayed in \textcolor{property}{blue}. The nomenclature of properties
257 is quite similar to the one of the options so it is not explained
258 explicilty but should be clear by analogy.
259 \end{properties}
260 \begin{templates}
261 \tmpl*{template}
262 In order to distinguish them visually from options and properties
263 templates are displayed in \textcolor{template}{green}.
264 \end{templates}
265
266 \section{\acro\ for the impatient}\label{sec:acro-impatient}
267
268 Acronyms are defined in the preamble via the command
269 \begin{commands}
270 \command{DeclareAcronym}[\marg{id}\marg{properties}]
271 where \meta{id} is a unique string to identify the acronym and
272 \meta{properties} is a key\slash value list of acronym properties. These
273 include:
274 \end{commands}
275 \begin{properties}
276 %% short
277 \propval{short}{text}\Initial!
278 The short form of the acronym. \emph{This property is required}: an
279 acronym must have a short form.
280 %% long
281 \propval{long}{text}\Initial!
282 The long form of the acronym. \emph{This property is required}: an
283 acronym must have a description.
284 \end{properties}
285 \begin{bewareofthedog}
286 In its simplest form an acronym needs a short and a long form. Please note
287 that both properties \emph{must} be set.
288 \end{bewareofthedog}
289
290 In the document acronyms are used with these commands:
291 \begin{commands}
292 \command{ac}[\marg{id}\quad\cs{Ac}\marg{id}]
293 \cs{ac} prints the acronym \meta{id}, the first time with full description
294 and every subsequent use only the abbreviated form. \cs{Ac} does the same
295 but uppercases the first letter -- this may be needed at the beginning of
296 a sentence.
297 \command{acs}[\marg{id}\quad\cs{Acs}\marg{id}]
298 \cs{acs} prints the short form of the acronym \meta{id}. \cs{Acs} does the
299 same but uppercases the first letter.
300 \command{acl}[\marg{id}\quad\cs{Acl}\marg{id}]
301 \cs{acl} prints the long form of the acronym \meta{id}. \cs{Acl} does the
302 same but uppercases the first letter.
303 \command{acf}[\marg{id}\quad\cs{Acf}\marg{id}]
304 \cs{acf} prints the full form of the acronym \meta{id}. \cs{Acf} does the
305 same but uppercases the first letter.
306 \end{commands}
307
308 Let's say you defined \acs*{cd} as follows:
309 \begin{sourcecode}
310 \DeclareAcronym{cd}{
311 short = CD ,
312 long = compact disc
313 }
314 \end{sourcecode}
315 Then the usage is
316 \begin{example}[side-by-side]
317 \begin{tabular}{ll}
318 first & \ac{cd} \\
319 second & \ac{cd} \\
320 long & \acl{cd} \\
321 short & \acs{cd} \\
322 full & \acf{cd}
323 \end{tabular}
324 \end{example}
325
326 \section{Setting options}\label{sec:setting-options}
327 \subsection{Load-time options}\label{sec:load-time-options}
328 \acro\ knows only a small set of load-time options which can be used as
329 argument to \cs*{usepackage}:
330 \begin{options}
331 \keybool{upgrade}\Initial{false}
332 When this option is used \acro\ tries to give as much helpful and
333 meaningful warning or error messages when a deprecated or removed command,
334 property, or option is used. This is especially useful if you are
335 upgrading from version~2.
336 \end{options}
337
338 You can still use version~2 by specifying using one of the following options:
339 \begin{sourcecode}
340 \usepackage{acro}[=v2]
341 \usepackage{acro}[=version2]
342 \end{sourcecode}
343
344 \subsection{Setup command}\label{sec:setup-command}
345 All options of \acro\ that have \emph{not} been mentioned in
346 section~\ref{sec:load-time-options} have to be set up either with this command
347 \begin{commands}
348 \command{acsetup}[\marg{options}]
349 or as option to other commands. If the latter is possible then it is
350 described when the corresponding commands are explained. Options usually
351 follow a key\slash value syntax and are always described in the following
352 way:
353 \end{commands}
354 \begin{options}
355 \opt*{option}
356 An option without a value. Those options are very rare if there are any.
357 \keyval*{option}{value}\Initial{preset}
358 An option where a value can be given. The pre-set value is given to the
359 right.
360 \keychoice*{option}{\default{choiceA},choiceB,choiceC}\Initial{choiceB}
361 An option with a determined set of choices. The underlined value is
362 chosen if the option is given without value.
363 \keybool*{option}
364 A boolean option with the only choices \code{true} and \code{false}.
365 \opt*{option}\Module{module}
366 An option at a deeper level belonging to the module \module*{module}.
367 \end{options}
368 All of the above is probably clear from an example (using real options):
369 \begin{sourcecode}
370 \acsetup{
371 make-links = true , % boolean
372 index , % boolean
373 format = \emph , % standard
374 list / local , % boolean option of the list module
375 list / display = all % choice option of the list module
376 }
377 \end{sourcecode}
378
379 \part{Comprehensive description of creation and usage of acronyms}\label{part:compr-descr-creat}
380 \section{Declaring acronyms and other abbreviations}\label{sec:decl-acronyms-other}
381
382 All acronyms have to be declared in the preamble with the following command in
383 order to be used in the document. Any usage of an acronym which has not been
384 declared leads to an error message.
385 \begin{commands}
386 \command{DeclareAcronym}[\marg{id}\marg{list of properties}]
387 The basic command for declaring an acronym where \meta{id} is a unique
388 string identifying the acronym. Per default this is case sensitive which
389 means \code{id} is different from \code{ID}, for example.
390 \end{commands}
391 The command understands a number of properties which are listed in the
392 following sections. This is a comprehensive overview over the existing
393 properties. Many properties are also explained in more detail in later
394 sections of this manual.
395 \begin{options}
396 \keybool{case-sensitive}\Initial{true}
397 When this is set you can write the \ac{id} of the acronym upper- or lower-
398 or mixed case and it is recognized by \acro\ as the same. This might be
399 useful when the acronym appears in the page header, for example.
400 \keybool{case-insensitive}\Initial{false}
401 \sinceversion{3.6}The inverse of the option \option{case-sensitive}.
402 \end{options}
403
404 \begin{bewareofthedog}
405 In its simplest form an acronym needs a short and a long form. Please note
406 that both properties \emph{must} be set.
407 \end{bewareofthedog}
408
409 \subsection{Basic properties}\label{sec:basic-properties}
410 \begin{properties}
411 %% short
412 \propval{short}{text}\Initial!
413 The short form of the acronym. \emph{This property is required}: an
414 acronym must have a short form.
415 \end{properties}
416 Maybe you mostly have simple acronyms where the \ac{id} and short form are
417 the same. In that case you can use
418 \begin{options}
419 \keybool{use-id-as-short}\Initial{false}
420 to use the \ac{id} of the acronym as short form. For more complicated
421 cases this would still allow you to set the short form.
422 \end{options}
423 \begin{properties}
424 %% long
425 \propval{long}{text}\Initial!
426 The long form of the acronym. \emph{This property is required}: an
427 acronym must have a description.
428 %% alt
429 \propval{alt}{text}\Initial
430 Alternative short form.
431 %% extra
432 \propval{extra}{text}\Initial
433 Extra information to be added in the list of acronyms.
434 %% foreign
435 \propval{foreign}{long form in foreign language}\Initial
436 Can be useful when dealing with acronyms in foreign languages, see
437 section~\vref{sec:fore-lang-acronyms} for details.
438 %% long-post
439 \propval{long-post}{text}\Initial
440 \meta{text} is appended to the long form of the acronym in the text but
441 not in the list of acronyms.
442 %% post
443 \propval{post}{text}\Initial
444 \meta{text} is appended to the acronym in the text but not in the list of
445 acronyms.
446 %% single
447 \propval{single}{text}\Initial={long}
448 If provided \meta{text} will be used instead of the long form if the
449 acronym is only used a single time \emph{and} the option
450 \option{single} has been set, see section~\vref{sec:single-appe-an}.
451 %% sort
452 \propval{sort}{text}\Initial={short}
453 If used the acronym will be sorted according to this property instead of
454 its short form.
455 %% tag
456 \propval{tag}{csv list}\Initial
457 The tag(s) of an acronym.
458 %% cite
459 \proplit-{cite}{\oarg{prenote}\oarg{postnote}\marg{citation keys}}\Initial
460 A citation that is printed to the acronym according to an option explained
461 later.
462 %% before-citation
463 \propval{before-citation}{text}\Initial
464 \meta{text} is prepended to the citation of the acronym when and where
465 the citation is printed.
466 %% index
467 \propval{index}{text}\Initial
468 This property allows to overwrite the automatic index entry with an
469 arbitrary one. See section~\vref{sec:indexing} for details.
470 %% index-sort
471 \propval{index-sort}{text}\Initial={sort}
472 If you use the option \option{index} every occurrence of an acronym is
473 recorded to the index and sorted by its short form or (if set) by the
474 value of the \property{sort} property. This property allows to set an
475 individual sorting option for the index. See section~\vref{sec:indexing}
476 for details.
477 %% index-cmd
478 \propval{index-cmd}{index command}\Initial
479 This sets the indexing command for the acronym. If unused then the
480 command set by the corresponding option is used. See
481 section~\vref{sec:indexing} for details.
482 \end{properties}
483
484 \subsection{Properties related to plural and indefinite forms}\label{sec:prop-relat-plur}
485 \begin{properties}
486 %% short-plural
487 \propval{short-plural}{text}\Initial{s}
488 The plural ending appended to the short form.
489 %% short-plural-form
490 \propval{short-plural-form}{text}\Initial
491 The plural short form of the acronym; replaces the short form when used
492 instead of appending the plural ending.
493 %% long-plural
494 \propval{long-plural}{text}\Initial{s}
495 The plural ending appended to the long form.
496 %% long-plural-form
497 \propval{long-plural-form}{text}\Initial
498 Plural long form of the acronym; replaces the long form when used
499 instead of appending the plural ending.
500 %% alt-plural
501 \propval{alt-plural}{text}\Initial{s}
502 The plural ending appended to the alternative form.
503 %% alt-plural-form
504 \propval{alt-plural-form}{text}\Initial
505 The plural alternative form of the acronym; replaces the alternative form
506 when used instead of appending the plural ending.
507 %% foreign-plural
508 \propval{foreign-plural}{text}\Initial{s}
509 The plural ending appended to the foreign form.
510 %% foreign-plural-form
511 \propval{foreign-plural-form}{text}\Initial
512 Plural foreign form of the acronym; replaces the foreign form when used
513 instead of appending the plural ending.
514 %% short-indefinite
515 \propval{short-indefinite}{text}\Initial{a}
516 Indefinite article for the short form.
517 %% long-indefinite
518 \propval{long-indefinite}{text}\Initial{a}
519 Indefinite article for the long form.
520 %% alt-indefinite
521 \propval{alt-indefinite}{text}\Initial{a}
522 Indefinite article for the alternative form.
523 \end{properties}
524
525 \subsection{Properties related to formatting}\label{sec:prop-relat-form}
526 \begin{properties}
527 \propval{format}{code}\Initial
528 The format used for both short and long form of the acronym.
529 %% short-format
530 \propval{short-format}{code}\Initial={format}
531 The format used for the short form of the acronym.
532 %% long-format
533 \propval{long-format}{code}\Initial={format}
534 The format used for the long form of the acronym.
535 %% first-long-format
536 \propval{first-long-format}{code}\Initial={long-format}
537 The format used for the first appearance of the long form of the acronym.
538 %% alt-format
539 \propval{alt-format}{code}\Initial={short-format}
540 The format used for the alternative form of the acronym. If this is not
541 given the short format will be used.
542 %% extra-format
543 \propval{extra-format}{code}\Initial
544 The format used for the additional information of the acronym.
545 %% foreign-format
546 \propval{foreign-format}{code}\Initial
547 The format used for the foreign form of the acronym.
548 %% single-format
549 % \propval{single-format}{code}\Initial={long-format}
550 % The format used for the acronym if the acronym is only used a single
551 % time.
552 %% list-format
553 \propval{list-format}{code}\Initial={long-format}
554 The format used for the long form of the acronym in the list if the list
555 template supports it. All pre-defined list templates \emph{do} support
556 it.
557 %% first-style
558 \propchoice{first-style}{long-short,short-long,short,long,footnote}\Initial
559 The style of the first appearance of the acronym, see also
560 section~\vref{sec:first-or-full}.
561 %% first-style
562 \propchoice{subsequent-style}{long-short,short-long,short,long,footnote}\Initial
563 \sinceversion{3.4}The style of the appearance of the acronym after the
564 first time.
565 %% single-style
566 \propchoice{single-style}{long-short,short-long,short,long,footnote}\Initial
567 The style of a single appearance of the acronym, see also
568 section~\vref{sec:single-appe-an}.
569 \end{properties}
570
571 \subsection{Properties related to the created \acs*{pdf} file}\label{sec:prop-relat-creat}
572 \begin{properties}
573 %% pdfstring
574 \propval{pdfstring}{pdfstring}\Initial={short}
575 Used as \acs{pdf} string replacement in bookmarks when used together with
576 the \pkg{hyperref}~\cite{pkg:hyperref} or the \pkg{bookmark}
577 package~\cite{pkg:bookmark}.
578 %% pdfcomment
579 \propval{pdfcomment}{text}
580 Sets a tooltip description for an acronym. For actually getting
581 tooltips you also need an appropriate setting of the options
582 \option{pdfcomment/cmd} and \option{pdfcomment/use}, see also
583 section~\vref{sec:pdf-comments}.
584 %% short-acc
585 \propval{short-acc}{text}\Initial={short}
586 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
587 package for the short form of the acronym.
588 %% long-acc
589 \propval{long-acc}{text}\Initial={long}
590 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
591 package for the long form of the acronym.
592 %% alt-acc
593 \propval{alt-acc}{text}\Initial={alt}
594 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
595 package for the alternative short form of the acronym.
596 %% foreign-acc
597 \propval{foreign-acc}{text}\Initial={foreign}
598 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
599 package for the foreign form of the acronym.
600 %% extra-acc
601 \propval{extra-acc}{text}\Initial={extra}
602 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
603 package for the extra information of the acronym.
604 %% single-acc
605 \propval{single-acc}{text}\Initial={long-acc}
606 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
607 package for a single appearance of the acronym.
608 %% list-acc
609 \propval{list-acc}{text}\Initial={list}
610 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
611 package for the appearance in the list of acronyms.
612 \end{properties}
613
614 \subsection{Futher properties}\label{sec:futher-properties}
615 \begin{properties}
616 %% list
617 \propval{list}{text}\Initial={long}
618 If specified this will be written in the list as description instead of
619 the long form if the corresponding list template supports it.
620 %% foreign-babel
621 \propval{foreign-babel}{language}\Initial
622 The \pkg{babel}~\cite{pkg:babel} or
623 \pkg{polyglossia}~\cite{pkg:polyglossia} language of the foreign form.
624 This language is used to wrap the entry with
625 \cs*{foreignlanguage}\marg{language} if either \pkg{babel} or
626 \pkg{polyglossia} is loaded. You'll need to take care that the
627 corresponding language is loaded by \pkg{babel} or \pkg{polyglossia}.
628 %% foreign-locale
629 \propval{foreign-locale}{language}\Initial
630 The language name that is output when the option
631 \module{locale}\code{/}\option{display} is used. If this property is not
632 set then the appropriate value might be derived from
633 \property{foreign-babel}. See section~\vref{sec:fore-lang-acronyms} for
634 details.
635 %% preset
636 \propval{preset}{set name}\Initial
637 \sinceversion{3.5}Enables to load a set of properties that has been
638 defined earlier with \cs{NewAcroPreset}, see
639 section~\vref{sec:presets}.
640 %% uselist
641 \propval{uselist}{csv list of acronym ids}\Initial
642 \sinceversion{3.5}If this property is given and all acronyms specified in
643 this property have been used before the first time the current acronym is
644 used it behaves as if it has been used before.
645 \end{properties}
646
647 \subsection{Presets}\label{sec:presets}
648 \sinceversion{3.5}Sometimes it can be useful to have different kinds of
649 acronyms or abbreviations or similar which share a common set of properties.
650 Such sets can be defined with these commands:
651 \begin{commands}
652 \command{NewAcroPreset}[\marg{set name}\marg{csv list of properties}]
653 Defines the property set \meta{set name}. Any valid property can be set
654 in \meta{csv list of properties}.
655 \command{RenewAcroPreset}[\marg{set name}\marg{csv list of properties}]
656 Redefines the property set \meta{set name}.
657 \command{DeclareAcroPreset}[\marg{set name}\marg{csv list of properties}]
658 Defines or redefines the property set \meta{set name} without checking.
659 \end{commands}
660
661 \section{Using acronyms}\label{sec:using-acronyms}
662 There are a number of commands to use acronyms with. Their names always follow
663 the same pattern which should make their usage intuitive immediately.
664
665 All of these commands have a starred form which means \enquote{don't count
666 this as usage}. All of these commands also have an optional argument that
667 allows to set options for that usage only.
668 \begin{commands}
669 \command*{acrocommand}[\sarg\oarg{options}\marg{id}]
670 This is the general syntax of \emph{all} of the commands listed below.
671 The star and the optional argument is left way for the sake of
672 readability. \emph{A command \cs*{acrocommand} does not actually exist.}
673 \command{ac}[\marg{id}\quad\cs{Ac}\marg{id}\quad\cs{acp}\marg{id}\quad
674 \cs{Acp}\marg{id}\quad\cs{iac}\marg{id}\quad\cs{Iac}\marg{id}]
675 \cs{ac} prints the acronym \meta{id}, the first time with full description
676 and every subsequent use only the abbreviated form. \cs{Ac} does the same
677 but uppercases the first letter -- this may be needed at the beginning of
678 a sentence. The commands \cs{acp} and \cs{Acp}, resp., print the
679 corresponding plural forms. The commands \cs{iac} and \cs{Iac}, resp.,
680 print indefinite forms.
681 \command{acs}[\marg{id}\quad\cs{Acs}\marg{id}\quad\cs{acsp}\marg{id}\quad
682 \cs{Acsp}\marg{id}\quad\cs{iacs}\marg{id}\quad\cs{Iacs}\marg{id}]
683 \cs{acs} prints the short form of the acronym \meta{id}. \cs{Acs} does the
684 same but uppercases the first letter. The commands \cs{acsp} and
685 \cs{Acsp}, resp., print the corresponding plural forms. The commands
686 \cs{iacs} and \cs{Iacs}, resp., print indefinite forms.
687 \command{acl}[\marg{id}\quad\cs{Acl}\marg{id}\quad\cs{aclp}\marg{id}\quad
688 \cs{Aclp}\marg{id}\quad\cs{iacl}\marg{id}\quad\cs{Iacl}\marg{id}]
689 \cs{acl} prints the long form of the acronym \meta{id}. \cs{Acl} does the
690 same but uppercases the first letter. The commands \cs{aclp} and
691 \cs{Aclp}, resp., print the corresponding plural forms. The commands
692 \cs{iacl} and \cs{Iacl}, resp., print indefinite forms.
693 \command{aca}[\marg{id}\quad\cs{Aca}\marg{id}\quad\cs{acap}\marg{id}\quad
694 \cs{Acap}\marg{id}\quad\cs{iaca}\marg{id}\quad\cs{Iaca}\marg{id}]
695 \cs{aca} prints the alternative short form of the acronym \meta{id}.
696 \cs{Aca} does the same but uppercases the first letter. The commands
697 \cs{acap} and \cs{Acap}, resp., print the corresponding plural forms. The
698 commands \cs{iaca} and \cs{Iaca}, resp., print indefinite forms.
699 \command{acf}[\marg{id}\quad\cs{Acf}\marg{id}\quad\cs{acfp}\marg{id}\quad
700 \cs{Acfp}\marg{id}\quad\cs{iacf}\marg{id}\quad\cs{Iacf}\marg{id}]
701 \cs{acf} prints the full form of the acronym \meta{id}. \cs{Acf} does the
702 same but uppercases the first letter. The commands \cs{acfp} and
703 \cs{Acfp}, resp., print the corresponding plural forms. The commands
704 \cs{iacf} and \cs{Iacf}, resp., print indefinite forms.
705 \end{commands}
706
707 The usage should be clear. Let's assume you have defined an acronym
708 \acs*{ufo}\label{ufo} like this:
709 \begin{sourcecode}
710 \DeclareAcronym{ufo}{
711 short = UFO ,
712 long = unidentified flying object ,
713 foreign = unbekanntes Flugobjekt ,
714 foreign-plural-form = unbekannte Flugobjekte ,
715 foreign-babel = ngerman ,
716 long-indefinite = an
717 }
718 \end{sourcecode}
719 The typical outputs look like this:
720 \begin{example}
721 \ac{ufo} \\
722 \iac{ufo} \\
723 \iacl{ufo} \\
724 \Iacf{ufo} \\
725 \acfp{ufo}
726 \end{example}
727
728 \begin{bewareofthedog}
729 In a number of contexts all acronym commands act as if their starred form is
730 used: in the table of contents, in the list of figures, and in the list of
731 tables. The same is true for floats and the measuring phase of common
732 table environments like \env*{tabularx} or \env*{ltxtable}.
733 \end{bewareofthedog}
734
735 \section{Alternative short forms}\label{sec:altern-short-forms}
736 Sometimes expressions have two different short forms. And example might be
737 \acs*{jpg} which also often is \aca*{jpg}. This is what the property
738 \property{alt} is there for.
739 \begin{properties}
740 \propval{alt}{text}
741 Alternative short form.
742 \end{properties}
743 Let's define \acs*{jpg}:
744 \begin{sourcecode}
745 \DeclareAcronym{jpg}{
746 short = JPEG ,
747 sort = jpeg ,
748 alt = JPG ,
749 long = Joint Photographic Experts Group
750 }
751 \end{sourcecode}
752 And let's see how to use it:
753 \begin{example}
754 \ac{jpg} \\
755 \ac{jpg} \\
756 \aca{jpg}
757 \end{example}
758 As you can see the full form shows both short forms of the acronym. This could
759 be changed by altering the template for the full form, see
760 section~\vref{sec:templates} and section~\vref{sec:first-or-full}. The
761 alternative form is also printed in the list of acronyms, see
762 section~\vref{sec:acronyms}. This can also be changed by altering the
763 template for the list, again see section~\ref{sec:templates}.
764
765 \section{The first or full appearance}\label{sec:first-or-full}
766 If an acronym is used for the first time with \cs{ac} (after any number of
767 usages with the starred forms of the usage commands listed in
768 section~\vref{sec:using-acronyms}) or if an acronym is used \cs{acf}, then the
769 first or full appearance of the acronym is printed\footnote{This usually
770 requires at least two \LaTeX\ runs until it is stable.}.
771
772 The first or full appearance of an acronym is determined by this option:
773 \begin{options}
774 \keychoice{first-style}{long-short,short-long,short,long,footnote}\Initial{long-short}
775 The style of the first appearance of the acronym. This options sets the
776 appearance for all acronyms. Available options in reality are the names
777 of all defined templates of the type \code{acronym}. All pre-defined
778 templates can be found in section~\vref{sec:pre-defin-templ}.
779 \keychoice{subsequent-style}{long-short,short-long,short,long,footnote}\Initial{short}
780 \sinceversion{3.4}The style of the appearance of the acronym after the
781 first time. This options sets the appearance for all acronyms. Available
782 options in reality are the names of all defined templates of the type
783 \code{acronym}. All pre-defined templates can be found in
784 section~\vref{sec:pre-defin-templ}.
785 \end{options}
786 It might be desirable to set the first appearance of an acronym
787 individually. This is possible by setting the corresponding property:
788 \begin{properties}
789 \propchoice{first-style}{long-short,short-long,short,long,footnote}\Initial
790 The style of the first appearance of the acronym.
791 \end{properties}
792 Let's again look at an example:
793 \begin{example}[side-by-side]
794 \acf[first-style=long-short]{cd} \\
795 \acf[first-style=short-long]{cd} \\
796 \acf[first-style=footnote]{cd} \\
797 \acf[first-style=long]{cd} \\
798 \acf[first-style=short]{cd}
799 \end{example}
800 This also demonstrates the use of the optional argument.
801
802 An example of an abbreviation that should have \code{long} as first appearance
803 might be \enquote{\acs*{etc}}, defined like this
804 \begin{sourcecode}
805 \DeclareAcronym{etc}{
806 short = etc\acdot ,
807 long = et cetera ,
808 format = \textit ,
809 first-style = long ,
810 plural =
811 }
812 \end{sourcecode}
813 and output like this:
814 \begin{example}[side-by-side]
815 \ac{etc}, \ac{etc} \ac{etc}.
816 \end{example}
817 The command \cs{acdot} is explained in section~\vref{sec:trailing-tokens}.
818 Basically it checks if a dot follows and outputs a dot if not.
819
820 \section{Single appearances of an acronym}\label{sec:single-appe-an}
821 If an acronym is used only once (not counting usages with the starred forms of
822 the usage commands listed in section~\vref{sec:using-acronyms}), then the
823 single appearance of the acronym is printed\footnote{This usually requires at
824 least two \LaTeX\ runs until it is stable.}.
825
826 The single appearance of an acronym is determined by this option:
827 \begin{options}
828 \keychoice{single}{\default{true},false,\meta{number}}\Initial{false}
829 This option determines whether a single appearance of an acronym counts as
830 \emph{usage}. It might be desirable in such cases that an acronym is
831 simply printed as long form and not added to the list of acronym. This is
832 what this option does. With \meta{number} the minimal number of usages
833 can be given that needs to be exceeded. \keyis{single}{1} is the same as
834 \keyis{single}{true}.
835 \keychoice{single-style}{long-short,short-long,short,long,footnote}\Initial{long}
836 The style of the single appearance of an acronym. Can be used to
837 determine how a single appearance is printed if the option \option{single}
838 has been set. This option sets the appearance for all acronyms.
839 Available options in reality are the names of all defined templates of the
840 type \code{acronym}. All pre-defined templates can be found in
841 section~\vref{sec:pre-defin-templ}.
842 \end{options}
843
844 If you like you can also set the single appearance of an acronym individually:
845 \begin{properties}
846 \propval{single}{text}\Initial
847 If provided \meta{text} will be used instead of whatever template
848 (\enquote{style}) has been set for the single appearance if the acronym is
849 only used a single time \emph{and} the option \option{single} has been
850 set\footnote{Actually the template \template{single} is used which
851 typesets the \property{single} property.}.
852 % \propval{single-format}{code}\Initial={long-format}
853 % The format used for the acronym if the acronym is only used a single
854 % time.
855 \propchoice{single-style}{long-short,short-long,short,long,footnote}\Initial
856 The style of the single appearance of the acronym.
857 \end{properties}
858 Let's again look at an example. The acronym \acs*{png} is defined as follows:
859 \begin{sourcecode}
860 \DeclareAcronym{png}{
861 short = PNG ,
862 long = Portable Network Graphics ,
863 first-style = short-long ,
864 single-style = short
865 }
866 \end{sourcecode}
867 And it is used only once in this manual\footnote{You will find it in the list
868 of acronyms in section~\ref{sec:acronyms} nonetheless as this document does
869 \keyis{list/display}{all}.}:
870 \begin{example}[side-by-side]
871 \ac{png}
872 \end{example}
873 Please be aware that \cs{acf} would still print the full form, of course.
874
875 \section{Printing the list}\label{sec:printing-list}
876 \subsection{The main command and its options}\label{sec:main-list}
877 The main idea is simple: just place
878 \begin{commands}
879 \command{printacronyms}[\oarg{options}]
880 where you want the list to appear. It may require several (most times
881 two) \LaTeX\ runs for it to stabilize so look out for any warnings
882 from \acro\ requiring to re-run.
883 \end{commands}
884 The options controlling the list are these:
885 \begin{options}
886 \keychoice{template}{description,tabular,longtable,supertabular,tabularray,lof,toc}%
887 \Module{list}\Initial{description}
888 Choose the template to create the list with. See more on this in
889 sections~\vref{sec:templates} and~\vref{sec:examples}.
890 \keybool{sort}\Module{list}\Initial{true}
891 Decide whether to sort the list of acronyms alphabetically or to print it
892 in order of definition.
893 \keychoice{display}{all,used}\Module{list}\Initial{used}
894 Decide whether to print only the acronyms actually used in the document or
895 all acronyms which have been declared in the preamble.
896 \keyval{exclude}{csv list of tags}\Module{list}\Initial
897 Set a list of tags to exclude from the list. Only acronyms not
898 belonging to one of these tags will be included.
899 \keyval{include}{csv list of tags}\Module{list}\Initial
900 Set a list of tags to include in the list. Only acronyms belonging to
901 one of these tags will be included.
902 \keybool{add}\Module{list}\Initial
903 \sinceversion{3.4}Set a list of tags to include in the list. These
904 acronyms will be included in any case.
905 \keychoice{heading}{none,section,section*,chapter,chapter*}\Module{list}
906 Choose the heading template for the list of acronyms.
907
908 This only has an effect if the list template supports it. All pre-defined
909 templates \emph{do} support it.
910 \keyval{name}{text}\Module{list}\Initial{\cs{acrotranslate}\Marg{list-name}}
911 Overwrites the text which is used in the heading.
912
913 This only has an effect if the list template supports heading templates
914 \emph{and} the heading templates support it. All pre-defined heading
915 templates \emph{do} support this.
916 \keyval{preamble}{text}\Module{list}\Initial
917 Set a preamble to be placed between heading and actual list.
918
919 This only has an effect if the list template supports it. All pre-defined
920 templates \emph{do} support it.
921 \keybool{display}\Module{list,locale}\Initial{false}
922 This options determines whether the language of the foreign form is printed
923 or not.
924
925 This only has an effect if the list template supports foreign forms. All
926 pre-defined templates \emph{do} support them.
927 \end{options}
928
929 All these options can be set with \cs{acsetup} globally or locally as options
930 to \cs{printacronyms}. In the latter case omit the leading
931 \module{list}:
932 \begin{sourcecode}
933 \acsetup{list/display=all,list/exclude=units}
934 or
935 \printacronyms[display=all,exclude=units]
936 \end{sourcecode}
937
938 \subsection{Add page numbers to the list}\label{sec:page-numbers}
939 If you want to include the page numbers where the acronyms have been used in
940 the list of acronym you can use these options:
941 \begin{options}
942 \keychoice{display}{first,all,none}\Module{pages}\Initial{none}
943 Decide whether to include page numbers in the list of acroynms and
944 whether to add the first page or every page. When you choose
945 \code{first} and have \pkg{hyperref} loaded you will also get a
946 backlink to that page.
947 \keybool{use}\Module{pages,seq}\Initial{true}
948 Turns a two-page range into \meta{num}\,f.\ (\latin{sequens}) and a
949 three-page range into \meta{num}\,ff.\ (\latin{sequentes}) when set to
950 \code{true}.
951 \keyval{pre}{code}\Module{pages,seq}\Initial{\cs*{,}}
952 \meta{code} is inserted between the page number and the sequens or
953 sequentes symbol.
954 \keyval{threshold}{num}\Module{pages,seq}\Initial{3}
955 The threshold for a page range to be turned into \latin{sequentes}. A
956 page range above the threshold is still typeset as a range:
957 \meta{num1}--\meta{num2}.
958 \keyval{fill}{code}\Module{pages}\Initial{\cs*{acrodotfill}}
959 This is the code that is placed between acronym description and actual
960 page numbers.
961 \keybool{name}\Module{pages}\Initial{false}
962 If set to true the page numbers are preceded with p.\ or pp.
963 \end{options}
964 \begin{commands}
965 \command{acrodotfill}
966 \sinceversion{3.5}Creates a dotted line like those in the table of
967 contents. If the macro \cs*{cftdotfill} is defined it is equal to
968 \cs*{cftdotfill}\Marg{\cs*{cftdotsep}}.
969 \end{commands}
970 Additionally\sinceversion{3.3} to setting these options with \cs{acsetup} they
971 can be set as options to \cs{printacronyms}:
972 \begin{sourcecode}
973 \printacronyms[pages={display=all,seq/use=false}]
974 \end{sourcecode}
975
976 \subsection{Filter lists using tags}\label{sec:lists-tags}
977 With the property \property{tag} you can assign one or more tags to an
978 acronym. These tags can be used to filter the list of acronyms.
979 \begin{properties}
980 %% tag
981 \propval{tag}{csv list}\Initial
982 The tag(s) of an acronym.
983 \end{properties}
984 \begin{options}
985 \keyval{exclude}{csv list of tags}\Module{list}\Initial
986 Set a list of tags to exclude from the list. Only acronyms not
987 belonging to one of these tags will be included.
988 \keyval{include}{csv list of tags}\Module{list}\Initial
989 Set a list of tags to include in the list. Only acronyms belonging to
990 one of these tags will be included.
991 \end{options}
992
993 Let's look at an example. This manual declares these two acronyms with the tag
994 \code{city}:
995 \begin{sourcecode}
996 \DeclareAcronym{la}{
997 short = LA ,
998 long = Los Angeles,
999 plural = ,
1000 tag = city
1001 }
1002 \DeclareAcronym{ny}{
1003 short = NY ,
1004 long = New York ,
1005 plural = ,
1006 tag = city
1007 }
1008 \end{sourcecode}
1009 We can now use this to either print a list \emph{without} these acronyms by
1010 saying
1011 \begin{sourcecode}
1012 \printacronyms[exclude=city]
1013 \end{sourcecode}
1014 or print a list \emph{with only} these acronyms with
1015 \begin{example}
1016 \printacronyms[include=city,heading=none]
1017 \end{example}
1018 \begin{bewareofthedog}
1019 If you use both \option{exclude} and \option{include} and list a tag in both
1020 \option{exclude} takes precedence over \option{include}.
1021 \begin{sourcecode}
1022 \printacronyms[exclude={a,b},include={b,c}]
1023 \end{sourcecode}
1024 would only print acronyms with tag \code{c}.
1025 \end{bewareofthedog}
1026
1027 \subsection{Local lists}\label{sec:local-lists}
1028 Maybe you like a list of acronyms for each chapter in a book which only lists
1029 the acronyms used within this chapter. You need to do three things: set
1030 \begin{options}
1031 \keybool{use}\Module{barriers}\Initial{false}
1032 this option to \code{true}, place
1033 \end{options}
1034 \begin{commands}
1035 \command{acbarrier}
1036 before a new chapter starts (this is not necessary for the first chapter),
1037 and use \cs{printacronyms} with the option
1038 \end{commands}
1039 \begin{options}
1040 \keybool{local}\Module{list}\Initial{false}
1041 or set this option once in the preamble with \cs{acsetup} so it is applied
1042 to every list.
1043 \end{options}
1044 Please read more on barriers in section~\vref{sec:barriers}.
1045 \begin{bewareofthedog}
1046 Please don't use page numbers together with local lists for the time being.
1047 If an acronym appears in more than one list both lists would contain the
1048 \emph{same} page numbers anstead of only the ones local to barriers.
1049
1050 For the similar reasons please also don't use \option{make-links} together
1051 with local lists.
1052
1053 This \emph{might} be resolved on day.
1054 \end{bewareofthedog}
1055
1056 \section{Formatting}\label{sec:formatting}
1057 \acro\ has a number of options and parameters which can be used to influence
1058 the formatting of acronyms.
1059 \begin{options}
1060 \keyval{format}{code}\Initial
1061 Sets the format for both the short and the long form.
1062 \keyval{short}{code}\Module{format}\Initial
1063 Sets the format for the short form.
1064 \keyval{long}{code}\Module{format}\Initial
1065 Sets the format for the long form.
1066 \keyval{first-long}{code}\Module{format}\Initial
1067 Sets the format for the first appearance of the long form.
1068 \keyval{alt}{code}\Module{format}\Initial
1069 Sets the format for the alternative form.
1070 \keyval{extra}{code}\Module{format}\Initial
1071 Sets the format for the extra information.
1072 \keyval{foreign}{code}\Module{format}\Initial
1073 Sets the format for the foreign form.
1074 \keyval{list}{code}\Module{format}\Initial
1075 Sets the format for the long form in the list form.
1076 \end{options}
1077 While this options influence the formatting of the acronyms globally you can
1078 also give each acronym its own formatting individually:
1079 \begin{properties}
1080 \propval{format}{code}\Initial
1081 The format used for both short and long form of the acronym.
1082 %% short-format
1083 \propval{short-format}{code}\Initial={format}
1084 The format used for the short form of the acronym.
1085 %% long-format
1086 \propval{long-format}{code}\Initial={format}
1087 The format used for the long form of the acronym.
1088 %% first-long-format
1089 \propval{first-long-format}{code}\Initial={long-format}
1090 The format used for the first appearance of the long form of the acronym.
1091 %% alt-format
1092 \propval{alt-format}{code}\Initial={short-format}
1093 The format used for the alternative form of the acronym. If this is not
1094 given the short format will be used.
1095 %% extra-format
1096 \propval{extra-format}{code}\Initial
1097 The format used for the additional information of the acronym.
1098 %% foreign-format
1099 \propval{foreign-format}{code}\Initial
1100 The format used for the foreign form of the acronym.
1101 %% single-format
1102 \propval{single-format}{code}\Initial={long-format}
1103 The format used for the acronym if the acronym is only used a single
1104 time.
1105 %% list-format
1106 \propval{list-format}{code}\Initial={long-format}
1107 The format used for the long form of the acronym in the list if the list
1108 template supports it. All pre-defined list templates \emph{do} support
1109 it.
1110 %% first-style
1111 \propchoice{first-style}{long-short,short-long,short,long,footnote}\Initial
1112 The style of the first appearance of the acronym, see also
1113 section~\vref{sec:first-or-full}.
1114 %% single-style
1115 \propchoice{single-style}{long-short,short-long,short,long,footnote}\Initial
1116 The style of a single appearance of the acronym, see also
1117 section~\vref{sec:single-appe-an}.
1118 \end{properties}
1119 Per\changedversion{3.3} default the individual formatting instructions
1120 \emph{replace} the global ones. This can be changed through the option
1121 \begin{options}
1122 \keybool{replace}\Module{format}\Initial{true}
1123 With this option active local options will \emph{replace} the global
1124 ones.
1125 \end{options}
1126
1127 Let's see an example:
1128 \begin{sourcecode}
1129 \DeclareAcronym{pdf}{
1130 short = pdf ,
1131 long = Portable Document Format ,
1132 short-format = \scshape
1133 }
1134 \end{sourcecode}
1135 \begin{example}
1136 \acsetup{format = \itshape}
1137 \acf{pdf} \par
1138 \acsetup{format/replace=false}
1139 \acf{pdf}
1140 \end{example}
1141
1142 \section{Plural forms and other endings}\label{sec:plural-forms-other}
1143 \subsection{The plural ending and the plural form}\label{sec:plural-ending-form}
1144 Not in all languages plural forms are as easy as always appending an
1145 \enquote{s}. Not even English. Sometimes there's other endings
1146 instead\footnote{German is full of such examples.}. This is why \acro\ has
1147 quite a number of different properties related to plural forms or endings:
1148 \begin{properties}
1149 %% short-plural
1150 \propval{short-plural}{text}\Initial{s}
1151 The plural ending appended to the short form.
1152 %% short-plural-form
1153 \propval{short-plural-form}{text}\Initial
1154 The plural short form of the acronym; replaces the short form when used
1155 instead of appending the plural ending.
1156 %% long-plural
1157 \propval{long-plural}{text}\Initial{s}
1158 The plural ending appended to the long form.
1159 %% long-plural-form
1160 \propval{long-plural-form}{text}\Initial
1161 Plural long form of the acronym; replaces the long form when used
1162 instead of appending the plural ending.
1163 %% alt-plural
1164 \propval{alt-plural}{text}\Initial{s}
1165 The plural ending appended to the alternative form.
1166 %% alt-plural-form
1167 \propval{alt-plural-form}{text}\Initial
1168 The plural alternative form of the acronym; replaces the alternative form
1169 when used instead of appending the plural ending.
1170 %% foreign-plural
1171 \propval{foreign-plural}{text}\Initial{s}
1172 The plural ending appended to the foreign form.
1173 %% foreign-plural-form
1174 \propval{foreign-plural-form}{text}\Initial
1175 Plural foreign form of the acronym; replaces the foreign form when used
1176 instead of appending the plural ending.
1177 \end{properties}
1178 There are two options which allow to change the default values for the whole
1179 document:
1180 \begin{options}
1181 \keyval{short-plural-ending}{text}\Initial{s}
1182 Defines the plural ending for the short forms to be \meta{text}.
1183 \keyval{long-plural-ending}{text}\Initial{s}
1184 Defines the plural ending for the long forms to be \meta{text}.
1185 \end{options}
1186 Now let's see two simple examples demonstrating the two different kinds of plural
1187 settings:
1188 \begin{sourcecode}
1189 \DeclareAcronym{sw}{
1190 short = SW ,
1191 long = Sammelwerk ,
1192 long-plural = e
1193 }
1194 \DeclareAcronym{MP}{
1195 short = MP ,
1196 long = Member of Parliament ,
1197 plural-form = Members of Parliament
1198 }
1199 \end{sourcecode}
1200 The first one has another plural ending than the usual \enquote{s}. The second
1201 one has a different plural form altogether because appending an \enquote{s}
1202 would give a wrong form:
1203 \begin{example}[side-by-side]
1204 \acfp{sw} \par
1205 \acfp{MP}
1206 \end{example}
1207
1208 \subsection{Other endings}\label{sec:other-endings}
1209 Besides plural endings there are other ones like the genitive case, for
1210 example. This is why \acro\ generalized the concept.
1211 Section~\vref{sec:endings} explains in detail how to define and use additional
1212 endings.
1213
1214 \section{Articles}
1215 \subsection{Indefinite forms}\label{sec:indefinite-forms}
1216 Indefinite forms can be a problem if the short and the long form of acronyms
1217 have different indefinite articles\footnote{This may very well be a language
1218 specific issue.}.
1219 \begin{example}[side-by-side]
1220 \acreset{ufo}%
1221 a \ac{ufo} \par
1222 an \ac{ufo}
1223 \end{example}
1224 And what good would it be to use a package like \acro\ if you have to keep
1225 track of first and second uses, anyway? This is why \acs{ufo} should be defined
1226 like we did on page~\pageref{ufo}. We then can just use the dedicated
1227 commands and let them decide for us:
1228 \begin{example}[side-by-side]
1229 \acreset{ufo}%
1230 \iac{ufo} \par
1231 \iac{ufo}
1232 \end{example}
1233 The commands which also output the indefinite article all start with an
1234 \enquote{i} and have all been described in section~\vref{sec:using-acronyms}
1235 already: \cs{iac}, \cs{Iac}, \cs{iacs}, \cs{Iacs}, \cs{iacl}, \cs{Iacl},
1236 \cs{iaca}, \cs{Iaca}, \cs{iacf}, and \cs{Iacf}.
1237
1238 \subsection{Other articles}\label{sec:other-articles}
1239 There might be cases -- most likely depending on your language -- when you
1240 would like to have other articles behaving similar to the indefinite ones.
1241 Section~\ref{sec:articles} explains in detail how to define and use additional
1242 articles.
1243
1244 \section{Foreign language acronyms}\label{sec:fore-lang-acronyms}
1245 Sometimes and in some fields more often than in others abbreviations are used
1246 that are derived from another language. \acro\ provides a number of
1247 properties for such cases:
1248 \begin{properties}
1249 %% foreign
1250 \propval{foreign}{long form in foreign language}\Initial
1251 Can be useful when dealing with acronyms in foreign languages, see
1252 section~\vref{sec:fore-lang-acronyms} for details.
1253 %% foreign-plural
1254 \propval{foreign-plural}{text}\Initial{s}
1255 The plural ending appended to the foreign form.
1256 %% foreign-plural-form
1257 \propval{foreign-plural-form}{text}\Initial
1258 Plural foreign form of the acronym; replaces the foreign form when used
1259 instead of appending the plural ending.
1260 %% foreign-format
1261 \propval{foreign-format}{code}\Initial
1262 The format used for the foreign form of the acronym.
1263 %% foreign-babel
1264 \propval{foreign-babel}{language}\Initial
1265 The \pkg{babel} or \pkg{polyglossia} language of the foreign form. This
1266 language is used to wrap the entry with
1267 \cs*{foreignlanguage}\marg{language} if either \pkg{babel} or
1268 \pkg{polyglossia} is loaded. You'll need to take care that the
1269 corresponding language is loaded by \pkg{babel} or \pkg{polyglossia}.
1270 %% foreign-locale
1271 \propval{foreign-locale}{language}\Initial
1272 The language name that is output when the option
1273 \module{locale}\code{/}\option{display} is used. If this property is not
1274 set then the appropriate value might be derived from
1275 \property{foreign-babel}.
1276 \end{properties}
1277 There are also some options:
1278 \begin{options}
1279 \keybool{display}\Module{foreign}\Initial{true}
1280 Determine whether to hide or display the foreign form.
1281 \keybool{display}\Module{list,foreign}\Initial{true}
1282 \sinceversion{3.2}Determine whether to hide or display the foreign form in
1283 the list of acronyms.
1284 \keybool{display}\Module{locale}\Initial{false}
1285 This options determines whether the language of the foreign form is printed
1286 or not when the full form of the acronym is printed.
1287 \keybool{display}\Module{list,locale}\Initial{false}
1288 The same but for the list of acronyms.
1289 \keyval{format}{code}\Module{locale}\Initial{\cs*{em}\cs*{text\_titlecase\_first:n}}
1290 Determines how said language is formatted when printed. The last command
1291 in \meta{code} may take a mandatory argument.
1292 \end{options}
1293
1294 Let's say you are writing a German document and are using the abbreviation
1295 \acs*{ecu} for \acl*{ecu} which stems from the English \enquote{Electronic
1296 Control Unit}. Then you can define it as follows:
1297 \begin{sourcecode}
1298 \DeclareAcronym{ecu}{
1299 short = ECU ,
1300 long = Steuergerät ,
1301 foreign = Electronic Control Unit ,
1302 foreign-babel = english ,
1303 foreign-locale = englisch
1304 }
1305 \end{sourcecode}
1306 Now the abbreviation is introduced so that everyone understands the confusion:
1307 \begin{example}
1308 \ac{ecu} \par
1309 \acsetup{locale/display,locale/format=\emph}
1310 \acf{ecu}
1311 \end{example}
1312
1313 The property \property{foreign-babel} is used for ensuring correct hyphenation
1314 as long as you use \pkg{babel} or \pkg{polyglossia} and load the corresponding
1315 language, too. If you are writing your document in English then \acro\ is
1316 able to deduce the language used for the \enquote{locale} field by itself:
1317 \begin{sourcecode}
1318 \DeclareAcronym{eg}{
1319 short = e.g\acdot ,
1320 long = for example ,
1321 foreign = exempli gratia ,
1322 foreign-babel = latin ,
1323 short-format = \textit ,
1324 foreign-format = \textit
1325 }
1326 \end{sourcecode}
1327 \begin{example}
1328 \acsetup{locale/display,first-style=short-long}
1329 \acf{eg}
1330 \end{example}
1331
1332 \section{Uppercasing}\label{sec:uppercasing}
1333
1334 Depending on the kind of abbreviations you have and depending on their
1335 definition and maybe also depending on your language the long and sometimes
1336 also the short forms need to start with an uppercase letter at the beginning
1337 of a sentence while it starts with a lowercase letter otherwise.
1338
1339 For this \acro\ provides uppercase versions for all predefined acronym
1340 commands listed in section~\ref{sec:using-acronyms}. The usage is
1341 self-explaining:
1342 \begin{example}
1343 There was \iacl{ufo} hovering \dots \par
1344 \Aclp{ufo} were hovering \dots
1345 \end{example}
1346 If you defined them with uppercase letters to begin with then these commands
1347 have no effect, of course.
1348 \begin{sourcecode}
1349 \DeclareAcronym{ufo}{
1350 short = UFO ,
1351 long = Unidentified Flying Object
1352 }
1353 \end{sourcecode}
1354
1355 % \pagebreak
1356
1357 There are a number of options to control the uppercasing behavior:
1358 \begin{options}
1359 \opt{first}\Module{uppercase}
1360 The default setting. Converts the first letter to uppercase.
1361 \opt{title}\Module{uppercase}
1362 This is just a synonym of \option{first}.
1363 \opt{all}\Module{uppercase}
1364 Converts \emph{all} letters to uppercase.
1365 \opt{none}\Module{uppercase}
1366 Converts \emph{all} letters to \emph{lowercase}
1367 \keyval{cmd}{command}\Module{uppercase}
1368 All of the above options just choose the right command using this option
1369 internally. This means you can choose a different behavior altogether by
1370 setting this option to something else. For example you could use
1371 \cs*{capitalisewords} from the package
1372 \pkg{mfirstuc}~\cite{pkg:mfirstuc}. The command needs to have one
1373 mandatory argument.
1374 \end{options}
1375
1376 There may be reasons to exclude short forms from being uppercased. This can
1377 be controlled by this option:
1378 \begin{options}
1379 \keybool{short}\Module{uppercase}\Initial{true}
1380 It allows you to disable the mechanism for the \property{short} and
1381 \property{alt} properties.
1382 \end{options}
1383
1384 \section{Citing and indexing}\label{sec:citing-indexing}
1385 \subsection{Citing}\label{sec:citing}
1386 Acronyms can be given cite keys. This makes it possible to add a citation
1387 reference automatically when the acronym is used for the first time.
1388
1389 Let's see an example first. \acs*{ny} has been defined like this:
1390 \begin{sourcecode}
1391 \DeclareAcronym{ny}{
1392 short = NY ,
1393 long = New York ,
1394 plural = ,
1395 tag = city ,
1396 cite = NewYork
1397 }
1398 \end{sourcecode}
1399 The property \property{cite} will now trigger \acro\ to input
1400 \verbcode+\cite{NewYork}+ after the acronym:
1401 \begin{example}[side-by-side]
1402 \ac{ny}
1403 \end{example}
1404 Depending on the citation style (and probably other factors, too) it might be
1405 desirable to add the citation rather inside the parentheses together with the
1406 short form of the acronym and even cited with a different command. For cases
1407 like these \acro\ offers a number of options:\acuse{ny}
1408 \begin{options}
1409 \keyval{cmd}{citation command}\Module{cite}\Initial{\cs*{cite}}
1410 Choose the command with which citations ar printed.
1411 \keybool{group}\Module{cite}\Initial{false}
1412 Decide whether to group citations with the short form in the parentheses.
1413 The template must support this. \acro's pre-defined templates \emph{do}
1414 support it.
1415 \keychoice{display}{first,all,none}\Module{cite}\Initial{first}
1416 Decide whether to output the citation in the first/full usage only or
1417 always or never.
1418 \keyval{pre}{text}\Module{cite}\Initial{\cs*{nobreakspace}}
1419 Arbitrary code directly output before the citation.
1420 \keyval{cmd}{citation command}\Module{cite,group}\Initial{\cs*{cite}}
1421 Choose the command with which grouped citations are printed.
1422 \keyval{pre}{text}\Module{cite,group}\Initial{,\textvisiblespace}
1423 Arbitrary code directly output before the citation in the grouped case.
1424 \end{options}
1425
1426 If for example you use \pkg{biblatex}'s \code{authoryear}
1427 style~\cite{pkg:biblatex} you might want to have settings like these:
1428 \begin{sourcecode}
1429 \acsetup{
1430 cite/group = true ,
1431 cite/cmd = \parencite ,
1432 cite/group/cmd = \cite
1433 }
1434 \end{sourcecode}
1435 \begin{cnltxcode}
1436 \begin{lstlisting}[style=cnltx]
1437 \acsetup{cite/display = all}
1438 \acf{ny} \\
1439 \ac{ny}
1440 \end{lstlisting}
1441 \tcblower
1442 New York (NY, Wikipedia 2020) \\
1443 NY (Wikipedia 2020)
1444 \end{cnltxcode}
1445
1446 \subsection{Indexing}\label{sec:indexing}
1447 Maybe you want to add your acronyms to an index. In that case it is probably
1448 desirable to let \acro\ make this automatically. In the simplest case just
1449 enable it:
1450 \begin{options}
1451 \keychoice{use}{\default{true},false,indexed}\Module{index}\Initial{false}
1452 \changedversion{3.5}Enable indexing. If \code{indexed} is chosen only the
1453 acronyms for which the property \property{index} has been set are indexed.
1454 With \code{true} \emph{all} acronyms are indexed.
1455 \keyval{cmd}{index command}\Module{index}\Initial{\cs*{index}}
1456 Choose a command for indexing.
1457 \keyval{disable}{code}\Module{index}\Initial{\cs*{def}\cs*{@}\{\}}
1458 Sometimes it is desirable to change the meaning of a command inside an
1459 index entry. For the entries created by \acro\ this can be achieved with
1460 this option.
1461 \opt{clear}\Module{index}
1462 This option clears the disable list.
1463 \end{options}
1464 While these options set global behavior there are also properties to set them
1465 for an acronym individually.
1466 \begin{properties}
1467 %% index
1468 \propval{index}{text}\Initial
1469 This property allows to overwrite the automatic index entry with an
1470 arbitrary one.
1471 %% index-sort
1472 \propval{index-sort}{text}\Initial={sort}
1473 If you use the option \option{index} every occurrence of an acronym is
1474 recorded to the index and sorted by its short form or (if set) by the
1475 value of the \property{sort} property. This property allows to set an
1476 individual sorting option for the index.
1477 %% no-index
1478 \propbool{no-index}\Initial{true}
1479 This property allows to exclude an acronym from being indexed.
1480 \end{properties}
1481 This manual is an example for the indexing feature. Each acronym from
1482 section~\vref{sec:acronyms} that has been used in this manual is also listed
1483 in the index.
1484
1485 %% TODO: document the label property
1486
1487 \section{Barriers}\label{sec:barriers}
1488 The main purpose of the concept of barriers is to be able to have \emph{local}
1489 lists of acronyms. This concept does a little bit more than that, though,
1490 which should become clear from the following options:
1491 \begin{options}
1492 \keybool{use}\Module{barriers}\Initial{false}
1493 Activate usage of barriers. Otherwise the command \cs{acbarrier} just
1494 does nothing except writing a warning in the log.
1495 \keybool{reset}\Module{barriers}\Initial{false}
1496 When set to \code{true} the acronym usage is reset for all acronyms at a
1497 barrier. The first use of \cs{ac} after a barrier will again look like
1498 the \cs{acf}.
1499 \keybool{single}\Module{barriers}\Initial{false}
1500 When set to \code{true} a single usage of an acronym between two barriers
1501 with \cs{ac} will look according to the chosen style as explained in
1502 section~\vref{sec:single-appe-an}. This option only has an effect when
1503 the option \option{single} is used as well.
1504 \end{options}
1505
1506 There are two natural barriers in a document: \beginenv*\Marg{document} and
1507 \endenv*\Marg{document}. You can add an arbitrary number of additional
1508 barriers with
1509 \begin{commands}
1510 \command{acbarrier}
1511 For this command to have any effect you must set
1512 \module{barriers}\code{/}\option{use} to \code{true}!
1513 \end{commands}
1514 \begin{bewareofthedog}
1515 It usually takes two or even three \LaTeX\ runs until acronym usages
1516 between barriers are properly counted.
1517 \end{bewareofthedog}
1518
1519 \section{Trailing tokens}\label{sec:trailing-tokens}
1520 \subsection{What is it about?}
1521 \acro\ has the possibility to look ahead for certain tokens and switch a
1522 boolean variable if it finds them. Per default \acro\ knows about three
1523 tokens: the \enquote{\code{dot}} (\sym{.}), the \enquote{\code{dash}}
1524 (\sym{-}) and the \enquote{\code{babel-hyphen}} (\cs*{babelhyphen}).
1525
1526 You have seen an example for this already:
1527 \begin{sourcecode}
1528 \DeclareAcronym{etc}{
1529 short = etc\acdot ,
1530 long = et cetera ,
1531 format = \textit ,
1532 first-style = long ,
1533 plural =
1534 }
1535 \end{sourcecode}
1536 The macro \cs{acdot} recognizes if a dot is directly following. It only prints
1537 a dot if it doesn't.
1538 \begin{example}[side-by-side]
1539 \ac{etc} and \ac{etc}.
1540 \end{example}
1541
1542 Another example: let's say you're a German scientist, you have
1543 \begin{sourcecode}
1544 \DeclareAcronym{PU}{
1545 short = PU ,
1546 long = Polyurethan ,
1547 long-plural = e
1548 }
1549 \end{sourcecode}
1550 and you use it the first time like this: \verbcode+\ac{PU}-Hartschaum+ then
1551 according to German orthography and typesetting rules this should be printed
1552 as
1553 \begin{center}
1554 \enquote{Polyurethan(PU)-Hartschaum}
1555 \end{center}
1556 \ie, with \emph{no} space between long and short form:
1557 \begin{example}[side-by-side]
1558 \acf{PU}-Hartschaum
1559 \end{example}
1560
1561 This works because the template \code{long-short}\footnote{The template that
1562 is used by default for the first appearance.} uses \cs{acspace} at the
1563 appropriate place and the manual setup does
1564 \begin{sourcecode}
1565 \acsetup{trailing/activate = dash}
1566 \end{sourcecode}
1567 \cs{acspace} looks ahead for a trailing dash and adds a space it it doesn't
1568 find it.
1569
1570 \subsection{How does it work?}
1571 Tokens to look for can be defined and activated through the following options:
1572 \begin{options}
1573 \keylit-{define}{\meta{token}\marg{name}}\Module{trailing}
1574 Defines token \meta{name} and tells \acro\ look for \meta{token} if
1575 \meta{name} is activated.
1576 \keyval{activate}{csv list of token names}\Module{trailing}
1577 Tell \acro\ to look for trailing tokens. This is done by giving a csv
1578 list of the internal \emph{names} of the tokens. Per default only
1579 \code{dot} is activated.
1580 \keyval{deactivate}{csv list of token names}\Module{trailing}
1581 Tell \acro\ not to look for trailing tokens. This is done by giving a csv
1582 list of the internal \emph{names} of the tokens.
1583 \end{options}
1584 The package itself does this:
1585 \begin{sourcecode}
1586 \acsetup{
1587 trailing/define = . {dot} ,
1588 trailing/define = {, {comma}} ,
1589 trailing/define = - {dash}
1590 trailing/define = \babelhyphen {babel-hyphen} ,
1591 trailing/activate = {dot,comma}
1592 }
1593 \end{sourcecode}
1594
1595 In order to make use of this mechanism there is the following command:
1596 \begin{commands}
1597 \expandable\command{aciftrailing}[\marg{csv list of token
1598 names}\marg{true}\marg{false}]
1599 Check if one of the tokens listed in \meta{csv list of token names} is
1600 following and either place \meta{true} or \meta{false} in the input
1601 stream.
1602 \end{commands}
1603 This command is used to define the two commands you already know:
1604 \begin{commands}
1605 \expandable\command{acdot} Inserts \cs{abbrdot} if no \code{dot} follows.
1606 \expandable\command{acspace} Inserts a \cs*{space} if no \code{dash} or
1607 \code{babel-hyphen} follows.
1608 \expandable\command{abbrdot} Inserts \sym{.}\cs*{@}
1609 \end{commands}
1610 The definitions are equivalent to the following code:
1611 \begin{sourcecode}
1612 \newcommand*\acdot{\aciftrailing{dot}{}{\abbrdot}}
1613 \newcommand*\acspace{\aciftrailing{dash,babel-hyphen}{}{\space}}
1614 \end{sourcecode}
1615 You are of course free to redefine them according to your needs.
1616
1617 \section{Using or resetting acronyms}\label{sec:using-or-resetting}
1618 Sometimes it is necessary to mark an acronym as used before it actually has
1619 been used or to mark an acronym as unused even though it \emph{has} been
1620 used. You have already seen one of the commands which make it possible:
1621 \begin{commands}
1622 \command{acuse}[\marg{csv list of acronym ids}]
1623 Every acronym given in the list will be marked as used.
1624 \command{acuseall}
1625 Every acronym is marked as used.
1626 \command{acreset}[\marg{csv list of acronym ids}]
1627 Every acronym given in the list will be reset.
1628 \command{acresetall}
1629 Every acronym will be reset.
1630 \end{commands}
1631
1632 \begin{bewareofthedog}
1633 In a number of contexts all acronym commands act as if their starred form is
1634 used: in the table of contents, in the list of figures, and in the list of
1635 tables. The same is true for floats and the measuring phase of common
1636 table environments like \env*{tabularx} or \env*{ltxtable}.
1637 \end{bewareofthedog}
1638
1639 \section{Bookmarks, backlinks and accessibility support}\label{sec:pdf-properties}
1640 \subsection{Backlinks}\label{sec:backlinks}
1641 When \acro\ is used together with the package
1642 \pkg{hyperref}~\cite{pkg:hyperref} then you can make use of the following
1643 option:
1644 \begin{options}
1645 \keybool{make-links}\Initial{false}
1646 If this is activated then every short or alternative appearance of an
1647 acronym will be linked to its description in the list of acronyms.
1648 \keybool{link-only-first}\Initial{false}
1649 \sinceversion{3.5}If this is activated in addition to \option{make-links}
1650 then \emph{only the first} short or alternative appearance of an acronym
1651 will be linked to its description in the list of acronyms.
1652 \end{options}
1653 \begin{bewareofthedog}
1654 This will fail miserably together with local lists if an acronym appears in
1655 more than one list. This \emph{might} be resolved on day.
1656 \end{bewareofthedog}
1657
1658 \subsection{Bookmarks}\label{sec:bookmarks}
1659 Since bookmarks (which are created by the \pkg{hyperref} or the \pkg{bookmark}
1660 packages~\cite{pkg:bookmark}) can only contain simple text \acro\ simplifies
1661 the output of the acronym commands when they appear in a bookmark. Although
1662 the output can be modified with a dedicated template-mechanism there is no
1663 user interface at the moment. Contact me at \issues\ if you need it.
1664
1665 Acronyms have the property \property{pdfstring}:
1666 \begin{properties}
1667 %% pdfstring
1668 \propval{pdfstring}{pdfstring}\Initial={short}
1669 Used as \acs{pdf} string replacement for the short form in bookmarks when
1670 used together with the \pkg{hyperref}~\cite{pkg:hyperref} or the
1671 \pkg{bookmark} package~\cite{pkg:bookmark}.
1672 \end{properties}
1673
1674 This is for acronyms like
1675 \begin{sourcecode}
1676 \DeclareAcronym{pdf}{
1677 short = pdf ,
1678 long = Portable Document Format ,
1679 short-format = \scshape ,
1680 pdfstring = PDF
1681 }
1682 \end{sourcecode}
1683 where the bookmark would write \enquote{pdf} instead of \enquote{\textsc{pdf}}
1684 if the property where not set.
1685
1686 \subsection{\acs*{pdf} comments}\label{sec:pdf-comments}
1687 Some people like see comments in the \ac{pdf} when they're hovering with the
1688 mouse over the short form of an acronym. This can be achieved.
1689 \begin{options}
1690 \keybool{use}\Module{pdfcomments}\Initial{false}
1691 This enables the creation of \ac{pdf} comments.
1692 \keyval{cmd}{code}\Module{pdfcomments}\Initial{\cs*{pdftooltip}\Marg{\#1}\Marg{\#2}}
1693 Chooses the command for actually creating the comment. You must refer to
1694 the printed output in the \ac{pdf} with \code{\#1} and to the comment with
1695 \code{\#2}. The default command \cs*{pdftooltip} is provided by the
1696 package \pkg{pdfcomment}~\cite{pkg:pdfcomment}. You must load it in order
1697 to use it.
1698 \end{options}
1699 Only acronyms where the corresponding property has been set will get comments:
1700 \begin{properties}
1701 %% pdfcomment
1702 \propval{pdfcomment}{text}
1703 Sets a tooltip description for an acronym.
1704 \end{properties}
1705
1706 \subsection{Accessibility support}\label{sec:access-supp}
1707 \acro\ supports the \pkg{accsupp} package~\cite{pkg:accsupp} when you
1708 \emph{also load \pkg{hyperref}}. Then \acro\ uses
1709 \begin{sourcecode}
1710 \BeginAccSupp{ method = pdfstringdef , ActualText = {PDF} }
1711 \textsc{pdf}%
1712 \EndAccSupp{}%
1713 \end{sourcecode}
1714 for an acronym defined like this:
1715 \begin{sourcecode}
1716 \DeclareAcronym{pdf}{
1717 short = pdf ,
1718 long = Portable Document Format ,
1719 short-format = \scshape ,
1720 pdfstring = PDF ,
1721 short-acc = PDF
1722 }
1723 \end{sourcecode}
1724 Without accessibility support when a string like \enquote{\textsc{pdf}} is
1725 copied from the \ac{pdf} and pasted you get \enquote{pdf}. If you don't care
1726 about that simply don't load \pkg{accsupp} and ignore this section.
1727
1728 You have a few options to be able to manipulate what \acro\ does here but I
1729 recommend to stay with the default settings:
1730 \begin{options}
1731 \keybool{use}\Module{accsupp}\Initial{true}
1732 When this is true and the package \pkg{accsupp} is loaded then
1733 accessibility support is used.
1734 \keyval{options}{text}\Module{accsupp}\Initial
1735 Additional option to be passed to \cs{BeginAccSupp}. See the
1736 \pkg{accsupp} manual for possible settings.
1737 \keyval{method}{method}\Module{accsupp}\Initial{pdfstringdef}
1738 The method used by \cs{BeginAccSupp}. See the
1739 \pkg{accsupp} manual for possible values.
1740 \end{options}
1741
1742 The \enquote{ActualText} that is used by \acro\ always defaults to the values
1743 of the acronym properties themselves. You can choose these values
1744 individually by setting the corresponding properties:
1745 \begin{properties}
1746 %% short-acc
1747 \propval{short-acc}{text}\Initial={short}
1748 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
1749 package for the short form of the acronym.
1750 %% long-acc
1751 \propval{long-acc}{text}\Initial={long}
1752 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
1753 package for the long form of the acronym.
1754 %% alt-acc
1755 \propval{alt-acc}{text}\Initial={alt}
1756 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
1757 package for the alternative short form of the acronym.
1758 %% foreign-acc
1759 \propval{foreign-acc}{text}\Initial={foreign}
1760 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
1761 package for the foreign form of the acronym.
1762 %% extra-acc
1763 \propval{extra-acc}{text}\Initial={extra}
1764 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
1765 package for the extra information of the acronym.
1766 %% single-acc
1767 \propval{single-acc}{text}\Initial={long-acc}
1768 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
1769 package for a single appearance of the acronym.
1770 %% list-acc
1771 \propval{list-acc}{text}\Initial={list}
1772 Sets the \code{ActualText} property as presented by the \pkg{accsupp}
1773 package for the appearance in the list of acronyms.
1774 \end{properties}
1775
1776 Extra care has to be taken for plural forms as these can not be picked up
1777 automatically right now. You have to explicitly set them for the
1778 accessibility support, too:
1779 \begin{sourcecode}
1780 \DeclareAcronym{ufo}{
1781 short = UFO ,
1782 long = unidentified flying object ,
1783 foreign = unbekanntes Flugobjekt ,
1784 foreign-plural-form = unbekannte Flugobjekte ,
1785 foreign-acc-plural-form = unbekannte Flugobjekte ,
1786 foreign-babel = ngerman ,
1787 long-indefinite = an
1788 }
1789 \end{sourcecode}
1790
1791 \begin{bewareofthedog}
1792 Please note that this mechanism is disabled for inner acronyms if you have
1793 nested definitions.
1794 \end{bewareofthedog}
1795
1796 \section{Localisation}\label{sec:localisation}
1797 There are places when \acro\ uses text strings which depend on the language of
1798 the document. In order to recognize the language from \pkg{babel} of
1799 \pkg{polyglossia} and print the strings in the correct language \acro\ uses
1800 the \pkg{translations}~\cite{pkg:translations}.
1801
1802 If the language is detected incorrectly or you want \acro\ to use another
1803 language than it detects you can use the following option:
1804 \begin{options}
1805 \keychoice{language}{auto,\meta{language}}\Initial{auto}
1806 The default setting \code{auto} lets \acro\ detect the language setting
1807 automatically. Valid choices are all language names known to the package
1808 \pkg{translations}. Mostly just type your language and it should work.
1809 \end{options}
1810 \acro\ only provides support for a handful of languages. You can easily teach
1811 \acro\ your language -- see section~\vref{sec:translations} -- if it isn't
1812 supported, yet\footnote{If you like you can always open an issue at \issues\
1813 and provide your translations so I can add them to \acro.}.
1814 \begin{commands}
1815 \expandable\command{acrotranslate}[\marg{key}]
1816 This command fetches the translation of \meta{key} for the current
1817 language. It is meant for usage in template definitions.
1818 \end{commands}
1819
1820 Available keywords and their English, French, and German translations are
1821 shown in table~\vref{tab:translations}.
1822
1823 \begin{table}
1824 \centering
1825 \begin{tabular}{llll}
1826 \toprule
1827 \bfseries Key & \bfseries English & \bfseries French & \bfseries German \\
1828 \midrule
1829 \translationtable
1830 \bottomrule
1831 \end{tabular}
1832 \caption{Available translation keywords.}
1833 \label{tab:translations}
1834 \end{table}
1835
1836 \section{Patches}\label{sec:patches}
1837 In several situations it can lead to wrong results if \acro\ marks an acronym
1838 as used too early or at all. This is why it is possible to disable the
1839 mechanism which is responsible:
1840 \begin{commands}
1841 \command{acswitchoff}
1842 This disables the mechanism which marks acronyms as used. After this
1843 command every acronym command like \cs{ac} acts like its starred version.
1844 \command{acswitchon}
1845 This command enables the mechanism again.
1846 \end{commands}
1847
1848 In certain circumstances \acro\ uses these commands itself. For example it is
1849 often preferable that acronyms are not counted as used in floats, the table of
1850 contents or the lists of figures and tables. This is why \acro\ turns the
1851 mechanism off in these places.
1852
1853 Certain table environments typeset their contents twice for measurement
1854 purposes. \acro\ tries to disable the usage mechanism during these phases.
1855 The same is true for single line captions from the \pkg{caption} package.
1856
1857 All these patches can be turned off:
1858 \begin{options}
1859 \keybool{floats}\Module{patch}\Initial{true}
1860 En-/disable the \option{floats} patch.
1861 \keybool{lists}\Module{patch}\Initial{true}
1862 En-/disable the \option{lists} patch for the table of contents, the list
1863 of figures and the list of tables.
1864 \keybool{tabularx}\Module{patch}\Initial{true}
1865 En-/disable the \option{tabularx} patch.
1866 \keybool{longtable}\Module{patch}\Initial{true}
1867 \sinceversion{3.7}En-/disable the \option{longtable} patch.
1868 \keybool{ltxtable}\Module{patch}\Initial{true}
1869 En-/disable the \option{ltxtable} patch.
1870 \keybool{tabu}\Module{patch}\Initial{true}
1871 En-/disable the \option{tabu} patch.
1872 \keybool{caption}\Module{patch}\Initial{true}
1873 En-/disable the \option{caption} patch.
1874 \keybool{maketitle}\Module{patch}\Initial{true}
1875 \sinceversion{3.6}En-/disable the \option{maketitle} patch.
1876 \end{options}
1877
1878 \part{Extending \acro}\label{part:extending-acro}
1879 \section{Background}\label{sec:background}
1880 \subsection{Templates}
1881 One of the core ideas of \acro\ version~3.0 is the use of \emph{templates}
1882 which manage how different how anything is printed, from the output of \cs{ac}
1883 and friends to the list of acronyms. \acro\ uses three types of templates:
1884 \begin{description}
1885 \item[acronym] These templates can be used to define \emph{acronym
1886 commands}, see section~\vref{sec:own-acronym-commands}.
1887 \item[list] These templates are used by the \cs{printacronyms} command.
1888 \item[heading] These templates only make sense if a \emph{list} template
1889 uses \cs{acroheading}. This command makes use of them.
1890 \end{description}
1891
1892 How these templates are defined, which are available from the start and how
1893 they are used is explained in section~\vref{sec:templates}.
1894
1895 \subsection{Objects}
1896 \acro\ uses certain kinds of objects in some of its commands. It is possible
1897 to defines own such objects:
1898 \begin{description}
1899 \item[articles] Per default only the \enquote{indefinite} article is
1900 defined. But it is possible to define and add other articles to \acro.
1901 This is explained in section~\vref{sec:other-articles}.
1902 \item[endings] Per default only the ending \enquote{plural} is defined. But
1903 it is possible to define and add other endings to \acro. This is
1904 explained in section~\vref{sec:other-endings}.
1905 \item[properties] You have already learned about properties. It is possible
1906 to define and add further acronym properties to \acro. This is explained
1907 in section~\vref{sec:new-properties}.
1908 \item[translations] \acro\ uses localisation strings at a number of places.
1909 It is possible to change these strings and add further strings. This is
1910 explained in section~\vref{sec:localisation}.
1911 \end{description}
1912
1913 \section{Templates}\label{sec:templates}
1914 \subsection{Pre-defined templates}\label{sec:pre-defin-templ}
1915 \subsubsection{Acronym templates}
1916 \begin{templates}
1917 \tmpl{alt}
1918 Display the alternative form of an acronym.
1919 \tmpl{first}
1920 This is a \emph{pseudo} template which always displays what is
1921 set through the option \option{first-style} or the property
1922 \property{first-style}.
1923 \tmpl{footnote}
1924 A template for the first appearance where the long form is printed in a
1925 footnote. This template also contains a command
1926 \cs{acroendfootnote}\sinceversion{3.7} at the end of the footnote text
1927 which in its default definition does nothing.
1928 \tmpl{long}
1929 Display the long form of an acronym.
1930 \tmpl{long-short}
1931 A template for the first appearance where the long form is printed and the
1932 short form follows in parentheses.
1933 \tmpl{short}
1934 Display the short form of an acronym.
1935 \tmpl{short-long}
1936 A template for the first appearance where the short form is printed and the
1937 long form follows in parentheses.
1938 \tmpl{single}
1939 A template which is used when the property \property{single} has been set
1940 \emph{and} the option \option{single} has been set \emph{and} if the
1941 acronym is only used a single time.
1942 \tmpl{show}
1943 A template which writes all properties of an acronym into the log file.
1944 \end{templates}
1945
1946 \subsubsection{List templates}
1947 \begin{templates}
1948 \tmpl{description}
1949 The default list style which places the short form in the item of a
1950 \env*{description} environment and adds the all the rest as description of
1951 the item.
1952 \tmpl{lof}
1953 A style which mimicks the list of figures. This style does not support
1954 page ranges.
1955 \tmpl{longtable}
1956 A style that uses a \env*{longtable} environment for building the list.
1957 This needs the \pkg{longtable} package~\cite{pkg:longtable} loaded.
1958 \tmpl{supertabular}
1959 A\sinceversion{3.2} style that uses a \env*{supertabular} environment for
1960 building the list. This needs the \pkg{supertabular}
1961 package~\cite{pkg:supertabular} loaded.
1962 \tmpl{tabularray}
1963 A\sinceversion{3.8} style that uses a custom table environment
1964 \env*{actblr} based on \env*{longtblr}. This needs the \pkg{tabularray}
1965 package~\cite{pkg:tabularray} loaded.
1966 \tmpl{tabular}
1967 A style that uses a \env*{tabular} environment for building the list.
1968 Since a \env*{tabular} cannot break across pages this is only suited for
1969 short lists.
1970 \tmpl{toc}
1971 A style which mimicks the table of contents. This style does not support
1972 page ranges.
1973 \end{templates}
1974
1975 The templates \template{tabular}, \template{longtable}, and
1976 \template{supertabular} support the following option:
1977 \begin{options}
1978 \keyval{colspec}{value}\Module{templates}%
1979 \Initial{\code{>\{\cs*{bfseries}\}lp\{.7\cs*{linewidth}\}}}
1980 \sinceversion{3.8}It enables you to easily adjust the column specification
1981 of the standard table templates to your needs. \emph{Please be aware that
1982 you need \emph{exactly} two columns}.
1983 \end{options}
1984
1985 \subsubsection{Heading templates}
1986 \begin{templates}
1987 \tmpl{addchap}
1988 Only defined in a \KOMAScript\ class and if \cs*{chapter} is defined. Uses
1989 \cs*{addchap} for the heading.
1990 \tmpl{addchap*}
1991 \sinceversion{3.6}Only defined in a \KOMAScript\ class and if
1992 \cs*{chapter} is defined. Uses \cs*{addchap*} for the heading.
1993 \tmpl{addsec}
1994 Only defined in a \KOMAScript\ class. Uses \cs*{addsec} for the heading.
1995 \tmpl{addsec*}
1996 \sinceversion{3.6}Only defined in a \KOMAScript\ class. Uses \cs*{addsec*}
1997 for the heading.
1998 \tmpl{chapter}
1999 Only defined if \cs*{chapter} is defined. Uses \cs*{chapter} for the heading.
2000 \tmpl{chapter*}
2001 Uses \cs*{chapter}\sarg\ for the heading.
2002 \tmpl{none}
2003 Displays nothing.
2004 \tmpl{section}
2005 Uses \cs*{section} for the heading.
2006 \tmpl{section*}
2007 Uses \cs*{section}\sarg\ for the heading.
2008 \end{templates}
2009
2010 \subsection{Defining new templates}\label{sec:defin-new-templ}
2011 For the definition of templates these commends are available:
2012 \begin{commands}
2013 \command{NewAcroTemplate}[\oarg{type}\marg{name}\marg{code}]
2014 This defines a template of type \meta{type} with the name \meta{name}
2015 which inserts \meta{code} when used. A template of type \meta{type} with
2016 name \meta{name} must not exist. The default type is \code{acronym}.
2017 \command{RenewAcroTemplate}[\oarg{type}\marg{name}\marg{code}]
2018 This re-defines a template of type \meta{type} with the name \meta{name}
2019 which inserts \meta{code} when used. A template of type \meta{type} with
2020 name \meta{name} must exist. The default type is \code{acronym}.
2021 \command{SetupAcroTemplate}[\oarg{type}\marg{name}\marg{code}]
2022 Adds\sinceversion{3.2} \meta{code} to the beginning of the template
2023 \meta{name} of type \meta{type}. The default type is \code{acronym}.
2024 \command{SetupNextAcroTemplate}[\oarg{type}\marg{name}\marg{code}]
2025 Adds\sinceversion{3.2} \meta{code} to the beginning of \emph{the next use}
2026 of the template \meta{name} of type \meta{type}. The default type is
2027 \code{acronym}.
2028 \expandable\command{AcroTemplateType}
2029 Within a template this expands to the \meta{type} of the current
2030 template.
2031 \expandable\command{AcroTemplateName}
2032 Within a template this expands to the \meta{name} of the current
2033 template.
2034 \end{commands}
2035
2036 How to use these commands is best explained by examples of how the existing
2037 templates have been defined. The following sections will show several
2038 examples for their usage.
2039
2040 \subsection{Commands to be used in template definitions}
2041
2042 \acro\ provides and uses a large number of commands that are meant to be used
2043 in template definitions and that often are useless or will raise errors if
2044 used outside. Depending on their purpose the commands can be used in
2045 different types of templates or only in certain types of templates.
2046
2047 In the descriptions below a \expandablesymbol\ indicates a fully expandable
2048 command when used in an \cs*{edef}, \cs*{write} or in \cs*{expanded}.
2049
2050 A \TF\ always refers to a \meta{true} and \meta{false} branch and indicates
2051 that \emph{three} commands exist: one exactly as described, one with only the
2052 \code{\textcolor{cs}{T}} and the \meta{true} branch, and one with only the
2053 \code{\textcolor{cs}{F}} and the \meta{false} branch. So \cs{acroif\TF} means
2054 there is \cs*{acroifTF}, \cs*{acroifT}, and \cs*{acroifF}, where \cs*{acroifT}
2055 and \cs*{acroifF} each have an argument less than \cs*{acroifTF}.
2056
2057 \subsubsection{Commands for common uses}
2058 \begin{commands}
2059 \expandable\command{acrolistname}
2060 Expands to whatever is currently set with
2061 \module{list}\code{/}\option{name}.
2062 \command{acrowrite}[\marg{property}]
2063 Prints the property \meta{property} of the current acronym. Depending on
2064 the circumstances this prints the property together with an article or an
2065 ending either in uppercase or lowercase form. Default is the lowercase
2066 form without ending or article. The actual outcome is determined by
2067 switches which are explained in section~\vref{sec:own-acronym-commands}.
2068 \command{acroformat}[\marg{type}\marg{text}]
2069 This formats \meta{text} according to \meta{type} where \meta{type} has
2070 either been set as property or as option from the \module{format} module.
2071 Valid values are \code{short}, \code{long}, \code{alt}, \code{extra},
2072 \code{foreign}, \code{list}, and \code{first-long}.
2073 \command{acroshow}[\marg{property}]
2074 For debugging puposes: writes the property \meta{property} of the current
2075 acronym to the log file.
2076 \command{acroif\TF}[\marg{property}\marg{true}\marg{false}]
2077 Checks if the property \meta{property} has been set for the current
2078 acronym and either leaves \meta{true} or \meta{false} in the input stream.
2079 \command{acroifboolean\TF}[\marg{property}\marg{true}\marg{false}]
2080 \sinceversion{3.1}Returns \meta{true} if the boolean property
2081 \meta{property} has been set to \code{true} and \meta{false} otherwise.
2082 \command{acroifall\TF}[\marg{properties}\marg{true}\marg{false}]
2083 Checks if all properties in the csv list \meta{properties} have been set
2084 for the current acronym and either leaves \meta{true} or \meta{false} in
2085 the input stream.
2086 \command{acroifany\TF}[\marg{properties}\marg{true}\marg{false}]
2087 Checks if any of the properties in the csv list \meta{properties} has been
2088 set for the current acronym and either leaves \meta{true} or \meta{false}
2089 in the input stream.
2090 \command{acroiftag\TF}[\marg{tag}\marg{true}\marg{false}]
2091 Checks if the current acronym has been given the tag \meta{tag} and either
2092 leaves \meta{true} or \meta{false} in the input stream.
2093 \command{acroifstarred\TF}[\marg{true}\marg{false}]
2094 \sinceversion{3.5}Checks if the current call of the acronym is a starred
2095 command or not and either leaves \meta{true} or \meta{false} in the input
2096 stream.
2097 \command{AcroPropertiesMap}[\marg{code}]
2098 Maps over all defined acronym properties. Within \meta{code} you can
2099 refer to the current property with \code{\#1}.
2100 \command{AcroAcronymsMap}[\marg{code}]
2101 \sinceversion{3.5}Maps over all defined acronyms. Within \meta{code} you
2102 can refer to the current property with \code{\#1} or with \cs{AcronymID}.
2103 \command{AcroMapBreak}
2104 \sinceversion{3.5}Stops the map \cs{AcroAcronymsMap} and is usually used
2105 in combination with a boolean check.
2106 \command{AcroPropertiesSet}[\marg{id}\marg{csv list of properties}]
2107 \sinceversion{3.5}Allows the setting of properties of acronym \meta{id}
2108 outside of \cs{declareAcronym}.
2109 \end{commands}
2110
2111 \subsubsection{Commands for usage in acronym templates}
2112 \begin{commands}
2113 \expandable\command{acroifused\TF}[\marg{true}\marg{false}]
2114 Checks if the current acronym has been used before and either leaves
2115 \meta{true} or \meta{false} in the input stream.
2116 \command{acroiffirst\TF}[\marg{true}\marg{false}]
2117 Checks if the current usage of the current acronym is the first time and
2118 either leaves \meta{true} or \meta{false} in the input stream.
2119 \command{acroifsingle\TF}[\marg{true}\marg{false}]
2120 Checks if the current acronym is used a single time and either leaves
2121 \meta{true} or \meta{false} in the input stream.
2122 \command{acrogroupcite}
2123 \end{commands}
2124
2125 \subsubsection{Commands for usage in list templates}
2126 \begin{commands}
2127 \expandable\command{acroifchapter\TF}[\marg{true}\marg{false}]
2128 This just check if \cs*{chapter} is defined. Used in the \template{toc}
2129 template.
2130 \expandable\command{acroifpages\TF}[\marg{true}\marg{false}]
2131 This is \meta{true} if the option \module{pages}\code{/}\option{display}
2132 is set, \emph{and} the current acronym is not single, \emph{and} has at
2133 least one page number. \meta{false} otherwise.
2134 \command{acropages}[\marg{first}\marg{range}]
2135 If \cs{acroifpages\TF} would be \meta{false} this would do nothing.
2136 Otherwise, if \module{pages}\code{/}\option{display} is \code{first} it
2137 prints the first page number, preceded by \meta{first} if
2138 \module{pages}\code{/}\option{name} is true. If
2139 \module{pages}\code{/}\option{display} is \code{all} it prints the page
2140 range, preceded by \meta{range} if \module{pages}\code{/}\option{name} is
2141 true.
2142 \command{acronopagerange}
2143 This disables page ranges. Used in the \template{toc} and \template{lof}
2144 templates.
2145 \command{acroneedpages}
2146 \sinceversion{3.4}This enables the page number displayed. Used in the
2147 \template{toc} and \template{lof} templates.
2148 \command{acropagefill}
2149 If \cs{acroifpages\TF} would be \meta{false} this would do
2150 nothing. Otherwise it prints whatever is set by
2151 \module{pages}\code{/}\option{fill}.
2152 \command{acronymsmap}[\marg{code}]
2153 Maps over the acronyms in order of appearance in the list. Which acronyms
2154 these are depends on settings. They might only have certain tags, be ones
2155 local to barriers, \dots \par
2156 Within \meta{code} \code{\#1} refers to the current \ac{id} of the
2157 acronym. Also \cs{AcronymID} expands to the current \ac{id}. The latter
2158 is important for all the commands that check or print properties of
2159 acronyms.
2160 \command{acronymsmap\TF}[\marg{code}\marg{true}\marg{false}]
2161 This does the same as \cs{acronymsmap} and also leaves \meta{true} in the
2162 input stream if the list is not empty and \meta{false} otherwise. This is
2163 useful to trigger a rerun warning.
2164 \command{AcronymTable}
2165 This is an empty token list at the beginning of a list template.
2166 \command{AcroAddRow}[\marg{code}]
2167 Adds \meta{code} to the right of \cs{AcronymTable} and ensures that
2168 \cs{AcronymID} has the correct global definition for this code. With this
2169 the code for the \template{tabular} template and other table templates can
2170 be built in a comfortable way.
2171 \command{AcroNeedPackage}[\marg{package}]
2172 Checks if the package \meta{package} is loaded and throws an error
2173 otherwise.
2174 \command{AcroRerun}
2175 Triggers \acro\ to throw an \enquote{empty list} rerun warning.
2176 \end{commands}
2177
2178 \subsection{New acronym templates}\label{sec:new-acronym-templ}
2179
2180 Some templates are quite short and self-explaining:
2181 \begin{sourcecode}
2182 \NewAcroTemplate{short}{\acrowrite{short}}
2183 \end{sourcecode}
2184
2185 Some are a little bit more elaborate:
2186 \begin{sourcecode}
2187 \NewAcroTemplate{alt}{%
2188 \acroifTF{alt}
2189 {\acrowrite{alt}}
2190 {\acrowrite{short}}%
2191 }
2192 \end{sourcecode}
2193
2194 And some templates need to do a lot more:
2195 \begin{sourcecode}
2196 \NewAcroTemplate{long-short}{%
2197 \acroiffirstTF{%
2198 \acrowrite{long}%
2199 \acspace(%
2200 \acroifT{foreign}{\acrowrite{foreign}, }%
2201 \acrowrite{short}%
2202 \acroifT{alt}{ \acrotranslate{or} \acrowrite{alt}}%
2203 \acrogroupcite
2204 )%
2205 }%
2206 {\acrowrite{short}}%
2207 }
2208 \end{sourcecode}
2209
2210 \subsection{New list templates}\label{sec:new-list-templates}
2211 This section shows the definition of three templates: \template{description},
2212 \template{tabular}, and \template{toc}.
2213
2214 First the \template{description} template:
2215 \begin{sourcecode}
2216 \NewAcroTemplate[list]{description}{%
2217 \acroheading
2218 \acropreamble
2219 \begin{description}
2220 \acronymsmapF{%
2221 \item[\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}]
2222 \acrowrite{list}%
2223 \acroifanyT{foreign,extra}{ (}%
2224 \acroifT{foreign}{\acrowrite{foreign}\acroifT{extra}{, }}%
2225 \acroifT{extra}{\acrowrite{extra}}%
2226 \acroifanyT{foreign,extra}{)}%
2227 \acropagefill
2228 \acropages
2229 {\acrotranslate{page}\nobreakspace}
2230 {\acrotranslate{pages}\nobreakspace}%
2231 }
2232 {\item\AcroRerun}
2233 \end{description}
2234 }
2235 \end{sourcecode}
2236
2237 The following shows how to define templates using some kind of table
2238 environment. Special care is necessary due to the way \LaTeX\ tables work:
2239 first the table body is built and only then the table itself is printed:
2240 \begin{sourcecode}
2241 \NewAcroTemplate[list]{tabular}{%
2242 \AcroNeedPackage{array}%
2243 \acronymsmapF{%
2244 \AcroAddRow{
2245 \acrowrite{short}%
2246 \acroifT{alt}{/\acrowrite{alt}}
2247 &
2248 \acrowrite{list}%
2249 \acroifanyT{foreign,extra}{ (}%
2250 \acroifT{foreign}{\acrowrite{foreign}\acroifT{extra}{, }}%
2251 \acroifT{extra}{\acrowrite{extra}}%
2252 \acroifanyT{foreign,extra}{)}%
2253 \acropagefill
2254 \acropages
2255 {\acrotranslate{page}\nobreakspace}
2256 {\acrotranslate{pages}\nobreakspace}%
2257 \tabularnewline
2258 }%
2259 }
2260 {\AcroRerun}%
2261 \acroheading
2262 \acropreamble
2263 \par\noindent
2264 \begin{tabular}{>{\bfseries}lp{.7\linewidth}}
2265 \AcronymTable
2266 \end{tabular}
2267 }
2268 \end{sourcecode}
2269
2270 \begin{sourcecode}
2271 \NewAcroTemplate[list]{toc}{%
2272 \acroheading
2273 \acropreamble
2274 \acronopagerange
2275 \acronymsmapF{%
2276 \contentsline{\acroifchapterTF{chapter}{section}}
2277 {\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}}
2278 {}{}%
2279 \contentsline{\acroifchapterF{sub}section}
2280 {
2281 \acrowrite{list}%
2282 \acroifT{foreign}{\acrowrite{foreign}\acroifT{extra}{, }}%
2283 \acroifT{extra}{\acrowrite{extra}}%
2284 \acroifanyT{foreign,extra}{)}%
2285 }
2286 {\acropages{}{}}
2287 {}%
2288 }
2289 {\AcroRerun}
2290 }
2291 \end{sourcecode}
2292
2293 \subsection{New heading templates}\label{sec:new-head-templ}
2294 Let's take a look at the two templates \template{section} and
2295 \template{section*} which should give you enough information to build your
2296 own:
2297 \begin{sourcecode}
2298 \NewAcroTemplate[heading]{section} {\section {\acrolistname}}
2299 \NewAcroTemplate[heading]{section*}{\section*{\acrolistname}}
2300 \end{sourcecode}
2301
2302 \section{Endings}\label{sec:endings}
2303 Referring to section~\vref{sec:other-endings} this section explains how to
2304 define and use additional endings.
2305 \begin{commands}
2306 \command{DeclareAcroEnding}[\marg{name}\marg{short default}\marg{long default}]
2307 This command can be used to define properties and options analoguous to
2308 the plural endings which have been defined this way:
2309 \end{commands}
2310 \begin{sourcecode}
2311 \DeclareAcroEnding{plural}{s}{s}
2312 \end{sourcecode}
2313 In general \cs{DeclareAcroEnding}\marg{foo}\marg{x}\marg{y} defines these
2314 options
2315 \begin{options}
2316 \keyval*{short-\meta{foo}-ending}{value}\Initial*{\meta{x}}
2317 \keyval*{long-\meta{foo}-ending}{value}\Initial*{\meta{y}}
2318 \end{options}
2319 and these properties
2320 \begin{properties}
2321 \propval*{short-\meta{foo}}{value}\Initial*{\meta{x}}
2322 \propval*{short-\meta{foo}-form}{value}\Initial*
2323 \propval*{alt-\meta{foo}}{value}\Initial*{\meta{x}}
2324 \propval*{alt-\meta{foo}-form}{value}\Initial*
2325 \propval*{long-\meta{foo}}{value}\Initial*{\meta{y}}
2326 \propval*{long-\meta{foo}-form}{value}\Initial*
2327 \propval*{foreign-\meta{foo}}{value}\Initial*{\meta{y}}
2328 \propval*{foreign-\meta{foo}-form}{value}\Initial*
2329 \propval*{single-\meta{foo}}{value}\Initial*{\meta{y}}
2330 \propval*{single-\meta{foo}-form}{value}\Initial*
2331 \propval*{extra-\meta{foo}}{value}\Initial*{\meta{y}}
2332 \propval*{extra-\meta{foo}-form}{value}\Initial*
2333 \end{properties}
2334 In addition another command is defined which is meant to be used in
2335 template definitions.
2336 \begin{commands}
2337 \command*{acro\meta{foo}}
2338 This command tells the template that the ending \meta{foo} should be
2339 used.
2340 \end{commands}
2341 Section~\vref{sec:own-acronym-commands} has an example of how this can be used
2342 to define a possessive ending and commands that make use of them like this:
2343 \begin{example}[side-by-side]
2344 \acfg{MP}
2345 \end{example}
2346
2347 \section{Articles}\label{sec:articles}
2348 Referring to section~\vref{sec:other-articles} this section explains how to
2349 define and use additional articles.
2350 \begin{commands}
2351 \command{DeclareAcroArticle}[\marg{name}\marg{default}]
2352 This command can be used to define properties and options analoguous to
2353 the indefinite article which have been defined this way:
2354 \end{commands}
2355 \begin{sourcecode}
2356 \DeclareAcroArticle{indefinite}{a}
2357 \end{sourcecode}
2358 In general \cs{DeclareAcroArticle}\marg{foo}\marg{x} defines the
2359 option
2360 \begin{options}
2361 \keyval*{\meta{foo}}{value}\Initial*{\meta{x}}
2362 \end{options}
2363 and these properties
2364 \begin{properties}
2365 \propval*{short-\meta{foo}}{value}\Initial*{\meta{x}}
2366 \propval*{alt-\meta{foo}}{value}\Initial*{\meta{x}}
2367 \propval*{long-\meta{foo}}{value}\Initial*{\meta{x}}
2368 \propval*{foreign-\meta{foo}}{value}\Initial*{\meta{x}}
2369 \propval*{single-\meta{foo}}{value}\Initial*{\meta{x}}
2370 \propval*{extra-\meta{foo}}{value}\Initial*{\meta{x}}
2371 \end{properties}
2372 In addition another command is defined which is meant to be used in
2373 template definitions.
2374 \begin{commands}
2375 \command*{acro\meta{foo}}
2376 This command tells the template that the article \meta{foo} should be
2377 used.
2378 \end{commands}
2379 Section~\vref{sec:own-acronym-commands} has examples of how this can be used
2380 to define definite articles and commands that make use of them like this:
2381 \begin{example}
2382 \dacs{hadopi} \par
2383 \dacl{hadopi}
2384 \end{example}
2385
2386 \section{Translations}\label{sec:translations}
2387 For adding additional keywords, or for adding translations to existing
2388 keywords, or for changing existing translations \acro\ uses this command:
2389 \begin{commands}
2390 \command{DeclareAcroTranslation}[\marg{key}\marg{language=translation list}]
2391 With this command new translations keywords can be added and translations
2392 for existing keywords can be changed.
2393 \command{AddAcroTranslations}[\marg{key}\marg{language=translation list}]
2394 Basically the same but this time per language rather than per keyword.
2395 \end{commands}
2396 As an example this is how \acro\ declares translations for the \code{pages}
2397 keyword:
2398 \begin{sourcecode}
2399 \DeclareAcroTranslation{pages}{
2400 Fallback = pp\abbrdot ,
2401 English = pp\abbrdot ,
2402 French = pp\abbrdot ,
2403 German = S\abbrdot ,
2404 Portuguese = pp\abbrdot
2405 }
2406 \end{sourcecode}
2407 Translations for a language could be added this way\footnote{\acro\ already
2408 has the translations for Italian.}:
2409 \begin{sourcecode}
2410 \AddAcroTranslations{Italian}{
2411 list-name = Acronimi ,
2412 page = p\abbrdot ,
2413 pages = pp\abbrdot ,
2414 sequens = s\abbrdot ,
2415 sequentes = ss\abbrdot ,
2416 also = anche ,
2417 and = e ,
2418 or = o
2419 }
2420 \end{sourcecode}
2421 The existing keywords had been shown in table~\vref{tab:translations}.
2422
2423 \section{Properties}\label{sec:new-properties}
2424 As you know from section~\ref{sec:decl-acronyms-other} \acro\ comes with quite
2425 a number of predefined properties which control various aspects of
2426 acronyms. However, there are cases when additional properties would be nice to
2427 have and to use. It can be done with the following command:
2428 \begin{commands}
2429 \command{DeclareAcroProperty}[\sarg\arg{?}\arg{!}\arg{|}\arg{>}\marg{name}]
2430 This defines the new property \meta{name}. The command has five optional
2431 arguments most of which you probably never need. \par
2432 The optional star \sym{*} ensures that each acronym gets a \emph{unique}
2433 value for the property. \par
2434 The optional question mark \sym{?} creates a \emph{boolean} property.
2435 That is a property that only can get the values \code{true} or
2436 \code{false} and when it is used without value (not an empty value!) then
2437 \code{true} is assumed. \par
2438 The optional exclamation mark \sym{!} creates a \emph{mandatory}
2439 property. An error is raised if an acronym does not set it. \par
2440 The optional pipe \sym{|} creates a \emph{static} property which means
2441 its value is written to an auxiliary file and read in again at begin
2442 document. Once set the value is the same throughout the document. \par
2443 The optional greater as symbol\sinceversion{3.2} \sym{>} creates a
2444 \emph{display} property. This additionally defines the two boolean
2445 options \meta{name}\code{/}\option{display} and
2446 \module{list}\code{/}\meta{name}\code{/}\option{display}, both initially
2447 set to true. If these options are set to false the acronym commands or
2448 the list act as if the property \meta{name} has not been set. The
2449 \property{foreign} property is an example.
2450 \command{DeclareAcroPropertyAlias}[\sarg\arg{?}\arg{!}\arg{|}\arg{>}\marg{name1}\marg{name2}]
2451 This newly declares property \meta{name1} and makes it an alias of
2452 property \meta{name2}. This means that \meta{name1} gets the same value
2453 that \meta{name2} has unless it is set explicitly. Property \meta{name2}
2454 must exist.
2455 \command{MakeAcroPropertyAlias}[\marg{name1}\marg{name2}]
2456 This makes property \meta{name1} and makes it an alias of property
2457 \meta{name2}. Both properties must exist.
2458 \end{commands}
2459 Exmaples for defining and using new properties are shown in
2460 section~\ref{sec:examples}, \ac*{eg}, examples~\ref{example:texsx-505891}
2461 or~\ref{example:texsx-507726}.
2462
2463 \section{Own acronym commands}\label{sec:own-acronym-commands}
2464 \subsection{Background}
2465 You can define own acronym commands or redefine the existing ones with
2466 commands similar to \cs*{NewDocumentCommand} from the \pkg{xparse}
2467 package~\cite{pkg:xparse}.
2468 \begin{commands}
2469 \command{NewAcroCommand}[\marg{command}\marg{arg. spec.}\marg{code}]
2470 This creates the new command \meta{command} with the argument
2471 specification\footnote{in the sense of an \pkg{xparse}
2472 command.} \code{so\meta{arg. spec.}} and replacement text \meta{code}.
2473 There are significant differences to \cs*{NewDocumentCommand}: the new
2474 command always has two additional arguments: an optional star and an
2475 optional argument for options. You can ignore this fact in your
2476 definition, though. However, the command \emph{must} at least have one
2477 argument \emph{and} the first argument \emph{must} refer to the \ac{id}.
2478 Everything else is up to you. \par
2479 The new command has the suiting framework to recognize trailing tokens,
2480 count usage, index, and add a citation if necessary.
2481 \command{RenewAcroCommand}[\marg{command}\marg{arg. spec.}\marg{code}]
2482 Like \cs{NewAcroCommand} but redefines an existing command.
2483 \command{UseAcroTemplate}[\oarg{type}\marg{name}\oarg{argument number}\meta{arguments}]
2484 The argument \meta{type} defaults to \code{acronym} and \meta{argument
2485 number} defaults to \code{1}. The command must be followed by as many
2486 mandatory arguments as you specify with \meta{argument number}. All
2487 predefined acronym templates use the first argument as \ac{id} so they
2488 must use one argument.
2489 \end{commands}
2490 Let's see an example. This is the definition of \cs{ac}:
2491 \begin{sourcecode}
2492 \NewAcroCommand\ac{m}{\UseAcroTemplate{first}{#1}}
2493 \end{sourcecode}
2494 Equivalent definitions would be:
2495 \begin{sourcecode}
2496 \NewAcroCommand\ac{m}{\UseAcroTemplate[acroynm]{first}{#1}}
2497 \NewAcroCommand\ac{m}{\UseAcroTemplate[acroynm]{first}[1]{#1}}
2498 \NewAcroCommand\ac{m}{\UseAcroTemplate{first}[1]{#1}}
2499 \NewAcroCommand\ac{m}{\UseAcroTemplate{first}[2]{#1}{}}
2500 \end{sourcecode}
2501
2502 There are a number of switch commands which determine a certain behavior.
2503 They tell the following template how to interpret certain conditionals and how
2504 to use \cs{acrowrite}.
2505 \begin{commands}
2506 \command{acrocite}
2507 Tells \acro\ to output the citation.
2508 \command{acrodonotuse}
2509 Tells \acro\ to not count this as usage.
2510 \command{acroplural}
2511 Use plural form.
2512 \command{acroindefinite}
2513 Use indefinite article
2514 \command{acroupper}
2515 Use uppercase form.
2516 \command{acrofull}
2517 Use first or full form.
2518 \end{commands}
2519
2520 Here is an example that makes use of them:
2521 \begin{sourcecode}
2522 \NewAcroCommand\Iacs{m}{%
2523 \acroupper\acroindefinite\UseAcroTemplate{short}{#1}%
2524 }
2525 \end{sourcecode}
2526
2527 \subsection{Create commands for possessive endings}
2528 Let's say you want to add an ending for the genitive case.
2529 First you define the appropriate ending:
2530 \begin{sourcecode}
2531 \DeclareAcroEnding{possessive}{'s}{'s}
2532 \end{sourcecode}
2533 Then you define commands which make use of this ending:
2534 \begin{sourcecode}
2535 \NewAcroCommand\acg{m}{\acropossessive\UseAcroTemplate{first}{#1}}
2536 \NewAcroCommand\acsg{m}{\acropossessive\UseAcroTemplate{short}{#1}}
2537 \NewAcroCommand\aclg{m}{\acropossessive\UseAcroTemplate{long}{#1}}
2538 \NewAcroCommand\acfg{m}{%
2539 \acrofull
2540 \acropossessive
2541 \UseAcroTemplate{first}{#1}%
2542 }
2543 \NewAcroCommand\iacsg{m}{%
2544 \acroindefinite
2545 \acropossessive
2546 \UseAcroTemplate{short}{#1}%
2547 }
2548 \end{sourcecode}
2549 You maybe also define acronyms with corresponding properties\footnote{Bear
2550 with me if this is incorrect: English is not my native language.}:
2551 \begin{sourcecode}
2552 \DeclareAcronym{MP}{
2553 short = MP ,
2554 long = Member of Parliament ,
2555 plural-form = Members of Parliament ,
2556 long-possessive-form = Member's of Parliament
2557 }
2558 \end{sourcecode}
2559 Now you can use it like this:
2560 \begin{example}
2561 This is the \acg{MP} first day at work after \dots
2562 \end{example}
2563
2564 \section{Own \acro\ style files}
2565 When you want to use your definitions regarding \acro\ repeatedly then it
2566 makes sense to put them in a file which you put somewhere in your local
2567 \LaTeX\ tree. There are three options:
2568 \begin{enumerate}
2569 \item Put them in a simple \code{.tex} file in \cs*{input} it.
2570 \item Put in in a \code{.sty} file and include it with \cs*{usepackage}
2571 \emph{after} \acro.
2572 \item Create a style file following this pattern decribed below.
2573 \end{enumerate}
2574 \begin{center}
2575 \code{acro.style.\meta{name}.code.tex}
2576 \end{center}
2577 This file should start with
2578 \begin{sourcecode}
2579 \AcroStyle{name}
2580 \end{sourcecode}
2581 and input the file with \cs{acsetup} using the option
2582 \begin{options}
2583 \keyval{load-style}{name}
2584 This is more or less the same as if you'd use the package variant but
2585 naturally ensures that you load it after \acro\ and in the future might
2586 provide other bells and whistles, too.
2587 \end{options}
2588 The command
2589 \begin{commands}
2590 \command{AcroStyle}[\sarg\marg{style}\oarg{details}]
2591 has an optional star which switches to expl3 syntax. It also has an
2592 optional argument \meta{details} with the same purpose and usage as
2593 the one from \cs*{ProvidesPackage}. A typical usage would look like
2594 \end{commands}
2595 \begin{sourcecode}
2596 \AcroStyle{abbrev}[2020/04/21 abbreviations with acro (CN)]
2597 \NewDocumentCommand\newabbreviation{mmm}{%
2598 \DeclareAcronym{#1}{ short = #2 , #3 , class = abbrev , no-index }%
2599 }
2600 \NewDocumentCommand\printabbreviations{O{}}{%
2601 \printacronyms[#1,include=abbrev]%
2602 }
2603 \end{sourcecode}
2604
2605 \clearpage
2606 \appendix
2607 \part{Appendix}\label{part:appendix}
2608
2609 \section{Examples}\label{sec:examples}
2610
2611 \listexamplefiles
2612
2613 \printacronyms[
2614 preamble = {\label{sec:acronyms}Below all abbreviations are listed which
2615 have been defined for the manual. The ones without page numbers have been
2616 defined but haven't been used.} ,
2617 exclude = {glossary}
2618 ]
2619
2620 \printbibliography
2621
2622 \end{document}