在 Overleaf 的 Table 中使用多行和多列

Using multirow and multicoloum in Table in Overleaf

我正在尝试创建一个 table,其中第一列是多列(2 列)和多行(2 行)。错误在第一列(方面)。如何让它发挥作用?

\begin{table}[htb]
\centering
\begin{tabular}{l|c|c|c|c|c}
\hline

\multirow{2}{c}{}\multicolumn{2}{c|}{Aspects} & \multicolumn{4}{c}{Methods} \
\cline{3-6}
 & & Binomial Test & Tangram & Stereoscope & BayesPrism\
\hline
\multirow{10}{*}{\begin{turn}{270}Total Number\end{turn}} & Cell Type 0 & 3381 & 25  & 1200 &  331    \
                               & Cell Type 1 & 1903 & 40  & 3360 &  3468    \
                               & Cell Type 2 & 3466 & 0   & 1357 &  2729    \
                               & Cell Type 3 & 3468 & 40  & 1711 &  412   \
                               & Cell Type 4 & 3406 & 64  & 1996 &  3458   \
                               & Cell Type 5 & 2934 & 31  & 1512 &  1772    \
                               & Cell Type 6 & 494  & 55  & 3463 &  3468   \
                               & Cell Type 7 & 3159 & 30  & 2367 &  3467    \
                               & Cell Type 8 & 3454 & 53  & 3275 &  3456    \
                               & Cell Type 9 & 3281 & 18  & 1320 &  1451    \
            \hline
\multicolumn{2}{c|}{Total Variables}     & 28,946 & 356 & 21,443 & 23,962\
\multicolumn{2}{c|}{Residual Error Mean} & 3.04   & 3.50 & 2.92  & 2.93 \
\hline
\end{tabular}
\caption{Total Number of Each Cell Types for The Model \ref{regression}}
\label{total_cell}
\end{table}

这一行完全乱七八糟:

\multirow{2}{c}{}\multicolumn{2}{c|}{Aspects} 

\multirow语法错误,而且\multirow必须在\multicolumn里面才能组合(见multirow手册)。

我还添加了一个 \multicolumn{1}{l}{} 来去除 2x2 单元格中的竖线。

\documentclass{article}
\usepackage{multirow}
\usepackage{rotating}

\begin{document}

\begin{table}[htb]
\centering
\begin{tabular}{l|c|c|c|c|c}
\hline

\multicolumn{2}{c|}{\multirow{2}{*}{Aspects}} & \multicolumn{4}{c}{Methods} \
\cline{3-6}
\multicolumn{1}{l}{} & & Binomial Test & Tangram & Stereoscope & BayesPrism\
\hline
\multirow{10}{*}{\begin{turn}{270}Total Number\end{turn}} & Cell Type 0 & 3381 & 25  & 1200 &  331    \
                               & Cell Type 1 & 1903 & 40  & 3360 &  3468    \
                               & Cell Type 2 & 3466 & 0   & 1357 &  2729    \
                               & Cell Type 3 & 3468 & 40  & 1711 &  412   \
                               & Cell Type 4 & 3406 & 64  & 1996 &  3458   \
                               & Cell Type 5 & 2934 & 31  & 1512 &  1772    \
                               & Cell Type 6 & 494  & 55  & 3463 &  3468   \
                               & Cell Type 7 & 3159 & 30  & 2367 &  3467    \
                               & Cell Type 8 & 3454 & 53  & 3275 &  3456    \
                               & Cell Type 9 & 3281 & 18  & 1320 &  1451    \
            \hline
\multicolumn{2}{c|}{Total Variables}     & 28,946 & 356 & 21,443 & 23,962\
\multicolumn{2}{c|}{Residual Error Mean} & 3.04   & 3.50 & 2.92  & 2.93 \
\hline
\end{tabular}
\caption{Total Number of Each Cell Types for The Model \ref{regression}}
\label{total_cell}
\end{table}

\end{document}