question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mathml output usage in browser

See original GitHub issue

TeXZilla 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 &InvisibleTimes; or &pi;. 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:closed
  • Created 4 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
arnogcommented, May 20, 2019

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.

0reactions
arnogcommented, Mar 12, 2020

I can’t reproduce it. Could you write up a new issue with a code sample showing what you see vs. what you expect?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authoring MathML - MDN Web Docs
This page explains how to write mathematics using the MathML language, which is described with tags and attributes in text format.
Read more >
How to View MathML Equations in HTML Output
MathJax is a solution to properly view MathML equations embedded in HTML content in a variety of browsers.
Read more >
MathML Support — MathJax 3.2 documentation
MathJax uses MathML as the basis for its internal format for mathematical ... the results in Safari and Firefox are not always comparable...
Read more >
Browser to Display MathML code instead of equation
PS: Rendering MathML to view as plain text gives the TeX output. For example,. The axis on which the point (0,4) lie, is...
Read more >
The MathML Interface - W3C
Second, in the case of HTML/XHTML, MathML rendering must be integrated into browser software. Some browsers already implement MathML rendering natively, and one ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found