TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following code attempts to absolutely position two nodes with rectangular outlines, then draw a line that goes from the right-hand side of one to the left-hand side of the other, along orthogonal lines with the vertical segment lying directly between the two nodes. But instead of getting that result, this happens:

alt text

I can't get the hang of how LaTeX and TikZ length commands work. How can I fix what I've got here?





[yscale = -1]

\begin{scope} % Boxes
[ every node/.style = { draw,
                        inner sep = 3mm,
    \node (a) at (0,20mm) {Apple};
    \node (b) at (28mm,0) {Banana};

\begin{scope} % Arrows
[->, > = angle 90, very thick]
    \setlength{\mylengthC}{\mylengthA/2 + \mylengthB/2}
    \draw (\mylengthA,20mm) -- (\mylengthC,20mm) |- (\mylengthB,0);


share|improve this question
up vote 5 down vote accepted

This works:

% mark the midpoint between nodes a and b
\path (a.east) -- (b.west) node[coordinate,midway] (c) {};
% Arrows
\draw[->,>=angle 90, very thick] (a.east) -| (c) |- (b.west);

You almost never have to use \pgfextracts. Instead, use named coordinate nodes and transformations.

share|improve this answer
Works great, thanks. – Hammerite Oct 11 '10 at 9:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.