5

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}

enter image description here

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

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}

enter image description here

If I comment out stix2, I get

enter image description here

Solution: add \vphantom{+}:

\documentclass{article}

\usepackage{stix2}

\begin{document}

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

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

\end{document}

enter image description here

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}

enter image description here

  • 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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.