diff options
author | Karl Berry <karl@freefriends.org> | 2021-06-30 21:18:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-06-30 21:18:14 +0000 |
commit | d47a0f82a233c6e4347ed879fb1da009e06e8a73 (patch) | |
tree | 105ad80edcd2f8e264f34eff9f60ae5988172de9 /Master | |
parent | e10d85cd43df7e227b19858f4ee94edbe836019d (diff) |
spbmark (30jun21)
git-svn-id: svn://tug.org/texlive/trunk@59777 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/spbmark/spbmark.pdf | bin | 67418 -> 68944 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/spbmark/spbmark.dtx | 65 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/spbmark/spbmark.sty | 48 |
3 files changed, 79 insertions, 34 deletions
diff --git a/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf b/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf Binary files differindex 32f841bedf8..7c108609cb3 100644 --- a/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf +++ b/Master/texmf-dist/doc/latex/spbmark/spbmark.pdf diff --git a/Master/texmf-dist/source/latex/spbmark/spbmark.dtx b/Master/texmf-dist/source/latex/spbmark/spbmark.dtx index 754bcfa0c46..87e40645dbf 100644 --- a/Master/texmf-dist/source/latex/spbmark/spbmark.dtx +++ b/Master/texmf-dist/source/latex/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/Master/texmf-dist/tex/latex/spbmark/spbmark.sty b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty index 2eb7406a8dc..f8a53902b79 100644 --- a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty +++ b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty @@ -11,19 +11,23 @@ %% conditions of the CC-BY 4.0 License. %% The latest version of this license is in %% https://creativecommons.org/licenses/by/4.0/legalcode -\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} @@ -69,15 +73,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} } @@ -104,7 +110,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: } } @@ -116,13 +122,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}} } @@ -164,8 +170,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 |