panel icon indicating copy to clipboard operation
panel copied to clipboard

Show param docstrings with LaTeX rendering

Open angusivory opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe.

I’m using a pn.Param() object which shows my parameters as inputs with the docstring visible on hover - but my docstrings contain LaTeX text and are not being rendered properly.

Describe the solution you'd like

Is there a way to to get these docstrings to format correctly (e.g. in example_param = param.Number(label="example", doc=r"an example of $LaTeX$ formatting, $\frac{1}{2}$"), how to get this to render correctly in the GUI?

Describe alternatives you've considered

I am aware of pn.pane.LaTeX but this does not interact with pn.Param objects unfortunately.

Additional context

latex_panel_issue

angusivory avatar Aug 07 '24 08:08 angusivory

Could you try if adding pn.extension('mathjax') or pn.extension('katex') solves your problem?

MarcSkovMadsen avatar Aug 07 '24 12:08 MarcSkovMadsen

Unfortunately doesn't work - i've had pn.extension('katex', 'mathjax', notifications=True) in my code for a while, and LaTeX panes show up fine - they just don't support Param objects, hence no formatting for docstrings or labels.

angusivory avatar Aug 08 '24 08:08 angusivory

This will probably require a change in Bokeh to allow LaTeX rendering in the tooltips. Thoughts @mattpap?

philippjfr avatar Aug 08 '24 09:08 philippjfr

Yes it will, but it would be even better if it "just worked" in all relevant contexts without the need for intervention everytime.

mattpap avatar Aug 08 '24 13:08 mattpap

any workarounds? it would be good to have this solved. Also unicode characters in names or labels are not displayed correctly either. You can use them for attribute names but then the gui displays a "^" character.

class Sky(param.Parameterized):
    name = param.String(default='Sky',)
    λ_min = param.Number(default=1.0, doc=r"$$\lambda_{min}~[μm]$$")

This won't display correctly in the panel.

chaffra avatar Jul 29 '25 16:07 chaffra