Search In
• More options...
Find results that contain...
Find results in...

# Help with MathJax

You could also use their CDN instead:

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

Seems to work just fine: http://jsfiddle.net/unb9yvhL/

## Recommended Posts

Posted · Original PosterOP

Hello there,

I am writing a program (Javascript and HTML), where I write a formula based on user inputs.

I input the script in the <head>, and I used the link provided by the MathJax website.

But I can not get MathJax to work. I get this error:

"Unexpected Text node".

HTML

 <math id="p">Y=[C]^c*[D]^d/[A]^a*[B]^b[/itex]

I am using JavaScript to edit the above formula, to different strings the user inputs.

I think I might just have misunderstood how MathJax works enterily.

Any suggestions?

Thanks

##### Share on other sites

How have you installed it?

##### Share on other sites
Posted · Original PosterOP
How have you installed it?

I put a Script tag in the header of the HTML. (Sorry if this post is messed up, tapatalk was not cooperating).

EDIT: I derped. Anyway, I unpacked the download and put it in my project folder, and linked to the MathJax.js file from a <script> tag in the header.

##### Share on other sites

You could also use their CDN instead:

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

Seems to work just fine: http://jsfiddle.net/unb9yvhL/

##### Share on other sites
Posted · Original PosterOP

You could also use their CDN instead:

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

Seems to work just fine: http://jsfiddle.net/unb9yvhL/

You know what? I didn't know about Tex notation until yesterday, and that is why it doesn't work. I am still new to programming and stuff. :-)

EDIT: works perfeclty now. Thanks very much dude:-)

##### Share on other sites
Posted · Original PosterOP

You could also use their CDN instead:

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

Seems to work just fine: http://jsfiddle.net/unb9yvhL/

I was too quick.

The math now works when I load the page. It shows the formula correct and all. But when I input user input from textfields from the HTML, I does not work. I think it is to do with this bit:

MathJax.Hub.Config({  tex2jax: {inlineMath: [['$','$'], ['\$','\$']]}});

Where am I to put this? I have two seperate functions that ae triggered by buttons, where I first declare the var's that get the input from the user, then I put it together in one long straight line, and outputs it via innerHTML. And even if I add the , it still looks as plain HTML.

##### Share on other sites

Just like the docs say that part goes into the head, did you even read it?

<script type="text/x-mathjax-config">MathJax.Hub.Config({  tex2jax: {inlineMath: [['$','$'], ['\$','\$']]}});</script>
##### Share on other sites
Posted · Original PosterOP

Just like the docs say that part goes into the head, did you even read it?

<script type="text/x-mathjax-config">MathJax.Hub.Config({  tex2jax: {inlineMath: [['$','$'], ['\$','\$']]}});</script

I misunderstood. I though it was enough to include it in my main.js, as that is in my <head>, but that was not working perfectly (only somewhat). But thanks I'll try that.