# Request paragraph in multicol environment to be printed on next page / avoid breaking paragraphs

I played a lot with the differed available penalties. But I cannot achieve what I want. Here an example for explaining:

\documentclass[]{article}
\usepackage{lipsum}
\usepackage{multicol}
\begin{document}
\lipsum[1-4]
\begin{multicols}{2}
%\raggedcolumns
\lipsum[4]
\textbf{\lipsum[5]}
\end{multicols}
\end{document}


I want to prevent that the last paragraph stretches over two pages. So the bold printed part should go on the next page. The rest of the 2-column text should stay on page 1. It may use \raggedcolumns, that would be okay with me. A \newpage after \lipsum[4] would do the trick, but how can I make LaTeX insert it for me?

EDIT: I need to clarify: The content of the 2-column text is coming from an external source. I do not want to edit it manually: No page break, no environment, nor any other change I need to do to change the 2-column text. Just \lipsum[4-5].

• I'm not sure I got the question. It is acceptable to insert manually a break command? – Ulrike Fischer Mar 22 '18 at 10:03
• No, I do not want to insert it manually. I want LaTex insert it for me. – Jack Miller Mar 22 '18 at 12:28
• You can make the paragraph unbreakable with a \parbox or minipage. – John Kormylo Mar 22 '18 at 13:52
• I wonder what kind of special (commercial?) application you are trying to build up here given your last question and this one. Your requrements as far as they are visible from those questions are kind of special and not really fitting what multicol is trying to achieve as a standard use cases. That doesn't mean that they can't be acomplished but perhaps you need to consider contracting the development of a special version fitting your requirements. – Frank Mittelbach Mar 23 '18 at 14:33
• @FrankMittelbach Yes, indeed it seems that I need another/individual solution. I was hoping to re-resurrect a private, 20-year-old song book without too much effort. Each song is a paragraph that is why I want prevent breaks within. But it seems the best way is to use a current package (e.g. songs.sourceforge.net). That of course requires a lot of re-structuring... – Jack Miller Mar 24 '18 at 7:59

using the samepage environment should have the desired effect:

\documentclass[]{article}
\usepackage{lipsum}
\usepackage{multicol}
\begin{document}
\lipsum[1-4]
\begin{multicols}{2}
%\raggedcolumns
\lipsum[4]
\begin{samepage}
\textbf{\lipsum[5]}
\end{samepage}
\end{multicols}
\end{document}


• This would be very similar to inserting a \newpage which I want to avoid. I clarified my question above. – Jack Miller Mar 23 '18 at 5:17
• I'm not sure that is going to work if that part ever gets across several columns (or ends up being balanced) – Frank Mittelbach Mar 23 '18 at 14:35
• @FrankMittelbach -- you're correct. it's just as specific as \newpage, but it can be useful in its place. – barbara beeton Mar 23 '18 at 14:46

I found a solution:

\documentclass[]{article}
\usepackage{lipsum}
\usepackage{multicol}

\begin{document}
\lipsum[1-2]
\begin{multicols}{2}
\clubpenalties 15 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 0
\raggedcolumns
\lipsum[4]
\textbf{\lipsum[4]}
\lipsum[4-88]
\end{multicols}
\end{document}


The line starting with \clubpenalties 15 adds infinite (10000) penalties for break (either column or page break) for the first 14 rows. Which means that the first 15 lines in a paragraph are always kept together. For longer paragraphs (e.g. see last paragraph on page 5 of sample code) one would need to increase the number of lines which are kept together (by increasing 15 and adding the same number of times 10000 before the last 0).

\raggedcolumns is need to prevent LaTeX from inserting spaces would cause messy looking gaps.