What you say sounds reasonable. However the fastest way to get this functionality would be if you provide a pull request yourself (I would guess most of the core developers use ipython notebooks anyway and will hardly find the time to do this).
Just when you import matplotlib, use the lazy `import_module` that we have implemented (it is done so `from sympy import *` is not slowed down by dependencies) On 13 April 2013 13:38, Christoph Pohl <[email protected]> wrote: > Hello, > > currently the printing.preview function needs an LaTeX installation to > compile > the expression to an image/document. Given that a LaTeX installation is not > always available, and matplotlib has already implemented a sizeable subset > of > the most common LaTeX math commands, would it be possible to provide an > alternative preview function that does not depend on LaTeX itself? > > A rough example of how this could work: > > def alternative_preview(expr, **kwargs): > """Show rendered preview of expr""" > from matplotlib import pyplot as plt > latex_str = r"$ %s $" % sp.latex(expr, **kwargs) > # matplotlib does not recognize \operatorname, but does work with > \mathrm > latex_str = latex_str.replace("operatorname","mathrm") > plt.figure(figsize = (15, 2)) > plt.text(0.5, 0.5, latex_str, fontsize=30, horizontalalignment='center') > plt.axis('off') > plt.show() > > Maybe it would be possible to check whether LaTeX is installed, and fall > back > to this if it is not. I reckon most sympy users also have matplotlib > installed, > so this additional dependency would be acceptable, i.e. users can "choose > their dependency", matplotlib or LaTeX. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy?hl=en-US. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
