# Inserting a one-column multi-page table in a two-column document

I am trying to insert a one-column multi-page table in a two-column document. I do not want the page to be flushed before and after the table with the switch between number of columns. Essentially, what I want is the look of table* but capable of spanning multiple pages. Below is an example drawing of what I'm looking for (it isn't important that the table be [h] as in this instance, only that it is embedded in the surrounding text).

Below is a minimal example which generates the "Actual" image:

\documentclass{article}
\usepackage{lipsum} %% To generate example text
\usepackage{array, booktabs,longtable}

\twocolumn
\begin{document}

\lipsum[1-6] %% To generate example text

%%% Begin table %%%
\onecolumn
\begin{longtable}[h]{>{\hangindent=1em}p{13cm}}
\toprule
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\bottomrule
\end{longtable}
\twocolumn
%%% End table %%%

\lipsum[1-6] %% To generate example text

\end{document}


I have tried using the multicol package as an alternative to \onecolumn but this results in the text in the table extending beyond the page margins, instead of wrapping. I also tried using xltabular but must have gotten something wrong as this completely removed the table.

Update: The solution is roughly the one provided below by @Sveinung, but there are several caveats to keep in mind (all but the first apply to my specific case of using documentclass IEEEtran):

1. All tables and figures which should only span one of the two columns will not work within multicol until you make them non-floating.
2. Add the onecolumn option to the documentclass directive.
3. Place the \begin{multicols}{2} after \maketitle and the Abstract (placing it before leads to the columns overwriting the Abstract and the title only spanning one column).
4. Place \end{multicols} just before the end of the document
5. Wrap the offending table in an end/begin multicols.
6. using a local copy of IEEEtran.cls, switch the twocolumn/onecolumn treatment for \abstract and \IEEkeywords for the mode you emply (e.g., compsoc, transmag).
• This is not possible on such a way. Changes from tow column to one column and vice versa can happen on new page only. Oct 21, 2019 at 11:58
• Are you basing this comment on the location of the table at [h]? It is fine with me if the table floats to [t], as with table*, so long as there is no unsightly gap in the text before and after the table.
– Ann
Oct 21, 2019 at 12:11
• longtable does not float. It will start where the environment starts. Oct 21, 2019 at 12:50
• @ann, long table doesn't work in two column documents. change two column to one start new page. If this doesn't mater, than I don't understand what is the problem. Oct 21, 2019 at 12:51
• It is not necessary that the longtable package be used. The important factors are that 1) it is multi-page table, 2) it is a one-column table despite the document being two-column, and 3) that there isn't a lot of empty whitespace before and after the table. I can achieve 1) and 2), but not 3).
– Ann
Oct 21, 2019 at 13:07

What you try to achieve, is probably not possible using twocolumn mode. When you change from twocolumn to onecolumn, LaTeX gives will have a new page, and lot of white space.

I suggest using the package multicol instead for twocolumn mode, and place your texts before and after the tables in multicolsenvironments.

multicol has some shortcomings regarding floats inside columns. If you have lots of floats, it may be not the way to go.

Example 1

\documentclass{article}
\usepackage{lipsum} %% To generate example text
\usepackage{array, booktabs,longtable}
\usepackage[latin]{babel}
\usepackage{multicol}

\begin{document}
\begin{multicols}{2}
\lipsum[1-6] %% To generate example text
\end{multicols}
%%% Begin table %%%

\begin{longtable}{>{\hangindent=1em}p{13cm}}
\toprule
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\bottomrule
\end{longtable}
%%% End table %%%
\begin{multicols}{2}

\lipsum[1-6] %% To generate example text
\end{multicols}

\end{document}


Example 2 - switch to onecolumn

You have to adjust the left and right margin of the longtable if the table shall be set flush to the margins. Since this will depend on your documents margin, I leave it to you.

\documentclass[twocolumn]{article}
\usepackage{lipsum} %% To generate example text
\usepackage{array, booktabs,longtable}
\usepackage[latin]{babel}
\usepackage{multicol}

\begin{document}
\onecolumn
\begin{multicols}{2}
\lipsum[1-7] %% To generate example text
\end{multicols}
%%% Begin table %%%

\begin{longtable}[c]{>{\hangindent=1em}p{13cm}}
\toprule
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\lipsum[1]\\ %% To generate example text
\bottomrule
\end{longtable}
%%% End table %%%
\begin{multicols}{2}

\lipsum[1-6] %% To generate example text
\end{multicols}

\end{document}

• I previously tried using multicol, but around the table rather than in the document itself, with the side effect that the table columns didn't wrap. (Essentially, I wrapped the longtable in a multicols environment.) I see you have tried an alternative approach of using multicols in the document itself. I don't think this is possible for me, as in the actual document the twocolumn comes from the IEEEtrans style, not from an explicit \twocolumn command.
– Ann
Oct 21, 2019 at 13:10
• @Ann Then probably you options are either to wait until the document is final, and then place your tables manually at "strategic" places, or do as we did before - place all the tabulars at the end of the document, and refer to them in the text. Another possibility is to switch to onecolumn at the beginning of the document, and use multicol as I suggest. Oct 21, 2019 at 15:25
• @Ann you can try to set IEEEtran to onecolumn as a class option and then use the solution in this answer. Oct 21, 2019 at 15:28
• I'll give that a try (setting IEEEtran to onecolumn and using multicols around the body text). I've been looking at the afterpage approach @Mico suggested [1] but haven't been able to get it to work. [1] tex.stackexchange.com/questions/256465/…
– Ann
Oct 22, 2019 at 5:00
• Success! As a note to anyone else trying this, (1) use the onecolumn option in the documentclass directive, (2) place the \begin{multicols}{2} after \maketitle and the Abstract (placing it before leads to the columns overwriting the Abstract and the title only spanning one column), (3) place \end{multicols} just before the end of the document, (4) wrap the offending table in an end/begin multicols, and (5) using a local copy of IEEEtran.cls, switch the twocolumn/onecolumn treatment for \abstract and \IEEkeywords for the mode you emply (e.g., compsoc, transmag).
– Ann
Oct 23, 2019 at 11:44