3

How to make \filbreak work together with \multicols?

See following example:

\documentclass[]{article}
\usepackage{lipsum}
\usepackage{multicol}
\begin{document}
    \lipsum[2-4]
    \filbreak
    \lipsum[1] % fits on same page, so previews \filbreak has no effect
    \filbreak
    \lipsum[2-4] % does not fit on same page, so preview \filbreak introcudes page break
    \filbreak
    \begin{multicols}{2} % does not fit on page, but previews \filbreak does not introduce pagebreak
        \lipsum
    \end{multicols}
\end{document}

enter image description here Note: 2-column text continues on 3rd page.

Why doesn't the third \filbreak introduce a page break so that the 2-column text is started on a new page? How to change that?

3

\filbreak while defined in LaTeX isn't really implementing a LaTeX concept but provides a simple mechanism (originally defined in plain TeX) for handling "simple" galley material. The stress here is on "simple".

Basically what \filbreak does is adding a vertical fill (stretchable whitespace) following by a penalty saying "this is a good break position" (-200 to be exact) then backing up by a negative stretch.

As a result a normal linebreak (which has a penalty of 0) will be less attractive as filling the page with whitespace. Thus for normal text the output routine will favor the \filbreak positions over other breaks so it wil usually jump from one \filbreak to the next. However, already a section heading may kill this as it will add a penalty of -300 by default, so depending on how close to the bottom that is and how much other wiste space is on the page it may be taken instead of the \filbreak point.

Now with multicol this totally breaks down, because what that environment does is:

  • it measures how much space is left on the page
  • and if there is enough it will save all of the existing page temporarily and then starts collecting material for 2 or more columns.
  • when it has enough material to fill remaining space calculated before (or when it ends before that) it will make columns and then combines the saved material with these columns in a single page and outputs that page.
  • the "strange" sequence of penalty and stretches at the end of that material now play no role as the stretch cancels out and the penalty is not looked at.

You ask above, why doesn't it break before the environment when it isn't able to get all material on this page? The answer is a) it doesn't get any signal to break because of the above change in behavior from simple to complex OR processing and b) because even if it would get such a signal somehow it would need to process the whole environment first (or at least a good amount of it) to find out if that would fit and at the point of decision it simply doesn't have this data.

So bottom line the two approaches simply do not play together and there wouldn't be an easy way to change the multicol processing to start on a new page if there isn't enough space to fit the whole environment in.

  • Do you know another multi-column environment that would do the trick? – Jack Miller Mar 23 '18 at 6:21
  • @JackMiller sorry Jack, no. I would have said so if. In theory it would be possible to extend mulicol to support this but it would require some more major changes for which I don't have the bandwidth at the moment. – Frank Mittelbach Mar 23 '18 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.