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:
1 parent
68ec9941dc
commit
02742d201f
3 files changed
+26
-4
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user