7

I have a problem with spacing. I think the problem comes from the package newtx.

Here is a MWE:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{newtxtext}
\usepackage[frenchmath]{newtxmath}

\begin{document}
  $\underbrace{1+2-3}_{=0}$
\end{document}

The 0 seems to be too near the equal sign. If I uncomment the two lines of newtx, the spacing seems better

1 Answer 1

6

The = has a very tight bounding box in NewTX. In what follows I use {=}0 in order to show the tightness also in text (or display) style.

Note that the sidebearings in Computer Modern are not that big, but the difference is noticeable.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{newtxtext}
\usepackage[frenchmath]{newtxmath}

\begin{document}

{\fboxsep=0pt\fboxrule=0.1pt\fbox{$=$}}

${=}0\quad\underbrace{1+2-3}_{=0}$

\end{document}

enter image description here

If I comment out the newtx lines, I get

enter image description here

As you see, relation spaces are not added in script style. In this case I think it's good practice to add the \; space manually.

\underbrace{1+2-3}_{=\;0}

enter image description here

Another possible solution is to add some sidebearing to =.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{newtxtext}
\usepackage[frenchmath]{newtxmath}

\newcommand{\widereq}{\mkern0.5mu\equals\mkern0.5mu}
\begingroup\lccode`~=`=\lowercase{\endgroup\let~}\widereq
\mathchardef\equals=\mathcode`=
\AtBeginDocument{\mathcode`=="8000 }

\begin{document}

{\fboxsep=0pt\fboxrule=0.1pt\fbox{$=$}}

${=}0\quad\underbrace{1+2-3}_{=0}$

\end{document}

enter image description here

8
  • Thank you for your help. But the problem is that I have been using newtxmath for not so long, and I have many math documents with just _{=0}. I can’t do what you suggest in all my documents. For the future ones, ok, but for the old ones …
    – Didier
    Oct 15, 2022 at 11:42
  • I had already created a topic about spacing with newtxmath : tex.stackexchange.com/questions/617156/…. And you had answered that the spacing was wrong.
    – Didier
    Oct 15, 2022 at 11:52
  • @Didier I added the images and took the occasion to show an alternative approach.
    – egreg
    Oct 15, 2022 at 13:44
  • Thank you again, @egreg. Unfortunately, I am not sure I understood correctly your answer (I am French). Is the spacing _{=0} normal? Your first suggestion is to add \; manually. But in your image, the spacing seems very big, but maybe it is normal? What I don’t understand is why LaTeX doesn’t handle correctly the spacing in scriptstyle, and why I should add a \; manually. And didn’t you reverse the first two images? Because with newtxmath the spacing is narrower with my documents but it is the opposite in your images. And your second suggestion is way beyond my understanding
    – Didier
    Oct 15, 2022 at 19:56
  • I also have the same problem with >0, …
    – Didier
    Oct 15, 2022 at 19:57

You must log in to answer this question.

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