texlive[61716] Master/texmf-dist: spbmark (23jan22)

commits+karl at tug.org commits+karl at tug.org
Sun Jan 23 22:12:22 CET 2022


Revision: 61716
          http://tug.org/svn/texlive?view=revision&revision=61716
Author:   karl
Date:     2022-01-23 22:12:21 +0100 (Sun, 23 Jan 2022)
Log Message:
-----------
spbmark (23jan22)

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	2022-01-23 21:12:06 UTC (rev 61715)
+++ trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex	2022-01-23 21:12:21 UTC (rev 61716)
@@ -6,8 +6,8 @@
   {
     package           = spbmark,
     title             = the spbmark package,
-    version           = v1.2H,
-    date              = 2021/12/22,
+    version           = v1.3,
+    date              = 2022/01/23,
     authors           = Qu Yi,
     info              = Customize superscript and subscript,
     email             = q1jx at foxmail.com,
@@ -61,9 +61,9 @@
 \section{User commands}
 There are currently three commands to set superscript and subscript. Their format can be set temporarily using the optional parameters of the command, or set globally using a key-value list, see section \ref{sec:global control interface}.
 \begin{commands}
-  \command{super}[\oarg{kv list}\splitoarg{height}{depth}\marg{content}\oarg{kv list}]
+  \command{super}[\oarg{kv list}\marg{content}\oarg{kv list}]
   This is a superscript output command. The two \meta{kv list} are equivalent.
-  \command{sub}[\oarg{kv list}\splitoarg{height}{depth}\marg{content}\oarg{kv list}]
+  \command{sub}[\oarg{kv list}\marg{content}\oarg{kv list}]
   This is a subscript output command. The two \meta{kv list} are equivalent.
   \command{supersub}[\oarg{kv list}\marg{super cont}\marg{sub cont}\oarg{kv list}]
   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 two \meta{kv list} are equivalent.
@@ -73,9 +73,7 @@
   In some cases, \code{math} or \code{text} output modes require different code for format or move. This command can be used when using the \code{match} option or changing the output mode locally, whitch should be used in the move or format options. It can switch the corresponding code according to different output modes.
 \end{commands}
 
-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{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.
+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. When the following options are used in the \cs{spbset} command, in addition to \option{style} and \option{mode}, they are set according to the type of the previous most recent command.
 \begin{options}
   \keyval{vmove}{fixed length}\Default{0pt}
   Vertical move of superscript or subscript. Represents the extra vertical distance \option{vsep} between superscript and subscript in the superscript and subscript commands.
@@ -85,6 +83,10 @@
   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.
+  \keyval{height}{fixed length}\Default
+  The distance between the superscript or subscript baseline and the previous line.
+  \keyval{depth}{fixed length}\Default
+  The distance between the superscript or subscript baseline and the next line.
   \keyval{style}{style name}\Default
   Use the \meta{style name} defined by the \cs{defspbstyle} command to make it work global or local.
   \keychoice{mode}{text,math,match}\Default{match}
@@ -120,6 +122,14 @@
   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.
+  \keyval{spheight}{fixed length}\Default
+  The distance between the superscript baseline and the previous line.
+  \keyval{spdepth}{fixed length}\Default
+  The distance between the superscript baseline and the next line.
+  \keyval{sbheight}{fixed length}\Default
+  The distance between the subscript baseline and the previous line.
+  \keyval{sbdepth}{fixed length}\Default
+  The distance between the subscript baseline and the next line.
 \end{options}
 
 If \option{sphmove} is positive, the superscript or subscript moves to the right, conversely it moves to the left. However, for superscript, if \option{spvmove} is positive, the superscript moves up, conversely it moves down. For subscript, if \option{spvmove} is positive, the subscript moves down, conversely it moves up.
@@ -132,6 +142,10 @@
   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{spbheight}{fixed length}\Default
+  The distance between the superscript baseline and the previous line.
+  \keyval{spbdepth}{fixed length}\Default
+  The distance between the subscript baseline and the next line.
   \keyval{vsep}{fixed length}\Default{0.6ex}
   The extra vertical distance between superscript and subscript.
   \keychoice{halign}{l,c,r}\Default{l}

Modified: trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2022-01-23 21:12:06 UTC (rev 61715)
+++ trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2022-01-23 21:12:21 UTC (rev 61716)
@@ -1,7 +1,7 @@
 %
 % ***************** THE SPBMARK PACKAGE *****************
 %
-% Copyright (C) 2021 by Qu Yi <q1jx at foxmail.com>
+% Copyright (C) 2021-2022 by Qu Yi <q1jx at foxmail.com>
 %
 % This work may be distributed and/or modified under the
 % conditions of the CC-BY 4.0 License.
@@ -9,9 +9,11 @@
 %   https://creativecommons.org/licenses/by/4.0/legalcode
 \NeedsTeXFormat{LaTeX2e}[2018/12/31]
 \RequirePackage{xparse,l3keys2e}
-\ProvidesExplPackage{spbmark}{2021/12/22}{1.2H}
+\ProvidesExplPackage{spbmark}{2022/01/23}{1.3}
   {Customize superscripts and subscripts}
 
+\cs_generate_variant:Nn \box_set_ht:Nn { cv }
+\cs_generate_variant:Nn \box_set_dp:Nn { cv }
 \cs_generate_variant:Nn \dim_max:nn { VV }
 \cs_generate_variant:Nn \dim_compare:nNnTF { V }
 \cs_generate_variant:Nn \msg_warning:nnn { nnV }
@@ -40,17 +42,15 @@
 
 \tl_new:N \l__spb_super_cmd_ii_tl
 \tl_new:N \l__spb_sub_cmd_ii_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
+\tl_new:N \g__spb_mark_case_init_tl
 
-\cs_new_protected:Npn \spb_local_case_init:nnnn #1#2#3#4
+\cs_new_protected:Npn \spb_local_case_init:nnn #1#2#3
   {
-    \str_case:xn { \tl_use:c { g__spb_#1_init_tl } }
+    \str_case:Vn \g__spb_mark_case_init_tl
       {
-        { super } {#2}
-        { sub } {#3}
-        { supersub } {#4}
+        { super } {#1}
+        { sub } {#2}
+        { supersub } {#3}
       }
   }
 \cs_new_protected:Npn \defspbstyle #1#2
@@ -75,7 +75,7 @@
     spbhmove .initial:n = 0pt,
     vmove .code:n       =
       {
-        \spb_local_case_init:nnnn { vmove }
+        \spb_local_case_init:nnn
           { \tl_set:Nn \l__spb_super_vmove_tl {#1} }
           { \tl_set:Nn \l__spb_sub_vmove_tl {#1} }
           { \tl_set:Nn \l__spb_supersub_vsep_tl {#1} }
@@ -82,7 +82,7 @@
       },
     hmove .code:n       =
       {
-        \spb_local_case_init:nnnn { hmove }
+        \spb_local_case_init:nnn
           { \tl_set:Nn \l__spb_super_hmove_tl {#1} }
           { \tl_set:Nn \l__spb_sub_hmove_tl {#1} }
           { \tl_set:Nn \l__spb_supersub_hmove_tl {#1} }
@@ -94,7 +94,7 @@
     spbcmd .code:n      = \spb at both@cmd at assign{#1},
     cmd .code:n         =
       {
-        \spb_local_case_init:nnnn { cmd }
+        \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 at both@cmd at assign{#1} }
@@ -104,11 +104,31 @@
     spbcmd+ .code:n     = \spb at both@cmd at assign+{#1},
     cmd+ .code:n        =
       {
-        \spb_local_case_init:nnnn { cmd }
+        \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 at both@cmd at assign+{#1} }
       },
+    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,
+    height .code:n      =
+      {
+        \spb_local_case_init:nnn
+          { \tl_set:Nn \l__super_height_i_tl {#1} }
+          { \tl_set:Nn \l__sub_height_i_tl {#1} }
+          { \tl_set:Nn \l__super_height_ii_tl {#1} }
+      },
+    spdepth .tl_set:N   = \l__super_depth_i_tl,
+    sbdepth .tl_set:N   = \l__sub_depth_i_tl,
+    spbdepth .tl_set:N  = \l__sub_depth_ii_tl,
+    depth .code:n       =
+      {
+        \spb_local_case_init:nnn
+          { \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,
@@ -123,9 +143,13 @@
 \cs_set_eq:NN \spb at textsubscript@save \textsubscript
 \cs_set_eq:NN \spb at math@super at save \sp
 \cs_set_eq:NN \spb at math@sub at 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
 \cs_new:Npn \spb_math_print_store_i:nn #1#2
   {
-    \hbox_set:Nn \l_tmpa_box
+    \hbox_set:cn { l__#1_i_box }
       {
         \ensuremath
           {
@@ -136,7 +160,7 @@
   }
 \cs_new:Npn \spb_text_print_store_i:nn #1#2
   {
-    \hbox_set:Nn \l_tmpa_box
+    \hbox_set:cn { l__#1_i_box }
       {
         \use:c { spb at text#1script at save }
           { \tl_use:c { l__spb_#1_cmd_i_tl }{#2} }
@@ -144,16 +168,16 @@
   }
 \cs_new:Npn \spb_math_print_store_ii:nn #1#2
   {
-    \hbox_set:Nn \l_tmpa_box
+    \hbox_set:Nn \l__super_ii_box
       { \ensuremath{\spb at math@super at save{\l__spb_super_cmd_ii_tl{#1}}} }
-    \hbox_set:Nn \l_tmpb_box
+    \hbox_set:Nn \l__sub_ii_box
       { \ensuremath{\spb at math@sub at save{\l__spb_sub_cmd_ii_tl{#2}}} }
   }
 \cs_new:Npn \spb_text_print_store_ii:nn #1#2
   {
-    \hbox_set:Nn \l_tmpa_box
+    \hbox_set:Nn \l__super_ii_box
       { \spb at textsuperscript@save{\l__spb_super_cmd_ii_tl{#1}} }
-    \hbox_set:Nn \l_tmpb_box
+    \hbox_set:Nn \l__sub_ii_box
       { \spb at textsubscript@save{\l__spb_sub_cmd_ii_tl{#2}} }
   }
 \cs_set_eq:NN \spbifmath \use_ii:nn
@@ -187,28 +211,32 @@
         }
       }
    }
-\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 }
+\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_boxa_wd_tl \l__spb_boxb_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_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_vmove:nn #1
+\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_boxa_move_up:n }
-        { sub } { \spb_boxa_move_down:n }
+        { super } { \spb_box_super_move_i_up:n }
+        { sub } { \spb_box_sub_move_i_down:n }
       }
   }
-\cs_generate_variant:Nn \spb_boxa_move_up:n { V }
-\cs_generate_variant:Nn \spb_boxb_move_down:n { V }
+\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
   {
@@ -215,15 +243,10 @@
     \tl_set:Nn \l__spb_supersub_half_vsep_tl
       { \l__spb_supersub_vsep_tl/2 }
     \use:c { hbox_overlap_#1:n }
-      { \spb_boxa_move_up:V \l__spb_supersub_half_vsep_tl }
+      { \spb_box_super_move_ii_up:V \l__spb_supersub_half_vsep_tl }
     \use:c { hbox_overlap_#1:n }
-      { \spb_boxb_move_down:V \l__spb_supersub_half_vsep_tl }
+      { \spb_box_sub_move_ii_down:V \l__spb_supersub_half_vsep_tl }
   }
-\cs_new_protected:Npn \spb_box_ht_dp_assign:nn #1#2
-  {
-    \tl_if_empty:nF {#1} { \box_set_ht:Nn \l_tmpa_box {#1} }
-    \tl_if_novalue:nF {#2} { \box_set_dp:Nn \l_tmpa_box {#2} }
-  }
 \NewDocumentCommand{\spb at both@cmd at assign}
   {t+>{\SplitArgument{1}{,}}m}
   {
@@ -243,31 +266,31 @@
     \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_global_value_init:n #1
+\cs_new_protected:Npn \spb_ht_dp_assign:nnn #1#2#3
   {
-    \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}
+    \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
   {
-    \exp_args:Nc \NewDocumentCommand {#1}
-      {O{}>{\SplitArgument{1}{,}}O{}mO{}}
+    \exp_args:Nc \NewDocumentCommand {#1}{O{}mO{}}
       {
         \group_begin:
-        \spb_global_value_init:n {#1}
-        \keys_set:nn { ctex/style } {##1,##4}
-        \spb_mode_switch:nnn {#1} {##3} { i }
+        \tl_gset:Nn \g__spb_mark_case_init_tl {#1}
+        \keys_set:nn { ctex/style } {##1,##3}
+        \spb_mode_switch:nnn {#1} {##2} { i }
         \spb_content_hbox_set:n {#1}
-        \spb_box_ht_dp_assign:nn ##2
-        \box_use:N \l_tmpa_box
+        \spb_ht_dp_assign:nnn {#1} {#1} { i }
+        \box_use:c { l__#1_i_box }
         \group_end:
       }
   }
 \cs_new_protected:Npn \spb_content_hbox_set:n #1
   {
-    \hbox_set:Nn \l_tmpa_box
+    \hbox_set:cn { l__#1_i_box }
       {
         \dim_compare:nNnTF { \tl_use:c { l__spb_#1_hmove_tl } } < { 0pt }
           {
@@ -274,14 +297,14 @@
             \hbox_overlap_left:n
               {
                 \hbox_overlap_right:n
-                  { \spb_boxa_vmove:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } }
+                  { \spb_box_vmove: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
-              { \l__spb_boxa_wd_tl + \tl_use:c { l__spb_#1_hmove_tl } }
-              { \hss\spb_boxa_vmove:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } }
+              { \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 } } }
           }
       }
   }
@@ -292,9 +315,10 @@
 \NewDocumentCommand{\supersub}{O{}mmO{}}
   {
     \group_begin:
-    \spb_global_value_init:n { supersub }
+    \tl_gset:Nn \g__spb_mark_case_init_tl { supersub }
     \keys_set:nn { ctex/style } {#1,#4}
     \spb_mode_switch:nnn {#2} {#3} { ii }
+    \spb_ht_dp_assign:nnn { super } { sub } { ii }
     \str_case:VnF \l__spb_supersub_halign_tl
       {
         { l } { \use_i:nnn }



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