0

As shown by the difference between the two lines of the image below, for sufficiently large pairs of parentheses in newtxmath, the space in front of the left parenthesis disappears. This results in spacing that is more cramped than desired. Is there a clean (i.e., without manually adjusting the kerning each time) way to restore this space?

enter image description here

Here is the code used to generate that image:

\documentclass{minimal}

\usepackage{newtxmath}
\usepackage{mathtools}

\DeclarePairedDelimiter{\paren}{\lparen}{\rparen}
\newcommand*{\tall}{\int_0^{t^2} x\,dx}
\newcommand*{\taller}{\sum_{\substack{(k,m)=1\\0 < k < m}} k}

\begin{document}

\begin{align*}
  &\exp\paren*{\tall} \\
  &\exp\paren*{\taller}
\end{align*}

\end{document}
cubesteak
  • 101
  • 3

2 Answers2

2

I prepared two standalone documents, doing \fbox{\Bigg(} first with Computer Modern, then with newtxmath, setting \fboxsep to 0pt and \fboxrule to 0.1pt in order to precisely show the bounding box.

The command \Bigg works exactly the same in text as in math. Next, I did \includegraphics with both outputs, getting

enter image description here

(left CM, right NewTX).

Next experiment, I typeset $\exp\paren[\Bigg]{}$ in both standalone documents.

enter image description here

You can note that the difference in the bounding boxes has an important role.

The difference in the bounding boxes is even more outstanding for really bigger parentheses. Here's the experiment: I define

\makeatletter
\newcommand{\Bigggg}{\bBigg@{4.5}}
\makeatother

and retry the first experiment, getting

enter image description here

Again, left is Computer Modern, right is NewTX. The size is slightly smaller in the latter case, but this shows the problem is in how the bounding box of the composed parentheses are defined.

egreg
  • 1,121,712
1

When you use \left and \right, TeX inserts additional spacing around the delimiters. A command declared with \DeclarePairedDelimiter does not. Therefore, if you wanted the extra space after an operator, you could switch to \left( and \right).

You could also define a command that expands to \,\paren{#1} and use that.

I know I say this a lot, but this is another one of the many, many problems that goes away if you switch to the modern toolchain. unicode-math with TeX Gyre Termes Math looks very similar to newtxmath, but does not have this bug.

Davislor
  • 44,045
  • Thanks for answering! However, this issue is unrelated to \mathopen{} and \mathclose{}: Both the first and second line use \DeclarePairedDelimiter, yet there is a difference in spacing for the larger pair of parentheses. – cubesteak May 22 '20 at 02:38
  • @cubesteak Right, but switching will still get you the additional space you wanted. – Davislor May 22 '20 at 02:45
  • If I switch both sets of parentheses to \left( and \right), the inconsistency in spacing persists. (Of course, I could only use \left( and \right) for sufficiently large parentheses, but this would be no better than manually inserting a mkern when needed.) – cubesteak May 22 '20 at 02:47
  • @cubesteak Another fix is to change fonts to one with better spacing around its extensible symbols? – Davislor May 22 '20 at 02:55
  • Yes---that certainly would work :) I quite like the newtxmath font, so I was just curious if this issue could be fixed without switching fonts entirely. – cubesteak May 22 '20 at 03:04
  • @cubesteak Maybe insert a \mathop atom before the left delimiter? – Davislor May 22 '20 at 03:18
  • Manually adding space like that does work (I find that \mkern1.5mu looks good).

    To add this space automatically, do you happen to know if it's possible to obtain the "size" of parentheses scaled using \left and \right, e.g., the number of extensible segments used?

    – cubesteak May 22 '20 at 03:29
  • 1
    @cubesteak First idea that comes to mind is to store the inner expression in a box, measure its height, and compare that to a threshold value? – Davislor May 22 '20 at 04:07
  • Thanks! Will give that a shot. – cubesteak May 22 '20 at 04:08
  • @cubesteak This problem also goes away if you use TeX Gyre Termes Math with unicode-math. It’s very similar to newtxmath. – Davislor May 22 '20 at 04:11