When using node coordinates in a matrix of nodes in the article document class, the following code works well and soes exactly what it is supopsed to:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of nodes]
{
A & B & C\\
D & E & F\\
};
\draw (m-1-1)--(m-2-3);
\end{tikzpicture}
\end{document}
If I try to get the same result in beamer by doing
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\matrix (m) [matrix of nodes]
{
A \& B \& C\\
D \& E \& F\\
};
\draw (m-1-1)--(m-2-3);
\end{tikzpicture}
\end{frame}
\end{document}
compilation fails with
Package pgf Error: No shape named m-2-3 is known.
Using a fragile frame makes no difference. Is there a way to make the node names in a matrix of nodes work in beamer?
ampersand replacement=\&. – Qrrbrbirlbel Mar 07 '13 at 05:24fragileframe option will work. Your second code withoutfragilebut withampersand replacement=\&will work. – Ignasi Mar 07 '13 at 08:46