summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/acronym/acronym.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-10-30 00:35:42 +0000
committerKarl Berry <karl@freefriends.org>2012-10-30 00:35:42 +0000
commit63c2e4c2b9c2fddab2f4db4ef370348376142fc1 (patch)
treec05371c25b42883cd861f355265eab03ff8e813c /Master/texmf-dist/source/latex/acronym/acronym.dtx
parent0422d75fda19ce1749d4810e7309ea7dfe05488c (diff)
acronym (29oct12)
git-svn-id: svn://tug.org/texlive/trunk@28114 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/acronym/acronym.dtx')
-rw-r--r--Master/texmf-dist/source/latex/acronym/acronym.dtx136
1 files changed, 129 insertions, 7 deletions
diff --git a/Master/texmf-dist/source/latex/acronym/acronym.dtx b/Master/texmf-dist/source/latex/acronym/acronym.dtx
index 2e5f76c30e1..349edb46ce7 100644
--- a/Master/texmf-dist/source/latex/acronym/acronym.dtx
+++ b/Master/texmf-dist/source/latex/acronym/acronym.dtx
@@ -35,7 +35,7 @@
%</driver>
% \fi
%
-% \CheckSum{965}
+% \CheckSum{1066}
%
%% \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
@@ -83,6 +83,7 @@
% \DoNotIndex{\usepackage}
%
%
+% \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.}
@@ -246,14 +247,22 @@
%
% 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{\acs*}, \cmd{\acl*}, \cmd{\acf*}, \cmd{\acp*},
-% \cmd{\acsp*}, \cmd{\aclp*}, \cmd{\acfp*}, \cmd{\acfi*}, \cmd{\acsu*}
-% and \cmd{\aclu*}.
+% \cmd{\acsp*}, \cmd{\aclp*}, \cmd{\acfp*}, \cmd{\acfi*}, \cmd{\acsu*},
+% \cmd{\aclu*}, \cmd{\iac*} and \cmd{\Iac*}.
%
% \subsection{Customization}
%
@@ -382,6 +391,31 @@
% |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}
%
@@ -575,10 +609,10 @@ 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}[2012/09/04
- v1.37
+\ProvidesPackage{acronym}[2012/10/29
+ v1.38
Support for acronyms (Tobias Oetiker)]
-\RequirePackage{suffix}
+\RequirePackage{suffix,xstring}
% \end{macrocode}
%
%
@@ -985,6 +1019,7 @@ blocks to be tested separately. The latter are commonly indicated as
\newenvironment{acronym}[1][1]{%
\providecommand*{\acro}{\AC@acro}%
\providecommand*{\acroplural}{\AC@acroplural}%
+ \providecommand*{\acroindefinite}{\AC@acroindefinite}%
\long\def\acroextra##1{##1}%
\def\@tempa{1}\def\@tempb{#1}%
\ifx\@tempa\@tempb%
@@ -1057,6 +1092,42 @@ blocks to be tested separately. The latter are commonly indicated as
% \end{macro}
%
%
+% \subsubsection{Nonstandard indefinite articles}
+%
+% \begin{macro}{\newacroindefinite}
+% Sets up a non standard indefinite article for a given acronym.
+% \begin{macrocode}
+\newcommand*\newacroindefinite[3]{%
+ \expandafter\gdef\csname fn@#1@IS\endcsname{#2}%
+ \expandafter\gdef\csname fn@#1@IL\endcsname{#3}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\acrodefindefinite}
+% Same as above, storing content in aux file.
+% \begin{macrocode}
+\newcommand*\acrodefindefinite[3]{%
+ \@bsphack
+ \protected@write\@auxout{}{\string\newacroindefinite{#1}{#2}{#3}}%
+ \@esphack
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AC@acroindefinite}
+% Internal command to set up an indefinite article in the
+% acronym environment.
+% \begin{macrocode}
+\newcommand\AC@acroindefinite[3]{
+ \@bsphack
+ \protected@write\@auxout{}%
+ {\string\newacroindefinite{#1}{\string\AC@hyperlink{#1}{#2}}{#3}}%
+ \@esphack
+}
+% \end{macrocode}
+% \end{macro}
+%
% \subsubsection{Non standard or foreign plural forms}
%
% \begin{macro}{\newacroplural}
@@ -1223,7 +1294,7 @@ blocks to be tested separately. The latter are commonly indicated as
% \begin{macrocode}
\newcommand*{\@acs}[1]{%
\acsfont{\AC@acs{#1}}%
-%% having a footnote on acs sort of defetes the purpose
+%% having a footnote on acs sort of defeats the purpose
%% \ifAC@footnote
%% \footnote{\AC@acl{#1}{}}%
%% \fi
@@ -1401,6 +1472,57 @@ blocks to be tested separately. The latter are commonly indicated as
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@firstupper}
+% Internal commands for Indefinite article
+% \begin{macrocode}
+\newcommand{\@firstupper}[1]{%
+ \StrLeft{#1}{1}[\firstletter]%
+ \StrGobbleLeft{#1}{1}[\remainder]%
+ \MakeUppercase\firstletter\remainder
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\iac}
+% \begin{macro}{\@iac}
+% \begin{macro}{\@iaci}
+% \begin{macro}{\Iac}
+% \begin{macro}{\@Iac}
+% Indefinite article correct expansion
+% \begin{macrocode}
+\newcommand*{\iac}{\AC@starredfalse\protect\@iac}%
+\WithSuffix\newcommand\iac*{\AC@starredtrue\protect\@iac}%
+\newcommand*{\Iac}{\AC@starredfalse\protect\@Iac}%
+\WithSuffix\newcommand\Iac*{\AC@starredtrue\protect\@Iac}%
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\@iaci}[1]{%
+ \ifcsname fn@#1@IL\endcsname
+ \ifAC@dua
+ \csname fn@#1@IL\endcsname%
+ \else
+ \expandafter\ifx\csname ac@#1\endcsname\AC@used%
+ \csname fn@#1@IS\endcsname%
+ \else
+ \csname fn@#1@IL\endcsname%
+ \fi
+ \fi
+ \else
+ a%
+ \fi
+}
+\newcommand*{\@iac}[1]{%
+ \@iaci{#1} \ifAC@starred\ac*{#1}\else\ac{#1}\fi%
+}
+\newcommand*{\@Iac}[1]{%
+ \@firstupper{\@iaci{#1}} \ifAC@starred\ac*{#1}\else\ac{#1}\fi%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\acsp}
% \begin{macro}{\acspa}