2

I would like to have an array as a list of matrices but keep getting the error "Extra }, or forgotten \right.". As an example, I have the following:

\begin{align*}
    \mathcal{X} = \left[ \left[
    \begin{bmatrix}
        5 & 1 & 4 & 5 \\
        1 & 1 & 1 & 4 \\
        5 & 3 & 1 & 4  
    \end{bmatrix},
    \begin{bmatrix}
        5 & 3 & 4 & 4 \\
        2 & 5 & 3 & 4 \\
        2 & 2 & 4 & 4  
    \end{bmatrix} \right], \left[
    \begin{bmatrix}
        2 & 3 & 1 & 2 \\
        1 & 5 & 4 & 2 \\
        3 & 4 & 5 & 3  
    \end{bmatrix},
    \begin{bmatrix}
        2 & 3 & 1 & 4 \\
        4 & 4 & 2 & 1 \\
        4 & 1 & 1 & 1  
    \end{bmatrix} \right], \\ \left[
    \begin{bmatrix}
        5 & 5 & 4 & 3 \\
        5 & 1 & 4 & 2 \\
        1 & 2 & 1 & 2
    \end{bmatrix},
    \begin{bmatrix}
        5 & 1 & 4 & 1 \\
        3 & 1 & 5 & 4 \\
        5 & 4 & 2 & 3
\end{bmatrix} \right] \right]
\end{align*}

but the final bracket will not be printed on the screen. This is shown here array

Is there a way of making the bracket appear or better yet, doing this in a more organized way? I have tried \Biggr[ but the bracket is not of the same size. Likewise I have tried creating more matrices but has similarly not worked. Thanks.

1
  • 3
    Welcome to TeX.SX! \left and \right cannot straddle a line break in a display alignment.
    – egreg
    Commented Dec 28, 2022 at 22:45

1 Answer 1

1

\left and \right cannot straddle two lines in an alignment display.

In this case you can match the opening \left[ with \right. and do similarly in the second line.

\documentclass{article}
\usepackage{amsmath}
\usepackage{showframe}% just to see the page margins

\begin{document}

\begin{align*}
\mathcal{X} =
% outer
\left[
  \left[
    \begin{bmatrix}
        5 & 1 & 4 & 5 \\
        1 & 1 & 1 & 4 \\
        5 & 3 & 1 & 4  
    \end{bmatrix},
    \begin{bmatrix}
        5 & 3 & 4 & 4 \\
        2 & 5 & 3 & 4 \\
        2 & 2 & 4 & 4  
    \end{bmatrix}
  \right],
  \left[
    \begin{bmatrix}
        2 & 3 & 1 & 2 \\
        1 & 5 & 4 & 2 \\
        3 & 4 & 5 & 3  
    \end{bmatrix},
    \begin{bmatrix}
        2 & 3 & 1 & 4 \\
        4 & 4 & 2 & 1 \\
        4 & 1 & 1 & 1  
    \end{bmatrix}
  \right],
\right. % match with \left[
 \\
\left.
  \left[
    \begin{bmatrix}
        5 & 5 & 4 & 3 \\
        5 & 1 & 4 & 2 \\
        1 & 2 & 1 & 2
    \end{bmatrix},
    \begin{bmatrix}
        5 & 1 & 4 & 1 \\
        3 & 1 & 5 & 4 \\
        5 & 4 & 2 & 3
    \end{bmatrix}
  \right]
\right]
\end{align*}

\end{document}

enter image description here

Remove showframe that's used here just to see that the alignment fits.

An alternative version:

\documentclass{article}
\usepackage{amsmath}
\usepackage{showframe}% just to see the page margins

\begin{document}

\begin{align*}
\mathcal{X} =
% outer
\left[ \vphantom{\begin{matrix}0\\0\\0\end{matrix}}\right.
& \left[
    \begin{bmatrix}
        5 & 1 & 4 & 5 \\
        1 & 1 & 1 & 4 \\
        5 & 3 & 1 & 4  
    \end{bmatrix},
    \begin{bmatrix}
        5 & 3 & 4 & 4 \\
        2 & 5 & 3 & 4 \\
        2 & 2 & 4 & 4  
    \end{bmatrix}
  \right],
\\
& \left[
    \begin{bmatrix}
        2 & 3 & 1 & 2 \\
        1 & 5 & 4 & 2 \\
        3 & 4 & 5 & 3  
    \end{bmatrix},
    \begin{bmatrix}
        2 & 3 & 1 & 4 \\
        4 & 4 & 2 & 1 \\
        4 & 1 & 1 & 1  
    \end{bmatrix}
  \right],
\\
& \left[
    \begin{bmatrix}
        5 & 5 & 4 & 3 \\
        5 & 1 & 4 & 2 \\
        1 & 2 & 1 & 2
    \end{bmatrix},
    \begin{bmatrix}
        5 & 1 & 4 & 1 \\
        3 & 1 & 5 & 4 \\
        5 & 4 & 2 & 3
    \end{bmatrix}
  \right]
\left.\vphantom{\begin{matrix}0\\9\\9\end{matrix}}\right]
\end{align*}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .