10

Is there a recommended method for incorporating multi-page tables into twocolumn documents? It's clear that the longtable package isn't set up to deal with documents of more than one column.

Is there an alternative package that will deal better with the twocolumn format?

Alternatively, what's the best way of putting longtable (or equivalent) into a twocolumn document as a single column float? Is there something similar to table* and figure*, but for longtable?

Marco Daniel
  • 95,681
Alex T.
  • 151
  • 1
    Thanks! I've gotten supertabular to generate tables now, but have not yet figured out how force it to be single-column (similar to figure*), which I am now realizing is really necessary given my table width.

    Any advice on how to do this?

    – Alex T. Dec 30 '11 at 20:35
  • I'm not sure that I understand. Will tabularx handle page breaks? – Alex T. Dec 30 '11 at 21:14

1 Answers1

5

How float environments are handled in LaTeX can you read in the answer of Frank Mittelbach: How to influence the position of float environments like figure and table in LaTeX? To answer your question we must collect some facts:

  1. Floating environments doesn't allow any page breaks.
  2. longtable or supertabular aren't floating environments and can't be used inside them.
  3. Only the package tabularx and ltxtable (combination of longtable and tabularx) can handel a given width.
  4. You can't simple interrupt the twocolumn mode.
  5. When a document is set in twocolumn, yet you can switch inside the document between onecolumn and twocolumn

Based of this fact and your request I suggest a combination of the package multicol and ltxtable

The package multicol provided the environment multicols.

\documentclass[twocolumn,demo]{article}
\usepackage{graphicx,lipsum}
\usepackage{multicol}
\usepackage{longtable,ltxtable,booktabs}
\usepackage{forloop}
\newcounter{count}
\setcounter{count}{1}

\usepackage{filecontents}
\begin{filecontents}{myltxtable.tex}
\renewcommand\arraystretch{3.5}
\begin{longtable}{X}
\caption{caption}\\\endfirsthead
\toprule
foo\\bar\\foo\\bar\\
foo\\bar\\foo\\bar\\
foo\\bar\\foo\\bar\\
foo\\bar\\foo\\bar\\
foo\\bar\\foo\\bar\\
\bottomrule
\end{longtable}
\end{filecontents}

\begin{document}
\section{foo}
\lipsum[1]
\clearpage
\onecolumn
\begin{multicols}{2}[\section{begin multicols}]
\lipsum\lipsum[2]
\end{multicols}
\LTXtable{\textwidth}{myltxtable.tex}
\twocolumn
\lipsum
\end{document} 

ORIG

I hope I understand you correct. Some time ago I wrote a small post about the package supertabular on the FAQ Dante (in German) which is able to handle two column.

One important fact is that supertabular calculates the width of the rows c, l and r on every new page again.

Here a small example:

\documentclass[twocolumn]{article}
\usepackage{forloop,supertabular}
\newcounter{count}
\setcounter{count}{1}
\begin{document}
\begin{center}
\tablefirsthead{erster Tabellenkopf\\}
\tablehead{Tabellenkopf\\}
\tabletail{Fortsetzung n\"achste Seite\\}
\tablelasttail{letze Seite\\}
\tablecaption{supertabular-Tabelle}
\begin{supertabular}{c}
\whiledo{\value{count} < 100}{\stepcounter{count}
   \arabic{count} \\}
\end{supertabular}
\end{center}
\end{document} 
David Carlisle
  • 757,742
Marco Daniel
  • 95,681