Ask Your Question

Unrecognised TeX code (2)

asked 2011-09-17 12:56:02 +0200

Dirk Danckaert gravatar image

Why is the following latex code correctly recognised by the view()-function (for outputting results) but not by the text()-function (for inclusion in a plot)?

Dy='$\\begin{align}\\Delta y&=y_2-y_1 \\\\ &=m\\cdot\\Delta x \\end{align}$'

view(Dy) gives a correctly formatted latex formula but text(Dy,...) returns an error message.

edit retag flag offensive close merge delete



As far as I know, the `text` command passes its arguments to matplotlib, so matplotlib handles any LaTeX code. Perhaps it doesn't understand the `align` environment?

John Palmieri gravatar imageJohn Palmieri ( 2011-09-17 13:43:36 +0200 )edit

That could well be the case. Would explain too why ':' (in latex code) is rendered as '.' in text(), but not in view().

Dirk Danckaert gravatar imageDirk Danckaert ( 2011-09-17 15:47:13 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-09-20 11:37:19 +0200

Jason Grout gravatar image

John is right, I believe. Here is the documentation for mathtext (i.e., matplotlib's tex renderer). You could conceivably do the usetex option in matplotlib to have matplotlib pass the expression directly to Tex, which may make the align command work.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-09-17 12:56:02 +0200

Seen: 295 times

Last updated: Sep 20 '11