Add {gather} support

This commit is contained in:
Marcel Fabian Krüger 2021-06-22 23:24:25 +02:00
parent ffe3514b75
commit 36b3c596a7

View File

@ -3,6 +3,12 @@
\lua_now:n { require'luamml-amsmath' }
% For all of these changes, the redefinitions appear huge.
% But they are almost identical to the original and only
% add luamml commands in appropriate places, so they would
% mostly disappear if there were enough hooks in amsmath.
% aligned and friends
\cs_set:Npn \start@aligned #1#2 {
\RIfM@
\else
@ -66,6 +72,66 @@
\__luamml_amsmath_finalize_inner_table:
}
% gather
\cs_set:Npn \gather@ #1 {
\ingather@true
\let \split \insplit@
\let \tag \tag@in@align
\let \label \label@in@display
\chardef \dspbrk@context \z@
\intertext@ \displ@y@ \Let@
\let \math@cr@@@ \math@cr@@@gather
\gmeasure@ {#1}
\global \shifttag@false
\tabskip \z@skip
\global \row@ \@ne
\halign to \displaywidth \bgroup
\strut@
\setboxz@h {
$
\m@th
\displaystyle
{##}
\luamml_flag_save:Nn \displaystyle {mtd}
$
}
\__luamml_amsmath_add_box_to_row:
\calc@shift@gather
\set@gather@field
\tabskip\@centering
&
\setboxz@h {
\strut@
{##}
}
\place@tag@gather
\__luamml_amsmath_set_tag:
\tabskip \iftagsleft@
\gdisplaywidth@
\else
\z@skip
\span \fi
\crcr
#1
}
\cs_new_eq:NN \__luamml_amsmath_original_gmeasure:n \gmeasure@
\cs_set:Npn \gmeasure@ #1 {
\exp_last_unbraced:Nno
\use_ii_i:nn
{ \luamml_flag_ignore: }
{ \__luamml_amsmath_original_gmeasure:n {#1} }
}
\cs_set:Npn \endgather {
\math@cr
\black@ \totwidth@
\__luamml_amsmath_finalize_table:
\egroup
$$
\ignorespacesafterend
}
% align and friends
\cs_set:Npn \align@preamble {
&
\hfil