# Two problems with double lines in TikZ

Using TikZ for a few weeks now, I am still overwhelmed by the richness of features and by the perfection of the output. Yet I have two problems related to double lines, cf. source code and image supplied:

\documentclass[tikz, border = 2mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\tikzset{myarrow/.style={
arrows={-Implies},
double,
double distance = 0.3cm
}}
\begin{tikzpicture}
\fill [orange!30] (2,0) rectangle (6,4);
\draw [orange] (0,0) rectangle (6,4);
\draw[myarrow] (1,1) -- (5,3);
\draw[myarrow] (4,1) -- (1,3);
\end{tikzpicture}
\end{document}


(1) The output of a double line is in fact a rectangle with two - obviously undesirable - very thin black or gray lines. This is probably due to numerical instability.

(2) The white area between the double lines covers everything behind it. So there is no way for two double lines to intersect, such that all the black lines stay completely visible.

Curiously enough, this behaviour is visible in numerous examples througout the web, but no one seems to care or to even mention this.

Is there a way to draw "Implies" arrows just by an "Implies" arrow head and two straight lines with nothing in between? This would (1) be numerically stable and (2) behave like ink on paper as regards intersection.

• See the explanations for /tikz/double in the pgfmanual. The path of a double line are drawn twice: first with a big line width and the border color (black) and then with a smaller line width and the filling color (white). – esdd Dec 14 '17 at 12:40
• There are number of question about this here. Instead of the double option I would use the shapes.arrows library or tex.stackexchange.com/a/72793/2388 – Ulrike Fischer Dec 14 '17 at 14:16

A possible different approach might be to use a custom to path. The implementation below is very inflexible, relying on hard coded values. As such, this probably isn't a very good solution, though it might be of interest.

All coordinates are found using the syntax of the calc library, described in section 13.5 Coordinate Calculations of the TikZ manual (for version 3.0.1a).

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[
Double/.style={
to path={
% left leg
($(\tikztostart)!2pt!90:($(\tikztotarget)!5pt!(\tikztostart)$)$) -- ($($(\tikztotarget)!3.5pt!(\tikztostart)$)!2pt!270:(\tikztostart)$)
% right leg
($(\tikztostart)!2pt!270:($(\tikztotarget)!4pt!(\tikztostart)$)$) -- ($($(\tikztotarget)!3.5pt!(\tikztostart)$)!2pt!90:(\tikztostart)$)
($($(\tikztotarget)!5pt!(\tikztostart)$)!4pt!90:(\tikztostart)$)
.. controls
($($(\tikztotarget)!3pt!(\tikztostart)$)!0.5pt!90:(\tikztostart)$) and
($(\tikztotarget)!1pt!(\tikztostart)$)
.. (\tikztotarget)
.. controls
($(\tikztotarget)!0.5pt!(\tikztostart)$) and
($($(\tikztotarget)!3pt!(\tikztostart)$)!1pt!270:(\tikztostart)$)
..
($($(\tikztotarget)!5pt!(\tikztostart)$)!4pt!270:(\tikztostart)$)
}
}
]

\fill [blue!10] (-1,-1) rectangle (2,2);
\draw [help lines] (-1,-1) grid (2,2);
\draw (0,0) to[Double] (1,1);
\draw (1,0) to[Double] (0,1);
\draw (0.5,1) to[Double] (0.5,0);
\draw (0,0.5) to[Double] (1,0.5);
\end{tikzpicture}
\end{document}

• Thank you very much! This shows how to define a double-lined arrow from scratch. I can easily adjust the hard-coded values for my needs, i.e. a diagram with a dozen single-lined and double-lined arrows with lots of intersections. – Helmut Kastenholz Dec 15 '17 at 22:13