summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/autonum
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-04-29 23:26:49 +0000
committerKarl Berry <karl@freefriends.org>2013-04-29 23:26:49 +0000
commit04a0be28296aa8b6e73b84223f3d714af8823573 (patch)
tree06168acf581f665e5d4a1a2edd8b9ddb628c7e81 /Master/texmf-dist/source/latex/autonum
parentfba99232ec114a7de58113b5cc8d8a4db127cdac (diff)
autonum (29apr13)
git-svn-id: svn://tug.org/texlive/trunk@30163 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/autonum')
-rw-r--r--Master/texmf-dist/source/latex/autonum/autonum.dtx71
-rw-r--r--Master/texmf-dist/source/latex/autonum/autonum.ins1
2 files changed, 58 insertions, 14 deletions
diff --git a/Master/texmf-dist/source/latex/autonum/autonum.dtx b/Master/texmf-dist/source/latex/autonum/autonum.dtx
index 6bde0a0669b..531ae202394 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/04/20 v0.3.3 autonum LaTeX package]
+\ProvidesPackage{autonum}[2013/04/28 v0.3.4 autonum LaTeX package]
\PassOptionsToPackage{hypertexnames=false}{hyperref}
\RequirePackage{etoolbox}
\RequirePackage{amsmath}
@@ -130,6 +130,7 @@ and the derived files autonum.ins,
%\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.}
%
% \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.
@@ -186,8 +187,20 @@ and the derived files autonum.ins,
% To get the correct references up to three compilation runs are necessary when the autonum package is used (as always in \TeX\ this cannot be guaranteed, so in rare cases even that is not enough). This is one additional run compared to the default referencing mode, as one run is needed to check if an equation is used. This is probably not avoidable, as the information which equation should have a number is simply not always available in the first run while layouting the equation. Thus, the equation's number can change in the second run. For the reference command, this information is only stable in the third run, as the equations influence each other.
%\end{macro}
%
-% \begin{macro}{\[ et al.}
+% \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.
+%
+% \vspace{0.5em}
+% \noindent\cmd{\begin\{align\}}\\
+% \indent \texttt{a}\cmd{\label\{firstLabel\}}\texttt{\textbackslash\textbackslash}\\
+% \indent \texttt{b}\cmd{\label\{secondLabel\}}\\
+% \cmd{\end\{align\}}\\
+% \vspace{0.5em}
+%
+% \end{macro}
+
+% \begin{macro}{\[ and \]}
% As the commands \cmd{\[} and \cmd{\]} are useless when using autonum, they are redefined to be an alias of \texttt{begin\{equation\}} and \texttt{end\{equation\}}, respectively. ^^A, instead either the \texttt{equation} or the \texttt{align} environments are used, depending on the number of lines in the equation.
% Without adding labels or referencing added labels, the new \cmd{\[}-\cmd{\]}-environment behaves like the old one. ^^A if the equation is only one line. The new definition inherits all the multi-line and alignment capabilities from align and thus is recommended as default while writing. If the environment's content has only one line, the equation environment is used, which has a \href{http://tex.stackexchange.com/questions/321/align-vs-equation}{smaller vertical space} for short lines above the environment compared to align.
% \end{macro}
@@ -264,6 +277,7 @@ and the derived files autonum.ins,
% \item David Carlisle
% \begin{itemize}
% \item explained that amsmath environments \href{http://tex.stackexchange.com/a/59088/7323}{are executed twice} what lead to the support of the amsmath environments
+% \item created the \cmd{\vanishprotect} macro what avoided errors after the deactivation of the package
% \end{itemize}
% \item Fg Nu
% \begin{itemize}
@@ -325,7 +339,11 @@ and the derived files autonum.ins,
% The expandafter commands are used to first expand the \cmd{\csname}-\cmd{\endcsname}. Then there is a command definition left, where the command and its replacement (which can also be a command) are protected by \cmd{\string} to create the command in the next run (when the aux file is read) and not in the current run (when the aux file is written).
% \begin{macrocode}
\protected@write\@mainaux{}{%
- \csxdef{\detokenize{#1}}{#2}%
+% \end{macrocode}
+ % The commented and the uncommented lines should do the same. The longer variant has the advantage, that there is no error the first run after the deactivation of the autonum package, as \cmd{\xdef}, read from the aux file, is always a known command, whereas \cmd{\csxdef} might not be known in that case, as with the deactivation of autonum it might happen, that etoolbox is not loaded anymore, too.
+% \begin{macrocode}
+% \csxdef{\detokenize{#1}}{#2}%
+ \expandafter\string\expandafter\xdef\expandafter\string\csname #1\endcsname{#2}%
}%
}
% \end{macrocode}
@@ -341,6 +359,19 @@ and the derived files autonum.ins,
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\vanishprotect}
+% This \href{http://tex.stackexchange.com/a/110782}{command} encapsulates content to not appear in the table-of-contents or similar lists. The content is shown in normal text (captions or section headings and so on). The macro uses one arguments in spite of its parameterless definition.
+% \begin{macrocode}
+\def\vanishprotect{%
+ \ifx\protect\@typeset@protect
+ \expandafter\@firstofone
+ \else
+ \expandafter\@gobble
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+
%\begin{macro}{\ifcsedef}
% This command is similar to the \cmd{\ifcsdef} test from the package etoolbox, but the command sequence gets fully expanded before it is evaluated.. This command would be a candidate for inclusion into etoolbox.
% \begin{macrocode}
@@ -636,26 +667,38 @@ and the derived files autonum.ins,
% \end{macrocode}
%\end{macro}
+
+%\begin{macro}{\skipInPDFTOC}
+% The content of the macro is never written to the PDF's table of content (TOC). This is especially useful for macros which should only modify the normal PDF's content.
+% \begin{macrocode}
+\def\skipInPDFTOC#1{%
+% \end{macrocode}
+ % If hyperref is loaded (i.e. \cmd{\texorpdfstring} is defined), take care to only write into the document. If it is not loaded, this is the default behavior.
+% \begin{macrocode}
+ \ifdef{\texorpdfstring}{%
+ \texorpdfstring{#1}{}%
+ }{%
+ #1%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+
%\begin{macro}{\autonum@generatePatchedReferenceGeneral}
% This command can patch arbitrary reference commands. The patch logic can be different to patching the label command, as the references have to be patched only once, so optimizing for speed is counter-productive.
% \begin{macrocode}
\def\autonum@generatePatchedReferenceGeneral#1#2{%
\csletcs{autonum@reference#1Old}{#1}%
% \end{macrocode}
- % Mark label as referenced and call the old reference command. If hyperref is loaded (i.e. \cmd{\texorpdfstring} is defined), take care to not write in the pdf string, as this would lead to a write inside of a write when, e.g., calling \cmd{\cref} inside of a section command.
+ % Mark label as referenced and call the old reference command. Do not write in the PDF's TOC, as this would lead to a write inside of a write when, e.g., calling \cmd{\cref} inside of a section command. Also use \cmd{\vanishprotect} to avoid writing \cmd{\autonum@markLabelAsReferenced} into the aux file or similar files. This avoids errors after deactivating the autonum package.
% \begin{macrocode}
- \ifdef{\texorpdfstring}{%
- \csdef{#1}##1{%
- \texorpdfstring{%
+ \csdef{#1}##1{%
+ \skipInPDFTOC{%
+ \vanishprotect{%
\csuse{#2}{\protect\autonum@markLabelAsReferenced}{##1}%
- }{}%
- \csuse{autonum@reference#1Old}{##1}%
- }%
- }{%
- \csdef{#1}##1{%
- \csuse{#2}{\protect\autonum@markLabelAsReferenced}{##1}%
- \csuse{autonum@reference#1Old}{##1}%
+ }%
}%
+ \csuse{autonum@reference#1Old}{##1}%
}%
}
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/autonum/autonum.ins b/Master/texmf-dist/source/latex/autonum/autonum.ins
index d90907ba0e0..2029099e63f 100644
--- a/Master/texmf-dist/source/latex/autonum/autonum.ins
+++ b/Master/texmf-dist/source/latex/autonum/autonum.ins
@@ -49,6 +49,7 @@ and the derived files autonum.ins,
\file{autonum.sty}{\from{autonum.dtx}{package}}
}
\endbatchfile
+
%%
%% Copyright (C) 2012 by Patrick Häcker <pat_h@web.de>
%%