texlive[71304] Master/texmf-dist: spbmark (19may24)
commits+karl at tug.org
commits+karl at tug.org
Sun May 19 22:35:57 CEST 2024
Revision: 71304
https://tug.org/svn/texlive?view=revision&revision=71304
Author: karl
Date: 2024-05-19 22:35:57 +0200 (Sun, 19 May 2024)
Log Message:
-----------
spbmark (19may24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf
trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex
trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
Modified: trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex 2024-05-19 20:35:48 UTC (rev 71303)
+++ trunk/Master/texmf-dist/doc/latex/spbmark/spbmark.tex 2024-05-19 20:35:57 UTC (rev 71304)
@@ -8,8 +8,8 @@
{
package = spbmark,
title = the spbmark package,
- version = v1.46i,
- date = 2024/05/13,
+ version = v1.46j,
+ date = 2024/05/19,
authors = Qu Yi,
info = Customize superscript and subscript,
email = toquyi at 163.com,
@@ -40,7 +40,7 @@
\newsplitarg{\splitoarg}{[}{]}
\newsplitarg{\splitmarg}{\{}{\}}
\newsplitarg{\splitdarg}{(}{)}
-\newnote{\newtag}[1][New]{\textcolor{red}{#1}}
+\newnote{\newtag}[1]{\textcolor{red}{#1}}
\renewcommand{\emph}[1]{\textcolor{red}{#1}}
\renewcommand{\cnltx at write@lastname}{}
\makeatother
@@ -49,12 +49,14 @@
\section{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}. These options can also be changed in the preamble area and main body using the global control command \cs{spbset}.
\begin{options}
- \keychoice{text}{true,\fbox{false}}\newtag[Changed]%
- \cs{textsuperscript} and \cs{textsubscript} are equivalent to the \cs{super} and \cs{sub} commands. You can also use the \cs{defspbstyle} command to define the style \code{textsp} and \code{textsb} to change the format of the text superscript and subscript.
- \keychoice{math}{true,\fbox{false}}\newtag[Changed]%
- \cs{sp} and \cs{sb} are equivalent to the \cs{super} and \cs{sub} commands. You can also use the \cs{defspbstyle} command to define the style \code{mathsp} and \code{mathsb} to change the format of the math superscript and subscript.
- \keychoice{foot}{true,\fbox{false}}\newtag[Changed]%
- The format of the footnote mark match the superscript global move and format settings. You can also use the \cs{defspbstyle} command to define the superscript style \code{fnmark} to change the format of the footnote mark.
+ \keychoice{text}{true,\fbox{false}}
+ \cs{textsuperscript} and \cs{textsubscript} are equivalent to the \cs{super} and \cs{sub} commands. The command \cs{defspbstyle} can be used to define the style \code{textsp} and \code{textsb} to change the format of the text superscript and subscript.
+ \keychoice{math}{true,\fbox{false}}
+ \cs{sp} and \cs{sb} are equivalent to the \cs{super} and \cs{sub} commands. The command \cs{defspbstyle} can be used to define the style \code{mathsp} and \code{mathsb} to change the format of the math superscript and subscript.
+ \keychoice{math*}{true,\fbox{false}}\newtag{Exp\\v1.46j}%
+ The \code{\^{}} and \code{\_{}} tokens in the math mode are equivalent to the \cs{super} and \cs{sub} commands. The command \cs{defspbstyle} can be used to define the style \code{mathsp*} and \code{mathsb*} to change the format of the math superscript and subscript.
+ \keychoice{foot}{true,\fbox{false}}
+ The format of the footnote mark match the superscript global move and format settings. \cs{defspbstyle} can be used to define the superscript style \code{fnmark} to change the format of the footnote mark.
\begin{example}[code-only]
\defspbstyle{textsp}{vmove=-1pt,cmd=\bfseries}
\defspbstyle{mathsb}{hmove=0.5em}
@@ -152,7 +154,7 @@
Use the \meta{style name} defined by the \cs{defspbstyle} command to make it work global or local.
\keychoice{mode}{text,math,\fbox{match}}
The mode of superscript or subscript output can be \code{text} or \code{math} mode. The \code{match} option automatically matches output modes according to the current mode.
- \keychoice{thiswd}{auto,\fbox{keep}}\newtag%
+ \keychoice{thiswd}{auto,\fbox{keep}}
Sets how the length of the this marker is handled after this command is used. If it is \code{keep}, the width of the previous marker remains the same. If it is \code{auto}, if the next token is a marker command and the upper or lower position is the \textcolor{red}{opposite} of the this command, the width of the this marker is maintained, otherwise the width automatically returns to \textcolor{red}{zero}.
\begin{example}
\spbset{sbhmove=-\llastwd,sbthiswd=auto,sbcmd=\color{red}}
@@ -161,7 +163,7 @@
3A\sub{bcd}[thiswd=keep]\sub{e}Some texts\sub{e} \\
4A\sub{bcd}\sub{e}Some texts\sub{e}
\end{example}
- \keyval{regex}{regular expression}\newtag%
+ \keyval{regex}{regular expression}
After using the superscript or subscript command, this option is used to determine whether the \textcolor{red}{following} tokens match the \meta{regular expression}. If it does \textcolor{red}{not}, the width of the this marker returns to zero.
\begin{example}[code-only]
\newcommand{\mysp}[2][]{\super[regex=\c{mysb},#1]{#2}}
@@ -206,13 +208,13 @@
The distance between the subscript baseline and the previous line.
\keyval{sbdepth}{fixed length}
The distance between the subscript baseline and the next line.
- \keychoice{spthiswd}{auto,\fbox{keep}}\newtag%
+ \keychoice{spthiswd}{auto,\fbox{keep}}
Width processing mode after using this superscript. See Section \ref{sec:user commands} for the meaning of this option.
- \keychoice{sbthiswd}{auto,\fbox{keep}}\newtag%
+ \keychoice{sbthiswd}{auto,\fbox{keep}}
Width processing mode after using this subscript. See Section \ref{sec:user commands} for the meaning of this option.
- \keyval{spregex}{regular expression}\newtag%
+ \keyval{spregex}{regular expression}
After the superscript command is used, the regular expression rules of the following tokens are matched. See Section \ref{sec:user commands} for the meaning of this option.
- \keyval{sbregex}{regular expression}\newtag%
+ \keyval{sbregex}{regular expression}
After the subscript command is used, the regular expression rules of the following tokens are matched. See Section \ref{sec:user commands} for the meaning of this option.
\end{options}
@@ -251,9 +253,12 @@
\subsection{siunitx}
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[vmove=-1pt]{2}} \\
- \qty[mode=text]{30}{A\supersub[hmove=1pt,cmd=\color{red}]{b}{c}} \\
- \spbset{sbhmove=2pt}\unit[mode=text]{A\sub{b}}
+ \spbset{spcmd=\spbifmath{}{\color{purple}}}
+ \sisetup{text-superscript-command=\super}
+ 1-\qty[mode=text]{10}{A^2} \\
+ 2-\unit[mode=math]{kg.m/s\super[vmove=-1pt]{2}} \\
+ 3-\qty[mode=text]{30}{A\supersub[hmove=1pt,cmd=\color{blue}]{b}{c}} \\
+ 4-\spbset{sbhmove=2pt}\unit[mode=text]{A\sub{b}}
\end{example}
\subsection{realscripts}
Modified: trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty 2024-05-19 20:35:48 UTC (rev 71303)
+++ trunk/Master/texmf-dist/tex/latex/spbmark/spbmark.sty 2024-05-19 20:35:57 UTC (rev 71304)
@@ -9,7 +9,7 @@
% https://creativecommons.org/licenses/by/4.0/legalcode
\NeedsTeXFormat{LaTeX2e}[2018/12/31]
\RequirePackage{xparse,l3keys2e}
-\ProvidesExplPackage{spbmark}{2024/05/13}{1.46i}
+\ProvidesExplPackage{spbmark}{2024/05/19}{1.46j}
{Customize superscripts and subscripts}
\cs_generate_variant:Nn \box_set_ht:Nn { cv }
@@ -22,6 +22,8 @@
\cs_generate_variant:Nn \tl_if_novalue:nF { V }
\cs_generate_variant:Nn \tl_if_blank:nF { v }
+\providecommand{\AfterPreamble}{\AtBeginDocument}
+\AtBeginDocument{\cs_set_eq:NN \AfterPreamble \use:n}
\cs_set_eq:NN \spb at textsuperscript@save \textsuperscript
\cs_set_eq:NN \spb at textsubscript@save \textsubscript
\cs_set_eq:NN \spb at math@super at save \sp
@@ -30,46 +32,78 @@
\cs_new_protected:Npn \spb_define:n { \keys_define:nn { ctex/tools } }
\cs_new_protected:Npn \spb_set:n { \keys_set:nn { ctex/tools } }
\cs_set_eq:NN \spbset \spb_set:n
+
\keys_define:nn { spbmark/option }
{
text .choice:,
- text/true .code:n =
+ text/true .code:n =
{
\cs_set:Npn \textsuperscript { \super[textsp] }
\cs_set:Npn \textsubscript { \sub[textsb] }
},
- text/false .code:n =
+ text/false .code:n =
{
\cs_set:Npn \textsuperscript { \spb at textsuperscript@save }
\cs_set:Npn \textsubscript { \spb at textsubscript@save }
},
- text .default:n = true,
+ text .default:n = true,
math .choice:,
- math/true .code:n =
+ math/true .code:n =
{
\cs_set:Npn \sp { \super[mathsp] }
\cs_set:Npn \sb { \sub[mathsb] }
},
- math/false .code:n =
+ math/false .code:n =
{
\cs_set:Npn \sp { \spb at math@super at save }
\cs_set:Npn \sb { \spb at math@sub at save }
},
- math .default:n = true,
+ math .default:n = true,
foot .choice:,
- foot/true .code:n =
+ foot/true .code:n =
{
\cs_set:Npn \@makefnmark
{ \hbox:n { \fnmarkfont{\super[fnmark]{\@thefnmark}} } }
},
- foot/false .code:n =
+ foot/false .code:n =
{ \cs_set:Npn \@makefnmark { \spb@@makefnmark at save } },
- foot .default:n = true,
- both .meta:n = { text = #1,math = #1 },
- both .default:n = true,
- all .meta:n = { text = #1,math = #1,foot = #1 },
- all .default:n = true
+ foot .default:n = true,
+ both .meta:n = { text = #1,math = #1 },
+ both .default:n = true,
+ all .meta:n = { text = #1,math = #1,foot = #1 },
+ all .default:n = true
}
+\char_set_catcode_active:N \~
+\keys_define:nn { spbmark/option }
+ {
+ math* .choice:,
+ math*/true .code:n =
+ {
+ \AfterPreamble
+ {
+ \group_begin:
+ \char_set_lccode:nn { `\~ } { `\^ }
+ \lowercase{\group_end:\cs_set:Npn ~} { \super[mathsp*] }
+ \group_begin:
+ \char_set_lccode:nn { `\~ } { `\_ }
+ \lowercase{\group_end:\cs_set:Npn ~} { \sub[mathsb*] }
+ \char_set_mathcode:nn { `\^ } { "8000 }
+ \char_set_catcode_other:N \^
+ \char_set_catcode_other:N \_
+ }
+ },
+ math*/false .code:n =
+ {
+ \AfterPreamble
+ {
+ \char_set_catcode_math_superscript:N \^
+ \char_set_catcode_math_subscript:N \_
+ \char_set_mathcode:nn { `\^ } { "005E }
+ }
+ },
+ math* .default:n = true
+ }
+\char_set_catcode_space:N \~
\tl_if_exist:NTF \ftntm at font
{ \tl_set_eq:NN \fnmarkfont \ftntm at font }
{ \tl_set_eq:NN \fnmarkfont \normalfont }
@@ -112,7 +146,7 @@
\cs_new_protected:Npn \spbshortkv #1#2
{ \spb_define:n { #1 .meta:n = {#2} } }
\clist_map_inline:nn
- { textsp,textsb,mathsp,mathsb,fnmark }
+ { textsp,textsb,mathsp,mathsb,mathsp*,mathsb*,fnmark }
{
\defspbstyle{#1}{}
\spbshortkv{#1}{style = #1}
More information about the tex-live-commits
mailing list.