0

I am trying to suppress page-breaking when a sentence in a single columned text is followed by a multi-column text.

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

\begin{document} \lipsum[1-5]

We have the following cases: \begin{multicols}{2} \begin{enumerate} \item First case \item Second case \item Third case \item Fourth case \item Fifth case \item Sixth case \end{enumerate} \end{multicols}

\end{document}

Is it possible to avoid "We have the following cases:" being the last line of a page while the enumeration starting on the next page? In other words, is it possible that either "We have the following cases:" moves in the next page or some items stay in the same page with "We have the following cases:"?

Replacing

\begin{enumerate}

by

\begin{enumerate}[beginpenalty=10000]

did not solve the problem.

enter image description here

  • 1
    Your example would be a lot more useful if it showed the problem you are trying to solve so it could be used to test answers – David Carlisle Feb 07 '24 at 09:45
  • Please clarify how this query isn't a duplicate of the query you posted 2 days ago? – Mico Feb 07 '24 at 09:52
  • Off-topic: Don't load both enumerate and enumitem; choose one or the other package, but not both. (Speaking for myself, I'd use the enumitem package.) – Mico Feb 07 '24 at 09:54
  • @Mico Actually the query I posted a few days, referred to something more general, and the answer to it solved successfully most cases. However, it did not solve the case where one-column text is followed by two-column text. – Yiorgos S. Smyrlis Feb 07 '24 at 10:20
  • @DavidCarlisle I have modified my question accordingly. – Yiorgos S. Smyrlis Feb 07 '24 at 10:32

1 Answers1

2

You can use the optional argument of multicols for such leading text

\documentclass{article}
\usepackage{multicol}
\usepackage{enumerate,enumitem}

\begin{document}

\rule{1cm}{18cm}

\begin{multicols}{2}[ We have the following cases: ] \begin{enumerate} \item First case \item Second case \item Third case \item Fourth case \item Fifth case \item Sixth case \end{enumerate} \end{multicols}

\end{document}

enter image description here

David Carlisle
  • 757,742