Math not displaying properly in static HTML Pluto Notebook

When I export a Pluto Notebook to HTML the math is not rendered. I am wondering why. Anyone with the same problem?
An example:

Could you help a bit with

  1. Where does the math not render correctly?
  2. How did you export this, with the HTML export button directly in Pluto?

Concerning 1, for example this part

looks totally fine for me. This is inline text, so if you do no put \displaystyle upfront the sum, this is what it looks like. But LaTeX-wise this is correctly rendered

1 Like

In several PC I have already tried, what I see is:

Even in display math mode, some blocks are apparently not rendered through Matjax but something else:

If I run the Notebook everything is fine. So, the problem is exclusively with the static HTML version.

Interesting, since exactly the same work in my Safari (Mac OS) maybe check whether the MathJAx/KaTeX is loaded correctly in your browser?

I have an easy solution; just add to your code:

using PlutoPlotly

The solution is simple and @disberd must know why. But I do not!

After adding using PlutoPlotly, I get this in the HTML rendering: perfect LaTeX

Hum… I took a look at the source of PlutoPlotly.jl. It actually has a module to force Mathjax to run locally. But it seems that this should be fixed by now according to this pull request: MathJax not rendered in exported static HTML · Issue #1987 · fonsp/Pluto.jl · GitHub

Maybe @disberd has an idea.

It looks like this notebook uses PlotlyBase.jl for Plots, which loads the MathJax 2 library globally. Pluto uses the current version MathJax 3, which it cannot load if 2 was already loaded, and there is a race condition which one gets loaded first.

I wrote a PR to Pluto to detect this problem and display an error message:

I would suggest switching from PlotlyBase.jl to PlutoPlotly.jl.


And I am sorry for bringing the situation into Github issue. :sweat_smile: Thank you!

I am sad to say that it did not solve the problem in my case. :worried:

What did not solve the problem?

What I have done so far:

  • Substituting PlotlyBase.jl by PlutoPlotly.jl.
  • Run the static version of the Notebook in 3 browsers: Brave, Firefox and Edge
  • Cleared the browser cache
  • Deleted all the Frontmatter data I have introduced

What puzzles me is that the active notebook works fine… I am sorry for insisting, but this is a critical matter as I have just started the semester and decided too late to move entirely from slides to notebooks… I will have to teach STATA to the students as the required software for the course. But I want to get them excited about Julia. And I have already used Pluto and Julia with them in another course.

Solved! I have switched the plotting packages but forgot to wrap the plot object with the PlutoPlot() function from PlutoPlotly.jl:man_facepalming: I guess that without using this function plots are displayed anyway but relying on PlotlyBase.jl since PlotlyBase.jl is a dependency of PlutoPlotly.jl. But I am a humble economist, with poor programming expertise…
Thank you very much to you all!

Hi @rgouveiamendes, sorry for the late reply.

You can also simply make your plots using the exported plot function instead of using Plot from PlotlyBase and you already have an instance of PlutoPlot. So instead of doing PlutoPlot(Plot(...)) you simply do plot(...)