0

I've been using memoir's \newfloat to make boxes of text that float within a multi-column document. When I use twocolumn mode, everything works fine. However, I need to use the multicol package for columns, instead, because that allows me to make section titles that span columns (without starting a new page, like when attempting such in twocolumn mode).

When I use the the starred version of the memoir float, the results span columns as expected (both in twocolumn mode and when using multicol). The non-starred version, however, fails to show up when using multicol.

\documentclass{memoir}

\usepackage{lipsum}
\usepackage{multicol}
\usepackage{xcolor}

\pagestyle{empty}

% Create memoir float...
\newfloat{F}{X}{capname}

% Make section title span columns...
\let\oldsection\section
\renewcommand*{\section}[1]{%
    \end{multicols}%
    \oldsection{#1}%
    \begin{multicols}{2}%
    }

\begin{document}

\begin{multicols}{2}

\section{Section title modified to span columns}

\lipsum[1-2]

\begin{F} % Non-starred is supposed to float contents within a column -- this works with twocolumn, but not multicols?
\color{red}{\lipsum[3]}
\end{F}

\lipsum[4-5]

\begin{F*} % Non-starred is supposed to float contents across all columns on next page -- this works.
\color{green}{\lipsum[6]}
\end{F*}

\lipsum[7-8]

\end{multicols}

\end{document}
2
  • 1
    multicol doesn't support 1-column floats Jan 19, 2020 at 0:01
  • Then is there a simple alternative to multicol that would allow both types of floats, as well as the column-spanning section title?
    – user182238
    Jan 19, 2020 at 0:13

1 Answer 1

1

Do you really need the multicols environment or could you make do with a mixture of multicols combined with the regular \onecolumn and \twocolumn macros? As @DavidCarlisle said multicol does not support single column floats.

\documentclass{memoir} % defaults to \onecolumn
\usepackage{multicols}
\begin{document}
Text in one column ...
\twocolumn % starts new page in two column
Text in two columns
\onecolumn % starts new page in one column
Text
\begin{multicols}{2} % starts two columns
Text in two columns
\end{multicols} % reverts back (to onecolumn)
Text
\end{document}

By cunning adjustments you may be able to get your one column figures in a \twocolumn instead of a multicols{2}.

2
  • All I require are two things: First, the section title must span two columns, anywhere on the page, without the change forcing a jump to a new page. Second, I need to be able to float both single-column and column-spanning patches of text. (So, perhaps my issue is with twocolumn mode not doing what I want with the section title?)
    – user182238
    Jan 20, 2020 at 17:16
  • By the way, I've seen solutions on here for one problem or the other, but never for both. They always pass the buck from twocolumn to multicol for the section title, and vice versa for single-column floats. I'm not a programmer, so I don't comprehend the behind-the-scenes complexity that apparently prevents both from working.
    – user182238
    Jan 20, 2020 at 17:22

You must log in to answer this question.

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