# Overbracket with tikz square arrow style

I am trying to place text to the right of the brackets so that it doesn't overlap the equation.

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc}

\usepackage{amsmath}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\tikzset{square arrow/.style={to path={-- ++(0,.25) -| (\tikztotarget)}}}

\begin{document}
$=\, -\nu_{gx}\, \dfrac{\partial \, \left<\tikzmark{a}n\right>}{\partial\,x} \, =\, -\nu_{gx} \, \dfrac{\partial \left<\tikzmark{b}\eta_{0}\right>}{\partial \,x} \, \dfrac{\partial \,T}{\partial \,x} \tikz[overlay,remember picture] {\draw[<->,square arrow] ((a.north)+(0.25em,1.25ex)) to ((b.north)+(0.50em,1.25ex)) node [above,right] {local thermal equilibrium!};}$
\end{document}


-

You need to adjust the parameters of the two endpoints for the width of the characters in the angle brackets:

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc}

\usepackage{amsmath}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\tikzset{square arrow/.style={to path={-- ++(0,.25) -| (\tikztotarget)}}}

\begin{document}
$=\, -\nu_{gx}\, \dfrac{\partial \, \left<\tikzmark{a}n\right>}{\partial\,x} \, =\, -\nu_{gx} \, \dfrac{\partial \left<\tikzmark{b}\eta_{0}\right>}{\partial \,x} \, \dfrac{\partial \,T}{\partial \,x} \tikz[overlay,remember picture]{% \draw[<->,square arrow, red, thick] ((a.north)+(0.25em,0.30ex)) to ((b.north)+(0.50em,0.30ex)) ; \node [above, yshift=1.50ex, blue] at ((a.north)!0.5!(b.north)) {label}; }$


\end{document}

-
I actually want the \tikzmark centered above the mentioned expressions, so the arrows would be right above the $n$ and the $\eta_{0}$. I also cannot figure out how to place arrows at both ends of the bracket. –  Brazos Wolf Oct 5 '12 at 7:19
@BrazosWolf: Have updated solution. Let me know if that is what you desired. –  Peter Grill Oct 5 '12 at 7:37
Looks brilliant. But then I decided to complicate matters and actually desire text to go with it. –  Brazos Wolf Oct 5 '12 at 8:01
@BrazosWolf: Ok, have updated it to allow for a label. –  Peter Grill Oct 5 '12 at 8:07
thanks. looks perfect with node [right,yshift=1.5ex] –  Brazos Wolf Oct 5 '12 at 8:11

You could (mis-)use chemmacros' redox commands: \OX{<name>,<text>} to mark the places and \redox(<name1>,<name2>) to connect them:

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{chemmacros}

\begin{document}

$=\, -\nu_{gx}\, \dfrac{\partial \, \left<\OX{a,n}\right>}{\partial\,x} \, =\, -\nu_{gx} \, \dfrac{\partial \left<\OX{b,\eta_{0}}\right>}{\partial \,x} \, \dfrac{\partial \,T}{\partial \,x}$
\redox(a,b)[<->]{text over}
\end{document}


It has some options for customization:

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{chemmacros}

\begin{document}

\chemsetup[redox]{sep=1em,dist=1em}
$=\, -\nu_{gx}\, \dfrac{\partial \, \left<\OX{a,n}\right>}{\partial\,x} \, =\, -\nu_{gx} \, \dfrac{\partial \left<\OX{b,\eta_{0}}\right>}{\partial \,x} \, \dfrac{\partial \,T}{\partial \,x}$
\redox(a,b)[<->,draw=blue]{text over}
\end{document}


Edit: new requirements:

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{chemmacros}

\begin{document}

\chemsetup[redox]{sep=1em,dist=1em}
$=\, -\nu_{gx}\, \dfrac{\partial \, \left<\OX{a,n}\right>}{\partial\,x} \, =\, -\nu_{gx} \, \dfrac{\partial \left<\OX{b,\eta_{0}}\right>}{\partial \,x} \, \dfrac{\partial \,T}{\partial \,x}$
\redox(a,b)[<->]
\tikz[remember picture,overlay] \draw (b.east) ++(0,.75) node[right] {local thermal equilibrium!};
\end{document}


-
So much more elegant and terse than my attempted solution. –  Brazos Wolf Oct 5 '12 at 7:57
However, I have to compile it twice to get the desired effect. Why is that? –  Brazos Wolf Oct 5 '12 at 7:58
Also, is there any way to push the text to the side of the bracket using chemmacros? –  Brazos Wolf Oct 5 '12 at 8:06
that's because of TikZ' remember picture option: in the first run the position of the coordinates has to be remembered –  clemens Oct 5 '12 at 8:06
Not directly, but the nodes can be accessed with TikZ in the standard way, I'll add an edit. –  clemens Oct 5 '12 at 8:09