1

I have using elsarticle.cls for two column document, my problem is after long table white space is appearing it's because of \twocolumn command, How i resolve the issue, Please see the below example latex code

\documentclass[5p,times]{elsarticle}

\usepackage{lipsum}
\usepackage{tabulary,longtable}
\usepackage{booktabs}


\begin{document}

\begin{frontmatter}

\title{Title}
\author{So Nia}
\address{Department, University}
\ead{so.nia@somewhere.xyz}

\begin{abstract}
\lipsum*[2]
\end{abstract}

\end{frontmatter}

\section{Start}

\lipsum[1-20]
\begingroup
\makeatletter\if@twocolumn\gdef\TwoColDocument{true}\onecolumn\onecolumn\fi\makeatother 
\begin{longtable}{llllll}
\caption{{saple catption} }
\label{table-wrap-97454aa52e5d901359e9505ab07216c1}
\def\arraystretch{1}\\\endfirsthead 
\toprule 
column1 & column2 & column3 & column4 & column4 & column5\\
\midrule \\\endhead \hline \noalign{\vskip3pt} \noalign{\textit{\hfill Continued on next page}} \noalign{\vskip3pt} \endfoot \endlastfoot 
\toprule 
sample title & sample title & sample title & sample title & sample title & sample title\\
\midrule 
sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\


sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\


\bottomrule
\end{longtable}
\endgroup
\twocolumn

\lipsum[1-20]

\end{document}
  • Sorry, but \onecolumn and \twocolumn always start a new page. The best you can do is use \afterpage (afterpage package). – John Kormylo Apr 4 '18 at 14:17
1

It turns out that \afterpage is more of an \aftercolumn in \twocolumn mode, so I created \aftertwo to wait until the next actual page.

\documentclass[5p,times]{elsarticle}

\usepackage{lipsum}
\usepackage{tabulary,longtable,afterpage}
\usepackage{booktabs}

\makeatletter
\newcommand{\aftertwo}[1]{\afterpage{\if@firstcolumn #1
  \else\afterpage{#1}\fi}}
\makeatother

\begin{document}

\begin{frontmatter}

\title{Title}
\author{So Nia}
\address{Department, University}
\ead{so.nia@somewhere.xyz}

\begin{abstract}
\lipsum*[2]
\end{abstract}

\end{frontmatter}

\section{Start}

\lipsum[1-20]

\aftertwo{
\onecolumn
\begin{longtable}{llllll}
\caption{{saple catption} }
\label{table-wrap-97454aa52e5d901359e9505ab07216c1}
\def\arraystretch{1}\\\endfirsthead 
\toprule 
column1 & column2 & column3 & column4 & column4 & column5\\
\midrule \\\endhead \hline \noalign{\vskip3pt} \noalign{\textit{\hfill Continued on next page}} \noalign{\vskip3pt} \endfoot \endlastfoot 
\toprule 
sample title & sample title & sample title & sample title & sample title & sample title\\
\midrule 
sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\


sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\

sample title &
  1 0\ensuremath{\mathrm{\mu}}m &
  123 &
  1245 &
  NO &
  Yes\\


\bottomrule
\end{longtable}
\twocolumn}

\lipsum[1-20]

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.