2

I need to draw some arrow marks in the border some cells in a tabular. That arrow should start from the bottom right corner of the cell and end at top right corner of the cell. I have drawn such arrows tikzmark and calc libraries. The following is my solution

\newcommand\cellarrow[1]{%
    \begin{tikzpicture}[remember picture, overlay, >=stealth, shift={(0,0)}]
      \draw[->, line width=2pt,color =brown]  ( $ (pic cs:#1) +(2.7\tabcolsep,-1ex) $ )  to   ( $ (pic cs:#1) +(16pt,2.5ex) $ ) ;
    \end{tikzpicture}%
    }

enter image description here

Obviously This is not a good solution since it works well width only a particular table shown in Section 1. So we need to some how position the bottom right corner and draw the arrow with the height same as that of the corresponding cell.

How to do this?

Any idea is highly appreciated.

MWE:

\documentclass{article}

\usepackage{tikz}
\usepackage{xcolor}

\usetikzlibrary{calc,tikzmark}


\newcommand\cellarrow[1]{%
\begin{tikzpicture}[remember picture, overlay, >=stealth, shift={(0,0)}]
  \draw[->, line width=2pt,color =brown]  ( $ (pic cs:#1) +(2.7\tabcolsep,-1ex) $ )  to   ( $ (pic cs:#1) +(16pt,2.5ex) $ ) ;
\end{tikzpicture}%
}
\def\done{done}


    \begin{document}
    \section{Table with Same width}
            \begin{tabular}{|l|c|c|c|c|c|c|}
        \hline
        Some column  & \done & \done &  \done&  \done& \done&\done \\
        \hline
        This has arrows&\tikzmark{a}   & \tikzmark{b} & \tikzmark{c} & & &  \\
        \hline
        Communication of Papers
        & &  & &  & &    \\ \hline  
    \end{tabular}
        \cellarrow{a} 
        \cellarrow{b} 
        \cellarrow{c} 



    \section{Some other table}
    \renewcommand{\arraystretch}{2}
    \begin{tabular}{|l|c|c|c|c|c|c|c|c|}
        \hline
        Some column  & \done & \done &  \done&  \done&  \done& \done &\done  &\\
        \hline
        This has arrows&  &  &  &  & & \tikzmark{f} & \tikzmark{g} & \tikzmark{h} \\
        \hline
        Communication of Papers
        & &  & &  & &  & &  \\ \hline   
    \end{tabular}
    \cellarrow{f} 
    \cellarrow{g} 
    \cellarrow{h} 

    \end{document}
  • 1
    Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, \end{document}, and definitions of custom macros. 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. – Skillmon Jul 24 '18 at 8:00
  • Sorry for the mistake happened and I didnt notice too. I have edited the question. – David Jul 24 '18 at 9:50
  • Tabulars use a strut of height \arraystretch\ht\strutbox and depth \arraystretch\dp\strutbox. Of course, if the contents are larger than the strut, it will use the height and depth of the contents. – John Kormylo Jul 24 '18 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.