summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/acronym
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-04-24 16:29:33 +0000
committerKarl Berry <karl@freefriends.org>2008-04-24 16:29:33 +0000
commitc81366738cc576e048c004dc39db36690f83d528 (patch)
treea5eaeafc62cfa30499a89b4f11ee93e820be69e7 /Master/texmf-dist/source/latex/acronym
parent0bf2ae49cc609e7d767bcb7afda169984fa6f9de (diff)
acronym 1.30 (23apr08)
git-svn-id: svn://tug.org/texlive/trunk@7632 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/acronym')
-rw-r--r--Master/texmf-dist/source/latex/acronym/acronym.dtx133
1 files changed, 105 insertions, 28 deletions
diff --git a/Master/texmf-dist/source/latex/acronym/acronym.dtx b/Master/texmf-dist/source/latex/acronym/acronym.dtx
index 212ee413f93..c1c711ae893 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{744}
+% \CheckSum{833}
%
%% \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,7 +83,10 @@
% \DoNotIndex{\usepackage}
%
%
-% \changes{v1.27}{2008/04/18}{Added withpage option to print page numbers into acronym list by tobi and Domagoj Babic, babic@cs.ubc.ca}
+% \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 Immo.Koester@rwth-aachen.de}
% \changes{v1.25}{2005/11/11}{Properly handle acronym commands in PDF Bookmarks by Heiko Oberdiek oberdiek@uni-freiburg.de}
% \changes{v1.24}{2005/10/25}{Now the acronyms commands and fixed a bug in the option nolist, by Jose Emilio Vila Forcen, jemilio@ieee.org}
@@ -367,7 +370,7 @@
%
% \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
@@ -403,6 +406,7 @@
% \begin{macrocode}
%<*acrotest>
\documentclass{article}
+\usepackage{hyperref}
\usepackage[printonlyused,withpage]{acronym}
\begin{document}
@@ -478,8 +482,8 @@ between the constant of Boltzmann and the \acl{NA}:
% First we test that we got the right format and name the package.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{acronym}[2008/04/18
- v1.27
+\ProvidesPackage{acronym}[2008/04/22
+ v1.30
Support for acronyms (Tobias Oetiker)]
\RequirePackage{suffix}
% \end{macrocode}
@@ -608,7 +612,6 @@ between the constant of Boltzmann and the \acl{NA}:
% \end{macro}
% \end{macro}
%
-%
% \subsection{Hyperlinks and PDF support}
%
% \begin{macro}{\AC@hyperlink}
@@ -617,6 +620,7 @@ between the constant of Boltzmann and the \acl{NA}:
% \begin{macrocode}
\def\AC@hyperlink#1#2{#2}
\def\AC@hypertarget#1#2{#2}
+\def\AC@phantomsection{}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -631,7 +635,15 @@ between the constant of Boltzmann and the \acl{NA}:
{\let\AC@hyperlink=\hyperlink
\newcommand*\AC@raisedhypertarget[2]{%
\Hy@raisedlink{\hypertarget{#1}{}}#2}%
- \let\AC@hypertarget=\AC@raisedhypertarget}{}}
+ \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}
@@ -711,7 +723,11 @@ between the constant of Boltzmann and the \acl{NA}:
% \end{macrocode}
% \begin{macrocode}
\def\AC@reset#1{%
- \global\expandafter\let\csname ac@#1\endcsname\relax}
+ \global\expandafter\let\csname ac@#1\endcsname\relax
+ \@ifundefined{s@acro:#1}{%
+ \global\@namedef{s@acro:#1}{}%
+ }{}%
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -928,10 +944,12 @@ between the constant of Boltzmann and the \acl{NA}:
\item[\protect\AC@hypertarget{#1}{\acsfont{#2}}] #3%
\ifAC@withpage%
\expandafter\ifx\csname r@acro:#1\endcsname\relax%
- \G@refundefinedtrue%
+ \PackageWarning{acronym}{%
+ Acronym #1 used in text but not spelled out in
+ full in text}%
\else%
\dotfill\pageref{acro:#1}%
- \fi%
+ \fi\\%
\fi%
\fi%
\else%
@@ -1041,6 +1059,79 @@ between the constant of Boltzmann and the \acl{NA}:
% \end{macro}
% \end{macro}
%
+% \subsection{Helper functions to unset labels}
+%
+% \begin{macro}{\@verridelabel} The internal \cmd{\@verridelabel}
+% command lets us 'redefine' an acronym label such that the page
+% reference in the acronym list points where it should be pointing and
+% not just to the very first occurrence of the acronym, where it may not
+% even be expanded. (code by Ulrich Diez)
+%
+% \begin{macrocode}
+\newcommand*\@verridelabel[1]{%
+ \@bsphack
+ \protected@write\@auxout{}{\string\undonewlabel{#1}}%
+ \@overriddenmessage s{#1}%
+ \label{#1}%
+ \@esphack
+}%
+\newcommand*\undonewlabel{\@und@newl@bel r}%
+\newcommand*\@und@newl@bel[2]{%
+ \@ifundefined{#1@#2}{%
+ \@latex@error{Label `#2' shall be overridden although it does
+ not yet^^Jexist}{A label which does not exist cannot be
+ overridden.}%
+ }{%
+ \global\expandafter\let\csname #1@#2\endcsname\relax
+ }%
+}%
+\newcommand*\@overriddenmessage[2]{%
+ \@ifundefined{#1@#2}{\global\@namedef{#1@#2}{i}}{%
+ \expandafter\g@addto@macro\csname #1@#2\endcsname{i}%
+ }%
+ \@latex@warning{Label `#2' overridden}%
+}%
+\newcommand*\my@testdef[3]{%
+ \@ifundefined{s@#2}\@secondoftwo\@firstofone
+ {%
+ \expandafter\ifx\csname s@#2\endcsname\empty
+ \expandafter\@firstofone
+ \else
+ \expandafter\xdef\csname s@#2\endcsname{%
+ \expandafter\expandafter
+ \expandafter\@gobble
+ \csname s@#2\endcsname
+ }%
+ \expandafter\@gobble
+ \fi
+ }%
+ {%
+ \@testdef{#1}{#2}{#3}%
+ }%
+}%
+\protected@write\@auxout{}{%
+ \string\reset@newl@bel
+}%
+\newcommand*\reset@newl@bel{%
+ \ifx\@newl@bel\@testdef
+ \let\@newl@bel\my@testdef
+ \let\undonewlabel\@gobble
+ \fi
+}%
+\newcommand*\AC@placelabel[1]{%
+ \expandafter\ifx\csname ac@#1\endcsname\AC@used
+ {\AC@phantomsection\@verridelabel{acro:#1}}%
+ \else
+ \global\expandafter\let\csname ac@#1\endcsname\AC@used
+ {\AC@phantomsection
+ \@ifundefined{s@acro:#1}{\label}{\@verridelabel}{acro:#1}}%
+ \AC@addtoclearlist{#1}%
+ \fi
+}%
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\acf}
% \begin{macro}{\acfa}
% \begin{macro}{\@acf}
@@ -1066,21 +1157,14 @@ between the constant of Boltzmann and the \acl{NA}:
\newcommand*{\@acf}[1]{%
\ifAC@footnote
\acsfont{\AC@acs{#1}}%
- \footnote{\AC@acl{#1}{}}%
+ \footnote{\AC@placelabel{#1}\AC@acl{#1}{}}%
\else
\acffont{%
- \AC@acl{#1}%
+ \AC@placelabel{#1}\AC@acl{#1}%
\nolinebreak[3] %
\acfsfont{(\acsfont{\AC@acs{#1}})}%
}%
\fi
- \expandafter\ifx\csname ac@#1\endcsname\AC@used
- \relax%
- \else
- \global\expandafter\let\csname ac@#1\endcsname\AC@used
- \label{acro:#1}%
- \AC@addtoclearlist{#1}%
- \fi
\ifAC@starred\else\AC@logged{#1}\fi}
% \end{macrocode}
% \end{macro}
@@ -1174,21 +1258,14 @@ between the constant of Boltzmann and the \acl{NA}:
\newcommand*{\@acfp}[1]{%
\ifAC@footnote
\acsfont{\AC@acs{#1}}s%
- \footnote{\AC@acl{#1}s{}}%
+ \footnote{\AC@placelabel{#1}\AC@acl{#1}s{}}%
\else
\acffont{%
- \AC@acl{#1}s%
+ \AC@placelabel{#1}\AC@acl{#1}s%
\nolinebreak[3] %
\acfsfont{(\acsfont{\AC@acs{#1}}s)}%
}%
\fi
- \expandafter\ifx\csname ac@#1\endcsname\AC@used
- \relax%
- \else
- \global\expandafter\let\csname ac@#1\endcsname\AC@used
- \label{acro:#1}%
- \AC@addtoclearlist{#1}%
- \fi
\ifAC@starred\else\AC@logged{#1}\fi}
% \end{macrocode}
% \end{macro}