diff options
author | Karl Berry <karl@freefriends.org> | 2017-07-28 21:45:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-07-28 21:45:48 +0000 |
commit | b3bc2e60a36b6c3e0a6f7277689cca614aae0528 (patch) | |
tree | c032a5e36b9b9d943f4bff4656643376dbb020c4 /Master/texmf-dist/tex/latex/xassoccnt | |
parent | 32d0b3285fe157a86330df36bb2edec3e8ed7340 (diff) |
xassoccnt (28jul17)
git-svn-id: svn://tug.org/texlive/trunk@44907 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 | 95 |
1 files changed, 90 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty index 932f421190f..e11965df0c8 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 1.4 (2017/04/30 -- 00:47:05) +%% LaTeX package xassoccnt - version 1.5 (2017/07/28 -- 12:08:57) %% Source file for xassoccnt.sty %% %% @@ -19,10 +19,10 @@ %% %% -\def\xassoccntpackageversion{1.4} +\def\xassoccntpackageversion{1.5} \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{xassoccnt}[2017/04/30 - v\xassoccntpackageversion] +\ProvidesPackage{xassoccnt}[2017/07/28 - v\xassoccntpackageversion] \RequirePackage{etoolbox} \RequirePackage{letltxmacro} \RequirePackage{xcolor} @@ -39,11 +39,11 @@ \cs_generate_variant:Nn \seq_set_from_clist:Nn { Nx, cx } \cs_generate_variant:Nn \seq_gset_from_clist:Nn { Nx, cx } +\cs_generate_variant:Nn \seq_item:Nn { Nx, cx,NV,cV} \cs_generate_variant:Nn \seq_set_split:Nnn {Nxn,cxn,Nxx,cxx,cox,Nox,Non,con} \cs_generate_variant:Nn \seq_remove_all:Nn { cV, NV } \cs_generate_variant:Nn \seq_gremove_all:Nn { cV, NV } -\cs_generate_variant:Nn \seq_gput_right:cn {cx} \cs_generate_variant:Nn \prop_put:Nnn {cxx,nxx,nxn,cxn,Nxx,Nxn} \cs_generate_variant:Nn \prop_gput:Nnn {cxx,nxx,nxn,cxn,Nxx,Nxn,NVx,Nvn,cVn,cVx} \cs_generate_variant:Nn \prop_remove:Nn {cx,Nx} @@ -58,6 +58,8 @@ % global/local scratch variables \seq_new:N \l__xassoccnt_tmpa_seq +\seq_new:N \l__xassoccnt_tmpb_seq +\seq_new:N \l__xassoccnt_tmpc_seq \tl_new:N \l__xassoccnt_tmpa_tl \tl_new:N \l__xassoccnt_tmpb_tl @@ -700,7 +702,7 @@ }{} \AtEndOfPackage{ - \PackageInfo{xassoccnt}{2017/04/30 - v\xassoccntpackageversion -- stepping counters simultaneously and other features} + \PackageInfo{xassoccnt}{2017/07/28 - v\xassoccntpackageversion -- stepping counters simultaneously and other features} \xassoccnt_trackloadedpackages:n{alphalph,calc,cleveref,hyperref} \@ifpackageloaded{calc}{% \msg_warning:nnn{xassoccnt}{incompatiblepackagenonfatal}{calc}% Warning @@ -963,6 +965,8 @@ } \fi +\cs_generate_variant:Nn \__xassoccnt_newcounter_ltx:nnn {nVn} + @@ -2541,6 +2545,8 @@ } + + \cs_set:Npn \refstepcounter #1 {% \seq_if_in:NxF \g_xassoccnt_suspendedcnt_seq {#1} {% \cs_gset_nopar:Npx \LastRefSteppedCounter {#1} @@ -2549,6 +2555,7 @@ } } +\cs_gset_nopar:Npx \LastRefSteppedCounter {} \newcommand{\LastCounterValue}{% \int_use:N \g__xassoccnt_lastcountervalue_int @@ -2712,6 +2719,84 @@ +%%%%%%%%%%%%% Counter hierarchies + +\seq_new:N \g_xassoccnt_counterhierarchies_seq + + + +\cs_new:Nn \__xassoccnt_add_counterhierarchy:n {% + \seq_if_exist:cF { g_xassoccnt_ #1 _counterhierarchy_seq } { + \seq_new:cn {g_xassoccnt_ #1 _counterhierarchy_seq} + } + \tl_set:Nx \l_tmpb_tl {#1} + \seq_gput_right:Nx \g_xassoccnt_counterhierarchies_seq {#1} + \seq_gremove_duplicates:N \g_xassoccnt_counterhierarchies_seq +} + +\keys_define:nn {xassoccnt(COUNTERHIERARCHY)} {% + hierarchy-name .code:n= {\__xassoccnt_add_counterhierarchy:n{#1}}, + hierarchy-name .value_required:n=true +} + +\seq_set_from_clist:cn {foo_seq} {einstein,feynman,newton,boltzmann} + + +\cs_new:Nn \seq_insert_seq:nnnn { + \group_begin: + \int_zero:N \l_tmpa_int + \seq_set_eq:NN \l_tmpa_seq #1 + \seq_clear:N \l__xassoccnt_tmpb_seq +% \seq_clear:N \l_tmpa_seq + \int_do_while:nNnn {\l_tmpa_int } < {#3} {% + \int_incr:N \l_tmpa_int + \seq_put_right:Nx \l__xassoccnt_tmpb_seq {\seq_item:NV #1 {\l_tmpa_int}} + } + \seq_concat:NNN \l__xassoccnt_tmpa_seq \l__xassoccnt_tmpb_seq #2 + + \seq_clear:N \l__xassoccnt_tmpb_seq + \int_do_while:nNnn {\l_tmpa_int } < {\seq_count:N {#1} + 1} {% + \int_incr:N \l_tmpa_int + \seq_put_right:Nx \l__xassoccnt_tmpa_seq {\seq_item:NV #1 {\l_tmpa_int}} + } +% \seq_concat:NNN \l__xassoccnt_tmpc_seq \l__xassoccnt_tmpa_seq \l__xassoccnt_ + \seq_use:Nn \l__xassoccnt_tmpa_seq {\par} + +% \map_\seq_map_inline:Nn #1 {% + + + + %\l_tmpa_seq #1 + + \group_end: + +} + + +\NewDocumentCommand{\NewCounterHierarchy}{O{}m}{% + \group_begin: + \keys_set:nn {xassoccnt(COUNTERHIERARCHY)}{ #1 } + \seq_set_from_clist:Nx \l_tmpa_seq {#2} + \seq_set_eq:NN \l_tmpb_seq \l_tmpa_seq + \int_zero:N \l_tmpa_int + \seq_pop_left:NN \l_tmpb_seq \l_tmpa_tl + \__xassoccnt_newcounter_ltx:nVn{}{\l_tmpa_tl}{} + \seq_map_inline:Nn \l_tmpa_seq {% + \int_incr:N \l_tmpa_int + \tl_clear:N \l_tmpa_tl + \tl_set:Nx \l_tmpa_tl {\seq_item:Nn \l_tmpa_seq {\l_tmpa_int+1}} + \tl_if_empty:NF \l_tmpa_tl {% + \__xassoccnt_newcounter_ltx:nVn{}{\l_tmpa_tl}{##1} + } + } + \seq_set_eq:NN \l_tmpb_seq \l_tmpa_seq + \seq_insert_seq:nnnn {\l_tmpa_seq} {\foo_seq} {2} {} + \group_end: +} + + + + % Pretty printing counters \NewDocumentCommand{\PrettyPrintCounterName}{+mm}{% |