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 longtable that is used to produce checklist forms. The basic layout is shown below, alt text alt text

The second page (if there is one - some forms are quite short) would be better if it had the bottom row of the table extend vertically to meet the top of the signature block below - which is a separate tabular. Is there a way to add vertical stretch like a \vfill effect in a table row? Any other suggestions.

A trimmed working minimal version of the code is listed below

\documentclass[11pt]{article} % use larger type; default would be 10pt
\usepackage{longtable}

\usepackage{amssymb}[2002/01/22] %% for the Box

%% Set up counters for the check items
%% The counters are defined globally in a header
%% so we only step the counters here
%%
%% qnumber is the question counter

\newcounter{qnumber}
\setcounter{qnumber}{0}


%% new counter for headings in forms
%% 
\newcounter{hcounter}
\setcounter{hcounter}{0}


%% We define the yesno macro that is used
%% by the questions to print the Yes No and 
%% tick boxes
\newcommand{\yesno}{\textsf{Yes}\hskip9pt\textsf{No} {\Large ~$\Box$}~~~~{\Large $\Box$}}

%% we now define the questions
%% since they are not all questions a better term
%% would be added on the next revision
%
\newcommand{\question}[1]{
\stepcounter{qnumber}%
\hfill\thehcounter.\theqnumber\hfill\hfill &\textsf{#1} &{\small\yesno}&    {\small\yesno}&{\small\yesno}\\ \hline%
}

%% we now define the question headings
%% Every time a heading is called
%% The hcounter is incremented and the qnumber set to 1

\newcommand{\heading}[1]{%
\stepcounter{hcounter}%  
\setcounter{qnumber}{0}%
\hfill\textbf{\thehcounter.0}\hfill\hfill&\multicolumn{4}{|l|}{\bf\textsf{#1}}\\ \hline %
}

\begin{document}

\begin{longtable}{|p{7mm}|p{8.61cm}|p{1.5cm}|p{1.5cm}|p{1.55cm}|}
\heading{Controls}
  \question{Control valves/actuators properly installed.}
  \question{Control valves/actuators operable.}
  \question{BMS signals operable.}
  \question{Control valves/actuators properly installed.}
  \question{Vibration isolation devices installed?}
\heading{Other} 
  \question{Access doors are operable and sealed? } 
  \question{Casing undamaged?}
  \question{Insulation undamaged?}
  \question{Condensate drainage is unobstructed?}
%% the end portion of the environment
%% add the remarks columns and close the longtable
\multicolumn{5}{|l|}{\bf {\textsf{DISCREPANCIES}}}\\
\multicolumn{5}{|l|}{}\\
\multicolumn{5}{|l|}{}\\
\multicolumn{5}{|l|}{}\\
\multicolumn{5}{|l|}{}\\
\hline%
\end{longtable}
\end{document}
share|improve this question
    
save the coordinates of the first row and compare the y value of the last row with the one of the first row. Then you can insert an invisible vertical rule. –  Herbert Dec 20 '10 at 21:56
    
@Herbert good suggestion, care to elaborate how I can pick-up the co-ordinate? I am sure there is a PStricks or TikZ way to do it but I am not very familiar with them. –  Yiannis Lazarides Dec 20 '10 at 22:22
add comment

1 Answer

up vote 3 down vote accepted

With the package zref-savepos you can get the current coordinates. It needs at least two pdflatex runs. \zrefy{<Label>} is the current height from the bottom. With the other settings from the top you know what height you have to fill to get a full page tabular. Here is only an example on how it works. For demonstration I used only \rule{0pt}{0.5\myHeight}. You have to use the paper dimensions to get the correct \myHeight.

\documentclass[11pt]{article} % use larger type; default would be 10pt
\usepackage{longtable}
\usepackage{zref-savepos}
\newlength\myHeight

\usepackage{amssymb}[2002/01/22] %% for the Box
\newcounter{qnumber}
\setcounter{qnumber}{0}
\newcounter{hcounter}
\setcounter{hcounter}{0}
\newcommand{\yesno}{\textsf{Yes}\hskip9pt\textsf{No} {\Large ~$\Box$}~~~~{\Large $\Box$}}
\newcommand{\question}[1]{
\stepcounter{qnumber}%
\hfill\thehcounter.\theqnumber\hfill\hfill &\textsf{#1} &{\small\yesno}&    {\small\yesno}&{\small\yesno}\\ \hline%
}
\newcommand{\heading}[1]{%
\stepcounter{hcounter}%  
\setcounter{qnumber}{0}%
\hfill\textbf{\thehcounter.0}\hfill\hfill&\multicolumn{4}{|l|}{\bf\textsf{#1}}\\ \hline %
}

\begin{document}

\begin{longtable}{|p{7mm}|p{8.61cm}|p{1.5cm}|p{1.5cm}|p{1.55cm}|}
\zposy{TOP}\heading{Controls}
  \question{Control valves/actuators properly installed.}
  \question{Control valves/actuators operable.}
  \question{BMS signals operable.}
  \question{Control valves/actuators properly installed.}
  \question{Vibration isolation devices installed?}
\heading{Other} 
  \question{Access doors are operable and sealed? } 
  \question{Casing undamaged?}
  \question{Insulation undamaged?}
  \question{Condensate drainage is unobstructed?}
%% the end portion of the environment
%% add the remarks columns and close the longtable
\multicolumn{5}{|l|}{\bf {\textsf{DISCREPANCIES}}}\\
\multicolumn{5}{|l|}{%
  \zsavepos{POS}\setlength\myHeight{\zposy{POS}sp}
\rule{0pt}{0.5\myHeight}    \the\myHeight    }\\\hline%
\end{longtable}

\end{document}
share|improve this answer
    
I marked your inline code with backticks. Have a look at your first version; there the <Label> didn't show up (got eaten as an unknown html entity). –  Hendrik Vogt Dec 21 '10 at 8:15
    
ah thanks, maybe that I'll learn it in this year ... :-) –  Herbert Dec 21 '10 at 8:29
    
One more thing to learn: If you use "@Hendrik" somewhere in your comment, and there is already a comment that I wrote (as is the case here), then I get a notification of what you wrote. Merry Christmas! –  Hendrik Vogt Dec 21 '10 at 9:00
    
Thanks it worked after some minor modification. Great code thanks. –  Yiannis Lazarides Dec 21 '10 at 18:23
    
@YiannisLazarides Can we know those minor modifications? :-) –  azetina Oct 23 '12 at 20:01
show 1 more 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.