# Nonstandard (non?)nesting of over- and under-braces

\overbrace{ABCDEFG = HIJKL} = PQRSTUV
ABCDEFG = \underbrace{HIJKL = PQRSTUV}


LaTeX can handle either of the lines above. How can I get both the overbrace and the underbrace, when they overlap like that?

The package oubraces should solve your problem!

Once you load the package, the command works like this:

\overunderbraces{upper braces}{main formula}{lower braces}


which needs you to split your equation into multiple columns using &, and the braces command is

\br{n}{label}


where n is the number of columns to span and the label braces can be left blank.

So for your example, you'd have

$\overunderbraces{&\br{2}{}&}{&ABCDEFG= & HIJKL &=PQRSTUV}{&&\br{2}{}}$


You have to use some trickery. The following uses How to put a big bracket under different parts of a equation so that I could write e.g. a text specific to that part in the equation? as a guide:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

$\renewcommand{\arraystretch}{2.5}% Just for this example \begin{array}{c} \overbrace{ABCDEFG = HIJKL} = PQRSTUV \\ ABCDEFG = \underbrace{HIJKL = PQRSTUV} \\ \mathrlap{\overbrace{\phantom{ABCDEFG = HIJKL}}} ABCDEFG = \underbrace{HIJKL = PQRSTUV} \end{array}$

\end{document}