I have a mathematical set notation that I want to display inline in a paragraph of text. However, when I write this, the output is not very beautiful:

$\{ (w_j,\dots,w_{j+n-1}) | 0 \leq j \leq k-1-n\}$

The curly braces look a bit too small, but it's bearable. What's worse is the spacing, I think: the curly braces are too close to the opening parenthesis on the left side and the "n" on the right side. The same with the pipe symbol in the middle: it's practically glued to the closing parenthesis and the "0".

Overall the tight spacing makes the definition difficult to read. So I wonder if there is a "better" way to write the above set, so that the output is more esthetically pleasing.


Use \left\{ ... \mid ... \right\}. The spacing of the curly braces looks fine to me, but if you insist on more spacing you can add a \, between the \left\{ and the (. So, the complete equation becomes

$\left\{ (w_j,\dots,w_{j+n-1}) \mid 0 \leq j \leq k-1-n \right\}$

or, with the extra spacing

$\left\{\, (w_j,\dots,w_{j+n-1}) \mid 0 \leq j \leq k-1-n\,\right\}$
  • 3
    I'd like to add that in general \left...\right with in inline mathematics, should be used with extreme care, because they can easily become too large, and thus alter the line space
    – daleif
    Mar 18 '11 at 15:50
  • 2
    I second that. Also, if you use \left\{ and \right\}, it makes sense to use \middle| instead of \mid, so that the vertical bar has the same size as the curly braces (note that \mid is not scalable). Mar 18 '11 at 18:19
  • Ah, I did not know about the difference between \mid and \middle. I will revise my answer later this evening, explaining a bit more about delimiter sizing and stuff like that. Thanks for the additional info.
    – Michel
    Mar 18 '11 at 18:43

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.