TeX will not break a line at the “control space”, because it's allowed to break lines in formulas only after binary operators such as +
or =
. Glue in math mode is not an allowed break point.
The spaces in
$a,\ b$, and $c$
will be different, because TeX adds a thin space between a punctuation atom (the comma) and an ordinary atom (the ‘b’), independently of any explicit intervening glue (or penalty).
So the “correct” way should be
$a$,~$b$, and~$c$
The three variables are just names, from a grammatical point of view, so this is no different from
Moe, Larry, and~Curly
Whether you should use the Oxford comma or not is up to your personal preference (I wouldn't).
Why no tie between Moe,
and Larry
, but one between $a$,
and $b$
? Because single variables in a text are much less prominent than a multiletter word, so it's better to help TeX in not letting it add a line break there.
I generally recommend to liberally use ~
, so maybe
Moe,~Larry, and~Curly
would be even better. If TeX is not able to correctly break the paragraph, we can decide whether to remove a tie.
What about “for i=1,2,...,n” (that I wrote in obviously wrong way here)?
The list of numbers forms a syntactical unit, so it should be
for~$i=1,2,\dots,n$
Such a choice could be debatable, so I'll stop here.
$
's."