30

Many PDFs are never printed but are read in electronic form, where, for at least some readers and reading styles, it would be advantageous to have a single page through which the reader could continuously scroll.

Is there a way to adjust "paper" size so that the entire document fits on a single "page"? Are there aspects of the TeX architecture that would make this difficult; features of packages or popular document styles that would break?

In particular, I'd be interested in doing this for Tufte-LaTeX, which (with it's sidenotes in place of footnotes and citations) is well-suited for this scenario.

3

4 Answers 4

22

There was a solution given by Veytsman and Ware in Tugboat 32 (2011) 261 in an article titled "Ebooks and paper sizes: Output routines made easier" to be found at https://tug.org/TUGboat/tb32-3/tb102veytsman-ebooks.pdf

Their idea is not to make one big page for the whole document, but one page for each section, and they found a trick to set the page size dynamically to the actual size of the text without white space.

I worked out a preliminary version of a package using their idea. At

you can find the package, a test file and an example of the resulting pdf file. You could try modifying it to give one page for the whole of a document.

The result is subject to the maximum dimension of \maxdimen of TeX.

5
  • Thanks. I'll have a look at that. The real real question for me though will me: does it work with Tufte-LaTeX.
    – orome
    Mar 27, 2012 at 22:02
  • No joy with Tufte-LaTeX, unfortunately. But this seems to be the state of the art, so I'll take this as the answer.
    – orome
    Mar 30, 2012 at 15:18
  • @JohnCollins: Nice package! Are you planning to publish this properly, e.g. on CTAN? Mar 18, 2015 at 14:30
  • This is working well for me for text and tables. But sometimes I have just a bunch of figures, and page size is not properly extended. For smaller pages its fine. But it seems as soon as the size would exceed a regular page height, the floats move to different pages or are not shown at all. Anyone have experienced the same and/or found a solution? Oct 21, 2020 at 20:51
  • I actually found a simple solution: Just use a custom environment instead of figure. And with the caption package you can even make it work with captions that are compatible with regular figures: \usepackage{caption} \newenvironment{nofloatfigure}{\captionsetup{type=figure}}{} Oct 21, 2020 at 21:01
10
\documentclass{article}
\setlength\textheight{30\textheight}

produces

! Dimension too large.
<recently read> \textheight 

so simply making a very tall page causes problems for even quite modest documents.

TeX's architecture generally tries to clear out pages as quickly as possible, unlike line breaking which does a least cost analysis of the breaking over a whole paragraph, page breaking (usually) only considers one potential break at a time, and the memory taken up by the scroll for the page shipped out is recycled. This enabled TeX to process arbitrarily long documents even in the small memory available at the time.

Now of course, there is more memory available but it's not clear to see how TeX could adapt. Probably the thing to do would be to have a simplified output routine that continuously shipped out pages without adding header or footer at all; and then a simple post process with a pdf tool could stitch the pages back together.

2
  • Header and footer would be fairly easy as would the stitching. What settings are equivalent to telling TeX: "take the first possible page break that you can"? Mar 27, 2012 at 18:54
  • just a default output routine, with no floats/footnotes does essentially that. (Assuming you don't mean what you said, or it would break after every line and leave every page underfull, so you want some of the usual aspects of breaking within badness tolerances) but you'd also want to do some trick code so that the white space that is normally discarded when a break occurs is never discarded (usual dance with penalties and rules, probably, ie make sure TeX never breaks before vertical glue. Mar 27, 2012 at 19:03
1

I believe that modyfing some properties of your document will get you very close to what you want, even without the need of one long page. It will happen that there will be an empty vertical space, but not that often with these settings. See the commented MWE:

\documentclass[a4paper]{article}

\usepackage[margin=1mm]{geometry} % no margins
\usepackage[bottomtitles]{titlesec} % allow titles to be at the bottom of the page
\widowpenalty=0\relax % no empty lines at the end of page
\clubpenalty=0\relax % no empty lines at the end of page
\pagestyle{empty} % no headers or footers

\usepackage{lipsum}
\begin{document}
\lipsum[1-60]
\end{document}
0

You can try the following 5 metre page and see the problems. Your users will have no idea or orientation as to where the document will end, can you scroll at the end?

\vsize500cm
\vbox to 575cm{
\vrule height500cm
}
\bye

(Most readers will fail to display this properly)

2
  • I'm not sure I understand: I want it to end where the text ends.
    – orome
    Mar 27, 2012 at 19:25
  • @raxacoricofallapatorius Sorry maybe I misunderstood you. Approach in plain TeX, declare a large value of \vsize500cm. Provided you text is less than 5meters long it would compile. Mar 27, 2012 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .