Menu

#186 pgfonlayer makes pgf forget options

v1.0 (example)
closed-fixed
nobody
None
5
2013-07-18
2011-11-04
No

Path options (like linewidth) that are set before a pgfonlayer environment are ignored inside the environment. For example in

\documentclass{article}

\usepackage{pgf}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}

\begin{document}
\begin{pgfpicture}
\pgfsetlinewidth{5pt}
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpoint{5cm}{0cm}}
\pgfusepath{draw}

\begin{pgfonlayer}{background}
\pgfpathmoveto{\pgfpoint{0cm}{1cm}}
\pgfpathlineto{\pgfpoint{5cm}{1cm}}
\pgfusepath{draw}
\end{pgfonlayer}
\end{pgfpicture}
\end{document}

The second line is drawn with the default line width instead of 5pt.

(see also http://tex.stackexchange.com/questions/33601/bug-in-tikz-line-width-on-layers\)

Discussion

  • Till Tantau

    Till Tantau - 2013-07-18
    • status: open --> closed-fixed
    • Group: --> v1.0 (example)
     
  • Till Tantau

    Till Tantau - 2013-07-18

    Fixed in CVS. (Arrow tips will now match the thin line width of the background lines.)

    The "forgetfulness" of the background layer is documented; all options concerning the graphic state get lost (except for the bug in the line width to which this report refers).

    I have added a new "every on background layer" style that can be used to get the "on background layer" scopes in sync with the "every picture" style. See the manual in the section on the "backgrounds" library.