MathJax equations are not displayed on my new site but work fine on its exact copy

The problem

I am in the process of migrating my website to another webserver.

The problem is that on my new site the LaTeX equations are not displayed.

The configuration

  1. I used WordPress plugin “Duplicator” to copy my site from one server to another.
  2. I have the exact same plugins on each website and the exact same configuration.

I use the plugin LaTeX for WordPress to display the equations:

Both of them are using the CDN from MathJax.

What I tried

  • I tried to change the CDN on the new site and it did not work
  • I tried running http or https versions of the CDN and it did not change anything
  • I tried running a simple html page with the CDN and the equation displayed correctly, telling me it does not seems to be CDN related.
  • I tried to clear the cache of my browser, I tried to use different browsers, no difference

So I though it was because of the plugin:

  • I tried disabling every plugin except the LaTex for WordPress plugin and it did not work
  • I compared each php file of the plugin between the two versions and they have the same content
  • The configuration of the plugin is strictly the same
  • I tried comparing the generated html code between the two pages and I see that there is 8 MathJax related style in the old site, and only 5 on the new site.

The style for the classes:


But in the working version there are also the styles for the classes:

.MathJax_Preview .MJXf-math 

Moreover I found that the generated html code is different.

Example of the code on a working test page:

<script type="math/tex" id="MathJax-Element-1">1+x=x^2</script>

We can clearly see the math “1+x=x^2” inside the script.

But on the non working page, the math is gone:

<script type="math/tex" id="MathJax-Element-1"></script></p>

When the page load, I can quickly see the preview image being displayed, and then dissapear.


Example of a working page displaying equations correctly:

The same page on my new server:

The Question

What can be the cause of this problem? How can I fix it?

Read more here: MathJax equations are not displayed on my new site but work fine on its exact copy

Leave a Reply

Your email address will not be published. Required fields are marked *