Label steps of equations using \tikzmark

I was very happy with results obtained in this question: Combine two \tikzmark solutions. (Awaiting @PeterGrill to update his answer) The \tikzmark is a wonderful creation. What am stuck now is to create labels like the one shown in the diagram below:

I knwo that the commands midway and below for nodes can be applied but don't know why I can't get it. Can a simple command be created, say \mylabel{node1}{node2}{text} that does the desired result?

This is my MWE:

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\sn}[2]{\ensuremath{{#1}\times 10^{#2}}}
\newcommand{\mtikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\tikzset{square arrow/.style={to path={-- ++(0,-.25) -| (\tikztotarget)}}}

\begin{document}
\begin{align*}
(\sn{3.14}{-\mtikzmark{a}2}) + (\sn{1.2}{-\mtikzmark{b}4}) &= (\sn{3.14}{-2}) + (\sn{0.012}{-2})\\
&= \sn{(3.14+0.012)}{-2}\\
&= \sn{3.152}{-2}
\tikz[overlay,remember picture] {\draw[<->,square arrow] (a.south) to (b.south);}
\end{align*}
\end{document}


Notice that am still not implementing the solution given in the quoted post as I believe this is a different question. Unfortunately, the \tikzmark definition above is fixed to below and not above of the equation. A customization of the such would be greatly appreciated.

-

This is one possibility, defining two commands \mytlabel (for text above) and \myblabel (for text below) with the following syntax:

\mytlabel[<options>]{<start.mark>}{<end-mark>}{<text>}
\myblabel[<options>]{<start.mark>}{<end-mark>}{<text>}


the optional argument can be used to pass options to the node containing the text for fine tuning:

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\sn}[2]{\ensuremath{{#1}\times 10^{#2}}}
\newcommand{\mtikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\tikzset{mylabel/.style={align=center,fill=white,near start,font=\footnotesize}}

%\mytlabel[options]{start.mark}{end-mark}{text}
\newcommand\mytlabel[4][]{%
\tikz[overlay,remember picture]
{\draw[<->] ([yshift=4pt]#2.north) -- ++(0,0.25)  -| node[mylabel,#1] {#4} ([yshift=4pt]#3.north);}
}
%\myblabel[options]{start.mark}{end-mark}{text}
\newcommand\myblabel[4][]{%
\tikz[overlay,remember picture]
{\draw[<->] (#2.south) -- ++(0,-0.2)  -| node[mylabel,#1] {#4} (#3.south);}
}

\begin{document}
\begin{align*}
(\sn{3\mtikzmark{e}.14}{-\mtikzmark{a}2}) + (\sn{1.2}{-\mtikzmark{b}4})
&= (\sn{3\mtikzmark{f}.14}{-\mtikzmark{c}2}) + (\sn{0.012}{-\mtikzmark{d}2})\\[1ex]
&= \sn{(3.14+0.012)}{-2}\\
&= \sn{3.152}{-2}
\end{align*}
\mytlabel{a}{b}{not equal}
\mytlabel{c}{d}{equal}
\myblabel[anchor=north,yshift=4pt]{e}{f}{The decimal is moved \\ to the left to increase \\ the exponent}
\end{document}


-
Would one have to manually define the south to input the label The decimal is moved to the left to increase the exponent.? –  azetina Oct 13 '12 at 3:38
@azetina please see my updated answer. –  Gonzalo Medina Oct 13 '12 at 3:41
Seems to do the job. Very much appreciated. –  azetina Oct 13 '12 at 3:48
@azetina You're welcome! I updated my answer with some comments and an improved version. –  Gonzalo Medina Oct 13 '12 at 3:54
Typographically speaking, is a \parbox better for the text than centering it? –  azetina Oct 13 '12 at 4:06