# How can you address the size of surrounding parentheses whose size is determined by \left and \right? [duplicate]

Possible Duplicate:
How to automatically resize the vertical bar in a set comprehension?

Trying to type the formula for a conditional probability like this

\mathrm{P} \left( whatever \mid whatever \right) = ...,


I'd like to have \mid the same size as the left and right parentheses.

How can I achieve this?

-
@Martin: Thanks for correcting the layout! –  j.p. May 5 '11 at 15:05

## marked as duplicate by Juan A. Navarro, Leo Liu, lockstep, Caramdir, Alan MunnMay 7 '11 at 14:24

use \middle| or for a double \middle|\middle|

$\left( \frac{a}{b^2}+1\middle| f(x)\right)$

-
Arg, 12sec to late ... I would have used \middle\vert, but \middle| seems to do the same. –  Martin Scharrer May 5 '11 at 15:07
I was 29 seconds too late... –  Gonzalo Medina May 5 '11 at 15:11
@Herbert: Thanks, works fine (I just have to adjust the spaces around the | a little)! –  j.p. May 5 '11 at 15:13
@Martin: Sorry, but you could have been a little less altruistic and first answer the question before beautifying it. –  j.p. May 5 '11 at 15:15
@Herbert: \vert is the same as |, \Vert is the same as \| –  egreg May 5 '11 at 16:04
\middle doesn't add spaces around the symbol it produces and treats it as an ordinary symbol, like when we say \bigg| or even \bigg(. On the other hand it can't be put inside \mathrel.
The problem might arise when when \middle is used in a subscript; one can say either of
\left( something \nonscript\;\middle|\nonscript\; something \right)

and the result will be the same as if we used \mid (of course if we decide that this vertical bar must be treated as a relation symbol). This is for writing macros that use the \middle feature, as in direct input one knows what space is necessary.