I am trying to make a table that shows how an element moves from location in the table to another. I would like to add a vector that starts at the first element and goes to the second element.
How do I do this?
I've tried putting the table in a picture but I get the error: Not in outer par mode.
\begin{figure}
\setlength{\unitlength}{1mm}
\begin{picture}(500,400)
\put(20,-10){\vector(1,-1){5}}
\begin{table}
\begin{tabular}[t]{ll}
\textbf{Something here} & \\ \hline
A & F \\
B & A \\
C & G \\
D & H \\
E & I%
\end{tabular}
\end{table}
\end{picture}
\end{figure}
I want a vector pointing from A in left column to A in right column.
And I've tried putting the picture in a cell but the \vector
commands don't show up in the PDF.
I have also searched Google but can't find how to do it.
Can anyone help?
Best Answer
You can use Andrew Stacey's tried and tested
tikzmark
idea, first posted hereAdding a large brace next to a body of text
and repeated in many examples since.
The idea is to set a
node
at each of the places in your table, and then connect the two nodes afterwards (usingoverlay
andremember picture
). You can tweak the placement of the connections using thecalc
tikz library.