MathOverflow has an awesome engine where you can embed LaTeX in questions, answers, and comments. Can we get something like this going on Stack Overflow?

I think it’d be appropriate as I at least pretty often want to write something like n^2 and would benefit greatly from prettier markup.

share|improve this question
+1. Though in a "programming", instead of math, environment, it seems this issue comes up less often and programmers are used to dealing with it when it does. Plus complex formulas aren't needed nearly as often. (How often do you think you'd be misunderstood on SO writing n^2 and n**2?) –  Gnome Nov 22 '09 at 2:20
That's true, but just because we're used to something bad doesn't mean we shouldn't attempt to improve it =). –  Claudiu Nov 22 '09 at 2:41
I like the idea in principal. However, it should be as intuitive as possible. I've looked at LaTeX for typesetting and decided to stick with QuarkXPress as I found it more intuitive. (shudder) –  Jason D Nov 29 '09 at 23:59
I think this is a good idea. It would be very helpful for the more computer sciency sort of questions. I think LaTeX makes the most sense; it's standard in academia. –  user138665 Dec 17 '09 at 1:42 or similar might help. Think "preview bit" below answer. –  Aiden Bell Jan 14 '10 at 16:11
Maybe this is just my personal problem, but I cannot read set theory notation or Sigma notation, even though I easily understand the related concepts they embody. Those would probably be the first things commonly used on the site. As much as I want arithmetic to have the proper symbols, I would not want the rest that comes with it. –  Merlyn Morgan-Graham Nov 19 '11 at 1:09
I would argue that programmers see a lot of complex math, it just depends on what you are programming. I do research in intelligent controls, for instance, and most of my programs are heavy on both the programming stuff and the math. LaTeX in SO would be extremely helpful. –  Engineero Jun 9 '13 at 17:12
@minitech Do you have an example for when you would use this on SO? –  Undo Sep 10 '13 at 17:28
@Undo: Not on hand. Anything regarding algorithms. This advice is an important part, by the way. –  minitech Sep 10 '13 at 17:29
@minitech If you need math formatting, there's a good chance that your question is off-topic and you should ask it on Computer Science instead. There are plenty of exceptions, of course, but I've found it to be a good rule of thumb for deciding between Stack Overflow and Computer Science. (You could even add a third wheel: code → Stack Overflow, math → Computer Science, neither → Programmers, but I don't know how accurate that one is.) –  Gilles Sep 10 '13 at 17:50
@Gilles: Sure. If it’s not, however… I just don’t see the harm in adding something that already works elsewhere for the specific exceptional cases. –  minitech Sep 10 '13 at 17:51
add comment

5 Answers

up vote 8 down vote accepted

This is implemented on -- you can check it out there. It will never be on Stack Overflow, though, as it is an extremely heavy dependency. (See also Nick's investigations about impact in November 2013.)

Info here:
TeX math markup is sorely needed

share|improve this answer
Well, you could conditionally enable it accross stackexchange, enabling consistent markup (question migration). By that I mean that you check the question and all answers if there is LaTeX block and if so, you load this "extremely heavy dependency". There are questions that would hugely benefit from that. –  Rok Kralj Jun 26 '12 at 17:07
As it works just fine on how is it too heavy? –  donroby Aug 12 '12 at 16:54
Also on physics SE. –  Calmarius Aug 16 '13 at 14:52
(@donroby, I know more than a year passed, but if you still wonder about impact and missed it: see Nick's investigations. Just the messenger!) –  Arjan Dec 12 '13 at 20:22
-1 it should be enabled on any site that might use math. See for example –  endolith Feb 25 at 19:44
add comment

enter image description here

As a workaround, you can easily embed LaTeX by generating an image of the equation using the following WYSIWYG editor:

enter image description here

share|improve this answer
Holy crap, this is useful. –  Makoto Jan 20 '13 at 5:06
I know it's too late to ask, but is there an alternate to codecogs? This website has been giving a 503 - Service Not Available since past few days. –  Ranveer Feb 15 at 21:40
Works alright for me, and I'm on holiday in France... –  Milo Chen Feb 15 at 21:42
Hmm.. Strange. Any alternates you know of? –  Ranveer Feb 16 at 8:30
@Ranveer Daum Equation Editor –  Anant Feb 20 at 17:17
@Anant awesome! This works! –  Ranveer Feb 20 at 17:41
@Anant, also you might wanna give the same answer here:… –  Ranveer Feb 20 at 17:42
@Ranveer Done :) –  Anant Feb 20 at 17:46
add comment

Although I'm a big LaTeX fan, I don't think the work would be justified for Stack Overflow.

Since Stack Overflow is one of the sites on the web that gets Unicode right, you can do standard things like

K ⊆ A



anyway. And <sub> and <sup> are whitelisted, so you can even do more complicated things like




share|improve this answer
that seems way more complicated doing O(n<sup>2</sup>) than O(n^2) for the same thing... –  tzenes Feb 23 '10 at 5:09
@tzenes: Pick your examples right. O(n^2) is still more than O(n²). But again, I love Latex, and I wouldn't have a problem with it being implemented on SO. I just feel that the work necessary to do that isn't justified by the few times this is actually needed. –  balpha Feb 23 '10 at 8:04
Well I came onto this subject when writing this answer:… It took me a long time to get all the tags right, especially considering how much easier latex would have been... –  tzenes Mar 11 '10 at 4:20
Expressions featuring summation, integrals, products, roots ... would be nice examples. E.g. ∑<sub>i=0</sub><sup>n</sup> just doesn't look right. I don't know wether it justifies the work for the few questions that need it though. –  Georg Fritzsche Aug 4 '10 at 18:52
About justifying "the work" that'd need to be done - since mathoverflow has it working perfectly, it seems like it would be a simple matter –  Claudiu Mar 6 '11 at 17:52
@Claudiu: Yes, it's done client-side via JavaScript. This requires every single user visiting the site to download gigabytes of JavaScript (okay, slightly exaggerating) for something that's interesting for at most a tiny amount of posts. –  balpha Mar 6 '11 at 17:57
While this is a fair suggestion, I'd certainly rather have people download excess code than suggest that people learn to use Unicode for formatting. Wasting a few bytes for some users isn't quite the same as wasting brain cells. Nonetheless, mentioning Unicode points to gradual evolution in browsers, and perhaps a future version of HTML or browsers will make this question irrelevant. –  Iterator Nov 18 '11 at 21:53
@balpha can you provide a link on how to use <sub> etc and also how do you generate the unicode characters?Through a char-map and then copy and paste or is there some nice shortcut? –  Dan Jan 14 at 10:51
add comment

Having LaTeX support on Stack Overflow would be great. After all SO is about programming, which covers algorithms. And some algorithms are easier explained if one can typeset math. For example whenever it comes to complicated transformation issues regarding 3D graphics, being able to typeset those matrices would be a huge benefit.

share|improve this answer
For 3D stuff, you should be at GameDev.SE anyways. LaTeX will take up CPU (on your computer and on SO's servers), and I believe it'll be only needed in 1/1000 questions or answers. And most of those questions could probably go over to Math.SE, or GameDev.SE. –  muntoo Apr 16 '11 at 4:31
If you're really desperate, you can render the image, and then simply include the image in your question/answer. –  muntoo Apr 16 '11 at 4:33
@muntoo: 3D isn't limited to gaming – I admit, that my 3D experience mostly results from developing a 3D engine. However it's as important in programming engineering tools (CAD/CAM), scientific visualization, modern user interfaces, etc. –  datenwolf Apr 17 '11 at 8:50
@datenwolf I think physics simulation fits in to GameDev.SE, even if it's for a NASA rocket, and not just a game with a NASA rocket. GameDev.SE probably has a higher ratio of knowing "3D stuff" to number of [active] users than any other SE site. You don't have to tell them that you're going to be using it for a "game" or not. –  muntoo Apr 17 '11 at 18:14
For stuff that doesn't fit into GameDev.SE, you could go to CSTheory.SE or Math.SE. (Or any of the other LaTeX enabled sites.) –  muntoo Apr 17 '11 at 18:16
@muntoo, we don't get to choose where the questions go, and often the subject matter belongs on SO. –  Adam Jun 14 '11 at 7:14
add comment

It would be fantastic to have this. There are times when a statistical programming question arises where either Stack Overflow or Cross Validated would be an appropriate site (maybe Stack Overflow will have the edge), but I would rather see it on Cross Validated simply, because one can have LaTeX formatting.

The use case is pretty simple: Joe comes along with a question about how to do X in R (or MATLAB, Python, whatever), and there's an issue with his math and his implementation. For example: the two don't match. Another scenario is that of this question, where we could Q&A on the mathematical inverse, and a good way to code the transformation. It is irritating to address the mathematics within an environment where the formatting support is weak. Both sites (Stack Overflow and Cross Validated) have adequate support for presenting code, so the winner is the site that supports the formatting of mathematics. The same is true for $\textrm{computational math} \setminus \textrm{statistics}$ and the Stack Exchange site Mathematics. ;-)

To that end, I hope that moderators will accept some flags that suggest that a question is better for Mathematics or Cross Validated based on topic, audience, etc. and the ease of answering the question with the available formatting tools.

share|improve this answer
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .