# Math not displaying properly in static HTML Pluto Notebook

**URL:** <https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790>\
**Category:** Pluto\
**Created:** [February 6, 2024, 10:05am UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790 "2024-02-06T10:05:14Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgouveiamendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rgouveiamendes/32/218636_2.png) [@rgouveiamendes](https://discourse.julialang.org/u/rgouveiamendes)\
**Post date:** [February 6, 2024, 10:05am UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/1 "2024-02-06T10:05:14Z")

</div>

When I export a Pluto Notebook to HTML the math is not rendered. I am wondering why. Anyone with the same problem?  
An example: [https://rgouveiamendes.org/teaching/iscte-iul/econometrics-i/notebooks/capitulo01](https://rgouveiamendes.org/teaching/iscte-iul/econometrics-i/notebooks/capitulo01)

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [February 6, 2024, 10:27am UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/2 "2024-02-06T10:27:00Z")

</div>

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

 ![Screenshot 2024-02-06 at 11.25.40](https://global.discourse-cdn.com/julialang/original/3X/9/1/9191e7d1d92d24fce02ba7bc1b4d49a066e413e3.png)

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

---

<div class="post-metadata">

**Author:** ![rgouveiamendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rgouveiamendes/32/218636_2.png) [@rgouveiamendes](https://discourse.julialang.org/u/rgouveiamendes)\
**Post date:** [February 6, 2024, 12:59pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/3 "2024-02-06T12:59:07Z")

</div>

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

 ![Screenshot 2024-02-06 125429](https://global.discourse-cdn.com/julialang/original/3X/e/2/e23a93113560802c553bf27ec13984113a2378f7.png)

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

 ![Screenshot 2024-02-06 125818](https://global.discourse-cdn.com/julialang/original/3X/b/6/b62eccb1cd65a71186267477e324029c69172aab.png)

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

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [February 6, 2024, 3:30pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/4 "2024-02-06T15:30:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Post date:** [February 6, 2024, 4:11pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/5 "2024-02-06T16:11:22Z")

</div>

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

```julia
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

 ![a](https://global.discourse-cdn.com/julialang/original/3X/1/1/118a854ffb236ab85f007b5ca4fcfd98a632f5df.png)

---

<div class="post-metadata">

**Author:** ![rgouveiamendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rgouveiamendes/32/218636_2.png) [@rgouveiamendes](https://discourse.julialang.org/u/rgouveiamendes)\
**Post date:** [February 6, 2024, 8:03pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/6 "2024-02-06T20:03:32Z")

</div>

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](https://github.com/fonsp/Pluto.jl/issues/1987)

Maybe @disberd has an idea.

---

<div class="post-metadata">

**Author:** ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)\
**Post date:** [February 7, 2024, 12:59pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/7 "2024-02-07T12:59:10Z")

</div>

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:

> <https://github.com/fonsp/Pluto.jl/pull/2803/files>
>
> Fix https://github.com/fonsp/Pluto.jl/issues/1987#issuecomment-1930864175

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

---

<div class="post-metadata">

**Author:** ![rgouveiamendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rgouveiamendes/32/218636_2.png) [@rgouveiamendes](https://discourse.julialang.org/u/rgouveiamendes)\
**Post date:** [February 7, 2024, 1:06pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/8 "2024-02-07T13:06:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rgouveiamendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rgouveiamendes/32/218636_2.png) [@rgouveiamendes](https://discourse.julialang.org/u/rgouveiamendes)\
**Post date:** [February 7, 2024, 2:40pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/9 "2024-02-07T14:40:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)\
**Post date:** [February 7, 2024, 4:51pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/10 "2024-02-07T16:51:28Z")

</div>

What did not solve the problem?

---

<div class="post-metadata">

**Author:** ![rgouveiamendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rgouveiamendes/32/218636_2.png) [@rgouveiamendes](https://discourse.julialang.org/u/rgouveiamendes)\
**Post date:** [February 7, 2024, 5:09pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/11 "2024-02-07T17:09:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rgouveiamendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rgouveiamendes/32/218636_2.png) [@rgouveiamendes](https://discourse.julialang.org/u/rgouveiamendes)\
**Post date:** [February 7, 2024, 6:11pm UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/12 "2024-02-07T18:11:43Z")

</div>

Solved! I have switched the plotting packages but forgot to wrap the plot object with the `PlutoPlot()` function from `PlutoPlotly.jl`… 🤦‍♂️ 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!

---

<div class="post-metadata">

**Author:** ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)\
**Post date:** [February 8, 2024, 7:57am UTC](https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/13 "2024-02-08T07:57:11Z")

</div>

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(...)`
