Skip to content

Commit 116c96c

Browse files
committed
moving gathered luamml patch
1 parent 7d00ace commit 116c96c

File tree

2 files changed

+75
-42
lines changed

2 files changed

+75
-42
lines changed

required/latex-lab/latex-lab-amsmath.dtx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,35 @@
117117
\ignorespacesafterend
118118
}
119119
\math_register_halign_env:nn {gather}{}
120+
% \end{macrocode}
121+
%
122+
% the gathered environment needs various sockets for luamml support.
123+
% \begin{macrocode}
124+
\renewenvironment{gathered}[1][c]{%
125+
\RIfM@\else
126+
\nonmatherr@{\begin{gathered}}%
127+
\fi
128+
% \end{macrocode}
129+
% This annotates the space
130+
% \begin{macrocode}
131+
\UseTaggingSocket{ math/luamml/annotate/false } {}{ \alignedspace@left }
132+
\ams@start@box{#1}\bgroup
133+
\Let@ \chardef\dspbrk@context\@ne \restore@math@cr
134+
\spread@equation
135+
\ialign\bgroup
136+
\hfil\strut@$\m@th\displaystyle##
137+
% \end{macrocode}
138+
% This save the cell and then finalize it.
139+
% \begin{macrocode}
140+
\UseTaggingSocket{math/luamml/save/nNn}{ {} \displaystyle {mtd}}
141+
$
142+
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
143+
\hfil
144+
\crcr
145+
\ams@return@opt@arg
146+
}{%
147+
\endaligned
148+
}
120149
}
121150
% \end{macrocode}
122151
%

texmf/tex/lualatex/luamml/luamml-patches-amsmath.sty

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -58,32 +58,36 @@
5858
\crcr
5959
\ams@return@opt@arg
6060
}
61-
62-
\renewcommand \gathered [1] [c] {
63-
\RIfM@
64-
\else
65-
\nonmatherr@ { \begin {gathered} }
66-
\fi
67-
\UseTaggingSocket{ math/luamml/annotate/false } {}{ \alignedspace@left }
68-
\ams@start@box {#1} \bgroup
69-
\Let@
70-
\chardef \dspbrk@context \@ne
71-
\restore@math@cr
72-
\spread@equation
73-
\ialign \bgroup
74-
\hfil
75-
\strut@
76-
$
77-
\m@th
78-
\displaystyle
79-
##
80-
\UseTaggingSocket{math/luamml/save/nNn}{ {} \displaystyle {mtd}}
81-
$
82-
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
83-
\hfil
84-
\crcr
85-
\ams@return@opt@arg
86-
}
61+
\IfPackageAtLeastTF{latex-lab-testphase-math}{2025-01-24}
62+
{}
63+
{
64+
\PackageInfo{luamml}{patching~gathered}
65+
\renewcommand \gathered [1] [c] {
66+
\RIfM@
67+
\else
68+
\nonmatherr@ { \begin {gathered} }
69+
\fi
70+
\UseTaggingSocket{ math/luamml/annotate/false } {}{ \alignedspace@left }
71+
\ams@start@box {#1} \bgroup
72+
\Let@
73+
\chardef \dspbrk@context \@ne
74+
\restore@math@cr
75+
\spread@equation
76+
\ialign \bgroup
77+
\hfil
78+
\strut@
79+
$
80+
\m@th
81+
\displaystyle
82+
##
83+
\UseTaggingSocket{math/luamml/save/nNn}{ {} \displaystyle {mtd}}
84+
$
85+
\UseTaggingSocket{math/luamml/mtable/finalizecol}{last}
86+
\hfil
87+
\crcr
88+
\ams@return@opt@arg
89+
}
90+
}
8791

8892
\cs_set:Npn \endaligned {
8993
\crcr
@@ -257,22 +261,22 @@
257261
\UseTaggingSocket{math/luamml/mtable/tag/save}
258262
}
259263
}
260-
}
261-
262-
\cs_set:Npn \endalign {
263-
\math@cr
264-
\black@ \totwidth@
265-
\UseTaggingSocket{math/luamml/mtable/finalize} {align}
266-
\egroup
267-
\ifingather@
268-
\restorealignstate@
269-
\egroup
270-
\nonumber
271-
\ifnum0=`{\fi\iffalse}\fi
272-
\else
273-
$$
274-
\fi
275-
\ignorespacesafterend
264+
% this handled in latex-lab through \common@align@ending
265+
\cs_set:Npn \endalign {
266+
\math@cr
267+
\black@ \totwidth@
268+
\UseTaggingSocket{math/luamml/mtable/finalize} {align}
269+
\egroup
270+
\ifingather@
271+
\restorealignstate@
272+
\egroup
273+
\nonumber
274+
\ifnum0=`{\fi\iffalse}\fi
275+
\else
276+
$$
277+
\fi
278+
\ignorespacesafterend
279+
}
276280
}
277281
278282
% For a more interesting one, let's consider multline:

0 commit comments

Comments
 (0)