Skip to content
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

Clean bmatrix/Bmatrix/etc from latex output when generating output for matplotlib rendering #3006

Closed
flacjacket opened this issue Mar 7, 2014 · 6 comments
Labels
Easy to Fix This is a good issue for new contributors. Feel free to work on this if no one else has already. IPython printing

Comments

@flacjacket
Copy link
Member

Since there is a problem with the matplotlib rendering of latex matrices that include braces (such as bmatrix), in interactive/printing.py, the latex generation for matplotlib should include a workaround for this. This can be seen by running, from either a qtconsole or notebook:

In [1]: init_printing(use_latex='matplotlib')

In [2]: [x,y]
/home/sean/ipython/IPython/core/formatters.py:239: FormatterWarning: Exception in image/png formatter: 
\begin{bmatrix}x, & y\end{bmatrix}
^
Unknown symbol: \begin (at char 0), (line:1, col:1)
  FormatterWarning,
Out[2]: [x, y]
@jigarmistry
Copy link

In Ipython if you write:

In [1]: from sympy import init_printing

In [2]: init_printing(use_latex='matplotlib')

In [3]: [x,y]
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-114b0ad9bcca> in <module>()
----> 1 [x,y]

NameError: name 'x' is not defined

it will give error like this because no x is define yet.

@flacjacket
Copy link
Member Author

Oops, my default profile loads sympy, and I have things like x and y defined by default. Any list with sympy objects should do this. To get x and y you can do something like from sympy.abc import x, y or from sympy import symbols; x, y = symbols('x y').

@asmeurer
Copy link
Member

Or use init_session() instead of init_printing().

@moorepants
Copy link
Member

This works fine for me on IPython 4 and SymPy master.

selection_006

@moorepants
Copy link
Member

I'm closing this. Please reopen if you can show how to reproduce.

@flacjacket
Copy link
Member Author

Looks like this was fixed a while ago e532688, so this can stay closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy to Fix This is a good issue for new contributors. Feel free to work on this if no one else has already. IPython printing
Projects
None yet
Development

No branches or pull requests

5 participants