local mathjax in visual studio help

95 views
Skip to first unread message

David Carlisle

unread,
Dec 13, 2012, 6:04:22 AM12/13/12
to mathja...@googlegroups.com
Has anyone got a (local) mathjax install to work for MicroSoft Visual
Studio 2010 help?

he help system introduced there is basically a http server on
localhost with the files packaged in a simple zip file. However to
make things interesting the web server rewrites URLs all over the
place.

If the zip file has top level directories html and mathjax

a file html/file.html that does

<script type="text/javascript" src="mathjax/MathJax.js">

does load MathJax.js but the URL as seen in the browser is

http://127.0.0.1:47873/help/1-2920/ms.help?content/NAG/store/NagLibrary.mshc;/mathjax/MathJax.js

with the numbers 1-2920/ and potentially the port number not being
known in advance until the zip file is registered on the client's
machine help server.

Looking in firebug I got a bit lost but basically after loading a
couple of files mathjax fails to find its component javascript files
and no rendering happens. Note that the path to the main mathjax file
is already in the ? query part of the URL so relative links to deeper
files get broken.

I'm aiming to use a local (2.0 but 2.1 or anything that works:-)
MathJax restricted to MathML input and HTML/CSS output using system
installed STIX fonts, currently using the config at the end which
seems to work on local files (and classic chm help files).

For such a restricted configuration, how feasible would it be to get
all needed javascript into a single file (not asking that someone do
it, just asking if it is worth trying or if it is doomed to failure)


David

Current config:



<script type="text/x-mathjax-config">
MathJax.Hub.Config({
config: [],
jax: ["input/MathML","output/HTML-CSS"],
extensions: ["mml2jax.js","MathZoom.js"],
showMathMenu: false,
"HTML-CSS": {
availableFonts: ["STIX"],
preferredFont: "STIX",
webFont: null,
imageFont: null
},
MMLorHTML: {
prefer: {
MSIE: "HTML",
Firefox: "HTML",
Opera: "HTML",
Safari: "HTML",
Chrome: "HTML",
other: "HTML"
}
}
});
</script>

Davide Cervone

unread,
Dec 13, 2012, 6:45:16 AM12/13/12
to mathja...@googlegroups.com
David:

Try the following configuration:

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
root: "/mathjax",
jax: ["input/MathML","output/HTML-CSS"],
extensions: ["mml2jax.js","MathZoom.js"],
showMathMenu: false,
"HTML-CSS": {
availableFonts: ["STIX"],
preferredFont: "STIX",
webFont: null,
imageFont: null
}
});
</script>

This sets the root directory explicitly, so avoids MathJax keeping the
rewritten URL as part of its root. Also, you don't need the MMLorHTML
section since you aren't loading the MMLorHTML configuration file (nor
a combined configuration file that includes it).

I've used the top-level "/mathjax" address here, even though your
example uses "mathjax/MathJax.js" from the file "html/file.html",
which doesn't seem right to me (that should look for "html/mathjax/
MathJax.js"). If your example is correct, then you may need to use

root: "mathjax",

instead, but it sems wrong to me.

Davide

David Carlisle

unread,
Dec 17, 2012, 10:38:33 AM12/17/12
to mathja...@googlegroups.com
On 13 December 2012 11:45, Davide Cervone <dp...@union.edu> wrote:
> I've used the top-level "/mathjax" address here, even though your example
> uses "mathjax/MathJax.js" from the file "html/file.html", which doesn't seem
> right to me (that should look for "html/mathjax/MathJax.js"). If your
> example is correct, then you may need to use


That is the issue really, as the http server rewrites _all_ URLs to the form

http://127.0.0.1:47873/help/1-1100/ms.help? very long list of params
including content=path/to/original/file

there is no sensible base URI for relative links to work, as far as
the browser knows every file has the same base URL of
http://127.0.0.1:47873/help/1-1100/ms.help
so all relative links are from the root of the server.

So in my initial example <zip archive>/mathjax/mathJax is found, but
when mathjax tries to load files below extensions or jax/input it gets
lost (not that I blame your code for that:-)

You'd think in a format that is a zip archive of html files,
generating cross document links would be easy:-)

David

--
http://dpcarlisle.blogspot.com/

Davide Cervone

unread,
Dec 17, 2012, 5:54:09 PM12/17/12
to mathja...@googlegroups.com
Did you try setting the root property like I suggested? MathJax
doesn't use relative URL's so it should always produce ones that are
based from the root. Usually it figures that out from the initial URL
from which it was loaded, but you can set it explicitly as I did in
the example configuration that I provided. I think that should work
for you. If not, can you say what URL's are being produced for the
files that aren't being found?

Davide
Reply all
Reply to author
Forward
0 new messages