#111 parameterized style in tikzpicture env options = error

closed
nobody
None
5
2010-10-22
2009-10-09
No

In the CVS version of PGF (2009-10-09), definition of parameterized styles within `tikzpicture` environment main options produces an error (`ERROR: Illegal parameter number in definition of \test.`):

{{{
#!tex
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{tikzpicture}[mystyle/.style={draw=#1,fill=#1!50}]
\node[mystyle=red] {Node};
\end{tikzpicture}
\end{frame}
\end{document}
}}}

This error is not encountered when defining a similar parameterized style with an independent call to `\tikzset`:

{{{
#!tex
\documentclass{beamer}
\usepackage{tikz}
\tikzset{mystyle/.style={draw=#1,fill=#1!50}}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\node[mystyle=red] {Node};
\end{tikzpicture}
\end{frame}
\end{document}
}}}

Discussion

  • Holger Krause
    Holger Krause
    2010-04-24

    I didn't try the given example, but encountered a similiar problem. In my case the error occurs only when using the beamer documentclass, not for e.g. article.

    My guess is, that it's a beamer/pgf interaction.

    I'm using pgf etc. from ubuntu 9.10.

     
  • Stefan Pinnow
    Stefan Pinnow
    2010-10-22

    I can confirm that. The error occurs only with the beamer class.

     
  • Hello,

    this has actually nothing at all to do with pgf. Try to use \newcommand[1]{...#1...} inside of a frame -- it should produce the same effect.

    To solve it, use
    \begin{frame}[fragile]
    and it will work as expected.

    I close this bug.

    Thanks for reporting!

    Best regards

    Christian

     
    • status: open --> closed