请帮助我用 LaTeX 生成此矩阵。我尝试过以下方法:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mleftright}
\begin{document}
[
\renewcommand\arraystretch{1.3}
\mleft[
\begin{array}{c|c|c|c}
\ 0 2 2 \dots 2 \\
202\dots2 \\
\\
\\
\\
222 \dots 0 & 111 & \dots & 11 \\ \hline
\ 111\dots 1 \\
111\dots 1 \\
111 \dots 1 & 022 \ & \dots & 11 \\
\end{array}
\mright]
]
\end{document}
但结果并不完全正确。
答案1
像这样?
\documentclass{article}
\usepackage{amsmath}
\usepackage{mleftright}
\usepackage{array, multirow}
\usepackage[svgnames, table]{xcolor}
\begin{document}
\[
\renewcommand\arraystretch{1.3}
\arrayrulecolor{Silver!80}
\mleft[
\begin{array}{*{5}{c}|ccc|c|cc}
0 & 2 & 2 & \dots & 2 & 1 & 1 & 1 & \multirow{4}{*}[-1ex]{\dots }& 1 & 1\\
2 & 0 & 2 & \dots & 2 & 1 & 1 & 1 & & 1 & 1 \\
\vdots & & & & & & & & & & \vdots\\
2 & 2 & 2 & \dots & 0 & 1 & 1 & 1 & & 1 & 1 \\ \hline
1 & 1 & 1 & \dots & 1& 0 & 2 & 2 & & 1 & 1 \\
1 & 1 & 1 & \dots & 1& 2 & 0 & 2 & \dots & 1 & 1 \\
1 & 1 & 1 & \dots & 1& 2 & 2 & 0 && 1 & 1 \end{array}
\mright]
\]
\end{document}