@@ -1932,7 +1932,14 @@ def clear(self):
19321932
19331933 def parse (self , s , fonts_object , fontsize , dpi ):
19341934 self ._state_stack = [self .State (fonts_object , 'default' , fontsize , dpi )]
1935- self ._expression .parseString (s )
1935+ try :
1936+ self ._expression .parseString (s )
1937+ except ParseException , err :
1938+ raise ValueError ("\n " .join ([
1939+ "" ,
1940+ err .line ,
1941+ " " * (err .column - 1 ) + "^" ,
1942+ str (err )]))
19361943 return self ._expr
19371944
19381945 # The state of the parser is maintained in a stack. Upon
@@ -2155,7 +2162,7 @@ def subsuperscript(self, s, loc, toks):
21552162 super = next1
21562163 sub = next2
21572164 else :
2158- raise ParseFatalException ("Subscript/superscript sequence is too long." )
2165+ raise ParseFatalException ("Subscript/superscript sequence is too long. Use braces { } to remove ambiguity. " )
21592166
21602167 state = self .get_state ()
21612168 rule_thickness = state .font_output .get_underline_thickness (
@@ -2277,7 +2284,7 @@ def sqrt(self, s, loc, toks):
22772284 state .font , state .fontsize , state .dpi )
22782285
22792286 if root is None :
2280- root = Box ()
2287+ root = Box (0. , 0. , 0. )
22812288 else :
22822289 if not isinstance (root , ParseResults ):
22832290 raise ParseFatalException (
0 commit comments