Using a local configuration file with the CDN

22 views
Skip to first unread message

saf....@gmail.com

unread,
Apr 30, 2016, 12:07:08 AM4/30/16
to MathJax Users
How can we use the path of a local configuration file on our hard drive while using CDN? I'm using the instructions from this MathJax document section to try including test.js configuration file from my computer (Windows 8.1) but the configuration used in the test.js does not work. I've the following script tag in my html file:

<script type="text/javascript"
</script>

I tried the following format for local path also but it doesn't work either: file:///C:/MathJax/Examples/test.js

Content of test.js file:

MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
      processEscapes: true
    }
  });

If I include the above MathJax.Hub.Config(....) content inside my htm file (using another script tag - of course) the math expressions inside $...$ will parse successfully. But if I used the local file test.js instead, MathJax ignores $...$ expressions. It seems local configuration file needs to have URL of a local web server. I thought file:///C:/MathJax/Examples/test.js would be standard URL for a local file Thanks..Saf

Peter Krautzberger

unread,
May 2, 2016, 11:52:01 AM5/2/16
to mathja...@googlegroups.com
Hi,

As noted in the documentation, a configuration file needs a loadComplete call; MathJax will wait for 15 seconds before timinig out.

I don't know if you run into security problems with a local file name like that -- the developer console should give information if the file gets loaded.

You might want to use a plain-JS configuration method (explained on the same documentation page), simply loaded before MathJax.js.

Regards,
Peter.

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

saf....@gmail.com

unread,
May 3, 2016, 6:44:35 PM5/3/16
to MathJax Users
Thanks for the direction. It's working now. Two things I observed:
  1. file:///C:/MathJax/Examples/test.js format for local file URL works but not C:\MathJax\Examples\test.js (that makes sense)
  2. Configuration inside test.js do work even without calling loadComplete at the end of test.js but, in that case, Math parsing does not start until after 15 seconds. With loadComplte call inside test.js, Math displays right away.
-Saf
Reply all
Reply to author
Forward
0 new messages