# Comma placement inline math

In the following sentence

If all $f(x_j), j=1,\dots,N$ are positive, then ...

Do you think there should be a comma after the $N$? I always considered the math as a single unit and read the sentence as

If all [MATH] are positive, then ...

Accordingly I only put commas when the surrounding sentence required them, as in

Given $f(x_j), j=1,\dots,N$, our goal is to ...

I am asking because I observed a lot of authors not following my thinking. However, there are also some that more or less do put the commas as I do, so I wondered if you know about guidelines regarding this question or simply have a definite opinion about it.

• Personally, I like to treat my math as if it's part of the sentence. Also I don't like to have two different math statements next to each other without words. I'd do something like "Given $f(x_j)$, where $j=1,\ldots,N$, our goal is to..." – vrugtehagel Feb 11 '16 at 8:14
• What about the first example? "If all $f(x_j)$, where $j=1,\dots,N$, are positive" breaks the sentence apart. "If all $f(x_j)$ are positive, where $j=1,\dots,N$" breaks the math apart. – Bananach Feb 11 '16 at 8:24
• I don't see what's wrong with "If all $f(x_j)$, where $j=1,\ldots,N$, are positive", but you can also do "If $f(x_j)$ is positive for all $j=1,\ldots,N$" – vrugtehagel Feb 11 '16 at 8:30
• The two phrases are grammatically different. In the first, there shouldn't be a comma after $N$; in the second, there should be one after "positive". Forget about whether there's math present: this would be true if the sentences were "If each of John, Mary, and Joe are happy, then ...", and "Given that we have amassed all the data, our goal should now be to...". – BrianO Feb 11 '16 at 8:32
• But "If all $f(x_j), j=1, ... N$" isn't a restrictive clause, it isn't even a clause. You don't have a full clause until you get to the end of "are positive", where of course a comma is required. It reads badly and goes "bump* to have a comma after $N$. You wouldn't write "If Moe, Larry, and Curly, are funny, then ...", and you wouldn't write "If the integers, are rationals, then...". – BrianO Feb 11 '16 at 8:41

If all $$f(x_j)$$ are positive (as $$j$$ ranges from $$1$$ to $$N$$), then…
If for all $$j$$ with $$1 \leq j \leq N$$ we have $$f(x_j)$$ positive, then…
If all $$f(x_j)$$ (where $$j = 1, \dots, n$$) are positive, then…