1

Right now I have a long table spanning across both pages. At the bottom of the portion of the first page it says "Continued on next page", which is good, but this also appears at the bottom of the portion on the second page. Here's the code I'm using:

\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
  • 3
    you need an \endlastfoot without that Sep 10, 2021 at 16:36

1 Answer 1

1

Please see the following MWE resulting in two pages. Please see that I marked important code changings with <=====.

\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}

I added command \endlastfoot to create a special footer for the last page of the table, containing only \hline.

The resulting second pdf page is

second page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.