Closed adamny closed 2 years ago
Thanks for reporting this.
I should probably explicitly disable post/pre actions at various points in the processing of knot strands since they probably shouldn't be applied all the time. I can get what I think is the right behaviour by wrapping the postaction
in an only when rendering
style:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{
knots,
positioning,
decorations.markings,
arrows.meta,
calc,
shapes,
math,
}
\begin{document}
\begin{tikzpicture}
\draw[
decoration={
markings,
mark=at position 0.2 with {
\draw[black, fill=black] circle[radius=2pt];
}
},
postaction={
decorate
},
] (0,0) -- (1,1);
% This used to work, but not anymore:
\begin{knot}
\strand[
decoration={
markings,
mark=at position 0.2 with {
\draw[black, fill=black] circle[radius=2pt];
}
},
only when rendering/.style={
postaction={
decorate
}
}
] (2,0) -- ++(1,1);
\end{knot}
\end{tikzpicture}
\end{document}
The issue is that the path is used several times, and only some of those are when the path is actually drawn. Ideally, I'd figure out what things definitely shouldn't be set when the path is used but not drawn and explicitly disable them. If not that, then better error reporting would be at least a step in the right direction!
And ... looks like there is a bug revealed here. There would appear to be some extra grouping defined when a postaction
is used (that aren't there when a preaction
) is used causing issues with how the knot
environment saves the path for re-using.
Many thanks!
The command `strand' below used to work, but not anymore: