TikZ Knots package: crossing changed after scalingUnexpected behavior of the “knots” tikz library when a crossing is close to another (thick) line: What's going on?How can the knots TikZ library be used with current l3 (e.g. TeX Live 2015)?Unexpected behavior of the “knots” tikz library when a crossing is close to another (thick) line: What's going on?Tikz knots package: line style with consider self-intersectionsUnwanted white space around knots in TikZHow can I construct a planar tangle, shaed or un-shaded, in LaTeX or Mathematica using the tikz package?Flipping behavior at triple point crossings in knots package for tikzForce individual pin angle in knots package TikZFlip crossing doesn't work in TikZ with two strands

Why do I get two different answers for this counting problem?

I'm flying to France today and my passport expires in less than 2 months

How can I tell someone that I want to be his or her friend?

What is the intuition behind short exact sequences of groups; in particular, what is the intuition behind group extensions?

How to model explosives?

Why does Kotter return in Welcome Back Kotter

90's TV series where a boy goes to another dimension through portal near power lines

Neighboring nodes in the network

Python: return float 1.0 as int 1 but float 1.5 as float 1.5

Can I ask the recruiters in my resume to put the reason why I am rejected?

Etiquette around loan refinance - decision is going to cost first broker a lot of money

How do I find out when a node was added to an availability group?

How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?

Is it canonical bit space?

Cronab fails because shell path not found

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

What exploit are these user agents trying to use?

Is it unprofessional to ask if a job posting on GlassDoor is real?

How do I write bicross product symbols in latex?

Is it possible to create light that imparts a greater proportion of its energy as momentum rather than heat?

How much of data wrangling is a data scientist's job?

How to say in German "enjoying home comforts"

Why 'in' operator is throwing error instead of logging false with string literal

Arrow those variables!



TikZ Knots package: crossing changed after scaling


Unexpected behavior of the “knots” tikz library when a crossing is close to another (thick) line: What's going on?How can the knots TikZ library be used with current l3 (e.g. TeX Live 2015)?Unexpected behavior of the “knots” tikz library when a crossing is close to another (thick) line: What's going on?Tikz knots package: line style with consider self-intersectionsUnwanted white space around knots in TikZHow can I construct a planar tangle, shaed or un-shaded, in LaTeX or Mathematica using the tikz package?Flipping behavior at triple point crossings in knots package for tikzForce individual pin angle in knots package TikZFlip crossing doesn't work in TikZ with two strands













3















I have realised that my knot diagram changes one of its crossings when it's scaled differently. The crossings should be correct in the second diagram generated by the code below. I don't know how this has happened. I have tried using draft mode=crossings but it was no use. Could I please have some help in switching the crossings to the correct version in the first diagram?



This is my code:



documentclass[a4paper,11pt]report
usepackagegraphicx,amssymb,amstext,amsmath
usepackagetikz
usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

begindocument

tikzset
knot diagram/every strand/.append style=
line width=1.5pt,violet
,


tikzset
my style/.style=
dashed



begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

%---------------------------------------------------------------

begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

enddocument









share|improve this question






















  • The problem is the presence of the dashed line. Do you need that to be defined as part of the knot? Could it be an ordinary line drawn before the knot is rendered? I'll post some different possibilities when I get back to a proper computer.

    – Loop Space
    22 hours ago











  • This is the same underlying problem as addressed in tex.stackexchange.com/q/323758/86 I'll post an answer here as well as it's not easy to generalise, but refer to the answer there for the explanation.

    – Loop Space
    5 hours ago















3















I have realised that my knot diagram changes one of its crossings when it's scaled differently. The crossings should be correct in the second diagram generated by the code below. I don't know how this has happened. I have tried using draft mode=crossings but it was no use. Could I please have some help in switching the crossings to the correct version in the first diagram?



This is my code:



documentclass[a4paper,11pt]report
usepackagegraphicx,amssymb,amstext,amsmath
usepackagetikz
usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

begindocument

tikzset
knot diagram/every strand/.append style=
line width=1.5pt,violet
,


tikzset
my style/.style=
dashed



begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

%---------------------------------------------------------------

begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

enddocument









share|improve this question






















  • The problem is the presence of the dashed line. Do you need that to be defined as part of the knot? Could it be an ordinary line drawn before the knot is rendered? I'll post some different possibilities when I get back to a proper computer.

    – Loop Space
    22 hours ago











  • This is the same underlying problem as addressed in tex.stackexchange.com/q/323758/86 I'll post an answer here as well as it's not easy to generalise, but refer to the answer there for the explanation.

    – Loop Space
    5 hours ago













3












3








3


0






I have realised that my knot diagram changes one of its crossings when it's scaled differently. The crossings should be correct in the second diagram generated by the code below. I don't know how this has happened. I have tried using draft mode=crossings but it was no use. Could I please have some help in switching the crossings to the correct version in the first diagram?



This is my code:



documentclass[a4paper,11pt]report
usepackagegraphicx,amssymb,amstext,amsmath
usepackagetikz
usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

begindocument

tikzset
knot diagram/every strand/.append style=
line width=1.5pt,violet
,


tikzset
my style/.style=
dashed



begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

%---------------------------------------------------------------

begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

enddocument









share|improve this question














I have realised that my knot diagram changes one of its crossings when it's scaled differently. The crossings should be correct in the second diagram generated by the code below. I don't know how this has happened. I have tried using draft mode=crossings but it was no use. Could I please have some help in switching the crossings to the correct version in the first diagram?



This is my code:



documentclass[a4paper,11pt]report
usepackagegraphicx,amssymb,amstext,amsmath
usepackagetikz
usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

begindocument

tikzset
knot diagram/every strand/.append style=
line width=1.5pt,violet
,


tikzset
my style/.style=
dashed



begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

%---------------------------------------------------------------

begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

enddocument






tikz-knots






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 20:42









JpWJpW

554




554












  • The problem is the presence of the dashed line. Do you need that to be defined as part of the knot? Could it be an ordinary line drawn before the knot is rendered? I'll post some different possibilities when I get back to a proper computer.

    – Loop Space
    22 hours ago











  • This is the same underlying problem as addressed in tex.stackexchange.com/q/323758/86 I'll post an answer here as well as it's not easy to generalise, but refer to the answer there for the explanation.

    – Loop Space
    5 hours ago

















  • The problem is the presence of the dashed line. Do you need that to be defined as part of the knot? Could it be an ordinary line drawn before the knot is rendered? I'll post some different possibilities when I get back to a proper computer.

    – Loop Space
    22 hours ago











  • This is the same underlying problem as addressed in tex.stackexchange.com/q/323758/86 I'll post an answer here as well as it's not easy to generalise, but refer to the answer there for the explanation.

    – Loop Space
    5 hours ago
















The problem is the presence of the dashed line. Do you need that to be defined as part of the knot? Could it be an ordinary line drawn before the knot is rendered? I'll post some different possibilities when I get back to a proper computer.

– Loop Space
22 hours ago





The problem is the presence of the dashed line. Do you need that to be defined as part of the knot? Could it be an ordinary line drawn before the knot is rendered? I'll post some different possibilities when I get back to a proper computer.

– Loop Space
22 hours ago













This is the same underlying problem as addressed in tex.stackexchange.com/q/323758/86 I'll post an answer here as well as it's not easy to generalise, but refer to the answer there for the explanation.

– Loop Space
5 hours ago





This is the same underlying problem as addressed in tex.stackexchange.com/q/323758/86 I'll post an answer here as well as it's not easy to generalise, but refer to the answer there for the explanation.

– Loop Space
5 hours ago










2 Answers
2






active

oldest

votes


















2














I did precisely what you suggested, draft mode=crossings, after which I flipped crossing number 6 and get



documentclass[a4paper,11pt]report
usepackagegraphicx,amssymb,amstext,amsmath
usepackagetikz
usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

begindocument

tikzset
knot diagram/every strand/.append style=
line width=1.5pt,violet
,


tikzset
my style/.style=
dashed



begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

%---------------------------------------------------------------

begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[%draft mode=crossings,
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing/.list=3,6,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

enddocument


enter image description here



OK, I am not able to solve the problem. Here is a proposal for a workaround.



documentclass[a4paper,11pt]report
usepackagegraphicx,amssymb,amstext,amsmath
usepackagetikz
usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

begindocument

tikzset
knot diagram/every strand/.append style=
line width=3.2pt,violet
,


tikzset
my style/.style=
dashed



scalebox0.45
begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[%draft mode=crossings,
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

enddocument


enter image description here






share|improve this answer




















  • 1





    Ah thank you (as always!) - but I meant how could I change that crossing in the first diagram?

    – JpW
    Mar 7 at 21:42











  • @JpW Oh, sorry. Yes, I confirm that this is difficult. One can get the intersection as desired by putting flip crossing=8, in the first graph, but then the intersection with the vertical line is wrong (I also removed (0,0) in the end). I suspect that the fact that you use the coordinate (0,0) in the end (in addition to [closed]) could be part of the reason.

    – marmot
    Mar 7 at 22:40











  • If you alter the scale from 1 to 2 without any changes to the crossing flips, then you can actually see the crossing slowly change...

    – JpW
    Mar 7 at 22:49











  • @JpW Yes. I see how there can be problems. TikZ uses approximations to find intersections. Sometimes it finds more than there actually are, i.e. it may overcount intersections and so on. This does depend on the scale. What you can always do is to put something that works in a scalebox (and scale the line width and the nodes up with transform shape). Is your aim to have the second plot scaled down to the first one?

    – marmot
    Mar 7 at 22:54











  • Yes it is. I'm writing up my report, which is on a much smaller scale than my poster (which was what I previously used). I wrote the poster in beamer several weeks ago and I'm trying to use the same code for the report but that crossing is a headache.

    – JpW
    Mar 7 at 22:59


















0














The underlying issue here is the same as noted in Unexpected behavior of the "knots" tikz library when a crossing is close to another (thick) line: What's going on?. There are two crossings that are very close together and the clipping circles (when the crossings are drawn) overlap, meaning that when the violet line is drawn over the dashed grey line, it also draws over itself at that problematic crossing.



Here are a few possible fixes. In the first, I reduce the radius of the clipping circles. In the second, I took the dashed grey line out of the knot as it doesn't seem to be actually part of the knot (note that if you do want to keep it in the knot, you should use the key only when rendering for the dashed part - see the documentation for details). In the third fix, I simplified your hobby path a little.



Results:



The various fixes



Code:



documentclass[a4paper,11pt]report
%urlhttps://tex.stackexchange.com/q/478294/86
usepackageshellesc
usepackagegraphicx,amssymb,amstext,amsmath
usepackagetikz
usetikzlibrary
decorations.pathreplacing,
decorations.markings,
hobby,
knots,
celtic,
shapes.geometric,
calc,
external


tikzexternalize

begindocument

tikzset
knot diagram/every strand/.append style=
line width=1.5pt,violet
,


tikzset
my style/.style=
dashed






Demonstration of the problem: the clipping circles are big enough that the circle associated with the crossing between the violet line and the dashed grey line overlaps the problematic crossing.

tikzsetnextfilenameproblem
begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
background clip/.append style=
preaction=
fill=gray,
fill opacity=.5,

,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

%---------------------------------------------------------------

Fix one: shrink the clipping circles using the verb+clip radius+ key.

tikzsetnextfilenamefix-one
begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
clip radius=3pt,
background clip/.append style=
preaction=
fill=gray,
fill opacity=.5,

,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

Fix two: the dashed grey lines don't appear to actually be anything to do with the knot, so draw them separately.
This means that there aren't two crossings near to each other any more.

tikzsetnextfilenamefix-two
begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
draw[
line width=1.5pt,
my style,
lightgray,
rotate=180
] (-0.7,-1.2) -- (-0.7,2.5);
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
% flip crossing=6,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
endknot
path (0,-.7);
endtikzpicture

Fix three: you specify a lot of emphnodes in your Hobby path.
If you aren't wedded to that specific path then reducing the number of nodes can simplify the knot algorithm.

tikzsetnextfilenamefix-three
begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.2 with arrow[line width=1.5pt]<,
mark=at position 0.28 with arrow[line width=1.5pt]<,
mark=at position 0.8 with arrow[line width=1.5pt]<]
draw[
line width=1.5pt,
my style,
lightgray,
rotate=180
] (-0.7,-2.2) -- (-0.7,3.5);
beginknot[
consider self intersections=true,
end tolerance=3pt,
flip crossing=4,
rotate=180]
strand ([closed].5,2) [add arrow,violet] .. (-.5,1) .. (.3,-.5) .. (-.3,-.5) .. (.5,1) .. ([tension=3]-1.5,1) .. (.7,-1) .. (-2,1);
endknot
path (0,-.7);
endtikzpicture


tikzsetnextfilenamelarge-scale
begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
markings,
mark=at position 0.25 with arrow[line width=1.5pt]<,
mark=at position 0.653 with arrow[line width=1.5pt]<,
mark=at position 0.75 with arrow[line width=1.5pt]<]
beginknot[
consider self intersections=true,
ignore endpoint intersections=false,
flip crossing=3,
rotate=180]
strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
endknot
path (0,-.7);
endtikzpicture

enddocument





share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "85"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478294%2ftikz-knots-package-crossing-changed-after-scaling%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    I did precisely what you suggested, draft mode=crossings, after which I flipped crossing number 6 and get



    documentclass[a4paper,11pt]report
    usepackagegraphicx,amssymb,amstext,amsmath
    usepackagetikz
    usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

    begindocument

    tikzset
    knot diagram/every strand/.append style=
    line width=1.5pt,violet
    ,


    tikzset
    my style/.style=
    dashed



    begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    %---------------------------------------------------------------

    begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[%draft mode=crossings,
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing/.list=3,6,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    enddocument


    enter image description here



    OK, I am not able to solve the problem. Here is a proposal for a workaround.



    documentclass[a4paper,11pt]report
    usepackagegraphicx,amssymb,amstext,amsmath
    usepackagetikz
    usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

    begindocument

    tikzset
    knot diagram/every strand/.append style=
    line width=3.2pt,violet
    ,


    tikzset
    my style/.style=
    dashed



    scalebox0.45
    begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[%draft mode=crossings,
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    enddocument


    enter image description here






    share|improve this answer




















    • 1





      Ah thank you (as always!) - but I meant how could I change that crossing in the first diagram?

      – JpW
      Mar 7 at 21:42











    • @JpW Oh, sorry. Yes, I confirm that this is difficult. One can get the intersection as desired by putting flip crossing=8, in the first graph, but then the intersection with the vertical line is wrong (I also removed (0,0) in the end). I suspect that the fact that you use the coordinate (0,0) in the end (in addition to [closed]) could be part of the reason.

      – marmot
      Mar 7 at 22:40











    • If you alter the scale from 1 to 2 without any changes to the crossing flips, then you can actually see the crossing slowly change...

      – JpW
      Mar 7 at 22:49











    • @JpW Yes. I see how there can be problems. TikZ uses approximations to find intersections. Sometimes it finds more than there actually are, i.e. it may overcount intersections and so on. This does depend on the scale. What you can always do is to put something that works in a scalebox (and scale the line width and the nodes up with transform shape). Is your aim to have the second plot scaled down to the first one?

      – marmot
      Mar 7 at 22:54











    • Yes it is. I'm writing up my report, which is on a much smaller scale than my poster (which was what I previously used). I wrote the poster in beamer several weeks ago and I'm trying to use the same code for the report but that crossing is a headache.

      – JpW
      Mar 7 at 22:59















    2














    I did precisely what you suggested, draft mode=crossings, after which I flipped crossing number 6 and get



    documentclass[a4paper,11pt]report
    usepackagegraphicx,amssymb,amstext,amsmath
    usepackagetikz
    usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

    begindocument

    tikzset
    knot diagram/every strand/.append style=
    line width=1.5pt,violet
    ,


    tikzset
    my style/.style=
    dashed



    begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    %---------------------------------------------------------------

    begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[%draft mode=crossings,
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing/.list=3,6,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    enddocument


    enter image description here



    OK, I am not able to solve the problem. Here is a proposal for a workaround.



    documentclass[a4paper,11pt]report
    usepackagegraphicx,amssymb,amstext,amsmath
    usepackagetikz
    usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

    begindocument

    tikzset
    knot diagram/every strand/.append style=
    line width=3.2pt,violet
    ,


    tikzset
    my style/.style=
    dashed



    scalebox0.45
    begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[%draft mode=crossings,
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    enddocument


    enter image description here






    share|improve this answer




















    • 1





      Ah thank you (as always!) - but I meant how could I change that crossing in the first diagram?

      – JpW
      Mar 7 at 21:42











    • @JpW Oh, sorry. Yes, I confirm that this is difficult. One can get the intersection as desired by putting flip crossing=8, in the first graph, but then the intersection with the vertical line is wrong (I also removed (0,0) in the end). I suspect that the fact that you use the coordinate (0,0) in the end (in addition to [closed]) could be part of the reason.

      – marmot
      Mar 7 at 22:40











    • If you alter the scale from 1 to 2 without any changes to the crossing flips, then you can actually see the crossing slowly change...

      – JpW
      Mar 7 at 22:49











    • @JpW Yes. I see how there can be problems. TikZ uses approximations to find intersections. Sometimes it finds more than there actually are, i.e. it may overcount intersections and so on. This does depend on the scale. What you can always do is to put something that works in a scalebox (and scale the line width and the nodes up with transform shape). Is your aim to have the second plot scaled down to the first one?

      – marmot
      Mar 7 at 22:54











    • Yes it is. I'm writing up my report, which is on a much smaller scale than my poster (which was what I previously used). I wrote the poster in beamer several weeks ago and I'm trying to use the same code for the report but that crossing is a headache.

      – JpW
      Mar 7 at 22:59













    2












    2








    2







    I did precisely what you suggested, draft mode=crossings, after which I flipped crossing number 6 and get



    documentclass[a4paper,11pt]report
    usepackagegraphicx,amssymb,amstext,amsmath
    usepackagetikz
    usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

    begindocument

    tikzset
    knot diagram/every strand/.append style=
    line width=1.5pt,violet
    ,


    tikzset
    my style/.style=
    dashed



    begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    %---------------------------------------------------------------

    begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[%draft mode=crossings,
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing/.list=3,6,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    enddocument


    enter image description here



    OK, I am not able to solve the problem. Here is a proposal for a workaround.



    documentclass[a4paper,11pt]report
    usepackagegraphicx,amssymb,amstext,amsmath
    usepackagetikz
    usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

    begindocument

    tikzset
    knot diagram/every strand/.append style=
    line width=3.2pt,violet
    ,


    tikzset
    my style/.style=
    dashed



    scalebox0.45
    begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[%draft mode=crossings,
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    enddocument


    enter image description here






    share|improve this answer















    I did precisely what you suggested, draft mode=crossings, after which I flipped crossing number 6 and get



    documentclass[a4paper,11pt]report
    usepackagegraphicx,amssymb,amstext,amsmath
    usepackagetikz
    usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

    begindocument

    tikzset
    knot diagram/every strand/.append style=
    line width=1.5pt,violet
    ,


    tikzset
    my style/.style=
    dashed



    begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    %---------------------------------------------------------------

    begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[%draft mode=crossings,
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing/.list=3,6,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    enddocument


    enter image description here



    OK, I am not able to solve the problem. Here is a proposal for a workaround.



    documentclass[a4paper,11pt]report
    usepackagegraphicx,amssymb,amstext,amsmath
    usepackagetikz
    usetikzlibrarydecorations.pathreplacing,decorations.markings,hobby,knots,celtic,shapes.geometric,calc

    begindocument

    tikzset
    knot diagram/every strand/.append style=
    line width=3.2pt,violet
    ,


    tikzset
    my style/.style=
    dashed



    scalebox0.45
    begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[%draft mode=crossings,
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    enddocument


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 7 at 23:09

























    answered Mar 7 at 21:24









    marmotmarmot

    114k5145276




    114k5145276







    • 1





      Ah thank you (as always!) - but I meant how could I change that crossing in the first diagram?

      – JpW
      Mar 7 at 21:42











    • @JpW Oh, sorry. Yes, I confirm that this is difficult. One can get the intersection as desired by putting flip crossing=8, in the first graph, but then the intersection with the vertical line is wrong (I also removed (0,0) in the end). I suspect that the fact that you use the coordinate (0,0) in the end (in addition to [closed]) could be part of the reason.

      – marmot
      Mar 7 at 22:40











    • If you alter the scale from 1 to 2 without any changes to the crossing flips, then you can actually see the crossing slowly change...

      – JpW
      Mar 7 at 22:49











    • @JpW Yes. I see how there can be problems. TikZ uses approximations to find intersections. Sometimes it finds more than there actually are, i.e. it may overcount intersections and so on. This does depend on the scale. What you can always do is to put something that works in a scalebox (and scale the line width and the nodes up with transform shape). Is your aim to have the second plot scaled down to the first one?

      – marmot
      Mar 7 at 22:54











    • Yes it is. I'm writing up my report, which is on a much smaller scale than my poster (which was what I previously used). I wrote the poster in beamer several weeks ago and I'm trying to use the same code for the report but that crossing is a headache.

      – JpW
      Mar 7 at 22:59












    • 1





      Ah thank you (as always!) - but I meant how could I change that crossing in the first diagram?

      – JpW
      Mar 7 at 21:42











    • @JpW Oh, sorry. Yes, I confirm that this is difficult. One can get the intersection as desired by putting flip crossing=8, in the first graph, but then the intersection with the vertical line is wrong (I also removed (0,0) in the end). I suspect that the fact that you use the coordinate (0,0) in the end (in addition to [closed]) could be part of the reason.

      – marmot
      Mar 7 at 22:40











    • If you alter the scale from 1 to 2 without any changes to the crossing flips, then you can actually see the crossing slowly change...

      – JpW
      Mar 7 at 22:49











    • @JpW Yes. I see how there can be problems. TikZ uses approximations to find intersections. Sometimes it finds more than there actually are, i.e. it may overcount intersections and so on. This does depend on the scale. What you can always do is to put something that works in a scalebox (and scale the line width and the nodes up with transform shape). Is your aim to have the second plot scaled down to the first one?

      – marmot
      Mar 7 at 22:54











    • Yes it is. I'm writing up my report, which is on a much smaller scale than my poster (which was what I previously used). I wrote the poster in beamer several weeks ago and I'm trying to use the same code for the report but that crossing is a headache.

      – JpW
      Mar 7 at 22:59







    1




    1





    Ah thank you (as always!) - but I meant how could I change that crossing in the first diagram?

    – JpW
    Mar 7 at 21:42





    Ah thank you (as always!) - but I meant how could I change that crossing in the first diagram?

    – JpW
    Mar 7 at 21:42













    @JpW Oh, sorry. Yes, I confirm that this is difficult. One can get the intersection as desired by putting flip crossing=8, in the first graph, but then the intersection with the vertical line is wrong (I also removed (0,0) in the end). I suspect that the fact that you use the coordinate (0,0) in the end (in addition to [closed]) could be part of the reason.

    – marmot
    Mar 7 at 22:40





    @JpW Oh, sorry. Yes, I confirm that this is difficult. One can get the intersection as desired by putting flip crossing=8, in the first graph, but then the intersection with the vertical line is wrong (I also removed (0,0) in the end). I suspect that the fact that you use the coordinate (0,0) in the end (in addition to [closed]) could be part of the reason.

    – marmot
    Mar 7 at 22:40













    If you alter the scale from 1 to 2 without any changes to the crossing flips, then you can actually see the crossing slowly change...

    – JpW
    Mar 7 at 22:49





    If you alter the scale from 1 to 2 without any changes to the crossing flips, then you can actually see the crossing slowly change...

    – JpW
    Mar 7 at 22:49













    @JpW Yes. I see how there can be problems. TikZ uses approximations to find intersections. Sometimes it finds more than there actually are, i.e. it may overcount intersections and so on. This does depend on the scale. What you can always do is to put something that works in a scalebox (and scale the line width and the nodes up with transform shape). Is your aim to have the second plot scaled down to the first one?

    – marmot
    Mar 7 at 22:54





    @JpW Yes. I see how there can be problems. TikZ uses approximations to find intersections. Sometimes it finds more than there actually are, i.e. it may overcount intersections and so on. This does depend on the scale. What you can always do is to put something that works in a scalebox (and scale the line width and the nodes up with transform shape). Is your aim to have the second plot scaled down to the first one?

    – marmot
    Mar 7 at 22:54













    Yes it is. I'm writing up my report, which is on a much smaller scale than my poster (which was what I previously used). I wrote the poster in beamer several weeks ago and I'm trying to use the same code for the report but that crossing is a headache.

    – JpW
    Mar 7 at 22:59





    Yes it is. I'm writing up my report, which is on a much smaller scale than my poster (which was what I previously used). I wrote the poster in beamer several weeks ago and I'm trying to use the same code for the report but that crossing is a headache.

    – JpW
    Mar 7 at 22:59











    0














    The underlying issue here is the same as noted in Unexpected behavior of the "knots" tikz library when a crossing is close to another (thick) line: What's going on?. There are two crossings that are very close together and the clipping circles (when the crossings are drawn) overlap, meaning that when the violet line is drawn over the dashed grey line, it also draws over itself at that problematic crossing.



    Here are a few possible fixes. In the first, I reduce the radius of the clipping circles. In the second, I took the dashed grey line out of the knot as it doesn't seem to be actually part of the knot (note that if you do want to keep it in the knot, you should use the key only when rendering for the dashed part - see the documentation for details). In the third fix, I simplified your hobby path a little.



    Results:



    The various fixes



    Code:



    documentclass[a4paper,11pt]report
    %urlhttps://tex.stackexchange.com/q/478294/86
    usepackageshellesc
    usepackagegraphicx,amssymb,amstext,amsmath
    usepackagetikz
    usetikzlibrary
    decorations.pathreplacing,
    decorations.markings,
    hobby,
    knots,
    celtic,
    shapes.geometric,
    calc,
    external


    tikzexternalize

    begindocument

    tikzset
    knot diagram/every strand/.append style=
    line width=1.5pt,violet
    ,


    tikzset
    my style/.style=
    dashed






    Demonstration of the problem: the clipping circles are big enough that the circle associated with the crossing between the violet line and the dashed grey line overlaps the problematic crossing.

    tikzsetnextfilenameproblem
    begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    background clip/.append style=
    preaction=
    fill=gray,
    fill opacity=.5,

    ,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    %---------------------------------------------------------------

    Fix one: shrink the clipping circles using the verb+clip radius+ key.

    tikzsetnextfilenamefix-one
    begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    clip radius=3pt,
    background clip/.append style=
    preaction=
    fill=gray,
    fill opacity=.5,

    ,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    Fix two: the dashed grey lines don't appear to actually be anything to do with the knot, so draw them separately.
    This means that there aren't two crossings near to each other any more.

    tikzsetnextfilenamefix-two
    begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    draw[
    line width=1.5pt,
    my style,
    lightgray,
    rotate=180
    ] (-0.7,-1.2) -- (-0.7,2.5);
    beginknot[
    consider self intersections=true,
    ignore endpoint intersections=false,
    % flip crossing=6,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    endknot
    path (0,-.7);
    endtikzpicture

    Fix three: you specify a lot of emphnodes in your Hobby path.
    If you aren't wedded to that specific path then reducing the number of nodes can simplify the knot algorithm.

    tikzsetnextfilenamefix-three
    begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.2 with arrow[line width=1.5pt]<,
    mark=at position 0.28 with arrow[line width=1.5pt]<,
    mark=at position 0.8 with arrow[line width=1.5pt]<]
    draw[
    line width=1.5pt,
    my style,
    lightgray,
    rotate=180
    ] (-0.7,-2.2) -- (-0.7,3.5);
    beginknot[
    consider self intersections=true,
    end tolerance=3pt,
    flip crossing=4,
    rotate=180]
    strand ([closed].5,2) [add arrow,violet] .. (-.5,1) .. (.3,-.5) .. (-.3,-.5) .. (.5,1) .. ([tension=3]-1.5,1) .. (.7,-1) .. (-2,1);
    endknot
    path (0,-.7);
    endtikzpicture


    tikzsetnextfilenamelarge-scale
    begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
    markings,
    mark=at position 0.25 with arrow[line width=1.5pt]<,
    mark=at position 0.653 with arrow[line width=1.5pt]<,
    mark=at position 0.75 with arrow[line width=1.5pt]<]
    beginknot[
    consider self intersections=true,
    ignore endpoint intersections=false,
    flip crossing=3,
    rotate=180]
    strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
    strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
    strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
    endknot
    path (0,-.7);
    endtikzpicture

    enddocument





    share|improve this answer



























      0














      The underlying issue here is the same as noted in Unexpected behavior of the "knots" tikz library when a crossing is close to another (thick) line: What's going on?. There are two crossings that are very close together and the clipping circles (when the crossings are drawn) overlap, meaning that when the violet line is drawn over the dashed grey line, it also draws over itself at that problematic crossing.



      Here are a few possible fixes. In the first, I reduce the radius of the clipping circles. In the second, I took the dashed grey line out of the knot as it doesn't seem to be actually part of the knot (note that if you do want to keep it in the knot, you should use the key only when rendering for the dashed part - see the documentation for details). In the third fix, I simplified your hobby path a little.



      Results:



      The various fixes



      Code:



      documentclass[a4paper,11pt]report
      %urlhttps://tex.stackexchange.com/q/478294/86
      usepackageshellesc
      usepackagegraphicx,amssymb,amstext,amsmath
      usepackagetikz
      usetikzlibrary
      decorations.pathreplacing,
      decorations.markings,
      hobby,
      knots,
      celtic,
      shapes.geometric,
      calc,
      external


      tikzexternalize

      begindocument

      tikzset
      knot diagram/every strand/.append style=
      line width=1.5pt,violet
      ,


      tikzset
      my style/.style=
      dashed






      Demonstration of the problem: the clipping circles are big enough that the circle associated with the crossing between the violet line and the dashed grey line overlaps the problematic crossing.

      tikzsetnextfilenameproblem
      begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
      markings,
      mark=at position 0.25 with arrow[line width=1.5pt]<,
      mark=at position 0.653 with arrow[line width=1.5pt]<,
      mark=at position 0.75 with arrow[line width=1.5pt]<]
      beginknot[
      consider self intersections=true,
      ignore endpoint intersections=false,
      flip crossing=3,
      background clip/.append style=
      preaction=
      fill=gray,
      fill opacity=.5,

      ,
      rotate=180]
      strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
      strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
      strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
      endknot
      path (0,-.7);
      endtikzpicture

      %---------------------------------------------------------------

      Fix one: shrink the clipping circles using the verb+clip radius+ key.

      tikzsetnextfilenamefix-one
      begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
      markings,
      mark=at position 0.25 with arrow[line width=1.5pt]<,
      mark=at position 0.653 with arrow[line width=1.5pt]<,
      mark=at position 0.75 with arrow[line width=1.5pt]<]
      beginknot[
      consider self intersections=true,
      ignore endpoint intersections=false,
      flip crossing=3,
      clip radius=3pt,
      background clip/.append style=
      preaction=
      fill=gray,
      fill opacity=.5,

      ,
      rotate=180]
      strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
      strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
      strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
      endknot
      path (0,-.7);
      endtikzpicture

      Fix two: the dashed grey lines don't appear to actually be anything to do with the knot, so draw them separately.
      This means that there aren't two crossings near to each other any more.

      tikzsetnextfilenamefix-two
      begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
      markings,
      mark=at position 0.25 with arrow[line width=1.5pt]<,
      mark=at position 0.653 with arrow[line width=1.5pt]<,
      mark=at position 0.75 with arrow[line width=1.5pt]<]
      draw[
      line width=1.5pt,
      my style,
      lightgray,
      rotate=180
      ] (-0.7,-1.2) -- (-0.7,2.5);
      beginknot[
      consider self intersections=true,
      ignore endpoint intersections=false,
      % flip crossing=6,
      rotate=180]
      strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
      endknot
      path (0,-.7);
      endtikzpicture

      Fix three: you specify a lot of emphnodes in your Hobby path.
      If you aren't wedded to that specific path then reducing the number of nodes can simplify the knot algorithm.

      tikzsetnextfilenamefix-three
      begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
      markings,
      mark=at position 0.2 with arrow[line width=1.5pt]<,
      mark=at position 0.28 with arrow[line width=1.5pt]<,
      mark=at position 0.8 with arrow[line width=1.5pt]<]
      draw[
      line width=1.5pt,
      my style,
      lightgray,
      rotate=180
      ] (-0.7,-2.2) -- (-0.7,3.5);
      beginknot[
      consider self intersections=true,
      end tolerance=3pt,
      flip crossing=4,
      rotate=180]
      strand ([closed].5,2) [add arrow,violet] .. (-.5,1) .. (.3,-.5) .. (-.3,-.5) .. (.5,1) .. ([tension=3]-1.5,1) .. (.7,-1) .. (-2,1);
      endknot
      path (0,-.7);
      endtikzpicture


      tikzsetnextfilenamelarge-scale
      begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
      markings,
      mark=at position 0.25 with arrow[line width=1.5pt]<,
      mark=at position 0.653 with arrow[line width=1.5pt]<,
      mark=at position 0.75 with arrow[line width=1.5pt]<]
      beginknot[
      consider self intersections=true,
      ignore endpoint intersections=false,
      flip crossing=3,
      rotate=180]
      strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
      strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
      strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
      endknot
      path (0,-.7);
      endtikzpicture

      enddocument





      share|improve this answer

























        0












        0








        0







        The underlying issue here is the same as noted in Unexpected behavior of the "knots" tikz library when a crossing is close to another (thick) line: What's going on?. There are two crossings that are very close together and the clipping circles (when the crossings are drawn) overlap, meaning that when the violet line is drawn over the dashed grey line, it also draws over itself at that problematic crossing.



        Here are a few possible fixes. In the first, I reduce the radius of the clipping circles. In the second, I took the dashed grey line out of the knot as it doesn't seem to be actually part of the knot (note that if you do want to keep it in the knot, you should use the key only when rendering for the dashed part - see the documentation for details). In the third fix, I simplified your hobby path a little.



        Results:



        The various fixes



        Code:



        documentclass[a4paper,11pt]report
        %urlhttps://tex.stackexchange.com/q/478294/86
        usepackageshellesc
        usepackagegraphicx,amssymb,amstext,amsmath
        usepackagetikz
        usetikzlibrary
        decorations.pathreplacing,
        decorations.markings,
        hobby,
        knots,
        celtic,
        shapes.geometric,
        calc,
        external


        tikzexternalize

        begindocument

        tikzset
        knot diagram/every strand/.append style=
        line width=1.5pt,violet
        ,


        tikzset
        my style/.style=
        dashed






        Demonstration of the problem: the clipping circles are big enough that the circle associated with the crossing between the violet line and the dashed grey line overlaps the problematic crossing.

        tikzsetnextfilenameproblem
        begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.25 with arrow[line width=1.5pt]<,
        mark=at position 0.653 with arrow[line width=1.5pt]<,
        mark=at position 0.75 with arrow[line width=1.5pt]<]
        beginknot[
        consider self intersections=true,
        ignore endpoint intersections=false,
        flip crossing=3,
        background clip/.append style=
        preaction=
        fill=gray,
        fill opacity=.5,

        ,
        rotate=180]
        strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
        endknot
        path (0,-.7);
        endtikzpicture

        %---------------------------------------------------------------

        Fix one: shrink the clipping circles using the verb+clip radius+ key.

        tikzsetnextfilenamefix-one
        begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.25 with arrow[line width=1.5pt]<,
        mark=at position 0.653 with arrow[line width=1.5pt]<,
        mark=at position 0.75 with arrow[line width=1.5pt]<]
        beginknot[
        consider self intersections=true,
        ignore endpoint intersections=false,
        flip crossing=3,
        clip radius=3pt,
        background clip/.append style=
        preaction=
        fill=gray,
        fill opacity=.5,

        ,
        rotate=180]
        strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
        endknot
        path (0,-.7);
        endtikzpicture

        Fix two: the dashed grey lines don't appear to actually be anything to do with the knot, so draw them separately.
        This means that there aren't two crossings near to each other any more.

        tikzsetnextfilenamefix-two
        begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.25 with arrow[line width=1.5pt]<,
        mark=at position 0.653 with arrow[line width=1.5pt]<,
        mark=at position 0.75 with arrow[line width=1.5pt]<]
        draw[
        line width=1.5pt,
        my style,
        lightgray,
        rotate=180
        ] (-0.7,-1.2) -- (-0.7,2.5);
        beginknot[
        consider self intersections=true,
        ignore endpoint intersections=false,
        % flip crossing=6,
        rotate=180]
        strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
        endknot
        path (0,-.7);
        endtikzpicture

        Fix three: you specify a lot of emphnodes in your Hobby path.
        If you aren't wedded to that specific path then reducing the number of nodes can simplify the knot algorithm.

        tikzsetnextfilenamefix-three
        begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.2 with arrow[line width=1.5pt]<,
        mark=at position 0.28 with arrow[line width=1.5pt]<,
        mark=at position 0.8 with arrow[line width=1.5pt]<]
        draw[
        line width=1.5pt,
        my style,
        lightgray,
        rotate=180
        ] (-0.7,-2.2) -- (-0.7,3.5);
        beginknot[
        consider self intersections=true,
        end tolerance=3pt,
        flip crossing=4,
        rotate=180]
        strand ([closed].5,2) [add arrow,violet] .. (-.5,1) .. (.3,-.5) .. (-.3,-.5) .. (.5,1) .. ([tension=3]-1.5,1) .. (.7,-1) .. (-2,1);
        endknot
        path (0,-.7);
        endtikzpicture


        tikzsetnextfilenamelarge-scale
        begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.25 with arrow[line width=1.5pt]<,
        mark=at position 0.653 with arrow[line width=1.5pt]<,
        mark=at position 0.75 with arrow[line width=1.5pt]<]
        beginknot[
        consider self intersections=true,
        ignore endpoint intersections=false,
        flip crossing=3,
        rotate=180]
        strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
        endknot
        path (0,-.7);
        endtikzpicture

        enddocument





        share|improve this answer













        The underlying issue here is the same as noted in Unexpected behavior of the "knots" tikz library when a crossing is close to another (thick) line: What's going on?. There are two crossings that are very close together and the clipping circles (when the crossings are drawn) overlap, meaning that when the violet line is drawn over the dashed grey line, it also draws over itself at that problematic crossing.



        Here are a few possible fixes. In the first, I reduce the radius of the clipping circles. In the second, I took the dashed grey line out of the knot as it doesn't seem to be actually part of the knot (note that if you do want to keep it in the knot, you should use the key only when rendering for the dashed part - see the documentation for details). In the third fix, I simplified your hobby path a little.



        Results:



        The various fixes



        Code:



        documentclass[a4paper,11pt]report
        %urlhttps://tex.stackexchange.com/q/478294/86
        usepackageshellesc
        usepackagegraphicx,amssymb,amstext,amsmath
        usepackagetikz
        usetikzlibrary
        decorations.pathreplacing,
        decorations.markings,
        hobby,
        knots,
        celtic,
        shapes.geometric,
        calc,
        external


        tikzexternalize

        begindocument

        tikzset
        knot diagram/every strand/.append style=
        line width=1.5pt,violet
        ,


        tikzset
        my style/.style=
        dashed






        Demonstration of the problem: the clipping circles are big enough that the circle associated with the crossing between the violet line and the dashed grey line overlaps the problematic crossing.

        tikzsetnextfilenameproblem
        begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.25 with arrow[line width=1.5pt]<,
        mark=at position 0.653 with arrow[line width=1.5pt]<,
        mark=at position 0.75 with arrow[line width=1.5pt]<]
        beginknot[
        consider self intersections=true,
        ignore endpoint intersections=false,
        flip crossing=3,
        background clip/.append style=
        preaction=
        fill=gray,
        fill opacity=.5,

        ,
        rotate=180]
        strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
        endknot
        path (0,-.7);
        endtikzpicture

        %---------------------------------------------------------------

        Fix one: shrink the clipping circles using the verb+clip radius+ key.

        tikzsetnextfilenamefix-one
        begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.25 with arrow[line width=1.5pt]<,
        mark=at position 0.653 with arrow[line width=1.5pt]<,
        mark=at position 0.75 with arrow[line width=1.5pt]<]
        beginknot[
        consider self intersections=true,
        ignore endpoint intersections=false,
        flip crossing=3,
        clip radius=3pt,
        background clip/.append style=
        preaction=
        fill=gray,
        fill opacity=.5,

        ,
        rotate=180]
        strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
        endknot
        path (0,-.7);
        endtikzpicture

        Fix two: the dashed grey lines don't appear to actually be anything to do with the knot, so draw them separately.
        This means that there aren't two crossings near to each other any more.

        tikzsetnextfilenamefix-two
        begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.25 with arrow[line width=1.5pt]<,
        mark=at position 0.653 with arrow[line width=1.5pt]<,
        mark=at position 0.75 with arrow[line width=1.5pt]<]
        draw[
        line width=1.5pt,
        my style,
        lightgray,
        rotate=180
        ] (-0.7,-1.2) -- (-0.7,2.5);
        beginknot[
        consider self intersections=true,
        ignore endpoint intersections=false,
        % flip crossing=6,
        rotate=180]
        strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
        endknot
        path (0,-.7);
        endtikzpicture

        Fix three: you specify a lot of emphnodes in your Hobby path.
        If you aren't wedded to that specific path then reducing the number of nodes can simplify the knot algorithm.

        tikzsetnextfilenamefix-three
        begintikzpicture[scale=0.9, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.2 with arrow[line width=1.5pt]<,
        mark=at position 0.28 with arrow[line width=1.5pt]<,
        mark=at position 0.8 with arrow[line width=1.5pt]<]
        draw[
        line width=1.5pt,
        my style,
        lightgray,
        rotate=180
        ] (-0.7,-2.2) -- (-0.7,3.5);
        beginknot[
        consider self intersections=true,
        end tolerance=3pt,
        flip crossing=4,
        rotate=180]
        strand ([closed].5,2) [add arrow,violet] .. (-.5,1) .. (.3,-.5) .. (-.3,-.5) .. (.5,1) .. ([tension=3]-1.5,1) .. (.7,-1) .. (-2,1);
        endknot
        path (0,-.7);
        endtikzpicture


        tikzsetnextfilenamelarge-scale
        begintikzpicture[scale=2, use Hobby shortcut, add arrow/.style=postaction=decorate, decoration=
        markings,
        mark=at position 0.25 with arrow[line width=1.5pt]<,
        mark=at position 0.653 with arrow[line width=1.5pt]<,
        mark=at position 0.75 with arrow[line width=1.5pt]<]
        beginknot[
        consider self intersections=true,
        ignore endpoint intersections=false,
        flip crossing=3,
        rotate=180]
        strand ([closed]0,0) .. (0.7,-0.7) .. (0,-1) .. (-1.7,0) .. (-1.5,2.2) .. (0,2.5) .. (.5,2) .. (-.5,1) [add arrow,violet] .. (.5,0) .. (0,-.5) .. (-.5,0) .. (.5,1) .. (-.5,2) .. (-1.5,1) .. (0,0);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-1.2) -- (-0.7,-.9);
        strand[knot diagram/only when rendering/.style=my style, lightgray] (-0.7,-.75) -- (-0.7,2.5);
        endknot
        path (0,-.7);
        endtikzpicture

        enddocument






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 3 hours ago









        Loop SpaceLoop Space

        113k30308610




        113k30308610



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478294%2ftikz-knots-package-crossing-changed-after-scaling%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            acmart: Multiple authors: all with same affiliation, one author an additional affiliationHow to Write Names of Multiple Authors with Shared Affiliation in ACM 2017 Template?Multiple authors with different primary affiliation, but same additional affiliationSame affiliation for all authors without extra packagesIOS-Book-Article.cls: one author with multiple affiliationacmart: Shared Author AffiliationMultiple authors with different primary affiliation, but same additional affiliationAuthor affiliation with only 1 authorAdding Multiple Authors with Different Affiliation in LaTeX ArticleLaTeX: Multiple authors stays on same lineHow to Label Multiple Authors with Same DescriptionHow to make two authors use the same affiliationTwo authors with same affiliation on finished front page

            How to write “ä” and other umlauts and accented letters in bibliography?Accents in BibTeXSorting references with special characters alphabeticallyUse ae ligature in bibliographyEastern European nameInverted circumflex in BibTexBibTex, non-ascii initials and nameptr fproblems with accent in LatexHow to add a Ø to my bibliography from Jabref?References without accentsTroubles when trying to cite St“omer-Verlet in ”title" field of a bib entryComprehensive list of accented charactersHow to type the letter “i” with two dots (diaeresis) in math mode?Problem with glossary text and accented lettersSpecial character in bibliographyAccented letters, Unicode and LaTeX accentsHow to stop natbib from modifying bibliography styleCitation of a paper with non-standard characters by BibtexWrite accented characters to file using writeHow to group the bibliography alphabetically, if some surnames start with “accented” characters?How can I automatically capitalize significant words in my bibliography?

            Problem using RevTeX4-1 with “! Undefined control sequence. @bibitemShut”