Bring all MathJax logic into one common template
Might as well do this right away, we're here anyway.