1

I am trying to teach myself how to use the knots package for latex to render images for a paper I am writing. Unfortunately nobody else in my department has any experience with this package. I think that I have figured out the basic commands and I was trying to draw a simple diagram. One of many which I will need. If you render the code below you'll see a sharpish point in the middle. Is there an obvious way to smooth this out. I've tried flattening the loops but that doesn't make it any better. Any help is greatly appreciated.

\begin{tikzpicture}[scale = 1]
\begin{knot}[
    consider self intersections,
    draft mode = crossings,
    clip width = 10,]
    %flip crossing = #,]
\strand[black, thick](0,0) .. controls +(5,16) and +(5,-16) .. (0,8) .. controls +(5,16) and +(5,-16) .. (0,16);
\end{knot}
\end{tikzpicture}

1 Answer 1

1

This has nothing to do with the knots package. You just happen to draw two curves the slopes of which differ at the point where they get combined. One of the many ways to rectify this is

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{knots}
\begin{document}
\begin{tikzpicture}[scale = 1]
\begin{knot}[
    consider self intersections,
    draft mode = crossings,
    clip width = 10,]
    %flip crossing = #,]
\strand[black, thick,looseness=2]
(0,0) to[out=90,in=90] (4,4) to[out=-90,in=-90] (0,8) 
to[out=90,in=90] (4,12) to[out=-90,in=-90]  (0,16);
\end{knot}
\end{tikzpicture}

\end{document}

enter image description here

6
  • Thank you so much for the solution. You did make a number of changes to the original code. Could you explain what some of the changes are doing explicitly?
    – Walt
    Jan 28, 2020 at 21:25
  • @Walt All I do is to make sure that the slope does not jump. This is achieved by having an in and a subsequent out differ by 180.
    – user194703
    Jan 28, 2020 at 21:28
  • BTW, this code does not have the problem mentioned in your next question. That is, if you use scale=0.2 the intersections will still be found.
    – user194703
    Jan 28, 2020 at 21:34
  • I don't fully understand what those commands are since I have never seen them before. You see you have completely replaced the control statements in my original posting with the in out statements. What are those. I get that having a uniform slope will fix my problem what I don't get is what your code is doing on a level where I can apply it to other diagrams.
    – Walt
    Jan 28, 2020 at 22:08
  • @Walt This is explained in great detail on p. 838 of pgfmanual v3.1.5.
    – user194703
    Jan 28, 2020 at 22:10

You must log in to answer this question.

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