Opened 5 years ago

Last modified 2 years ago

#8758 assigned defect

Doesn't work with MathJax v1.1

Reported by: Dave Matthews Owned by: kisielk
Priority: normal Component: TracMathJaxPlugin
Severity: normal Keywords:
Cc: xancorreu@… Trac Release: 0.11


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

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?

Attachments (1) (3.0 KB) - added by helend 5 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 5 years ago by kisielk

  • Status changed from new to assigned

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

comment:2 Changed 5 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.

The HTML reads

<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 5 years ago by anonymous

  • Cc xancorreu@… added; anonymous removed

comment:4 Changed 5 years ago by…

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 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  = "";

  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 2 years ago by rjollos (previous) (diff)

comment:5 Changed 5 years ago by helend

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

Changed 5 years ago by helend

comment:6 Changed 4 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 4 years ago by anonymous

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

comment:8 Changed 4 years ago by kisielk

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:

Add Comment

Modify Ticket

as assigned The owner will remain kisielk.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.