0

我正在尝试制作一个表,其中第一列是多列(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}
4

1 回答 1

1

这条线完全搞砸了:

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

有错误的\multirow语法,而且,如果你想组合它们,\multirow必须在里面(参见手册)。\multicolumnmultirow

我还添加了一个\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}

在此处输入图像描述

于 2022-02-07T11:34:41.437 回答