53

During the last phase of layout I frequently get a single line or two on a separate page. Rather then pulling the whole paragraph on that last page I would like to "squeeze" the lines on the previous page a bit.

Is there a way to mark the current page to be squeezed a bit if necessary, but let LaTeX reset this marking automatically after the page is done?

3 Answers 3

52

Use \enlargethispage or \enlargethispage*

According to the documentation,

\enlargethispage{size}

\enlargethispage*{size}

Enlarge the \textheight for the current page by the specified amount; e.g. \enlargethispage{\baselineskip} will allow one additional line.

The starred form tries to squeeze the material together on the page as much as possible. This is normally used together with an explicit \pagebreak.

5
  • 1
    I just wanted to mention "enlarging the page may be dangerous, and is there a way to reduce the baselineskip by 2% on the current page." but googling for your anser revealed: "The starred form tries to squeeze the material together on the page as much as possible. This is normally used together with an explicit \pagebreak." So: Thanks, perfect!
    – towi
    Oct 20, 2011 at 6:47
  • 2
    it's often useful to look back a few pages to see if there is an earlier instance of two lines being broken to a new page, where allowing one more line on the previous page would actually move two lines. it's nice to keep the bottoms of facing pages aligned, so two pages might be adjusted at the same time. and sometimes as little as .25\baselineskip is enough to move a line "up". Oct 20, 2011 at 11:17
  • Thanks @towi, I'm not sure why I didn't include the documentation about the starred version, but this is now an improved answer.
    – bryn
    Oct 20, 2011 at 20:36
  • In such cases I go over the preceding paragraphs to see if there is something that can be said more concisely. Only if that fails would I take such extreme measures.
    – vonbrand
    Feb 24, 2014 at 17:00
  • I encountered an issue with the method of avoiding widows/orphans by using \enlargethispage{\baselineskip} -- I often get the "fatal error" \pdfendlink ended up in different nesting level than \pdfstartlink. Any idea what to do? Mar 4, 2016 at 12:30
10

Well for two lines, you should not change too much, but the one line (also called widow or widowed line) should be avoided (also the single line of a starting paragraph at the end of a page - called orphan). So instead of doing it manually for a single page, which you would have to change if you add a new word or sentence, you could tell TeX to avoid widows and orphans by adding

\clubpenalty = 10000
\widowpenalty = 10000
\displaywidowpenalty = 10000

That would not avoid the two lines on a seperate page, because that is still okay in typographical philosophy, but at least the one line.

4
  • Ok, two lines I will not touch. I heard the terms before, but as "Schusterjunge" and "Hurenkind" (which is not always an orphan, though :cough:).
    – towi
    Oct 20, 2011 at 7:14
  • Yep, i'm also thinking mor of the german terms, and find them easier to remember (okay i'm german, that might be a reason), but i thought for an english comment, i should use the english terms. As you can see in the commands, orphans may also be called clubs, i think.
    – Ronny
    Oct 20, 2011 at 13:45
  • Actually the German terms are quite funny. Just have to be careful not to interpret them as insults. Using them for something "bad" like widowed lines or orphan lines, could imply that there is something bad about a son of a "Schuster" (what does that translate to in English?) or the child of a whore. The funny thing about it is: "Who made up those terms for it?! How did they get that idea even?" Mar 6, 2017 at 10:56
  • 1
    Well, the „Hurenkind“, which is really more like an insult, can be explained, it's a lonely first line on a page. So it does not know where it's coming from. The same holds for that child, which might not know its father. For the „Schusterjunge“ (a single first line at the end of a page) – he does not know where he's going, however, I don't know exactly why that only holds for a Schusterjunge.
    – Ronny
    Mar 11, 2017 at 5:40
3

You can change the margins of the page just for this page:

\usepackage{geometry}
...
... 
...
\newgeometry{top=0.5cm, bottom=0.5cm}
...
... <The enlarged page contents>
...    
\restoregeometry %so it does not affect the rest of the pages.
...
... 
...

For more detailed answer look at this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .