I'm trying to use Tikz to draw climbing knots.
I adapted the code from this answer https://tex.stackexchange.com/a/283009/229885 to draw 3D-ish rope using Tikz paths (the basic idea is to superimpose many paths of different widths and colors to get a 3D look). It works great, but there is an issue that is bothering me and I don't know how to solve.
In the picture below you can see two knots. The pink one has been drawn using a single path and the white one has been drawn using two paths. I need to break the paths in order to be able to represent rope-crossings correctly, but when I do so I can see a "seam" where both paths meet.
Here is the code I used to create this picture:
\documentclass[tikz, border=2mm]{standalone}
%%% The "Rope" command %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% \Rope[further options]{color}{width}{path definition} %
% %
\newcommand{\Rope}[4][] %
{ \pgfmathsetmacro{\RopeLevels}{25} %
\foreach \RopeLevel in {1,...,\RopeLevels} %
{ \pgfmathsetmacro{\RopeShade} %
{100 * (\RopeLevel-0.5) / \RopeLevels} %
\pgfmathsetlengthmacro{\RopeWidth} %
{sqrt(pow(#3, 2) - pow(#3 * (\RopeLevel-1) / \RopeLevels, 2))} %
\draw[#2!\RopeShade!black, line width=\RopeWidth, #1] #4; %
} %
} %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{tikzpicture}
\Rope[rounded corners]{pink} {2mm}{ (0.0, 0.0) to (1.0, 1.0) to (0.0, 1.0) to (1.0, 0.0) }
\Rope[rounded corners]{white}{2mm}{ (1.5, 0.0) to (2.5, 1.0) to (2.0, 1.0) }
\Rope[rounded corners]{white}{2mm}{ (2.0, 1.0) to (1.5, 1.0) to (2.5, 0.0) }
\end{tikzpicture}
\end{document}
I tried to define new arrow styles that extend the paths beyond the given coordinates, but the seam is still visible no matter what.
My questions are:
- Is this seam real or an artifact created by my PDF reader? (I'm using Atril 1.24.0 on Xubuntu 20.04.1)
- Is there any way to join Tikz paths seamlessly?
- More in general, is there a better way to draw climbing knots in LaTeX?
Thank you in advance,




\newcommand{\Rope}[4][] { \draw[double=#2, thick, double distance=#3, white, #1] #4; }also creates an artificial "seam" where both paths met. I'm starting to suspect that these artifacts are, indeed, the PDF reader's fault, but I can't believe that there isn't a simple way to avoid them... – Carlos Luna Nov 30 '20 at 15:29