Jump to content

Help with MathJax

Go to solution Solved by Cheesebaron,

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/

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 comment
https://linustechtips.com/topic/287637-help-with-mathjax/
Share on other sites

Link to post
Share on other sites

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 comment
https://linustechtips.com/topic/287637-help-with-mathjax/#findComment-3912088
Share on other sites

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

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 comment
https://linustechtips.com/topic/287637-help-with-mathjax/#findComment-3913059
Share on other sites

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

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 comment
https://linustechtips.com/topic/287637-help-with-mathjax/#findComment-3913226
Share on other sites

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

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 comment
https://linustechtips.com/topic/287637-help-with-mathjax/#findComment-3914370
Share on other sites

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

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 comment
https://linustechtips.com/topic/287637-help-with-mathjax/#findComment-3916560
Share on other sites

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

×