5

Is there any way to use MathJax in emacs org-mode html export without an internet connection?

I know that MathJax can be downloaded, but when I provide org-html-mathjax-options with the path to MathJax.js, the html file doesn't use MathJax at all.

Any help would be appreciated. Thanks!

Update -- this has been answered.

When in org-html-mathjax-options, set path to /<path-to-mathjax>/MathJax/MathJax.js?config=TeX-AMS_HTM‌​L,local/local

2
  • Interesting I never used MathJax with org-mode. I think... So, thinking out loud, If getting to MathJax.js through the web works, I would try to get to it through a local server. i.e. something like http://localhost/<path-to-mathjax-folder>/MathJax.js (it depends on how the server is set up) Jan 30, 2017 at 20:52
  • @RolazaroAzeveires strangely that does not work. Nor does file:///<path-to-mathjax-folder>/MathJax.js.
    – user14743
    Jan 30, 2017 at 22:07

2 Answers 2

3

This works for me, as a local setting, instead of

#+HTML_MATHJAX:  path:"http://localhost/<path-to-mathjax>/MathJax.js"

use

#+HTML_MATHJAX:  path:"http://localhost/<path-to-mathjax>/MathJax.js?config=TeX-AMS_HTML"

I do not know why, both manuals from emacs and org-mode do not use this config, so any further explanation is welcome. I got there by noting that the default value includes this config option, not a plain path.

According to user14743's comment, in org-html-mathjax-options, set the path to /<path-to-mathjax>/MathJax/MathJax.js?config=TeX-AMS-MML_HTM‌​LorMML,local/local.

I note that file://... does not work either way.

4
  • You just had to put that at the top of your file? I tried and still, strangely, nothing. I'm glad you were able to make it work in principle, at least, even though I can't get it to work over here. That makes me a little optimistic that I can get it set up. I had thought maybe it was due to one of my Firefox extensions, but this failed even after disabling them.
    – user14743
    Feb 1, 2017 at 3:51
  • @user14743, yes. I am not sure what else to suggest... Can you see the MathJax.js file if you use the path in your browser? The path must be the path seen by the local host, not the one on the hard disk. Feb 1, 2017 at 21:58
  • 1
    I'm unable to post an answer for some reason. I can't see the CAPTCHA box so that I can click it and prove I'm a human. Anyway, I was able to solve it. When in org-html-mathjax-options, set path to /<path-to-mathjax>/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML,local/local
    – user14743
    Feb 2, 2017 at 18:14
  • Feel free to update your answer to reflect this and I'll mark it as solved. This will help future people find the answer to this question.
    – user14743
    Feb 2, 2017 at 18:15
1

Thanks for your post. I find this works for me,

#+HTML_MATHJAX:  path:"file:///<path-to-mathjax-folder>/MathJax.js?config=TeX-AMS_HTML"

However, this does not work,

#+HTML_MATHJAX:  path:"http:/localhost/<path-to-mathjax-folder>/MathJax.js?config=TeX-AMS_HTML"

I don't know why. This just provides an alternative way.

3
  • The second version should be http:// not http:/. May be that it is the reason it didn't work for you. Dec 10, 2019 at 13:37
  • I tried both http:// and https://. Neither of them worked.
    – Yujun Li
    Dec 12, 2019 at 10:29
  • I also tried /<path-to-mathjax-foler>/ without file:///. It unexpectedly worked. I tried all of these on a Mac. The third one looks like the version file:///. To get http:// work, it may need some other configurations.
    – Yujun Li
    Dec 12, 2019 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.