diff options
author | Karl Berry <karl@freefriends.org> | 2016-05-10 21:32:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-05-10 21:32:09 +0000 |
commit | a042eaf934daca8ec58804d0c8cf20be9a4e66d4 (patch) | |
tree | 77606a7f750907424cb35f5bfd4c1ffe7e12254a /Master/texmf-dist/tex/latex/xassoccnt | |
parent | 4bedf8053067f3211ee912a487ee5d03c1f43971 (diff) |
xassoccnt (10may16)
git-svn-id: svn://tug.org/texlive/trunk@41014 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/xassoccnt')
-rw-r--r-- | Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty | 81 |
1 files changed, 67 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty index 1c6809697a7..dae0afc37ab 100644 --- a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty +++ b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 0.6 (2016/03/05 -- 14/44/15) +%% LaTeX package xassoccnt - version 0.7 (2016/05/10 -- 00/41/54) %% Source file for xassoccnt.sty %% %% @@ -19,10 +19,10 @@ %% %% -\def\xassoccntpackageversion{0.6} +\def\xassoccntpackageversion{0.7} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{xassoccnt}[2016/03/05 - v\xassoccntpackageversion] +\ProvidesPackage{xassoccnt}[2016/05/10 - v\xassoccntpackageversion] \RequirePackage{xcolor} \RequirePackage{xparse} @@ -103,7 +103,7 @@ initial .code:n={ \int_set:Nn \l__xassoccnt_initialcountervalue_int {#1}}, sloppy .bool_set:N=\l__xassoccnt_sloppy_newcounter, autodefinecounters .bool_set:N=\g__xassoccnt_autodefine_counters, - nonumberofruns .code:n={\typeout{Disabling numberofruns}\bool_gset_true:N \g__xassoccnt_nonumberofruns_bool}, + nonumberofruns .code:n={\bool_gset_true:N \g__xassoccnt_nonumberofruns_bool}, nonumberofruns .value_forbidden:n = true, % Choice keys autodefine .choice:, @@ -163,7 +163,7 @@ resetbackup .bool_set:N={\l__xassoccnt_resetbackupcounters_bool } } -%\keys_set:nn{xassoccnt}{nonumberofruns=false} +\keys_set:nn{xassoccnt}{nonumberofruns} \ProcessKeysOptions{xassoccnt} @@ -760,6 +760,7 @@ \seq_if_exist:cT { \__xassoccnt_drivercontainer:n{#1} } { \seq_map_inline:cn {\__xassoccnt_drivercontainer:n{#1} } { +% \typeout{Stepping~the~associated~counter(#1):##1}% \xassoccnt_addtocounter{##1}{\c_one} } } @@ -1274,7 +1275,6 @@ %%%% Redefinition of standard counter macros - \RenewDocumentCommand{\stepcounter}{m}{% \__xassoccnt_translate_countername:cn {l_tmpa_tl} {#1}% \xassoccnt_is_suspendedcounter:nF{#1}{% @@ -1293,8 +1293,12 @@ % This is the replacement of \csname cl@#1\endcsname \xassoccnt_standardaddtocounter{\l_tmpa_tl}{\c_one} \seq_map_inline:Nn \l__xassoccnt_counterreset_seq {% - \csname c@##1\endcsname\c_minus_one - \xassoccnt_standardstepcounter{##1}% + \xassoccnt_is_drivercounter:nTF{##1}{% + \csname c@##1\endcsname\c_zero % Reset but do not increase + }{% + \csname c@##1\endcsname\c_minus_one + \xassoccnt_standardstepcounter{##1}% + } } \__xassoccnt_step_associatedcounters:n {\l_tmpa_tl} % step the remaining associated counters }% End of not empty reset list @@ -1304,8 +1308,6 @@ - - \NewDocumentCommand{\xassoccnt_addtocounter}{mmO{}}{% % Only add to a counter if this counter isn't on the suspended counters list! \xassoccnt_is_suspendedcounter:nF{#1}{% @@ -1590,19 +1592,28 @@ } -\NewDocumentCommand{\TotalValue}{m}{% +\newcommand{\TotalValue}[1]{% +% \seq_use:Nn \g__xassoccnt_totalcounter_container {\par}% \tl_set:Nx \l_tmpa_tl {\__xassoccnt_expand_totalcountername:n{#1}} \tl_set:Nx \l_tmpb_tl {#1}% + \typeout{Foo} \seq_if_in:NnTF \g__xassoccnt_supertotalcounter_container {\l_tmpb_tl }{% \tl_set:Nx \l_tmpa_tl {\__xassoccnt_expand_totalcountername:n{#1}} }{% \seq_if_in:NVF \g__xassoccnt_totalcounter_container {\l_tmpa_tl }{% - \tl_set:Nn \l_tmpa_tl {#1}% + \tl_set:NV \l_tmpa_tl {#1}% } } - \number\value{\l_tmpa_tl}% + \number\value{\tl_use:N \l_tmpa_tl}% } +\newcommand{\TotalValueOld}[1]{% + %\tl_set:Nx \l_tmpa_tl {\__xassoccnt_expand_totalcountername:n{#1}} + %\tl_set:Nx \l_tmpb_tl {#1}% + \number\value{\__xassoccnt_expand_totalcountername:n{#1}}% +} + + \cs_new:Nn \__xassoccnt_writetotalcounters:nn {% \immediate\write\@mainaux {% \string\IfIsDocumentCounterF\expandafter{\__xassoccnt_expand_totalcountername:n{#1}}{\string\DeclareDocumentCounter\expandafter{\__xassoccnt_expand_totalcountername:n{#1}}} @@ -1874,6 +1885,48 @@ } +%%%% More simplifying macros for doing similar steps for all counters in the comma separated list + + +\NewDocumentCommand{\LoopAddtoCounters}{+mm}{% + \clist_set:Nx \l_tmpa_clist {#1}% + \clist_map_inline:Nn \l_tmpa_clist { \addtocounter{##1}{#2} } +} + +\NewDocumentCommand{\LoopRefstepCounters}{+mm}{% + \clist_set:Nx \l_tmpa_clist {#1}% + \clist_map_inline:Nn \l_tmpa_clist { \refstepcounter{##1}{#2} } +} + +\NewDocumentCommand{\LoopResetCounters}{+m}{% + \LoopSetCounters{#1}{0} +} + +\NewDocumentCommand{\LoopStepCounters}{+m}{% + \clist_set:Nx \l_tmpa_clist {#1}% + \clist_map_inline:Nn \l_tmpa_clist { \stepcounter{##1} } +} + +\NewDocumentCommand{\LoopSetCounters}{+mm}{% + \clist_set:Nx \l_tmpa_clist {#1}% + \clist_map_inline:Nn \l_tmpa_clist { \setcounter{##1}{#2} } +} + +\NewDocumentCommand{\LoopCountersFunction}{+m+m}{% + \clist_set:Nx \l_tmpa_clist {#1}% + \clist_map_inline:Nn \l_tmpa_clist { #2{##1} } +} + + + + +%%%% + +%% Counter-Values-Mapping-To-Something-Different - Macros + + + + %%%%%%%%%%%%%%%%%%%% @@ -1901,7 +1954,7 @@ \EnableNumberofrunsTF{% \NewTotalDocumentCounter[supertotal=true]{numberofruns} \AtBeginDocument{% - \stepcounter{numberofruns} + \stepcounter{numberofruns}% } }{} |