How to draw a vertical arrow across the rows of the table in latex?

1.9k views Asked by At

I want to create below table in latex. I have looked into the tikzlibrary but I was unable to find a solution to draw an arrow across a column in latex.enter image description here
Below is the code for generating the table in latex:

\begin{table*}
  \caption{Trend}
  \label{tab:trend}
  \begin{tabular}{cccl}
    \toprule
    Complexity Level & Mean Precision & MAP & NDCG \\
    \midrule
    1 & \parbox{2cm}{TFIDF: \\LSA: }  & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA:} \\\\
    2 & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA:} \\\\
    3 & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA: } \\\\
    4 & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA: } \\
  \bottomrule
\end{tabular}
\end{table*}

How can we draw a vertical arrow across the rows of the table in latex?

1

There are 1 answers

0
samcarter_is_at_topanswers.xyz On BEST ANSWER

You can use the tikzmark library:

\documentclass{article}

\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}

\begin{table*}
  \caption{Trend}
  \label{tab:trend}
  \begin{tabular}{cccl}
    \toprule
    Complexity Level & Mean Precision\tikzmark{foo} & MAP & NDCG \\
    \midrule
    1 & \parbox{2cm}{TFIDF: \\LSA: }  & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA:} \\\\
    2 & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA:} \\\\
    3 & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA: } \\\\
    4 & \parbox{2cm}{TFIDF: \\LSA: \tikzmark{bar}} & \parbox{2cm}{TFIDF: \\LSA: } & \parbox{2cm}{TFIDF: \\LSA: } \\
  \bottomrule
\end{tabular}
\begin{tikzpicture}[overlay,remember picture]
\draw[->,blue,thick] (pic cs:foo) -- (pic cs:bar);
\end{tikzpicture}
\end{table*}


\end{document}