I would like to put some longer tabular data inside the multicols environment while maintaining its balancing abilities. I have tried supertabular with the trick to redefine \newpage
as columnbreak
. This isn't good though, because the columns aren't properly balanced. Finally I ended up using \halign
:
\documentclass[11pt, a4paper]{article}
\usepackage[margin=3cm]{geometry}
\usepackage{supertabular}
\usepackage{multicol}
\def\shortlipsum{\par Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque.\par}
\newcounter{entryno}
\setcounter{entryno}{1}
\def\tabline{Test & \the\value{entryno} & Description\addtocounter{entryno}{1}\\}
\def\tablines{\tabline\tabline\tabline\tabline\tabline}
\def\mybreak{\hrule width \columnwidth height 0pt \columnbreak}
\begin{document}
\begin{multicols}{2}
\shortlipsum
\medskip
% % This doesn't balance the columns. Whole table ends up in the left column (it fits)
% \begingroup\let\newpage\mybreak
% \noindent\begin{supertabular*}{\columnwidth}{@{\indent}l l l}
% \tablines\tablines\tablines\tablines\tablines\tablines
% \end{supertabular*}
% \endgroup
\begingroup\let\\\cr
\noindent\halign{\indent#\quad&#\quad&#\hfil\cr
\tablines\tablines\tablines\tablines\tablines\tablines}
\endgroup
\medskip
\shortlipsum
\end{multicols}
\shortlipsum
\end{document}
I was wondering if I'm the only one using \halign
to achieve this result. On the other hand supertabular
leaves me with an undesired almost empty right column. How would you approach this problem?
Best Answer
If you don't want
longtable
to add headers and footers to the table at the same time thatmulticol
is balancing where to make the break (which would require that frank and I cooperate:-) then multicol will balance the output from longtable if you first tricklongtable
into thinking that it isn't inmulticol
at all.I added some rules, just to show that latex tabular features then work, which is harder to do with a bare
\halign
.