Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 12 down vote accepted

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}

Result

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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