Wrap long mathjax expressions
moorepants opened this issue · 6 comments
Here is a cell that outputs a long sympy expression in rendered latex displayed in a jupyter-sphinx site:
Here is the same notebook opened in jupyter notebook:
The expressions wrap in the notebook but not on the website. I'm not sure what signals mathjax to wrap in jupyter, but it would be nice if that behavior was the same for jupyter-sphinx pages.
Mathjax has some kind of wrap setting: https://stackoverflow.com/questions/15235077/mathjax-word-wrap maybe that's something I need to set in a sphinx config?
I found this https://www.sphinx-doc.org/en/master/usage/extensions/math.html#confval-mathjax3_config, so maybe I just need a config setting.
I also saw this: https://docs.mathjax.org/en/latest/output/linebreaks.html, maybe the notebook uses mathjax 2 and jupyter-sphinx is using version 3?
With default settings latest sphinx indeed uses mathjax 3. An alternative is to use katex, which is easy to configure to wrap long display math via a couple of CSS classes (and which wraps inline math by default).
Overall this seems to be not something that should be fixed on the jupyter-sphinx side.
I wasn't able to figure out the mathjax settings yet in the sphinx config. It seems that the correct mathjax behavior occurs automatically in jupyter notebook, so it would be nice if that behavior matched in jupyter-sphinx. I don't think katex supports enough math to work with sympy (at least that is the last discussion on sympy's list that I remember). I'll keep trying to get the mathjax v3 settings working in sphinx and report back.
With default settings latest sphinx indeed uses mathjax 3.
Does that mean that mathjax 2 is still the default in jupyter notebook?