diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/spbmark/spbmark.sty | 64 |
1 files changed, 49 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty index 9646dc1e00e..c1ce4837a57 100644 --- a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty +++ b/Master/texmf-dist/tex/latex/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/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@textsuperscript@save \textsuperscript \cs_set_eq:NN \spb@textsubscript@save \textsubscript \cs_set_eq:NN \spb@math@super@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@textsuperscript@save } \cs_set:Npn \textsubscript { \spb@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@math@super@save } \cs_set:Npn \sb { \spb@math@sub@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@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@font { \tl_set_eq:NN \fnmarkfont \ftntm@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} |