如何删除命令 twocolumn 后的空格

如何删除命令 twocolumn 后的空格

我已经使用 elsarticle.cls 来处理两列文档,我的问题是长表格后出现空白,这是由于 \twocolumn 命令造成的,我如何解决这个问题,请参阅下面的示例 latex 代码

\documentclass[5p,times]{elsarticle}

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


\begin{document}

\begin{frontmatter}

\title{Title}
\author{So Nia}
\address{Department, University}
\ead{[email protected]}

\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}

答案1

事实证明这\afterpage更像是一种\aftercolumn模式\twocolumn,因此我创建了\aftertwo等到下一个实际页面。

\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{[email protected]}

\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}

相关内容