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

  • Home
  • SEARCH
  • 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 7697707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:04:34+00:00 2026-05-31T22:04:34+00:00

I want to render equations to PNG files and embed them in the HTML

  • 0

I want to render equations to PNG files and embed them in the HTML documentation of my library. I am already using pylab (matplotlib) in other projects.

I have not found any clues in http://matplotlib.sourceforge.net/users/usetex.html and http://matplotlib.sourceforge.net/users/mathtext.html

When I do

plt.title(r'$\alpha > \beta$')
plt.show()

I get a titled empty figure with axes.

Update:

After doing some research I found, that the easiest way of rendering LaTeX to png is using mathext ( http://code.google.com/p/mathtex/ ).

Suprisingly, I had all requiered libraries to build it from source.

Anyway, thanks to everyone for replies.

Update 2:

I did some testing of mathtex and found it does not support matrices (\begin{pmatrix}) and some other things I need.
So, I’m going to install LaTex (MikTeX).

Update 3:

I installed proTeXt. It’s huge, but easy-to-use and fast. IMHO, for now it’s the only way of rendering equations.

  • 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-31T22:04:36+00:00Added an answer on May 31, 2026 at 10:04 pm
    • (source) If you are using IPython interpreter, it renders all single matplotlib step into a figure window by default.

      Thus, plt.title(r'$\alpha > \beta$') in IPython would immediately create a figure even before calling .show(). On the other hand, using terminal/cmd/IDLE won’t.

    • plt.show() would create a figure window whether you’re using IPython or not, you want to change that line to:

      plt.savefig('filename.png')
      

    Edit:
    Okay, I misunderstood your question. As @Li-aung Yip said, you may want to use Sympy for pure equation image. We can still do some trick in matplotlib to achieve what you want though (you may need to readjust or resize accordingly):

    import matplotlib.pyplot as plt
    
    #add text
    plt.text(0.01, 0.8, r'$\alpha > \beta$',fontsize=50)
    
    #hide axes
    fig = plt.gca()
    fig.axes.get_xaxis().set_visible(False)
    fig.axes.get_yaxis().set_visible(False)
    plt.draw() #or savefig
    

    This is done by hiding axes ticks and adding text inside the plot figure.

    But…this doesn’t really “not drawing” a figure :\ Though you can post-process such as cropping the image with PIL.

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

Sidebar

Related Questions

I want to render content that i have created locally using html component and
I want to render an HTML-EMail and send it to our customers using some
I want to render the partial view using ajax. When I submit the button,
I want to render for facebook bot special data. I have og.html.erb <!DOCTYPE html><html><head>
I want to render a form (fields and includes a submit button) when using
Background: I want to render this: <a href=javascript:myfunction('Somevar')><img src=some.png width=20 height=20 border=0 /></a> in
I want to Render HTML Code to an Image with C#. Can I do
I want to render a splash screen on the iPhone whilst using an Open
I have a bunch of partials that I want to render horizontally, using form-inline
I want to render using Richfaces a context menu on left click on 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.