Here are the Code examples 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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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.