P5music
P5music

Reputation: 3327

MathJax not working if loaded from local js file or if the source code is included

I am testing the MathJax javascript library in a local HTML file. It works and correctly renders 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 doesn't work if I include instead:

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

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

Upvotes: 13

Views: 8035

Answers (2)

coder
coder

Reputation: 906

This may occur due to two reasons

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

Still you are getting the error look into second reason.

2.You are not referring to the file correctly. eg:

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

You have typed an incorrect filename. Correct name of file is MathJax.js.Given below is the correct way.

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

MathJax.js is the name of the file in the extracted folder(unless modified)

If all of this is not working,then link to the script in this way:

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

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

'?config=TeX-AMS-MML_HTMLorMML'

Upvotes: 5

P5music
P5music

Reputation: 3327

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

Upvotes: 12

Related Questions