(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "/Content/Js/third-party/mathjax/MathJax.js?config=TeX-AMS_HTML";
var config = 'MathJax.Hub.Config({' +
'"HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"], imageFont: null, preferredFont: "TeX" },' +
'extensions: ["tex2jax.js"],' +
'tex2jax: { inlineMath: [ ["$","$"], ["\\\\(","\\\\)"] ], displayMath: [ ["$$","$$"] ], processEscapes: true, ignoreClass: "tex2jax_ignore|dno" },' +
'TeX: { noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } } }' +
'});' +
'MathJax.Hub.Startup.onload();';
if (window.opera) { script.innerHTML = config }
else { script.text = config }
document.getElementsByTagName("head")[0].appendChild(script);
})();
Even when escaped \$ appears to be rendered via MathJax. Our control phrase is:
"if ten apples cost \$5.00 and six oranges are for \$3.50, how much is ..."You can find this test here: http://meta.math.stackexchange.com/questions/403/texification-is-too-aggressive-or-how-to-enter-a-dollar-sign/1863#1863
I finally figured out what is going on, here. It turns out that your
startup code not only loads MathJax, but also queues a call to
MathJax.Hub.Typeset. That means the page is typeset twice. Normally,
that is not a problem, as the second pass will not find any new math.
But the Typeset method calls both the preprocessors and the output
processor, and that means tex2jax runs over the page a second time.
That may not sound like a problem, but in the case of escaped dollars,
it is. Why? Because the first pass unescapes them (to turn them into
normal dollar signs) and the second then FINDS those dollars and uses
them as delimiters. Whew!
Anyway, the solution is to have tex2jax arrange things so that the
previously escaped dollars are not treated as delimiters on the second
pass. That can be done by having tex2jax enclose the dollars in a
<span> for example, which will prevent the next pass from matching it
with another dollar sign (since tex2jax requires the two delimiters to
be in the same parent element).
I haven't fixed tex2jax yet, but thought I would let you know what the
problem is. It was a challenge to isolate this one (especially since
I was taken down several blind alleys), but it should not be hard to
fix.
Davide
Davide