Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am new to tikz. If I have two nodes [A] and [B] as:

[A]

       [B]

How do I align [C] so that it is vertically below [A] and horizontally left of [B] such that:

[A]

[C]    [B]

without resorting to absolute positioning?

share|improve this question

2 Answers 2

up vote 9 down vote accepted
\documentclass[11pt]{scrartcl}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\node (a) at (0,0){[A]};
\node (b) at (5,-4){[B]};  
\node (c) at (a|-b){[C]};
\end{tikzpicture}
\end{document} 
share|improve this answer
    
Thanks that is exactly what I wanted. –  Mobius Pizza Dec 12 '11 at 21:55

You can use relative positioning (§ 3.8; TIKZ & PGF Manual, v. 2.10).

 \documentclass{article}
 \usepackage{tikz}
 \begin{document}
 \begin{figure}
 \centering
 \begin{tikzpicture}[auto]
 \node [draw] (a) {A};
 \node [draw, below of=a] (c) {C};
 \node [draw, right of=c] (b) {B};
 \end{tikzpicture}
 \end{figure}
 \end{document}

enter image description here

share|improve this answer
1  
No, if you need to place C after A and B. And in the question you need to place C after A and B. Another problem with this method appears with scale=.... –  Alain Matthes Dec 12 '11 at 21:50
1  
Not sure why you would need to place C after A and B, and not sure that the question implies that need. (The question does state the preference to avoid absolute positioning, and hence I still prefer my answer :P.) –  badroit Dec 12 '11 at 21:58
    
The question begins with ` If I have two nodes [A] and [B]` Your method is correct in multiple cases like graphs in the tutorials of the pgfmanual, personally I tried to avoid it in the geometric pictures because it' s difficult to scale the result. –  Alain Matthes Dec 12 '11 at 22:37
1  
You could do below right=of... with the positioning library if you set node distance=x<dimen> and y<dimen> to the surrounding scope/tikzpicture. –  morbusg Dec 13 '11 at 16:08

Your Answer

 
discard

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.