New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParseFatalException on basic LaTeX expressions #659

Closed
eviatarbach opened this Issue Jan 6, 2012 · 6 comments

Comments

Projects
None yet
3 participants
@eviatarbach

eviatarbach commented Jan 6, 2012

Hello,

matplotlib is returning ParseFatalException on basic LaTeX expressions. For example,

from pylab import *
import numpy as np

t = arange(-180.0, 180.0, 0.1)
s = t / 360.0 * np.pi

plot(t, s, '-', lw=2)

xlabel(r'$\floor{x}$')

show()

ParseFatalException: Expected end of math '$'

@efiring

This comment has been minimized.

Show comment
Hide comment
@efiring

efiring Jan 6, 2012

Member

What version are you using?
Your example fails for me also, but with a different exception, because mathtext doesn't know about "\floor".
I don't know that vanilla LaTeX does either, for that matter. I do find "\lfloor", and "\rfloor" in LaTeX, both of which work with mpl github master.
So it is not at all clear to me that what you are reporting is a bug.

Member

efiring commented Jan 6, 2012

What version are you using?
Your example fails for me also, but with a different exception, because mathtext doesn't know about "\floor".
I don't know that vanilla LaTeX does either, for that matter. I do find "\lfloor", and "\rfloor" in LaTeX, both of which work with mpl github master.
So it is not at all clear to me that what you are reporting is a bug.

@eviatarbach

This comment has been minimized.

Show comment
Hide comment
@eviatarbach

eviatarbach Jan 6, 2012

Ah, sorry, that command doesn't actually exist in LaTeX. However, the same error occurs with \mbox, for example.

I'm using version 1.0.1-3.

eviatarbach commented Jan 6, 2012

Ah, sorry, that command doesn't actually exist in LaTeX. However, the same error occurs with \mbox, for example.

I'm using version 1.0.1-3.

@efiring

This comment has been minimized.

Show comment
Hide comment
@efiring

efiring Jan 6, 2012

Member

Right. I suspect the problem is that mathtext is not intended as a full implementation of LaTeX, but as a way of getting a large fraction of LaTeX formatting without requiring an actual LaTeX installation. @mdboom may want to comment further. If you have LaTeX installed, you can use rcParams['text.usetex']=True to use genuine LaTeX in place of mathtext. Then \mbox will work, presumably along with any other valid base LaTeX.

Member

efiring commented Jan 6, 2012

Right. I suspect the problem is that mathtext is not intended as a full implementation of LaTeX, but as a way of getting a large fraction of LaTeX formatting without requiring an actual LaTeX installation. @mdboom may want to comment further. If you have LaTeX installed, you can use rcParams['text.usetex']=True to use genuine LaTeX in place of mathtext. Then \mbox will work, presumably along with any other valid base LaTeX.

@eviatarbach

This comment has been minimized.

Show comment
Hide comment
@eviatarbach

eviatarbach Jan 6, 2012

Oh, okay. But should't the error message be changed? It's misleading.

eviatarbach commented Jan 6, 2012

Oh, okay. But should't the error message be changed? It's misleading.

@efiring

This comment has been minimized.

Show comment
Hide comment
@efiring

efiring Jan 6, 2012

Member

Exactly--and evidently it was changed some time between 1.0.1 and the present git master. Running the latter, I get

ValueError: 
\floor{x}
^
Unknown symbol: \floor (at char 0), (line:1, col:1)
Member

efiring commented Jan 6, 2012

Exactly--and evidently it was changed some time between 1.0.1 and the present git master. Running the latter, I get

ValueError: 
\floor{x}
^
Unknown symbol: \floor (at char 0), (line:1, col:1)

@efiring efiring closed this Jan 6, 2012

@mdboom

This comment has been minimized.

Show comment
Hide comment
@mdboom

mdboom Jan 6, 2012

Member

The error messages were improved in 7f1d181. As you can see from that, it required a pretty major overhaul of how the parser works. This is not in 1.1.x, but will make it into the next major release.

Member

mdboom commented Jan 6, 2012

The error messages were improved in 7f1d181. As you can see from that, it required a pretty major overhaul of how the parser works. This is not in 1.1.x, but will make it into the next major release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment