MathJax + Trac Integration

34 views
Skip to first unread message

Jan Schmidt

unread,
Sep 5, 2011, 10:11:15 AM9/5/11
to MathJax Development
Hi,

I postet a simular message to MathJax Users.

since the revision 1.1 no default configuration is used anymore.
This is a problem for trac, because the url gets encodet (? to %3F and
= to %3D).

This results in en Error 403 Forbidden from MatJax.js

There is also a ticket for trac

http://trac-hacks.org/ticket/8758

but nobody seems to work on it.

The problem is, that I cannot force trac to put any other script than
type text/javascript into the html-header. Nor is it possible to
write
script-code directly into the header. I have
to put the code into an extra file und load this like mathjax.js with

<script type="text/javascript" source="config.js"> </script>

The only part I can change from within a Trac-plugin is the part after
source=

So it's not possible to set the configuration like recommendet

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
config: ["TeX-AMS_HTML.js"],
jax: ["input/TeX"]
});
</script>

I played a long time with that and till now its not working. The only
way is to give the config-file in the way like '?config=default'.

But Trac encodes the url and that does MatJax not like.

I'm not an javascript-freak and the code of mathjax.js is not really
readable (for me) and so I cannot write a fix for that. But I think,
the
parse-arguments-function has only a little bit to modified.

Maybe it is possible to ship an extra version of mathjax.js (e.g.
'mathjax-default-config.js' using the default.js as configuration file
and
not displaying the warning message?

Can anyone help me?

Thanks in advance!
Jan

Davide P. Cervone

unread,
Sep 6, 2011, 7:35:56 AM9/6/11
to mathj...@googlegroups.com
I have responded to your original posting at

http://groups.google.com/group/mathjax-users/browse_thread/thread/4224949f7944888e

in the mathjax users forum.


> This results in en Error 403 Forbidden from MatJax.js

See my response above. This is because the server isn't able to get
the file Trac is asking for. (MathJax is not being loaded and run on
your page, and so MathJax can't solve the problem for you.)

> But Trac encodes the url and that does MatJax not like.

It's not MathJax that doesn't like it, it is the server that doesn't
like it, because it means you are asking for a file that doesn't exist.

> I'm not an javascript-freak and the code of mathjax.js is not really
> readable (for me) and so I cannot write a fix for that. But I think,
> the parse-arguments-function has only a little bit to modified.

Unfortunately that won't do it. See response linked above.

> Maybe it is possible to ship an extra version of mathjax.js (e.g.
> 'mathjax-default-config.js' using the default.js as configuration file
> and not displaying the warning message?

The default.js file was intended as a file you could edit to modify
the configuration you wanted to use. Now that MathJax is served from
the CDN, you don't have access to edit default.js, and it doesn't make
sense to load a configuration file you can't configure.

I have suggested a method you can use to overcome this problem
yourself in the message above. See if that doesn't work for you. It
will take a little bit of javascript. You might find

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

to be helpful in figuring out how to insert the script node dynamically.

Davide

Jan Schmidt

unread,
Sep 9, 2011, 5:31:46 AM9/9/11
to MathJax Development


On 6 Sep., 13:35, "Davide P. Cervone" <d...@union.edu> wrote:
> I have responded to your original posting at
>
>        http://groups.google.com/group/mathjax-users/browse_thread/thread/422...
>
> in the mathjax users forum.
>
> > This results in en Error 403 Forbidden from MatJax.js
>
> See my response above.  This is because the server isn't able to get  
> the file Trac is asking for.  (MathJax is not being loaded and run on  
> your page, and so MathJax can't solve the problem for you.)

Your right. The 403 comes from the Apache. Here it means:

"The given path contained wildcard characters: access denied"

I could try mod_rewrite...

> I have suggested a method you can use to overcome this problem  
> yourself in the message above.  See if that doesn't work for you.  It  
> will take a little bit of javascript.  You might find
>
>        http://www.mathjax.org/docs/1.1/dynamic.html
>
> to be helpful in figuring out how to insert the script node dynamically.

That's the better way. It works. Thanks a lot!

jan

Davide P. Cervone

unread,
Sep 9, 2011, 5:05:31 PM9/9/11
to mathj...@googlegroups.com
>> I have suggested a method you can use to overcome this problem
>> yourself in the message above. See if that doesn't work for you. It
>> will take a little bit of javascript. You might find
>>
>> http://www.mathjax.org/docs/1.1/dynamic.html
>>
>> to be helpful in figuring out how to insert the script node dynamically.
>
> That's the better way. It works. Thanks a lot!

Great. Glad you were able to get it to work. If there is a Trac forum where you could post your solution, that might help others with the same issue. You can also post your final solution here, for others to reference, if you want.

Davide

Reply all
Reply to author
Forward
0 new messages