summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/acronym
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-03-05 22:08:19 +0000
committerKarl Berry <karl@freefriends.org>2020-03-05 22:08:19 +0000
commitd379da24c3c8619aae41ef32e82cd06a72154d86 (patch)
treef666b8232edb45f0246a7a73eea8aee0e9342763 /Master/texmf-dist/source/latex/acronym
parent938d0017220d59681ce920e3593cb9cdef66341e (diff)
acronym (5mar20)
git-svn-id: svn://tug.org/texlive/trunk@54112 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/acronym')
-rw-r--r--Master/texmf-dist/source/latex/acronym/acronym.dtx177
-rw-r--r--Master/texmf-dist/source/latex/acronym/acronym.ins4
2 files changed, 141 insertions, 40 deletions
diff --git a/Master/texmf-dist/source/latex/acronym/acronym.dtx b/Master/texmf-dist/source/latex/acronym/acronym.dtx
index 62df769abb4..c64031f7cc4 100644
--- a/Master/texmf-dist/source/latex/acronym/acronym.dtx
+++ b/Master/texmf-dist/source/latex/acronym/acronym.dtx
@@ -2,7 +2,7 @@
%
% Doc-Source file to use with LaTeX2e
%
-% Copyright 1994-2019 by Tobias Oetiker (tobi@oetiker.ch) and many Contributors.
+% Copyright 1994-2020 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{1389}
+% \CheckSum{1518}
%
%% \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
@@ -66,7 +66,7 @@
% \ensuremath, \expandafter}
% \DoNotIndex{\fi, \footnote}
% \DoNotIndex{\gdef, \global}
-% \DoNotIndex{\hfill, \hyperlink, \hypertarget}
+% \DoNotIndex{\hfill, \hyperlink, \hyperref, \hypertarget}
% \DoNotIndex{\if@filesw, \ifx, \item}
% \DoNotIndex{\label, \labelsep, \labelwidth, \leftmargin, \let,
% \long}
@@ -82,7 +82,8 @@
% \DoNotIndex{\textbf, \textsf, \textsmaller, \textsuperscript, \the}
% \DoNotIndex{\usepackage}
%
-%
+% \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}
@@ -423,11 +424,12 @@
% 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}:
+% 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{printonlyused}-mode you can add to each acronym the
+% 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}
@@ -675,8 +677,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}[2019/11/11
- v1.42
+\ProvidesPackage{acronym}[2020/02/07
+ v1.44
Support for acronyms (Tobias Oetiker)]
\RequirePackage{suffix,xstring}
% \end{macrocode}
@@ -710,6 +712,18 @@ blocks to be tested separately. The latter are commonly indicated as
% \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
@@ -723,6 +737,18 @@ blocks to be tested separately. The latter are commonly indicated as
% \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}
@@ -834,15 +860,21 @@ blocks to be tested separately. The latter are commonly indicated as
% \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.
@@ -852,6 +884,7 @@ blocks to be tested separately. The latter are commonly indicated as
\AtBeginDocument{%
\@ifpackageloaded{hyperref}
{\let\AC@hyperlink=\hyperlink
+ \let\AC@hyperref=\hyperref
\newcommand*\AC@raisedhypertarget[2]{%
\Hy@raisedlink{\hypertarget{#1}{}}#2}%
\let\AC@hypertarget=\AC@raisedhypertarget
@@ -867,6 +900,19 @@ blocks to be tested separately. The latter are commonly indicated as
% \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
@@ -952,7 +998,7 @@ blocks to be tested separately. The latter are commonly indicated as
% \end{macrocode}
% \begin{macrocode}
\def\AC@reset#1{%
- \global\expandafter\let\csname AC@#1\endcsname\relax
+ \global\expandafter\let\csname AC@\AC@prefix#1\endcsname\relax
}
% \end{macrocode}
% \end{macro}
@@ -967,7 +1013,7 @@ blocks to be tested separately. The latter are commonly indicated as
%
% \begin{macro}{\AC@populated}
% An on/off flag to note if any acronyms were logged. This
-% is needed for the first run with |printonlyused| option,
+% is needed for the first run with |printonly(re)used| option,
% because the acronym list are then empty, resulting in a
% |"missing item"| error.
%
@@ -1008,12 +1054,22 @@ blocks to be tested separately. The latter are commonly indicated as
% (called by the \texttt{aux} file).
% \begin{macrocode}
\newcommand*{\acronymused}[1]{%
- \expandafter\ifx\csname acused@#1\endcsname\AC@used
- \relax
- \else
- \global\expandafter\let\csname acused@#1\endcsname\AC@used
- \global\let\AC@populated\AC@used
- \fi}
+ \expandafter\ifx\csname acused@#1@once\endcsname\AC@used%
+ \expandafter\ifx\csname acused@#1@twice\endcsname\AC@used%
+ \relax%
+ \else%
+ \global\expandafter\let\csname acused@#1@twice\endcsname\AC@used%
+ \global\let\AC@populated\AC@used%
+ \fi%
+ \else%
+ \global\expandafter\let\csname acused@#1@once\endcsname\AC@used%
+ \ifAC@printonlyreused%
+ \relax%
+ \else%
+ \global\let\AC@populated\AC@used%
+ \fi%
+ \fi%
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1029,6 +1085,18 @@ blocks to be tested separately. The latter are commonly indicated as
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{AC@prefix}
+% Returns the prefix used to build the defined acronym commands as long as
+% the |noacroprefix| option is disabled. Otherwise the output is empty, so
+% the old behaviour from version <1.43 is reproduced.
+% \begin{macrocode}
+\ifAC@noacroprefix
+ \newcommand*\AC@prefix{}
+\else
+ \newcommand*\AC@prefix{acronyms@}
+\fi
+% \end{macrocode}
+% \end{macro}
%
% \subsection{Defining acronyms}
%
@@ -1170,35 +1238,68 @@ blocks to be tested separately. The latter are commonly indicated as
% \begin{macro}{\AC@@acro}
% \begin{macrocode}
\newcommand*\AC@acro[1]{%
- \@ifnextchar[{\AC@@acro{#1}}{\AC@@acro{#1}[#1]}}
+ \@ifnextchar[{%
+ \csname AC@\AC@prefix{}@acro\endcsname{#1}%
+ }{%
+ \csname AC@\AC@prefix{}@acro\endcsname{#1}[#1]%
+ }%
+}
% \end{macrocode}
% \begin{macrocode}
-\newcommand\AC@@acro{}
-\def\AC@@acro#1[#2]#3{%
+\expandafter\newcommand\csname AC@\AC@prefix{}@acro\endcsname{}
+\expandafter\def\csname AC@\AC@prefix{}@acro\endcsname#1[#2]#3{%
\ifAC@nolist%
\else%
- \ifAC@printonlyused%
- \expandafter\ifx\csname acused@#1\endcsname\AC@used%
- \item[\protect\AC@hypertarget{#1}{\aclabelfont{#2}}] #3%
+ \ifnum%
+ \ifAC@printonlyused 1%
+ \else\ifAC@printonlyreused 1%
+ \else 0\fi\fi%
+ =1%
+ \ifnum%
+ \ifAC@printonlyused%
+ \expandafter\ifx\csname acused@#1@once\endcsname\AC@used 1 \else 0 \fi%
+ \else\ifAC@printonlyreused%
+ \expandafter\ifx\csname acused@#1@twice\endcsname\AC@used 1 \else 0 \fi%
+ \else 0 \fi\fi%
+ =1%
+ \item[\protect\AC@hypertarget{#1}{%
+ \AC@hyperref[acro:#1]{\aclabelfont{#2}\hfill}%
+ }]\AC@hyperref[acro:#1]{#3}%
\ifAC@withpage%
\expandafter\ifx\csname r@acro:#1\endcsname\relax%
\PackageInfo{acronym}{%
Acronym #1 used in text but not spelled out in
full in text}%
\else%
- \dotfill\pageref{acro:#1}%
+ \nobreak\leaders\hbox{$\m@th\mkern\@dotsep mu\hbox{.}\mkern\@dotsep mu$}\hfill%
+ \nobreak\hb@xt@\@pnumwidth{%
+ \hfil\normalfont\normalcolor\AC@pageref{acro:#1}%
+ }%
\fi%
\fi\\%
\fi%
- \else%
- \item[\protect\AC@hypertarget{#1}{\aclabelfont{#2}}] #3%
- \fi%
- \fi%
- \begingroup
+ \else%
+ \item[\protect\AC@hypertarget{#1}{\AC@hyperref[acro:#1]{\aclabelfont{#2}\hfill}}]\AC@hyperref[acro:#1]{#3}%
+ \fi%
+ \fi%
+ \begingroup
\def\acroextra##1{}%
\@bsphack
- \protected@write\@auxout{}%
- {\string\newacro{#1}[\string\AC@hyperlink{#1}{#2}]{#3}}%
+ \ifAC@printonlyreused%
+ \protected@write\@auxout{}{%
+ \string\newacro{#1}[%
+ \expandafter\ifx\csname acused@#1@twice\endcsname\AC@used%
+ \string\AC@hyperlink{#1}{#2}%
+ \else%
+ {#2}%
+ \fi%
+ ]{#3}%
+ }%
+ \else%
+ \protected@write\@auxout{}{%
+ \string\newacro{#1}[\string\AC@hyperlink{#1}{#2}]{#3}%
+ }%
+ \fi%
\@esphack
\endgroup
\ignorespaces}
@@ -1535,11 +1636,11 @@ blocks to be tested separately. The latter are commonly indicated as
\fi
}%
\newcommand*\AC@placelabel[1]{%
- \expandafter\ifx\csname AC@#1\endcsname\AC@used
+ \expandafter\ifx\csname AC@\AC@prefix#1\endcsname\AC@used
\else
{\AC@phantomsection\@verridelabel{acro:#1}}%
\ifAC@starred\else%
- \global\expandafter\let\csname AC@#1\endcsname\AC@used
+ \global\expandafter\let\csname AC@\AC@prefix#1\endcsname\AC@used
\fi%
\AC@addtoAC@clearlist{#1}%
\fi
@@ -1638,7 +1739,7 @@ blocks to be tested separately. The latter are commonly indicated as
\ifAC@dua
\ifAC@starred\acl*{#2}\else\acl{#2}\fi%
\else
- \expandafter\ifx\csname AC@#2\endcsname\AC@used%
+ \expandafter\ifx\csname AC@\AC@prefix#2\endcsname\AC@used%
\ifAC@starred\acs*{#2}\else\acs{#2}\fi%
\else
\ifAC@starred\acf*[#1]{#2}\else\acf[#1]{#2}\fi%
@@ -1650,7 +1751,7 @@ blocks to be tested separately. The latter are commonly indicated as
\ifAC@dua
\ifAC@starred\Acl*{#2}\else\Acl{#2}\fi%
\else
- \expandafter\ifx\csname AC@#2\endcsname\AC@used%
+ \expandafter\ifx\csname AC@\AC@prefix#2\endcsname\AC@used%
\ifAC@starred\acs*{#2}\else\acs{#2}\fi%
\else
\ifAC@starred\Acf*[#1]{#2}\else\Acf[#1]{#2}\fi%
@@ -1681,7 +1782,7 @@ blocks to be tested separately. The latter are commonly indicated as
\ifAC@dua
\csname fn@#1@IL\endcsname%
\else
- \expandafter\ifx\csname AC@#1\endcsname\AC@used%
+ \expandafter\ifx\csname AC@\AC@prefix#1\endcsname\AC@used%
\csname fn@#1@IS\endcsname%
\else
\csname fn@#1@IL\endcsname%
@@ -1844,7 +1945,7 @@ blocks to be tested separately. The latter are commonly indicated as
\ifAC@dua
\ifAC@starred\aclp*{#2}\else\aclp{#2}\fi%
\else
- \expandafter\ifx\csname AC@#2\endcsname\AC@used
+ \expandafter\ifx\csname AC@\AC@prefix#2\endcsname\AC@used
\ifAC@starred\acsp*{#2}\else\acsp{#2}\fi%
\else
\ifAC@starred\acfp*[#1]{#2}\else\acfp[#1]{#2}\fi%
@@ -1856,7 +1957,7 @@ blocks to be tested separately. The latter are commonly indicated as
\ifAC@dua
\ifAC@starred\Aclp*{#2}\else\Aclp{#2}\fi%
\else
- \expandafter\ifx\csname AC@#2\endcsname\AC@used
+ \expandafter\ifx\csname AC@\AC@prefix#2\endcsname\AC@used
\ifAC@starred\acsp*{#2}\else\acsp{#2}\fi%
\else
\ifAC@starred\Acfp*[#1]{#2}\else\Acfp[#1]{#2}\fi%
@@ -1919,7 +2020,7 @@ blocks to be tested separately. The latter are commonly indicated as
% \cmd{\acronymused}!
% \begin{macrocode}
\newcommand{\acused}[1]{%
-\global\expandafter\let\csname AC@#1\endcsname\AC@used%
+\global\expandafter\let\csname AC@\AC@prefix#1\endcsname\AC@used%
\AC@addtoAC@clearlist{#1}}
% \end{macrocode}
% \end{macro}
diff --git a/Master/texmf-dist/source/latex/acronym/acronym.ins b/Master/texmf-dist/source/latex/acronym/acronym.ins
index 0af1e114c07..9dc36c5ac1c 100644
--- a/Master/texmf-dist/source/latex/acronym/acronym.ins
+++ b/Master/texmf-dist/source/latex/acronym/acronym.ins
@@ -4,7 +4,7 @@
%% driver files from the doc files in this package when run through
%% LaTeX or TeX.
%%
-%% Copyright 1995--2010 by Tobias Oetiker (tobi@oetiker.ch)
+%% Copyright 1995--2020 by Tobias Oetiker (tobi@oetiker.ch)
%% and individual authors listed elsewhere
%% in this file.
%% All rights reserved.
@@ -31,7 +31,7 @@
\keepsilent
\preamble
- Copyright 1995--2009 by Tobias Oetiker (tobi@oetiker.ch)
+ Copyright 1995--2020 by Tobias Oetiker (tobi@oetiker.ch)
and individual authors listed elsewhere.
All rights reserved.