Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Appendix A: Installation

Section 4: Installing new fonts

Fonts come in a variety of formats. The earlier PostScript Type 3 (METAFONT) and Type 1 (PS) fonts are now being superseded by fonts in TrueType (.ttf) and OpenType (.otf) formats. How you install them and where they go depends on how and where you installed LATEX: all I can deal with here are the standard locations within the TEX Directory Structure (TDS).

TrueType and OpenType typefaces

These are a single .ttf or .otf file per font (so there may be many for a whole typeface or font family).

METAFONT typefaces

These are normally used only with older distributions of LATEX but there are still some fonts which are not yet available in OpenType or TrueType format.

They have a number of .mf source (outline) files and possibly also some .fd (font definition) files. There may be .tfm (TEX Font Metric) files but these are not needed at installation, as they get generated from the outlines automatically the first time you use the font.

PostScript typefaces

They are normally used only with pdflatex and are no longer covered in this book.

They come as a pair of files per font (so there may be many for a whole typeface): a .pfb (PostScript font binary) outline, and an .afm (Adobe Font Metric) file.

A .sty file (if present) SHOULD be used in a \usepackage command to tell LATEX what font features are available, and there is often a PDF showing examples and describing how to use the font or family.

The use of Type 1 and METAFONT typefaces assumes the use of the New Font Selection Scheme (NFSS) used in LATEX. If you are running the obsolete LATEX 2.09, you MUST upgrade it now, because none of this will work.

A.4.1 TrueType and OpenType fonts

These types of font are already recognised by your computer, so you just install them in the normal way for your computer system (usually double-click or right-click on the font file and select Install from the menu).

On Windows and Apple Macintosh OS Xsystems, the fonts are then available immediately.

On Unix & GNU/Linux systems you must run the FontConfig utility fc-cache to give LATEX fast-loading access to all the fonts you have installed. Run the program like this:

fc-cache -fv

It can take several minutes, especially if you have a lot of fonts. Once it has finished, you can search the font database with the fc-list utility and then use the grep command to refine the search for the font name or part, eg:

$ fc-list|grep -i comic|sort
/home/peter/texmf/fonts/truetype/
  windows/comicbd.ttf: Comic Sans MS:style=Bold
  windows/comici.ttf: Comic Sans MS:style=Italic
  windows/comic.ttf: Comic Sans MS:style=Regular
  windows/comicz.ttf: Comic Sans MS:style=BoldItalic

You can then see the exact font name to use in your documents, eg

\usepackage{fontspec}
\setsansfont{Comic Sans MS}

A.4.1.1 Font management

If you want to keep your additional fonts in several different locations, you will need to tell FontConfig where to look. You may install fonts a ) in your Personal TEX Directory; b ) in the system’s shared folder; or c ) in your TEX distribution’s shared tree. You should never install fonts in your TEX distribution’s master tree, as this will get overwritten when you upgrade, whereas the shared tree is not touched.

On Unix & GNU/Linux systems there are already .conf font configuration files in /etc/fonts/conf.avail/ for the fonts that come with the installation. You can create one or more configuration files for the installation locations you have used. Some examples are shown in § 6.2.1.1 above.

A.4.2 Installing METAFONT fonts

This is the simplest installation. When you download METAFONT fonts from CTAN, you’ll usually find a number of outline files (.mf files) and maybe some other types as well (see below).

    Installation of METAFONT fonts

  1. In your Personal TEX directory, create a new subdirectory called fonts/source/public/name named after the typeface you’re installing

  2. Copy all the .mf files to this directory

  3. Copy any .fd file[s] to your tex/latex/mfnfss subdirectory (create it if it doesn’t already exist)

  4. Copy any .sty (style) files to a subdirectory (create it too), named after the typeface, eg tex/latex/name

  5. If you are using MiKTEX, run your TEX indexer program (see step 4 above).

    Unix & GNU/Linux systems, including Apple Macintosh OS X, don’t need this last step

That’s it. Unlike PostScript fonts, METAFONT fonts generate their own font metric files (.tfm files) automatically on-the-fly the first time the font is used, so there is normally nothing else to install.

Now you can put a \usepackage command in your Preamble with whatever name the .sty file was called, and read the documentation to see what commands it gives to use the font (refer to item 1 in the list above and step 2 above).

If the font came without .fd or .sty files, you’ll need to find someone who can make them for you.

  1. On Unix & GNU/Linux systems, including Apple Macintosh OS X, the easiest way to do this is in a Terminal window, in your Personal TEX Directory, using the command mkdir -p fonts/source/public/whatever, as this creates any intervening subdirectories for you. Under Windows, you have to create each subsubdirectory individually.