Sunday, March 9, 2014

Off Topic

Getting Blogger to correctly display and preview MathJax was a little tricky. You have to add the following to the <head> section of your template:

<head>
<script src='https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js' type='text/javascript'>    
    MathJax.Hub.Config({
    HTML: ["input/TeX","output/HTML-CSS"],
    TeX: { extensions: ["AMSmath.js","AMSsymbols.js"], 
         equationNumbers: { autoNumber: "AMS" } },
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
    tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ],
             displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
             processEscapes: true },
    "HTML-CSS": { availableFonts: ["TeX"],
                linebreaks: { automatic: true } }
    });
</script>
...
</head>

Note: You must use https. Using http://cdn.mathjax.org/mathjax/latest/MathJax.js will not work in preview mode, and https://cdn.mathjax.org/mathjax/latest/MathJax.js does not work at all. https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js is the only url that I found to always work correctly1

No comments:

Post a Comment