# Drawing lines across multiple equation blocks

I've seen ways to make arrows from one part of an equation to another. Is there any way to draw curve lines linking one part of a equation to another part of another equation block, crossing over other equations, and even text?

See the hand drawing for illustration. I believe I've seen this type of figures in text books. But I'm sure they might have otherpowerful typesetting software.

EDIT :

I tested the excellent suggestion of David Carlisle in the following code snippet. The line doesn't seem to show up. And yes I compile it twice. The result is shown below.

\documentclass[letterpaper,11pt]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}

\begin{align*}
&\partial_i \sum_j (A_2)_{jl} \left( \sum \cdots + \sum_u U_{ju} \left( \sum_{\mu} (A_1)_{u\mu} x_{\mu} +  \cdots \right)^2\right)^2 \\
\end{align*}

\begin{align*}
&\overbrace{\partial_i \left( \sum_k (A_1)_{jk} x_k^{\prime} + \sum_u U_{ju} \left( \sum_{\mu} (A_1)_{u\mu} x_{\mu} + \textbf{const} \right)^2\right)}^{\tikzmark{b}}  \\
&= 0 \; + \; \sum_u U_{ju} \partial_i \left( \cdots \;\; \cdots \right)_u^2 \\
&= \sum_u U_{ju} 2 \; \left( \cdots \;\; \cdots \right)_u \; \partial_i \left( \cdots \;\; \cdots \right)_u2 \\
\end{align*}

\end{document}


\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}

aaa
$$a=\underbrace{xyz}_{?\tikzmark{a}}$$

a\\
aaa\\
aaaaaa\\
aaaaaaaa
$$a+\frac{1}{b+\frac{2}{c+\frac{3}{d+4}}}$$
a\\
aaa\\
aaaaaa\\
aaaaaaaa
$$a=\overbrace{xyz}^{?\tikzmark{b}}$$

\tikz[remember picture]
\draw[overlay] (pic cs:a)to  [bend left]  (pic cs:b);

\end{document}

• That's really cool ! Is it possible to control where the line goes, e.g. branch left to avoid crossing over some text, like in my figure. – horaceT Jan 5 '17 at 0:01
• For some reason, the arrow doesn't show up. Is there anything to watch out for? I could post the code and the image of the page. – horaceT Jan 5 '17 at 4:07
• @horaceT you need to run latex twice for tikzmark based things – David Carlisle Jan 5 '17 at 7:39