Discourse Math Plugin

So something weird. I just created a new post to test again. In the first 5 seconds or so while the pos was up it DID render the equation properly then a moment later it reverted to raw latex. It always renders correctly in the preview however.

My guess is that this is strongly related to your non-standard install, we only really support the docker based setup.

Why isnt this standard? I removed all the non-standard plugins as you said.

I am afraid the only “production” support we offer here is for people who use this guide:

discourse/INSTALL-cloud.md at master · discourse/discourse · GitHub

What I think you have done though you are not explicitly telling me so is swang an install by hand by kicking off unicorn launching sidekiq and orchestrating NGINX.

Am I mistaken? Or are you using our official install?

1 Like

Ohhh you meant how discourse was insalled or how the plugin was installed?

I wanted to provide a solution to my own problem in case it helps anyone else.

Ultimately I couldnt get the Discourse-math plugin working. In case anyone else completely fails at getting it working one option is to uninstall it and instead go to your customize tab and edit your theme in the Web UI. If you add the following to the head tab it should work (either disable CSP in your setting or add the domain to the acceptable sources, both can be done in the settings).

<script type="text/x-mathjax-config">
    extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js", "TeX/noErrors.js"],
    jax: ["input/TeX","output/HTML-CSS"],
    tex2jax: {
        inlineMath: [['$','$'], ["\\(","\\)"]],
        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
        processEscapes: true,
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML"></script>
<script type="text/javascript">
    var observer = new MutationObserver(function(mutations) {
        var refresh = false;
        refresh = false;
        mutations.forEach(function(mutation) {
            if(mutation.target.id == "topic" || mutation.target.id == "reply-control") {
                refresh = true;
        if(refresh) {
    observer.observe(document, { childList: true, subtree: true});
1 Like

Super wide equations will now scroll horizontally instead of being cut off. This works on both desktop and mobile devices.


Hi I have an issue with multiple inline math commands. e.g.:

$v(t_1) =$ space under $a(t)$ between $0$ and $t_1$

$v(t_1) =$ space under $a(t)$ between $0$ and $t_1$

Any clue how to solve this?

What issue exactly? :slight_smile: Can you provide a screenshot, or does it simply not render at all?

It renders for me fine with both KaTeX and MathJax.


And it seems it also doesn’t work for previews?

1 Like