[Tex/LaTex] Font encoding in LaTeX

font-encodings

I've been using LaTeX for a while and I've read a lot of discussion about fonts encodings.

Some suggest to use T1 fonts adding \usepackage[T1]{fontenc}, other suggest to add nothing, other suggest to use T1 in addition to the package ae while others say this is deprecated and another font should be used instead …

I'm very confused, is there some updated resource that explains the issue well and settles the matter?

In my experience adding nothing works fine but sometimes i need additional character sets such as bold small caps, in this case I can use the T1 encoding but the quality is poor. Everything seems to be fixed if I use the ae or the lmodern packages. What's really happening and what should I really do?

PS: I'm sorry if this has been asked before, I've found a lot of discussion about this but I'm posting in the hope to get a definitive answer.

PPS: Currently I'm using latex + dvips + ps2pdf. I prefer to use pdflatex if I can but, as I work with other, this is not always possible.

Best Answer

The basic rule is: Try if you get better results using \usepackage[T1]{fontenc} in your document.

The explanation: when you write English text you can probably get by without this line and you will not experience any differences/difficulties in most situations.

When Knuth introduced TeX, he shipped it with the font called 'Computer Modern'. This font has only a very limited character set (compared with today's OpenType fonts). For example characters like 'ö' and 'ü' were not present. This does no harm if you don't typeset any languages that use these characters. But as soon as you have to render them, you can help by combining two dots '¨' on top of 'o' or 'u'. There is a TeX primitive for that: \accent. This has the side-effect of disabling hyphenation, which is not acceptable.

Thus one day TeX users came up with an agreement on how to encode fonts that can render most European languages (the T1 encoding). This encoding tells which code to put in the DVI or PDF file when the users requests an 'ö' or 'ü'. Now that these characters don't have to be composed by two glyphs anymore, they donn't break hyphenation.

Now why bother with T1 if you don't have these funny characters? When you prepare a font for LaTeX, you have to create font metric files (tfm). Since T1 is the most used encoding these days (in Europe for sure), some people don't bother anymore with non-T1 encodings and thus a font might not be available in the old and default OT1 encoding.

BUT: when you stick to Computer Modern, you might want to keep the old encoding (and not use T1), since the PostScript variant (which leads to better rendering results) is only available with the OT1 encoding. For T1 encoded Computer Modern (which you have to use when you need hyphenation in words with these special characters), you could use the ae package or change your font to cm-super (by not loading ae and changing the encoding to T1 - but I wouldn't want to do that). I strongly suggest to use the Computer Modern replacement called 'Latin Modern' which comes in several flavors (PostScript Type 1, OpenType fonts). Activate it by \usepackage{lmodern}.

Related Question