5

So currently I have curly braces around an array with vertical bars next to only parts of an array using \multicolumn:

\[
f_{i_k}(a)=
\left\{
\begin{array}{|c|c|c|r}
\multicolumn{1}{c}{k=1} & \multicolumn{1}{c}{k=2} & \multicolumn{1}{c}{k=3} \\ 
A'(a), & B(a), & C(a), &i=1 \\
A(a), & B'(a), & C(a), &i=2 \\
A(a), & B(a), & C'(a), &i=3
\end{array}
\right.
\]

which gives me this:

what I don't want

However I want the curly brace to only extend around the the rows with vertical bars, i.e. the bottom three rows.

Any ideas on how I'd do this? simply putting \left\{ and \right. within the array does not seem to work

2 Answers 2

2

This is a solution using nested arrays and involves manual adjustments. I'll provide another automatic solution with blkarray package.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\[
f_{i_k}(a)=
\begin{array}{c}
    \begin{array}{cccr}
        k = 1 & \,k = 2\, & \,k = 3 & \hspace{1.2em} \\
    \end{array}\\ 
    \left \{
    \begin{array}{|c|c|c|r}
        A'(a), & B(a), & C(a), &i=1 \\
        A(a), & B'(a), & C(a), &i=2 \\
        A(a), & B(a), & C'(a), &i=3
    \end{array}
    \right.
\end{array}
\]

\end{document}

enter image description here

Using \usepackage{blkarray}, this is another option:

\[
f_{i_k}(a) = 
\begin{blockarray}{ccccr}
  &k=1 & k=2 & k=3 & \\
  \begin{block}{@{}c\{@{}|c|c|c|r}
    &A'(a), & B(a) , & C(a) , & i=1 \\
    &A(a) , & B'(a), & C(a) , & i=2 \\
    &A(a) , & B(a) , & C'(a), & i=3 \\
  \end{block}
\end{blockarray}
\]

with a slightly different result:

enter image description here

0
2

Here is a solution with {NiceArray} of nicematrix.

I have used {NiceArray} with the key first-row, and, so, there is no vertical rules in that ``first-row''.

For the vertical brace, I have used the command \SubMatrix available in the \CodeAfter of the environment {NiceArray}.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\[
f_{i_k}(a)= \quad
\begin{NiceArray}{|c|c|c|r}[first-row]
k=1 & k=2 & k=3 \\ 
A'(a), & B(a), & C(a), &i=1 \\
A(a), & B'(a), & C(a), &i=2 \\
A(a), & B(a), & C'(a), &i=3
\CodeAfter \SubMatrix{\{}{1-1}{3-1}{.}[left-xshift=0.5em]
\end{NiceArray}
\]
    
\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes).

Output of the above code

If you prefer to align the equality with the brace, use the key baseline:

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\[
f_{i_k}(a)= \quad
\begin{NiceArray}{|c|c|c|r}[first-row,baseline=2]
k=1 & k=2 & k=3 \\ 
A'(a), & B(a), & C(a), &i=1 \\
A(a), & B'(a), & C(a), &i=2 \\
A(a), & B(a), & C'(a), &i=3
\CodeAfter \SubMatrix{\{}{1-1}{3-1}{.}[left-xshift=0.5em]
\end{NiceArray}
\]

\end{document}

Output of the second code

You must log in to answer this question.

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