21

At least through the early 1980s, the source code in non typewritten computer manuals and books was usually typeset using proportional fonts, sometimes with syntax highlighting such as keywords in bold. When did these works start switching to unhighlighted monospace fonts for code? Was this shift driven by any particular technologies, production processes, or requirements?

I wonder whether the spread of formatting software like troff and TeX since the early 1980s, which provide good support for rendering code as monospace, may have driven or helped the shift.

I know many manuals and books published prior to the 1980s contained monospace source code, for example because they were produced with technologies that can output only monospace text. I'm specifically asking about other manuals and books, the ones for which there was at least a technical choice of fonts.

20
  • 9
    TeX doesn’t render code as monospace by default; on the contrary, as I recall Knuth’s own “paper” rendering of the literate-programming TeX program puts it in a proportional font. Commented Jan 4 at 16:25
  • 12
    The 1977 IBM Fortran IV manual uses monospaced fonts for code. See bitsavers.org/pdf/ibm/series1/…
    – Jon Custer
    Commented Jan 4 at 19:57
  • 23
    Probably since day 1, as teletypes and such did not have variable spaced fonts.
    – Erik Eidt
    Commented Jan 4 at 21:00
  • 7
    I heavily concur. Program code in manuals used what was available for printing, and that was monospace. And monospace was used not only for the program code, but for all other text as well. More elaborately typeset documentation that offered the choice of multiple fonts did only come up in the late 1970s/early 1980 (the bigger the vendor was, the earlier). Digital Research, for example, produced monospaced manuals for a long time.
    – tofro
    Commented Jan 4 at 22:21
  • 9
    @tofro - 'what was available for printing was monospace' rather assumes that the typesetting of manuals was to be done on computers, but why should that be the case? Typesetting as a craft existed before computers, no reason to forget how to do it.
    – dave
    Commented Jan 5 at 3:10

10 Answers 10

25

Could you provide any base for the assumption that using proportional fonts was the most common way before 1980? My experience tells different.

Random example with text in proportional and code in fixed-width:

Now, what's true in my memory, and supported by peeking into some books, is that: books tend to use only a single type, fixed or proportional, throughout the whole publication. It's safe to assume that this reduced effort in typesetting.

Then again, even back then full listings were usually printed using fixed fonts. IBM's 1965 Fortran Specifications and Operating Procedures for the 1401 is a nice example. All examples / statements embedded in sections are using a proportional font, while (full) listings are made using fixed fonts - after all, that's the way to give an impression as close as possible what a programmer will see on punch card, print out or screen.

Very early documentation even offers another sub-type, where basic text including statements is printed depending on the default style, but all explicit code examples are made to look like programming forms with their fixed width structure. For example, this is seen in the 1960 IBM 1401 Symbolic Programming System Specifications.

Oh, and the 1967 /360 F-Assembler Programmers Guide even toppled all of this by using a fixed font throughout all text, but proportional when it comes to examples(*1).

I purposely picked very early books to show the origins. It continues the same way through the following decades. Likewise I showed IBM manuals only because there's a lot available online. Other manufacturers show the very same classes.

But similar style can be seen when looking at early computer magazines - although the very early ones don't have a lot of listings. One might guess that readers had to get computers before being able to send in programs. Though 'how to write' sections show that formatting was a professional job, not the authors' decision.


Regarding 'Typewriter' usage it should be noted that proportional spaced typewriters existed since the 1880 Hammond. That marvel not only supported proportional or fixed on the same device, but Italics and Bold as well. Those machines (and similar designs) were quite common with professional publishers. Its follow up models were produced until the late 1960s. Of newer origin would be the 1966 IBM Selectric Composer and 1972 MC Executive.


Manassehkatz' observation that use of multiple fonts/spacing became more common with the availability of typesetting systems does add meaning - except computer typesetting is a process that only started with minis and micros in the mid to late 1970s, but already in the early 1960s with mainframe-based typesetting systems (*2).


*1 - The /360 era also marks a point when IBM mostly switched to fixed font only for manual text. This changed again in the late 1980s.

*2 - Almost forgotten today, but those systems were such a big business that even special terminals were developed and manufactured by companies like IBM or Siemens. Newspapers foremost, but book typesetting as well. I still remember the programming for the 8162 type which had to be handled on interface level as three screens due it offering 72 lines of text :)

24
  • 1
    but already in the early 1960s with mainframe based typesetting systems I'm well aware of that. But I think your typical small publisher - and except for IBM, DEC, etc. most software publishers were small in the 1970s and early 1980s - couldn't afford to make use of a mainframe typesetting system. Commented Jan 5 at 0:17
  • 4
    The code in that DEC TSS/8 manual looks like it was cut and pasted (you know, with actual scissors and glue) into the camera-ready copy, from teletype output.
    – dave
    Commented Jan 5 at 3:22
  • 3
    The PET Computer User Manual that you linked uses a proportional font for its examples. Look at the word PRINT in any example that contains it and it is clear that it is using a proportional font. It's PRINT not PRINT
    – JeremyP
    Commented Jan 5 at 11:34
  • 1
    @PaoloAmoroso Not sure what you mean by typewritten, but the manuals selected were neither produced on typewriters (or printers), nor duplicated by photographic matters (that's why I selected early ones where that technology was still unavailable/too expensive). Those manuals have been typeseted the classic way using linotype style machinery. Also, excluding a common style of book typesetting style isn't exactly supporting the question.
    – Raffzahn
    Commented Jan 5 at 11:36
  • 1
    @manassehkatz-Moving2Codidact Typesetting wasn't an inhouse issue back then especially not "your typical small publisher" . That's a rather recent development made possible by closed digital production cycles. Publisher delivered their material as typed pages with instructions to the print house which turned those pages into the book layout according to mandatory instruction sheets. It was those print houses that could afford typesetting the linotype way who also switched first to computer based using mainframes. As usual a business detail most people never see.
    – Raffzahn
    Commented Jan 5 at 11:37
21

Eating your own dog food

Computer manuals for "real" publication, as opposed to just internal use within a company, were typeset using traditional methods. When you are typesetting manually, or minimally computer assisted, switching between different fonts, including (perhaps even more so) switching between proportional and mono-spaced fonts, is extra work. It was only in the 1970s that minicomputer-based typesetting became available, and it really took the microcomputer to put this in the hands of small companies. On top of that, the output was a problem. Even if you could see the different fonts on the screen (nominally, not actually true Wysiwyg for most people until the mid-1980s at the earliest), unless you had expensive typesetting equipment your options were extremely limited (dot-matrix - poor quality, daisywheel - good quality but only one font at a time) until the laser printer.

All of that put together meant that your practical, affordable options until ~ 1984 were:

  • Dot-matrix printout - generally monospace (and visible dots) for text and code.
  • Daisy-wheel printout - generally proportional for text and code.
  • Professional typesetting - generally proportional, but mono-space available for code if you were willing to pay for it, for text and code.

1984 changed everything. The Mac was the consumer-level/small-business start of desktop publishing with Wysiwyg. And yes, other programs came along on the PC side too. Plus the laser printer - HP LaserJet in 1984, Apple LaserWriter in 1985 - made it possible to use an affordable computer to produce camera-ready output under full and easy control of the author. It was no longer:

  • Type up a document and send it (whether paper or floppy disk or via modem) to a publisher
  • Publisher typesets and returns proofs to the author (paper)

but instead the author could produce an entire manual, ready to reproduce, in house, with professional quality type (300 dpi). Once you have that, including mono-space code makes a lot of sense as it matches the way most coding is done on-screen.

11
  • 2
    Who is the dog food producer and what is the dog food? Commented Jan 4 at 23:38
  • 5
    Computer software companies using the systems they write software for and or sell to write the documentation for those systems. Commented Jan 5 at 0:02
  • 2
    So it’s “dogfooding” for a software company to use the same PCs they did not manufacture as the target platform for their software and as the workstations on which they write documentation? Seems like a stretch. Commented Jan 5 at 9:48
  • 5
    Small nitpick: In the typesetting world, 300dpi was not professional quality. 9-pin and 24-pin dot matrix printers could produce "Near Letter Quality," daisy wheel & 300dpi laser printers were considered "Letter Quality," but the optical & film systems that were used in professional typesetting were (if memory serves) akin to 1200+ dpi. Source: I was a typesetter for a small-town print shop in the late '80s-early '90's.
    – zmerch
    Commented Jan 5 at 20:12
  • 2
    @manassehkatz-Moving2Codidact Sounds like you worked that at a time when users already tried to do parts of the typesetting job on their own. Printing workflow before that, did not have the author do any of that. There were no 'sophisticated equipment' at the author side, no matter what tools typesetter and printer used. One delivered everything single sided, 2 line spacing. Any special formatting -including insertion of pictures or graphs - was written in text and marked with some (company specific) signature. All of that described every time again in the preceding Satzanweisung.
    – Raffzahn
    Commented Jan 5 at 21:10
13

In the 1980s, many magazines incorporated source code in the form of photo-reproduced computer printouts, which were naturally monospaced. In situations that didn't use actual computer printouts, for computer source-code programs in many languages, proportionally spaced text is preferable to monospaced text except when certain issues arise, but use of a monospaced font avoids such issues. For example, if one has a multi-line comment in a programming language that uses fixed line breaks, and has no way of knowing what font the program will be rendered in, there may be no practical way to edit the text to yield a reasonable-looking right margin for all fonts the viewer might use. This may be a problem for some ways of presenting the text, but would not be a problem in something like a book whose choice of font is set in stone (or, more likely, lead or aluminum) when the book is published.

Another consideration may be that many font libraries for conventional type setting haven't included complete monospaced fonts (as opposed to sets of monospaced numerical digits) because laying out text in a monospaced font required more work than laying out proportionally-spaced text and offered no real benefit. Note that even typewriter-like text was often set using a font like Rockwell, which is a proportionally-spaced font which is stylistically similar to Courier, rather than an actual monospaced font. As sans-serif fonts have become more popular in text editors, they've also taken over when representing literal source text, but the less distinctive letter shapes make it desirable to use letter spacing as well as letter shape to distinguish such text from the surrounding content.

3
  • 1
    In 1983 I was typing in ZX81 code from magazines. Some even reproduced the tractor holes. Commented Jan 4 at 22:58
  • 2
    I'm pretty sure I had magazines whose code was printed on ZX Printer, with its appalling horizontal alignment. Commented Jan 6 at 8:58
  • 1
    @TobySpeight I think I saw that in Personal Computer World in 1983. Does this look like it? Page 228 of the scanned magazine worldradiohistory.com/UK/Personal-Computer-World/80s/… Commented Jan 6 at 16:04
8

In code, unlike natural printed text, spacing is sometimes important.

In proportional fonts, the width of a space is not the same as the width of all characters. (It may be different than the width of any character in that font.) This is the definition of proportional viz. fonts.

Also, a block of text may be justified by changing the width of spaces (sometimes both inter-word and inter-character) in a proportional font.

In some languages, variable spacing is problematic.

Specifically, FORTRAN, which was in common use when this change became common, was very particular about spacing. It could get extremely difficult or impossible to fix one's own code in a proportional font.

Even in languages where whitespace is insignificant, there are programming styles where spacing is significant. Consider this:

TOP_CENTER_LENGTH = 53
DURATION          = 6
INTERVAL          = 3000

in comparison to this:

TOP_CENTER_LENGTH = 53
DURATION = 6
INTERVAL = 3000

which are different in terms of readability.

Edit: whether required or not, in many older languages (like perl and C) and most newer languages, spacing denoted structure. Compare the readability of:

void run_me(int x, int y) {
    for (int i = 0; i < y; i++) {
        x += y;
        if (i * y < x) {
            x++;
        }
    }
}

versus the wholly illegible yet functionally equivalent:

void run_me(int x,int y){ for(int i=0;
i< y; i++){x +=y; if(i*y<x){
x++;}}}

If you wanted anyone to ever look at your code, your code would have to look like the first block or you'd need to find someone who was very motivated to read it.

Historical significance

It should also be noted that before we had this nifty thing where we could all communicate magically over radio waves and light beams in glass tubes, code was often distributed in print and even magazines. It would have been very difficult or impossible to key in a FORTRAN program in a proportional font. This was more common at some point than it would be considered by most, now.

But... when?

This was before my time so I don't have specific memory of it, but Wikipedia has a good article on type-in code. There's information in there about the history of it.

4
  • As an ancient Fortran programmer I fully concur. In Fortran spacing is part of the syntax of the language, and trying to copy and align code with columns on a punch card needed code source material to be printed in a monospace font. An additional aspect you may wish to include: in both old and new programming languages, indenting code from the start of a line using spaces and/or tab characters is used to indicate code structure, so that when reading you can skip blocks of code that are related but not what you are looking for with ease. This remains hugely important to this day.
    – traktor
    Commented Jan 6 at 6:42
  • However, Fortran 66 or 77 standard documents do not use a typical typewriter font. Maybe it is monispace, but it is a cut very similar to the rest of the text, just in capitals. Commented Jan 7 at 8:13
  • @traktor, yes, thanks, edited. We hope people indent and sometimes they don't and we cry. :-) Commented Jan 12 at 15:48
  • Code indentation with a proportional font still works as long as the 'space' character has a single fixed size. Which isn't necessarily true for cold-metal typefaces, but could be enforced for hand-typeset code.
    – dave
    Commented Jan 13 at 14:42
7

The IBM 709/7090 FORTRAN Reference Manual (copyright 1958, 1959, 1961) uses the same font for code as text, except that the code is in all capitals. A serif font is most of the text, a sans-serif font is used for section and sidebar markings. Text is not justified. One example looks like:

1971 manual

By the 1966 IBM System/360 Fortran manual the font is still mono-spaced, but text is justified. The font is a serif font. It now looks like:

1966 manual

The 1977 IBM Series/1 Fortran manual is back to having unjustified text, but has gone to fancier use of fonts, including bolding and italics. All are serif fonts. But, actual code is in a different font from the text:

1977 manual

So, in all cases the code is a monospaced font. The text is as well mind you, and the various versions have adopted a variety of formatting choices. I find it interesting that the plainest formatting is the 1966 version, the one in the middle.

3
  • 3
    “the font is still mono-spaced” – but the example before is not. Editing error? Commented Jan 6 at 17:24
  • 1
    709/7090 FORTRAN is not monospaced. Commented Jan 7 at 3:26
  • The manuals are a somewhat specific thing produced by the companies on some budget. But look also at national and international standards for Fortran 66 or 77 or some books published by real book publishers. Most examples shown there is a single line so the necessity to align lines 1-7 does not arise that much. Maybe the font is after all monospace, but the cut is very similar to the rest of the text. Commented Jan 7 at 8:11
5

To answer the 'why' part of the question:

There are two reasons to use monospaced fonts for code.

  1. It is good practice to visually distinguish various types of information in a manual. Notes and warnings get an icon, a procedure with steps uses numbering for each step etc. You want to distinguish code from the rest of the text as well: this is information that has to be typed into the computer, unlike the rest of the manual. There are several ways to do this, using a monospaced font emerged as the standard method. And it's a logical standard, as it emulates what the code looks like as you enter it.
  2. in code, it is essential to use the correct symbol. Sans-serif fonts have two major problems in this regard: lowercase L and uppercase i are too similar, and 0, o and O are too similar. Monospaced fonts are generally designed to solve this, e.g. by using serifs and by adding a slash through the zero.
7
  • 'Slash through zero' is a local convention, or at least used to be, before US terminology and conventions conquered the world. In ICL publications, and on the coding forms I wrote up for keypunch operators, zero was unslashed, and 'oh' had a horizontal bar, like a capital theta (the presumption being that zero was more frequent than oh). The lineprinter output I have shows neither as slashed.
    – dave
    Commented Jan 5 at 14:21
  • 1
    Point #2 seems to conflate serif/sans-serif and proportional/monospaced. A proportional serif'd font can solve the eye-versus-ell problem. See good old Times Roman. Apart from that, I think you missed what I consider the most important reason for using monospaced fonts in manuals -- you're using one of 'those' languages where it matters what column things go in.
    – dave
    Commented Jan 5 at 16:12
  • Generally, serif fonts solve the L/i problem but not 0/o/O.
    – Hobbes
    Commented Jan 5 at 16:56
  • 1
    @Hobbes: If comments will contain tables, or even paragraph-formatted text with hard line breaks, proportional fonts are likely to cause problems.
    – supercat
    Commented Jan 5 at 19:29
  • 1
    Monospaced fonts don't solve the 0/o/O problem just by the simple virtue of fixed spacing. I have lineprinter output to confirm that. It is glyph design (whether by putting a slash on zero, or by making "O" squarer than "0") that solves that, and you can do that in a proportional font just as well, Maybe better, as this comment illustrates in this browser. One could well regard the slash as a a crude hack to work around the ambiguity caused by fixed-width characters.
    – dave
    Commented Jan 5 at 22:36
5

Any printed code that was not mono-spaced would drive many programmers crazy, myself included. I have to believe that any books or magazines which used variable width text for code was edited by people who didn't program. They probably were going by some style guide which didn't envision the importance of indenting, columned data, and the "structure" of structured programming.

OTOH, I guess if the programmer didn't care how his code looked, he could have been perfectly happy with proportional fonts.

In direct answer to your question, I believe the premise to incorrect. Good programming sources use fixed-width fonts for code, and to my knowledge always have.

1
  • There are plenty of examples of articles set in proportional typefaces by programmers with better credentials than you or I. The first example I grabbed from my library was Informal Introduction to Algol 68, by Lindsey and van der Meulen. Take a look at that before claiming that they didn't care how it looked.
    – dave
    Commented Jan 13 at 15:00
1

I have a couple of Multics manuals from 1975. Straight-up monospace. Emphasis is by underlining. Undoubtedly formatted with runoff (ancestral to Unix nroff), which could justify monospaced text only.

0

Very likely before you were born. I started programming for money in 1969. At that time, we didn’t have any other fonts.

6
  • 2
    Charlie, we've had fonts since Gutenberg invented moveable type. The point is that there's no inherent need for books about computers to be printed on devices attached to computers. I learned Algol in large part from the Revised Report, and it wasn't shy of using multiple fonts for code, though whether it's monospaced or proportional seems to depend on where you read it. (Welcome to Retrocomputing, despite this criticism).
    – dave
    Commented Jan 10 at 0:00
  • Im so old. Computers had only one font. Details varied but they were all monospace fonts. Programming languages often depended on monospace fonts — COBOL, FORTRAN, RPG assemblers, all column dependent. The problem still shows up in Python, where '\t' and '\b\b\b\b\b\b\b' look the same but parse differently. Thanks for the welcome, but I was doing retro-computing back when it was cutting edge. Commented Jan 30 at 16:41
  • I'm so old, computers had no fonts at all. Different I/O devices had typefaces, often quite different to each other. I reject the notion that a programming language designed for punched cards had any dependency on fonts whatsoever. What mattered was which card column something was punched in; and if you had the services of a keypunch operator, that in turn depended on which square on the coding sheet you wrote it in. (Oh, and 'tab' on a keypunch just moves to a particular column, nothing is punched on the card).
    – dave
    Commented Jan 30 at 22:14
  • Right, typefaces not fonts. Son, you need google. Commented Feb 3 at 15:11
  • You're correct: typical output devices (lineprinter, teletype) of the time had a single font (of a single typeface). But the salient point is that the computer had no font to call its own.
    – dave
    Commented Feb 3 at 15:28
0

The Style Manuals that dictated how documentaion was to be produced and presented. These typically dictated the use of fixed spaced fonts for computer code examples.

As an example the HP Help System, Developers Guide, although this is version 3.0 the first copyright date is 1988.

Glossary, Page Glossary-1

example listing

A body of text in which line breaks are left as they are and which is displayed in a computer font. The text is typically an example of a portion of a computer fi le. Example listings are entered using the ex or vex elements.

Help Tag Markup Reference, Page 11-16

Computer example Shows computer text without changing the spacing or line breaks.

You must log in to answer this question.

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