-
-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LaTeX Strings in plotly lead to javascript error. #1500
Comments
The problem is that plotly uses MathJax 2, but we are using MathJax 3, and because MathJax does not provide an ES module export, we can only use one version at the same time on one page :( |
It seems that the problem is known over there: plotly/plotly.js#4563 |
I was trying to make recent plotly work in Pluto with latex given the recent support to MathJax 3. It does seem that there is some issue with the global MathJax equations that are rendered before the plot is loaded are correctly rendered also in the plot, but loading the plotly plot then breaks rendering of new symbols even outside of plotly plots (If you try to change the latextring in the cell below to some latex other latex glyph after rendering the plot you get an empty SVG). Finally, it seems that commenting out these lines: Pluto.jl/frontend/common/SetupMathJax.js Lines 63 to 65 in 84574a6
fix the latex rendering issues with plotly. I have seen that the plan might be to migrate to KaTeX directly as in #1998 but I am still tagging @fonsp as he might understand more about this Edit: Adding the notebook code # ╔═╡ 89c83fb6-26a2-466f-bec4-399eceef6070
using LaTeXStrings
# ╔═╡ d65eea4b-da9e-48f0-9763-103cadca0a92
L"$\Psi = 3"
# ╔═╡ 6e3ef160-a833-11ec-0086-973be8405af3
html"""
<div id='graph'>
</div>
<script src="https://cdn.plot.ly/plotly-2.11.1.js"></script>
<script>
Plotly.newPlot('graph', [{
y: [2,1,2],
name: '$\\sigma = 3$',
showlegend: true,
}], {
title: '$\\Psi=3$'
})
</script>
""" |
Hi, using LaTeX strings in plotly.js leads to the following javascript error with MathJax setup:
An MWE in form of a pluto notebook can be found here:
plotly-mathjax-mwe.jl
The same error appears in the Plot.jl sample notebook when
using LaTeXStrings
and plotting with
plot!(years, oranges, label=L"$x^3$".s)
The text was updated successfully, but these errors were encountered: