diff --git a/luamml-patches-amsmath.sty b/luamml-patches-amsmath.sty index b9556d1..04c97f5 100644 --- a/luamml-patches-amsmath.sty +++ b/luamml-patches-amsmath.sty @@ -15,11 +15,7 @@ \nonmatherr@ { \begin { \@currenvir } } \fi \savecolumn@ % Assumption: called inside a group - \luamml_annotate:en { - core = false - } { - \alignedspace@left - } + \UseTaggingSocket{ math/luamml/annotate/false } {}{ \alignedspace@left } \ams@start@box {#1} \bgroup \maxfields@ #2 \relax \ifnum \maxfields@ > \m@ne @@ -44,7 +40,7 @@ {##} \luamml_save:nNn {} \displaystyle {mtd} $ - \__luamml_amsmath_add_last_to_row: + \UseTaggingSocket{math/luamml/mtable/finalizecol} \tabskip \z@skip & \column@plus $ @@ -56,7 +52,7 @@ } \luamml_save:nNn {} \displaystyle {mtd} $ - \__luamml_amsmath_add_last_to_row: + \UseTaggingSocket{math/luamml/mtable/finalizecol} \hfil \tabskip\alignsep@ \crcr @@ -68,11 +64,7 @@ \else \nonmatherr@ { \begin {gathered} } \fi - \luamml_annotate:en { - core = false - } { - \alignedspace@left - } + \UseTaggingSocket{ math/luamml/annotate/false } {}{ \alignedspace@left } \ams@start@box {#1} \bgroup \Let@ \chardef \dspbrk@context \@ne @@ -87,7 +79,7 @@ ## \luamml_save:nNn {} \displaystyle {mtd} $ - \__luamml_amsmath_add_last_to_row: + \UseTaggingSocket{math/luamml/mtable/finalizecol} \hfil \crcr \ams@return@opt@arg @@ -302,14 +294,14 @@ \cs_set:Npn \endmultline@math { \luamml_save:nNn {} \displaystyle {mtd} $ - \__luamml_amsmath_add_last_to_row: + \UseTaggingSocket{math/luamml/mtable/finalizecol} } \cs_set:Npn \rendmultline@ { \iftag@ \luamml_save:nNn {} \displaystyle {mtd} $ - \__luamml_amsmath_add_last_to_row: + \UseTaggingSocket{math/luamml/mtable/finalizecol} \let \endmultline@math \relax \ifshifttag@ \hskip \multlinegap @@ -354,12 +346,7 @@ % Finally some slightly different stuff. % While {matrix} is covered by {array}, we still have {smallmatrix}: \renewenvironment {smallmatrix} { - \luamml_annotate:en { - core = false - } { - \null - \, - } + \UseTaggingSocket{ math/luamml/annotate/false } {} { \null\, } \vcenter \bgroup \Let@ \restore@math@cr @@ -375,7 +362,7 @@ ## \luamml_save:nn {} {mtd} % No \scriptsize here since we want to add the mstyle nodes $ - \__luamml_amsmath_add_last_to_row: + \UseTaggingSocket{math/luamml/mtable/finalizecol} \hfil && \thickspace @@ -386,7 +373,7 @@ ## \luamml_save:nn {} {mtd} % No \scriptsize here since we want to add the mstyle nodes $ - \__luamml_amsmath_add_last_to_row: + \UseTaggingSocket{math/luamml/mtable/finalizecol} \hfil \crcr }{% @@ -395,11 +382,7 @@ \egroup \egroup \__luamml_amsmath_finalize_inner_table: - \luamml_annotate:en { - core = false - } { - \, - } + \UseTaggingSocket{ math/luamml/annotate/false } {}{ \, } } % {cases} is defined by the kernel, but we patch the overwritten version by amsmath. diff --git a/luamml.dtx b/luamml.dtx index e5de0f5..5dde284 100644 --- a/luamml.dtx +++ b/luamml.dtx @@ -556,7 +556,27 @@ \AssignSocketPlug{tagsupport/math/luamml/save/nn}{luamml} % \end{macrocode} % -% \subsection{socket plugs for the array package} +% \subsubsection{sockets to annotate content} +% +% \begin{macrocode} +\str_if_exist:cF { l__socket_tagsupport/math/luamml/annotate/false_plug_str } + { + \NewSocket{tagsupport/math/luamml/annotate/false}{2} + \NewSocketPlug{tagsupport/math/luamml/annotate/false}{default}{#2} + \AssignSocketPlug{tagsupport/math/luamml/annotate/false}{default} + } +%<*luatex> +\NewSocketPlug{tagsupport/math/luamml/annotate/false}{luamml} + { + \luamml_annotate:en { core = false } + { + #2 + } + } +\AssignSocketPlug{tagsupport/math/luamml/annotate/false}{luamml} +% +% \end{macrocode} +% \subsubsection{socket plugs for the array package} % % The socket declaration can go with the 2025-06-01 release % \begin{macrocode} @@ -624,6 +644,26 @@ % \end{macrocode} % \subsubsection{amsmath alignments} % +% This socket is used at the end of alignment cells and adds the content to +% the current row. +% +% \begin{macrocode} +\str_if_exist:cF { l__socket_tagsupport/math/luamml/mtable/finalizecol_plug_str } + { + \NewSocket{tagsupport/math/luamml/mtable/finalizecol}{0} + } +% \end{macrocode} +% \begin{macrocode} +%<*luatex> +\NewSocketPlug{tagsupport/math/luamml/mtable/finalizecol}{luamml} + { + \__luamml_amsmath_add_last_to_row: + } +\AssignSocketPlug{tagsupport/math/luamml/mtable/finalizecol}{luamml} + +% +% \end{macrocode} +% % This socket finalize the \texttt{mtable} in alignments like align or gather. % It takes an argument, the environment. % It should be used normally with \cs{UseExpandableTaggingSocket}.