[Tex/LaTex] \overset and superscripts

oversetpositioningsuperscripts

Consider this MWE:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
&\overset{0}{\mathcal{D}^{\alpha\beta}}\\
&\overset{0}{\mathcal{D}}^{\alpha\beta}
\end{align}
\end{document}

which gives the following (both wrong!) results:

enter image description here

I want the superscripts athe the level of the top of $\mathcal{D}$ (as in the first case), but the overset $0$, must be only over the $\mathcal{D}$, not the superscripts (as in the second line).

How can I do that?

Best Answer

You can do that very simply with \accentset from the accents package. Note it is by default in scriptscriptstyle. You can force scriptstyle, but the documentation of the package warns you can have trouble. In the present example, it seems to work:

\documentclass{article}
\usepackage{amsmath}
\usepackage{accents}

\begin{document}

\begin{align*}
    & \accentset{0}{\mathcal{D}}^{0\alpha\beta} \\
    & \accentset{\scriptstyle 0}{\mathcal{D}}^{0\alpha\beta}
\end{align*}

\end{document} 

enter image description here

Related Question