Using Fonts
local graph
Chapter 10 — Using Fonts
Section titled “Chapter 10 — Using Fonts”With mathematical typesetting covered, we can now look at the fonts that define a document’s look. This chapter introduces LaTeX’s font options and shows how text and math fonts work together. The base font you choose strongly shapes the overall appearance. You might select a clear, easy-to-read font for a lengthy document or a decorative, calligraphic font for a greeting card. Your job application letter could benefit from a very clean professional font. In contrast, a mathematical article requires fonts with a wide range of symbols and a text font that complements them.
Until now, we have focused on the logical properties of fonts. Although we’ve always used the LaTeX standard font, we switched from Roman to sans-serif and typewriter styles, and learned how to make text bold, italic, and slanted back in Chapter 2, Formatting Text and Creating Macros. However, we’ve not yet moved beyond the standard font set.
In this chapter, we’ll look at the following topics:
- Using comprehensive font bundles
- Choosing specific font families
- Writing with TrueType and OpenType system fonts
While we’ll examine the text’s appearance, we’ll also look at how math formulas look together with the text font.
As this book is printed and electronically distributed with bitmap images, you will not see the original LaTeX quality in the font samples in this chapter. Visit https://latexguide.org/chapter-10 to see the fonts in original LaTeX and PDF quality. You can see the font examples in a larger size to easily highlight the fine details and differences.
Let’s begin with an example. It will serve as the basis for our work with fonts throughout this chapter.
Using comprehensive font bundles
Section titled “Using comprehensive font bundles”We begin with the most extensive font bundles. To test fonts, it helps to use a pangram. This word comes from the Greek pan gramma, meaning every letter. It stands for a sentence that uses every letter of the alphabet. Pangrams are ideal for showing how a font handles its full character set.
We will print a famous pangram phrase using the Latin Modern font family. Latin Modern is very similar to LaTeX’s default font, Computer Modern. However, Latin Modern includes many additional characters, especially accented ones. Because of this broader coverage and its high quality, it’s often considered the natural successor to the standard font. Let’s see how it looks in various font families and shapes, together with a math formula:
- Start a new document:
\documentclass{article}
- Create a macro for the pangram and include additional numerals. It shall take one argument, which will be the font family or shape selection command. We will add a paragraph break at the end, as shown:
\newcommand{\pangram}[1]{{#1 The quick brown foxjumps over the lazy dog. 1234567890\par}}
- Load the
fontencpackage and choose theT1font encoding:\usepackage[T1]{fontenc} - Load the
lmodernpackage to get the Latin Modern font:\usepackage{lmodern} - Begin the document and choose a
largefont size so the details are easy to see:\begin{document}\large - Now, we use our
\pangrammacro several times with different font settings:\pangram{\rmfamily}\pangram{\sffamily}\pangram{\ttfamily}\pangram{\itshape}\pangram{\slshape} - Add a math font example; use the code that we wrote for Figure 9.29 in Chapter 9, Writing Math Formulas:
\[\int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}\sum_{i=1}^{n} f(x_i) \,\Delta x_i\]\end{document}
- Compile and look at the font examples:

Figure 10.1 – Latin Modern font examples
Figure 10.1 – Latin Modern font examples
In our \pangram macro definition, we had another pair of curly braces. In our {{ … }} argument, the outer curly braces hold the argument to \newcommand, and the inner curly braces limit our commands to restrict the effect of the font change.
Remember, the \pangram macro is just a small demonstration macro for us, so we won’t have to repeat the demo sentence for each font family. In your everyday documents, load the font package and write your text. If needed, you can switch between font families such as \sffamily, \ttfamily, or \rmfamily, just like in Chapter 2, Formatting Text and Creating Macros.
In step 3, we selected a font encoding. Technically, encodings are mappings of character codes to symbols in a font. For English and most Western European languages, the T1 font encoding is recommended. It’s also known as Cork encoding because it was developed in the city of Cork, Ireland, during a TeX user group conference.
The default LaTeX font encoding is called OT1. Compared to OT1, the T1 encoding uses larger encoding tables that handle accented characters much better.
For example, with the default historic OT1 encoding, the accented ö character is built from the o glyph and separate dots, to be printed in the PDF file. With T1, an ö is a single glyph of the current font, so LaTeX can also properly apply hyphenation rules to words containing accented characters. The search feature of a PDF reader also works with those characters, and copying and pasting from the PDF file preserves them. With the default OT1 encoding, copying and pasting the ö character would result in dots and an o character.
If you notice a drop in default font quality with T1 encoding, your installation may be missing fonts. In that case, install the cm-super package using the package manager, or switch to one of the fonts with T1 support described in the next sections.
What we have discussed so far is output encoding. You may also encounter the term input encoding. Modern operating systems and editors support UTF-8 (Unicode), an industry-standard text encoding that extends the aged ASCII code, which can handle only 128 characters. LaTeX supports UTF-8 natively, so we won’t need to do anything. So, if you encounter the inputenc package in older books or code on the internet, you may omit it. A good practice is to use UTF-8 with any editor.
Now, we will take a look at some recommended fonts with examples. All of them support T1 encoding, so before you load a font, use the following command:
\usepackage[T1]{fontenc}In the following sections, we will explore the different fonts.
Latin Modern – a replacement for the standard font
Section titled “Latin Modern – a replacement for the standard font”Latin Modern was designed to look like the default LaTeX font, but the encoding has been improved, and it has also received additional refinements. Latin Modern contains many diacritic characters as single glyphs, whereas Computer Modern builds such accented characters from plain letters and accents.
Latin Modern has 72 text fonts and 20 math fonts under the hood, supporting all font families, shapes, and weights.
In Figure 10.1, we saw what it looks like.
Kp-Fonts – another extensive set of fonts
Section titled “Kp-Fonts – another extensive set of fonts”The Kp-Fonts collection from the Johannes Kepler project provides serif, sans-serif, and monospaced fonts, as well as mathematical symbol fonts in several shapes and weights. It even includes bold-extended and combinations such as slanted serif small caps.
Just load the package to use those fonts:
\usepackage{kpfonts}The previous example will change to the following:

Figure 10.2 – Kepler font examples
Figure 10.2 – Kepler font examples
Kp-Fonts also provides light versions with the same font metrics. The light versions might look nice in print but may appear a bit too thin for screen reading.
To switch to the light versions, load the package with the light option:
\usepackage[light]{kpfonts}The look will be different now:

Figure 10.3 – Kepler font as a light version
Figure 10.3 – Kepler font as a light version
Now, let’s look at more specialized font packages that provide a single style.
Choosing specific font families
Section titled “Choosing specific font families”We’ll now look at several TeX fonts that each have their own character and style. As before, we’ll use our \pangram macro from the previous section combined with the corresponding font-family command for testing.
Serif fonts
Section titled “Serif fonts”A small line or stroke attached to the ends of a larger stroke in a letter or symbol is called a serif. A font using such serifs is called a serif font, or a serif typeface.
The default serif font is called Computer Modern Roman. Latin Modern provides a very similar look, and you already know the Kp-Fonts serif font. Other packages specialize in serif fonts, and we will now look at some of them.
Times Roman
Section titled “Times Roman”The newtx package defines a Times -style text font along with a matching math font. The package is split into two parts so that the text and math components can be loaded independently, which is helpful when you want to combine Times with a different math font. That’s why we load it in this way:
\usepackage{newtxtext}\usepackage{newtxmath}With \pangram{\rmfamily} and our math formula, we get the following:

Figure 10.4 – A Times Roman font
Figure 10.4 – A Times Roman font
As you can see, Times is a very narrow font that works well in multi-column text, as in newspapers, but is not well-suited to single-column text. Wide text lines with too many characters are not ideal.
Palatino
Section titled “Palatino”The newpx package provides a Palatino -style text font and a matching math font. This package is also split into two parts for independent use, so we load them separately:
\usepackage{newpxtext}\usepackage{newpxmath}This gives us the following:

Figure 10.5 – A Palatino font
Figure 10.5 – A Palatino font
We can see that Palatino is noticeably wider than Times, giving it a more open and relaxed appearance.
Charter
Section titled “Charter”Charter is similar to the default Computer Modern font but has a slightly heavier appearance. We load it like this:
\usepackage{charter}For proper math support, load the mathdesign package with the charter option instead of loading charter directly:
\usepackage[charter]{mathdesign}This produces the following:

Figure 10.6 – Charter and mathdesign fonts
Figure 10.6 – Charter and mathdesign fonts
Besides Charter, the mathdesign package can also load the Utopia font:
\usepackage[utopia]{mathdesign}And this loads the Garamond font:
\usepackage[garamond]{mathdesign}New Century Schoolbook
Section titled “New Century Schoolbook”The newcent package provides the easy-to-read serif typeface New Century Schoolbook:
\usepackage{newcent}To pair it with a suitable math font, you can load the Fourier math fonts:
\usepackage{fouriernc}Here they are together:

Figure 10.7 – New Century Schoolbook and Fourier fonts
Figure 10.7 – New Century Schoolbook and Fourier fonts
nc in the fouriernc package stands for New Century because it’s designed as a companion.
Concrete Roman
Section titled “Concrete Roman”The Concrete Roman font may not look ideal on screen, but it delivers excellent print quality. Just load the concrete package:
\usepackage{concrete}A matching math companion is available through the concmath package:
\usepackage{concmath}Together, they produce the following result:

Figure 10.8 – Concrete Roman font with math support
Figure 10.8 – Concrete Roman font with math support
With its upright integral sign and serifless summation symbol, Concrete Roman has a distinctive appearance.
Bookman
Section titled “Bookman”Bookman is an old-style serif font, provided through the bookman package, loaded by the following command:
\usepackage{bookman}The Kerkis font is a bookman extension with math support; you can load this instead:
\usepackage{kmath}\usepackage{kerkis}We get the following:

Figure 10.9 – Kerkis, aka Bookman, with math support
Figure 10.9 – Kerkis, aka Bookman, with math support
An even more enhanced Bookman-inspired font is available under the name TeX Gyre Bonum. This one, though, especially with math support, is better used as an OpenType font. In the last section of this chapter, we will deal with this.
Fonts with the same or similar design often appear under different names. That’s often for legal reasons, since the font names can be protected even when the design itself is free to use.
Sans-serif fonts
Section titled “Sans-serif fonts”Sans-serif fonts are simply fonts where no serifs are used. They tend to look clearer, making them a popular choice for slide presentations and other screen-based content.
Because sans-serif fonts don’t appear as heavy in bold, they work well for headings. However, many believe that longer passages of text are much more readable with traditional serifs. That’s the reason why KOMA-Script classes use a serif font in the document body text and a sans-serif font for the headings by default.
If required, the main body font could be rendered sans-serif by means of this command:
\renewcommand{\familydefault}{\sfdefault}We already know that Latin Modern and Kp-Fonts provide sans-serif variants. Let’s now take another look at some dedicated sans-serif fonts.
Arev is a sans-serif font designed for slide presentations. The name is Vera spelled backward, as it extends the Vera Sans font, itself based on the Frutiger font. Arev also includes matching math support. Load it like this:
\usepackage{arev}Text and math become the following:

Figure 10.10 – Arev, a Frutiger-like font
Figure 10.10 – Arev, a Frutiger-like font
Note that integral and summation signs still retain serifs, as this is very common.
Computer Modern Bright
Section titled “Computer Modern Bright”Computer Modern Bright (CM Bright) is derived from Computer Modern Sans Serif to produce a lighter variant. The cmbright package provides this font together with a light typewriter font and a sans-serif math font. Load it as follows:
\usepackage{cmbright}The output of our sample code will be like this:

Figure 10.11 – The CM Bright font
Figure 10.11 – The CM Bright font
Compared with other sans-serif fonts, it’s less bold and more understated. Because of its light weight, it pairs best with text fonts of similar lightness rather than with heavier serif fonts.
Kurier
Section titled “Kurier”Many sans-serif fonts look similar at first glance, but their differences set them apart. Look at the Kurier font in Figure 10.12, for example; you can notice differences, especially in the shape of the letter g and the math symbols. Load it as follows:
\usepackage{kurier}We can enable math support by using the math option:
\usepackage[math]{kurier}Compiling our example code gives us the following:

Figure 10.12 – The Kurier font
Figure 10.12 – The Kurier font
In this font family, even the integral and summation symbols appear without serifs.
Helvetica
Section titled “Helvetica”The classic sans-serif font Helvetica is simple, clean, and widely recognized. You probably know its Microsoft descendant, Arial. Load the font this way:
\usepackage{helvet}Use the scaled option if the font appears too large, especially when next to a serif font. For example, to scale it a bit down, you can write the following:
\usepackage[scaled=0.95]{helvet}Helvetica doesn’t include direct math support, but the sfmath package can help:
\usepackage{sfmath}When you load the sfmath package in your document preamble, LaTeX will also use the current sans-serif text font within math formulas. Place it after other font packages, so it has a chance to detect the font. Further explanations, examples, options, and an alternative approach using the sansmath package can be found in Chapter 3, Adjusting Fonts, of the LaTeX Cookbook, with the source code at https://latex-cookbook.net/chapter-03.
Loading helvet and sfmath as in this section produces the following output:

Figure 10.13 – Helvetica example
Figure 10.13 – Helvetica example
You can find further information on the sfmath author’s home page at https://dtrx.de/od/tex/sfmath.html.
Typewriter fonts
Section titled “Typewriter fonts”Typewriter fonts, also known as monospaced fonts, are commonly used for source code, as in this book. Let’s look at three excellent variants.
Courier
Section titled “Courier”Courier is a very wide-running typewriter font. Load it with this:
\usepackage{courier}Then, with \ttfamily or \texttt, we will get the following:
Figure 10.14 – The Courier font
If that appears too big compared to your main document font, you can load the couriers package instead (note the s for scaled) with a scaled option, such as here:
\usepackage[scaled=0.95]{couriers}This reduces the Courier font to 95% of its original size.
Inconsolata
Section titled “Inconsolata”Inconsolata is a well-designed monospaced font made specifically for source code listings. It’s more compact and easier to read than Courier. Load it as follows:
\usepackage{inconsolata}The output proves that monospaced fonts can be elegant:
Figure 10.15 – The Inconsolata font
Unlike Courier, it’s sans-serif. It also supports a scaling option if you need to adjust its size.
Bera Mono
Section titled “Bera Mono”Bera Mono is another sans-serif typewriter font. Load it like this:
\usepackage{beramono}This is how it looks:
Figure 10.16 – The Bera Mono font
Here, you can also specify a scaled option.
Calligraphic fonts
Section titled “Calligraphic fonts”Calligraphic fonts are script typefaces with fluid strokes similar to handwriting. They work nicely for invitations, decorative headings, or any text that needs a fancy touch. Let’s pick two beautiful handwriting fonts for a closer look.
Calligra
Section titled “Calligra”We load the font in the usual way:
\usepackage{calligra}To switch to the font, we can use the \calligra command in the text. As we know, local switching commands are valid until a surrounding environment or group, { … }, ends. It also works with our \pangram macro, like this:
\pangram{\calligra}This prints the following:

Figure 10.17 – The Calligra handwriting font
Figure 10.17 – The Calligra handwriting font
Capital letters look particularly lively and playful.
Miama Nueva
Section titled “Miama Nueva”The parts of letters that extend above the normal letter height are called ascenders, while those that drop below the baseline are called descenders. Miama Nueva is an elegant handwriting font with especially graceful ascenders and descenders. Load it as usual:
\usepackage{miama}Then, the \fmmfamily command switches to that font. Again, use it within a group, { … }, or an environment if you want to limit the font choice to just a piece of text. We can use our \pangram macro again:
\pangram{\fmmfamily}The writing is a pleasure to read:

Figure 10.18 – The Miama Nueva handwriting font
Figure 10.18 – The Miama Nueva handwriting font
Miama Nueva is very charming, for example, on invitation cards for weddings.
Probably the best place to browse LaTeX fonts is The LaTeX Font Catalogue. You can visit it online at https://www.tug.org/FontCatalogue. The site aims to present all freely available fonts for LaTeX. It’s based on TeX Live. It shows visual samples, the required code, and further useful information. Pick a category, browse the previews, and click a font to see some examples, usage notes, and the required code.
You can also use fonts that LaTeX doesn’t support directly, and that’s what we’ll look at next.
Writing with TrueType and OpenType system fonts
Section titled “Writing with TrueType and OpenType system fonts”LaTeX can also use many thousands of fonts that were never even prepared for LaTeX. That includes operating system fonts, TrueType fonts, and modern OpenType fonts.
Let’s try this with fonts available on a Microsoft Windows computer. For macOS users, we will look at an example afterward.
Selecting the main font
Section titled “Selecting the main font”We can either open Settings | Fonts through the Windows Start menu or look in the C:\Windows\Fonts folder to see the installed fonts. The Segoe UI font appears available with several names, so let’s choose Segoe UI Semilight. Let’s see how easy it is to use:
- Start a new document:
\documentclass{article}
- Load the
fontspecpackage, which provides the font selection commands:\usepackage{fontspec} - Set the main font:
\setmainfont{Segoe UI Semilight}
- Write the document body with some large text:
\begin{document}\largeThe quick brown fox jumps over the lazy dog. 1234567890\end{document}
- This time, choose either LuaLaTeX or XeLaTeX as the compiling engine. In TeXworks, this is a drop-down list right next to the Typeset button, as shown here:

Figure 10.19 – Selecting LuaLaTeX
Figure 10.19 – Selecting LuaLaTeX
- Compile, and see what we get:

Figure 10.20 – Segoe UI Semilight from Microsoft Windows 10
Figure 10.20 – Segoe UI Semilight from Microsoft Windows 10
That font selection was straightforward: load one package and use one command. Let’s now do it with multiple fonts in a document.
Selecting multiple font families
Section titled “Selecting multiple font families”Windows already comes with a number of fonts. We can pick a few in Settings | Fonts in the Windows Start menu, or by looking in the C:\Windows\Fonts folder. This time, we will choose the following:
- Cambria as the main serif font
- Segoe UI as the sans-serif font
- Lucida Console as the typewriter font
- Cambria Math as the math font
All of these are standard Windows fonts.
Let’s assemble a document that displays all four fonts:
- Start a new document and enter our
\pangrammacro again for easy testing:\documentclass{article}\newcommand{\pangram}[1]{{#1 The quick brown foxjumps over the lazy dog. 1234567890\par}} - Load the
fontspecpackage and theunicode-mathpackage. The latter lets us select the math font:\usepackage{fontspec}\usepackage{unicode-math} - Set the fonts as planned using an optional argument that automatically scales the fonts, so their lowercase letter height matches the main font’s lowercase letter height, as follows:
\setmainfont{Cambria}\setsansfont{Segoe UI}[Scale=MatchLowercase]\setmonofont{Lucida Console}[Scale=MatchLowercase]\setmathfont{Cambria Math}[Scale=MatchLowercase]
- Then, write a test document body again to view the available fonts:
\begin{document}\large\pangram{\rmfamily}\pangram{\sffamily}\pangram{\ttfamily}\[\int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}\sum_{i=1}^{n} f(x_i) \,\Delta x_i\]\end{document}
- Compile with LuaTeX or XeLaTeX, and take a look:

Figure 10.21 – Various Microsoft Windows fonts
Figure 10.21 – Various Microsoft Windows fonts
Cambria became the main text font, and whenever we switch to sans-serif, we get Segoe UI, and when we write code listings in typewriter font, Lucida Console appears. Also, math formulas are now printed in Cambria Math rather than the default Computer Modern font. This easy font selection is actually quite an evolution in LaTeX, and it’s worth considering LuaLaTeX or XeLaTeX just because of the extended font support. Both support OpenType and TrueType fonts, but neither works with pdfLaTeX yet.
XeLaTeX was developed with direct system-font access in mind, something pdfLaTeX doesn’t offer. LuaLaTeX was introduced as a LaTeX extension that added the Lua scripting language, and it has since gained better font support. Without dealing with their advanced features, we can simply choose one of them for fonts when we don’t have a package for pdfLaTeX.
Nowadays, XeLaTeX is less maintained, and it’s recommended to use LuaLaTeX.
Selecting a font locally
Section titled “Selecting a font locally”As promised earlier, we’ll also work with macOS. This time, let’s choose the Zapfino font, which is preinstalled in macOS. It’s a beautiful calligraphic font we’ll apply only to a specific piece of text, rather than changing the font for the entire document. Follow these steps:
- Start with a small document, just like in the previous sections. As before, make sure you load the
fontspecpackage:\usepackage{fontspec} - Define a new font family, with a name of your choice, and set it to
Zapfino:\newfontfamily{\calligraphicfont}{Zapfino} - Define a custom formatting macro, as we did in Chapter 2, Formatting Text and Creating Macros:
\newcommand{\calligraphic}[1]{{\calligraphicfont #1}}
- Now, you can use this command anywhere in your document text to format it calligraphically:
\calligraphic{A graceful Zapfino typography example}
- Check the output of this macro:

Figure 10.22 – Selecting a calligraphic font
Figure 10.22 – Selecting a calligraphic font
Here, ascenders and descenders are intentionally exaggerated to look more elegant. This change affects only the selected text.
Summary
Section titled “Summary”You now know how to choose and combine different text and math fonts, so your documents no longer have to rely on LaTeX’s default look.
We explored complete font sets, individual fonts, and several good font packages. For some advanced font techniques with ready-to-use examples, you can take a look at Chapter 3, Adjusting Fonts, in the LaTeX Cookbook, and visit the book’s website with online compilable code at https://latex-cookbook.net/chapter-03.
Now, let’s go from fonts back to LaTeX in general, and we will learn how to develop and manage larger documents in the next chapter.