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.tex42
1 files changed, 30 insertions, 12 deletions
diff --git a/macros/latex/contrib/spbmark/spbmark.tex b/macros/latex/contrib/spbmark/spbmark.tex
index 1198c98708..52d32744ce 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.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{*}