Several StackExchange sites have support for mathematical formulae using MathJax (LaTeX syntax).

Many Code-Golf challenges are mathematical in nature. Equations come up very often in discussions.

Therefore, I think it would be very useful to enable support for this on here as well?

Test to see if it is enabled yet: $ \LaTeX $

  • \$\begingroup\$ MathJax is a big, heavy pile of javascript, and Jeff has claimed that it will only be used on sites where it goes to a core task. Not that I'd mind, as I'm active on Physics.SE so it's already in my cache. \$\endgroup\$ Commented Apr 12, 2011 at 1:13
  • 1
    \$\begingroup\$ @dmckee: As far as I can tell, it is about 50 KB of JavaScript. That’s the equivalent of about 33 images, and as you alluded to it only needs to be downloaded once and cached. Can you describe in greater detail what the problem with that is? \$\endgroup\$
    – Timwi
    Commented Apr 12, 2011 at 12:05
  • 1
    \$\begingroup\$ I seem to recall Jeff saying it was much heavier than that, but I can't find the conversation that I had with Jeff on the matter. I did find meta.stackexchange.com/q/30559/2509. \$\endgroup\$ Commented Apr 12, 2011 at 16:47
  • \$\begingroup\$ I've found that Firefox 3.6 on Vista ties up the entire system for several seconds while fetching something from cdn.mathjax. I really have no idea why, but it goes deep because even the mouse pointer doesn't respond. No problems with Chrome on Linux at home. :shrug: \$\endgroup\$ Commented Apr 16, 2011 at 11:47
  • \$\begingroup\$ While there is not MathJax support on this site, we can use FAQ to help people: How can I incorporate good-looking mathematical exposition into my question/answer? \$\endgroup\$ Commented Mar 20, 2014 at 10:54
  • \$\begingroup\$ @Timwi But \$a=b\$ works. This is Latex/Mathjax. It is simply \$a=b\$. Here is a fraction:\$ \phi=1+\frac{1}{1+\frac{1}{1+}}\dots\$. It is \$ \phi=1+\frac{1}{1+\frac{1}{1+}}\dots\$ \$\endgroup\$
    – math scat
    Commented Jul 21, 2020 at 7:40

2 Answers 2


Although I don't think MathJax is necessary for codegolf.SE (in contrast to math.SE), I think it would be neat to have it. So I've checked some questions / answers to see how MathJax would be used on this site:

  • Easy indexing / exponentiation by $A_i$ instead of A<sub>i</sub> (example)
  • Symbols for number sets (\mathbb{N} and \mathbb{R})
  • Nicer Big-O notation (\mathcal{O}(n^2) instead of O(n^2))
  • \cdot instead of * (example)
  • Nicer variables (It's easier to recognize $n$ as a variable than n)

A way around that can be used by single people who want to have this in their answer is including images like this answer does.

codegolf.SE could also generate images for formulas instead of loading MathJax. But this might cause other problems. Here is how it can be done (link).

  • \$\begingroup\$ In the present absence of MathJax, a FAQ article on "How can I incorporate good-looking mathematical exposition into my question/answer?" would be a nice thing to have. You seem to have a good command of a variety of options...perhaps you would be willing to write it? I can also throw in a few tidbits (ASCIITeX, export options in MathType and Mathematica) \$\endgroup\$ Commented Mar 17, 2014 at 19:18
  • \$\begingroup\$ I could try to write this. Where should I write a first draft? How long can this explanation be? \$\endgroup\$ Commented Mar 17, 2014 at 19:28
  • \$\begingroup\$ Details on adding to the FAQ are here: meta.codegolf.stackexchange.com/questions/1280/… \$\endgroup\$ Commented Mar 17, 2014 at 19:45
  • \$\begingroup\$ @JonathanVanMatre Thanks. I've created a fist draft here. If I find some free time, I'll search for command line tools that make this process easier. \$\endgroup\$ Commented Mar 20, 2014 at 10:53
  • \$\begingroup\$ There is meta.codegolf.stackexchange.com/questions/1611/… but neither answer is very usable. Maybe we should set a code-challenge to convert a math.se question with LaTeX into one that works for code.se :) \$\endgroup\$
    – user9206
    Commented Jun 2, 2014 at 16:51

While Latex is nice for viewing math, if the math is not essential to the site, it is a big problem. On Mathematics.se, it can take a while before the raw Latex is converted to what I see, especially on a slow computer. Oftentimes on a slow computer, the computer freezes.

As an alternative, I recommend copying the html symbols from this: http://en.wikipedia.org/wiki/Table_of_mathematical_symbols

This is what I have done in my posts when I want mathematical symbols; I even compiled a list of symbols into my profile for easy access.

  • \$\begingroup\$ In my experience this is rather a matter of the browser than a matter of the computer. Old IE versions have problems with that. Chrome on the other hand displays it fine. Firefox seems to be much slower in executing JavaScript than Chrome, but by far better than old IE versions. \$\endgroup\$ Commented Mar 17, 2014 at 19:31
  • \$\begingroup\$ @moose I have a windows 7 computer that will freeze, using the most up to date chrome. \$\endgroup\$
    – Justin
    Commented Mar 17, 2014 at 19:49
  • 3
    \$\begingroup\$ @Quincunx Well, there you go. You just need to fix your having a windows 7 computer. \$\endgroup\$ Commented Apr 25, 2014 at 21:53

You must log in to answer this question.

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