在表格行添加垂直拉伸?

在表格行添加垂直拉伸?

我有一个longtable用于生成清单表格的软件。基本布局如下所示, 替代文本 替代文本

如果第二页(如果有的话 - 有些表格很短)的表格底部行垂直延伸到下方顶部,则效果会更好signature block- 这是一个单独的行tabular。有没有办法\vfill在表格行中添加垂直拉伸效果?还有其他建议吗?

下面列出了经过精简的最小工作版本代码

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

答案1

使用该包,zref-savepos您可以获取当前坐标。它至少需要两次 pdflatex 运行。\zrefy{<Label>}是从底部开始的当前高度。使用来自顶部的其他设置,您可以知道要填充多少高度才能获得整页表格。这里只是一个关于它如何工作的示例。为了演示,我仅使用了\rule{0pt}{0.5\myHeight}。您必须使用纸张尺寸才能获得正确的\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}

相关内容