4

When LaTeX is unable to fit content onto a page, it sometimes inserts a large amount of whitespace between the two elements that fit on the first page, rather than just leaving space at the bottom of the page.

Minimal example:

  \documentclass[a4paper]{memoir}
  \usepackage{tikz}
  \newcommand{\Rectangle}{%
      \begin{minipage}{\linewidth} \tikz \draw (0,0) rectangle (2,16); \end{minipage}%
  }

  \begin{document}
  \begin{center} Hello \end{center}

  \Rectangle

  \Rectangle
  \end{document}

I would like the spacing to be such that the whitespace is just at the bottom of the first page rather than the large hole in the middle of the text and the rectangle. This can be fixed by either using the article class instead of memoir or getting rid of the \begin{center} and \end{center} but neither compromise is satisfactory for me.

What is the best way to get the whitespace to appear at the bottom of the page?

  • \raggedbottom? – egreg Dec 29 '11 at 0:37
9

The standard setting of memoir is \flushbottom: every page is flush to the bottom, unless a \newpage command appears (which may be implicitly issued by other commands.

So, issuing \raggedbottom for the whole document (or parts thereof) or \newpage for the page under question, will fill the bottom with white space.

  • Thanks. Is there any reason why it does \flushbottom when I have the \begin{center}...\end{center} but not when I just have normal text? – bryn Dec 29 '11 at 2:44
  • 2
    @bryn: The center environment actually adds vertical space above/below it, cause it to be "bigger than expected." See When should we use \begin{center} instead of \centering? – Werner Dec 29 '11 at 2:47
  • I agree with Werner, see if \centering can serve your purpose: {\centering Hello \\ } – ltxsun Dec 29 '11 at 4:34

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.