![可能的实现](https://linux22.com/image/238280/%E5%8F%AF%E8%83%BD%E7%9A%84%E5%AE%9E%E7%8E%B0.png)
为了我的博士论文附录,我需要排版一些包含原始数据的非常大的表格。它们大约有 30 列,并且可能有很多行,无法垂直地放在一页(双页)上。
是否有一个包可以允许创建一个覆盖整个双页(宽度)的表格,因此左页上有 1-15 列,右页上有 16-30 列,甚至有一个或多个分页符?
我知道longtable
,但我没有找到允许这样做的选项。
两个表格的行应该垂直对齐,但最好重复(“特征”)第一列右侧页面上的每一行也都清晰可见。
(当然我也可以将其分成多个表,但我希望将每个测量部分的所有数据放在一行中。)
更远实际问题:
- 针对这种情况有什么建议吗?
例如
- 左第一页上一个标题就够了吗?
- 通常情况下,我会使用软件包制作表格
booktabs
,并避免在“正常”表格线之间出现水平线,但在这种情况下,它可以帮助眼睛对线条进行分组,也许按 3 组进行分组(这对我的数据 9 来说是有意义的,可以帮助眼睛跟随线条... - 我怎样才能减少那些大表格的外边距(仅)以使用大部分页面宽度?
答案1
我认为唯一可行的选择是将数据分成 2n 个部分:
- 第一部分,第 1-15 列,第 1-24 行,
\newpage
- 第二部分,第 16-30 列,第 1-24 行,
\newpage
- 第三部分,第 1-15 列,第 24-48 行,
\newpage
- 第四部分,第 16-30 列,第 24-48 行,
\newpage
- ...
二十四行只是为了放一些数字。如果数据和标题行的高度相同,它们应该可以完美对齐。
对于标题,它可以放在左页,但我建议将其设置\vbox
为规定的高度:
\newcommand{\mycaption}[1]{\vbox to 3\baselineskip{
\vfill\captionof{table}{#1}\vfill}}
其中 3 是大于标题行数的数字。对于右侧页面,您可以说
\newcommand{\fakecaption}{\vbox to 3\baselineskip{}}
并在;\fakecaption
之后插入\newpage
\captionof
需要标题包裹。
可以使用以下方式覆盖边距:\newgeometry
可以使用以下几何学包或简单地将每个“子表”插入到里面\makebox[\textwidth]{}
。
可能的实现
\documentclass[a4paper,twoside]{book}
\usepackage{caption}
\newlength{\leftcaptionht}
\newsavebox{\tablebox}
\newcommand{\lefttable}[1]{%
\setbox\tablebox=\vbox{\medskip\captionof{table}{#1}}
\setlength{\leftcaptionht}{\ht\tablebox}%
\box\tablebox}
\newenvironment{doubletable}
{\newpage\ifodd\value{page}\null\newpage\fi\centering}{\newpage}
\newenvironment{widetabular}
{\begin{lrbox}{\tablebox}\begin{tabular}}
{\end{tabular}\end{lrbox}\makebox[\textwidth]{\usebox{\tablebox}}}
\newcommand{\righttable}{\newpage\vbox to\leftcaptionht{}}
\begin{document}
text
\begin{doubletable}
\lefttable{This is a caption}
\begin{widetabular}{ll}
a column long enough to go over & a column long enough to arrive over the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
\end{widetabular}
\righttable
\begin{widetabular}{ll}
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
\end{widetabular}
\end{doubletable}
\begin{doubletable}
\lefttable{This is a caption that occupies more than one line and so has to wrap, so that we
can show that the alignment is correct}
\begin{widetabular}{ll}
a column long enough to go over & a column long enough to arrive over the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
\end{widetabular}
\righttable
\begin{widetabular}{ll}
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
a column & a column long enough to arrive near the right margin\\
\end{widetabular}
\end{doubletable}
\end{document}
如果您希望在正确的页面上添加标题,则只需进行\righttable
不同的定义:
\newcommand{\righttable}{\newpage\vbox to\leftcaptionht{\medskip
\noindent(Table \thetable{} (continued)}}
(或类似的东西)。
建议向表中添加行,直到它们适合页面,然后开始新的一对。
答案2
您可以使用 创建表格ConTeXt
,它还可以在水平方向上拆分表格。如果您需要使用 运行它,则可以将创建的 PDF 插入到您的文档中pdflatex