I like to draw a double line such that the gap between the two lines is transparent. My purpose is to draw railway tracks:
\documentclass[tikz]{standalone}
\tikzstyle{track}=[
postaction={draw=gray,densely dashed,line width=14pt},
postaction={draw=black,double distance=8pt,line width=2pt},
postaction={draw=gray,densely dashed,line width=8pt},]
\begin{document}
\begin{tikzpicture}
\draw[track] (-5,27) to[out= 0,in=180] ( 5,33)
to[out= 0,in= 90] ( 7,25)
to[out=270,in= 0] (-5,27);
\draw[track] (-4,10) to (0,10) to[out= 0,in=270] (4,16);
\draw[track] (12,10) to (8,10) to[out=180,in=270] (4,16) to (4,20);
\draw[track] (-4,0) to (12,0);
\draw[track] (0,0) to[out= 0,in=270] (3,2)
to[out= 90,in=270] (1,4)
to[out= 90,in=180] (4,6)
to[out= 0,in=120] (8,5)
to[out=300,in= 0] (4,0);
\end{tikzpicture}
\end{document}
The second postaction draws a double line, but the gap between the two lines is not transparent. Therefore, I made the third postaction. But I expect that the tracks will look much more realistic (in particular at the switches) if the gap of the double lines is transparent. Any ideas?




double distance(or simplydouble) draws the path twice---one with the base color, and one with the inbetween color. If you specifydouble=transparent, so that the inbetween color is transparent, you will see that instead of getting a white fill, it is all solid black. If you want a different solution than your own,double distancemight not be the appropriate command. A different approach could be to instead draw two black lines---one shifted to the left and one shifted to the right. – eiterorm Aug 26 '14 at 20:26