Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Very much related: Define pretty sets in LaTeX; esp., how to do the condition-separator? (possible duplicate?) –  Hendrik Vogt Mar 18 '11 at 17:30
add comment

1 Answer

up vote 3 down vote accepted

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\}$
share|improve this answer
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). –  Michael Ummels 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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