PlotlyJS.jl icon indicating copy to clipboard operation
PlotlyJS.jl copied to clipboard

support LaTeX titles by adding :include_mathjax option

Open hhaensel opened this issue 5 years ago • 0 comments

I recently committed an :include_mathjax option for the plotly() backend in plot and wondered, whether I could reuse my experience for PlotlyJS and its respective Backend in plots. This is, what I ended up with. This probably solves #60 and #325, at least partly.

WebIO currently does not support registering of directories with its dep2url routine and has some missing Windows support, which I addressed in https://github.com/JuliaGizmos/WebIO.jl/pull/417

Meanwhile, I used AssetRegistry directly to work around this problem.

Usage: add include_mathjax = <mathjaxpath> to the Layout options. mathjaxpath can be either "cdn", "local" (which looks whether mathjax is installed with IJulia) or a direct link to a mathjax file (local or remote).

Unfortunately, I couldn't find a way to implement this for the plot pane. MathJax only works, if the mathjax source is included in the head tag. I have experimented with a script that appends MathJax to the header after document was loaded, but that version also only worked for the Blink display, so I chose to use this version, which is somehow cleaner. Maybe, someone else can help? Example:

plot(scatter(y=[2,3]), Layout(xaxis_title="\$\\Gamma\$", include_mathjax = "cdn"))

or from the Plots plotlyjs() backend

plot(1:2, include_mathjax="cdn", extra_kwargs = :plot, xlabel = "\$\\Gamma_1\$")

hhaensel avatar Jun 02 '20 15:06 hhaensel