Regular sized fonts in oubraces package

I am using the oubraces package to get overlapping over/underbraces in an equation. My equation is in the following MWE:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{oubraces}
\begin{document}

$$\overunderbraces{&&\br{1}{\text{Diagonal in k-space}}&&\br{3}{\text{Diagonal in x-space}}}{i\hbar\frac{d\psi_n(x)}{dt}&=&-\frac{\hbar^2}{2m}\frac{\partial^2\psi_n(x)}{\partial x^2}&+&\frac{1}{2}m\omega^2x^2\psi_n(x)&+&f(x,t)\psi_n(x)}{&&\br{3}{\text{Diagonal in Hermite-Gauss basis}}&&\br{1}{\text{Diagonal in x-space}}}$$

\end{document}


which produces this:

The fractions are compressed to smaller than the usual display math font size. How do I restore the full sized fonts?

• Try \dfrac instead of \frac. – CarLaTeX Oct 19 at 5:19
• Worked perfectly, thanks! (I'd give you the reputation boost for a correct answer, but I can't since it's just a comment?) – user502382 Oct 19 at 5:23
• I'll add an answer, thanks. – CarLaTeX Oct 19 at 5:29

Just use \dfrac instead of \frac

If you like, you could add some \rules for increasing the vertical spacing.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{oubraces}

\begin{document}
Without \verb|\rule|:
$$\overunderbraces{&&\br{1}{\text{Diagonal in k-space}}&&\br{3}{\text{Diagonal in x-space}}}{i\hbar\dfrac{d\psi_n(x)}{dt}&=&-\dfrac{\hbar^2}{2m}\dfrac{\partial^2\psi_n(x)}{\partial x^2}&+&\dfrac{1}{2}m\omega^2x^2\psi_n(x)&+&f(x,t)\psi_n(x)}{&&\br{3}{\text{Diagonal in Hermite-Gauss basis}}&&\br{1}{\text{Diagonal in x-space}}}$$
With \verb|\rule|:
$$\overunderbraces{&&\br{1}{\text{Diagonal in k-space}}&&\br{3}{\text{Diagonal in x-space}}}{i\hbar\dfrac{d\psi_n(x)}{dt}&=&\rule[-10pt]{0pt}{30pt}-\dfrac{\hbar^2}{2m}\dfrac{\partial^2\psi_n(x)}{\partial x^2}&+&\dfrac{1}{2}m\omega^2x^2\psi_n(x)&+&f(x,t)\psi_n(x)}{&&\br{3}{\text{\rule{0pt}{7pt}Diagonal in Hermite-Gauss basis}}&&\br{1}{\text{Diagonal in x-space}}}$$

\end{document}


• Short answer deserves a +1! – manooooh Oct 19 at 5:45
• @manooooh Thank you, lol! – CarLaTeX Oct 19 at 5:47

You can patch \overunderbraces to use \displaystyle for the main formula when in a display environment (equation, align and so on), checking for \if@display that's provided by amsmath.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{oubraces}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\overunderbraces}
{&\hfil$} {&\hfil$\if@display\displaystyle\fi}
{}{}
\patchcmd{\overunderbraces}
{&\hfil${}} {&\hfil$\if@display\displaystyle\fi{}}
{}{}
\makeatother

\begin{document}

$$\overunderbraces{% &&\br{1}{\text{Diagonal in k-space}}% &&\br{3}{\text{Diagonal in x-space}}% }{% i\hbar\frac{d\psi_n(x)}{dt}% &=% &-\frac{\hbar^2}{2m}\frac{\partial^2\psi_n(x)}{\partial x^2}% &+% &\frac{1}{2}m\omega^2x^2\psi_n(x) &+ &f(x,t)\psi_n(x)% }{% &&\br{3}{\text{Diagonal in Hermite-Gauss basis}}% &&\br{1}{\text{Diagonal in x-space}}% }$$

\end{document}


Note that I used {-} after the & in order to fix the spacing.