I have a simple command which I use to write set comprehensions so that the braces automatically resize with respect to size of the enclosed arguments, e.g.

```
\usepackage{amsmath}
\newcommand{\set}[1]{\left\lbrace #1\right\rbrace}
\begin{equation*}
\set{x \in X \mid x > \frac{1}{2}}
\end{equation*}
% Produces something like: { x : X | x > 1/2 }
```

However, the `\mid`

vertical bar wont resize like the braces `{ .. }`

do. How can I get the `\mid`

to resize as well?

## Best Answer

You can use

`\middle|`

instead of`\mid`

likeor with better spacing

(I think this requires a somewhat modern TeX-distribution.)