I have two unaligned nodes
|AAAAAAA|
|B|
and I want to have the node with the B aligned to the left of the node with AAAs and below it
|AAAAAAA|
|B|
How can this be done?
I have two unaligned nodes
|AAAAAAA|
|B|
and I want to have the node with the B aligned to the left of the node with AAAs and below it
|AAAAAAA|
|B|
How can this be done?
You can position "B" below and left of "AAA" without having to know the position of it using the positioning library:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node [draw] (A) at (4,5) {AAAA};
\node [draw,below=of A.west,anchor=west] (B) {B};
\end{tikzpicture}
\end{document}
Gives:

of, e.g. below=2cm of A.
– Martin Scharrer
Mar 16 '11 at 22:29
\begin{tikzpicture}[node distance=5mm] \node[draw, anchor=west] (1) {AAAAAAAA}; \node[draw, below=of 1.south west, anchor=north west] (2) {B}; \end{tikzpicture}
we can left align the two nodes and have a precise distance of 5mm between them. Thanks a lot. @MichaelUmmels
– Mário Mar 17 '11 at 09:49below=of A.west, anchor=west (which is what Martin has written) not anchor=west, below=of A.west (which looks just as good, but seems not to work).
– John Wickerson
Mar 13 '15 at 15:22
anchor=west after below instruction works, but not the other way around? (Just like John pointed out in the comment above)
– Andriy Drozdyuk
Nov 19 '16 at 18:03
Use anchor=west for both nodes. For example:
\begin{tikzpicture}
\node[anchor=west] (1) at (0,1) {AAAAAAAA};
\node[anchor=west] (2) at (0,0) {B};
\end{tikzpicture}
node distance) is more flexible.
– Michael Ummels
Mar 17 '11 at 10:14