handle text command as in latex-lab

This commit is contained in:
Ulrike Fischer 2024-12-03 16:33:37 +01:00
parent 957c8ff803
commit eb4dd9561c

View File

@ -1,37 +1,25 @@
\ProvidesExplPackage {luamml-patches-amstext} {2024-10-30} {0.2.0}
{Feel free to add a description here}
\int_new:N \g__luamml_amsmath_text_struct_int
\cs_set:Npn \textdef@ #1 #2 #3 {
\int_if_odd:nTF { \int_div_truncate:nn { \l__luamml_flag_int } { 8 } } {
\int_gincr:N \g__luamml_amsmath_text_struct_int
\tag_struct_begin:n {
tag = mtext/mathml,
stash,
label = __luamml_amsmath_text_ \int_use:N \g__luamml_amsmath_text_struct_int
}
\tag_mc_begin:n {
tag = mtext
}
\AnnotateFormula {
nucleus = true,
struct = "__luamml_amsmath_text_ \int_use:N \g__luamml_amsmath_text_struct_int"
}
} {
\use:n
}
{
\hbox {
{
\everymath {#1}
\let \f@size #2
\selectfont
#3
}
}
}
\int_if_odd:nT { \int_div_truncate:nn { \l__luamml_flag_int } { 8 } } {
\tag_mc_end:
\tag_struct_end:
}
}
% This is the same definition as in latex-lab-amsmath. It can go with the
% 2025-06-01 release.
\sys_if_engine_luatex:T
{
\def\text@#1{
\tag_socket_use:nnn {math/luamml/hbox}{}
{{%
\ifcase\mathstyle
\hbox{{#1}}\or
\hbox{{#1}}\or
\hbox{{#1}}\or
\hbox{{#1}}\or
\hbox{{\let\f@size\sf@size\selectfont#1}}\or
\hbox{{\let\f@size\sf@size\selectfont#1}}\or
\hbox{{\let\f@size\ssf@size\selectfont#1}}\or
\hbox{{\let\f@size\ssf@size\selectfont#1}}\or
\ERROR
\fi
\check@mathfonts
}}}
}