# Unicode math and subscript spacing

The following code results in the 'j' being too far away from the parenthesis:

\documentclass[a4paper, 12pt]{article}

\usepackage[english]{babel}

\usepackage{amsmath}

\usepackage{fontspec}
\setmainfont{STIX Two Text}
\let\arrowvert\undefined
\RequirePackage[stix2]{newtxmath}
\let\openbox\undefined
\DeclareSymbolFont{operators}{OT1}{stix2}{m}{n}
\SetSymbolFont{operators}{bold}{OT1}{stix2}{b}{n}

\newcommand{\p}[1]{\left({{}{#1}}_{{}}\,\negthickspace\right)}

\title{Untitled}
\date{Typeset on \today}

\begin{document}

\maketitle

$$D_{v_p} = \p{ {\widehat e}_i }_{j}$$

\end{document}


Upon commenting the STIX-related code, the problem seems to disappear. Replacing it with \usepackage{unicode-math} produces the same artifact.

What is wrong?

• What's your use case for wanting to using \left( and \right)? to encase \hat{e}_i (or \widehat{e}_i)? Put differently, why not write (\widehat{e}_i)_j or, if you prefer, {(\widehat{e}_i)}_j-- and obtain nicely spaced subscripts?
– Mico
Jan 30, 2021 at 12:00
• @Mico, this does not seem like an extremely general solution. Jan 30, 2021 at 12:10
• "Extremely general solutions" are usually not optimal solutions. Hence my question: What's your use case for deliberately generating parentheses that can be much too large for the job and can generate all kinds of odd, but utterly avoidable, follow-up problems?
– Mico
Jan 30, 2021 at 12:29
• @Mico, I hoped there is a simpler way. Jan 30, 2021 at 12:59
• @MikeLand You triggered a LuaTeX bug here, but that only applies to legacy math fonts, so it does not happen with unicode-math. So it's impossible to say why your attempt with unicode-math didn't work without seeing the code. Currently the unicode-math tag and title are a bit misleading since the question is mostly about what happens with legacy math. Jan 30, 2021 at 13:39