diff options
Diffstat (limited to 'macros/latex/contrib/spbmark/spbmark.sty')
-rw-r--r-- | macros/latex/contrib/spbmark/spbmark.sty | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty index c1ce4837a5..4046c8bf9c 100644 --- a/macros/latex/contrib/spbmark/spbmark.sty +++ b/macros/latex/contrib/spbmark/spbmark.sty @@ -8,8 +8,8 @@ % The latest version of this license is in % https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2018/12/31] -\RequirePackage{xparse,l3keys2e} -\ProvidesExplPackage{spbmark}{2024/05/19}{1.46j} +\RequirePackage{xparse} +\ProvidesExplPackage{spbmark}{2024/07/14}{1.46n} {Customize superscripts and subscripts} \cs_generate_variant:Nn \box_set_ht:Nn { cv } @@ -32,6 +32,16 @@ \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 +\cs_new_protected:Npn \spb_mark_core_set_trad:n #1 + { + \cs_set_eq:cc { spb@text#1script@core } { spb@text#1script@save } + \cs_set_eq:cc { spb@math@#1@core } { spb@math@#1@save } + } +\cs_new_protected:Npn \spb_mark_core_set_none:n #1 + { + \cs_set_eq:cN { spb@text#1script@core } \use:n + \cs_set_eq:cN { spb@math@#1@core } \use:n + } \keys_define:nn { spbmark/option } { @@ -43,8 +53,8 @@ }, text/false .code:n = { - \cs_set:Npn \textsuperscript { \spb@textsuperscript@save } - \cs_set:Npn \textsubscript { \spb@textsubscript@save } + \cs_set:Npn \textsuperscript { \spb@textsuperscript@core } + \cs_set:Npn \textsubscript { \spb@textsubscript@core } }, text .default:n = true, math .choice:, @@ -55,8 +65,8 @@ }, math/false .code:n = { - \cs_set:Npn \sp { \spb@math@super@save } - \cs_set:Npn \sb { \spb@math@sub@save } + \cs_set:Npn \sp { \spb@math@super@core } + \cs_set:Npn \sb { \spb@math@sub@core } }, math .default:n = true, foot .choice:, @@ -71,7 +81,17 @@ both .meta:n = { text = #1,math = #1 }, both .default:n = true, all .meta:n = { text = #1,math = #1,foot = #1 }, - all .default:n = true + all .default:n = true, + spcore .choice:, + spcore .value_required:n = true, + spcore/trad .code:n = \spb_mark_core_set_trad:n { super }, + spcore/none .code:n = \spb_mark_core_set_none:n { super }, + spcore .initial:n = trad, + sbcore .choice:, + sbcore .value_required:n = true, + sbcore/trad .code:n = \spb_mark_core_set_trad:n { sub }, + sbcore/none .code:n = \spb_mark_core_set_none:n { sub }, + sbcore .initial:n = trad } \char_set_catcode_active:N \~ \keys_define:nn { spbmark/option } @@ -108,7 +128,12 @@ { \tl_set_eq:NN \fnmarkfont \ftntm@font } { \tl_set_eq:NN \fnmarkfont \normalfont } -\ProcessKeysOptions{spbmark/option} +\cs_if_exist:NTF \ProcessKeyOptions + { \ProcessKeyOptions[spbmark/option] } + { + \RequirePackage{l3keys2e} + \ProcessKeysOptions{spbmark/option} + } \tl_new:N \g__spb_mark_case_init_tl \cs_new_protected:Npn \spb_local_case_init:nnn #1#2#3 @@ -314,7 +339,7 @@ { \ensuremath { - \use:c { spb@math@#1@save } + \use:c { spb@math@#1@core } { \tl_use:c { l__spb_#1_cmd_i_tl }{#2} } } } @@ -324,7 +349,7 @@ { \hbox_gset:cn { g__#1_i_inner_box } { - \use:c { spb@text#1script@save } + \use:c { spb@text#1script@core } { \tl_use:c { l__spb_#1_cmd_i_tl }{#2} } } \dim_gset:Nv \rlastwd { l__spb_box_#1_wd_i_tl } @@ -332,16 +357,16 @@ \cs_new:Npn \spb_math_print_store_ii:nn #1#2 { \hbox_gset:Nn \g__super_ii_box - { \ensuremath{\spb@math@super@save{\l__spb_super_cmd_ii_tl{#1}}} } + { \ensuremath{\spb@math@super@core{\l__spb_super_cmd_ii_tl{#1}}} } \hbox_gset:Nn \g__sub_ii_box - { \ensuremath{\spb@math@sub@save{\l__spb_sub_cmd_ii_tl{#2}}} } + { \ensuremath{\spb@math@sub@core{\l__spb_sub_cmd_ii_tl{#2}}} } } \cs_new:Npn \spb_text_print_store_ii:nn #1#2 { \hbox_gset:Nn \g__super_ii_box - { \spb@textsuperscript@save{\l__spb_super_cmd_ii_tl{#1}} } + { \spb@textsuperscript@core{\l__spb_super_cmd_ii_tl{#1}} } \hbox_gset:Nn \g__sub_ii_box - { \spb@textsubscript@save{\l__spb_sub_cmd_ii_tl{#2}} } + { \spb@textsubscript@core{\l__spb_sub_cmd_ii_tl{#2}} } } \cs_set_eq:NN \spbifmath \use_ii:nn \cs_new:Npn \spb@ifmathtrue { \cs_set_eq:NN \spbifmath \use_i:nn } @@ -585,7 +610,7 @@ { \ifaltsbsp@spbmark \SetAltSubSupCommands{\relax} - \else\fi + \fi } }{} \cs_set_eq:NN \spb \supersub |