# [solved] MathJax stopped working

#1

Hi there! I didn’t update my website (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.

When I configured MathJax, I just used the standard recommendation at 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.

<footer>
<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>

#2

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.

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

#3

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

#4

Ok!

#5

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/

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