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 wonder if I get something wrong with TeX’s glue concept. If define a length to be 2pt plus 1pt minus 1pt I expect that the length should be exactly 2pt where possible an if not it should be between 1pt and 3pt. But if I set

\setlength{\parskip}{0.5\baselineskip plus 1pt}

LaTeX stretches the parskip more than 1pt. to reach the flushing bottom. Is it possible to get a flushing bottom in case where the 1pt stretch is enough and a ragged bottom if not. I’d like to have a flushing bottom but I really don’t like parskips with an amount of 1.5\baselinskip or more.

too stretched

I tried to build an example, which is kind of long since I needed to control the paragraph length. I tried lipsum.sty but I didn’t get the desired (bad) result in the example. So excuse the much lines …

\documentclass{scrreprt}

\setlength{\parskip}{0.5\baselineskip plus 1pt}
\flushbottom

\usepackage{lipsum}

\begin{document}
\chapter{Test}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis
egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna
fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien
est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices
bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac,
nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue
eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim
rutrum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.
Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue
eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem.

Nulla et lectus
vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida
placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget
sem vel leo ultrices bibendum.  Donec varius orci eget risus. Duis nibh mi, congue eu,
accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis
egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna
fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien
est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices
bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac,
nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue
eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim
rutrum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

\section{Test}
\lipsum[4-10]
\end{document}
share|improve this question
3  
There's no space on page 1 for the section title and a couple of lines, but the \flushbottom option is in force. The only available stretchable space is the \parskip, so you end up with an underfull page because it has to stretch too much. (Without \parskip the page typesets perfectly, by the way.) –  egreg Jun 12 '12 at 16:04
3  
Note TeX is very unhappy at having to stretch that far: Underfull \vbox (badness 10000) has occurred while \output is active that is infinitely bad. If you have flushbottom you need enough stretch on the page to achieve that. –  David Carlisle Jun 12 '12 at 16:06
    
@egreg: (I didn’t decided to use a parskip but I have to :-() –  Tobi Jun 12 '12 at 16:48
1  
You're very unlucky, then. Without \parskip the section title and four lines of text can be accommodated on the chapter first page, so filling that page is hard: you need at least five more lines to avoid the underfull box message. You may get two more lines by appending \looseness=1 to the paragraphs and say \enlargethispage{-\baselineskip} to gain another one. Maybe this can solve the problem in the "real" case. –  egreg Jun 12 '12 at 16:56

1 Answer 1

As you have flushbottom in effect you need to add enough stretch to pad out the page. TeX reports the page as underfull with a badness of 10000 (which is as bad as it gets)


You could redefine \section like so:

\let\oldsection\section
\def\section{\filbreak\oldsection}

This will have no effect unless a page break happens just before a section (in which case the preceding page is allowed to run short). \filbreak is defines such that if a break doesn't happen it adds positive and negative glue that exactly cancels out. (Actually it could have an effect if a latex display environment ends the previous section, as the additional glue will interfere with \@addvspace thus "hiding" the glue already added)

However in this case it produces the effect that I assume you are wanting:

enter image description here


Another possibility is to allow more stretch after a chapter title.

\renewcommand\chapterheadendvskip
{\vspace{1.725\baselineskip plus 3\baselineskip minus .192\baselineskip }}

Is enough to get rid of the underfull box (but makes a big space)

enter image description here

share|improve this answer
    
Thanks. But there are several pages with only two long paragraphs on it so indeed the only glue is between the paragraphs. My question is, how can I let TeX stretch the glue to the maximum (2pt plus 1pt = 3pt) without making it bigger and accept the undefull (not flushing) page. The problem is that if I use \ragged bottom is tha all pages are ragged even those which could be flushed by using the plus 1pt part. (Hope you understand what I tried to say …) –  Tobi Jun 12 '12 at 16:50
2  
Once TeX has to stretch any glue to more than its stated maximum then the page is infinitely bad and so basically you don't get to choose (and Tex doesn't try to do any optimisation of the possible infinitely bad cases) you could give the raggestbottom finite rather than infinite stretch eg instead of \@textbottom{\vskip \z@ \@plus.0001fil}' do \@textbottom{\vskip 0pt plus 30pt}` –  David Carlisle Jun 12 '12 at 17:03

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.