TransWikia.com

No page break between a paragraph and a multicol

TeX - LaTeX Asked by Michael Fraiman on March 12, 2021

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

One Answer

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{5baselineskip} % 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.

Answered by Peter Wilson on March 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP