<..equations of amsmath.sty..>+
\def\math@cr@@[#1]{\ifnum0=‘{\fi \iffalse}\fi\math@cr@@@
\o:noalign:{\vskip#1\relax}}
-_-_-
The above had also ‘\noalign{\vskip#1\relax}}’ in it, but it cause two extra rows in subarray.
<..equations of amsmath.sty..>+
\catcode‘\#=13 \catcode‘\!=6
\def\reg:align!1!2{%
<.inany@true.> \inalign@true <.displaybreak@.>\intertext@
\ifingather@\else\displ@y@\fi\Let@ \let\math@cr@@@\math@cr@@@align
\ifxxat@\else \let\tag\tag@in@align \fi
\let\label\label@in@display !1% set st@r
\ifst@rred\else \global\@eqnswtrue \fi \measure@{!2}%
\global\row@\z@ \tabskip\eqnshift@
<.clean span.>%
<.halign amsmath align.>}
\catcode‘\#=6 \catcode‘\!=12
-_-_-
<..halign amsmath align..>
\SaveMkHalignConf:g{\align:type}\HRestore\noalign
\MkHalign#{<.amsmath align pattern.>}!2%
-_-_-
<..amsmath align pattern..>
\span
&\@lign$\m@th\displaystyle{<.sub/sup base.>#}$%
&\@lign$\m@th\displaystyle{<.sub/sup base.>#}$%
-_-_-
We need to clean the \c:halign and \d:halign around the \span.
<..clean span..>
\Configure{PauseMkHalign}
{\Configure{PauseMkHalign}{}{}{}{}\expandafter\clean:span}{}{}{}%
-_-_-
<..equations of amsmath.sty..>+
\def\clean:span#1\c:halign{%
\TeXhalign \bgroup \:span}
-_-_-
<..equations of amsmath.sty..>+
\ifx \ifinany@\:Undef
<.since 1999 endalign.>
\else
<.until 1999 endalign.>
\fi
\HLet\endalign=\:tempc
\def\:tempc{\pic:MkHalign{\align:type}}
\HLet\align@=\:tempc
-_-_-
<..since 1999 endalign..>
\def\:tempc{%
\math@cr
\EndMkHalign \RecallMkHalignConfig \csname b:\align:type\endcsname
\ifingather@ \restorealignstate@ \egroup \nonumber
\ifnum0=‘{\fi\iffalse}\fi%
\else $$\fi
\global\@ignoretrue
}
-_-_-
<..until 1999 endalign..>
\def\:tempc{%
\math@cr
\EndMkHalign \RecallMkHalignConfig \csname b:\align:type\endcsname
\ifingather@ \restorealignstate@ \egroup \nonumber
\ifnum0=‘{\fi}%
\else $$\fi
\global\@ignoretrue
}
-_-_-
<..equations of amsmath.styNO..>
\NewConfigure{align}{6}
\NewConfigure{align*}{6}
-_-_-
<..equations of amsmath.sty..>+
<.ams align config util.>
\def\:tempc#1{%
\expandafter\pend:def\csname #1\endcsname{\def\align:type{#1}}%
\NewConfigure{#1}[6]{\Config:alg{##1}{##2}{##3}{##4}{##5}{##6}{#1}}%
\Configure{#1}{}{}{}{}{}{}%
\def\:temp{#1}\def\:tempa{align}\ifx \:temp\:tempa\else
\@xp\let\csname reg:#1\endcsname=\reg:align
\@xp\let\csname end#1\endcsname=\endalign
\fi }
\:tempc{alignat}
\:tempc{alignat*}
\:tempc{xalignat}
\:tempc{xalignat*}
\:tempc{xxalignat}
\:tempc{align}
\:tempc{align*}
\:tempc{flalign}
\:tempc{flalign*}
\pend:defIII\start@align{\Configure{$$}{}{}{}}
-_-_-
<..ams align config util..>
\def\Config:alg#1#2#3#4#5#6#7{%
\expandafter\c:def\csname a:#7\endcsname{\global
\let\sv:amps=\add:amps #1}%
\expandafter\c:def\csname b:#7\endcsname{#2\global
\let\add:amps=\sv:amps}%
\expandafter\c:def\csname c:#7\endcsname{#3}%
\expandafter\c:def\csname d:#7\endcsname{#4}%
\expandafter\c:def\csname e:#7\endcsname{\expandafter\align:td
\expandafter{\csname f:#7\endcsname}{#5}{#6}}%
}
\def\align:td#1#2#3{\iftag@
\ifnum \add:amps>0
\gHAdvance\add:amps by -1 \gHAdvance\HCol by -1
\global\let#1=\empty
\ifnum \add:amps=0 \gHAdvance\HCol=1 #2\gdef#1{#3}\fi
\else #2\gdef#1{#3}\fi
\else \gHAssign\add:amps=\HCol\relax #2\gdef#1{#3}\fi}%
-_-_-
The ‘align’ environment set labels by rewriting the row with empty entry, and adding the abel in an extra entry. That is, with a format of the form ‘align-\label=&....maxfields@-1....&latex-\label’. The machinary is within \add@amps.
Without the \HRestore\noalign we get infinite loop. Where? Why?
<..sub/sup base..>
{\HCode{}}%
-_-_-