# tikz and beamer: shape rectangle split example from manual

The pgf manual has an example using the shape rectangle split on page 450 that is not working with the beamer class:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{shapes.multipart}

\begin{document}

\begin{frame}{Testing}

\begin{tikzpicture}[my shape/.style={ rectangle split, rectangle split parts=#1, draw, anchor=center}]
\node [my shape=5] at (0,1) {
a\nodepart{two}b\nodepart{three}c\nodepart{four}d\nodepart{five}e};
\node [my shape=5, rectangle split horizontal] at (2,2) {
1\nodepart{two}2\nodepart{three}3\nodepart{four}4\nodepart{five}5};
\node [my shape=3] at (3,0.5) {
A\nodepart{two}B\nodepart{three}C};
\node [my shape=4, rectangle split horizontal] at (1.5,0.5) {
1\nodepart{two}2\nodepart{three}3\nodepart{four}4};
\end{tikzpicture}

\end{frame}

\end{document}


When this document is compiled with pdflatex, it gives the following error message:

! Illegal parameter number in definition of \test.
1
l.19   \end{tikzpicture}


Is this a known bug?

With the article class no error is found in the tikzpicture environment.

-

The #1 seems to cause a problem. However, it can be fixed using the fragile option to the frame, which is described in the beamer manual, and causes the frame content to be differently handled.

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}
\begin{document}
\begin{frame}[fragile]{Testing}
\begin{tikzpicture}[my shape/.style={ rectangle split,
rectangle split parts=#1, draw, anchor=center}]
\node [my shape=5] at (0,1) {
a\nodepart{two}b\nodepart{three}c\nodepart{four}d\nodepart{five}e};
\node [my shape=5, rectangle split horizontal] at (2,2) {
1\nodepart{two}2\nodepart{three}3\nodepart{four}4\nodepart{five}5};
\node [my shape=3] at (3,0.5) {
A\nodepart{two}B\nodepart{three}C};
\node [my shape=4, rectangle split horizontal] at (1.5,0.5) {
1\nodepart{two}2\nodepart{three}3\nodepart{four}4};
\end{tikzpicture}
\end{frame}
\end{document}


-
do you know how to solve this when doing a poster? I am using \documentclass[final]{beamer} \usepackage[scale=1.24]{beamerposter}  –  elaRosca Jul 16 at 18:04