答案1
这是一个使用嵌套array
环境的解决方案。
\documentclass{article}
\usepackage{amsmath} % for "\text" macro
\newcommand\curlygroup[1]{%
\left.\begin{array}{@{}c@{}}
\vphantom{x_11} \\ \vphantom{vdots} \\ \vphantom{x_11}
\end{array}\right\} \text{#1}}
\begin{document}
\[
\setlength\arraycolsep{2pt}
\left[\begin{array}{cccc}
x_{11} & x_{12} & \cdots & x_{1p} \\
\vdots & \vdots & \ddots & \vdots \\
x_{k1} & x_{k2} & \cdots & x_{kp} \\
\hline
x_{k+1,1}&x_{k+1,2}& \cdots & x_{k+1,p}\\
\vdots & \vdots & \ddots & \vdots \\
x_{n1} & x_{n2} & \cdots & x_{np} \\
\end{array}\right]
\begin{array}{@{}l@{}}
\curlygroup{Group 1}\\[4.5ex]
\curlygroup{Group 2}
\end{array}
\]
\end{document}
答案2
与。{bNiceMatrix}
nicematrix
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\[
\setlength{\arraycolsep}{2pt}
\begin{bNiceMatrix}[margin,last-col=5]
x_{11} & x_{12} & \cdots & x_{1p} & \Block{3-1}{\quad \text{Group } 1} \\
\vdots & \vdots & \ddots & \vdots \\
x_{k1} & x_{k2} & \cdots & x_{kp} \\
\hline
x_{k+1,1}&x_{k+1,2}& \cdots & x_{k+1,p}& \Block{3-1}{\quad \text{Group } 2}\\
\vdots & \vdots & \ddots & \vdots \\
x_{n1} & x_{n2} & \cdots & x_{np} \\
\CodeAfter [sub-matrix/xshift=2mm]
\SubMatrix{.}{1-1}{3-4}{\}}
\SubMatrix{.}{4-1}{6-4}{\}}
\end{bNiceMatrix}
\]
\end{document}