0

When I insert images in Supertabular to break them automatically across pages, supertablur does not work correctly.

  1. Table caption remains on the first page!
  2. The images do not break across pages!

The MWE is as follows:

\documentclass{article}

\usepackage{graphicx}
\usepackage{supertabular}

\begin{document}

\tablecaption{Testing Supertabular}
\tablehead
   {\bfseries row&\bfseries  Image\\ \hline}
\tabletail
   {\hline \multicolumn{2}{r}{\emph{Continued on next page}}\\}
\tablelasttail{\hline}

\begin{supertabular}{cc}
\hline
1 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
2 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
3 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
4 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
5 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
6 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
7 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
\end{supertabular} 

\end{document}
1

Supertabular isn't very good at this. Its calculation of the required space assumes that each row has a "normal" height (one line of text), unless there is a p{} column, in which case the height of the resulting \parbox is measured. So in this case it thinks the table is 7 lines high and that would fit on the page. So it puts everything in a single tabular. But then TeX's page breaking algorithm finds that this tabular is too large for the page and puts it on the next page. You can help supertabular by using a p specifier for the second column.

\begin{supertabular}{cp{.5\textwidth}}

Another option is toi use longtable instead of supertabular. In general I find longtable more reliable than supertabular.

\documentclass{article}

\usepackage{graphicx}
\usepackage{longtable}

\begin{document}

\begin{longtable}{cc}
  \caption{Testing Longtable} \\
  \bfseries row&\bfseries  Image\\ \hline \endhead
  \hline \multicolumn{2}{r}{\emph{Continued on next page}}\\ \endfoot
  \hline \endlastfoot
\hline
1 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
2 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
3 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
4 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
5 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
6 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
7 & \includegraphics[width=.5\textwidth]{example-image-a} \\ \hline
\end{longtable} 

\end{document}

enter image description here

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.