Thursday, 11 June 2015

Creating Math in Blogger

I've decided to add MathJax1 to my blog.

I have tried in the past to use MathML3, but it's support among internet browsers is still too fragmented to be of any use. It looks like this situation is likely to continue. Also, I am a big fan of the Tex notation, instead of the verbose XML I would need to get anything done in MathML.

The difference is obvious when you right-click on the Math Expressions below.


When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c =
0\) and they are \[x = {-b \pm \sqrt{b^2 - 4ac} \over 2a}\]

JavaScript Snippet

I have added the below snippet to my HTML in my Template, as according to source [2].
<!-- Script for installing MathJax -->
<script type='text/x-mathjax-config'>
   //  <![CDATA[
      extensions: ["tex2jax.js"],
      showProcessingMessages : true,
      tex2jax: {
          inlineMath: [ ["\\(","\\)"] ],
          displayMath: [ ["\\[","\\]"] ],
          preview : "TeX",
          processEscapes: true
      TeX: {
        Macros: {
            Moon: "{&#9790;}"
   //   ]]>
<script src='' type='text/javascript'/>
<!-- End Script for installing MathJax -->


[1] MathJax
[2] The Astronomy Learner - MathJax on Blogger
[3] Wikipedia - MathML
W3 - MathJax Overview
Hanselman - Exploring Crossbrowser Math Equations Using MathML or LaTeX With MathJax

No comments:

Post a Comment