diff options
author | Karl Berry <karl@freefriends.org> | 2010-07-16 23:46:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-07-16 23:46:07 +0000 |
commit | 1e26864ecd918b1155caeb2bc233523134235afd (patch) | |
tree | df13736c2fb58d67a257e6feff4adbf1406ad538 /Master/texmf-dist/tex/latex/undolabl/undolabl.sty | |
parent | b4f103cbfc783d328fbc6e0d01b330c11269200b (diff) |
undolabl 1.0d (15jul10)
git-svn-id: svn://tug.org/texlive/trunk@19486 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/undolabl/undolabl.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/undolabl/undolabl.sty | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/undolabl/undolabl.sty b/Master/texmf-dist/tex/latex/undolabl/undolabl.sty index c1c9993cfc9..c57a9d683dd 100644 --- a/Master/texmf-dist/tex/latex/undolabl/undolabl.sty +++ b/Master/texmf-dist/tex/latex/undolabl/undolabl.sty @@ -30,8 +30,11 @@ %% (Martin dot Muench at Uni-Bonn dot de). %% %% The main code of this package was invented by Ulrich Diez -%% (eu_angelion@web.de) in 2008 and published on the internet. -%% While Ulrich Diez neither wanted to create a package himself +%% (eu_angelion@web.de) and first published in the comp.text.tex +%% newsgroup at Sun, 20 Apr 2008 16:39:26 +0200, with subject: +%% Re: How to undefine/overwrite a label? (see e.g. +%% http://groups.google.de/group/comp.text.tex/msg/5ba8d4722e5cd326). +%% While Ulrich Diez neither wanted to create a package himself yet %% nor have one published under his name, he granted the %% publication of his code. Therefore: Thanks! %% @@ -43,29 +46,37 @@ \NeedsTeXFormat{LaTeX2e}[1994/06/01] -\ProvidesPackage{undolabl}[2010/06/24 v1.0c +\ProvidesPackage{undolabl}[2010/07/15 v1.0d Overriding labels (HMM)] \newcommand\overridelabel[1]{% \@bsphack - \protected@write\@auxout{}{\string\undonewlabel{#1}{\on@line}}% + \protected@write\@auxout{}{\string\undonewlabel{#1}}% + \@overriddenmessage s{#1}% \label{#1}% \@esphack - }% + } -\newcommand\undonewlabel{\@und@newl@bel rs}% +\newcommand\undonewlabel{\@und@newl@bel r}% -\newcommand\@und@newl@bel[4]{% - \@ifundefined{#1@#3}\relax{% - \@latex@warning@no@line{Label `#3' overridden#4}% +\newcommand\@und@newl@bel[2]{% + \@ifundefined{#1@#2}{% + \PackageError{undolabl}{Label `#2' shall be overridden ^^J + although it does not yet exist}{% + A label which does not exist cannot be overridden.}% + }{% \expandafter\global \expandafter\let - \csname #1@#3\endcsname\relax - \@ifundefined{#2@#3}{\global\@namedef{#2@#3}{i}}{% - \expandafter\g@addto@macro\csname #2@#3\endcsname{i}% - }% + \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}% + }% + \PackageWarning{undolabl}{Label `#2' overridden} + } \newcommand\undolabl@testdef[3]{% \@ifundefined{s@#2}\@secondoftwo\@firstofone{% @@ -90,7 +101,7 @@ \newcommand\reset@newl@bel{% \ifx\@newl@bel\@testdef \let\@newl@bel\undolabl@testdef - \let\undonewlabel\@gobbletwo + \let\undonewlabel\@gobble \fi }% \endinput |