我有一张细长的表格,上面有标题部分。它无法放在一页上,所以我把它分成两部分,长度大致相等,但在另一个tabular
环境中。我对设计很满意,只是我希望右侧列有垂直均匀分布的部分,第一列与顶部对齐,最后一列与底部对齐。基本上,我希望\separator
下面代码中的命令类似于\vfill
我尝试将其定义为\parbox{\linewidth}{\vfill}\\
since ,但以下尝试\vfill\\
本身不起作用。我可以手动进行计算,但实际的表格比此示例更复杂,包含子部分和其他内容,每次编辑时都必须重新进行计算。
有什么建议么?
\documentclass{book}
\usepackage{booktabs}
\begin{document}
\begin{table}
\newcommand\separator{\parbox{\linewidth}{\vfill}\\}
\center
\begin{tabular}{@{}ll@{}}
\toprule
\begin{tabular}{ll}
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\addlinespace
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\end{tabular}
&
\begin{tabular}{ll}
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\separator
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\separator
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\separator
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\end{tabular}\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
编辑:我使用了 David 的优雅解决方案,并将文本列设置为p
,所有文本列的宽度相同。multicols
我将环境放在 a 中minipage
,然后依次将其放入,\begin{tabular}{c}
因为我想封装整个封装在\toprule
和\bottomrule
全局修改中的内容。代码有点乱,但结果非常漂亮。
答案1
请注意,\center
是的内部实现\begin{center}
,并不打算用作命令形式(如果使用,应与配对\endcenter
)\centering
是预期的命令形式。
间距和对齐可以根据要求进行调整,但类似于:
\documentclass{book}
\usepackage{booktabs,multicol}
\begin{document}
\begin{table}
\hrule
\begin{multicols}{2}\setlength\parskip{12pt plus 1fill}
\centering
\begin{tabular}{ll}
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\end{tabular}
\begin{tabular}{ll}
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\end{tabular}
\begin{tabular}{ll}
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\end{tabular}
\begin{tabular}{ll}
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\end{tabular}
\begin{tabular}{ll}
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\end{tabular}
\begin{tabular}{ll}
\multicolumn{2}{c}{\scshape title}\\
\addlinespace
Text & AAA\\
Text & AAA\\
Text & AAA\\
Text & AAA\\
\end{tabular}
\end{multicols}
\hrule
\end{table}
\end{document}