# Using newtxmath for letters but not symbols

I'd like to use newtxmath for the letters in my equations. Unfortunately, if I just enable newtxmath, I find that the \lesssim and \lnsim symbols look too much alike. Here's an example:

\documentclass[12pt,varwidth]{standalone}

\usepackage{amssymb}
\usepackage{newtxmath}

\begin{document}
$a\lnsim b$ means $a<b$ and $a\nsim b$.

I'd like $a\lnsim b$ and $a\lesssim b$ to look different.

But also $\lnsim$ to be same size as $\le,\nsim,\ne,=$.
\end{document}


I've found I can use the default (more legible) \lesssim and \lnsim relations if I add the noamssymbols option to newtxmath:

\usepackage[noamssymbols]{newtxmath}


Unfortunately, then I get a weird mismatch between relation symbol sizes. In particular, \lnsim looks completely out of proportion with < and \le:

Of course, I can also get rid of newtxmath altogether, but then the letters don't look as good. (In my real document, the text font is times.)

How can I get the letters from newtxmath, but keep the operators like <, =, \ne, etc., from the plain latex font?

• Welcome! Do you really want it just for the letters and nothing else? – cfr Sep 3 '15 at 0:20
• I'm not a typography expert, but in general TeX's math relations look okay. What looks weird to me is pairing the TeX math font with Times italic (which is required by the journal style I'm using). – user3188445 Sep 3 '15 at 0:23
• What are you using for Times? Normally, you should use the text font for letters etc. in maths. – cfr Sep 3 '15 at 0:25
• Using acmsmall.cls. Actually it seems to use New Century Schoolbook, not times. Hmm... Should I be using mathdesign or something instead of newtxmath? (acm.org/publications/article-templates/acm-latex-style-guide) – user3188445 Sep 3 '15 at 0:28
• If you are submitting to a journal or conference, you should under no circumstances change the fonts. They will only have to undo your changes. Publisher's templates are designed to impose a particular style. Trying to use a different one is not wise. However, the chances of them actually publishing using the fonts you get when using their class are probably not high: many publishers will change the fonts in production anyway. (They may have proprietary fonts, for example, and will just use something in the class for authors which gives a general sense of how it will look.) – cfr Sep 3 '15 at 0:42

A rough and ready solution first, then I’ll try talking you into a more modern one.

Better simple fix than what I originally posted. Rescale the operator with \scalebox.

\documentclass[12pt,varwidth]{standalone}

\usepackage{amssymb}
\usepackage[noamssymbols]{newtxmath}
\usepackage{graphicx}

\let\oldlnsim\lnsim
\renewcommand{\lnsim}{\ensuremath\mathrel{\scalebox{0.8}{\ensuremath\oldlnsim}}}

\let\oldlesssim\lesssim
\renewcommand{\lesssim}{\ensuremath\mathrel{\scalebox{0.8}{\ensuremath\oldlesssim}}}

%% Etc.

\begin{document}
$a\lnsim b$ means $a<b$ and $a\nsim b$.

I'd like $a\lnsim b$ and $a\lesssim b$ to look different.

But also $\lnsim$ to be same size as $\le,\nsim,\ne,=$.
\end{document}


Pixel-by-pixel comparison. Before:

After:

All right, here’s the other solution I said I’d try talking you into.

If you read the newtx documentation, the author, Michael Sharpe, is very open about where he got the bits and pieces of his package. He even says, “In my opinion, material typeset in Linux Libertine looks better than the corresponding material typeset in Times.” So, if you like his settings, we can also request them in a modern toolchain and get all of its benefits. Including fonts that scale automatically, no limit on math alphabets, and the ability to select any glyph from any Unicode font as the default.

\documentclass[12pt,varwidth]{standalone}

\usepackage{amssymb}
\usepackage[math-style=TeX]{unicode-math}

%% Basically identical appearance to newtxmath, but all scaling is now
%% automatic.
\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{Linux Libertine O}
\setsansfont{TeX Gyre Heros}
\setmathfont{TeX Gyre Termes Math}

%% With one wrinkle: Unicode maps /mathcal and /mathscr to the same
%% code points, so we need to set /mathcal and /mathbfcal up
%% separately:  Now we have more alphabets than before, and won’t
%% run out.
\setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1,Scale=MatchUppercase]{XITS Math}

\begin{document}
$a\lnsim b$ means $a<b$ and $a\nsim b$.

I'd like $a\lnsim b$ and $a\lesssim b$ to look different.

But also $\lnsim$ to be same size as $\le,\nsim,\ne,=$.

\end{document}


That’s simple, and gets you an operator that’s a little more distinct than the one from newtxmath. The way to actually get what you wanted, though, the amsmath symbol scaled down, involves a little extra trickery:

\documentclass[12pt,varwidth]{standalone}

\usepackage{amssymb}
\usepackage[math-style=TeX]{unicode-math}

%% Basically identical appearance to newtxmath, but all scaling is now
%% automatic.
\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{Linux Libertine O}
\setsansfont{TeX Gyre Heros}
\setmathfont{TeX Gyre Termes Math}

%% With one wrinkle: Unicode maps /mathcal and /mathscr to the same
%% code points, so we need to set /mathcal and /mathbfcal up
%% separately:  Now we have more alphabets than before, and won’t
%% run out.
\setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1,Scale=MatchUppercase]{XITS Math}

%% We can use the same trick to override any range of math characters---
%% such as the ones whose appearance you didn’t like.  In this case,
%% you wanted them to look
%% like amsmath’s, but smaller.
\setmathfont[range={"22E6-"22E9},Scale=0.8]{XITS Math}
%% Since ≁ now looks out of place, change it, then change a number of
%% other tilde operators to match that:
\setmathfont[range={"223B-"223D,"2241-"224C}]{XITS Math}

\begin{document}
$a\lnsim b$ means $a<b$ and $a\nsim b$.

I'd like $a\lnsim b$ and $a\lesssim b$ to look different.

But also $\lnsim$ to be same size as $\le,\nsim,\ne,=$.

\end{document}


Lorehead's answer is very good. However, since I am using pdftex rather than lualatex, I couldn't use the XITS approach. But the answer prompted me to find stix, which is probably not as good as XITS but works with pdflatex. So while the following may not be perfect, it at least gives me much better looking output than anything I had before:

\usepackage[notext]{stix}
\usepackage{amssymb}


I'm accepting Lorehead's answer, but also adding this one for anyone who wants a quick fix to the problem.

• Glad it works for you. I’d considered recommending that, but you said you preferred the appearance of newtxmath, and the two aren’t compatible because they use too many math alphabets. – Davislor Sep 3 '15 at 6:43