Guðmundur H
Guðmundur H

Reputation: 11988

Dealing with widows in a multicol environment

I have problems with dealing with widows within a multicols environment, that is, I have not managed to instruct LaTeX to remove the them.

This PDF document shows an example of the problem. At the top of the second page, I get a widow from the last paragraph of the first page. I have tried a couple of approaches, without luck:

I've also read through the documentation for multicol but have not found anything useful.

Is there anything else I could try?

(The complete LaTeX document for the above example)

Upvotes: 5

Views: 878

Answers (2)

AVB
AVB

Reputation: 4024

It seems that the TeX FAQ item Controlling widows and orphans has some options you did not try yet.

Getting rid of a widow can be more tricky. Options are

  • If the previous page contains a long paragraph with a short last line, it may be possible to set it “tight”: write \looseness=-1 immediately after the last word of the paragraph.
  • If that doesn’t work, adjusting the page size, using \enlargethispage{\baselineskip} to “add a line” to the page, which may have the effect of getting the whole paragraph on one page.
  • Reducing the size of the page by \enlargethispage{-\baselineskip} may produce a (more-or-less) acceptable “two-line widow”.

Upvotes: 2

Alexey Malistov
Alexey Malistov

Reputation: 26995

{\obeyspaces\gdef\nomorebreak{\beginnomorebreak\let \nobreakspace}}
\def\beginnomorebreak{\begingroup
   \def\par{\endgraf\endgroup\par\penalty 9999 }\obeyspaces
   \brokenpenalty 10000 \widowpenalty 10000 \clubpenalty 10000 }
\def\nobreakspace{\vadjust{\nobreak} \removespaces}
\def\removespaces{\futurelet\next\checkspace}
\def\checkspace{\ifx\next\nobreakspace\expandafter\removesinglespace\fi}
\def\removesinglespace#1{\removespaces}

Insert \nomorebreak at any place of your paragraph. Page breaks will be prohibited after this macro until the end of the paragraph.

Upvotes: 2

Related Questions