Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.
<to be read again> 
                   1
l.19   \end{tikzpicture}

Is this a known bug?

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

share|improve this question
add comment

1 Answer

up vote 14 down vote accepted

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}

test frame

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.