texlive[61342] Master/texmf-dist: spbmark (18dec21)

commits+karl at tug.org commits+karl at tug.org
Sat Dec 18 21:56:50 CET 2021


Revision: 61342
          http://tug.org/svn/texlive?view=revision&revision=61342
Author:   karl
Date:     2021-12-18 21:56:50 +0100 (Sat, 18 Dec 2021)
Log Message:
-----------
spbmark (18dec21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf
    trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex
    trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty

Modified: trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex	2021-12-18 20:56:36 UTC (rev 61341)
+++ trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex	2021-12-18 20:56:50 UTC (rev 61342)
@@ -6,8 +6,8 @@
   {
     package           = spbmark,
     title             = the spbmark package,
-    version           = v1.2B,
-    date              = 2021/12/16,
+    version           = v1.2C,
+    date              = 2021/12/18,
     authors           = Qu Yi,
     info              = Customize superscript and subscript,
     email             = q1jx at foxmail.com,
@@ -47,7 +47,7 @@
   \keybool{math}\Default{false}
   \cs{sp} and \cs{sb} are equivalent to the \cs{super} and \cs{sub} commands.
   \keybool{foot}\Default{false}
-  The format of the footnote mark match the superscript offsets and format of the \cs{spbset} global setting.
+  The format of the footnote mark match the superscript move and format of the \cs{spbset} global setting.
   \opt{both}\Default!
   The values of \option{text} and \option{math} two options are \code{true} at the same time.
   \opt{all}\Default!
@@ -71,14 +71,16 @@
 
 The optional parameter \splitmeta{height}{depth} generally does not need to be used. The \meta{height} and \meta{depth} are separated by commas. Only the front part indicates the \meta{height} of the superscript or subscript, and only the back part indicates the \meta{depth}.
 
-The options common to \meta{kv list} of the three commands are as follows. They can be used in \meta{key-value list} for the \cs{spbset} command. If \option{vshift}, \option{hshift} and \option{cmd} are used in the \cs{spbset} command, it is set according to the type of the previous nearest command.
+The options common to \meta{kv list} of the three commands are as follows. They can be used in \meta{key-value list} for the \cs{spbset} command. If \option{vmove}, \option{hmove} and \option{cmd} are used in the \cs{spbset} command, it is set according to the type of the previous nearest command.
 \begin{options}
-  \keyval{vshift}{fixed length}\Default{0pt}
-  Vertical shift of superscript or subscript. Represents the vertical distance \option{vsep} between superscript and subscript in the superscript and subscript commands.
-  \keyval{hshift}{fixed length}\Default{0pt}
-  Horizontal shift of superscript or subscript. Represents the common shift in the superscript and subscript commands.
+  \keyval{vmove}{fixed length}\Default{0pt}
+  Vertical move of superscript or subscript. Represents the vertical distance \option{vsep} between superscript and subscript in the superscript and subscript commands.
+  \keyval{hmove}{fixed length}\Default{0pt}
+  Horizontal move of superscript or subscript. Represents the common move in the superscript and subscript commands.
   \keyval{cmd}{format cmds}\Default
-  The format command of superscript or subscript. The last command can take a parameter, which accepts superscript or subscript. Represents the format of superscript and subscript in the superscript and subscript commands.
+  The format commands of superscript or subscript. The last command can take a parameter, which accepts superscript or subscript. Represents the format of superscript and subscript in the superscript and subscript commands.
+  \keyval{cmd+}{format cmds}\Default
+  Add code to the previous global superscript or subscript format commands.
   \keychoice{mode}{text,math,match}\Default{match}
   The mode of superscript or subscript output can be \code{text} or \code{math} mode. The \code{match} option automatically matches output modes according to the current mode.
 \end{options}
@@ -92,56 +94,62 @@
 
 The following list of keys control the format both of superscript or subscript.
 \begin{options}
-  \keyval{spvshift}{fixed length}\Default{0pt}
-  Extra vertical shift of the superscript. 
-  \keyval{sphshift}{fixed length}\Default{0pt}
-  Extra horizontal shift of the superscript.
-  \keyval{sbvshift}{fixed length}\Default{0pt}
-  Extra vertical shift of the subscript.
-  \keyval{sbhshift}{fixed length}\Default{0pt}
-  Extra horizontal shift of the subscript.
-  \opt{nohshift}\Default!
-  Cancel the horizontal offset of superscript and subscript at the same time.
-  \opt{novshift}\Default!
-  Cancel the vertical offset of superscript and subscript at the same time.
+  \keyval{spvmove}{fixed length}\Default{0pt}
+  Extra vertical move of the superscript. 
+  \keyval{sphmove}{fixed length}\Default{0pt}
+  Extra horizontal move of the superscript.
+  \keyval{sbvmove}{fixed length}\Default{0pt}
+  Extra vertical move of the subscript.
+  \keyval{sbhmove}{fixed length}\Default{0pt}
+  Extra horizontal move of the subscript.
+  \opt{nohmove}\Default!
+  Cancel the horizontal move of superscript and subscript at the same time.
+  \opt{novmove}\Default!
+  Cancel the vertical move of superscript and subscript at the same time.
   \keyval{spcmd}{format cmds}\Default
-  Control the format of superscript, the last command in the code can take an argument, which is a superscript.
+  The format commands of superscript. The last command in the code can take an argument, which is a superscript.
+  \keyval{spcmd+}{format cmds}\Default
+  Add code to the previous global superscript format commands.
   \keyval{sbcmd}{format cmds}\Default
-  Control the format of subscript, the last command in the code can take an argument, which is a subscript.
+  The format commands of subscript. The last command in the code can take an argument, which is a subscript.
+  \keyval{sbcmd+}{format cmds}\Default
+  Add code to the previous global subcript format commands.
 \end{options}
 
-If \option{sphshift} is positive, the superscript or subscript moves to the right, and if it is negative, it moves to the left. However, for superscript, if \option{spvshift} is positive, the superscript moves up, and if spvshift is negative, it moves down. For subscripts, if \option{spvshift} is positive, the subscript moves down, and if spvshift is negative, it moves up.
+If \option{sphmove} is positive, the superscript or subscript moves to the right, and if it is negative, it moves to the left. However, for superscript, if \option{spvmove} is positive, the superscript moves up, and if spvmove is negative, it moves down. For subscripts, if \option{spvmove} is positive, the subscript moves down, and if spvmove is negative, it moves up.
 
 The following list of keys control the format of superscript and subscript.
 \begin{options}
-  \keyval{spbhshift}{fixed length}\Default{0pt}
-  Extra vertical shift of the superscript and the subscript.
+  \keyval{spbhmove}{fixed length}\Default{0pt}
+  Extra vertical move of the superscript and the subscript.
   \kvsplit{spbcmd}{super cmds}{sub cmds}\Default
-  Control the format of superscript or subscript. The first part is in superscript format, and the latter part is in subscript format. They are separated by commas, or only the first part exists.
-  \keyval{vsep}{fixed length}\Default{0.3ex}
-  The distance between superscript and subscript, its default value is \code{0.3ex}.
+  The format commands of superscript and subscript. The first part is in superscript format, and the latter part is in subscript format. They are separated by commas, or only the first part exists.
+  \kvsplit{spbcmd+}{super cmds}{sub cmds}\Default
+  Add code to the previous global superscript and subscript format commands.
+  \keyval{vsep}{fixed length}\Default{0.6ex}
+  The vertical distance between superscript and subscript.
   \keychoice{halign}{l,c,r}\Default{l}
   The alignment of superscript and subscript, which contains \code{l}, \code{c}, and \code{r} parameters respectively for left, center, and right alignment.
 \end{options}
 
 \section{Examples of use}
-Here is a list of the three commands, please pay attention to the usage of optional parameters. Note when the horizontal offset is negative, the starting point is at the right end of the mark.
+Here is a list of the three commands, please pay attention to the usage of optional parameters. Note when the horizontal move is negative, the starting point is at the right end of the mark.
 \begin{example}
 \spbset{spbcmd={\ttfamily,\color{blue}}}
-A\super[vshift=0.2ex,hshift=0.2em,cmd=\textcolor{red}]{exam}B \\
+A\super[vmove=0.2ex,hmove=0.2em,cmd=\textcolor{red}]{exam}B \\
 $A\sub[cmd=\mathsf,mode=math]{exam}B$ \\
-A\supersub[vsep=0.3ex,halign=c]{examsuper}{sub}B \\
-A\super{c}[vshift=5pt,hshift=-1.5pt]B\sub[vshift=5pt,hshift=-1pt]{d}AB
+A\supersub[vsep=0.6ex,halign=c]{examsuper}{sub}B \\
+A\super{c}[vmove=5pt,hmove=-5.5pt]B\sub[vmove=5pt,hmove=-5pt]{d}AB
 \end{example}
 
 It can also be used with the \pkg*{siunitx} package to output superscript and subscript in the unit:
 \begin{example}
-\unit[mode=math]{kg.m/s\super[vshift=-1pt]{2}} \\
-\qty[mode=text]{30}{A\supersub[hshift=1pt,cmd=\color{red}]{b}{c}} \\
-\spbset{sbhshift=2pt}\unit[mode=text]{A\sub{b}}
+\unit[mode=math]{kg.m/s\super[vmove=-1pt]{2}} \\
+\qty[mode=text]{30}{A\supersub[hmove=1pt,cmd=\color{red}]{b}{c}} \\
+\spbset{sbhmove=2pt}\unit[mode=text]{A\sub{b}}
 \end{example}
 
-\pkg*{spbmark} also patches the footer markers for standard document class and \cls*{KOMA-Script}. You can format the footer markers by redefining the \cs{fnmarkfont} command. Note that extra horizontal shift does not work with footnote markers.
+\pkg*{spbmark} also patches the footer markers for standard document class and \cls*{KOMA-Script}. You can format the footer markers by redefining the \cs{fnmarkfont} command. Note that extra horizontal move does not work with footnote markers.
 
 \section{Developer commands}
 If you need to use the original definitions of \cs{textsuperscript}, \cs{textsubscript}, \cs{sp} and \cs{sb} after using the \option{text} or \option{math} option, then you can use the following commands:
@@ -157,7 +165,7 @@
 \end{commands}
 
 \section{Known issues}
-At present, the vertical and horizontal offsets are effective for the unit commands in the \pkg*{siunitx} macro package. However, due to the special mechanism that the decimal point is not recognized correctly because it's converted to a space in the \cs*{unit} command, it's recommended to use \code{pt} as the unit of offset.
+At present, the vertical and horizontal move are effective for the unit commands in the \pkg*{siunitx} macro package. However, due to the special mechanism that the decimal point is not recognized correctly because it's converted to a space in the \cs*{unit} command, it's recommended to use \code{pt} as the unit of move.
 
 \nocite{*}
 

Modified: trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2021-12-18 20:56:36 UTC (rev 61341)
+++ trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2021-12-18 20:56:50 UTC (rev 61342)
@@ -9,7 +9,7 @@
 %   https://creativecommons.org/licenses/by/4.0/legalcode
 \NeedsTeXFormat{LaTeX2e}[2018/12/31]
 \RequirePackage{xparse,l3keys2e}
-\ProvidesExplPackage{spbmark}{2021/12/16}{1.2B}
+\ProvidesExplPackage{spbmark}{2021/12/18}{1.2C}
   {Customize superscripts and subscripts}
 
 \cs_generate_variant:Nn \dim_max:nn { VV }
@@ -40,8 +40,8 @@
 
 \tl_new:N \l__spb_super_cmd_ii_tl
 \tl_new:N \l__spb_sub_cmd_ii_tl
-\tl_new:N \g__spb_hshift_init_tl
-\tl_new:N \g__spb_vshift_init_tl
+\tl_new:N \g__spb_hmove_init_tl
+\tl_new:N \g__spb_vmove_init_tl
 \tl_new:N \g__spb_cmd_init_tl
 
 \cs_new_protected:Npn \spb_local_case_init:nnnn #1#2#3#4
@@ -55,48 +55,58 @@
   }
 \spb_define:n
   {
-    spvshift .dim_set:N   = \l__spb_super_vshift_dim,
-    spvshift .initial:n   = 0pt,
-    sphshift .dim_set:N   = \l__spb_super_hshift_dim,
-    sphshift .initial:n   = 0pt,
-    sbvshift .dim_set:N   = \l__spb_sub_vshift_dim,
-    sbvshift .initial:n   = 0pt,
-    sbhshift .dim_set:N   = \l__spb_sub_hshift_dim,
-    sbhshift .initial:n   = 0pt,
-    spbhshift .dim_set:N  = \l__spb_supersub_hshift_dim,
-    spbhshift .initial:n  = 0pt,
-    vshift .code:n        =
+    spvmove .dim_set:N  = \l__spb_super_vmove_dim,
+    spvmove .initial:n  = 0pt,
+    sphmove .dim_set:N  = \l__spb_super_hmove_dim,
+    sphmove .initial:n  = 0pt,
+    sbvmove .dim_set:N  = \l__spb_sub_vmove_dim,
+    sbvmove .initial:n  = 0pt,
+    sbhmove .dim_set:N  = \l__spb_sub_hmove_dim,
+    sbhmove .initial:n  = 0pt,
+    spbhmove .dim_set:N = \l__spb_supersub_hmove_dim,
+    spbhmove .initial:n = 0pt,
+    vmove .code:n       =
       {
-        \spb_local_case_init:nnnn { vshift }
-          { \dim_set:Nn \l__spb_super_vshift_dim {#1} }
-          { \dim_set:Nn \l__spb_sub_vshift_dim {#1} }
+        \spb_local_case_init:nnnn { vmove }
+          { \dim_set:Nn \l__spb_super_vmove_dim {#1} }
+          { \dim_set:Nn \l__spb_sub_vmove_dim {#1} }
           { \dim_set:Nn \l__spb_supersub_vsep_dim {#1} }
       },
-    hshift .code:n        =
+    hmove .code:n       =
       {
-        \spb_local_case_init:nnnn { hshift }
-          { \dim_set:Nn \l__spb_super_hshift_dim {#1} }
-          { \dim_set:Nn \l__spb_sub_hshift_dim {#1} }
-          { \dim_set:Nn \l__spb_supersub_hshift_dim {#1} }
+        \spb_local_case_init:nnnn { hmove }
+          { \dim_set:Nn \l__spb_super_hmove_dim {#1} }
+          { \dim_set:Nn \l__spb_sub_hmove_dim {#1} }
+          { \dim_set:Nn \l__spb_supersub_hmove_dim {#1} }
       },
-    nohshift .meta:n      = { sphshift = 0pt,sbhshift = 0pt },
-    novshift .meta:n      = { spvshift = 0pt,sbvshift = 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:n {#1},
-    cmd .code:n           =
+    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 at both@cmd at assign{#1},
+    cmd .code:n         =
       {
         \spb_local_case_init:nnnn { cmd }
           { \tl_set:Nn \l__spb_super_cmd_i_tl {#1} }
           { \tl_set:Nn \l__spb_sub_cmd_i_tl {#1} }
-          { \spb_both_cmd_assign:n {#1} }
+          { \spb at both@cmd at assign{#1} }
       },
-    vsep .dim_set:N       = \l__spb_supersub_vsep_dim,
-    vsep .initial:n       = 0.3ex,
-    halign .tl_set:N      = \l__spb_supersub_align_tl,
-    halign .initial:n     = l,
-    mode .tl_set:N        = \l__spb_mode_value_tl,
-    mode .initial:n       = match
+    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 at both@cmd at assign+{#1},
+    cmd+ .code:n        =
+      {
+        \spb_local_case_init:nnnn { cmd }
+          { \tl_put_right:Nn \l__spb_super_cmd_i_tl {#1} }
+          { \tl_put_right:Nn \l__spb_sub_cmd_i_tl {#1} }
+          { \spb at both@cmd at assign+{#1} }
+      },
+    vsep .dim_set:N     = \l__spb_supersub_vsep_dim,
+    vsep .initial:n     = 0.6ex,
+    halign .tl_set:N    = \l__spb_supersub_halign_tl,
+    halign .initial:n   = l,
+    mode .tl_set:N      = \l__spb_mode_value_tl,
+    mode .initial:n     = match
   }
 
 \tl_set:Nn \l__spb_boxa_wd_tl { \box_wd:N \l_tmpa_box }
@@ -111,7 +121,7 @@
   { \box_move_down:nn {#1} { \box_use:N \l_tmpa_box } }
 \cs_new:Npn \spb_boxb_move_down:n #1
   { \box_move_down:nn {#1} { \box_use:N \l_tmpb_box } }
-\cs_new:Npn \spb_boxa_vshift:nn #1
+\cs_new:Npn \spb_boxa_vmove:nn #1
   {
     \str_case:nn {#1}
       {
@@ -121,12 +131,15 @@
   }
 \cs_generate_variant:Nn \spb_boxa_move_up:n { V }
 \cs_generate_variant:Nn \spb_boxb_move_down:n { V }
-\cs_new:Npn \spb_hbox_overlap_vshift:n #1
+\dim_new:N \l__spb_supersub_half_vsep_dim
+\cs_new:Npn \spb_hbox_overlap_vmove:n #1
   {
+    \dim_set:Nn \l__spb_supersub_half_vsep_dim
+      { \l__spb_supersub_vsep_dim/2 }
     \use:c { hbox_overlap_#1:n }
-      { \spb_boxa_move_up:V \l__spb_supersub_vsep_dim }
+      { \spb_boxa_move_up:V \l__spb_supersub_half_vsep_dim }
     \use:c { hbox_overlap_#1:n }
-      { \spb_boxb_move_down:V \l__spb_supersub_vsep_dim }
+      { \spb_boxb_move_down:V \l__spb_supersub_half_vsep_dim }
   }
 \cs_set_eq:NN \spb at textsuperscript@save \textsuperscript
 \cs_set_eq:NN \spb at textsubscript@save \textsubscript
@@ -170,9 +183,13 @@
     \tl_if_empty:nF {#1} { \box_set_ht:Nn \l_tmpb_box {#1} }
     \tl_if_novalue:nF {#2} { \box_set_dp:Nn \l_tmpb_box {#2} }
   }
-\NewDocumentCommand{\spb_both_cmd_assign:n}
-  {>{\SplitArgument{1}{,}}m}
-  {\spb_supersub_both_cmd:nn #1}
+\NewDocumentCommand{\spb at both@cmd at 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}
@@ -180,19 +197,31 @@
       { \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_mode_switch:nnn #1#2#3
   {
     \str_case:Vn \l__spb_mode_value_tl
       {
-        { math } {#1}
-        { text } {#2}
-        { match } {#3}
+        { math }
+        { \use:c { spb_math_print_store_#3:nn } {#1} {#2} }
+        { text }
+        { \use:c { spb_text_print_store_#3:nn } {#1} {#2} }
+        { match }
+        {
+          \mode_if_math:TF
+            { \use:c { spb_math_print_store_#3:nn } {#1} {#2} }
+            { \use:c { spb_text_print_store_#3:nn } {#1} {#2} }
+        }
       }
    }
 \cs_new_protected:Npn \spb_global_value_init:n #1
   {
-    \tl_gset:Nn \g__spb_hshift_init_tl {#1}
-    \tl_gset:Nn \g__spb_vshift_init_tl {#1}
+    \tl_gset:Nn \g__spb_hmove_init_tl {#1}
+    \tl_gset:Nn \g__spb_vmove_init_tl {#1}
     \tl_gset:Nn \g__spb_cmd_init_tl {#1}
   }
 
@@ -204,14 +233,7 @@
         \group_begin:
         \spb_global_value_init:n {#1}
         \keys_set:nn { ctex/style } {##1,##4}
-        \spb_mode_switch:nnn
-          { \spb_math_print_store_i:nn {#1} {##3} }
-          { \spb_text_print_store_i:nn {#1} {##3} }
-          {
-            \mode_if_math:TF
-              { \spb_math_print_store_i:nn {#1} {##3} }
-              { \spb_text_print_store_i:nn {#1} {##3} }
-          }
+        \spb_mode_switch:nnn {#1} {##3} { i }
         \spb_content_hbox_set:n {#1}
         \spb_box_ht_dp_assign:nn ##2
         \box_use:N \l_tmpa_box
@@ -219,50 +241,37 @@
       }
   }
 \cs_new_protected:Npn \spb_content_hbox_set:n #1
-   {
-     \hbox_set:Nn \l_tmpa_box
-       {
-         \dim_compare:nNnTF { \dim_use:c { l__spb_#1_hshift_dim } } < { 0pt }
-           {
-             \hbox_overlap_left:n
-               {
-                 \hbox_to_wd:nn
-                   { \l__spb_boxa_wd_tl - \dim_use:c { l__spb_#1_hshift_dim } }
-                   {
-                      \spb_boxa_vshift:nn {#1}
-                        { \dim_use:c { l__spb_#1_vshift_dim } }\hss
-                   }
-               }
-           }
-           {
-             \hbox_to_wd:nn
-               { \l__spb_boxa_wd_tl + \dim_use:c { l__spb_#1_hshift_dim } }
-               {
-                  \hss\spb_boxa_vshift:nn {#1}
-                    { \dim_use:c { l__spb_#1_vshift_dim } }
-               }
-           }
-       }
-   }
+  {
+    \hbox_set:Nn \l_tmpa_box
+      {
+        \dim_compare:nNnTF { \dim_use:c { l__spb_#1_hmove_dim } } < { 0pt }
+          {
+            \hbox_overlap_left:n
+              {
+                \hbox_overlap_right:n
+                  { \spb_boxa_vmove:nn {#1} { \dim_use:c { l__spb_#1_vmove_dim } } }
+                \skip_horizontal:n { -\dim_use:c { l__spb_#1_hmove_dim } }
+              }
+          }
+          {
+            \hbox_to_wd:nn
+              { \l__spb_boxa_wd_tl + \dim_use:c { l__spb_#1_hmove_dim } }
+              { \hss\spb_boxa_vmove:nn {#1} { \dim_use:c { l__spb_#1_vmove_dim } } }
+          }
+      }
+  }
 \clist_map_inline:nn { super,sub } { \spb_both_newcmd_map:n {#1} }
 
-\cs_new:Npn \spb_supersub_hshift_if_negative:TF #1#2
-  { \dim_compare:VNnTF \l__spb_supersub_hshift_dim < { 0pt } {#1} {#2} }
+\cs_new:Npn \spb_supersub_hmove_if_negative:TF #1#2
+  { \dim_compare:VNnTF \l__spb_supersub_hmove_dim < { 0pt } {#1} {#2} }
 \NewDocumentCommand{\supersub}{O{}mmO{}}
   {
     \group_begin:
     \spb_global_value_init:n { supersub }
     \keys_set:nn { ctex/style } {#1,#4}
-    \spb_mode_switch:nnn
-      { \spb_math_print_store_ii:nn {#2} {#3} }
-      { \spb_text_print_store_ii:nnnn {#2} {#3} }
+    \spb_mode_switch:nnn {#2} {#3} { ii }
+    \str_case:VnF \l__spb_supersub_halign_tl
       {
-        \mode_if_math:TF
-          { \spb_math_print_store_ii:nn {#2} {#3} }
-          { \spb_text_print_store_ii:nn {#2} {#3} }
-      }
-    \str_case:VnF \l__spb_supersub_align_tl
-      {
         { l } { \use_i:nnn }
         { c } { \use_ii:nnn }
         { r } { \use_iii:nnn }
@@ -272,58 +281,55 @@
         \use_i:nnn
       }
       {
-        \spb_supersub_hshift_if_negative:TF
+        \spb_supersub_hmove_if_negative:TF
           {
             \hbox_overlap_left:n
               {
-                \spb_hbox_overlap_vshift:n { right }
-                \skip_horizontal:n { -\l__spb_supersub_hshift_dim }
+                \spb_hbox_overlap_vmove:n { right }
+                \skip_horizontal:n { -\l__spb_supersub_hmove_dim }
               }
           }
           {
             \hbox:n
               {
-                \skip_horizontal:n { \l__spb_supersub_hshift_dim }
-                \spb_hbox_overlap_vshift:n { right } 
+                \skip_horizontal:n { \l__spb_supersub_hmove_dim }
+                \spb_hbox_overlap_vmove:n { right } 
                 \skip_horizontal:n { \l__spb_box_max_wd_tl }
               }
           }
       }
       {
-        \spb_supersub_hshift_if_negative:TF
+        \spb_supersub_hmove_if_negative:TF
           {
             \hbox_overlap_left:n
               {
-                \spb_hbox_overlap_vshift:n { center }
-                \skip_horizontal:n
-                  { \l__spb_box_max_wd_tl/2 - \l__spb_supersub_hshift_dim }
+                \spb_hbox_overlap_vmove:n { center }
+                \skip_horizontal:n { \l__spb_box_max_wd_tl/2 - \l__spb_supersub_hmove_dim }
               }
           }
           {
             \hbox:n
               {
-                \skip_horizontal:n
-                  { \l__spb_box_max_wd_tl/2 + \l__spb_supersub_hshift_dim }
-                \spb_hbox_overlap_vshift:n { center } 
+                \skip_horizontal:n { \l__spb_box_max_wd_tl/2 + \l__spb_supersub_hmove_dim }
+                \spb_hbox_overlap_vmove:n { center } 
                 \skip_horizontal:n { \l__spb_box_max_wd_tl/2 }
               }
           }
       }
       {
-        \spb_supersub_hshift_if_negative:TF
+        \spb_supersub_hmove_if_negative:TF
           {
             \hbox_overlap_left:n
               {
-                \spb_hbox_overlap_vshift:n { left }
-                \skip_horizontal:n { -\l__spb_supersub_hshift_dim }
+                \spb_hbox_overlap_vmove:n { left }
+                \skip_horizontal:n { -\l__spb_supersub_hmove_dim }
               }
           }
           {
             \hbox:n
               {
-                \skip_horizontal:n
-                  { \l__spb_box_max_wd_tl + \l__spb_supersub_hshift_dim }
-                \spb_hbox_overlap_vshift:n { left } 
+                \skip_horizontal:n { \l__spb_box_max_wd_tl + \l__spb_supersub_hmove_dim }
+                \spb_hbox_overlap_vmove:n { left } 
               }
           }
       }



More information about the tex-live-commits mailing list.