Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Is there a supported / working MathJax plugin for Vanilla 2.6?

General question: what is the status of math rendering support in Vanilla 2.6?

I have a version of the MathJaxCDN plugin, which was written by Peregrine, which is successfully running on a Vanilla 2.1 installation.

I tried coping that over to a fresh installation of 2.6.4. But the plugin doesn't seem to be doing anything. Wondering if that's because the plugin API has changed since 2.1.

Thank you


  • edited January 2019

    And I did enable the plugin. The version field in the plugin is set to 1.3.

  • edited January 2019

    Note I see commentary on the web about the CDN for MathJax having been shut down in 2017. However this plugin is working today on my Vanilla 2.1 installation on another host. And I see that the .js files on the mathjax cdn site are still present.

  • R_JR_J Ex-Fanboy Munich Admin

    I do not find a link to this plugin. If I could see some code I might be able to give advice...

  • edited January 2019

    Hi R_J, thanks for your offer.

    I have attached a tgz file for the plugin.

  • LincLinc Detroit Admin

    To my knowledge, we're still supporting this addon:

  • LincLinc Detroit Admin
    edited January 2019

    The downside of that addon is I'm fairly certain it will not work with the new Rich Editor in 2.8 and I'm not clear what timeline we'll be updating it on, if at all. Not hopeless, but very unclear what its future is today. For now, you can continue using the old editor which will stay minimally supported probably thru 2.9 (at least).

  • edited January 2019

    Thanks Linc. That is different code, so I will try it out!

    Can you help me to understand the implications of your caveat about the Rich Editor. Since Latex is a plain text format, won't the users always be able to enter the Latex snippets in the forum contents, regardless of what the editor for input is? And then, since MathJax is a rendering component which kicks in after the contents have been stored, won't this Latex get correctly rendered, regardless of the editor for the input?

    I am not too concerned about the Latex showing up as plain text in the editor, and about it not being rendered in the previewing tool. Integration of Latex rendering with an editor tool would be a nice to have -- but it sounds really complex and difficult to do, so I could see why it would be given a very low priority.

    My concern is about building a forum and a community that depends on Latex to typeset complex math stuff, and then having to subsequently discontinue the language entirely.

  • From another point of view: consider a feature in which the user could dynamically select a non-default input editor. In the bare-bones version of this, the only non-default editor available would be a plaintext editor -- in which case there could just be a checkbox that says to use plain text.

    Then rich mathematical typesetting via Latex could be confidently supported into the future. Mathematicians would just have to know how to kick the tires a bit: to check the plaintext box, and to live without a rich text editor or, possibly, an accurate preview tool.

    I myself am okay with using plaintext + markdown + embedded Latex.

    Thank you for considering my questions and suggestions!

  • LincLinc Detroit Admin
    edited January 2019

    I'm not really the expert to be going into detail on this. I don't think Rich Editor will effect support for Latex-as-plaintext. The issue would be whether the Javascript will work against it for special rendering. I doubt that it will. My hope/assumption is that someone will just need to update it a bit to continue support, but that might prove a bit tricky and I don't know on what timeline we'd do that if no one from open source takes it on. That's all my support comment was about.

    The framework underneath the editor won't be changing any time soon, so yes it will continue to be possible to swap editors on a per-post basis, theoretically at least. I feel like that's a more complicated solution than just updating the Javascript, however.

    Also this entire problem is probably more than a year away from getting forced assuming you continue with Advanced Editor for now.

  • charrondevcharrondev Developer Lead (PHP, JS) Montreal Vanilla Staff

    @DavidTanzer I've been doing the bulk of the work on Rich Editor so maybe I can shed some light here. There's 2 sides to this.

    Plain text to MathJax conversion

    I'm not familiar with the way this particular plugin works, but if it works in the following manner, the existing plugin should work with rich editor.

    • The plugin does not integrate specifically into Advanced Editor.
    • The plugin does some scanning on the rendered HTML in the page after the post is made.
    • The plugin finds plaintext expressions, say in a paragraph element, and deploys those.
    // If the plugin scans for output HTML like this
    // And converts it into something like the following
    <p><span><!--- Some Mathjax output here --></span></p>
    // Then it will work still

    Rich Editor expression integration

    Rich editor is based on quill. Quill has some built in integration with KaTeX expressions which can preview live in the editor. If you look at the demo on the quill homepage there, you can try it out.

    The actual implementation probably wouldn't take that long, it's mostly the UI integration that would need to be done. Although I don't have intention to champion the issue myself, if you start planning a feature on our issue tracker I could offer a bit of guidance on how the feature could be implemented.

    MathJax specifically is also not ruled out (the actual quill blot implementation for KaTex is only 30 lines) The real work mostly lies in wiring up the UI properly.

  • edited January 2019

    @charrondev Thanks for this interesting information!

    I project that that MathJax will work with any editor, because there is hardly any interaction between Vanilla and MathJax.

    MathJax is founded on a huge javascript library that implements a substantial Latex rendering engine in the browser itself.

    The MathJax plugin is a very small piece of code causes this code at the top of the rendered html:

    <script src="/plugins/MathJaxCDN/js/redraw.js?v=1.3" type="text/javascript"></script>

    <script src="/plugins/EnhancedComments/js/enhancedcomment.js" type="text/javascript"></script>

    <script type="text/javascript" src=""> </script> <script> MathJax.Hub.Config({ tex2jax: { // inlineMath: [$'\(','\)'$], // inlineMath: [ ['[math]','[/math]'], ['\(','\)'] ] // inlineMath: [ ['[math]','[/math]'] ] inlineMath: [ ['[math]','[/math]'], ['$','$'] ] // inlineMath: [ ['$$','$$'], ['\(','\)'] ] } }); </script>

    So an embedded formula like $$x^2 + y^2 = 1$$ gets scanned and processed in the browser, and there is no way that Vanilla could treat this other than plain text.

  • The downside will be that the editor will not be able to show what the actual page looks like.

    To me, this would not be a big deal.

  • edited January 2019

    In the mathjax plugin configuration, you define the escape characters for the embedded formulas. So, as long as you choose a different escape than what is used for KaTex, one should be able to freely mix KaTex and MathJax expressions in the same text.

  • KaTex does sound like an interesting competitor to MathJax. It will be worth keeping an eye on how the race evolves.

    From a cursory review, the comparison seems to be as follows.

    • KaTex only implements a subset of the functionality of MathJax. But KaTex is a newer product, and they have been adding to it over time.
    • There are performance issues with MathJax, which are due to the time needed to load components of the latex rendering engine into the browser. The whole bundle, with all the fonts, etc., is quite large. But fortunately MathJax only incrementally loads the components as they are needed. And this impact is mitigated by javascript caching in the browser.
    • MathJax has dependence on an external CDN, whereas KaTex based on server-side processing and is self contained. I read that MathJax is now working on some server-side rendering as well.
    • MathJax has institutional support; managed by the American Mathematical Society.

    I personally have not experienced performance problems with MathJax on a Vanilla forum. Posts are small and generally do not cause a large footprint of MathJax to be downloaded. There were some complaints on my forum about MathJax performance, but those were one-time loading issues.

  • edited January 2019

    Oops, looks like I was missing the point of the caveat. Sure there's no interaction on the server between Vanilla and MathJax, but it seems the concern is about the client-side interactions between the javascript for the new editor and mathjax.

    Here are a couple of relevant comments from the MathJax docs:

    "you need to be careful that your mathematics doesn’t look like HTML tags to the browser (which parses the page before MathJax gets to see it)."

    "The TeX input processor handles conversion of your mathematical notation into MathJax’s internal format (which is essentially MathML), and so acts as a TeX to MathML converter."

    Not sure if the latter is encouraging or not.

  • R_JR_J Ex-Fanboy Munich Admin

    @DavidTanzer you might have not seen the most interesting message here:

    The version on GitHub still uses the old CDN but exchanging that link in the plugin is everything which is needed to make it work again.

  • @R_J Thanks for looking into this. It's still not working for me when I update the link. The mathjax script entry is being put in the page, but the formulas don't render. I wonder if I don't have the right link. Or if I'm not using the right delimiters.

    Here are the script lines which get put into the rendered html:

    <script src=";v=2.6.4"></script> 

     <script src="/plugins/MathJax/js/live.js?v=1.1"></script>

    Is this the path that you are using? Does yours have the delayStartUpUntil=onload?

    After that comes the MathJax.Hub.Config section, which I have pasted below. You can see that, as a test, I tried to use yyy, zzz as delimiters for inline math.

    Then I tried all of the following as text in the discussion text -- still no rendering.

    yyy x^2 zzz

    $ x ^ 2 $

    $( x ^ 2 $)

    $\(x ^ 2 \)$

    Can you give a sample of text that renders for you?

    Thank you.

    Text of the config entry:

     <script src="/js/library/jquery.tokeninput.js?v=2.6.4"></script><script type="text/x-mathjax-config">


        jax: ["input/TeX","output/HTML-CSS"],

        extensions: ["tex2jax.js","MathMenu.js","MathZoom.js"],

        TeX: {

          extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]


        tex2jax: {

          inlineMath: [ ['$\(','\)$'], ['$','$'], ['yyy', 'zzz' ],

          displayMath: [ ['$$\(','\)$$'] ],

          processEscapes: true


        "HTML-CSS": { availableFonts: ["TeX"] },

        messageStyle: "none",

        showProcessingMessages: false


  • edited February 2019

    I see in the MathJax docs that ordinarily, the config block needs to come before the load of MathJax.js. But the plugin puts the script of type text/x-mathjax-config after all the script blocks for javascript. So that would account for why the delayStartupUntil=onload is there.

    I actually *once* saw the formula render. This makes me think there could be a race condition or some other problem with the onload signal reaching mathjax.

    So perhaps my config block is never actually being processed by mathjax.

    This whole concern would go away if the config entry would be loaded first. I tried switching these lines in the plugin code:



    But it didn't change anything -- all the JsFile entries go first.

  • R_JR_J Ex-Fanboy Munich Admin

    This equation is beatifully rendered on my test forum: $$(x = {-b \pm \sqrt{b^2-4ac} \over 2a})$$

    It is this part of the plugin (line 41) which needs to be changed if you want other delimeters:

           tex2jax: {
               inlineMath: [ ['$\(','\)$'] ],
               displayMath: [ ['$$\(','\)$$'] ],
               processEscapes: true

    The back slash escapes the next character, therefore displayMath: [ ['$$\(','\)$$'] ], has to be read as "$$(" as the opening string an ")$$" as the closing string.

    "Inline math" has to be escaped with "$(" and ")$".

    If you want it to only use the "$$" it should work with displayMath: [ ['$$','$$'] ],

Sign In or Register to comment.