# Mathjax support

• Hi there,

I include Mathjax script in the header. It works pretty good. But there is only one problem: I need to refresh my page, then the equation comes out. Other wise its just code. Just check it out here:

see? when you open it, its just the code, after you refresh, the equation poops up.

Any ideas? Thanks.

Nope, maybe the equation appears when you click that link, so how about click "CFD" at the left top corner? you will see the equation's code instead equation.

After refresh! It works.

• It's because the script runs once the page is loaded. Since NodeBB is a single page application, you have to re-run code when the page changes see this hooks.
I think action:posts.loaded would be the right choice for you. How you can re-run the parser of Mathjax you have to check within their docs.

• @frissdiegurke Thank you, I will try it and give you a feedback. Actually there is a plugin for nodeBB, called "Katex", but the equation looks not very beautiful....not well arranged.

• @frissdiegurke

Hello again,

do you know where should I insert this:?

$(window).on('action:ajaxify.end', function(event, data) { console.log(data); // to inspect what is passed back by NodeBB });  Thanks. This dynamic mathjax is so great: https://cdn.mathjax.org/mathjax/latest/test/sample-dynamic-2.html • to render mathjax script. It works good so far. • Im still looking for a dynamic mathjax support from nodebb... • Here: $(window).on('action:posts.loaded action:ajaxify.end', function () {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, "content"]);
});


• @PitaJ
where should I put the code into? which file?

• @SuperMike
I wish this plugin can number the equations and support center locating. Check my page with MathJax: link text. It is very well-organised, the only problem is that you need to refresh the page. I also tested with Katex, looks it does not support with \mathbf{}?

• @sharonyue you put that code in the custom HTML in the ACP inside a <script> </script> tag, or wherever you have the rest of your code.

• @pitaj
Hello, I put the following

<script>
MathJax.Hub.Queue(["Typeset", MathJax.Hub, "content"]);
});
</script>


here:

And it does not work?... I still need to refresh the page to load mathjax.

• You don't need <script> and </script> in the custom JS portion of the page.

4

12

3

1

10
| |