38

I am using multicol to make a two-column document using the book document class. I have a long tabular that I want to break where the page breaks and then continue in the next column.

I could split it into two tables, but I want their width and such to be the same. I've tried with longtable but can't get it to work.

I basically want the table to split and arrange itself into two columns just like normal text does.

Edit: Sorry for the lack of information. With just 1 column it works fine with longtable, but when I use multicols it breaks down and just continues outside the page. I also get an error while compiling.

Package longtable Error: longtable not in 1-column mode.

This is a simplification of my code:

\documentclass[11pt,a4paper]{article}

\usepackage{multicol}
\usepackage{longtable}

\begin{document}

\begin{multicols}{2}

\begin{longtable}{ccc}
Header of first column & Header of second column \\
\endhead
Table cell 1, 1 & Table cell 1, 2 \\
Table cell 2, 1 & Table cell 2, 2 \\
Table cell 1, 1 & Table cell 1, 2 \\
...
...
\end{longtable}

\end{multicols}

\end{document}

What it looks like

I hope this is enough information. Any thoughts?

2

3 Answers 3

28

Use the \twocolumn format, then you can use the package supertabular

\documentclass[11pt,a4paper]{article}
\usepackage{supertabular}

\begin{document}
\twocolumn
\tablehead{Header of first column & Header of second column \\}

\begin{supertabular}{ccc}
Table cell 1, 1 & Table cell 1, 2 \\
Table cell 2, 1 & Table cell 2, 2 \\
Table cell 1, 1 & Table cell 1, 2 \\
...
...
\end{supertabular}

\end{document}

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

4
  • 1
    +1 Was supertabular created to replace longtable? Jul 20, 2011 at 15:08
  • no, it is another package. There are more packages which support a pagebreak
    – user2478
    Jul 20, 2011 at 15:32
  • 4
    That's great. I did not know about supertabular. A shame it can't be used with multicols, but this works for my purpose.
    – Etabeeta
    Jul 20, 2011 at 15:51
  • 6
    +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...
    – mmdanziger
    Jan 26, 2012 at 10:03
17

A way to use longtable within multicols is described in one of the answers to Balancing long table inside multicol in LaTeX. As multicol does balancing after the table is processed some of the features (like repeated table headings) will not work though.

A way to use supertabular with multicols is described in Trick Supertabular into Multicols in new command.

The difference between the two table environments is that supertabular is calculating the table cell width anew for each column while longtablekeeps them uniform.

5

I already posted this answer in a similar question, but I used minipage and vdots and got the effect I wanted:

\documentclass[11pt]{article}
\usepackage{booktabs}
\begin{document}

\begin{table} 
\caption{Your Caption}

\begin{minipage}{0.5\textwidth}
\begin{tabular}{ccc}
\toprule
\textbf{Cell} & \textbf{Simulation} & \textbf{Theoretical} \\
\midrule
0  &  0.0  &  7.88e-31   \\
\vdots & \vdots & \vdots  \\ 
\bottomrule
\end{tabular}

\end{minipage} \hfill
\begin{minipage}{0.5\textwidth}
\begin{tabular}{ccc}
\toprule
\textbf{Cell} & \textbf{Simulation} & \textbf{Theoretical}  \\
\midrule
\vdots & \vdots & \vdots  \\
99  &  0.0  &  7.88-29  \\ 
\bottomrule
\end{tabular}

\end{minipage}
\end{table}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .