How to draw a double-ended arrow between the numerator and denominator in a frac inside a sqrt, and an arrow labeled by an otimes pointing to that?

Here's what I have, and I've hand drawn what I seeking:

I'm after (a) a double-ended arrow with the two ends pointing to the numerator and denominator of a fraction under a square root, and (b) an arrow pointing to the double-ended arrow labeled by an \otimes.

I'm typesetting old lecture notes in LaTeX and need to be as accurate as possible, so this is what I need to do. But it doesn't strike as straightforward.

I tried using baseline in tikz, but it didn't come out symmetric, and I wouldn't even know where to begin with the arrow pointing to the double-ended arrow.

\documentclass{article}

\usepackage{amsmath}
\usepackage{tikz}

\begin{document}

\begin{equation*}
\sqrt{\frac{N}{p(1-p)}}
\end{equation*}

\end{document}

• Have a look for tikzmark – cmhughes Jun 11 '15 at 7:14

A solution that uses calc to determine the position of the double arrow:

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

\begin{document}
\begin{tikzpicture}[execute at begin node = $\displaystyle, execute at end node =$]
\node (eq) {\sqrt{\frac{N}{p(1-p)}}};
\draw[<->] ($(eq.north east)!.3!(eq.south east)$) to[in=0, out=0,distance=10] node[right] {\leftarrow\otimes} ($(eq.north east)!.7!(eq.south east)$);
\end{tikzpicture}
\end{document}


• For a longer arrow, change \leftarrow to \longleftarrow
• You can use colours by adding \color{}
• The size of the bend of the double arrow is in distance=...
• The vertical position of the arrowheads of the double arrow are the !.3! and !.7!
• The horizontal position of the arrowheads of the double arrow can be adjusted by adding -(.4,0).

Example:

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

\begin{document}
\begin{tikzpicture}[execute at begin node = $\displaystyle, execute at end node =$]
\node (eq) {\sqrt{\frac{N}{p(1-p)}}};
\draw[<->,red] ($(eq.north east)!.3!(eq.south east)-(.4,0)$) to[in=0, out=0,distance=20] node[right] {\color{blue}\longleftarrow \color{green}\otimes} ($(eq.north east)!.7!(eq.south east)$);
\end{tikzpicture}
\end{document}


• Remarkable! Thanks for this (and thanks to the other answerer). – Rebecca J. Stones Jun 11 '15 at 8:10

Here is something that should get you started on using tikzmark:

Notes:

• This does require two runs. First one to determine the locations, and the second to do the drawing.

• There probably are easier ways to determine the locations.

Code:

\documentclass{article}

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

\newcommand{\mytikzmark}[1]{\tikz[remember picture] \node[baseline, inner sep=0pt] (#1) {};}

\begin{document}

\begin{equation*}
\sqrt{\frac{N\mytikzmark{top}}{p(1-p)\mytikzmark{bottom}}}
\end{equation*}
\begin{tikzpicture}[remember picture, overlay]
\coordinate (Top Start)  at ([yshift=0.25\baselineskip]top -| bottom);
\coordinate (Bottom End) at ([yshift=0.2\baselineskip]bottom);
\draw [latex-latex, red, thick]
(Top Start) to[out=-5, in=5, distance=0.75cm]
(Bottom End);
\node (MidHeight) at (Top Start |- Bottom End) {};
\node  at ([shift={(1.5cm,0.5\baselineskip)}]Bottom End) (OTIMES) {$\otimes$};
\draw [blue, -stealth, thick] (OTIMES) -- ++(-0.8cm,0);
\end{tikzpicture}%
\end{document}

• What a beautiful image! – Sigur Jun 11 '15 at 7:41