What's the correct pipe-symbol for conditional probabilities and set-builder-notation?

If I want to typeset conditional probabilities (e.g. P[A | B]) or set-builder-notation (e.g. {x | x ∈ ℝ}), what symbol should I use for the vertical bars? Candidates are bar.v (producing and equivalent to “|”) and divides (producing and equivalent to “∣”).

Arguments for bar.v:

  • Found on most keyboards, hence significantly easier to type
  • The official docs use it in set-builder-notation examples, e.g. here.
  • The vertical bar in conditional probabilities and set-builder-notation has nothing to do with divisibility, so using a symbol called divides seems unidiomatic.

Arguments for divides:

  • Before issue #306 (sorry, I can only add two links per post) got fixed, I think divides was the only way to typeset conditional probabilities and set-builder-notation? Nowadays, both divides and bar.v produce very similar (though not identical!) output.
  • The LaTeX-counterpart to bar.v is \vert, and the LaTeX-counterpart to divides is \mid. In LaTeX, conditional probabilities and set-builder-notation should be typeset with \mid, according to this stackexchange answer.

One rather common suggestion would be to use mid(|) i.e the regular bar but with a call out to mid which ensures it has the same height as the surrounding brackets. I won’t vote for which symbol to use, but use one with mid. physica has a Set function and uses mid(|).

Such as this:

${(x, y) | f(x) / g(x) = 1}$ \ \
${(x, y) mid(|) f(x) / g(x) = 1}$ \ \
${(x, y) divides f(x) / g(x) = 1}$  \ \
${(x, y) mid(divides) f(x) / g(x) = 1}$

bild

1 Like

Thank you. Yes, mid should be used, but it still doesn’t decide what symbol is preferable. physica’s Set is weak evidence for bar.v.