Bug in mathtext

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

matplotlib-title IPython_crash_report.txt (35.1 KB)

J�rgen Stenarson wrote:

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.

That is on purpose. If you give mathtext something that is a syntax error, it throws an exception, showing where the syntax error occurred. The only time mathtext gives warnings (as opposed to errors) is when a the expression is syntactically correct but the symbols can not be found in the currently configured font. This is to make sure that plots are portable between matplotlib installations ... but the intention is not to fail silently on invalid expressions.

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.

That was an oversight -- and is a good idea. This has been added in r4586.

Thanks for finding this,
Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Hey Jorgen,

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}|$")

that's odd, it's OK for mpl to throw the exception, what shouldn't be
happening is for ipython to fully crash out. I can't reproduce it
with SVN mpl on my box, I tried both tkagg and gtkagg as backends and
in both cases I see the exception traceback (as Michael intended by
raising the error) but I simply get back the next ipython prompt, as
usual. I don't understand how this particular exception could crash
out ipython, since it's being raised inside regular user code...

Really, really strange...

f

···

On Dec 4, 2007 12:10 PM, Jörgen Stenarson <jorgen.stenarson@...1799...> wrote:

Fernando Perez wrote:

Hey Jorgen,

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}|$")

that's odd, it's OK for mpl to throw the exception, what shouldn't be
happening is for ipython to fully crash out. I can't reproduce it
with SVN mpl on my box, I tried both tkagg and gtkagg as backends and
in both cases I see the exception traceback (as Michael intended by
raising the error) but I simply get back the next ipython prompt, as
usual. I don't understand how this particular exception could crash
out ipython, since it's being raised inside regular user code...

You're right -- I misread the original report. It doesn't crash ipython for me either. I just get another ipython prompt.

Cheers,
Mike

···

On Dec 4, 2007 12:10 PM, J�rgen Stenarson <jorgen.stenarson@...1799...> wrote:

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Michael Droettboom skrev:

Fernando Perez wrote:

Hey Jorgen,

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}|$")

that's odd, it's OK for mpl to throw the exception, what shouldn't be
happening is for ipython to fully crash out. I can't reproduce it
with SVN mpl on my box, I tried both tkagg and gtkagg as backends and
in both cases I see the exception traceback (as Michael intended by
raising the error) but I simply get back the next ipython prompt, as
usual. I don't understand how this particular exception could crash
out ipython, since it's being raised inside regular user code...

You're right -- I misread the original report. It doesn't crash ipython for me either. I just get another ipython prompt.

Cheers,
Mike

Thanks Mike. I hope we can figure out what is causing the crashes but I guess we can take this over on the ipython-list. Fernando have you tried it on a windows machine? I'm using tkagg. Do you have any ideas on what I could start testing to isolate the problem?

/J�rgen

···

On Dec 4, 2007 12:10 PM, J�rgen Stenarson <jorgen.stenarson@...1799...> wrote: