MathJax
Official Implementation
HTML<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false
});
</script>
Simple Solution
Remove the script tags from the head
and add the following coffeescript to your application:
COFFEESCRIPT$ ->
loadMathJax()
$(document).on 'page:load', loadMathJax
loadMathJax = ->
window.MathJax = null
$.getScript "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML", ->
MathJax.Hub.Config
showMathMenu: false
Advanced Solution (with AJAX caching)
Remove the script tags from the
head
.-
Define this classes somewhere in your application's JS:
COFFEESCRIPT
class MathJax constructor: (@options) -> @bind() load: => window.MathJax = null @_fetch().done => window.MathJax.Hub.Config @options bind: -> $ => @load() $(document).on 'page:load', @load unbind: -> $(document).off 'page:load', @load # private _fetch: -> $.ajax dataType: 'script' cache: true url: "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
-
Add this line to your application's JS (after the class has been defined) to initialize MathJax
COFFEESCRIPT
new MathJax showMathMenu: false
Related Issues: #16
Credit: Nick Reed
All solutions should be considered unofficial. There is no guarantee that a given solution will work with your application. If you find that a solution is insufficient, please let me know by submitting an issue on Github.