1

(This question is close to scalebox / resizebox shifts fraction component, but the answer there provided did not fixed my issue)

When using scalebox, in a subscript, inside a fraction, it seems to weird out other elements in the fraction. This is my example:

I need a shorter minus sign, for this I define

\newcommand{\unaryminus}{\scalebox{0.4}[1.0]{\( - \)}}

And now I tried to use it inside a fraction, as a subscript

\frac{\gamma_{1,\unaryminus 1}{+}\gamma_{2,0}{+}\gamma_{3,1}}{3}

which gives

Fraction

pancho
  • 227

1 Answers1

2

You need to use the current math style:

\documentclass{article}
\usepackage{amsmath,graphicx}

\newcommand{\unaryminus}{{\text{\scalebox{0.4}[1.0]{\( - \)}}}}

\begin{document}

\[
\frac{\gamma_{1,\unaryminus 1}{+}\gamma_{2,0}{+}\gamma_{3,1}}{3}
\]

\end{document}

enter image description here

Slightly more efficient:

\documentclass{article}
\usepackage{amsmath,graphicx}

\newcommand{\unaryminus}{\mathord{\mathpalette\scaledunary{-}}}
\makeatletter
\newcommand{\scaledunary}[2]{%
  \scalebox{0.4}[1.0]{$\m@th#1#2$}%
}
\makeatother

\begin{document}

\[
\frac{\gamma_{1,\unaryminus 1}{+}\gamma_{2,0}{+}\gamma_{3,1}}{3}
\]

\end{document}
egreg
  • 1,121,712