Modify

Opened 4 years ago

Last modified 2 months 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

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?

Attachments (1)

tracmathjax.py (3.0 KB) - added by helend 3 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 3 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 3 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 3 years ago by anonymous

  • Cc xancorreu@… added

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

The resolution is diskussed here:

http://www.mathjax.org/docs/1.1/dynamic.html

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"]' +
               '});' +
               'MathJax.Hub.Startup.onload();';

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

  document.getElementsByTagName("head")[0].appendChild(script);
})();
Last edited 2 months ago by rjollos (previous) (diff)

comment:5 Changed 3 years ago by helend

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

tracmathjax.py

Changed 3 years ago by helend

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

https://bitbucket.org/kisielk/tracmathjaxplugin/changeset/7f4e31322263

Add Comment

Modify Ticket

Action
as assigned The owner will remain kisielk.
Author


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

 
Note: See TracTickets for help on using tickets.