blob: 82af80f3f74f8acf7d25e137536ca51d18b4a2d7 (
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
|
\catcode`\@=11
\def\newcounter#1{\define#1{}%
\edef\next@{\def\noexpand#1{\futurelet\noexpand\next
\csname\exstring@#1@Z\endcsname}}\next@
\edef\next@{\def\csname\exstring@#1@Z\endcsname
{\global\advance\csname\exstring@#1@C\endcsname\@ne
{\csname\exstring@#1@F\endcsname\csname\exstring@#1@S\endcsname
{\csname\exstring@#1@P\endcsname\csname\exstring@#1@N\endcsname
{\noexpand\number\csname\exstring@#1@C\endcsname}%
\csname\exstring@#1@Q\endcsname}}%
\noexpand\ifx\noexpand\next\noexpand\label
\def\noexpand\next@\noexpand\label########1{{\noexpand\noexpands@
\xdef\noexpand\Thelabel@{\csname\exstring@#1@N\endcsname
{\noexpand\number\csname\exstring@#1@C\endcsname}}%
\xdef\noexpand\Thelabel@@@{\noexpand\number
\csname\exstring@#1@C\endcsname}%
\xdef\noexpand\Thelabel@@{\csname\exstring@#1@S\endcsname
{\csname\exstring@#1@P\endcsname
\csname\exstring@#1@N\endcsname
{\noexpand\number\csname\exstring@#1@C\endcsname}%
\csname\exstring@#1@Q\endcsname}}%
\xdef\noexpand\Thelabel@@@@{\csname\exstring@#1@P\endcsname
\csname\exstring@#1@N\endcsname
{\noexpand\number\csname\exstring@#1@C\endcsname}%
\csname\exstring@#1@Q\endcsname}}%
{\noexpand\locallabel@\noexpand\label{########1}}}%
\noexpand\else\let\noexpand\next@\relax\noexpand\fi\noexpand\next@}}\next@
\expandafter\newcount@\csname\exstring@#1@C\endcsname
\expandafter\let\csname\exstring@#1@N\endcsname\arabic
\expandafter\def\csname\exstring@#1@S\endcsname##1{##1\/}%
\expandafter\let\csname\exstring@#1@P\endcsname\empty
\expandafter\let\csname\exstring@#1@Q\endcsname\empty
\expandafter\def\csname\exstring@#1@F\endcsname{\rm}%
}
\def\usecounter#1#2{\expandafter\ifx\csname\exstring@#1@Z\endcsname
\relax\Err@{\noexpand#1not created with \string\newcounter}\fi
\expandafter\let\csname\exstring@#1@@Z\endcsname\relax
\expandafter\let\csname\exstring@#1@@Z@\endcsname\relax
\edef\next@{\def\noexpand#2{\futurelet\noexpand\next
\csname\exstring@#1@@Z\endcsname}}\next@
\edef\next@{\def\csname\exstring@#1@@Z\endcsname{\noexpand\ifx
\noexpand\next\noexpand\label\def\noexpand\next@\noexpand\label
########1{\csname\exstring@#1@@Z@\endcsname
{\noexpand#1\noexpand\label{########1}}\noexpand\FNSSP@}%
\noexpand\else\noexpand\ifx\noexpand\next
\noexpand"\def\noexpand\next@\noexpand"########1\noexpand"%
{\csname\exstring@#1@@Z@\endcsname{{\expandafter\noexpand
\csname\exstring@#1@F\endcsname
\let\noexpand\pre\expandafter\noexpand\csname\exstring@#1@P\endcsname
\let\noexpand\post\expandafter\noexpand\csname\exstring@#1@Q\endcsname
\let\noexpand\style\expandafter\noexpand\csname\exstring@#1@S\endcsname
\let\noexpand\numstyle\expandafter\noexpand\csname\exstring@#1@N\endcsname
########1}}\noexpand\FNSSP@}\noexpand\else
\def\noexpand\next@{\csname\exstring@#1@@Z@\endcsname{\noexpand#1}%
\noexpand\FNSSP@}%
\noexpand\fi\noexpand\fi\noexpand\next@}}\next@
\expandafter\def\csname\exstring@#1@@Z@\endcsname}
\catcode`\@=\active
|