What typographic support is available to support display of statistical formula?

There will be occasions when it would be useful to be able to include a statistical formula within a question, answer, or comment. How is this supported?

jsMath would be awesome as it could allow dynamic previewing of mathematics in questions and answers.

As a stopgap measure, you can use a service that compiles markup, such as TeX, to an image and then link the image into your Question or Answer. Here's a list of some such services taken from a blog post by my good friend Cameron see his blog post for side-by-side comparisons.

It seems StackExchange scrubs image links that pass script parameters- which is unfortunate as these services can't be used directly from a post. However, you can download the generated image and rehost using a site like TinyPic.

• I think the long term answer is what Colin suggested, i.e., to incorporate the jsMath library in the same fashion as mathoverflow. But since the site admins haven't indicated if that will happen or when it might happen, I'm going to accept your answer as correct, because it should work with the current system. If I'm breaking any protocols by doing it this way, just let me know. Jul 20 '10 at 18:41

Is it possible to incorporate the latex javascript library that mathoverflow use?

• We should definitely ask them about it. To my knowledge jsMath is the most feature-rich client-side solution and uses TeX-style notation which is a good lingua franca for expressing mathematical statements. Jul 19 '10 at 20:11
• I don't know if he used it or not but John L. Taylor stats.stackexchange.com/users/39/john-l-taylor was able to include a formula in one of his answers stats.stackexchange.com/questions/2/what-is-normality/59#59 , so there is currently some type of support. Assuming it is the same as mathoverflow, should we add that as a FAQ? Jul 19 '10 at 20:24
• @A Lion: He just did what I did, when I found the equations I wanted on Wikipedia for this question: stats.stackexchange.com/questions/54/… and linked to them.
– Amos
Jul 19 '10 at 20:39
• Yeah, it's an image. Reminds me, I think there's a pile of "turn-TeX-into-hosted-image" sites out there, I'll dig some up. Jul 19 '10 at 21:08
• Yes it is. Look at mathoverflow.net . They use jsMath and it works excellent Jul 20 '10 at 8:52

Latex support is now built-in. See this meta thread from math.SE: https://math.meta.stackexchange.com/questions/2/tex-math-markup-is-sorely-needed

I have made this answer CW in case you want to see what you have to do to get latex output.

A demo: $\alpha$

John Gietzen over at http://math.stackexchange.com has created a greasemonkey script which uses the Google Charts API to create images on the fly from latex. I have asked his permission to adapt it for our site. See his answer to this question: https://math.meta.stackexchange.com/questions/2/tex-math-markup-is-sorely-needed

Here is a demo of the script: $\alpha$

Ok, here is the script put together by John: http://userscripts.org/scripts/show/81977

Presently, I have it working for in firefox with greasemonkey installed. Apparently, it works in Chrome as well but I have not been able to get it to work. I will update this answer if I can resolve that issue.

Perhaps, we should start using tex + the above script. The advantage is that as and when we get tex support from the devs all our posts will look nice.

• What about all the people using browsers other than Firefox or Chrome (like IE or Safari)? They will just see what looks like a bunch of line noise surrounded by dollar signs. It is probably best to pre-compile the TeX to an image and post a link to that. Jul 23 '10 at 6:55
• Yeah, that is true. So, perhaps we wait till tex functionality is built-in and in the meantime use images only.
Jul 23 '10 at 13:14
• BTW, some users on math.stachexchange.com are using tex. If you are on that site as well and use chrome/firefox the above script will work. On firefox: greasemonkey + the script linked above On chrome: Just the script.
Jul 23 '10 at 15:28
• @Srikant: I believe that this script will work in IE using the GM4IE extension. Jul 26 '10 at 20:21
• @Sharpie Safari is close to Chrome, I think it should work there.
– user88
Jul 29 '10 at 22:19
• The script is causing problems with R code that includes a dollar sign. e.g., the answer by PaulHurleyuk at stats.stackexchange.com/questions/213/… Jul 30 '10 at 12:54
• @Rob I have taken the liberty of re-posting your comment on this meta thread: meta.stats.stackexchange.com/questions/218/… If not that is not ok please let me know and I will delete it.
Jul 30 '10 at 14:24

Another option is to use http://mathurl.com/, and then link to the picture.

See this discussion.

According to the site's about section:

• The image is linked to mathurl.com. Will that link ever break in the distant future?
Jul 27 '10 at 16:19
• @Srikant: It shouldn't, no. Although that's a risk. Jul 27 '10 at 16:20
• ok. I wonder when the devs will let us know their decision about the request to add latex support: meta.stackexchange.com/questions/57931/… That would be ideal.
Jul 27 '10 at 16:25

In fact, you should be looking into using MathJax instead of/as well as jsMath. It's written by the same people, recently had its first release, and is much more stable and flexible. Right now, however, it's actually a little slower than jsMath, but they anticipate improving this soon.

In my opinion, a solution should be found that displays the equations immediately, not after some seconds. Therefore, I vote for JS in the previews, but compiled tex when questions and answers are displayed!

The only time I've had to implement something like this was with a Moodle site where we made use of mimetex although this appears to have been superseded by mathtex which I haven't used. NRich make extensive use of jsMath very successfully and it probably isn't going to be as much of a nightmare to get working as mimetex was.

I have to note that MathML support is available in Firefox 4b2. And while syntax does seem quite cumbersome:

$<mi>x</mi> <mo>=</mo> <mfrac> <mrow> <mo>&minus;</mo> <mi>b</mi> <mo>&PlusMinus;</mo> <msqrt> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>&minus;</mo> <mn>4</mn> <mo>&InvisibleTimes;</mo> <mi>a</mi> <mo>&InvisibleTimes;</mo> <mi>c</mi> </msqrt> </mrow> <mrow> <mn>2</mn> <mo>&InvisibleTimes;</mo> <mi>a</mi> </mrow> </mfrac>$


It could be great if we could be allowed this tags.

x = − b ± b 2 − 4 ⁢ a ⁢ c 2 ⁢ a