# TeX usage in StackExchange

It seems nearly universal for relatively inexperienced posters to StackExchange to write things like \sum_{n} \int_{a}^{\infty} x^{2}\;dx instead of \sum_n \int_a^\infty x^2\;dx. It doesn't seem worthless to acquaint them with the fact that the braces aren't needed unless there's more than one character in the subscript or superscript. Does StackExchange have some FAQ telling people to do it that way?

I've also seen people using \mbox as a substitute for \mathrm or \text or even \operatorname. That is a hideous abomination (the comments on the linked page don't apply only to Wikipedia). Could that same FAQ, if it exists, be prescribing that usage?

Later note: I proposed omitting all mention of mbox from any manual, if one exists, and Phira tries to say I proposed using the manual to "preach against" its use. That is a straw man. I proposed mentioning that braces are unnecessary in some contexts, and Phira wants to make it appear that I was proposing to "preach against" their use.

I'm sorry I tried to contribute here.

• @HenningMakholm : I don't understand what you're saying. Do you mean that no such person will bother to use \mbox in posts to stackexchange? If so, you're mistaken; I've seen it more than once. Or do you mean such a person would not bother to mention in an FAQ, if one existed, that it should not be used in that way? If so, I think the right thing to do is simply describe the proper use of \text, \mathrm, and \operatorname. But if there's already an FAQ that says \mbox should be used, then certainly that should be changed. – Michael Hardy Dec 7 '11 at 0:12
• BTW, I think Wikipedia may be using mathJax within a few weeks. Developers, including Brion Vibber, are working on it. – Michael Hardy Dec 7 '11 at 0:12
• Can someone explain the down-vote? Is there someone who wants me to cease contributing here, or is there some objection to this question? – Michael Hardy Dec 7 '11 at 0:16
• Regarding down-votes on meta, I think this thread on meta.SO is also relevant here: meta.stackexchange.com/questions/87475/… – Jonas Meyer Dec 7 '11 at 0:31
• Why are you reading TeX code? It is mean to be read by machines, not humans. If, as in your first example, it produces the same rendering, then why be concerned? Did it occur to you that such TeX code might be machine-generated? E.g. some Math.SE users have mentioned that they use WYSIWYG TeX editors to help compose their posts here. – Bill Dubuque Dec 7 '11 at 1:36
• @HenningMakholm : Because I was editing a posting, of course. It had not occurred to me that it might be machine-generated; your comment is the first I'd ever heard of that possibility. – Michael Hardy Dec 7 '11 at 1:58
• @HenningMakholm : How would I not read TeX code if I'm editing a posting? – Michael Hardy Dec 7 '11 at 2:01
• @MichaelHardy: It seems to me that it might be prudent to mention you were the author of the link provided in your post (lest someone be misled that it is an appeal to some other "authority"). – cardinal Dec 7 '11 at 3:00
• See also this thread on TeX.SE for arguments for and against using unnecessary braces. I'm not sure why it should really matter whether such braces are here or not. (side note/off topic: my own aesthetics favor the use of a thin space \, instead of of a thick space \; between the integrand and the dx) – t.b. Dec 7 '11 at 7:42
• @Michael: Sorry -- I must accidentally have posted half a comment after I figured out I had misread your post and therefore what I had to say did not actually apply. The half that did appear was not meaningful and is now deleted. (Your later pings seem to address Bill, not me). – hmakholm left over Monica Dec 7 '11 at 12:02
• @cardinal : It had not occurred to me that anyone might perceive that Wikipedia page as authoritative. I had intended it to be perceived as making a convincing argument. – Michael Hardy Dec 7 '11 at 21:58
• @MichaelHardy: I think you may have missed (part of) the point of my comment. – cardinal Dec 8 '11 at 2:42
• It seems that some users use MathType to typeset their formulas. The resulting code (see here for an example) seems to have some of the characteristics of what you describe in this post, arguably it's even worse. – t.b. Apr 11 '12 at 0:41

I would actually argue that, for a short introductory resource aimed at people who may have no prior experience with $\LaTeX$, it's better to err on the side of too many braces, rather than too few.

Let me put it this way: if someone knows only one way to typeset $x^2$, I'd rather it be x^{2} rather than x^2, because the former will still work when he wants to write $x^{10}$.

(Of course, personally I'm happy to write things like \frac12 for $\frac12$, especially when I'm trying to squeeze a long comment under the 600 character limit. But that's not the kind of syntax I'd use in an introductory reference. As much as I like code golf, this is not the site for that.)

• Yes, yes, yes. I wish I could upvote this multiple times. Instead, I'll just point out that Gratzer, in Math into Latex, does this when he teaches you how to use subscripts in Chapter 1. Later, of course, there is (almost) all the detail you could possibly want about how the TeX parser works. But he understands that the first thing to do is teach users a method which, although not the most minimal, will always work. – David E Speyer Dec 12 '11 at 19:15

Even if a short guide to LaTeX would be written here, I would be absolutely against using it for preaching against things like x^{2}, mbox or eqnarray etc, as hideous as they may be.

A short guide should be aimed at novices who need some more examples and some links to resources like detexify.

There is a tex.SE site, after all.

• Did I suggest preaching? I was suggesting helping people. And I never suggested that it should say anything against mbox; only that it should omit any recommendation to use mbox. – Michael Hardy Dec 7 '11 at 21:45
• Did you enter this discussion to try to find ways to twist what I wrote? Should I apologize for having tried to contribute? I would also opposed using a LaTeX guide to preach against anything, and I would not mention mbox at all in such a guide. – Michael Hardy Dec 7 '11 at 21:48
• I have flagged this answer for moderator attention because it is dishonest. – Michael Hardy Dec 7 '11 at 21:52

When I type Latex myself, I don't do the things you mention. But often I have a calculation on Maple, then I want to paste the result here, so I ask Maple to produce Latex. Then I do have things like x^{2}, done I guess to be on the safe side. But there is no call to outlaw these!

We don't provide any FAQ of our own that explains any etiquette on formatting LaTeX. The full extent of our instructions, which are rather sparse-to-nonexistent, are in the editing help as follows:

Mathematics uses MathJax to render LaTeX. You can use single dollar signs to delimit inline equations, and double dollars for blocks:

    The *Gamma function* satisfying $\Gamma(n) = (n-1)!\quad\forall n\in\mathbb N$ is via through the Euler integral

$$\Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,.$$


A good post on TeX etiquette and formatting could be supplied here on Mathematics Meta - this post could be linked when educating people. We may possibly (no guarantee) even be able to link to said post from the aforementioned editing help, provided it is authoritative enough by your community standards.

Outside of a standard location on Mathematics Meta, I'm otherwise not sure where would even be a good idea to put that kind of information.