# \[solved\] MathJax stopped working

**URL:** <https://discourse.gohugo.io/t/solved-mathjax-stopped-working/5946>\
**Category:** support\
**Tags:** typesetting\
**Created:** [March 28, 2017, 9:57am UTC](https://discourse.gohugo.io/t/solved-mathjax-stopped-working/5946 "2017-03-28T09:57:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ataias](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ataias/32/218_2.png) [@ataias](https://discourse.gohugo.io/u/ataias)\
**Post date:** [March 28, 2017, 9:57am UTC](https://discourse.gohugo.io/t/solved-mathjax-stopped-working/5946/1 "2017-03-28T09:57:09Z")

</div>

Hi there! I didn’t update my website ([ataias.com.br](http://ataias.com.br)) for about 4 months, nor did I update go and hugo. Yesterday I updated them while I was creating some topics and then I noticed mathjax stopped working. Another thing I did was adding `enableEmoji = true` in the `config.toml` of the template (hugo-hikari), but I tried to remove it once and MathJax didn’t come back to life.

_Example page_: [https://ataias.com.br/2016/09/03/code-a-program-to-solve-a-partial-differential-equation-using-finite-differences-with-an-explicit-method/](https://ataias.com.br/2016/09/03/code-a-program-to-solve-a-partial-differential-equation-using-finite-differences-with-an-explicit-method/)

When I configured MathJax, I just used the standard recommendation at [https://gohugo.io/tutorials/mathjax/](https://gohugo.io/tutorials/mathjax/) . I think I added a couple things for other needs as time passed. What looks to me is that MathJax is simply not running, but I don’t know why. I am not sure which files are important to show in that case, but one important is my `footer.html`, that I present below.

```auto
<footer>
	{{ with .Site.Params.copyright }}
	<small>{{ . | markdownify }}</small>
	{{ end }}

	<script type="text/javascript" async
	src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
	</script>

	<script type="text/x-mathjax-config">
	MathJax.Hub.Config({
	tex2jax: {
		inlineMath: [['$','$'], ['\\(','\\)']],
		displayMath: [['$$','$$']],
		processEscapes: true,
		processEnvironments: true,
		skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
		TeX: { equationNumbers: { autoNumber: "AMS" },
				 extensions: ["AMSmath.js", "AMSsymbols.js"] }
	}
});
</script>

<script type="text/x-mathjax-config">
	MathJax.Hub.Queue(function() {
		// Fix <code> tags after MathJax finishes running. This is a
		// hack to overcome a shortcoming of Markdown. Discussion at
		// https://github.com/mojombo/jekyll/issues/199
		var all = MathJax.Hub.getAllJax(), i;
		for(i = 0; i < all.length; i += 1) {
				all[i].SourceElement().parentNode.className += ' has-jax';
		}
});
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
	// Autonumbering by mathjax
  TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
</footer>

```

---

<div class="post-metadata">

**Author:** ![ataias](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ataias/32/218_2.png) [@ataias](https://discourse.gohugo.io/u/ataias)\
**Post date:** [March 28, 2017, 10:56pm UTC](https://discourse.gohugo.io/t/solved-mathjax-stopped-working/5946/2 "2017-03-28T22:56:50Z")

</div>

I noticed the browser was complaining of not having `MathJax` defined. I had the idea to put everything in a single `<script async></script>` so that the inside would run after loading the source (I hope this is what happens… I am not a js/html expert). Working now, hopefully won’t break again.

```auto
<script type="text/javascript" async
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  MathJax.Hub.Config({
  tex2jax: {
    inlineMath: [['$','$'], ['\\(','\\)']],
    displayMath: [['$$','$$']],
    processEscapes: true,
    processEnvironments: true,
    skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
    TeX: { equationNumbers: { autoNumber: "AMS" },
         extensions: ["AMSmath.js", "AMSsymbols.js"] }
  }
  });
  MathJax.Hub.Queue(function() {
    // Fix <code> tags after MathJax finishes running. This is a
    // hack to overcome a shortcoming of Markdown. Discussion at
    // https://github.com/mojombo/jekyll/issues/199
    var all = MathJax.Hub.getAllJax(), i;
    for(i = 0; i < all.length; i += 1) {
        all[i].SourceElement().parentNode.className += ' has-jax';
    }
  });

  MathJax.Hub.Config({
  // Autonumbering by mathjax
  TeX: { equationNumbers: { autoNumber: "AMS" } }
  });
</script>

```

---

<div class="post-metadata">

**Author:** ![Hash\_Borgir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hash_borgir/32/6655_2.png) [@Hash\_Borgir](https://discourse.gohugo.io/u/Hash_Borgir)\
**Post date:** [March 28, 2017, 11:15pm UTC](https://discourse.gohugo.io/t/solved-mathjax-stopped-working/5946/3 "2017-03-28T23:15:54Z")

</div>

Awesome, glad to see it working. Could you kindly mark the post title as [solved]? Thanks a bunch! 🙂

---

<div class="post-metadata">

**Author:** ![ataias](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ataias/32/218_2.png) [@ataias](https://discourse.gohugo.io/u/ataias)\
**Post date:** [March 29, 2017, 12:10am UTC](https://discourse.gohugo.io/t/solved-mathjax-stopped-working/5946/4 "2017-03-29T00:10:03Z")

</div>

Ok! 😁

---

<div class="post-metadata">

**Author:** ![Toma](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/toma/32/3691_2.png) [@Toma](https://discourse.gohugo.io/u/Toma)\
**Post date:** [May 25, 2017, 6:39pm UTC](https://discourse.gohugo.io/t/solved-mathjax-stopped-working/5946/5 "2017-05-25T18:39:41Z")

</div>

By the way, for anyone reading this now or in future, you should be aware that MathJax has closed down their CDN and a new one should be used: [https://www.mathjax.org/cdn-shutting-down/](https://www.mathjax.org/cdn-shutting-down/)

The old CDN link referenced here will no longer work and should be replaced.
