Math Rendering not working
I upgraded today and found MathJax is not rendering equations. I do the preview (from File menu) in Marked 2 and the equations are rendered. I open in Multimarkdown Composer (from File menu) and equations are rendered but equation numbering is not (probably old version and not configured for equation numbers). Preferences for all three apps (nvUltra, Marked 2, Multimarkdown Composer) were set to render math expressions in MathJax. In Marked I could even put in a reference to equation 1. I don't see a way to attach file so I'll just paste it here
```
```
-
Those equations seem to work fine for me with MathJax (with the usual MathJax caveats -- always do full reload after changing the text, ensure that MathJax is linked.)
As usual, KaTeX works better for the equations it supports in terms of live refresh, but it does not support all of the examples that you include.
What specifically isn't working for you?
0 -
I found the problem and can reproduce. The original file had 2 blank lines at the very beginning. I removed them and the equations showed up. I put them back and the equations were still there. I saved the file, quit nvUltra and opened the app again and the equations did not show up.
Actually, I tested again and just removing one of the blank lines worked.
There may still be a problem on my side, I am still looking at preferences.
I was hoping to export the file as HTML but the only way seems to be copy as HTML but that does not put in the link to MathJax script. And the File>Export Preferences just bring up a save menu. Also, because numbering equations is not enabled for MathJax the one reference call comes up "The equation ??? ...".
0 -
1. Leading blank lines in a file will cause changes if your file has metadata in it, but otherwise won't change how a file is processed. (What you pasted doesn't have metadata, but perhaps the original did??) I don't see a difference with/without blank lines with the sample you sent and doubt that is actually significant here (assuming no metadata in the file). If you still think it is, please send me the exact file (not copy/paste).
2. nvUltra doesn't support file exporting (it works on folders and has a different focus). MultiMarkdown Composer supports converting files into different output formats (e.g. HTML, etc.)
3. Export Preferences does just that -- it exports your preferences so that you can send the file to us for special debugging/testing when requested. For simple debugging in the forums, a screenshot is often easier and allows for other users to see what is going on as well.
As for MathJax 2->3, I just tried again to get v3 working properly and it just didn't seem to want to. The docs suggest that v3 is not feature complete yet. Combine that with the fact that KaTeX has much better support for live updates to the preview, and just seems to work (except when it doesn't....), and I still use KaTeX for my infrequent usage.
When I compare built-in MathJax using nvUltra (2.7.7 from Cloudflare), MultiMarkdown Composer 4.5 (2.7.2 from Cloudflare), MultiMarkdown Composer 5 (2.7.7 from Cloudflare), and Marked 2 (not sure what version), it all works the same, EXCEPT that Marked 2 doesn't support the equations inside "AlignAt". As you note, none of them support `The equation $\ref{energy_mass_eq}$`.
KaTeX 0.13.20 from jsdelivr.net (Composer 5 and nvUltra) supports some but not all equations. Built-in KaTeX in Marked 2 doesn't support any of them.
Exporting to HTML with the same versions of KaTeX and MathJax, and opening them in Chrome gives the same results. As does opening them in Safari.
At this point, I still can't find an error with nvUltra's handling of this. There are clearly limitations within KaTeX and MathJax, but there is nothing I can do about that. MathJax 3 may or may not support additional features, but thus far I have not been successfully able to get it to work, and until it is feature complete I'm not sure it makes sense to do so. Usage statistics on the CDN suggest that v2 is far more commonly used, it appears.
0 -
Just was looking at another older file that had math expressions. Did not edit the file yet but changed back and forth between KaTeX and Mathjax, restarting nvUltra each time. KaTeX rendered expressions it could but Mathjax did not render any of the math expressions. There seems to be something odd with how Mathjax is started up. Refreshing Preview screen did nothing however changing the CSS file caused the math expressions to be rendered.
0 -
Oh, but I changed back to Github CSS the math equations go back to being unrendered!
0 -
Oops - now changing the CSS is not working.
0 -
I hope this link works.
https://www.dropbox.com/s/mkz0bkozemf0e6s/ReadMe.md?dl=0
This is the file I am using where using Mathjax does not render math expressions with the exception of changing Preview CSS (but this is random, sometime Math equations are rendered and other times they are not). Using KaTeX renders just the equations it can (remember, KaTeX is not as complete as Mathjax).
0 -
When using MathJax and typing, do you see the "Processing Math" flash in the lower left corner of the preview? It does for me, which indicates that MathJax is running. To the best of my understanding, my "job" is to get MathJax to run. It's up to MathJax to actually do its job of formatting the math. My experience with MathJax is that it is good for formatting HTML once, but not repeatedly (e.g. while editing.)
With Mathjax, if I toggle the preview off and on (sometimes twice) it works.
KaTeX has always been better at "live updating", and it works for me (with the exception of things KaTeX does not cover).
As for changing the CSS, I don't think there is anything special about the CSS. But changing it does cause a full reload of the preview, just like toggling it on and off.
Also -- take a look at the new Composer beta -- https://multimarkdown.zendesk.com/hc/en-us/community/topics/4606065324051-MultiMarkdown-Composer-Beta
The only obvious difference between Composer and nvUltra right now, is that Composer *seems* to do better at applying MathJax every time I toggle preview off/on (but still not 100%). That is presumably something I can try to replicate in nvUltra.
But I'm not sure that anything else about MathJax is within my control.
(One more thought -- if you edit the file while the preview is closed, you will likely have to toggle it on/off twice -- the first time you turn it on, it does run an update to catch the changes since the last time the preview was on.
0
Please sign in to leave a comment.
Comments
8 comments