From 83b88676e8526454a292a894c5f30451eb75b828 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Fri, 30 Jul 2021 03:02:15 +0000
Subject: CTAN sync 202107300302

---
 macros/latex/contrib/spbmark/spbmark.sty | 61 ++++++++++++++++++++------------
 1 file changed, 38 insertions(+), 23 deletions(-)

(limited to 'macros/latex/contrib/spbmark/spbmark.sty')

diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty
index 3a35bcd11f..56c06b6d0a 100644
--- a/macros/latex/contrib/spbmark/spbmark.sty
+++ b/macros/latex/contrib/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}{2021/07/28}{1.08}
+\ProvidesExplPackage{spbmark}{2021/07/29}{1.1}
   {Customize superscripts and subscripts}
 
 \cs_new_protected:Npn \spb_define:n { \keys_define:nn { spbmark } }
@@ -59,8 +59,18 @@
   { \hbox_to_zero:n { \hss #1\hss } }
 \cs_new:Npn \spb_boxa_move_up:n #1
   { \box_move_up:nn {#1} { \box_use:N \l_tmpa_box } }
+\cs_new:Npn \spb_boxa_move_down:n #1
+  { \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
+  {
+    \str_case:nn {#1}
+      {
+        { super } { \spb_boxa_move_up:n }
+        { sub } { \spb_boxa_move_down:n }
+      }
+  }
 \cs_new:Npn \spb_hbox_overlap_vshift:n #1#2
   {
     \use:c { hbox_overlap_#2:n } { \spb_boxa_move_up:n {#1} }
@@ -78,13 +88,15 @@
   }
 \cs_new:Npn \spb_math_print_store:nnnn #1#2#3#4
   {
-    \hbox_set:Nn \l_tmpa_box { \ensuremath{#1{\spb@sp@save{#2}}} }
-    \hbox_set:Nn \l_tmpb_box { \ensuremath{#3{\spb@sb@save{#4}}} }
+    \hbox_set:Nn \l_tmpa_box { \ensuremath{#1{\spb@sp@save{#3}}} }
+    \hbox_set:Nn \l_tmpb_box
+      { \ensuremath{\tl_if_novalue:nF {#2} {#2}{\spb@sb@save{#4}}} }
   }
 \cs_new:Npn \spb_text_print_store:nnnn #1#2#3#4
   {
-    \hbox_set:Nn \l_tmpa_box { #1{\spb@textsuperscript@save{#2}} }
-    \hbox_set:Nn \l_tmpb_box { #3{\spb@textsubscript@save{#4}} }
+    \hbox_set:Nn \l_tmpa_box { #1{\spb@textsuperscript@save{#3}} }
+    \hbox_set:Nn \l_tmpb_box
+      { \tl_if_novalue:nF {#2} {#2}{\spb@textsubscript@save{#4}} }
   }
 \cs_set_eq:NN \spb@textsuperscript@save \textsuperscript
 \cs_set_eq:NN \spb@textsubscript@save \textsubscript
@@ -139,12 +151,12 @@
                 \hbox_overlap_left:n
                   {
                     \hbox_to_wd:nn { \l__spb_boxa_wd_tl - ##6 }
-                      { \spb_boxa_move_up:n {##2}\hss }
+                      { \spb_boxa_vshift:nn {#1} {##2}\hss }
                   }
               }
               {
                 \hbox_to_wd:nn { \l__spb_boxa_wd_tl + ##6 }
-                  { \hss\spb_boxa_move_up:n {##2} }
+                  { \hss\spb_boxa_vshift:nn {#1} {##2} }
               }
           }
         \spb_box_ht_dp_assign:nn ##3
@@ -154,18 +166,21 @@
 \NewDocumentCommand{\supersub}
   {
     sO{\l__spb_supersub_script_sep_dim}
-    O{\l__spb_supersub_script_align_tl}
-    D(){\l__spb_super_script_formatii_tl}mm
-    O{\l__spb_supersub_script_hshift_dim}
-    D(){\l__spb_sub_script_formatii_tl}
+    D(){\l__spb_supersub_script_align_tl}
+    mmO{\l__spb_supersub_script_hshift_dim}
+    >{\SplitArgument{1}{,}}D()
+    {
+      \l__spb_super_script_formatii_tl,
+      \l__spb_sub_script_formatii_tl
+    }
   }
   {
     \IfBooleanTF{#1}
-      {\spb_math_print_store:nnnn {#4} {#5} {#8} {#6}}
+      {\spb_math_print_store:nnnn #7 {#4} {#5}}
       {
         \mode_if_math:TF
-          { \spb_math_print_store:nnnn {#4} {#5} {#8} {#6} }
-          { \spb_text_print_store:nnnn {#4} {#5} {#8} {#6} }
+          { \spb_math_print_store:nnnn #7 {#4} {#5} }
+          { \spb_text_print_store:nnnn #7 {#4} {#5} }
       }
     \str_case:onF {#3}
       {
@@ -178,54 +193,54 @@
         \use_i:nnn
       }
       {
-        \dim_compare:nNnTF {#7} < { 0pt }
+        \dim_compare:nNnTF {#6} < { 0pt }
           {
             \hbox_overlap_left:n
               {
                 \spb_hbox_overlap_vshift:n {#2} { right } 
-                \skip_horizontal:n { -#7 }
+                \skip_horizontal:n { -#6 }
               }
           }
           {
             \hbox:n
               {
-                \skip_horizontal:n {#7}
+                \skip_horizontal:n {#6}
                 \spb_hbox_overlap_vshift:n {#2} { right } 
                 \skip_horizontal:n { \l__spb_box_max_wd_tl }
               }
           }
       }
       {
-        \dim_compare:nNnTF {#7} < { 0pt }
+        \dim_compare:nNnTF {#6} < { 0pt }
           {
             \hbox_overlap_left:n
               {
                 \spb_hbox_overlap_vshift:n {#2} { center } 
-                \skip_horizontal:n { \l__spb_box_max_wd_tl/2 - #7 }
+                \skip_horizontal:n { \l__spb_box_max_wd_tl/2 - #6 }
               }
           }
           {
             \hbox:n
               {
-                \skip_horizontal:n { \l__spb_box_max_wd_tl/2 + #7 }
+                \skip_horizontal:n { \l__spb_box_max_wd_tl/2 + #6 }
                 \spb_hbox_overlap_vshift:n {#2} { center } 
                 \skip_horizontal:n { \l__spb_box_max_wd_tl/2 }
               }
           }
       }
       {
-        \dim_compare:nNnTF {#7} < { 0pt }
+        \dim_compare:nNnTF {#6} < { 0pt }
           {
             \hbox_overlap_left:n
               {
                 \spb_hbox_overlap_vshift:n {#2} { left } 
-                \skip_horizontal:n { -#7 }
+                \skip_horizontal:n { -#6 }
               }
           }
           {
             \hbox:n
               {
-                \skip_horizontal:n { \l__spb_box_max_wd_tl + #7 }
+                \skip_horizontal:n { \l__spb_box_max_wd_tl + #6 }
                 \spb_hbox_overlap_vshift:n {#2} { left } 
               }
           }
-- 
cgit v1.2.3

