Tuesday, February 28, 2012

MathJax in Blogger

Tuesday, July 12, 2011

MathJax in Blogger (II)

The new awesome way to include math in a website is MathJax. Until recently, one had to install MathJax in their own server in order to include math in their webpages. That changed a few weeks ago; you can now specify in your html code that the required script be loaded from MathJax's website.

To get MathJax to work in Blogger, just go to your Blogger account, click "Design" (top right of the page), and then "Edit HTML". After the first <head> you see, paste
  <script src='http://cdn.mathjax.org/mathjax/latest/MathJax.js' type='text/javascript'>     MathJax.Hub.Config({         extensions: ["tex2jax.js","TeX/AmsMath.js","TeX/AMSsymbols.js"],         jax: ["input/TeX","output/HTML-CSS"],         tex2jax: {             inlineMath: [ ['$','$'], ["\\(","\\)"] ],             displayMath: [ ['$$','$$'], ["\\[","\\]"] ],             processEscapes: true,         },         "HTML-CSS": { availableFonts: ["TeX"] }     }); </script>

You're done! You can now use the usual $...$ or \(...\) for inline equations, and $$...$$ or
\[...\] for equations that are centered in their own line.

Time for an example:
cos2θsin2θ=cos2θ.
Note that the code above loads AMSmath.js and AMSsymbols.js, so that the macros and environments they provide are defined for use on your blog.

No comments:

Blog Archive