Wednesday, July 31, 2013

Latex in Blogger

Who doesn't like beautifully formatted mathematics? Latex is the standard. 

The question is how to get Blogger to recognize and then property format a Latex script. Here's a way:

  1. Go to the Overview page for your blogger blog.
  2. Click Template. It should be found on the right.
  3. Choose Edit HTML.
  4. Add the code below before the first occurrence of <head>:

<script type='text/x-mathjax-config'> MathJax.Hub.Config({tex2jax: {inlineMath: [[&#39;amp;#39;,&#39;amp;#39;], [&#39;\\(&#39;,&#39;\\)&#39;]]}}); </script>
<script src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' type='text/javascript'> </script>

A few tests:

$Ax^2+Bx+C=0$

$\frac{a}{b} = \frac{c}{d} \Leftrightarrow ad = bc$

Simply enclose your scripts between dollar signs ($). If you need a bit of help to build the script for an expression or equation you wish to display, here's an online TeX editor.

1 comment :

  1. Please I need further explanation. I have added the code you give to my template. What should I do then? After I write down the script for the equation I want to display and enclose it between two ($) using the TeX editor...should I paste it in my new post in compose mode? This only displays the Latex script after I publish it. It is not recognized. What is my fault?
    Oh, by the way I love Lao Chu.

    ReplyDelete