diff options
author | Karl Berry <karl@freefriends.org> | 2022-01-24 21:27:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-01-24 21:27:58 +0000 |
commit | 40016efe79a53ac2b557d733e72bb411aff489ec (patch) | |
tree | eaea61b75df34fcdee1924fd686eb303102cdbc2 /Master/texmf-dist/tex/latex/spbmark | |
parent | 25c79fafb95c8fff1e822b368b8ac1d8239ce2c3 (diff) |
spbmark (24jan22)
git-svn-id: svn://tug.org/texlive/trunk@61728 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/spbmark')
-rw-r--r-- | Master/texmf-dist/tex/latex/spbmark/spbmark.sty | 204 |
1 files changed, 106 insertions, 98 deletions
diff --git a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty index bc2aeab66f9..53061aedf81 100644 --- a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty +++ b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty @@ -9,7 +9,7 @@ % https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2018/12/31] \RequirePackage{xparse,l3keys2e} -\ProvidesExplPackage{spbmark}{2022/01/23}{1.3} +\ProvidesExplPackage{spbmark}{2022/01/24}{1.31} {Customize superscripts and subscripts} \cs_generate_variant:Nn \box_set_ht:Nn { cv } @@ -40,10 +40,11 @@ \ProcessKeysOptions{spbmark/option} -\tl_new:N \l__spb_super_cmd_ii_tl -\tl_new:N \l__spb_sub_cmd_ii_tl +\cs_set_eq:NN \spb@textsuperscript@save \textsuperscript +\cs_set_eq:NN \spb@textsubscript@save \textsubscript +\cs_set_eq:NN \spb@math@super@save \sp +\cs_set_eq:NN \spb@math@sub@save \sb \tl_new:N \g__spb_mark_case_init_tl - \cs_new_protected:Npn \spb_local_case_init:nnn #1#2#3 { \str_case:Vn \g__spb_mark_case_init_tl @@ -63,6 +64,14 @@ } \spb_define:n { + mode .tl_set:N = \l__spb_mode_value_tl, + mode .initial:n = match, + style .choice:, + style .value_required:n = true, + vsep .tl_set:N = \l__spb_supersub_vsep_tl, + vsep .initial:n = 0.6ex, + halign .tl_set:N = \l__spb_supersub_halign_tl, + halign .initial:n = l, spvmove .tl_set:N = \l__spb_super_vmove_tl, spvmove .initial:n = 0pt, sphmove .tl_set:N = \l__spb_super_hmove_tl, @@ -88,27 +97,87 @@ { \tl_set:Nn \l__spb_supersub_hmove_tl {#1} } }, nohmove .meta:n = { sphmove = 0pt,sbhmove = 0pt }, - novmove .meta:n = { spvmove = 0pt,sbvmove = 0pt }, - spcmd .tl_set:N = \l__spb_super_cmd_i_tl, - sbcmd .tl_set:N = \l__spb_sub_cmd_i_tl, - spbcmd .code:n = \spb@both@cmd@assign{#1}, - cmd .code:n = + novmove .meta:n = { spvmove = 0pt,sbvmove = 0pt } + } +\cs_new:Npn \spb_box_super_move_up_i:n #1 + { \box_move_up:nn {#1} { \box_use:N \l__super_i_box } } +\cs_new:Npn \spb_box_sub_move_down_i:n #1 + { \box_move_down:nn {#1} { \box_use:N \l__sub_i_box } } +\cs_new:Npn \spb_box_super_move_up_ii:n #1 + { \box_move_up:nn {#1} { \box_use:N \l__super_ii_box } } +\cs_new:Npn \spb_box_sub_move_down_ii:n #1 + { \box_move_down:nn {#1} { \box_use:N \l__sub_ii_box } } +\cs_new:Npn \spb_box_vmove_i:nn #1 + { + \str_case:nn {#1} + { + { super } { \spb_box_super_move_up_i:n } + { sub } { \spb_box_sub_move_down_i:n } + } + } +\cs_generate_variant:Nn \spb_box_super_move_up_ii:n { V } +\cs_generate_variant:Nn \spb_box_sub_move_down_ii:n { V } +\dim_new:N \l__spb_supersub_half_vsep_tl +\providecommand{\hbox_overlap_center:n}[1] + { \hbox_to_zero:n { \hss #1\hss } } +\cs_new:Npn \spb_hbox_overlap_vmove_ii:n #1 + { + \tl_set:Nn \l__spb_supersub_half_vsep_tl + { \l__spb_supersub_vsep_tl/2 } + \use:c { hbox_overlap_#1:n } + { \spb_box_super_move_up_ii:V \l__spb_supersub_half_vsep_tl } + \use:c { hbox_overlap_#1:n } + { \spb_box_sub_move_down_ii:V \l__spb_supersub_half_vsep_tl } + } + +\tl_new:N \l__spb_super_cmd_ii_tl +\tl_new:N \l__spb_sub_cmd_ii_tl + +\spb_define:n + { + spcmd .tl_set:N = \l__spb_super_cmd_i_tl, + sbcmd .tl_set:N = \l__spb_sub_cmd_i_tl, + spbcmd .code:n = \spb@both@cmd@assign{#1}, + cmd .code:n = { \spb_local_case_init:nnn { \tl_set:Nn \l__spb_super_cmd_i_tl {#1} } { \tl_set:Nn \l__spb_sub_cmd_i_tl {#1} } { \spb@both@cmd@assign{#1} } }, - spcmd+ .code:n = \tl_put_right:Nn \l__spb_super_cmd_i_tl {#1}, - sbcmd+ .code:n = \tl_put_right:Nn \l__spb_sub_cmd_i_tl {#1}, - spbcmd+ .code:n = \spb@both@cmd@assign+{#1}, - cmd+ .code:n = + spcmd+ .code:n = \tl_put_right:Nn \l__spb_super_cmd_i_tl {#1}, + sbcmd+ .code:n = \tl_put_right:Nn \l__spb_sub_cmd_i_tl {#1}, + spbcmd+ .code:n = \spb@both@cmd@assign+{#1}, + cmd+ .code:n = { \spb_local_case_init:nnn { \tl_put_right:Nn \l__spb_super_cmd_i_tl {#1} } { \tl_put_right:Nn \l__spb_sub_cmd_i_tl {#1} } { \spb@both@cmd@assign+{#1} } - }, + } + } +\NewDocumentCommand{\spb@both@cmd@assign} + {t+>{\SplitArgument{1}{,}}m} + { + \IfBooleanTF{#1} + {\spb_supersub_both_addto_cmd:nn #2} + {\spb_supersub_both_cmd:nn #2} + } +\cs_new_protected:Npn \spb_supersub_both_cmd:nn #1#2 + { + \tl_set:Nn \l__spb_super_cmd_ii_tl {#1} + \tl_if_novalue:nTF {#2} + { \tl_clear:N \l__spb_sub_cmd_ii_tl } + { \tl_set:Nn \l__spb_sub_cmd_ii_tl {#2} } + } +\cs_new_protected:Npn \spb_supersub_both_addto_cmd:nn #1#2 + { + \tl_put_right:Nn \l__spb_super_cmd_ii_tl {#1} + \tl_if_novalue:nF {#2} { \tl_put_right:Nn \l__spb_sub_cmd_ii_tl {#2} } + } + +\spb_define:n + { spheight .tl_set:N = \l__super_height_i_tl, sbheight .tl_set:N = \l__sub_height_i_tl, spbheight .tl_set:N = \l__super_height_ii_tl, @@ -128,25 +197,26 @@ { \tl_set:Nn \l__super_depth_i_tl {#1} } { \tl_set:Nn \l__sub_depth_i_tl {#1} } { \tl_set:Nn \l__sub_depth_ii_tl {#1} } - }, - vsep .tl_set:N = \l__spb_supersub_vsep_tl, - vsep .initial:n = 0.6ex, - halign .tl_set:N = \l__spb_supersub_halign_tl, - halign .initial:n = l, - style .choice:, - style .value_required:n = true, - mode .tl_set:N = \l__spb_mode_value_tl, - mode .initial:n = match + } + } +\cs_new_protected:Npn \spb_ht_dp_assign:nnn #1#2#3 + { + \tl_if_empty:cF { l__#1_height_#3_tl } + { \box_set_ht:cv { l__#1_#3_box } { l__#1_height_#3_tl } } + \tl_if_empty:cF { l__#1_depth_i_tl } + { \box_set_dp:cv { l__#2_#3_box } { l__#2_depth_#3_tl } } } -\cs_set_eq:NN \spb@textsuperscript@save \textsuperscript -\cs_set_eq:NN \spb@textsubscript@save \textsubscript -\cs_set_eq:NN \spb@math@super@save \sp -\cs_set_eq:NN \spb@math@sub@save \sb \box_new:N \l__super_i_box \box_new:N \l__sub_i_box \box_new:N \l__super_ii_box \box_new:N \l__sub_ii_box +\tl_set:Nn \l__spb_box_super_wd_i_tl { \box_wd:N \l__super_i_box } +\tl_set:Nn \l__spb_box_sub_wd_i_tl { \box_wd:N \l__sub_i_box } +\tl_set:Nn \l__spb_box_super_wd_ii_tl { \box_wd:N \l__super_ii_box } +\tl_set:Nn \l__spb_box_sub_wd_ii_tl { \box_wd:N \l__sub_ii_box } +\tl_set:Nn \l__spb_box_max_wd_tl + { \dim_max:VV \l__spb_box_super_wd_ii_tl \l__spb_box_sub_wd_ii_tl } \cs_new:Npn \spb_math_print_store_i:nn #1#2 { \hbox_set:cn { l__#1_i_box } @@ -210,69 +280,7 @@ } } } - } -\tl_set:Nn \l__spb_box_super_wd_i_tl { \box_wd:N \l__super_i_box } -\tl_set:Nn \l__spb_box_sub_wd_i_tl { \box_wd:N \l__sub_i_box } -\tl_set:Nn \l__spb_box_super_wd_ii_tl { \box_wd:N \l__super_ii_box } -\tl_set:Nn \l__spb_box_sub_wd_ii_tl { \box_wd:N \l__sub_ii_box } -\tl_set:Nn \l__spb_box_max_wd_tl - { \dim_max:VV \l__spb_box_super_wd_ii_tl \l__spb_box_sub_wd_ii_tl } -\providecommand{\hbox_overlap_center:n}[1] - { \hbox_to_zero:n { \hss #1\hss } } -\cs_new:Npn \spb_box_super_move_i_up:n #1 - { \box_move_up:nn {#1} { \box_use:N \l__super_i_box } } -\cs_new:Npn \spb_box_sub_move_i_down:n #1 - { \box_move_down:nn {#1} { \box_use:N \l__sub_i_box } } -\cs_new:Npn \spb_box_super_move_ii_up:n #1 - { \box_move_up:nn {#1} { \box_use:N \l__super_ii_box } } -\cs_new:Npn \spb_box_sub_move_ii_down:n #1 - { \box_move_down:nn {#1} { \box_use:N \l__sub_ii_box } } -\cs_new:Npn \spb_box_vmove:nn #1 - { - \str_case:nn {#1} - { - { super } { \spb_box_super_move_i_up:n } - { sub } { \spb_box_sub_move_i_down:n } - } - } -\cs_generate_variant:Nn \spb_box_super_move_ii_up:n { V } -\cs_generate_variant:Nn \spb_box_sub_move_ii_down:n { V } -\dim_new:N \l__spb_supersub_half_vsep_tl -\cs_new:Npn \spb_hbox_overlap_vmove:n #1 - { - \tl_set:Nn \l__spb_supersub_half_vsep_tl - { \l__spb_supersub_vsep_tl/2 } - \use:c { hbox_overlap_#1:n } - { \spb_box_super_move_ii_up:V \l__spb_supersub_half_vsep_tl } - \use:c { hbox_overlap_#1:n } - { \spb_box_sub_move_ii_down:V \l__spb_supersub_half_vsep_tl } - } -\NewDocumentCommand{\spb@both@cmd@assign} - {t+>{\SplitArgument{1}{,}}m} - { - \IfBooleanTF{#1} - {\spb_supersub_both_addto_cmd:nn #2} - {\spb_supersub_both_cmd:nn #2} - } -\cs_new_protected:Npn \spb_supersub_both_cmd:nn #1#2 - { - \tl_set:Nn \l__spb_super_cmd_ii_tl {#1} - \tl_if_novalue:nTF {#2} - { \tl_clear:N \l__spb_sub_cmd_ii_tl } - { \tl_set:Nn \l__spb_sub_cmd_ii_tl {#2} } - } -\cs_new_protected:Npn \spb_supersub_both_addto_cmd:nn #1#2 - { - \tl_put_right:Nn \l__spb_super_cmd_ii_tl {#1} - \tl_if_novalue:nF {#2} { \tl_put_right:Nn \l__spb_sub_cmd_ii_tl {#2} } - } -\cs_new_protected:Npn \spb_ht_dp_assign:nnn #1#2#3 - { - \tl_if_empty:cF { l__#1_height_#3_tl } - { \box_set_ht:cv { l__#1_#3_box } { l__#1_height_#3_tl } } - \tl_if_empty:cF { l__#1_depth_i_tl } - { \box_set_dp:cv { l__#2_#3_box } { l__#2_depth_#3_tl } } - } + } \cs_new_protected:Npn \spb_both_newcmd_map:n #1 { @@ -297,14 +305,14 @@ \hbox_overlap_left:n { \hbox_overlap_right:n - { \spb_box_vmove:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } } + { \spb_box_vmove_i:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } } \skip_horizontal:n { -\tl_use:c { l__spb_#1_hmove_tl } } } } { \hbox_to_wd:nn { \tl_use:c { l__spb_box_#1_wd_i_tl } + \tl_use:c { l__spb_#1_hmove_tl } } - { \hss\spb_box_vmove:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } } + { \hss\spb_box_vmove_i:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } } } } } @@ -334,7 +342,7 @@ { \hbox_overlap_left:n { - \spb_hbox_overlap_vmove:n { right } + \spb_hbox_overlap_vmove_ii:n { right } \skip_horizontal:n { -\l__spb_supersub_hmove_tl } } } @@ -342,7 +350,7 @@ \hbox:n { \skip_horizontal:n { \l__spb_supersub_hmove_tl } - \spb_hbox_overlap_vmove:n { right } + \spb_hbox_overlap_vmove_ii:n { right } \skip_horizontal:n { \l__spb_box_max_wd_tl } } } @@ -352,7 +360,7 @@ { \hbox_overlap_left:n { - \spb_hbox_overlap_vmove:n { center } + \spb_hbox_overlap_vmove_ii:n { center } \skip_horizontal:n { -\l__spb_supersub_hmove_tl - \l__spb_box_max_wd_tl/2 } } } @@ -360,7 +368,7 @@ \hbox:n { \skip_horizontal:n { \l__spb_box_max_wd_tl/2 + \l__spb_supersub_hmove_tl } - \spb_hbox_overlap_vmove:n { center } + \spb_hbox_overlap_vmove_ii:n { center } \skip_horizontal:n { \l__spb_box_max_wd_tl/2 } } } @@ -370,7 +378,7 @@ { \hbox_overlap_left:n { - \spb_hbox_overlap_vmove:n { left } + \spb_hbox_overlap_vmove_ii:n { left } \skip_horizontal:n { -\l__spb_supersub_hmove_tl - \l__spb_box_max_wd_tl } } } @@ -378,7 +386,7 @@ \hbox:n { \skip_horizontal:n { \l__spb_box_max_wd_tl + \l__spb_supersub_hmove_tl } - \spb_hbox_overlap_vmove:n { left } + \spb_hbox_overlap_vmove_ii:n { left } } } } |