summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-12-19 23:20:05 +0000
committerKarl Berry <karl@freefriends.org>2014-12-19 23:20:05 +0000
commita3bb5abaf88c429db37fef119741ee780664428a (patch)
treeda08c4163213f6f72c4aa70e11d2b4463efa2be1 /Master/texmf-dist/tex/latex
parent628f4fa7af89a5208879f94f4893e3361408a497 (diff)
autonum (20dec14)
git-svn-id: svn://tug.org/texlive/trunk@35865 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/autonum/autonum.sty135
1 files changed, 107 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/autonum/autonum.sty b/Master/texmf-dist/tex/latex/autonum/autonum.sty
index 348314e193c..82d094c1148 100644
--- a/Master/texmf-dist/tex/latex/autonum/autonum.sty
+++ b/Master/texmf-dist/tex/latex/autonum/autonum.sty
@@ -13,13 +13,15 @@
%% ----------------------------------------------------------------
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{autonum}[2014/04/14 v0.3.8 autonum LaTeX package]
+\ProvidesPackage{autonum}[2014/12/19 v0.3.9 autonum LaTeX package]
\PassOptionsToPackage{hypertexnames=false}{hyperref}
\RequirePackage{etoolbox}
+\RequirePackage{etextools}
\RequirePackage{amsmath}
\RequirePackage[absolute]{textpos}
\RequirePackage{letltxmacro}
+
\def\csxdefaux#1#2{%
\protected@write\@mainaux{}{%
\csxdef{\detokenize{#1}}{#2}%
@@ -34,11 +36,11 @@
\csxdef{#1}{#2}%
}
-\newrobustcmd{\csLetLtxMacro}[2]{%
+\newrobustcmd{\CsLetLtxMacro}[2]{%
\expandafter\LetLtxMacro\csname#1\endcsname#2%
}
-\newrobustcmd{\LetcsLtxMacro}[2]{%
+\newrobustcmd{\LetCsLtxMacro}[2]{%
\ifcsdef{#2}{%
\expandafter\LetLtxMacro\expandafter#1\csname#2\endcsname
}{%
@@ -46,9 +48,29 @@
}%
}
-\newrobustcmd*{\csLetcsLtxMacro}[2]{%
+\newrobustcmd*{\CsLetCsLtxMacro}[2]{%
+\ifcsdef{#2}{%
+\expandafter\LetLtxMacro\csname#1\expandafter\endcsname\csname#2\endcsname
+}{%
+\csundef{#1}%
+}%
+}
+
+\newrobustcmd{\GlobalCsLetLtxMacro}[2]{%
+\expandafter\GlobalLetLtxMacro\csname#1\endcsname#2%
+}
+
+\newrobustcmd{\GlobalLetCsLtxMacro}[2]{%
+\ifcsdef{#2}{%
+\expandafter\GlobalLetLtxMacro\expandafter#1\csname#2\endcsname
+}{%
+\undef#1%
+}%
+}
+
+\newrobustcmd*{\GlobalCsLetCsLtxMacro}[2]{%
\ifcsdef{#2}{%
-\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname
+\expandafter\GlobalLetLtxMacro\csname#1\expandafter\endcsname\csname#2\endcsname
}{%
\csundef{#1}%
}%
@@ -68,8 +90,36 @@
\undef{\autonum@ifcsedefTemp}%
}
+\def\newcommandsequence#1{%
+\expandafter\newcommand\csname #1\endcsname
+}
+
+\def\renewcommandsequence#1{%
+\expandafter\renewcommand\csname #1\endcsname
+}
+
+
+
+\def\autonum@debug#1{%
+\PackageWarning{autonum}{#1}%
+}
+\def\meaningx#1{%
+\expandafter\ifcsname\string #1\endcsname
+\expandafter\meaning\csname\string #1\endcsname
+\else
+\meaning#1%
+\fi
+}
+\def\autonum@debugMacro#1{%
+\autonum@debug{%
+\detokenize{#1}defined as \MessageBreak
+\meaning#1 \expandafter\ifcsname\string #1\endcsname\MessageBreak
+with \expandafter\detokenize\expandafter{\csname\string#1\endcsname}defined as\MessageBreak
+\meaningx#1\fi
+}%
+}
\AtBeginDocument{%
\newlength{\autonum@environmentWidth}%
@@ -94,8 +144,8 @@
\autonum@patchEnvironmentHelper{#1}{1}%
}
\def\autonum@patchBlockEnvironment#1{%
-\autonum@saveEnvironmentSubcommands{#1}{equation}{}%
-\autonum@patchEnvironmentHelper{#1}{0}%
+\autonum@renameEnvironment{#1}{0}%
+\autonum@changeEnvironment{#1}{0}%
}
\def\autonum@patchEnvironmentHelper#1#2{%
\autonum@renameEnvironment{#1}{#2}%
@@ -111,11 +161,10 @@
\deflength{\autonum@environmentWidth}{\linewidth-\multlinegap-\multlinegap}%
\hspace{\autonum@environmentWidth}%
\global\cslet{autonum@newline#1}\\%
-\notag%
+\notag
\ifboolexpr{not test {\ifstrequal{#1}{multline}} or test {\ifcsundef{autonum@label#1}}}{%
-\global\cslet{autonum@label#1}{\label}%
-}%
-\notag%
+\GlobalCsLetLtxMacro{autonum@label#1}\label
+}{}%
\end{#1}%
\end{#2}%
\end{textblock}%
@@ -150,45 +199,70 @@
}
\def\autonum@startChangeEnvironment#1#2{%
+\ifstrequal{#1}{split}{%
+}{%
\autonum@saveSubcommands
+}%
\csuse{autonum@#1Old}#2%
+\ifstrequal{#1}{split}{%
+}{%
\autonum@patchSubcommands{#1}%
+}%
}
\def\autonum@endChangeEnvironment#1{%
\autonum@possiblyHideNumber
\csuse{autonum@end#1Old}%
+\ifstrequal{#1}{split}{%
+\renewcommand\label[2][]{%
+\PackageError{autonum}{%
+A label must not be placed between \detokenize{\end{split}}\MessageBreak
+and the end (of a line) of a math environment\MessageBreak
+when using autonum. Wrongly placed label is:\MessageBreak
+##2%
+}{Move the \detokenize{\label}call before \detokenize{\begin{split}}}%
+}%
+\aftergroup@def{\label}%
+}{%
\autonum@restoreSubcommands
+\global\undef\autonum@currentLabel
+}%
}
\def\autonum@saveSubcommands{%
-\let\autonum@labelNormal\label%
-\let\autonum@newlineNormal\\%
+\LetLtxMacro\autonum@labelNormal\label
+\LetLtxMacro\autonum@newlineNormal\\%
}
\def\autonum@patchSubcommands#1{%
-\expandafter\GlobalLetLtxMacro\expandafter\label\csname autonum@patched#1Label\endcsname
+\GlobalLetCsLtxMacro\label{autonum@patched#1Label}%
\ifstrequal{#1}{multline}{%
}{%
- \global\letcs{\\}{autonum@patched#1Newline}%
+\GlobalLetCsLtxMacro\\{autonum@patched#1Newline}%
}%
}
\def\autonum@restoreSubcommands{%
-\GlobalLetLtxMacro{\label}{\autonum@labelNormal}%
-\global\let\\\autonum@newlineNormal%
+\GlobalLetLtxMacro\label\autonum@labelNormal
+\GlobalLetLtxMacro\\\autonum@newlineNormal
}
\def\autonum@generatePatchedLabel#1{%
-\expandafter\newcommand\csname autonum@patched#1Label\endcsname[2][\@empty]{%
+\newcommandsequence{autonum@patched#1Label}[2][]{%
\ifdef{\autonum@currentLabel}{%
+\ifmeasuring@
\PackageError{autonum}{Two succeeding \string\label's detected}{Did you forget a \string\\?}%
+\fi
}{%
+\ifboolexpr{test {\ifstrequal{#1}{flalign}} or test {\ifstrequal{#1}{alignat}}}{%
\def\autonum@currentLabel{##2}%
+}{%
+\global\def\autonum@currentLabel{##2}%
+}%
}%
\ifcsedef{autonum@##2Referenced}{%
\let\df@label\@empty%
-\ifx\@empty##1\relax
+\if\relax\detokenize{##1}\relax
\csuse{autonum@label#1}{##2}%
\else
\csuse{autonum@label#1}[##1]{##2}%
@@ -198,20 +272,25 @@
}
\def\autonum@generatePatchedNewline#1{%
-\csdef{autonum@patched#1Newline}{%
+\newcommandsequence{autonum@patched#1Newline}[1][]{%
\autonum@possiblyHideNumber
+\if\relax\detokenize{##1}\relax
\csuse{autonum@newline#1}%
-}
+\else
+\csuse{autonum@newline#1}[##1]%
+\fi
+\global\undef\autonum@currentLabel
+}%
}
\def\autonum@possiblyHideNumber{
\ifdef{\autonum@currentLabel}{%
-\ifcsedef{autonum@\csuse{autonum@currentLabel}Referenced}{%
+\ifcsedef{autonum@\autonum@currentLabel Referenced}{%
}{%
-\notag%
+\notag
}%
}{%
-\notag%
+\notag
}%
}
@@ -232,7 +311,7 @@
}
\def\autonum@generatePatchedReferenceGeneral#1#2{%
-\csLetcsLtxMacro{autonum@reference#1Old}{#1}%
+\CsLetCsLtxMacro{autonum@reference#1Old}{#1}%
\csdef{#1}{%
\protect\autonum@processReference{autonum@reference#1Old}{#2}%
}%
@@ -286,7 +365,7 @@
\def\autonum@useWithMultipleLineDetection#1#2{%
\begin{#1}%
\autonum@patchParentheses
-\global\let\autonum@patchedNewline\\%
+\GlobalLetLtxMacro\autonum@patchedNewline\\%
\ifstrequal{#1}{align}{%
\gdef\\{%
\autonum@patchedNewline
@@ -298,7 +377,7 @@
}%
}
#2%
-\global\let\\\autonum@patchedNewline%
+\GlobalLetLtxMacro\\\autonum@patchedNewline
\ifdef{\autonum@multipleLines}{%
\global\undef{\autonum@multipleLines}%
}{%
@@ -332,7 +411,7 @@
}{}%
}
%%
-%% Copyright (C) 2012, 2013 by Patrick Häcker <pat_h@web.de>
+%% Copyright (C) 2012, 2013, 2014 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