21

I'm currently looking at different solutions getting 2 dimensional mathematical formulas into webpages. I think that the wikipedia solution (generating png images from LaTeX sourcecode) is good enough until we get support for MathML in webbrowsers.

I suddenly realized that it might be possible to create a Google Charts API equivalent for mathformulas. Has this already been done? Is it even possible due to the strange characters involved in LaTeX-code?

I would like to hit an url like latex2png.org/api/?eq="E = mc^2" and get the following response: e=mc^2

edit: Thanks for the answers sofar. However, I am already aware of several tools to generate png images from latex source code (both online and from my commandline), but what I was looking for was a simple way to get the image via an Http GET request. Perhaps such a service does not exist.

Community
  • 1
  • 1
Jonas
  • 19,422
  • 10
  • 54
  • 67

7 Answers7

27

Update

As @hughes (and others) pointed out, the previous Google Chart API has been deprecated.

The example I wrote still works as of Sept 2015, but a new one shall be used now (documentation):

Old answer

Google Chart can do it (Documentation):

http://chart.apis.google.com/chart?cht=tx&chl=%5CLaTeX

I'm using this with Google Docs, because it doesn't support math yet.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
AkiRoss
  • 11,745
  • 6
  • 59
  • 86
12

chart.apis.google with background color changed

alt text

https://chart.apis.google.com/chart?cht=tx&chf=bg,s,FFFF00&chl=%0D%0A4x_0%5CDelta%28x%29%2B3%5CDelta%28x%29%2B2%5CDelta%28x%5E2%29%3E0%0D%0A

or chart.apis.google with background color transparent and resized

For better readability URL needs to be decoded.

https://chart.apis.google.com/chart?cht=tx&chs=428x35&chf=bg,s,FFFFFF00&chl=
4x_0\Delta(x)+3\Delta(x)+2\Delta(x^2)>0

Data structure looks like this

{
  "cht":"tx",
  "chs":"428x35",
  "chf":"bg,s,FFFFFF00",
  "chl":"n4x_0\Delta(x) 3\Delta(x) 2\Delta(x^2)>0"
}

alt text

https://chart.apis.google.com/chart?cht=tx&chs=428x35&chf=bg,s,FFFFFF00&chl=%0D%0A4x_0%5CDelta%28x%29%2B3%5CDelta%28x%29%2B2%5CDelta%28x%5E2%29%3E0%0D%0A
FDisk
  • 8,493
  • 2
  • 47
  • 52
9

You could try the Online image generator for mathematical formulas for a start.

mathurl is a mathematical version of TinyURL.com. It allows you to reference LaTeXed mathematical expressions using a short url. For example, http://mathurl.com/?5v4pjw will show [LaTeX output Image] which you can then edit. More details on mathurl’s help page

Galwegian
  • 41,475
  • 16
  • 112
  • 158
  • 1
    this service requires you to first POST an equation and then GET the image. I would like to embed the equation in the URL – Jonas Feb 05 '09 at 16:35
8

I just ran across MathJax on Ajaxian [via Wayback Machine]:

MathJax seems to have a chance at being a practical solution that offers a high quality display of LaTeX and MathML math notation in HTML pages.

The output is remarkably beautiful, and it's all pure HTML and CSS, which makes it scalable and selectable. Performance is currently a bit sluggish, but this is recognized.

Weston Ruter
  • 1,041
  • 1
  • 9
  • 21
1

As everyone has said, there are many services that do this already. Here is another easy one that I've used a number of times (and you can install it locally on your server if necessary):
http://www.codecogs.com/components/equationeditor/equationeditor.php

nlucaroni
  • 47,556
  • 6
  • 64
  • 86
0

Please check out this site for a way to create TeX documents without any software installed. You can then snippet the result image with any screen capture method and embed the resulting image into a any website.

Go to http://sharelatex.com

The software is free to use, but you need to register to create documents.

Carey G. Butler
  • 59
  • 1
  • 10
0

I'd take a good look at how the MediaWiki LaTeX support does it and borrow from there.

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614