[Tex/LaTex] Round bracket under a matrix

bracketsmatrices

\begin{flalign*}
&\left.
\begin{bmatrix}
x_{11} & \cdots & x_{1k} \\
\vdots & \ddots & \vdots \\
x_{n1} & \cdots & x_{nk} 
\end{bmatrix}
\right)~\text{$n$ observations}&
\end{flalign*}

enter image description here

I want to draw a round bracket under the matrix with text
"k variables". I know how to draw a round bracket on the left and right side
of the matrix, but I don't know how to draw it under the matrix.

Best Answer

Regardless of how you define the "underfence" (by using abraces or, as I prefer, defining them myself) the tricky part is in my opinion the width of this underfence. I therefore first put the "bare" matrix in a box and add all brackets/parentheses later

\documentclass{article}

\usepackage{amsmath}
\usepackage{abraces}

\begin{document}

\[
\setbox0=\hbox{$\displaystyle
\begin{matrix}
x_{11} & \cdots & x_{1k} \\
\vdots & \ddots & \vdots \\
x_{n1} & \cdots & x_{nk} 
\end{matrix}$}
%
\left[\rule{0pt}{\ht0}\right.
\aunderbrace[l1r]{\copy0}_{\text{\normalsize$k$ variables}}
\left.\vphantom{\copy0}\right]
\left.\rule{0pt}{.9\ht0}\right)~\text{$n$ observations}
\]

\end{document}

enter image description here

Related Question