# Allow using MathJAX?

Some stack exchange sites (cs, math, physics etc.) have MathJAX support. Now on programmers.se and stack overflow there is less need for mathematical formulae, but they appear, most often when discussing complexities or algorithms that involve some calculation.

I usually help myself with some HTML markup (like "O(n2)" (O(<i>n</i><sup>2</sup>)), but MathJAX would make it easier. Plus the HTML does not work in comment; all one can resort to there is unicode math ("O(n²)", O(n²)) which requires copy&paste from something that can type it, because browser can't.

Hm, though we'd need definition for $\O$, because otherwise it is $\mathrm{O}(n^2)$.

The same applies to Stack Overflow. Algorithms are regularly discussed on both Programmers.SE and Stack Overflow.

• I requested this feature back in 2011 for reference. – World Engineer Sep 5 '13 at 12:18
• See also Adding support for math notation noting that MathJAX is a very heavy dependacy. – user40980 Sep 5 '13 at 14:54
• @MichaelT Note that Math.SE gets more traffic than us, so that shouldn't be an issue here if it isn't there. – Dynamic Sep 5 '13 at 20:44
• @Dynamic it impacts render times of all pages, CDN hits and such. The frequency for its use isn't that high and as programmers, we're more likely to do sum(1 .. n) rather than try to write out the mathy form of it as $\sum\limits_{i=1}^n X_i$ -- its harder for non-math types to understand and edit on the site. – user40980 Sep 5 '13 at 20:53
• @JanHudec (not trying to say no) - your request would be stronger if you could identify 5-10 questions or answers where having MathJAX would improve it? An example would be Balance Tree with depth n has how many nodes maximum? (I grabbed an online equation editor to generate that one). Note thats for the summation - not the superscript which can be done quite easily with just standard html tags. – user40980 Sep 6 '13 at 2:13
• @MichaelT: Sorry, I don't see that question saying it's heavy dependency anywhere. And it's always the same script (though large) just referenced from the pages, so browsers should request it once and be done with it. – Jan Hudec Sep 6 '13 at 6:20
• @JanHudec "It will never be on Stack Overflow, though, as it is an extremely heavy dependency." from here. Granted, that is a several year old answer and it might be best to clarify what that means today. – user40980 Sep 6 '13 at 12:44
• @MichaelT: Yes. Except it refers to details in the question on meta.Math.SE and in that question I can't see where it is a heavy dependency. And even less why it would be a problem. It is a client-side script that is not even served by stack exchange. Stack exchange has zero work with it, because it's always the same script, clients only get it once and it only runs on onload, so it does not delay rendering either (the page loads and than the formulas flick in). – Jan Hudec Sep 6 '13 at 13:19
• For the specifics of what "an extremely heavy dependency" is, you are probably best asking on Meta.StackOverflow - I'm not sure the full background behind it. The argument for adding it to P.SE would best be served if you had some examples for things other than can be handled by superscript that would result in a better user experience. – user40980 Sep 6 '13 at 16:11
• See this comment for a detailed analysis of why MathJax need not be considered a "heavy dependency". – Davide Cervone Sep 7 '13 at 15:17
• @DavideCervone very enlightening. I would suggest following Anna's suggestion for identifying questions on P.SE that would benefit from its use in a way that can't be handled with the sup tag. – user40980 Sep 7 '13 at 17:40
• If you do feel strongly with this, the question on MSO meta.stackexchange.com/questions/30559/latex-in-stack-overflow might get some attention. – user40980 Sep 12 '13 at 15:56
• @DavideCervone There's been some activity on MSO about the nature of the heavy dependency that you might want to look into. If nothing else, its a good read. – user40980 Nov 4 '13 at 3:27

Recently, Nick did some tests on Stack Overflow to see what impact MathJax would have on Stack Overflow. This was likely done in part to put to rest the 'heavy dependency' argument. The full post can be read at There's seriously no reason why LaTeX markup via MathJax shouldn't be enabled on SO

For a Stack Overflow page load (even when its doing 'nothing'):

Furthermore, for sites that have those pesky $ that show up in code, it can be a breaking change for existing questions changing the rendering for: [...] which then stores into a$_SESSION - the problem is most of the settings will be set by javascript, and as javascript is a client side script you can't access PHP $_SESSION variables as its server based. [...] to: Lastly, there are reports that adding MathJax significantly impacts the time it takes for a preview to show up while writing an answer because MathJax needs to be called to rerender the preview on every keystroke. (numbers, links and images from the associated answers in the MSO question) • The breakage is apparently worked around on some sites already by using \$ as delimiter. – Jan Hudec Jul 13 '14 at 10:32

I support allowing MathJax also in Programmers.SE; I just missed again its absence while editing this question:

I will add more questions on this list whenever I run again into this obstacle. (Since I am not the OP, I hesitated to edit the question in order to add examples of questions where MathJax would be of help, as requested in the comments by @MichaelT).

You can read which SE sites currently allow MathJax here. Recently, as of this writing, "Code Review" allowed it with \$ delimiters, which could be a solution to the conflict with code like $_SESSION.
• Do consider how many existing questions and answers this would break. Even meta posts such as How do I explain ${something} to${someone}? will have to be redone. My general finding is that, often, when these questions are asked they really want to be on CS.SE (where mathjax is enabled). Its not that they're off topic here, but rather that the type of answer they want is one that would come from a computer scientist rather than a programmer (and those are different things). – user40980 Jul 2 '14 at 1:55
• You have a point with CS.SE, possibly such questions should be migrated. However, about breaking existing posts, wouldn't the option of using \\$ delimiters avoid precisely that problem? – logc Jul 2 '14 at 8:31