# Does LaTeX automatically change fonts when switching between Title, Author, Date, and Body Text or sizes modifiers?

I have a question regarding the inner workings of the system. Let us assume that I am using the article class.

I cannot help but notice that the title seems to have a different look than the body text—something about the curvature of the letters. (I could be mistaken, but it seems like simply switching sizes in Microsoft Word does not make the title look as nice as in LaTeX)

I know that when I downloaded Computer Modern Unicode, there are many *.otf files:

cmunbbx.otf
cmunbi.otf
cmunbl.otf
cmunbmo.otf
cmunbmr.otf
cmunbso.otf
cmunbsr.otf
cmunbtl.otf
cmunbto.otf
cmunbx.otf
cmunbxo.otf
cmunci.otf
cmunit.otf
cmunobi.otf
cmunobx.otf
cmunorm.otf
cmunoti.otf
cmunrb.otf
cmunrm.otf
cmunsi.otf
cmunsl.otf
cmunso.otf
cmunss.otf
cmunssdc.otf
cmunst.otf
cmunsx.otf
cmuntb.otf
cmunti.otf
cmuntt.otf
cmuntx.otf
cmunui.otf
cmunvi.otf
cmunvt.otf


So my question is, does LaTeX choose different otf files based on size or for title, author, date, and sections.

\title{}
\date{}
\author{}

\small{}
\large{}
\Large{}
etc.


## Follow-up Question

• I think the big list of *.otf files gives each font variant (e.g. bold, italic, slanted,...) rather than each size. The sizing information is stored within each .otf file. – John Wickerson Jun 3 '13 at 11:02
• @JohnWickerson +1 on the 1st part of your post, but I'm afraid the 2nd one needs correction: an .otf file is not going to contain the glyphs for different sizes. There is no a.8pt, a.12pt, a.24pt etc (I don't think anybody has ever done that in an OpenType font). What would be interesting to know is if the people who derived the CM Unicode fonts from their predecessors really converted all the optical sizes. My impression is that they didn't -- or there would be eight versions of the file cmunrm.otf. – Nils L Jun 3 '13 at 11:32
• update: just checked -- no, they really didn't.. Using CMU Serif, like this, will result in only one grade being used. Using LM Roman yields three grades, as expected. – Nils L Jun 3 '13 at 11:54

that's called »optical sizes« or »grades«. A typeface designer may choose to draw several versions of a typeface, each optimized for printing at a certain size. For example, a grade optimized for printing at footnote size (say, 8pt) will usually have sturdier hairlines, less stroke contrast, maybe a bit looser spacing, maybe a decreased ascender-to-xheight ratio, probably less overall detail -- whereas a grade optimized for display use (say, size 24pt) will be more playful, have more contrast between vertical and horizontal strokes etc. The differences become most obvious when the different grades are scaled to the same absolute size.

Nowadays, many fonts come in a ›Text‹ and a ›Display‹ version. Some have an additional ›Footnote‹ grade (or ›Caption‹, or ›Micro‹; there's no naming standards). But more than three grades are pretty rare. Donald Knuth drew eight of them for Computer Modern Roman Regular, five for CM Sans, four for CM Typewriter, only one for CMR Smallcaps etc. [although, see below, this wasn't adopted in the Unicode version].

In the days of letterpress printing, this practice was the norm rather than the exception. As (before the late 19th century) every fount had to be cut from scratch for a certain size anyway, a punchcutter would cut their 8pt punches not only smaller than their 24pt ones, but include other differences likes the ones above as well.

The overall aims of all this are (among others) to (1) improve readability at small sizes, (2) to prevent thin strokes from disappearing (or even parts of the metal punch breaking off) at small sizes, to (3) add variation, embellishments, detail etc. at large sizes (note, e.g. the loops in FF Clifford's italic Q or w), (4) to create a more uniform ›color‹ among the different sizes, as using the regular text grade in footnotes yields a color too light, and, for display, too dark.

Unless you are using Computer Modern Roman, TeX will only choose different fonts for different sizes if (1) you tell it to, and (2) you actually have a font that comes in different grades.

It's also possible to specify completely different fonts for the different sizes. I often use Playfair Display as a companion for Miller Text (as a cheapskate replacement for Miller Display). Using Xe/LuaTeX, fontspec's optical size feature can be used to that end:

\documentclass[12pt,DIV=7]{scrartcl}
\usepackage{fontspec,blindtext}
\setmainfont%
[SizeFeatures={%
{Size=-14,Font={Miller Text}},%
{Size=14-,Font={Playfair Display}}}]{Miller Text}

\begin{document}
{\Large Lorem Ipsum \&c.}\par
\blindtext
\end{document}


PS: that said, the Unicode version of Computer Modern does not seem to come in different grades, as does traditional Latin Modern Roman. The reason the file list you posted is that long is simply that a lot of quite different fonts are part of the CM Unicode project. Knuth's sans, typewriter, typewriter proportional, upright (!) italic, etc., they're all in there.

• Do the most common font-packages (mathdesign, newtx, newpx, libertine, the Tex Gyre fonts etc.) include and use different grades? – marczellm Jun 4 '13 at 9:12
• no, none of these does. Actually, I don't know about a single font from the *TeX world that has different grades (besides the Knuth ones). The problem is that producing different grades, obviuosly, multiplies the wo/manpower that's required in designing a font. It's just too much for people who don't design fonts for a living. So, niceties like that are hard to find from other sources than professional foundries. And even for those, there's good reasons not to do it. – Nils L Jun 4 '13 at 9:36

Unlike most word processors, LaTeX does, in general, not simply scale a font to the requested size, but uses designed fonts for particular sizes.

This is specified in the fd files.

If you look at the pslatex times package fd files for Times Roman you see:

\DeclareFontShape{T1}{ptm}{m}{n}{
<-> ptmr8t
}{}


Which says that in T1 encoding for Times Roman (ptm) you use the same font at all sizes, simply scaled.

However if you look at the original Computer Modern fonts you see a more complicated picture:

\DeclareFontShape{OT1}{cmr}{m}{n}%
{<5><6><7><8><9><10><12>gen*cmr%
<10.95>cmr10%
<14.4>cmr12%
<17.28><20.74><24.88>cmr17}{}


There are separate fonts cmr5, cmr6, cmr7, cmr8, cmr9, cmr10, cmr12, cmr17 and a suitable font is chosen for each size.

Depending on packages loading LaTeX either forces a requested size to one of the sizes above (as shown here) or scales the nearest font to the requested size (type1cm1 or fix-cm packages).

The answer assumes you're using XeLaTeX or LuaLaTeX.

The definition of \@maketitle in the article class is

\def\@maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\LARGE \@title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@author
\end{tabular}\par}%
\vskip 1em%
{\large \@date}%
\end{center}%
\par
\vskip 1.5em}
\fi


This command is responsible for the actual typesetting of the title data. It uses \LARGE size for the title and \large for the author and date fields.

If you say

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{CMU Serif}
\setsansfont[Ligatures=TeX]{CMU Sans Serif}


the fonts will be simply scaled, because they are not available in different optical sizes. The situation is different if you use the Latin Modern fonts, because they are available in different optical sizes.

Other OpenType fonts are, for example Adobe Minion, Garamond Pro and others. The good news is that fontspec is able to load the different optical sizes, if available.

With the specification for fontspec given above, the font files will be automatically chosen when issuing \bfseries, \itshape and so on, or their counterparts \textbf, \textit, … In most cases no user intervention is needed. It could happen that for some fonts the correspondence cannot be caught by fontspec, see the manual for workarounds. But it's not the usual case.