Monday 16 May 2011

How to display math formulas on Blogger using MathJax

1. Log into your Blogger account by opening http://www.blogger.com/home

2. In the Manage Blogs section click on "Design" - "Edit HTML"

3. Search for the <head> tag in your Blogger Template HTML code using Ctrl+F

4. Copy and paste the script tag below into the <head> block of your Blogger Template (taken from:http://www.mathjax.org/docs/1.1/start.html)

<script type="text/javascript"
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>



4. Then click on SAVE TEMPLATE.

* Now when you create Posts in HTML mode you can directly type math formulas using the LaTex syntax. Also you can copy and paste the formulas from the blog highlighting them , right click - Show Source.

* Below you can find some math examples:



\begin{aligned}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned}

\begin{eqnarray*}
\left(1+x\right)^n & = & 1 + nx + \frac{n\left(n-1\right)}{2!}x^2 \\
& & + \frac{n\left(n-1\right)\left(n-2\right)}{3!}x^3 \\
& & + \frac{n\left(n-1\right)\left(n-2\right)\left(n-3\right)}{4!}x^4 \\
& & + \ldots
\end{eqnarray*}

\begin{aligned}
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) \end{aligned}

\begin{aligned}
P(E) = \frac{n(E)}{n(S)} \end{aligned}