The eqnarray environment seems intended to represent one or more equations, but each equation can be continued with additional right-hand-sides (by omitting the 1st column), or the RHS itself can be continued on multiple lines by omitting the 1st two columns on a row. With our goal of constructing well-structured mathematics, this gives us a fun little puzzle to sort out. However, being essentially the only structure for aligning mathematical stuff in standard LaTeX, eqnarray tended to be stretched into various other use cases; aligning numbered equations with bits of text on the side, for example. We therefore have some work to do to guess what the intent is.

The strategy used for eqnarray is process the material as an alignment in math mode and convert initially to the following XML structure:

<ltx:equationgroup>

<ltx:equation>

<ltx:_Capture_>

<ltx:Math><ltx:XMath>column math here</ltx:XMath></ltx:Math>

</ltx:_Capture_>

…

</ltx:equation>

…

</ltx:equationgroup>

The results are then studied to recognize the patterns of empty columns so that the rows can be regrouped into logical equations. MathFork structures are used to contain those logical equations while preserving the layout in the MathBranch.

NOTE We need to deal better with the cases that have more rows numbered that we would like.