5

I'm required to have my dissertation in Times New Roman. I'm using LuaLaTeX because it lets me use figures which are too big for the usual compiler. I've tried several ways to change the font:

\usepackage{times}

was already in the template provided, but doesn't seem to do anything (the document appears in the normal LaTeX font).

\usepackage{fontspec}
\setmainfont{Times New Roman}

gives me undefined control sequence errors.

EDIT to give the whole code: My document is now like this:

\documentclass[10pt, twocolumn]{revtex4}    % Font size (10,11 or 12pt) and column number (one or two).

\usepackage{fontspec}
%\setmainfont{Times New Roman}
\setmainfont{times}[
  Extension      = .ttf ,
  BoldFont       = *bd ,
  ItalicFont     = *i ,
  BoldItalicFont = *bi
]

\usepackage[a4paper, left=1.85cm, right=1.85cm,
 top=1.85cm, bottom=1.85cm]{geometry}       % Defines paper size and margin length

%%%%% Document %%%%%
\begin{document}                     
Hello 123.
\end{document}

This gives a PDF in Times New Roman but with lots of Undefined Control Sequence Errors (none of which seem to be particularly helpful) and the top of the PDF looks like the picture below. enter image description here

The log file is here: https://drive.google.com/file/d/1e9IwV-Nmbza2UDfbFEDmv3xarpbJrfOB/view?usp=sharing

Am I doing something wrong - is there a simple way to change the font type that I'm missing? Thanks in advance.

11
  • you shouldn't get get undefined command errors but it is impossible for anyone to debug if you do not show your input or what error you got. Edit your question to show the full error from the log file, in a code section so that line ends are preserved. Mar 17, 2020 at 14:10
  • 3
    Don't use the package times with luatex. Simply \setmainfont{Times New Roman} should normally work, if you have the font. Mar 17, 2020 at 14:19
  • Welcome to tex.sx! If you want to know all the ways of selecting a font in fontspec, see the fontspec manual section 2: Font selection. That said, your code compiles fine for me (including small caps). (on LuaTeX, Version 1.12.0; MiKTeX 2.9.7300 64-bit)
    – TivV
    Mar 17, 2020 at 14:19
  • \setmainfont{Times New Roman} gives the same error as above. When you say if I have the font - it's installed on my system, do I need to install it separately for this to work?
    – TIF
    Mar 17, 2020 at 14:24
  • 1
    Show the log-file. Mar 17, 2020 at 14:31

1 Answer 1

4

Unless your TeX distribution is of neolithic vintage, the following code should work for you. Observe that loading the fontspec package is optional. The newtxtext and newtxmath font packages contain code that adjusts various settings depending on whether the document is compiled with pdfLaTeX, XeLaTeX, or LuaLaTeX.

Aside: Instead of specifying left=1.85cm, right=1.85cm, top=1.85cm, bottom=1.85cm while loading the geometry package, do consider writing just margin=1.85cm.

\documentclass[10pt,twocolumn]{revtex4}
\usepackage[a4paper,margin=1.85cm]{geometry}  

%\usepackage{fontspec} % optional
\usepackage{newtxtext,newtxmath}

\begin{document}                     
Hello 123.
\end{document}

Addendum: There can be little justification these days for loading the times package, which was last updated ca 15 years ago. Its operational content consists of only three instructions:

\renewcommand{\sfdefault}{phv}
\renewcommand{\rmdefault}{ptm}
\renewcommand{\ttdefault}{pcr}

This not only sets the document's "Roman" font to Times, but the default sans-serif font to Helvetica and (most problematically) the default monospaced font to Courier. You will most likely wish to exercise more specific control over the default sans-serif and monospaced fonts of your document.

3
  • 1
    EDIT: I put in \usepackage{fontspec} and it now works! Thanks a lot Thanks, I've now thoroughly uninstalled and reinstalled Miktex. The template was from my department and it being 15 years old doesn't surprise me... However I'm now getting ! error: (file ntx-Regular-tlf-t1) (type 3): font ntx-Regular-tlf-t1 at 600 notfound! ==> Fatal error occurred, no output PDF file produced! when I try to compile.
    – TIF
    Mar 17, 2020 at 17:49
  • 1
    @TIF - The error message sounds like the text and/or math fonts of the newtx font packages weren't installed properly. This, in turn, could be due to you either not (re)installing a full version of MikTeX or doing so only in admin mode but not in user mode as well (or vice versa). There are a ton of postings on this site about how to install/update MikTeX correctly and how to recover from an installation mistake. You might start at How should one maintain and update a MiKTeX installation? (Sorry for being vague -- I don't use MikTeX myself.)
    – Mico
    Mar 17, 2020 at 18:10
  • @TIF - The fact that the error message complains about type-3 fonts (which are raster fonts) not being found may also suggest that the type-1 outline fonts -- which is what one ought to be using in the 21st century! -- either weren't installed properly or weren't activated properly.
    – Mico
    Mar 17, 2020 at 21:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .