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 writing a book and have already made contract for x pages with the printing company, so I want to create a PDF containing x pages. However, say that I only have material enough to fill x − y pages. Is there some package or simple hack available for adding y empty pages at the end of the document? I.e. I want to add empty pages until the latest added page is page number x.

share|improve this question
    
You could add clearpage\null the appropriate number of times. (And add \pagestyle{empty} after the first \clearpage\null.) –  lockstep Aug 6 '11 at 9:34

2 Answers 2

up vote 7 down vote accepted

You can do this using a simple loop.

The following code will ensure the document to be e.g. 100 pages in size:

\documentclass{article}

\usepackage{lipsum}

\newcommand\emptypages[1]{%
    \loop\ifnum\value{page}<#1\relax
        \clearpage
        \null
        \thispagestyle{empty}%
    \repeat
    \clearpage
}
\AtEndDocument{\emptypages{100}}

\begin{document}

\lipsum[1-20]

\end{document}
share|improve this answer

The memoir package provides the \leavespergathering{} command for a purpose closely related to yours. Ipsis literis from the manual:

The command \leavespergathering{num} ensures that there will be exactly the right number of pages output to make a complete set of gatherings of num leaves (2× num pages) each --- if necessary blank pages will be output at the end to make up the correct tally. If num is less than two (the default) then no additional pages will be output.

Thus, to fill to 84 pages, for example, you would use \leavespergathering{42}

share|improve this answer

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.