diff --git a/crates/texrra-tex-core/src/render.rs b/crates/texrra-tex-core/src/render.rs index 0d2a15a..f37edec 100755 --- a/crates/texrra-tex-core/src/render.rs +++ b/crates/texrra-tex-core/src/render.rs @@ -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 diff --git a/docs/TEX_FIDELITY_ROADMAP.md b/docs/TEX_FIDELITY_ROADMAP.md index f27c3fd..6b88a0d 100644 --- a/docs/TEX_FIDELITY_ROADMAP.md +++ b/docs/TEX_FIDELITY_ROADMAP.md @@ -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 diff --git a/docs/WEB_ROUTE_D_EXPERIMENT.md b/docs/WEB_ROUTE_D_EXPERIMENT.md index 2236624..4e48fe4 100644 --- a/docs/WEB_ROUTE_D_EXPERIMENT.md +++ b/docs/WEB_ROUTE_D_EXPERIMENT.md @@ -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 |