Math Mode – How to Draw Annotated Braces Over and Under Math Expressions?

bracesmath-mode

What LaTeX markup would one have to write to produce a result similar to the image below?

enter image description here

Please excuse my Paint-and-mouse drawing skills. 🙂

Best Answer

amsmath's \text can help to obtain the correct size of superscript/subscript fonts in math mode, while the bracing it possible using the traditional \overbrace/\underbrace:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
$\overbrace{a\rightarrow\underbrace{(b\rightarrow c)}_{\text{bar}}}^{\text{foo}}$
\end{document}

For other symbols (like arrows), see the Comprehensive LaTeX Symbol List.