A while ago, I have stumbled upon a very nice solution for parallel paths drawn with TikZ, which can be found here: Draw additional parallel paths in TikZ.
However, when trying to use this for my purposes - namely in combination with the shorten >=
and shorten <=
options - I discovered that this solution doesn't quite behave as expected. Here is an MWE:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{positioning}
\def\pgfdecoratedcontourdistance{0pt}
\pgfkeys{/pgf/decoration/contour distance/.code={%
\pgfmathparse{#1}%
\let\pgfdecoratedcontourdistance=\pgfmathresult}%
}
\pgfdeclaredecoration{contour lineto}{start}
{
\state{start}[next state=draw, width=0pt]{
\pgfpathmoveto{\pgfpoint{0pt}{\pgfdecoratedcontourdistance}}%
}
\state{draw}[next state=draw, width=\pgfdecoratedinputsegmentlength]{
\pgfmathparse{-\pgfdecoratedcontourdistance*cot(-\pgfdecoratedangletonextinputsegment/2+90)}%
\let\shorten=\pgfmathresult%
\pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentlength+\shorten}{\pgfdecoratedcontourdistance}}%
}
\state{final}{
\pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentlength}{\pgfdecoratedcontourdistance}}%
}
}
\begin{document}
\tikzset{
box/.style={draw=black, fill=blue!20, inner sep=1em},
arrow/.style={->,draw=black, shorten >=1mm,shorten <=1mm},
quintuple/.style={
postaction={decoration={contour lineto, contour distance=-4pt},draw=black, decorate},
postaction={decoration={contour lineto, contour distance=-2pt},draw=black, decorate},
postaction={decoration={contour lineto, contour distance=+2pt},draw=black, decorate},
postaction={decoration={contour lineto, contour distance=+4pt},draw=black, decorate},
},
}
\begin{tikzpicture}
\node[box] (box1) {Box 1};
\node[box,above right=of box1] (box2) {Box 2};
\draw[arrow,quintuple] (box1) |- (box2);
\end{tikzpicture}
\end{document}
The picture this produces looks like this:
The arrow ends are all screwed up, and I can't figure out why this happens. Can anybody provide a solution that has nice arrow ends (or at least explain what's happening here)?
\tikzset{}
goes in the preamble. (before\begin{document}
).\usetikzlibrary{}
that is important.\tikzset
is just key setter and can set anywhere.