ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

Latex labels not rendering if no Markdown cells in Jupyter lab

Open tiagopereira opened this issue 6 years ago • 2 comments

I'm trying to use Latex labels in widgets in jupyter lab, but after trying the exact same commands as in a tutorial notebook, it didn't work for me:

from ipywidgets import IntSlider, Label
Label(value=r'\(e=mc^2\)')

This will return \(e=mc^2\) instead of the rendered Latex version. After some digging, I found that this only happens if there are no markdown cells in the notebook or in any other notebook in the same directory. This seems very puzzling. If in the same directory I have any other notebook with markdown in at least one cell, this problem doesn't happen.

This only happens in jupyter lab, jupyter notebook works as expected. Not sure whether to bring this issue here on at jupyterlab.

My versions:

ipywidgets                7.2.1                    py36_1    conda-forge
jupyter_client            5.2.3                      py_1    conda-forge
jupyter_core              4.4.0                      py_0    conda-forge
jupyterlab                0.32.1                   py36_0    conda-forge
jupyterlab_launcher       0.10.5                   py36_0    conda-forge

tiagopereira avatar Jul 23 '18 12:07 tiagopereira

After some digging, I found that this only happens if there are no markdown cells in the notebook or in any other notebook in the same directory.

Wow, you have saved my life! I wonder how did you end up observing this peculiarity. Anyway, thanks so much!

sjoycode avatar Apr 21 '20 16:04 sjoycode

Not sure the perculiarity with no markdown cells still applies. Here is a screenshot taken straight from the Ipywidgets online docs where markdown cells are present in the notebook, and it's not rendering the math: Screenshot at 2023-08-22 13-00-38

And yes, I am seeing the same in my local notebook.

ipydatawidgets            4.3.2              pyhc268e32_0    conda-forge
ipykernel                 6.25.1             pyh71e2992_0    conda-forge
ipywidgets                8.1.0              pyhd8ed1ab_0    conda-forge
jupyter_client            8.3.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.3.1           py310hff52083_0    conda-forge
jupyterlab                4.0.5              pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.8              pyhd8ed1ab_0    conda-forge

nvaytet avatar Aug 22 '23 11:08 nvaytet