diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/spbmark/spbmark.sty | 106 |
1 files changed, 69 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty index f5e40f2b7f0..7df09aaeec0 100644 --- a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty +++ b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty @@ -7,9 +7,9 @@ % conditions of the CC-BY 4.0 License. % The latest version of this license is in % https://creativecommons.org/licenses/by/4.0/legalcode -\NeedsTeXFormat{LaTeX2e}[2018/12/31] +\NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{xparse,l3keys2e} -\ProvidesExplPackage{spbmark}{2021/07/26}{1.05} +\ProvidesExplPackage{spbmark}{2021/07/26}{1.06} {Customize superscripts and subscripts} \cs_new_protected:Npn \spb_define:n { \keys_define:nn { spbmark } } @@ -53,24 +53,14 @@ \tl_set:Nn \l__spb_boxa_wd_tl { \box_wd:N \l_tmpa_box } \tl_set:Nn \l__spb_boxb_wd_tl { \box_wd:N \l_tmpb_box } -\cs_new:Npn \spb_tmp_boxa_use: { \box_use:N \l_tmpa_box } -\cs_new:Npn \spb_tmp_boxb_use: { \box_use:N \l_tmpb_box } -\cs_new:Npn \spb_box_max_dim_horizontal: +\tl_set:Nn \l__spb_box_max_wd_tl + { \dim_max:nn { \l__spb_boxa_wd_tl } { \l__spb_boxb_wd_tl } } +\cs_new:Npn \spb_tmp_boxa_use_vmove:n #1 + { \box_move_up:nn {#1} { \box_use:N \l_tmpa_box } } +\cs_new:Npn \spb_hbox_overlap_position:n #1 { - \skip_horizontal:n - { \dim_max:nn { \l__spb_boxa_wd_tl } { \l__spb_boxb_wd_tl } } - } -\cs_new:Npn \spb_boxwd_subtract:nnnn #1#2#3#4 - { - \skip_horizontal:n - { #1\tl_use:c { l__spb_#3_wd_tl } - #2\tl_use:c { l__spb_#4_wd_tl } } - } -\cs_new:Npn \spb_boxwd_script_align:nn #1#2 - { - \spb_boxwd_subtract:nnnn { 0.5 } { 0.5 } {#1} {#2} - \use:c { spb_tmp_#2_use: } - \spb_boxwd_subtract:nnnn { -0.5 } { 0.5 } {#1} {#2} - \use:c { spb_tmp_#1_use: } + \use:c { hbox_overlap_#1:n } { \box_use:N \l_tmpa_box } + \use:c { hbox_overlap_#1:n } { \box_use:N \l_tmpb_box } } \cs_new:Npn \spb_math_print_store:nnn #1#2#3 { @@ -138,10 +128,23 @@ { \spb_math_print_store:nnn {##4} {#1} {##5} } { \spb_text_print_store:nnn {##4} {#1} {##5} } } - \hbox_set_to_wd:Nnn \l_tmpb_box { \l__spb_boxa_wd_tl + ##6 } - { \hss\box_move_up:nn {##2} { \spb_tmp_boxa_use: } } + \hbox_set:Nn \l_tmpb_box + { + \dim_compare:nNnTF {##6} < { 0pt } + { + \hbox_overlap_left:n + { + \hbox_to_wd:nn { \l__spb_boxa_wd_tl - ##6 } + { \spb_tmp_boxa_use_vmove:n {##2}\hss } + } + } + { + \hbox_to_wd:nn { \l__spb_boxa_wd_tl + ##6 } + { \hss\spb_tmp_boxa_use_vmove:n {##2} } + } + } \spb_box_ht_dp_assign:nn ##3 - \spb_tmp_boxb_use: + \box_use:N \l_tmpb_box } } \NewDocumentCommand{\supersub} @@ -160,10 +163,10 @@ { \spb_math_print_store:nnnn {#4} {#5} {#8} {#6} } { \spb_text_print_store:nnnn {#4} {#5} {#8} {#6} } } - \hbox_set_to_wd:Nnn \l_tmpa_box { \l__spb_boxa_wd_tl + #7 } - { \hss\box_move_up:nn {#2} { \spb_tmp_boxa_use: } } - \hbox_set_to_wd:Nnn \l_tmpb_box { \l__spb_boxb_wd_tl + #7 } - { \hss\box_move_down:nn {#2} { \spb_tmp_boxb_use: } } + \hbox_set:Nn \l_tmpa_box + { \box_move_up:nn {#2} { \box_use:N \l_tmpa_box } } + \hbox_set:Nn \l_tmpb_box + { \box_move_down:nn {#2} { \box_use:N \l_tmpb_box } } \str_case:onF {#3} { { l } { \use_i:nnn } @@ -175,19 +178,48 @@ \use_i:nnn } { - \hbox_overlap_right:n { \spb_tmp_boxa_use: } - \hbox_overlap_right:n { \spb_tmp_boxb_use: } - \spb_box_max_dim_horizontal: + \dim_compare:nNnTF {#7} < { 0pt } + { + \hbox_overlap_left:n + { + \spb_hbox_overlap_position:n { right } + \skip_horizontal:n { -#7 } + } + } + { + \skip_horizontal:n {#7} + \spb_hbox_overlap_position:n { right } + \skip_horizontal:n { \l__spb_box_max_wd_tl } + } } { - \dim_compare:nNnTF { \l__spb_boxa_wd_tl } > { \l__spb_boxb_wd_tl } - { \spb_boxwd_script_align:nn { boxa } { boxb } } - { \spb_boxwd_script_align:nn { boxb } { boxa } } + \dim_compare:nNnTF {#7} < { 0pt } + { + \hbox_overlap_left:n + { + \spb_hbox_overlap_position:n { center } + \skip_horizontal:n { \l__spb_box_max_wd_tl/2 - #7 } + } + } + { + \skip_horizontal:n { \l__spb_box_max_wd_tl/2 + #7 } + \spb_hbox_overlap_position:n { center } + \skip_horizontal:n { \l__spb_box_max_wd_tl/2 } + } } { - \spb_box_max_dim_horizontal: - \hbox_overlap_left:n { \spb_tmp_boxa_use: } - \hbox_overlap_left:n { \spb_tmp_boxb_use: } + \dim_compare:nNnTF {#7} < { 0pt } + { + \hbox_overlap_left:n + { + \spb_hbox_overlap_position:n { left } + \skip_horizontal:n { -#7 } + } + } + { + \skip_horizontal:n { \l__spb_box_max_wd_tl + #7 } + \spb_hbox_overlap_position:n { left } + } } } \msg_new:nnn { spbmark } { unsupported-align } @@ -215,5 +247,5 @@ { \cs_new:Npn \fnmarkfont { \ftntm@font } } { \cs_new:Npn \fnmarkfont { \normalfont } } \endinput -%% -%% End of file `spbmark.sty'. +% +% End of file `spbmark.sty'.
\ No newline at end of file |