texlive[60111] Master/texmf-dist: spbmark (29jul21)

commits+karl at tug.org commits+karl at tug.org
Thu Jul 29 22:36:02 CEST 2021


Revision: 60111
          http://tug.org/svn/texlive?view=revision&revision=60111
Author:   karl
Date:     2021-07-29 22:36:02 +0200 (Thu, 29 Jul 2021)
Log Message:
-----------
spbmark (29jul21)

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-07-29 20:35:48 UTC (rev 60110)
+++ trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex	2021-07-29 20:36:02 UTC (rev 60111)
@@ -6,8 +6,8 @@
   {
     package   = spbmark,
     title     = the spbmark package,
-    version   = v1.08,
-    date      = 2021/07/28,
+    version   = v1.1,
+    date      = 2021/07/29,
     authors   = Qu Yi,
     info      = Customize superscript and subscript,
     email     = quee123 at foxmail.com,
@@ -28,7 +28,7 @@
   {%
     \ensuremath{\langle}%
     \textcolor{meta}{\argumentformat #1}%
-    \ensuremath{\rangle,\langle}%
+    \ensuremath{\rangle},\ensuremath{\langle}%
     \textcolor{meta}{\argumentformat #2}%
     \ensuremath{\rangle}%
   }
@@ -41,6 +41,7 @@
   {\item\code{\option{#1}\cnltx at isvalue\splitmarg{#2}{#3}}}
 \newsplitarg{\splitoarg}{[}{]}
 \newsplitarg{\splitmarg}{\{}{\}}
+\newsplitarg{\splitdarg}{(}{)}
 \makeatother
 
 \begin{document}
@@ -49,7 +50,7 @@
 \label{sec:macro package options}
 \begin{options}
   \opt{ctex}\Default!
-  This option works with the C\TeX{} document class used by simplified Chinese users, there's actually no functional change. Adding path \option*{style} to \cs*{ctexset} command, which is equivalent to using \cs{spbset}.
+  This option works with the C\TeX{} document class used by simplified Chinese users, there's actually no functional change. Adding path \module*{style} to \cs*{ctexset} command, which is equivalent to using \cs{spbset}.
   \keybool{newsupb}\Default{true}
   \option{newsupb} is a boolean option with a default value of true that redefines the \LaTeX{} kernel commands to cause \cs{sp} and \cs{textsuperscript} are equivalent to \cs{super} command, and \cs{sb} and \cs{textsubscript} are equivalent to \cs{sub} command.
 \end{options}
@@ -61,8 +62,8 @@
   This is a superscript output command. If \meta{vshift} or \meta{hshift} is a positive value, the superscript moves up or to the right, if it's negative, the superscript moves down or to the left.
   \command{sub}[\sarg\oarg{vshift}\splitoarg{height}{depth}\darg{code}\marg{content}\oarg{hshift}]
   This is a subscript output command. If \meta{vshift} or \meta{hshift} is a positive value, the subscript moves down or to the right, if it's negative, the subscript moves up or to the left.
-  \command{supersub}[\sarg\oarg{vsep}\oarg{align}\darg{sup code}\marg{sup cont}\marg{sub cont}\oarg{hshift}\darg{sub code}]
-  This is a command that outputs both superscript and subscript at the same time. The \meta{vsep} represents the vertical spacing between superscript and subscript, same as option \option{supersubsep}. The parameters of \meta{align} are the same as the \option{supersubalign}.
+  \command{supersub}[\sarg\oarg{vsep}\darg{align}\marg{sup cont}\marg{sub cont}\oarg{hshift}\splitdarg{sup code}{sub code}]
+  This is a command that outputs both superscript and subscript at the same time. You can also use the shorter command \cs{spb} instead of it. The \meta{vsep} represents the vertical spacing between superscript and subscript, same as option \option{supersubsep}. The parameters of \meta{align} are the same as the \option{supersubalign}.
 \end{commands}
 
 These commands can match the corresponding pattern depending on whether they are currently in text mode or mathematical mode, or they can use an asterisk variant to force the mathematical pattern. 
@@ -79,7 +80,7 @@
   Save the original definition of the \cs{textsubscript} command, output subscript in the text.
   \command{spb at sp@save}[\marg{content}]
   Save the original definition of the \cs{sp} command, output superscript in the math mode.
-  \command{spb at sbt@save}[\marg{content}]
+  \command{spb at sb@save}[\marg{content}]
   Save the original definition of the \cs{sb} command, output subscript in the math mode.
 \end{commands}
 
@@ -112,10 +113,10 @@
   Extra vertical shift of the superscript and the subscript.
   \kvsplit{supersub-format}{super code}{sub code}\Default{0pt}
   Control the format of superscript or subscript. The first part is in superscript format, and the latter part is in subscript format. The two are separated by commas, or only the first part exists.
-  \keyval{supersubsep}{rubber length}\Default{0.3ex}
+  \keyval{supersubsep}{fixed length}\Default{0.3ex}
   The distance between superscript and subscript, its default value is \code{0.3ex}.
   \keychoice{supersubalign}{l,c,r}\Default{l}
-  The alignment of superscript and subscript, which contains \option*{l}, \option*{c}, and \option*{r} parameters respectively for left, center, and right alignment.
+  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}
@@ -124,14 +125,14 @@
 \spbset{supersub-format = {\ttfamily,\color{blue}}}
 A\super[0.2ex](\textcolor{red}){exam}[0.2em]B \\
 $A\sub(\mathsf){exam}B$ \\
-A\supersub[0.3ex][c]{examsuper}{sub}B \\
-A\super[5pt]{c}[-1.5pt]B\sub[-5pt]{d}[-1pt]AB
+A\supersub[0.3ex](c){examsuper}{sub}B \\
+A\super[5pt]{c}[-1.5pt]B\sub[5pt]{d}[-1pt]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*[-1pt]{2}} \\
-\qty[mode = text]{30}{A\supersub(\color{red}){b}{c}[1pt]} \\
+\qty[mode = text]{30}{A\supersub{b}{c}[1pt](\color{red})} \\
 \spbset{sub-hshift = 2pt}\unit[mode = text]{A_b}
 \end{example}
 

Modified: trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2021-07-29 20:35:48 UTC (rev 60110)
+++ trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2021-07-29 20:36:02 UTC (rev 60111)
@@ -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 at sp@save{#2}}} }
-    \hbox_set:Nn \l_tmpb_box { \ensuremath{#3{\spb at sb@save{#4}}} }
+    \hbox_set:Nn \l_tmpa_box { \ensuremath{#1{\spb at sp@save{#3}}} }
+    \hbox_set:Nn \l_tmpb_box
+      { \ensuremath{\tl_if_novalue:nF {#2} {#2}{\spb at sb@save{#4}}} }
   }
 \cs_new:Npn \spb_text_print_store:nnnn #1#2#3#4
   {
-    \hbox_set:Nn \l_tmpa_box { #1{\spb at textsuperscript@save{#2}} }
-    \hbox_set:Nn \l_tmpb_box { #3{\spb at textsubscript@save{#4}} }
+    \hbox_set:Nn \l_tmpa_box { #1{\spb at textsuperscript@save{#3}} }
+    \hbox_set:Nn \l_tmpb_box
+      { \tl_if_novalue:nF {#2} {#2}{\spb at textsubscript@save{#4}} }
   }
 \cs_set_eq:NN \spb at textsuperscript@save \textsuperscript
 \cs_set_eq:NN \spb at 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,18 +193,18 @@
         \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 }
               }
@@ -196,18 +211,18 @@
           }
       }
       {
-        \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 }
               }
@@ -214,18 +229,18 @@
           }
       }
       {
-        \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 } 
               }
           }



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