3

This question is related to this one on small knots, but the solution there does not help (though it is needed in order for the intersections to appear at all.

My problem is the following: I'm drawing a knot with two intersections quite close to each other (a few milimeter apart), and I'd like to flip the first crossing, but not the second one. When I try to do so, however, nothing happens. When trying to flip just the second crossing, both flip. I'm fairly sure that this is happening because they are close to each other, but I don't know how to remedy it... Any help would be much appreciated!

MWE:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{knots}
\begin{document} 
\begin{tikzpicture}
\begin{knot}[end tolerance=1pt,flip crossing=1]
\strand[red,thick] (0,0) ellipse (0.35cm and 0.1cm);
\strand[blue,thick] (0,-1) -- (0,1);
\end{knot}
\end{tikzpicture}
\begin{tikzpicture}
\begin{knot}[end tolerance=1pt,flip crossing=2]
\strand[red,thick] (0,0) ellipse (0.35cm and 0.1cm);
\strand[blue,thick] (0,-1) -- (0,1);
\end{knot}
\end{tikzpicture}
\end{document}
4

Short answer: add clip radius=2pt to your knot options to allow closer crossings.

Long answer: In order to draw the crossings, the knots package redraws the upper curve (with a spacing background), clipped to a circle centered around the crossing. The issue in your case is that the default circle encompasses both intersections, so the process seems to affect both intersections. Since the second intersection is rendered last, its drawing order seems to be used for both. We can see this by adding a background to the knot so that the paths used to make the gaps become visible:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{knots}
\begin{document} 
\begin{tikzpicture}
\begin{knot}[end tolerance=1pt,flip crossing=1]
\fill[gray] (-.5,-1) rectangle (.5,1);
\strand[red,thick] (0,0) ellipse (0.35cm and 0.1cm);
\strand[blue,thick] (0,-1) -- (0,1);
\end{knot}
\end{tikzpicture}
\end{document}

enter image description here

You can see that the blue path has a background in a circle around the first intersection and the red path has a background in a circle around the second, but each of these circles covers both intersections and so only the second one "appears".

To fix this, you can change the radius of the clipping circle so that the redrawing only occurs closer to the intersection. In practice, you want your radius to be bigger than the width of the crossing gap but smaller than the distance between the closest crossings.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{knots}
\begin{document} 
\begin{tikzpicture}
\begin{knot}[end tolerance=1pt,flip crossing=1, clip radius=2pt]
\fill[gray] (-.5,-1) rectangle (.5,1);
\strand[red,thick] (0,0) ellipse (0.35cm and 0.1cm);
\strand[blue,thick] (0,-1) -- (0,1);
\end{knot}
\end{tikzpicture}
\end{document}

enter image description here

Now the backgrounds are local enough to only affect the intended crossings.

  • Agreed ... very good deconstruction of the problem. – Loop Space Dec 4 '16 at 17:43
  • @LoopSpace Seeing as how I keep on running into small-knot-problems, I'm left wondering why the standard settings are not optimal for these cases. Are there any problems that arise when making the standard settings include things like small clip radius/end tolerance? – Danu Dec 4 '16 at 19:10
  • @Danu When I originally wrote the package, my knot diagrams were quite big so the defaults were set for such. You should be able to set them globally using a suitable \tikzset in your preamble. The sort of thing I was drawing can be seen in arxiv.org/pdf/1602.06450v1.pdf – Loop Space Dec 4 '16 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.