2

How can I create a crossing in the picture below? I tried to follow examples in the manual for tikz Knots package.

\documentclass[11pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{knots} 

\begin{document}
\begin{tikzpicture}[scale=0.75]
\begin{knot}[clip width=5, clip radius=8pt, consider self intersections]
  \strand[thick] (0,0)
    to[out=up, in=down] (0,1)
    to[out=up, in=left] (0.5,1.5)
    to[out=right, in=up]  (1,1)
    to[out=down, in=right]  (0.5,0.5)
    to[out=left, in=down]  (0,1)
    to[out=up, in=down]  (0,2);
\end{knot}
\end{tikzpicture}
\end{document}

enter image description here

EDIT: I am trying to illustrate the first Reidemeister move. Responding to Andrew's comment, I modified my code so that the crossing is not at the endpoint of a section and the crossing has tangents in different directions. However, the problem still persists:

\begin{knot}[clip width=10, clip radius=15pt, consider self intersections]
  \strand[thick] (0,0)
    to[out=up, in=down] (0,0.7) 
    to[out=up, in=left] (0.5,1.5)
    to[out=right, in=up]  (1,1)
    to[out=down, in=right]  (0.5,0.5)
    to[out=left, in=down]  (0,1.3)
    to[out=up, in=down]  (0,2);
\end{knot}

enter image description here

4
  • 1
    The algorithm behind the knots package works best when the crossing is not at the endpoint of a section of the path. It also looks best when the paths at the crossing have tangents in different directions. Does the diagram have to look exactly like that or is there a bit of freedom to adjust the picture? Nov 9, 2020 at 21:32
  • @AndrewStacey: Thanks for your suggestions. I amended my question accordingly, but still have trouble with the crossing.
    – Adam
    Nov 11, 2020 at 0:14
  • The distance between the intersection and the specified points is still too small so the algorithm is missing the intersection (the purpose of this is to avoid spurious intersections, by the way). There's a key that can be used to reduce the internal distance used on this check - see the documentation (I don't have it in front of me right now) or change the .7 to .5 and 1.3 to 1.5 Nov 11, 2020 at 6:42
  • I missed that you helpfully linked to the manual! The key is end tolerance. You could also try ’ignore endpoint intersections=false` on your original diagram (I'd forgotten that key). Nov 11, 2020 at 6:45

1 Answer 1

2

Finding the intersections in a knot diagram is a lengthy process so the knots library makes a few optimisations, which can be turned off if needed. These are:

  1. By default, it only looks at intersections between separate paths. consider self intersections=true overrides this.
  2. When looking at self intersections then it has to split the path into sections and consider intersections between these sections. Successive sections obviously intersect at their end points, these are considered spurious intersections and would crowd out the wanted ones so by default it ignores intersections that are near an endpoint of a section. What it considers to be "near" is determined by end tolerance=<dimen> (for simplicity, it uses the l^1 norm).
  3. Ignoring endpoint intersections can be disabled altogether by the key ignore endpoint intersections=false.

Here are three solutions. The first adjusts the path so that the intersection is not near an section endpoint (that is, near a specified point on the path). The second uses a smaller adjustment and adjusts end tolerance=<dimen> as well. The third uses the key ignore endpoint intersections=false on the original path.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{knots}

\title{Untitled}
\author{}
\date{2020-11-11}
\begin{document}
\maketitle


\begin{tikzpicture}
\begin{knot}[clip width=10, clip radius=15pt, consider self intersections]
  \strand[thick] (0,0)
    to[out=up, in=down] (0,0.5) 
    to[out=up, in=left] (0.5,1.5)
    to[out=right, in=up]  (1,1)
    to[out=down, in=right]  (0.5,0.5)
    to[out=left, in=down]  (0,1.5)
    to[out=up, in=down]  (0,2);
\end{knot}
\end{tikzpicture}


\begin{tikzpicture}
\begin{knot}[clip width=10, clip radius=15pt, consider self intersections, end tolerance=3pt]
  \strand[thick] (0,0)
    to[out=up, in=down] (0,0.7) 
    to[out=up, in=left] (0.5,1.5)
    to[out=right, in=up]  (1,1)
    to[out=down, in=right]  (0.5,0.5)
    to[out=left, in=down]  (0,1.3)
    to[out=up, in=down]  (0,2);
\end{knot}
\end{tikzpicture}

\begin{tikzpicture}[scale=0.75]
\begin{knot}[clip width=5, clip radius=8pt, consider self intersections, ignore endpoint intersections=false]
  \strand[thick] (0,0)
    to[out=up, in=down] (0,1)
    to[out=up, in=left] (0.5,1.5)
    to[out=right, in=up]  (1,1)
    to[out=down, in=right]  (0.5,0.5)
    to[out=left, in=down]  (0,1)
    to[out=up, in=down]  (0,2);
\end{knot}
\end{tikzpicture}


\end{document}

First Reidemeister move

You must log in to answer this question.

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