texlive[62415] Master/texmf-dist: spbmark (4mar22)

commits+karl at tug.org commits+karl at tug.org
Fri Mar 4 22:59:15 CET 2022


Revision: 62415
          http://tug.org/svn/texlive?view=revision&revision=62415
Author:   karl
Date:     2022-03-04 22:59:15 +0100 (Fri, 04 Mar 2022)
Log Message:
-----------
spbmark (4mar22)

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-03-04 21:58:50 UTC (rev 62414)
+++ trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex	2022-03-04 21:59:15 UTC (rev 62415)
@@ -1,13 +1,13 @@
 \documentclass[load-preamble+]{cnltx-doc}
 
-\usepackage{spbmark,siunitx,pifont}
+\usepackage{spbmark,siunitx,pifont,hologo}
 \usepackage[noto]{newtxmath}
 \setcnltx
   {
     package           = spbmark,
     title             = the spbmark package,
-    version           = v1.38,
-    date              = 2022/03/02,
+    version           = v1.39,
+    date              = 2022/03/04,
     authors           = Qu Yi,
     info              = Customize superscript and subscript,
     email             = q1jx at foxmail.com,
@@ -20,7 +20,9 @@
     title-format      = \huge\bfseries\scshape,
     add-frame-options = {innerleftmargin = 2em},
     listings-options  = {numbers = none,gobble = 2},
-    pre-output        = {\parindent = 0em}
+    pre-output        = {\parindent = 0em},
+    before-skip       = \smallskipamount,
+    after-skip        = \smallskipamount
   }
 
 \makeatletter
@@ -39,6 +41,7 @@
 \newsplitarg{\splitmarg}{\{}{\}}
 \newsplitarg{\splitdarg}{(}{)}
 \newnote{\newtag}[1][New]{\textcolor{red}{\ding{73}\ #1}}
+\renewcommand{\emph}[1]{\textcolor{red}{#1}}
 \makeatother
 
 \begin{document}
@@ -76,6 +79,23 @@
   Defines the style of the superscript or subscript used for the \option{style} option.
   \command{spbifmath}[\marg{math code}\marg{text code}]
   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.
+
+  When the horizontal movement distance of the marker is \emph{non-negative}, since the \cs{super} and \cs{sub} commands put the marker in a horizontal box, the horizontal position is staggered when using superscript and subscript \emph{consecutively}, which is a different mechanism than the sequential use of \code{\^{}} and \code{\_} symbols in math mode. The following three commands save the width of the previous marker, use it for negative move of the \option{hmove} option of the next marker, and provide the corresponding alignment.
+
+  It should be noted that the following commands should save the longer width of the marker, that is, the longer width of the marker in the front, the shorter width of the marker in the back. This is due to the fact that horizontal movement uses a negative distance to leave the marker in a zero-width box state.
+  \command{llastwd}\newtag%
+  Save the width of the previous marker and provide left alignment.
+  \command{clastwd}\newtag%
+  Save the width of the previous marker and provide center alignment.
+  \command{rlastwd}\newtag%
+  Save the width of the previous marker and provide right alignment.
+  \begin{example}
+  A\super{bcd}\sub{e}B \\
+  A\super{bcd}\sub[hmove=-\llastwd]{e}B \\
+  A\sub{e}\super{bcd}[hmove=-\llastwd]B \\
+  A\super{bcd}\sub[hmove=-\clastwd]{e}B \\
+  A\super{bcd}\sub[hmove=-\rlastwd]{e}B \\
+  \end{example}
   \command{spbshortkv}[\marg{short opt}\marg{key value}]\newtag%
   Converts any existing key-value pair to a shorthand option. The value of key \code{\#1} indicates that the shorthand option needs to be assigned a value.
   \begin{example}
@@ -87,20 +107,22 @@
   \end{example}
 \end{commands}
 
-Since the \cs{super} and \cs{sub} commands enclose the scripts in a horizontal box, the horizontal positions are staggered when using both superscript and subscript, which is different from the simultaneous use of \code{\^{}} and \code{\_} symbols in math mode. In this case, you need to adjust the horizontal offset of the latter command or use the \cs{supersub} command.
-
 The options common to \meta{kv list} of the three commands are as follows. They can also be used in \meta {key-value list} of the \cs{spbset} command. In this situation, in addition to \option{style} and \option{mode}, they will be 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.
   \keyval{hmove}{fixed length}\Default{0pt}
-  Horizontal move of superscript or subscript. Represents the common move in the superscript and subscript commands.
+  Horizontal move of superscript or subscript. Represents the common move in the superscript and subscript commands. Moved values can be expressed mathematically:
+  \begin{example}
+  A\super{b}[vmove=0.4ex+4pt/2,hmove=2pt*3-11.5pt] \\
+  A\supersub[vsep={3pt,6pt-2bp}]{examsuper}{sub}
+  \end{example}
   \keyval{cmd}{format cmds}
   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}
   Add code to the previous global superscript or subscript format commands.
   \keyval{height}{fixed length}
-  The distance between the superscript or subscript baseline and the previous line.
+  The distance between the superscript or subscript baseline and the previous line. It is recommended that the superscript adjusts the height and the subscript adjusts the depth.
   \keyval{depth}{fixed length}
   The distance between the superscript or subscript baseline and the next line.
   \keyval{style}{style name}
@@ -116,7 +138,7 @@
   \pkg*{spbmark} uses the \cs{spbset} command to control the global default format of superscript and subscript. These options also apply to \meta{kv list} of the above commands. The values ​​set by it will be overwritten by the optional parameters of the superscript and other commands.
 \end{commands}
 
-The following list of keys control the format both of superscript \textcolor{red}{or} subscript.
+The following list of keys control the format both of superscript \emph{or} subscript.
 \begin{options}
   \keyval{spvmove}{fixed length}\Default{0pt}
   Extra vertical move of the superscript. 
@@ -150,7 +172,7 @@
 
 If \option{sphmove} is positive, the superscript or subscript moves to the right, conversely it moves to the left. The positive direction of vertical offset of subscript and superscript is opposite. 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.
 
-The following list of keys control the format of superscript \textcolor{red}{and} subscript.
+The following list of keys control the format of superscript \emph{and} subscript.
 \begin{options}
   \keyval{spbhmove}{fixed length}\Default{0pt}
   Extra vertical move of the superscript and the subscript.

Modified: trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2022-03-04 21:58:50 UTC (rev 62414)
+++ trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty	2022-03-04 21:59:15 UTC (rev 62415)
@@ -9,12 +9,13 @@
 %   https://creativecommons.org/licenses/by/4.0/legalcode
 \NeedsTeXFormat{LaTeX2e}[2018/12/31]
 \RequirePackage{xparse,l3keys2e}
-\ProvidesExplPackage{spbmark}{2022/03/02}{1.38}
+\ProvidesExplPackage{spbmark}{2022/03/04}{1.39}
   {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_gset:Nn { Nv }
 \cs_generate_variant:Nn \dim_compare:nNnTF { V }
 \cs_generate_variant:Nn \msg_warning:nnn { nnV }
 \cs_generate_variant:Nn \str_case:nn { x }
@@ -227,6 +228,9 @@
 \box_new:N \l__sub_i_box
 \box_new:N \l__super_ii_box
 \box_new:N \l__sub_ii_box
+\dim_new:N \llastwd
+\dim_new:N \clastwd
+\dim_new:N \rlastwd
 \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 }
@@ -243,6 +247,7 @@
               { \tl_use:c { l__spb_#1_cmd_i_tl }{#2} }
           }
       }
+    \dim_gset:Nv \rlastwd { l__spb_box_#1_wd_i_tl }
   }
 \cs_new:Npn \spb_text_print_store_i:nn #1#2
   {
@@ -251,6 +256,7 @@
         \use:c { spb at text#1script at save }
           { \tl_use:c { l__spb_#1_cmd_i_tl }{#2} }
       }
+    \dim_gset:Nv \rlastwd { l__spb_box_#1_wd_i_tl }
   }
 \cs_new:Npn \spb_math_print_store_ii:nn #1#2
   {
@@ -303,6 +309,7 @@
     \exp_args:Nc \NewDocumentCommand {#1}{O{}mO{}}
       {
         \group_begin:
+        \mode_leave_vertical:
         \tl_gset:Nn \g__spb_mark_case_init_tl {#1}
         \spb_define:n { unknown .undefine: }
         \spb_set:n { ##1,##3 }
@@ -315,6 +322,7 @@
   }
 \cs_new_protected:Npn \spb_content_hbox_set:n #1
   {
+    \dim_gset:Nn \clastwd { (\llastwd + \rlastwd)/2 }
     \hbox_set:cn { l__#1_i_box }
       {
         \dim_compare:nNnTF { \tl_use:c { l__spb_#1_hmove_tl } } < { 0pt }
@@ -323,7 +331,7 @@
               {
                 \hbox_overlap_right:n
                   { \spb_box_vmove_i:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } }
-                \skip_horizontal:n { -\tl_use:c { l__spb_#1_hmove_tl } }
+                \skip_horizontal:n { \dim_abs:n { \tl_use:c { l__spb_#1_hmove_tl } } }
               }
           }
           {
@@ -332,6 +340,8 @@
               { \hss\spb_box_vmove_i:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } }
           }
       }
+    \dim_gset:Nn \llastwd
+      { \tl_use:c { l__spb_box_#1_wd_i_tl } - \tl_use:c { l__spb_#1_hmove_tl } }
   }
 \clist_map_inline:nn { super,sub } { \spb_both_newcmd_map:n {#1} }
 
@@ -340,6 +350,7 @@
 \NewDocumentCommand{\supersub}{O{}mmO{}}
   {
     \group_begin:
+    \mode_leave_vertical:
     \tl_gset:Nn \g__spb_mark_case_init_tl { supersub }
     \spb_define:n { unknown .undefine: }
     \spb_set:n {#1,#4}
@@ -361,7 +372,7 @@
             \hbox_overlap_left:n
               {
                 \spb_hbox_overlap_vmove_ii:n { right }
-                \skip_horizontal:n { -\l__spb_supersub_hmove_tl }
+                \skip_horizontal:n { \dim_abs:n { \l__spb_supersub_hmove_tl } }
               }
           }
           {
@@ -379,7 +390,8 @@
             \hbox_overlap_left:n
               {
                 \spb_hbox_overlap_vmove_ii:n { center }
-                \skip_horizontal:n { -\l__spb_supersub_hmove_tl - \l__spb_box_max_wd_tl/2 }
+                \skip_horizontal:n
+                  { \dim_abs:n { \l__spb_supersub_hmove_tl + \l__spb_box_max_wd_tl/2 } }
               }
           }
           {
@@ -397,7 +409,8 @@
             \hbox_overlap_left:n
               {
                 \spb_hbox_overlap_vmove_ii:n { left }
-                \skip_horizontal:n { -\l__spb_supersub_hmove_tl - \l__spb_box_max_wd_tl }
+                \skip_horizontal:n
+                  { \dim_abs:n { \l__spb_supersub_hmove_tl + \l__spb_box_max_wd_tl } }
               }
           }
           {



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