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.

I have a long text and using supertabular package. While I know that the package and LaTeX itself calculate and determine when to have a page break, would it possible to know when the page break is about to occur or it is just occurred? Thank you for your help.

Thank you David.

In the following LaTeX document you will see on page 2 that the two header coincide. One header is controlled by the fancyheader and this is ok, however the other one can be eliminated if I know that the page break occurred or that the header will be displayed.

Also and if it is not to much to ask, on this same document I used redefine command, which works great, but on the first page I do not have a value and hence it will print blank. I tried ifthenelse and ifnum but did not work, is there a way on the fancy header to find if it is the first page do not display this line of the header?

Any help will be greatly appreciated.

\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}}\\
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\\
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\\
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\\
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\\
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\\
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]\\
\multicolumn{6}{l}{\textbf {Set 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\\
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\\
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\\
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\\
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\\
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\\
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\\
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\\
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\\
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\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\toprule[1pt]\\
\multicolumn{6}{l}{\textbf {Set 3}}\\
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\\
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\\
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\\
03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\
\gdef\NewText{Set 4}
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\\
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\\
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]\\
\multicolumn{6}{l}{\textbf {Set 4}}\\
03/07/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\\
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\\
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\\
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\\
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
    
I think you will need to provide a small complete document that demonstrates the issue, and describe what you want to do. TeX's page breaking is asynchronous so it depends what part of your code needs to know. You can hook into the output routine (where page head and foot are added) as that controls the page breaking, but that can not affect macros within the table body, which have usually all been expanded before the TeX considers the break. (supertabular does more page break calculations by hand than longtable so it's less affected by the output routine, but still an example would be good) –  David Carlisle Mar 22 '13 at 14:24
    
Ah well that's a bit tricky, the standard way in TeX to pass information from the document body to the head is to use \mark You can use marks in longtable (but longtable table heads are a fixed box so can not use them) but you can't use marks in supertabular as far as I can see as the table body is in a box already. perhaps someone who knows supertabular better may be able to pick this up. –  David Carlisle Mar 22 '13 at 21:12

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.