# Drawing Line Between Tikzmarknodes

I am trying to draw a line between the nodes in the output:

\documentclass{article}
\usepackage{tikz,amsmath}
\usetikzlibrary{tikzmark}

%%% Derivative Macro

\newcommand{\der}[2]{\dfrac{\mathrm{d}#1}{\mathrm{d}#2}}

%%% Derivative Prime Notation

\newcommand{\pder}[2]{#1^{\prime}(#2)}

\begin{document}

\begin{center}
$\der{}{x} \bigg [\dfrac{N(x)}{D(x)} \bigg ] = \dfrac{\tikzmarknode{1}{D(x)} \cdot \tikzmarknode[red]{2}{\pder{N}{x}}\tikzmarknode{3}{-}\tikzmarknode{4} {N(x)} \cdot \tikzmarknode[red]{5}{\pder{D}{x}}}{\tikzmarknode{6} {(D(x))^{2}}}$
\end{center}

\begin{tikzpicture}[overlay,remember picture,cyan!70]
\path ([yshift=0.1cm]1.north) coordinate (aux);
\foreach \X in {1,...,5}
{\draw   (\X |-aux) node[above,circle,draw,font=\small,inner sep=1pt]
(L\X){\X};}
\path ([yshift=-0.1cm]6.south) coordinate (aux);
\draw   (6 |-aux) node[below,circle,draw,font=\small,inner sep=1pt]
(L6){6};
\end{tikzpicture}

\end{document}


This outputs:

I want to get:

I tried simply connecting the L-nodes with paths and it worked, so I'm curious as to whether I'm missing some detail about what you wanted. Anyway, I'll post this just in case this is what you want. To get more fancy arrows, take a look at the arrows.meta tikz library.

\documentclass{article}
%\url{https://tex.stackexchange.com/q/463829/86}
\usepackage{tikz,amsmath}
\usetikzlibrary{tikzmark}

%%% Derivative Macro

\newcommand{\der}[2]{\dfrac{\mathrm{d}#1}{\mathrm{d}#2}}

%%% Derivative Prime Notation

\newcommand{\pder}[2]{#1^{\prime}(#2)}

\begin{document}

$\der{}{x} \bigg [\dfrac{N(x)}{D(x)} \bigg ] = \dfrac{\tikzmarknode{1}{D(x)} \cdot \tikzmarknode[red]{2}{\pder{N}{x}}\tikzmarknode{3}{-}\tikzmarknode{4} {N(x)} \cdot \tikzmarknode[red]{5}{\pder{D}{x}}}{\tikzmarknode{6} {(D(x))^{2}}}$

\begin{tikzpicture}[overlay,remember picture,cyan!70]
\path ([yshift=0.1cm]1.north) coordinate (aux);
\foreach \X in {1,...,5}
{\draw   (\X |-aux) node[above,circle,draw,font=\small,inner sep=1pt]
(L\X){\X};}
\path ([yshift=-0.1cm]6.south) coordinate (aux);
\draw   (6 |-aux) node[below,circle,draw,font=\small,inner sep=1pt]
(L6){6};
\draw[-<] (L1) -- +(-1,0);
\draw (L1) -- (L2) -- (L3) -- (L4) -- (L5);
\draw[->] (L5.east) to[out=0,in=0,looseness=2] (L5.east |- L6.east) -- (L6);
\end{tikzpicture}

\end{document}


• I just saw your solution and was going the wrong way on my own. We did give those nodes a name L1,L2,..,L5 so I should have gotten half. I am certain I would not have gotten the right code between L5 and L6. Thanks! – MathScholar Dec 8 '18 at 16:33