Keep large-operator limits close to the operator

Display limits under \sum used the operator glyph depth, which pushed i=1 far
below the fraction and made the denominator look detached. Use the normal
limit gap for big operators while preserving the depth-based placement that
the existing \mathop oracle validates for ordinary bases.

Test count stays 1079.
This commit is contained in:
gloamxun committed 2026-10-28 08:17:57 +08:00
1 parent 68ec9941dc
commit 02742d201f
3 files changed
+26 -4

No files matched your search

+22 -1
View File
@@ -1063,6 +1063,23 @@ impl Page {
list.images.extend(content.images);
list.width = list.width.max(content.width);
}
fn large_operator(atom: &MathAtom) -> bool {
match atom {
MathAtom::BigOperator { name } => matches!(
name.as_str(),
"sum" | "prod" | "coprod" | "bigcup" | "bigcap" | "bigoplus" | "bigotimes"
),
MathAtom::Symbol(character) => matches!(
character,
'∑' | '∏' | '∐' | '∫' | '∬' | '∭' | '∮' | '⋃' | '⋂' | '⨁' | '⨂'
),
MathAtom::Classed { body, .. }
| MathAtom::Script { base: body, .. }
| MathAtom::Limits { base: body, .. } => Self::large_operator(body),
_ => false,
}
}
fn paint_math(
atom: &MathAtom,
font: &Cmr10Metrics,
@@ -1590,7 +1607,11 @@ impl Page {
font,
x + (base_box.width - sub_box.width).max(0) / 2,
baseline
+ math::intrinsic_depth(base, font)
+ if Self::large_operator(base) {
0
} else {
math::intrinsic_depth(base, font)
}
+ 131_072
+ sub_box.height
+ 65_536
+3 -2
View File
@@ -49,8 +49,9 @@ execution is not a goal.
parenthetical citations; inline `thebibliography` without labels remains
numeric, and the full natbib option surface is not implemented;
- display math is approximate; fraction boxes reserve the full
numerator/denominator extent, scripts attach across math spaces, subscripts
drop below the base, and tags sit at the right margin;
numerator/denominator extent, large-operator limits sit close to the
operator, scripts attach across math spaces, subscripts drop below the
base, and tags sit at the right margin;
- PNG/JPEG/BMP floats now reserve their image height, embed the raster with
its real pixel dimensions, centre the image within the float, and emit it
into the SVG preview as a PNG data URI. Table floats are centred with their
+1 -1
View File
@@ -148,7 +148,7 @@ PDF was rendered page-by-page next to the route-D output.
| Citations | natbib author-year `(Kour and Saabne, 2014a; …)` | author-year `(Kour and Saabne, 2014a; Keshet et al., 2016)` for `.bib`; numeric for unlabeled inline bibliographies |
| Table | booktabs rules, `Size (µm)`, `~100`, `10^6` | centred with rules; `Size (µm)`, `~100`, `10⁶` |
| Figure | framed rule box above the caption | centred framed rule body (raster) on page 3 |
| Display equation | fully typeset fraction/product/sum | approximate body; fraction box uses full extents, subscripts attach even after a space, and the tag sits at the right margin |
| Display equation | fully typeset fraction/product/sum | approximate body; fraction box uses full extents, sum limits sit close to large operators, subscripts attach even after a space, and the tag is at the right margin |
| References | author-year, italic venue, DOI link | author-year entries; DOI appended when present in the .bib |
| Float order | figure/table on page 3 with section 3.4 | figure/table on page 3 above 3.3/3.4 |