答案1
为了好玩,我使用了\fcolorbox
es 和\fbox
es 的堆栈。
\documentclass{article}
\usepackage{xcolor,stackengine}
\begin{document}
\fboxsep=-.5pt\relax\fboxrule=1pt\relax
\ensurestackMath{\Longunderstack{m_1 m_2 m_3 m_4}} \fbox{%
\fboxrule=.5pt\fboxsep=2.5pt\relax
\Longunderstack[l]{\fcolorbox{black}{gray}{\textcolor{white}{\makebox[106pt]{124}}} {} {} \,M}%
\Longunderstack{{} \fcolorbox{black}{gray}{\textcolor{white}{\makebox[10pt]{8}}}}%
\Longunderstack{{} {} \fcolorbox{black}{gray}{\textcolor{white}{\makebox[8pt]{6}}}}%
\Longunderstack{{} {} {} \fcolorbox{black}{gray}{\textcolor{white}{\makebox[8pt]{6}}}}%
}\par
\bigskip
\ensurestackMath{\Longunderstack{m_1 m_2 m_3 m_4}} \stackunder{\fbox{%
\fboxrule=.5pt\fboxsep=2.5pt\relax
\Longunderstack[l]{\fcolorbox{black}{gray}{\textcolor{white}{\makebox[33pt]{36}}} {} {} \,M$'$}%
\Longunderstack{{} \fcolorbox{black}{gray}{\textcolor{white}{\makebox[33pt]{36}}}}%
\Longunderstack{{} {} \fcolorbox{black}{gray}{\textcolor{white}{\makebox[33pt]{36}}}}%
\Longunderstack{{} {} {} \fcolorbox{black}{gray}{\textcolor{white}{\makebox[33pt]{36}}}}%
}}{$N=500$ samples}
\end{document}