summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/autonum/autonum.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-29 22:52:33 +0000
committerKarl Berry <karl@freefriends.org>2012-05-29 22:52:33 +0000
commit6ba407cece356e54f1144fc1d9c3fd38a65a2c2e (patch)
treee473c8af06b48bceb4aa7b9822a24c047905a59b /Master/texmf-dist/tex/latex/autonum/autonum.sty
parent9de37ad7dbd5b10933f4fc87f93ddf5a77501004 (diff)
autonum (29may12)
git-svn-id: svn://tug.org/texlive/trunk@26721 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/autonum/autonum.sty')
-rw-r--r--Master/texmf-dist/tex/latex/autonum/autonum.sty124
1 files changed, 124 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/autonum/autonum.sty b/Master/texmf-dist/tex/latex/autonum/autonum.sty
new file mode 100644
index 00000000000..303aa4f89c7
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/autonum/autonum.sty
@@ -0,0 +1,124 @@
+%%
+%% This is file `autonum.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% autonum.dtx (with options: `package')
+%% ----------------------------------------------------------------
+%% autonum --- Automatic number referenced equations
+%% E-mail: pat_h@web.de
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{autonum}[2012/05/26 v0.1 autonum LaTeX package]
+\RequirePackage{etoolbox}
+
+\newcommand{\csxdefaux}[2]{%
+\protected@write\@mainaux{}{%
+\expandafter\string\expandafter\xdef\expandafter\string\csname #1\endcsname{#2}%
+}%
+}
+
+\newcommand{\csxdefall}[2]{%
+\csxdefaux{#1}{#2}%
+\csxdef{#1}{#2}%
+}
+
+\newcounter{autonum@counter}
+
+\newcommand{\autonum@patchEnvironment}[1]{
+\csletcs{autonum@#1Old}{#1}%
+\csletcs{autonum@end#1Old}{end#1}%
+\autonum@saveOldEnvironment{#1}%
+\autonum@changeEnvironment{#1}%
+}
+
+\newcommand{\autonum@saveOldEnvironment}[1]{
+\newenvironment{#1+}{%
+\csuse{autonum@#1Old}%
+}{%
+\csuse{autonum@end#1Old}%
+}%
+}
+
+\newcommand{\autonum@changeEnvironment}[1]{
+\renewenvironment{#1}{%
+\autonum@IfReferenced{\Roman{autonum@counter}}{%
+\csuse{autonum@#1Old}%
+}{%
+\begin{#1*}%
+}%
+}{%
+\autonum@IfReferenced{\Roman{autonum@counter}}{%
+\csuse{autonum@end#1Old}%
+}{%
+\end{#1*}%
+\ignorespacesafterend
+}%
+\stepcounter{autonum@counter}%
+}%
+}
+
+\AfterPreamble{
+\autonum@patchEnvironment{equation}
+%% \forcsvlist{\autonum@patchEnvironment}{gather,multline,align.flalign,alignat}
+
+\ifcsundef{equation*}{%
+\newenvironment{equation*}{\[}{\]}%
+}{}
+
+\newcommand{\autonum@IfReferenced}[3]{%
+\ifcsdef{autonum@#1Referenced}{#2}{#3}%
+}
+
+\newcommand{\autonum@patchLabel}[1]{%
+\letcs{\autonum@labelOld}{#1}%
+\csdef{#1}##1{%
+\csxdefall{autonum@##1Labeled}{\Roman{autonum@counter}}%
+\autonum@labelOld{##1}%
+}%
+}
+\ifdef{\label@in@display}{%
+\autonum@patchLabel{label@in@display}%
+}{%
+\autonum@patchLabel{label}%
+}
+
+\newcommand{\autonum@patchReference}[1]{%
+\letcs{\autonum@referenceOld}{#1}%
+\csdef{#1}##1{%
+\ifcsdef{autonum@##1Labeled}{%
+\csxdefall{autonum@\csuse{autonum@##1Labeled}Referenced}{}%
+}{}%
+\autonum@referenceOld{##1}%
+}%
+}
+\autonum@patchReference{ref}%
+\ifdef{\cref}{%
+\autonum@patchReference{cref}%
+}{}%
+}
+
+%%
+%% Copyright (C) 2012 by Patrick Häcker <pat_h@web.de>
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License (LPPL), either
+%% version 1.3c of this license or (at your option) any later
+%% version. The latest version of this license is in the file:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status) by
+%% Patrick Häcker.
+%%
+%% This work consists of the file autonum.dtx
+%% and the derived files autonum.ins,
+%% autonum.pdf and
+%% autonum.sty.
+%%
+%%
+%% End of file `autonum.sty'.