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.

A rather high node has a not so high node on its rigth side.

I like the positioning and sizes, but i want both node to share the same Y-Axis of their north border.

\tikzstyle{big}  =[rectangle, draw=blue, text centered, minimum height=60]
\tikzstyle{small}=[rectangle, draw=black, text centered, minimum width=60]

\begin{tikzpicture}

\node[big]   (l) {Left  High};
\node[small] (r) [right of = l, anchor = west] {Rigth  Low};

\end{tikzpicture}

Here is a brute force example where only the Y-Axis alignes the way i would like it.

\node[big]   (l) at (0,0) [anchor = north] {Left High};
\node[small] (r) at (3,0) [anchor = north] {Right Low};

My goal is to still use the [right of = l] notation and also use reference l.north somehow to set r.north = l.north.

share|improve this question
    
right of will position the node at a certain node distance from the other, by default using both the coordinate of their center; if you add anchor, you tell Tikz to refer to this coordinate to position the shape. Did you try \node[right of=l.north,anchor=north]? –  Lionel MANSUY Feb 4 '13 at 12:50
add comment

1 Answer

up vote 5 down vote accepted

It's probably because you are using the positioning syntax with explicit at (coord) so that explicit coordinate wins over the positioning directive. Here are two examples

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[
big/.style={rectangle, draw=blue, text centered, minimum height=60},
small/.style={rectangle, draw=black, text centered, minimum width=60}
]

\node[big] (l) at (0,0) {Left High};
\node[small,right= 3 cm of {l.north},anchor=north] (r) {Right Low};
\node[big,anchor=north west] (r2) at (r.north east) {righter};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
add comment

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.