# Moving tiles of the pattern in TikZ

One of the problems with patterns is that you never know how individual tiles are going to be laid over the area. E.g. if you use star pattern, sometimes stars on the left side of the area shall be broken in half, and sometimes they shall be whole. Is there any way to control how tiles are laid over the area?

-

The patterns are not drawn at tikz/pgf level, but instead they are "passed" to the driver language (pdf, postscript), which uses its own pattern procedures, for the sake of efficiency.

You can imagine those patterns as "already drawn" in a invisible bottom layer and covering all the page. When you fill a shape with that pattern, you merely are cutting a "hole" with that shape, through which the udnerlying pattern can be seen. This MWE should clarify what I mean. Note how the pattern appears to be "continued" from one rectangle to another, even if they belong to different tikz figures.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{patterns}

\tikz{
\draw[pattern=fivepointed stars] (0,0) rectangle (2,1);
}x%
\tikz{
\draw[pattern=fivepointed stars] (0,0) rectangle (2,1);
}

\tikz{
\draw[pattern=fivepointed stars] (0,0) rectangle (2,1);
}xxx%
\tikz{
\draw[pattern=fivepointed stars] (0,0) rectangle (2,1);
}
\end{document}


Even worse, the "underlying pattern" is different depending on the final driver (PostScript, PDF or SVG). Quoting TikZ manual:

the phase of patterns is not well-defined, that is, it is not clear where origin of the “first” tile is. To be more precise, PostScript and pdf on the one hand and svg on the other hand define the origin differently. PostScript and pdf define a fixed origin that is independent of where the path lies.

So the answer apparently is that you cannot affect this mapping from tikz/pgf.

-