LaTeX Times New Roman: pdfLaTeX, XeLaTeX and lmodern

November 11, 2026 · 10 min read

LaTeX Times New Roman: Set the Font in pdfLaTeX, XeLaTeX and LuaLaTeX

For LaTeX Times New Roman text, your compiler decides the setup. With pdfLaTeX, load newtxtext and newtxmath for Times-style text and matching math. With XeLaTeX or LuaLaTeX, load fontspec and call \setmainfont{Times New Roman} to use the installed font. Below you'll find tested preambles, the Pandoc route, and what lmodern does.

How Do You Use Times New Roman in LaTeX?

Pick the row that matches your compiler. If you're not sure which one you use, it's probably pdfLaTeX, because that's Overleaf's default compiler.

CompilerPreambleWhat you get
pdfLaTeX\usepackage{newtxtext,newtxmath}A Times clone for text, plus matching math
XeLaTeX or LuaLaTeX\usepackage{fontspec} and \setmainfont{Times New Roman}The Times New Roman installed on your machine
XeLaTeX or LuaLaTeX, font missing\setmainfont{TeX Gyre Termes}A free Times Roman replacement
pdfLaTeX, older documents\usepackage{mathptmx}Times text and mostly matching math, no bold math

Those first two rows cover nearly every case. The rest of this guide explains each one, plus the two packages people often load by mistake: times and lmodern. Setting the point size is a separate step, covered in our LaTeX font size guide.

The pdfLaTeX Route: newtxtext and newtxmath

The newtx bundle on CTAN splits the older txfonts package into two independent packages. newtxtext sets the body text, and newtxmath sets the math. Here's a complete document you can compile as is:

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{newtxtext,newtxmath}

\begin{document}
Body text in a Times clone, and the formula $E = mc^2$
uses Times-style italic letters as well.
\end{document}

This produces a page where the paragraph and the formula share the same Times look. According to the newtx documentation, the text font has been based on TeX Gyre Termes since version 1.4. The package also brings a Helvetica clone for sans serif text, and newtxmath loads amsmath for you.

The same documentation adds a few practical rules. Load newtxtext before newtxmath, as every example in the manual does. T1 is already the default encoding for newtxtext, so the fontenc line just makes it explicit. If you need bold symbols, add \usepackage{bm} after all the math packages. There's also a one-line wrapper, \usepackage{newtx}, that loads both packages together.

You don't need \usepackage[utf8]{inputenc} either. UTF-8 has been LaTeX's default input encoding since the April 2018 release, per LaTeX News issue 28.

We prefer this pair for most documents. You stay on pdfLaTeX, and the math matches the text without extra work. For bold, calligraphic and other letter styles inside formulas, see our LaTeX math fonts guide.

Why the times Package Is Obsolete (and Where mathptmx Fits)

CTAN marks the times package as obsolete, and it isn't the route for new documents. It only swaps the text fonts. When we compiled \usepackage{times} with pdfLaTeX, the body text came out in Nimbus Roman, URW's Times clone, while the formula x+y stayed in Computer Modern. The PSNFSS documentation gives the reason: the package doesn't load suitable math fonts.

mathptmx was the fix for that. It builds math from Times Italic plus symbols borrowed from Computer Modern, RSFS and Adobe Symbol. Its known gap is bold math: the PSNFSS manual says there are no bold math fonts, so \boldmath has no effect. CTAN now lists mathptmx as obsolete too and recommends newtx instead.

% Old: Times text, Computer Modern math
\usepackage{times}

% Current: Times-style text and math together
\usepackage{newtxtext,newtxmath}

Real LaTeX Times New Roman With fontspec (XeLaTeX and LuaLaTeX)

To use the actual Times New Roman font file, switch to a Unicode engine. The fontspec package lets XeLaTeX and LuaLaTeX load any font installed on the system by name:

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}

\begin{document}
This paragraph is set in Times New Roman.
\end{document}

We compiled this with both XeLaTeX and LuaLaTeX on macOS, and pdffonts listed TimesNewRomanPSMT as the embedded text font. Formulas still used Computer Modern, though. For matching math, add unicode-math and pick an OpenType math font:

\usepackage{unicode-math}
\setmainfont{Times New Roman}
\setmathfont{TeX Gyre Termes Math}

unicode-math loads fontspec itself, so this version needs no separate fontspec line. Two errors trip people up here:

  • Under pdfLaTeX, fontspec stops with a fatal error saying it requires either XeTeX or LuaTeX. Change the compiler, not the package.
  • If the font isn't installed, you get The font "Times New Roman" cannot be found. Swap in \setmainfont{TeX Gyre Termes} instead.

Windows and macOS ship Times New Roman, but Linux systems often don't, so the second error is common on Linux servers and CI runners. LuaLaTeX finds TeX Gyre Termes by name in a full TeX Live install. Under XeLaTeX on Linux, the TeX Live guide says you first make TeX Live's fonts visible to fontconfig.

On Overleaf, open the gear icon (or the File menu), choose Compiler, and select XeLaTeX or LuaLaTeX. Overleaf's list of fonts available to fontspec includes Times New Roman, TeX Gyre Termes and TeX Gyre Termes Math.

Times Roman vs Times New Roman: Is newtx the Real Thing?

No, and for most papers that's fine. Microsoft's typography notes say Times New Roman first appeared in 1932 in The Times of London. Victor Lardent drew it under Stanley Morison, and Monotype's drawing office refined it. The copy on Windows and macOS is that design.

TeX's free fonts are separate digitisations. CTAN describes TeX Gyre Termes, the base of newtxtext, as a replacement for the standard Times Roman font, built on URW Nimbus Roman No9 L. The times and mathptmx packages select Adobe Times Roman or an equivalent, which on TeX Live means Nimbus Roman. In body text, the clones and the Microsoft font look nearly the same.

Here's the limitation. If a journal template demands the Microsoft font itself, only fontspec with the installed file gives you that. Don't expect identical line breaks when you switch between a clone and the real font either. To see what you actually embedded, run pdffonts paper.pdf: Times New Roman shows up as TimesNewRomanPSMT, while the clones show Termes or Nimbus names.

What Does lmodern Do in LaTeX?

The LaTeX lmodern package switches the default roman, sans serif and typewriter fonts, plus the math fonts, to Latin Modern. Latin Modern is Computer Modern rebuilt as outline fonts in Type 1 and OpenType format, with many extra accented characters. CTAN's Latin Modern entry counts 72 text fonts and 20 math fonts.

It doesn't give you Times. It keeps the classic LaTeX look and fixes how pdfLaTeX renders it:

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

T1 encoding gives you real accented glyphs, but classic Computer Modern needs the cm-super fonts to supply them in outline form. On our test install without cm-super, the line "Café über naïve" came out as a blurry Type 3 bitmap font. Adding lmodern produced a sharp Type 1 font instead. It also scales cleanly to any size.

So which one do you keep? Never load lmodern and newtxtext together. Both redefine the default font families, so whichever package loads last wins. If you want Times, delete the lmodern line. Under XeLaTeX and LuaLaTeX, LaTeX already uses Latin Modern for text, so the package adds little there beyond Type 1 copies of the math fonts.

Times New Roman in Pandoc and Markdown Documents

If you write in Markdown and turn it into a PDF through LaTeX, you set the font with Pandoc variables. Our Pandoc Markdown guide covers PDF engines and extensions, and converting Markdown to LaTeX with Pandoc covers the conversion itself. For the font, the Pandoc manual gives you two variables.

mainfont works with XeLaTeX or LuaLaTeX and takes the name of any system font:

pandoc notes.md -o notes.pdf --pdf-engine=xelatex -V mainfont="Times New Roman"

With Pandoc 3.8, this embedded Times New Roman for the text and Latin Modern Math for formulas. Add -V mathfont="TeX Gyre Termes Math" if you want matching math.

fontfamily is for pdfLaTeX and names a font package. Put it in your Markdown file's YAML header:

---
fontfamily: newtx
---

That loads the newtx wrapper, which brings in both newtxtext and newtxmath. In Pandoc's default template, setting fontfamily also stops Pandoc from loading lmodern, so the two don't clash.

Prefer your own preamble? Our Markdown to LaTeX converter turns Markdown into a .tex file in your browser and passes math through unchanged. Add the font lines from this guide to that file's preamble and compile it yourself, because the tool doesn't produce a PDF. Our editor's preview and PDF export have no font settings, so Times New Roman only appears once your LaTeX toolchain compiles the file.

Times New Roman in Beamer Slides and Other Fixes When Nothing Changes

Beamer doesn't use your main font. Beamer typesets slides in sans serif by default, so \setmainfont alone changes nothing visible. In our XeLaTeX test, the slide text stayed in Latin Modern Sans until we added the serif font theme:

\documentclass{beamer}
\usefonttheme{serif}
\usepackage{fontspec}
\setmainfont{Times New Roman}

With \usefonttheme{serif} in place, the same slide embedded Times New Roman.

Text is Times but formulas aren't. You're probably loading times or using fontspec without unicode-math. Replace times with newtx, or add a math font as shown earlier.

Compilation stops at fontspec. The project is still on pdfLaTeX. Switch the compiler, or use newtx instead.

Times disappears after you add a package. Search the preamble for lmodern loaded after newtx. A class or template that loads its own fonts can do the same thing.

Questions About Times New Roman in LaTeX

Getting LaTeX Times New Roman right comes down to three rules: newtx for pdfLaTeX, fontspec for XeLaTeX and LuaLaTeX, and no lmodern next to either. Run pdffonts when the exact font matters. If you draft in Markdown first, write in the editor, convert with the Markdown to LaTeX tool, then add your font lines. Still deciding whether you need LaTeX at all? Our Markdown vs LaTeX comparison helps you choose.