# How to create an empty table as a template which I can populate using commands

I would like to create a template which I can use to create a booklet.

I'd like a 5 row x 2 column table to fill the LH page, with room for a header, and the same on the RH page with room for a footer.

I'd then like to be able to define a custom command which can fill up these cells with questions (and be able to define these elsewhere)

What I have so far is below, but I need help with knowing which classes to look at and how to go about putting it together

Ideally, I'd like to be able to populate the LHS and RHS of the tables on each side seperately (i.e. not have to use &, just use \question and have it go down the columns in order)

\documentclass[a5paper,12pt]{book}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{lipsum}
\usepackage{pst-3dplot}

\oddsidemargin 0.2cm
\evensidemargin 0.2cm

\begin{document}

%% Set up counters for questions
%%
\newcounter{qnumber}
\setcounter{qnumber}{0}
\stepcounter{qnumber}

%% we now define the questions
\newcommand{\question}[1]{
\hline Question X \textsf{#1}  & Question Y \textsf{#1}  \\ \hline
}

\thispagestyle{empty}
%\noindent
\begin{tabularx}{\linewidth}{|X|X|}

\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}

\end{tabularx}

\end{document}
-
Welcome to TeX.SX! By "elsewhere", do you mean before the table, or anywhere in your input file? –  Jubobs Feb 24 '14 at 12:16
@Jubobs - thanks! Ideally after the table, or in a separate file which I'd then include (so I can have banks of questions and generate booklets depending on which questions I need) –  Morris Fauntleroy Feb 24 '14 at 12:31
Why a tabular? Is the idea that you put two questions per line on each page? I guess I'm finding it hard to see how this is meant to go. Plus in what sense are you trying to make a 'booklet'? –  cfr Feb 24 '14 at 23:10

You could try something like this. It is not a tabular but it pushes all of the configuration in terms of layout to the beginning so that all you need do is define the questions (or pull them in from an external file or whatever) in the document itself.

It defines 3 new commands which each take a single argument:

\question{}

to typeset a question. Following your format, this puts 'Question' and the number in serif font and the question itself in sans.

to define the header. Here the header is on odd pages as that makes it easy to show the result. In reality, though, you'd probably want to switch odd and even in the following code to make a proper booklet.

\questionfoot{}

to define the footer. Here this is on even pages but, again, you'd likely want to reverse this.

The flowfram package is used to divide up the pages. See the documentation for details of the possibilities.

The header and footer are set in static frames. These will repeat their content until redefined. So you likely want to change them if you have multiple double-page spreads.

The questions are set in flow frames such that questions flow down the left, then down the right and then to the next page.

geometry is used to set the margins which I think matches your definition. I suspect you want these a bit smaller and possibly a smaller font size to make this work nicely.

\documentclass[a5paper,12pt,twoside]{book}
\usepackage[margin=20mm]{geometry}
\usepackage{parskip}
\usepackage{flowfram}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{.66\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{.49\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{.32\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{.15\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{0pt}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{.66\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{.49\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{.32\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{.15\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{0pt}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.85\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.68\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.51\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.34\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.17\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.85\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.68\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.51\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.34\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.17\textheight}
\newstaticframe[even]{\textwidth}{.15\textheight}{0pt}{0pt}[questionfooter]
\setlength{\ffcolumnseprule}{.5pt}
\setallflowframes{border=none}
\newcounter{qnumber}
\setcounter{qnumber}{0}
\newcommand{\question}[1]{%
\stepcounter{qnumber}%
Question \theqnumber. \textsf{#1}
\newpage}
\newcommand{\questionfoot}[1]{%
\setstaticcontents*{questionfooter}{#1}}

\begin{document}
\thispagestyle{empty}
%\getflowid{\myid}{??}\myid

\questionfoot{\centering\itshape Don't forget to check your work\dots}

\question{Is this a good question? \\ can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a good question? \\ can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}

\end{document}

Produces:

-