I write a lot |, for instance, even numbers = \{ z | z \in Z, z mod 2 = 0 \}. But the space around | does not look enough... I tried \mathbin{|} and \quad | \quad, they do not look great either...

Could anyone tell me a conventional way to put space around |?

  • 1
    How about \mid? – Werner Nov 14 '11 at 9:26
  • You should write z \equiv 0 \pmod{2} or z \bmod 2 = 0. – Andrey Vihrov Nov 14 '11 at 9:27

Actually you were on the right track, but it's \mathrel{|}, for which LaTeX has the abbreviation \mid.

The formula should be more correctly written as

\{\, z \mid z\in Z, z \bmod 2 = 0 \,\}
\{\, z \mid z\in Z, z \equiv 0 \pmod{2} \,\}
\{\, z\in Z \mid z \bmod 2 = 0 \,\}
\{\, z\in Z \mid z \equiv 0 \pmod{2} \,\}

Take your pick. If you write something like "even numbers = {z ...}" (which I don't like, preferring to say "the even numbers are those in the set {z ...}"), put the equals sign inside the formula

even numbers~\(=\{\, ... \,\}

or, if the text is already inside math mode (in an alignment, for instance), use

\text{even numbers} = \{\, ... \,\}

Note that \text is provided by the amsmath package.

  • I wonder if there is a semantically better way to typeset set definitions, as \, does not appeal to me. – Andrey Vihrov Nov 14 '11 at 10:08
  • 2
    @AndreyVihrov The \, is a matter of personal taste. One way to avoid it might be to define \lset and \rset to be respectively \{\, and \,\}. Or directly redefining \{ provided it's not used elsewhere: \renewcommand\{{\lbrace\,} and similarly for \} with \rbrace. – egreg Nov 14 '11 at 10:14
  • 1
    The braket package provides the commands \set (online math mode) and \Set (display math mode) to fill just this need. – Mico Nov 14 '11 at 11:07
  • @Mico It's disputable if this is really an improvement. :) – egreg Nov 14 '11 at 11:25
  • @egreg: I'm with you -- I just insert the spacing commands to the right of the opening curly and to the left of the closing curly brace by hand; remembering the syntax of \set{... is too cumbersome, given the relatively low frequency of needing to use it arises in my work. – Mico Nov 14 '11 at 11:40

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.