blob: c57a9d683ddc06178e1d969cfc5a40f7ab54b05b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
%%
%% This is file `undolabl.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% undolabl.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% IMPORTANT NOTICE:
%% The usual disclaimers apply:
%% If it doesn't work right that's your problem.
%% (Nevertheless, send an e-mail to the maintainer
%% when you find an error in this package.)
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%% http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% The Current Maintainer of this work is H.-Martin Muench
%% (Martin dot Muench at Uni-Bonn dot de).
%%
%% The main code of this package was invented by Ulrich Diez
%% (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!
%%
%% This work consists of the main source file undolabl.dtx
%% and the derived files
%% undolabl.sty, undolabl.pdf, undolabl.ins, undolabl.drv,
%% undolabl-example.tex.
%%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{undolabl}[2010/07/15 v1.0d
Overriding labels (HMM)]
\newcommand\overridelabel[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}{%
\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@#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{%
\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\undolabl@testdef
\let\undonewlabel\@gobble
\fi
}%
\endinput
%%
%% End of file `undolabl.sty'.
|