[Tex/LaTex] Using commas in mathematical formulas

math-modepunctuationspacing

I need write some formula, but I don't know how to arrange the comma's place.

$p,\ q\in N$, blabla $0<a,\ b<1$ blabla $i,\ j=1,\ 2,\ \dots,\ n$

or

$p,\;q\in N$, blabla $0<a,\;b<1$ blabla $i,\;j=1,\;2,\;\dots,\;n$

or

$p$, $q\in N$, blabla $0<a$, $b<1$ blabla $i$, $j=1$, 2$, $\dots$, $n$

or

$p$,~q\in N$, blabla $0<a$,~$b<1$ blabla $i$,~$j=1$,~$2$,~$\dots$,~$n$

which one is more acceptable?

Best Answer

There are some subtleties in this kind of sentences.

You have to decide whether the space in something like "p and q belong to N" you want a normal space after the comma or not and then be coherent across the document. So you can do either

$p$,~$q\in N$

or

$p,q\in N$

In the first form the tie is necessary, or you may get

p,<line break>q ∈ N

which is unacceptable. I prefer, for this case, the second form that makes clearer that the two variables are treated in the same fashion. In this case we can consider that the comma belongs to the formula, being just a shorthand: $p,q\in N$ actually stands for the longer and clumsy $p\in N$ and $q\in N$.

To the contrary, some conditions applying to one or more variables should better go in different formulas; therefore

$0<a,\ b<1$

should be considered wrong because (as shown in the comments below, which refer to the previous version of this answer) it is ambiguous: does it mean that a is greater than zero and b is less than one or that both should be between zero and one? So separate them:

$0<a<1$, $0<b<1$

should be preferred if both variables vary between zero and one. One might use

$a,b \in (0,1)$

which seems, however, a bit too technical.

Something similar applies to ranges, but the commas in the range aren't part of the formula, so

$i,j=1$, $2$,~\dots, $n$

is, in my opinion, the preferred way to go. For the first bit the choice made for the above case should be respected, of course. One might also do

$i,j=1$,~$2$,~\dots, $n$

so as to ensure that no line break is taken after the 1. In difficult line breaking cases, that tie can be removed. There's no problem with a line break after the dots, because a range is expected. An input such as

$i,j=1,2,\dots,n$

results in too crowded an output (and poses line breaking problems).

A hint: whenever you feel the necessity to use \␣ (control space) or \; in a formula, ask yourself whether it's better to do separate formulas.

Related Question