I am very new to Tikz and am trying to draw a diagram with 5 nodes. My code is as follows:
\usepackage{tikz}
\usetikzlibrary{automata, arrows, positioning}
\begin{document}
\begin{center}
\begin{tikzpicture}
\tikzset{node distance = 3 cm, every state/.style = {semithick}, every edge/.style = {draw, ->, > = stealth', semithick}}
\node[state] (2) {2};
\node[state, right = of 2] (3) {3};
\node[state, below right = of 2] (1) {1};
\node[state, below left = of 1] (4) {4};
\node[state, below right = of 1] (5) {5};
\end{tikzpicture}
\end{center}
\end{document}
The problem here is that I would like node 1 to be exactly below and in the middle nodes 2 and 3, so I am trying to code something like \node[state, below right = of 2 and below left = of 3] (1) {1}
. However, this does not work.
How can I amend my code to achieve this?
Best Answer
using
calc
library define a point between3
and2
calleda