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 am not sure whether invoking \clearpage is necessary or redundant at many places in my input .tex files.

Here I will ask you, in what condition is invoking \clearpage necessary?

I hope I get a list of all possible condition that might be also useful for others.

In my daily work, I do as follows:

  1. If I need a new page for the next stuff, I put \clearpage right before the stuff.
  2. If I need to change the header/footer style for the next stuff, I put \clearpage followed by \pagestyle right before the stuff.
  3. If I get a "too many floots" error, I put \clearpage at the end of every 5 consecutive floats.
share|improve this question
    
I'm not really sure I understand the question. You should use \clearpage and \newpage whenever you want a new page. When do you think you're using it inappropriately? –  Will Robertson Jan 18 '11 at 6:39
    
@Will: thanks for commenting. Please see my update. @Yiannis: It is worth seeing my update too. –  xport Jan 18 '11 at 6:55
1  
for item 3) if you get this error often it is advisable to use the "morefloats" package, for an explanation see tex.stackexchange.com/questions/8212/… . Classes such as the tufte-book incorporate this package in the class definitions. –  Yiannis Lazarides Jan 18 '11 at 7:14
1  
again for 3: you might be underspecifying where your floats can appear. You should always write your document with either [tbp] or [htbp] to give the floats some room and only start constraining them when the document is finished. Or you might just be using too many floats :) –  Will Robertson Jan 18 '11 at 7:26
add comment

3 Answers

up vote 13 down vote accepted

In general, you do not need any \clearpage because page breaking should be done automatically by the TeX engine. However, in some cases, eg having lots of images or equations, one has to insert a manually pagebreak.

  • \newpage ends the page immediately at the current position and starts a new page without any stretching of the page
  • \pagebreak[value] ends the page after the current line and stretches the vertical page to end up on the lower page border, if there is any material with glue
  • \clearpage outputs all active floats and ends the page like \newpage
  • \cleardoublepage same for double sided documents

With the package nextpage one can also use the macros \cleartoevenpage and \cleartooddpage

share|improve this answer
add comment

The use of \clearpage in an author's document should be limited to only a few instances. The command should be used in class files normally in places such as the definitions for chapter, title,appendix, bibliography, toc and the like.

With a well written class the author should never really need to insert a \clearpage command. However, there maybe instances (especially when someone has too many floats) that one needs to enforce a pagebreak and the printing of floats. In this case the \clearpage command is recommended.

share|improve this answer
    
@Yiannis: Your answer is NOT clear when I (as an document author) should use \clearpage in the input file. –  xport Jan 18 '11 at 4:30
    
@xport Never really! But I will modify the answer:) –  Yiannis Lazarides Jan 18 '11 at 4:34
1  
@xport Do you want the author to do this? Shouldn't the author for example just type \mainmatter? –  Yiannis Lazarides Jan 18 '11 at 4:53
1  
@xport If you do this often enough, then it is best to define a 'landscapepage` or landscapetable command and place it in the class file or a package. In general the author should be typing contents and not worry about the looks of the page; that belongs to the class author. –  Yiannis Lazarides Jan 18 '11 at 5:06
1  
@xport Just thinking aloud I would give this type of table a more semantic name such as readonceeverytenyearstable as landscape tables are really unreadable and very few people would bother reading them :) –  Yiannis Lazarides Jan 18 '11 at 5:10
show 2 more comments

I think others have given good answers, but if you find yourself needing to use \clearpage to flush out floats, then it's usually better to use the afterpage package to clear the floats at the end of the page.

\afterpage{\clearpage}

That way you don't just end the page right there; you end the page at the normal break point.

share|improve this answer
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.