Suppose I want to define a set of elements satisfying two conditions, such as:

$\{ f(x,y) \mid 2<x<5, 7<y<10 \}$

Semantically, I am using the comma character to separate the two clauses of the definition, 2<x<5 and 7<y<10. But TeX treats the comma in math mode as a regular math symbol, with no extra spacing around it and not allowing a line break after it. By contrast, the relation symbol < does seem to be surrounded by slightly more space, and TeX allows a line break after it. As a consequence, if a line break is necessary inside this set definition (in inline math mode), TeX will allow it after < but not after , --- which is contrary to the intended parsing of the content.

It may be possible to solve these visual problems by adding \allowbreak (or some other solution) and manually forcing a math-mode space. But in the spirit of TeX's goal of separating content from layout, I get the impression that I'm missing something. It seems that the comma symbol is not the correct character for this purpose.

An alternative to the comma might be an ampersand, as in:

$\{ f(x,y) \mid 2<x<5 \& 7<y<10 \}$

But & is an ordinary math character just like ,, so that this doesn't solve any problem.

What is the semantically correct way to separate clauses in a set definition?

  • Sorry, but there is no “semantically correct” way; there are a few, choose one and be consistent. I'd exclude \& from consideration. – egreg Mar 23 '17 at 18:30

The intention of this answer is, firstly, to propose using the word "and" as it makes it easier visually to separate the two conditions and, secondly, to promote the use of a few simple commands for sets which make sure that the closing brace is never missing and which define in a single place whether \mid, \colon or any other separator is used.

enter image description here


$\Set{f(x,y)}{(2<x<5) \land (7<y<10)}$

$\SET{f(x,y)}{$2<x<5$ and $7<y<10$}$

$\SET{f(x,y)}{$2<x<5$, $7<y<10$}$

I don't know if I may present this as an answer, but I'll certainly try. The crux of the problem is that & was never intended for clause notation. On the other hand, if you use nice (and correct) logical notation, you'll get through just fine. I am a mathematician and I've seen many mathematical papers, but none of them got a hold of & symbol. I don't want to impose my aesthetic views of you, but just for the sake of universal clarity, I suggest that you use \wedge, \vee and other logical symbols from now on. Anyway, here is the code.


$\{ f(x,y) \mid (2<x<5) \wedge (7<y<10) \}$

enter image description here

  • Use \[ ...\] instead of $$...$$. See tex.stackexchange.com/questions/503/why-is-preferable-to. – Troy Mar 23 '17 at 15:57
  • I know that \[...\] is a better way to go, but I wanted to keep it as similar to Ari's original MWE as possible. He/She has more than 1000 reputation, she surely knows TeX very well, so I didn't deem this method you reminded me of worth mentioning. – Gregor Perčič Mar 23 '17 at 16:04
  • 1
    Ari's original MWE is inline math, with single $. Anyway, it's best to ensure your answer is in its most correct form, since your answer may be seen by others apart from OP. – Troy Mar 23 '17 at 16:10
  • Oh, I see. Excuse me, I naturally typed $$...$$ instead of $...$. Examine my code in about two minutes, I'll fix my mistake as I don't want people to use primitive $$...$$ instead of \[...\]. And as we are on the topic of display commands, $...$ is also very inferior to \(...\). – Gregor Perčič Mar 23 '17 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.