liffiton / dokuwiki-plugin-mathjax

MathJax plugin for DokuWiki
https://www.dokuwiki.org/plugin:mathjax
12 stars 11 forks source link

mhchem extension broken #39

Closed TheManchineel closed 3 years ago

TheManchineel commented 3 years ago

I want to add chemical formulas and equations to my Wiki. I'm using the MathJax plugin with the following configuration:

MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ["$","$"], ["\\(","\\)"] ],
        displayMath: [ ["$$","$$"], ["\\[","\\]"] ],
        processEscapes: true
    },
    TeX: {
        equationNumbers: {autoNumber: "AMS"},
        extensions: ["AMSmath.js","AMSsymbols.js","mhchem.js","noErrors.js","noUndefined.js"]
    }
});

However, it seems that the plugin isn't working quite properly: when, for example I type a reaction with text above the arrow like so: $\ce{Zn_{(s)} + Cu^{2+}_{(aq)} ->[{H_2O}] Zn^{2+}_{(aq)} + Cu_{(s)}}$ I get this: https://imgur.com/aSubnbH

while in reality I should be getting this, as rendered by KaTeX with mhchem in Joplin: https://imgur.com/8kBdNMx

And this isn't the only odd behavior. Another example: <=> renders as "⇔" while instead it should render as "⇌".

Does anyone have an idea why mhchem is "working" but not quite with MathJax?

liffiton commented 3 years ago

It appears to be caused by some substitutions added by this commit. That was claimed to be part of supporting latex export in the LaTeXit plugin, but considering it in light of this issue, I'm not sure the substitutions are needed or correct.

I'll remove those substitutions and release a new version of the plugin.

Thanks for the report!

TheManchineel commented 3 years ago

@liffiton confirming that this was fully fixed with the new release. Thanks a lot!

liffiton commented 3 years ago

Great! Thanks for the confirmation.