Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns and edge path constructions #852

Closed
ghost opened this issue May 9, 2020 · 3 comments
Closed

Patterns and edge path constructions #852

ghost opened this issue May 9, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented May 9, 2020

When using the patterns.meta library some strange things happen when one uses an edge path construction. In a standalone document this leads to the creation of an extra empty page. This is mainly to bring this up, I'll be happy to do further research on why this happens and how this can be fixed.

Here is a minimal working example. I just took one of the patterns from the manual, the flower pattern from p. 736 of pgfmanual v3.1.5, and embedded it in a standalone document. Then I added an edge. (I also added braces around the arguments of the \foreach loops but this is irrelevant for the present discussion.)

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{patterns.meta} 
\tikzdeclarepattern{name=flower,
type=colored,
bottom left={(-.1pt,-.1pt)}, top right={(10.1pt,10.1pt)}, tile size={(10pt,10pt)}, code={
\tikzset{x=1pt,y=1pt}
\path [draw=green] (5,2.5) -- (5, 7.5) edge (5,2.5);  %<-edge
\foreach \i in {0,60,...,300}
{\path [fill=pink, shift={(5,7.5)}, rotate=-\i]
(0,0) .. controls ++(120:4) and ++(60:4) .. (0,0);}
\path [fill=red] (5,7.5) circle [radius=1]; 
\foreach \i in {-45,45}
{\path [fill=green, shift={(5,2.5)}, rotate=-\i] (0,0) .. controls ++(120:4) and
++(60:4) .. (0,0);}
} }

\begin{document}
\begin{tikzpicture}
\draw[pattern=flower] circle [radius=1];
\end{tikzpicture}
\end{document}

As soon as the edge is in the pattern, I get an unwanted empty page on my standalone document. Removing the edge leads to just one page, as expected from the input.

P.S. I do not know how to add tags to an issue, otherwise I'd have added patterns.

@hmenke
Copy link
Member

hmenke commented May 10, 2020

Patterns only support really simple drawing instructions, e.g. node is completely unsupported. I should probably make this into an error.

\def\tikz@fig{%
\tikzerror{You cannot use nodes inside a pattern}%
}%

@hmenke
Copy link
Member

hmenke commented May 10, 2020

I guess in theory edge could be supported because it is “just” drawing a path asynchronously. However, I have the suspicion that the complexity of the implementation will be enormous. Normally edges (and nodes) are added to a temporary box which is flushed out in \tikz@finish (Step 13) but the code in the pattern is not a proper picture, so \tikz@finish isn't called for it.

@ghost
Copy link
Author

ghost commented May 10, 2020

@hmenke I like the idea from your first comment. Please note also that, according to what I find, the more complex the picture underlying the pattern becomes, the more likely it is that there are viewer-dependent issues, i.e. artifacts. This is in particular true if you stack them (e.g. with postaction). So I think telling the user that one should not do too complex things is a great idea.

hmenke added a commit to hmenke/pgf that referenced this issue May 18, 2020
@hmenke hmenke added this to the 3.1.6 milestone May 18, 2020
@hmenke hmenke closed this as completed May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant