Attach limits labels to overbrace and underbrace

This commit is contained in:
gloamxun committed 2026-10-20 13:29:02 +08:00
1 parent 76cc4035ea
commit cd3434ff8e
1 file changed
+10 -2
+10 -2
View File
@@ -692,12 +692,13 @@ fn parse_atom(chars: &[char], index: usize) -> (MathAtom, usize) {
}
"overbrace" | "underbrace" => {
let (base, after) = parse_atom(chars, next);
(
parse_limits(
chars,
after,
MathAtom::Brace {
base: Box::new(base),
above: command == "overbrace",
},
after,
)
}
"binom" | "dbinom" | "tbinom" => {
@@ -1035,6 +1036,13 @@ mod tests {
assert!(tall.width > plain.width);
}
#[test]
fn overbrace_accepts_a_superscript_label() {
let font = Cmr10Metrics::default();
let plain = layout_math(&parse_math(r"\overbrace{x}"), &font);
let labeled = layout_math(&parse_math(r"\overbrace{x}^{n}"), &font);
assert!(labeled.height > plain.height);
}
#[test]
fn widecheck_and_dddot_use_their_accent_codepoints() {
let MathAtom::Row(check) = parse_math(r"\widecheck{x}") else {