3

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}

with no options

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:

enter image description here

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 03 '15 at 00: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 03 '15 at 00:23
  • What are you using for Times? Normally, you should use the text font for letters etc. in maths. – cfr Sep 03 '15 at 00: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? (http://www.acm.org/publications/article-templates/acm-latex-style-guide) – user3188445 Sep 03 '15 at 00:28
  • 2
    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 03 '15 at 00:42
  • You should not load any font packages or change the format. The New Century/Helvetica combo is only to approximate the final printed result. (It says this in the comments in the file.) If you are concerned that 2 symbols look too alike and will confuse readers, then email your production editor and ask whether the difference will be sufficiently clear in the final font or whether you should take any other steps to distinguish them. Understand that choice of font and layout is not yours to make. You are responsible for, and have control over, only the content - not the design. – cfr Sep 03 '15 at 00:52
  • @cfr: Thanks for the advice. With this particular journal, I get to keep distributing my version of the file. Experience shows that 99% of people will actually read the free version on my web page rather than the paywalled official version typeset by the publisher. I'm asking my question for two reasons: 1) to make my unofficial version look as good as possible, and 2) to help people who are translating my paper into other languages (not through the publisher). As you say, whatever fonts I pick won't affect the publisher's final version. – user3188445 Sep 03 '15 at 02:59
  • Ah, fair enough. It is just that sometimes people jump through hoops because they don't really think about the fact that the publisher will make changes which destroy the hoops anyway ;). – cfr Sep 03 '15 at 11:57

2 Answers2

2

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: enter image description here

After: Scalebox solution

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}

With Unicode

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}

Correct solution

Davislor
  • 44,045
1

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.

enter image description here

  • 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 03 '15 at 06:43