I need for petri nets some special edges for arcs:
- Reset arc
- which has an cross at Place
- Transfer arc
- which has an dashed edge from place to place and an snaked edge from transition to dashed edge.
This is what I have so far:
\documentclass{article}
\def\xcolorversion{2.00}
\def\xkeyvalversion{1.8}
% allows drawing of petri nets
\usepackage[version=0.96]{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing, decorations.markings,shapes,snakes,automata,backgrounds,petri}
% Petri net definition for tikz
\tikzstyle{place}=[circle,thick,draw=blue!75,fill=blue!20,minimum size=6mm]
\tikzstyle{transition}=[rectangle,thick,draw=black!75,
fill=black!20,minimum size=4mm]
\tikzstyle{every label}=[red]
\pgfarrowsdeclare{x}{x}
{
\arrowsize=0.2pt
\advance\arrowsize by .5\pgflinewidth
\pgfarrowsleftextend{-4\arrowsize-.5\pgflinewidth}
\pgfarrowsrightextend{.5\pgflinewidth}
}
{
\arrowsize=0.2pt
\advance\arrowsize by .5\pgflinewidth
\pgfsetdash{}{0pt} % do not dash
\pgfsetroundjoin
% fix join
\pgfsetroundcap
% fix cap
\pgfpathmoveto{\pgfpoint{-6\arrowsize}{6\arrowsize}}
\pgfpatharc{180}{270}{6\arrowsize}
\pgfusepathqstroke
\pgfpathmoveto{\pgfpointorigin}
\pgfpatharc{90}{180}{6\arrowsize}
\pgfusepathqstroke
\pgfpathmoveto{\pgfpoint{6\arrowsize}{-6\arrowsize}}
\pgfpatharc{180}{270}{-6\arrowsize}
\pgfusepathqstroke
\pgfpathmoveto{\pgfpointorigin}
\pgfpatharc{90}{180}{-6\arrowsize}
\pgfusepathqstroke
}
\tikzstyle{normal}=[->]
\tikzstyle{read}=[-]
\tikzstyle{reset}=[-*]
\tikzstyle{inhibitor}=[-o]
\tikzstyle{transfer}=[-x]
\usepackage[latin1]{inputenc}
\begin{document}
\begin{tikzpicture}[node distance=1.3cm,>=stealth',bend angle=45,auto]
\begin{scope}[xshift=10cm]
\node [place,tokens=1]
(p1') [label=right:$p_1$] {};
\node [place,tokens=1]
(p2') [below of=p1', label=left:$p_2$] {};
\node [transition] (t1') [right of=p1'] {}
edge [pre, inhibitor, bend left] (p1')
edge [post, bend left] (p2')
edge [post, reset, bend right] node[swap] {3} (p1');
\node [transition] (t2') [left of=p2'] {}
edge [pre, normal, bend left] node [auto] {2} (p2')
edge [post, read, bend right] (p2')
edge [post, transfer, bend left, snake=snake] node [auto] {2} (p1');
\end{scope}
\end{tikzpicture}
\end{document}
I'm very new to Latex and tikz. Hope someone can help me.
Regards.
Best Answer
For question 1, you can use
markings
:And for second, you have to declare a coordinate in the middle:
And then use that coordinate (d) as in
And the styles will be:
Full code: