I am trying to make a table with a line from each row leading to another table. I use a custom \tikzmark function, from this post, to create a node in each row, however, the node does not seem to work as intended. Help is very welcome.
I would like to draw lines from rows ending with a :pi1 to the top right table.
There should also be a line from the row ending with :pi21 to the bottom right table.
The code for producing the image above.
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\tikzset{
state/.style={
rectangle,
draw=black,
minimum height=2em,
inner sep=2pt,
text centered,
},
}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture, anchor=base] \node (#1) {};}
\begin{tikzpicture}[]
\node[state] (IT)
{%
\begin{tabular}{llll}
:s1 & :p1 & :o1 & :pi1 \tikzmark{a} \\
:s2 & :p2 & :o2 & :pi1 \tikzmark{b} \\
:s3 & :p3 & :o3 & :pi2 \tikzmark{c} \\
\end{tabular}
};
\node[state,
node distance=3cm,
right of=IT,
yshift=+1cm] (PI1)
{%
\begin{tabular}{lll}
:pi1 & :p1 & :o1 \\
:s2 & :p2 & :o2 \\
:s3 & :p3 & :o3 \\
\end{tabular}
};
\node[state,
below of=PI1,
node distance=2cm] (PI2)
{%
\begin{tabular}{lll}
:pi2 & :p1 & :o1 \\
:s3 & :p3 & :o3 \\
\end{tabular}
};
\draw (a) -- (PI1);
\draw (b) -- (PI1);
\draw (c) -- (PI2);
\end{tikzpicture}
\end{document}

