答案1
该nicematrix
软件包有用于此目的的工具。该\Block
命令按指定方式跨越列和行。columns-width=auto
强制所有列具有相同的宽度。
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\[
\NiceMatrixOptions{cell-space-limits=2mm}
\begin{bNiceArray}{c:cc}[columns-width=auto, margin]
A_{11} & \Block{1-2}{A_{12}} & \\ \hdottedline
\Block{2-1}{A_{21}} & \Block{2-2}{A_{22}} \\[4ex]
&&
\end{bNiceArray}\;
\begin{vNiceArray}{c}[margin]
\Block{1-1}{x_1}\\ \hdottedline
\Block{2-1}{x_2} \\[4ex]
\\
\end{vNiceArray}
\]
\end{document}
或者如果您想要虚线,您可以定义一个custom-line
。请注意,tikz
必须加载此选项。
\documentclass{article}
\usepackage{nicematrix, tikz}
\begin{document}
\[
\NiceMatrixOptions{cell-space-limits=2mm, custom-line={letter=I, tikz=dashed, total-width=\pgflinewidth, command = hdashedline}}
\begin{bNiceArray}{cIcc}[columns-width=auto, margin]
A_{11} & \Block{1-2}{A_{12}} & \\ \hdashedline
\Block{2-1}{A_{21}} & \Block{2-2}{A_{22}} \\[4ex]
&&
\end{bNiceArray}\;
\begin{vNiceArray}{c}[margin]
\Block{1-1}{x_1}\\ \hdashedline
\Block{2-1}{x_2} \\[4ex]
\\
\end{vNiceArray}
\]
\end{document}