MathJax does not work if loaded from local js file or if source code is included

I am testing the javascript MathJax library in a local HTML file. It works and correctly displays math formulas if I include:

script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' 

in the HTML file, but it does not work if I include instead:

 script type="text/javascript" src="/path_to/mathjax.js" 

or even if I put all the javascript source code. What is the reason? I need to load mathjax.js from a local js file into a local HTML file, so the first method doesn't help me. (EDIT- I see an error: failed to load /extensions/MathZoom.js )

+6
source share
2 answers

I had to download the entire MathJax distribution (17 Mb zip file), deploy it and put the right configuration line in the HTML file. Final form: script type = 'text / javascript' src = '/path_to/MathJax/MathJax.js? config = TeX-AMS-MML_HTMLorMML, local / local '

+11
source

This can happen for two reasons.

1. You may not have extracted the entire zip folder, so do this first.

However, you get an error for the second reason.

2. You do not mean the file correctly. eg:

 <script type ="text/javascript" src="pathto\mathjax.js"> 

You have entered an invalid file name. The correct file name is MathJax.js.Given below is the correct path.

 <script type ="text/javascript" src="pathto\mathjax.js"> 

MathJax.js is the name of the file in the extracted folder (if not changed)

If all this does not work, then refer to the script as follows:

 <script type="text/javascript" src="Pathto/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> 

The reason your script is not working is because you are not including:

? Config = TeX-AMS-MML_HTMLorMML

+2
source

Source: https://habr.com/ru/post/955342/


All Articles