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.

Wrong convertion LaTEX-code to MathML

See original GitHub issue

Describe the bug: The LATEX-code are converted to MathML wrong, although by visually all OK. The correct MathML is needed to read math formulas by screen-readers.

To Reproduce: Steps to reproduce the behavior:

  1. Try to type the difficult LaTEX-formula which contains, for example, log or trigonometric function. My example is: $${\log_{\sqrt{11}} 121}^2$$
  2. see the source MathML-code (not a visual picture of the formula).

Expected behavior: I should get something about this: <math> <msup ><mrow ><msub ><mi>log</mi><msqrt ><mn>11</mn></msqrt></msub><mo>⁡</mo><mn>121</mn></mrow><mn>2</mn></msup></math> But I get such MathML: <math ><msup ><mrow ><msub ><mo><mi>log</mi><mo>&#x2061;</mo></mo><msqrt ><mn>11</mn></msqrt></msub><mn>121</mn></mrow><mn>2</mn></msup><mrow encoding = "application/x-tex"></mrow></math> Environment (please complete the following information):

  • KaTeX Version: latest (the problem is relevant even or your demo)
  • Device: laptop, but the problem is relevant for all devices.
  • OS: Windows 10, iOS 14
  • Browser: Chrome, mobile safari
  • Version: Chrome 86, Safari 14

Additional context:

The log and other functions shouldn’t be wrapped into <mi></mi> tags as it is interpreted incorrectly by different MathML-readers (such as MathPlayer). The wrong convertion of LaTEX-code breaks an accessibility The problems almost at all formulas with log or trigonometric functions. Also in some situations, for example, there is an excess subscript, and so on.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

2reactions
ronkokcommented, Oct 15, 2020

@Futyn-Maker Thank you for the comment. I believe that this MathML can be written in more than one way and still meet the W3C spec for MathML. So we want to write the version that works in both visible browsers and in screen readers. I’ve volunteered quite a lot of time in the last year to cleaning up KaTeX’s MathML and your feedback tells me that I have some more work to do.

So here is what is going to happen next. I’m going to go work up a modification of KaTeX. Maybe a couple different versions. I’ll put the output up on a test page somewhere and then I’ll come back here, give you the URL, and ask you to tell me how they work. When we get something that works properly for all viewers readers, then I’ll turn in a PR to this repository.

Give me a couple of days. I’ve got some other things on my plate right now.

0reactions
Futyn-Makercommented, Oct 17, 2020

Yes, it seem that all OK. The operator name are spoken correctly. The MathML code which generated the Access8Math addon in NVDA is following (it can bit differ of original KaTEX-code): <math ><munder ><mrow ><mi>asin</mi><mo>⁡</mo></mrow><mi>y</mi></munder><mi>x</mi><mrow encoding = "application/x-tex"></mrow></math>

Andrey

Read more comments on GitHub >

github_iconTop Results From Across the Web

mathjax - LaTeX to MathML conversion: tools, limitations, and ...
The disadvantage of MathML is poor browser support, which is practically non-existent (apart from Firefox, but it's not perfect). Fortunately, Mathjax can be ......
Read more >
From LaTeX to MathML
And TeX4ht is a tool for converting LATEX input into hypertext document, ... MathML code, or may even refuse to open a file...
Read more >
converting tex commands (latex) to mathml - Stack Overflow
You can use it to convert an HTML page containing TeX code to one containing MathML instead using the page2mml command in the...
Read more >
Converting LaTeX to MathML: the Tralics algorithms - CiteSeerX
are images obtained by converting pieces of the XML document via TEX and tools ... characters into MathML code, and the algorithm it...
Read more >
Converting LaTeX to MathML: the Tralics algorithms - Hal-Inria
Converting LaTeX to MathML: the Tralics algorithms ... characters into MathML code, and the algorithm it uses in order to get a correct...
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