MMDC 3: Preference>Advanced>MathJax more customization

christian.kolen's Avatar

christian.kolen

29 Apr, 2016 07:52 PM

Currently the way I use MathJax with MMDC is to put this in the header:

HTML Header: <script type="text/x-mathjax-config"> MathJax.Ajax.config.path["Contrib"]="https://cdn.mathjax.org/mathjax/contrib"; MathJax.Hub.Register.StartupHook("TeX Jax Ready",function (){MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{cancel: ["Extension","cancel"], bcancel: ["Extension","cancel"], xcancel: ["Extension","cancel"], cancelto: ["Extension","cancel"]});}); MathJax.Hub.Config({tex2jax:{inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true}, TeX:{equationNumbers:{autoNumber: "AMS"}, extensions: ["[Contrib]/physics/physics.js","[Contrib]/siunitx/siunitx.js"]}});</script><script type="text/javascript"src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full"></script>

which is basically to put the following in the header section:

<!-- setup MathJax to use physics package, SIUnitX package, cancel package, equation numbering, and dollar sign -->
<script type="text/x-mathjax-config">
  MathJax.Ajax.config.path["Contrib"] = "https://cdn.mathjax.org/mathjax/contrib";
  MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
    MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
        cancel: ["Extension","cancel"],
        bcancel: ["Extension","cancel"],
        xcancel: ["Extension","cancel"],
        cancelto: ["Extension","cancel"]
    });
  });
  MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [['$','$'], ['\\(','\\)']],
        processEscapes: true
    },
    TeX: {
        equationNumbers: { autoNumber: "AMS"},
        extensions: ["[Contrib]/physics/physics.js","[Contrib]/siunitx/siunitx.js"]
    }
  });
</script>
<!-- Load MathJax -->
<script type="text/javascript"
    src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full">
</script>

Currently in MMDC3 beta, in Preference>Advanced, there's only a checkbox to specify if MathJax is automatically used or not. The suggestion is it provides 2 optional text boxes, one for the big MathJax setup script, another for the link to CDN, which allows us to choose from both the location of the script, and the config option (e.g. https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full)

The advantage is to declutter the metadata front matter in the Markdown source since it is both ugly, and cause problems when the same markdown source is used in other context (e.g. in pandoc).

Thanks.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac