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.

Katex does not parse but MathJax does

See original GitHub issue

So we have an equation with _ (underscores) in the name like:

\text{Score} = 2\times\text{(Protein_(g))}  -  0.75\times\text{(Lipid_Tot_(g))}

And in mathjax it renders it just fine (url). However as seen if one uses https://khan.github.io/KaTeX/, Katex yields this error:

KaTeX parse error: Expected '}', got '_' at position 37: …s\text{(Protein_̲(g))} - 0.75\…

Do we know why, and if so should we fix Katex or is mathjax wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
kevinbarabashcommented, Sep 1, 2018

@pkra thanks linking to the relevant MathJax issue. I’m glad to hear that you’re considering making this configurable in v3. In the interest of improving interoperability KaTeX could add the current MathJax behaviour and make it configurable as well. For KaTeX though, I think we’d probably want to make our current behaviour the default. The rationale being that there’s probably more TeX code in the world that relies on the TeX behaviour than than the current MathJax behaviour.

2reactions
pkracommented, Sep 1, 2018

A relevant issue would be https://github.com/mathjax/mathjax-v3/issues/135.

Before going all xkcd#386, you might consider that are valid reasons to avoid text mode (e.g., it is essentially a different layout system, also incompatible with CSS). Some are mentioned at https://docs.mathjax.org/en/latest/tex.html#differences.

If you are interested in thinking about the larger community, you might consider starting a discussion on the W3C MathOnWeb community group to work towards better compatibility across TeX-like conversion tools. (Disclaimer: I co-chair the CG.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Issues - KaTeX
KaTeX does not support the align environment because LaTeX doesn't support align in math mode. The aligned environment offers the same functionality but...
Read more >
MathJax and KaTeX working in HTML but not ... - Stack Overflow
But when I try the following code in Javascript it doesn't work: document.getElementById("output").innerHTML = "$$ \int f(x)dx $$". Why is ...
Read more >
Syntax Extensions - MyST-Parser
Math is parsed by adding to the myst_enable_extensions list option, ... be parsed if there are no initial / final spaces, e.g. $a$...
Read more >
MathJax Frequently Asked Questions
Mathematics is not rendering properly in IE. How do I fix that?¶ ... First, please open the MathJax homepage at www.mathjax.org in IE...
Read more >
katex - npm
Make sure to include the CSS and font files, but there is no need to include the JavaScript. Like render , renderToString throws...
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