Davide
http://s3.amazonaws.com/mathjax/latest/MathJax.js
for now to access MathJax. This will at least get your site up and
running until we straighten out the problem with the CDN.
Davide
On Mar 13, 2012, at 10:51 AM, Hadley Wickham wrote:
Good to see MathJAX returning after the DNS glitch yesterday. Thanks for all the restorative work.
One heartening thing was that we had quite a few error reports from our http://nrich.maths.org users. We have users :)
A couple of things that I'd like to do to make things fallback more gracefully which maybe you can help us with - I'm sure others will have similar needs:
1) We saw some machines replacing the greyed out source TeX with bright red error messages. This I think is new to MathJAX v2. Our users can often make sense of the source TeX, but the red error message obliterates the maths content completely. Is there a way to disable this message?
2) Any thoughts on how to implement a local fallback? We saw a suggestion from Simon Woodhead on this yesterday which looks promising.
> <!-- MathJax: Fall back to local if CDN offline but local image fonts are not supported (saves >100MB) -->
> <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
> <script>window.MathJax || document.write('<script type="text/x-mathjax-config">MathJax.Hub.Config({"HTML-CSS":{imageFont:null}});<\/script><script src="<<PATH_TO_YOUR_LOCAL_MATHJAX>>MathJax.js?config=TeX-AMS_HTML-full"><\/script>')</script>
Many thanks again for a great service.
M
--
Mike Pearson
+44 (0)1223 764244
+44 (0)7752 562977
Millennium Mathematics Project,
Centre for Mathematical Sciences,
University of Cambridge
Cambridge CB3 0WA
Load 2 last extensions (red shows error but as a part of the source code)
extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js","TeX/noErrors.js","TeX/noUndefined.js"],
--
========================
Victor Ivrii, Professor, Department of Mathematics, University of Toronto
http://www.math.toronto.edu/ivrii
Checking back, the red error messages appeared briefly in Firefox when we attempted to use the temporary CDN set up by Peter. So maybe this was more of a glitch than a real issue.
Mike
M
Thanks for the encouraging remarks. Peter and I were both pretty
upset by the downtime yesterday, and regret the trouble it caused you.
> A couple of things that I'd like to do to make things fallback more
> gracefully which maybe you can help us with - I'm sure others will
> have similar needs:
>
> 1) We saw some machines replacing the greyed out source TeX with
> bright red error messages. This I think is new to MathJAX v2. Our
> users can often make sense of the source TeX, but the red error
> message obliterates the maths content completely. Is there a way to
> disable this message?
There are two types of error messages that MathJax will produce. The
first are syntax errors resulting from incorrect TeX (things like
unknown control sequences, missing braces, etc.) These are the ones
that are controlled by the noErrors and noUndefined extensions that
Victor suggested. When these AREN'T used, you would get a red message
on yellow background giving the TeX error that occurred. When they
ARE used, you will get a control sequence in red for an undefined
control sequence, and the original TeX with a black border for other
syntax errors.
You are using the TeX-AMS_HTML configuration which includes these
already, as you can see by opening the About MathJax dialog from the
MathJax contextual menu. So there is no need to add these to your
configuration.
The second type of error is a failure within the MathJax code itself.
Usually this is due to a failure to load one of the MathJax components
(e.g., one of the files doesn't load and MathJax times out waiting for
it). In this case, MathJax puts a red "[Math Processing Error]"
message in place of the mathematics. I suspect this is the one you
are seeing, and it is not affected by the noErrors or noUndefined
extensions. This is used when something is wrong within MathJax
itself. There is no easy way to turn this off (though you can set
what the text of it is). Because this indicates an internal error
occurring within MathJax itself, it is not easy to recover from that.
For example, it may not be possible to put back the original TeX code,
since it is not clear at what point MathJax stopped running.
You mentioned that this occurred for some people with Firefox with the
alternate CDN address that Peter set up, but that it was temporary.
Here is what I think happened. Firefox has a strict same-origin
policy that affects files obtained from a source other than the domain
of the page you are viewing, and they include web-based fonts in that
policy. So the CDN has special access control settings that allow
Firefox to load the MathJax fonts despite this policy. It turns out
that Amazon S3 doesn't process those settings, so Firefox users would
not be able to obtain the web fonts from the alternate CDN. In that
case, MathJax will switch to its image fonts. But as Peter mentioned,
he made the announcement of the alternate CDN before all the image
files were in place (since these are rarely used in most
circumstances). I suspect that your Firefox users were getting
switched over to image fonts, but the needed files weren't yet in
place, and so MathJax failed to load the needed files, and internal
errors occurs when it tried to use the data that those files contain,
causing the "[Math Processing Error]" messages.
> 2) Any thoughts on how to implement a local fallback? We saw a
> suggestion from Simon Woodhead on this yesterday which looks
> promising.
>
>> <!-- MathJax: Fall back to local if CDN offline but local image
>> fonts are not supported (saves >100MB) -->
>> <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML
>> "></script>
>> <script>window.MathJax || document.write('<script type="text/x-
>> mathjax-config">MathJax.Hub.Config({"HTML-CSS":{imageFont:null}});<
>> \/script><script src="<<PATH_TO_YOUR_LOCAL_MATHJAX>>MathJax.js?
>> config=TeX-AMS_HTML-full"><\/script>')</script>
This looks reasonable, but it does require a second installation
somewhere, either a local one of your own, or another public
location. I haven't tried it out, but it looks good.
Davide
I thought about reserved server but it means a lag: MJ waits ***every
time*** for CDN to fail. May be better to have a local script
MathJaxFriend.js with a menu which configures where MJ is loaded from?
Victor
Right. It requires that at least MathJax.js is loaded in order to get
the red messages. If MathJax.js doesn't load, then none of MathJax
actions will be taken.
> I thought about reserved server but it means a lag: MJ waits ***every
> time*** for CDN to fail. May be better to have a local script
> MathJaxFriend.js with a menu which configures where MJ is loaded from?
I think it depends on the type of failure that occurs. The original
author's suggestion was to handle the case where the CDN is not
available at all. In that case, the secondary server will kick in and
make MathJax available. It will not wait for a MathJax timeout, since
MathJax will not be running. The suggested method does NOT do
anything about the case where MathJax.js is loaded, but then some
other component is unavailable. In that case, you would most likely
get the red "[Math Processing Error]" messages if the files where
MathJax's javascript files, or bad output if the files were the font
files.
Whether MathJax needs to wait for a timeout is also somewhat
complicated and depends on what is going wrong. If the MathJax.js has
been loaded and some other javascript file is unavailable, then most
browsers will receive an error (not a timeout), and will call the
onerror handler, so MathJax will know immediately that the file can't
be loaded and so will fail immediately. It is usually only if the
file contains some run-time error (so that it either doesn't compile
or doesn't run to completion) that MathJax will wait for that to
happen and eventually time out.
In the case yesterday, however, the CDN did not return an error
condition immediately, because it was itself waiting for mathjax.org
to respond to it, and so the CDN only returned the 504 error after
some delay. I don't know how long that delay is, and whether
MathJax's internal timeout was longer or shorter than that, but it
would cause MathJax to fail the same in either case. That is a rather
unusual circumstance (where the server itself doesn't know immediately
whether it will be able to ship the file).
You could certainly include a menu if you wanted to.
Davide
You are right, this was the message we were seeing, and I think you analysis of the situation is correct.
Mike