# How to connect cells in a table using tikzpicture and tikz?

I am trying to make a table look that like an accounting debit and credit sheet. The table i want to make is look likes this:

but i can only get as far as the table format and content because the code i used to make the arrow doesn't work, it return the

"Cannot parse this coordinate error"

\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{table}[H] \centering
\begin{tabular}{c|ccc|ccc|c}
\multicolumn{2}{c}{NH Trung Ương} & & \multicolumn{2}{c}{NH Thương Mại} & & \multicolumn{2}{c}{Doanh Nghiệp, \ldots} \\
\cline{1-2}                             \cline{4-5}                          \cline{7-8}
FR         & \tikzmark{d}{RR}     & &\tikzmark{c}{RR}  &\tikzmark{b}{D} & &\tikzmark{a}{D}              &Loan        \\
Debts & C                         & & ER               &                & & C                           &            \\
IOU   &                           & &Loans             &                & &                             &C
\end{tabular}
\begin{tikzpicture}[overlay, remember picture, yshift=.25\baselineskip, shorten >=.5pt, shorten <=.5pt]
\draw [->] ({pic cs:a}) -- to ({pic cs:b});
\end{tikzpicture}


I don't know what went wrong with my code, i follow the answer from this post How to draw such arrows in the table?. Thank you.

Well, for starters, there's no need to enclose the coordinates with curly braces in your case, so you should remove them. Also, I suggest you remove the call for the library and add a definition for a newcommand instead.

## Code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}

\newcommand\tikzmark[2]{\tikz[overlay,remember picture, anchor=base] \node (#1) {#2};}

\begin{document}
\begin{tabular}{c|ccc|ccc|c}
\multicolumn{2}{c}{NH Trung Ương} & & \multicolumn{2}{c}{NH Thương Mại} & & \multicolumn{2}{c}{Doanh Nghiệp, \ldots} \\
\cline{1-2}                             \cline{4-5}                          \cline{7-8}
FR         & \tikzmark{d}{RR}     & &\tikzmark{c}{RR}  &\tikzmark{b}{D} & &\tikzmark{a}{D}              &Loan        \\
Debts & C                         & & ER               &                & & C                           &            \\
IOU   &                           & &Loans             &                & &                             &C
\end{tabular}
\begin{tikzpicture}[overlay, remember picture, yshift=.25\baselineskip, ->, shorten >=.5pt, shorten <=.5pt]
\draw (a) -- (b);
\end{tikzpicture}
\end{document}

• I'd suggest adding anchor=base in tikzmark definition for better alignment of marked items. – Ignasi Feb 18 '16 at 15:45