I want to display the structure of a matrix as shown in the image below:
Can this be done using pmatrix
and \underbrace
?
My attempt at combining pmatrix
and \underbrace
results in a compile error.
\documentclass{standalone}
\usepackage{amsmath}
\begin{document}
$
\begin{pmatrix}
%1 & \underbrace{1 & \cdots & 1}_{k} \\ % compile error!
1 & 1 & \cdots & 1 \\
1 & 1 & 1 & 1
\end{pmatrix}
$
\end{document}
Best Answer
A combination of
\smash[b]
should work:If you don't want to space the dots in the underbraced blocks, then change the definition:
For getting the underbrace only inside the delimiters, it's more complicated, because we don't want that the underbrace is considered when sizing the delimiters, yet we want to consider the vertical space taken by it.