# Table to fill page with x number of rows

I'm writing a document that will be printed for a hands-on workshop. I'd like to include some pages in the back of the handout that contain ruled tables that fill the page up to the margins. The trainees could then use this for writing comments, questions etc either for their notes or for feedback.

I'd like to be able to say: Draw a table with width = \textwidth, height = \textheight and 2 columns, the first being 3cm wide and the other filling the remaining space. In addition, I only want to specify the row height and have a table drawn with rules without explicitly coding each row.

-

I borrowed some code from exam.cls and slightly modified it to define a \myruledpage command with two mandatory arguments; the first one gives the length of the first column of rules, and the second one controls the separation between rules; a simple example:

\documentclass{article}
\usepackage[paperheight=10cm]{geometry}% just for the example
\makeatletter
% Code taken from exam.cls and modified
\newlength\linefillheight
\newlength\linefillthickness
\setlength\linefillheight{.25in}
\setlength\linefillthickness{0.1pt}

\newcommand\linefill[1]{\leavevmode

\newcommand\fillwithlines[2]{%
\begingroup
\ifhmode
\par
\fi
\hrule height \z@
\nobreak
\setbox0=\hbox to \hsize{\hskip \@totalleftmargin
\vrule height \linefillheight depth \z@ width \z@
\linefill{#2}}%
% vertical space will always produce the same number of lines
% no matter where on the page it happens to start:
\endgroup
}
\makeatother

\newcommand\myruledpage[2]{%
\setlength\linefillheight{#2}
\fillwithlines{\stretch{1}}{#1}
\newpage}

\begin{document}

\myruledpage{3cm}{1cm}
\myruledpage{5cm}{10pt}
\myruledpage{.5\textwidth}{4pt}

\end{document}


-
Perfect! Exactly what I wanted. The ability to control the width of the first column as well as the line height is fantastic! The speedy, well formed, useful and insightful responses from this site amazes me - Thanks! – Nathan S. Watson-Haigh Oct 25 '12 at 20:18

It's not clear to me from the statement of your objectives if you want various horizontal rules within the table. I'll assume that this isn't the case as the participants' comments on various topics might vary greatly in length; hence, I'll assume that you want horizontal rules only at the top (to delimit the header row) and at the very bottom of each table. With that in mind, I'd recommend using the tabularx package as well as the booktabs package. The latter comes in handy for drawing well-spaced horizontal rules.

The following MWE illustrates how this might be done.

\documentclass{article}
\usepackage{tabularx,booktabs}
\begin{document}

\begin{table}
\begin{tabularx}{\textwidth}{@{} p{3cm} X} % "X" column seizes remaining space
\toprule
Topic & Comment\\
\midrule
\phantom{x}\\[0.9\textheight]
\bottomrule
\end{tabularx}
\end{table}
\end{document}

-