[IPython-User] Is it possible to join math expressions with display()

Matthias Bussonnier bussonniermatthias@gmail....
Sun Mar 25 14:51:31 CDT 2012

On Sun, Mar 25, 2012 at 8:19 PM, Joon Ro <joonpyro@gmail.com> wrote:

> Hi,
> I was wondering if it is possible to join math expressions with display()
> in ipython notebook.
> For example, after solving the following:
>     x_sol = solve(x +y - 3, x)[0]
> If I just do display(x_sol), then notebook will print out the solution
> (-y+3). Is there any way to print it prettier, e.g. I get something like:
>     x = - y + 3
> with display()? If I just do display(x, Symbol('='), x_sol) then it will
> print them in separate lines.

I would guess that display() does not display LaTeX only, so it can't
decide to concatenate different object.
You might have to write a function that check wether each of it's argument
has a __repr_latex__ and merge them and return a single object that you can

moreover, I think that display only compute the representation of every of
its object and send them to the frontend, which then decide what
representation it takes.

I would search around IPython.core to find the source of display if I had
to do smth like that. And PR are I think always welcome on github.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120325/722e1136/attachment.html 

More information about the IPython-User mailing list