# overbrace/underbrace but with an arrow instead

Is there a similar command to \overbrace{foo}^{bar} but instead of braces, an arrow pointing up/down?

EDIT: Here's a little demonstration of how I'd expect something like this to work:

And possible syntax would be \overarrow{a=b}^{\text{theorem X}}

-
How would you place the arrow? The point of the overbrace is that its width adapts to the formula, while a vertical arrow is rather thin in the horizontal direction. Not much you can do about that. –  Harald Hanche-Olsen Jan 11 '11 at 15:10
@Harald: see my edit. –  daniel.jackson Jan 11 '11 at 15:18
Do you really want the arrow centered over "a=b"? That would become very strange if you do it over "i=m" since those letters definitely have different widths. Maybe it's better to put it just over the "=". –  Hendrik Vogt Jan 11 '11 at 15:26
@Hendrik: yes, what you said makes more sense. –  daniel.jackson Jan 11 '11 at 15:34

Here is a generalized approach, providing \overarrow[<relation>][<arrow>]{<stuff>}. By default <relation> is = and <arrow> is \uparrow (both arguments are optional). A complement to this is provided by \underarrow[<relation>][<arrow>]{<stuff>} for typesetting underneath <operator> (<arrow> has the default <downarrow> in \underarrow).

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{xparse}% http://ctan.org/pkg/xparse

\NewDocumentCommand{\overarrow}{O{=} O{\uparrow} m}{%
\overset{\makebox[0pt]{\begin{tabular}{@{}c@{}}#3\0pt]\ensuremath{#2}\end{tabular}}}{#1} } \NewDocumentCommand{\underarrow}{O{=} O{\downarrow} m}{% \underset{\makebox[0pt]{\begin{tabular}{@{}c@{}}\ensuremath{#2}\\[0pt]#3\end{tabular}}}{#1} } \begin{document} \begin{align*} \alpha &\overarrow{Theorem X}\beta & \alpha &\underarrow{Theorem X}\beta \\ \alpha &\overarrow[\approx]{Theorem Y}\beta & \alpha &\underarrow[\approx]{Theorem Y}\beta \\ \alpha &\overarrow[>][\downarrow]{Theorem Z}\beta & \alpha &\underarrow[>][\uparrow]{Theorem Z}\beta \end{align*} \end{document}  One difference between this typesetting and that proposed by @Herbert is that \stackrel modifies the size of the upper component. Since \overarrow and \underarrow in this answer uses tabular to stack the items, no size adjustment is visible. xparse provides the interface for mixing optional/mandatory arguments. - \documentclass{article} \usepackage{amsmath} \makeatletter \def\overUnderArrow{\@ifnextchar[\overUnderArrow@i{\overUnderArrow@i[]}} \def\overUnderArrow@i[#1]#2#3{% #1 under #2 over #3 main argument \ifx\relax#1\relax\array[b]{c}\overset{\text{#2}}{\uparrow}\\#3\endarray \else\ifx\relax#2\relax \array[t]{c}#3\\\underset{\text{#1}}{\downarrow}\endarray \else \array{c}\overset{\text{#2}}{\uparrow}\\#3\\\underset{\text{#1}}{\downarrow}\endarray \fi\fi} \makeatother \begin{document} \[ \overUnderArrow[TheoremX]{TheoremX}{\alpha = \beta} \overUnderArrow{TheoremX}{\alpha = \beta} \overUnderArrow[TheoremX]{}{\alpha = \beta}

\end{document}


The syntax is \overUnderArrow[below]{above}{main entry}. It is also possible to extend the definition for variable arrows direction.

-
is it possible to modify this to a down arrow and position everything beneath? also how can I add some padding around the arrow? it's too close sometimes i.imgur.com/N1MHu.png –  daniel.jackson Dec 9 '11 at 19:23
how should I know what and how you extracted something from my solution ... –  Herbert Dec 9 '11 at 19:25
I'm talking about your solution as it is shown here.. is it possible to alter it to do what I asked? –  daniel.jackson Dec 9 '11 at 20:31
I added a command for a down arrow, see answer –  Herbert Dec 9 '11 at 20:54