I would like to find out why TikZ doesn't behave like I would expect. I made small example:

\node[dot_label_se={$y_3$}, below=1.5cm of point_y2] (point_y3) {};
\node[dot_label_se={$z_3$}, below right=1.5cm and 2cm of point_y2] (point_z3) {};
\node[dot_label_se={$v_3$}, below=3cm of point_v1] (point_v3) {};


The problem is with points z3 and v3. First of all look at z3 positioning it is the same as y3 but shifted right by 2cm, so why height is slightly different?

In case of v3 I tried to put it relative to v1 by 3cm (2 x 1,5cm) and result is different than having v2 1.5cm below v1 and then v3 1.5cm below v2. Isn't node positioning relative to node center?

Edit: (full working example - just points)

\usepackage{arevtext, arevmath}


dot_label_se/.style={circle, inner sep=2pt, fill, label={[text depth=0pt,    text height=0.5ex, xshift=-0.07cm]-35:#1}, name=#1},
dot_label_sw/.style={circle, inner sep=2pt, fill, label={[text depth=0pt, text height=0.5ex, xshift=0.14cm]215:#1}, name=#1},


\node[dot_label_se={$y_1$}, left=1cm] (point_y1) {};
\node[dot_label_se={$z_1$}, right=1cm] (point_z1) {};
\node[dot_label_se={$x_1$}, left=2cm of point_y1] (point_x1) {};
\node[dot_label_sw={$v_1$}, right=2cm of point_z1] (point_v1) {};

\node[dot_label_se={$x_2$}, below=1.5cm of point_x1] (point_x2) {};
\node[dot_label_sw={$y_2$}, below=1.5cm of point_y1] (point_y2) {};

\node[dot_label_se={$x_3$}, below=1.5cm of point_x2] (point_x3) {};
\node[dot_label_se={$y_3$}, below=1.5cm of point_y2] (point_y3) {};
\node[dot_label_se={$z_3$}, below right=1.5cm and 2cm of point_y2] (point_z3) {};
\node[dot_label_se={$v_3$}, below=3cm of point_v1] (point_v3) {};

  • 3
    Welcome to TeX.SX! Please make your code compilable (if possible) in the form of a minimal working example (MWE), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – Dai Bowen
    Feb 12, 2017 at 13:55
  • 1
    for positioning of node z_3 you should consider nodes side. If you will provide minimal working example as ask you Dai Bowen in comment above, I will show you how to simply do this. Help us to help you!
    – Zarko
    Feb 12, 2017 at 14:02

3 Answers 3


EDIT: As I mentioned in my comment, the problem is considering node size in determining of distances between nodes. It seems that the best solution is add option on grid and use your MWE as is.

However, I took liberty and rewrite your MWE. See if the my MWE is acceptable to you:


    \begin{tikzpicture}[on grid,
    node distance = 15mm and 15mm,
  dot/.style args = {#1/#2}{circle, fill=black, 
                            inner sep=0pt, outer sep=0pt, minimum size=5pt,
                            label={[node distance=2pt, inner sep=1pt]#1:{#2}},
                            node contents={}},
       DL/.style = {postaction={decorate},
                    decoration = {markings,
                                  mark=at position 0.6 with {\arrow{Stealth[length=3mm]}}
\node (n11) [dot=-45/$x_1$];
\node (n12) [dot=-45/$y_1$,right=of n11];
\node (n13) [dot=-45/$z_1$,right=of n12];
\node (n14) [dot=-45/$v_1$,right=of n13];
    \foreach \i [count=\j from 1] in {2,3,4}{\draw[DL] (n1\j) -- (n1\i);}
\node (n21) [dot=-45/$x_2$,below=of n11];
\node (n22) [dot=225/$y_2$,right=of n21];
    \draw[DL] (n21) -- (n22);
\node (n31) [dot=-45/$x_3$,below=of n21];
\node (n32) [dot=-45/$y_3$,below=of n22];
\node (n33) [dot=-45/$z_3$,below=30mm of n13];
\node (n34) [dot=-45/$v_3$,below=30mm of n14];
    \foreach \i [count=\j from 1] in {2,3,4}{\draw[DL] (n3\j) -- (n3\i);}
    \draw[DL] (n22) -- (n33);

Note: in positioning of nodes is used syntax determined in TikZ library positioning. Used in your MWE is deprecated.

enter image description here

  • 1
    +1 for on grid. But i think, you should point out that this is the best option. All other answers including yours redefine something. All you need is to specify on grid at the beginning of the picture and you're done. Bam. Beautiful.
    – pschulz
    Feb 12, 2017 at 15:27
  • @pschulz, I will add your suggestion.
    – Zarko
    Feb 12, 2017 at 15:35

You're assuming your nodes to behave like points, but in reality they are assigned a width and a height. When using relative positioning, your calculations are thus slightly off.

Try aligning them on an edge — for example, on the left side — and using relative positioning from there. Reconstructed from your example (which is not an MWE, otherwise a more comprehensive answer would be possible), it would probably look like this:

\node[dot_label_se={$x_1$}] (point_x1) {};
\node[dot_label_se={$y_1$}, right=2cm of point_x1] (point_y1) {};
\node[dot_label_se={$z_1$}, right=2cm of point_y1] (point_z1) {};
\node[dot_label_se={$x_2$}, below=1.5cm of point_x1] (point_x2) {};
\node[dot_label_se={$y_2$}, right=2cm of point_x2] (point_y2) {};
\node[dot_label_se={$x_3$}, below=1.5cm of point_x2] (point_x3) {};
\node[dot_label_se={$y_3$}, right=2cm of point_x1] (point_y3) {};
\node[dot_label_se={$z_3$}, right=2cm of point_y3] (point_z3) {};

By expanding only in one direction, you're minimizing the possibility of problems arising. If you still have problems aligning them, you can add a key definining the minimum width for all nodes to the same, high enough value.


To avoid taking the node shapes into account when positioning other nodes, consider adding .center to node names and anchor=center. For example:

\node[dot_label_se={$y_3$}, below=1.5cm of point_y2.center,anchor=center] (point_y3) {};
\node[dot_label_se={$z_3$}, below right=1.5cm and 2cm of point_y2.center,anchor=center] (point_z3) {};
\node[dot_label_se={$v_3$}, below=3cm of point_v1.center,anchor=center] (point_v3) {};

Consider the following example:


\begin{tikzpicture}[bul/.style = {fill,circle,inner sep=3pt}]
\node [bul](1) {};
\node [bul,below=1.5 of 1](2) {};
\node [bul,below=1.5 of 2](3) {};
\node [bul,right=2 of 1](4) {};
\node [bul,below right=1.5 and 2 of 2](5) {};
\draw (4)--(1)--(2)--(3)--(5);


enter image description here

And now this:

\begin{tikzpicture}[bul/.style = {fill,circle,inner sep=3pt}]
\node [bul](1) {};
\node [bul,below=1.5 of 1.center,anchor=center](2) {};
\node [bul,below=1.5 of 2.center,anchor=center](3) {};
\node [bul,right=2 of 1.center,anchor=center](4) {};
\node [bul,below right=1.5 and 2 of 2.center,anchor=center](5) {};
\draw (4)--(1)--(2)--(3)--(5);

enter image description here

You must log in to answer this question.

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