Chapter 10 – Using Fonts

Here are the Code examples of of this chapter. You can compile them online right on this web page by pressing the Typeset / Compile button. You can also edit them for testing, and compile again.

For a better view with the online compiler, I sometimes use \documentclass[border=10pt]{standalone} instead of \documentclass{article}. Instead of having a big letter/A4 page, the standalone class crops the paper to see just the visible text without an empty rest of a page.

Any question about a code example? Post it on LaTeX.org, I will answer. As forum admin I read every single question there. (profile link).

Using comprehensive font bundles

Latin Modern – a replacement for the standard font

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
\large
\pangram{\rmfamily}
\pangram{\sffamily}
\pangram{\ttfamily}
\pangram{\itshape}
\pangram{\slshape}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.1



Kp-Fonts – another full set of fonts

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}
\begin{document}
\large
\pangram{\rmfamily}
\pangram{\sffamily}
\pangram{\ttfamily}
\pangram{\itshape}
\pangram{\slshape}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.2



Kepler font as light version

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage[light]{kpfonts}
\begin{document}
\large
\pangram{\rmfamily}
\pangram{\sffamily}
\pangram{\ttfamily}
\pangram{\itshape}
\pangram{\slshape}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.3



Times Roman

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{newtxtext}
\usepackage{newtxmath}
\begin{document}
\large
\pangram{\rmfamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.4



Palatino

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{newpxtext}
\usepackage{newpxmath}
\begin{document}
\large
\pangram{\rmfamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.5



Charter

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage[charter]{mathdesign}
\begin{document}
\large
\pangram{\rmfamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.6



New Century Schoolbook

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{newcent}
\usepackage{fouriernc}
\begin{document}
\large
\pangram{\rmfamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.7



Concrete Roman

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{concrete}
\usepackage{concmath}
\begin{document}
\large
\pangram{\rmfamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.8



Bookman / Kerkis

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{kmath}
\usepackage{kerkis}
\begin{document}
\large
\pangram{\rmfamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.9



Sans-serif fonts

Arev

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{arev}
\begin{document}
\large
\pangram{\sffamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.10



Computer Modern Bright

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\begin{document}
\large
\pangram{\sffamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.11



Kurier

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage[math]{kurier}
\begin{document}
\large
\pangram{\sffamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.12



Helvetica

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage[scaled=0.95]{helvet}
\usepackage{sfmath}
\begin{document}
\large
\pangram{\sffamily}
\[
  \int_a^b \! f(x) \, dx = \lim_{\Delta x \rightarrow 0}
  \sum_{i=1}^{n} f(x_i) \,\Delta x_i
\]
\end{document}

figure

Figure 10.13



Typewriter fonts

Courier

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{courier}
\begin{document}
\large
\pangram{\ttfamily}
\end{document}

figure

Figure 10.14



Inconsolata

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{inconsolata}
\begin{document}
\large
\pangram{\ttfamily}
\end{document}

figure

Figure 10.15



Bera Mono

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{beramono}
\begin{document}
\large
\pangram{\ttfamily}
\end{document}

figure

Figure 10.16



Calligraphic fonts

Calligra

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{calligra}
\begin{document}
\large
\pangram{\calligra}
\end{document}

figure

Figure 10.17



Miama Nueva

\documentclass[preview,border=10pt]{standalone}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage[T1]{fontenc}
\usepackage{miama}
\begin{document}
\large
\pangram{\fmmfamily}
\end{document}

figure

Figure 10.18



Using arbitrary fonts

The remaining examples can run on Windows computers with the fonts installed, not here on the web site.

Selecting the main font

% !TEX none
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Segoe UI Semilight}
\begin{document}
\large
The quick brown fox jumps over the lazy dog. 1234567890
\end{document}

figure

Figure 10.20



Selecting multiple font families

% !TEX none
\documentclass{article}
\newcommand{\pangram}[1]{{#1 The quick brown fox jumps over
  the lazy dog. 1234567890\par}}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{Cambria}
\setsansfont{Segoe UI}[Scale=MatchLowercase]
\setmonofont{Lucida Console}[Scale=MatchLowercase]
\setmathfont{Cambria Math}[Scale=MatchLowercase]

\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}

figure

Figure 10.21



This code is available on Github. It is licensed under the MIT License, a short and simple permissive license with conditions only requiring preservation of copyright and license notices.

Go to next chapter.