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.

HTMLMath widget in JupyterLab doesn't render LaTeX until MathJax has been loaded externally

See original GitHub issue

In 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

  1. Launch a fresh JupyterLab instance
  2. Create a new notebook
  3. Create and display an HTMLMath widget that contains LaTeX. It will display in raw form (not typeset)
  4. Create and evaluate a markdown cell that contains LaTeX
  5. Repeat step (3) and the output will be typeset as expected.

Here is a screenshot of the end-result of this process screen shot 2018-10-24 at 6 15 35 pm

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:open
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tiagopereiracommented, Feb 21, 2019

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.

0reactions
altimmonscommented, Sep 10, 2020

Hmm… I possibly have an unrelated issue? Or not. Google brought me here after all.

I have to use the following:

 from IPython.display import display, Math

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

latex jupyter notebook it does not work - Stack Overflow
I had to install Mathjax from a local file to get I to work : download the latest Mathjax.zip; python -m IPython.external.mathjax C:\path\to\ ......
Read more >
Latex equations not rendered in Jupyterlab
I am a new user of jupyterlab and was wondering, do I need to install Mathjax separately. Because when I used to use...
Read more >
Math and equations - Jupyter Book
Jupyter Book uses MathJax for typesetting math in your HTML book build. This allows you to have LaTeX-style mathematics in your online content....
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