summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/spbmark/spbmark.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/spbmark/spbmark.tex')
-rw-r--r--macros/latex/contrib/spbmark/spbmark.tex25
1 files changed, 13 insertions, 12 deletions
diff --git a/macros/latex/contrib/spbmark/spbmark.tex b/macros/latex/contrib/spbmark/spbmark.tex
index 52d32744ce..b755e565e7 100644
--- a/macros/latex/contrib/spbmark/spbmark.tex
+++ b/macros/latex/contrib/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}