I am trying to add a pattern-striped background to a rectangle, but the PDF generated with PDFLatex produces a couple of completely black rectangles instead of the ones filled in with the pattern. The following code is taken form the answer to the question Using form-only patterns with variable: possible TikZ bug.

TikZ code:


    slope/.default=0.9, slope


\pgfdeclarepatternformonly{stripes}{\pgfpoint{0cm}{0cm}}{\pgfpoint{1cm}{1cm}}{\pgfpoint{1cm}{1cm}} {
    \foreach \i in {0.1, 0.3,...,0.9} {
        \pgfpathmoveto{\pgfpoint{\i cm}{0cm}}
        \pgfpathlineto{\pgfpoint{1cm}{1cm - \i cm}}
        \pgfpathlineto{\pgfpoint{1cm}{1cm - \i cm+ 0.1cm}}
        \pgfpathlineto{\pgfpoint{\i cm - 0.1cm}{0cm}}
        \pgfpathmoveto{\pgfpoint{0cm}{\i cm}}
        \pgfpathlineto{\pgfpoint{1cm - \i cm}{1cm}}
        \pgfpathlineto{\pgfpoint{1cm - \i cm - 0.1cm}{1cm}}
        \pgfpathlineto{\pgfpoint{0cm}{\i cm + 0.1cm}}

\pgfdeclarepatternformonly[\tikz@pattern@color,\slope]{slant lines}


    \fill[pattern=stripes, pattern color=red] (0,0) rectangle (5,5);
    \fill[pattern=slant lines, pattern color=blue, slope=0.3] (5,0) rectangle (10,5);

The result is shown in the following picture:

enter image description here

What am I doing wrong?

closed as unclear what you're asking by Qrrbrbirlbel, user13907, user31729, R. Schumacher, Paul Gessler Apr 30 '15 at 23:10

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    It is fine on my end with Package: tikz 2013/12/13 v3.0.0 (rcs-revision 1.142). – Jesse Dec 8 '14 at 12:30
  • I will try to update the package, my current version is: tikz.sty 2010/10/13 v2.10 (rcs-revision 1.76), the one that comes packaged with Debian Wheezy (stable). – Ricardo Dec 9 '14 at 12:16

Browse other questions tagged or ask your own question.