summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/spbmark/spbmark.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/spbmark/spbmark.sty')
-rw-r--r--macros/latex/contrib/spbmark/spbmark.sty63
1 files changed, 62 insertions, 1 deletions
diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty
index e846f52fde..41fa6ea8b1 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/02/06}{1.46b}
+\ProvidesExplPackage{spbmark}{2024/02/13}{1.46d}
{Customize superscripts and subscripts}
\cs_generate_variant:Nn \box_set_ht:Nn { cv }
@@ -341,6 +341,61 @@
}
}
}
+\spb_define:n
+ {
+ thiswd .code:n =
+ {
+ \spb_local_case_init:nnn
+ { \tl_set:Nn \l__spb_super_thiswd_mode_tl {#1} }
+ { \tl_set:Nn \l__spb_sub_thiswd_mode_tl {#1} } { }
+ },
+ regex .code:n =
+ {
+ \spb_local_case_init:nnn
+ { \tl_set:Nn \l__spb_super_regex_next_tl {#1} }
+ { \tl_set:Nn \l__spb_sub_regex_next_tl {#1} } { }
+ },
+ spthiswd .tl_set:N = \l__spb_super_thiswd_mode_tl,
+ spthiswd .initial:n = keep,
+ sbthiswd .tl_set:N = \l__spb_sub_thiswd_mode_tl,
+ sbthiswd .initial:n = keep,
+ spregex .tl_set:N = \l__spb_super_regex_next_tl,
+ spregex .initial:n = \c{sub}|\c{textsubscript}|\c{sb}|\_,
+ sbregex .tl_set:N = \l__spb_sub_regex_next_tl,
+ sbregex .initial:n = \c{super}|\c{textsuperscript}|\c{sp}|\^
+ }
+\cs_new:Npn \spb_clear_thiswd:n #1
+ {
+ \str_case:nn {#1}
+ {
+ { super }
+ {
+ \peek_regex:nF
+ { \exp_not:o { \l__spb_super_regex_next_tl } }
+ {
+ \exp_not:n
+ {
+ \dim_zero:N \llastwd
+ \dim_zero:N \clastwd
+ \dim_zero:N \rlastwd
+ }
+ }
+ }
+ { sub }
+ {
+ \peek_regex:nF
+ { \exp_not:o { \l__spb_sub_regex_next_tl } }
+ {
+ \exp_not:n
+ {
+ \dim_zero:N \llastwd
+ \dim_zero:N \clastwd
+ \dim_zero:N \rlastwd
+ }
+ }
+ }
+ }
+ }
\cs_new_protected:Npn \spb_both_newcmd_map:n #1
{
@@ -354,7 +409,13 @@
\spb_content_hbox_set:nn {#1} {##1}
\spb_ht_dp_assign:nnnn {#1} {#1} { i } { _outer }
\box_use:c { l__#1_i_outer_box }
+ \exp_last_unbraced:Nx
\group_end:
+ {
+ \exp_args:Nv \str_if_eq:nnT
+ { l__spb_#1_thiswd_mode_tl } { auto }
+ { \spb_clear_thiswd:n {#1} }
+ }
}
}
\cs_new_protected:Npn \spb_content_hbox_set:nn #1#2