LaTeX Font Packages: lmodern, Times New Roman, Palatino, and More
Date Published

Every LaTeX document starts life in Computer Modern, the typeface Donald Knuth drew for TeX. It is a fine font for mathematics, but it is not right for every paper, thesis, or CV, and many "my PDF looks blurry" and "my accents are missing" complaints come down to not loading a modern font package at all. This guide covers the packages you will actually use: lmodern, the Times New Roman options, Palatino, Helvetica and Arial, monospace fonts for code, and the newer OpenType families, plus the encoding lines and error messages that go with them.
All examples use pdfLaTeX unless noted; XeLaTeX and LuaLaTeX users can skip to the fontspec section.
lmodern in LaTeX (Latin Modern)
Latin Modern is the scalable, Type 1 and OpenType successor to Computer Modern, produced by Bogusław Jackowski and Janusz Nowacki of the Polish TeX users group GUST. It keeps the look of Knuth's original almost exactly while fixing the two problems that plague the default setup.
Problem 1: pixelated text. The original Computer Modern fonts were generated by Metafont as bitmaps. When you switch to T1 encoding without a scalable font installed, LaTeX falls back to bitmap Type 3 fonts, and the PDF looks fuzzy on screen and fails many publisher and arXiv checks. Latin Modern provides vector outlines, so text stays sharp at any zoom.
Problem 2: missing or broken accents. Computer Modern's default OT1 encoding is 7-bit and builds accented letters out of two glyphs. Words containing é, ü, or ñ hyphenate incorrectly, and copy-paste from the PDF produces garbage. Latin Modern has a full T1 glyph set with real accented characters for Western and Central European languages.
The fix is two lines in the preamble:
1\usepackage[T1]{fontenc}2\usepackage{lmodern}
Try this in Octree — free LaTeX editor with AI, compiles in your browser
Load fontenc with the T1 option so that LaTeX uses the full character set, then lmodern to supply the outlines. The result is a drop-in replacement for Computer Modern with better scaling, more glyphs, and cleaner PDF output. Latin Modern is also the default font in XeLaTeX and LuaLaTeX. Unless you have a reason to choose something else, this is the baseline every document should start from.
Copy-ready example: a complete document that uses Latin Modern with T1 encoding. Compile it with pdfLaTeX and zoom into the PDF: the text stays sharp and accented letters are real glyphs, so they can be searched and copied.
1\documentclass{article}2\usepackage[T1]{fontenc} % 8-bit encoding: real accented glyphs3\usepackage{lmodern} % scalable Latin Modern instead of bitmap CM4\begin{document}5Latin Modern: café, naïve, Ångström, and $E = mc^2$.6\end{document}
Times New Roman in LaTeX
Times is the most requested alternative because journals, theses, and grant applications so often demand it. There are five ways to get it, from obsolete to recommended.
Copy-ready preamble for Times New Roman. Use the first two lines with pdfLaTeX; with XeLaTeX or LuaLaTeX, use the fontspec lines instead to load the real Times New Roman installed on your system:
1% pdfLaTeX: Times text and matching Times math (recommended)2\usepackage[T1]{fontenc}3\usepackage{newtxtext,newtxmath}45% XeLaTeX or LuaLaTeX: the actual Times New Roman font6% \usepackage{fontspec}7% \setmainfont{Times New Roman}
In short: \usepackage{times} is the legacy package and changes text only, leaving math in Computer Modern; \usepackage{mathptmx} sets text and math in Times but has no bold math; \usepackage{newtxtext,newtxmath} is the modern, complete choice; and \setmainfont{Times New Roman} under XeLaTeX or LuaLaTeX gives the exact Monotype font. Each option is explained below.
\usepackage{times} (obsolete, text only)
1\usepackage{times}
This is the oldest method and still appears in many templates. It switches the body text to a Times clone (Nimbus Roman), sans-serif to Helvetica, and monospace to Courier, but math stays in Computer Modern, so equations look mismatched next to the text. The package is officially deprecated and prints no warning, which is why so many documents still use it.
\usepackage{mathptmx} (text and math)
1\usepackage{mathptmx}
Part of the standard PSNFSS bundle, mathptmx sets both text and math in Times. It is available in every TeX distribution, but it lacks bold math and some symbols, and its Greek letters are upright rather than italic.
\usepackage{newtxtext,newtxmath} (recommended)
1\usepackage[T1]{fontenc}2\usepackage{newtxtext,newtxmath}
Michael Sharpe's newtx bundle is the modern choice: a complete Times text family with small caps and old-style figures, and a full math font including bold, blackboard bold, and AMS symbols. Most IEEE and Elsevier-style templates that ask for Times should use this.
\usepackage{tgtermes} (TeX Gyre Termes)
1\usepackage{tgtermes}2\usepackage{newtxmath}
TeX Gyre Termes is GUST's Times clone with the same wide glyph coverage as Latin Modern. It is text only, so pair it with newtxmath for matching equations.
XeLaTeX or LuaLaTeX with the real Times New Roman
1\usepackage{fontspec}2\setmainfont{Times New Roman}
This loads the actual Times New Roman from your operating system, the only way to get the genuine Microsoft font rather than a metric-compatible clone. It requires XeLaTeX or LuaLaTeX, not pdfLaTeX, and the font must be installed on the machine doing the compiling. On a Linux server without Microsoft fonts, \setmainfont{TeX Gyre Termes} is the drop-in substitute that ships with TeX Live. Add \usepackage{unicode-math} and \setmathfont{TeX Gyre Termes Math} for matching math.
Palatino-like Fonts
Palatino, designed by Hermann Zapf in 1948, is wider and more calligraphic than Times and popular for books.
\usepackage{palatino}— the legacy PSNFSS package, text only, with the same math mismatch astimes\usepackage{mathpazo}— Palatino text with matching math; add the[sc]option for true small caps and[osf]for old-style figures\usepackage{newpxtext,newpxmath}— the recommended modern pair, the Palatino counterpart of newtx with full math support\usepackage{tgpagella}— TeX Gyre Pagella, GUST's Palatino clone, text only
Sans-Serif Fonts: Helvetica, Arial, and Others
Helvetica
1\usepackage[scaled=0.92]{helvet}2\renewcommand{\familydefault}{\sfdefault}
The helvet package loads Nimbus Sans, a Helvetica clone. Helvetica's x-height is larger than Times or Computer Modern, so the scaled option shrinks it to match; 0.88 to 0.95 is typical. The \renewcommand{\familydefault}{\sfdefault} line makes sans-serif the body font instead of only affecting \textsf{}. TeX Gyre Heros (\usepackage{tgheros}) is the GUST alternative with wider coverage.
Arial
Arial is metrically compatible with Helvetica, so in pdfLaTeX the helvet setup above is the standard substitute and produces the same line breaks. For the real Arial, use XeLaTeX or LuaLaTeX with \setmainfont{Arial}. Liberation Sans, a free Arial-compatible font, loads the same way with \setsansfont{Liberation Sans}.
Computer Modern Sans and Latin Modern Sans
1\renewcommand{\familydefault}{\sfdefault}
With no font package loaded this gives Computer Modern Sans; with lmodern loaded it gives Latin Modern Sans. Both are common in presentations and posters.
Monospace Fonts for Code
\usepackage{courier}— the legacy Courier package;tgcursor(TeX Gyre Cursor) is the better-covered replacement\usepackage{inconsolata}— recommended for listings; narrow and readable, withvar0andvarloptions for alternate zero and l glyphs\usepackage[scaled]{FiraMono}— Mozilla's Fira Mono, a good match for Fira Sans\usepackage{sourcecodepro}— Adobe's Source Code Pro
Most of these accept a scaled option, for example \usepackage[scaled=0.85]{inconsolata}, because monospace fonts tend to look large beside body text.
Modern Font Families
- Libertinus —
\usepackage{libertinus}; a complete family (serif, sans, mono) with full math support throughlibertinust1mathin pdfLaTeX, and an OpenType math font in XeLaTeX and LuaLaTeX - STIX Two —
\usepackage{stix2}; designed by scientific publishers for journal typesetting, with the widest symbol coverage of any Times-style font - EB Garamond —
\usepackage{ebgaramond}and\usepackage{ebgaramond-maths}; an elegant classical look for humanities theses and books
Using System Fonts with fontspec (XeLaTeX and LuaLaTeX)
1\usepackage{fontspec}2\setmainfont{Times New Roman}3\setsansfont{Helvetica}4\setmonofont{Menlo}
fontspec opens up every TrueType and OpenType font on your computer. The names must match what your operating system calls the font, and the document will not compile elsewhere unless the same fonts are installed. For math, add \usepackage{unicode-math} and \setmathfont{...} with an OpenType math font such as Latin Modern Math or STIX Two Math.
Computer Modern vs the Alternatives
Font family | pdfLaTeX package | Math support | Typical use |
|---|---|---|---|
Computer Modern | (default) | Yes | Classic math and CS papers |
Latin Modern | | Yes | Everything; the default you should set |
Times | | Yes, full | IEEE, Elsevier, theses that require Times |
Times | | Yes, limited | Older templates |
Times | | No | Legacy only |
TeX Gyre Termes | | Pair with newtxmath | Free Times with wide coverage |
Palatino | | Yes, full | Books, theses |
Palatino | | Yes | Simple Palatino setup |
Helvetica/Arial | | No (text only) | Posters, slides, sans-serif body |
Libertinus | | Yes | Modern elegant documents |
STIX Two | | Yes | Scientific publishing |
EB Garamond | | Yes | Humanities, books |
Font Combinations
- Classic academic:
\usepackage{lmodern} - IEEE and engineering:
\usepackage{newtxtext,newtxmath} - Modern elegant:
\usepackage{libertinus} - Book publishing:
\usepackage{newpxtext,newpxmath} - Humanities:
\usepackage{ebgaramond}with\usepackage{ebgaramond-maths}
Math Font Considerations
Not every text font has a matching math font, and mixing a Times body with Computer Modern equations is the most common typographic mistake in LaTeX. Fonts with reliable math companions are lmodern (Computer Modern style), newtxmath (Times), newpxmath (Palatino), libertinust1math (Libertinus), and stix2 (STIX). If your text font has none, newtxmath pairs reasonably with most serifs.
Font Size and Encoding Notes
Document-wide size is set in the class options: \documentclass[12pt]{article} accepts 10pt, 11pt, and 12pt. Within the text, the relative size commands run from \tiny through \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, \LARGE, \huge to \Huge. For an exact size, \fontsize{14pt}{16pt}\selectfont sets 14 pt type on 16 pt line spacing.
Two encoding lines belong in nearly every pdfLaTeX preamble:
1\usepackage[utf8]{inputenc}2\usepackage[T1]{fontenc}
inputenc tells LaTeX the source file is UTF-8; it has been the default since April 2018, so the line is optional but harmless. fontenc with T1 selects the 8-bit output encoding that gives correct hyphenation of accented words, proper <, >, and | characters, and searchable PDF text. Always pair T1 with a scalable font such as lmodern, or you get bitmap fallbacks.
Common Font Errors
"LaTeX Font Warning: Font shape `T1/ptm/m/n' undefined, using `T1/cmr/m/n' instead." LaTeX could not find the requested font and silently substituted Computer Modern. The package's font files are missing: run tlmgr install times (or the package named in the warning) or install collection-fontsrecommended.
"! Font T1/lmr/m/n/10=ec-lmr10 at 10.0pt not loadable: Metric (TFM) file not found." The lmodern fonts are not installed. Run tlmgr install lmodern, or sudo apt install fonts-lmodern on Debian and Ubuntu.
"! LaTeX Error: File `newtxtext.sty' not found." The package itself is missing: tlmgr install newtx.
"fontspec error: The font 'Times New Roman' cannot be found." Either the font is not installed on the compiling machine, or you compiled with pdfLaTeX, which cannot use fontspec. Switch to XeLaTeX or LuaLaTeX and check the exact name with fc-list | grep -i times.
Blurry or pixelated text in the PDF. You are using T1 encoding without a scalable font. Add \usepackage{lmodern} or install cm-super.
Frequently Asked Questions
What is the best font for LaTeX?
For most documents, Latin Modern (\usepackage{lmodern}) is the best default: it looks like classic TeX, has complete math support, and avoids the pixelation and encoding problems of raw Computer Modern. If a journal requires Times, use newtxtext,newtxmath.
What is lmodern in LaTeX?
lmodern is the package that loads Latin Modern, a scalable Type 1 and OpenType version of Knuth's Computer Modern with full accent coverage. Load it with \usepackage[T1]{fontenc} and \usepackage{lmodern} to get crisp, searchable text that looks like default LaTeX.
How do I use Times New Roman in LaTeX?
In pdfLaTeX, \usepackage{newtxtext,newtxmath} gives a Times-compatible text and math font. For the genuine Microsoft font, compile with XeLaTeX or LuaLaTeX and use \usepackage{fontspec} with \setmainfont{Times New Roman}.
How do I use Times New Roman in XeLaTeX or LuaLaTeX?
Load fontspec and set the main font: \usepackage{fontspec} then \setmainfont{Times New Roman}. The font must be installed on your system (it ships with Windows and macOS); on Linux or Overleaf use \setmainfont{TeX Gyre Termes} instead. For matching math, add unicode-math with \setmathfont{TeX Gyre Termes Math}.
Why does my LaTeX document still look like Computer Modern after adding times?
The times package only changes text; math remains Computer Modern. Replace it with mathptmx or, better, newtxtext,newtxmath.
Do I need \usepackage[T1]{fontenc} with lmodern?
Yes. Without T1, LaTeX uses the 7-bit OT1 encoding and most of Latin Modern's accented characters go unused. The two packages are meant to be loaded together.
Typography with Octree
Choosing a font package is a one-line change, but checking the result means recompiling and scrolling through the PDF every time. Octree compiles as you edit, so you can switch between lmodern, newtx, and Palatino and compare the output instantly, and its AI assistant can set up the right preamble for a journal's requirements.
Try it at https://useoctree.com
Try this in Octree — free LaTeX editor with AI, compiles in your browser

Colored boxes in LaTeX with tcolorbox: color box background and frame, titles, drop shadows, rounded corners, plus \colorbox, \fcolorbox, \fbox and Beamer.

LaTeX right align, centering and left align: flushright, \raggedleft, center, \centering, flushleft and \hfill, plus how to align equations with align.