Schrodinger's equation [duplicate]

Trying to get Schrodinger's equation to format better. The first term is

-\dfrac{\hslash^2}{2m} \, \dfrac{\mathrm{d}^2 \psi}{\mathrm{d} x^2}


However, because of the exponent in the denominator, the second fraction prints lower than the first one, and looks unbalanced. Is there a way to drop the baseline for the exponent of the first fraction so they line up? Also, this is in beamer, if that adds other complexity to the issue

• Regarding physics: Keep in mind, that the spacial derivative is only a partial derivative, hence use \partial instead of \mathrm{d}. Feb 9, 2014 at 18:50
• Yes, but we're just working in one dimension, so \mathrm{d} is proper. Feb 9, 2014 at 20:09

\vphantom can be used in the denominator of the first fraction to line to increase the height to the height of the second denominator.

Because we have fractions with superscripts, it becomes a little more complicate, because TeX changes into the "cramped" math style, where the superscripts are less raised. Therefore the example calculates the height in macro \crampedvphantom. The macro uses \overline to force TeX to change the math style into its cramped math style for the expression in the argument.

In the example I have increased the height of the second denominator a little to make the effect more visible:

\documentclass{beamer}
\usepackage{amsmath}
\usepackage{amssymb}

\makeatletter
\newcommand*{\crampedvphantom}[1]{%
\mathpalette\cramped@vphantom{#1}%
}
\newcommand*{\cramped@vphantom}[2]{%
\sbox0{$#1\overline{}$}%
\sbox2{$#1\overline{#2}\m@th$}%
\dimen0=\ht2 %
$-\dfrac{\hslash^2}{2m \crampedvphantom{\partial x^{2^{1^1}}}} \, \dfrac{\partial^2 \psi}{\partial x^{2^{1^1}}}$

• Perhaps the OP meant \mathrm{d}^2 instead of \mathrm(d)^2? Feb 9, 2014 at 18:34
• @GonzaloMedina: Yes, this makes sense. The example also now uses \partial (see Henri Menke's comment/answer) and takes into account the "cramped" math style. Feb 9, 2014 at 19:05