[Tex/LaTex] Two problems with double lines in TikZ

tikz-pgf

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}

pdf output as png image

(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.

Best Answer

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).

output of code

\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)$)
      % arrow head
      ($($(\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}
Related Question