@@ -2859,29 +2859,28 @@ def binom(self, s, loc, toks):
2859
2859
return self ._genfrac ('(' , ')' , 0.0 , self ._MathStyle .TEXTSTYLE ,
2860
2860
num , den )
2861
2861
2862
- def _genset (self , state , annotation , body , overunder ):
2862
+ def _genset (self , s , loc , toks ):
2863
+ (annotation , body ), = toks
2864
+ state = self .get_state ()
2863
2865
thickness = state .font_output .get_underline_thickness (
2864
2866
state .font , state .fontsize , state .dpi )
2865
2867
2866
2868
annotation .shrink ()
2867
-
2868
2869
cannotation = HCentered ([annotation ])
2869
2870
cbody = HCentered ([body ])
2870
2871
width = max (cannotation .width , cbody .width )
2871
2872
cannotation .hpack (width , 'exactly' )
2872
2873
cbody .hpack (width , 'exactly' )
2873
2874
2874
2875
vgap = thickness * 3
2875
- if overunder == "under" :
2876
+ if s [ loc + 1 ] == "u" : # \underset
2876
2877
vlist = Vlist ([cbody , # body
2877
2878
Vbox (0 , vgap ), # space
2878
2879
cannotation # annotation
2879
2880
])
2880
2881
# Shift so the body sits in the same vertical position
2881
- shift_amount = cbody .depth + cannotation .height + vgap
2882
-
2883
- vlist .shift_amount = shift_amount
2884
- else :
2882
+ vlist .shift_amount = cbody .depth + cannotation .height + vgap
2883
+ else : # \overset
2885
2884
vlist = Vlist ([cannotation , # annotation
2886
2885
Vbox (0 , vgap ), # space
2887
2886
cbody # body
@@ -2891,6 +2890,8 @@ def _genset(self, state, annotation, body, overunder):
2891
2890
# an Hlist and extend it with an Hbox(0, horizontal_gap)
2892
2891
return vlist
2893
2892
2893
+ overset = underset = _genset
2894
+
2894
2895
def sqrt (self , s , loc , toks ):
2895
2896
(root , body ), = toks
2896
2897
state = self .get_state ()
@@ -2951,24 +2952,6 @@ def overline(self, s, loc, toks):
2951
2952
hlist = Hlist ([rightside ])
2952
2953
return [hlist ]
2953
2954
2954
- def overset (self , s , loc , toks ):
2955
- assert len (toks ) == 1
2956
- assert len (toks [0 ]) == 2
2957
-
2958
- state = self .get_state ()
2959
- annotation , body = toks [0 ]
2960
-
2961
- return self ._genset (state , annotation , body , overunder = "over" )
2962
-
2963
- def underset (self , s , loc , toks ):
2964
- assert len (toks ) == 1
2965
- assert len (toks [0 ]) == 2
2966
-
2967
- state = self .get_state ()
2968
- annotation , body = toks [0 ]
2969
-
2970
- return self ._genset (state , annotation , body , overunder = "under" )
2971
-
2972
2955
def _auto_sized_delimiter (self , front , middle , back ):
2973
2956
state = self .get_state ()
2974
2957
if len (middle ):
0 commit comments