Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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}
share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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