From f88fa7fd9d64252e58dd1ad93679a7c1b259c2ea Mon Sep 17 00:00:00 2001 From: GloamXun Date: Tue, 20 Oct 2026 19:09:44 +0800 Subject: [PATCH] Ignore numbering and limits control words in math --- crates/texrra-tex-core/src/math.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/texrra-tex-core/src/math.rs b/crates/texrra-tex-core/src/math.rs index 775c166..dabdf76 100755 --- a/crates/texrra-tex-core/src/math.rs +++ b/crates/texrra-tex-core/src/math.rs @@ -581,7 +581,8 @@ fn parse_atom(chars: &[char], index: usize) -> (MathAtom, usize) { return match command.as_str() { "quad" => (MathAtom::Space(655_360), next), "qquad" => (MathAtom::Space(1_310_720), next), - "displaystyle" | "textstyle" | "scriptstyle" | "scriptscriptstyle" => { + "displaystyle" | "textstyle" | "scriptstyle" | "scriptscriptstyle" | "nonumber" + | "notag" | "limits" | "nolimits" | "displaylimits" => { let mut after = next; while chars.get(after).is_some_and(|ch| ch.is_whitespace()) { after += 1; @@ -1268,6 +1269,14 @@ mod tests { assert_eq!(under.height, plain.height); } + #[test] + fn numbering_control_words_are_transparent() { + let font = Cmr10Metrics::default(); + let plain = layout_math(&parse_math("x+y"), &font); + let numbered = layout_math(&parse_math(r"x\nonumber+y"), &font); + assert_eq!(plain.width, numbered.width); + assert_eq!(plain.height, numbered.height); + } #[test] fn operatorname_star_does_not_emit_a_symbol() { let font = Cmr10Metrics::default();