Hi,

I get a complete crash dumping me in the console when there are unknown latex commands in a mathtext expression, this when doing interactive stuff in ipython -pylab.

examples:
title("$|S_{11}|$")
title("$\vbar S_{11} \vbar$")

I would also like to see an alias between | and \vert like there is in regular latex.

I have attached a crash report from ipython for the first case

I'm using 0.91.1, python 2.4, on win xp

/Jörgen



***************************************************************************

IPython post-mortem report

IPython version: 0.8.3.svn.r2876 

SVN revision   : 2876M 

Platform info  : os.name -> nt, sys.platform -> win32

***************************************************************************

Current user configuration structure:

{'Version': 0,
 '__allownew': False,
 'alias': [],
 'args': [],
 'autocall': 1,
 'autoedit_syntax': 0,
 'autoindent': 1,
 'automagic': 1,
 'banner': 0,
 'c': '',
 'cache_size': 1000,
 'classic': 0,
 'color_info': 1,
 'colors': 'Linux',
 'confirm_exit': 1,
 'debug': 0,
 'deep_reload': 0,
 'editor': 'C:\\Program\\TextPad 4\\TextPad.exe',
 'embedded': False,
 'execfile': [],
 'execute': [],
 'gthread': 0,
 'help': 0,
 'import_all': [],
 'import_mod': [],
 'import_some': [[]],
 'include': [],
 'interact': 1,
 'ipythondir': 'c:\\documents and settings\\jorgenst\\_ipython',
 'log': 0,
 'logfile': '',
 'logplay': '',
 'magic_docstrings': 0,
 'messages': 1,
 'multi_line_specials': 1,
 'nosep': 0,
 'object_info_string_level': 0,
 'opts': Struct({'pylab': 1, '__allownew': True}),
 'pdb': 0,
 'pprint': 1,
 'profile': '',
 'prompt_in1': 'In [\\#]: ',
 'prompt_in2': '   .\\D.: ',
 'prompt_out': 'Out[\\#]: ',
 'prompts_pad_left': 1,
 'pylab': 1,
 'pylab_import_all': 1,
 'q4thread': 0,
 'qthread': 0,
 'quick': 0,
 'quiet': 0,
 'rcfile': 'ipythonrc.ini',
 'readline': 1,
 'readline_merge_completions': 1,
 'readline_omit__names': 0,
 'readline_parse_and_bind': [],
 'readline_remove_delims': '-/~',
 'screen_length': -2,
 'separate_in': '\n',
 'separate_out': '\n',
 'separate_out2': '',
 'system_header': 'IPython system call: ',
 'system_verbose': 0,
 'term_title': 1,
 'tk': 0,
 'upgrade': 0,
 'wildcards_case_sensitive': 1,
 'wthread': 0,
 'wxversion': '0',
 'xmode': 'Context'}

***************************************************************************

Crash traceback:

---------------------------------------------------------------------------
ValueError                             Python 2.4.3: C:\Python24\python.exe
                                                   Tue Dec 04 19:57:25 2007
A problem occured executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.

c:\python24\scripts\ipython.py 
     12 IPython.Shell.IPShell().mainloop(sys_exit=1)
     13 
     14 [or simply IPython.Shell.IPShell().mainloop(1) ]
     15 
     16 and IPython will be your working environment when you start python. The 
final
     17 sys.exit() call will make python exit transparently when IPython 
finishes, so
     18 you don't have an extra prompt to get out of.
     19 
     20 This is probably useful to developers who manage multiple Python 
versions and
     21 don't want to have correspondingly multiple IPython versions. Note that 
in
     22 this mode, there is no way to pass IPython any command-line options, as 
those
     23 are trapped first by Python itself.
     24 """
     25 
     26 import IPython
---> 27 IPython.Shell.start().mainloop()
        IPython.Shell.start.mainloop = undefined
     28 
     29 
     30 
     31 
     32 
     33 
     34 
     35 
     36 
     37 
     38 
     39 
     40 
     41 
     42 

c:\python\external\ipython\IPython\Shell.pyc in 
mainloop(self=<IPython.Shell.IPShellMatplotlib instance>, sys_exit=0, 
banner=None)
     62 
#-----------------------------------------------------------------------------
     63 # This class is trivial now, but I want to have it in to publish a clean
     64 # interface. Later when the internals are reorganized, code that uses 
this
     65 # shouldn't have to change.
     66 
     67 class IPShell:
     68     """Create an IPython instance."""
     69     
     70     def __init__(self,argv=None,user_ns=None,user_global_ns=None,
     71                  debug=1,shell_class=InteractiveShell):
     72         self.IP = make_IPython(argv,user_ns=user_ns,
     73                                user_global_ns=user_global_ns,
     74                                debug=debug,shell_class=shell_class)
     75 
     76     def mainloop(self,sys_exit=0,banner=None):
---> 77         self.IP.mainloop(banner)
        global For = undefined
        global more = undefined
        global details = undefined
        global see = undefined
        global the = undefined
        global __call__ = undefined
        global method = undefined
        global below. = undefined
     78         if sys_exit:
     79             sys.exit()
     80 
     81 
#-----------------------------------------------------------------------------
     82 def kill_embedded(self,parameter_s=''):
     83     """%kill_embedded : deactivate for good the current embedded 
IPython.
     84 
     85     This function (after asking for confirmation) sets an internal flag 
so that
     86     an embedded IPython will never activate again.  This is useful to
     87     permanently disable a shell that is being called inside a loop: 
once you've
     88     figured out what you needed from it, you may then kill it and the 
program
     89     will then continue to run without the interactive shell interfering 
again.
     90     """
     91     
     92     kill = ask_yes_no("Are you sure you want to kill this embedded 
instance "

c:\python\external\ipython\IPython\iplib.pyc in 
mainloop(self=<IPython.Shell.MatplotlibShell object>, banner='')
   1535 
   1536         If an optional banner argument is given, it will override the
   1537         internally created default banner."""
   1538 
   1539         if self.rc.c:  # Emulate Python's -c option
   1540             self.exec_init_cmd()
   1541         if banner is None:
   1542             if not self.rc.banner:
   1543                 banner = ''
   1544             # banner is string? Use it directly!
   1545             elif isinstance(self.rc.banner,basestring):
   1546                 banner = self.rc.banner
   1547             else:                
   1548                 banner = self.BANNER+self.banner2
   1549 
-> 1550         self.interact(banner)
   1551 
   1552     def exec_init_cmd(self):
   1553         """Execute a command given at the command line.
   1554 
   1555         This emulates Python's -c option."""
   1556 
   1557         #sys.argv = ['-c']
   1558         self.push(self.prefilter(self.rc.c, False))
   1559         if not self.rc.interact:
   1560             self.exit_now = True
   1561 
   1562     def 
embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
   1563         """Embeds IPython into a running python program.
   1564 
   1565         Input:

c:\python\external\ipython\IPython\iplib.pyc in 
interact(self=<IPython.Shell.MatplotlibShell object>, banner='')
   1656         
   1657         # Mark activity in the builtins
   1658         __builtin__.__dict__['__IPYTHON__active'] += 1
   1659         
   1660         if self.has_readline:
   1661             self.readline_startup_hook(self.pre_readline)
   1662         # exit_now is set by a call to %Exit or %Quit
   1663         
   1664         while not self.exit_now:
   1665             if more:
   1666                 prompt = self.hooks.generate_prompt(True)
   1667                 if self.autoindent:
   1668                     self.rl_do_indent = True
   1669                     
   1670             else:
-> 1671                 prompt = self.hooks.generate_prompt(False)
   1672             try:
   1673                 line = self.raw_input(prompt,more)
   1674                 if self.exit_now:
   1675                     # quick exit on sys.std[in|out] close
   1676                     break
   1677                 if self.autoindent:
   1678                     self.rl_do_indent = False
   1679                     
   1680             except KeyboardInterrupt:
   1681                 self.write('\nKeyboardInterrupt\n')
   1682                 self.resetbuffer()
   1683                 # keep cache in sync with the prompt counter:
   1684                 self.outputcache.prompt_count -= 1
   1685 
   1686                 if self.autoindent:

c:\python\external\ipython\IPython\hooks.pyc in 
__call__(self=<IPython.hooks.CommandChainDispatcher instance>, *args=(False,), 
**kw={})
    119             self.chain = []
    120         else:
    121             self.chain = commands
    122             
    123             
    124     def __call__(self,*args, **kw):
    125         """ Command chain is called just like normal func. 
    126         
    127         This will call all funcs in chain with the same args as were 
given to this
    128         function, and return the result of first func that didn't raise
    129         TryNext """
    130         
    131         for prio,cmd in self.chain:
    132             #print "prio",prio,"cmd",cmd #dbg
    133             try:
--> 134                 ret = cmd(*args, **kw)
        global RI = undefined
        global R = undefined
        global s = undefined
        global t = undefined
        global IPythont = undefined
        global ReleaseR = undefined
        global authorst = undefined
        global __author__t = undefined
        global licenset = undefined
        global __license__t = undefined
        global versiont = undefined
        global __version__R = undefined
        global R6 = undefined
        global genutilsRD = undefined
        global PrettyPrintert = undefined
        global __all__RA = undefined
        global RZ = undefined
        global RW = undefined
        global RD = undefined
        global RU = undefined
        global RS = undefined
        global RQ = undefined
        global RY = undefined
        global RA = undefined
    135                 return ret
    136             except ipapi.TryNext, exc:
    137                 if exc.args or exc.kwargs:
    138                     args = exc.args
    139                     kw = exc.kwargs
    140                 
    141     def __str__(self):
    142         return str(self.chain)
    143     
    144     def add(self, func, priority=0):
    145         """ Add a func to the cmd chain with given priority """
    146         bisect.insort(self.chain,(priority,func))
    147 
    148     def __iter__(self):
    149         """ Return all objects in chain.

c:\documents and settings\jorgenst\_ipython\ipy_user_conf.pyc in 
pylab_generate_prompt(self=<IPython.Shell.MatplotlibShell object>, 
is_continuation=False)
     51     pos=jsutil.jsplot.get_figure_positions()
     52     out="import 
jsutil.jsplot;jsutil.jsplot.set_figure_positions(%r)"%pos
     53     if to_clipboard:
     54         import pyreadline.clipboard
     55         pyreadline.clipboard.set_clipboard_text(out)
     56     return out
     57 
     58 def generate_prompt(self, is_continuation):
     59     gc.collect()
     60     return hooks.generate_prompt(self, is_continuation)
     61 
     62 def pylab_generate_prompt(self, is_continuation):
     63     import pylab,matplotlib
     64     gc.collect()  #Do garbage collection (reclaim used memory)
     65     if matplotlib.is_interactive():
---> 66         pylab.show()  #Do automatic show when in pylab mode
        global R = undefined
        global s = undefined
        global d = undefined
        global i = undefined
        global sN = undefined
        global t = undefined
        global columnR = undefined
        global c = undefined
        global C = undefined
        global _ = undefined
        global k = undefined
     67     return hooks.generate_prompt(self, is_continuation)
     68 
     69 def textpad_hook(self,filename, linenum=None):
     70     """Open the default editor at the given filename and linenumber.
     71 
     72     This is IPython's default editor hook, you can use it as an example 
to
     73     write your own modified one.  To set your own editor function as the
     74     new editor hook, call ip.set_hook('editor',yourfunc)."""
     75 
     76     # IPython configures a default editor at startup by reading $EDITOR 
from
     77     # the environment, and falling back on vi (unix) or notepad (win32).
     78     editor = self.rc.editor
     79     
     80     # marker for at which line to open the file (for existing objects)
     81     if linenum is None or editor=='notepad':

C:\Python24\lib\site-packages\matplotlib\backends\backend_tkagg.pyc in show()
     55     if matplotlib.is_interactive():
     56         figManager =  Gcf.get_active()
     57         if figManager is not None:
     58             figManager.show()
     59 
     60 
     61 def show():
     62     """
     63     Show all the figures and enter the gtk mainloop
     64 
     65     This should be the last line of your script.  This function sets
     66     interactive mode to True, as detailed on
     67     http://matplotlib.sf.net/interactive.html
     68     """
     69     for manager in Gcf.get_all_fig_managers():
---> 70         manager.show()
        global c = undefined
        global C = undefined
        global s = undefined
        global i = undefined
        global t = undefined
        global d = undefined
     71     import matplotlib
     72     matplotlib.interactive(True)
     73     if rcParams['tk.pythoninspect']:
     74         os.environ['PYTHONINSPECT'] = '1'
     75     if show._needmain:
     76         Tk.mainloop()
     77         show._needmain = False
     78 show._needmain = True
     79 
     80 def new_figure_manager(num, *args, **kwargs):
     81     """
     82     Create a new figure manager instance
     83     """
     84     _focus = windowing.FocusManager()
     85     FigureClass = kwargs.pop('FigureClass', Figure)

C:\Python24\lib\site-packages\matplotlib\backends\backend_tkagg.pyc in 
show(self=<matplotlib.backends.backend_tkagg.FigureManagerTkAgg instance>)
    322         this function doesn't segfault but causes the
    323         PyEval_RestoreThread: NULL state bug on win32
    324         """
    325 
    326         def destroy(*args):
    327             self.window = None
    328             Gcf.destroy(self._num)
    329 
    330         if not self._shown: self.canvas._tkcanvas.bind("<Destroy>", 
destroy)
    331         _focus = windowing.FocusManager()
    332         if not self._shown:
    333             self.window.deiconify()
    334             # anim.py requires this
    335             if sys.platform=='win32' : self.window.update()
    336         else:
--> 337             self.canvas.draw()
    338         self._shown = True
    339 
    340 
    341     def destroy(self, *args):
    342         if Gcf.get_num_fig_managers()==0 and not 
matplotlib.is_interactive():
    343             if self.window is not None:
    344                 self.window.quit()
    345         if self.window is not None:
    346             #self.toolbar.destroy()
    347             self.window.destroy()
    348 
    349             pass
    350         self.window = None
    351 
    352     def set_window_title(self, title):

C:\Python24\lib\site-packages\matplotlib\backends\backend_tkagg.pyc in 
draw(self=<matplotlib.backends.backend_tkagg.FigureCanvasTkAgg instance>)
    176 
    177         # compute desired figure size in inches
    178         dpival = self.figure.dpi.get()
    179         winch = width/dpival
    180         hinch = height/dpival
    181         self.figure.set_size_inches(winch, hinch)
    182 
    183 
    184         self._tkcanvas.delete(self._tkphoto)
    185         self._tkphoto = Tk.PhotoImage(
    186             master=self._tkcanvas, width=width, height=height)
    187         
self._tkcanvas.create_image(width/2,height/2,image=self._tkphoto)
    188         self.show()
    189 
    190     def draw(self):
--> 191         FigureCanvasAgg.draw(self)
        global d = undefined
        global _ = undefined
        global n = undefined
        global i = undefined
        global S = undefined
        global Nt = undefined
        global omenuR = undefined
        global R = undefined
        global Rk = undefined
        global R5 = undefined
        global R2 = undefined
        global t = undefined
        global axesR = undefined
        global hasattrR = undefined
        global s = undefined
        global Rj = undefined
        global c = undefined
        global B = undefined
        global Z = undefined
        global RS = undefined
        global so = undefined
        global Public = undefined
        global attriubutes = undefined
        global canvas = undefined
        global the = undefined
        global FigureCanvas = undefined
        global gtk.DrawingArea = undefined
        global win = undefined
        global gtk.Window = undefined
        global C = undefined
        global N = undefined
        global R3 = undefined
        global Rl = undefined
        global NavigationToolbar2Rj = undefined
        global G = undefined
        global messageR = undefined
        global R1 = undefined
        global R0 = undefined
        global set_messageD = undefined
        global y = undefined
        global Wn = undefined
        global j = undefined
        global o = undefined
        global X = undefined
        global Rm = undefined
        global Rf = undefined
        global y0t = undefined
        global y1t = undefined
        global lastrectR = undefined
        global Rt = undefined
        global RR = undefined
        global create_rectanglet = undefined
        global x0t = undefined
        global x1 = undefined
        global R6 = undefined
        global R7 = undefined
        global draw_rubberbandG = undefined
        global sA = undefined
        global R4 = undefined
        global releaseR = undefined
        global cursor = undefined
        global cursordR = undefined
        global set_cursorY = undefined
        global NR = undefined
        global Rh = undefined
        global Ni2 = undefined
        global Re = undefined
        global Rg = undefined
        global HomeR = undefined
        global home.ppmR = undefined
        global Backs = undefined
        global back.ppmt = undefined
        global Forwards = undefined
        global forward.ppmt = undefined
        global Pans = undefined
        global move.ppmt = undefined
        global Zooms = undefined
        global zoom_to_rect.ppms = undefined
        global Configure = undefined
        global Subplotss = undefined
        global subplots.ppmR = undefined
        global filesave.ppmt = undefined
        global textvariableR = undefined
        global Rn = undefined
        global bHomet = undefined
        global backt = undefined
        global bBackt = undefined
        global forwardt = undefined
        global bForwardt = undefined
        global pant = undefined
        global bPant = undefined
        global zoomt = undefined
        global bZoomt = undefined
        global configure_subplotst = undefined
        global bsubplotR = undefined
        global bsavet = undefined
        global StringVarR = undefined
        global Labelt = undefined
        global _message_labelR = undefined
        global RIGHTR = undefined
        global _init_toolbare = undefined
        global s2 = undefined
        global figsizei = undefined
        global topf = undefined
        global toolfigR = undefined
        global subplots_adjustt = undefined
        global SubplotToolRk = undefined
        global toolR = undefined
        global RV = undefined
        global RY = undefined
        global RL = undefined
        global k = undefined
        global l = undefined
        global f = undefined
        global g = undefined
        global D = undefined
        global q = undefined
        global p = undefined
        global Sn = undefined
        global Xd = undefined
        global asksaveasfilename = undefined
        global showerrori = undefined
        global s.sR = undefined
        global Save = undefined
        global figuret = undefined
        global filetypest = undefined
        global defaultextensiont = undefined
        global Error = undefined
        global saving = undefined
        global file = undefined
        global tkFileDialogt = undefined
        global asksaveasfilenameR = undefined
        global get_supported_filetypest = undefined
        global copyRZ = undefined
        global get_default_filetypet = undefined
        global default_filetypet = undefined
        global default_filetype_namet = undefined
        global itemst = undefined
        global sorted_filetypest = undefined
        global sortRQ = undefined
        global extR = undefined
        global tk_filetypesR3 = undefined
        global Exceptiont = undefined
        global eR = undefined
        global Rc = undefined
        global Rb = undefined
        global RZ = undefined
        global R.R = undefined
        global update = undefined
        global drawing = undefined
        global area = undefined
        global only = undefined
        global idleN = undefined
        global dynamic_update = undefined
        global R8 = undefined
        global R9 = undefined
        global __future__t = undefined
        global divisionR = undefined
        global enumeratet = undefined
        global matplotlib.backend_basest = undefined
        global RendererBaset = undefined
        global GraphicsContextBaseR = undefined
        global R.t = undefined
        global cursorst = undefined
        global matplotlib.figureR0 = undefined
        global matplotlib._pylab_helpersR = undefined
        global matplotlib.windowingR = undefined
        global matplotlib.widgetsRX = undefined
        global verboset = undefined
        global TkVersiont = undefined
        global backend_versiont = undefined
        global PIXELS_PER_INCHt = undefined
        global MOVEt = undefined
        global HANDt = undefined
        global POINTERt = undefined
        global SELECT_REGIONR = undefined
        global FigureManager = <class 
matplotlib.backends.backend_tkagg.FigureManagerTkAgg at 0x01D9DCF0>
        global Ri = undefined
        global Rv = undefined
        global Rr = undefined
        global Ru = undefined
        global RX = undefined
        global Q = undefined
    192         tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
    193         self._master.update_idletasks()
    194 
    195     def blit(self, bbox=None):
    196         tkagg.blit(self._tkphoto, self.renderer._renderer, bbox=bbox, 
colormode=2)
    197         self._master.update_idletasks()
    198 
    199     show = draw
    200 
    201     def draw_idle(self):
    202         'update drawing area only if idle'
    203         d = self._idle
    204         self._idle = False
    205         def idle_draw(*args):
    206             self.draw()

C:\Python24\lib\site-packages\matplotlib\backends\backend_agg.pyc in 
draw(self=<matplotlib.backends.backend_tkagg.FigureCanvasTkAgg instance>)
    365     def copy_from_bbox(self, bbox):
    366         renderer = self.get_renderer()
    367         return renderer.copy_from_bbox(bbox)
    368 
    369     def restore_region(self, region):
    370         renderer = self.get_renderer()
    371         return renderer.restore_region(region)
    372 
    373     def draw(self):
    374         """
    375         Draw the figure using the renderer
    376         """
    377         if __debug__: verbose.report('FigureCanvasAgg.draw', 
'debug-annoying')
    378 
    379         self.renderer = self.get_renderer()
--> 380         self.figure.draw(self.renderer)
    381 
    382     def get_renderer(self):
    383         l,b,w,h = self.figure.bbox.get_bounds()
    384         key = w, h, self.figure.dpi.get()
    385         try: self._lastKey, self.renderer
    386         except AttributeError: need_new_renderer = True
    387         else:  need_new_renderer = (self._lastKey != key)
    388 
    389         if need_new_renderer:
    390             self.renderer = RendererAgg(w, h, self.figure.dpi)
    391             self._lastKey = key
    392         return self.renderer
    393 
    394     def tostring_rgb(self):
    395         if __debug__: verbose.report('FigureCanvasAgg.tostring_rgb',

C:\Python24\lib\site-packages\matplotlib\figure.pyc in 
draw(self=<matplotlib.figure.Figure instance>, 
renderer=<matplotlib.backends.backend_agg.RendererAgg instance>)
    597             # make a composite image blending alpha
    598             # list of (_image.Image, ox, oy)
    599 
    600             mag = renderer.get_image_magnification()
    601             ims = [(im.make_image(mag), im.ox*mag, im.oy*mag)
    602                    for im in self.images]
    603             im = _image.from_images(self.bbox.height()*mag,
    604                                     self.bbox.width()*mag,
    605                                     ims)
    606             im.is_grayscale = False
    607             l, b, w, h = self.bbox.get_bounds()
    608             renderer.draw_image(l, b, im, self.bbox)
    609 
    610 
    611         # render the axes
--> 612         for a in self.axes: a.draw(renderer)
    613 
    614         # render the figure text
    615         for t in self.texts: t.draw(renderer)
    616 
    617         for legend in self.legends:
    618             legend.draw(renderer)
    619 
    620         self.transFigure.thaw()  # release the lazy objects
    621         renderer.close_group('figure')
    622 
    623         self._cachedRenderer = renderer
    624 
    625         self.canvas.draw_event(renderer)
    626 
    627     def draw_artist(self, a):

C:\Python24\lib\site-packages\matplotlib\axes.pyc in 
draw(self=<matplotlib.axes.Subplot instance>, 
renderer=<matplotlib.backends.backend_agg.RendererAgg instance>, inframe=False)
   1329                 self.yaxis.set_zorder(2.5)
   1330             artists.extend([self.xaxis, self.yaxis])
   1331         if not inframe: artists.append(self.title)
   1332         artists.extend(self.tables)
   1333         if self.legend_ is not None:
   1334             artists.append(self.legend_)
   1335         if self.axison and self._frameon:
   1336             artists.append(self.axesFrame)
   1337 
   1338         # keep track of i to guarantee stable sort for python 2.2
   1339         dsu = [ (a.zorder, i, a) for i, a in enumerate(artists)
   1340                 if not a.get_animated()]
   1341         dsu.sort()
   1342 
   1343         for zorder, i, a in dsu:
-> 1344             a.draw(renderer)
        global If = undefined
        global you = undefined
        global make = undefined
        global multiple = undefined
        global lines = undefined
        global with = undefined
        global one = undefined
        global plot = undefined
        global command = undefined
        global the = undefined
        global kwargs = undefined
        global apply = undefined
   1345 
   1346         self.transData.thaw()  # release the lazy objects
   1347         self.transAxes.thaw()  # release the lazy objects
   1348         renderer.close_group('axes')
   1349         self._cachedRenderer = renderer
   1350 
   1351     def draw_artist(self, a):
   1352         """
   1353         This method can only be used after an initial draw which
   1354         caches the renderer.  It is used to efficiently update Axes
   1355         data (axis ticks, labels, etc are not updated)
   1356         """
   1357         assert self._cachedRenderer is not None
   1358         a.draw(self._cachedRenderer)
   1359 

C:\Python24\lib\site-packages\matplotlib\text.pyc in 
draw(self=<matplotlib.text.Text instance>, 
renderer=<matplotlib.backends.backend_agg.RendererAgg instance>)
    302         if not self.get_visible(): return
    303         if self._text=='': return
    304 
    305         gc = renderer.new_gc()
    306         gc.set_foreground(self._color)
    307         gc.set_alpha(self._alpha)
    308         if self.get_clip_on():
    309             gc.set_clip_rectangle(self.clipbox.get_bounds())
    310 
    311 
    312 
    313         if self._bbox:
    314             bbox_artist(self, renderer, self._bbox)
    315         angle = self.get_rotation()
    316 
--> 317         bbox, info = self._get_layout(renderer)
        global after = undefined
        global the = undefined
        global text = undefined
        global before. = undefined
    318         trans = self.get_transform()
    319         if rcParams['text.usetex']:
    320             canvasw, canvash = renderer.get_canvas_width_height()
    321             for line, wh, x, y in info:
    322                 x, y = trans.xy_tup((x, y))
    323                 if renderer.flipy():
    324                     y = canvash-y
    325 
    326                 renderer.draw_tex(gc, x, y, line,
    327                                   self._fontproperties, angle)
    328             return
    329 
    330         for line, wh, x, y in info:
    331             x, y = trans.xy_tup((x, y))
    332 

C:\Python24\lib\site-packages\matplotlib\text.pyc in 
_get_layout(self=<matplotlib.text.Text instance>, 
renderer=<matplotlib.backends.backend_agg.RendererAgg instance>)
    185         width = 0
    186         height = 0
    187 
    188         xmin, ymin = thisx, thisy
    189         lines = self._text.split('\n')
    190             
    191         whs = []
    192         # Find full vertical extent of font,
    193         # including ascenders and descenders:
    194         tmp, heightt, bl = renderer.get_text_width_height_descent(
    195                 'lp', self._fontproperties, ismath=False)
    196         offsety = heightt * self._linespacing
    197 
    198         baseline = None
    199         for line in lines:
--> 200             w, h, d = renderer.get_text_width_height_descent(
        global Set = undefined
        global the = undefined
        global background = undefined
        global color = undefined
        global of = undefined
        global text = undefined
        global by = undefined
        global updating = undefined
        bbox = undefined
        global see = undefined
        global set_bbox = undefined
        global more = undefined
        global info = undefined
    201                 line, self._fontproperties, 
ismath=self.is_math_text(line))
    202             if baseline is None:
    203                 baseline = h - d
    204             whs.append( (w,h) )
    205             horizLayout.append((line, thisx, thisy, w, h))
    206             thisy -= offsety
    207             width = max(width, w)
    208 
    209         ymin = horizLayout[-1][2]
    210         ymax = horizLayout[0][2] + horizLayout[0][-1]
    211         height = ymax-ymin
    212 
    213         xmax = xmin + width
    214         # get the rotation matrix
    215         M = self.get_rotation_matrix(xmin, ymin)

C:\Python24\lib\site-packages\matplotlib\backends\backend_agg.pyc in 
get_text_width_height_descent(self=<matplotlib.backends.backend_agg.RendererAgg 
instance>, s='$|S_{11}|$', prop=<matplotlib.font_manager.FontProperties 
object>, ismath=True, rgb=(0, 0, 0))
    216 
    217         # passing rgb is a little hack to make cacheing in the
    218         # texmanager more efficient.  It is not meant to be used
    219         # outside the backend
    220         """
    221         if ismath=='TeX':
    222             # todo: handle props
    223             size = prop.get_size_in_points()
    224             texmanager = self.get_texmanager()
    225             Z = texmanager.get_rgba(s, size, self.dpi.get(), rgb)
    226             m,n,tmp = Z.shape
    227             # TODO: descent of TeX text (I am imitating backend_ps here 
-JKS)
    228             return n, m, 0
    229 
    230         if ismath:
--> 231             ox, oy, width, height, descent, fonts, used_characters = \
    232                 self.mathtext_parser.parse(s, self.dpi.get(), prop)
    233             return width, height, descent
    234         font = self._get_agg_font(prop)
    235         font.set_text(s, 0.0, flags=LOAD_FORCE_AUTOHINT)  # the width 
and height of unrotated string
    236         w, h = font.get_width_height()
    237         d = font.get_descent()
    238         w /= 64.0  # convert from subpixels
    239         h /= 64.0
    240         d /= 64.0
    241         return w, h, d
    242 
    243     def draw_tex(self, gc, x, y, s, prop, angle):
    244         # todo, handle props, angle, origins
    245         rgb = gc.get_rgb()
    246         size = prop.get_size_in_points()

C:\Python24\lib\site-packages\matplotlib\mathtext.pyc in 
parse(self=<matplotlib.mathtext.MathTextParser object>, s='$|S_{11}|$', 
dpi=80.0, prop=<matplotlib.font_manager.FontProperties object>)
   2659             fontset_class = self._font_type_mapping.get(fontset)
   2660             if fontset_class is not None:
   2661                 font_output = fontset_class(prop, backend)
   2662             else:
   2663                 raise ValueError(
   2664                     "mathtext.fontset must be either 'cm', 'stix', "
   2665                     "'stixsans', or 'custom'")
   2666 
   2667         fontsize = prop.get_size_in_points()
   2668 
   2669         # This is a class variable so we don't rebuild the parser
   2670         # with each request.
   2671         if self._parser is None:
   2672             self.__class__._parser = Parser()
   2673 
-> 2674         box = self._parser.parse(s, font_output, fontsize, dpi)
   2675         font_output.set_canvas_size(box.width, box.height, box.depth)
   2676         result = font_output.get_results(box)
   2677         self._cache[cacheKey] = result
   2678         # Free up the transient data structures
   2679         self._parser.clear()
   2680 
   2681         # Fix cyclical references
   2682         font_output.destroy()
   2683         font_output.mathtext_backend.fonts_object = None
   2684         font_output.mathtext_backend = None
   2685 
   2686         return result
   2687 
   2688 
   2689 

C:\Python24\lib\site-packages\matplotlib\mathtext.pyc in 
parse(self=<matplotlib.mathtext.Parser object>, s='$|S_{11}|$', 
fonts_object=<matplotlib.mathtext.BakomaFonts object>, fontsize=14.0, dpi=80.0)
   2130 
   2131         self._expression.enablePackrat()
   2132 
   2133         self.clear()
   2134 
   2135     def clear(self):
   2136         self._expr = None
   2137         self._state_stack = None
   2138         self._em_width_cache = {}
   2139 
   2140     def parse(self, s, fonts_object, fontsize, dpi):
   2141         self._state_stack = [self.State(fonts_object, 'default', 'rm', 
fontsize, dpi)]
   2142         try:
   2143             self._expression.parseString(s)
   2144         except ParseException, err:
-> 2145             raise ValueError("\n".join([
   2146                         "",
   2147                         err.line,
   2148                         " " * (err.column - 1) + "^",
   2149                         str(err)]))
   2150         return self._expr
   2151 
   2152     # The state of the parser is maintained in a stack.  Upon
   2153     # entering and leaving a group { } or math/non-math, the stack
   2154     # is pushed and popped accordingly.  The current state always
   2155     # exists in the top element of the stack.
   2156     class State(object):
   2157         def __init__(self, font_output, font, font_class, fontsize, 
dpi):
   2158             self.font_output = font_output
   2159             self._font = font
   2160             self.font_class = font_class

ValueError: 
$|S_{11}|$
^
Expected end of text (at char 0), (line:1, col:1)

***************************************************************************

History of session input:
title("$|S_{11}|$")

*** Last line of input (may not be in above history):
title("$|S_{11}|$")
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to