summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/spbmark
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-07-01 03:01:47 +0000
committerNorbert Preining <norbert@preining.info>2021-07-01 03:01:47 +0000
commitc840f97520ba98156a0ed525d6b5d05ab6a324f6 (patch)
tree8e6cf79a5019e2dc2811f4a5b032caffb2809226 /macros/latex/contrib/spbmark
parent916b6828e77bd92bd88d57bad094c4520f0ad65c (diff)
CTAN sync 202107010301
Diffstat (limited to 'macros/latex/contrib/spbmark')
-rw-r--r--macros/latex/contrib/spbmark/spbmark.dtx65
-rw-r--r--macros/latex/contrib/spbmark/spbmark.pdfbin67418 -> 68944 bytes
2 files changed, 46 insertions, 19 deletions
diff --git a/macros/latex/contrib/spbmark/spbmark.dtx b/macros/latex/contrib/spbmark/spbmark.dtx
index 754bcfa0c4..87e40645db 100644
--- a/macros/latex/contrib/spbmark/spbmark.dtx
+++ b/macros/latex/contrib/spbmark/spbmark.dtx
@@ -23,7 +23,7 @@
%
% \title{\pkg{spbmark} -- Superscript and subscript of text}
% \author{Qu Yi}
-% \date{2021/06/28\hskip 1em\relax v1.00a\thanks{\url{https://github.com/texl3/spbmark}}}
+% \date{2021/06/30\hskip 1em\relax v1.01\thanks{\url{https://github.com/texl3/spbmark}}}
%
% \maketitle
% \begin{abstract}
@@ -32,12 +32,17 @@
% \tableofcontents
%
% \section{Macro package options}
+% \label{sec:macro package options}
% \begin{function}[added = 2021-06-26]{ctex}
-% This option works with the C\TeX{} document class used by simplified Chinese users, there's actually no functional change. Adding path \texttt{style} to \tn{ctexset} command, which is equivalent to using \tn{spbset}.
+% This option works with the C\TeX{} document class used by simplified Chinese users, there's actually no functional change. Adding path \texttt{style} to \tn{ctexset} command, which is equivalent to using \tn{spbset}.
+% \end{function}
+%
+% \begin{function}[added = 2021-06-30]{newsupb}
+% \texttt{newsupb} is a boolean option with a default value of true that redefines the \LaTeX{} kernel commands to cause \tn{sp} and \tn{textsuperscript} are equivalent to \tn{super} command, and \tn{sb} and \tn{textsubscript} are equivalent to \tn{sub} command.
% \end{function}
%
% \section{User commands}
-% \begin{function}[added = 2021-06-26,updated = 2021-06-28]{\super,\sub,\supersub,\textsuperscript,\textsubscript}
+% \begin{function}[added = 2021-06-26,updated = 2021-06-28]{\super,\sub,\supersub}
% \begin{syntax}
% \tn{super*}\oarg{vshift}[<height>,<depth>]\parg{code}\marg{content}\oarg{hshift}
% \tn{sub*}\oarg{vshift}[<height>,<depth>]\parg{code}\marg{content}\oarg{hshift}
@@ -54,7 +59,11 @@
%
% The \meta{code} is used to format superscripts and subscripts, 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.
%
-% The \tn{textsuperscript} and \tn{textsubscript} commands have been redefined to be equivalent to \tn{super} and \tn{sub} respectively, if you need to use their original definitions, then \tn{spb@textsuperscript@save} and \tn{spb@textsubscript@save} will be available.
+% \begin{function}[added = 2021-06-30]{\sp,\sb,\spb,\textsuperscript,\textsubscript}
+% Except for the \tn{spb} command which is equivalent to \tn{supersub}, the others are \LaTeX{} kernel commands. If you use the \texttt{newsupb} package options then they will be redefined to make the command shorter, see section \ref{sec:macro package options}.
+%
+% If you need to use the original definitions of \tn{textsuperscript} and \tn{textsubscript}, then \tn{spb@textsuperscript@save} and \tn{spb@textsubscript@save} will be available. If you need to use the original definitions of \tn{sp} and \tn{sb}, then \tn{spb@sp@save} and \tn{spb@sb@save} will be available.
+% \end{function}
%
% \section{Global control interface}
% \begin{function}[added = 2021-06-26]{\spbset}
@@ -125,19 +134,23 @@
%
% \StopEventually{}
%<*package>
-\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-\RequirePackage{l3keys2e}
-\ProvidesExplPackage{spbmark}{2021/06/28}{1.00a}{beta}
+\NeedsTeXFormat{LaTeX2e}[2018/12/31]
+\RequirePackage{xparse,l3keys2e}
+\ProvidesExplPackage{spbmark}{2021/06/30}{1.01}
+ {Customize superscripts and subscripts}
\cs_new_protected:Npn \spb_define:n { \keys_define:nn { spbmark } }
\cs_new_protected:Npn \spbset { \keys_set:nn { spbmark } }
\keys_define:nn { spbmark/option }
{
- ctex .code:n =
+ ctex .code:n =
{
\cs_set:Npn \spb_define:n { \keys_define:nn { ctex/style } }
\cs_set:Npn \spbset { \keys_set:nn { ctex/style } }
- }
+ },
+ newsupb .bool_set:N = \l__spb_new_supersub_bool,
+ newsupb .default:n = true,
+ newsupb .initial:n = true
}
\ProcessKeysOptions{spbmark/option}
@@ -183,15 +196,17 @@
}
\cs_set_eq:NN \spb@textsuperscript@save \textsuperscript
\cs_set_eq:NN \spb@textsubscript@save \textsubscript
+\cs_set_eq:NN \spb@sp@save \sp
+\cs_set_eq:NN \spb@sb@save \sb
\cs_new:Npn \spb_math:nn #1
{
\str_case:nn {#1}
{
- { super } { \sp }
- { sub } { \sb }
+ { super } { \spb@sp@save }
+ { sub } { \spb@sb@save }
}
}
-\cs_new_protected:Npn \spb_box_dp_ht_assign:nn #1#2
+\cs_new_protected:Npn \spb_box_ht_dp_assign:nn #1#2
{
\tl_if_empty:nF {#1} { \box_set_ht:Nn \l_tmpb_box {#1} }
\tl_if_novalue:nF {#2} { \box_set_dp:Nn \l_tmpb_box {#2} }
@@ -218,7 +233,7 @@
}
\hbox_set_to_wd:Nnn \l_tmpb_box { \l__spb_boxa_wd_tl + ##6 }
{ \hss\box_move_up:nn {##2} { \spb_tmp_boxa_use: } }
- \spb_box_dp_ht_assign:nn ##3
+ \spb_box_ht_dp_assign:nn ##3
\spb_tmp_boxb_use:
}
}
@@ -230,13 +245,13 @@
{
\IfBooleanTF{#1}
{
- \spb_tmp_hboxa_set:n { $#4{\sp{#5}}$ }
- \spb_tmp_hboxb_set:n { $#8{\sb{#6}}$ }
+ \spb_tmp_hboxa_set:n { $#4{\spb@sp@save{#5}}$ }
+ \spb_tmp_hboxb_set:n { $#8{\spb@sb@save{#6}}$ }
}{
\mode_if_math:TF
{
- \spb_tmp_hboxa_set:n { $#4{\sp{#5}}$ }
- \spb_tmp_hboxb_set:n { $#8{\sb{#6}}$ }
+ \spb_tmp_hboxa_set:n { $#4{\spb@sp@save{#5}}$ }
+ \spb_tmp_hboxb_set:n { $#8{\spb@sb@save{#6}}$ }
}
{
\spb_tmp_hboxa_set:n { #4{\spb@textsuperscript@save{#5}} }
@@ -278,8 +293,20 @@
Alignment~only~supports~l,~c,~and~r. \\
The~l~parameter~will~be~used~by~default.
}
-\cs_set_eq:NN \textsuperscript \super
-\cs_set_eq:NN \textsubscript \sub
+
+\bool_if:NT \l__spb_new_supersub_bool
+ {
+ \clist_map_inline:nn
+ {
+ { sp,sb },
+ { textsuperscript,textsubscript }
+ }
+ {
+ \cs_set_eq:cN { \clist_item:nn {#1} { 1 } } \super
+ \cs_set_eq:cN { \clist_item:nn {#1} { 2 } } \sub
+ }
+ }
+\cs_set_eq:NN \spb \supersub
\cs_set:Npn \@makefnmark
{ \hbox:n { \fnmarkfont\super{\@thefnmark}[0pt] } }
\cs_if_exist:NTF \ftntm@font
diff --git a/macros/latex/contrib/spbmark/spbmark.pdf b/macros/latex/contrib/spbmark/spbmark.pdf
index 32f841bedf..7c108609cb 100644
--- a/macros/latex/contrib/spbmark/spbmark.pdf
+++ b/macros/latex/contrib/spbmark/spbmark.pdf
Binary files differ