Tuesday, October 2, 2012

Writing Math Equation in Dynamic Page Blogs


Mathjax is an open source Javascript display engine for mathematics. It's allow you to rendered math equation on all modern browsers without have to download reader, plugins or fonts.

Mathjax support Tex, LaTax and MathML equations. Better than word, here is an example.

When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) 
and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

Which produce:
When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

What not so trivial to me is how to set it up.  Basically, to endable MathJax in web platform, you have to add the line to header section.
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?
config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>

Unfortunately, it's won't work with Dynamic Page, which I am using. Because the content of the post is showed in a popup page, the in the main page itself. The solution, the script have to be added into the post itself.

Here what I did:
  1. open the post
  2. edit in html mode
  3. copy the script on top of the post
Then start writing the math equation! That all it's take.

Mathjax has an excellent documentation how to use it here. It's really cool! :)

No comments:

Post a Comment