HTMLMath widget in JupyterLab doesn't render LaTeX until MathJax has been loaded externally
See original GitHub issueIn the process of adding MathJax / LaTeX support to the plotly.py ipywidget, I realized that JupyterLab doesn’t seem to automatically initialize MathJax the way the classic notebook did. I was able to reproduce this same situation using the built-in HTMLMath
widget.
Steps to reproduce
- Launch a fresh JupyterLab instance
- Create a new notebook
- Create and display an
HTMLMath
widget that contains LaTeX. It will display in raw form (not typeset) - Create and evaluate a markdown cell that contains LaTeX
- Repeat step (3) and the output will be typeset as expected.
Here is a screenshot of the end-result of this process
Is it possible for a widget (or a general JupyterLab extension for that matter) to request that JupyterLab perform its MathJax initialization?
This is also something I’d like to add to the plotly mime type renderer (https://github.com/jupyterlab/jupyter-renderers/tree/master/packages/plotly-extension) and chart editor (https://github.com/plotly/jupyterlab-chart-editor) extensions, so let me know if this is a discussion we should move somewhere else. Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
Also seeing the same. I have some Latex in widgets to produce plots. Is there any way to initialise Mathjax without using a markdown cell? It would be nice if my widgets could run properly in new notebooks, not needing the users to markdown cells.
Hmm… I possibly have an unrelated issue? Or not. Google brought me here after all.
I have to use the following:
then it renders my text. Otherwise I get strings, including opening notebooks from other people with Latex.
I have to then use:
display(Math(latex(e)))
And then it sends that to the renderer.
But tex just sitting there? Nope.