diff options
author | Karl Berry <karl@freefriends.org> | 2021-07-28 20:48:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-07-28 20:48:41 +0000 |
commit | 96dcd69507fddcad970d109c600828c68f6fd5a8 (patch) | |
tree | 245325400c0e8a7ee9709c58dee04d562f7133d3 | |
parent | 8d926a39de2bc76c0488c7ae02fe3665a543399f (diff) |
spbmark (28jul21)
git-svn-id: svn://tug.org/texlive/trunk@60106 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/spbmark/spbmark.pdf | bin | 64931 -> 65490 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/spbmark/spbmark.tex | 42 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/spbmark/spbmark.sty | 59 |
3 files changed, 64 insertions, 37 deletions
diff --git a/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf b/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf Binary files differindex b26a2bb3253..f1e03050484 100644 --- a/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf +++ b/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf diff --git a/Master/texmf-dist/doc/latex/spbmark/spbmark.tex b/Master/texmf-dist/doc/latex/spbmark/spbmark.tex index 1198c98708e..52d32744ce6 100644 --- a/Master/texmf-dist/doc/latex/spbmark/spbmark.tex +++ b/Master/texmf-dist/doc/latex/spbmark/spbmark.tex @@ -6,8 +6,8 @@ { package = spbmark, title = the spbmark package, - version = v1.06, - date = 2021/07/26, + version = v1.08, + date = 2021/07/28, authors = Qu Yi, info = Customize superscript and subscript, email = quee123@foxmail.com, @@ -23,6 +23,26 @@ pre-output = {\parindent = 0em} } +\makeatletter +\newcommand{\splitmeta}[2] + {% + \ensuremath{\langle}% + \textcolor{meta}{\argumentformat #1}% + \ensuremath{\rangle,\langle}% + \textcolor{meta}{\argumentformat #2}% + \ensuremath{\rangle}% + } +\newcommand{\newsplitarg}[4][\splitmeta] + { + \newcommand{#2}[2] + {\code{\textcolor{argument}{#3\textnormal{#1{##1}{##2}}#4}}} + } +\newcommand{\kvsplit}[3] + {\item\code{\option{#1}\cnltx@isvalue\splitmarg{#2}{#3}}} +\newsplitarg{\splitoarg}{[}{]} +\newsplitarg{\splitmarg}{\{}{\}} +\makeatother + \begin{document} \section{Macro package options} @@ -37,19 +57,17 @@ \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}[\sarg\oarg{vshift}\oarg{height,depth}\darg{code}\marg{content}\oarg{hshift}] - This is a superscript output command. - \command{sub}[\sarg\oarg{vshift}\oarg{height,depth}\darg{code}\marg{content}\oarg{hshift}] - This is a subscript output command. + \command{super}[\sarg\oarg{vshift}\splitoarg{height}{depth}\darg{code}\marg{content}\oarg{hshift}] + 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. + 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}. \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. -The \meta{vshift} and \meta{hshift} represent respectively vertical and horizontal offsets of superscript or subscript, their default value is \code{0pt}. If it is positive, move up or right, or if it is negative, move left or down. The parameters of \meta{script align} are the same as the \option{supersubalign}. - -The optional parameter \meta{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 height of the superscript or subscript, and only the back part indicates the depth. +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 \meta{code} is used to format superscript and subscript, 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. @@ -92,7 +110,7 @@ The following list of keys control the format of superscript and subscript. They \begin{options} \keyval{supersub-hshift}{fixed length}\Default{0pt} Extra vertical shift of the superscript and the subscript. - \keyval{supersub-format}{super code,sub code}\Default{0pt} + \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} The distance between superscript and subscript, its default value is \code{0.3ex}. @@ -120,7 +138,7 @@ It can also be used with the \pkg*{siunitx} package to output superscript and su \pkg*{spbmark} also patches the footer markers for standard document class and \cls*{KOMA-Script}. You can format the footer markers by redefining the \cs{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 \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 \cs*{unit} command, it is recommended to use \code{pt} as the unit of offset. +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's converted to a space in the \cs*{unit} command, it's recommended to use \code{pt} as the unit of offset. \nocite{*} diff --git a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty index 7df09aaeec0..3a35bcd11fd 100644 --- a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty +++ b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty @@ -7,9 +7,9 @@ % conditions of the CC-BY 4.0 License. % The latest version of this license is in % https://creativecommons.org/licenses/by/4.0/legalcode -\NeedsTeXFormat{LaTeX2e}[2020/10/01] +\NeedsTeXFormat{LaTeX2e}[2018/12/31] \RequirePackage{xparse,l3keys2e} -\ProvidesExplPackage{spbmark}{2021/07/26}{1.06} +\ProvidesExplPackage{spbmark}{2021/07/28}{1.08} {Customize superscripts and subscripts} \cs_new_protected:Npn \spb_define:n { \keys_define:nn { spbmark } } @@ -55,12 +55,16 @@ \tl_set:Nn \l__spb_boxb_wd_tl { \box_wd:N \l_tmpb_box } \tl_set:Nn \l__spb_box_max_wd_tl { \dim_max:nn { \l__spb_boxa_wd_tl } { \l__spb_boxb_wd_tl } } -\cs_new:Npn \spb_tmp_boxa_use_vmove:n #1 +\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_hbox_overlap_position:n #1 +\cs_new:Npn \spb_boxb_move_down:n #1 + { \box_move_down:nn {#1} { \box_use:N \l_tmpb_box } } +\cs_new:Npn \spb_hbox_overlap_vshift:n #1#2 { - \use:c { hbox_overlap_#1:n } { \box_use:N \l_tmpa_box } - \use:c { hbox_overlap_#1:n } { \box_use:N \l_tmpb_box } + \use:c { hbox_overlap_#2:n } { \spb_boxa_move_up:n {#1} } + \use:c { hbox_overlap_#2:n } { \spb_boxb_move_down:n {#1} } } \cs_new:Npn \spb_math_print_store:nnn #1#2#3 { @@ -128,23 +132,23 @@ { \spb_math_print_store:nnn {##4} {#1} {##5} } { \spb_text_print_store:nnn {##4} {#1} {##5} } } - \hbox_set:Nn \l_tmpb_box + \hbox_set:Nn \l_tmpa_box { \dim_compare:nNnTF {##6} < { 0pt } { \hbox_overlap_left:n { \hbox_to_wd:nn { \l__spb_boxa_wd_tl - ##6 } - { \spb_tmp_boxa_use_vmove:n {##2}\hss } + { \spb_boxa_move_up:n {##2}\hss } } } { \hbox_to_wd:nn { \l__spb_boxa_wd_tl + ##6 } - { \hss\spb_tmp_boxa_use_vmove:n {##2} } + { \hss\spb_boxa_move_up:n {##2} } } } \spb_box_ht_dp_assign:nn ##3 - \box_use:N \l_tmpb_box + \box_use:N \l_tmpa_box } } \NewDocumentCommand{\supersub} @@ -163,10 +167,6 @@ { \spb_math_print_store:nnnn {#4} {#5} {#8} {#6} } { \spb_text_print_store:nnnn {#4} {#5} {#8} {#6} } } - \hbox_set:Nn \l_tmpa_box - { \box_move_up:nn {#2} { \box_use:N \l_tmpa_box } } - \hbox_set:Nn \l_tmpb_box - { \box_move_down:nn {#2} { \box_use:N \l_tmpb_box } } \str_case:onF {#3} { { l } { \use_i:nnn } @@ -182,14 +182,17 @@ { \hbox_overlap_left:n { - \spb_hbox_overlap_position:n { right } + \spb_hbox_overlap_vshift:n {#2} { right } \skip_horizontal:n { -#7 } } } { - \skip_horizontal:n {#7} - \spb_hbox_overlap_position:n { right } - \skip_horizontal:n { \l__spb_box_max_wd_tl } + \hbox:n + { + \skip_horizontal:n {#7} + \spb_hbox_overlap_vshift:n {#2} { right } + \skip_horizontal:n { \l__spb_box_max_wd_tl } + } } } { @@ -197,14 +200,17 @@ { \hbox_overlap_left:n { - \spb_hbox_overlap_position:n { center } + \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 + #7 } - \spb_hbox_overlap_position:n { center } - \skip_horizontal:n { \l__spb_box_max_wd_tl/2 } + \hbox:n + { + \skip_horizontal:n { \l__spb_box_max_wd_tl/2 + #7 } + \spb_hbox_overlap_vshift:n {#2} { center } + \skip_horizontal:n { \l__spb_box_max_wd_tl/2 } + } } } { @@ -212,13 +218,16 @@ { \hbox_overlap_left:n { - \spb_hbox_overlap_position:n { left } + \spb_hbox_overlap_vshift:n {#2} { left } \skip_horizontal:n { -#7 } } } { - \skip_horizontal:n { \l__spb_box_max_wd_tl + #7 } - \spb_hbox_overlap_position:n { left } + \hbox:n + { + \skip_horizontal:n { \l__spb_box_max_wd_tl + #7 } + \spb_hbox_overlap_vshift:n {#2} { left } + } } } } |