[Tex/LaTex] Adding vertical stretch at a table row

longtabletablesvertical alignment

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}

Best Answer

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}
Related Question