答案1
像这样:
\documentclass{article}
\usepackage{slashbox}
\usepackage{multirow}
\begin{document}
\begin{table}[]
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\multirow{2}{*}{\backslashbox{B}{9}}} & \multicolumn{2}{c|}{J} & \multicolumn{2}{c|}{M} \\ \cline{3-6}
\multicolumn{2}{|c|}{} & K & L & M & O \\ \hline
\multirow{2}{*}{A} & B & & & & \\ \cline{2-6}
& C & & & & \\ \hline
\multirow{2}{*}{O} & E & & & & \\ \cline{2-6}
& F & & & & \\ \hline
\end{tabular}
\end{table}
\end{document}
答案2
nicematrix
具有优秀包的类似示例
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{NiceTabular}{wc{5mm}cccc}[hvlines,corners=NW]
& \;\diagbox{A}{B} & \Block{}{C \\ D} & \Block{}{ E \\ F} & \Block{}{ G \\ longer} \\
\Block{4-1}{H1} & I & text 1 & & text \\
& J & text 2 & & text \\
& K & text & & other text \\
& L & text & & text \\
\Block{4-1}{H2} & M & text & smth & text \\
& N & text & & text \\
& O & text & & text \\
& P & text text & & text \\
\end{NiceTabular}
\end{document}