I'd like to draw a twisted pair using Tikz. Its shape reminds me to draw a series of sin functions, but i don't sincerly know how to do that (how to draw the cables). The result I'd like to obtain is like this (sorry for the quality, I couldn't do it better)

enter image description here

Thanks in advance to everybody!

1 Answer 1


You can use the knots library.

\begin{tikzpicture}[fat line/.style={black, double=#1,double
    distance=6pt,looseness=1.2,line cap=round}]
\begin{knot}[%draft mode = crossings, % uncomment to see where the crossings are
    clip width = 0,
    flip crossing = 2]
\strand[fat line=gray]
    (0,0) to[out=20,in=180] (2,-1) to[out=0,in=160] (4,0); 
\strand[fat line=white]
    (0,-1) to[out=-20,in=180] (2,0) to[out=0,in=200] (4,-1); 

enter image description here

  • how can i add more lines? I tried editing \strand by adding "to [out=x, in=y] (6,-1)" but I don't know how to set x and y. How can i calculate them?
    – frad
    Mar 16, 2020 at 17:33
  • @frad The arguments of out and in are just angles. So out=20 means that the curve goes out under an angle of 20 degrees.
    – user194703
    Mar 16, 2020 at 17:36
  • yup, I already knew this, but I don't know what values I should write to get a perfect shape. I mean: I edited your code into this "\strand (0,0) to[out=20,in=180] (1,-0.5) to[out=0,in=160] (2,0) to[out=-20,in=140] (3,-0.5);" but the wire is not clean. I'd like to draw several paths like the main one
    – frad
    Mar 16, 2020 at 17:39
  • @frad I can only answer this if I now how the result should look like. Some basic methods of drawing smooth curves are collected e.g. here. You may want to use the hobby library by LoopSpace, the same author as knots. Maybe this answer helps you to achieve what you want.
    – user194703
    Mar 16, 2020 at 18:01
  • 1
    @frad Your link does not show an image (for me), probably your browser has a setting that remembers a choice which my browser does not know. Also I feel that this is a separate question. You could plot a function and so on.
    – user194703
    Mar 16, 2020 at 18:08

You must log in to answer this question.

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