# Best way to include Boxes and Arrows in a Table?

I want to create a table, but in the first column I want boxes that are connected with arrows. It should be similar to the picture below. The boxes should be normal (black and white, no fancy colors) and the arrows should be normal black arrows.

Can anyone help me to create this?

• You can create the boxes as a tikzpicture and then include it in the table. Check https://tex.stackexchange.com/questions/152067/tikz-picture-in-table?rq=1 for an example about how to include tikz in a table
– Jes
Jan 21 at 22:32
• This seems to work only to create boxes in one row, but I want to draw arrows from one box (first row) to the next box (second row). Jan 21 at 23:11
• @Knallbert please see if the answer below suits your requirement Jan 22 at 0:18
• looks perfect, thank you Jan 22 at 0:20

## 2 Answers

\documentclass{article}

\usepackage{tikz}

\newlength{\mylength}
\settoheight{\mylength}{S}
\tikzset{mybox/.style={draw=black,text width=2cm, align=center},
baseline={([yshift=-\mylength]current bounding box.north)}}

\usepackage{booktabs}
\usepackage{tabularx}

\usepackage{enumitem}
\newlist{tabitemize}{itemize}{1}
\setlist[tabitemize]{label=\textbullet,
noitemsep,
leftmargin=*,
topsep=0pt,
partopsep=0pt,
nosep,
before=\begin{minipage}[t]{\hsize}\raggedright,
after=\end{minipage}}

\begin{document}
\noindent
\begin{tabularx}{\textwidth}{c XX}
\toprule
Column1 & Column2 & Column3  \\
\midrule
\begin{tikzpicture}[remember picture]
\node (A) [mybox]  {Box 1};
\end{tikzpicture}
& \begin{tabitemize} \item some longer text in this item \item some text \end{tabitemize}
& \begin{tabitemize}\item some text \end{tabitemize}\\
\addlinespace
\begin{tikzpicture}[remember picture]
\node (B) [mybox]{Box 2};
\end{tikzpicture}
& \begin{tabitemize} \item some text \item some text \item some text \item some longer text in this item \item some text \end{tabitemize}
& \begin{tabitemize}\item some text \item some longer text in this item  \item some longer text in this item \end{tabitemize}\\
\addlinespace
\begin{tikzpicture}[remember picture]
\node (C) [mybox]  {Box 3};
\end{tikzpicture}
& \begin{tabitemize} \item some text \item some text \end{tabitemize}
& \begin{tabitemize}\item some text \end{tabitemize}\\
\bottomrule
\end{tabularx}
\begin{tikzpicture}[overlay, remember picture, ultra thick, ->]
\draw (A) -- (B);
\draw (B) -- (C);
\end{tikzpicture}

\end{document}

• thanks, this is perfect! Is it possible to include an automatic \flushleft option in the tabitemize definition (my text is getting strechted out in some places)? Jan 23 at 12:43
• Add \newcolumntype{L}{>{\raggedright\arraybackslash}X} to the preamble and replace \begin{tabularx}{\textwidth}{c XX} with \begin{tabularx}{\textwidth}{c LL}. Jan 23 at 12:46
• when I do this the text stays the same way. When I insert \flushleft after the \item it works fine, but this way I have to do it seperatley everywhere Jan 23 at 13:42
• @Knallbert: I updated my answer. The items should now be left aligned as opposed to justified. Jan 23 at 13:56
• perfect, thank you Jan 23 at 14:14

\documentclass[12pt,a4paper]{article}

\usepackage{tikz}
\usetikzlibrary{tikzmark}

\usepackage[column=0]{cellspace}
\setlength{\cellspacetoplimit}{\tabcolsep}
\setlength{\cellspacebottomlimit}{\cellspacetoplimit}

\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\usepackage{makecell}
\begin{document}
\minipage{\textwidth}
\begin{tabular}{ 0c0c0c }
\toprule
Column1
&Column2
&Column3        \\
\midrule
\begin{tikzpicture}[baseline=(current bounding  box.center), remember picture]
\node (A) [draw=black,text width=2cm, align=center]  {Box 1};
\end{tikzpicture}
&\makecell[t]{\tabitem some text\\\tabitem some text}
&\tabitem some text\\

\begin{tikzpicture}[baseline=(current bounding  box.center), remember picture]
\node (B) [draw=black,text width=2cm, align=center]{Box 2};
\end{tikzpicture}
&\makecell[t]{\tabitem some text\\\tabitem some text}
&\tabitem some text\\
\bottomrule
\end{tabular}
\begin{tikzpicture}[overlay, black, remember picture]
\draw[ultra thick, ->] (A.south) -- (B.north);
\end{tikzpicture}
\endminipage

\end{document}

• Thanks again, it works very good. Only one problem: When I put longer text in the \tabitem, there is no automatic break, but the text overwrites the next column. Any easy way to fix this? When I use manual line break ("\\") then the second line is not aligned with the first one. Jan 22 at 14:20
• Also, the points of \tabitem in general are not in line. Jan 22 at 14:31