![如何格式化论文中的长表格和大表格?](https://linux22.com/image/320613/%E5%A6%82%E4%BD%95%E6%A0%BC%E5%BC%8F%E5%8C%96%E8%AE%BA%E6%96%87%E4%B8%AD%E7%9A%84%E9%95%BF%E8%A1%A8%E6%A0%BC%E5%92%8C%E5%A4%A7%E8%A1%A8%E6%A0%BC%EF%BC%9F.png)
在我的硕士论文中,我有很多桌子,又大又长;如何最好地适应它们?
将较长的表格分成多页可以吗?
那么大一点的呢?
任何建议将被认真考虑
更新
这是一个大表格的示例
\begin{table}[H]
\centering
\begin{tabular}{|l|r|r|r|}
\hline HTTP Date & Time zone & Time shift & Timestamp \\
\hline Tue, 02 Jun 2015 20:33:31 GMT & America/Chicago & -6 & June 2nd 2015, 22:19:31.929 \\
\hline Sun, 14 Jun 2015 11:33:46 GMT & America/Denver & -7 & June 14th 2015, 13:19:07.193 \\
\hline Sun, 14 Jun 2015 11:34:01 GMT & America/Los\_Angeles & -8 & June 14th 2015, 13:19:21.755 \\
\hline Sun, 14 Jun 2015 11:33:46 GMT & America/New\_York & -5 & June 14th 2015, 13:19:07.417 \\
\hline Sun, 14 Jun 2015 12:19:18 GMT & America/Phoenix & -7 & June 14th 2015, 14:04:38.980 \\
\hline Sun, 14 Jun 2015 11:33:59 GMT & America/Toronto & -5 & June 14th 2015, 13:19:19.881 \\
\hline Fri, 12 Jun 2015 05:53:03 GMT & Asia/Shanghai & 8 & June 12th 2015, 07:38:31.238 \\
\hline Sun, 14 Jun 2015 11:33:56 GMT & Europe/Amsterdam & 1 & June 14th 2015, 13:19:17.290 \\
...
\hline
\end{tabular}
答案1
您可以使用ltablex
同时加载tabularx
和的包longtable
。表格有点太宽是因为第三列的头部,我用命令绕过了它\makebox[0pt]
。
\documentclass{article}
\usepackage{booktabs, ltablex}
\usepackage{siunitx}
\sisetup{table-format=-2.0, table-number-alignment=center}
\usepackage[showframe]{geometry}
\begin{document}
\renewcommand{\arraystretch}{1.2}%
\begin{tabularx}{\linewidth}{@{\,}X@{\enspace}l r SX@{\enspace}l@{\,}}
\toprule
\multicolumn{2}{c}{HTTP Date}
& \multicolumn{1}{c}{Time zone}
& {\makebox[0pt]{Time shift}}
& \multicolumn{2}{c}{Timestamp} \\
\midrule
Tue, 02 Jun 2015, & 20:33:31 GMT
& America/Chicago & -6 & June 2nd 2015, & 22:19:31.92 \\
Sun, 14 Jun 2015, & 11:33:46 GMT
& America/Denver & -7 & June 14th 2015, & 13:19:07.193 \\
% \hline
Sun, 14 Jun 2015, & 11:34:01 GMT
& America/Los\_Angeles & -8 & June 14th 2015, & 13:19:21.755 \\
Sun, 14 Jun 2015, & 11:33:46 GMT
& America/New\_York & -5 & June 14th 2015, & 13:19:07.417 \\
Sun, 14 Jun 2015, & 12:19:18 GMT
& America/Phoenix & -7 & June 14th 2015, & 14:04:38.980 \\
Sun, 14 Jun 2015, & 11:33:59 GMT
& America/Toronto & -5 & June 14th 2015, & 13:19:19.881 \\
% \hline
Fri, 12 Jun 2015, & 05:53:03 GMT
& Asia/Shanghai & 8 & June 12th 2015, & 07:38:31.238 \\
Sun, 14 Jun 2015, & 11:33:56 GMT
& Europe/Amsterdam & 1 & June 14th 2015, & 13:19:17.290 \\
\bottomrule
\end{tabularx}
\end{document}
答案2
嗯,旋转桌子90度很简单:
\documentclass{article}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{showframe}
\begin{document}
\begin{sidewaystable}[p]
\renewcommand{\arraystretch}{1.2}
\centering
\begin{tabular}{ r@{\ }l r S r@{\ }l }
\toprule
\multicolumn{2}{c}{HTTP Date}
& \multicolumn{1}{c}{Time zone}
& \multicolumn{1}{c}{Time shift}
& \multicolumn{2}{c}{Timestamp} \\
\midrule
Tue, 02 Jun 2015, & 20:33:31 GMT
& America/Chicago & -6 & June 2nd 2015, & 22:19:31.92 \\
Sun, 14 Jun 2015, & 11:33:46 GMT
& America/Denver & -7 & June 14th 2015, & 13:19:07.193 \\
% \hline
Sun, 14 Jun 2015, & 11:34:01 GMT
& America/Los\_Angeles & -8 & June 14th 2015, & 13:19:21.755 \\
Sun, 14 Jun 2015, & 11:33:46 GMT
& America/New\_York & -5 & June 14th 2015, & 13:19:07.417 \\
Sun, 14 Jun 2015, & 12:19:18 GMT
& America/Phoenix & -7 & June 14th 2015, & 14:04:38.980 \\
Sun, 14 Jun 2015, & 11:33:59 GMT
& America/Toronto & -5 & June 14th 2015, & 13:19:19.881 \\
% \hline
Fri, 12 Jun 2015, & 05:53:03 GMT
& Asia/Shanghai & 8 & June 12th 2015, & 07:38:31.238 \\
Sun, 14 Jun 2015, & 11:33:56 GMT
& Europe/Amsterdam & 1 & June 14th 2015, & 13:19:17.290 \\
\bottomrule
\end{tabular}
\end{sidewaystable}
\end{document}
但页面看上去很空:
对于上图,我稍微重新格式化了您的表格(引入了两个附加列)。在其中,我添加了siunitx
包以更好地格式化“时间移位”,并booktabs
获得更漂亮的标尺。在表格中,如您所见,我省略了垂直线。也许将长单元格中的文本拆分为较短的两行的解决方案会更好:
\documentclass{article}
\usepackage[margin=30mm,showframe]{geometry}
\usepackage{booktabs,tabularx}
\usepackage{siunitx}
\begin{document}
\begin{table}[h]
\renewcommand{\arraystretch}{1.3}
\centering
\begin{tabularx}{\textwidth}{ X r S X }
\toprule
\multicolumn{1}{c}{HTTP Date}
& \multicolumn{1}{c}{Time zone}
& \multicolumn{1}{c}{Time shift}
& \multicolumn{1}{c}{Timestamp} \\
\midrule
Tue, 02 Jun 2015,\newline
20:33:31 GMT
& America/Chicago & -6 & June 2nd 2015,\newline
22:19:31.92 \\
Sun, 14 Jun 2015,\newline
11:33:46 GMT
& America/Denver & -7 & June 14th 2015,\newline
13:19:07.193 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
这使:
对于上面的 MWE,我添加了两个包:(geometry
因为我不知道您的页面是如何设置的)我用它们定义了页面,以及,它们将表格调整到文本宽度并使多行单元格成为可能。包中的tabularx
选项仅用于显示文本边框。在正常情况下应该省略它。showframe
geometry
如果您希望将此表扩展到更多页面,则需要选择支持此功能的表环境。 Bernard 的回答中有一个可能的解决方案。