As part of an effort to upgrade KaTeX from version 0.9 to the current version 0.11 on www.khanacademy.org we ran an audit of published math content on the site, to compare parse errors using KaTeX 0.11 vs the (currently used) KaTeX 0.9 library version.
We found that that expressions using \begin{alignedat}{at} fail to parse with KaTeX 0.11:
Error: Expected node of type textord, but got node of type mathord
at assertNodeType (katex.js:6124)
at Object.alignedHandler [as handler] (katex.js:10097)
at Object.handler (katex.js:10466)
at Parser.callFunction (katex.js:16537)
at Parser.parseFunction (katex.js:16520)
at Parser.parseGroup (katex.js:16923)
at Parser.parseAtom (katex.js:16370)
at Parser.parseExpression (katex.js:16233)
at Parser.parse (katex.js:16201)
at parseTree (katex.js:17188)
Example:
\begin{alignedat}{at}&1&+&2&=&3\end{alignedat}
In KaTeX 0.9 similar to the following would render:
1​ +​ 2​ =​ 3
ps. I browsed https://github.com/KaTeX/KaTeX/blob/v0.9.0/test/katex-spec.js but did not find test coverage for \begin{alignedat}{at}.
I'm not very familiar with alignedat, but I believe the argument is supposed to be an integer. See e.g. this stackexchange thread. So I think this "regression" actually brings KaTeX more in line with LaTeX. I don't recall the change that would have affected it, though.
Would it be reasonable to replace at with a number (e.g. 9) in your site/tests? Or is this backwards compatibility important? Perhaps we should retroactively update some release notes, at least...
alignedat tests are screenshot only, and in https://github.com/KaTeX/KaTeX/blob/master/test/screenshotter/ss_data.yaml
Thank you for taking a look at this @edemaine, and for the links!
I'll consult with our content team as to the effort required to update all affected content.
We will fix it in the content. Thanks again @edemaine.
Most helpful comment
We will fix it in the content. Thanks again @edemaine.