\ProvidesExplPackage {luamml-patches-amstext} {2024-08-14} {0.1.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:
  }
}
