Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Possible to implement LaTeX in Scene module?
-
Is there a way that I can get the Scene module to print a graphical LaTeX output, possibly as an image? My goal is to have Scene produce a few of these graphics so that they may be dragged around and have some interactivity. I have been exploring the SymPy and Matplotlib libraries, but it seems that both are concerned with printing to the console
I'm fairly new to both libraries, most of Python really.. I thought that I could possibly produce the graphic through Matplotlib, and have it available for Scene to draw, but I am struggling to execute such a approach. Thanks in advance!
-
If you can draw the LaTeX string in
matplotlib
, there's asavefig
function that saves the plot to a png file, which you could read and display in the Scene -
import matplotlib.mathtext as mt s=r'$\frac{A}{B} = C$' mt.math_to_image(s, 'test.png')
the second argument to math_to_image could also be a BytesIO, etc.