Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[blocked until mid 2023, maybe] Switch to supporting Mathjax v4 (instead of katex + mathjax v2, which is what we now use) #4734

Closed
3 tasks done
williamstein opened this issue Jul 11, 2020 · 9 comments

Comments

@williamstein
Copy link
Contributor

williamstein commented Jul 11, 2020

  • See math rendering using katex fallback to mathjax on error no longer works #4733 for why we can never ever switch to "only katex"

  • Right now we use out-of-date Mathjax 2 and katex together, with the motivation for both being entirely "synchronous rendering and speed".

  • If Mathjax 3 also provides "synchronous rendering and (sufficient) speed" and can run on the share server, we should switch to it, for simplicity and predictability (e.g., right now anything that relies on mathjax will just fail to render on the share server, which could seriously annoy and confuse users! Labeling this issue I-bug because this share server issue is a bug).

So:

  • Is MathJax3 sufficiently fast? How does it compare in practice to Katex regarding speed? [yes]
  • Does MathJax3 fully support synchronous rendering (like katex does)? [yes]
  • Does MathJax3 support everything mathjax2 renders? [emphatic no -- missing wrapping]
@williamstein
Copy link
Contributor Author

There's a katex versus mathjax 2 versus mathjax 3 benchmarker here: https://www.intmath.com/cg5/katex-mathjax-comparison.php?processor=MathJax3

It seems to me that katex is about twice as fast as mathjax 3, and mathjax 3 is a bit over twice as fast as mathjax 2.

@williamstein
Copy link
Contributor Author

On the backend for the share server we only use katex, so the only way to make this work would be probably to have to figure out how to use mathjax3 for the share server. I'm less optimistic about that.

@williamstein
Copy link
Contributor Author

Regarding server side:

"If you prefer to render server-side, MathJax version 3 makes that easy as well." see https://www.mathjax.org/#installnow

So yes, I think this is all totally plausible, and maybe not that hard!

@williamstein williamstein self-assigned this Oct 27, 2020
@williamstein williamstein changed the title Consider switching to only using Mathjax 3 (instead of katex + mathjax2, which is what we now use) Switch to only using Mathjax 3 (instead of katex + mathjax2, which is what we now use) Oct 27, 2020
@williamstein
Copy link
Contributor Author

There's a list of things not ported to mathjax 3

For example:

"Currently, automatic line breaking support is missing from version 3. This is a key feature to be included in a future release."

Automatic line breaking is in Mathjax2 and Katex (since 2018), and this is a very critical blocker feature required by our users. So without this, there is absolutely no chance to use Mathjax 3 in CoCalc in any way, shape or form.

There is a discussion ending here, in which line breaking is planned for "early 2020", then slips to "sometime in 2021", and concludes with a user saying:

image

So I'm marking this issue "blocked"/"upstream", and changing the title to 2021 at least.

@williamstein williamstein changed the title Switch to only using Mathjax 3 (instead of katex + mathjax2, which is what we now use) [blocked until 2021] Switch to only using Mathjax 3 (instead of katex + mathjax2, which is what we now use) Oct 27, 2020
@williamstein
Copy link
Contributor Author

Now it is definitely not going to get implemented until 2022 at the earliest: mathjax/MathJax#2312 (comment)

@williamstein williamstein changed the title [blocked until 2021] Switch to only using Mathjax 3 (instead of katex + mathjax2, which is what we now use) [blocked until 2022, at least] Switch to only using Mathjax 3 (instead of katex + mathjax2, which is what we now use) Dec 1, 2021
@williamstein
Copy link
Contributor Author

Line breaking did not get implemented in 2022 in Mathjax v3, but it did get implemented in v4.alpha, so I guess we wait. I'm changing the title again.

@williamstein williamstein changed the title [blocked until 2022, at least] Switch to only using Mathjax 3 (instead of katex + mathjax2, which is what we now use) [blocked until mid 2023, maybe] Switch to supporting Mathjax v4 (instead of katex + mathjax v2, which is what we now use) Jan 26, 2023
@williamstein
Copy link
Contributor Author

See comment here also: jupyterlab/jupyterlab#7218 (comment)

@williamstein
Copy link
Contributor Author

Quote during JupyterLab meeting: "The size of the mathjax v3 package is 20MB, so we lazy load it dynamically." when discussing jupyterlab/jupyterlab#13877

So keep size in mind!

@williamstein
Copy link
Contributor Author

I've decided to just support katex longterm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant