TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to emulate HTML's infinite page height using LaTeX/XeTeX, i.e. have the PDF pages grow higher until a manual \newpage is issued.

This could be emulated by setting a very large page height and using pdfcrop on the output (or just setting the page height manually), but I'd like a pure TeX variant and if possible support for footnotes etc at the bottom of the cropped page.

share|improve this question
up vote 19 down vote accepted

You could use the preview package for this. It's basically the "pure (La)TeX variant of pdfcrop" you are looking for. You need to set the text height to \maxdimen e.g. using geometry and wrap every page in \begin{preview} ... \end{preview}. To do this simply have a \begin{preview} after \begin{document}, a \end{preview} before \end{document} and define a \newpage variant as \end{preview}\begin{preview}. You will loose some of the border which can be readded using the \PreviewBorder macro. However, AFAIK this doesn't support header and footer.

Here now some example code. Apparently preview already takes care to suppress automatic page breaks and the modification of the text height is not required.





share|improve this answer
Enclosing the content in a minipage takes care of the footnotes (or would that be more restrictive than necessary?) – pascal May 27 '11 at 21:43
@pascal: If you need footnotes you can add minipages. However they number footnotes differently. Floats won't work either. – Martin Scharrer May 27 '11 at 22:25

Another ConTeXt solution. This takes care of footnotes, but you need to mark the start and stop of the page.


\setupTEXpage[width=\textwidth, offset=2mm]

which can then be used as

\section {Some section}
\input knuth \footnote{A random footnote}
\input ward
share|improve this answer
Wow. I really have to look into ConTeXt... – pascal May 27 '11 at 21:46
IMO nicer then the solution I've posted (from 10 years ago) – topskip May 28 '11 at 5:39

Thanks for the replies, I'm using Martin's solution, from my class file:





This works for me, if I would want to print the document, I can just disable the block.

share|improve this answer

Your Answer


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.