![在 revtex4 中使用 longtable 时出现多余的页眉和页脚](https://linux22.com/image/390570/%E5%9C%A8%20revtex4%20%E4%B8%AD%E4%BD%BF%E7%94%A8%20longtable%20%E6%97%B6%E5%87%BA%E7%8E%B0%E5%A4%9A%E4%BD%99%E7%9A%84%E9%A1%B5%E7%9C%89%E5%92%8C%E9%A1%B5%E8%84%9A.png)
我的 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}
您将获得两个表格:
和