Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
ibbadib

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>

Just put it in your <head>

 

There is more info here: http://mathjax.readthedocs.org/en/latest/start.html

 

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</math>

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

Link to post
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.

Link to post
Share on other sites
Posted · Best Answer

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>

Just put it in your <head>

 

There is more info here: http://mathjax.readthedocs.org/en/latest/start.html

 

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

Link to post
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>

Just put it in your <head>

 

There is more info here: http://mathjax.readthedocs.org/en/latest/start.html

 

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:-)

Link to post
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>

Just put it in your <head>

 

There is more info here: http://mathjax.readthedocs.org/en/latest/start.html

 

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.

Link to post
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>
Link to post
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.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Buy VPN

×