[Tex/LaTex] \left and \right with array

arraysdelimitersmacros

The following definition, from How to continue a piece of text so it is aligned with the last line of an inline multiline box?, allows splitting a math set-builder expression across two lines:

\newcommand\setst[2]{\{#1 : 
   \begin{array}[t]{@{}l@{}}#2 \}\end{array}}

I want:

  1. to change \{ and \} to \left\{ and \right\}, respectively. The following attempt generates an error of a missing `\right. ; and
  2. not to have symbols that would normally be tall in display math, such as integral signs, get squashed down by the array environment.

    What's wrong with my syntax?

    \newcommand\Setst2{\left{#1 : \right. %
    \begin{array}[t]{@{}l@{}}\left.#2 \right}\end{array}}

And how fix the issue of squashed normally-tall symbols retain their noraml display-math height? (See 2nd source file below.)

Example source (modified from above-cited link):

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}

\newcommand\setst[2]{\{#1 : 
  \begin{array}[t]{@{}l@{}}#2 \}\end{array}}

% my attempted mod
\newcommand\Setst[2]{\left\{#1 : \right. %
  \begin{array}[t]{@{}l@{}}\left.#2 \right\}\end{array}}

\begin{document}

Braces OK:
\[
\setst{x}{ x \in S_1 \land {} \\
          (x \in S_2 \lor x \in S_3) }
\]

Error:
\[
\Setst{x}{ x \in S_1 \land {} \\
          (x \in S_2 \lor x \in S_3) }
\]

\end{document}

Here's the printed output from just the "OK" version, using the original command \setst:

Split-line set-builder

The aim is to replace the { and the } in the output with the coresponding large versions — assuming, of course, that the math expression within causes those braces to expand. But each brace should not expand so as to encompass both lines of the printed output!

Here's a more realistic example, where larger braces are really needed:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}

\newcommand\setst[2]{\{#1 : 
  \begin{array}[t]{@{}l@{}}#2 \}\end{array}}

% my attempted mod
\newcommand\Setst[2]{\left\{#1 : \right. %
  \begin{array}[t]{@{}l@{}}\left.#2 \right\}\end{array}}

\begin{document}

Works, but integral sign and absolute value get squashed down smaller than they ought to appear in display math:
\[
\setst{f}{f(t) > 0 \text{ for all $t$ with } 0 < t < 1\\
    \text{and }\left|\int_{0}^{1}e^{-\frac{1}{2} t^{2}}f(t) dt\right| \leq 1 }
\]

\end{document}

And the output from that, with the two braces indicated:

Split-line set-builder #2

Best Answer

I suggest pursuing a less-than-fully-automatic approach to sizing the outer curly braces. In the code below the default size of the outer curly braces is \big, but this may be changed by specifying an optional sizing-related parameter, which may take on values Bigg, bigg, Big (and, of course, big). I favor a minimum size of big (rather than normalsize) as IMNSHO, the curly braces simply need to "look" a bit more prominent.

In the following screenshot, the curly braces in the first example are of size \big (the default); they are of size \bigg in the second, where \displaystyle is in effect for the second row.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for '\DeclarePairedDelimiter' macro
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert} % "absolute value" macro

\newcommand\Setst[3][big]{\csname #1l\endcsname\{ #2 : 
  \begin{array}[t]{@{}l@{}}#3\csname #1r\endcsname \}\end{array}}

\begin{document}
\[
\Setst{f}{\text{$f(t)>0$ for all $t$ with $0<t<1$}\\
          \text{and }\abs[\big]{\int_0^1 e^{-\frac{1}{2}t^2}\!f(t)\,dt}\leq1}
\]

\[ % use \displaystyle directive in second row; hence, use "bigg" curly braces
\Setst[bigg]{f}{\text{$f(t)>0$ for all $t$ with $0<t<1$}\\
  \displaystyle \text{and }\abs[\bigg]{\int_0^1 e^{-\frac{1}{2}t^2}\!f(t)\,dt}\leq1}
\] 
\end{document}
Related Question