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

Form-only patterns have no specified color #1122

Closed
QJLc opened this issue Jan 9, 2022 · 3 comments
Closed

Form-only patterns have no specified color #1122

QJLc opened this issue Jan 9, 2022 · 3 comments

Comments

@QJLc
Copy link

QJLc commented Jan 9, 2022

\documentclass{article}

\usepackage{tikz}

\begin{document}

\pgfdeclarepatternformonly[\testcolor]{Rings}
{\pgfpoint{-0.5*20pt}{-0.5*20pt}}
{\pgfpoint{0.5*20pt}{0.5*20pt}}
{\pgfpoint{20pt}{20pt}}
{
%  \pgfsetstrokecolor{\testcolor}%
  \pgfpathcircle\pgfpointorigin{8pt}
  \pgfusepath{stroke}
}

\begin{tikzpicture}[testcolor/.store in=\testcolor, Rings/.style={pattern=Rings}]
  \begin{scope}[testcolor=red]
    \filldraw [Rings] (0,0) rectangle +(1.5,2);
    \filldraw [Rings, pattern color=green] (2,0) rectangle +(1.5,2);
  \end{scope}
  \begin{scope}[testcolor=green]
    \filldraw [Rings] (0,2.5) rectangle +(1.5,2);
    \filldraw [Rings, pattern color=red] (2,2.5) rectangle +(1.5,2);
  \end{scope}
\end{tikzpicture}

\end{document}

I find that, in file pgfcorepatterns.code.tex, the line 184 has a number 7, it should be #7.

\def\pgf@declarepatternmutable#1#2#3#4#5#6#7{%
\pgfutil@ifundefined{pgf@pattern@name@#1}{%
\expandafter\gdef\csname pgf@pattern@name@#1\endcsname{#1}%
\expandafter\gdef\csname pgf@pattern@variables@#1\endcsname{#2}%
\expandafter\gdef\csname pgf@pattern@lowerleft@#1\endcsname{#3}%
\expandafter\gdef\csname pgf@pattern@upperright@#1\endcsname{#4}%
\expandafter\gdef\csname pgf@pattern@tilesize@#1\endcsname{#5}%
\expandafter\long\expandafter\gdef\csname pgf@pattern@code@#1\endcsname{#6}%
\expandafter\gdef\csname pgf@pattern@type@#1\endcsname{7}%
}{\pgferror{The pattern `#1' is already defined}}%
}

@muzimuzhi
Copy link
Member

Great catch! Would you like to prepare a pull request so you can be one of the contributors of pgf? Alternatively I can do the fixing commit and co-author with you, if you're willing to provide your email address, either the real one or the no-reply one.

@hmenke
Copy link
Member

hmenke commented Jan 10, 2022

Fixed in f811952

@QJLc
Copy link
Author

QJLc commented Jan 17, 2022

Sorry, my link to GitHub is not stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants