using version 3.0.1, using "_processEscapes_" set to "_true_" stops MathJax from working, giving the error "TypeError: Q.setAttribute is not a function". The folloowing is the minimal example that I tested:
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width">
<title>MathJax v3 with TeX input and SVG output</title>
<script>
MathJax = {
tex: {
inlineMath: [['$', '$']],
processEscapes: true
},
svg: {fontCache: 'global'}
};
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
</head>
<body>
<h1>MathJax v3 beta: TeX input, HTML output test</h1>
<p>
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
\$equation\$
</p>
</body>
</html>
I can reproduce the issue and am looking into it. Thanks for the report.
Thanks, it was working properly in the previous 3.0.0 version if it helps
It turns out to be the new assistive-mml
extension that was causing the problem. I've made a pull request to fix the issue. Thanks for reporting it!
Here is a patch that you can use for now until the next release. Add this to your MathJax configuration:
MathJax = {
startup: {
pageReady() {
const options = MathJax.startup.document.options;
const BaseMathItem = options.MathItem;
options.MathItem = class FixedMathItem extends BaseMathItem {
assistiveMml(document) {
if (this.display !== null) super.assistiveMml(document);
}
};
return MathJax.startup.defaultPageReady();
}
}
};
This patches the MathItem
class to not do the assistive MathML call if the item is an escaped character.
thanks a lot, it worked ...
I already had ready: function(){...}
for introducing Persian digits and defining getAllJax
function, adding this new piece of code after that block of code seemingly works with no problem ...
Hello,
I'm also facing this issue. I can confirm that the workaround brings back the typesetting, but a lot of error messages pop up in the console (same with setting processEscapes to false):
Is this expected from the workaround? The input tested can be found here: https://pastebin.com/raw/48veiAsx
Works with 3.0.0 but not 3.0.1. I can also confirm that setting processEscape
to false
seems to fix the issue (but then we can't have $ anymore).
Thank you @dpvc for providing a workaround AND a fix! :)
Now waiting for next release!
~Nico
PS: congrats and thanks for all the work done for 3.0!
@NicolasCARPi, the error messages you are getting are actually a different issue. The units of mu
are specific to TeX, and are supposed to be converted to em
s before they are passed to the internal MathML representation. It looks like the extensible arrows (e.g., \xrightarrow
) aren't translating these properly. I'll open a separate issue for that.
@dpvc I know that asciimath is not finished in v3 yet but while your patch fixes the error there is weird behaviour in ascimath. \$ used as masciimath delimiters are not escaped.
jsbin: https://jsbin.com/rokixumiwi/edit?html,output
@KyrietS, The TeX and AsciiMath input jax operate independently, and so the TeX input jax is unaware of the AsciiMath delimiters that you have specified. So both the TeX input jax and AsciiMath input jax think they are to process the \$
(TeX to escape it, and AsciiMath to use it as a delimiter). In fact, both do process it (the a + b
in your jsbin is typeset by AsciiMath and the dollar signs around it are processed by TeX).
One solution would be to disable the escape processing of the TeX input jax. Add
processEscapes: false
to the tex
section of your configuration to do that.
@dpvc Thank you. I apologise for my ignorance. I didn't know that:
docs: the default for processEscapes has changed from
false
in version 2 totrue
in version 3.
@KyrietS, no problem.
Most helpful comment
Here is a patch that you can use for now until the next release. Add this to your MathJax configuration:
This patches the
MathItem
class to not do the assistive MathML call if the item is an escaped character.