我怎样才能从我的长表中删除最后一个“接上一页”?

我怎样才能从我的长表中删除最后一个“接上一页”?

现在我有一个横跨两页的长表格。第一页底部显示“下页继续”,这很好,但第二页底部也显示“下页继续”。这是我使用的代码:

\begin{longtable}{cc}
\caption{Reward surfaces of all MuJuCo environments} \\
\hline
\endfirsthead
\multicolumn{2}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\endhead
\hline \multicolumn{2}{r}{\textit{Continued on next page}} \\
\endfoot
\hline

\includegraphics[width=2.75in,keepaspectratio]{./plots/mujuco/antepisode_rewards_3dsurface.png} & \includegraphics[width=2.75in,keepaspectratio]{./plots/mujuco/halfcheetahepisode_rewards_3dsurface.png} \\
\includegraphics[width=2.75in,keepaspectratio]{./plots/mujuco/hopperepisode_rewards_3dsurface.png} & \includegraphics[width=2.75in,keepaspectratio]{./plots/mujuco/humanoid@3x3episode_rewards_3dsurface.png} \\
[...]

\end{longtable}

答案1

请参阅以下 MWE,结果为两页。请注意,我用 标记了重要的代码更改<=====

\documentclass{article}

\usepackage{longtable}
\usepackage{graphicx}


\begin{document}
\begin{longtable}{cc}
  \caption{Reward surfaces of all MuJuCo environments} \\
  \hline
\endfirsthead
  \multicolumn{2}{c}%
    {\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
  \hline
\endhead
  \hline 
  \multicolumn{2}{r}{\textit{Continued on next page}} \\
\endfoot
  \hline % <============================================================
\endlastfoot % <========================================================
\includegraphics[width=2.75in,keepaspectratio]{example-image} & \includegraphics[width=2.75in,keepaspectratio]{example-image-a} \\
\includegraphics[width=2.75in,keepaspectratio]{example-image} & \includegraphics[width=2.75in,keepaspectratio]{example-image-b} \\
\includegraphics[width=2.75in,keepaspectratio]{example-image} & \includegraphics[width=2.75in,keepaspectratio]{example-image-a} \\
\includegraphics[width=2.75in,keepaspectratio]{example-image} & \includegraphics[width=2.75in,keepaspectratio]{example-image-b} \\
\end{longtable}
\end{document}

我添加了命令\endlastfoot来为表格的最后一页创建一个特殊的页脚,其中仅包含\hline

生成的第二个 pdf 页面是

第二页

相关内容