%% %% 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 %% %% 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'.