1

I am trying to draw a positive half-twist using knots package. I expected that every new strand lies on top of the previous ones, but that is not the case. In this the second (of the three) is on top:

\documentclass[tikz]{standalone}
\usetikzlibrary{knots} 
\begin{document}
\begin{tikzpicture}
\begin{knot}[clip width=2, consider self intersections]
     \strand  (0,1) .. controls +(0:.8) and +(180:.5) ..  (1,0); 
     \strand (0, .75) .. controls +(0:.5) and +(180:.5) .. (1,.25); 
     \strand  (0,0) .. controls +(0:.4) and +(180:.5) ..  (1,1);        
\end{knot}         
    \node at (0.9, 0.75) {\vdots};
    \node at (0.1, 0.4) {\vdots};
\end{tikzpicture}
\end{document}

enter image description here

And furthermore, when I interchange the lines for the first and the third strands, one crossing is not recognized:

enter image description here

Is this a bug or a feature? As I said, I am trying to draw a positive half-twist.

1 Answer 1

6

TL;DR I need to write better documentation.

Your diagram is actually quite small compared to those that I used when designing this package. This isn't a problem per se, but means that the default lengths are set up for larger diagrams and need to be reduced for ones such as yours.

Firstly, the lower right crossing is not being considered in either of the two versions (with the strands as you have them or with the order changed as you describe). This is because the default end tolerance is 14pt, which is about half a centimetre. As your entire diagram fits in a 1cm square, it's no surprise that one of the crossings is within half a centimetre of the end of a strand. So, the first step is to reduce the end tolerance to something more suited to your diagram.

The reason why you are seeing this crossing in the first version of your diagram is because when the left crossing is drawn (with the middle strand going over) then the clip region is so large that it encompasses the right crossing as well. That size is controlled by the clip radius which defaults to 10pt.

Drawing circles at relevant places shows this:

crossings with key regions circled

(draft mode=crossings is very useful for debugging as it shows which intersections are being found)

So to fix this, we need to reduce the dimensions as described above.

\documentclass{article}
%\url{https://tex.stackexchange.com/q/611824/86}
\usepackage{tikz}


\usetikzlibrary{knots} 
\begin{document}
\begin{tikzpicture}
\begin{knot}[
  clip width=2,
%  draft mode=crossings,
  end tolerance=3pt,
  clip radius=3pt,
]
     \strand[red]  (0,1) .. controls +(0:.8) and +(180:.5) ..  (1,0); 
     \strand[green] (0, .75) .. controls +(0:.5) and +(180:.5) .. (1,.25); 
     \strand[blue]  (0,0) .. controls +(0:.4) and +(180:.5) ..  (1,1);        
\end{knot}         
\node at (0.9, 0.75) {\vdots};
\node at (0.1, 0.4) {\vdots};
\end{tikzpicture}
\end{document}

This produces the following:

Small knot with all crossings

Incidentally, your intuition about which strand should be the over strand is incorrect. You say "I expected that every new strand lies on top of the previous ones". Since every crossing gets re-rendered regardless of whether it should be flipped or not, I had a choice as to whether the lower or higher number is chosen as the over-strand by default. For no reason that I can remember -- but probably purely a pragmatic programming reason -- I chose the lower number so the crossings should look as though the earlier strands are on top of the later ones.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .