Let mathop take limits below its body

This commit is contained in:
gloamxun committed 2026-10-20 19:21:15 +08:00
1 parent ae8f81b1a2
commit c7b0124369
1 file changed
+16 -7
+16 -7
View File
@@ -745,13 +745,15 @@ fn parse_atom(chars: &[char], index: usize) -> (MathAtom, usize) {
"mathinner" => MathClass::Inner,
_ => MathClass::Ordinary,
};
(
MathAtom::Classed {
class,
body: Box::new(body),
},
after,
)
let atom = MathAtom::Classed {
class,
body: Box::new(body),
};
if command == "mathop" {
parse_limits(chars, after, atom)
} else {
(atom, after)
}
}
"big" | "bigl" | "bigr" | "Big" | "Bigl" | "Bigr" | "bigg" | "biggl" | "biggr"
| "Bigg" | "Biggl" | "Biggr" => {
@@ -1396,6 +1398,13 @@ mod tests {
));
}
#[test]
fn mathop_takes_limits_below() {
let font = Cmr10Metrics::default();
let plain = layout_math(&parse_math(r"\mathop{argmax}"), &font);
let limited = layout_math(&parse_math(r"\mathop{argmax}_{x}"), &font);
assert!(limited.depth > plain.depth);
}
#[test]
fn starred_operatorname_takes_limits_below() {
let font = Cmr10Metrics::default();