Grow math delimiters with their body extent

This commit is contained in:
gloamxun committed 2026-10-20 13:03:14 +08:00
1 parent 15741c0b9c
commit a6cf56da6c
2 files changed
+12 -1

No files matched your search

+8
View File
@@ -606,6 +606,14 @@ mod tests {
assert!(indexed.height > plain.height);
}
#[test]
fn tall_delimiters_grow_with_their_body() {
let font = Cmr10Metrics::default();
let plain = layout_math(&parse_math("\\left(a\\right)"), &font);
let tall = layout_math(&parse_math("\\left(\\frac{a}{b}\\right)"), &font);
assert!(tall.height > plain.height);
assert!(tall.width > plain.width);
}
#[test]
fn overset_and_underset_stack_their_arguments() {
let font = Cmr10Metrics::default();
+4 -1
View File
@@ -123,7 +123,10 @@ a single cost function.
without changing width or height.
- `MathAtom::Text(String)` parses `\text{...}` and `\mathrm{...}`;
widths use upright CMR glyphs and spaces use the font space width.
- `MathAtom::Delimited { left, right, body }` and `\left...\right`
- `MathAtom::Delimited { left, right, body }`
- Delimiter width grows with the body extent: each non-`.` delimiter is
`0.35 * max(body height + depth, 7pt)` wide.
and `\left...\right`
parsing grow the delimiter box with the body height/depth.
- `MathClass` and TeX's 0/3/4/5mu inter-atom table add spacing for
binary/relation/open/close/punctuation atoms in `MathAtom::Row`.