diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-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 |