How to Change Fonts in LaTeX (fontspec & packages)
To change fonts in LaTeX, load a font package like lmodern or newtxtext with pdfLaTeX, or use fontspec with XeLaTeX/LuaLaTeX to load any system OpenType font.
To change fonts in LaTeX, load a font package such as lmodern or newtxtext with the default pdfLaTeX engine, or use fontspec with XeLaTeX/LuaLaTeX to load any OpenType system font by name. The choice of engine decides your options: pdfLaTeX uses preinstalled font packages; XeLaTeX and LuaLaTeX can use the fonts on your computer. Here's how to do both.
1. Font packages with pdfLaTeX (portable)
\usepackage{lmodern} % Latin Modern (clean default)
% or:
\usepackage{newtxtext, newtxmath} % Times-like text + matching math
% or:
\usepackage{fourier} % Utopia-based
These work with the standard engine and travel anywhere, including arXiv. Always also load \usepackage[T1]{fontenc} for correct accented characters and copy-paste.
2. Any system font with fontspec
% compile with XeLaTeX or LuaLaTeX
\usepackage{fontspec}
\setmainfont{EB Garamond}
\setsansfont{Inter}
\setmonofont{JetBrains Mono}
fontspec loads OpenType/TrueType fonts by name — the only way to match a specific system font like Times New Roman or Arial. See How to Compile LaTeX Online for choosing the engine.
3. Local font changes
| Command | Effect |
|---|---|
| \textbf{} | Bold |
| \textit{} | Italic |
| \texttt{} | Monospace |
| \textsf{} | Sans-serif |
| \textsc{} | Small Caps |
| \emph{} | Emphasis (context-aware italic) |
4. Font size
{\small smaller} {\large larger} {\Huge biggest}
Sizes scale relative to the document's base (10pt, 11pt, 12pt class option). The full ladder: \tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, \LARGE, \huge, \Huge.
5. Restyle headings
\usepackage{titlesec}
\titleformat{\section}{\sffamily\Large\bfseries}{\thesection}{1em}{}
titlesec controls heading fonts and spacing — useful for a distinctive thesis or resume. Pair fonts with color for accents.
→ Switch fonts and engines, see the result instantly, in LetX.
Written by Shihab Shahriar Antor — AI Engineer & Founder of Shahriar Labs, maker of LetX.
Frequently Asked Questions
How do I use Times New Roman or Arial in LaTeX?
For a Times-like serif with pdfLaTeX, load \usepackage{newtxtext, newtxmath}, which gives Times-style text and matching math. For literal Times New Roman or Arial (system fonts), switch to XeLaTeX or LuaLaTeX and use fontspec: \setmainfont{Times New Roman} and \setmainfont{Arial}. pdfLaTeX can't load system fonts directly, which is why font matching to a Word document usually means switching engines.
What's the difference between font packages and fontspec?
Font packages (like lmodern, newtxtext, fourier) are preinstalled font sets you load with \usepackage, and they work with the default pdfLaTeX engine. fontspec is a package that lets XeLaTeX or LuaLaTeX load any OpenType or TrueType font installed on your system by name. Use a font package for portability and speed; use fontspec when you need a specific system font or advanced typographic features like real small caps and ligatures.
How do I change only the font of a heading or a single word?
For a single span, use the font commands: \textbf{bold}, \textit{italic}, \texttt{monospace}, \textsf{sans-serif}, and \textsc{Small Caps}. To restyle all headings, the titlesec package lets you set their font, e.g. \titleformat{\section}{\sffamily\Large\bfseries}{\thesection}{1em}{}. Changing the main document font globally is done once in the preamble; local commands handle one-off emphasis.