[Tex/LaTex] multicolumn long table or enumeration

#enumeratelistsmulticolpage-breakingtables

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:

output of code

Best Answer

It's possible to trick supertabular to work inside a multicols 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.

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{xcolor,supertabular,multicol}
\newcount\n
\n=0
\def\tablebody{}
\makeatletter
\loop\ifnum\n<300
        \advance\n by1
        \protected@edef\tablebody{\tablebody
                \textbf{\number\n.}&
                \hfill T\hfill\hfill F\hfill\hskip0pt\endgraf
                \vskip.5\baselineskip
                \color@begingroup
                \color{black!20}
                \hrule height3ex
                \color@endgroup
                \tabularnewline
        }
\repeat
\makeatother
\pagestyle{empty}
\begin{document}
\begin{multicols*}{2}
\let\mcnewpage=\newpage
\makeatletter
\renewcommand\newpage{%
        \if@firstcolumn
                \hrule width\linewidth height0pt
                \columnbreak
        \else
                \mcnewpage
        \fi
}
\makeatother
\tablehead{Item \#&\\}
\begin{supertabular}{lp{1.5in}}
\tablebody
\end{supertabular}
\end{multicols*}
\end{document}

I'm not actually sure that this is the best way to generate the body, but it works. enter image description here

Related Question