如何使用 longtable 跨页拆分表格?

如何使用 longtable 跨页拆分表格?

我是 LaTeX 的新手。我知道这个问题已经被问过几次了,但我没能搞定。

%By default, CURRENTLY TWO-SIDED DOCUMENT! 

\documentclass[12pt, a4paper]{book}
%Packages
\usepackage{graphicx}
\usepackage[a4paper, left=1in, top=1in,right=1in,bottom=1in]{geometry}
\usepackage{setspace} 
\graphicspath{{images/}}
\usepackage{emptypage}
\usepackage{hyperref}
\usepackage[labelfont=bf]{caption}
\usepackage{indentfirst}
\usepackage{array}
\usepackage{longtable}

\usepackage[style=apa]{biblatex} %%or authoryear
\addbibresource{MyLibrary.bib} %% add new one updated

\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\hypersetup{colorlinks=true,linkcolor=black,urlcolor=cyan,citecolor=black,}
%\setboolean{@twoside}{false} to put one sided document

\begin{document}
\pagestyle{plain}
\onehalfspacing
\setlength{\parskip}{12pt}


\begin{table}%[hbt!]
\renewcommand{\arraystretch}{1.5}
\centering
\caption[List of siRNA sequences.]{\textbf{List of siRNA sequences.}}
\begin{tabular}{C{0.5cm}C{2cm}C{2cm}C{2cm}C{6.5cm}}

\textbf{\#} & \textbf{Target gene} & \textbf{Ref} & \textbf{Ref single siRNA} &\textbf{Sequence}\\ \hline
1 & Silencer & 4390843 & & proprietary - not disclosed\\ 
2 & Gapd & D-001830-20-20 & & XXXXXXXXXXXXXXXXXXX  / XXXXXXXXXXXXXXXXXXX / XXXXXXXXXXXXXXXXXXX / XXXXXXXXXXXXXXXXXXX\\ 
3 & Atf3 & 4390771 & s62686 & XXXXXXXXXXXXXXXXXXXtt\\
4 & Atf3 & 4390771 & s62688 & XXXXXXXXXXXXXXXXXXXtt\\
5 & Sox11 & 4390771 & s74154 & XXXXXXXXXXXXXXXXXXXtt\\
6 & Sox11 & 4390771 & s202022 & XXXXXXXXXXXXXXXXXXXtt \\
7 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-13 & XXXXXXXXXXXXXXXXXXX\\
8 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-14 & XXXXXXXXXXXXXXXXXXX\\
9 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-15 & XXXXXXXXXXXXXXXXXXX\\
10 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-16 & XXXXXXXXXXXXXXXXXXX\\
11 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-09 & XXXXXXXXXXXXXXXXXXX\\
12 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-10 & XXXXXXXXXXXXXXXXXXX\\
13 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-11 & XXXXXXXXXXXXXXXXXXX\\
14 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-12 & XXXXXXXXXXXXXXXXXXX\\
15 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-09 & XXXXXXXXXXXXXXXXXXX \\
16 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-10 & XXXXXXXXXXXXXXXXXXX\\
17 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-11 & XXXXXXXXXXXXXXXXXXX\\
18 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-12 & XXXXXXXXXXXXXXXXXXX\\
19 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-05 & XXXXXXXXXXXXXXXXXXX\\ 
20 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-06 & XXXXXXXXXXXXXXXXXXX\\
21 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-07 & XXXXXXXXXXXXXXXXXXX\\
22 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-08 & XXXXXXXXXXXXXXXXXXX\\
23 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-05 & XXXXXXXXXXXXXXXXXXX\\
24 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-06 & XXXXXXXXXXXXXXXXXXX\\
25 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-07 & XXXXXXXXXXXXXXXXXXX\\
26 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-08 & XXXXXXXXXXXXXXXXXXX\\
27 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-05 & XXXXXXXXXXXXXXXXXXX\\
28 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-06 & XXXXXXXXXXXXXXXXXXX\\
29 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-07 & XXXXXXXXXXXXXXXXXXX\\
30 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-08 & XXXXXXXXXXXXXXXXXXX\\ 
31 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-05 & XXXXXXXXXXXXXXXXXXX\\
32 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-06 & XXXXXXXXXXXXXXXXXXX\\ 
33 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-07 & XXXXXXXXXXXXXXXXXXX\\ 
34 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-08 & XXXXXXXXXXXXXXXXXXX\\
  \hline
\end{tabular}
\label{tab:siRNAseq}
\end{table}

%references


\end{document}

这是我的代码。当我编译它时,34 行中只有 14 行显示出来,而且第 14 行位于此页面的最底部。理想情况下,我想将表格拆分到多个页面上。我无法提供更多详细信息,因为这是我使用 Latex 制作的第一份文档。

非常感谢您的宝贵帮助。问候,Alex

答案1

longtable(更新了从设置切换到设置的答案tabularx

如果消除第 2、3 和 4 列的换行符,则可以在单个页面上排版整个表格。

以下解决方案采用table/tabularx组合,目标宽度为\textwidth;它采用X列类型作为最后一列。我还将以等宽字体排版最后一列中的材料。另外,我将通过为每组目标基因插入指令来对表格内容进行一些视觉分组\addlinespace

在此处输入图片描述

\documentclass[12pt,a4paper]{book}
%Packages
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}
\usepackage{setspace} 
\usepackage{hyperref}
\hypersetup{colorlinks,linkcolor=black,urlcolor=cyan,citecolor=black}

\usepackage[font=bf]{caption}
\usepackage{indentfirst}

% New code
\usepackage{tabularx} % for 'tabularx' env. and 'X' column type
\usepackage{ragged2e} % for '\RaggedRight' macro
\usepackage{booktabs} % for well-spaced horizontal rules and  '\addlinespace' macro
\newcolumntype{L}[1]{>{\RaggedRight}p{#1}} % suppress full justification

\begin{document}

\pagestyle{plain}
\onehalfspacing
%\setlength{\parskip}{12pt} % bad idea

\begin{table}[p] % place table on a page by itself
\caption{List of siRNA sequences.}
\label{tab:siRNAseq}

\begin{tabularx}{\textwidth}{@{} 
     r L{2cm} l L{2.25cm} >{\ttfamily}X @{}}

\# & Target gene & Ref & Ref single siRNA & \textrm{Sequence}\\ 
\midrule

1  & Silencer  & 4390843 & & \textrm{proprietary, not disclosed}\\ 
\addlinespace
2  & Gapd      & D-001830-20-20 & & 
   XXXXXXXXXXXXXXXXXXX / 
   XXXXXXXXXXXXXXXXXXX / 
   XXXXXXXXXXXXXXXXXXX /
   XXXXXXXXXXXXXXXXXXX \\ 
\addlinespace
3  & Atf3      & 4390771                  & s62686      & XXXXXXXXXXXXXXXXXXXtt\\
4  & Atf3      & 4390771                  & s62688      & XXXXXXXXXXXXXXXXXXXtt\\
\addlinespace
5  & Sox11     & 4390771                  & s74154      & XXXXXXXXXXXXXXXXXXXtt\\
6  & Sox11     & 4390771                  & s202022     & XXXXXXXXXXXXXXXXXXXtt\\ 
\addlinespace
7  & Atf3      & LQ-058604-01-0010, 11910 & J-058604-13 & XXXXXXXXXXXXXXXXXXX\\
8  & Atf3      & LQ-058604-01-0010, 11910 & J-058604-14 & XXXXXXXXXXXXXXXXXXX\\
9  & Atf3      & LQ-058604-01-0010, 11910 & J-058604-15 & XXXXXXXXXXXXXXXXXXX\\
10 & Atf3      & LQ-058604-01-0010, 11910 & J-058604-16 & XXXXXXXXXXXXXXXXXXX\\ 
\addlinespace
11 & Sox11     & LQ-040404-01-0010, 20666 & J-040404-09 & XXXXXXXXXXXXXXXXXXX\\
12 & Sox11     & LQ-040404-01-0010, 20666 & J-040404-10 & XXXXXXXXXXXXXXXXXXX\\
13 & Sox11     & LQ-040404-01-0010, 20666 & J-040404-11 & XXXXXXXXXXXXXXXXXXX\\
14 & Sox11     & LQ-040404-01-0010, 20666 & J-040404-12 & XXXXXXXXXXXXXXXXXXX\\ 
\addlinespace
15 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-09 & XXXXXXXXXXXXXXXXXXX\\
16 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-10 & XXXXXXXXXXXXXXXXXXX\\
17 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-11 & XXXXXXXXXXXXXXXXXXX\\
18 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-12 & XXXXXXXXXXXXXXXXXXX\\ 
\addlinespace
19 & Gadd45a   & LQ-042505-00-0010, 13197 & J-042505-05 & XXXXXXXXXXXXXXXXXXX\\ 
20 & Gadd45a   & LQ-042505-00-0010, 13197 & J-042505-06 & XXXXXXXXXXXXXXXXXXX\\
21 & Gadd45a   & LQ-042505-00-0010, 13197 & J-042505-07 & XXXXXXXXXXXXXXXXXXX\\
22 & Gadd45a   & LQ-042505-00-0010, 13197 & J-042505-08 & XXXXXXXXXXXXXXXXXXX\\ 
\addlinespace
23 & Cdkn1a    & LQ-058636-00-0010, 12575 & J-058636-05 & XXXXXXXXXXXXXXXXXXX\\
24 & Cdkn1a    & LQ-058636-00-0010, 12575 & J-058636-06 & XXXXXXXXXXXXXXXXXXX\\
25 & Cdkn1a    & LQ-058636-00-0010, 12575 & J-058636-07 & XXXXXXXXXXXXXXXXXXX\\
26 & Cdkn1a    & LQ-058636-00-0010, 12575 & J-058636-08 & XXXXXXXXXXXXXXXXXXX\\ 
\addlinespace
27 & Fgfr1     & LQ-040832-00-0010, 14182 & J-040832-05 & XXXXXXXXXXXXXXXXXXX\\
28 & Fgfr1     & LQ-040832-00-0010, 14182 & J-040832-06 & XXXXXXXXXXXXXXXXXXX\\
29 & Fgfr1     & LQ-040832-00-0010, 14182 & J-040832-07 & XXXXXXXXXXXXXXXXXXX\\
30 & Fgfr1     & LQ-040832-00-0010, 14182 & J-040832-08 & XXXXXXXXXXXXXXXXXXX\\ 
\addlinespace 
31 & Ecel1     & LQ-041879-00-0010, 13599 & J-041879-05 & XXXXXXXXXXXXXXXXXXX\\
32 & Ecel1     & LQ-041879-00-0010, 13599 & J-041879-06 & XXXXXXXXXXXXXXXXXXX\\ 
33 & Ecel1     & LQ-041879-00-0010, 13599 & J-041879-07 & XXXXXXXXXXXXXXXXXXX\\ 
34 & Ecel1     & LQ-041879-00-0010, 13599 & J-041879-08 & XXXXXXXXXXXXXXXXXXX\\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

答案2

过长的标题会浪费宝贵的空间,因为这些标题可能会被分成多行。

对于最后一列,我喜欢 Mico 的想法,即以等宽字体打印序列,这可以保证对齐。第一个条目采用普通字体(较小)。

最后一列声明为类型p,其长度根据最长序列预先确定。

这使得表格适合宽度。

\documentclass[12pt, a4paper]{book}
%Packages
\usepackage{graphicx}
\usepackage[a4paper, left=1in, top=1in,right=1in,bottom=1in]{geometry}
\usepackage{setspace} 
\graphicspath{{images/}}
\usepackage{emptypage}
\usepackage{hyperref}
\usepackage[labelfont=bf]{caption}
\usepackage{indentfirst}
\usepackage{array}
\usepackage{longtable}
\usepackage{ltxtable}
\usepackage{longtable}
\usepackage{tabularx}

\usepackage[style=apa]{biblatex} %%or authoryear
\addbibresource{MyLibrary.bib} %% add new one updated

\hypersetup{colorlinks=true,linkcolor=black,urlcolor=cyan,citecolor=black,}
%\setboolean{@twoside}{false} to put one sided document

\newlength{\sequencelength}

\pagestyle{plain}
\onehalfspacing
%\setlength{\parskip}{12pt} % Don't! Really, don't! You only waste space

\begin{document}

\begingroup

\settowidth{\sequencelength}{\ttfamily AGAGGAACCUCUUUAUCCAtt}

\begin{longtable}{|c|c|c|c|>{\raggedright\ttfamily\arraybackslash}p{\sequencelength}|}
\caption{List of siRNA sequences.}\label{tab:siRNAseq}
 \\
\hline
\# &
\begin{tabular}[t]{@{}c@{}} Target \\ gene \end{tabular} &
Ref & 
\begin{tabular}[t]{@{}c@{}} Ref single \\ siRNA \end{tabular} &
\multicolumn{1}{c|}{Sequence} \\
\hline
\endfirsthead
\hline
\# &
\begin{tabular}[t]{@{}c@{}} Target \\ gene \end{tabular} &
Ref & 
\begin{tabular}[t]{@{}c@{}} Ref single \\ siRNA \end{tabular} &
\multicolumn{1}{c|}{Sequence} \\
\hline
\endhead
\hline
\endfoot
    % Your table data goes here
    1 & Silencer & 4390843 & & \normalfont\footnotesize proprietary -- not disclosed\\ 
    2 & Gapd & D-001830-20-20 & & XXXXXXXXXXXXXXXXXXX  / XXXXXXXXXXXXXXXXXXX / XXXXXXXXXXXXXXXXXXX / XXXXXXXXXXXXXXXXXXX\\ 
    3 & Atf3 & 4390771 & s62686 & XXXXXXXXXXXXXXXXXXXtt\\
    4 & Atf3 & 4390771 & s62688 & XXXXXXXXXXXXXXXXXXXtt\\
    5 & Sox11 & 4390771 & s74154 & XXXXXXXXXXXXXXXXXXXtt\\
    6 & Sox11 & 4390771 & s202022 & XXXXXXXXXXXXXXXXXXXtt \\
    7 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-13 & XXXXXXXXXXXXXXXXXXX\\
    8 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-14 & XXXXXXXXXXXXXXXXXXX\\
    9 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-15 & XXXXXXXXXXXXXXXXXXX\\
    10 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-16 & XXXXXXXXXXXXXXXXXXX\\
    11 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-09 & XXXXXXXXXXXXXXXXXXX\\
    12 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-10 & XXXXXXXXXXXXXXXXXXX\\
    13 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-11 & XXXXXXXXXXXXXXXXXXX\\
    14 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-12 & XXXXXXXXXXXXXXXXXXX\\
    15 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-09 & XXXXXXXXXXXXXXXXXXX \\
    16 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-10 & XXXXXXXXXXXXXXXXXXX\\
    17 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-11 & XXXXXXXXXXXXXXXXXXX\\
    18 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-12 & XXXXXXXXXXXXXXXXXXX\\
    19 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-05 & XXXXXXXXXXXXXXXXXXX\\ 
    20 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-06 & XXXXXXXXXXXXXXXXXXX\\
    21 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-07 & XXXXXXXXXXXXXXXXXXX\\
    22 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-08 & XXXXXXXXXXXXXXXXXXX\\
    23 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-05 & XXXXXXXXXXXXXXXXXXX\\
    24 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-06 & XXXXXXXXXXXXXXXXXXX\\
    25 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-07 & XXXXXXXXXXXXXXXXXXX\\
    26 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-08 & XXXXXXXXXXXXXXXXXXX\\
    27 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-05 & XXXXXXXXXXXXXXXXXXX\\
    28 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-06 & XXXXXXXXXXXXXXXXXXX\\
    29 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-07 & XXXXXXXXXXXXXXXXXXX\\
    30 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-08 & XXXXXXXXXXXXXXXXXXX\\ 
    31 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-05 & XXXXXXXXXXXXXXXXXXX\\
    32 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-06 & XXXXXXXXXXXXXXXXXXX\\ 
    33 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-07 & XXXXXXXXXXXXXXXXXXX\\ 
    34 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-08 & XXXXXXXXXXXXXXXXXXX\\
\end{longtable}
\endgroup

%references


\end{document}

在此处输入图片描述

如果您切换到\footnotesize(并切换到\scriptsize最后一列的文本条目),您甚至不需要longtable,标准\begin{table}[p]就足够了。

在此处输入图片描述

为了完整起见,我以更开放的视角展示了您在这种情况下所得到的结果。

\documentclass[12pt, a4paper]{book}
%Packages
\usepackage[a4paper, left=1in, top=1in,right=1in,bottom=1in]{geometry}
\usepackage{array}
\usepackage{booktabs}
\usepackage{caption}

\newlength{\sequencelength}

\pagestyle{plain}

\begin{document}

\begin{table}[p]
\centering\small
\settowidth{\sequencelength}{\ttfamily AGAGGAACCUCUUUAUCCAtt}

\caption{List of siRNA sequences.}\label{tab:siRNAseq}

\begin{tabular}{@{}cccc>{\raggedright\ttfamily\arraybackslash}p{\sequencelength}@{}}
\toprule
\# &
\begin{tabular}[t]{@{}c@{}} Target \\ gene \end{tabular} &
Ref & 
\begin{tabular}[t]{@{}c@{}} Ref single \\ siRNA \end{tabular} &
\multicolumn{1}{c}{Sequence} \\
\midrule
    % Your table data goes here
    1 & Silencer & 4390843 & & \normalfont\footnotesize proprietary -- not disclosed\\ 
    2 & Gapd & D-001830-20-20 & & XXXXXXXXXXXXXXXXXXX  / XXXXXXXXXXXXXXXXXXX / XXXXXXXXXXXXXXXXXXX / XXXXXXXXXXXXXXXXXXX\\ 
    3 & Atf3 & 4390771 & s62686 & XXXXXXXXXXXXXXXXXXXtt\\
    4 & Atf3 & 4390771 & s62688 & XXXXXXXXXXXXXXXXXXXtt\\
    5 & Sox11 & 4390771 & s74154 & XXXXXXXXXXXXXXXXXXXtt\\
    6 & Sox11 & 4390771 & s202022 & XXXXXXXXXXXXXXXXXXXtt \\
    7 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-13 & XXXXXXXXXXXXXXXXXXX\\
    8 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-14 & XXXXXXXXXXXXXXXXXXX\\
    9 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-15 & XXXXXXXXXXXXXXXXXXX\\
    10 & Atf3 & LQ-058604-01-0010, 11910 & J-058604-16 & XXXXXXXXXXXXXXXXXXX\\
    11 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-09 & XXXXXXXXXXXXXXXXXXX\\
    12 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-10 & XXXXXXXXXXXXXXXXXXX\\
    13 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-11 & XXXXXXXXXXXXXXXXXXX\\
    14 & Sox11 & LQ-040404-01-0010, 20666 & J-040404-12 & XXXXXXXXXXXXXXXXXXX\\
    15 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-09 & XXXXXXXXXXXXXXXXXXX \\
    16 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-10 & XXXXXXXXXXXXXXXXXXX\\
    17 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-11 & XXXXXXXXXXXXXXXXXXX\\
    18 & Tnfrsf12a & LQ-040436-01-0010, 27279 & J-040436-12 & XXXXXXXXXXXXXXXXXXX\\
    19 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-05 & XXXXXXXXXXXXXXXXXXX\\ 
    20 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-06 & XXXXXXXXXXXXXXXXXXX\\
    21 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-07 & XXXXXXXXXXXXXXXXXXX\\
    22 & Gadd45a & LQ-042505-00-0010, 13197 & J-042505-08 & XXXXXXXXXXXXXXXXXXX\\
    23 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-05 & XXXXXXXXXXXXXXXXXXX\\
    24 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-06 & XXXXXXXXXXXXXXXXXXX\\
    25 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-07 & XXXXXXXXXXXXXXXXXXX\\
    26 & Cdkn1a & LQ-058636-00-0010, 12575 & J-058636-08 & XXXXXXXXXXXXXXXXXXX\\
    27 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-05 & XXXXXXXXXXXXXXXXXXX\\
    28 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-06 & XXXXXXXXXXXXXXXXXXX\\
    29 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-07 & XXXXXXXXXXXXXXXXXXX\\
    30 & Fgfr1 & LQ-040832-00-0010, 14182 & J-040832-08 & XXXXXXXXXXXXXXXXXXX\\ 
    31 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-05 & XXXXXXXXXXXXXXXXXXX\\
    32 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-06 & XXXXXXXXXXXXXXXXXXX\\ 
    33 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-07 & XXXXXXXXXXXXXXXXXXX\\ 
    34 & Ecel1 & LQ-041879-00-0010, 13599 & J-041879-08 & XXXXXXXXXXXXXXXXXXX\\
\bottomrule
\end{tabular}

\end{table}

\end{document}

在此处输入图片描述

答案3

编辑:
同时,楼主在问题中更改了最后一列的数据。这个更改现在也反映在这个答案中。还添加了表格在两页之间断开的情况图像。

  • 您的表格可以放在一页上。
  • 但在任何情况下,如果表格不是从页面顶部开始,并且因此分布在两页上,则使用长表格。
  • 对于较长的表格代码我建议使用longtblrtabularray。使用它,表格代码简洁明了。可以写成如下形式:
\documentclass[12pt, a4paper]{book}
\usepackage[margin=1in]{geometry}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum}                             % for dummy text
%---------------------------------------------------------------%
%Packages
\usepackage{setspace}

\usepackage{xcolor}
\usepackage{seqsplit}
\usepackage{tabularray}     % new
\UseTblrLibrary{booktabs}   % new
    \SetTblrStyle{caption}{font=\small}
    \SetTblrStyle{caption-tag}{font=\small\bfseries}
    \SetTblrStyle{contfoot}{font=\footnotesize\itshape}
\ExplSyntaxOn
    \NewChildSelector{eachfour}
    {
    \int_step_inline:nnnn {5}{4}{\l_tblr_childs_total_tl}
          { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
    }
\ExplSyntaxOff


%\usepackage{hyperref}
%\hypersetup{colorlinks, linkcolor=black, urlcolor=cyan, citecolor=black}

\begin{document}
\pagestyle{plain}

\begin{longtblr}[
caption = {List of siRNA sequences.},
  label = {tab:siRNAseq}
                ]{colsep = 4pt, 
                  colspec = {@{} r l l l X[l, font=\ttfamily] @{}},
                  row{1}  = {font=\small\bfseries, l, f},
                  row{2-Y}      = {rowsep=0pt},
                  row{eachfour} = {belowsep=1ex},
                  rowhead = 1 
                  }

    \toprule
\#  &   {Target\\ gene}
                &   Ref                     &   {Ref single\\ siRNA}   
                                                            &   Sequence    \\
    \midrule
% table body
1   & Silencer  & 4390843                   &               & \textrm{proprietary --- not disclosed}\\[1ex]
2   & Gapd      & D-001830-20-20            &               & \seqsplit{XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}
\\[1ex]
3   & Atf3      & 4390771                   & s62686        & XXXXXXXXXXXXXXXXXXXtt \\
4   & Atf3      & 4390771                   & s62688        & XXXXXXXXXXXXXXXXXXXtt \\[2ex]
5   & Sox11     & 4390771                   & s74154        & XXXXXXXXXXXXXXXXXXXtt \\
6   & Sox11     & 4390771                   & s202022       & XXXXXXXXXXXXXXXXXXXtt \\
7   & Atf3      & LQ-058604-01-0010, 11910  & J-058604-13   & XXXXXXXXXXXXXXXXXXX   \\
8   & Atf3      & LQ-058604-01-0010, 11910  & J-058604-14   & XXXXXXXXXXXXXXXXXXX   \\
9   & Atf3      & LQ-058604-01-0010, 11910  & J-058604-15   & XXXXXXXXXXXXXXXXXXX   \\
10  & Atf3      & LQ-058604-01-0010, 11910  & J-058604-16   & XXXXXXXXXXXXXXXXXXX   \\
11  & Sox11     & LQ-040404-01-0010, 20666  & J-040404-09   & XXXXXXXXXXXXXXXXXXX   \\
12  & Sox11     & LQ-040404-01-0010, 20666  & J-040404-10   & XXXXXXXXXXXXXXXXXXX   \\
13  & Sox11     & LQ-040404-01-0010, 20666  & J-040404-11   & XXXXXXXXXXXXXXXXXXX   \\
14  & Sox11     & LQ-040404-01-0010, 20666  & J-040404-12   & XXXXXXXXXXXXXXXXXXX   \\
15  & Tnfrsf12a & LQ-040436-01-0010, 27279  & J-040436-09   & XXXXXXXXXXXXXXXXXXX   \\
16  & Tnfrsf12a & LQ-040436-01-0010, 27279  & J-040436-10   & XXXXXXXXXXXXXXXXXXX   \\
17  & Tnfrsf12a & LQ-040436-01-0010, 27279  & J-040436-11   & XXXXXXXXXXXXXXXXXXX   \\
18  & Tnfrsf12a & LQ-040436-01-0010, 27279  & J-040436-12   & XXXXXXXXXXXXXXXXXXX   \\
19  & Gadd45a   & LQ-042505-00-0010, 13197  & J-042505-05   & XXXXXXXXXXXXXXXXXXX   \\
20  & Gadd45a   & LQ-042505-00-0010, 13197  & J-042505-06   & XXXXXXXXXXXXXXXXXXX   \\
21  & Gadd45a   & LQ-042505-00-0010, 13197  & J-042505-07   & XXXXXXXXXXXXXXXXXXX   \\
22  & Gadd45a   & LQ-042505-00-0010, 13197  & J-042505-08   & XXXXXXXXXXXXXXXXXXX   \\
23  & Cdkn1a    & LQ-058636-00-0010, 12575  & J-058636-05   & XXXXXXXXXXXXXXXXXXX   \\
24  & Cdkn1a    & LQ-058636-00-0010, 12575  & J-058636-06   & XXXXXXXXXXXXXXXXXXX   \\
25  & Cdkn1a    & LQ-058636-00-0010, 12575  & J-058636-07   & XXXXXXXXXXXXXXXXXXX   \\
26  & Cdkn1a    & LQ-058636-00-0010, 12575  & J-058636-08   & XXXXXXXXXXXXXXXXXXX   \\
27  & Fgfr1     & LQ-040832-00-0010, 14182  & J-040832-05   & XXXXXXXXXXXXXXXXXXX   \\
28  & Fgfr1     & LQ-040832-00-0010, 14182  & J-040832-06   & XXXXXXXXXXXXXXXXXXX   \\
29  & Fgfr1     & LQ-040832-00-0010, 14182  & J-040832-07   & XXXXXXXXXXXXXXXXXXX   \\
30  & Fgfr1     & LQ-040832-00-0010, 14182  & J-040832-08   & XXXXXXXXXXXXXXXXXXX   \\
31  & Ecel1     & LQ-041879-00-0010, 13599  & J-041879-05   & XXXXXXXXXXXXXXXXXXX   \\
32  & Ecel1     & LQ-041879-00-0010, 13599  & J-041879-06   & XXXXXXXXXXXXXXXXXXX   \\
33  & Ecel1     & LQ-041879-00-0010, 13599  & J-041879-07   & XXXXXXXXXXXXXXXXXXX   \\
34  & Ecel1     & LQ-041879-00-0010, 13599  & J-041879-08   & XXXXXXXXXXXXXXXXXXX   \\
    \bottomrule
\end{longtblr}

\end{document}

在此处输入图片描述

(红线表示页面布局)

举个例子,当您的表格不是从页面顶部开始,然后它被分成两页时:

在此处输入图片描述

相关内容