summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-07-24 20:48:09 +0000
committerKarl Berry <karl@freefriends.org>2021-07-24 20:48:09 +0000
commitf0de3338cfffa669b4bfa9f7b24d887637265089 (patch)
treea6123d80e5ca4106e8f62275c00013f5f155239c /Master/texmf-dist/tex
parent3a2294eff9e415a4ff2a6b6275988c8cf14cd628 (diff)
spbmark (24jul21)
git-svn-id: svn://tug.org/texlive/trunk@60044 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/spbmark/spbmark.sty103
1 files changed, 64 insertions, 39 deletions
diff --git a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
index 36c379a3d5e..eac66899859 100644
--- a/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
+++ b/Master/texmf-dist/tex/latex/spbmark/spbmark.sty
@@ -13,7 +13,7 @@
%% https://creativecommons.org/licenses/by/4.0/legalcode
\NeedsTeXFormat{LaTeX2e}[2018/12/31]
\RequirePackage{xparse,l3keys2e}
-\ProvidesExplPackage{spbmark}{2021/07/22}{1.02}
+\ProvidesExplPackage{spbmark}{2021/07/23}{1.04}
{Customize superscripts and subscripts}
\cs_new_protected:Npn \spb_define:n { \keys_define:nn { spbmark } }
@@ -32,28 +32,33 @@
\ProcessKeysOptions{spbmark/option}
+\tl_new:N \l__spb_super_script_formatii_tl
+\tl_new:N \l__spb_sub_script_formatii_tl
\spb_define:n
{
- super-vshift .dim_set:N = \l__spb_super_script_vshift_dim,
- super-vshift .initial:n = 0pt,
- super-hshift .dim_set:N = \l__spb_super_script_hshift_dim,
- super-hshift .initial:n = 0pt,
- sub-vshift .dim_set:N = \l__spb_sub_script_vshift_dim,
- sub-vshift .initial:n = 0pt,
- sub-hshift .dim_set:N = \l__spb_sub_script_hshift_dim,
- sub-hshift .initial:n = 0pt,
- supersubsep .dim_set:N = \l__spb_supersub_script_sep_dim,
- supersubsep .initial:n = 0.3ex,
- supersubalign .tl_set:N = \l__spb_supersub_script_align_tl,
- supersubalign .initial:n = l
+ super-vshift .dim_set:N = \l__spb_super_script_vshift_dim,
+ super-vshift .initial:n = 0pt,
+ super-hshift .dim_set:N = \l__spb_super_script_hshift_dim,
+ super-hshift .initial:n = 0pt,
+ sub-vshift .dim_set:N = \l__spb_sub_script_vshift_dim,
+ sub-vshift .initial:n = 0pt,
+ sub-hshift .dim_set:N = \l__spb_sub_script_hshift_dim,
+ sub-hshift .initial:n = 0pt,
+ supersub-hshift .dim_set:N = \l__spb_supersub_script_hshift_dim,
+ supersub-hshift .initial:n = 0pt,
+ super-format .tl_set:N = \l__spb_super_script_formati_tl,
+ sub-format .tl_set:N = \l__spb_sub_script_formati_tl,
+ supersub-format .code:n = \spb_both_format_assign:n {#1},
+ supersubsep .dim_set:N = \l__spb_supersub_script_sep_dim,
+ supersubsep .initial:n = 0.3ex,
+ supersubalign .tl_set:N = \l__spb_supersub_script_align_tl,
+ supersubalign .initial:n = l
}
\tl_set:Nn \l__spb_boxa_wd_tl { \box_wd:N \l_tmpa_box }
\tl_set:Nn \l__spb_boxb_wd_tl { \box_wd:N \l_tmpb_box }
\cs_new:Npn \spb_tmp_boxa_use: { \box_use:N \l_tmpa_box }
\cs_new:Npn \spb_tmp_boxb_use: { \box_use:N \l_tmpb_box }
-\cs_new:Npn \spb_tmp_hboxa_set:n #1 { \hbox_set:Nn \l_tmpa_box {#1} }
-\cs_new:Npn \spb_tmp_hboxb_set:n #1 { \hbox_set:Nn \l_tmpb_box {#1} }
\cs_new:Npn \spb_box_max_dim_horizontal:
{
\skip_horizontal:n
@@ -71,6 +76,26 @@
\spb_boxwd_subtract:nnnn { -0.5 } { 0.5 } {#1} {#2}
\use:c { spb_tmp_#1_use: }
}
+\cs_new:Npn \spb_math_print_store:nnn #1#2#3
+ {
+ \hbox_set:Nn \l_tmpa_box
+ { \ensuremath{#1{\spb_math:nn {#2} {#3}}} }
+ }
+\cs_new:Npn \spb_text_print_store:nnn #1#2#3
+ {
+ \hbox_set:Nn \l_tmpa_box
+ { #1{\use:c { spb@text#2script@save }{#3}} }
+ }
+\cs_new:Npn \spb_math_print_store:nnnn #1#2#3#4
+ {
+ \hbox_set:Nn \l_tmpa_box { \ensuremath{#1{\spb@sp@save{#2}}} }
+ \hbox_set:Nn \l_tmpb_box { \ensuremath{#3{\spb@sb@save{#4}}} }
+ }
+\cs_new:Npn \spb_text_print_store:nnnn #1#2#3#4
+ {
+ \hbox_set:Nn \l_tmpa_box { #1{\spb@textsuperscript@save{#2}} }
+ \hbox_set:Nn \l_tmpb_box { #3{\spb@textsubscript@save{#4}} }
+ }
\cs_set_eq:NN \spb@textsuperscript@save \textsuperscript
\cs_set_eq:NN \spb@textsubscript@save \textsubscript
\cs_set_eq:NN \spb@sp@save \sp
@@ -88,29 +113,34 @@
\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} }
}
+\NewDocumentCommand{\spb_both_format_assign:n}
+ {>{\SplitArgument{1}{,}}m}
+ {\spb_supersub_script_both_format:nn #1}
+\cs_new_protected:Npn \spb_supersub_script_both_format:nn #1#2
+ {
+ \tl_set:Nn \l__spb_super_script_formatii_tl {#1}
+ \tl_if_novalue:nTF {#2}
+ { \tl_clear:N \l__spb_sub_script_formatii_tl }
+ { \tl_set:Nn \l__spb_sub_script_formatii_tl {#2} }
+ }
+
\clist_map_inline:nn
{ super,sub }
{
\exp_args:Nc \NewDocumentCommand {#1}
{
sO{\dim_use:c { l__spb_#1_script_vshift_dim }}
- >{\SplitArgument{1}{,}}O{}D(){}
+ >{\SplitArgument{1}{,}}O{}
+ D(){\tl_use:c { l__spb_#1_script_formati_tl }}
mO{\dim_use:c { l__spb_#1_script_hshift_dim }}
}
{
\IfBooleanTF{##1}
+ {\spb_math_print_store:nnn {##4} {#1} {##5}}
{
- \spb_tmp_hboxa_set:n
- { \ensuremath{##4{\spb_math:nn {#1} {##5}}} }
- }{
\mode_if_math:TF
- {
- \spb_tmp_hboxa_set:n
- { \ensuremath{##4{\spb_math:nn {#1} {##5}}} }
- }{
- \spb_tmp_hboxa_set:n
- { ##4{\use:c { spb@text#1script@save }{##5}} }
- }
+ { \spb_math_print_store:nnn {##4} {#1} {##5} }
+ { \spb_text_print_store:nnn {##4} {#1} {##5} }
}
\hbox_set_to_wd:Nnn \l_tmpb_box { \l__spb_boxa_wd_tl + ##6 }
{ \hss\box_move_up:nn {##2} { \spb_tmp_boxa_use: } }
@@ -121,23 +151,18 @@
\NewDocumentCommand{\supersub}
{
sO{\l__spb_supersub_script_sep_dim}
- O{\l__spb_supersub_script_align_tl}D(){}mmO{0pt}D(){}
+ O{\l__spb_supersub_script_align_tl}
+ D(){\l__spb_super_script_formatii_tl}mm
+ O{\l__spb_supersub_script_hshift_dim}
+ D(){\l__spb_sub_script_formatii_tl}
}
{
\IfBooleanTF{#1}
+ {\spb_math_print_store:nnnn {#4} {#5} {#8} {#6}}
{
- \spb_tmp_hboxa_set:n { \ensuremath{#4{\spb@sp@save{#5}}} }
- \spb_tmp_hboxb_set:n { \ensuremath{#8{\spb@sb@save{#6}}} }
- }{
\mode_if_math:TF
- {
- \spb_tmp_hboxa_set:n { \ensuremath{#4{\spb@sp@save{#5}}} }
- \spb_tmp_hboxb_set:n { \ensuremath{#8{\spb@sb@save{#6}}} }
- }
- {
- \spb_tmp_hboxa_set:n { #4{\spb@textsuperscript@save{#5}} }
- \spb_tmp_hboxb_set:n { #8{\spb@textsubscript@save{#6}} }
- }
+ { \spb_math_print_store:nnnn {#4} {#5} {#8} {#6} }
+ { \spb_text_print_store:nnnn {#4} {#5} {#8} {#6} }
}
\hbox_set_to_wd:Nnn \l_tmpa_box { \l__spb_boxa_wd_tl + #7 }
{ \hss\box_move_up:nn {#2} { \spb_tmp_boxa_use: } }
@@ -159,7 +184,7 @@
\spb_box_max_dim_horizontal:
}
{
- \dim_compare:nTF { \l__spb_boxa_wd_tl > \l__spb_boxb_wd_tl }
+ \dim_compare:nNnTF { \l__spb_boxa_wd_tl } > { \l__spb_boxb_wd_tl }
{ \spb_boxwd_script_align:nn { boxa } { boxb } }
{ \spb_boxwd_script_align:nn { boxb } { boxa } }
}