summaryrefslogtreecommitdiff
path: root/macros/lamstex/inputs/anynum.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/lamstex/inputs/anynum.tex')
-rw-r--r--macros/lamstex/inputs/anynum.tex58
1 files changed, 58 insertions, 0 deletions
diff --git a/macros/lamstex/inputs/anynum.tex b/macros/lamstex/inputs/anynum.tex
new file mode 100644
index 0000000000..82af80f3f7
--- /dev/null
+++ b/macros/lamstex/inputs/anynum.tex
@@ -0,0 +1,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