[Tex/LaTex] longtabu with multicols

longtablemulticoltablestabutwo-column

I want to place a very long table into my document, i.e. a table which spans multiple pages. The table has a rather narrow width, so it should be set in multicolumn mode (2 or 3 columns). The text should be set in 1-column mode, of course.

For my tables, I use the "tabu" and "longtabu" tables. Unfortunately, longtabu does not work together with multicols. The error message is: "longtable not in 1-column mode…"

Is there any workaround?

The final table should look like in the sketch below. Please note how the entries should be ordered, and how the columns should be balanced on the last page of the table (although this is not absolutely necessary).

I'm grateful for any advice on how to achieve that!

enter image description here

Best Answer

Cals tables work to some extent inside multicols. The limitation is that you have to specify table breaks manually.

calstable in multicols

\documentclass{article}
\usepackage{multicol,cals}
\makeatletter
\begin{document}
\section{Multipage table (in a multicols in a table)}
\begin{calstable}
\colwidths{{1cm}{7cm}{1cm}}
\brow \cell{x} \cell{x} \cell{x} \erow
\brow \cell{x} \cell{
\columnsep=0cm\relax
% Force multicols to regard our \leftskip
% by pretending that we are a list.
\@totalleftmargin=\cals@paddingL\relax
\begin{multicols}{2}

\begin{calstable}
\alignR
\colwidths{{1.5cm}{1.5cm}}
\thead{\brow \cell{$n$}\cell{$n^2$} \erow}
\tfoot{\brow \cell{$n$}\cell{$n^2$} \erow}
\brow \cell{2}  \cell{4}   \erow
\brow \cell{3}  \cell{9}   \erow
\brow \cell{4}  \cell{16}  \erow
\brow \cell{5}  \cell{25}  \erow
\brow \cell{6}  \cell{36}  \erow
\tbreak{\break }
\brow \cell{7}  \cell{49}  \erow
\brow \cell{8}  \cell{64}  \erow
\brow \cell{9}  \cell{81}  \erow
\brow \cell{10} \cell{100} \erow
\brow \cell{11} \cell{121} \erow
\end{calstable}

\end{multicols}
} \cell{x} \erow
\brow \cell{x} \cell{x} \cell{x} \erow
\end{calstable}
\end{document}