18

Is it possible to align node c vertical to node a and horizontal to node b. If I combine the "below=of" and "right=of" parameter, Tikz ignores the first one.

\begin{tikzpicture}
  \node[draw, circle, xshift=2cm](a){A};
  \node[draw, circle, minimum width=2cm, yshift=-2cm](b){B};
  \node[draw, below=of a, right=of b](c){C};
\end{tikzpicture}
2
  • 2
    You can use \node[draw](c) at (a|- b){C}; instead.
    – percusse
    Feb 11, 2013 at 12:22
  • @percusse Let me return the favour: perhaps you could convert your comment to an answer. Mar 11, 2013 at 18:26

1 Answer 1

16

You can use the orthogonal identifiers |- and -| for intersections of different coordinates. A quick reading hint is go vertical | and then horizontal - or vice versa.

\begin{tikzpicture}
  \node[draw, circle, xshift=2cm](a){A};
  \node[draw, circle, minimum width=2cm, yshift=-2cm](b){B};
  \node[draw](c) at (a|- b){C};
\end{tikzpicture}

enter image description here

1
  • Thanks! It can also be helpful to assign an anchor, like \node[anchor=south] (c) at (a -| b.south) {C}; to get control over further specifics of positioning relative to the existing nodes. Oct 26, 2016 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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