Skip to content

Commit

Permalink
more sockets, start to move amsmath env
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer committed Jan 31, 2025
1 parent c5ee511 commit e1741b1
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 33 deletions.
70 changes: 40 additions & 30 deletions luamml-patches-amsmath.sty
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{##}
\UseTaggingSocket{math/luamml/save/nNn}{ {} \displaystyle {mtd}}
$
\UseTaggingSocket{math/luamml/mtable/finalizecol}
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
\tabskip \z@skip
& \column@plus
$
Expand All @@ -52,7 +52,7 @@
}
\UseTaggingSocket{math/luamml/save/nNn}{ {} \displaystyle {mtd}}
$
\UseTaggingSocket{math/luamml/mtable/finalizecol}
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
\hfil
\tabskip\alignsep@
\crcr
Expand All @@ -79,7 +79,7 @@
##
\UseTaggingSocket{math/luamml/save/nNn}{ {} \displaystyle {mtd}}
$
\UseTaggingSocket{math/luamml/mtable/finalizecol}
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
\hfil
\crcr
\ams@return@opt@arg
Expand Down Expand Up @@ -117,7 +117,7 @@
\UseTaggingSocket{math/luamml/save/nNn}{ {} \displaystyle {mtd}}
$
}
\__luamml_amsmath_add_box_to_row:
\UseTaggingSocket{math/luamml/mtable/finalizecol}{box}
\calc@shift@gather
\set@gather@field
\tabskip\@centering
Expand All @@ -132,7 +132,7 @@
{ \place@tag@gather }
{
\place@tag@gather
\__luamml_amsmath_set_tag:
\UseTaggingSocket{math/luamml/mtable/tag/set}
}
\tabskip \iftagsleft@
\gdisplaywidth@
Expand All @@ -150,15 +150,18 @@
{ \luamml_ignore: }
{ \__luamml_amsmath_original_gmeasure:n {#1} }
}

\cs_set:Npn \endgather {
\math@cr
\black@ \totwidth@
\UseExpandableTaggingSocket{math/luamml/mtable/finalize} {gather}
\egroup
$$
\ignorespacesafterend
}
\IfPackageAtLeastTF{latex-lab-testphase-math}{2025-01-24}
{}
{ \PackageInfo{luamml}{patching~\string\endgather}
\cs_set:Npn \endgather {
\math@cr
\black@ \totwidth@
\UseExpandableTaggingSocket{math/luamml/mtable/finalize} {gather}
\egroup
$$
\ignorespacesafterend
}
}
% align and friends
\cs_set:Npn \align@preamble {
Expand All @@ -181,7 +184,7 @@
\ifmeasuring@
\savefieldlength@
\else
\__luamml_amsmath_add_box_to_row:
\UseTaggingSocket{math/luamml/mtable/finalizecol}{box}
\fi
\set@field
\tabskip\z@skip
Expand All @@ -205,7 +208,7 @@
\ifmeasuring@
\savefieldlength@
\else
\__luamml_amsmath_add_box_to_row:
\UseTaggingSocket{math/luamml/mtable/finalizecol}{box}
\fi
\set@field
\hfil
Expand All @@ -230,7 +233,7 @@
{ \make@display@tag }
}
\place@tag
\__luamml_amsmath_set_tag:
\UseTaggingSocket{math/luamml/mtable/tag/set}
\fi
\ifst@rred
\else
Expand All @@ -240,14 +243,21 @@
\cr
}
\cs_set:Npn \maketag@@@ #1 {
\hbox {
\m@th
\normalfont
#1
\__luamml_amsmath_save_tag:
}
}
% This was lost anyway, as the latex-lab code overwrites
% the definition again.
\IfPackageAtLeastTF{latex-lab-testphase-math}{2025-01-24}
{}
{ \PackageInfo{luamml}{patching~\string\maketag@@@}
\cs_set:Npn \maketag@@@ #1
{
\hbox {
\m@th
\normalfont
#1
\UseTaggingSocket{math/luamml/mtable/tag/save}
}
}
}
\cs_set:Npn \endalign {
\math@cr
Expand Down Expand Up @@ -294,14 +304,14 @@
\cs_set:Npn \endmultline@math {
\luamml_save:nNn {} \displaystyle {mtd}
$
\UseTaggingSocket{math/luamml/mtable/finalizecol}
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
}
\cs_set:Npn \rendmultline@ {
\iftag@
\luamml_save:nNn {} \displaystyle {mtd}
$
\UseTaggingSocket{math/luamml/mtable/finalizecol}
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
\let \endmultline@math \relax
\ifshifttag@
\hskip \multlinegap
Expand All @@ -322,7 +332,7 @@
\hskip \multlinetaggap
\make@display@tag
\fi
\__luamml_amsmath_set_tag:
\UseTaggingSocket{math/luamml/mtable/tag/set}
\else
\hskip \multlinegap
\fi
Expand Down Expand Up @@ -363,7 +373,7 @@
% No \scriptsize here since we want to add the mstyle nodes
\UseTaggingSocket{math/luamml/save/nn}{ {} {mtd}}
$
\UseTaggingSocket{math/luamml/mtable/finalizecol}
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
\hfil
&&
\thickspace
Expand All @@ -375,7 +385,7 @@
% No \scriptsize here since we want to add the mstyle nodes
\UseTaggingSocket{math/luamml/save/nn}{ {} {mtd}}
$
\UseTaggingSocket{math/luamml/mtable/finalizecol}
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
\hfil
\crcr
}{%
Expand Down
28 changes: 25 additions & 3 deletions luamml.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,14 @@
% \begin{macrocode}
\str_if_exist:cF { l__socket_tagsupport/math/luamml/mtable/finalizecol_plug_str }
{
\NewSocket{tagsupport/math/luamml/mtable/finalizecol}{0}
\NewSocket{tagsupport/math/luamml/mtable/finalizecol}{1}
}
% \end{macrocode}
% \begin{macrocode}
%<*luatex>
\NewSocketPlug{tagsupport/math/luamml/mtable/finalizecol}{luamml}
{
\__luamml_amsmath_add_last_to_row:
\use:c{__luamml_amsmath_add_#1_to_row:}
}
\AssignSocketPlug{tagsupport/math/luamml/mtable/finalizecol}{luamml}

Expand Down Expand Up @@ -685,7 +685,29 @@
%</luatex>
% \end{macrocode}
%
%
% These sockets save and set tags and labels in alignments.
% \begin{macrocode}
\str_if_exist:cF { l__socket_tagsupport/math/luamml/mtable/tag/save_plug_str }
{
\NewSocket{tagsupport/math/luamml/mtable/tag/save}{0}
\NewSocket{tagsupport/math/luamml/mtable/tag/set}{0}
}
% \end{macrocode}
% \begin{macrocode}
%<*luatex>
\NewSocketPlug{tagsupport/math/luamml/mtable/tag/save}{luamml}
{
\__luamml_amsmath_save_tag:
}
\AssignSocketPlug{tagsupport/math/luamml/mtable/tag/save}{luamml}
\NewSocketPlug{tagsupport/math/luamml/mtable/tag/set}{luamml}
{
\__luamml_amsmath_set_tag:
}
\AssignSocketPlug{tagsupport/math/luamml/mtable/tag/set}{luamml}

%</luatex>
% \end{macrocode}
% \subsubsection{Horizontal boxes}
% This socket annotates an \cs{hbox} inside box commands used in math.
% We test for the socket until the release 2025-06-01.
Expand Down

0 comments on commit e1741b1

Please sign in to comment.