A whole novel in English

A public-domain English novel read into its twelve chapters and laid out across fifty-nine numbered pages, each chapter opening a page of its own and the engine choosing every line 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 the plain text file holds it, and writes the whole of it as a single PDF: a title page, then its twelve chapters over fifty-nine numbered pages. The one thing the program is told is how that file marks a chapter — here, a line that reads CHAPTER I — and everything else follows from it: each chapter opens a page of its own under its number and its name, and every page after that carries the author's name on the left-hand pages and the book's on the right-hand ones.

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.
  • Chapters found in the text itself, each opening a page of its own.
  • Line breaking, justification and page breaking left to the engine.

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 in English

What this document weighs

This document weighs 208,239 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