summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/autonum/autonum.ins
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-08-17 22:49:35 +0000
committerKarl Berry <karl@freefriends.org>2012-08-17 22:49:35 +0000
commitd2d1de388ec0f65d0f8c40a5b184c68b249a3f6f (patch)
tree31075d4de62d73b06ca79c188ee3524f60231d6b /Master/texmf-dist/source/latex/autonum/autonum.ins
parent72fc6f6b4e78b80b5e04462b824aeaad3ded4e47 (diff)
autonum (17aug12)
git-svn-id: svn://tug.org/texlive/trunk@27444 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/autonum/autonum.ins')
-rw-r--r--Master/texmf-dist/source/latex/autonum/autonum.ins83
1 files changed, 60 insertions, 23 deletions
diff --git a/Master/texmf-dist/source/latex/autonum/autonum.ins b/Master/texmf-dist/source/latex/autonum/autonum.ins
index fbac37d109c..56a3a3ddd42 100644
--- a/Master/texmf-dist/source/latex/autonum/autonum.ins
+++ b/Master/texmf-dist/source/latex/autonum/autonum.ins
@@ -52,7 +52,7 @@ and the derived files autonum.ins,
\def\csxdefaux#1#2{%
\protected@write\@mainaux{}{%
-\expandafter\string\expandafter\xdef\expandafter\string\csname #1\endcsname{#2}%
+\csxdef{\detokenize{#1}}{#2}%
}%
}
@@ -68,35 +68,40 @@ and the derived files autonum.ins,
}
\AtBeginDocument{%
-\forcsvlist{\autonum@patchFullEnvironment}{equation,gather,multline,align}%
+\forcsvlist{\autonum@patchParametrizedFullEnvironment}{alignat}%
+\forcsvlist{\autonum@patchFullEnvironment}{equation,gather,multline,flalign,align}%
\def\[#1\]{%
\begin{equation}#1\end{equation}%
}%
\autonum@generatePatchedReference{ref}%
\ifdef{\cref}{%
-\autonum@generatePatchedReference{cref}%
+\autonum@generatePatchedReferenceCSL{cref}%
}{}%
}
\def\autonum@patchFullEnvironment#1{%
-\autonum@saveEnvironmentSubcommands{#1}{center}%
-\autonum@patchEnvironmentHelper{#1}%
+\autonum@saveEnvironmentSubcommands{#1}{center}{}%
+\autonum@patchEnvironmentHelper{#1}{0}%
+}
+\def\autonum@patchParametrizedFullEnvironment#1{%
+\autonum@saveEnvironmentSubcommands{#1}{center}{1}%
+\autonum@patchEnvironmentHelper{#1}{1}%
}
\def\autonum@patchBlockEnvironment#1{%
-\autonum@saveEnvironmentSubcommands{#1}{equation*}%
-\autonum@patchEnvironmentHelper{#1}%
+\autonum@saveEnvironmentSubcommands{#1}{equation*}{}%
+\autonum@patchEnvironmentHelper{#1}{0}%
}
-\def\autonum@patchEnvironmentHelper#1{%
-\autonum@renameEnvironment{#1}%
-\autonum@changeEnvironment{#1}%
+\def\autonum@patchEnvironmentHelper#1#2{%
+\autonum@renameEnvironment{#1}{#2}%
+\autonum@changeEnvironment{#1}{#2}%
\autonum@generatePatchedLabel{#1}%
\autonum@generatePatchedNewline{#1}%
}
-\def\autonum@saveEnvironmentSubcommands#1#2{%
+\def\autonum@saveEnvironmentSubcommands#1#2#3{%
\begin{textblock}{1}[1,1](0,0)%
-\begin{#2}
-\begin{#1}%
+\begin{#2}%
+\begin{#1}#3%
\global\cslet{autonum@newline#1}\\%
\notag%
\ifboolexpr{not test {\ifstrequal{#1}{multline}} or test {\ifcsundef{autonum@label#1}}}{%
@@ -104,32 +109,48 @@ and the derived files autonum.ins,
}%
\notag%
\end{#1}%
-\end{#2}
+\end{#2}%
\end{textblock}%
}
-\def\autonum@renameEnvironment#1{%
+\def\autonum@renameEnvironment#1#2{%
\csletcs{autonum@#1Old}{#1}%
\csletcs{autonum@end#1Old}{end#1}%
-\newenvironment{#1+}{%
+\newenvironment{#1+}[#2]{%
\csuse{autonum@#1Old}%
}{%
\csuse{autonum@end#1Old}%
}%
}
-\def\autonum@changeEnvironment#1{%
+\def\autonum@changeEnvironment#1#2{%
+\ifnum #2=0%
\renewenvironment{#1}{%
+\autonum@startChangeEnvironment{#1}{}%
+}{%
+\autonum@endChangeEnvironment{#1}%
+}
+\else
+\renewenvironment{#1}[1]{%
+\autonum@startChangeEnvironment{#1}{##1}%
+}{%
+\autonum@endChangeEnvironment{#1}%
+}%
+\fi%
+\global\csundef{#1*}%
+\global\csundef{end#1*}%
+}
+
+\def\autonum@startChangeEnvironment#1#2{%
\autonum@saveSubcommands
-\csuse{autonum@#1Old}%
+\csuse{autonum@#1Old}#2%
\autonum@patchSubcommands{#1}%
-}{%
+}
+
+\def\autonum@endChangeEnvironment#1{%
\autonum@possiblyHideNumber
\csuse{autonum@end#1Old}%
\autonum@restoreSubcommands
-}%
-\global\csundef{#1*}%
-\global\csundef{end#1*}%
}
\def\autonum@saveSubcommands{%
@@ -183,13 +204,29 @@ and the derived files autonum.ins,
}
\def\autonum@generatePatchedReference#1{%
+\autonum@generatePatchedReferenceGeneral{#1}{autonum@use}%
+}
+
+\def\autonum@generatePatchedReferenceCSL#1{%
+\autonum@generatePatchedReferenceGeneral{#1}{forcsvlist}%
+}
+
+\def\autonum@generatePatchedReferenceGeneral#1#2{%
\csletcs{autonum@reference#1Old}{#1}%
\csdef{#1}##1{%
-\csxdefall{autonum@##1Referenced}{}%
+\csuse{#2}{\autonum@markLabelAsReferenced}{##1}
\csuse{autonum@reference#1Old}{##1}%
}%
}
+\def\autonum@markLabelAsReferenced#1{%
+\csxdefall{autonum@#1Referenced}{}%
+}
+
+\def\autonum@use#1#2{%
+#1{#2}%
+}
+
\newcounter{autonum@counter}
\def\autonum@patchShortcutEnvironment{%
\def\[##1\]{%