Friday, August 29, 2014

Typsetting math with Latex in your blogger/blogspot blog, using mathjax


Mathjax allows you to typeset math in your webpages, using the familar latex syntax. It uses javascript to render the math in the browser, and does quite a good job of it.

To add mathjax to your blogger/blogspot blog (like this one):

Go to the blog dashboard, click on Layout and add an HTML/Javascript gadget at the top, and paste in the following

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script> 
  
To get this gadget to work in the mobile version of your blog, you might need to take some additional steps: http://ruffnsluff.blogspot.com/p/getting-your-gadget-to-work-on-mobile.html

To inline math, use
\(..\)
For display math (like an equation on its own line), use
\[...\] or $$...$$ 

Example of inline math: \( x^n + y^n \neq z^n \).

Display math:

$$\int_{0}^{1} \frac{1}{1+x^2} \text{d}x = \frac{\pi}{4}$$

It even works in the preview and comments.

More information about Mathjax is here: http://docs.mathjax.org/en/latest/start.html

No comments:

Post a Comment