I would like to generate a multi-column table that wraps within columns of the document, and splits across pages. There are a couple of similar questions here
How do I create a really long table in a two column layout?
Two-column longtable or tabular
But neither seem really to resolve the problem.
Criteria:
The table/list will be generated with a loop, with an arbitrary number of rows.
It should split over pages.
It should be usable in a multicols environment.
The closest solution seems to be to use a list instead of a table, but this has the problem of lining up the top rows when the list is wrapped in a multicols environment. Below is a sample document:
\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{xcolor,array}
\usepackage{multicol}
\usepackage{ifthen,enumitem}
\def\stnum{30} % number of items
\newcolumntype{C}{>{\centering}p{.5in}}
\setlist{nolistsep}
\pagestyle{empty}
\begin{document}
\enlargethispage{3\baselineskip}
\begin{multicols*}{2}
\begin{enumerate}[label={\bfseries\arabic*.\qquad},leftmargin=1.3in]
\item[Item \#]
\whiledo{\value{enumi}<\stnum}{
\item \begin{tabular}{CC}T & F\end{tabular}
\item[]{\color{black!20}\rule{1.5in}{3ex}}
}
\end{enumerate}
\end{multicols*}
\end{document}
The main problem is how to line up the rows properly (as if this were a table.) A secondary problem would be to have the equivalent of a repeated column header when the columns wrap.
Here's a partial picture of the output of the document above:
Best Answer
It's possible to trick
supertabular
to work inside amulticols
environment by redefining\newpage
to be\columnbreak
in the first column and\newpage
in the second. I also needed to stick a height 0, width\linewidth
rule at the bottom of the first column. Strange things happen without it.I'm not actually sure that this is the best way to generate the body, but it works.