Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I don't know that there is one. But you can use the text command, and wrap the latex in $:

text("Behold the power of TeX: $\\frac{x^2}{y^3} = 7$", (0, 0), axes=False,fontsize=20)

So you can trivially write a latexrender command yourself:

def latexrender(s):
    pic = text("$" + s.replace('$','\$') + "$",(0,0),axes=False, color='black',fontsize=20)
    pic.show()

Adding extra features like allowing you to specify the properties via **kwargs is left as an exercise for the reader.

I don't know that there is one. But you can use the text command, and wrap the latex in $:

text("Behold the power of TeX: $\\frac{x^2}{y^3} = 7$", (0, 0), axes=False,fontsize=20)

So you can trivially write a latexrender command yourself:

def latexrender(s):
    pic = text("$" + s.replace('$','\$') + "$",(0,0),axes=False, color='black',fontsize=20)
    pic.show()

latexrender("17 + \sum_{i=2}^{q} \, k^2 = 29383")

Adding extra features like allowing you to specify the properties via **kwargs is left as an exercise for the reader.

I don't know that there is one. But you can use the text command, and wrap the latex in $:

text("Behold the power of TeX: $\\frac{x^2}{y^3} = 7$", (0, 0), axes=False,fontsize=20)

So you can trivially write a latexrender command yourself:

def latexrender(s):
    pic = text("$" + s.replace('$','\$') + "$",(0,0),axes=False, color='black',fontsize=20)
    pic.show()

latexrender("17 + \sum_{i=2}^{q} \, k^2 = 29383")

Adding extra features like allowing you to specify the properties via **kwargs is left as an exercise for the reader.reader. I should note though that the above uses matplotlib's TeX implementation, not any system verison, AFAIK.

I don't know that there is one. But from the console, you can use the text command, and wrap the latex in $:

text("Behold the power of TeX: $\\frac{x^2}{y^3} = 7$", (0, 0), axes=False,fontsize=20)

So you can trivially write a latexrender command yourself:

def latexrender(s):
    pic = text("$" + s.replace('$','\$') + "$",(0,0),axes=False, color='black',fontsize=20)
    pic.show()

latexrender("17 + \sum_{i=2}^{q} \, k^2 = 29383")

Adding extra features like allowing you to specify the properties via **kwargs is left as an exercise for the reader. I should note though that the above uses matplotlib's TeX implementation, not any system verison, verson, AFAIK.

Let's see if I can figure out how to do this from the notebook..

I don't know that there is one. But from the console, you can use the text command, and wrap the latex in $:

text("Behold the power of TeX: $\\frac{x^2}{y^3} = 7$", (0, 0), axes=False,fontsize=20)

So you can trivially write a latexrender command yourself:

def latexrender(s):
    pic = text("$" + s.replace('$','\$') + "$",(0,0),axes=False, color='black',fontsize=20)
    pic.show()

latexrender("17 + \sum_{i=2}^{q} \, k^2 = 29383")

Adding extra features like allowing you to specify the properties via **kwargs is left as an exercise for the reader. I should note though that the above uses matplotlib's TeX implementation, not any system verson, AFAIK.

Let's see if I can figure out how to do this from the notebook..notebook.. okay, the above still works there. I'll see if I can figure out how to get LaTeX itself called (although I should say that the matplotlib mathtext has worked pretty well for me).

I don't know that there is one. But from the console, you can use the text command, and wrap the latex in $:

text("Behold the power of TeX: $\\frac{x^2}{y^3} = 7$", (0, 0), axes=False,fontsize=20)

So you can trivially write a latexrender command yourself:

def latexrender(s):
    pic = text("$" + s.replace('$','\$') + "$",(0,0),axes=False, color='black',fontsize=20)
    pic.show()

latexrender("17 latexrender(r"17 + \sum_{i=2}^{q} \, k^2 = 29383")

Adding extra features like allowing you to specify the properties via **kwargs is left as an exercise for the reader. I should note though that the above uses matplotlib's TeX implementation, not any system verson, AFAIK.

Let's see if I can figure out how to do this from the notebook.. okay, the above still works there. I'll see if I can figure out how to get LaTeX itself called (although I should say that the matplotlib mathtext has worked pretty well for me).

After a little thought, something like the following should get the job done:

import matplotlib
matplotlib.rcParams['text.usetex']=True
def latexrender(s):
    pic = text("$" + s.replace('$','\$') + "$",(0,0),axes=False, color='black',fontsize=20)
    pic.show()

latexrender(r"17 + \displaystyle\sum\limits_{i=2}^q \, k^2 = 29383")