# Arrow between parts of equation in LaTeX

I want to make an arrow under an equation pointing from one part of the equation to another. A bit like an underbrace, but with an arrow. How can I do this?

-

## migrated from stackoverflow.comNov 11 '11 at 7:41

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  N.N. Nov 11 '11 at 8:04
Could you clarify whether you want the arrow to point to specific parts of the equation or not. –  Loop Space Nov 11 '11 at 8:09
Should the arrow be straight or curved? –  Gonzalo Medina Nov 11 '11 at 14:48

Using TikZ, you can place a node for the starting point of the arrow and another one for the ending point, and then join the nodes using the kind of arrow that you desire; a little example, using a curved red arrow and some code to place the nodes borrowed from this answer by Andrew Stacey:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\begin{document}

$$a\tikzmark{a}x^2 + bx + c = 5\tikzmark{b}x^2 + bx + c. \begin{tikzpicture}[overlay,remember picture,out=315,in=225,distance=0.4cm] \draw[->,red,shorten >=3pt,shorten <=3pt] (a.center) to (b.center); \end{tikzpicture}$$

\end{document}


-

Try this one:

\underrightarrow{y = ax^2 + bx + c}

It will look like this:

-

The document mathmode has the sections Over- and underbrackets and Extensible arrows

If you want to define your own style please have a look into the the linked document. An example of the document is shown below.

\documentclass{article}

\usepackage{amsmath}
\makeatletter
\def\mapstofill@{%
\arrowfill@{\mapstochar\relbar}\relbar\rightarrow}
\newcommand*\xmapsto[2][]{%
\ext@arrow0099\mapstofill@{#1}{\displaystyle#2}}
\makeatother
\begin{document}

$\underrightarrow{y = ax^2 + bx + c}$

$\xmapsto{y = ax^2 + bx + c}$
\end{document}


-