the-journey Technical writing history with ed and nroff

Enjoy this practical demonstration of technical writing history on old-style Unix.

I love exploring technical writing history. It's one reason I sometimes write articles about early word processors, printing documentation on the Model 33, and dot matrix printers. And as we look ahead to the National Day of Writing on Friday, October 20, I wanted to share another look at technical writing history on Unix.

Early document preparation

When Unix was new, the standard way to write documents was with a document preparation system called nroff. This stood for "new roff," because it replaced an earlier text processing system called roff, which itself was a simplified version of Jerry Saltzer's RUNOFF program from the Compatible Time-Sharing System (CTSS) on the IBM 7090.

A document preparation system like nroff collects words and fills paragraphs. That means individual words are read from the input and the program makes full-width paragraphs. With nroff, you can use special codes to indicate formatting within the document, such as adding space, changing the margins, and centering text. For example, to add a blank line of extra space, then create a temporary indent of four spaces for the next paragraph, you would enter:

.sp 1
.ti 4

Technical writers used these "dot" commands with nroff to create all kinds of special formatting. The Patents team at Bell Labs used nroff to write patent applications, which required rather strict formatting.

Using macros

You can also combine several formatting instructions together to create a "macro." For example, if we wanted every paragraph to start with a blank line then four spaces, we could create a macro called .pp to do this automatically:

.de pp
.sp 1
.ti 4
..

With that macro, technical writers could simply use the .pp macro to start a new paragraph, like this:

.pp
A text processing system like nroff collects words
and fills paragraphs.
That means that individual words get read from the input
and the program fills out paragraphs.
.pp
And with nroff, you can also use these special codes
to indicate formatting like adding space, changing the
margins, and centering text.

Defining margins

Technical writers could use other nroff instructions to define page margins. For example, a standard US Letter page is eight and a half inches wide and eleven inches tall. Typewriter devices of the era, including many early computer printers, could print 85 characters on a line at 10 characters per inch, and 66 lines on a page using 6 lines per inch.

Assuming the text body should be 65 characters, that leaves 20 characters on a line; this divides neatly to 10 blank columns for the left margin and leaving 10 blank columns for the right margin. A technical writer would define these in nroff by defining the line length to 65 and the page offset to 10:

.ll 65
.po 10

A practical demonstration

I wanted to share a practical demonstration of technical writing history on old-style Unix. This uses ed to edit files and nroff to format documents. ed was the standard text editor at the time; it would be several years before the vi visual editor arrived.