summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-12 01:50:30 +0000
committerKarl Berry <karl@freefriends.org>2013-11-12 01:50:30 +0000
commit2966f8b2993275dcac7d3b9e53d8b1a7bc66b43a (patch)
tree20ab21051814f539393b7176c1a909b61e0d32e8 /Master
parent74456c15bcb8f119a6ff55119eadd11af99885f8 (diff)
autonum (12nov13)
git-svn-id: svn://tug.org/texlive/trunk@32126 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/autonum/autonum.pdfbin278308 -> 279676 bytes
-rw-r--r--Master/texmf-dist/doc/latex/autonum/test-autonum.pdfbin90055 -> 90483 bytes
-rw-r--r--Master/texmf-dist/doc/latex/autonum/test-autonum.tex9
-rw-r--r--Master/texmf-dist/source/latex/autonum/autonum.dtx37
-rw-r--r--Master/texmf-dist/tex/latex/autonum/autonum.sty20
5 files changed, 47 insertions, 19 deletions
diff --git a/Master/texmf-dist/doc/latex/autonum/autonum.pdf b/Master/texmf-dist/doc/latex/autonum/autonum.pdf
index 0f18d528ef8..ccdb3ce8b28 100644
--- a/Master/texmf-dist/doc/latex/autonum/autonum.pdf
+++ b/Master/texmf-dist/doc/latex/autonum/autonum.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/autonum/test-autonum.pdf b/Master/texmf-dist/doc/latex/autonum/test-autonum.pdf
index 49857f80912..de100cf4665 100644
--- a/Master/texmf-dist/doc/latex/autonum/test-autonum.pdf
+++ b/Master/texmf-dist/doc/latex/autonum/test-autonum.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/autonum/test-autonum.tex b/Master/texmf-dist/doc/latex/autonum/test-autonum.tex
index c220992cba4..2f2804e0272 100644
--- a/Master/texmf-dist/doc/latex/autonum/test-autonum.tex
+++ b/Master/texmf-dist/doc/latex/autonum/test-autonum.tex
@@ -24,6 +24,7 @@
\@ifpackageloaded{cleveref}{%
\def\ifcleveref#1{#1}%
+ \crefname{inequation}{ineq.}{ineqs.}
}{%
\def\ifcleveref#1{}%
}
@@ -143,6 +144,14 @@
\]
\cref{crefThree,crefFour}
}
+ \item Using cref with a custom type \cref{myInequation} and thus an optional argument in the label command
+ \begin{equation}\label[inequation]{myInequation}
+ a < b
+ \end{equation}
+ \item Using an unused cref with a custom type and thus an optional argument in the label command
+ \begin{equation}\label[inequation]{myUnusedInequation}
+ d < c
+ \end{equation}
}
\item Using align \ref{alignOne}, \ref{alignThree}
\begin{align}
diff --git a/Master/texmf-dist/source/latex/autonum/autonum.dtx b/Master/texmf-dist/source/latex/autonum/autonum.dtx
index 43d053fed81..5df4b5f7ae8 100644
--- a/Master/texmf-dist/source/latex/autonum/autonum.dtx
+++ b/Master/texmf-dist/source/latex/autonum/autonum.dtx
@@ -85,7 +85,7 @@ and the derived files autonum.ins,
%</internal>
%<*package>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{autonum}[2013/10/13 v0.3.6 autonum LaTeX package]
+\ProvidesPackage{autonum}[2013/11/10 v0.3.7 autonum LaTeX package]
\PassOptionsToPackage{hypertexnames=false}{hyperref}
\RequirePackage{etoolbox}
\RequirePackage{amsmath}
@@ -134,6 +134,7 @@ and the derived files autonum.ins,
%\changes{v0.3.4}{2013/04/28}{Gracefully handle deactivating the package.}
%\changes{v0.3.5}{2013/06/15}{Support reference commands with optional arguments or stars.}
%\changes{v0.3.6}{2013/10/13}{Fix special characters regression. Fix deactivating the package with TOC and LOF}
+%\changes{v0.3.7}{2013/11/10}{Suport label commands with an optional argument}
%
% \section{Introduction}
% With \LaTeX, the user has to decide manually to not number an equation by adding a star in the math environment. Authors who do not want to think about the numbering during the writing (and maybe they should not), often use the environments without stars. As default, these users get all equations numbered, although there are \href{http://tex.stackexchange.com/q/29267/7323}{different opinions} about what should be numbered.
@@ -218,7 +219,7 @@ and the derived files autonum.ins,
%
% \section{Compatibility}
% \subsection{Load Order}
-% As other packages might break autonum, it should be loaded very late. Normally, amsmath is loaded automatically to make use of the more advanced math environments. Nevertheless, to use other packages, it might be necessary to load amsmath manually. To use autonum with amsmath, hyperref and cleveref for example, the order must be amsmath $\rightarrow$ hyperref $\rightarrow$ cleveref $\rightarrow$ autonum, as cleveref may not be loaded after amsmath. If a wrong order has been active, it might be necessary to delete the aux file manually to get rid of compile errors. The support of autonum without amsmath has been discontinued due to missing demand.
+% As other packages might break autonum, it should be loaded very late. Normally, amsmath is loaded automatically to make use of the more advanced math environments. Nevertheless, to use other packages, it might be necessary to load amsmath manually. To use autonum with amsmath, hyperref and cleveref for example, the order must be amsmath $\rightarrow$ hyperref $\rightarrow$ cleveref $\rightarrow$ autonum, as cleveref must not be loaded after amsmath. If a wrong order has been active, it might be necessary to delete the aux file manually to get rid of compile errors. The support of autonum without amsmath has been discontinued due to missing demand.
%
% \subsection{Hyperref}
% The hyperref package must be loaded with the option \texttt{hypertexnames=false} to work when autonum is used.\\
@@ -651,7 +652,11 @@ and the derived files autonum.ins,
% Patch the label command, as some special data has to be saved with each usage. In order to support multi-line equations, the counter must be increased in every line, as every line is a possible reference target. Therefore, \\ has to be overwritten, too. This must be global, as amsmath is very annoying with overwriting local definitions, e.g. in align environments.
% \begin{macrocode}
\def\autonum@patchSubcommands#1{%
- \global\letcs{\label}{autonum@patched#1Label}%
+% \end{macrocode}
+ % The following two lines seem to do the same and both activate the patched label command. As the second one should, in theory, be superior in case of an optional argument for the \cmd{\label} command, use this one.
+% \begin{macrocode}
+% \global\letcs{\label}{autonum@patched#1Label}%
+ \expandafter\GlobalLetLtxMacro\expandafter\label\csname autonum@patched#1Label\endcsname
% \end{macrocode}
% Do not patch the newline command in a multline environment, as only the last line may get a \cmd{\notag} command, because all lines basically build one equation (see also amsmath's documentation, section 3.3).
% \begin{macrocode}
@@ -667,7 +672,7 @@ and the derived files autonum.ins,
% Restore the newline and label commands. This must be global, as it had been overwritten globally in \cmd{\autonum@patchSubcommands}.
% \begin{macrocode}
\def\autonum@restoreSubcommands{%
- \global\let\label\autonum@labelNormal%
+ \GlobalLetLtxMacro{\label}{\autonum@labelNormal}%
\global\let\\\autonum@newlineNormal%
}
% \end{macrocode}
@@ -677,25 +682,35 @@ and the derived files autonum.ins,
% Use an extra command to patch the used label command for efficiency.
% \begin{macrocode}
\def\autonum@generatePatchedLabel#1{%
- \csdef{autonum@patched#1Label}##1{%
- % \end{macrocode}
+% \end{macrocode}
+ % As the \cmd{\label} command can have an optional argument (see cleveref: Overriding the Cross-Reference Type), it must be supported in the patched version of the command, too. As the basic version of \cmd{\label} does not support an optional argument (see texdoc source2e), inside of the following macro the label command must not be called with a possible empty optional argument unconditionally. Instead, there must be a test if an optional argument has been provided and only then it must be used in the call of the original label command. Use the trick with the \href{http://tex.stackexchange.com/a/60896}{empty macro} as a test.
+% \begin{macrocode}
+ \expandafter\newcommand\csname autonum@patched#1Label\endcsname[2][\@empty]{%
+% \end{macrocode}
% The labeling information is needed in the newline command. Therefore, the following variable is used to store it until the next newline command. As the definition is local and every line in an multi-line displayed math environment has its own group, the variable does not have to be deleted explicitly.
- % \begin{macrocode}
+% \begin{macrocode}
\ifdef{\autonum@currentLabel}{%
\PackageError{autonum}{Two succeeding \string\label's detected}{Did you forget a \string\\?}%
}{%
- \def\autonum@currentLabel{##1}%
+ \def\autonum@currentLabel{##2}%
}%
% \end{macrocode}
% Only call the original label command if the label gets referenced. This obviously is identical if the reference is located before the label. It is also identical if the reference is located after the label, as the \cmd{\\} or \cmd{\endenvironment} commands which follow the \cmd{\label} would suppress the numbering anyway in the first pass. In the second pass, the information about referencing is the same as if only the content of the following if-command were available.
% \begin{macrocode}
- \ifcsedef{autonum@##1Referenced}{%
+ \ifcsedef{autonum@##2Referenced}{%
% \end{macrocode}
% The environment's original label command is called to do the real labeling. As it checks for erroneous succeeding labels using \cmd{df@label}, this variable has to be emptied before every call.
% \begin{macrocode}
\let\df@label\@empty%
- \csuse{autonum@label#1}{##1}%
- }{}
+% \end{macrocode}
+ % If the following test is true, \cmd{\label} has been called without optional argument, as the default has been used internally.
+% \begin{macrocode}
+ \ifx\@empty##1\relax
+ \csuse{autonum@label#1}{##2}%
+ \else
+ \csuse{autonum@label#1}[##1]{##2}%
+ \fi
+ }{}%
}%
}
% \end{macrocode}
diff --git a/Master/texmf-dist/tex/latex/autonum/autonum.sty b/Master/texmf-dist/tex/latex/autonum/autonum.sty
index ee745a2cf84..826fde6ab44 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}[2013/10/13 v0.3.6 autonum LaTeX package]
+\ProvidesPackage{autonum}[2013/11/10 v0.3.7 autonum LaTeX package]
\PassOptionsToPackage{hypertexnames=false}{hyperref}
\RequirePackage{etoolbox}
\RequirePackage{amsmath}
@@ -166,7 +166,7 @@
}
\def\autonum@patchSubcommands#1{%
-\global\letcs{\label}{autonum@patched#1Label}%
+\expandafter\GlobalLetLtxMacro\expandafter\label\csname autonum@patched#1Label\endcsname
\ifstrequal{#1}{multline}{%
}{%
\global\letcs{\\}{autonum@patched#1Newline}%
@@ -174,21 +174,25 @@
}
\def\autonum@restoreSubcommands{%
-\global\let\label\autonum@labelNormal%
+\GlobalLetLtxMacro{\label}{\autonum@labelNormal}%
\global\let\\\autonum@newlineNormal%
}
\def\autonum@generatePatchedLabel#1{%
-\csdef{autonum@patched#1Label}##1{%
+\expandafter\newcommand\csname autonum@patched#1Label\endcsname[2][\@empty]{%
\ifdef{\autonum@currentLabel}{%
\PackageError{autonum}{Two succeeding \string\label's detected}{Did you forget a \string\\?}%
}{%
-\def\autonum@currentLabel{##1}%
+\def\autonum@currentLabel{##2}%
}%
-\ifcsedef{autonum@##1Referenced}{%
+\ifcsedef{autonum@##2Referenced}{%
\let\df@label\@empty%
-\csuse{autonum@label#1}{##1}%
-}{}
+\ifx\@empty##1\relax
+\csuse{autonum@label#1}{##2}%
+\else
+\csuse{autonum@label#1}[##1]{##2}%
+\fi
+}{}%
}%
}