LockerGnomeTech news and nostalgia for today's technology professionals
Subscribe

Search

Softwaregrofflinuxwriting

A 120-Page Novella Takes 1.6 Seconds to Typeset With Linux’s Manual-Page Tool

Movq stripped fiction layout down to three formatting commands, then exposed the page-break problems and language choices hiding behind that small setup.

Drypoint of Chris Pirillo: he pulls a long ribbon of neatly typeset pages
Illustration: LockerGnome

The program that lays out Linux manual pages can also make a novella look like a book. Apparently it was waiting for someone to give it a less argumentative plot.

Movq had finished two works: roughly 15,000 words across 50 A5 pages, then about 40,000 words across 120. The first took more than seven months to write; the longer one took ten days. In the first-person walkthrough, the writer describes getting hooked on fiction after years of finding nontechnical reading tedious, then deciding to try making some.

Both manuscripts went through groff. The attraction was small software that could produce good typography quickly: the shorter document rendered in about 700 milliseconds, the longer in 1.6 seconds, including preprocessing. These are the author’s timings for particular documents on one old PC. The stopwatch hasn’t established anything about how your illustrated technical manual would behave.

The GNU manual describes a typesetting system that accepts plain text mixed with formatting commands and outputs PDF, PostScript, HTML or terminal text. Groff reimplements and extends the troff tools from AT&T Unix. Its association with manual pages can make the terminal output seem like the entire product, rather like judging a printer by its test page.

Movq’s custom macro package needs three basic commands for the manuscript. One formats a chapter heading, another begins an indented paragraph, and the third inserts a longer gap for a break within a chapter. The book has no diagrams, cross-references or lists demanding their own layout machinery. The author says, “Because it’s more fun that way,” about making the package personally.

Page numbers expose the fiddly part. Movq plants a trap near the bottom of each page: reaching that position invokes a footer macro. The footer uses a separate environment so printing a page number won’t disturb the body line the formatter is still collecting. Returning to the body with the wrong kind of spacing command can break that unfinished line. The post shows the broken output as well as the adjustment.

Language introduces another decision. Groff can add extra space after a sentence; the author disables that spacing for the German manuscript and selects German hyphenation rules. This little setup still has to know which conventions the reader expects. A short configuration file doesn’t exempt anyone from typography.

The initial stories were written directly in groff. Afterward, movq converted the second manuscript into a restricted Markdown form with chapter headings, blank-line paragraphs and emphasis. A small Perl conversion turns those conventions back into macro calls and font instructions. The author wanted more pleasant source text without giving up groff’s justification.

A text-to-PDF workflow could make long-lived personal writing easier to keep independent of a particular editing app. The cost shifts toward maintaining the formatting recipe, including its unresolved details. Movq still lists questions about page size, footer positioning and header symmetry, and calls the demo a snapshot that won’t be updated. Someone building on it gets those open questions along with the 1.6-second render.

More Software

Every Software story →