# Unrecognised TeX code (2)

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 close merge delete

1

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?

( 2011-09-17 06:43:36 -0500 )edit

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

( 2011-09-17 08:47:13 -0500 )edit

Sort by » oldest newest most voted

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.

more