Mathjax: Does version 3 support <script type="math/tex">?

Created on 17 Oct 2019  Â·  5Comments  Â·  Source: mathjax/MathJax

It seems Mathjax version 3 does not render before processed by Mathjax.

I was wondering whether this is an expected behavior in v3 or not. If so, are there any options to turn on the rendering of

All 5 comments

This is the expected behavior in version 3. See the last bullet point in the changes to the API section of the upgrading to v3 documentation. This gives a configuration that will process the scripts that you are using.

Thank you so much for the information. This is exactly what I was looking for. Adding the following script successfully processed html files generated by Jekyll (from both html and markdown files).

MathJax = {
  options: {
    renderActions: {
      /* add a new named action not to override the original 'find' action */
      find_script_mathtex: [10, function (doc) {
        for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
          const display = !!node.type.match(/; *mode=display/);
          const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
          const text = document.createTextNode('');
          node.parentNode.replaceChild(text, node);
          math.start = {node: text, delim: '', n: 0};
          math.end = {node: text, delim: '', n: 0};
          doc.math.push(math);
        }
      }, '']
    }
  }
};

Would you consider making this a simple option switch?

@opeltre, No, but it could be made an extension you could load.

For anyone still looking: @memakura's code just kinda works very well and out of the box :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muzimuzhi picture muzimuzhi  Â·  6Comments

mt4c picture mt4c  Â·  3Comments

albertodiazdorado picture albertodiazdorado  Â·  6Comments

DibasDauliya picture DibasDauliya  Â·  6Comments

dpvc picture dpvc  Â·  3Comments