10.9 Monospaced (typewriter) fonts
The choice of monospaced (typewriter) fonts for use in program listings and other applications is not very wide though it has considerably increased in recent years. Of course, with the Computer or Latin Modern fonts a suitable typewriter family is included, but if the main document fonts are being replaced, freely available choices for typewriter fonts are still relatively few. While staying with Computer or Latin Modern Typewriter (which have an identical design) might be an option, the font may not blend well with the chosen document font.
We start with a few guidelines for selecting a suitable monospaced font and then show examples of roughly a dozen typewriter fonts to choose from.
If you use a monospaced font mixed with your main document font, then you typically want to make it comfortably fit in by not showing large deviations from the normal running length nor from the x-height of your body font. The following example compares LuxiMono (scaled down to 85% using the option scaled), Computer Modern Typewriter, and Adobe Courier (or more precisely TEX Gyre Cursor). Among those three, LuxiMono has the largest x-height () and, at the same time, the smallest width. Courier, running very wide, occupies the other end of the spectrum, with CM Typewriter being comfortably in between the two extremes.
10.9.1 Algol
Algol is a font by Adrian Frutiger (1928–2015) that was designed for printing Algol code in manuals; i.e., it is not really meant to be a general-purpose text font. One interesting aspect of it is that it is actually not a monospaced font1 — so use it only for typewriter if you do not require that all characters line up.
It was digitalized and prepared for use with LaTEX by Michael Sharpe under the name Algol Revived. Note that his algolrevived package sets up the font for use as the document font, unless you give it the option tt! With medium you select the medium bold series as the default, and with scaled you can supply a scale factor as usual. The package also defines a few additional text symbols; see its documentation for details.
10.9.2 Anonymous Pro
Anonymous Pro is a monospaced font family designed by Mark Simonson. Special care has been taken to make it suitable for code display by giving glyphs that could be mistaken for each other distinct shapes (such as zero and capital O, etc.).
LaTEX support for pdfTEX is provided through the package AnonymousPro by Arash Esbati. With the option scaled, you can specify a scale factor for the font. The package also defines a number of command names to access extra symbols, many of which represent Apple keyboard keys, such as ⌘ ⎈, as well as a few others. Note that the small capitals are faked and appear much too thin.
10.9.3 CM Bright Typewriter Light
The CM Bright Typewriter Light fonts are designed to be combined with the sans serif family CM Bright. Both families are described together on page 12, and the NFSS classification is given in Table 10.3. If you think of combining it with other families, consider using LM Typewriter instead, which also offers a light version, and additional shapes.
10.9.4 Courier
Courier is a wide-running, thin-stroked monospaced font. It was designed by Howard Kettler (1919–1999) of IBM and later redrawn by Adrian Frutiger (1928–2015). These days it is often used in combination with Times Roman, producing a striking contrast. One reason for the popularity of this combination is certainly its availability on any PostScript device.
TEX Gyre Cursor shown here is based on the URW Nimbus Mono L version of the font family (which is set up with the TEX Gyre tgcursor package).
10.9.5 DejaVu Sans Mono
DejaVu Sans Mono is the monospaced font matching the serif and sans serif DejaVu designs. You can find the description of all three families on page 12 and their NFSS classifications in Table 10.4 on page 13.
10.9.6 Fira Mono
This font by Erik Spiekermann is the companion to the Humanist sans serif Fira Sans. See page 14 for the font descriptions and Table 10.5 for the NFSS font classification and further details on the families.
10.9.7 Go Mono
Designed by Charles Bigelow this monospaced font has Go Sans as the matching sans serif family. See page 15 for the font description and Table 10.7 on page 16 for the NFSS font classification and further details.
10.9.8 Inconsolata
Inconsolata is a monospaced sans serif font designed by Raph Levien. It is provided in regular and bold weights but offers only a single shape, e.g., no italics, etc. By default, word spaces are flexible; i.e., only the characters are monospaced and thus can be used justified.
LaTEX support for pdfTEX is provided through the package inconsolata by Michael Sharpe. It offers a bundle of options, e.g., scaled, narrow (for a somewhat condensed width), hyphenate (allow hyphenation), mono (make word spaces also mono-width), and several others. Support for a number of variant characters such as a nonslashed zero is also provided through options. See the package documentation for details.
10.9.9 Kp (Johannes Kepler) Typewriter
Kp Mono has both a matching serif and sans serif design. All three families are described on page 17 where you also find their NFSS classifications in Table 10.9 on page 18. An interesting aspect of the font is that it offers both lining and oldstyle numbers (as shown below). If you prefer lining numerals, use the family jkptt with pdfTEX; with Unicode engines use the feature set of fontspec.
10.9.10 Latin Modern Typewriter
If you load the lmodern package, all fonts are going to be from the Latin Modern families. On the Unicode engines Latin Modern is already the default, so you do not even have to load a package.
In either case, this means that elects the regular monospaced version of the Latin Modern Typewriter font. You can find the description of the Latin Modern families in Section 9.5.1 and their NFSS classifications in Table 9.6 on page →I 687.
10.9.11 Libertinus Mono
For this font by Philipp H. Poll and Khaled Hosny there exists a matching serif and sans serif family. See page 19 for the font description and Table 10.10 on page 20 for the NFSS font classification and further details on the fonts. I would avoid the bold weight as it is far too dark and fuzzy for my taste.
10.9.12 Lucida’s monospaced families
There are several closely related monospaced Lucida designs intended to be used with matching Lucida serif and sans serif families. They are described together in Section 10.2.10 on page 21, and their NFSS classifications are given in Table 10.11 on page 22.
Lucida Typewriter is a serifed design running comparably wide, while the other three families are sans serif designs with a shorter running length.
10.9.13 Luximono
The Luximono fonts are original designs by Kris Holmes and Charles Bigelow (Bigelow and Holmes, Inc.), for which hinting and kerning tables have been added by URW++ Design and Development GmbH. The family has two weights with upright and oblique shapes. In that respect, it differs from other monospaced fonts, which are often offered only in medium series and more rarely in italic or oblique shapes.
10.9.14 Noto Sans Mono
The Noto Sans Mono fonts (and the earlier version Droid Sans Mono) have matching serif and sans serif designs. They are described on page 26, and the NFSS classification is given in Table 10.14 on page 28.
10.9.15 Plex Mono
For the Plex Mono font by Mike Abbink there exists a matching serif and sans serif family. See page 30 for the font description and Table 10.16 on page 31 for the NFSS font classification.
10.9.16 PT Mono
Paratype’s PT Mono is the monospaced font intended as a companion to PT Serif and PT Sans — all designed by Alexandra Korolkova. See page 31 for the family descriptions and Table 10.17 on page 32 for the NFSS font classification and further details.
10.9.17 Roboto Mono
Roboto Mono is the monospaced companion to Roboto Sans and slab serif font Roboto Slab. All three families are described in more detail on page 34, and the NFSS classifications are found in Table 10.19 on page 35.
10.9.18 Source Code Pro
The monospaced font Source Code Pro is the companion to the families Source Serif Pro and Source Sans Pro. All three are described in more detail on page 35, and their NFSS classifications are found in Table 10.20 on page 36.