texlive[59739] Master/texmf-dist: spbmark (28jun21)

commits+karl at tug.org commits+karl at tug.org
Mon Jun 28 22:37:07 CEST 2021


Revision: 59739
          http://tug.org/svn/texlive?view=revision&revision=59739
Author:   karl
Date:     2021-06-28 22:37:07 +0200 (Mon, 28 Jun 2021)
Log Message:
-----------
spbmark (28jun21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf
    trunk/Master/texmf-dist/source/latex/spbmark/spbmark.dtx
    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/source/latex/spbmark/spbmark.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/spbmark/spbmark.dtx	2021-06-28 20:36:54 UTC (rev 59738)
+++ trunk/Master/texmf-dist/source/latex/spbmark/spbmark.dtx	2021-06-28 20:37:07 UTC (rev 59739)
@@ -11,7 +11,8 @@
 % \iffalse
 %<*driver>
 \documentclass{l3doc}
-\usepackage{spbmark}
+\usepackage{spbmark,siunitx}
+\usepackage[noto]{newtxmath}
 \OnlyDescription
 \begin{document}
   \DocInput{\jobname.dtx}
@@ -22,7 +23,7 @@
 %
 % \title{\pkg{spbmark} -- Superscript and subscript of text}
 % \author{Qu Yi}
-% \date{2021/06/26\hskip 1em\relax v1.00\thanks{\url{https://github.com/texl3/spbmark}}}
+% \date{2021/06/28\hskip 1em\relax v1.00a\thanks{\url{https://github.com/texl3/spbmark}}}
 %
 % \maketitle
 % \begin{abstract}
@@ -36,10 +37,10 @@
 % \end{function}
 %
 % \section{User commands}
-% \begin{function}[added = 2021-06-26]{\super,\sub,\supersub,\textsuperscript,\textsubscript}
+% \begin{function}[added = 2021-06-26,updated = 2021-06-28]{\super,\sub,\supersub,\textsuperscript,\textsubscript}
 % \begin{syntax}
-%   \tn{super*}\oarg{vertical shift}\parg{format code}\marg{content}\oarg{horizontal shift}
-%   \tn{sub*}\oarg{vertical shift}\parg{format code}\marg{content}\oarg{horizontal shift}
+%   \tn{super*}\oarg{vshift}[<height>,<depth>]\parg{code}\marg{content}\oarg{hshift}
+%   \tn{sub*}\oarg{vshift}[<height>,<depth>]\parg{code}\marg{content}\oarg{hshift}
 %   \tn{supersub*}\oarg{script sep}\oarg{script align}\parg{super format code}
 %   \          \marg{super content}\marg{sub content}
 %   \          \oarg{horizontal shift}\parg{sub format code}
@@ -47,10 +48,12 @@
 % \tn{super} command is used to output superscripts, \tn{sub} command is used to output subscripts, \tn{supersub} command is used to output both superscripts and subscripts.
 % \end{function}
 %
-% They 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. The vertical shift and horizontal shift are both 0pt, and the parameters of \meta{script align} are the same as the \texttt{supersubalign}.
+% They 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. The \meta{vshift} and \meta{hshift} represent respectively vertical and horizontal offsets of superscript or subscript, their default value is 0 pt, and the parameters of \meta{script align} are the same as the \texttt{supersubalign}.
 %
-% The \meta{format code} is used to format superscripts and subscripts, and can insert commands such as fonts or colors. The last command in the code can take an argument, which is either a superscript or a subscript.
+% The second optional parameter generally does not need to be used. The \meta{height} and \meta{depth} are separated by commas. Only the front part indicates the height of the superscript or subscript, and only the back part indicates the depth.
 %
+% The \meta{code} is used to format superscripts and subscripts, and can insert commands such as fonts or colors. The last command in the code can take an argument, which is either a superscript or a subscript.
+%
 % The \tn{textsuperscript} and \tn{textsubscript} commands have been redefined to be equivalent to \tn{super} and \tn{sub} respectively, if you need to use their original definitions, then \tn{spb at textsuperscript@save} and \tn{spb at textsubscript@save} will be available.
 %
 % \section{Global control interface}
@@ -77,7 +80,7 @@
 % \DescribeOption{super-hshift} Extra horizontal shift of the superscripts. \\
 % \DescribeOption{sub-vshift} Extra vertical shift of the subscripts. \\
 % \DescribeOption{sub-hshift} Extra horizontal shift of the subscripts. \\
-% \DescribeOption{supersubsep} The distance between superscript and subscript when using \tn{supersub}, its default value is 0.3ex. \\
+% \DescribeOption{supersubsep} The distance between superscript and subscript when using \tn{supersub}, its default value is 0.3 ex. \\
 % \DescribeOption{supersubalign} The alignment of superscript and subscript when using \tn{supersub}, which contains l, c, and r parameters respectively for left, center, and right alignment. \\
 %
 % \section{Examples of use}
@@ -86,16 +89,27 @@
 %   \noindent
 %   |A\super[0.2ex](\color{red}){exam}[0.2em]B| \\
 %   |$A\sub(\mathsf){exam}B$| \\
-%   |A\supersub[0.3ex][c]{examsuper}{examsub}B| \\
+%   |A\supersub[0.3ex][c]{examsuper}{sub}B| \\
 %   A\super[0.2ex](\color{red}){exam}[0.2em]B \\
 %   $A\sub(\mathsf){exam}B$ \\
-%   A\supersub[0.3ex][c]{examsuper}{examsub}B
+%   A\supersub[0.3ex][c]{examsuper}{sub}B
 % \end{quotation}
 %
-% \pkg{spbmark} also patches the standard document class and the footer markers for \cls{KOMA-Script}. You can format the footer markers by redefining the \tn{fnmarkfont} command. Note that extra horizontal shift does not work with footnote markers.
+% It can also be used with the \pkg{siunitx} package to output superscripts and subscripts in the unit:
+% \begin{quotation}
+%   \noindent
+%   |\unit[mode = math]{kg.m/s\super*[-1pt]{2}}| \\
+%   |\qty[mode = text]{30}{A\supersub(\color{red}){b}{c}[1pt]}| \\
+%   |\spbset{sub-hshift = 2pt}\unit[mode = text]{A_b}| \\
+%   \unit[mode = math]{kg.m/s\super*[-1pt]{2}} \\
+%   \qty[mode = text]{30}{A\supersub(\color{red}){b}{c}[1pt]} \\
+%   \spbset{sub-hshift = 2pt}\unit[mode = text]{A_b}
+% \end{quotation}
 %
+% \pkg{spbmark} also patches the footer markers for standard document class and \cls{KOMA-Script}. You can format the footer markers by redefining the \tn{fnmarkfont} command. Note that extra horizontal shift does not work with footnote markers.
+%
 % \section{Known issues}
-% At present, the vertical and horizontal offsets are effective for the unit commands in the text mode of the \pkg{siunitx} macro package. \tn{super} and \tn{sub} can also be used normally in its unit commands, but when the unit is output in the math mode, \tn{supersub} command cannot be used.
+% 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 is converted to a space in the \tn{unit} command, it is recommended to use \texttt{pt} as the unit of offset.
 %
 % \newcommand\urlprefix{\newline\hspace*{\fill}}
 % \let\OldUrl\url
@@ -113,7 +127,7 @@
 %<*package>
 \NeedsTeXFormat{LaTeX2e}[2020/10/01]
 \RequirePackage{l3keys2e}
-\ProvidesExplPackage{spbmark}{2021/06/26}{1.00}{beta}
+\ProvidesExplPackage{spbmark}{2021/06/28}{1.00a}{beta}
 
 \cs_new_protected:Npn \spb_define:n { \keys_define:nn { spbmark } }
 \cs_new_protected:Npn \spbset { \keys_set:nn { spbmark } }
@@ -143,10 +157,13 @@
     supersubalign .tl_set:N   = \l__spb_supersub_script_align_tl,
     supersubalign .initial:n  = l
   }
+
 \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_tmp_hboxa_set:n #1 { \hbox_set:Nn \l_tmpa_box {#1} }
+\cs_new:Npn \spb_tmp_hboxb_set:n #1 { \hbox_set:Nn \l_tmpb_box {#1} }
 \cs_new:Npn \spb_box_max_dim_horizontal:
   {
     \skip_horizontal:n
@@ -174,27 +191,34 @@
         { sub } { \sb }
       }
   }
+\cs_new_protected:Npn \spb_box_dp_ht_assign:nn #1#2
+  {
+    \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} }
+  }
 \clist_map_inline:nn
   { super,sub }
   {
     \exp_args:Nc \NewDocumentCommand {#1}
       {
-        sO{\dim_use:c { l__spb_#1_script_vshift_dim }}D(){}m
-        O{\dim_use:c { l__spb_#1_script_hshift_dim }}
+        sO{\dim_use:c { l__spb_#1_script_vshift_dim }}
+        >{\SplitArgument{1}{,}}O{}D(){}
+        mO{\dim_use:c { l__spb_#1_script_hshift_dim }}
       }
       {
         \IfBooleanTF{##1}
-          {\hbox_set:Nn \l_tmpa_box { $##3{\spb_math:nn {#1} {##4}}$ }}
+          {\spb_tmp_hboxa_set:n { $##4{\spb_math:nn {#1} {##5}}$ }}
           {
             \mode_if_math:TF
-              { \hbox_set:Nn \l_tmpa_box { $##3{\spb_math:nn {#1} {##4}}$ } }
+              { \spb_tmp_hboxa_set:n { $##4{\spb_math:nn {#1} {##5}}$ } }
               {
-                \hbox_set:Nn \l_tmpa_box
-                  { ##3{\use:c { spb at text#1script at save }{##4}} }
+                \spb_tmp_hboxa_set:n
+                  { ##4{\use:c { spb at text#1script at save }{##5}} }
               }
           }
-        \hbox_set_to_wd:Nnn \l_tmpb_box { \l__spb_boxa_wd_tl + ##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: } }
+        \spb_box_dp_ht_assign:nn ##3
         \spb_tmp_boxb_use:
       }
   }
@@ -206,17 +230,17 @@
   {
     \IfBooleanTF{#1}
       {
-        \hbox_set:Nn \l_tmpa_box { $#4{\sp{#5}}$ }
-        \hbox_set:Nn \l_tmpb_box { $#8{\sb{#6}}$ }
+        \spb_tmp_hboxa_set:n { $#4{\sp{#5}}$ }
+        \spb_tmp_hboxb_set:n  { $#8{\sb{#6}}$ }
       }{
         \mode_if_math:TF
           {
-            \hbox_set:Nn \l_tmpa_box { $#4{\sp{#5}}$ }
-            \hbox_set:Nn \l_tmpb_box { $#8{\sb{#6}}$ }
+            \spb_tmp_hboxa_set:n { $#4{\sp{#5}}$ }
+            \spb_tmp_hboxb_set:n  { $#8{\sb{#6}}$ }
           }
           {
-            \hbox_set:Nn \l_tmpa_box { #4{\spb at textsuperscript@save{#5}} }
-            \hbox_set:Nn \l_tmpb_box { #8{\spb at textsubscript@save{#6}} }
+            \spb_tmp_hboxa_set:n { #4{\spb at textsuperscript@save{#5}} }
+            \spb_tmp_hboxb_set:n  { #8{\spb at textsubscript@save{#6}} }
           }
       }
     \hbox_set_to_wd:Nnn \l_tmpa_box { \l__spb_boxa_wd_tl + #7 }
@@ -223,14 +247,17 @@
       { \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: } }
-    \str_case:nnF {#3}
+    \str_case:onF {#3}
       {
         { l } { \use_i:nnn }
         { c } { \use_ii:nnn }
         { r } { \use_iii:nnn }
       }
-      { \use_i:nnn }
       {
+        \msg_warning:nn { spbmark } { unsupported-align }
+        \use_i:nnn
+      }
+      {
         \hbox_overlap_right:n { \spb_tmp_boxa_use: }
         \hbox_overlap_right:n { \spb_tmp_boxb_use: }
         \spb_box_max_dim_horizontal:
@@ -246,6 +273,11 @@
         \hbox_overlap_left:n { \spb_tmp_boxb_use: }
       }
   }
+\msg_new:nnn { spbmark } { unsupported-align }
+  {
+    Alignment~only~supports~l,~c,~and~r. \\
+    The~l~parameter~will~be~used~by~default.
+  }
 \cs_set_eq:NN \textsuperscript \super
 \cs_set_eq:NN \textsubscript \sub
 \cs_set:Npn \@makefnmark

Modified: trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2021-06-28 20:36:54 UTC (rev 59738)
+++ trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2021-06-28 20:37:07 UTC (rev 59739)
@@ -13,7 +13,7 @@
 %%   https://creativecommons.org/licenses/by/4.0/legalcode
 \NeedsTeXFormat{LaTeX2e}[2020/10/01]
 \RequirePackage{l3keys2e}
-\ProvidesExplPackage{spbmark}{2021/06/26}{1.00}{beta}
+\ProvidesExplPackage{spbmark}{2021/06/28}{1.00a}{beta}
 
 \cs_new_protected:Npn \spb_define:n { \keys_define:nn { spbmark } }
 \cs_new_protected:Npn \spbset { \keys_set:nn { spbmark } }
@@ -43,10 +43,13 @@
     supersubalign .tl_set:N   = \l__spb_supersub_script_align_tl,
     supersubalign .initial:n  = l
   }
+
 \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_tmp_hboxa_set:n #1 { \hbox_set:Nn \l_tmpa_box {#1} }
+\cs_new:Npn \spb_tmp_hboxb_set:n #1 { \hbox_set:Nn \l_tmpb_box {#1} }
 \cs_new:Npn \spb_box_max_dim_horizontal:
   {
     \skip_horizontal:n
@@ -74,27 +77,34 @@
         { sub } { \sb }
       }
   }
+\cs_new_protected:Npn \spb_box_dp_ht_assign:nn #1#2
+  {
+    \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} }
+  }
 \clist_map_inline:nn
   { super,sub }
   {
     \exp_args:Nc \NewDocumentCommand {#1}
       {
-        sO{\dim_use:c { l__spb_#1_script_vshift_dim }}D(){}m
-        O{\dim_use:c { l__spb_#1_script_hshift_dim }}
+        sO{\dim_use:c { l__spb_#1_script_vshift_dim }}
+        >{\SplitArgument{1}{,}}O{}D(){}
+        mO{\dim_use:c { l__spb_#1_script_hshift_dim }}
       }
       {
         \IfBooleanTF{##1}
-          {\hbox_set:Nn \l_tmpa_box { $##3{\spb_math:nn {#1} {##4}}$ }}
+          {\spb_tmp_hboxa_set:n { $##4{\spb_math:nn {#1} {##5}}$ }}
           {
             \mode_if_math:TF
-              { \hbox_set:Nn \l_tmpa_box { $##3{\spb_math:nn {#1} {##4}}$ } }
+              { \spb_tmp_hboxa_set:n { $##4{\spb_math:nn {#1} {##5}}$ } }
               {
-                \hbox_set:Nn \l_tmpa_box
-                  { ##3{\use:c { spb at text#1script at save }{##4}} }
+                \spb_tmp_hboxa_set:n
+                  { ##4{\use:c { spb at text#1script at save }{##5}} }
               }
           }
-        \hbox_set_to_wd:Nnn \l_tmpb_box { \l__spb_boxa_wd_tl + ##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: } }
+        \spb_box_dp_ht_assign:nn ##3
         \spb_tmp_boxb_use:
       }
   }
@@ -106,17 +116,17 @@
   {
     \IfBooleanTF{#1}
       {
-        \hbox_set:Nn \l_tmpa_box { $#4{\sp{#5}}$ }
-        \hbox_set:Nn \l_tmpb_box { $#8{\sb{#6}}$ }
+        \spb_tmp_hboxa_set:n { $#4{\sp{#5}}$ }
+        \spb_tmp_hboxb_set:n  { $#8{\sb{#6}}$ }
       }{
         \mode_if_math:TF
           {
-            \hbox_set:Nn \l_tmpa_box { $#4{\sp{#5}}$ }
-            \hbox_set:Nn \l_tmpb_box { $#8{\sb{#6}}$ }
+            \spb_tmp_hboxa_set:n { $#4{\sp{#5}}$ }
+            \spb_tmp_hboxb_set:n  { $#8{\sb{#6}}$ }
           }
           {
-            \hbox_set:Nn \l_tmpa_box { #4{\spb at textsuperscript@save{#5}} }
-            \hbox_set:Nn \l_tmpb_box { #8{\spb at textsubscript@save{#6}} }
+            \spb_tmp_hboxa_set:n { #4{\spb at textsuperscript@save{#5}} }
+            \spb_tmp_hboxb_set:n  { #8{\spb at textsubscript@save{#6}} }
           }
       }
     \hbox_set_to_wd:Nnn \l_tmpa_box { \l__spb_boxa_wd_tl + #7 }
@@ -123,14 +133,17 @@
       { \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: } }
-    \str_case:nnF {#3}
+    \str_case:onF {#3}
       {
         { l } { \use_i:nnn }
         { c } { \use_ii:nnn }
         { r } { \use_iii:nnn }
       }
-      { \use_i:nnn }
       {
+        \msg_warning:nn { spbmark } { unsupported-align }
+        \use_i:nnn
+      }
+      {
         \hbox_overlap_right:n { \spb_tmp_boxa_use: }
         \hbox_overlap_right:n { \spb_tmp_boxb_use: }
         \spb_box_max_dim_horizontal:
@@ -146,6 +159,11 @@
         \hbox_overlap_left:n { \spb_tmp_boxb_use: }
       }
   }
+\msg_new:nnn { spbmark } { unsupported-align }
+  {
+    Alignment~only~supports~l,~c,~and~r. \\
+    The~l~parameter~will~be~used~by~default.
+  }
 \cs_set_eq:NN \textsuperscript \super
 \cs_set_eq:NN \textsubscript \sub
 \cs_set:Npn \@makefnmark



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