summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/acronym/acronym.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-04-12 03:02:38 +0000
committerNorbert Preining <norbert@preining.info>2020-04-12 03:02:38 +0000
commitffcfe2bb60911db71a31e4c12541eae3e9df29f3 (patch)
treee92cb82e6e05dbc4c9689fecd9d736a2a8e2b0bb /macros/latex/contrib/acronym/acronym.dtx
parentc2697fc286a1e2c94fd9968b76be6f4a6d2114cd (diff)
CTAN sync 202004120302
Diffstat (limited to 'macros/latex/contrib/acronym/acronym.dtx')
-rw-r--r--macros/latex/contrib/acronym/acronym.dtx73
1 files changed, 47 insertions, 26 deletions
diff --git a/macros/latex/contrib/acronym/acronym.dtx b/macros/latex/contrib/acronym/acronym.dtx
index 31211759a8..f7d8e8eabd 100644
--- a/macros/latex/contrib/acronym/acronym.dtx
+++ b/macros/latex/contrib/acronym/acronym.dtx
@@ -35,7 +35,7 @@
%</driver>
% \fi
%
-% \CheckSum{1522}
+% \CheckSum{1526}
%
%% \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,7 @@
% \DoNotIndex{\textbf, \textsf, \textsmaller, \textsuperscript, \the}
% \DoNotIndex{\usepackage}
%
+% \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}
@@ -636,7 +637,8 @@ neutrinoless double beta decay.
\subsection{Some testing 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
+\acp{BUT}. To test a \ac{BUT} requires defining a testing strategy\dots{}
+\Iac{IC} popped up unexpectedly.
\section{Acronyms}
\begin{acronym}[TDMA]
@@ -655,6 +657,7 @@ blocks to be tested separately. The latter are commonly indicated as
\acro{IC}{Integrated Circuit}%
\acro{BUT}{Block Under Test}%
\acrodefplural{BUT}{Blocks Under Test}%
+ \acroindefinite{IC}{an}{an}
\end{acronym}
\end{document}
@@ -679,8 +682,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/03/13
- v1.46
+\ProvidesPackage{acronym}[2020/04/17
+ v1.47
Support for acronyms (Tobias Oetiker)]
\RequirePackage{suffix,xstring}
% \end{macrocode}
@@ -1039,7 +1042,6 @@ blocks to be tested separately. The latter are commonly indicated as
% acronyms is in the front matter of the document.
% \begin{macrocode}
\newcommand*{\AC@logged}[1]{%
- \acronymused{#1}% mark it as used in the current run too
\@bsphack
\protected@write\@auxout{}{\string\acronymused{#1}}%
\@esphack}
@@ -1080,9 +1082,8 @@ blocks to be tested separately. The latter are commonly indicated as
% Internal commands for making a first letter upper case.
% \begin{macrocode}
\newcommand{\@firstupper}[1]{%
- \StrLeft{#1}{1}[\firstletter]%
- \StrGobbleLeft{#1}{1}[\remainder]%
- \MakeUppercase\firstletter\remainder%
+ \StrSplit{#1}{1}{\head}{\tail}%
+ \MakeUppercase\head\tail%
}
% \end{macrocode}
% \end{macro}
@@ -1340,7 +1341,7 @@ blocks to be tested separately. The latter are commonly indicated as
\newcommand\AC@acroindefinite[3]{
\@bsphack
\protected@write\@auxout{}%
- {\string\newacroindefinite{#1}{\string\AC@hyperlink{#1}{#2}}{#3}}%
+ {\string\newacroindefinite{#1}{#2}{#3}}%
\@esphack
}
% \end{macrocode}
@@ -1438,7 +1439,9 @@ blocks to be tested separately. The latter are commonly indicated as
\fi
}
\newcommand*\AC@Aclp[1]{%
- \@firstupper\expandafter{\AC@aclp{#1}}%
+ \AC@uppertrue%
+ \AC@aclp{#1}%
+ \AC@upperfalse%
}
\newcommand*\AC@acsp[1]{%
\ifcsname fn@#1@PS\endcsname
@@ -1465,6 +1468,16 @@ blocks to be tested separately. The latter are commonly indicated as
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\ifAC@upper}
+% If an acronym needs to be capitalized, this flag is used to indicate
+% this at an appropriate point in the code. In that case, the firstupper
+% command will be called at a time when the acronym is expandable, otherwise
+% the xstring command will not work properly.
+% \begin{macrocode}
+\newif\ifAC@upper
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\AC@get}
% If the acronym is undefined, the internal macro \cmd{\AC@get}
% warns the user by printing the name in bold with an exclamation
@@ -1475,12 +1488,17 @@ blocks to be tested separately. The latter are commonly indicated as
% saved in \fnacro.
% \begin{macrocode}
\newcommand*\AC@get[3]{%
- \ifx#1\relax
- \PackageWarning{acronym}{Acronym `#3' is not defined}%
- \textbf{#3!}%
+ \ifx#1\relax
+ \PackageWarning{acronym}{Acronym `#3' is not defined}%
+ \textbf{#3!}%
+ \else
+ \ifAC@upper
+ \@firstupper{\expandafter#2#1}%
\else
- \expandafter#2#1%
- \fi}
+ \expandafter#2#1%
+ \fi
+ \fi
+}
% \end{macrocode}
% \end{macro}
%
@@ -1500,7 +1518,9 @@ blocks to be tested separately. The latter are commonly indicated as
% \end{macrocode}
% \begin{macrocode}
\newcommand*\AC@Acl[1]{%
- \@firstupper\expandafter{\AC@acl{#1}}%
+ \AC@uppertrue%
+ \AC@acl{#1}%
+ \AC@upperfalse%
}
% \end{macrocode}
% \end{macro}
@@ -1780,25 +1800,26 @@ blocks to be tested separately. The latter are commonly indicated as
% \end{macrocode}
% \begin{macrocode}
\newcommand*{\@iaci}[1]{%
- \ifcsname fn@#1@IL\endcsname
- \ifAC@dua
- \csname fn@#1@IL\endcsname%
- \else
- \expandafter\ifx\csname AC@\AC@prefix#1\endcsname\AC@used%
+ \ifcsname fn@#1@IL\endcsname
+ \ifAC@dua
+ \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%
\fi
- \fi
- \else
- a%
- \fi
+ \fi
+ \else
+ a%
+ \fi
}
\newcommand*{\@iac}[2][\AC@linebreakpenalty]{%
\@iaci{#2} \ifAC@starred\ac*[#1]{#2}\else\ac[#1]{#2}\fi%
}
\newcommand*{\@Iac}[2][\AC@linebreakpenalty]{%
- \@firstupper{\@iaci{#2}} \ifAC@starred\ac*[#1]{#2}\else\ac[#1]{#2}\fi%
+ \@firstupper{\@iaci{#2}}\space%
+ \ifAC@starred\ac*[#1]{#2}\else\ac[#1]{#2}\fi%
}
% \end{macrocode}
% \end{macro}