summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/spbmark
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-02-05 03:00:39 +0000
committerNorbert Preining <norbert@preining.info>2024-02-05 03:00:39 +0000
commit1343b01ff7a9bf0b93cee0d13ff1b13f2e649252 (patch)
tree25e1802be3817a994cd8ef1b326299eaea4727d6 /macros/latex/contrib/spbmark
parent16f68bbec3cca735a695904227872abc2ace1f90 (diff)
CTAN sync 202402050300
Diffstat (limited to 'macros/latex/contrib/spbmark')
-rw-r--r--macros/latex/contrib/spbmark/spbmark.pdfbin85360 -> 86672 bytes
-rw-r--r--macros/latex/contrib/spbmark/spbmark.sty82
-rw-r--r--macros/latex/contrib/spbmark/spbmark.tex64
3 files changed, 79 insertions, 67 deletions
diff --git a/macros/latex/contrib/spbmark/spbmark.pdf b/macros/latex/contrib/spbmark/spbmark.pdf
index 678496688b..29809f57d1 100644
--- a/macros/latex/contrib/spbmark/spbmark.pdf
+++ b/macros/latex/contrib/spbmark/spbmark.pdf
Binary files differ
diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty
index 9d8c24a018..b6af3d93c2 100644
--- a/macros/latex/contrib/spbmark/spbmark.sty
+++ b/macros/latex/contrib/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}{2024/01/08}{1.43}
+\ProvidesExplPackage{spbmark}{2024/02/04}{1.45}
{Customize superscripts and subscripts}
\cs_generate_variant:Nn \box_set_ht:Nn { cv }
@@ -23,31 +23,60 @@
\cs_generate_variant:Nn \tl_if_novalue:nF { V }
\cs_generate_variant:Nn \tl_if_blank:nF { v }
+\cs_set_eq:NN \spb@textsuperscript@save \textsuperscript
+\cs_set_eq:NN \spb@textsubscript@save \textsubscript
+\cs_set_eq:NN \spb@math@super@save \sp
+\cs_set_eq:NN \spb@math@sub@save \sb
+\cs_set_eq:NN \spb@@makefnmark@save \@makefnmark
\cs_new_protected:Npn \spb_define:n { \keys_define:nn { ctex/style } }
\cs_new_protected:Npn \spb_set:n { \keys_set:nn { ctex/style } }
\cs_set_eq:NN \spbset \spb_set:n
\keys_define:nn { spbmark/option }
{
- text .bool_set:N = \l_spb_newsupb_text_bool,
+ text .choice:,
+ text/true .code:n =
+ {
+ \cs_set:Npn \textsuperscript { \super }
+ \cs_set:Npn \textsubscript { \sub }
+ },
+ text/false .code:n =
+ {
+ \cs_set:Npn \textsuperscript { \spb@textsuperscript@save }
+ \cs_set:Npn \textsubscript { \spb@textsubscript@save }
+ },
text .default:n = true,
- math .bool_set:N = \l_spb_newsupb_math_bool,
+ math .choice:,
+ math/true .code:n =
+ {
+ \cs_set:Npn \sp { \super }
+ \cs_set:Npn \sb { \sub }
+ },
+ math/false .code:n =
+ {
+ \cs_set:Npn \sp { \spb@math@super@save }
+ \cs_set:Npn \sb { \spb@math@sub@save }
+ },
math .default:n = true,
- foot .bool_set:N = \l_spb_newsupb_foot_bool,
+ foot .choice:,
+ foot/true .code:n =
+ {
+ \cs_set:Npn \@makefnmark
+ { \hbox:n { \fnmarkfont{\super{\@thefnmark}} } }
+ },
+ foot/false .code:n =
+ { \cs_set:Npn \@makefnmark { \spb@@makefnmark@save } },
foot .default:n = true,
- both .meta:n = { text,math },
- both .value_forbidden:n = true,
- all .meta:n = { text,math,foot },
- all .value_forbidden:n = true,
- ctex .code:n = { },
- newsupb .code:n = { }
+ both .meta:n = { text = #1,math = #1 },
+ both .default:n = true,
+ all .meta:n = { text = #1,math = #1,foot = #1 },
+ all .default:n = true
}
+\tl_if_exist:NTF \ftntm@font
+ { \tl_set_eq:NN \fnmarkfont \ftntm@font }
+ { \tl_set_eq:NN \fnmarkfont \normalfont }
\ProcessKeysOptions{spbmark/option}
-\cs_set_eq:NN \spb@textsuperscript@save \textsuperscript
-\cs_set_eq:NN \spb@textsubscript@save \textsubscript
-\cs_set_eq:NN \spb@math@super@save \sp
-\cs_set_eq:NN \spb@math@sub@save \sb
\tl_new:N \g__spb_mark_case_init_tl
\cs_new_protected:Npn \spb_local_case_init:nnn #1#2#3
{
@@ -120,6 +149,7 @@
nohmove .meta:n = { sphmove = 0pt,sbhmove = 0pt },
novmove .meta:n = { spvmove = 0pt,sbvmove = 0pt }
}
+
\cs_new:Npn \spb_box_super_move_up_i:n #1
{ \box_move_up:nn {#1} { \box_use:N \l__super_i_inner_box } }
\cs_new:Npn \spb_box_sub_move_down_i:n #1
@@ -313,7 +343,6 @@
\group_begin:
\mode_leave_vertical:
\tl_gset:Nn \g__spb_mark_case_init_tl {#1}
- \spb_define:n { unknown .undefine: }
\spb_set:n { ##2,##4 }
\spb_mode_switch:nnn {#1} {##3} { i }
\spb_content_hbox_set:nn {#1} {##1}
@@ -445,26 +474,11 @@
Alignment~only~supports~l,~c,~and~r. \\
The~l~parameter~will~be~used~by~default.
}
-
-\bool_if:NT \l_spb_newsupb_text_bool
- {
- \cs_set_eq:NN \textsuperscript \super
- \cs_set_eq:NN \textsubscript \sub
- }
-\bool_if:NT \l_spb_newsupb_math_bool
- {
- \cs_set_eq:NN \sp \super
- \cs_set_eq:NN \sb \sub
- }
-\bool_if:NT \l_spb_newsupb_foot_bool
- {
- \cs_set:Npn \@makefnmark
- { \hbox:n { \fnmarkfont{\super{\@thefnmark}} } }
- }
+\@ifpackageloaded{easybase}
+ {\ctex_gadd_package_hook:nnn { after } { easybase }}
+ {\use:n}
+ { \keys_define:nn { } { ctex/style .inherit:n = spbmark/option } }
\cs_set_eq:NN \spb \supersub
-\tl_if_exist:NTF \ftntm@font
- { \tl_set_eq:NN \fnmarkfont \ftntm@font }
- { \tl_set_eq:NN \fnmarkfont \normalfont }
\endinput
%
% End of file `spbmark.sty'. \ No newline at end of file
diff --git a/macros/latex/contrib/spbmark/spbmark.tex b/macros/latex/contrib/spbmark/spbmark.tex
index 28025db66c..f4d22c3cfc 100644
--- a/macros/latex/contrib/spbmark/spbmark.tex
+++ b/macros/latex/contrib/spbmark/spbmark.tex
@@ -1,13 +1,13 @@
\documentclass[load-preamble+]{cnltx-doc}
-\usepackage{spbmark,siunitx,pifont,hologo}
+\usepackage{spbmark,siunitx,setspace,pifont,hologo}
\usepackage[noto]{newtxmath}
\setcnltx
{
package = spbmark,
title = the spbmark package,
- version = v1.43,
- date = 2024/01/08,
+ version = v1.45,
+ date = 2024/02/04,
authors = Qu Yi,
info = Customize superscript and subscript,
email = toquyi@163.com,
@@ -18,13 +18,11 @@
},
color-scheme = blue,
title-format = \huge\bfseries\scshape,
- add-frame-options = {innerleftmargin = 2em},
- listings-options = {numbers = none,gobble = 2},
- pre-output = {\parindent = 0em},
+ listings-options = {numbers = none,gobble = 2,lineskip = 1pt},
+ pre-output = {\parindent = 0em \setstretch{1.3}},
before-skip = \smallskipamount,
after-skip = \smallskipamount
}
-
\makeatletter
\newcommand{\splitmeta}[2]{\meta{#1}\texttt{,}\meta{#2}}
\newcommand{\newsplitarg}[4][\splitmeta]
@@ -45,10 +43,9 @@
\makeatother
\begin{document}
-
\section{Macro package options}
\label{sec:macro package options}
-The following macro package options will redefine the script commands of the \LaTeX{} kernel. If you do not specify the values of boolean options, they default to \code{true}.
+The following macro package options will redefine the script commands of the \LaTeX{} kernel. If you do not specify the values of boolean options, they default to \code{true}. These options can also be changed in the preamble area and main body using the global control command \cs{sbpset}.
\begin{options}
\keychoice{text}{true,\fbox{false}}
\cs{textsuperscript} and \cs{textsubscript} are equivalent to the \cs{super} and \cs{sub} commands.
@@ -56,13 +53,14 @@ The following macro package options will redefine the script commands of the \La
\cs{sp} and \cs{sb} are equivalent to the \cs{super} and \cs{sub} commands.
\keychoice{foot}{true,\fbox{false}}
The format of the footnote mark match the superscript global move and format settings.
- \opt{both}
- The values of \option{text} and \option{math} two options are \code{true} at the same time.
- \opt{all}
- The values of \option{text}, \option{math} and \option{foot} three options are \code{true} at the same time.
+ \keychoice{both}{true,\fbox{false}}
+ The values of \option{text} and \option{math} two options are \code{true} or \code{false} at the same time.
+ \keychoice{all}{true,\fbox{false}}
+ The values of \option{text}, \option{math} and \option{foot} three options are \code{true} or \code{false} at the same time.
\begin{example}[code-only]
\usepackage[both]{spbmark}
\usepackage[text,foot=true]{spbmark}
+ \spbset{all=false,math}
\end{example}
\end{options}
@@ -84,11 +82,11 @@ There are currently three commands to set superscript and subscript. Their forma
\command{rlastwd}\newtag%
Save the width of the previous marker and provide right alignment. Actually this is the width of the next marker.
\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 \\
+ 1A\super{bcd}\sub{e}B \\
+ 2A\super{bcd}\sub[hmove=-\llastwd]{e}B \\
+ 3A\sub{e}\super{bcd}[hmove=-\llastwd]B \\
+ 4A\super{bcd}\sub[hmove=-\clastwd]{e}B \\
+ 5A\super{bcd}\sub[hmove=-\rlastwd]{e}B
\end{example}
\command{supersub}[\sarg\oarg{kv list}\marg{super cont}\marg{sub cont}\oarg{kv list}]
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 two \meta{kv list} are equivalent.
@@ -102,12 +100,12 @@ There are currently three commands to set superscript and subscript. Their forma
If horizontally move is negative and its absolute value is \emph{less} than the maximum width of the marker, then the marker overlaps the subsequent text. To avoid this use the command with the \emph{asterisk} parameter or adjust the horizontal distance with the marker length commands.
\begin{example}
\spbset{spvmove=5pt,vsep=1.8ex,spcmd=\color{blue}}
- A\super[hmove=-8pt]{super}B \\
- A\supersub[hmove=-8pt]{examsuper}{sub}B \\
- A\super*[hmove=-8pt]{super}B \\
- A\supersub*[hmove=-8pt]{examsuper}{sub}B \\
- A\super[hmove=-8pt]{super}\hspace{\dimexpr(\llastwd-8pt)}B \\
- A\supersub[hmove=-8pt]{examsuper}{sub}\hspace{\dimexpr(\maxwd-8pt)}B
+ 1A\super[hmove=-8pt]{super}B \\
+ 2A\supersub[hmove=-8pt]{examsuper}{sub}B \\
+ 3A\super*[hmove=-8pt]{super}B \\
+ 4A\supersub*[hmove=-8pt]{examsuper}{sub}B \\
+ 5A\super[hmove=-8pt]{super}\hspace{\dimexpr(\llastwd-8pt)}B \\
+ 6A\supersub[hmove=-8pt]{examsuper}{sub}\hspace{\dimexpr(\maxwd-8pt)}B
\end{example}
\command{defspbstyle}[\marg{style name}\marg{kv list}]
Defines the style of the superscript or subscript used for the \option{style} option.
@@ -119,8 +117,8 @@ There are currently three commands to set superscript and subscript. Their forma
\spbshortkv{x}{sphmove=#1}
\defspbstyle{fancy}{sbcmd=\color{blue},mode=math}
\spbshortkv{mysb}{style=fancy}
- A\super[x=2pt]{b} \\
- A\sub{b}[mysb]
+ 1A\super[x=2pt]{b} \\
+ 2A\sub{b}[mysb]
\end{example}
\end{commands}
@@ -131,8 +129,8 @@ The options common to \meta{kv list} of the three commands are as follows. They
\keyval{hmove}{fixed length}\Default{0pt}
Horizontal move of superscript or subscript. Represents the \emph{common} move of superscript and subscript in super-subscript command. The starting point for horizontal movement is to the left of the marker. 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}
+ 1A\super{b}[vmove=0.4ex+4pt/2,hmove=2pt*3-11.5pt] \\
+ 2A\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.
@@ -152,7 +150,7 @@ The options common to \meta{kv list} of the three commands are as follows. They
\label{sec:global control interface}
\begin{commands}
\command{spbset}[\marg{key-value list}]
- \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.
+ \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 \emph{or} subscript.
@@ -212,10 +210,10 @@ Here is a list of the three commands, please pay attention to the usage of optio
\begin{example}
\defspbstyle{fancy}{cmd=\color{purple}}
\spbset{spbcmd={\spbifmath{\mathtt}{\ttfamily},\color{blue}}}
- A\super[vmove=0.2ex,hmove=0.2em,cmd=\textcolor{red}]{exam}B \\
- $A\sub[style=fancy,cmd+=\mathsf,mode=math]{exam}B$ \\
- A\supersub[vsep=0.6ex,halign=c]{examsuper}{sub}B \\
- A\super{c}[vmove=5pt,hmove=-5.5pt]B\sub[vmove=5pt,hmove=-5pt]{d}AB
+ 1A\super[vmove=0.2ex,hmove=0.2em,cmd=\textcolor{red}]{exam}B \\
+ 2$A\sub[style=fancy,cmd+=\mathsf,mode=math]{exam}B$ \\
+ 3A\supersub[vsep=0.6ex,halign=c]{examsuper}{sub}B \\
+ 4A\super{c}[vmove=5pt,hmove=-5.5pt]B\sub[vmove=5pt,hmove=-5pt]{d}AB
\end{example}
It can also be used with the \pkg*{siunitx} package to output superscript and subscript in the unit: