mathml output usage in browser
See original GitHub issueTeXZilla provides a method to create a mathml XML node from a latex string that can be called with const mathmlNode = TeXZilla.toMathML(latex)
.
As I was switching to MathLive for math editing, I was trying to see if I could also use MathLive to convert the equations to MathML and replace TexZilla.
In order to get the mathmlNode, I did this:
const domParser = new DomParser()
const mathmlNode = domParser.parseFromString(
`<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics>${
MathLive.latexToMathML(latex)
}</semantics></math>`,
"application/xml"
).documentElement
This worked to a certain degree. Unfortunately it stumbles on certain mathml character entities, such as ⁢
or π
. The DOM parser returns errors like “Entity ‘pi’ not defined”.
I then compared the output that comes out of TexZilla and MathLive and I noticed that TexZilla uses the standard unicode characters instead of the character entities. Is there a reason why MathLive is producing this kind of output and is there a way to create a node that the browser can read without throwing errors?
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (10 by maintainers)
Top GitHub Comments
That module is going to get moved out of the core MathLive project, but it will still be around, so it’s something still worth addressing. I’ll look at it.
I can’t reproduce it. Could you write up a new issue with a code sample showing what you see vs. what you expect?