miranov25 / RootInteractive

4 stars 12 forks source link

LaTeX Formatting Not Working in RootInteractive dashboard with Bokeh 3.0.2+ #350

Open miranov25 opened 5 months ago

miranov25 commented 5 months ago

Issue: LaTeX Formatting Not Working in RootInteractive with Bokeh 3.3.2

Description: After updating to Bokeh version 3.3.2, which supports LaTeX formatting, we've encountered an issue in RootInteractive where LaTeX formatted strings are not rendered correctly. It appears that the rendering mechanism in RootInteractive might not be compatible with Bokeh's new LaTeX rendering method.

Example: When using a LaTeX formatted string for an axis title in RootInteractive, like so:

"dyCorr1.AxisTitle": r"$$\deta_{y1}$$ (cm)"

Possible Cause:

It seems there might be a need for an update or modification in RootInteractive to align with Bokeh's updated LaTeX rendering capabilities.

Request:

Guidance or suggestions on how to resolve this issue would be very helpful. If there are any known workarounds or planned updates to address this compatibility issue, please let us know.

miranov25 commented 5 months ago

Example plot from Bokeh tutorial is working well:

https://docs.bokeh.org/en/3.0.2/docs/user_guide/styling/mathtext.html `` Bokeh uses the MathJax library to handle LaTeX and MathML. See the official MathJax documentation for more information on MathJax.''

from numpy import arange, pi, sin

from bokeh.models.annotations.labels import Label
from bokeh.plotting import figure, show

x = arange(-2*pi, 2*pi, 0.1)
y = sin(x)

p = figure(height=250, title=r"\[\sin(x)\text{ for }x\text{ between }-2\pi\text{ and }2\pi\]")
p.circle(x, y, alpha=0.6, size=7)

label = Label(
    text="$$y = \sin(x)\$$",
    x=150, y=130,
    x_units="screen", y_units="screen",
)
p.add_layout(label)

p.yaxis.axis_label = r"\[\sin(x)\]"
p.xaxis.axis_label = r"\[x\pi\]"

show(p)
image
miranov25 commented 3 months ago

Temporary solution - adding figure with latex in first place

This issue was fixed for a moment in the template in recent pull request #351 It is not yet generic solution, therefore not yet closing