# How to typeset mathematical set with conditions in multiple rows [duplicate]

With the TeX code

$$\max\left\{ \sum_{i=1}^{n}|\langle x^{(i)},b\rangle|^2\;\mid\vbox{ \hbox{Condition 1} \hbox{Condition 2} \hbox{Condition 3} }\right\}$$


I get the output

How can I achieve the following two things?

1. The separator produced by \mid shall have the same height as the curly brackets.
2. The three conditions shall be centered vertically.

## marked as duplicate by egreg math-mode StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Dec 6 '16 at 20:58

You can use a tabular instead of the \vbox:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$$\max\left\{ \sum_{i=1}^{n}|\langle x^{(i)},b\rangle|^2\; \begin{tabular}{|l} Condition 1 \\ Condition 2 \\ Condition 3 \end{tabular} \right\}$$
\end{document}


Use \middle\vert to draw a full-height vertical bar. Use an array environment to hold the conditions -- I assume the conditions will be mostly math-mode material.

\documentclass{article}
\usepackage{amsmath} % for "\text" macro
\begin{document}
$$\max \left\{ \sum_{i=1}^{n}|\langle x^{(i)},b\rangle|^2 \;\middle\vert\; \begin{array}{@{}l@{}} \text{Condition 1}\\ \text{Condition 2}\\ \text{Condition 3} \end{array} \right\}$$
\end{document}

• This is also a perfect answer. Can \middle be also applied to different things than \vert to stretch them? – phinz Dec 6 '16 at 19:41
• @phinz: \middle can be applied to any stretchable "fence" symbol, not just \vert. Give \Vert a try, say. – Mico Dec 6 '16 at 19:44