# How to connect nodes (or cells) of a table with lines or curves, with TikZ or anything else that will work with Beamer? [duplicate]

I'd like to be able to typeset as simply as possible a table with cells joigned by arrows with TikZ (because I want to use it in conjunction with Beamer and PDFLaTeX). Here is the code I'm comfortable with, involving PSTricks macros:

\documentclass{beamer}
\usepackage{etex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{pst-node,auto-pst-pdf,tabularx}

\begin{document}

\begin{frame}
\footnotesize

\renewcommand{\arraystretch}{3}
\begin{tabular}{|l|*{8}{>{$}c<{$}|}}
\hline
Valeur $x_i$ (par ordre croissant) & 1 & 3 & 4 & ... & 20 & 23 & ... &  67\\
\hline
Effectif $n_i$ & \rnode{A}{2} & 4 & \rnode{D}{2} & ... & 3 & \rnode{G}{6} &
... & 145 \\
\hline
Effectifs cumulés & \rnode{B}{2} & \rnode{C}{6} & \rnode{E}{\,8\,} & ... &
\rnode{F}{64} & \rnode{H}{70} & ... & \ovalnode{I}{2453} \\
\hline
\end{tabular}

\hfill\rnode{J}{Effectif total}

\ncline[nodesep=2pt]{->}{A}{B}
\ncline[nodesep=2pt]{->}{C}{D}
\ncput*{+}
\ncline[nodesep=2pt]{->}{D}{E}
\ncput*{=}
\ncline[nodesep=2pt]{->}{F}{G}
\ncput*{+}
\ncline[nodesep=2pt]{->}{G}{H}
\ncput*{=}
\ncangle[nodesep=2pt,angleA=0,angleB=0]{->}{J}{I}

\end{frame}

\end{document}


I've searched a little, before posting, and I only found some solutions which seems quite complicated to me (eg here or here). I cannot afford at present the time investment needed to become skilled enough in TikZ (which I only master for simple drawings).

I also heard about the matrix command of TikZ, but it doesn't work with beamer on 2 different TeXlive installation at home (packages from standard Ubuntu 15.04 repositories on one, « vanilla » TeXlive installed from TUG on the other).

Here is the code I tested (grabbed from here as a working example) :

• the working code :

\documentclass[a4paper]{article}

\usepackage{etex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}

\begin{tikzpicture}
\matrix(dict)[matrix of nodes,%below=of game,
nodes={align=center,text width=1cm},
row 1/.style={anchor=south},
column 1/.style={nodes={text width=2cm,align=right}}
]{
meaning & $b_1$ & $b_2$ & $b_3$ & $b_1b_2$ & $b_1b_3$ & $b_2b_3$ & $b_1b_2b_3$\\
common list \\
private list\\
};
\draw(dict-1-1.south west)--(dict-1-8.south east);
\draw(dict-1-1.north east)--(dict-3-1.south east);
\end{tikzpicture}

\end{document}

• the not working code:

\documentclass{beamer}

\usepackage{etex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}

\begin{frame}

\begin{tikzpicture}
\matrix(dict)[matrix of nodes,%below=of game,
nodes={align=center,text width=1cm},
row 1/.style={anchor=south},
column 1/.style={nodes={text width=2cm,align=right}}
]{
meaning & $b_1$ & $b_2$ & $b_3$ & $b_1b_2$ & $b_1b_3$ & $b_2b_3$ & $b_1b_2b_3$\\
common list \\
private list\\
};
\draw(dict-1-1.south west)--(dict-1-8.south east);
\draw(dict-1-1.north east)--(dict-3-1.south east);
\end{tikzpicture}

\end{frame}

\end{document}


The error at compilation time is :

! Undefined control sequence.
<argument> \pgf@matrix@last@nextcell@options


egreg pointed out that my question may be duplicate with this one. But the error is different - anyway, adding the fragile option to the frame solve this peculiar problem.

Moreover, the point is not necessarily to use TikZ's matrix environment. I'd like to have a simple yet fancy and PDFLaTeX compatible way for joining nodes, whether they are in tables or not. I can do this easily with PSTricks, but it's hard to have PSTricks working with Beamer and PDFLaTeX.

Hoping someone will have an idea, preferably a simple and efficient one...

natsirt