Option to use MathJax 3?

fiona.alpha137's Avatar

fiona.alpha137

31 Jan, 2020 09:47 PM

Hi Brett,

I realized recently that MathJax 3.0 has been released, and among many new features, it now has the physics latex package which is crucial for my writing needs. I think MathJax 3.0 has changed how it takes configuration inputs, so it's probably not desirable to switch to MathJax 3 entirely, but would it be possible to add an option to use MathJax 3 in Marked 2?

Thanks,
Fiona

  1. Support Staff 1 Posted by Brett on 31 Jan, 2020 09:57 PM

    Brett's Avatar

    I'll look into it, I hadn't realized there had been a significant
    MathJax update. In the meantime you do always have the option of
    disabling the internal MathJax integration and using a script tag
    sourcing the CDN version of the library.

    -Brett

  2. Support Staff 2 Posted by Brett on 06 Feb, 2020 04:40 PM

    Brett's Avatar

    To follow up, if you disable MathJax entirely in preferences, you should be able to add a script tag to your document that loads v3 and any necessary config options. This could be semi-automated by using an external script and the raw include syntax in Marked.

    I have not fully tested this, but if you do give it a shot I'm willing to help debug it with you and would be curious if it works for future reference.

  3. 3 Posted by fiona.alpha137 on 21 Feb, 2020 09:07 PM

    fiona.alpha137's Avatar

    Hi Brett,

    Thanks for the response. I tried loading MathJax 3 directly in my markdown file, and that seems to be working: please see the attached test1.md and test1.png files. The \expval and \dd commands are from the physics package that's only available in MathJax 3, and they are rendering correctly.

    But I couldn't figure out how the script tag can be moved to an external file. I don't know much about html, so I tried just copy-pasting the html code that loads MathJax 3 to a separate file in the same folder (mathjax.html attached here) and wrote <<{mathjax.html} inside my markdown (see attached test2.md), but then Marked 2 crashes.

    Best,
    Fiona

  4. 4 Posted by fiona.alpha137 on 21 Feb, 2020 09:22 PM

    fiona.alpha137's Avatar

    Sorry I realized I was having custom processor turned on; Marked 2 still crashes with the <<{mathjax.html} line, the only difference is that the \begin{equation} and \end{equation} block needs to be surrounded by $$. Please find the attached files, test1.md should render in Marked 2 with MathJax turned off and custom processor turned off, and test2.md crashes.

  5. 5 Posted by fiona.alpha137 on 21 Feb, 2020 09:41 PM

    fiona.alpha137's Avatar

    And I realized I didn't have the latest version of Marked 2... I just updated and now <<{mathjax.html} is working when I put this line somewhere below the title line. It would be great if MathJax 3 is an option in Marked 2, but a single additional line is good enough for me. Sorry about all these messages, thanks for the help!

  6. Support Staff 6 Posted by Brett on 21 Feb, 2020 11:32 PM

    Brett's Avatar

    Glad it worked out!

    - Brett

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