470

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?

4
  • 18
    I checked what I had written on p.337 of the LaTeX Companion, but the advice there says "OT1 is not adviable for languages other than English" (so I acknowledged that you may pretend you write in ASCII :-). But in addition to that it also gives all the explanations like hyphenation not working etc. So I'm not sure why it isn't adequately explained. Commented Nov 26, 2012 at 22:04
  • 10
    If you choose to include \usepackage[T1]{fontenc}, installing the cmssuper package may be necessary to ensure high quality PDFs.
    – badroit
    Commented Apr 17, 2014 at 19:04
  • 2
    Might be worth mentioning in case any future readers come across this question: do not use this in XeTeX or LuaTeX. (refer to fonts - Are there cases where fontenc + luatex (or xetex) cause problems? - TeX - LaTeX Stack Exchange.)
    – user202729
    Commented Mar 28, 2023 at 9:52
  • Pursuant to the above comment: This question was posted 12 years ago (as of 2023). Due to the large number of ticks, it is often seen. But nowadays, it is much better to use utf8 everywhere, load OpenType or TrueType fonts using fontspec (rather than directly requesting fontenc or inputenc, and process using lualatex. The older Type 1 fonts, with T1 or OT1 encoding, are best left for older documents that were originally written when that technology was standard in TeX.
    – user287367
    Commented May 11, 2023 at 17:15

2 Answers 2

466

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. Commented Jul 30, 2010 at 18:58
  • 8
    Yep, definitely load lmodern (or some other font package) when you use T1. Commented Jul 31, 2010 at 2:37
  • 19
    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. Commented Aug 13, 2010 at 16:43
  • 5
    @Jukka: I am not sure why you would still use the ae package. Commented Aug 22, 2010 at 10:04
  • 8
    So, what about fonts having >256 glyphs? There must exist some, right?
    – letmaik
    Commented Oct 9, 2012 at 18:50
136

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
    Commented Nov 24, 2018 at 23:58
  • 5
    @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. Commented 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 .