-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathacronym.dtx
2213 lines (2202 loc) · 76.4 KB
/
acronym.dtx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse (meta-comment)
%
% Doc-Source file to use with LaTeX2e
%
% Copyright 1994-2025 by Tobias Oetiker ([email protected]) and many Contributors.
% All rights reserved.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3 of this license
% or (at your option) any later version. The latest version of the
% license is in
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
% The Current Maintainer of this work is Tobias Oetiker ([email protected]).
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{acronym} % to get file info
\EnableCrossrefs
%\DisableCrossrefs % say \DisableCrossrefs if index is ready
\CodelineIndex
\RecordChanges % gather update information
%\OnlyDescription % comment out for implementation details
%\OldMakeindex % use if your MakeIndex is pre-v2.9
\setlength\hfuzz{15pt} % dont make so many
\hbadness=7000 % over and under full box warnings
\begin{document}
\DocInput{acronym.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{1664}
%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
%
%
% \DoNotIndex{\@auxout, \@bsphack, \@car, \@esphack, \@firstoftwo,
% \@gobble, \@ifnextchar,
% \@ifpackageloaded, \@nil, \@secondoftwo, \\}
% \DoNotIndex{\addtolength, \AtBeginDocument}
% \DoNotIndex{\begin, \begingroup, \bflabel}
% \DoNotIndex{\csname}
% \DoNotIndex{\DeclareOption, \def, \documentclass}
% \DoNotIndex{\edef, \else, \end, \endcsname, \endgroup, \endinput,
% \ensuremath, \expandafter}
% \DoNotIndex{\fi, \footnote}
% \DoNotIndex{\gdef, \global}
% \DoNotIndex{\hfill, \hyperlink, \hyperref, \hypertarget}
% \DoNotIndex{\if@filesw, \ifx, \item}
% \DoNotIndex{\label, \labelsep, \labelwidth, \leftmargin, \let,
% \long}
% \DoNotIndex{\makelabel, \mathrm}
% \DoNotIndex{\NeedsTeXFormat, \newcommand, \newenvironment,
% \newif, \newtoks, \noexpand, \nolinebreak, \null}
% \DoNotIndex{\PackageWarning, \PackageError, \ProcessOptions, \protect,
% \protected@write, \providecommand, \ProvidesPackage}
% \DoNotIndex{\raggedright, \ref, \relax, \renewcommand,
% \RequirePackage}
% \DoNotIndex{\S, \section, \setlength, \settowidth, \string,
% \subsection}
% \DoNotIndex{\textbf, \textsf, \textsmaller, \textsuperscript, \the}
% \DoNotIndex{\usepackage}
%
% \changes{v1.50}{2025/01/16}{Theo von Arx adds the option 'error' to throw errors upon undefined acronyms, Tobi integrates patches for issue/60 ltx and amsmath}
% \changes{v1.49}{2024/03/30}{Chris Landis adds noforwardlinks option and fixes targets for forward links to acs/acl/etc.-only use}
% \changes{v1.48}{2021/10/09}{Bruno Le Floch corrected capitalization of acronyms with a custom plural form.}
% \changes{v1.47}{2020/04/10}{Tobi Oetiker and Marcus Meeßen \cmd{hskip} Fixed several bugs in macros that use capitalisation, a bug were the output depends on the position of the list of acronyms, and a bug were nested hyperlinks could cause errors.}
% \changes{v1.46}{2020/03/13}{Tobi Oetiker \cmd{hskip} Fixed miss merge}
% \changes{v1.45}{2020/03/13}{Marcus Meeßen \cmd{hskip} Fixed hyperref and "missing aux" regressions.}
% \changes{v1.44}{2020/02/07}{Marcus Meeßen \cmd{hskip} Added the |printonlyreused| option, which allows to automatically exclude acronyms from the list of acronyms if they are used only once}
% \changes{v1.43}{2020/02/05}{Marcus Meeßen \cmd{hskip} Fixed unconventional dots spacing in list of acronyms, enhanced list of acronyms with hyperrefs, and fixed collisions between acronyms and package commands, which can be turned of with the |noacroprefix| option}
% \changes{v1.42}{2019/11/11}{Philippe Chauvat \cmd{hskip} Fix the carriage return with long lines, Tobi Oetiker and Horst Schirmeier fixed usedflag and page number entries for acfi and Acfi}
% \changes{v1.41}{2015/03/21}{Tobi Oetiker and Jason Mills \cmd{hskip} fix nameing conflicts with pageslts package}
% \changes{v1.40}{2014/09/29}{Hartmut Henkel - remove \cmd{hskip} instances, since they cause bad formating since space at the end of a line can not be collapsed anymore}
% \changes{v1.39}{2014/08/14}{Yann Leprince - make the appearance of labels consistent whether or not the acronym environment has its optional argument provided}
% \changes{v1.38}{2012/10/09}{Ash Hughes - add support for dynamic indefinite articles depending on the acronym form used}
% \changes{v1.37}{2012/09/04}{Martin Falk - ac* should NOT set the used flag ... now it does not. Martin Ruessler found fix for non hyphenation in the first word of the long form of the acronym}
% \changes{v1.36}{2010/09/08}{Uwe Bieling disable hyperlinks in nolist mode, prevent hyphenation of short form of acronyms}
% \changes{v1.35}{2009/10/20}{Sergio Callegari added support for nonstandard plural forms and fixed management of default short form.}
% \changes{v1.34}{2009/01/25}{make sure that the s of acp get smaller as well when the smaller option is active}
% \changes{v1.33}{2008/12/19}{enrico.gregorio provided a patch for makeing non-description acronym lists work}
% \changes{v1.32}{2008/05/28}{Ulrich Diez again altered code to redefine labels in order to cope with unreproducable bug-reports. Warnings turnrd into infos for the sake of decreasing frightening-level}
% \changes{v1.31}{2008/05/21}{Philipp Lehman noted a nameconflict with jurabib. Renamed clearlist to AC@clearlist since it is internal anyway}
% \changes{v1.30}{2008/04/22}{Ulrich Diez corrected code to redefine labels and adjusted behavior with \cmd{\AC@used}}
% \changes{v1.29}{2008/04/22}{added code to redefine labels as acronyms are used multiple times, makeing the right page numbers show up for the withpage option (code by Ulrich Diez on comp.text.tex, integration by Domagoj Babic, babic AT cs.ubc.ca)}
% \changes{v1.28}{2008/04/19}{add linebreak to items list by tobi}
% \changes{v1.27}{2008/04/18}{Added withpage option to print page numbers into acronym list by tobi and Domagoj Babic, babic AT cs.ubc.ca}
% \changes{v1.26}{2006/06/26}{Don't put out an empty item if nolist is in effect by [email protected]}
% \changes{v1.25}{2005/11/11}{Properly handle acronym commands in PDF Bookmarks by Heiko Oberdiek [email protected]}
% \changes{v1.24}{2005/10/25}{Now the acronyms commands and fixed a bug in the option nolist, by Jose Emilio Vila Forcen, [email protected]}
% \changes{v1.23}{2005/10/24}{Fix fpr nolist option by Tobi}
% \changes{v1.22}{2005/10/04}{added starred versions of ac(p), acf(p), acs(p), acl(p), acfi, acsu \& aclu by Stefan Pinnow ([email protected])}
% \changes{v1.21}{2005/09/20}{fixed acused again by Tobi. added option nolist, by Jose Emilio Vila Forcen, [email protected]}
% \changes{v1.20}{2005/08/16}{make acused actually work. by Richard.Walker with cs.anu.edu.au}
% \changes{v1.19}{2005/04/26}{three new commands acused (set-used), acsu (adds to used), aclu (adds to used) by Lee Netherton [email protected]}
% \changes{v1.18}{2005/04/01}{added additionaly format option for Full Name (acfi) command by Manuel G"ortz [email protected]}
% \changes{v1.17}{2004/11/10}{added don't use acronyms (dua) option by Oliver Creighton}
% \changes{v1.16}{2004/11/03}{fixed version number -- tobi}
% \changes{v1.15}{2004/11/02}{make acresetall work even when ac is called in environments by ctt}
% \changes{v1.14}{2004/10/08}{fix acsp and acfp for footnote mode by Markus Ortner [email protected]}
% \changes{v1.13}{2004/07/29}{deflist renamed to AC@deflist to
% avoid unnecessary nameing conflict. Found by [email protected].
% fixed prinonlyused option, it was ON all the time by Tobi. Foonotes were
% not adding to the clear list by Tobi.}
% \changes{v1.12}{2004/06/08}{Make acronyms robust and compatible
% with pdf bookmarks by Danie Els ([email protected]).}
% \changes{v1.11}{2004/06/04}{make hyperlinks work inside optional
% item text by replaceing hypertarget with raisedhypertarget by
% Martin Salois ([email protected]). Added note on fragility by Tobi}
% \changes{v1.10a}{2004/05/26}{Fix for the bug of a \cs{}\cs{} following
% an acronym. Add footnote optional out for \cmd{\acs} by Danie Els
% ([email protected]).}
% \changes{v1.10}{2004/05/25}{Fix for list of acronyms in front
% matter and addition of \cmd{\acroextra} command by Danie Els
% ([email protected]).}
% \changes{v1.09}{2003/10/26}{Fixed hyperref support by Danie Els
% ([email protected]), make sure not only \cmd{\ac} sets acronyms
% as used but direct calls to \cmd{\acs} and \cmd{\acf} and
% \cmd{\acl} as well by Tobi.}
% \changes{v1.08}{2003/10/20}{Added hyperref support and the
% option \texttt{nohyperref} provided by Martin Salois
% ([email protected])}
% \changes{v1.07}{2003/02/11}{Added \cs{acresetall} to reset the
% 'uses' - flag of \cmd{\ac}, new option \texttt{printonlyused},
% new possible format for the list. provided by Sebastian Max
% ([email protected])}
% \changes{v1.06}{2000/05/21}{Added the smaller option and
% macros to control the appearance of \cmd{\acf} and \cmd{\acs}
% provided by Ingo Lepper ([email protected])}
% \changes{v1.05}{2000/05/11}{Added new commands for handling
% English plural forms of acronyms and the \texttt{footnote}
% option provided by [email protected]}
% \changes{v1.04}{2000/02/09}{Optional argument for \cmd{\acro} and
% \cmd{\acrodef}, allowing formatting of the acronym itself
% provided by Heiko Oberdiek ([email protected])}
% \changes{v1.03}{1996/09/19}{Fixed dtx file ... could not be printed}
% \changes{v1.02}{1996/08/14}{Added \cmd{\acl} command patch provided by
% Ted Stern ([email protected])}
%
%
% \GetFileInfo{acronym.sty}
%
% \title{An Acronym Environment for \LaTeXe\thanks{^^A
% This file has version number \fileversion,
% last revised \filedate.}}
% \author{Tobias Oetiker}
% \date{\filedate}
% \maketitle
%
%
% \section{Introduction}
% When writing a paper on cellular mobile radio I started to use a
% lot of acronyms. This can be very disturbing for the reader,
% as he might not know all the used acronyms. To help the reader
% I kept a list of all the acronyms at the end of my paper.
%
% This package makes sure, that all acronyms used in the text are
% spelled out in full at least once.
%
% \section{The user interface}
% The package provides several commands and one environment
% for dealing with acronyms. Their appearance can be controlled by
% two package options and three macros.
%
% \subsection{Acronyms in the Text}
%
% \DescribeMacro{\ac}
% To enter an acronym inside the text, use the
% \begin{quote}
% |\ac[|\meta{linebreak penalty}|]{|\meta{acronym}|}|
% \end{quote}
% command. The first time you use an acronym, the full name of the
% acronym along with the acronym in brackets will be printed. If you
% specify the |footnote| option while loading the package, the full
% name of the acronym is printed as a footnote.
% The next time you access the acronym only the acronym will
% be printed.
%
% When an acronym is being used, for the first time (with the |footnote|
% option not specified), next to the end of the line, a line break between
% the full name of the acronym and the acronym in brackets can be
% encountered. The optional variable represents the penalty level of
% breaking the line at that place, taking integer values between 0 and 4.
% A higher number corresponds to a higher penalty.
%
% \DescribeMacro{\Ac}
% Works in the same way as \cmd{\ac}, but starts the long form with an
% upper case letter. Use case: when the acronym is used for the first
% time, at the beginning of a sentence.
%
% \DescribeMacro{\acresetall}
% The 'memory' of the macro \cmd{\ac} can be flushed by calling the macro
% \cmd{\acresetall}. Afterwards, \cmd{\ac} will print the full name of any
% acronym and the acronym in brackets the next time it is used.
%
% \DescribeMacro{\acf}
% If later in the text again the Full Name of the acronym should be
% printed, use the command
% \begin{quote}
% |\acf[|\meta{linebreak penalty}|]{|\meta{acronym}|}|
% \end{quote}
% to access the acronym. It stands for ``full acronym'' and it
% always prints the full name and the acronym in brackets.
%
% When an full acronym is being used next to the end of the line, a line
% break between the full name of the acronym and the acronym in brackets
% can be encountered. The optional variable represents the penalty level
% of breaking the line at that place, taking integer values between 0
% and 4. A higher number corresponds to a higher penalty.
%
% \DescribeMacro{\Acf}
% Works in the same way as \cmd{\acf}, but starts the long form with an
% upper case letter.
%
% \DescribeMacro{\acs}
% To get the short version of the acronym, use the command
% \begin{quote}
% |\acs{|\meta{acronym}|}|
% \end{quote}
%
% \DescribeMacro{\acl}
% Gives you the expanded acronym without even mentioning the
% acronym.
% \begin{quote}
% |\acl{|\meta{acronym}|}|
% \end{quote}
%
% \DescribeMacro{\Acl}
% Works in the same way as \cmd{\acl}, but starts with an upper case
% letter.
%
% \DescribeMacro{\acp}
% Works in the same way as \cmd{\ac}, but makes the short and/or
% long forms into plurals.
%
% \DescribeMacro{\Acp}
% Works in the same way as \cmd{\acp}, but starts the long form with an
% upper case letter.
%
% \DescribeMacro{\acfp}
% Works in the same way as \cmd{\acf}, but makes the short and
% long forms into plurals.
%
% \DescribeMacro{\Acfp}
% Works in the same way as \cmd{\acfp}, but starts the long form with an
% upper case letter.
%
% \DescribeMacro{\acsp}
% Works in the same way as \cmd{\acs}, but makes the short
% form into a plural.
%
% \DescribeMacro{\aclp}
% Works in the same way as \cmd{\acl}, but makes the long form
% into a plural.
%
% \DescribeMacro{\Aclp}
% Works in the same way as \cmd{\aclp}, but starts with an upper case
% letter.
%
% \DescribeMacro{\acfi}
% Works in the same way as \cmd{\acf}, but prints the Full Name acronym
% (\cmd{\acl}) in italics and the abbreviated form (\cmd{\acs}) in
% upshaped form.
%
% \DescribeMacro{\Acfi}
% Works in the same way as \cmd{\acfi}, but starts the long form with an
% upper case letter.
%
% \DescribeMacro{\acfip}
% Works in the same way as \cmd{\acfi}, but makes the short and long
% forms into plurals.
%
% \DescribeMacro{\Acfip}
% Works in the same way as \cmd{\acfip}, but starts the long form with
% an upper case letter.
%
% \DescribeMacro{\acused}
% Marks an acronym as used, as if it had been called with \cmd{\ac},
% but without printing anything. This means that in the future only the
% short form of the acronym will be printed.
%
% \DescribeMacro{\acsu}
% Prints the short form of the acronym and marks it as used.
%
% \DescribeMacro{\aclu}
% Prints the long form of the acronym and marks it as used.
%
% \DescribeMacro{\Aclu}
% Works in the same way as \cmd{\aclu}, but starts with an upper case
% letter.
%
% Example: |\acl{lox}/\acl{lh2} (\acsu{lox}/\acsu{lh2})|
%
% \DescribeMacro{\iac}
% Works in the same way as the \cmd{\ac} command but prefixes it with
% an appropriate indefinite article.
%
% \DescribeMacro{\Iac}
% Works in the same way as the \cmd{\ac} command but prefixes it with
% an appropriate upper case indefinite article.
%
% \DescribeMacro{\...*}
% The following commands do the same as their unstarred forms, except
% that the acronym will not be marked as used. If you work with the 'onlyused'
% option then macros which have only been used with starred commands will
% not show up.\\
% \cmd{\ac*}, \cmd{\Ac*}, \cmd{\acs*}, \cmd{\acl*}, \cmd{\Acl*}, \cmd{\acf*},
% \cmd{\Acf*}, \cmd{\acp*}, \cmd{\Acp*}, \cmd{\acsp*}, \cmd{\aclp*}, \cmd{\Aclp*},
% \cmd{\acfp*}, \cmd{\Acfp*}, \cmd{\acfi*}, \cmd{\Acfi*}, \cmd{\acfip*},
% \cmd{\Acfip*}, \cmd{\acsu*}, \cmd{\aclu*}, \cmd{\Aclu*}, \cmd{\iac*},
% and \cmd{\Iac*}.
%
% \subsection{Customization}
%
% The appearance of \cmd{\acs} and \cmd{\acf} can be configured
% in various ways. Of main importance are the package options:
% \begin{description}
% \item[\normalfont|footnote|]
% makes the full name of the acronym appear as a footnote.
% \item[\normalfont|smaller|]
% lets the acronyms appear a bit smaller than the surrounding
% text. This is in accord with typographic convention.
% The |relsize| package is required.
% \end{description}
%
% There are three lower-level macros controlling the output.
% Any acronym printed by \cmd{\acs} is formatted
% by \DescribeMacro{\acsfont}\cmd{\acsfont}. Similarly, unless the
% option |footnote| is specified, \DescribeMacro{\acffont}\cmd{\acffont}
% handles the output of \cmd{\acf}, where the included acronym
% goes through \DescribeMacro{\acfsfont}\cmd{\acfsfont} (and
% \cmd{\acsfont}).
% The plural and upper case forms are treated accordingly. Usually the
% three macros do nothing. To give an example, the option |smaller|
% makes \cmd{\acsfont} use the command \cmd{\textsmaller} from the
% |relsize| package:
% \begin{quote}
% |\renewcommand*{\acsfont}[1]{\textsmaller{#1}}|
% \end{quote}
%
% \subsection{Defining Acronyms}
% Acronyms can either defined from an environment specifically
% introduced for that purpose or by direct definitions.
%
% \DescribeEnv{acronym}
% The |acronym| environment allows one to define all the acronyms
% needed by a document at a single place and is self-documenting,
% since a table of acronyms is automatically produced.
%
% In the |acronym| environment, acronyms are defined with the
% \DescribeMacro{\acro} command:
% \begin{quote}
% |\acro{|\meta{acronym}|}[|\meta{short name}|]{|\meta{full name}|}|
% \end{quote}
% The first argument \meta{acronym} is the acronym string itself
% and is used in the commands of the previous section such as
% \cmd{\ac} or \cmd{\acl}, that print the different forms of the
% acronym.
%
% Because internal commands take \meta{acronym} for storing
% the different forms of the acronym, the \TeX\ code for the
% acronym is limited by \cmd{\csname}.
% If the acronym requires problematic or complicate \TeX\ stuff
% (font commands, \dots), then this code
% can be given in the optional argument \meta{short name}.
% The first argument \meta{acronym} is then a simpler string
% to identify the acronym.
% For example, an acronym for water can look like this:
% \begin{quote}
% |\acro{H2O}[$\mathrm{H_2O}$]{water}|
% \end{quote}
% Then |\acs{H2O}| gets ``$\mathrm{H_2O}$'' and
% |\acl{H2O}| prints ``water''.
%%
% Inside the |acronym| environment \DescribeMacro{\acroextra}
% additional information can be added to the list of acronyms
% with the \cmd{\acroextra} command that will not be included
% in the normal inline acronyms.
%
% \begin{quote}
% |\acroextra{|\meta{additional info}|}|
% \end{quote}
%
% \noindent
% for example:
%
% \begin{quote}
% |\acro{H2O}[$\mathrm{H_2O}$]|\\
% | {Dihydrogen Monoxide\acroextra{ (water)}}|\\[1ex]
% |\acro{NA}[\ensuremath{N_{\mathrm A}}]|\\
% | {Number of Avogadro\acroextra{ (See \S\protect\ref{A1})}}|
% \end{quote}
%
% \noindent
% Note that \cmd{\acroextra} must be inserted inside the
% \cmd{\acro} definition and that fragile commands must be
% protected. Be careful of unnecessary spaces.
%
% The standard format of the acronym list is a \cmd{\description}
% environment. If you pass an optional parameter to the |acronym|
% environment, the width of the acronym-column will be fitted to the
% width of the given parameter (which should be the longest acronym).
% For example, if \textit{HBCI} is the longest acronym used, the
% list should start with
% \begin{quote}
% |\begin{acronym}[HBCI]|
% \end{quote}
%
% \DescribeMacro{\aclabelfont}
% The short form of each acronym in the list is formatted using
% \cmd{\aclabelfont}, which typesets its arguments in bold font by
% default. It can be redefined to produce bold sans-serif labels, for
% example, with
% \begin{quote}
% |\renewcommand*{\aclabelfont}[1]{\textbf{\textsf{\acsfont{#1}}}}|
% \end{quote}
%
% In standard mode, the acronym-list will consist of all defined
% acronyms, regardless if the the acronym was used in the text
% before or not. This behavior can be changed by loading the
% package with the parameter \texttt{printonlyused} (used at least once) or
% \texttt{printonlyreused} (use more than once):
% \begin{quote}
% |\usepackage[printonlyused]{acronym}|
% \end{quote}
% In \texttt{printonly(re)used}-mode you can add to each acronym the
% the page number where it was first used by additionally specifying
% the option \texttt{withpage}.
% \begin{quote}
% |\usepackage[printonlyused,withpage]{acronym}|
% \end{quote}
%
% If one does not want an acronym list to be produced at all,
% acronyms can be defined directly thanks to the two commands
% \DescribeMacro{\newacro}%
% \DescribeMacro{\acrodef}%
% \begin{quote}
% |\newacro{|\meta{acronym}|}[|\meta{short name}|]{|\meta{full name}|}|\\
% |\acrodef{|\meta{acronym}|}[|\meta{short name}|]{|\meta{full name}|}|
% \end{quote}
% \noindent the difference between the two consisting in the fact
% that the latter makes the acronym definition stored in the |.aux|
% file. Therefore, the acronym becomes available from start-up in
% the next run.
%
% Note that all the acronym definitions made by \cmd{\acro} in the
% |acronym| environment are also similarly added to the |.aux|
% file.
%
% \subsubsection{Non standard indefinite articles}
%
% Sometimes the indefinite article of an acronym differs between its
% short form and its long form, for example ``a Federal Bureau of
% Investigation (FBI) agent'' and ``an FBI agent''. To deal with this,
% the package provides the following three commands
% \DescribeMacro{\newacroindefinite}
% \DescribeMacro{\acrodefindefinite}
% \DescribeMacro{\acroindefinite}
% \begin{quote}
% |\acroindefinite{|\meta{acronym}|}{|\meta{short indefinite article}|}{|%
% \meta{long indefinite article}|}|\\
% |\newacroindefinite{|\meta{acronym}|}{|\meta{short indefinite article}|}{|%
% \meta{long indefinite article}|}|\\
% |\acrodefindefinite{|\meta{acronym}|}{|\meta{short indefinite article}|}{|%
% \meta{long indefinite article}|}|\\
% \end{quote}
% \noindent that allow one to define indefinite articles. The \cmd{\acroindefinite}
% command is meant to be used in the |acronym| environment. The
% difference among the latter two is that \cmd{\acrodefindefinite} puts
% the acronym definition in the |.aux| file, so that the acronym
% exception is available at the next run from start-up.
%
% When using \cmd{\iac} and \cmd{\Iac} without first defining an
% article, the default article is ``a''.
%
% \subsubsection{Non standard and foreign plural forms}
%
% When the plural form of an acronym is required, the package
% typically obtains it as an English plural, by adding an `s'. This
% happens both for long and short forms. For instance, for an
% acronym defined as
% \begin{quote}
% |\newacro{IC}{Integrated Circuit}|
% \end{quote}
% \noindent the |\acsp{IC}| command produces ``ICs'', and the
% |\aclp{IC}| command produces ``Integrated Circuits''.
%
% Unfortunately, this is generally not suitable for typesetting in
% languages different from English, and at times it is not correct
% even for English. For instance consider the ``MP'' acronym,
% commonly used to refer to a ``Member of the Parlament''. Of
% course, its long form plural is not ``Member of the Parlaments'',
% but ``Members of the Parlament''. For the short form plural,
% ``MPs'' is anyway commonly accepted. The same happens with ``SOC
% (System on a Chip)'' or ``BUT (Block Under Test)''.
%
% In foreign languages, things can be even more complicated. For
% instance, in Italian, there are different rules for English
% acronyms used in Italian text and Italian acronyms used in
% Italian text. The former do not get a plural at all, neither for
% the long, nor for the short form as in ``Un paio di
% \emph{Integrated Circuit (IC)}''. The latter get a plural long
% form following the natural Italian rules for plurals, and a
% plural short form that can either be the same as the singular
% short form, or --- at times --- a form obtained by doubling those
% letter of the short form that correspond to words that get a
% plural in the long form. For instance: ``Nucleo Investigativo
% (NI)'' could take a plural as in ``Nuclei Investigativi (NNII)'',
% although in modern texts one is more likely to find ``Nuclei
% Investigativi (NI)''.
%
% To deal with all these different situations, the package (since
% version 1.35) has been enriched with the following three commands
% \DescribeMacro{\acroplural}
% \DescribeMacro{\newacroplural}
% \DescribeMacro{\acrodefplural}
% \begin{quote}
% |\acroplural{|\meta{acronym}|}[|\meta{short plural}|]{|%
% \meta{long plural}|}|\\
% |\newacroplural{|\meta{acronym}|}[|\meta{short plural}|]{|%
% \meta{long plural}|}|\\
% |\acrodefplural{|\meta{acronym}|}[|\meta{short plural}|]{|%
% \meta{long plural}|}|\\
% \end{quote}
% \noindent that allow one to define plural exceptions. The \cmd{\acroplural}
% command is meant to be used in the |acronym| environment. The
% difference among the latter two is that \cmd{\acrodefplural} puts
% the acronym definition in the |.aux| file, so that the acronym
% exception is available at the next run from start-up. When the
% optional short form is not provided, the acronym name plus an `s'
% is used.
%
% Plural exceptions are never reported in tables of acronyms.
%
%
% \subsection{Miscellaneous}
% \subsubsection{Sectioning and pdf marks}
% Acronyms are robust (since version 1.12) and can be used in
% sectional headers such as \cmd{\chapter}, \cmd{\section}, etc.,
% but please note the following:
% \begin{itemize}
% \item Do not use the general form (\cmd{\ac} or \cmd{\acp}) in
% sectional headers, because it will uses the full name the first time,
% that is in the table of contents, and the short form further on.
%
% \item The text of \meta{acronym} is used verbatim in bookmarks and
% not \meta{short name} for pdf\TeX\ with \texttt{hyperref}.
%
% \item When the long form of the acronym is used in sectional headers
% (for pdf\TeX\ with \texttt{hyperref}), it will end up in the pdf
% bookmarks. In that case it is good to hide unusual text such as
% math inside the \cmd{\texorpdfstring} defined by \texttt{hyperref},
% for example:
% \begin{quote}
% |\acro{Nx}[\ensuremath{N_{\chi}}]|\\
% | {\texorpdfstring{$\chi$}{X}-factor}|
% \end{quote}
% which will then give
% \begin{quote}\begin{tabbing}
% pdf bookmark:\quad\=|\acf{Nx}| $\rightarrow$ \textsf{X-factor (Nx)}\\
% text: \>|\acf{Nx}| $\rightarrow$ $\chi$-factor~($N_{\chi}$)
% \end{tabbing}\end{quote}
%
% \item For acronyms in sectional headers, the file must be \textsc{pdf}\LaTeX'ed
% 3 times before the bookmarks are correct.
%
%
% \item Acronyms in sectional headers together with the |footnote| option
% will not give reliable results, because it will end up in the running
% heads and table of contents. If you really need it, use the optional
% argument of the sectioning commands. For example:
% \begin{quote}
% |\chapter[The water \texorpdfstring{$\mathrm{H_2O}$}{H2O}) ...]|\\
% | {The \acf{H2O} ...}|
% \end{quote}
% \end{itemize}
%
% \clearpage
% \section{An example file}
%
% \begin{macrocode}
%<*acrotest>
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage{amsmath}
\usepackage[printonlyused,withpage]{acronym}
\begin{document}
\section{Intro}
In the early nineties, \acs{GSM} was deployed in many European
countries. \ac{GSM} offered for the first time international
roaming for mobile subscribers. The \acs{GSM}'s use of \ac{TDMA} as
its communication standard was debated at length. And every now
and then there are big discussion whether \ac{CDMA} should have
been chosen over \ac{TDMA}.
\section{Furthermore}
\acresetall
The reader could have forgotten all the nice acronyms, so we repeat the
meaning again.
If you want to know more about \acf{GSM}, \acf{TDMA}, \acf{CDMA}
and other acronyms, just read a book about mobile communication. Just
to mention it: There is another \ac{UA}, just for testing purposes!
\begin{figure}[h]
Figure
\caption{A float also admits references like \ac{GSM} or \acf{CDMA}.}
\end{figure}
\subsection{Some chemistry and physics}
\label{Chem}
\ac{NAD+} is a major electron acceptor in the oxidation
of fuel molecules. The reactive part of \ac{NAD+} is its nictinamide
ring, a pyridine derivate.
One mol consists of \acs{NA} atoms or molecules. There is a relation
between the constant of Boltzmann and the \acl{NA}:
\begin{equation}
k = R/\acs{NA}\label{my:eq}
\end{equation}
\acl{lox}/\acl{lh2} (\acsu{lox}/\acsu{lh2})
\Acp{LFVP} are processes in which the lepton number of the initial
and final states are different. An example for \iac{LFVP} is
neutrinoless double beta decay.
\subsection{Some testing \acp{IC} fundamentals}
When testing \acp{IC}, one typically wants to identify functional
blocks to be tested separately. The latter are commonly indicated as
\acp{BUT}. To test a \ac{BUT} requires defining a testing strategy\dots{}
\Iac{IC} popped up unexpectedly.
\section{Acronyms}
\begin{acronym}[TDMA]
\acro{CDMA}{Code Division Multiple Access}
\acro{GSM}{Global System for Mobile communication}
\acro{NA}[\ensuremath{N_{\mathrm A}}]
{Number of Avogadro\acroextra{ (see \S\ref{Chem})}}
\acro{NAD+}[NAD\textsuperscript{+}]{Nicotinamide Adenine Dinucleotide}
\acro{LFVP}{lepton flavor violating process}
\acroindefinite{LFVP}{an}{a}
\acro{NUA}{Not Used Acronym}
\acro{TDMA}{Time Division Multiple Access}
\acro{UA}{Used Acronym}
\acro{lox}[\ensuremath{LOX}]{Liquid Oxygen}%
\acro{lh2}[\ensuremath{LH_2}]{Liquid Hydrogen}%
\acro{IC}{Integrated Circuit}%
\acro{BUT}{Block Under Test}%
\acrodefplural{BUT}{Blocks Under Test}%
\acroindefinite{IC}{an}{an}
\end{acronym}
\end{document}
%</acrotest>
% \end{macrocode}
%
% \StopEventually{}
% \clearpage
%
% \newcommand{\fnacro}{\cmd{\fn@}\texttt{\textsl{<acronym>}}}
%
%
%
% \section{The implementation}
% \begin{macrocode}
%<*acronym>
% \end{macrocode}
%
%
% \subsection{Identification}
%
% First we test that we got the right format and name the package.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{acronym}[2025/01/17
v1.50
Support for acronyms (Tobias Oetiker)]
\RequirePackage{suffix,xstring}
% \end{macrocode}
%
%
%
% \subsection{Options}
%
% \begin{macro}{\ifAC@error}
% The option |error| lets this package throw compile errors instead of warnings in case of undefined acronyms.
% \begin{macrocode}
\newif\ifAC@error
\AC@errorfalse
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{error}{\AC@errortrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@footnote}
% The option |footnote| leads to a redefinition of \cmd{\acf},
% \cmd{\Acf}, \cmd{\acfp}, and \cmd{\Acfp}, making the full name appear
% as a footnote.
% \begin{macrocode}
\newif\ifAC@footnote
\AC@footnotefalse
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{footnote}{\AC@footnotetrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@nohyperlinks}
% If hyperref is loaded, all acronyms will link to their glossary entry and the glossary entries to the first in-text use.
% With the option |nohyperlinks| these links can be suppressed.
% \begin{macrocode}
\newif\ifAC@nohyperlinks
\AC@nohyperlinksfalse
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{nohyperlinks}{\AC@nohyperlinkstrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@noforwardlinks}
% If hyperref is loaded and the |nohyperlinks| option is not selected,
% the option |noforwardlinks| suppresses the links from the glossary entries to the in-text use.
% \begin{macrocode}
\newif\ifAC@noforwardlinks
\AC@noforwardlinksfalse
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{noforwardlinks}{\AC@noforwardlinkstrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@noacroprefix}
% With the |noacroprefix| option the acronym commands are not prefixed. This
% reproduces the old behavior of version <1.43, but can cause collisions
% between user-defined acronyms and commands of this package.
% \begin{macrocode}
\newif\ifAC@noacroprefix
\AC@noacroprefixfalse
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{noacroprefix}{\AC@noacroprefixtrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@printonlyused}
% We need a marker
% which is set if the option |printonlyused| was used.
% \begin{macrocode}
\newif\ifAC@printonlyused
\AC@printonlyusedfalse
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{printonlyused}{\AC@printonlyusedtrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@printonlyreused}
% With the |printonlyreused| option, only those acronyms are included in the
% list of acronyms that have been used more than once, i.e. at least twice.
% \begin{macrocode}
\newif\ifAC@printonlyreused
\AC@printonlyreusedfalse
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{printonlyreused}{\AC@printonlyreusedtrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@withpage}
% A marker which tells us to print page numbers.
% \begin{macrocode}
\newif\ifAC@withpage
\AC@withpagefalse
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{withpage}{\AC@withpagetrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@smaller}
% The option |smaller| leads to a redefinition of \cmd{\acsfont}.
% We want to make the acronym appear smaller. Since this should
% be done in a context-sensitive way, we rely on the macro
% \cmd{\textsmaller} provided by the |relsize| package.
% As \cmd{\RequirePackage} cannot be used inside
% \cmd{\DeclareOption}, we need a boolean variable.
% \begin{macrocode}
\newif\ifAC@smaller
\AC@smallerfalse
\DeclareOption{smaller}{\AC@smallertrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@dua}
% The option |dua| stands for ``don't use acronyms''.
% It leads to a redefinition of \cmd{\ac}, \cmd{\Ac}, \cmd{\acp},
% and \cmd{\Acp}, making the full name appear all the time
% and suppressing all acronyms but the explicity requested by
% \cmd{\acf}, \cmd{\Acf}, \cmd{\acfp} or \cmd{\Acfp}.
% \begin{macrocode}
\newif\ifAC@dua
\AC@duafalse
\DeclareOption{dua}{\AC@duatrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@nolist}
% The option |nolist| stands for ``don't write the list of acronyms''.
% \begin{macrocode}
\newif\ifAC@nolist
\AC@nolistfalse
\DeclareOption{nolist}{\AC@nolisttrue\AC@nohyperlinkstrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifAC@nolinebreak}
% The option |nolinebreak| dictates whether to forbid, by defalt, a line break
% between the full name and the short name, when they are presented together.
% \begin{macrocode}
\newif\ifAC@nolinebreak
\AC@nolinebreakfalse
\DeclareOption{nolinebreak}{\AC@nolinebreaktrue}
% \end{macrocode}
% \end{macro}
%
% Now we process the options.
% \begin{macrocode}
\ProcessOptions\relax
% \end{macrocode}
%
%
%
%
% \subsection{Setup macros}
%
% \begin{macro}{\acsfont}
% \begin{macro}{\acffont}
% \begin{macro}{\acfsfont}
% The appearance of the output of the commands \cmd{\acs} and
% \cmd{\acf} is partially controlled by \cmd{\acsfont},
% \cmd{\acffont}, and \cmd{\acfsfont}. By default, they do nothing
% except when the |smaller| option is loaded.
%
% The option |smaller| leads to a redefinition of \cmd{\acsfont}.
% We want to make the acronym appear smaller. Since this should
% be done in a context-sensitive way, we rely on the macro
% \cmd{\textsmaller} provided by the |relsize| package.
% \begin{macrocode}
\ifAC@smaller
\RequirePackage{relsize}
\newcommand*{\acsfont}[1]{\textsmaller{#1}}
\else
\newcommand*{\acsfont}[1]{#1}
\fi
\newcommand*{\acffont}[1]{#1}
\newcommand*{\acfsfont}[1]{#1}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\AC@linebreakpenalty}
% When the option |nolinebreak| is specified, the default penalty for a line break
% is being set to the maximum. Otherwise, the default penalty is one level below
% the maximum, meaning that most of the times, by default, the line will not get
% broken.
%
% \begin{macrocode}
\ifAC@nolinebreak
\def\AC@linebreakpenalty{4}
\else
\def\AC@linebreakpenalty{3}
\fi
% \end{macrocode}
% \end{macro}
%
% \subsection{Hyperlinks and PDF support}
%
% \begin{macro}{\AC@hyperlink}
% \begin{macro}{\AC@hyperref}
% \begin{macro}{\AC@hypertarget}
% \begin{macro}{\AC@phantomsection}
% Define dummy hyperlink commands
% \begin{macrocode}
\def\AC@hyperlink#1#2{#2}
\def\AC@hyperref[#1]#2{#2}
\def\AC@hypertarget#1#2{#2}
\def\AC@phantomsection{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\AC@raisedhypertarget}
% Make sure that hyperlink processing gets enabled before we process
% the document if hyperref has been loaded in the mean time.
% \begin{macrocode}
\ifAC@nohyperlinks
\else
\AtBeginDocument{%
\@ifpackageloaded{hyperref}
{\let\AC@hyperlink=\hyperlink
\ifAC@noforwardlinks\else\let\AC@hyperref=\hyperref\fi
\newcommand*\AC@raisedhypertarget[2]{%
\Hy@raisedlink{\hypertarget{#1}{}}#2}%
\let\AC@hypertarget=\AC@raisedhypertarget
\def\AC@phantomsection{%
\Hy@GlobalStepCount\Hy@linkcounter
\edef\@currentHref{section*.\the \Hy@linkcounter}%
\Hy@raisedlink{%
\hyper@anchorstart{\@currentHref}\hyper@anchorend
}%
}%
}{}}%
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\AC@pageref}
% Use |\pageref*| instead of |\pageref| when the |hyperref| package is used.
% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{hyperref}{%
\let\AC@pageref=\@pagerefstar%
}{%
\let\AC@pageref=\pageref%
}%
}
% \end{macrocode}
% \end{macro}
%
% \noindent
% The \texttt{hyperref} package defines \cmd{\pdfstringdefDisableCommands}
% and \cmd{\texorpdfstring} for text in bookmarks. If undefined, then provide them
% it at the beginning of the document.
%
% \begin{macrocode}
\AtBeginDocument{%
\providecommand\texorpdfstring[2]{#1}%
\providecommand\pdfstringdefDisableCommands[1]{}%
\pdfstringdefDisableCommands{%
\csname AC@starredfalse\endcsname
\csname AC@footnotefalse\endcsname
\let\AC@hyperlink\@secondoftwo
\let\acsfont\relax
\let\acffont\relax
\let\acfsfont\relax
\let\acused\relax
\let\null\relax
\def\AChy@call#1#2{%
\ifx*#1\@empty
\expandafter #2%
\else
#2{#1}%
\fi
}%
\def\acs#1{\AChy@call{#1}\AC@acs}%
\def\acl#1{\AChy@call{#1}\@acl}%
\def\Acl#1{\AChy@call{#1}\@Acl}%
\def\acf#1{\AChy@call{#1}\AChy@acf}%
\def\Acf#1{\AChy@call{#1}\AChy@Acf}%
\def\ac#1{\AChy@call{#1}\@ac}%
\def\Ac#1{\AChy@call{#1}\@Ac}%
\def\acsp#1{\AChy@call{#1}\@acsp}%
\def\aclp#1{\AChy@call{#1}\@aclp}%
\def\Aclp#1{\AChy@call{#1}\@Aclp}%
\def\acfp#1{\AChy@call{#1}\AChy@acfp}%
\def\Acfp#1{\AChy@call{#1}\AChy@Acfp}%
\def\acp#1{\AChy@call{#1}\@acp}%
\def\Acp#1{\AChy@call{#1}\@Acp}%
\def\acfi#1{\AChy@call{#1}\AChy@acf}%
\def\Acfi#1{\AChy@call{#1}\AChy@Acf}%
\def\acfip#1{\AChy@call{#1}\AChy@acfp}%
\def\Acfip#1{\AChy@call{#1}\AChy@Acfp}%
\let\acsu\acs