9

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

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)

  • Can this be done without memoir? – isomorphismes Jun 3 '14 at 9:18
  • @isomorphismes Yes, of course; I used memoir as a prefix just because the post was about this class. It should work also with report and book. – egreg Jun 3 '14 at 9:43
1

You want to switch between onecolumn and twocolumn modes without ejecting the page. I'd suggest using multicol package written specifically for this.

  • I don't want to keep switching back and forth. All of the text is two columns, I really only want one minipage at the beginning of each chapter which spans both columns. – memyself Nov 1 '11 at 13:24
1

The \multicol package has a second optional parameter for text that you want to span over all the columns before the multi columns begin.

Note that there seems to be some problem with using \lipsum here, but adding real text it seems to work.

\documentclass{memoir}
\usepackage{lipsum} 
\usepackage{multicol} 

\begin{document}
\begin{multicols}{2}[%
    \chapter{test}
    \hrule
    Place your single column text here. 
    It will go across the page and the two column 
    text will begin after this.
    \hrule
]

% text across two columns.
\lipsum[1-20]

\end{multicols}
\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.