I have a twocolumn document with many sections. I want to allow sections to break across columns of the same page, but not allow sections to break across pages.

The most closely related previously asked question I can find is this. But it won't solve the problem I have.

In the MWE I have a long section that needs to break across a column in order to fit onto a page. The minipage environment doesn't allow this, and starts the long section in a new column but overruns the page. See here for piccy.

I also want to prevent the section title being separated from the section text.



\section{small-length section}

\section{epic-length section}

\section{mid-length section}

\section{big-length section}


1 Answer 1


If the end of the SamePage environment was on a different page, a \newpage will be performed before the start.

There are two problems with this solution. First, it may take more than 2 runs for the document to stabilize. Second, if a subsequent edit frees up enough space for the environment to fit on the previous page, the only way to test it is to delete the aux file (clean project). Alternatively, using draft mode will disable the page test.



\newcommand{\newSamePage}[2]% #1 = index, #2 = page
{\expandafter\gdef\csname SamePage#1\endcsname{#2}}

\ifdim\overfullrule=0pt\relax% check for final mode
    {\ifnum\csname SamePage\theSamePage\endcsname>\c@page\newpage\fi}%


  • If I put the "Third" section before the "Second", the "Third" section should be on the first page, in the second column, because there is room enough. Is this possible? Currently your solution begins a new page unnecessarily.
    – Tim
    Dec 30, 2015 at 11:21
  • That would fall under "subsequent edit" category. Delete the aux file or use \documentclass[draft]{,,,} to re-test if it will fit on an earlier page. Dec 30, 2015 at 14:37
  • of course. my mistake. Yep, it works great.
    – Tim
    Dec 31, 2015 at 9:22

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.