Thursday, 25 December 2014

How to write Math Formulas on Blogspot / Blogger

Source: http://irrep.blogspot.sg/2011/07/mathjax-in-blogger-ii.html

Blogger also has a way to typeset Math Formulas!

To type Formulas in LaTeX format, simply follow the instructions on the following website:
http://irrep.blogspot.sg/2011/07/mathjax-in-blogger-ii.html

In case the above website goes down, here is how to do it:

Basically, go to your blogspot website while signed in. On the top right hand corner, click on "Design". Click on "Edit HTML", and paste the following code right after the <head> in the HTML.

<script src='http://cdn.mathjax.org/mathjax/latest/MathJax.js' type='text/javascript'>    
    MathJax.Hub.Config({
        HTML: ["input/TeX","output/HTML-CSS"],
        TeX:extensions: ["AMSmath.js","AMSsymbols.js"], 
               equationNumbers: { autoNumber: "AMS" } },
        extensions: ["tex2jax.js"],
        jax: ["input/TeX","output/HTML-CSS"],
        tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ],
                   displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
                   processEscapes: true },
        "HTML-CSS": { availableFonts: ["TeX"],
                      linebreaks: { automatic: true } }
    });
</script>


Then, you can type formulas enclosed in dollar signs "$", in the usual LaTeX manner.

For instance $e^{i \pi}+1=0$.

In my opinion, this method is even superior to WordPress' LaTeX capabilities, which require a "$latex" which is more cumbersome to write.


Some other fancy formulae using the Displaystyle (Double Dollar signs "$$")
$$a^p \equiv a \pmod p$$
$$\int_0^\frac{\pi}{2} \sin x\ dx=1$$


No comments:

Post a Comment