omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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?

    Pythonista
    3
    3
    1594
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • zombie
      zombie last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • Olaf
        Olaf last edited by

        If you can draw the LaTeX string in matplotlib, there's a savefig function that saves the plot to a png file, which you could read and display in the Scene

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors