ParseFatalException: Expected end of math '$'

Hi all,

Is there a way to use

title(r'$ M= I_3 K=\left[\begin{array}{rrr} 2\,k & -k & 0 \\ -k & 2\,k+p & -(k+p) \\ 0 & -(k+p) & k+p\end{array}\right]$')

It currently fails with

Exception in Tkinter callback
Traceback (most recent call last):
   File "/data/home/nwagner/local/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
     return self.func(*args)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 202, in resize
     self.show()
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 205, in draw
     FigureCanvasAgg.draw(self)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", line 261, in draw
     self.figure.draw(self.renderer)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/figure.py", line 759, in draw
     for a in self.axes: a.draw(renderer)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/axes.py", line 1514, in draw
     a.draw(renderer)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/text.py", line 297, in draw
     bbox, info = self._get_layout(renderer)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/text.py", line 197, in _get_layout
     line, self._fontproperties, ismath=self.is_math_text(line))
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", line 135, in get_text_width_height_descent
     self.mathtext_parser.parse(s, self.dpi, prop)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/mathtext.py", line 2735, in parse
     box = self._parser.parse(s, font_output, fontsize, dpi)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/mathtext.py", line 2208, in parse
     self._expression.parseString(s)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 1048, in parseString
     loc, tokens = self._parse( instring, 0 )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2559, in parseImpl
     return self.expr._parse( instring, loc, doActions, callPreParse=False )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2307, in parseImpl
     loc, exprtokens = e._parse( instring, loc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2672, in parseImpl
     loc, tokens = self.expr._parse( instring, loc, doActions, callPreParse=False )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2307, in parseImpl
     loc, exprtokens = e._parse( instring, loc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2416, in parseImpl
     ret = e._parse( instring, loc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 950, in _parseNoCache
     tokens = fn( instring, tokensStart, retTokens )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/mathtext.py", line 1963, in raise_error
     raise ParseFatalException(msg + "\n" + s)
ParseFatalException: Expected end of math '$'

Arrays are not supported with the built-in math engine. You'll need to set math.usetex to True.

Cheers,
Mike

Nils Wagner wrote:

···

Hi all,

Is there a way to use

title(r' M= I\_3 K=\\left\[\\begin\{array\}\{rrr\} 2\\,k & \-k & 0 \\\\ \-k & 2\\,k\+p & \-\(k\+p\) \\\\ 0 & \-\(k\+p\) & k\+p\\end\{array\}\\right\]')

It currently fails with

Exception in Tkinter callback
Traceback (most recent call last):
   File "/data/home/nwagner/local/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
     return self.func(*args)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 202, in resize
     self.show()
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 205, in draw
     FigureCanvasAgg.draw(self)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", line 261, in draw
     self.figure.draw(self.renderer)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/figure.py", line 759, in draw
     for a in self.axes: a.draw(renderer)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/axes.py", line 1514, in draw
     a.draw(renderer)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/text.py", line 297, in draw
     bbox, info = self._get_layout(renderer)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/text.py", line 197, in _get_layout
     line, self._fontproperties, ismath=self.is_math_text(line))
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", line 135, in get_text_width_height_descent
     self.mathtext_parser.parse(s, self.dpi, prop)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/mathtext.py", line 2735, in parse
     box = self._parser.parse(s, font_output, fontsize, dpi)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/mathtext.py", line 2208, in parse
     self._expression.parseString(s)
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 1048, in parseString
     loc, tokens = self._parse( instring, 0 )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2559, in parseImpl
     return self.expr._parse( instring, loc, doActions, callPreParse=False )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2307, in parseImpl
     loc, exprtokens = e._parse( instring, loc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2672, in parseImpl
     loc, tokens = self.expr._parse( instring, loc, doActions, callPreParse=False )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2307, in parseImpl
     loc, exprtokens = e._parse( instring, loc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 924, in _parseNoCache
     loc,tokens = self.parseImpl( instring, preloc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 2416, in parseImpl
     ret = e._parse( instring, loc, doActions )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 981, in _parseCache
     value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/pyparsing.py", line 950, in _parseNoCache
     tokens = fn( instring, tokensStart, retTokens )
   File "/data/home/nwagner/local/lib/python2.5/site-packages/matplotlib/mathtext.py", line 1963, in raise_error
     raise ParseFatalException(msg + "\n" + s)
ParseFatalException: Expected end of math '$'

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA