## DormanResearch : StretchyMid

Referers: LatexHints :: (Remote :: Orphans :: Tree )
Dorman Wiki
Dorman Lab Wiki
For normal sized conditional probability and conditional expectation expressions, the \mid command from AMS-LaTeX should be used instead of the pipe (|) or \vert because it is defined as a binary relation and gets the spacing right. For example, instead of P(A|B) it is better to write P(A \mid B).

However, like braces, parentheses, and other delimiters, \mid is not stretchy on its own. LaTeX will try to automatically choose the correct size if you use a \left, \middle, and \right as, for example,
P\left( A \;\middle\vert\; B \right).
Since \mid is not stretchy, you must use \vert and add the horizontal space manually with \; commands.

Alternatively, if you need to control the size manually, the \big, \Big, \bigg, and \Bigg constructs will be useful:
P\bigl( A \bigm\vert B \bigr)
P\Bigl( A \Bigm\vert B \Bigr)
P\biggl( A \biggm\vert B \biggr)
P\Biggl( A \Biggm\vert B \Biggr)