2

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

  • 1
    longtabu uses longtable which can't be used inside multicols as stated in its documentation. See http://tex.stackexchange.com/questions/45980/balancing-long-table-inside-multicol-in-latex or http://tex.stackexchange.com/questions/23488/making-a-long-table-continue-over-two-columns – egreg Jul 23 '13 at 10:28
  • Sure, that's why I'm asking for a workaround or alternative. – arngineer Jul 23 '13 at 10:52
  • In the linked questions there are workarounds – egreg Jul 23 '13 at 10:53
  • Well, the workaround in the first question allows you to use longtabu in two-column-mode, but it does not add the longtabu headers! Neither at the column breaks nor at the page breaks. That renders longtabu rather useless.. – arngineer Jul 23 '13 at 11:21
  • Use supertabular, which works inside multicols and you are done. Receipt: see the links provided by egreg. Where is the problem? – Keks Dose Jul 24 '13 at 09:59
  • In the links provided by egreg, it says that supertabular does NOT work with multicols!:

    "together with the package multicols you can only use the tabbing environment."

    "+1 for the comment on supertabular not working with multicols. it's too bad but it helps to know in advance before wasting hours trying to tweak the settings..."

    – arngineer Jul 24 '13 at 13:55

1 Answers1

2

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}
olpa
  • 1,116