Skip to content

Commit

Permalink
fix: use HTML math for slider description
Browse files Browse the repository at this point in the history
Math mode in ipywidgets doesn't render well when using LaTeX dollar
signs for math mode. HTML math mode \(\) works well both in Jupyter
notebook and in HTML.
  • Loading branch information
redeboer committed Aug 4, 2021
1 parent da323a7 commit 009ddb4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/symplot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def create_slider(symbol: sp.Symbol) -> Slider:
>>> create_slider(sp.Symbol("n", integer=True))
IntSlider(value=0, description='$n$')
"""
description = f"${sp.latex(symbol)}$"
description = fR"\({sp.latex(symbol)}\)"
if symbol.is_integer:
return IntSlider(description=description)
return FloatSlider(description=description)
Expand Down

0 comments on commit 009ddb4

Please sign in to comment.