Aller au contenu

Introduction

By default, LaTeX typesets documents using the \(\text{Computer Modern}\) typeface family but you can use LaTeX packages to use different fonts according to your needs or preferences.

Changing the default document fonts

For example, by adding \usepackage{tgbonum} to the document preamble, LaTeX will use the TEX Gyre Bonum font family to typeset your document:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tgbonum}

\begin{document}
This document is a sample document to test font 
families and font typefaces.

This text uses a different font typeface
\end{document}

 Open this example in Overleaf

The following image shows the output produced by the example above:

FontTypefacesEx1OLV2.png

Changing default font typeface

The font can also be changed for a specific element in the document.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tgbonum}

\begin{document}
This document is a sample document to 
test font families and font typefaces.

{\fontfamily{qcr}\selectfont
This text uses a different font typeface
}
\end{document}

 Open this example in Overleaf

The following image shows the output produced by the example above:

FontTypefacesEx2.png

The command \fontfamily{qcr}\selectfont will set the TeX gyre cursor font typeface, whose fontcode is qcr, for the text inside the braces. A lot more LaTeX font typefaces are available, see the reference guide.

The popular LaTeX font typefaces are originated from four families:

  • Computer Modern (default in standard LaTeX classes): CM Roman, CM Sans Serif, CM Typewriter
  • Latin Modern: LM Roman, LM Sans Serif, LM Typewriter, LM Dunhill
  • Post Script Fonts: Times, Utopia/Fourier, Palatino, Bookman, Helvetica, Courier
  • TeX Gyre

Reference guide

Roman, Sans Serif and Typewriter typefaces

Font "font package name" "font code" Example
Computer Modern Roman cmr Typeface-cmr.png
Latin Modern Roman lmodern lmr Typeface-lmr.png
Latin Modern Dunhill lmodern lmdh Typeface-lmdh.png
TeX Gyre Termes tgtermes qtm Typeface-qtm.png
TeX Gyre Pagella tgpagella qpl Typeface-qpl.png
TeX Gyre Bonum tgbonum qbk Typeface-qbk.png
TeX Gyre Schola tgschola qcs Typeface-qsc.png
Times mathptmx ptm Typeface-ptm.png
Utopia / Fourier utopia / fourier put Typeface-put.png
Palatino palatino ppl Typeface-ppl.png
Bookman bookman pbk Typeface-pbk.png
Charter charter bch Typeface-bch.png
Computer Modern Sans Serif cmss Typeface-cmss.png
Latin Modern Sans Serif lmodern lmss Typeface-lmss.png
TeX Gyre Adventor tgadventor qag Typeface-qag.png
TeX Gyre Heros tgheros qhv Typeface-qhv.png
Helvetica helvet phv Typeface-phv.png
Computer Modern Typewriter cmtt Typeface-cmtt.png
Latin Modern Sans Typewriter lmodern lmtt Typeface-lmtt.png
TeX Gyre Cursor tgcursor qcr Typeface-qcr.png
Courier courier pcr Typeface-pcr.png

See also The LaTeX Font Catalogue, though not that not all fonts listed in the catalogue is distributed with a license that allows it to be distributed as part of TeX Live, and therefore not all those fonts are available on Overleaf.

Further reading

For more information see:

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX