Thursday, May 22, 2008

Inserting Math Formula

Although there has been a markup language for mathematics called MathML, it is not convenient because it needs some browser plugins to display math formula, for example, MathPlayer. Up to now, the best way to insert math formula into web pages is converting them into images.

But how to describe a math formula with pure text? The answer is TeX. TeX is a publishing tool for scientist and it is developed by Donald E. Knuth. To use it, you must learn some things about TeX. For example, the square root of 2 can be written as '\sqrt{2}'.

MimeTeX and MathTeX are famous for converting TeX texts into images. If you have your own server, you'd better setup it on the server, although it is a hard work. But what is you haven't your own server? Fortunately, there is a public server, forkosh, providing MimeTeX and MathTeX for free. e.g. if you want to write the squre root of 2, you need to write this HTML:<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?\sqrt{2}" /> or <img src="http://www.forkosh.dreamhost.com/mathtex.cgi?\sqrt{2}" />. i.e. you need to pass TeX text as the mimetex.cgi or the mathtex.cgi's argument. If you know TeX, inserting formula is very easy.

Now let's have look. The TeX text is 'x_{1,2}=\frac{-b\pm\sqrt{b^2-4ac}}{2a}'.

MimeTeX.cgi:


MathTeX.cgi:

3 comments:

Anonymous said...

guess you could've just done it yourself and it would've taken just as long

Zetanos said...

was searching a way to post math articles on blogs (blogger in particular), now that is good news !

VALMIKI GROUP said...

how to write the code to get next and previous button in gallery using html5