1
\usepackage{tikz}
\newcommand\tikzmark[2]{%
\tikz[remember picture,overlay,baseline=0pt] 
\node[inner sep=0pt,outer sep=0pt, anchor=base] (#1){#2};%
}

\newcommand\link[2]{%
\begin{tikzpicture}[remember picture, overlay, >=stealth, shorten >= 10pt, shorten <=10pt]
  \draw[->] (#1.south east) to (#2.north west);
\end{tikzpicture}%
}


\begin{table}[htbp]
\renewcommand{\arraystretch}{1}
\setlength{\tabcolsep}{10pt}
\centering
\begin{tabular}{m{0.2in} | m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in}}
    \hline
    & A  & B   & C       & B       & B       & B       & D  & C  & E \\
    \hline
 C  & 0   & 0  & \tikzmark{13}{\bf{1}}  & 0       & 0       & 0       & 0  & 1  & 0 \\

 B  & 0   & 1  & 0       & \tikzmark{12}{\bf{2}}  & \tikzmark{22}{\bf{1}}  & 1       & 0  & 0  & 0 \\

 B  & 0   & 1  & 0       & 1       & \tikzmark{11}{\bf{3}}  & \tikzmark{21}{\bf{2}}  & 0  & 0  & 0 \\

 C  & 0   & 0  & 1  & 0  & 0  & 0  & 0  & 1  & 0 \\

 E  & 0   & 0  & 0  & 0  & 0  & 0  & 0  & 0  & 1 \\
   \hline
\end{tabular}
 \captionsetup{justification=centering}
 \caption{All local alignment scoring matrix}
 \label{table:all_local}
\end{table}

\link{11}{12}
\link{12}{13}
\link{21}{22}

enter image description here

  • Welcome to TeX.SX! Please make your code compilable, complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – CarLaTeX Jan 6 '17 at 5:11
  • Unrelated, but note that \bf is 1) deprecated for 20+ years, and 2) not an macro that takes an argument, but a switch that influences the following text. Hence, you should use \textbf{...} or {\bfseries ...}. (\bfseries` is the modern equivalent of \bf, and having it inside an environment or group ({ .. }) keeps its effect local to the env/group.) – Torbjørn T. Jan 6 '17 at 9:05
1

You don't need to define a \tikzmark command because there is a tikzlibrary tikzmark which does it for you.

Note that \bf is deprecated, I've used \textbf{...} instead.

Moreover, since you haven't posted a complete mwe, I've added the necessary code to compile it (\documentclass, packages, etc.), maybe this doesn't coincide with yours.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usepackage{array}
\usepackage{caption}

\newcommand{\memo}[2]{%
    \tikzmark{#1}\textbf{#2}
}

\newcommand{\link}[2]{%
    \begin{tikzpicture}[remember picture, overlay, >=stealth, shorten >=9pt, shorten <=3pt]
        \draw [->] ([yshift=3pt]{pic cs:#1}) -- ([yshift=6pt]{pic cs:#2});
    \end{tikzpicture}
}
\begin{document}
\begin{table}[htbp]
    \renewcommand{\arraystretch}{1.5}% I've also increased this for esthetic reasons
    \setlength{\tabcolsep}{10pt}
    \centering
    \begin{tabular}{m{0.2in} | m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in} m{0.2in}}
        \hline
        & A  & B   & C       & B       & B       & B       & D  & C  & E \\
        \hline
        C  & 0   & 0  & \memo{13}{1} & 0       & 0       & 0       & 0  & 1  & 0 \\

        B  & 0   & 1  & 0       & \memo{12}{2} & \memo{22}{1} & 1       & 0  & 0  & 0 \\

        B  & 0   & 1  & 0       & 1       & \memo{11}{3} & \memo{21}{2} & 0  & 0  & 0 \\

        C  & 0   & 0  & 1  & 0  & 0  & 0  & 0  & 1  & 0 \\

        E  & 0   & 0  & 0  & 0  & 0  & 0  & 0  & 0  & 1 \\
        \hline
    \end{tabular}
    \captionsetup{justification=centering}
    \caption{All local alignment scoring matrix}
    \label{table:all_local}
\end{table}

\link{11}{12}
\link{12}{13}
\link{21}{22}

\end{document}

enter image description here

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.