@@ -2813,29 +2813,28 @@ def binom(self, s, loc, toks):
2813
2813
return self ._genfrac ('(' , ')' , 0.0 , self ._MathStyle .TEXTSTYLE ,
2814
2814
num , den )
2815
2815
2816
- def _genset (self , state , annotation , body , overunder ):
2816
+ def _genset (self , s , loc , toks ):
2817
+ (annotation , body ), = toks
2818
+ state = self .get_state ()
2817
2819
thickness = state .font_output .get_underline_thickness (
2818
2820
state .font , state .fontsize , state .dpi )
2819
2821
2820
2822
annotation .shrink ()
2821
-
2822
2823
cannotation = HCentered ([annotation ])
2823
2824
cbody = HCentered ([body ])
2824
2825
width = max (cannotation .width , cbody .width )
2825
2826
cannotation .hpack (width , 'exactly' )
2826
2827
cbody .hpack (width , 'exactly' )
2827
2828
2828
2829
vgap = thickness * 3
2829
- if overunder == "under" :
2830
+ if s [ loc + 1 ] == "u" : # \underset
2830
2831
vlist = Vlist ([cbody , # body
2831
2832
Vbox (0 , vgap ), # space
2832
2833
cannotation # annotation
2833
2834
])
2834
2835
# Shift so the body sits in the same vertical position
2835
- shift_amount = cbody .depth + cannotation .height + vgap
2836
-
2837
- vlist .shift_amount = shift_amount
2838
- else :
2836
+ vlist .shift_amount = cbody .depth + cannotation .height + vgap
2837
+ else : # \overset
2839
2838
vlist = Vlist ([cannotation , # annotation
2840
2839
Vbox (0 , vgap ), # space
2841
2840
cbody # body
@@ -2845,6 +2844,8 @@ def _genset(self, state, annotation, body, overunder):
2845
2844
# an Hlist and extend it with an Hbox(0, horizontal_gap)
2846
2845
return vlist
2847
2846
2847
+ overset = underset = _genset
2848
+
2848
2849
def sqrt (self , s , loc , toks ):
2849
2850
(root , body ), = toks
2850
2851
state = self .get_state ()
@@ -2905,24 +2906,6 @@ def overline(self, s, loc, toks):
2905
2906
hlist = Hlist ([rightside ])
2906
2907
return [hlist ]
2907
2908
2908
- def overset (self , s , loc , toks ):
2909
- assert len (toks ) == 1
2910
- assert len (toks [0 ]) == 2
2911
-
2912
- state = self .get_state ()
2913
- annotation , body = toks [0 ]
2914
-
2915
- return self ._genset (state , annotation , body , overunder = "over" )
2916
-
2917
- def underset (self , s , loc , toks ):
2918
- assert len (toks ) == 1
2919
- assert len (toks [0 ]) == 2
2920
-
2921
- state = self .get_state ()
2922
- annotation , body = toks [0 ]
2923
-
2924
- return self ._genset (state , annotation , body , overunder = "under" )
2925
-
2926
2909
def _auto_sized_delimiter (self , front , middle , back ):
2927
2910
state = self .get_state ()
2928
2911
if len (middle ):
0 commit comments