Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
0 votes

Hi! I recently updated jupyter notebook and jupyter lab, and found out that the latest versions use mathjax3 instead of mathjax2 to render formulas. Their developer promises 80% faster rendering and it's really cool, except that the formulas are now rendered as one line, one very long line. Maybe someone has already dealt with that and managed to fix it?

in General questions by (1.8k points)

1 Answer

0 votes

According to https://docs.mathjax.org/en/latest/output/linebreaks.html, automatic line breaking is not yet implemented in MathJax 3. I do not know if that web page is the current status, but it would explain why formulas do not wrap.

by (86.2k points)

I've found out that when using Cadabra2 in JupyterLab, expressions are rendered via LaTeX using the dmath* environment from the breqn package. However:

MathJax 3 (used in JupyterLab ≥3.0) does not support breqn, resulting in formulas not being rendered correctly (e.g., no line breaks for long equations).

Even with workarounds (e.g., CSS fixes or MathJax config tweaks), the output is suboptimal compared to standard LaTeX environments like align*.

I realize that using breqn is the easiest way to handle long expressions, but when using the latest versions of jupyter these problems occur.

There is line breaking support in MathJax 4.x, which is currently in beta, so the most sensible thing is to wait until Jupyterlab switches to that version. Cadabra uses built-in line breaking of MicroTeX for it's own notebook interface, but that does not lend itself to use in Jupyter.

So push the Jupyter people to switch to Mathjax 4.x, I'd say.

...