WeBWorK Main Forum

Where is Mathjax.js ?

Where is Mathjax.js ?

by Lars Jensen -
Number of replies: 14
Hi,

We're installing Webwork on a new test server and MathJax is not working. Images works fine. I noticed that the MathJax script MathJax.js is not present in /opt/webwork/MathJax - I figure this has to be the problem. Are there changes to the setup of Mathjax in webwork 2.15?

Thanks,
Lars.
In reply to Lars Jensen

Re: Where is Mathjax.js ?

by Danny Glin -
Is there anything in that directory? If not, then it's likely that MathJax hasn't been downloaded.

If that is the case, then you can get MathJax as follows:
cd /opt/webwork
git clone https://github.com/mathjax/MathJax.git

If there is some stuff in /opt/webwork/MathJax but not everything, then you can try blowing it away and re-downloading it using the above commands.
In reply to Danny Glin

Re: Where is Mathjax.js ?

by Lars Jensen -
Hi Danny,

As you can see here: https://github.com/mathjax/MathJax there's no MathJax.js in the distribution. The files you see is exactly what I get with git.

After upgrade, many course pages give me utf8 errors, like:

Warning messages

  • Non-fatal warning: file /opt/webwork/courses/m126_jensen/course.conf contains at least one character code which is not valid in UTF-8. (The copyright sign is often a culprit -- use '©' instead.)
  • While this is not fatal you should fix it
Is there an easy fix?

Thanks,
Lars.
In reply to Lars Jensen

Re: Where is Mathjax.js ?

by Glenn Rice -
You need to edit course.conf and change the invalid UTF-8 form of the copyright symbol to '©' as the message says. That is not related to MathJax at all, but is due to WeBWorK changes in version 2.15 to use multibyte characters.
In reply to Lars Jensen

Re: Where is Mathjax.js ?

by Glenn Rice -
You also need to make sure that you are on the legacy-v2 branch of MathJax. WeBWorK no longer works with the master branch. So once you clone MathJax using the command that Danny gave, then run "git checkout legacy-v2". This is now needed for all versions of WeBWorK.

We have an issue to upgrade WeBWorK to use the newer version of MathJax. See https://github.com/openwebwork/webwork2/issues/1013
In reply to Glenn Rice

Re: Where is Mathjax.js ?

by Lars Jensen -
Hi Glen,

Thanks! This fixed both of my issues.

Lars.
In reply to Lars Jensen

Re: Where is Mathjax.js ?

by Lars Jensen -

....well, not quite....

mathjax is still acting up. I can only see math rendered with mathjax in the Library Browser. Once I view a published set, or look at it in the editor, mathjax is not rendering the math expressions.

Any ideas?

Thanks,
lars.
In reply to Lars Jensen

Re: Where is Mathjax.js ?

by Glenn Rice -
I am not sure what else could be going wrong.

Are you getting any errors when the page loads? What does your browser's javascript console show? To open the console hit F12 and select Console in the top of the side or bottom bar for Chrome or Firefox. Look in the menus for the console for Safari (I am not sure where).
In reply to Glenn Rice

Re: Where is Mathjax.js ?

by Lars Jensen -
Hi Glenn,

Thanks! The error in the console says:

Failed to load resource: the /webwork2_files/mathjax/es5/tex-mml-chtml.js:1

server responded with a status of 404 (Not Found)

The es5 directory is in the MathJax directory after getting it with git clone, but it disappears after I do git checkout legacy-v2 on the directory.

Lars
In reply to Lars Jensen

Re: Where is Mathjax.js ?

by Glenn Rice -
"es5/tex-mml-chtml.js" is not part of MathJax version 2, and so will disappear when you switch to the legacy-v2 branch. It isn't needed and Webwork does not use the file.

You haven't changed the variable $webworkURLs{MathJax} in your localOverrides.conf file to point to that file instead have you? I don't know why you would, but just checking possibilities.

You didn't by chance look through the forks of webwork on github and switch to one of those (like the update-mathjax branch in my fork) that switches to MathJax version 3? This is even less likely.

This may be some odd issue that clearing the browser cache may resolve.

I am just fishing here. I am not sure what has happened on your system.


In reply to Lars Jensen

Re: Where is Mathjax.js ?

by Danny Glin -
Have you restarted apache since you checked out MathJax v2? It's possible that some of the apache processes still have MathJax v3 loaded.
In reply to Lars Jensen

Re: Where is Mathjax.js ?

by Glenn Rice -
I thought about this some more, and I think my first idea that you must have changed the value of $webworkURLs{MathJax} in the localOverrides.conf file is probably correct. Check that file and make sure that the value is

$webworkURLs{MathJax} = "$webworkURLs{htdocs}/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full";

That should be around line 240 of the file /opt/webwork/webwork2/conf/localOverrides.conf.

Make sure to restart apache2 after changing that line back to make the setting take effect.

After looking at the webwork2 code I realized that the library browser does not use that variable. It instead uses a hardcoded value (although it probably shouldn't). However, the rest of the code does use the value. So that is why the problems in the library work, but the rest don't. Since your javascript console is showing that the webwork page is requesting the file /webwork2_files/mathjax/es5/tex-mml-chtml.js you must have at some point changed the variable to use that file instead.
In reply to Glenn Rice

Re: Where is Mathjax.js ?

by Lars Jensen -
Hi Glenn,

Thank you so much. You were absolutely right. I had forgotten that had changed the line in localOverrides pointing to MathJax in an attempt to make things work, and I had left the line changed after I went to the legacy-v2 branch of MathJax. Everything is good after I changed that line back to its default form.

Lars.
In reply to Glenn Rice

Re: Where is Mathjax.js ?

by Nicholas Jacob -

I am working on a new WW server and have gotten so far along but seem to have hit this same road block.  I followed the instructions here and have the legacy version of MathJax running.  I am getting a different error though, a mixed content error...

Blocked loading mixed active content “http://156.110.194.114:8080/webwork2_files/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full

Chrome and Safari won't load any equations but Firefox will let you load images but not MathJax.

I cannot seem to find anybody else having my mixed content issues...

TIA

In reply to Nicholas Jacob

Re: Where is Mathjax.js ?

by Nicholas Jacob -
And of course I figured it out moments later!

https://webwork.maa.org/wiki/Installing_from_WW2.15_Ubuntu20.04_Server_Virtual_Machine_Image#Trouble_with_SSL_certificates

Fail at using the forums!