[Tex/LaTex] Multi-page one-column abstract in a two-column document

abstractpage-breakingtwo-column

I'm making a two-column document, but I need a one-column abstract. The code:

\twocolumn[
\begin{@twocolumnfalse}
\maketitle
\begin{abstract}
...
\end{abstract}
\end{@twocolumnfalse}
]

doesn't work, because the abstract is longer enough to use two pages and page don't break. I also tried making a one-column document and used the multicol environment only for the document "text" (not the abstract), but then i had problems with the figure environment.

So, how can I make a one-column abstract?

Best Answer

You can copy the following code as a file long2.sty, place it in your document folder, and then use it as shown below:

%%
%% This is file `long2.sty'.
%%
%% Author: Tomas "tohecz" Hejda <tohecz@gmail.com>
%%
%% Licenced under LaTeX-Project Public License version 1.3 or newer.
%% 
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{long2}[2012/08/19 v0.1 long2: breakable one-column preamble in a two-column document]

\newlength\longtwo@top
\newlength\longtwo@bottom

\newsavebox\longtwo@box
\def\longtwo@repeat{%
    \longtwo@column[{\@twocolumnfalse
    \ifdim\ht\longtwo@box>1.00\textheight%1
      \begingroup
      \vbadness10000
      \setbox0\vsplit\longtwo@box to 1.00\textheight%1
      \setbox1\vbox{\unvbox\longtwo@box}
      \global\setbox\longtwo@box\vbox{\unvbox1}
      \setbox2\vbox to \textheight{%
        \unvbox0
      }
      \ht2=0.9\textheight
      \box2
      \endgroup
    \else
      \ifdim\ht\longtwo@box>0.84\textheight
        \global\let\longtwo@repeat\clearpage
      \else
        \global\let\longtwo@repeat\relax
      \fi
      \unvbox\longtwo@box
      \vspace{15pt plus 15pt}
    \fi
    }]%
  \longtwo@repeat
}

\long\def\longtwo@[#1]{%
  \begingroup
    \let\longtwo@column\twocolumn
    \let\longtwo@mkttl\maketitle
    \def\maketitle{
      \begingroup
      \let\newpage\relax
      \longtwo@mkttl
      \endgroup
    }
    \longtwo@column[{\@twocolumnfalse
    \global\setbox\longtwo@box\vbox{#1}%
    \ifdim\ht\longtwo@box>\textheight
      \begingroup
      \vbadness10000
      \setbox0\vsplit\longtwo@box to 1.00\textheight%1
      \setbox1\vbox{\unvbox\longtwo@box}%
      \global\setbox\longtwo@box\vbox{\unvbox1}%
      \setbox2\vbox to \textheight{%
        \unvbox0
      }
      \ht2=0.9\textheight
      \box2
      \endgroup
    \else
      \ifdim\ht\longtwo@box>0.87\textheight
        \global\let\longtwo@repeat\clearpage
      \else
        \global\let\longtwo@repeat\relax
      \fi
      \unvbox\longtwo@box
    \fi
    }]%
    \longtwo@repeat
  \endgroup
}

\def\longtwocolumn{\@ifnextchar[\longtwo@\twocolumn}

\endinput
%%
%% End of file `long2.sty'.
%%

The document can then look like this (package lipsum and command \lipsum[x-y] are only used to produce some dummy text):

\documentclass[twocolumn]{article}

\usepackage{long2}
\usepackage{lipsum}
\parskip0pt plus 8pt

\title{My title}
\author{My the first}

\begin{document}

\longtwocolumn[{
\maketitle
\begin{abstract}
\lipsum[1-8]
\end{abstract}
\lipsum[9-15]
}]

\lipsum[16-25]

\end{document}

PS: I'm considering making it a package (after I add some features), that's why I posted a complete package file ;)

PPS: Brief introduction of the idea: We store the whole one-column part in a box, then we check whether the box is larger than a page. If yes, we \vsplit it, output the first part, and call \longtwo@repeat on the rest, which does the same again.