Document Fundamentals

Fonts

Learn about font families, emphasizing text, font styles, sizing text, and using alternative fonts in LaTeX.

Font Families

There are hundreds—if not thousands—of typefaces, or font families. Common examples include Times, Courier, and Helvetica. These families can generally be grouped into three main categories: serif, sans serif, and monospaced. LaTeX commands generally refer to these with the shorthand rm, sf, and tt respectively.

By default, LaTeX uses Computer Modern, a family of typefaces designed by Donald Knuth for use with TeX. It contains serif, sans serif, and monospaced fonts, each available in several weights and optical sizes.

The bodies of LaTeX documents are set in Roman (serif) type by default, but this can be changed by setting the family default:

\renewcommand{\familydefault}{<family>}

where <family> is any of the following:

  • \rmdefault
  • \sfdefault
  • \ttdefault

Emphasizing Text

TeX recognizes two types of markup commands:

  • Semantic - \emph{text} — by default italicise font. Can be overwritten by \renewcommand\emph{\textbf}.
  • Visual - which actually applies required formatting:
    • Family - \textrm{} \textsf{} \texttt{}
    • Weight - \textbf{} - bold, \textmd{} - medium
    • Shape - \textup{}, \textit{}, \textsl{}

To add some emphasis to a word or a phrase, use the \emph{text} command:

I want to \emph{emphasize} a word.

The command is dynamic: if you emphasize a word which is already in an emphasized sentence, it will be reverted to the upright font:

\emph{In this emphasized sentence, there is an emphasized \emph{word} which looks upright.}

Text may be emphasized more heavily through the use of boldface:

\textbf{Bold text} may be used to heavily emphasize very important words or phrases.

Warning: Do not overuse emphasis in your paragraphs. Emphasis should be reserved for key terms or other particularly important concepts in a text, and bold text especially used minimally.

Font Styles

Typefaces usually come in various styles and weights, such as italic and bold. The following table lists the commands you will need to access typical font shapes:

LaTeX commandEquivalent switchOutput style
\textnormal{…}{\normalfont …}document font family
\emph{…}{\em …}emphasis (typically italics)
\textrm{…}{\rmfamily …}roman font family
\textsf{…}{\sffamily …}sans serif font family
\texttt{…}{\ttfamily …}teletype/monospace font
\textup{…}{\upshape …}upright shape
\textit{…}{\itshape …}italic shape
\textsl{…}{\slshape …}slanted shape
\textsc{…}{\scshape …}Small Capitals
\uppercase{…}uppercase (all caps)
\textbf{…}{\bfseries …}bold
\textmd{…}{\mdseries …}medium weight

Generally, one should prefer the commands over their equivalent switches because the former automatically corrects spacing immediately following the end of the selected style.

Note: Underlining is available via the \underline{…} command, but text underlined in this way will not break properly. Instead, use the \ul{…} command from the soul package or \uline{…} command from the ulem package. Both packages also provide strikethrough text with \st{…} or \sout{…}, respectively.

Sizing Text

Built-in Sizes

To scale text relative to the default body text size:

CommandDescription
\tinyVery small
\scriptsizeScript size
\footnotesizeFootnote size
\smallSmall
\normalsizeNormal
\largeLarge
\LargeLarger
\LARGEEven larger
\hugeHuge
\HugeLargest

These commands change the size within a given scope. For instance {\Large some words} will change the size of only some words:

{\Large\tableofcontents}

By default, \normalsize is 10 points, but this can be changed in the \documentclass declaration, e.g. \documentclass[12pt]{article}.

Arbitrary Sizes

The \tiny...\Huge` commands are often enough for your needs, but you may occasionally want an arbitrary font size:

\fontsize{5cm}{5.5cm}\selectfont

sets the current font size to 5cm with 5.5 centimeter leading.

Note: If you are using lualatex or xelatex, you get automatic scaling. If you use latex or pdflatex, you may get a warning about unsupported sizes since these engines only support a fixed set of sizes.

Using Alternative Fonts

Using TTF and OTF Fonts

If you are using lualatex or xelatex, you can use TTF and OTF fonts with the fontspec package:

\documentclass{article}

\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Georgia}
\setsansfont[Ligatures=TeX]{Arial}

\begin{document}
Lorem ipsum...
\end{document}

The [Ligatures=TeX] option allows you to use the standard TeX ligatures instead of Unicode characters that are unlikely to be on your keyboard.

Selecting Font Files

Different weights and styles of a given typeface are usually stored as separate font files. We can hand-pick weights:

\usepackage{fontspec}
\setmainfont[
    Ligatures=TeX,
    UprightFont = *-Boo,
    ItalicFont = *-BooObl,
    SmallCapsFont = *SC-Boo,
    BoldFont = *-Dem,
    BoldItalicFont = *-DemObl
]{Futura}

Controlling Font Features

The OpenType (OTF) format allows type designers to embed font features that can be turned on and off, such as:

  • Alternate versions of glyphs
  • Lining and "oldstyle" figures
  • Up to three sets of ligatures: standard, contextual, and historical
  • Superscript and subscript glyphs
  • Small caps
\setmainfont[
    Ligatures=TeX,
    Numbers={OldStyle, Proportional}
]{Linux Libertine}

Features can be turned on and off using \addfontfeatures{...}:

{\addfontfeatures{Numbers={Lining, Tabular} }
    \begin{tabular}{l r}
        Widgets: & 25 \\
        Gadgets: & 6 \\
        Whatsits & 24 \\
    \end{tabular}
} % Return to previous figure style

Changing Fonts in latex and pdflatex

If you are not using one of the Unicode-aware engines, font selection is more complicated. Useful resources include:

Font Encoding

Unicode

Today, text is usually represented in computer systems using Unicode. LuaLaTeX and XeLaTeX use these tools to render Unicode-encoded input files into PDF documents.

TeX Encodings

The original TeX and LaTeX use a very different scheme. When using latex or pdflatex, you must choose an input encoding and an output encoding. The default font encoding is OT1.

To overcome shortcomings of OT1, use T1 encoding:

\usepackage[T1]{fontenc}
\usepackage{lmodern}

Warning: If after using T1 you find yourself with very low quality fonts, install either cm-super or lmodern.

PDF Fonts and Properties

PDF documents have the capability to embed font files. Many PDF viewers have a Properties feature to list embedded fonts and document metadata.

Many Unix systems make use of the poppler tool set which features pdfinfo to list PDF metadata, and pdffonts to list embedded fonts.

Copyright © 2026