summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-07-29 20:36:02 +0000
committerKarl Berry <karl@freefriends.org>2021-07-29 20:36:02 +0000
commitc7de7fc0fb381bc67c66652b8803f6b3743e8116 (patch)
tree7802fb14bb91f7572b96943b2cdc7ebcdfbbc6ed /Master
parent3b7862a995975696a6ff97afa58c1ff5ac6693c2 (diff)
spbmark (29jul21)
git-svn-id: svn://tug.org/texlive/trunk@60111 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/spbmark/spbmark.pdfbin65490 -> 65446 bytes
-rw-r--r--Master/texmf-dist/doc/latex/spbmark/spbmark.tex25
-rw-r--r--Master/texmf-dist/tex/latex/spbmark/spbmark.sty61
3 files changed, 51 insertions, 35 deletions
diff --git a/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf b/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf
index f1e03050484..b166f958023 100644
--- a/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf
+++ b/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/spbmark/spbmark.tex b/Master/texmf-dist/doc/latex/spbmark/spbmark.tex
index 52d32744ce6..b755e565e7e 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.08,
- date = 2021/07/28,
+ version = v1.1,
+ date = 2021/07/29,
authors = Qu Yi,
info = Customize superscript and subscript,
email = quee123@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@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 @@ There are currently three commands to set superscript and subscript. Their forma
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 @@ If you need to use the original definitions of \cs{textsuperscript}, \cs{textsub
Save the original definition of the \cs{textsubscript} command, output subscript in the text.
\command{spb@sp@save}[\marg{content}]
Save the original definition of the \cs{sp} command, output superscript in the math mode.
- \command{spb@sbt@save}[\marg{content}]
+ \command{spb@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 @@ The following list of keys control the format of superscript and subscript. They
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 @@ Here is a list of the three commands, please pay attention to the delimiter and
\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}
diff --git a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
index 3a35bcd11fd..56c06b6d0a3 100644
--- a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
+++ b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
@@ -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@sp@save{#2}}} }
- \hbox_set:Nn \l_tmpb_box { \ensuremath{#3{\spb@sb@save{#4}}} }
+ \hbox_set:Nn \l_tmpa_box { \ensuremath{#1{\spb@sp@save{#3}}} }
+ \hbox_set:Nn \l_tmpb_box
+ { \ensuremath{\tl_if_novalue:nF {#2} {#2}{\spb@sb@save{#4}}} }
}
\cs_new:Npn \spb_text_print_store:nnnn #1#2#3#4
{
- \hbox_set:Nn \l_tmpa_box { #1{\spb@textsuperscript@save{#2}} }
- \hbox_set:Nn \l_tmpb_box { #3{\spb@textsubscript@save{#4}} }
+ \hbox_set:Nn \l_tmpa_box { #1{\spb@textsuperscript@save{#3}} }
+ \hbox_set:Nn \l_tmpb_box
+ { \tl_if_novalue:nF {#2} {#2}{\spb@textsubscript@save{#4}} }
}
\cs_set_eq:NN \spb@textsuperscript@save \textsuperscript
\cs_set_eq:NN \spb@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,54 +193,54 @@
\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 }
}
}
}
{
- \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 }
}
}
}
{
- \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 }
}
}