长桌问答

长桌问答

我编写了此代码,但第一列的单词是叠加的:

\small
\setlength\tabcolsep{2.4pt}
\begin{longtable}{cp{6.645em}cp{7.215em}p{6em}c}
    \toprule
    \multicolumn{1}{p{3.93em}}{Dataset} & \multicolumn{1}{c}{} & \multicolumn{1}{p{6.645em}}{SLAC} & MEME  & FEL   & \multicolumn{1}{p{6.215em}}{FUBAR} \\
    \midrule
    \multicolumn{1}{c}{\multirow{2}[4]{*}{\begin{sideways}Basal\_40\end{sideways}}} & number of PSS & 0     & \multicolumn{1}{c}{8} & \multicolumn{1}{c}{2} & 0 \\
\cmidrule{2-6}          & sites &       & 1, 6, 13, 85, 99, 149, 154, 200 & 154, 218 &  \\
    \midrule
    \multicolumn{1}{c}{\multirow{2}[4]{*}{\begin{sideways}Strisores\_Aequorlitornithes\_40 \end{sideways}}} & number of PSS & 1     & \multicolumn{1}{c}{6} & \multicolumn{1}{c}{8} & 0 \\
\cmidrule{2-6}          & sites & 276   & 153, 154, 186, 238, 269, 276 & 49, 61, 123, 225, 238, 266, 268, 276 &  \\
                        &   &   &                                        \\
    \midrule
  \label{table:Supplemental Table 9}%
\end{longtable}%

但我刚开始使用 LaTeX,我想让我的表格看起来像我文档中的另一个表格,但我不知道该怎么做。有人能帮我吗?

\small
\begin{xltabular}{\textwidth}{c l c X X c}
    \toprule
    \thead{Dataset} &  & \thead{SLAC} & \thead{MEME}  & \thead{FEL}   & \thead{FUBAR} \\
    \midrule
    \multicolumn{1}{c}{\multirow{2}{*}{\rotatebox{90}{Basal\_40}}} & number of PSS & 0     & \multicolumn{1}{c}{8} & \multicolumn{1}{c}{2} & 0 \\
\cmidrule{2-6}          & sites &       & 1, 6, 13, 85, 99, 149, 154, 200 & 154, 218 &  \\
&   &   &                                        \\
    \midrule
    \multicolumn{1}{c}{\multirow{2}{*}{\rotatebox{90}{Strisores\_Aequorlitornithes\_40}}} & number of PSS & 1     & \multicolumn{1}{c}{6} & \multicolumn{1}{c}{8} & 0 \\
\cmidrule{2-6}          & sites & 276   & 153, 154, 186, 238, 269, 276 & 49, 61, 123, 225, 238, 266, 268, 276 &  \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
    \midrule
    \multicolumn{1}{c}{\multirow{2}{*}{\rotatebox{90}{Acanthisittidae Tyranni\_Passeri\_40}}} & number of PSS & 11     & \multicolumn{1}{c}{23} & \multicolumn{1}{c}{18} & 13 \\
\cmidrule{2-6}          & sites & 27, 43, 57, 58, 153, 157, 224, 231, 233, 234, 235   & 14, 27, 43, 44, 51, 56, 57, 58, 62, 67, 122, 130, 146, 153, 157, 224, 229, 231, 233, 235, 247, 265, 279 & 27, 43, 57, 58, 62, 67, 100, 130, 147, 153, 154, 156, 157, 224, 231, 233, 235, 265 &  27, 57, 58, 62, 122, 130, 153, 157, 179, 224, 231, 233, 235\\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\

答案1

由于为了避免旋转文本重叠,您需要相当多的空行(=浪费的空间),因此我还提供了另一种布局:

在此处输入图片描述

\documentclass{article}
\usepackage{longtable}
\usepackage{rotating}
\usepackage{array}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{xltabular}
\usepackage{makecell}

\begin{document}
{
\small
\setlength\tabcolsep{2.4pt}
\begin{longtable}{cp{6.645em}cp{7.215em}p{6em}c}
    \toprule
    \multicolumn{1}{p{3.93em}}{Dataset} & \multicolumn{1}{c}{} & \multicolumn{1}{p{6.645em}}{SLAC} & MEME  & FEL   & \multicolumn{1}{p{6.215em}}{FUBAR} \\
    \midrule
    \multicolumn{1}{c}{\multirow{2}[4]{*}{\rotatebox{90}{Basal\_40}}} & number of PSS & 0     & \multicolumn{1}{c}{8} & \multicolumn{1}{c}{2} & 0 \\
\cmidrule{2-6}          & sites &       & 1, 6, 13, 85, 99, 149, 154, 200 & 154, 218 &  \\
    \midrule
    \multicolumn{1}{c}{\multirow{10}[4]{*}{\rotatebox{90}{Strisores\_Aequorlitornithes\_40}}} & number of PSS & 1     & \multicolumn{1}{c}{6} & \multicolumn{1}{c}{8} & 0 \\
\cmidrule{2-6}          & sites & 276   & 153, 154, 186, 238, 269, 276 & 49, 61, 123, 225, 238, 266, 268, 276 &  \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        
    \midrule
  \label{table:Supplemental Table 9}%
\end{longtable}%
}


\begin{xltabular}{\textwidth}{l c X X c}
\caption{caption} \label{table:Supplemental Table 9}\\
    \toprule
      & \thead{SLAC} & \thead{MEME}  & \thead{FEL}   & \thead{FUBAR} \\
    \midrule
    \multicolumn{5}{@{}l}{Dataset: Basal\_40}\\
       number of PSS & 0                               & \multicolumn{1}{c}{8}                & \multicolumn{1}{c}{2} & 0 \\
       sites &       & 1, 6, 13, 85, 99, 149, 154, 200 & 154, 218                             &  \\
    \midrule
    \multicolumn{5}{@{}l}{Dataset: Strisores\_Aequorlitornithes\_40}\\
      number of PSS & 1                                & \multicolumn{1}{c}{6}                & \multicolumn{1}{c}{8} & 0 \\
      sites & 276   & 153, 154, 186, 238, 269, 276     & 49, 61, 123, 225, 238, 266, 268, 276 &  \\                        
    \bottomrule
\end{xltabular}%


\end{document}

根据评论中提到的其他要求进行更新:

\documentclass{article}
\usepackage{rotating}
\usepackage{array}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{xltabular}
\usepackage{makecell}

\begin{document}
{
\small
\begin{xltabular}{\textwidth}{c l c X X c}
    \toprule
    \thead{Dataset} & \thead{SLAC} & \thead{MEME}  & \thead{FEL}   & \thead{FUBAR} \\
    \midrule
    \multicolumn{1}{c}{\multirow{4}{*}{\rotatebox{90}{Basal\_40}}} & number of PSS & 0     & \multicolumn{1}{c}{8} & \multicolumn{1}{c}{2} & 0 \\
\cmidrule{2-6}          & sites &       & 1, 6, 13, 85, 99, 149, 154, 200 & 154, 218 &  \\
&   &   &                                        \\
    \midrule
    \multicolumn{1}{c}{\multirow{12}{*}{\rotatebox{90}{Strisores\_Aequorlitornithes\_40}}} & number of PSS & 1     & \multicolumn{1}{c}{6} & \multicolumn{1}{c}{8} & 0 \\
\cmidrule{2-6}          & sites & 276   & 153, 154, 186, 238, 269, 276 & 49, 61, 123, 225, 238, 266, 268, 276 &  \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\
                        &   &   &                                        \\                   
    \midrule
  \label{table:Supplemental Table 9}%
\end{xltabular}%
}

\end{document}

相关内容