ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

LaTeX labels not rendering in the ipywidgets controls

Open orome opened this issue 1 year ago • 5 comments

Description

LaTeX labels not rendering in the ipywidgets controls in my JupyterLab notebook?

For me, this

r=widgets.FloatSlider(min=1, max=4, step=0.02, value=3.08, continuous_update=True, description='$r$'), 
steps=widgets.IntSlider(min=2, max=500, step=1, value=20, continuous_update=True, description='$n_{max}$'),  
x0=widgets.FloatSlider(min=0.1, max=1.0, step=0.1, value=0.1, continuous_update=True, description='$x_0$'), 
...

results in: Screenshot 2023-10-09 at 3 17 12 PM

FWIW I get the same behavior (no rendering as LaTeX) when I enter the example from the docs in my notebook, and the example in the docs themselves don't work either, (though the older docs render fine).

See related forum question.

Reproduce

The simplest way to reproduce is:

  1. Navigate to the relevant section of the current docs
  2. Note that the LaTeX doesn't render

Expected behavior

LaTeX should render as specified in controls

Context

  • ipywidgets version: 8.1.1
  • Operating System and version: macOS 14.0, iOS 7.0.3
  • Browser and version: Safari 17.0, Firefox 118.0.2, Chrome 117.0.5938.149
Troubleshoot Output
$PATH:
	/Users/Orome/Documents/Projects/Coding/Python/venvs/logisticmap/bin
	/usr/local/MacGPG2/bin
	/opt/homebrew/opt/ruby/bin
	/opt/homebrew/opt/[email protected]/libexec/bin
	/Applications/Araxis Merge.app/Contents/Utilities
	/opt/homebrew/bin
	/opt/homebrew/sbin
	/Users/Orome/.cabal/bin
	/usr/local/bin
	/usr/bin
	/bin
	/usr/sbin
	/sbin
	/Users/Orome/bin
	/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
	/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
	/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
	/opt/X11/bin
	/Library/Apple/usr/bin
	/usr/local/MacGPG2/bin
	/Library/TeX/texbin
	/Applications/Little Snitch.app/Contents/Components
	/opt/homebrew/lib/ruby/gems/3.2.0/bin
	/opt/homebrew/opt/ghc@9/bin

sys.path: /Users/Orome/Documents/Projects/Coding/Python/venvs/logisticmap/bin /opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python312.zip /opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12 /opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload /Users/Orome/Documents/Projects/Coding/Python/venvs/logisticmap/lib/python3.12/site-packages

sys.executable: /Users/Orome/Documents/Projects/Coding/Python/venvs/logisticmap/bin/python

sys.version: 3.12.0 (main, Oct 2 2023, 12:03:24) [Clang 15.0.0 (clang-1500.0.40.1)]

platform.platform(): macOS-14.0-arm64-arm-64bit

which -a jupyter: /Users/Orome/Documents/Projects/Coding/Python/venvs/logisticmap/bin/jupyter /opt/homebrew/bin/jupyter

pip list: Package Version ------------------------- --------- anyio 4.0.0 appnope 0.1.3 argon2-cffi 23.1.0 argon2-cffi-bindings 21.2.0 arrow 1.3.0 asttokens 2.4.0 async-lru 2.0.4 attrs 23.1.0 Babel 2.13.0 backcall 0.2.0 beautifulsoup4 4.12.2 bleach 6.1.0 certifi 2023.7.22 cffi 1.16.0 charset-normalizer 3.3.0 comm 0.1.4 contourpy 1.1.1 cycler 0.12.0 debugpy 1.8.0 decorator 5.1.1 defusedxml 0.7.1 executing 2.0.0 fastjsonschema 2.18.1 fonttools 4.43.1 fqdn 1.5.1 idna 3.4 ipykernel 6.25.2 ipympl 0.9.3 ipython 8.16.1 ipython-genutils 0.2.0 ipywidgets 8.1.1 isoduration 20.11.0 jedi 0.19.1 Jinja2 3.1.2 json5 0.9.14 jsonpointer 2.4 jsonschema 4.19.1 jsonschema-specifications 2023.7.1 jupyter_client 8.3.1 jupyter_core 5.3.2 jupyter-events 0.7.0 jupyter-lsp 2.2.0 jupyter_server 2.7.3 jupyter_server_terminals 0.4.4 jupyterlab 4.0.6 jupyterlab_server 2.25.0 jupyterlab-widgets 3.0.9 kiwisolver 1.4.5 MarkupSafe 2.1.3 matplotlib 3.8.0 matplotlib-inline 0.1.6 mistune 3.0.2 nbclient 0.8.0 nbconvert 7.9.2 nbformat 5.9.2 nest-asyncio 1.5.8 notebook 7.0.4 notebook_shim 0.2.3 numpy 1.26.0 overrides 7.4.0 packaging 23.2 pandocfilters 1.5.0 parso 0.8.3 pexpect 4.8.0 pickleshare 0.7.5 Pillow 10.0.1 pip 23.2.1 platformdirs 3.11.0 prometheus-client 0.17.1 prompt-toolkit 3.0.39 psutil 5.9.5 ptyprocess 0.7.0 pure-eval 0.2.2 pycparser 2.21 Pygments 2.16.1 pyparsing 3.1.1 python-dateutil 2.8.2 python-json-logger 2.0.7 PyYAML 6.0.1 pyzmq 25.1.1 referencing 0.30.2 requests 2.31.0 rfc3339-validator 0.1.4 rfc3986-validator 0.1.1 rpds-py 0.10.4 Send2Trash 1.8.2 six 1.16.0 sniffio 1.3.0 soupsieve 2.5 stack-data 0.6.3 terminado 0.17.1 tinycss2 1.2.1 tornado 6.3.3 traitlets 5.11.2 types-python-dateutil 2.8.19.14 uri-template 1.3.0 urllib3 2.0.6 wcwidth 0.2.8 webcolors 1.13 webencodings 0.5.1 websocket-client 1.6.3 widgetsnbextension 4.0.9

Command Line Output
Exceeds post size limit...
Browser Output
Paste the output from your browser Javascript console here.

If using JupyterLab

  • JupyterLab version: 4.0.6
Installed Labextensions
JupyterLab v4.0.6
/Users/Orome/Documents/Projects/Coding/Python/venvs/logisticmap/share/jupyter/labextensions
        jupyter-matplotlib v0.11.3 enabled OK
        @jupyter-notebook/lab-extension v7.0.4 enabled OK
        @jupyter-widgets/jupyterlab-manager v5.0.9 enabled OK (python, jupyterlab_widgets)

orome avatar Oct 10 '23 14:10 orome

I think there must have been some kind of fairly general regression here. Unless I'm delusional, the following simple case should lead to rendered mathjax, and it currently doesn't (jupyterlab 4.0.6 with default mathjax 3 renderer, ipwidgets 8.1.1):

import ipywidgets
ipywidgets.HTMLMath(value=r"$x_y$")

(edit: changed delimiters, but I've tried with all delimiters)

Further edit: looks like this is the same issue as https://github.com/jupyter-widgets/ipywidgets/issues/3829

rawlins avatar Oct 12 '23 12:10 rawlins

Possibly also related to https://github.com/jupyter-widgets/ipywidgets/issues/2253 Have the same issue!

xEverth avatar Nov 21 '23 21:11 xEverth

Just tested with the snippet above and can confirm everything is working as expected with JupyterLab 4.1.2

image

Please let me know if you can still reproduce.

ibdafna avatar Feb 20 '24 07:02 ibdafna

Great, on update I can confirm that I'm no longer seeing this with my snippet either, or other simple cases I've checked.

rawlins avatar Feb 25 '24 16:02 rawlins