> ## Documentation Index
> Fetch the complete documentation index at: https://resources.latex-cloud-studio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LaTeX Fonts Guide: Change Font Family, Size, and System Fonts

> Learn how to change fonts in LaTeX with pdfLaTeX, XeLaTeX, and LuaLaTeX. Covers font families, fontspec, system fonts, and font packages.

If you want to change the font in LaTeX, the right method depends on your compiler. Use font packages such as `lmodern` or `newtxtext` with pdfLaTeX, and use `fontspec` with XeLaTeX or LuaLaTeX when you want system fonts such as Times New Roman, Arial, or EB Garamond.

<Info>
  **Quick answer**: use pdfLaTeX with font packages for traditional LaTeX workflows, and use XeLaTeX or LuaLaTeX with `fontspec` when you need system fonts or modern OpenType features.

  **Related topics**: [Text formatting](/learn/latex/text-formatting) | [Document classes](/learn/reference/document-classes) | [Choosing a compiler](/learn/latex/basics/choosing-compiler)
</Info>

## How to Change the Font in LaTeX

| Goal                                                    | Recommended approach                                              |
| ------------------------------------------------------- | ----------------------------------------------------------------- |
| Use a better default serif/sans/mono font with pdfLaTeX | Load a font package such as `lmodern`, `newtxtext`, or `mathpazo` |
| Use fonts installed on your computer                    | Compile with XeLaTeX or LuaLaTeX and load `fontspec`              |
| Keep math fonts consistent with text fonts              | Choose a matching text + math package pair                        |
| Improve spacing and justification                       | Add `microtype`                                                   |

## Font Basics

### The Three Font Attributes

LaTeX fonts have three independent attributes:

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex font-attributes.tex theme={null}
      \documentclass{article}
      \begin{document}

      % Family (shape of letters)
      \textrm{Roman family (serif)}
      \textsf{Sans serif family}
      \texttt{Typewriter family (monospace)}

      % Series (weight/width)
      \textmd{Medium series (normal)}
      \textbf{Bold series}

      % Shape (slant/style)
      \textup{Upright shape}
      \textit{Italic shape}
      \textsl{Slanted shape}
      \textsc{Small Caps Shape}

      \end{document}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-paragraph">Roman family (serif)</p>
        <p className="latex-preview-paragraph latex-preview-sans">Sans serif family</p>
        <p className="latex-preview-paragraph latex-preview-mono">Typewriter family (monospace)</p>
        <p className="latex-preview-paragraph">Medium series (normal)</p>
        <p className="latex-preview-paragraph"><strong>Bold series</strong></p>
        <p className="latex-preview-paragraph"><em>Italic shape</em></p>
        <p className="latex-preview-paragraph latex-preview-smallcaps">Small Caps Shape</p>
      </div>
    </div>
  </Tab>
</Tabs>

### Combining Font Attributes

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex combining-fonts.tex theme={null}
      % All combinations work
      \textsf{\textbf{Sans serif bold}}
      \texttt{\textit{Typewriter italic}}
      \textrm{\textbf{\textit{Roman bold italic}}}
      \textsc{\textbf{Bold Small Caps}}

      % Using declarations
      {\sffamily\bfseries\itshape Sans serif bold italic}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-paragraph latex-preview-sans"><strong>Sans serif bold</strong></p>
        <p className="latex-preview-paragraph latex-preview-mono"><em>Typewriter italic</em></p>
        <p className="latex-preview-paragraph"><strong><em>Roman bold italic</em></strong></p>
        <p className="latex-preview-paragraph latex-preview-smallcaps"><strong>Bold Small Caps</strong></p>
        <p className="latex-preview-paragraph latex-preview-sans"><strong><em>Sans serif bold italic</em></strong></p>
      </div>
    </div>
  </Tab>
</Tabs>

## Font Packages (pdfLaTeX)

### Popular Font Packages

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex font-packages.tex theme={null}
      \documentclass{article}

      % Times-like fonts
      \usepackage{mathptmx}  % Times with math support
      % or
      \usepackage{newtxtext,newtxmath}  % New TX fonts

      % Palatino-like fonts
      \usepackage{mathpazo}  % Palatino with math
      % or
      \usepackage{newpxtext,newpxmath}  % New PX fonts

      % Computer Modern variants
      \usepackage{lmodern}   % Latin Modern
      \usepackage{cm-super}  % CM Super

      % Sans serif as default
      \usepackage{helvet}
      \renewcommand{\familydefault}{\sfdefault}

      % Other popular choices
      \usepackage{fourier}   % Utopia
      \usepackage{libertine} % Linux Libertine
      \usepackage{kpfonts}   % KP Fonts

      \begin{document}
      Your text here...
      \end{document}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper">
        <p className="latex-preview-label">Times-like</p>
        <p className="latex-preview-paragraph">A traditional serif look for papers and reports.</p>
        <p className="latex-preview-label">Palatino-like</p>
        <p className="latex-preview-paragraph" style={{ letterSpacing: "0.01em" }}>A wider, more bookish serif with generous proportions.</p>
        <p className="latex-preview-label">Sans default</p>
        <p className="latex-preview-paragraph latex-preview-sans">A cleaner screen-oriented sans serif voice.</p>
        <p className="latex-preview-label">Monospace</p>
        <p className="latex-preview-paragraph latex-preview-mono">Code examples stay aligned in a fixed-width face.</p>
      </div>
    </div>
  </Tab>
</Tabs>

### Font Package Comparison

| Package     | Style     | Math Support | Use Case            |
| ----------- | --------- | ------------ | ------------------- |
| `lmodern`   | Modern    | Yes          | Default improvement |
| `mathptmx`  | Times     | Yes          | Traditional papers  |
| `helvet`    | Helvetica | No           | Modern look         |
| `mathpazo`  | Palatino  | Yes          | Books, elegant      |
| `libertine` | Libertine | Yes          | Professional        |
| `fourier`   | Utopia    | Yes          | Technical docs      |

## System Fonts (XeLaTeX/LuaLaTeX)

### Using System Fonts

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex system-fonts.tex theme={null}
      \documentclass{article}
      \usepackage{fontspec}

      % Set main font
      \setmainfont{Times New Roman}
      \setsansfont{Arial}
      \setmonofont{Consolas}

      % With options
      \setmainfont{Georgia}[
        BoldFont = Georgia Bold,
        ItalicFont = Georgia Italic,
        BoldItalicFont = Georgia Bold Italic
      ]

      % Alternative syntax
      \setmainfont[
        Ligatures=TeX,
        Numbers=OldStyle,
        Scale=1.0
      ]{Minion Pro}

      \begin{document}
      This document uses system fonts directly!
      \end{document}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper">
        <p className="latex-preview-title">This document uses system fonts directly!</p>
        <p className="latex-preview-paragraph">Times New Roman can serve as the main text face, Arial as the sans family, and Consolas as the monospaced font in one compiled PDF.</p>
        <p className="latex-preview-paragraph latex-preview-sans">Sans text uses the system-installed sans font.</p>
        <p className="latex-preview-paragraph latex-preview-mono">Monospace text uses the configured code face.</p>
      </div>
    </div>
  </Tab>
</Tabs>

### Font Selection by Name

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex font-by-name.tex theme={null}
      \documentclass{article}
      \usepackage{fontspec}

      % Define custom font commands
      \newfontfamily\headingfont{Helvetica Neue}
      \newfontfamily\specialfont{Zapfino}
      \newfontfamily\codefont{Source Code Pro}

      \begin{document}

      {\headingfont\Large This is a heading in Helvetica Neue}

      Regular text in the main font.

      {\specialfont Special decorative text}

      {\codefont\small Code examples in Source Code Pro}

      \end{document}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper">
        <p className="latex-preview-title latex-preview-sans" style={{ textAlign: "left" }}>This is a heading in Helvetica Neue</p>
        <p className="latex-preview-paragraph">Regular text in the main font.</p>
        <p className="latex-preview-paragraph" style={{ fontStyle: "italic", fontSize: "1.08rem" }}>Special decorative text</p>
        <p className="latex-preview-paragraph latex-preview-mono latex-preview-size-small">Code examples in Source Code Pro</p>
      </div>
    </div>
  </Tab>
</Tabs>

## Font Features

### OpenType Features (XeLaTeX/LuaLaTeX)

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex opentype-features.tex theme={null}
      \documentclass{article}
      \usepackage{fontspec}

      \setmainfont{EB Garamond}[
        Ligatures={Common, Rare},
        Numbers=OldStyle,
        Contextuals=Alternate,
        Style=Historic
      ]

      % Specific features
      \newfontfamily\displayfont{Adobe Garamond Pro}[
        Numbers={Proportional,OldStyle},
        Letters=SmallCaps,
        Ligatures={Common,Discretionary}
      ]

      \begin{document}

      % Ligatures
      Office, shelf, affiliate (fi, fl, ffi ligatures)

      % Old style numbers
      Regular: 0123456789 vs {\addfontfeatures{Numbers=OldStyle}0123456789}

      % Small caps
      {\scshape Small Capitals Text}

      % Stylistic sets
      {\addfontfeatures{StylisticSet=1}Stylistic Variant}

      \end{document}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper">
        <p className="latex-preview-paragraph">Office, shelf, affiliate</p>
        <p className="latex-preview-paragraph">Regular: 0123456789</p>
        <p className="latex-preview-paragraph" style={{ fontVariantNumeric: "oldstyle-nums" }}>Old style: 0123456789</p>
        <p className="latex-preview-paragraph latex-preview-smallcaps">Small Capitals Text</p>
        <p className="latex-preview-paragraph">Stylistic Variant</p>
      </div>
    </div>
  </Tab>
</Tabs>

### Microtype Package

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex microtype.tex theme={null}
      \documentclass{article}
      \usepackage{microtype}

      % Full features (pdfLaTeX)
      \usepackage[
        protrusion=true,
        expansion=true,
        tracking=true,
        kerning=true,
        spacing=true
      ]{microtype}

      % Fine-tuning
      \microtypesetup{
        protrusion={true,alltext},
        expansion={true,alltext,compat}
      }

      \begin{document}
      Microtype improves typography through:
      \begin{itemize}
      \item Character protrusion (margin kerning)
      \item Font expansion (better justification)
      \item Tracking (letter spacing)
      \item Additional kerning
      \end{itemize}

      The improvements are subtle but create more professional results.
      \end{document}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-paragraph">Microtype improves typography through character protrusion, font expansion, tracking, and better justification. The effect is subtle in code, but it makes the final paragraph color look smoother and more even.</p>

        <ul className="latex-preview-list">
          <li>Character protrusion (margin kerning)</li>
          <li>Font expansion (better justification)</li>
          <li>Tracking and additional kerning</li>
        </ul>
      </div>
    </div>
  </Tab>
</Tabs>

## Font Sizes

### Changing Font Size

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex font-sizes.tex theme={null}
      \documentclass[12pt]{article}  % Base size: 10pt, 11pt, or 12pt

      % Exact sizes
      \fontsize{14}{17}\selectfont  % 14pt font, 17pt baseline
      This text is exactly 14 points.

      % Relative sizes
      {\tiny Tiny text (5pt at 10pt base)}
      {\small Small text (9pt at 10pt base)}
      {\large Large text (12pt at 10pt base)}
      {\Huge Huge text (25pt at 10pt base)}

      % Custom size commands
      \newcommand{\customsize}{\fontsize{13}{16}\selectfont}
      {\customsize Custom 13pt text}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-size-small">Tiny text sample</p>
        <p className="latex-preview-size-small">Small text sample</p>
        <p>Normal text sample</p>
        <p className="latex-preview-size-large">Large text sample</p>
        <p className="latex-preview-size-huge">Huge text sample</p>
        <p style={{ fontSize: "0.98rem" }}>Custom 13pt text</p>
      </div>
    </div>
  </Tab>
</Tabs>

### Size Commands Reference

| Command         | 10pt Article | 11pt Article | 12pt Article |
| --------------- | ------------ | ------------ | ------------ |
| `\tiny`         | 5pt          | 6pt          | 6pt          |
| `\scriptsize`   | 7pt          | 8pt          | 8pt          |
| `\footnotesize` | 8pt          | 9pt          | 10pt         |
| `\small`        | 9pt          | 10pt         | 10.95pt      |
| `\normalsize`   | 10pt         | 10.95pt      | 12pt         |
| `\large`        | 12pt         | 12pt         | 14.4pt       |
| `\Large`        | 14.4pt       | 14.4pt       | 17.28pt      |
| `\LARGE`        | 17.28pt      | 17.28pt      | 20.74pt      |
| `\huge`         | 20.74pt      | 20.74pt      | 24.88pt      |
| `\Huge`         | 24.88pt      | 24.88pt      | 24.88pt      |

## Mathematical Fonts

### Math Font Packages

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex math-fonts.tex theme={null}
      % Matching text and math fonts
      \usepackage{mathptmx}     % Times
      \usepackage{mathpazo}     % Palatino
      \usepackage{fourier}      % Utopia
      \usepackage{newtxmath}    % Times (modern)
      \usepackage{newpxmath}    % Palatino (modern)
      \usepackage{eulervm}      % Euler math
      \usepackage{stix2}        % STIX fonts

      % Math alphabets
      \usepackage{amsfonts}
      \usepackage{amssymb}
      \usepackage{mathrsfs}     % \mathscr
      \usepackage{bbm}          % \mathbbm

      % Usage
      $\mathbb{R}$, $\mathcal{A}$, $\mathscr{L}$, $\mathfrak{g}$
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-paragraph">ℝ, 𝒜, ℒ, 𝔤</p>
        <p className="latex-preview-paragraph">Matching text and math font packages make formulas feel native to the surrounding paragraph instead of visually detached.</p>
      </div>
    </div>
  </Tab>
</Tabs>

### Unicode Math (XeLaTeX/LuaLaTeX)

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex unicode-math.tex theme={null}
      \documentclass{article}
      \usepackage{unicode-math}

      % Set math font
      \setmathfont{XITS Math}
      % or
      \setmathfont{Latin Modern Math}
      % or
      \setmathfont{TeX Gyre Termes Math}

      % With options
      \setmathfont{Cambria Math}[
        Scale=MatchLowercase,
        math-style=ISO,
        bold-style=ISO
      ]

      \begin{document}
      Unicode math allows: $α + β = γ$ and $∫_0^∞ e^{-x²} dx = \frac{√π}{2}$
      \end{document}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-paragraph">Unicode math allows: α + β = γ and ∫₀^∞ e<sup>-x²</sup> dx = √π / 2</p>
        <p className="latex-preview-footnote">With <span className="latex-preview-inline-code">unicode-math</span>, the text and mathematical glyphs come from the same modern OpenType ecosystem.</p>
      </div>
    </div>
  </Tab>
</Tabs>

## Special Typography

### Drop Caps

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex drop-caps.tex theme={null}
      \documentclass{article}
      \usepackage{lettrine}
      \begin{document}

      \lettrine[lines=3]{O}{nce upon a time}, in a land far away, 
      there lived a typographer who loved beautiful drop caps. 
      This elegant initial letter adds a classic touch to the 
      beginning of chapters or sections.

      \lettrine[lines=2,loversize=0.1]{T}{his} is a smaller drop cap.

      \end{document}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-paragraph latex-preview-dropcap">Once upon a time, in a land far away, there lived a typographer who loved beautiful drop caps. This elegant initial letter adds a classic touch to the beginning of chapters or sections.</p>
        <p className="latex-preview-paragraph latex-preview-dropcap">This is a smaller drop cap.</p>
      </div>
    </div>
  </Tab>
</Tabs>

### Custom Fonts for Special Text

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex special-fonts.tex theme={null}
      \documentclass{article}
      \usepackage{fontspec}  % XeLaTeX/LuaLaTeX

      % Define special purpose fonts
      \newfontfamily\chapterfont{Bebas Neue}
      \newfontfamily\quotefont{Crimson Text}[Scale=1.1]
      \newfontfamily\emojifont{Apple Color Emoji}  % or Noto Color Emoji

      \begin{document}

      {\chapterfont\Huge Chapter One}

      {\quotefont\itshape "Beautiful typography is invisible, 
      yet it shapes how we perceive the written word."}

      {\emojifont 😊 📚 ✨}  % Emoji support!

      \end{document}
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper">
        <p className="latex-preview-title latex-preview-sans" style={{ textAlign: "left", letterSpacing: "0.04em" }}>Chapter One</p>
        <p className="latex-preview-paragraph" style={{ fontStyle: "italic", fontSize: "1.1rem" }}>"Beautiful typography is invisible, yet it shapes how we perceive the written word."</p>
        <p className="latex-preview-paragraph latex-preview-size-large">😊 📚 ✨</p>
      </div>
    </div>
  </Tab>
</Tabs>

## Font Troubleshooting

### Common Issues and Solutions

<Tabs>
  <Tab title="Code">
    <CodeGroup>
      ```latex font-fixes.tex theme={null}
      % Font not found (XeLaTeX/LuaLaTeX)
      \setmainfont{Arial}[
        Extension = .ttf,
        Path = /path/to/fonts/,
        UprightFont = *-Regular,
        BoldFont = *-Bold,
        ItalicFont = *-Italic
      ]

      % Missing characters
      \usepackage{textcomp}  % Additional symbols
      \usepackage[T1]{fontenc}  % Better encoding

      % Font substitution warnings
      \usepackage{silence}
      \WarningFilter{latexfont}{Font shape}

      % Check available fonts (XeLaTeX/LuaLaTeX)
      % Run in terminal: fc-list : family
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-label">Successful font setup</p>
        <p className="latex-preview-paragraph">Main text renders in the requested font, accented characters display correctly, and bold/italic variants resolve without substitution warnings.</p>

        <ul className="latex-preview-list">
          <li>Arial Regular, Bold, and Italic loaded</li>
          <li>T1 encoding covers additional glyphs</li>
          <li>Missing-font warnings filtered from noisy logs</li>
        </ul>
      </div>
    </div>
  </Tab>
</Tabs>

## Best Practices

<Tip>
  **Font guidelines:**

  1. **Consistency**: Use maximum 2-3 font families per document
  2. **Readability**: Test fonts at actual reading size
  3. **Purpose**: Match font to document type (serif for print, sans for screen)
  4. **Licensing**: Ensure fonts are properly licensed
  5. **Fallbacks**: Provide alternatives for missing fonts
  6. **Testing**: Check output on different systems/viewers
</Tip>

## Font Comparison

<CardGroup cols={2}>
  <Card title="For Traditional Documents" icon="file-alt">
    * Times (mathptmx)
    * Palatino (mathpazo)
    * Computer Modern (default)
    * Latin Modern (lmodern)
  </Card>

  <Card title="For Modern Documents" icon="laptop">
    * Helvetica (helvet)
    * Open Sans
    * Source Sans Pro
    * Roboto
  </Card>

  <Card title="For Technical Documents" icon="cog">
    * Computer Modern
    * STIX Two
    * Libertinus
    * KP Fonts
  </Card>

  <Card title="For Books" icon="book">
    * Minion Pro
    * Sabon
    * Garamond
    * Baskerville
  </Card>
</CardGroup>

## Quick Reference

| Task         | pdfLaTeX                                    | XeLaTeX/LuaLaTeX                  |
| ------------ | ------------------------------------------- | --------------------------------- |
| Times font   | `\usepackage{mathptmx}`                     | `\setmainfont{Times New Roman}`   |
| Sans default | `\renewcommand{\familydefault}{\sfdefault}` | `\setmainfont{Arial}`             |
| Math fonts   | `\usepackage{newtxmath}`                    | `\usepackage{unicode-math}`       |
| Custom font  | Use packages                                | `\newfontfamily\myfont{FontName}` |

***

<Info>
  **Next**: Learn about [Mathematical equations](/learn/latex/mathematics/equations) to create complex mathematical expressions with proper formatting.
</Info>
