[Tex/LaTex] Is it wrong to use \clearpage instead of \newpage


The commands \newpage and \clearpage both force a page break. In addition, the latter command also "flushes" all pending floats from the stack, i.e., forces them to be typeset starting on the page that follows the page break.

My question is: Is it ever a mistake to use \clearpage rather than \newpage, other than in cases where one might not want any pending floats to be flushed? From a casual inspection of the definitions of the two commands (see below), I can't tell if there's any trouble lurking in always using \clearpage.

For ease of reference, here's the definition of \newpage (from latex.ltx):

\def \newpage {%
    \ifx \@nodocument\relax
      \global \@noskipsecfalse
    \global \@inlabelfalse
  \if@nobreak \@nobreakfalse \everypar{}\fi
  \penalty -\@M}

and here's the definition of \clearpage — note that it invokes \newpage:

    \ifnum \@dbltopnum =\m@ne
      \ifdim \pagetotal <\topskip
  \penalty -\@Mi

Best Answer

Technically there is nothing wrong with using \clearpage instead of \newpage. However, the two commands have different semantics and the question is which of the semantics you are interested in.

First of all, as you already mentioned \clearpage not only ends the page, but additionally it flushes out all floats that have been deferred. On the face of it that might be a good idea but consider the following situation: you have one float waiting which is just 1/3 of the page size. Now with \newpage you start a new page and then the float algorithm (see description of this algorithm for details) would kick in and try to place waiting floats onto the next page (and most likely would assign the waiting float to the top area of the next page. In contrast \clearpage would also output this float but on a page of its own.

So in situations like a chapter start it is advisable to end the previous chapter with a \clearpage (or rather start the new one with it) to flush out all floats, but in other situations this might result fairly empty pages with only floats on them which may or may not be desired.

A second difference is \clearpage actually always starts a new “page”, while \newpage really only ends the current column – and that is a big difference in twocolumn mode. Just try the following to see the difference:

A test
\newpage              % ends first column but not page
A second test

A clearpage test
\clearpage             % ends page (which has one column)
A second clearpage test