Martin's answer works well up to a limited size, but TeX has an upper limit on every length, including the page height. This limit is fairly small, equivalent to only around 20 sheets of letter paper placed end to end. To work around this limitation, I scaled everything in the document down by 40 times, then used pdfposter
to scale it back up after compiling the document.
\newcommand{\pagescale}{0.025} % 1/40
% Use these instead of the usual units.
\newlength{\PT}\setlength{\PT}{\pagescale pt}
\newlength{\IN}\setlength{\IN}{\pagescale in}
\newlength{\CM}\setlength{\CM}{\pagescale cm}
\newlength{\MM}\setlength{\MM}{\pagescale mm}
% LaTeX defaults are almost all defined using \p@, which is supposed to be 1pt.
\makeatletter
\setlength{\p@}{1\PT}
\makeatother
% Reset separations that were coded with pt not \p@.
\setlength{\jot}{3\PT} % Math display line separation.
\scriptspace=0.5\PT
\hfuzz=0.1\PT
\vfuzz=0.1\PT
\overfullrule=5\PT
\maxdepth=4\PT
\delimitershortfall=5\PT
\nulldelimiterspace=1.2\PT
\scriptspace=0.5\PT
\parindent=20\PT
\parskip=0\PT plus 1\PT
\abovedisplayskip=12\PT plus 3\PT minus 9\PT
\abovedisplayshortskip=0\PT plus 3\PT
\belowdisplayskip=12\PT plus 3\PT minus 9\PT
\belowdisplayshortskip=7\PT plus 3\PT minus 4\PT
\topskip=10\PT
\splittopskip=10\PT
\parfillskip=0\PT plus 1fil
\normalbaselineskip=12\PT
\normallineskip=1\PT
\normallineskiplimit=0\PT
\smallskipamount=3\PT plus 1\PT minus 1\PT
\medskipamount =6\PT plus 2\PT minus 2\PT
\bigskipamount =12\PT plus 4\PT minus 4\PT
\def\fontsubfuzz{.4\PT}
\unitlength = 1\PT
\fboxsep = 3\PT
\fboxrule = .4\PT
\let\Oldhrule\hrule
\def\hrule{\Oldhrule height 0.4\PT}
\let\Oldvrule\vrule
\def\vrule{\Oldvrule width 0.4\PT}
\documentclass{article}
\renewcommand{\baselinestretch}{\pagescale}
\newcommand{\marginsize}{2\CM}
\usepackage[paperwidth=8.5\IN,paperheight=16383pt,margin=\marginsize]{geometry}
\usepackage[active,tightpage]{preview}
\renewcommand{\PreviewBorder}{\marginsize}
% No point in page numbers if there is only one page.
\pagenumbering{gobble}
% Need to rerun math font definitions to get the sizes right. Loading amsfonts
% is sufficient.
\usepackage{amsfonts}
\usepackage{amsmath,lipsum}
\begin{document}
\begin{preview}
\begin{minipage}[b]{\textwidth}
\LaTeX
$\int_0^1 x^2 dx = \frac13$. \footnote{A footnote}
\hrule height \PT width 100\PT
\begin{align*}
\int_{-\infty}^\infty e^{-x^2} dx &= \sqrt{\pi} \\
z &= w
\end{align*}
\vrule height 100\PT
\lipsum
{\huge \lipsum
}
{\tiny \lipsum
}
% Very long example text, which couldn't fit on a single page at normal scale.
\newcount\foo
\foo=1000
\loop
\lipsum[1]\par
\advance \foo -1
\ifnum \foo>0
\repeat
\end{minipage}
\end{preview}
\end{document}
If you have floats then you likely want to follow Andy's advise and set \setcounter{totalnumber}{100}
, so that LaTeX can put more of them on a page.
The following script uses pdfposter to scale the pdf back to its usual dimensions after it has been built.
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Usage: $0 <scale factor> <input> <output>"
exit 1
fi
scale=$1
newpagesize=$(pdfinfo "$2" | awk '/Page size:/ { print ('"$scale"' * $3) "x" ('"$scale"' * $5) "pt" }')
pdfposter "$2" -s "$scale" -m "$newpagesize" $3