Pipe symbol in formula (conditional probability)

I’m trying to type the formula for conditional probability and I’m having trouble finding how to make a pipe (|) symbol. The character itself makes a logical or.

So my question is, how do I write P(A|B)?

To have it behave like an operator (which may sometimes be desirable) you can either use the divides operator (which uses the pipe symbol) or the “binary operator modifier” boper.

Not sure that this will ever be an issue in the context of “A, given B”, but anyway, here goes:

  • P(A divides B)
  • P(A boper | B)

Those are rendered almost the same. As far as I can tell, the boper version adds a little more spacing around the operator than the divides operator, but it is hardly noticeable unless you compare them side by side.

P(A boper | B) is really good. It produces the same MathML then P(A mline B), but the StarMath code carries the mathematical meaning much better.

Nevermind, I figured it out, you just put it in quotation marks:

P( A “|” B )

or as P(A mline B)