## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Long tables in twocolumn mode

Information and discussion about graphics, figures & tables in LaTeX documents.
pippipalma
Posts: 23
Joined: Mon Aug 20, 2012 5:12 pm

### Long tables in twocolumn mode

Hello!
I should produce a long table in a twocolumn book, but the longtable package only works with onecolumn documents.
I found that REVTeX 4.1 contains patches that enable the longtable package to work in two-column mode. In particular, it provides the additional environment longtable* which allows a longtable to span the whole page width.
Is there a way of including only those patches in my document, without having to change the class from "book" to "revtex4-1"?

Thanks!

LaTeXguide.org • LaTeX-Cookbook.net

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

### Long tables in twocolumn mode

Hi pippipalma,

Welcome to the LaTeX Community!

I would if possible simply place the long table on pages of its own started with \onecolumn and use \twocolumn after it again.

Is that a possibility for you?

As far as I know revtex is incompatible with quite a few packages. So changing from book is probably not a good way to go.

(I'm not sure there are many people here going to dig into longtable to find a patch.)

Best regards
site moderator & package author

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

### Long tables in twocolumn mode

I've consulted with the author of longtable and with Frank Mittelbach (project manager of LaTeX development), and both agree that a patch here would be far from trivial. Longtable works by altering the 'output routine', the most complex part of LaTeX, and REVTeX does a lot of patching to make longtable* work. Thus you are best going with @cgnieder's approach.
Joseph Wright

pippipalma
Posts: 23
Joined: Mon Aug 20, 2012 5:12 pm

### Re: Long tables in twocolumn mode

Thank you both for your suggestions!

At the moment I fixed the problem by switching to \onecolumn, as suggested by cgnieder; the only drawback I care (the creation of a new page is not really a problem for me) is that footnotes appear in one-column style.
From what you said, I guess that there is no chance for me to import the new environment definitions from revtex4-1.cls into my preamble. Do you agree?

Best regards!

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

### Long tables in twocolumn mode

If revtex really alters the output routine (and I have no doubt it does if Frank Mittelbach said so) I agree that there is no (or only with lots of patching which does not seem to be worth the effort) way to “import” the changes by revtex.

As for the footnotes: the following is not a perfect solution but might work for you in this special case (as long as you have only one footnote in the onecolumn part):

\documentclass[twocolumn]{article}
\usepackage{lipsum}% for dummy text
\usepackage{etoolbox}% provides \patchcmd
\makeatletter
\patchcmd[\long]{\@footnotetext}
{\hsize\columnwidth}% search
{\if@twocolumn\else\divide\columnwidth\tw@\fi\hsize\columnwidth}% replace
{}{}% success, failure
\makeatother
\begin{document}
\twocolumn
\lipsum[1]

A small text with a footnote\footnote{\lipsum[4]} \lipsum[2-6]

\onecolumn
\lipsum[1]

A small text with a footnote\footnote{\lipsum[4]} \lipsum[2-6]

\end{document}

Regards
site moderator & package author

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

### Long tables in twocolumn mode

I just remembered the dblfnote package:

\documentclass[twocolumn]{article}
\usepackage{lipsum}% for dummy text

\usepackage{dblfnote}

\begin{document}
\twocolumn
\lipsum[1]

A small text with a footnote\footnote{\lipsum[4]} \lipsum[2-3]

A small text with a footnote\footnote{\lipsum[4]} \lipsum[4-5]

\onecolumn
\lipsum[1]

A small text with a footnote\footnote{\lipsum[4]} \lipsum[2-4]

A small text with a footnote\footnote{\lipsum[4]} \lipsum[5-6]

\end{document}

Regards
site moderator & package author

pippipalma
Posts: 23
Joined: Mon Aug 20, 2012 5:12 pm

### Long tables in twocolumn mode

Hi Clemens,
thanks a lot for your suggestion! The dblfnote package would have been perfect (I compiled your code), if only I had not to manage two footnote systems:

\documentclass[a4paper,twocolumn]{book}
\usepackage{array}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage[norule,multiple,stable]{footmisc}
\usepackage{manyfoot}
\usepackage{dblfnote}
\usepackage{longtable}

\DeclareNewFootnote{B}[alph]

\newcommand{\footnoteBin}[1]
{\footnotemarkB\newcounter{#1}\setcounter{#1}{\value{footnoteB}}}

\newcommand{\footnoteBout}[2]
{\parbox{0pt}{}\footnotetextB[\value{#1}]{#2}}


In this case, dblfnote seems to affect only standard footnotes, leaving footnoteBs unchanged.

Regards

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

### Long tables in twocolumn mode

Do you need both apparatus in your longtable?

It seems that whatever dblfnote does to footnotes it doesn't do to others defined by manyfoot (or for any of bigfoot for that matter).

For the moment I'm out of suggestions I'm afraid. Maybe I'll have a look into the code of dblfnote the other day but I can't promise anything.

Regards
site moderator & package author

pippipalma
Posts: 23
Joined: Mon Aug 20, 2012 5:12 pm

### Long tables in twocolumn mode

Unfortunately both apparatus are needed in the longtable, as I use it to compare several paragraphs of 3 editions (two of which have their own footnotes) of a text.

In order to make \footnoteB work within the parboxes (implicitely defined by the p-columns of the longtable) I defined two new commands (\footnoteBin and \footnoteBout):

- \footnoteBin defines a footnote label and places a footnotemark within the p-column text;

- \footnoteBout is placed within the next l-column of the table and prints the footnotetext of a given footnote label.

(This procedure is not required for standard footnotes; the very manyfoot apparatus seem to work within l-, c- or r-columns).

Thanks for the help and regards!
Last edited by cgnieder on Wed Aug 22, 2012 11:38 am, edited 1 time in total.