答案1
欢迎来到 TeX.SE!
使用nicematrix
和tikz
包:
\documentclass[border=3mm,preview]{standalone}
\usepackage{nicematrix}
\usepackage{tikz}
\usetikzlibrary{fit}
\newcommand\mcc[1]{\multicolumn{1}{c}{#1}}
\begin{document}
\[
\begin{NiceMatrix}
& M_1 & M_2 & M_3 & M_4 \\
J_1 & 0 & 0.66 & 2 & 0.33 \\
J_2 & 1 & 0 & 1.22 & 0.33 \\
J_3 & 0 & 1 & 2 & 1 \\
J_4 & 2.33 & 0.33 & 1.67 & 0 \\
\CodeAfter
\tikz{
\node (f) [draw, inner xsep=1em, fit=(2-2) (5-5)] {};
\draw[line width=3pt, opacity=0.2]
(2-2 |- f.north) -- (5-2 |- f.south)
(3-2 -| f.west) -- (3-5 -| f.east)
(5-2 -| f.west) -- (5-5 -| f.east);
}
\end{NiceMatrix}
\]
\end{document}
经过两次编译你将获得: