4

I am writing a document with a simple three column layout using the package multicols.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{multicol}

\begin{document}
\begin{multicols}{3}
[
\section{First Section}
All human things are subject to decay. And when fate summons, Monarchs must obey.
]
\lipsum
\end{multicols}

\end{document}

However, I'd like to merge two of them at the begining, which may look like this: Random research article

where the section 'abstract' is over two columns. Any simple way to do so ?

1

1 Answer 1

1

If flowfram doesn't suit your needs, there isn't a simple way to do it, but it can be done. This solution patches multicol to shrink the height of the second column in the environment by the amount specified in \columnshrink. The necessary height is calculated by setting the abstract spanning the first two columns in a savebox and measuring its total height.

\documentclass{article}
\usepackage{lipsum}
\usepackage{multicol}
\usepackage{xpatch}

\newlength{\abstractwidth}
\newlength{\columnshrink}
\newsavebox{\twocolinsert}

\makeatletter
\newlength{\resized@col}
\newcounter{column@count}

\xpatchcmd{\multi@column@out}{\process@cols\mult@gfirstbox{%
  \setbox\count@
  \vsplit\@cclv to\dimen@
  \set@keptmarks
  \setbox\count@
  \vbox to\dimen@
  {\unvbox\count@
    \ifshr@nking\vfilmaxdepth\fi}%
  }%
}{\process@cols\mult@gfirstbox{%
  \global\advance\c@column@count\@ne
  \resized@col\dimen@%
  \ifnum\c@column@count=\tw@
      \advance\resized@col-\columnshrink
  \fi%
  \setbox\count@
  \vsplit\@cclv to\resized@col
  \set@keptmarks
  \setbox\count@
  \vbox to\dimen@
  { \ifnum\c@column@count=\tw@ \vspace*{\columnshrink} \fi%
    \unvbox\count@
    \ifshr@nking\vfilmaxdepth\fi}%
  }%
}{\typeout{Success}}{\typeout{Failure}}
\makeatother

\begin{document}
\begin{multicols}{3}
  \setlength{\abstractwidth}{2\linewidth}
  \addtolength{\abstractwidth}{\columnsep}
  \savebox{\twocolinsert}{\begin{minipage}{\abstractwidth}
      \section*{Abstract}
      \lipsum[1]
  \end{minipage}}
  \setlength{\columnshrink}{\ht\twocolinsert}
  \addtolength{\columnshrink}{\dp\twocolinsert}
  \noindent\usebox{\twocolinsert}

  \section*{Introduction}
  \lipsum[2-10]
  \end{multicols}
\end{document}

Result:

enter image description here

1
  • This patch no longer works with TeX Live 2022 with the latest package of multicol. Jan 6, 2023 at 4:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .