# Resolving inconsistent sub/superscript behavior with newpxmath and certain delimiters

Edit: I reached out to the package maintainer and he very quickly patched the issue. As of newpx version 1.410 (released 2/15/20), the issue should be resolved.

I recently started using newpxmath which I quite like, but it seems to have an issue aligning a superscript and subscript in certain circumstances.

The following example, without newpxmath, works fine and after every pair of delimiters, we see proper alignment between the subscript 2 and the superscript 2.

\documentclass{minimal}
\usepackage{mathtools}

\begin{document}

$\vec{x}^2_2$
\vspace{2mm}

$(\vec{x})^2_2$
\vspace{2mm}

$\left(\vec{x}\right)^2_2$
\vspace{2mm}

$\left\lVert\vec{x}\right\rVert^2_2$
\vspace{2mm}

Fixed: $|\vec{x}|^2_2$
\vspace{2mm}

Fixed: $\lVert \vec{x}\rVert^2_2$

\end{document}


However, after switching to newpxmath, the last two examples are slightly off, with the superscript 2 being slightly to the right of the subscript 2:

\documentclass{minimal}
\usepackage{newpxtext,newpxmath}
\usepackage{mathtools}

\begin{document}

$\vec{x}^2_2$
\vspace{2mm}

$(\vec{x})^2_2$
\vspace{2mm}

$\left(\vec{x}\right)^2_2$
\vspace{2mm}

$\left\lVert\vec{x}\right\rVert^2_2$
\vspace{2mm}

Bad: $|\vec{x}|^2_2$
\vspace{2mm}

Bad: $\lVert \vec{x}\rVert^2_2$

\end{document}


Is this a bug in newpxmath, or am I misunderstanding the expected behavior, and either way is there a workaround?

• Remember that the minimal class is not meant for MWEs (confusingly enough, it is used for some internal testing, and may not setup some stuff that packages need). Might be better to use article or similar. – daleif Feb 13 '20 at 12:27
• The difference is definitely there with \}, \rvert and \rVert. I believe you should better contact the maintainer (Michael Sharpe). He's the only one who can tell if this is the intended behaviour or not. – campa Feb 14 '20 at 8:59
• @campa: I sent him an email and he immediately got back saying he'd publish an update soon ! – daturkel Feb 15 '20 at 0:30

Here there is my MWE with the correct sub/superscripts.

EDITS: By correct comments of the users.

\documentclass[a4paper,12pt]{article}
\usepackage{newpxtext,newpxmath}
\usepackage{mathtools}
\usepackage{xcolor}
\begin{document}
$\vec{x}^2_2$

$(\vec{x})^2_2$

$\left(\vec{x}\right)^2_2$

$\left\lVert\vec{x}\right\rVert^2_2$

$\textbf{Improved brackets}\quad |\vec{x}|{^{2}_{2}}, \quad \lVert \vec{x}\rVert{^{2}_{2}}$
\end{document}

• While the hack apparently solves the issue, I would never refer to this as "use correctly the brackets" (=braces). – campa Feb 13 '20 at 10:22
• @campa Ok. I agree with you..excuse me. – Sebastiano Feb 13 '20 at 11:58
• Remember it is never a good idea to use the minimal class for MWEs – daleif Feb 13 '20 at 12:22
• @daleif I have just copied by the MWE of the user. Now edit my answer. – Sebastiano Feb 13 '20 at 12:23
• I sometimes do it a little differently \newcommand\dvec[1]{\smash{\vec{#1}}\vphantom{#1}} then left/right never sees the vector arrow – daleif Feb 13 '20 at 12:40