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.

Is there a way to select a float for three rows so that the page break will push the set of three rows to the next page instead of breaking between the rows? In the following example the second line of the subset 13 is pushing to the next page, but I would like the whole subset 13 (title and the following two rows) to push to the second page. I thought about float and could not make it work. Also if there is another way to do it I will be more than happy to hear it. Thanks a lot in advance for all your help and support.

\documentclass[10pt,english]{report}
\usepackage[letterpaper,top=2.0cm,bottom=2.0cm,left=0.5cm,right=1cm]{geometry}
\usepackage{booktabs}
\usepackage{calc}
\usepackage{ifthen}
\usepackage{array}
\usepackage{fancyhdr}
\usepackage[iso]{datetime}
\usepackage{lastpage}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\pagestyle{fancy}
\fancyhf{}
\setlength\headheight{0.5pt}
\chead{\textbf{\normalsize{Neuroscience Report}}}
\lhead{\textbf{UCLA}}
\rhead{\textbf{\footnotesize{Draft}}}
\rfoot{\today \hspace{0.5pt} \currenttime}
\cfoot{Page \thepage}\lfoot{UCLA}

\renewcommand{\headrulewidth}{1pt}

\usepackage{supertabular}
\newcommand{\NewText}{}
\newcommand{\Testit}{\NewText}
\begin{document}
\tablehead
{
\toprule[1pt]
\multicolumn{1}{c}{\textbf{Col1}} & \textbf{Col2} & \textbf{Col3} & \textbf{Col4} & \textbf{Col5} & \textbf{Col6} & \multicolumn{1}{c}{\textbf{SubCol1}}\\ 
& & & & & & \multicolumn{1}{c}{\textbf{SubCol2}}\\
\toprule[1pt]
\multicolumn{6}{l}{\textbf{\Testit}}\\}
\begin{supertabular}{p{37mm}p{15mm}p{23mm}p{26mm}p{33mm}p{10mm}p{37mm}}
\multicolumn{6}{l}{\textbf {Set 1}}\\
\multicolumn{3}{l}{\textbf {SubSet 1}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 2}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 3}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 4}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 5}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 6}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 7}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 8}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 9}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 10}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 11}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 12}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 13}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 14}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\\
\multicolumn{3}{l}{\textbf {SubSet 15}}&\multicolumn{3}{l}{\textbf {SubSet 2}}\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\toprule[1pt]\\
\end{supertabular}
\end{document}
share|improve this question
4  
Did you try with \\* for ending the rows after which you don't want a page break? –  egreg Mar 26 '13 at 13:17
4  
The needspace package allows you to verify a certain amount of space on the page, or else performs a page break. You could use this in the form of \needspace{2\baselineskip} my three lines. –  Steven B. Segletes Mar 26 '13 at 13:50
    
I tried Steven's and works (thank you Steve and egreg), the problem with this approach is that there is no knowledge of when the page break occurrs, and hence I can not add the \needspace in all the rows, because it will actually add additional unnedded space. Any additonal ideas will be greatly appreciated. –  Hector Lake Mar 26 '13 at 14:56
    
I don't think needspace adds extra space unnecessarily. And generally, it would only be used around, le's say, a data cluster that you wished to keep together, not over your whole document. I'll try to look more later. –  Steven B. Segletes Mar 26 '13 at 15:57
    
Hi Steven, that is correct, you do not want it all over the document, that is why I stated that since there is no knowledge of when the page break occur, I placed it all over the document, or if you want, on the most likely to occur the page break. If I know when the page break is about to happen, then I will place the \needspace there instead of all the adjacent rows. –  Hector Lake Mar 26 '13 at 16:17
add comment

1 Answer

The best alternative in your case, would be to use \cr once the environment for supertabular begins. With this approach, you don't have to unreliably guess, where the break is to occur, like the first comment suggested, or unnecessarily pollute the document with unneeded space, like the other one which followed.

So in your document replace the \\ with \cr after the first multicolumn, once supertabular begins. That is, \multicolumn{6}{l}{\textbf {Set 1}}\\ must be replaced with \multicolumn{6}{l}{\textbf {Set 1}}\cr and call it a day.

enter image description here

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.