rebuildRows method
Generic implementation to rebuild rows based on the original row structure. Shared by Matrix/Array/Aligned/Split/Eqnarray/Tabular/Substack.
Implementation
List<List<LatexNode>> rebuildRows(
List<List<LatexNode>> originalRows,
List<LatexNode> newChildren,
) {
final result = <List<LatexNode>>[];
var idx = 0;
for (final row in originalRows) {
result.add(List.generate(row.length, (_) => newChildren[idx++]));
}
return result;
}