Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have reproduced a simple example, which shows my spacing problem. Description: The page is completely filled with text, only 1-2 words go over to the next page, despite it looks as if there was enough room on the previous page left. How can I solve this? I realized one solution is \vspace*{-x pt}, but I don't know if it is ideal. I believe many of you faced this case before. What is the correct way to deal with it?

MWE:

\documentclass[a4paper, 12pt, headsepline]{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage{amsmath, amssymb, mathtools}
\usepackage{mathptmx}
\usepackage[a4paper,showframe]{geometry}
\geometry{left=2cm,right=5cm,top=2cm,bottom=2cm}
% \usepackage{lipsum} %\lipsum
\usepackage[pangram]{blindtext}

\begin{document}
\Blindtext[1][4]%1 paragraph, 3 pangrams
Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem
% \vspace*{-1pt}
\end{document}

If you uncomment the line \vspace*{-1pt}, you will see that it works. But I am not sure if this is harmless or the best way.

Edit: I need to keep the geometry values, so if possible, the solution should remain them as they are.

Thanks.

share|improve this question
    
There isn't enough room for the word to fit. You can make it fit using \enlargethispage{\baselineskip}, which will allow at least one more line on that specific page (somewhat similar to your \vspace internally reducing the amount of content on the page). Possible duplicate: Squeeze some more lines on the current page (or similar Enlarge a single page). –  Werner Jan 9 at 22:25
    
@Werner ok thanks for the links, but could you provide a solution which changes as few as possible? Also any comments on the \vspace* ? –  TomM Jan 9 at 22:27
1  
I've used \enlargethispage{\baselineskip}, but you could also use \enlargethispage{1pt}, which works. The reason for your problem stems from the fact that \textheight (as specified indirectly through the measurements in geometry) is not a factor of \baselineskip. It seems like your just under 1pt short of fitting 41 lines on a page. You could marginally adjust the value of \baselineskip, perhaps. –  Werner Jan 9 at 22:32
    
If you add heightrounded in the options to geometry, the package will make as small as possible a change to the requested text height so as to accommodate an integer number of lines. With your setting you get \textheight=731.23584pt, with heightrounded it will be \textheight=731.77844pt (which nobody would notice). –  egreg Jan 9 at 22:34
1  
Not always sometimes there are hard set limits (eg connected to the physical printing or binding technology, or just stubbornness of the publisher) in which case you just have to squeeze the text in to the specified size, but if you have the freedom then it's probably a good idea (the standard article/report/book calculate the textheight for each of the 10pt 11pt 12pt options based on this formula) –  David Carlisle Jan 9 at 22:41
show 1 more comment

2 Answers 2

up vote 4 down vote accepted

It depends what you want to happen, if you set

Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem Lorem%
\widowpenalty10000

Then there is an infinite penalty associated with just taking one line over, so two lines are taken over (leaving the first page short).

If you want the line to stay on the first page, then the vspace is Ok as a solution, or perhaps better you could use

\enlargethispage{1pt}

Although also you should avoid getting in to this position by making sure that \textheight - \topskip is a multiple of \baselineskip so that on a page with no headings or other display material with stretchy white space the text lines do fit exactly and don't leave a visual gap that looks like an empty line but doesn't quite fit.

If you add

 \showthe\dimexpr\textheight-\topskip-40\baselineskip\relax

you see

> -0.5426pt.
l.14 ...\textheight-\topskip-40\baselineskip\relax

which is why your last line doesn't quite fit.

share|improve this answer
    
Exactly what I would have said. ;) –  Werner Jan 9 at 22:33
    
@Werner sorry about that we were typing the same thing at the same time it seems:-) –  David Carlisle Jan 9 at 22:34
    
No worries. I didn't think about \widowpenalty... –  Werner Jan 9 at 22:35
1  
@Werner meanwhile egreg's been reading the geometry manual:-) –  David Carlisle Jan 9 at 22:36
1  
@TomM you can either just set it that way if setting the height directly, eg article class sets it as \setlength\textheight{\@tempcnta\baselineskip}\addtolength\textheight{\topskip}‌​ so it is always a multiple of baselineskip+\topskip, even though \baselineskip has different values depending on class options, but as you are using geometry to set the dimensions, let it worry about it and use the heightrounded option as egreg mentioned \ –  David Carlisle Jan 9 at 22:47
show 1 more comment

If you add heightrounded in the options to geometry, the package will make as small as possible a change to the requested text height so as to accommodate an integer number of lines.

With your setting you get

\textheight=731.23584pt

while, with heightrounded, you'll get

\textheight=731.77844pt

Nobody will notice the difference of about 0.5pt. The page will be filled up.

enter image description here

share|improve this answer
    
Thanks egreg, very helpful! –  TomM Jan 9 at 22:47
1  
@TomM You could also say \setstretch{1.24} instead of the 1.25 value set by \onehalfspacing. It's a difference of 0.8% in the baselineskip, again not noticeable by the bureaucrats who require enlarged line spacing. –  egreg Jan 9 at 23:13
    
@egreg That depends. I've had people get out rulers and complain that a title on a titlepage was 2mm too high. That's quite a lot for \baselineskip, but I have no doubt they would have complained about .2mm as well. Admittedly that was a graduate school person examining dissertation formatting and they are insane, but still. (Dunno if she used metric to try to make a foreigner feel more comfortable about the experience. Maybe the complaint just would have sounded too ridiculous in inches.) –  cfr Jan 10 at 0:25
    
@cfr Well, 0.19mm is really too small to be seen and measured with a ruler: it's just a tiny bit more than the thickness of a normal (typographic) rule. I know that some of the people in charge of examining dissertation formatting are insane, but I would urgently call the neuropsychiatric department in case 0.19mm would cause troubles. In inches it's 0.0075, by the way, or 7.5th (if this unit is still known). –  egreg Jan 10 at 0:33
    
@egreg I wasn't really serious about the .2mm. I thought the 2mm was sufficiently insane. Thanks for the conversion though I can't think in imperial lengths (except miles, I guess). I have very restricted (and domain specific) familiarity with imperial measurements (and US measures where those differ). –  cfr Jan 10 at 1:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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