I just can’t believe displaying LaTeX math formula in Octopress could be this easy.

  1. Add gem 'kramdown' to “GemFile”, then run bundle install.
  2. Edit “_config.yml”, replace markdown: rdiscount to markdown: kramdown, kramdown is a fast, pure-Ruby Markdown-superset converter.
  3. Open “source/_includes/custom/head.html”, and add below scripts to use MathJax, a decent js display engine for mathematics.
    <!-- MathJax -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"] ],
          processEscapes: true
        }
      });
    </script>

    <script type="text/x-mathjax-config">
        MathJax.Hub.Config({
          tex2jax: {
            skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
          }
        });
    </script>

    <script type="text/x-mathjax-config">
        MathJax.Hub.Queue(function() {
            var all = MathJax.Hub.getAllJax(), i;
            for(i=0; i < all.length; i += 1) {
                all[i].SourceElement().parentNode.className += ' has-jax';
            }
        });
    </script>

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

Now, let’s enjoy the beauty of Gaussian Distribution

f(x;μ,σ2)=1σ2πe12(xμσ)2f(x;\mu,\sigma^2) = \frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}