# Descriptive row and overbrace, underbrace, spanning multiple columns in a matrix

I would like to have a matrix with round brackets, a descriptive row which is not included in the surrounding brackets and overbraces and underbraces as can be seen in this picture:

I've tried to adapt this \bordermatrix code but did not come far:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

$\phantom{(17') \rightarrow\hspace{\arraycolsep}} \underbrace{ \bordermatrix{ \hspace{-\arraycolsep} & \overbrace{}^{label2} & & \overbrace{}^{label3} \cr & 1 & 1 & 1 \cr & 1 & 1 & 1 } }_{\text{label1}}$

\end{document}


• this might be helpful for the braces: tex.stackexchange.com/a/15336/579 Jul 24, 2017 at 21:10
• @barbarabeeton thanks, this looks interesting, but I don't know how to add the descriptive row. also, having a brace over only one column does not seem to work well
– efie
Jul 24, 2017 at 21:32

Well, I draw this matrix as tikzpicture:

Edit: slightly improved code and matrix looks:

\documentclass[tikz,
border=3mm,
]{standalone}
\usetikzlibrary{decorations.pathreplacing,
matrix,
positioning,
}

\begin{document}
\begin{tikzpicture}[auto,
node distance = 0mm,
every matrix/.style = {matrix of math nodes,
nodes={minimum width=2em},
left  delimiter={(},
right delimiter={)},
},
B/.style = {decorate,
decoration={brace, amplitude=2pt,
pre=moveto,pre length=1pt,post=moveto,post length=1pt,
raise=1mm,
},
},
]
\matrix (m)
{
1   &   1   &   1   \\
1   &   1   &   1   \\
};
\foreach \i in {1,2,3}
\node (a\i) [above=of m-1-\i] {$d_{\i}$};
\draw[B]    (a1.north west) -- node[above=2mm] {label1} (a2.north east);
\draw[B]    (a3.north west) -- node[above=2mm] {label2} (a3.north east);
\draw[B] (m-2-1.south east) -- node[below=2mm] {label3} (m-2-1.south west);
\end{tikzpicture}
\end{document}

• This looks great! Is the same also possible with round brackets?
– efie
Jul 24, 2017 at 21:43
• @efie, yes, it is possible. sorry, I overlook this, now corrected in answer Jul 24, 2017 at 21:47