@@ -2762,7 +2762,8 @@ def _genfrac(self, ldelim, rdelim, rule, style, num, den):
2762
2762
if style is not self ._MathStyle .DISPLAYSTYLE :
2763
2763
num .shrink ()
2764
2764
den .shrink ()
2765
- min_clearance = 0.5 * thickness
2765
+ min_clearance = np .ceil (0.5 * thickness )
2766
+ cap_height *= 0.7
2766
2767
else :
2767
2768
min_clearance = 1.5 * thickness
2768
2769
cnum = HCentered ([num ])
@@ -2771,18 +2772,20 @@ def _genfrac(self, ldelim, rdelim, rule, style, num, den):
2771
2772
cnum .hpack (width , 'exactly' )
2772
2773
cden .hpack (width , 'exactly' )
2773
2774
2774
- if cnum .height < cap_height :
2775
- cnum .height = cap_height
2776
2775
numerator_padding = max (
2777
2776
3 / 5 * cap_height - cnum .depth , min_clearance ) - thickness
2778
2777
denominator_padding = max (
2779
2778
4 / 3 * cap_height - cden .height , min_clearance ) + thickness
2780
- vlist = Vlist ([cnum , # numerator
2781
- Vbox (0 , numerator_padding ), # space
2782
- Hrule (state , rule ), # rule
2783
- Vbox (0 , denominator_padding ), # space
2784
- cden # denominator
2785
- ])
2779
+ vlist_builder = []
2780
+ if cnum .height < cap_height :
2781
+ vlist_builder .append (Vbox (0 , cap_height - cnum .height ))
2782
+ vlist_builder += [cnum , # numerator
2783
+ Vbox (0 , numerator_padding ), # space
2784
+ Hrule (state , rule ), # rule
2785
+ Vbox (0 , denominator_padding ), # space
2786
+ cden # denominator
2787
+ ]
2788
+ vlist = Vlist (vlist_builder )
2786
2789
2787
2790
# Shift so the fraction line sits in the middle of the
2788
2791
# minus sign
0 commit comments