Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7625903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:15:13+00:00 2026-05-31T05:15:13+00:00

Is there any python code that allow take a latex code (for equations) and

  • 0

Is there any python code that allow take a latex code (for equations) and parse it to mathml or svg code ? A simple function that take as argument a string (the latex code) and output a string (the svg or mathml code) would be perfect.

PS. I’ve found this http://svgkit.sourceforge.net/SVGLaTeX.html but it’s a web based project and not sure how to use it.

EDIT: or in any language (not obligatory python), or at least an exe file that can be simply executed by a command line to do that (without installing additional stuff).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:15:14+00:00Added an answer on May 31, 2026 at 5:15 am

    You can do this without installing anything:

    import urllib
    import urllib2
    
    def latex2svg(latexcode):
        """
        Turn LaTeX string to an SVG formatted string using the online SVGKit
        found at: http://svgkit.sourceforge.net/tests/latex_tests.html
        """
        txdata = urllib.urlencode({"latex": latexcode})
        url = "http://svgkit.sourceforge.net/cgi-bin/latex2svg.py"
        req = urllib2.Request(url, txdata)
        return urllib2.urlopen(req).read()
    
    print latex2svg("2+2=4")
    print latex2svg("\\frac{1}{2\\pi}")
    

    This script calls the SVGKit server you mention, which does the work of converting LaTeX to SVG. It returns the text of SVG (try it out).

    Note that, as with any solution that relies on third-party web apps,

    1. This assumes you have a reliable internet connection

    2. Its performance depends on the speed of your connection and of the server

    3. This relies on the third-party site to stay consistent (if they take it down, or the format significantly changes, this will no longer work without adjustment)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any guidelines to writing Google App Engine Python code that would work
Are there any libraries that will allow me to display code in <pre> tags
Is there any way I can get my Python code syntax highlighted in Microsoft
Are there any Python modules that will let me get access to NFS quota
Are there any modules for Python, that can be used as a TFTP server?
Is there any Ruby equivalent for Python's builtin zip function? If not, what is
Is there any compiler which will help me convert my python code to proper
I have some python code that binds to a socket. I catch any exception
Is there any python module to convert PDF files into text? I tried one
Are there any python libraries for data trees? I mean a tree as a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.