448

As a native English speaker, I've mostly been allowed the luxury of pretending that ASCII is enough, and have been able to treat font encodings as not my problem. I've seen lots of advice that I ought to include \usepackage[T1]{fontenc} in my preamble. (See, for instance, p. 337 of The LaTeX Companion.) What isn't really adequately explained is why I ought to do so.

So, if I am writing in English and have to make only occasional use of things like G\"odel, what does following the advice really get me?

3

2 Answers 2

451

Note that this is font encoding (determines what kind of font is used), not input encoding.

The default font encoding (OT1) of TeX is 7-bit and uses fonts that have 128 glyphs, and so do not include the accented characters as individual glyphs. So a letter ö is made by adding an accent to the existing 'o' glyph.

The T1 font encoding is an 8-bit encoding and uses fonts that have 256 glyphs. So an 'ö' is an actual single glyph in the font. Many of the older fonts have had T1 variants devised for them as well, and many newer fonts are available only in T1. I think "Computer Modern" was originally OT1, and "Latin Modern" is T1. (Look at OT1 font encoding and T1 font encoding.)

If you don't use \usepackage[T1]{fontenc},

13
  • 11
    Yes, hyphenation for languages with accented characters is the main reason that requires T1 font encoding. Jul 30, 2010 at 18:58
  • 8
    Yep, definitely load lmodern (or some other font package) when you use T1. Jul 31, 2010 at 2:37
  • 17
    The bigger problem is that without T1 you cannot copy/paste a name with a non-ascii glyph without getting them split up into their components. Aug 13, 2010 at 16:43
  • 5
    @Jukka: I am not sure why you would still use the ae package. Aug 22, 2010 at 10:04
  • 6
    So, what about fonts having >256 glyphs? There must exist some, right?
    – letmaik
    Oct 9, 2012 at 18:50
131

In addition to the reasons listed by @ShreevatsaR why the T1 font encoding is advisable even when writing (primarily) in the English language, there are two more reasons that were missing from his list:

  • TeX is only able to apply ligatures and kernings between characters when these characters are real glyphs from the same font. In OT1 (with 128 glyphs) you only have more or less ASCII characters and all diacritics etc are missing.

  • Searching in the output is not working whenever a diacritic character is being used as that ends up being a complicated box structure in the output and not a character.

So to stay with your example of the occasional G\"odel: if the font designer has decided that because of the shape of the G it needs some kerning to a following o or ö then he can specify this in T1 but not in OT1 (for the ö as that is not a single glyph in that font encoding). And there are a lot of kerning adjustments between characters.

The second point means that if somebody is searching through your papers (put up on the web as pdf's, for example) for the name Gödel, then the name wouldn't be found.

So in short the T1 fonts simply give slightly better output whenever there is a single diacritic char used, because kerning is better, hyphenation still works, cut-and-paste still works from the output and searching in the output works properly as well.

2
  • 1
    Do you agree that we have to load lmodern when using T1?
    – Sigur
    Nov 24, 2018 at 23:58
  • 4
    @Sigur you don't have to; depending on your installation Computer Modern has T1 encoded fonts too. But lmodern is a good replacement so you can do that for sure. Nov 25, 2018 at 7:56

You must log in to answer this question.

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