I'm trying to do something similar to what is shown in the picture, but do not even know where to start.
I can get something similar with three tables and minipage environment. But I have no idea how to connect tables rows with arrows.
Maybe I should use tikz for that, but I can't found similar examples with tables.
\documentclass{beamer}
\usepackage{tabu}
\usepackage{color}
\usepackage{xcolor, colortbl}
\begin{document}
\begin{table}[!htb]
Interleaving example \\
\begin{minipage}{.3\linewidth}
\centering
\begin{tabu}{|c|c|}
\hline
\rowcolor{green!25} 1 & $Document_a$ \\
\hline
\rowcolor{green!25} 2 & $Document_b$ \\
\hline
\rowcolor{green!25} 3 & $Document_c$ \\
\hline
\end{tabu}
Ranking A
\end{minipage}
\begin{minipage}{.3\linewidth}
\centering
\begin{tabu}{|c|c|}
\hline
\rowcolor{green!25} 1 & $Document_a$ \\
\hline
\rowcolor{red!25} 2 & $Document_e$ \\
\hline
\rowcolor{green!25} 3 & $Document_b$ \\
\hline
\end{tabu}
Shown to user
\end{minipage}
\begin{minipage}{.3\linewidth}
\centering
\begin{tabu}{|c|c|}
\hline
\rowcolor{red!25} 1 & $Document_e$ \\
\hline
\rowcolor{red!25} 2 & $Document_d$ \\
\hline
\rowcolor{red!25} 3 & $Document_f$ \\
\hline
\end{tabu}
Ranking B
\end{minipage}
\end{table}
\end{document}
Best Answer
I would use a tikz
matrix of (math) nodes
, together with some fancy arrows from theshapes.arrows
library of tikz:Here is the code:
A few words of explanation:
(M)
in\matrix (M)
means that the nodes in the matrix can be referred to asM-<row>-<col>
matrix of math nodes
then it is better to write\text{Document}_A
etc, (the\text
command is from the amsmath package), because otherwise it looks likeD*o*c*u*m*e*n*t
(the OP's MWE has this problem). If there is more text than mathematics in the nodes then usematrix of nodes
instead ofmatrix of math nodes
green!20
, assuming that this is the most common background|[Red]|
using theRed
styleempty node
is used to control the (minimum) height of each of these nodes and to allow us to put a fat arrow there latereast
,west
,south east
, ... modifiers to control where the arrows leave and enter the nodes(M-2-2.east|-M-2-3.west)
for the arrow fromDocument_f
toDocument_b
. All this does is make the arrow perpendicular to the sides of the rectangle.Red
,empty node
andfat arrow
styles make the code easier to read and easier to modify.