diff options
Diffstat (limited to 'macros/latex/contrib/acronym/acronym.dtx')
-rw-r--r-- | macros/latex/contrib/acronym/acronym.dtx | 155 |
1 files changed, 118 insertions, 37 deletions
diff --git a/macros/latex/contrib/acronym/acronym.dtx b/macros/latex/contrib/acronym/acronym.dtx index f7d8e8eabd..b332333810 100644 --- a/macros/latex/contrib/acronym/acronym.dtx +++ b/macros/latex/contrib/acronym/acronym.dtx @@ -2,7 +2,7 @@ % % Doc-Source file to use with LaTeX2e % -% Copyright 1994-2020 by Tobias Oetiker (tobi@oetiker.ch) and many Contributors. +% Copyright 1994-2024 by Tobias Oetiker (tobi@oetiker.ch) and many Contributors. % All rights reserved. % % This work may be distributed and/or modified under the conditions of @@ -35,7 +35,7 @@ %</driver> % \fi % -% \CheckSum{1526} +% \CheckSum{1634} % %% \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 @@ -82,6 +82,8 @@ % \DoNotIndex{\textbf, \textsf, \textsmaller, \textsuperscript, \the} % \DoNotIndex{\usepackage} % +% \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.} @@ -265,7 +267,7 @@ % % \DescribeMacro{\acsp} % Works in the same way as \cmd{\acs}, but makes the short -% form into a plural. +% form into a plural. % % \DescribeMacro{\aclp} % Works in the same way as \cmd{\acl}, but makes the long form @@ -284,6 +286,14 @@ % 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 @@ -302,11 +312,11 @@ % 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 +% 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 +% Works in the same way as the \cmd{\ac} command but prefixes it with % an appropriate upper case indefinite article. % % \DescribeMacro{\...*} @@ -316,8 +326,9 @@ % 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{\acsu*}, -% \cmd{\aclu*}, \cmd{\Aclu*}, \cmd{\iac*} and \cmd{\Iac*}. +% \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} % @@ -451,7 +462,7 @@ % 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. @@ -459,8 +470,8 @@ % \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, +% 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} @@ -479,7 +490,7 @@ % 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 +% When using \cmd{\iac} and \cmd{\Iac} without first defining an % article, the default article is ``a''. % % \subsubsection{Non standard and foreign plural forms} @@ -538,7 +549,7 @@ % 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. % % @@ -682,8 +693,8 @@ blocks to be tested separately. The latter are commonly indicated as % First we test that we got the right format and name the package. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{acronym}[2020/04/17 - v1.47 +\ProvidesPackage{acronym}[2024/03/30 + v1.49 Support for acronyms (Tobias Oetiker)] \RequirePackage{suffix,xstring} % \end{macrocode} @@ -706,7 +717,7 @@ blocks to be tested separately. The latter are commonly indicated as % \end{macro} % % \begin{macro}{\ifAC@nohyperlinks} -% If hyperref is loaded, all acronyms will link to their glossary entry. +% 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 @@ -717,6 +728,18 @@ blocks to be tested separately. The latter are commonly indicated as % \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 @@ -852,7 +875,7 @@ blocks to be tested separately. The latter are commonly indicated as % 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} @@ -889,7 +912,7 @@ blocks to be tested separately. The latter are commonly indicated as \AtBeginDocument{% \@ifpackageloaded{hyperref} {\let\AC@hyperlink=\hyperlink - \let\AC@hyperref=\hyperref + \ifAC@noforwardlinks\else\let\AC@hyperref=\hyperref\fi \newcommand*\AC@raisedhypertarget[2]{% \Hy@raisedlink{\hypertarget{#1}{}}#2}% \let\AC@hypertarget=\AC@raisedhypertarget @@ -959,6 +982,8 @@ blocks to be tested separately. The latter are commonly indicated as \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 \let\aclu\acl \let\Aclu\Acl @@ -1078,13 +1103,20 @@ blocks to be tested separately. The latter are commonly indicated as % \end{macro} % \end{macro} % -% \begin{macro}{\@firstupper} +% \begin{macro}{\@firstupper,\@firstupper@maybe} % Internal commands for making a first letter upper case. % \begin{macrocode} \newcommand{\@firstupper}[1]{% \StrSplit{#1}{1}{\head}{\tail}% \MakeUppercase\head\tail% } +\newcommand{\@firstupper@maybe}{% + \ifAC@upper + \expandafter\@firstupper + \else + \expandafter\@firstofone + \fi +} % \end{macrocode} % \end{macro} % @@ -1153,7 +1185,7 @@ blocks to be tested separately. The latter are commonly indicated as % % % \begin{environment}{AC@deflist} -% In standard mode, the acronym - list is formatted with a description +% In standard mode, the acronym list is formatted with a description % environment. If an optional argument is passed to the acronym % environment, the list is formatted as a AC@deflist, which needs the % longest appearing acronym as parameter. If the option 'nolist' is selected @@ -1198,7 +1230,7 @@ blocks to be tested separately. The latter are commonly indicated as % % \begin{macro}{\acro} % Acronyms can be defined with the user command \cmd{\acro} -% in side the |acronym| environment. +% inside the |acronym| environment. % % \begin{macrocode} \newenvironment{acronym}[1][1]{% @@ -1390,7 +1422,7 @@ blocks to be tested separately. The latter are commonly indicated as \@bsphack \protected@write\@auxout{}{\string\newacroplural{#1}{#2}}% \@esphack -} +} % \end{macrocode} % \end{macro} % \end{macro} @@ -1419,11 +1451,11 @@ blocks to be tested separately. The latter are commonly indicated as {\string\newacroplural{#1}[\string\AC@hyperlink{#1}{\AC@acs{#1}}]{#2}}% \@esphack } -% \end{macrocode} +% \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% +% % % \begin{macro}{\AC@aclp} % \begin{macro}{\AC@Aclp} @@ -1433,7 +1465,7 @@ blocks to be tested separately. The latter are commonly indicated as % \begin{macrocode} \newcommand*\AC@aclp[1]{% \ifcsname fn@#1@PL\endcsname - \csname fn@#1@PL\endcsname + \@firstupper@maybe{\csname fn@#1@PL\endcsname}% \else \AC@acl{#1}s% \fi @@ -1492,11 +1524,7 @@ blocks to be tested separately. The latter are commonly indicated as \PackageWarning{acronym}{Acronym `#3' is not defined}% \textbf{#3!}% \else - \ifAC@upper - \@firstupper{\expandafter#2#1}% - \else - \expandafter#2#1% - \fi + \@firstupper@maybe{\expandafter#2#1}% \fi } % \end{macrocode} @@ -1542,7 +1570,7 @@ blocks to be tested separately. The latter are commonly indicated as % \end{macrocode} % \begin{macrocode} \newcommand*{\@acs}[1]{% - \acsfont{\AC@acs{#1}}% + \acsfont{\AC@placelabel@part{#1}\AC@acs{#1}}% %% having a footnote on acs sort of defeats the purpose %% \ifAC@footnote %% \footnote{\AC@acl{#1}{}}% @@ -1569,12 +1597,12 @@ blocks to be tested separately. The latter are commonly indicated as % \end{macrocode} % \begin{macrocode} \newcommand*{\@acl}[1]{% - \AC@acl{#1}% + \AC@placelabel@part{#1}\AC@acl{#1}% \ifAC@starred\else\AC@logged{#1}\fi} % \end{macrocode} % \begin{macrocode} \newcommand*{\@Acl}[1]{% - \AC@Acl{#1}% + \AC@placelabel@part{#1}\AC@Acl{#1}% \ifAC@starred\else\AC@logged{#1}\fi} % \end{macrocode} % \end{macro} @@ -1657,6 +1685,12 @@ blocks to be tested separately. The latter are commonly indicated as \let\AC@undonewlabel\@gobble \fi }% +\newcommand*\AC@placelabel@part[1]{% + \expandafter\ifx\csname AC@\AC@prefix#1\endcsname\AC@used + \else + {\AC@phantomsection\@verridelabel{acro:#1}}% + \fi +}% \newcommand*\AC@placelabel[1]{% \expandafter\ifx\csname AC@\AC@prefix#1\endcsname\AC@used \else @@ -1802,12 +1836,12 @@ blocks to be tested separately. The latter are commonly indicated as \newcommand*{\@iaci}[1]{% \ifcsname fn@#1@IL\endcsname \ifAC@dua - \csname fn@#1@IL\endcsname% + \@firstupper@maybe{\csname fn@#1@IL\endcsname}% \else \expandafter\ifx\csname AC@\AC@prefix#1\endcsname\AC@used% \csname fn@#1@IS\endcsname% \else - \csname fn@#1@IL\endcsname% + \@firstupper@maybe{\csname fn@#1@IL\endcsname}% \fi \fi \else @@ -1846,7 +1880,7 @@ blocks to be tested separately. The latter are commonly indicated as % \end{macrocode} % \begin{macrocode} \newcommand*{\@acsp}[1]{% - \acsfont{\AC@acsp{#1}}% + \acsfont{\AC@placelabel@part{#1}\AC@acsp{#1}}% \ifAC@starred\else\AC@logged{#1}\fi} % \end{macrocode} % \end{macro} @@ -1869,12 +1903,12 @@ blocks to be tested separately. The latter are commonly indicated as % \end{macrocode} % \begin{macrocode} \newcommand*{\@aclp}[1]{% - \AC@aclp{#1}% + \AC@placelabel@part{#1}\AC@aclp{#1}% \ifAC@starred\else\AC@logged{#1}\fi} % \end{macrocode} % \begin{macrocode} \newcommand*{\@Aclp}[1]{% - \AC@Aclp{#1}% + \AC@placelabel@part{#1}\AC@Aclp{#1}% \ifAC@starred\else\AC@logged{#1}\fi} % \end{macrocode} % \end{macro} @@ -2038,6 +2072,53 @@ blocks to be tested separately. The latter are commonly indicated as % \end{macro} % \end{macro} % +% +% \begin{macro}{\acfip} +% \begin{macro}{\acfipa} +% \begin{macro}{\Acfip} +% \begin{macro}{\Acfipa} +% The plural of the full name is printed in italics and the plural of +% the acronym is printed in upshape. +% The optional variable determines the penalty for a line break. +% \begin{macrocode} +\newcommand*{\acfip}{\AC@starredfalse\protect\acfipa}% +\WithSuffix\newcommand\acfip*{\AC@starredtrue\protect\acfipa}% +% \end{macrocode} +% \begin{macrocode} +\newcommand*{\Acfip}{\AC@starredfalse\protect\Acfipa}% +\WithSuffix\newcommand\Acfip*{\AC@starredtrue\protect\Acfipa}% +% \end{macrocode} +% \begin{macrocode} +\newcommand{\acfipa}[2][\AC@linebreakpenalty]{% + \texorpdfstring{\protect\@acfip[#1]{#2}}{{\AC@aclp{#2}} (#2)}} +% \end{macrocode} +% \begin{macrocode} +\newcommand{\Acfipa}[2][\AC@linebreakpenalty]{% + \texorpdfstring{\protect\@Acfip[#1]{#2}}{{\AC@Aclp{#2}} (#2)}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*{\@acfip}[2][\AC@linebreakpenalty]{% + \acffont{% + \AC@placelabel{#2}{\itshape\AC@aclp{#2}}% + \nolinebreak[#1] % + \acfsfont{(\acsfont{\AC@acsp{#2}})}% + }% + \ifAC@starred\else\AC@logged{#2}\fi} +% \end{macrocode} +% \begin{macrocode} +\newcommand*{\@Acfip}[2][\AC@linebreakpenalty]{% + \acffont{% + \AC@placelabel{#2}{\itshape\AC@Aclp{#2}}% + \nolinebreak[#1] % + \acfsfont{(\acsfont{\AC@acsp{#2}})}% + }% + \ifAC@starred\else\AC@logged{#2}\fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\acused} % Marks the acronym as used. Don't confuse this with % \cmd{\acronymused}! |