5

Can anyone help me to change the font to "Times New Roman" in PDFLaTeX?

I already tried using the commands below without results:

% Font selection
\usepackage[T1]{fontenc}
\usepackage{times} 
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\setmainfont{Times New Roman}
6

If you are compiling with pdflatex, this is one of several ways to get Times New Roman font for both math and text:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{newtxmath,newtxtext}
\usepackage{lipsum} % just to generate dummy text
\begin{document}
\lipsum
\end{document}

\setmainfont is a command of the fontspec package, which you can't use with the pdflatex engine.

  • Thank you for your suggestion Andrew. It works but equations in math mode ($ equation $) still don't have the font Times New Roman. Can you solve this problem as well? Thank you in advance – Luca Jul 3 '16 at 11:37
  • Technically yes, nrwtxmath selects a font of math symbols that blend well with Times New Roman but are a separate font. This is what all math font packages in classic LaTeX do. You might look at unicode-math package for an alternative approach if you really need it to be a single font. – musarithmia Jul 3 '16 at 14:27
  • Thank you but it seems unicode-math package doesn't run with PDFLaTeX – Luca Jul 4 '16 at 7:41
  • Pdflatex only allows a certain number of slots for characters, enough for the basic English alphabet and most common symbols. If you want more symbols than that, you have to change to a different set of characters. This is done by having different font files for these different sets of characters. This limitation is built into the pdflatex program (oversimplifying a bit) and is a relic of an earlier era when computer memory was much more limited. If you want to use the full Unicode range of a single font, you have to use a different engine, xelatex or lualatex with fontspec package. – musarithmia Jul 4 '16 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.