A whole novel, laid out

A public-domain English novel handed over as one stretch of paragraphs and laid out across fifty-two numbered pages, with the engine choosing every line break and every page break.

Most examples on this site are one page long, which says nothing about what happens when a document is long. This one takes the text of Lewis Carroll's Alice's Adventures in Wonderland, published in 1865, exactly as it stands — one long run of paragraphs, with no formatting and no chapter structure handed in — and writes the whole of it as a single PDF of fifty-two numbered pages.

Nothing in the program counts pages or measures a line. It keeps a running position down the page, asks how much of the current paragraph fits under it, draws that much, and opens a new page when nothing more will go. Everything else — where each line ends, where each page ends, how a justified line is spaced — is the engine's decision. The novel is in the public domain: its copyright has expired and it carries no condition on its use.

What this example shows

  • A book-length text handed over whole, with no layout instructions at all.
  • Line breaking, justification and page breaking left to the engine.
  • A title page, then a page number at the foot of every page after.

The code, in full

The same document is written twice, once in each language. Both files are shown in full, with the code coloured on the server, and can be copied in one click.

The document itself

The document this example writes, ready to open.

Open the document in English

Read the Rust source Read the Python source

First page of A whole novel, laid out

What this document weighs

This document weighs 202,447 bytes.

The team wrote this book after measuring the documents above, so there is no earlier figure to set beside it. See every document measured.

Examples near this one

Soft hyphens and no-break spaces

A justified column set twice: the long words breaking at their soft hyphens with a hyphen shown, or left whole, and a figure a no-break space keeps together.

Break points after a slash or a hyphen

A justified column set twice: file paths and compounds running past the edge with no break points, then wrapping where a break after a slash or a hyphen is allowed.

Text poured into columns

One long passage poured into three columns, each fitting the lines its height allows and handing the rest to the next.

Every example, by subject