[Tex/LaTex] 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

arrowsequationstikz-pgf

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

enter image description here

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}

Best Answer

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}

enter image description here

Some adjustments to tailor it to your liking:

  • 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}

enter image description here