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

Using controls and cycle in a named picture leads to “no shape … known” error. #717

Closed
Wrzlprmft opened this issue Jul 23, 2019 · 3 comments
Milestone

Comments

@Wrzlprmft
Copy link

Wrzlprmft commented Jul 23, 2019

Minimal example:

\documentclass{standalone}
\usepackage{tikz}

\tikzset{pics/mypic/.style={code={
	\draw (0,0) .. controls (1,1) .. cycle;
}}}

\begin{document}
	\begin{tikzpicture}
		\pic (myname) {mypic};
	\end{tikzpicture}
\end{document}

This raises the following error:

! Package pgf Error: No shape named mynamecurrent subpath start is known.

See the pgf package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.10 		\pic (myname) {mypic}
                            ;

The following changes remove the problem:

  • Using -- instead of controls.
  • Using (0,0) instead of cycle.
  • Not naming the picture, i.e., removing myname.
@hmenke
Copy link
Member

hmenke commented Jul 27, 2019

What I find most interesting is that this works at all. I always thought that the only legal construction that you could use was -- cycle;. Does it work if the pic content is

\draw (0,0) .. controls (1,1) .. (0,0) -- cycle;

@Wrzlprmft
Copy link
Author

Does it work if the pic content is

\draw (0,0) .. controls (1,1) .. (0,0) -- cycle;

Yes, that throws no error.

@hmenke hmenke added this to the 3.1.5 milestone Nov 3, 2019
@hmenke
Copy link
Member

hmenke commented Nov 3, 2019

Short investigation shows that this is most likely a duplicate of #311

hmenke added a commit to hmenke/pgf that referenced this issue Nov 4, 2019
There were two issues:

1. Pile-up of `name prefix' pgf-tikz#311

    There is an extensive and very nice answer on TeX.SX:
    https://tex.stackexchange.com/questions/176900
    I have now implemented the first suggestion of just overriding
    `name prefix'.  I still have to test how this interacts with manual
    setting of `name prefix', but that doesn't seem to be very common
    (at least it doesn't seem to occur in the manual).

2. No resolution of global node names pgf-tikz#717

    This had the effect that when requesting `current subpath start' (or
    any other global name) from within a pic, the resolution would add
    the prefix and suffix with \tikz@pp@name and if the resulting local
    name was undefined, throw an error.  Now I have implemented a two
    step resolution which first checks whether the local name exists and
    if it doesn't tries the global name.  I hope nobody is relying on
    the fact that before global names weren't resolved.
@hmenke hmenke closed this as completed Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants