我们如何让一个表格跨页显示,通常有两个方案。其一是使用longtable,其二是使用supertabular

方案一 使用longtable

longtable宏包是 LaTeX 工具宏包套件之一,可用于跨页表格。它定义了一个长表环境,只需将tabular 环境改为 longtable 环境,跨页长表格就可自动拆分为多页表格。

注意:使用长表环境后,须经两或三次编译,才能得到正确结果。

由于改变了原有输出方式,所以它不能用在 multicolumn 多栏环境或 twocolumn 双栏页面格式中。

\begin{center}
\begin{longtable}{|l|l|l|}
\caption[Feasible triples for a highly variable Grid]{Feasible triples for
highly variable Grid, MLMMH.} \label{grid_mlmmh} \\

\hline \multicolumn{1}{|c|}{\textbf{Time (s)}} & \multicolumn{1}{c|}{\textbf{Triple chosen}} & \multicolumn{1}{c|}{\textbf{Other feasible triples}} \\ \hline
\endfirsthead

\multicolumn{3}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Time (s)}} &
\multicolumn{1}{c|}{\textbf{Triple chosen}} &
\multicolumn{1}{c|
}{\textbf{Other feasible triples}} \\ \hline
\endhead

\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline
\endlastfoot

0 & (11113725) & (11210980), (1138235), (220), (310) \\
2745 & (11210980) & (1138235), (220), (230), (310) \\
5490 & (11213725) & (222745), (230), (310) \\
8235 & (11216470) & (11313725), (222745), (230), (310) \\
10980 & (11216470) & (11313725), (222745), (230), (310) \\
13725 & (11216470) & (11313725), (222745), (230), (310) \\
16470 & (11316470) & (222745), (230), (310) \\
19215 & (11216470) & (11313725), (222745), (230), (310) \\
21960 & (11216470) & (11313725), (222745), (230), (310) \\
24705 & (11216470) & (11313725), (222745), (230), (310) \\
27450 & (11216470) & (11313725), (222745), (230), (310) \\
30195 & (222745) & (230), (310) \\
32940 & (11316470) & (222745), (230), (310) \\
35685 & (11313725) & (222745), (230), (310) \\
38430 & (11310980) & (222745), (230), (310) \\
41175 & (11213725) & (11310980), (222745), (230), (310) \\
43920 & (11310980) & (222745), (230), (310) \\
46665 & (222745) & (230), (310) \\
49410 & (222745) & (230), (310) \\
52155 & (11216470) & (11313725), (222745), (230), (310) \\
54900 & (11313725) & (222745), (230), (310) \\
57645 & (11313725) & (222745), (230), (310) \\
60390 & (11213725) & (222745), (230), (310) \\
63135 & (11316470) & (222745), (230), (310) \\
65880 & (11316470) & (222745), (230), (310) \\
68625 & (222745) & (230), (310) \\
71370 & (11313725) & (222745), (230), (310) \\
74115 & (11213725) & (222745), (230), (310) \\
76860 & (11313725) & (222745), (230), (310) \\
79605 & (11313725) & (222745), (230), (310) \\
82350 & (11213725) & (222745), (230), (310) \\
85095 & (11213725) & (11310980), (222745), (230), (310) \\
87840 & (11316470) & (222745), (230), (310) \\
90585 & (11316470) & (222745), (230), (310) \\
93330 & (11313725) & (222745), (230), (310) \\
96075 & (11316470) & (222745), (230), (310) \\
98820 & (11316470) & (222745), (230), (310) \\
101565 & (11313725) & (222745), (230), (310) \\
104310 & (11316470) & (222745), (230), (310) \\
107055 & (11313725) & (222745), (230), (310) \\
109800 & (11313725) & (222745), (230), (310) \\
112545 & (11216470) & (11313725), (222745), (230), (310) \\
115290 & (11316470) & (222745), (230), (310) \\
118035 & (11313725) & (222745), (230), (310) \\
120780 & (11316470) & (222745), (230), (310) \\
123525 & (11313725) & (222745), (230), (310) \\
126270 & (11216470) & (11313725), (222745), (230), (310) \\
129015 & (222745) & (230), (310) \\
131760 & (222745) & (230), (310) \\
134505 & (11316470) & (222745), (230), (310) \\
137250 & (11313725) & (222745), (230), (310) \\
139995 & (222745) & (230), (310) \\
142740 & (222745) & (230), (310) \\
145485 & (11216470) & (11313725), (222745), (230), (310) \\
148230 & (222745) & (230), (310) \\
150975 & (11316470) & (222745), (230), (310) \\
153720 & (11213725) & (222745), (230), (310) \\
156465 & (11313725) & (222745), (230), (310) \\
159210 & (11313725) & (222745), (230), (310) \\
161955 & (11316470) & (222745), (230), (310) \\
164700 & (11313725) & (222745), (230), (310) \\
\end{longtable}
\end{center}

方案二:使用supertabular
参看。 http://www.ctan.org/tex-archive/macros/latex/contrib/supertabular/supertabular.pdf

该宏包提供了一个 supertabular 环境,是对 tabular 环境的扩充。它能不断地计算表格长度,当排版到页面底部时,自动结束 tabular 环境,而在下一页再自动生成一个新的 tabular 环境,将剩余表格放入其中。

使用该宏包排版长表格时,要用所提供的生成命令专门设计表头,具体方法可参考文中的示例。

摘录文中示例如下:需要\usepackage{supertabular}

\begin{center}
\tablefirsthead{%
\hline
\multicolumn{1}{|c}{\tbsp Number} &
\multicolumn{1}{c}{Number$^2$} &
Number$^4$ &
\multicolumn{1}{c|}{Number!} \\
\hline}
\tablehead{%
\hline
\multicolumn{4}{|l|}{\small\sl continued from previous page}\\
\hline
\multicolumn{1}{|c}{ Number} &
\multicolumn{1}{c}{Number$^2$} &
Number$^4$ &
\multicolumn{1}{c|}{Number!} \\
\hline}
\tabletail{%
\hline
\multicolumn{4}{|r|}{\small\sl continued on next page}\\
\hline}
\tablelasttail{\hline}
\bottomcaption{This table is split across pages}
\tablefirsthead{%
\hline
\multicolumn{1}{|c}{\tbsp Number} &
\multicolumn{1}{c}{Number$^2$} &
Number$^4$ &
\multicolumn{1}{c|}{Number!} \\
\hline}
\tablehead{%
\hline
\multicolumn{4}{|l|}{\small\sl continued from previous page}\\
\hline
\multicolumn{1}{|c}{ Number} &
\multicolumn{1}{c}{Number$^2$} &
Number$^4$ &
\multicolumn{1}{c|}{Number!} \\
\hline}
\tabletail{%
\hline
\multicolumn{4}{|r|}{\small\sl continued on next page}\\
\hline}
\tablelasttail{\hline}
\bottomcaption{This table is split across pages}
\tablefirsthead{%
\hline
\multicolumn{1}{|c}{ Number} &
\multicolumn{1}{c}{Number$^2$} &
Number$^4$ &
\multicolumn{1}{c|}{Number!} \\
\hline}
\tablehead{%
\hline
\multicolumn{4}{|l|}{\small\sl continued from previous page}\\
\hline
\multicolumn{1}{|c}{ Number} &
\multicolumn{1}{c}{Number$^2$} &
Number$^4$ &
\multicolumn{1}{c|}{Number!} \\
\hline}
\tabletail{%
\hline
\multicolumn{4}{|r|}{\small\sl continued on next page}\\
\hline}
\tablelasttail{\hline}
\bottomcaption{This table is split across pages}
\begin{supertabular}{|r@{\hspace{6.5mm}}|r@{\hspace{5.5mm}}|r|r|}
1 & 1 & 1 & 1 \\
2 & 4 & 16 & 2 \\
3 & 9 & 81 & 6 \\
4 & 16 & 256 & 24 \\[5mm]
19 & 361 & 130321 & 1.2164510017\\
20 & 400 & 160000 & 2.4329020018\\
2 & 4 & 16 & 2 \\
3 & 9 & 81 & 6 \\
4 & 16 & 256 & 24 \\[5mm]
19 & 361 & 130321 & 1.2164510017\\
20 & 400 & 160000 & 2.4329020018\\
2 & 4 & 16 & 2 \\
3 & 9 & 81 & 6 \\
4 & 16 & 256 & 24 \\[5mm]
19 & 361 & 130321 & 1.2164510017\\
20 & 400 & 160000 & 2.4329020018\\
2 & 4 & 16 & 2 \\
3 & 9 & 81 & 6 \\
4 & 16 & 256 & 24 \\[5mm]
19 & 361 & 130321 & 1.2164510017\\
20 & 400 & 160000 & 2.4329020018\\
2 & 4 & 16 & 2 \\
3 & 9 & 81 & 6 \\
4 & 16 & 256 & 24 \\[5mm]
19 & 361 & 130321 & 1.2164510017\\
20 & 400 & 160000 & 2.4329020018\\2 & 4 & 16 & 2 \\
3 & 9 & 81 & 6 \\
4 & 16 & 256 & 24 \\[5mm]
19 & 361 & 130321 & 1.2164510017\\
20 & 400 & 160000 & 2.4329020018\\2 & 4 & 16 & 2 \\
3 & 9 & 81 & 6 \\
4 & 16 & 256 & 24 \\[5mm]
19 & 361 & 130321 & 1.2164510017\\
20 & 400 & 160000 & 2.4329020018\\
\end{supertabular}
\end{center}

点赞(6)

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部