Opened 6 years ago

Doesn't work with MathJax v1.1

Reported by: Owned by: Dave Matthews Kamil Kisiel normal TracMathJaxPlugin normal xancorreu@… 0.11

Description

If I try using MathJax v1.1 I get the following error message on every Trac page I view:

MathJax no longer loads a default configuration file; you must
specify such files explicitly. This page seems to use the older
default config/MathJax.js file, and so needs to be updated.
This is explained further at

http://www.mathjax.org/help/configuration


If I install MathJax v1.0.1a everything works fine but users are strongly encouraged to update.

I did try a simple change to the line

add_script(req, "/chrome/%s/%s" % (MATHJAX_DIR, MATHJAX_JS))


to add "?config=default" but I couldn't get this to work for some reason.

Would it be possible to upgrade this plugin to work with MathJax v1.1 please?

comment:1 Changed 6 years ago by Kamil Kisiel

Status: new → assigned

Sorry I've been slacking off on this. Planning on working on it this weekend.

comment:2 Changed 6 years ago by al@…

Have the same problem. The reason why just editing to

add_script(req, "/chrome/%s/%s?config=default") % (MATHJAX_DIR, MATHJAX_JS))


is not working is that the ? and = characters are %-masked (urlencoded) when the HTML code is rendered.

<script src="/trac/chrome/MathJax/MathJax.js%3Fconfig%3Ddefault" type="text/javascript"></script>


Is there a mask character to turn off % encoding?

comment:3 Changed 6 years ago by anonymous

Cc: xancorreu@… added; anonymous removed

comment:4 Changed 6 years ago by jan.schmidt@…

The resolution is diskussed here:

There should be shipped a file (i.e. mathjax.js), the user could edit to change the place where mathjax could be reached. This file goes to the place where trac.js is installed.

And in tracmathjax.py the add_script-call is changed to point to that file.

This mathjax.js works for me (0.12).

(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src  = "http://cdn.mathjax.org/mathjax/latest/MathJax.js";

var config = 'MathJax.Hub.Config({' +
'extensions: ["tex2jax.js"],' +
'jax: ["input/TeX","output/HTML-CSS"]' +
'});' +

if (window.opera) {script.innerHTML = config}
else {script.text = config}

})();

Last edited 3 years ago by Ryan J Ollos (previous) (diff)

comment:5 Changed 6 years ago by Bangyou Zheng

I changed the codes of function 'add_script' to mask '?'. This attachment is working for me.

comment:6 Changed 5 years ago by eu@…

Is there a reliable workaround for this bug? I am running Trac 0.12.2 and while the last attachnemt with _add_script(...) used to work fine until recently, now I am getting the warning dialogue from MathJax at every page again. Thanks.

comment:7 Changed 5 years ago by anonymous

I revoke my last ocmment, after some adjustments of the local configuration the attached tracmathjax.py works fine again. Thanks.

comment:8 Changed 5 years ago by Kamil Kisiel

hm, I haven't been receiving emails from TracHacks for some reason so I wasn't aware of the activity on this ticket.

I recently pushed a contributed change that pulls MathJax from the CDN instead of a local install, please give it a try:

Modify Ticket

Change Properties