Closed JMSS-Unknown closed 5 years ago
More related errors
\lim_{x\to\infty}
gives
Invalid markup: Incorrect number of children for <munder/> tag.
I tried reproducing these using the MacOS version of Firefox but wasn't able to. Could you paste the MathML markup that you're seeing when you get these errors?
For \log_{10}\left(x\right)
<span class="katex-mathml">
<math>
<semantics>
<mrow>
<msub>
<mi>log</mi>
<mo></mo>
<mn>10</mn>
</msub>
<mrow>
<mo fence="true">(</mo>
<mi>x</mi>
<mo fence="true">)</mo>
</mrow>
</mrow>
<annotation encoding="application/x-tex">\log_{10}\left(x\right)</annotation>
</semantics>
</math>
</span>
It seems to be caused by the empty mo
tag.
I extracted it to a new page to get:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
Equation:
<span class="katex-mathml">
<math>
<semantics>
<mrow>
<msub>
<mi>log</mi>
<mo></mo>
<mn>10</mn>
</msub>
<mrow>
<mo fence="true">(</mo>
<mi>x</mi>
<mo fence="true">)</mo>
</mrow>
</mrow>
<annotation encoding="application/x-tex">\log_{10}\left(x\right)</annotation>
</semantics>
</math>
</span>
</body>
</html>
With the mo
tag I get invalid-markup
, without it the log
renders correctly.
I don't expect that the mo
tag is actually empty. It should have an invisible character, U+2061 (⁡
), inside it. This is intentional (though arguably it should be after the <msub>
...).
However, I'm also unable to reproduce the error, using Firefox 63.0.3 on Windows. Could it be caused by a plugin? Can you try in a private window?
The error still occurs in private browsing with all extensions disabled. I also just tried it on another computer and the error did not show up. Seems like it has something to do with my setup.
The error shows up if you select CSS under filter output in the console. Is this an issue?
With that instruction, I can reproduce the error. It seems to happen with \log_5 x
but not \log x
.
Ah, I see the issue now. <msub>
is supposed to have only two children, but in this example, it has 3. This is caused by op
's MathML builder returning a document fragment: https://github.com/KaTeX/KaTeX/blob/f71f469d4b3ca97654702a0807e736d176f4c4c5/src/functions/op.js#L251-L263
I think we need to modify supsub
's MathML builder to wrap a fragment in an mrow
, in this line: https://github.com/KaTeX/KaTeX/blob/f71f469d4b3ca97654702a0807e736d176f4c4c5/src/functions/supsub.js#L204
Alternatively, we need to bring the ⁡
outside of the subscript...
We could also do some sanity checking out the MathML nodes we're outputting to make sure we're conforming to things like expected child count.
Alternatively, we need to bring the ⁡ outside of the subscript...
I think that'd probably be preferable if it isn't too tricky.
Closed via #1890.
I am also getting this error message on one of my files. Unfortunately, it's so big that I can't really pinpoint where the error might be coming from (and everything seems to be rendering fine, but my console is just blowing up with a lot of these errors). Is there any way to maybe track down what's causing this?
@thosgood Try binary search. Delete half the file/equations, and see if some errors persist. If it doesn't, remove the other half. Repeat until the file is small. Assuming it's a different cause, open a new issue for it.
But you should also check which version of KaTeX you're using, in case it's earlier than #1890. katex.version
should tell you.
For me this error happened with log_10
@Tobychidi Are you using the latest KaTeX?
@Tobychidi Are you using the latest KaTeX?
I think I have installed the latest version. The problem could be that Mathlive which is a formula input library is internally using an older version. Will check that.
Typing
\log_{10}\left(x\right)
into the preview at katex.org results in the errorInvalid markup: Incorrect number of children for <msub/> tag.
Same with\log^{10}\left(x\right)
I am using Firefox 63.0.3 on Windows. The error does not occur on Chrome or Edge.