Yes, you can write \usepackage{newtxtext, newtxmath}
and compile with XeLaTeX. You might get an obscure bug related to Greek letters in \mathrm
. (ETA: Commenters bring up more bugs with hyphenation patterns and non-ASCII characters than I was aware of.)
You can also use the font TeX Gyre Termes Math in unicode-math
, which has a very similar appearance to newtxmath
, but all the modern features and a larger selection of glyphs. There is also a text font, TeX Gyre Termes X, specifically based on the tweaks to Times in txfonts
. Or you could go halfway, using an OpenType version of Times with fontspec
along with math from newtxmath
.
Also note that new development of TeX is currently focused on LuaTeX. There are a few packages that still only work in XeTeX, but of the features I need, HarfBuzz font rendering was finally added to LuaTeX this year, ucharclasses
doesn’t work, and I prefer unicode-math
to mathspec
. There are still a few miscellaneous packages I might need XeTeX for here and there, but I’ve been using LuaTeX when I can for years, due to its better support for microtype
.
A Pragmatic Solution
Since it’s better to use Unicode fonts in Unicode engines, use iftex
to detect what kind of system you’re compiling on, if you must support both.
\usepackage{iftex}
\ifTUTeX
\usepackage{unicode-math}
\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }
\setmainfont{TeX Gyre Termes}[Scale=1.0]
\setmathfont{TeX Gyre Termes Math}
\else
\usepackage{amsmath, newtxtext, newtxmath}
\fi
There should be very few incompatibilities. One that I’ve seen is capital Greek letters such as Δ within \mathrm
, which happen to work in newtxmath
. In unicode-math
, you would use \symup\Delta
or \upDelta
instead.
If you want newtxmath
instead of unicode-math
for some reason, alternatives are to load fontspec
with newtxmath
and TeX Gyre Termes as the main font, mathastext
, and mathspec
, which also gives you letters from an OpenType font in math mode. If it’s important that the XeTeX/LuaTeX output be as identical to the PDFTeX output as possible, use TeX Gyre Termes X as the main font.