Print latex formatted matrix from ipython notebook

522 views
Skip to first unread message

brombo

unread,
Jun 17, 2015, 3:09:52 PM6/17/15
to sy...@googlegroups.com
Is there anyway to print a nicely latex formatted matrix in ipython notebook?  When I try I just get the test version printed out while the latex formatting for the other objects I am printing works fine.

Alan Bromborsky

unread,
Jun 18, 2015, 11:59:54 AM6/18/15
to sy...@googlegroups.com
I should clarify what I am doing.  I have custom latex printers for Matrix, Derivative, Function, Pow, and Symbol.  All work fine when generating a tex file for input to pdflatex.  Except for Matrix all work fine in printing latex in "ipython notebook."  I don't know what is different about Matrix.  Note that in my initialization for latex printing I have the statements -

Basic.__str__ = lambda self: GaLatexPrinter().doprint(self)
Matrix.__str__ = lambda self: GaLatexPrinter().doprint(self)
Basic.__repr_ = lambda self: GaLatexPrinter().doprint(self)

I added -

Matrix.__repr__ = lambda self: GaLatexPrinter().doprint(self)

but it made no difference in the output.


On Wed, Jun 17, 2015 at 3:09 PM, brombo <abrom...@gmail.com> wrote:
Is there anyway to print a nicely latex formatted matrix in ipython notebook?  When I try I just get the test version printed out while the latex formatting for the other objects I am printing works fine.

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/c49e47fb-8a4f-4196-9d0c-2cfff60a7691%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Francesco Bonazzi

unread,
Jun 18, 2015, 3:26:11 PM6/18/15
to sy...@googlegroups.com


On Thursday, 18 June 2015 17:59:54 UTC+2, brombo wrote:

I added -

Matrix.__repr__ = lambda self: GaLatexPrinter().doprint(self)

but it made no difference in the output.


With the information you provided, I can only try a guess.

Have you checked if __repr__ gets overwritten by __new__ in either Basic or Expr? SymPy's printer code is usually defined in the printing system files, not in the classes themselves.
Reply all
Reply to author
Forward
0 new messages