From ed725d5c234420505cc81dafaf4dd600a0c4b000 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 27 Jun 2013 16:31:37 +0000 Subject: autonum (16jun13) git-svn-id: svn://tug.org/texlive/trunk@30979 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/autonum/autonum.sty | 52 +++++++++++++++++++++---- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'Master/texmf-dist/tex/latex/autonum') 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 +%% Copyright (C) 2012, 2013 by Patrick Häcker %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License (LPPL), either -- cgit v1.2.3