[Tex/LaTex] How to prevent two column text to overlay with minipage of entire pagewidth

positioningtwo-column

I have a two column latex document and at the beginning of each chapter, I want to manually insert a minipage which spans the two columns. Unfortunately, the text in the right column will always overlay with the minipage. How can I prevent that from happening?

\documentclass[twocolumn]{memoir}
\usepackage{lipsum} 

\begin{document}

\chapter{test}

% minipage spanning entire width.
% how do I prevent the text below from overlaying into the minipage?
\begin{minipage}[t]{\textwidth}
STARTMINIPAGE \lipsum[1] ENDMINIPAGE
\end{minipage}

% text across two columns. the right column wraps into the minipage.
\lipsum[1-20]

\end{document}

Best Answer

Put this in your preamble:

\makeatletter
\let\memoir@makechapterhead\@makechapterhead
\def\@makechapterhead#1{\memoir@makechapterhead{#1}\dochapterprolog}
\makeatother

\def\chapterprolog#1{\gdef\dochapterprolog{%
  \if\relax\detokenize{#1}\relax\else
    \noindent\begin{minipage}{\textwidth}#1\end{minipage}\vspace{3\baselineskip}
  \fi\chapterprolog{}}}

You'll start a chapter by

\chapterprolog{What we want in the full width minipage}
\chapter{Chapter title}

The contents of the chapter prolog is reset to empty after usage, so if a chapter has no prolog nothing particular has to be done.

Adjust the 3\baselineskip to what suits you.

(Note: this new version will work also in one column mode)