I'm trying to create a diagram and would like my nodes left aligned using the anchor=west
option. I'd prefer to use relative positioning to make my diagram more flexible to changes. Here's my example:
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[%
every node/.style = {anchor=west}]
\node[fill=red!40, draw] (n0) at (0,0) {Base node} ;
\node[fill=red!40, draw] (n1) at (0,-2) {Node with longer text} ;
\node[fill=red!40, draw] (n2) [below=of n1] {Node with even longer text} ;
\end{tikzpicture}
\end{document}
Notice how the second node uses the anchor=west
style set for every node, but the third node with the longest text seems to be centered below the second vs. being left aligned with it. Is there a way to accomplish what I'm looking for?
Essentially, I want the alignment of the second node without having to specify absolute coordinates.
If you use relative coordinates together with automatic anchor coordinates, the relative coordinates are computed relative to the node's center, not relative to the border point.
If there's a way to do this (like override the setting, or use some automatic math to adjust based on half the width of each node...), I'd still like to know.