How do I use an OpenType font with my LaTeX document?

I want to use a really cool open-source OpenType font with my LaTeX document.

I was told that either I could go through a long process of converting the OpenType font to one useable by LaTeX, or I should instead switch to using XeTeX.

Is there a way for me to use an unmodified OpenType font with my LaTeX document (and existing LaTeX installation)?

Switch to XeTeX:

1. Change your invocations of `pdflatex` to `xelatex`.
2. `\usepackage{xltxtra}` at the beginning of your preamble (some XeTeX goodies, in particular it also loads `fontspec`, which is needed for font selection).
3. `\setmainfont{Name of OTF font}` in the preamble.
4. No step 4.

It’s as easy as that.

Drawback: you lose the advantages of the `microtype` package. Ah, and be sure to use UTF-8 as your source encoding, and remove any `\usepackage{inputenc}` declarations.

• You also have to remove \usepackage{fontenc} declarations. See tex.stackexchange.com/q/2984/1035 – Mateus Araújo Sep 11 '10 at 5:59
• It would be interesting to hear some more of the cons of "loosing the advantages of the `microtype` package" and how to compensate for that when using XeTeX. – PetaspeedBeaver Nov 9 '15 at 17:36
• @PetaspeedBeaver Current versions of “microtype” offer partial XeTeX support and it’s good enough for me. – Konrad Rudolph Nov 9 '15 at 17:44

As far as I know you should install it as a system font. Such that it becomes available in system settings for UI fonts, web-browser and all apps. On Mac OS X and Linux (Gnome at least) it is simple as double clicking the downloaded font.

After that you can use fontspec & Xe(La)TeX to select that font by name (note that font name can be different from the file name).

If you don't want to install the font as a system font, you can drop the font into the same folder as your tex document and xelatex should be able to find it.

To use OpenType and TrueType fonts with tex, latex (for dvi, dvi-ps, dvi-ps-pdf workflow) special font metrics will need to be generated and font map installed. Unfortunately I'm on a quest to find out how to properly do it.

Note that using "cool fonts from the web" might not be of high quality as highly engineered fonts. The Latin Modern has something like more than 50 complete fonts to cover different weights, italics, maths and special ligatures. None of the other fonts come close for exploiting latex typography power. Commercial fonts from Adobe, Apple, Microsoft are usually of high typographical quality and are more complete.

You should definitely switch to XeTeX if you want to do that. Fonts are (and as far as I can see, will always be) a pain to use with LaTeX by itself.

• This is by far the easiest way: use XeTeX (or LuaTeX) with the fontspec package. – Joseph Wright Jul 26 '10 at 20:16
• But it doesn't really answer the question. What do you do to use an OpenType font once you've switched to XeTeX? – jalf Jul 27 '10 at 1:29
• \usepackage{fontspec}\setmainfont{My OpenType Font} – Will Robertson Jul 29 '10 at 5:50