3

There is an orphan line on page 2.

How to get rid of it?

Minimal Code

\documentclass{article}
\usepackage[a4paper,margin=5cm,landscape]{geometry}
\usepackage{longtable,array}


\usepackage{pstricks}
\def\pic{\begin{pspicture}(5,5)\psframe(5,5)\end{pspicture}}
\def\row{\pic&\pic\\\hline}

\begin{document}

\begin{longtable}{|*{2}{m{0.4\linewidth}|}}
\hline
\row\row\row
\end{longtable}

\begin{longtable}{|*{2}{m{0.4\linewidth}|}}
\hline
\row\row\row
\end{longtable}

\end{document}

2 Answers 2

3

Do a test with \Needspace from package needspace if there is enough space on the page for beginning the table, which first draws the rule and then decides if the next row could be set on the current page.

\documentclass[dvips]{article}
\usepackage[a4paper,margin=5cm,landscape]{geometry}
\usepackage{longtable,array,needspace}


\usepackage{pstricks}
\def\pic{\begin{pspicture}(5,5)\psframe(5,5)\end{pspicture}}
\def\row{\pic & \pic\\\hline}

\begin{document}

\begin{longtable}{|*{2}{m{0.4\linewidth}|}}
\hline
\row\row\row
\end{longtable}

\Needspace*{5.5cm}
\begin{longtable}{|*{2}{m{0.4\linewidth}|}}\hline
\row\row\row
\end{longtable}

\end{document}
2

That's the \hline of the next longtable. You could try e.g. \Needspace{6cm} (from the needspace package) before the second longtable to force a page break. Or enlarge the page a bit with \enlargethispage{1cm}.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .