I have followed instructions in mathjax's README.txt, i.e. install "Libraries" module, created "public_html/libraries" and extracted MathJax distribution in there (renamed to MathJax), but for some reason mathjax module is still using the CDN version of MathJax.

Furthermore, the URL used for the CDN is still using the default mathjax's "config=..." value, rather than the one I put in "modules/mathjax/module" and "modules/mathjax/config/install/mathjax.settings.yml" files.

So, there are two bugs here:

1. Why is CDN used when I specify in Drupal configuration NOT to use it?

2. Why is the hardcoded CND URL used even when I overwrite it with a different value? So, it must be stored somewhere other than the above two locations as well (that would be a very broken design, so I am sure I am wrong. But storing it in _two_ rather than one place is already a bug, so.... :)

Also, I created an issue about not showing equation numbers yesterday, but it still doesn't show up in "My issues" in Dashboard or in the list of open issues. I wonder why? When I create issues on github they always show up instantly (and I have been a Linux kernel developer for 20+ years, so I dare hope it is not some kind of "anti-spam" verification that is taking so long to verify who I am....)

Btw, concerning the equation numbers: I have figured out that it is the absence of

<script type="text/x-mathjax-config">
       MathJax.Hub.Config({
          TeX: { equationNumbers: { autoNumber: "AMS" } }
       });
    </script>

in the header that is causing it. But how do I add a JavaScript code to a specific "node" in Drupal so that equation numbers show up?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tigran.aivazian created an issue. See original summary.

tigran.aivazian’s picture

UPDATE: I found a solution for the "missing equation numbers" problem --- one just needs to DISABLE CKeditor and use <script> tag instead of <code> and then everything works fine. Also, it kills two birds: i.e. the awful formatting of the text disappears as well (i.e. lumping everything in one long paragraph), so the equations can be edited later easily. So, the problem is just in the documentation which mentions the <code> tag which doesn't work. Also, it should be mentioned that CKeditor shouldn't be used as it is not really needed (when creating websites one should enter html code so the full knowledge of all HTML5 tags is a requirement anyway).

But the bug about using CDN when configured NOT to still remains.

cilefen’s picture

It has probably been broken a while. Apparently, not a lot of people use this feature. Try this.

cilefen’s picture

It definitely needs a cache clear if that value is changed. We can probably devise a more targeted way, but this works for now.

tigran.aivazian’s picture

Thank you, I will try your patch and will let you know if it works!

tigran.aivazian’s picture

Unfortunately, your patch does not seem to work. I applied it correctly, made sure that my MathJax distribution is in public_html/libraries/MathJax (so the url '/libraries/MathJax/MathJax.js' is valid), then deleted all caches in the browser and cookies as well, just in case. Then restarted the browser and accessed the same page --- it still says:

<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

when I view the page source in the browser.

So, the code in "modules/mathjax.module" seems to be ignored and hardcoded CDN URL is used somehow.

Does Drupal have a concept of "shutdown and restart" --- I assumed that it does not, i.e. it is not a daemon, but a stateless entity (set of php scripts) which is only executed when the user contacts the web server via web browser. But if I need to somehow instruct Drupal to do something to "refresh" itself with the new state of mathjax module, please let me know and I'll do it.

Also, the "MATHJAX TEST" page (the one showing quadratic equation's solution) keeps using CDN as well.

tigran.aivazian’s picture

Btw, in modules/mathjax/config/install/mathjax.settings.yml the value of use_cdn variable was 1, even though Drupal Configuration showed the option to use CDN unchecked.

So, I changed the value of use_cdn to 0 and it still doesn't work, i.e. it keeps using CDN.

tigran.aivazian’s picture

UPDATE: It works now --- what I had to do was to UNINSTALL the "Libraries" module. I didn't realise that the removal of mention of Libraries in README.txt file implied that this module should be uninstalled :)

The only strange thing is that it is still using the 'config=TeX-AMS-MML_HTMLorMML' option even though I have specified 'config=TeX-AMS_CHTML'. But this is no big deal, so I reverted it to 'TeX-AMS-MML_HTMLorMML' as it has approximately the same speed of rendering anyway...

Thank you very much for fixing this problem!

cilefen’s picture

Which patch did you try? Uninstalling a module will have caused a cache-rebuild, I think.

cilefen’s picture

install/mathjax.settings.yml are installation defaults.

By the way:

when creating websites one should enter html code so the full knowledge of all HTML5 tags is a requirement anyway

That does not work for a great many websites that accept anonymous or untrusted content.

  • cilefen committed 3e87699 on 8.x-2.x
    Issue #2841763 by cilefen, tigran.aivazian: Disabling CDN doesn't work
    
cilefen’s picture

Status: Needs review » Fixed

I will add this in the next release.

  • cilefen committed b1d0ed5 on 8.x-2.x
    Issue #2841763 by cilefen: Disabling CDN doesn't work
    
tigran.aivazian’s picture

Btw, in the Administration/Reports section MathJax is still showing two errors in red:

1. Missing JavaScript libraries (MathJax is configured to use local library files but they could not be found. See the README.)

2. Missing libraries module (MathJax is configured to use local library files but the libraries module is not enabled. See the README.)

Both errors are wrong, because:

1. MathJax JavaScript library is installed correctly (as per the README file)

2. The "libraries" module is not only not necessary, but it is imperative that it is NOT installed. If it is installed, then it should be uninstalled --- otherwise MathJax in local mode will not work.

cilefen’s picture

It would seem at a glance you are running only the older patch on this issue, or, did not download the new release of this module.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.