diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty b/Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty index 2f8a4de1cba..01bd26aff44 100644 --- a/Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty +++ b/Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty @@ -1,9 +1,9 @@ -%% LaTeX package xcntperchap - version 0.4 (2017/04/30 -- 00:53:36) +%% LaTeX package xcntperchap - version 0.5 (2018/01/05 -- 22:04:12) %% Source file for xcntperchap.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2016 -- 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> +%% Copyright (c) 2016 -- 2018 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -19,10 +19,10 @@ %% %% -\def\xcntperchappackageversion{0.4} +\def\xcntperchappackageversion{0.5} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{xcntperchap}[2017/04/30 - v\xcntperchappackageversion] +\ProvidesPackage{xcntperchap}[2018/01/05 - v\xcntperchappackageversion] \RequirePackage[counter]{zref} \RequirePackage{l3keys2e} @@ -33,11 +33,9 @@ \ExplSyntaxOn -%\let\latex@@stepcounter\stepcounter -%\let\latex@@addtocounter\addtocounter - \cs_set_eq:NN \latex@@stepcounter \stepcounter \cs_set_eq:NN \latex@@addtocounter \addtocounter +\cs_set_eq:NN \latex@@setcounter \setcounter \cs_generate_variant:Nn \int_set:Nn {NV, Nx} @@ -102,20 +100,23 @@ \tl_clear:N \l_tmpa_tl \int_zero:N \l_tmpa_int \int_zero:N \l_tmpb_int - \seq_if_in:NnT \g_xcntperchap_tracklevel_seq {#1} {% - \tl_put_right:Nn \l_tmpa_tl {#1,}% - \int_set:Nx \l_tmpb_int {\seq_count:c {g_xcntperchap_tracklevel_#1_seq} } - \int_compare:nNnT { \value{#1} } > {\c_zero }{% - \int_zero:N \l_tmpa_int - \seq_map_inline:cn {g_xcntperchap_tracklevel_#1_seq} {% - \int_incr:N \l_tmpa_int - \int_compare:nNnTF {\l_tmpa_int } < { \l_tmpb_int } - { \tl_gput_right:Nx \l_tmpa_tl { \number\value{cps@@#1total##1}, } } { \tl_gput_right:Nx \l_tmpa_tl { \number\value{cps@@#1total##1} } } - } - \iow_now:Nx \g_trackfile_storage_write {\l_tmpa_tl}% - } - \seq_map_inline:cn {g_xcntperchap_tracklevel_#1_seq} { - \setcounter{cps@@#1total##1}{\c_zero}% Reset the total counter values + \seq_if_exist:cT {g_xcntperchap_tracklevel_#1_seq} { + \seq_if_in:NnT \g_xcntperchap_tracklevel_seq {#1} {% + \tl_put_right:Nn \l_tmpa_tl {#1,}% + \int_set:Nx \l_tmpb_int {\seq_count:c {g_xcntperchap_tracklevel_#1_seq} } + \int_compare:nNnT { \number\value{#1} } > {0 }{% + \int_zero:N \l_tmpa_int + \seq_map_inline:cn {g_xcntperchap_tracklevel_#1_seq} {% + \int_incr:N \l_tmpa_int + \int_compare:nNnTF {\l_tmpa_int } < { \l_tmpb_int } + { \tl_gput_right:Nx \l_tmpa_tl { \number\value{cps@@#1total##1}, } } { \tl_gput_right:Nx \l_tmpa_tl { \number\value{cps@@#1total##1} } } + } + % Store the value list to the file + \iow_now:Nx \g_trackfile_storage_write {\tl_use:N \l_tmpa_tl}% + } + \seq_map_inline:cn {g_xcntperchap_tracklevel_#1_seq} { + \setcounter{cps@@#1total##1}{\c_zero}% Reset the total counter values + } } } \group_end: @@ -130,7 +131,6 @@ % Redefine again, to provide the storage feature \cs_set:Npn \xcntperchap_internal_stepcounter #1 {% -%\RenewDocumentCommand{\stepcounter}{m}{% % Must get reset list first \__xassoccnt_getresetlist:n{#1}% \seq_map_inline:Nn \g_xcntperchap_tracklevel_seq {% @@ -142,12 +142,24 @@ \latex@@stepcounter{#1}% } -\let\foo\stepcounter -\RenewDocumentCommand{\stepcounter}{m}{% +\cs_set:Npn \stepcounter #1{% \xcntperchap_internal_stepcounter{#1}% } +% Added in Version 0.5 +\cs_set:Npn \setcounter #1#2{% + % This might be necessary later on -> check in next updates +% \__xassoccnt_getresetlist:n{#1}% +% \seq_map_inline:Nn \g_xcntperchap_tracklevel_seq {% +% \seq_if_in:NnT \l__xassoccnt_counterreset_seq {##1} {% +% \StoreCounterValues{##1}% +% } +% } + \StoreCounterValues{#1}% + \latex@@setcounter{#1}{#2}% +} + \NewDocumentCommand{\AddToTrackedCounters}{mm}{% \seq_set_from_clist:Nn \l_tmpa_seq {#1} \seq_map_inline:Nn \l_tmpa_seq {% @@ -159,7 +171,7 @@ -\cs_new_nopar:Nn \xcntperchap_trackcounters: {% +\cs_new:Nn \xcntperchap_trackcounters: {% \seq_map_inline:cn {g_xcntperchap_tracklevel_seq} {% \xcntperchap_storetracked_values:n{##1}% } @@ -192,6 +204,7 @@ } + \cs_new:Nn \xcntperchap_open_trackfile_for_read:n {% \ior_open:Nn \g_trackfile_storage_read {#1} } |