diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/autonum/autonum.pdf | bin | 273282 -> 278034 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/autonum/test-autonum.pdf | bin | 87917 -> 88845 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/autonum/test-autonum.tex | 9 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/autonum/autonum.dtx | 122 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/autonum/autonum.ins | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/autonum/autonum.sty | 52 |
6 files changed, 166 insertions, 21 deletions
diff --git a/Master/texmf-dist/doc/latex/autonum/autonum.pdf b/Master/texmf-dist/doc/latex/autonum/autonum.pdf Binary files differindex 713e56faa1f..58a3642caa1 100644 --- a/Master/texmf-dist/doc/latex/autonum/autonum.pdf +++ b/Master/texmf-dist/doc/latex/autonum/autonum.pdf diff --git a/Master/texmf-dist/doc/latex/autonum/test-autonum.pdf b/Master/texmf-dist/doc/latex/autonum/test-autonum.pdf Binary files differindex fe61092d9f7..1949e6499c3 100644 --- a/Master/texmf-dist/doc/latex/autonum/test-autonum.pdf +++ b/Master/texmf-dist/doc/latex/autonum/test-autonum.pdf diff --git a/Master/texmf-dist/doc/latex/autonum/test-autonum.tex b/Master/texmf-dist/doc/latex/autonum/test-autonum.tex index db3f9cc0470..6a568b94494 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 @@ % % \stop % \begin{equation}\label{ee}b\end{equation} \section*{Tests} + Additionally test, that deactivating the package does not reuslt in compile errors during the next run if only basic features are used. \begin{itemize} \item Having a referenced equation with reference before \ref{referenceBefore} \begin{equation}\label{referenceBefore} @@ -54,6 +55,14 @@ \begin{equation}\label{checkWhitespace} b_c \end{equation} + \item Check if the starred version of ref does also work (\ref*{checkStarred}) + \begin{equation}\label{checkStarred} + c_D + \end{equation} + \item Check if the starred version of cref does also work (\cref*{checkStarredCref}) + \begin{equation}\label{checkStarredCref} + d_E + \end{equation} \item Placing the number in long equations \ref{long} \begin{equation}\label{long} \sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum\sum a diff --git a/Master/texmf-dist/source/latex/autonum/autonum.dtx b/Master/texmf-dist/source/latex/autonum/autonum.dtx index 531ae202394..b1424f0cbd8 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 by Patrick Häcker <pat_h@web.de> +Copyright (C) 2012, 2013 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,11 +85,12 @@ and the derived files autonum.ins, %</internal> %<*package> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{autonum}[2013/04/28 v0.3.4 autonum LaTeX package] +\ProvidesPackage{autonum}[2013/06/15 v0.3.5 autonum LaTeX package] \PassOptionsToPackage{hypertexnames=false}{hyperref} \RequirePackage{etoolbox} \RequirePackage{amsmath} \RequirePackage[absolute]{textpos} +\RequirePackage{letltxmacro} %</package> %<*driver> \documentclass{ltxdoc} @@ -131,6 +132,7 @@ and the derived files autonum.ins, %\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.} % % \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. @@ -318,6 +320,10 @@ and the derived files autonum.ins, % \begin{itemize} % \item found a bug when using \cmd{\cref} inside the \cmd{\section} command when hyperref is loaded which lead to its fix % \end{itemize} +% \item Michel Voßkuhle +% \begin{itemize} +% \item found a bug when using autonum together with the subcaption package due to the missing support of starred reference commands in autonum which lead to its fix +% \end{itemize} % \end{itemize} % % @@ -359,6 +365,41 @@ and the derived files autonum.ins, % \end{macrocode} %\end{macro} +%\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]{% + \expandafter\LetLtxMacro\csname#1\endcsname#2% +} +% \end{macrocode} +%\end{macro} + +%\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]{% + \ifcsdef{#2}{% + \expandafter\LetLtxMacro\expandafter#1\csname#2\endcsname + }{% + \undef#1% + }% +} +% \end{macrocode} +%\end{macro} + +%\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]{% + \ifcsdef{#2}{% + \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname + }{% + \csundef{#1}% + }% +} +% \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} @@ -373,7 +414,7 @@ and the derived files autonum.ins, %\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. +% 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} \def\ifcsedef#1#2#3{% \edef\autonum@ifcsedefTemp{#1}% @@ -383,6 +424,34 @@ and the derived files autonum.ins, % \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} +% \def\ifstar#1#2#3{% +% \ifstrequal{#1}{*}{#2}{#3}% +% } +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\csDeclareDocumentCommand} +% This command is a mixture of the \cmd{\csdef} command from the etoolbox package and the \cmd{\DeclareDocumentCommand} from the xparse package. This command would be a candidate for inclusion into xparse. +% \begin{macrocode} +% \def\csDeclareDocumentCommand#1#2#3{% +% \expandafter\DeclareDocumentCommand\csname #1\endcsname{#2}{#3}% +% } +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\autonum@debug} +% Activate and deactivate debugging by commenting and uncommenting the folowing code. +% \begin{macrocode} +% \def\autonum@debug#1{% +% \PackageWarning{autonum}{#1}% +% } +% \def\autonum@debug#1{}% +% \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{% @@ -688,22 +757,51 @@ and the derived files autonum.ins, % 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. 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. + % There might be reference commands, which have an optional argument. To support these, use \cmd{\csLetcsLtxMacro} instead of \cmd{\csletcs}. % \begin{macrocode} - \csdef{#1}##1{% - \skipInPDFTOC{% - \vanishprotect{% - \csuse{#2}{\protect\autonum@markLabelAsReferenced}{##1}% - }% - }% - \csuse{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} + \csdef{#1}{% +% \end{macrocode} + % Use protect, to avoid problems with sections and captions. This is the same trick that hyperref uses, which can be seen by executing \cmd{\show}\cmd{\ref}. +% \begin{macrocode} + \protect\autonum@processReference{autonum@reference#1Old}{#2}% }% } % \end{macrocode} %\end{macro} +%\begin{macro}{\autonum@processReference} + % If the reference command supports a starred call, as \cmd{\ref} when loading hyperref does for example, the star must be supported, as well. This macro separates calls using a star from those not using one. +% \begin{macrocode} +\def\autonum@processReference#1#2{% + \@ifstar{% + \autonum@processReferenceHelper{#1}{#2}{*}% + }{% + \autonum@processReferenceHelper{#1}{#2}{}% + }% +}% +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\autonum@processReference} + % 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} +% \autonum@processReferenceHelper{reference command name}{extraction command name}{star or empty}{label} +\def\autonum@processReferenceHelper#1#2#3#4{% + \skipInPDFTOC{% + \vanishprotect{% + \csuse{#2}{\protect\autonum@markLabelAsReferenced}{#4}% + }% + }% + \csuse{#1}#3{#4}% +}% +% \end{macrocode} +%\end{macro} + %\begin{macro}{\autonum@markLabelAsReferenced} % This is a simple helper macro to mark a label as referenced. The reference information is stored into a variable (for the current run) and into the aux file (for the next run), so it does not matter if the reference is used before or after the definition of the label. Saving into a variable saves one compilation run, although still up to three are needed to get everything right. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/autonum/autonum.ins b/Master/texmf-dist/source/latex/autonum/autonum.ins index 2029099e63f..6c7bd935fea 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 by Patrick Häcker <pat_h@web.de> +Copyright (C) 2012, 2013 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 @@ -51,7 +51,7 @@ and the derived files autonum.ins, \endbatchfile %% -%% Copyright (C) 2012 by Patrick Häcker <pat_h@web.de> +%% Copyright (C) 2012, 2013 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 c08de067925..2b60e8db144 100644 --- a/Master/texmf-dist/tex/latex/autonum/autonum.sty +++ b/Master/texmf-dist/tex/latex/autonum/autonum.sty @@ -13,11 +13,12 @@ %% ---------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{autonum}[2013/04/28 v0.3.4 autonum LaTeX package] +\ProvidesPackage{autonum}[2013/06/15 v0.3.5 autonum LaTeX package] \PassOptionsToPackage{hypertexnames=false}{hyperref} \RequirePackage{etoolbox} \RequirePackage{amsmath} \RequirePackage[absolute]{textpos} +\RequirePackage{letltxmacro} \def\csxdefaux#1#2{% \protected@write\@mainaux{}{% @@ -30,6 +31,26 @@ \csxdef{#1}{#2}% } +\newrobustcmd{\csLetLtxMacro}[2]{% +\expandafter\LetLtxMacro\csname#1\endcsname#2% +} + +\newrobustcmd{\LetcsLtxMacro}[2]{% +\ifcsdef{#2}{% +\expandafter\LetLtxMacro\expandafter#1\csname#2\endcsname +}{% +\undef#1% +}% +} + +\newrobustcmd*{\csLetcsLtxMacro}[2]{% +\ifcsdef{#2}{% +\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname +}{% +\csundef{#1}% +}% +} + \def\vanishprotect{% \ifx\protect\@typeset@protect \expandafter\@firstofone @@ -44,6 +65,9 @@ \undef{\autonum@ifcsedefTemp}% } + + + \AtBeginDocument{% \newlength{\autonum@environmentWidth}% \forcsvlist{\autonum@patchParametrizedFullEnvironment}{alignat}% @@ -200,16 +224,30 @@ } \def\autonum@generatePatchedReferenceGeneral#1#2{% -\csletcs{autonum@reference#1Old}{#1}% -\csdef{#1}##1{% +\csLetcsLtxMacro{autonum@reference#1Old}{#1}% +\csdef{#1}{% +\protect\autonum@processReference{autonum@reference#1Old}{#2}% +}% +} + + % If the reference command supports a starred call, as \cmd{\ref} when loading hyperref does for example, the star must be supported, as well. This macro separates calls using a star from those not using one. +\def\autonum@processReference#1#2{% +\@ifstar{% +\autonum@processReferenceHelper{#1}{#2}{*}% +}{% +\autonum@processReferenceHelper{#1}{#2}{}% +}% +}% + + % 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. +\def\autonum@processReferenceHelper#1#2#3#4{% \skipInPDFTOC{% \vanishprotect{% -\csuse{#2}{\protect\autonum@markLabelAsReferenced}{##1}% +\csuse{#2}{\protect\autonum@markLabelAsReferenced}{#4}% }% }% -\csuse{autonum@reference#1Old}{##1}% +\csuse{#1}#3{#4}% }% -} \def\autonum@markLabelAsReferenced#1{% \csxdefall{autonum@#1Referenced}{}% @@ -280,7 +318,7 @@ }{}% } %% -%% Copyright (C) 2012 by Patrick Häcker <pat_h@web.de> +%% Copyright (C) 2012, 2013 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 |