summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/assoccnt
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-09-29 22:06:31 +0000
committerKarl Berry <karl@freefriends.org>2015-09-29 22:06:31 +0000
commit982ab23fae158d0e4ca19de74a6fa98928334007 (patch)
treebfd7185e4bea051c581bf2e7d65cba475f86abb8 /Master/texmf-dist/tex/latex/assoccnt
parentf737ec574c2912930727d94df1184ccfb322d4ec (diff)
assoccnt (29sep15)
git-svn-id: svn://tug.org/texlive/trunk@38497 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/assoccnt')
-rw-r--r--Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty161
1 files changed, 102 insertions, 59 deletions
diff --git a/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty b/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty
index 4839a05ef06..c22f0eb4fc9 100644
--- a/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty
+++ b/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty
@@ -1,22 +1,37 @@
+
+\def\assoccntpackageversion{0.8}
\NeedsTeXFormat{LaTeX2e}%
-\ProvidesPackage{assoccnt}[2015/09/27 v0.6 -- Associate counters stepping]%
+\ProvidesPackage{assoccnt}[2015/09/29 v\assoccntpackageversion -- Associate counters stepping]%
%%%
%% License: LaTeX Project Public License version 1.3
-%% Copyright (2014) Dr. Christian Hupfer
+%% Copyright (2015) Dr. Christian Hupfer
%% Author: Christian Hupfer christian.hupfer@yahoo.de
%%
%%%%
+
\def\@@assoccnt@@keys{assoccntkeyfamily}%
\def\@@assoccnt@@packagename{assoccnt.sty}%
\def\@@assoccnt@@keyprefix{@@assoccnt@@pkg@@}%
+\typeout{\@@assoccnt@@packagename{} -- version v\assoccntpackageversion}
+
+
\RequirePackage{xcolor}%
\RequirePackage{etoolbox}[2011/01/03 2.2]%
\RequirePackage{xkeyval}[2012/10/14 v2.6b]%
\RequirePackage{xstring}%
+\newif\if@calcpackage
+
+\@ifpackageloaded{calc}{%
+\@calcpackagetrue%
+}{%
+\@calcpackagefalse%
+}
+
+
%%%% Defining package options
\newtoggle{GlobalSuspend}%
@@ -40,6 +55,7 @@
%%%%%
+
\newcounter{@@assoccnt@@internalcounter}%
@@ -49,15 +65,16 @@
\gdef\@@assoccnt@@storagemacro@@lastsetcounter{}%
+\let\@@assoccnt@@standardaddtocounter\addtocounter%
\let\@@assoccnt@@standardstepcounter\stepcounter%
\let\@@assoccnt@@standardrefstepcounter\refstepcounter%
\let\@@assoccnt@@standardsetcounter\setcounter%
-\let\@@assoccnt@@standardaddtocounter\addtocounter%
+
% Unused so far
\newcommand{\IsInResetList}[4]{%
- \IfSubStr{\csname cl@#1\endcsname}{{#2}}{%
+ \IfSubStr{\csname cl@#1\endcsname}{{#2}}{% Mind the {} around the #2 parameter!
#3%
}{%
#4%
@@ -410,47 +427,68 @@ 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]{%
- \@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}%
-}%
-
-\renewcommand{\stepcounter}[1]{%
- \@@assoccnt@@stepcounter{#1}%
-}%
-
%%% The setcounter wrapper
-\newcommand{\@@assocccnt@@setcounter}[2]{%
- \@@assoccnt@@standardsetcounter{#1}{#2}%
- \gdef\@@assoccnt@@storagemacro@@lastsetcounter{#1}%
-}%
+%\newcommand{\@@assocccnt@@setcounter}[2]{%
+% \@@assoccnt@@standardsetcounter{#1}{#2}%
+% \gdef\@@assoccnt@@storagemacro@@lastsetcounter{#1}%
+%}%
%%% addtocounter wrapper -- needs to switch the arguments for the command for the list usage!!!
+\newcommand{\@@assocccnt@@addtocounter}[2]{%
+ \ifcsdef{@@assoccnt@@suspendedcounterslist}{%
+ % Now, there are suspended counters -- do not update them!
+ \IsSuspendedCounter{#2}{%
+ % Nothing to be done
+ }{%
+ \@@assoccnt@@standardaddtocounter{#2}{#1}%
+ \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#2}%
+ }%
+ }{%
+ \@@assoccnt@@standardaddtocounter{#2}{#1}%
+ \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#2}%
+ }%
+}%
+
+
\newcommand{\@@assoccnt@@addtocounter}[2]{%
\ifcsdef{@@assoccnt@@suspendedcounterslist}{%
% Now, there are suspended counters -- do not update them!
\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}%
}%
}%
+
+\renewcommand{\addtocounter}[2]{%
+ \iftoggle{GlobalSuspend}{%
+ \IsSuspendedCounter{#1}{%
+ % No, do nothing at all%
+ }{%
+ \@@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
+ }%
+}%
+
+
+
+
%%% addtocounter wrapper -- needs to switch the arguments for the command for the list usage!!!
\newcommand{\@@assoccnt@@setcounter}[3]{%
\IsAssociatedToCounter{#1}{#3}{%
@@ -462,10 +500,31 @@ AssociatedCountersList%
-%%% Not needed so far
-\newcommand{\@@assoccnt@@refstepcounter}[1]{% %
+
+
+
+\newcommand{\@@assoccnt@@stepcounter}[1]{%
+ \@@assoccnt@@standardstepcounter{#1}%
+ \gdef\@@assoccnt@@storagemacro@@laststeppedcounter{#1}%
+}%
+
+
+\newcommand{\@@assoccnt@@stepdrivencounters}[1]{%
+ \ifcsdef{\@@assoccnt@@generatelistname{#1}}{% Check first, whether the list exists at all,
+ \forlistcsloop{\@@assoccnt@@standardrefstepcounter}{\@@assoccnt@@generatelistname{#1}}% March through the list
+ }{%
+ }%
+}%
+
+
+
+\renewcommand{\stepcounter}[1]{%
+ \@@assoccnt@@stepcounter{#1}%
+}%
+
+%%% Wrapper --> use standard ref stepping to prevent labelling system going mental
+\newcommand{\@@assocccnt@@refstepcounter}[1]{% %
\@@assoccnt@@standardrefstepcounter{#1}%
- \gdef\@@assoccnt@@storagemacro@@lastrefsteppedcounter{#1}%
}%
\renewcommand{\refstepcounter}[1]{%
@@ -473,35 +532,21 @@ AssociatedCountersList%
}%
-\renewcommand{\addtocounter}[2]{%
- \iftoggle{GlobalSuspend}{%
- \IsSuspendedCounter{#1}{%
- % No, do nothing at all%
- }{%
- \@@assoccnt@@standardaddtocounter{#1}{#2}%
- \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#1}%
- }%
- }{%
- \@@assoccnt@@standardaddtocounter{#1}{#2}%
- \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#1}%
- }%
- \@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
- }%
- }%
+\newcommand{\@@assoccnt@@refstepcounter}[1]{% %
+ \gdef\@@assoccnt@@storagemacro@@lastrefsteppedcounter{#1}%
+ \if@calcpackage
+ \@@assoccnt@@stepdrivencounters{#1}%
+ \fi
+ \@@assoccnt@@standardrefstepcounter{#1}%
+}%
+
+\renewcommand{\refstepcounter}[1]{%
+ \@@assoccnt@@refstepcounter{#1}%
}%
+
+
+
\listgadd{\@@assoccnt@@tempcounterlist}{}% This should be renamed later one... treated more generally
\newcommand{\@@assoccnt@@setcounterwrapper}[3]{%
@@ -514,8 +559,6 @@ AssociatedCountersList%
\define@boolkey{\@@assoccnt@@keys}{AssociatedToo}[false]{%
}%
-
-
\define@key{\@@assoccnt@@keys}{AssociatedCounters}{%
\undef{\@@assoccnt@@tempcounterlist}%
\def\@@assoccnt@@keymacro@@associatedcounters{#1}%
@@ -528,7 +571,6 @@ AssociatedCountersList%
\renewcommand{\setcounter}[3][]{%
\@@assoccnt@@standardsetcounter{#2}{#3}%
\gdef\@@assoccnt@@storagemacro@@lastsetcounter{#2}%
- %\gdef\assoccnt@@storagemacro@@lastsetcounter{#2}%
\setkeys{\@@assoccnt@@keys}{AssociatedToo=false,#1}%
\ifKV@assoccntkeyfamily@AssociatedToo
\@@assoccnt@@setcounterwrapper{#2}{#3}{\@@assoccnt@@generatelistname{#2}}%
@@ -567,4 +609,5 @@ AssociatedCountersList%
}%
+
\endinput% \ No newline at end of file