Ignore numbering and limits control words in math

This commit is contained in:
gloamxun committed 2026-10-20 19:09:44 +08:00
1 parent c72f612431
commit f88fa7fd9d
1 file changed
+10 -1
+10 -1
View File
@@ -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();