I'd like to have two boxes with text inside them atop one another with some vertical space, and with two parallel vertical edges linking them. With just one such linking edge, tikz makes it easy: \draw (node1) -- (node2);
(where node1 and node2 specify the two boxes with text). There's got to be a bit of separation between them; however, I've tried using things like (node1) +(5pt,0) -- (node2) +(5pt,0)
and frankly it isn't working. I've tried scoping with shift={(5pt,0),transform shape} and the shift was ignored. So, how should I do this? (FYI: there's addtional options on the edges specifying labels and arrows, but I don't believe that they're relevant to this).
Example of single link:
\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[yscale=-1]
\node at (0,0) (node1) [shape=rectangle,fill=green] {box1};
\node at (0,1) (node2) [shape=rectangle,fill=green] {box2};
\draw (node1) -- (node2);
\end{tikzpicture}
\end{document}
An ascii version…
. +----+
. |box1|
. +----+
. | |
. 1 v ^ 3
. | |
. +----+
. |box2|
. +----+
(pls ignore the "."s, I needed them to get the code entry to work)
Thank you for your solutions! I'll definitely be trying them out.
Best Answer
If I understand the problem correctly, you may want to use the
double
anddouble distance
keys.As described in subsubsection 15.3.5 of the
tikz
documentation, using thedouble
key in a\draw
command produces a double line. You can also fine-tune the distance between the two lines with thedouble distance
key; using the latter automatically enablesdouble
, as pointed out in Claudio's comment. See below.Edit: if you need different decorations, labels etc. for the two lines, you need to construct two distinct paths; see below. To draw an arrowhead at the middle of an path, I refer you to Alain Matthes's answer to Tikz: Arrowheads in the center.