diff --git a/crates/texrra-tex-core/src/lib.rs b/crates/texrra-tex-core/src/lib.rs index 8c742e8..304df90 100644 --- a/crates/texrra-tex-core/src/lib.rs +++ b/crates/texrra-tex-core/src/lib.rs @@ -243,6 +243,14 @@ impl Unit { continue; } let mut raw_row = raw_row.trim(); + if let Some(rest) = raw_row.strip_prefix(r"\noalign") { + let rest = rest.trim_start(); + if let Some(body) = rest.strip_prefix('{') { + if let Some((_, tail)) = body.split_once('}') { + raw_row = tail.trim(); + } + } + } let mut rule = false; if let Some(rest) = raw_row.strip_prefix(r"\hline") { rule = true; @@ -1221,6 +1229,17 @@ mod tests { let engine = Engine::layout(&document); assert_eq!(engine.pages().len(), 2); } + + #[test] + fn halign_skips_noalign_material() { + let unit = Unit::halign_from_source(1, r"A & B \\ \noalign{\vskip 4pt} C & D", 2, 10); + let VerticalItem::Halign(table) = &unit.items[0] else { + panic!("expected halign") + }; + assert_eq!(table.rows.len(), 2); + assert_eq!(table.rows[1].cells[0].text, "C"); + } + #[test] fn halign_template_centers_and_right_aligns_cells() { let unit = Unit::halign_from_source_with_template(1, "lcr", r"A & B & C", 10); diff --git a/docs/TEX_CORE.md b/docs/TEX_CORE.md index 705be85..9f83c11 100755 --- a/docs/TEX_CORE.md +++ b/docs/TEX_CORE.md @@ -198,3 +198,5 @@ add filled rules to the vertical list; rules consume page height like boxes. `\not` becomes `MathAtom::Negated`, preserving the base atom's geometry for a later overlaid slash. + +`\noalign{...}` material in a halign source is skipped while rows are scanned.