4

I'm writing a lengthy document which will have prompts typically between 2 and 5 lines long with a space after each prompt for notes. Ideally I want a 2-inch space with a stretch of 1 in and a shrink of 0.2 in. The 'internal' prompts are easily handled with \vspace{2in plus 1in minus 0.2in}.

The problem is at the bottom of the page, since TeX absorbs glue at the bottom of pages. I've tried variations of \vspace, \filbreak, and \def\filbreak{\par\vfil\penalty-200\vfilneg}, adjusting both the \vfil and \vfilneg. No success. Either the bottom prompt's space is the normal 2 in and the rest are spaced evenly using the remaining space or the bottom space is whatever's left on the page after the others are set to 2 in.

Is there any way to (automatically) evenly distribute the spaces?

\documentclass{article}
\usepackage[showframe,margin=1in]{geometry}

%\def\spacer{
%    \par\vspace*{1.7in plus 0.5in minus 0.3in} \penalty-200 % 
%    \vfilneg}
\def\comment{The page total is \the\pagetotal. \spacer}
\def\spacer{\par\vspace{2.4in plus 1in minus 0.2in} \penalty-200}
\raggedbottom

\begin{document} 

\comment

\comment

\comment

\comment

...

\comment

\end{document}
3
  • If you make the glue more stretchy it should more closely balance the glue added at the bottom of the page. Try \vspace{2.4in plus 1fill minus 0.2in} in your macro. Does that give you what you want?
    – Thruston
    Aug 24, 2013 at 22:20
  • 1
    \par\nopagebreak\vspace{2in plus 1in minus 0.2in}?
    – egreg
    Aug 24, 2013 at 23:15
  • 1
    @Thruston: That totally did it. I had previously tried \vspace{2in plus 1fil minus 0.2in}. I guess I just needed more infinity. @egreg: Yours still leaves larger gaps at the bottom of the pages.
    – Dale
    Aug 25, 2013 at 1:13

1 Answer 1

3

Try making the glue more infinitely stretchy so that it balances the glue added by the page eject (which is essentially equal to \vfill\eject).

\documentclass{article}
\usepackage[showframe,margin=1in]{geometry}

%\def\spacer{
%    \par\vspace*{1.7in plus 0.5in minus 0.3in} \penalty-200 % 
%    \vfilneg}
\def\comment{The page total is \the\pagetotal. \spacer}
\def\spacer{\par\vspace{2.4in plus 1fill minus 0.2in} \penalty-200}
\raggedbottom

\begin{document} 

\comment

\comment

\comment

\comment

...

\comment

\end{document}

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.