1

I want to use nested braces but the following code is giving errors. What is wrong here? How can I correct it?

$\psi_n(x)=
\begin{cases}
    \begin{aligned}
        &1  &= &\ 2\\
        &3  &= &\ 4\\
        &5  &= &\ 6\\
        &7  &= &\ 8\\
        \begin{rcases}
            &9  &= & 10\\
            &11 &= & 12
        \end{rcases} \text{13}
    \end{aligned}
\end{cases}
$\\
  • 1
    Did you load mathtools? – egreg Jan 27 at 15:34
  • Unrelated: does your aligned environment have two alignment columns? – Bernard Jan 27 at 15:40
  • rcases admits only two columns, so only one & per line is allowed. But your usage of & also in the aligned block is quite wrong. Could you post some image of how the output is supposed to look like? – campa Jan 27 at 15:45
  • When I made it two two columns, it worked. Actually, in my case each digit is an expression. Is there a way to use nested braces (big left opening brace and right small one) and still able to align at more than two columns? – pba Jan 27 at 16:00
  • I'm surprised that this is coded as in-line math rather than as a display environment. The multiple & are following the pattern of the deprecated eqnarray, not what is defined with amsmath. (I'm not able to experiment just now, but will try later.) – barbara beeton Jan 27 at 18:53
2

Here's a way to do this with a mixture of \left and \right delimiters. Null delimiters (like \left. and \right.) are corrected for using \kern-\nulldelimiterspace.

enter image description here

\documentclass{article}

\usepackage{amsmath,array}

\begin{document}

\[
  \setlength{\arraycolsep}{0pt}% No column separation
  %\renewcommand{\arraystretch}{1.2}% Stretch out array display
  A = \left\{\begin{array}{ l }
    \begin{array}{ r<{{}} r }
      \phantom{11 ={}}& \phantom{12} \\[-\normalbaselineskip]% For alignment with next array
       1 =&  2 \\
       3 =&  4 \\
       5 =&  6 \\
       7 =&  8 \\
    \end{array} \\
    \left.\kern-\nulldelimiterspace\begin{array}{ r<{{}} r }
       9 =& 10 \\
      11 =& 12
    \end{array}\right\} \text{13}
  \end{array}\right.\kern-\nulldelimiterspace
\]

\end{document}

You could also add \renewcommand{\arraystretch}{1.2} for a more align-like spacing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.