I am newbie in Tikz,
After reading this question Transitions in Petri nets
I want to create this
And this is my code, you can access with this link https://www.writelatex.com/read/bxwwcmmghpmw
\documentclass{article}
\usepackage[version=0.96]{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,automata,petri}
\tikzset{
place/.style={
circle,
thick,
draw=blue!75,
fill=blue!20,
minimum size=6mm,
},
transitionH/.style={
rectangle,
thick,
fill=black,
minimum width=8mm,
inner ysep=2pt
},
transitionV/.style={
rectangle,
thick,
fill=black,
minimum height=8mm,
inner xsep=2pt
}
}
\begin{document}
\begin{tikzpicture}[node distance=1.3cm,>=stealth',bend angle=45,auto]
\node [place,label=above:$P_1$] (p1) {};
\node [transitionV,label=above:$T_1$] (t1) [right of=p1] {}
edge[pre] (p1);
\node [place,tokens=1,label=above:$P_2$] (p2) [right of=t1] {}
edge[pre] (t1);
\node [place,tokens=2,label=above:$P_3$] (p3) [below of=p2] {}
edge[pre] (t1);
\node [transitionV,label=above:$T_2$] (t2) [right of=p3] {}
edge[pre] (p2)
edge[pre] (p3)
edge[post, bend left] (p1);
\node [place,tokens=1, label=above:$P_4$] (p4) [right of=t2] {}
edge[pre] (t2);
\end{tikzpicture}
\end{document}
I am not quite happy with the edge from T2 –> P1, and I want them center in vertical.
Thank you very much for your help.
Best Answer
Perhaps something like this:
The main changes were the switch from the obsolete
of=
syntax toof=
(with thepositioning
library for relative positioning, and the use ofout=<angle>
,in=<angle>
, together withlooseness
, for the edge (adjust the settings to your liking).Another option, using this time a
to
path instead ofedge
: