diff options
author | Karl Berry <karl@freefriends.org> | 2015-09-27 21:25:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-09-27 21:25:56 +0000 |
commit | 725a2e9304051ee8a4d4053c25fccf4fd60cf2b6 (patch) | |
tree | 7a771ac85013ec749d23bd43caae77fdfa347857 /Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty | |
parent | 1927158df927d7ef29221a17261313e3ddbcece0 (diff) |
assoccnt (27sep15)
git-svn-id: svn://tug.org/texlive/trunk@38477 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty b/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty index 3c736ac9288..4839a05ef06 100644 --- a/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty +++ b/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{assoccnt}[2014/09/22 v0.5a -- Associate counters stepping]% +\ProvidesPackage{assoccnt}[2015/09/27 v0.6 -- Associate counters stepping]% %%% %% License: LaTeX Project Public License version 1.3 %% Copyright (2014) Dr. Christian Hupfer @@ -55,6 +55,16 @@ \let\@@assoccnt@@standardaddtocounter\addtocounter% +% Unused so far +\newcommand{\IsInResetList}[4]{% + \IfSubStr{\csname cl@#1\endcsname}{{#2}}{% + #3% + }{% + #4% + }% +} + + % Just for a quick suffix \newcommand{\@@assoccnt@@associatedcounterslistsuffix}{% AssociatedCountersList% @@ -65,7 +75,7 @@ AssociatedCountersList% %%% Internal macro to generate the name of the list of associated counters \newcommand{\@@assoccnt@@generatelistname}[1]{% % #1 Name of the driver counter - @@#1@@\@@assoccnt@@associatedcounterslistsuffix + @@#1@@\@@assoccnt@@associatedcounterslistsuffix% }% \newcommand{\@@assoccnt@@drivercounterlist}{% @@ -270,7 +280,7 @@ AssociatedCountersList% \newcommand{\IsAssociatedCounter}[3]{% \ifcsdef{\@@assoccnt@@generateboundtocounterslist{#1}}{% true branch - \setcounter{@@assoccnt@@internalcounter}{0}% + \@@assoccnt@@standardsetcounter{@@assoccnt@@internalcounter}{0}% \renewcommand*{\do}[1]{% \@@assoccnt@@standardstepcounter{@@assoccnt@@internalcounter}% }% @@ -342,7 +352,7 @@ AssociatedCountersList% \newcommand{\GetDriverCounter}[1]{% - \setcounter{@@assoccnt@@internalcounter}{0}% + \@@assoccnt@@standardsetcounter{@@assoccnt@@internalcounter}{0}% \renewcommand*{\do}[1]{% ##1% \ifnumequal{\number\value{@@assoccnt@@internalcounter}}{1}{% @@ -402,10 +412,14 @@ AssociatedCountersList% %%% The stepcounter wrapper for the standard stepcounter command %%% This is just for convenience, if the command as to be improved/extended later on in future -\newcommand{\@@assoccnt@@stepcounter}[1]{% - \@@assoccnt@@standardstepcounter{#1}% +\newcommand{\@@assoccnt@@stepcounter}[1]{% + \@ifundefined{cl@#1}{% There is no reset list for this driver counter + \@@assoccnt@@standardstepcounter{#1}% + }{% + \csletcs{cl@#1}{relax}% Yes, there is reset list, but we drop it in this group, preventing that the counters from `\@addtoreset` are stepped anyway. + \@@assoccnt@@standardstepcounter{#1}% + }% \gdef\@@assoccnt@@storagemacro@@laststeppedcounter{#1}% -% \gdef\@@assoccnt@@storagemacro@@laststeppedcounter{#1}% }% \renewcommand{\stepcounter}[1]{% @@ -426,10 +440,12 @@ AssociatedCountersList% \IsSuspendedCounter{#2}{% % Nothing to be done }{% + \csletcs{cl@#2}{relax}% \@@assoccnt@@standardaddtocounter{#2}{#1}% \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#2}% }% }{% + \csletcs{cl@#2}{relax}% \@@assoccnt@@standardaddtocounter{#2}{#1}% \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#2}% }% @@ -464,16 +480,26 @@ AssociatedCountersList% }{% \@@assoccnt@@standardaddtocounter{#1}{#2}% \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#1}% - } + }% }{% \@@assoccnt@@standardaddtocounter{#1}{#2}% \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#1}% }% - \ifcsdef{\@@assoccnt@@generatelistname{#1}}{% Check first, whether the list exists at all, - \forlistcsloop{\@@assoccnt@@addtocounter{#2}}{\@@assoccnt@@generatelistname{#1}}% March through the list - }{% - % No list -> do nothing at all - }% + \@ifundefined{cl@#1}{% + \ifcsdef{\@@assoccnt@@generatelistname{#1}}{% Check first, whether the list exists at all, + \forlistcsloop{\@@assoccnt@@addtocounter{#2}}{\@@assoccnt@@generatelistname{#1}}% March through the list + }{% + % No list -> do nothing at all + }% + }{% + %\csletcs{temp@cllist}{cl@#1} + \csletcs{cl@#1}{relax}% + \ifcsdef{\@@assoccnt@@generatelistname{#1}}{% Check first, whether the list exists at all, + \forlistcsloop{\@@assoccnt@@addtocounter{#2}}{\@@assoccnt@@generatelistname{#1}}% March through the list + }{% + % No list -> do nothing at all + }% + }% }% \listgadd{\@@assoccnt@@tempcounterlist}{}% This should be renamed later one... treated more generally @@ -522,7 +548,7 @@ AssociatedCountersList% \ifdef{% \@@assoccnt@@storagemacro@@laststeppedcounter% }{% - \@@assoccnt@@storagemacro@@laststeppedcounter\typeout{Hello}% + \@@assoccnt@@storagemacro@@laststeppedcounter% }{% Undefined/unknown% }% |