The code
\documentclass[tikz,border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{hobby, knots}
\begin{document}
\begin{tikzpicture}[rotate=90,scale=3]% remove 'scale=3' to get the error
\begin{knot}[flip crossing=1,consider self intersections=true,
ignore endpoint intersections=false]
\strand (0,1) toout=-90,in=90 to [out=270, in=270]
(0.3,0.5)to [out=90, in=90]
(0,0.5)to[out=-90,in=90] (0,0);
\end{knot}
\end{tikzpicture}
\end{document}
uses the knots package to produce:
(It's rotated only to take up less space.) This is what I want, except that it is too large. Unfortunately, removing the scale=3 from the tikzpicture environment gives the error:
! Undefined control sequence. \LaTeX3 error: Erroneous variable \knotnextfilament6 used! l.14 \end{knot}x
Does anyone have any idea why this error occurs and how to fix it to get a smaller twist? (Of course, I could just rescale the image using \scalebox but this hack does not really solve the problem.)
In some sense the error is caused by the ignore endpoint intersections=false because without this the code compiles producing:
This does not solve my problem, however, as the crossing has been replaced by in intersection
The post Crossings in tikz knots package shows several ways to draw the twist using the knots package, so I can draw the diagram that I want, however, I still do not understand why the code above does not work when scale=3 is removed.


\strand (0,1) to[out=-90,in=90](0,0.55) to [out=-90, in=-90] (0.3,0.5)to [out=90, in=90] (0,0.45)edge(0,0);– Oct 24 '21 at 01:00ignore endpoint intersections=false. – 314159265358979323 Oct 24 '21 at 01:12(0,0.501)and(0,0.499)in that order fixes the problem. Interestingly, if I put(0,0.5001)and(0,0.4999)then it still compiles but it thinks that there are three crossings at that point. (This is using pdflatex, other engines might have different precision boundaries). – Andrew Stacey Oct 25 '21 at 10:13(0,0.5)then it finds 4 crossings so I still recommend adjusting them slightly to ensure that it only finds 1. – Andrew Stacey Oct 25 '21 at 10:52Have you seen the newer way of drawing knots using the spath3 tikz library?: Hmm, perhaps I'm too impatient. I started drawing the diagrams that I needed by dipping in the manuals and following code I found on the net. Sometimes I usedknots, sometimeshobbyand sometimes withspath3. I never worked out the relationships between the three packages and, in particular, whether the latter ones superceded or complemented the earlier ones. Perhaps I missed this in the documentation? – 314159265358979323 Oct 26 '21 at 07:57knotsandspath3; thehobbypackage is for designing the curves in the first place and the others are for rendering the intersections as knots. They work in different ways,knotsoverdraws whilespath3cuts. I'd say that neither is superior, but sometimes one is more appropriate than the other. If you want to illustrate 3-colouring, for example, thenspath3is better. If your paths are decorated, often the overdrawing method is better. – Andrew Stacey Oct 26 '21 at 09:28