×

ShareLaTeX guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

In L a T e X the default font typeface is the Computer Modern family. You can change this font typeface for another that better suits your style.

Contents

Introduction

To change the fond typeface of the entire document, a simple line must be added to the preamble:

\documentclass{article}
\usepackage[utf8]{inputenc}
 
\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}

The line \usepackage{tgbonum} establishes the font family T e X Gyre Bonum , whose font package name is tgbonum , as the default font for this document.

Open an example in ShareLaTeX

Changing default font typeface

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

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{textwidth=7cm}
 
\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}

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

The popular L a T e X font typefaces are originated from four families:

  • Computer Modern (default in standard L a T e X 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
  • T e X Gyre

Open an example in ShareLaTeX

Reference guide

Roman, Sans Serif and Typewriter typefaces

Font "fontpackagename" "fontcode" Example
Computer Modern Roman cmr Typeface-cmr.png
Latin Modern Roman lmodern lmr Typeface-lmr.png
Latin Modern Dunhill lmodern lmdh Typeface-lmdh.png
T e X Gyre Termes tgtermes qtm Typeface-qtm.png
T e X Gyre Pagella tgpagella qpl Typeface-qpl.png
T e X Gyre Bonum tgbonum qbk Typeface-qbk.png
T e X Gyre Schola tgschola qcs Typeface-qsc.png
Times times 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
T e X Gyre Adventor tgadventor qag Typeface-qag.png
T e X 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
T e X Gyre Cursor tgcursor qcr Typeface-qcr.png
Courier courier pcr Typeface-pcr.png

Open an example in ShareLaTeX

Further reading

For more information see: