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

  • 1
    @PhelypeOleinik no inside a box is always text mode – David Carlisle Jan 25 '18 at 13:36
  • @DavidCarlisle Oh... – Phelype Oleinik Jan 25 '18 at 13:49
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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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