diff options
Diffstat (limited to 'graphics/pgf/base/doc/text-en/pgfmanual-en-library-petri.tex')
-rw-r--r-- | graphics/pgf/base/doc/text-en/pgfmanual-en-library-petri.tex | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/graphics/pgf/base/doc/text-en/pgfmanual-en-library-petri.tex b/graphics/pgf/base/doc/text-en/pgfmanual-en-library-petri.tex index ccf0356091..1146624d65 100644 --- a/graphics/pgf/base/doc/text-en/pgfmanual-en-library-petri.tex +++ b/graphics/pgf/base/doc/text-en/pgfmanual-en-library-petri.tex @@ -26,7 +26,7 @@ The package defines a style for drawing places of Petri nets. its capacity. You should use the |tokens| options, explained in Section~\ref{section-tokens}, to add tokens inside the place. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri,positioning}}] \begin{tikzpicture} \node[place,label=above:$p_1$,tokens=2] (p1) {}; \node[place,label=below:$p_2\ge1$,right=of p1] (p2) {}; @@ -37,7 +37,7 @@ The package defines a style for drawing places of Petri nets. This style is evoked by the style |place|. To change the appearance of places, you can change this style. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri,positioning}}] \begin{tikzpicture} [every place/.style={draw=blue,fill=blue!20,thick,minimum size=9mm}] \node[place,tokens=7,label=above:$p_1$] (p1) {}; @@ -61,7 +61,7 @@ Transitions are also nodes. They should be drawn using the following style: To connect a transition to places, you can use the |edge| command as in the following example: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri,positioning}}] \begin{tikzpicture} \node[place,tokens=2,label=above:$p_1$] (p1) {}; \node[place,label=above:$p_2\ge1$,right=of p1] (p2) {}; @@ -112,7 +112,7 @@ style for typesetting them. be typeset in a tiny font and in white on black (naturally, you can easily change this by setting the style |every token|). % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri,positioning}}] \begin{tikzpicture} \node[place,label=above:$p_1$] (p1) {}; \node[token] at (p1) {}; @@ -131,8 +131,8 @@ In the above example, it is bothersome that we need an extra command for the token node. Worse, when we have \emph{two} tokens on a node, it is difficult to place both nodes inside the node without overlap. -The Petri net library offers a solution to this problem: The -|children are tokens| style. +The Petri library offers a solution to this problem: The |children are tokens| +style. \begin{stylekey}{/tikz/children are tokens} The idea behind this style is to use trees mechanism for placing tokens. @@ -143,7 +143,7 @@ The Petri net library offers a solution to this problem: The the children next to each other inside (or, rather, on top) of the place node. Additionally, the edge from the parent node is not drawn. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri}}] \begin{tikzpicture} \node[place,label=above:$p_1$] {} [children are tokens] @@ -166,7 +166,7 @@ The Petri net library offers a solution to this problem: The place more than nice tokens on a place, you will have to write your own placement code. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri}}] \begin{tikzpicture} \node[place,label=above:$p_2$] {} [children are tokens] @@ -181,7 +181,7 @@ The Petri net library offers a solution to this problem: The This specifies the distance between the centers of the tokens in the arrangements of the option |children are tokens|. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri}}] \begin{tikzpicture} \node[place,label=above:$p_3$] {} [children are tokens,token distance=1.1ex] @@ -206,7 +206,7 @@ tokens. having the style |token|. Thus, the following two pieces of codes have the same effect: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri}}] \tikz \node[place] {} [children are tokens] @@ -221,7 +221,7 @@ tokens. option does not handle ten or more tokens correctly. If you need this many tokens, you will have to program your own code. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri}}] \begin{tikzpicture}[every place/.style={minimum size=9mm}] \foreach \x/\y/\tokennumber in {0/2/1,1/2/2,2/2/3, @@ -238,7 +238,7 @@ tokens. gets a list of colors as parameter. It will then add as many tokens to the place as there are colors in this list, each filled correspondingly. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri}}] \tikz \node[place,colored tokens={black,black,red,blue}] {}; \end{codeexample} % @@ -248,11 +248,11 @@ tokens. This option, which must again be passed to a place, gets a list of texts for tokens. For each text, a new token will be added to the place. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri}}] \tikz \node[place,structured tokens={$x$,$y$,$z$}] {}; \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri}}] \begin{tikzpicture}[every place/.style={minimum size=9mm}] \foreach \x/\y/\tokennumber in {0/2/1,1/2/2,2/2/3, @@ -269,7 +269,7 @@ tokens. \subsection{Examples} -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{petri}}] \begin{tikzpicture}[yscale=-1.6,xscale=1.5,thick, every transition/.style={draw=red,fill=red!20,minimum size=3mm}, every place/.style={draw=blue,fill=blue!20,minimum size=6mm}] |