Maybe You never worry about fonts. Right, since for most people Computer Modern or Times are perfect enough to make a pdf document look good. And what’s more, seldom would there have been LaTeX tutorials covering topics on fonts. Fonts are considered for TeXhackers, not for TeX users.
On the other hand, people who are interested in typography care too much about font looks. Even a person who has just installed a brand new Windows system will proceed to his first configuration task: use ClearType to antialiase screen fonts rendering (Well, this post was written at the time of Windows XP. Things have changed dramatically since then). Let alone Unix/Linux fans and TeX/LaTeX zealots.
This series of articles does not instruct one how to install fonts, neither does it teach specifically how to use different fonts in a LaTeX document. Instead, it gives a big picture about how fonts are dealt with behind the scene. Understanding the principals helps one on knowing, such as, “what affects the document’s texts”, rather than “what steps to take to improve the layout”. It is even conjectured that this article will soon be obsolete due to the new font schemes in LaTeX3.
Under the New Font Selection Scheme (NFSS) for LaTeX2e, a font has five attributes: encoding, family, series, shape, and size. For example, OT1/cmr/m/n/10 means that the document is using a font in OT1 encoding scheme, computer modern roman (cmr) family, medium weight (m) series, normal upright (n) shape, and 10pt size. These five parameters will be displayed whenever LaTeX gives an overfull box warning.
To change the current font layout, one can use a series of
\font... commands, followed by a
\selectfont activation. Example:
It instructs LaTeX to use bold italic 12pt ptm font with 15pt baselineskip in the T1 encoding scheme for the texts. ptm is the widely used Adobe Times font, as oppose to cm.. (computer modern) families which might be hardly popular outside the TeX world.
Just to give a sense of what values are possible for each attribute in a font:
Encoding: OT1, T1…
Family: cmr, cmss, cmtt (computer modern); ptm, phv, pcr (Adobe)…
Series: m (medium), b (bold), bx (bold extended), sb (semi-bold), c (condensed)
Shape: n (normal/upright), it (italic), sl (slanted), sc (small caps)
Size: 5pt, 9pt, 10pt, 12pt, 14.4pt, 24.88pt…
Note that not all combinations of the attributes are valid.
Besides the above lower-level commands, LaTeX provides default settings for each document class. One can use different fonts by
renewcommand‘ing the defaults. For example,
\familydefault is originally set as
\rmdefault, which in turn is set as cmr. One can issue a command like:
to use Adobe Helvetica (phv) as the default font face. Changing
\shapedefault are similar. However, font size has to be changed in a different way, e.g.:
This sets a 12pt font size. Font encoding is usually changed by using a different package, such as:
This forces a T1 encoding.
To summarize, a font in LaTeX is specified by five attributes. Except for the encoding, the other four should be intuitive to gentle users. There are specific commands to select a different font. The encoding scheme shall be discussed in the next article. A last note is that all the above values mentioned in this article are for text fonts. Math uses different fonts and values, and needs to be dealt with additionally. But the principals are the same. There are also some tailored packages designed to set a specific font for everything (including text and math), such as mathptmx, courier, avant. Readers are encouraged to explore these packages.