diff --git a/library/src/math/root.rs b/library/src/math/root.rs index e1c8d9878..fa41167df 100644 --- a/library/src/math/root.rs +++ b/library/src/math/root.rs @@ -1,7 +1,5 @@ use super::*; -const MIN_INDEX_SHIFT: Em = Em::new(0.35); - /// # Square Root /// A square root. /// @@ -123,12 +121,12 @@ fn layout( let inner_ascent = extra_ascender + thickness + gap + radicand.ascent(); let mut sqrt_offset = Abs::zero(); + let mut shift_up = Abs::zero(); let mut ascent = inner_ascent; - let mut shift_up = raise_factor * sqrt.height() - descent; if let Some(index) = &index { sqrt_offset = kern_before + index.width() + kern_after; - shift_up.set_max(index.descent() + MIN_INDEX_SHIFT.scaled(ctx)); + shift_up = raise_factor * sqrt.height() - descent + index.descent(); ascent.set_max(shift_up + index.ascent()); } diff --git a/tests/ref/math/root.png b/tests/ref/math/root.png index 8d9063949..1f08de708 100644 Binary files a/tests/ref/math/root.png and b/tests/ref/math/root.png differ diff --git a/tests/typ/math/root.typ b/tests/typ/math/root.typ index 8d3e2de02..fdb37bc1b 100644 --- a/tests/typ/math/root.typ +++ b/tests/typ/math/root.typ @@ -35,4 +35,5 @@ $ v = sqrt((1/2) / (4/5)) // Test large index. $ root(2, x) quad root(3/(2/1), x) quad - root(1/11, x) $ + root(1/11, x) quad + root(1/2/3, 1) $