37

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)?

1

3 Answers 3

28

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.

See also: Differences between LuaTeX, ConTeXt and XeTeX.

3
  • 5
    You also have to remove \usepackage{fontenc} declarations. See tex.stackexchange.com/q/2984/1035 Commented Sep 11, 2010 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. Commented Nov 9, 2015 at 17:36
  • 1
    @PetaspeedBeaver Current versions of “microtype” offer partial XeTeX support and it’s good enough for me. Commented Nov 9, 2015 at 17:44
5

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.

3

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.

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

You must log in to answer this question.

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