1

I want to prevent a page break between a paragraph and a multicol environment that comes right after. I do not mind a page break inside the paragraph or inside the multicol. I also don't mind if the text doesn't fill the page completely, so I use \raggedbottom

My MWE:

\documentclass{article}

\usepackage{geometry}
\geometry{showframe}

\usepackage{multicol}
\usepackage{enumitem}
\usepackage{lipsum}

\raggedbottom

\begin{document}

\lipsum[1-6]

Some text. Some text. Some text. Some text.
Some text. Some text. Some text. Some text.
\begin{multicols}{2}
    \begin{enumerate}
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \end{enumerate}
\end{multicols}

\end{document}

The result:

enter image description here

4
  • What about \enlargethispage or the needspace package? Jan 31, 2020 at 17:43
  • @PeterWilson it seems that I will have to calculate the number of required lines by hand -- is that correct? Jan 31, 2020 at 17:45
  • If you decide you need at least the last 2 lines of the paragraph and the first 2 lines of your multicol then you need space for 4 (maybe 5) lines. It is up to you how you want things to look. Jan 31, 2020 at 18:06
  • Try \premulticols=0pt. Jan 31, 2020 at 22:12

1 Answer 1

1

Here is a version of your MWE which includes code according to my suggestion and also John Kormylo's suggestion. See which works best for you.

\documentclass{article}

\usepackage{geometry}
\geometry{showframe}

\usepackage{multicol}
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage{needspace}  % added per Peter W.

\raggedbottom

\begin{document}

\lipsum[1-6]

%\needspace{5\baselineskip} % added per Peter W.
Some text. Some text. Some text. Some text.
Some text. Some text. Some text. Some text.
\premulticols=0pt % added per John Kormylo
\begin{multicols}{2}
    \begin{enumerate}
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \item Some dummy text
    \end{enumerate}
\end{multicols}

\end{document}

John Kormylo's suggestion seems neater, and more broadly applicable, to me.

You must log in to answer this question.

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