I would like to create a command which prints its arguments in a set builder notation. The problem
\documentclass{article}
\newcommand{\set}[2]{\left\{\ #1 \ \left| \ #2 \ \right. \right\} }
\begin{document}
$\set{A}{ (B) }$
\bigskip
$\set{A}{\Bigg(B\Bigg)}$
\bigskip
% but:
$\set{\Bigg(A\Bigg)}{B}$
\end{document}
is that my attempt to make the height of the middle bar automatically adjusted to the contents of the set, only works wih respect to the content of the right hand side of it. I know I could use the colon instead, but I just don't like the way it looks.
Is there any simple work around?
Thanks in advance


\middle– egreg Apr 10 '18 at 21:25