Gerd Neugebauer - 2011-01-07

Hi,

I came across a behaviour of TikZ/PGF which I don't understand. Maybe someone here can help me.

I am working on a style which uses layers to decouple the sequence of the specification of elements from the result. For this purpose I have defined several macros which are reused where appropriate. As a consequence the environment pgfonlayer appears inside pgfonlayer. Unfortunately the elements inside are not visible.

The manual does not say anythng about this behaviour at all.

And here a minimal example:

\documentclass{report}
\usepackage{tikz}
\begin{document}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\begin{tikzpicture}
  \begin{pgfonlayer}{background}
    \fill (0,0) rectangle (2,1);
  \end{pgfonlayer}
  \begin{pgfonlayer}{background}
    \begin{pgfonlayer}{background}
      \fill (4,0) rectangle (2,1);
    \end{pgfonlayer}
  \end{pgfonlayer}
\end{tikzpicture}
\end{document}

The red rectangle is shown corrctly. The blue rectangle does not show up at all. The same effect appears when the layer names (background) are not identical. If I remove one level of the environment then everything shows up as expected. But this is not an option in my setup.

Finally: I am using TikZ/PGF in Version 2.0 from TeXlive 2010.

Ciao
Gerd