I have trouble understanding the tikz inheritance model while using the positioning library.

Consider the following example:


\begin{tikzpicture}[black,node distance=5mm]
  \node[draw] (0) {origin};
  \node[draw,below=of 0,node distance=20mm] {A};
  \node[draw,node distance=20mm,below=of 0] {B};

    \node[draw] {xshifted origin};
    \node[draw,below=of 0,yshift=-30mm] {C};
    \node[draw,yshift=-30mm,below=of 0,xshift=30mm] {D};


which leads to the following result:


And now the questions:

  1. Why does overriding the node distance work in B, but not in A?
  2. Using below seems to override the scope xshift in C, but it seems to be working both, before and after below in D, so this seems to be a different behavior from A / B. Why?

Any ideas are welcome. :)

  • In A, below of 0 comes first and it is executed while in B, it comes when there is already a particular node distance in force. For second, you are using 0 as a reference point and shifts are executed with respect to it.
    – user11232
    Apr 28, 2014 at 23:10

1 Answer 1


The keys are set as they are stumbled upon, so if you set a key that is used by the key that comes after it, it will affect. Otherwise, it will be set but the key that uses it would be already set.

In referring to node names, 0 already exists as a fixed position in canvas. Having a different transformation in effect doesn't change its canvas position unless you go low level canvas transformation which simply goes full speed without checking what is what.

Also, by adding a soft transformation to the scope adds that to all paths but transformations only affects explicit coordinates such as (3,2) not to the refering labels. Quick example

\draw[style=help lines] (-1,-1) grid[step=1] (2,2);
  \coordinate (o);
  \draw[red,thick] (o) -- (1,1);

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .