[Tex/LaTex] Minus sign not aligning with fraction

alignmentfractionssuperscripts

When I use subscripts and superscript with \frac the numerator and denominator looks very tight,

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb}


\begin{document}
\[e^{-\frac{(x-\mu_2)^2}{2\sigma^2_2}}\]
\[e^{-\dfrac{(x-\mu_2)^2}{2\sigma^2_2}}\]
\end{document}

enter image description here

So I tried using \dfrac but not the minus sign and fraction line are not aligned.

enter image description here

Anybody has a smart fix to this?

Best Answer

The cause of the misalignment is that the minus sign is in scriptstyle, but the fraction is being forced into displaystyle. Here are a few options:

\[e^{\displaystyle -\frac{(x-\mu_2)^2}{2\sigma^2_2}}\]

enter image description here

\[e^{\dfrac{-(x-\mu_2)^2}{2\sigma^2_2}}\]

enter image description here

\[e^{-(x-\mu_2)^2/2\sigma^2_2}\]

enter image description here

\[\exp\bigl(-(x-\mu_2)^2/2\sigma^2_2\bigr)\]

enter image description here

Related Question