Graphics, Figures & TablesLongtable package is not working in two column mode

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
arul
Posts: 2
Joined: Wed Sep 09, 2009 1:02 pm

Longtable package is not working in two column mode

Post by arul »

Hi all
I have 5 pages long table in my latex two column document. I used longtable package it shows error cant use is two column mode. Is there any otherway to split long tables in my twocolumn document?

thanks in advance

regards
a r u l

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Longtable package is not working in two column mode

Post by gmedina »

Hi,

in effect, as the longtable documentation (page 8) mentions:
documentation wrote:longtable now issues an error if started in the scope of \twocolumn, or the multicols environment.
A possible solution: use \onecolumn to temporarily switch to one column mode and build the table, and then use \twocolumn to swith back to two column mode:

Code: Select all

\documentclass[twocolumn]{article}
\usepackage{longtable}
\usepackage{lipsum}% just to automatically generate some text

\begin{document}
\lipsum[1-10]
\onecolumn
\begin{longtable}{cc}
  text & text\\
  text & text\\
  text & text\\
  text & text\\
  text & text\\
  text & text\\
  text & text\\
\end{longtable}
\twocolumn
\lipsum[1-10]

\end{document}
You will notice the poor column balancing obtained in page two in the above example. A better way to deal with two column documents is to use the multicol package:

Code: Select all

\documentclass{article}
\usepackage{multicol}
\usepackage{longtable}
\usepackage{lipsum}% just to automatically generate some text

\begin{document}
\begin{multicols}{2}
  \lipsum[1-10]
\end{multicols}
\onecolumn
\begin{longtable}{cc}
  text & text\\
  text & text\\
  text & text\\
  text & text\\
  text & text\\
  text & text\\
  text & text\\
\end{longtable}
\begin{multicols}{2}
  \lipsum[1-10]
\end{multicols}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Longtable package is not working in two column mode

Post by frabjous »

The supertabular and xtab packages will allow you to have a long multi-page table in a multiple column environment, but they don’t seem to actually wrap the table across the columns. I'd actually recommend using the tabbing environment instead if you can get away with it.
Post Reply