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.