summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/autonum
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/tex/latex/autonum
parent72fc6f6b4e78b80b5e04462b824aeaad3ded4e47 (diff)
autonum (17aug12)
git-svn-id: svn://tug.org/texlive/trunk@27444 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/autonum')
-rw-r--r--Master/texmf-dist/tex/latex/autonum/autonum.sty85
1 files changed, 61 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/latex/autonum/autonum.sty b/Master/texmf-dist/tex/latex/autonum/autonum.sty
index cb9833848fe..a44c6d4e27f 100644
--- a/Master/texmf-dist/tex/latex/autonum/autonum.sty
+++ b/Master/texmf-dist/tex/latex/autonum/autonum.sty
@@ -13,7 +13,7 @@
%% ----------------------------------------------------------------
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{autonum}[2012/06/21 v0.2 autonum LaTeX package]
+\ProvidesPackage{autonum}[2012/08/16 v0.3 autonum LaTeX package]
\PassOptionsToPackage{hypertexnames=false}{hyperref}
\RequirePackage{etoolbox}
\RequirePackage{amsmath}
@@ -21,7 +21,7 @@
\def\csxdefaux#1#2{%
\protected@write\@mainaux{}{%
-\expandafter\string\expandafter\xdef\expandafter\string\csname #1\endcsname{#2}%
+\csxdef{\detokenize{#1}}{#2}%
}%
}
@@ -37,35 +37,40 @@
}
\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}}}{%
@@ -73,32 +78,48 @@
}%
\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{%
@@ -152,13 +173,29 @@
}
\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\]{%