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?

  • 2
    The new patterns.meta library allows you to shift patterns. See e.g. here for an example.
    – user194703
    May 23 '20 at 16:26

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.


\draw[pattern=fivepointed stars] (0,0) rectangle (2,1);
\draw[pattern=fivepointed stars] (0,0) rectangle (2,1);

\draw[pattern=fivepointed stars] (0,0) rectangle (2,1);
\draw[pattern=fivepointed stars] (0,0) rectangle (2,1);


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.