Skip to main content
v2026.11,986 entries · CC-BY 4.0

Default Font in LaTeX: Computer Modern and How to Change It

The default LaTeX font is Computer Modern. See the macros that define it and how to change it under pdfLaTeX or fontspec.

Written and maintained by CASRAI Editorial Board

Published · Last updated

On this page

Short answer: the default font in LaTeX is Computer Modern. The main body text uses the roman family cmr, the sans-serif family is cmss and the typewriter family is cmtt. The body font is whatever \rmdefault names, so changing that one macro (or loading a font package) changes the whole document. This guide is for researchers and thesis writers who need to know what LaTeX uses out of the box, where that choice is defined, and how to replace it under pdfLaTeX, XeLaTeX or LuaLaTeX.

What the default font in LaTeX is used for in research writing

Journals, funders and universities often specify a typeface for manuscripts and theses, and most LaTeX templates inherit the default unless the class or a package overrides it. Knowing the default lets you tell whether a font you see in a PDF comes from your own preamble, from a template, or from LaTeX itself.

Per Overleaf’s Font typefaces article (read 2026-11-08), LaTeX typesets documents with the Computer Modern typeface family by default. The same default is why the question appears under several wordings, including latex font default, latex default font and default latex font: they all point to the same set of macros described below.

Where the default is defined

The LaTeX Project’s LaTeX2e font selection guide (fntguide.pdf, read 2026-11-08) defines the defaults through a small set of macros. The table below restates what that guide says.

Role Macro that names the default family Default family How to override
Roman (main text, \textrm, \rmfamily) \rmdefault Computer Modern Roman (cmr) \renewcommand{\rmdefault}{ptm}
Sans serif \sfdefault Computer Modern Sans (cmss) \renewcommand{\sfdefault}{phv}
Typewriter \ttdefault Computer Modern Typewriter (cmtt) \renewcommand{\ttdefault}{pcr}
Main body font family \familydefault \rmdefault Change \rmdefault, or redefine \familydefault

The guide also states that \encodingdefault, \familydefault, \seriesdefault and \shapedefault set the encoding, family, series and shape of the main body font, and that by default these are OT1, \rmdefault, m and n. Because the default family is \rmdefault, changing \rmdefault changes the main body font. The Computer Modern roman family for the OT1 encoding is described in the font definition file ot1cmr.fd.

The guide’s own example, \renewcommand{\rmdefault}{ptm}, \renewcommand{\sfdefault}{phv} and \renewcommand{\ttdefault}{pcr}, sets Times, Helvetica and Courier as the three defaults. Font packages such as times do this kind of substitution for you by loading other fonts.

How to install or access it

Computer Modern needs no installation: it is the default. Alternatives come from your TeX distribution or from Overleaf, which provides the packages used in its own examples. Package documentation is hosted on CTAN, the Comprehensive TeX Archive Network. For the XeLaTeX and LuaLaTeX route, the fontspec manual is on CTAN at mirrors.ctan.org/macros/unicodetex/latex/fontspec/fontspec.pdf (read 2026-11-08).

Step-by-step: change the default font

Option A: pdfLaTeX with a font package

  1. Compile with pdfLaTeX (see How to Compile LaTeX if you are unsure which engine your editor uses).
  2. In the preamble, load fontenc before the font package: \usepackage[T1]{fontenc}. Overleaf’s examples load fontenc first.
  3. Load a font package. Overleaf shows \usepackage{tgbonum} for TeX Gyre Bonum, and the lmodern package for the Latin Modern faces (lmr Latin Modern Roman, lmss Latin Modern Sans).
  4. Recompile and check the PDF.

Option B: pdfLaTeX by redefining the default macros

  1. In the preamble, redefine one or more of the defaults using the pattern from the font selection guide:
    \renewcommand{\rmdefault}{ptm}
    \renewcommand{\sfdefault}{phv}
    \renewcommand{\ttdefault}{pcr}
  2. Because \familydefault is \rmdefault by default, the body text changes with \rmdefault. To make the sans-serif family the body font instead, redefine \familydefault to \sfdefault (an application of the macro roles above, not a separate rule from the guide).

Option C: XeLaTeX or LuaLaTeX with fontspec

  1. Compile with XeLaTeX or LuaLaTeX.
  2. Load \usepackage{fontspec}.
  3. Set the fonts with \setmainfont, \setsansfont and \setmonofont. The fontspec manual’s example is \setmainfont{texgyrebonum-regular.otf} followed by \setsansfont{lmsans10-regular.otf}[Scale=MatchLowercase]. Fonts can be loaded by name or by filename.

Output and how to read it

After recompiling, the body text in the PDF should reflect the new roman family; sans-serif and monospaced text (\textsf, \texttt) follow \sfdefault and \ttdefault. If nothing changed, the default is still in effect: Computer Modern with the OT1 encoding.

Troubleshooting

  • Only the body font changed, or only the headings changed. The roles are separate: \rmdefault, \sfdefault and \ttdefault each control one family, and the body uses whichever the \familydefault points to.
  • The font package seems to do nothing. Load fontenc before the font package, as in Overleaf’s examples.
  • XeLaTeX or LuaLaTeX pauses on the first run. The fontspec manual notes that with LuaTeX, name-based font loading may need luaotfload-tool, and a first run can pause for several minutes while the font database builds.

Free alternatives to Computer Modern

Option Engine How it is loaded Source
Latin Modern (lmr, lmss) pdfLaTeX \usepackage[T1]{fontenc} and \usepackage{lmodern} Overleaf, Font typefaces
TeX Gyre Bonum pdfLaTeX \usepackage[T1]{fontenc} and \usepackage{tgbonum} Overleaf, Font typefaces
Times, Helvetica, Courier pdfLaTeX \renewcommand of \rmdefault, \sfdefault, \ttdefault to ptm, phv, pcr LaTeX2e font selection guide
Fonts installed on your system, or OpenType files XeLaTeX, LuaLaTeX fontspec with \setmainfont, \setsansfont, \setmonofont fontspec manual (CTAN)

For a presentation class, the Beamer font settings are separate; see LaTeX Beamer font. For heading and caption sizes rather than typefaces, see Overleaf font sizes.

FAQ

What is the default font in LaTeX?

Computer Modern. Roman text uses cmr, sans serif uses cmss and typewriter text uses cmtt, with the OT1 encoding by default (LaTeX2e font selection guide; Overleaf, read 2026-11-08).

What is the latex font default for the body text?

The body font is \familydefault, which is \rmdefault unless you change it, so the body text is Computer Modern Roman by default.

How do I change the default LaTeX font?

Under pdfLaTeX, load a font package after fontenc or redefine \rmdefault, \sfdefault and \ttdefault. Under XeLaTeX or LuaLaTeX, use fontspec and \setmainfont.

Is the default latex font the same as Latin Modern?

No. Latin Modern is a separate set of faces, loaded with the lmodern package. The default under pdfLaTeX is Computer Modern with OT1 encoding.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Default Font in LaTeX: Computer Modern and How to Change It

2 free questions a day, no account.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →