5

I am trying to make a simple TikZ picture consisting of some rectangles with pattern fills. This is roughly what I have added.

\documentclass{amsart}

\usepackage{amsmath,amsthm,mathrsfs,amssymb,graphicx}
\usepackage[all]{xy}
\usepackage{tikz}
\usetikzlibrary{patterns,arrows}

\begin{document}

\begin{tikzpicture}
    \draw[-,thick] (0,0) rectangle (0.5,1);

    \draw[-,thick] (1.5,0) rectangle (2,2);
    \draw[-,thick,pattern=crosshatch] (1.5,0) rectangle (2,0.5);

    \draw[-,thick] (3,0) rectangle (3.5,3);
    \draw[-,thick,pattern=crosshatch] (3,0) rectangle (3.5,1);

    \draw[-,thick] (4.5,0) rectangle (5,4);
    \draw[-,thick,pattern=crosshatch] (4.5,0) rectangle (5,1.5);

    \filldraw[-,thick,pattern=crosshatch] (6,0) rectangle (6.5,7);
\end{tikzpicture}

\end{document}

For whatever reason, though, the rightmost column, the one that's to have the crosshatch fill, always comes out black, with no pattern.

I tried a few standard examples from the pgf manual, with the same results. I have

\usetikzlibrary{patterns}

but I wonder if there is something else I have forgotten to include. Any help will be much appreciated. Thanks!

5
  • @percusse: Good point, thanks. I've updated the example.
    – Skeptic
    Commented Sep 23, 2012 at 0:16
  • 1
    Are you using XeLaTeX by any chance? That's the only one that gives me a black box and it gives a warning that patterns are not supported.
    – percusse
    Commented Sep 23, 2012 at 0:18
  • Uh, yup. :-( Now I feel dumb. (Was making a Beamer presentation a few days ago and forgot to switch back.) Thanks!
    – Skeptic
    Commented Sep 23, 2012 at 0:24
  • 1
    No problem. Do you mind if we close this as Too Localized?
    – percusse
    Commented Sep 23, 2012 at 0:55
  • Sure, go ahead. I'm not sure what the proper procedure is, I can even delete it if that's preferable. Thanks again.
    – Skeptic
    Commented Sep 23, 2012 at 1:13

0

Browse other questions tagged .