Putting arrows above text [duplicate]

I'm trying to typeset the following (the part in green I'd like to add, but don't know how to:

Here's my sample code:

\documentclass{article} \begin{document} $$=F_j\underbrace{\frac{\partial G_j}{\partial x_i}}_{\substack{\text{derivative} \\ \text{acts} \\ \text{only} \\ \text{on} \: \vec G} }-F_j\frac{\partial G_j}{\partial a_j}$$ \end{document}

Any ideas?

marked as duplicate by Reinstate Monica - M. Schröder, LaRiFaRi, Thorsten, dustin, user11232 Sep 28 '14 at 15:14

You shouln't use $$…$$, which is a plain TeX construction and can result in bad vertical spacing. Use $…$ instead.

Here is a solution using pst-node and must be compiled through LaTeX -> dvips -> pstopdf (auto-pst-pdf doesn't work here, for some reason). Also, I used the esvect package to have arrows above capital letters that have a more correct size (\overrightarrow is too large).

\documentclass[x11names]{article}
\usepackage{mathtools}
\usepackage[b]{esvect}
\usepackage{pst-node}

\begin{document}

$% =\rnode{A}{F_j}\underbrace{\rnode{B}{\dfrac{∂ G_j}{∂ x_i}}}_{\mathclap{\substack{\text{derivative} \\ \text{acts only} \\ \text{on} \: \vv G}} }-F_j\frac{∂ G_j}{∂ a_j} \ncbar[angleA=90, nodesep=3pt, arrows=<->, linecolor=DarkSeaGreen3]{A}{B} \naput[labelsep =1pt]{\color{DarkSeaGreen3}\textsf{\scriptsize Scalar product}}$%

\end{document}