我使用ltablex
包来创建表格。如何更改表格延续部分的标题名称(如图所示)?
答案1
ltablex
结合longtable
和tabularx
。longtable
提供命令来定义第一个和一般页眉以及一般和最后一个页脚。这些命令实际上用于(诚然简短)ltablex
文档,但本示例不包含用于一般页眉(或页脚)的连续标题。页眉/页脚命令在longtable
文档。
下面给出的代码展示了它们的用法ltablex
。连续标题在通用标题中定义。我还添加了一个使用longtabu
较新tabu
包的示例,它提供了一种定义灵活X
列的便捷方法。
\documentclass{article}
\usepackage{lipsum}
\usepackage{booktabs}
\usepackage{ltablex}
%if longtabu is used, longtable needs to be loaded (which ltablex already does in this document)
%\usepackage{longtable}
\usepackage{tabu}
\textheight4in %to force a page break after a few rows
\renewcommand{\arraystretch}{1.5} %improve spacing
\begin{document}
\begin{tabularx}{\textwidth}{XX}
\caption{A Table}\\
\toprule
First Header & \\
\toprule
\endfirsthead
\caption{A Table (continued)}\\
\toprule
Header & \\
\toprule
\endhead
\bottomrule
Footer & \\
\bottomrule
\endfoot
\bottomrule
Last Footer & \\
\bottomrule
\endlastfoot
Text & \lipsum[75]\\
Text & \lipsum[75]\\
Text & \lipsum[75]\\
\end{tabularx}
\begin{longtabu} to \textwidth {X[1,l] %aligned left
X[2,l]} %twice as wide as first column
\caption{A Table}\\
\toprule
First Header & \\
\toprule
\endfirsthead
\caption{A Table (continued)}\\
\toprule
Header & \\
\toprule
\endhead
\bottomrule
Footer & \\
\bottomrule
\endfoot
\bottomrule
Last Footer & \\
\bottomrule
\endlastfoot
Text & \lipsum[75]\\
Text & \lipsum[75]\\
Text & \lipsum[75]\\
\end{longtabu}
\end{document}