summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/autonum/README1
-rw-r--r--Master/texmf-dist/doc/latex/autonum/autonum.pdfbin279967 -> 291315 bytes
-rw-r--r--Master/texmf-dist/doc/latex/autonum/test-autonum.pdfbin101725 -> 102991 bytes
-rw-r--r--Master/texmf-dist/doc/latex/autonum/test-autonum.tex119
-rw-r--r--Master/texmf-dist/source/latex/autonum/autonum.dtx388
-rw-r--r--Master/texmf-dist/source/latex/autonum/autonum.ins5
-rw-r--r--Master/texmf-dist/tex/latex/autonum/autonum.sty135
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check1
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds3
9 files changed, 509 insertions, 143 deletions
diff --git a/Master/texmf-dist/doc/latex/autonum/README b/Master/texmf-dist/doc/latex/autonum/README
index 251898c06ae..bb0ab5023ed 100644
--- a/Master/texmf-dist/doc/latex/autonum/README
+++ b/Master/texmf-dist/doc/latex/autonum/README
@@ -15,3 +15,4 @@ Usage: \usepackage{autonum}
Everything else should happen automatically.
To use autonum together with other packages, load autonum last.
+
diff --git a/Master/texmf-dist/doc/latex/autonum/autonum.pdf b/Master/texmf-dist/doc/latex/autonum/autonum.pdf
index fb612176019..0587e222e1e 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 d60bab22107..a0f49983eab 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 adc9300fd55..2d2d890cb60 100644
--- a/Master/texmf-dist/doc/latex/autonum/test-autonum.tex
+++ b/Master/texmf-dist/doc/latex/autonum/test-autonum.tex
@@ -1,16 +1,22 @@
\documentclass{article}
+% Load hyperref early to avoid an error on compilation without existing aux-file. This is in contrast to what is recommended in hyperref's documentation. When deleting the aux-file, there was an error on first compilation if hyperref was defined after the \AtEndDocument command below. But as the second compilation run without error and as the error also happened without autonum, this is a problem outside unrelated to autonum.
+\usepackage[hypertexnames=false]{hyperref}
+
% Make this document look like endless paper to avoid page breaks, which make some of the tests useless.
% See http://tex.stackexchange.com/a/27057/7323
\usepackage{geometry}
\geometry{paperwidth=20cm,paperheight=\maxdimen,margin=4cm}
\usepackage{etoolbox}
\AtBeginDocument{
- \setbox0=\vbox\bgroup
- \preto\enddocument{\egroup
- \dimen0=\dp0
- \pdfpageheight=\dimexpr\ht0+10cm\relax
- \unvbox0\kern-\dimen0 }
+ \setbox0=\vbox
+ \bgroup
+}
+\AtEndDocument{
+ \egroup
+ \dimen0=\dp0
+ \pdfpageheight=\dimexpr\ht0+10cm\relax
+ \unvbox0\kern-\dimen0
}
% \usepackage[english,ngerman]{babel}
@@ -18,7 +24,6 @@
% \usepackage[utf8x]{inputenx}
\usepackage{amsmath}
-\usepackage[hypertexnames=false]{hyperref}
\usepackage{cleveref}
\usepackage{autonum}
@@ -75,9 +80,13 @@
\end{equation}
\ref{referenceAfter}
\item Having an unlabeled equation
- \begin{equation}\label{abc}
+ \begin{equation}
a^2 + b^2 = c^2
\end{equation}
+ \item Having a labeled equation with the label at the end of the equation \ref{abc}
+ \begin{equation}
+ a^2 + b^2 = c^2\label{abc}
+ \end{equation}
\item Having a labeled, but unreferenced equation
\begin{equation}\label{unreferenced}
\sqrt{a}
@@ -207,8 +216,89 @@
\item multline, numbering always (and avoiding overfull hbox warning) \begin{multline+} m=u\line(1,0){220}=v \end{multline+} (needs autonum)
\item equation, numbering always \begin{equation+} e=q \end{equation+} (needs autonum)
}
- \item shortcut and split \ref{split} \[ \label{split}\begin{split} s \\ p \end{split} \] (needs autonum)
+ \item align with line breaks with extra spacing
+ \begin{align}
+ a
+ \\[\baselineskip]
+ b
+ \end{align}
+ \ifautonum{
+ \item shortcut and split \ref{split} \[ \label{split}\begin{split} s \\ p \end{split} \] (needs autonum)
+ }
\item equation and split \ref{splitEquation} \begin{equation} \label{splitEquation}\begin{split} s \\ p \end{split} \end{equation}
+ \item align and split with the label defined before the split environment \ref{splitAlign}
+ \begin{align}
+ \label{splitAlign}
+ \begin{split}
+ s
+ \end{split}
+ \end{align}
+ \makeatletter
+ \ifdef{\autonum@currentLabel}{TEST FEHLGESCHLAGEN!}{}
+ \makeatother
+ \item align and split with the label defined in the split environment \ref{splitInAlign}
+ \begin{align}
+ \begin{split}
+ s\label{splitInAlign}
+ \end{split}
+ \end{align}
+ \item Align with split and non-split (should have two lines)
+ \begin{align}
+ \begin{split}
+ \text{line 1}
+ \end{split}
+ \\
+ \text{line 2}
+ \end{align}
+ \item Align with non-split and split (should have two lines)
+ \begin{align}
+ \text{line 1}
+ \\
+ \begin{split}
+ \text{line 2}
+ \end{split}
+ \end{align}
+ \item Align with two splits (should have four lines), none referenced)
+ \begin{align}
+ \begin{split}
+ \text{line 1}
+ \\
+ \text{line 2}
+ \end{split}
+ \\
+ \begin{split}
+ \text{line 3}
+ \\
+ \text{line 4}
+ \end{split}
+ \end{align}
+ \item Align with two splits (should have four lines), both referenced \ref{firstSplit} and \ref{secondSplit})
+ \begin{align}
+ \label{firstSplit}
+ \begin{split}
+ \text{line 1}
+ \\
+ \text{line 2}
+ \end{split}
+ \\
+ \label{secondSplit}
+ \begin{split}
+ \text{line 3}
+ \\
+ \text{line 4}
+ \end{split}
+ \end{align}
+ \item Align with split and label at the wrong place should result in the detection of an error
+ {
+ % Redefine \PackageError in a TeX group so the redifinition does not scatter.
+ \def\PackageError#1#2#3{\\\text{Package error successfully detected.}}%
+ \begin{align}
+ \begin{split}
+ 1 = 1
+ \end{split}
+ \label{problematicLabel}
+ \end{align}
+ }
% \item super-short \[\(a+b\\d+e\)\]
% \item Using aligned \ref{alignedOne}, \ref{alignedThree}
% \begin{equation}
@@ -230,39 +320,40 @@
% \begin{equation}
% \sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum a
% \end{equation}
- \item Split with a long line and a \texttt{\textbackslash notag} after ending split has too much spacing afterwards, if the split environment is not patched:
+ \item Split with a long line and a \textbackslash\texttt{notag} after ending split has too much spacing below the environment, if the split environment is not patched:
\begin{equation}
\begin{split}
\sum_1^2 a &= 2a\\
&= \sum_3^4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\end{split}\notag
\end{equation}
- \item Split with a long line and a \texttt{\textbackslash notag} before ending split has correct spacing afterwards:
+ \item Split with a long line and a \textbackslash\texttt{notag} before ending split has correct spacing below the environment:
\begin{equation}
\begin{split}
\sum_1^2 a &= 2a\\
&= \sum_3^4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\notag
\end{split}
\end{equation}
- \item Split with a long line should have correct spacing afterwards automatically:
+ \item Split with a long line and without an explicit \textbackslash\texttt{notag} should have the same spacing as directly above and not the spacing as directly below:
\begin{equation}
\begin{split}
\sum_1^2 a &= 2a\\
&= \sum_3^4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\end{split}
\end{equation}
- \item Split with a long line should have long spacing afterwards if it is referenced \ref{splitLong}:
+ \item Split with a long line should have long spacing below the environment if it is referenced \ref{splitLong}:
\begin{equation}\label{splitLong}
\begin{split}
\sum_1^2 a &= 2a\\
&= \sum_3^4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\end{split}
\end{equation}
- Note, that the \texttt{\textbackslash label} must not be put inside the \texttt{split} environment, as according to the \AmS-math documentation \texttt{split} provides no numbering.
+ Note, that the \textbackslash\texttt{label} must not be put inside the \texttt{split} environment, as according to the \AmS-math documentation \texttt{split} provides no numbering.
\end{itemize}
\section{Using ref in section \ref{i1}}\label{i1} text
\ifcleveref{
- \section{Using cref in \cref{i2}}\label{i2} text
+ % \cref with hyperref makes problems inside of \section: http://tex.stackexchange.com/a/138950. This seems to be unknown for cleveref's author according to 14.2 in cleveref's documentation. If it would be possible to detect that we are inside a moving argument, there could be an automatic solution.
+ \section{Using cref in \texorpdfstring{\cref{i2}}{Section \ref{i2}}}\label{i2} text
\begin{figure}
\caption{Ref 2: \cref{i2} and \ref{i2}}
\end{figure}
diff --git a/Master/texmf-dist/source/latex/autonum/autonum.dtx b/Master/texmf-dist/source/latex/autonum/autonum.dtx
index 9e09f6475c4..f20bbfe5c21 100644
--- a/Master/texmf-dist/source/latex/autonum/autonum.dtx
+++ b/Master/texmf-dist/source/latex/autonum/autonum.dtx
@@ -43,7 +43,7 @@ See http://www.latex-project.org/lppl.txt
\endpreamble
\postamble
-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
@@ -85,9 +85,10 @@ and the derived files autonum.ins,
%</internal>
%<*package>
\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}
@@ -125,22 +126,23 @@ and the derived files autonum.ins,
%
%\maketitle
%
-%\changes{v0.1}{2012/05/26}{First public release}
-%\changes{v0.2}{2012/06/21}{Support multi-line environments. Redefine \cmd{\[} to use the new \cmd{\equation}.}
-%\changes{v0.3}{2012/08/16}{Support alignat and flalign environments. Fix handling of special characters in label names. Fix handling of multiple label names in \cmd{\cref} command.}
-%\changes{v0.3.1}{2012/08/25}{Fix of leading whitespace in references. Fix of underfull hbox.}
-%\changes{v0.3.2}{2012/09/03}{Fix using reference inside caption.}
-%\changes{v0.3.3}{2013/04/20}{Fix using cleveref inside section.}
-%\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.}
-%\changes{v0.3.8}{2014/04/14}{Correct vertical whitespace after long lines with split.}
+%\changes{v0.1}{2012-05-26}{First public release}
+%\changes{v0.2}{2012-06-21}{Support multi-line environments. Redefine \cmd{\[} to use the new \cmd{\equation}.}
+%\changes{v0.3}{2012-08-16}{Support alignat and flalign environments. Fix handling of special characters in label names. Fix handling of multiple label names in \cmd{\cref} command.}
+%\changes{v0.3.1}{2012-08-25}{Fix of leading whitespace in references. Fix of underfull hbox.}
+%\changes{v0.3.2}{2012-09-03}{Fix using reference inside caption.}
+%\changes{v0.3.3}{2013-04-20}{Fix using cleveref inside section.}
+%\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.}
+%\changes{v0.3.8}{2014-04-14}{Correct vertical whitespace after long lines with split.}
+%\changes{v0.3.9}{2014-12-19}{Fix problems and increase robustness for split environment and newline options.}
%
% \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.
+% 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 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.
%
-% The other automatic possibility one can think of is to number only the referenced equations. The \href{http://www.ctan.org/tex-archive/macros/latex/contrib/mh/}{mathtools} package's option \texttt{showonlyrefs} seems to be the solution for those who want to have the referenced equations numbered only. Unfortunately, for \href{http://www.ctan.org/pkg/amsmath}{amsmath} users this also means a step backwards, as the numbering can overwrite parts of the equation according to its documentation. Generally, this options seems to be quite unreliable as it is incompatible with the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/cleveref/}{cleveref} package. The autonum package implements the numbering of referenced equations only without this deficiencies.
+% The other automatic possibility one can think of is to number only the referenced equations. The \href{http://www.ctan.org/pkg/mh/}{mathtools} package's option \texttt{showonlyrefs} seems to be the solution for those who want to have the referenced equations numbered only. Unfortunately, for \href{http://www.ctan.org/pkg/amsmath}{amsmath} users this also means a step backwards, as the numbering can overwrite parts of the equation according to its documentation. Generally, this options seems to be quite unreliable as it is incompatible with the \href{http://www.ctan.org/pkg/cleveref/}{cleveref} package. The autonum package implements the numbering of referenced equations only without this deficiencies.
%^^A This currently does not work with cleveref, as equations without a number increment the equation counter, too. As placing the labels does not always work correctly, \cmd{\mathtoolsset{showonlyrefs}} is not an option (see mathtools documentation, bottom of page 10).
%
% \section{Usage and Examples}
@@ -150,6 +152,8 @@ and the derived files autonum.ins,
% \cmd{\usepackage\{autonum\}}
% \vspace{0.5em}
%
+% This provides support for \cmd{\ref} (and \cmd{\cref} if cleveref is loaded, see section \ref{loadOrder}). If you need support for other reference commands, see section \ref{referenceCommands}. As you probably use the hyperref package, you should set the hypperref option \texttt{hypertexnames=false} when loading the hyperref package to avoid some warnings (see section \ref{hyperref}).
+%
% The recommended style is to add a label to each logical equation. Then, simply use the references as needed. Never use the starred forms when defining an equation as they do not make sense with autonum and are deactivated. You can use the (redefined) \texttt{equation} or \cmd{\[}-\cmd{\]}-environment in most cases, if you add the appropriate \cmd{\begin\{split\}}-\cmd{\end\{split\}} pairs when needed. Sometimes, an \texttt{align}, \texttt{multline}, \texttt{gather}, \texttt{flalign} or \texttt{alignat} environment is needed. Do \href{http://tug.org/pracjourn/2006-4/madsen/madsen.pdf}{not use \texttt{eqnarray}}.^^A, rarely use the \texttt{aligned} or \texttt{gathered} environments.
%
% Please keep in mind, that using autonum might not always be a good thing. If you hand-in a paper for review with many equations on a page, you might avoid using autonum or if you do, you probably should reference most of your equations or activate line numbers.
@@ -176,7 +180,7 @@ and the derived files autonum.ins,
% If you want to try an example yourself, you can take this one, where only the first equation gets a number:
%
% \vspace{0.5em}
-% \noindent\cmd{\documentclass\{minimal\}}\\
+% \noindent\cmd{\documentclass\{article\}}\\
% \cmd{\usepackage\{autonum\}}\\
% \cmd{\begin\{document\}}\\
% \indent\cmd{\begin\{equation\}}\cmd{\label\{a\}}\\
@@ -194,7 +198,7 @@ and the derived files autonum.ins,
%
% \begin{macro}{align et al.}
% Instead of equation you may also use one of the following environments: \texttt{align}, \texttt{gather}, \texttt{multline}, \texttt{flalign}. ^^A, \texttt{aligned}, \texttt{gathered}. ^^A The \texttt{multlined} environment is patched, if it is available.
-% The label must be given after the equation but before the newline command, e.g.
+% The label should be given after the equation but before the newline command, e.g.
%
% \vspace{0.5em}
% \noindent\cmd{\begin\{align\}}\\
@@ -203,6 +207,25 @@ and the derived files autonum.ins,
% \cmd{\end\{align\}}\\
% \vspace{0.5em}
%
+% Providing the label at the beginning of an equation's line should work, too, but is less thoroughly tested. Please provide feedback, if you find a non-working constellation, which works if autonum is not loaded.
+% \end{macro}
+
+% \begin{macro}{split}
+% The split environment should work as expected with one exception. To get correct vertical spacing after a non-referenced split environment, which is embedded into another math environment, autonum must execute code inside of the split environment. To identify the environment, currently the label name is used, which is not available inside of the split environment, if the label is given after the end of the split environment, which is possible without autonum. So as an exception to the rule above, provide the label before the beginning of the split environment when using a split environment to be on the safe side. Providing it inside of the split environment seems to work currently, but is not guaranteed to work in the future. If the label is given too late, autonum prints an error to avoid accidently introducing a spacing or numbering problem. As an example, put the labels as following:
+%
+% \vspace{0.5em}
+% \noindent\cmd{\begin\{align\}}\\
+% \indent \cmd{\label\{firstLabel\}}\\
+% \indent \cmd{\begin\{split\}}\\
+% \indent\indent \texttt{a}\\
+% \indent\indent \texttt{\textbackslash\textbackslash}\\
+% \indent\indent \texttt{b}\\
+% \indent \cmd{\end\{split\}}\\
+% \indent \texttt{\textbackslash\textbackslash}\\
+% \indent \texttt{c}\cmd{\label\{secondLabel\}}\\
+% \cmd{\end\{align\}}\\
+% \vspace{0.5em}
+%
% \end{macro}
% \begin{macro}{\[ and \]}
@@ -219,36 +242,26 @@ and the derived files autonum.ins,
%\end{macro}
%
% \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 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.\\
-% Problem description: Generally, the autonum package is careful not to break other packages, but with autonum there are non-starred mathematical environment which do not increase the equation counter. This leads to the following warning in hyperref when more than one equation is used: "destination with the same identifier (name{equation.0.1}) has been already used, duplicate ignored". Additionally, the link anchors do not work correctly (with a reference followed by a labeled equation, there is a warning in tracing mode, too. Hyperref seems to increase \LaTeX's equation's counter (called \texttt{equation}) only if a equation is referenced. This counter may not be modified to avoid problems with Hyperref, as this would change the displayed equation number (and it does not work anyway). This problem is independent of cleveref. The problem might be solvable by modifying \cmd{\begin\{equation\}} or \cmd{\end\{equation\}}. Using \texttt{gather} instead of \texttt{equation} removes the warning, but hyperlinks still do not work.
-%
-% \subsection{Reference commands}
-% As default the \cmd{\ref} and cleveref's \cmd{\cref} commands are supported. Support for new reference commands can be added by executing\\
-% \cmd{\let}\cmd{\ref}\cmd{\NewReferenceCommand}.
+% \subsection{Load Order}\label{loadOrder}
+% 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. If a wrong order has been active, it might be necessary to delete the aux file manually to get rid of compile errors, which is generally a good debugging strategy if autonum is or was involved. The support of autonum without amsmath has been discontinued due to missing demand.
%
-% If you want to use the power of \cmd{\cref} without getting rid of the habit of writing \cmd{\ref}, you can just use add the following code to the preamble
+% \subsection{Hyperref}\label{hyperref}
+% The hyperref package must be loaded with the option \texttt{hypertexnames=false} to work when autonum is used, as in the following example
%
-% \vspace{0.5em}
-% \noindent\cmd{\AfterEndPreamble\{\%}\\
-% \indent\cmd{\let}\cmd{\ref}\cmd{\cref}\\
-% \texttt{\}\%}
+% \vspace{0.5em}\noindent
+% \cmd{\usepackage[hypertexnames=false]\{hyperref\}}\\
+% \cmd{\usepackage\{autonum\}}
% \vspace{0.5em}
%
-% If you also strive for maximum consistency and want to avoid accidently writing \cmd{\cref} or \cmd{\autoref}, you can instead add the following lines
+% Problem description: Generally, the autonum package is careful not to break other packages, but with autonum there are non-starred mathematical environment which do not increase the equation counter if they are not referenced. This leads to the following warning in hyperref when more than one equation is used: "destination with the same identifier (name{equation.0.1}) has been already used, duplicate ignored".
%
-% \vspace{0.5em}
-% \noindent\cmd{\AfterEndPreamble\{\%}\\
-% \indent\cmd{\let}\cmd{\ref}\cmd{\cref}\\
-% \indent\cmd{\undef\{}\cmd{\cref\}\%}\\
-% \indent\cmd{\undef\{}\cmd{\autoref\}\%}\\
-% \texttt{\}\%}
-% \vspace{0.5em}
+% Additionally, the link anchors do not work correctly (with a reference followed by a labeled equation, there is a warning in tracing mode, too. Hyperref seems to increase \LaTeX's equation's counter (called \texttt{equation}) only if a equation is referenced. This counter may not be modified to avoid problems with Hyperref, as this would change the displayed equation number (and it does not work anyway). This problem is independent of cleveref. The problem might be solvable by modifying \cmd{\begin\{equation\}} or \cmd{\end\{equation\}}. Using \texttt{gather} instead of \texttt{equation} removes the warning, but hyperlinks still do not work.
%
-% If the original \cmd{\ref} command should not be overwritten, you have the following choices. Please mind that these interfaces might change in the future. Please also mind the \cmd{\makeatletter} and \cmd{\makeatother} command before and after the commands, respectively.
+% So it's a mess and probably not worth the time, as \texttt{hypertexnames=false} solves all these problems.
+%
+% \subsection{Reference commands}\label{referenceCommands}
+% As default the \cmd{\ref} and cleveref's \cmd{\cref} commands are supported (the latter one only if the cleveref package is loaded).
+% If you want to add autonum support for other referencing commands, you have the following choices. Please mind that these interfaces might change in the future, as it's unclear what reference commands make sense beyond \cmd{\cref}. Please also mind the \cmd{\makeatletter} and \cmd{\makeatother} command before and after the commands, respectively.
%
%\begin{macro}{\autonum@generatePatchedReference}
% For normal reference commands expecting a single label name as an argument, you can use \cmd{\autonum@generatePatchedReference}\{\texttt{NewReferenceCommand}\}.
@@ -263,20 +276,49 @@ and the derived files autonum.ins,
% For reference commands expecting a general data structure containing label names as an argument, you can use\\
% \cmd{\autonum@generatePatchedReferenceGeneral}\{\texttt{NewReferenceCommand}\}\\
% \{\cmd{\SplitAndLoopMacro}\}.\\
-% The macro \cmd{\SplitAndLoopMacro} acts as a function expecting the to-be-called function as the first argument and the data structure as the second argument. It must call the function given in the first argument for each label name given in the data structure of the second argument. An example is the \cmd{\forcsvlist} macro from the etoolbox package, which is used to implement \cmd{\autonum@generatePatchedReferenceCSL}. Commands like the \cmd{\crefrange} command are not supported at the moment.
+% The macro \cmd{\SplitAndLoopMacro} acts as a function expecting the to-be-called function as the first argument and the data structure as the second argument. It must call the function given in the first argument for each label name given in the data structure of the second argument. An example is the \cmd{\forcsvlist} macro from the etoolbox package, which is used to implement \cmd{\autonum@generatePatchedReferenceCSL}.
+%\end{macro}
+%
+%\begin{macro}{\crefrange}
+% Range commands like the \cmd{\crefrange} command are not supported at the moment. It's not completely clear, if this is a good or a bad thing. Please contact the package author if you are interested in this feature.
%\end{macro}
%
+% Support for new reference command names can be added by executing\\
+% \cmd{\let}\cmd{\ref}\cmd{\NewReferenceCommand}.
+%
+% If the new reference command can have optional arguments, you should probably write instead\\
+% \cmd{\LetLtxMacro}\cmd{\ref}\cmd{\NewReferenceCommand}.
+%
+% If you want to use the power of \cmd{\cref} without getting rid of the habit of writing \cmd{\ref}, you can just add the following code to the preamble
+%
+% \vspace{0.5em}
+% \noindent\cmd{\AfterEndPreamble\{\%}\\
+% \indent\cmd{\let}\cmd{\ref}\cmd{\cref}\\
+% \texttt{\}\%}
+% \vspace{0.5em}
+%
+% If you also strive for maximum consistency and want to avoid accidently writing \cmd{\cref} or \cmd{\autoref}, you can instead add the following lines
+%
+% \vspace{0.5em}
+% \noindent\cmd{\AfterEndPreamble\{\%}\\
+% \indent\cmd{\let}\cmd{\ref}\cmd{\cref}\\
+% \indent\cmd{\undef\{}\cmd{\cref\}\%}\\
+% \indent\cmd{\undef\{}\cmd{\autoref\}\%}\\
+% \texttt{\}\%}
+% \vspace{0.5em}
+%
+%
% \section{Further Ideas}
% \begin{itemize}
% \item For equations with multiple lines, which have a width close to the linewidth, but whose width at the middle/end is not so large, the equation number should not be set below the equation but next to the equation as it is done if the equation is smaller.
-% \item Every label and every reference string could be transformed by \cmd{\pdfmdfivesum} if pdftex and inputenc with utf8 are used. This would enable support for all sort of special characters
% \item A similar approach could be used for figure and table environments to print a warning, if such an environment is not referenced. With the subfig package, the solution would be harder, as a figure or table may be unreferenced, if all subfloats are referenced. Similarly, a subfloat may be unreferenced, if its parent environment is referenced. So the warning should only be printed if an unreferenced parent environment either does not have any child environment or if there is an unreferenced child environment.
-% \item A warning could be printed, if another compile is necessary.
+% \item A warning could be printed, if another compile is necessary. Sometimes this is the case, but not always.
% \item A "*" could be used instead of a "+".
% \item If a reference is used before the label is defined, the reference information is saved in a variable and can be used later in the current run when processing the label. It does not have to be saved to the aux file. If a reference is used after defining the label, the reference information is saved in the aux file and can be used in the next run when processing the label. The information does not have to be saved into a variable, as a label must only be defined once and the definition has already happened. Unfortunately, this would make it necessary to distinguish between definitions in the current and in the last run, as otherwise this leads either to oscillation or to defining everything in the end (depending if csdefaux or csdefall is used in the not-defined case), which is probably not worth the effort.
-% \item The command \cmd{\(} could be an alias for \texttt{begin\{split\}} and \cmd{\)} could be an alias for \texttt{end\{split\}}, not, that this collied with the \href{http://tex.stackexchange.com/questions/510/are-and-preferable-to}{LaTeX math inline syntax}
+% \item The command \cmd{\(} could be an alias for \texttt{begin\{split\}} and \cmd{\)} could be an alias for \texttt{end\{split\}} inside of another math environment, as the \href{http://tex.stackexchange.com/questions/510/are-and-preferable-to}{LaTeX math inline syntax} can only occur outside of a math environment.
% \item This \href{http://tex.stackexchange.com/a/5652}{trick} might be handy
% \item The \cmd{\crefrange} might be supported. As this would require a lot of work it will only be done if multiple people show interest and there are really convincing real-world examples where using \cmd{\crefrange} is superior to using \cmd{\cref}. Patches are, of course, welcome, too.
+% \item This documentation should be vastly improved from someone who is actually good in writing documentations.
% \end{itemize}
%
% \section{Contributions}
@@ -339,6 +381,10 @@ and the derived files autonum.ins,
% \begin{itemize}
% \item found an error if an equation is used inside of a figure environment, which has not been fixed, yet
% \end{itemize}
+% \item Enno Nagel
+% \begin{itemize}
+% \item highlighted poor areas in the documentation, which (hopefully) have been improved
+% \end{itemize}
% \end{itemize}
%
%
@@ -385,19 +431,19 @@ and the derived files autonum.ins,
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\csLetLtxMacro}
+%\begin{macro}{\CsLetLtxMacro}
% This command simply combines the functionality from \cmd{\cslet} and \cmd{\LetLtxMacro}. This command would be a candidate for inclusion into letltxmacro or possibly etoolbox.
% \begin{macrocode}
-\newrobustcmd{\csLetLtxMacro}[2]{%
+\newrobustcmd{\CsLetLtxMacro}[2]{%
\expandafter\LetLtxMacro\csname#1\endcsname#2%
}
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\LetcsLtxMacro}
+%\begin{macro}{\LetCsLtxMacro}
% This command simply combines the functionality from \cmd{\letcs} and \cmd{\LetLtxMacro}. This command would be a candidate for inclusion into letltxmacro or possibly etoolbox.
% \begin{macrocode}
-\newrobustcmd{\LetcsLtxMacro}[2]{%
+\newrobustcmd{\LetCsLtxMacro}[2]{%
\ifcsdef{#2}{%
\expandafter\LetLtxMacro\expandafter#1\csname#2\endcsname
}{%
@@ -407,12 +453,47 @@ and the derived files autonum.ins,
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\csLetcsLtxMacro}
+%\begin{macro}{\CsLetCsLtxMacro}
% This command simply combines the functionality from \cmd{\csletcs} and \cmd{\LetLtxMacro}. This command would be a candidate for inclusion into letltxmacro or possibly etoolbox.
% \begin{macrocode}
-\newrobustcmd*{\csLetcsLtxMacro}[2]{%
+\newrobustcmd*{\CsLetCsLtxMacro}[2]{%
\ifcsdef{#2}{%
- \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname
+ \expandafter\LetLtxMacro\csname#1\expandafter\endcsname\csname#2\endcsname
+ }{%
+ \csundef{#1}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+
+%\begin{macro}{\GlobalCsLetLtxMacro}
+% This command simply combines the functionality from \cmd{\cslet} and \cmd{\GlobalLetLtxMacro}. This command would be a candidate for inclusion into letltxmacro or possibly etoolbox.
+% \begin{macrocode}
+\newrobustcmd{\GlobalCsLetLtxMacro}[2]{%
+ \expandafter\GlobalLetLtxMacro\csname#1\endcsname#2%
+}
+% \end{macrocode}
+%\end{macro}
+
+%\begin{macro}{\GlobalLetCsLtxMacro}
+% This command simply combines the functionality from \cmd{\letcs} and \cmd{\GlobalLetLtxMacro}. This command would be a candidate for inclusion into letltxmacro or possibly etoolbox.
+% \begin{macrocode}
+\newrobustcmd{\GlobalLetCsLtxMacro}[2]{%
+ \ifcsdef{#2}{%
+ \expandafter\GlobalLetLtxMacro\expandafter#1\csname#2\endcsname
+ }{%
+ \undef#1%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+
+%\begin{macro}{\GlobalCsLetCsLtxMacro}
+% This command simply combines the functionality from \cmd{\csletcs} and \cmd{\GlobalLetLtxMacro}. This command would be a candidate for inclusion into letltxmacro or possibly etoolbox.
+% \begin{macrocode}
+\newrobustcmd*{\GlobalCsLetCsLtxMacro}[2]{%
+ \ifcsdef{#2}{%
+ \expandafter\GlobalLetLtxMacro\csname#1\expandafter\endcsname\csname#2\endcsname
}{%
\csundef{#1}%
}%
@@ -444,6 +525,33 @@ and the derived files autonum.ins,
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\newcommandsequence}
+% This command combines the macro \cmd{\csdef} from the package etoolbox and \LaTeX's \cmd{\newcommand} macro. This command would be a candidate for inclusion into etoolbox or into LaTeX2e, although the former is much more likely.
+% The interface of \cmd{\newcommand} et al. is "moom" when using xparse syntax. Yet, \cmd{\newcommand} itself provides "ommm..." as interface, i.e. is not capable of defining itself. However, as all the argument types "m" and "o" are supported, combining multiple \cmd{\newcommand}s which read (curry) only part of the arguments are able to emulate the interface. Even simpler is the use of currying, as besides the first argument, everything is identical in \cmd{\newcommand} and \cmd{\newcommandsequence}. So the first arguments is read, and \cmd{\newcommand} is called to read the changed first argument and the rest.
+% \begin{macrocode}
+\def\newcommandsequence#1{%
+ \expandafter\newcommand\csname #1\endcsname
+}
+% Tests:
+% \newcommandsequence{testcommand}{This is a test}%
+% \testcommand
+% \newcommandsequence{testcommandtwo}[2]{This is a test with #1 and #2}%
+% \testcommandtwo{one}{two}%
+% \newcommandsequence{testcommandtwooptional}[2][three]{This is a test with #1 and #2}%
+% \testcommandtwooptional[one]{two}%
+% \testcommandtwooptional{two}%
+% \end{macrocode}
+%\end{macro}
+
+%\begin{macro}{\renewcommandsequence}
+% This command combines the macro \cmd{\csdef} from the package etoolbox and \LaTeX's \cmd{\renewcommand} macro. This command would be a candidate for inclusion into etoolbox or into LaTeX2e, although the former is much more likely.
+% \begin{macrocode}
+\def\renewcommandsequence#1{%
+ \expandafter\renewcommand\csname #1\endcsname
+}
+% \end{macrocode}
+%\end{macro}
+
%\begin{macro}{\ifstar}
% This command is similar to the \cmd{\@ifstar} command from LaTeX, but it absorbs a token instead of peeking ahead. This command would be a candidate for inclusion into etoolbox.
% \begin{macrocode}
@@ -463,15 +571,45 @@ and the derived files autonum.ins,
%\end{macro}
%\begin{macro}{\autonum@debug}
-% Activate and deactivate debugging by commenting and uncommenting the folowing code.
+% Activate and deactivate debugging by commenting and uncommenting the following code.
% \begin{macrocode}
-% \def\autonum@debug#1{%
-% \PackageWarning{autonum}{#1}%
-% }
+\def\autonum@debug#1{%
+ \PackageWarning{autonum}{#1}%
+}
% \def\autonum@debug#1{}%
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\meaningx}
+% Acts like \cmd{\meaning}, but if the given macro is defined via \cmd{\newcommand} or similar and has an optional argument, \cmd{\meaning} does always show something like \cmd{\@protected@testopt} \cmd{\command} \cmd{\\command}, which is not very useful. That is why \cmd{\meaningx} outputs the meaning of \cmd{\\command} instead. \cmd{\meaningx} is expandable (see "texdoc etex" and \href{http://tex.stackexchange.com/a/66168}{this information about expandability} for more details).
+% \begin{macrocode}
+\def\meaningx#1{%
+ \expandafter\ifcsname\string #1\endcsname
+ \expandafter\meaning\csname\string #1\endcsname
+ \else
+ \meaning#1%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+
+%\begin{macro}{\autonum@debug}
+% Print the \cmd{\meaningx} of the given macro.
+% \begin{macrocode}
+\def\autonum@debugMacro#1{%
+% \end{macrocode}
+ % Please mind, that ppdflatex distorts the messages printed by this macro.
+% \begin{macrocode}
+ \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
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+
% This is needed to not get overwritten by other packages. The package autonum only overwrites some commands whose name start with \cmd{\autonum}. Other commands are only patched, so the currently valid command gets called, too. So although not very polite, this behavior seems reasonable.
% \begin{macrocode}
\AtBeginDocument{%
@@ -483,7 +621,7 @@ and the derived files autonum.ins,
%^^A \autonum@patchBlockEnvironment{multlined}%
%^^A }{}%
% \end{macrocode}
- % If align is redefined before flalign or alignat, autonum.dtx does not build anymore. The error reason is unknown. As the error disappears when align is redefined after both, there is no motivation in finding the underlying problem.
+ % If align is redefined before flalign or alignat, autonum.dtx does not build anymore. The reason of the error is unknown. As the error disappears when align is redefined after both, there is no motivation in finding the underlying problem.
% \begin{macrocode}
\newlength{\autonum@environmentWidth}%
% \forcsvlist{\autonum@patchParametrizedFullEnvironment}{alignat,figure}%
@@ -512,22 +650,29 @@ and the derived files autonum.ins,
% \end{macrocode}
%\begin{macro}{\autonum@patchEnvironment}
-% Patch a mathematical environment to automatically show an equation's number, if a part is referenced and do not use a number otherwise. For completeness, the original definition (numbering every part of an displayed equation structure) is made available using a different name. Do not redefine environment before getting the original label and newline commands. Use center as the default parameter, as a center environment is a neutral element regarding the subcommands' definitions.
+% Patch a mathematical environment to automatically show an equation's number, if a part is referenced and do not use a number otherwise. For completeness, the original definition (numbering every part of an displayed equation structure) is made available using a different name. Do not redefine the environments before getting the original label and newline commands. Use center as the default parameter, as a center environment is a neutral element regarding the subcommands' definitions.
% \begin{macrocode}
% \def\autonum@patchEnvironment#1{
\def\autonum@patchFullEnvironment#1{%
+% \autonum@debug{patchFullEnvironment; 1=#1}%
\autonum@saveEnvironmentSubcommands{#1}{center}{}%
\autonum@patchEnvironmentHelper{#1}{0}%
}
\def\autonum@patchParametrizedFullEnvironment#1{%
+% \autonum@debug{patchParametrizedFullEnvironment; 1=#1}%
\autonum@saveEnvironmentSubcommands{#1}{center}{1}%
\autonum@patchEnvironmentHelper{#1}{1}%
}
\def\autonum@patchBlockEnvironment#1{%
- \autonum@saveEnvironmentSubcommands{#1}{equation}{}%
- \autonum@patchEnvironmentHelper{#1}{0}%
+% \autonum@debug{patchBlockEnvironment; 1=#1}%
+% \end{macrocode}
+% There is no need to patch the newline or label commands like for the other environments, as they already have been patched in those outer math environments. So the environment subcommands do not have to be saved, too.
+% \begin{macrocode}
+ \autonum@renameEnvironment{#1}{0}%
+ \autonum@changeEnvironment{#1}{0}%
}
\def\autonum@patchEnvironmentHelper#1#2{%
+% \autonum@debug{patchEnvironmentHelper; 1=#1; 2=#2}%
\autonum@renameEnvironment{#1}{#2}%
\autonum@changeEnvironment{#1}{#2}%
\autonum@generatePatchedLabel{#1}%
@@ -537,9 +682,10 @@ and the derived files autonum.ins,
%\end{macro}
%\begin{macro}{\autonum@saveEnvironmentSubcommands}
-% This code is to save the newline code used in a mathematic display environment so that it can be used later. This is necessary, as saving it in the instance of the environment, where it should be used, does not work. Allow for two arguments, to enable putting the alignment building blocks into an equation environment (see amsmath documentation). The third argument is needed for environments which have arguments themself.
+% This macro saves the newline code used in a mathematic display environment so that it can be used later. This is necessary, as saving it in the instance of the environment, where it should be used, does not work. Allow for two arguments, to enable putting the alignment building blocks into an equation environment (see amsmath documentation). As a neutral element, the center environment can be used. The third argument is needed for environments which have arguments themself.
% \begin{macrocode}
\def\autonum@saveEnvironmentSubcommands#1#2#3{%
+% \autonum@debug{In saveEnvironmentSubcommands; 1=#1; 2=#2; 3=#3}%
\begin{textblock}{1}[1,1](0,0)%
\begin{#2}%
\begin{#1}#3%
@@ -549,23 +695,19 @@ and the derived files autonum.ins,
\deflength{\autonum@environmentWidth}{\linewidth-\multlinegap-\multlinegap}%
\hspace{\autonum@environmentWidth}%
% \end{macrocode}
- % Using global here is necessary to get the information out of the environment.
+ % Using global here is necessary to get the information out of the environment. As \cmd{\\} has an optional argument, you would think, that \cmd{\GlobalCsLetLtxMacro} is correct, while \cmd{\global}\cmd{\cslet} is incorrect (\href{http://tex.stackexchange.com/a/29837}{see here}). But although \cmd{\\} has an optional argument, it does not use \cmd{\newcommand} (see the definintion of \cmd{\Let@} in amsmath.sty for the details), but plain \cmd{\TeX}. Although using LetLtxMacro \href{http://tex.stackexchange.com/a/88007}{should never no harm}, it results in errors here, so it isn't used.
% \begin{macrocode}
\global\cslet{autonum@newline#1}\\%
% \end{macrocode}
% Use \cmd{\notag} to not increase the equation counter (otherwise the first equation shown would not have number 1).
% \begin{macrocode}
- \notag%
+ \notag
% \end{macrocode}
% For multline, check, that autonum's label command is undefined, because this means, that the first pass (measuring pass) of the environment is active. This is to avoid getting the \cmd{\label} command of the second pass (displaying pass), where the \cmd{\label} command is set to the \href{http://tex.stackexchange.com/a/59088/7323}{null definition}. The multline environment seems to need the first pass, whereas other environments seem to need the second pass, so adapt to the environments.
% \begin{macrocode}
\ifboolexpr{not test {\ifstrequal{#1}{multline}} or test {\ifcsundef{autonum@label#1}}}{%
- \global\cslet{autonum@label#1}{\label}%
- }%
-% \end{macrocode}
- % Use \cmd{\notag} again, to avoid an error with the gathered environment. WTF?
-% \begin{macrocode}
- \notag%
+ \GlobalCsLetLtxMacro{autonum@label#1}\label
+ }{}%
\end{#1}%
\end{#2}%
\end{textblock}%
@@ -592,8 +734,9 @@ and the derived files autonum.ins,
% Now change the environment. This command only supports displayed equation structures and is not suited for other environments (as e.g. figures). The second argument contains the number of arguments the redefined environment has.
% \begin{macrocode}
\def\autonum@changeEnvironment#1#2{%
+% \autonum@debug{changeEnvironment; 1=#1; 2=#2}%
% \end{macrocode}
- % Although Amsmath's environment is executed twice (for measuring and for painting), the content here is executed only once. The following if is only needed to distinguish between environments without (e.g. equation) and with one parameter (e.g. alignat).
+ % Although Amsmath's environment is executed twice (for measuring and for painting), the content here is executed only once. The following if is only needed to distinguish between environments without (e.g. equation) and with one parameter (e.g. alignat).
% \begin{macrocode}
\ifnum #2=0%
\renewenvironment{#1}{%
@@ -609,7 +752,7 @@ and the derived files autonum.ins,
}%
\fi
% \end{macrocode}
- % Delete the starred versions of the environment, as they sometimes lead to strange errors a long time after using the starred version. By deleting it, the error occurs at the right place.
+ % Delete the starred versions of the environment, as they sometimes lead to strange errors a long time after using the starred version. By deleting it, the error occurs at the right place.
% \begin{macrocode}
\global\csundef{#1*}%
\global\csundef{end#1*}%
@@ -621,12 +764,19 @@ and the derived files autonum.ins,
% Start the changed environment.
% \begin{macrocode}
\def\autonum@startChangeEnvironment#1#2{%
+% \autonum@debug{startChangeEnvironment; 1=#1; 2=#2}%
% \end{macrocode}
% Prepare the label and the newline commands and begin the displayed equation environment.
% \begin{macrocode}
- \autonum@saveSubcommands
+ \ifstrequal{#1}{split}{%
+ }{%
+ \autonum@saveSubcommands
+ }%
\csuse{autonum@#1Old}#2%
- \autonum@patchSubcommands{#1}%
+ \ifstrequal{#1}{split}{%
+ }{%
+ \autonum@patchSubcommands{#1}%
+ }%
}
% \end{macrocode}
%\end{macro}
@@ -635,12 +785,32 @@ and the derived files autonum.ins,
% Close the changed environment.
% \begin{macrocode}
\def\autonum@endChangeEnvironment#1{%
+% \autonum@debug{endChangeEnvironment; 1=#1}%
% \end{macrocode}
- % Possibly hide the number of the last equation in the displayed equation environment, end the latter one and restore the subcommands.
+ % Possibly hide the number of the last equation in the displayed equation environment and end the latter one.
% \begin{macrocode}
\autonum@possiblyHideNumber
\csuse{autonum@end#1Old}%
- \autonum@restoreSubcommands
+% \end{macrocode}
+ % Restore the subcommands. Do not restore the subcommands for the split environment, as \cmd{autonum@startChangeEnvironment} is not called (even if set) for the split environment due to yet unknown reasons. The hypothesis is, that this is as the split environment is inside of another environment (equation). Thus, \cmd{\renewenvironment} is called inside a group. As \cmd{\renewenvironment} is always local (see http://tex.stackexchange.com/q/51733), the redefinition of the split environment does not work. As the split subcommands are currently neither saved nor patched, it is not only unnecessary, but really harmful to restore the subcommands. Doing so breaks splits together with other material in an align environment. This code should be changed after the root problem has been fixed. Neither delete the label, as it might be defined before the split environment and is used after its end.
+% \begin{macrocode}
+ \ifstrequal{#1}{split}{%
+% \end{macrocode}
+ % If a split environment is inside an align environment, the \cmd{\notag} must be set inside of the split environment to get correct vertical spacing after the environment if the line is so long, that the equation number would be placed below the equation and if the equation is not referenced. In order to set the \cmd{\notag} it must be known of the equation is referenced or not. With the current logic, the label is used to identify an equation. If the label is only given after the split (but before the line of the align ends), this is impossible, thus, the label has to be given before the end of the split environment. As split provides not numbering, it's best to provide the label before the beginning of the split environment. To save users, redefine \cmd{\label} to result in an error if the \cmd{\label} is called too late. In the future, this could be changed if equations have another unique identifier like a number. The \cmd{\label} can be overwritten (but mind the optional argument, which must be supported), as the split TeX-group will end directly after this macro. In order to be effective, it must be smuggled outside, which \cmd{\aftergroup@def} from etextools takes care of. Outside, it will be removed automatically, as soon as the TeX-group ends, e.g. if the line or the environment ends.
+% \begin{macrocode}
+ \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
+ }%
}
% \end{macrocode}
%\end{macro}
@@ -649,8 +819,8 @@ and the derived files autonum.ins,
% Save the current newline and label commands.
% \begin{macrocode}
\def\autonum@saveSubcommands{%
- \let\autonum@labelNormal\label%
- \let\autonum@newlineNormal\\%
+ \LetLtxMacro\autonum@labelNormal\label
+ \LetLtxMacro\autonum@newlineNormal\\%
}
% \end{macrocode}
%\end{macro}
@@ -660,16 +830,15 @@ and the derived files autonum.ins,
% \begin{macrocode}
\def\autonum@patchSubcommands#1{%
% \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.
+ % Activate the patched label command and support an optional argument for the \cmd{\label} command.
% \begin{macrocode}
-% \global\letcs{\label}{autonum@patched#1Label}%
- \expandafter\GlobalLetLtxMacro\expandafter\label\csname autonum@patched#1Label\endcsname
+ \GlobalLetCsLtxMacro\label{autonum@patched#1Label}%
% \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}
\ifstrequal{#1}{multline}{%
}{%
- \global\letcs{\\}{autonum@patched#1Newline}%
+ \GlobalLetCsLtxMacro\\{autonum@patched#1Newline}%
}%
}
% \end{macrocode}
@@ -679,8 +848,8 @@ 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{%
- \GlobalLetLtxMacro{\label}{\autonum@labelNormal}%
- \global\let\\\autonum@newlineNormal%
+ \GlobalLetLtxMacro\label\autonum@labelNormal
+ \GlobalLetLtxMacro\\\autonum@newlineNormal
}
% \end{macrocode}
%\end{macro}
@@ -692,14 +861,29 @@ and the derived files autonum.ins,
% \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]{%
+ \newcommandsequence{autonum@patched#1Label}[2][]{%
% \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}
\ifdef{\autonum@currentLabel}{%
- \PackageError{autonum}{Two succeeding \string\label's detected}{Did you forget a \string\\?}%
+% \end{macrocode}
+ % As \cmd{\autonum@currentLabel} can be a global macro, there was a false positive error with math environments which are \href{http://tex.stackexchange.com/a/59088/7323}{executed twice}. To avoid this false positives, only check during the first run of these environments.
+% \begin{macrocode}
+ \ifmeasuring@
+ \PackageError{autonum}{Two succeeding \string\label's detected}{Did you forget a \string\\?}%
+ \fi
}{%
- \def\autonum@currentLabel{##2}%
+% \end{macrocode}
+ % Define the label globally, as otherwise it gets deleted inside of an align environment if it is defined before a split environment and should be applied after the split environment. Thus, it is globally deleted when ending a math environment or a line in such an environment (always with the exception of the split environment).
+% \begin{macrocode}
+ \ifboolexpr{test {\ifstrequal{#1}{flalign}} or test {\ifstrequal{#1}{alignat}}}{%
+% \end{macrocode}
+ % Do not define the label globally for flalign and alignat environment, as it results in warnings. According to the amsmath documentation it's uncommon to use split inside of both environments, so this should be an accectable compromise. Deleting globally when only defining locally does not seem to be a problem.
+% \begin{macrocode}
+ \def\autonum@currentLabel{##2}%
+ }{%
+ \global\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.
@@ -710,9 +894,9 @@ and the derived files autonum.ins,
% \begin{macrocode}
\let\df@label\@empty%
% \end{macrocode}
- % If the following test is true, \cmd{\label} has been called without optional argument, as the default has been used internally.
+ % If the following test is true, \cmd{\label} has been called without optional argument, as the default has been used internally. This test is from \href{http://tex.stackexchange.com/a/53091}{egreg}.
% \begin{macrocode}
- \ifx\@empty##1\relax
+ \if\relax\detokenize{##1}\relax
\csuse{autonum@label#1}{##2}%
\else
\csuse{autonum@label#1}[##1]{##2}%
@@ -727,10 +911,18 @@ and the derived files autonum.ins,
% This command generates patched newline commands for displayed math environments, so that they can simply be activated when needed.
% \begin{macrocode}
\def\autonum@generatePatchedNewline#1{%
- \csdef{autonum@patched#1Newline}{%
+% \end{macrocode}
+% The \cmd{\\} command has an optional argument, e.g. in an align environment, to put some extra vertical space between two lines. Thus, the patched newline command must currectly cope with an optional argument, too, if it has been given.
+% \begin{macrocode}
+ \newcommandsequence{autonum@patched#1Newline}[1][]{%
\autonum@possiblyHideNumber
- \csuse{autonum@newline#1}%
- }
+ \if\relax\detokenize{##1}\relax
+ \csuse{autonum@newline#1}%
+ \else
+ \csuse{autonum@newline#1}[##1]%
+ \fi
+ \global\undef\autonum@currentLabel
+ }%
}
% \end{macrocode}
%\end{macro}
@@ -740,15 +932,15 @@ and the derived files autonum.ins,
% \begin{macrocode}
\def\autonum@possiblyHideNumber{
\ifdef{\autonum@currentLabel}{%
- \ifcsedef{autonum@\csuse{autonum@currentLabel}Referenced}{%
+ \ifcsedef{autonum@\autonum@currentLabel Referenced}{%
}{%
- \notag%
+ \notag
}%
% \end{macrocode}
% The current label does not have to be cleaned, as every line is a separate cell \href{http://tex.stackexchange.com/q/58190}{defining a local group} in an displayed math environment.
% \begin{macrocode}
}{%
- \notag%
+ \notag
}%
}
% \end{macrocode}
@@ -794,9 +986,9 @@ and the derived files autonum.ins,
% \begin{macrocode}
\def\autonum@generatePatchedReferenceGeneral#1#2{%
% \end{macrocode}
- % There might be reference commands, which have an optional argument. To support these, use \cmd{\csLetcsLtxMacro} instead of \cmd{\csletcs}.
+ % There might be reference commands, which have an optional argument. To support these, use \cmd{\CsLetCsLtxMacro} instead of \cmd{\csletcs}.
% \begin{macrocode}
- \csLetcsLtxMacro{autonum@reference#1Old}{#1}%
+ \CsLetCsLtxMacro{autonum@reference#1Old}{#1}%
% \end{macrocode}
% Do not absorb any arguments, yet, because every further processing must be protected and this is the simplest way to achieve protected processing. Something like using \cmd{\@ifstar} inside of a moving argument would otherwise be very hard or impossible. Unfortunately, a simple approach like \cmd{\csDeclareDocumentCommand\{\#1\}\{sm\}} does produce a not yet understood infinite recursion.
% \begin{macrocode}
@@ -897,7 +1089,7 @@ and the derived files autonum.ins,
% \end{macrocode}
% Use global as this is in the middle of the first local group of a math environment.
% \begin{macrocode}
- \global\let\autonum@patchedNewline\\%
+ \GlobalLetLtxMacro\autonum@patchedNewline\\%
% \end{macrocode}
% Set the multipleLines variable if a newline is used. Do not use the newline for equations, as this results in "There's no line here to end" errors. This is ok, as if there is a newline in an environment, which is currently an equation, it is wrong anyway and should be set as an align environment. For that it is enough to set the multipleLines variable.
% \begin{macrocode}
@@ -915,7 +1107,7 @@ and the derived files autonum.ins,
% Set the environment's content and reset the newline command.
% \begin{macrocode}
#2%
- \global\let\\\autonum@patchedNewline%
+ \GlobalLetLtxMacro\\\autonum@patchedNewline
% \end{macrocode}
% Store information if the current math environment. The roman number is used, as there might be no label and if there is one, it might not be available at the beginning of the environment. Delete the multipleLines variable, to avoid influencing the next \cmd{\[}-\cmd{\]}-environment, as the variable must be global.
% \begin{macrocode}
diff --git a/Master/texmf-dist/source/latex/autonum/autonum.ins b/Master/texmf-dist/source/latex/autonum/autonum.ins
index 6c7bd935fea..a73a28c50aa 100644
--- a/Master/texmf-dist/source/latex/autonum/autonum.ins
+++ b/Master/texmf-dist/source/latex/autonum/autonum.ins
@@ -26,7 +26,7 @@ See http://www.latex-project.org/lppl.txt
\endpreamble
\postamble
-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
@@ -50,8 +50,9 @@ and the derived files autonum.ins,
}
\endbatchfile
+
%%
-%% 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
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
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 1acf395a3dd..fec0a86ad86 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -638,6 +638,7 @@ my @TLP_no_check = (
"patgen", # binary
"pdftex", # binary
"pdftools", # binary
+ "pl", # gust, requested 19dec14
"pdfwin", # not on ctan, too old to worry about
"plain", # mostly our .ini files, plus well-known plain.tex
"powerdot", # stale generated files on ctan
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index ad308f58638..982a1da4052 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -782,7 +782,8 @@ chomp ($Build = `cd $Master/../Build/source && pwd`);
'pigpen', "&MAKEflatten",
'pinlabel', "&MAKEnosymlinks",
'pitthesis', "die 'skipping, noinfo license",
- 'pl', "die 'skipping, not ready, cf. cc-pl, sorry",
+# 'pl', "&MAKEflatten",
+ 'pl', "die 'skipping, many files missing from ctan",
'plain', "die 'skipping, just plain.tex, rest in knuth-lib",
'pl-qx', "&MAKEplqx",
'pointRuler', "die 'skipping, requires compilation'",