我的 LaTeX 文件中有两个长表格:第一个应该提供页眉和页脚,而第二个不需要这样的辅助线。
如何解决第一个长表格的页眉和页脚不应该放在第二个长表格对应的页面的开头和结尾?我的 LaTeX 文件内容如下:
\documentclass[a4paper,preprint,aps, unsortedaddress]{revtex4}
\usepackage[top=2.5cm,bottom=2.5cm, left=3.5cm,right=2.5cm]{geometry}
\usepackage{longtable,array,booktabs}
\newcommand{\mc}{\multicolumn}
\begin{document}
\setlength\LTleft{-3.0cm}
\setlength\LTright{-2.0cm}
\scriptsize
\begin{longtable}{ l r @{--} p{1.3cm} >{\centering}p{2.6cm}
*{4}{p{1.25cm}} p{2.1cm}}
%% headers and footers
\caption{Table} \\
\hline\hline
\endfirsthead
\mc{9}{c}{\tablename\ \thetable\ -- \emph{Continued from previous page}} \\
\hline
aaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
\hline
\endhead
\hline
\mc{9}{r}{\emph{Continued on next page}} \\
\endfoot
\hline\hline
\endlastfoot
%% body of table
aaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
aaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\
aaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii
\end{longtable}
\newpage
\begin{longtable}{ccc}
cell1 & cell2 & cell3 \\
cell1 & cell2 & cell3 \\
cell1 & cell2 & cell3 \\
\end{longtable}
\end{document}
答案1
好吧,你可以为第二个表定义空的表头和表尾,例如
\begin{longtable}{ccc}
\endfirsthead
\endhead
\endfoot
cell1 & cell2 & cell3 \\
cell1 & cell2 & cell3 \\
cell1 & cell2 & cell3 \\
\end{longtable}
完整代码如下
\documentclass[a4paper,preprint,aps, unsortedaddress]{revtex4}
\usepackage[top=2.5cm,bottom=2.5cm, left=3.5cm,right=2.5cm]{geometry}
\usepackage{longtable,array,booktabs}
\newcommand{\mc}{\multicolumn}
\begin{document}
\setlength\LTleft{-3.0cm}
\setlength\LTright{-2.0cm}
\scriptsize
\begin{longtable}{ l r @{--} p{1.3cm} >{\centering}p{2.6cm} *{4}{p{1.25cm}} p{2.1cm}}
%% headers and footers
\caption{Table} \\
\hline\hline
\endfirsthead
\mc{9}{c}{\tablename\ \thetable\ -- \emph{Continued from previous page}} \\
\hline
aaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
\hline
\endhead
\hline
\mc{9}{r}{\emph{Continued on next page}} \\
\endfoot
\hline\hline
\endlastfoot
%% body of table
aaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
aaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\
aaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii
\end{longtable}
\newpage
\begin{longtable}{ccc}
\endfirsthead
\endhead
\endfoot
cell1 & cell2 & cell3 \\
cell1 & cell2 & cell3 \\
cell1 & cell2 & cell3 \\
\end{longtable}
\end{document}
您将获得两个表格:
和