# Wrong position of the vcentered minus sign in subscript using stix2

Is there any way to place minus sign at the same height as the horizontal bar of the plus without using raisebox?

\documentclass{article}

\usepackage{stix2}

\begin{document}
$$I_{a\vcenter{\hbox{\scriptscriptstyle+}}}^{\alpha}$$

$$I_{a\vcenter{\hbox{\scriptscriptstyle-}}}^{\alpha}$$
\end{document}


• In my opinion, it is not good to place the minus symbol like that. – user156344 Dec 17 '18 at 11:45

The result is somewhat expected, because the bounding box of the minus sign is tight; in the standard Computer Modern fonts it is instead the same as for the + sign.

\documentclass{article}

\usepackage{stix2}

\begin{document}

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

$$I_{a\vcenter{\hbox{\scriptscriptstyle+}}}^{\alpha}$$

$$I_{a\vcenter{\hbox{\scriptscriptstyle-}}}^{\alpha}$$

\end{document}


If I comment out stix2, I get

Solution: add \vphantom{+}:

\documentclass{article}

\usepackage{stix2}

\begin{document}

$$I_{a\vcenter{\hbox{\scriptscriptstyle+}}}^{\alpha}$$

$$I_{a\vcenter{\hbox{\scriptscriptstyle{-}\vphantom{+}}}}^{\alpha}$$

\end{document}


A generic definition:

\documentclass{article}

\usepackage{stix2}

\makeatletter
\newcommand{\splus}{{\mathpalette\splus@minus+}}
\newcommand{\sminus}{{\mathpalette\splus@minus-}}
\newcommand{\splus@minus}[2]{%
\vcenter{\hbox{$\m@th \ifx#1\displaystyle\scriptstyle\else \ifx#1\textstyle\scriptstyle\else \scriptscriptstyle\fi\fi \vphantom{+}{#2}$%
}}%
}
\makeatother

\begin{document}

$$a\splus$$ $$a\sminus$$

$$I_{a\splus}^{\alpha}$$

$$I_{a\sminus}^{\alpha}$$

\end{document}


• Oh, I see. I didn't expect that it could be connected with boxes size. Thank you very much. Your explanations are always very instructive. – Serafiel Dec 17 '18 at 12:27
• Even if I don't see the author of the answer from the beautiful images of your computer I immediately understand that you are you. :-) Beautiful hat with the propeller. – Sebastiano Dec 17 '18 at 12:35