Change font for newtxmath math alphabet together with fontspec

My setup for my thesis is that I use fontspec but leave the math to newtxmath because I prefer the appearance of this package's symbols over OpenType math fonts. Now my problem is that the Times uppercase letters in math mode have more weight than the TNR ones in text mode, which is too noticeable on the typeset pages. Lowercase letters and numbers are different as well, but I don't mind them that much.

Is it possible to use the TNR font loaded with fontspec for letters and numbers in math mode? I also would like to preserve the letter forms for g, v, w and z of newtxmath because they look better than the TNR italic ones.

\documentclass[12pt,a4paper]{article}

\usepackage[varg]{newtxmath}

% fix to have numerals not in CM
\DeclareSymbolFont{operators}{OT1}{ntxtlf}{m}{n}
\SetSymbolFont{operators}{bold}{OT1}{ntxtlf}{b}{n}

\usepackage[no-math]{fontspec}

\setmainfont{Times New Roman}

\newcommand\alphabet{abcdefghijklmnopqrstuvwxyz}
\newcommand\numbers{0123456789}

\begin{document}
\noindent\textit{\alphabet\\\MakeUppercase{\alphabet}}\\\numbers

\noindent$$\alphabet\\\MakeUppercase{\alphabet}\\\numbers$$
\end{document}


The example uses a fix from this answer: https://tex.stackexchange.com/a/394137/75284 to avoid Computer Modern math numerals.

• @Mico: Error corrected, I did mean newtxmath. – lblb Oct 22 '17 at 19:56

You can change the fonts. But I would e.g. avoid it for the lowercase letters — the spacing is too different, see e.g. the f.

\documentclass[12pt,a4paper]{article}

\usepackage[varg]{newtxmath}

% fix to have numerals not in CM
\DeclareSymbolFont{operators}{OT1}{ntxtlf}{m}{n}
\SetSymbolFont{operators}{bold}{OT1}{ntxtlf}{b}{n}

\usepackage[no-math]{fontspec}

\setmainfont{Times New Roman}[NFSSFamily=times]

\DeclareSymbolFont{uppercaseletters}{TU}{times}{m}{it}

\DeclareMathSymbol{A}{\mathalpha}{uppercaseletters}{A}
\DeclareMathSymbol{B}{\mathalpha}{uppercaseletters}{B}
\DeclareMathSymbol{C}{\mathalpha}{uppercaseletters}{C}
\DeclareMathSymbol{D}{\mathalpha}{uppercaseletters}{D}
\DeclareMathSymbol{E}{\mathalpha}{uppercaseletters}{E}
\DeclareMathSymbol{F}{\mathalpha}{uppercaseletters}{F}
\DeclareMathSymbol{G}{\mathalpha}{uppercaseletters}{G}
\DeclareMathSymbol{H}{\mathalpha}{uppercaseletters}{H}
\DeclareMathSymbol{I}{\mathalpha}{uppercaseletters}{I}
\DeclareMathSymbol{J}{\mathalpha}{uppercaseletters}{J}
\DeclareMathSymbol{K}{\mathalpha}{uppercaseletters}{K}
\DeclareMathSymbol{L}{\mathalpha}{uppercaseletters}{L}
\DeclareMathSymbol{M}{\mathalpha}{uppercaseletters}{M}
\DeclareMathSymbol{N}{\mathalpha}{uppercaseletters}{N}
\DeclareMathSymbol{O}{\mathalpha}{uppercaseletters}{O}
\DeclareMathSymbol{P}{\mathalpha}{uppercaseletters}{P}
\DeclareMathSymbol{Q}{\mathalpha}{uppercaseletters}{Q}
\DeclareMathSymbol{R}{\mathalpha}{uppercaseletters}{R}
\DeclareMathSymbol{S}{\mathalpha}{uppercaseletters}{S}
\DeclareMathSymbol{T}{\mathalpha}{uppercaseletters}{T}
\DeclareMathSymbol{U}{\mathalpha}{uppercaseletters}{U}
\DeclareMathSymbol{V}{\mathalpha}{uppercaseletters}{V}
\DeclareMathSymbol{W}{\mathalpha}{uppercaseletters}{W}
\DeclareMathSymbol{X}{\mathalpha}{uppercaseletters}{X}
\DeclareMathSymbol{Y}{\mathalpha}{uppercaseletters}{Y}
\DeclareMathSymbol{Z}{\mathalpha}{uppercaseletters}{Z}

\newcommand\alphabet{abcdefghijklmnopqrstuvwxyz}
\newcommand\numbers{0123456789}

\begin{document}
\noindent\textit{\alphabet\\\MakeUppercase{\alphabet}}\\\numbers

$fi(x)=1$

\noindent$$\alphabet\\\MakeUppercase{\alphabet}\\\numbers$$
\end{document}


Unless your document is going to be inspected a font freak, who might go apoplectic if he/she finds out that Times is used instead of Times New Roman, you can simplify your document setup greatly -- and you are pretty much guaranteed to have the same glyph weights in text and math mode -- by simply loading the newtxtext package. Moreover, the numerals will be in Times in both text and math mode.

As the preceding screenshot also demonstrates, the only meaningful differences between Times and Times New Roman that a non-font-freak might ever notice concern the appearance of the % symbol (in both upright and italic shapes) and of the z glyph (italic mode only: swashy with Times, non-swashy with Times New Roman).

% !TEX TS-program = lualatex
\documentclass[12pt,a4paper]{article}
\usepackage[no-math]{fontspec}
\usepackage{newtxtext}
\usepackage[varg]{newtxmath}

\newcommand\alphabet{abcdefghijklmnopqrstuvwxyz}
\newcommand\numbers{0123456789}

\begin{document}
\obeylines % just for this example
{\itshape
\alphabet
\MakeUppercase{\alphabet}}
\numbers
$\alphabet$
$\MakeUppercase{\alphabet}$
$\numbers$

\medskip
Times: \%
Times Italic: \textit{z\%}
\setmainfont{Times New Roman}
Times New Roman: \%
Times New Roman Italic: \textit{z\%}
\end{document}

• The reason for my complicated setup is that I personally found that the times fonts have heavier uppercase than lowercase letters, but Times much more so than TNR, visible in my screenshot. I notice this on screen and on printed paper. I've read somewhere that Times is not the best choice for languages which naturally contain more uppercase letters because of that. – lblb Oct 22 '17 at 19:52
• @lblb - Ah, so maybe you are one of those "font freaks" I alluded to in my answer. :-) Honestly, as long as as the text and math fonts are consistent and aren't too distracting or off-putting, nobody will care if the document was typeset using Times or Times New Roman. – Mico Oct 22 '17 at 21:22
• @Mico You are switching to T1 encoding and so break the non-ascii characters. This is not a good idea with lualatex. Try grüße and you see the problem. – Ulrike Fischer Oct 22 '17 at 21:25
• @UlrikeFischer - I hadn't even thought of multi-bit non-ASCII characters until now! :-) If those occur in the input, I'd recommend using the Stix Two text and math fonts -- another Times clone. Setup: \usepackage[no-math]{fontspec} \setmainfont{Stix Two Text} \usepackage{unicode-math} \setmathfont{Stix Two Math}, where the Stix Two fonts may be downloaded from stixfonts.org. – Mico Oct 22 '17 at 21:35
• Stix Two is not a solution to the question here: It looks quite similar to the letters of newtxmath. So lblb will find the uppercase to heavy too ;-) – Ulrike Fischer Oct 22 '17 at 21:44