From 22536bb2b5257046d271b1eaa11b4a275d5ec041 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 5 Jan 2019 22:40:38 +0000 Subject: pgf (5jan19) git-svn-id: svn://tug.org/texlive/trunk@49607 c570f23f-e606-0410-a88d-b1316a301751 --- .../pgf/text-en/pgfmanual-en-library-petri.tex | 267 +++++++++++---------- 1 file changed, 137 insertions(+), 130 deletions(-) (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-petri.tex') diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-petri.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-petri.tex index 9807c3542d3..ccf03560917 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-petri.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-petri.tex @@ -11,23 +11,21 @@ \section{Petri-Net Drawing Library} \begin{tikzlibrary}{petri} - This packages provides shapes and styles for drawing Petri nets. + This packages provides shapes and styles for drawing Petri nets. \end{tikzlibrary} - \subsection{Places} The package defines a style for drawing places of Petri nets. \begin{stylekey}{/tikz/place} - This style indicates that a node is a place of a Petri net. Usually, - the text of the node should be empty since places do not contain any - text. You should use the |label| option to add text outside the node - like its name or its capacity. You should use the |tokens| options, - explained in Section~\ref{section-tokens}, to add tokens inside the - place. - + This style indicates that a node is a place of a Petri net. Usually, the + text of the node should be empty since places do not contain any text. You + should use the |label| option to add text outside the node like its name or + its capacity. You should use the |tokens| options, explained in + Section~\ref{section-tokens}, to add tokens inside the place. + % \begin{codeexample}[] \begin{tikzpicture} \node[place,label=above:$p_1$,tokens=2] (p1) {}; @@ -35,9 +33,10 @@ The package defines a style for drawing places of Petri nets. \end{tikzpicture} \end{codeexample} - \begin{stylekey}{/tikz/every place} - This style is evoked by the style |place|. To change the - appearance of places, you can change this style. + \begin{stylekey}{/tikz/every place} + This style is evoked by the style |place|. To change the appearance of + places, you can change this style. + % \begin{codeexample}[] \begin{tikzpicture} [every place/.style={draw=blue,fill=blue!20,thick,minimum size=9mm}] @@ -46,25 +45,22 @@ The package defines a style for drawing places of Petri nets. label=below:$p_2\ge1$,right=of p1] (p2) {}; \end{tikzpicture} \end{codeexample} - \end{stylekey} + \end{stylekey} \end{stylekey} - - \subsection{Transitions} -Transitions are also nodes. They should be drawn using the following -style: +Transitions are also nodes. They should be drawn using the following style: \begin{stylekey}{/tikz/transition} - This style indicates that a node is a transition. As for places, the - text of a transition should be empty and the |label| option should - be used for adding labels. - - To connect a transition to places, you can use the |edge| command as - in the following example: + This style indicates that a node is a transition. As for places, the text + of a transition should be empty and the |label| option should be used for + adding labels. + To connect a transition to places, you can use the |edge| command as in the + following example: + % \begin{codeexample}[] \begin{tikzpicture} \node[place,tokens=2,label=above:$p_1$] (p1) {}; @@ -76,47 +72,46 @@ style: \end{tikzpicture} \end{codeexample} - \begin{stylekey}{/tikz/every transition} - This style is evoked by the style |transition|. - \end{stylekey} - - \begin{stylekey}{/tikz/pre} - This style can be used with paths leading \emph{from} a transition - \emph{to} a place to indicate that the place is in the pre-set of - the transition. By default, this style is |<-,shorten <=1pt|, but - feel free to redefine it. - \end{stylekey} - - \begin{stylekey}{/tikz/post} - This style is also used with paths leading \emph{from} a transition - \emph{to} a place, but this time the place is in the post-set of - the transition. Again, feel free to redefine it. - \end{stylekey} - - \begin{stylekey}{/tikz/pre and post} - This style is to be used to indicate that a place is both in the - pre- and post-set of a transition. - \end{stylekey} + \begin{stylekey}{/tikz/every transition} + This style is evoked by the style |transition|. + \end{stylekey} + + \begin{stylekey}{/tikz/pre} + This style can be used with paths leading \emph{from} a transition + \emph{to} a place to indicate that the place is in the pre-set of the + transition. By default, this style is |<-,shorten <=1pt|, but feel free + to redefine it. + \end{stylekey} + + \begin{stylekey}{/tikz/post} + This style is also used with paths leading \emph{from} a transition + \emph{to} a place, but this time the place is in the post-set of the + transition. Again, feel free to redefine it. + \end{stylekey} + + \begin{stylekey}{/tikz/pre and post} + This style is to be used to indicate that a place is both in the pre- + and post-set of a transition. + \end{stylekey} \end{stylekey} \subsection{Tokens} \label{section-tokens} -Interestingly, the most complicated aspect of drawing Petri nets in -\tikzname\ turns out to be the placement of tokens. +Interestingly, the most complicated aspect of drawing Petri nets in \tikzname\ +turns out to be the placement of tokens. -Let us start with a single token. They are also nodes and there is a -simple style for typesetting them. +Let us start with a single token. They are also nodes and there is a simple +style for typesetting them. \begin{stylekey}{/tikz/token} - This style indicates that a node is a token. By default, this causes - the node to be a small black circle. Unlike places and transitions, - it \emph{does} make sense to provide text for the token node. Such - text will be typeset in a tiny font and in white on black - (naturally, you can easily change this by setting the style - |every token|). - + This style indicates that a node is a token. By default, this causes the + node to be a small black circle. Unlike places and transitions, it + \emph{does} make sense to provide text for the token node. Such text will + 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{tikzpicture} \node[place,label=above:$p_1$] (p1) {}; @@ -126,28 +121,28 @@ simple style for typesetting them. \node[token] at (p2) {$y$}; \end{tikzpicture} \end{codeexample} - \begin{stylekey}{/tikz/every token} - Change this style to change the appearance of tokens. - \end{stylekey} + % + \begin{stylekey}{/tikz/every token} + Change this style to change the appearance of tokens. + \end{stylekey} \end{stylekey} -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. +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. - \begin{stylekey}{/tikz/children are tokens} - The idea behind this style is to use trees mechanism for placing - tokens. Every token lying on a place is treated as a child of the - node. Normally this would have the effect that the tokens are placed - below the place and they would be connected to the place by an - edge. The |children are tokens| style, however, redefines the growth - function of trees such that it places 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. + The idea behind this style is to use trees mechanism for placing tokens. + Every token lying on a place is treated as a child of the node. Normally + this would have the effect that the tokens are placed below the place and + they would be connected to the place by an edge. The |children are tokens| + style, however, redefines the growth function of trees such that it places + 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{tikzpicture} \node[place,label=above:$p_1$] {} @@ -158,19 +153,19 @@ The Petri net library offers a solution to this problem: The \end{tikzpicture} \end{codeexample} - In detail, what happens is the following: Tree growth functions tell - \tikzname\ where it should place the children of nodes. These - functions get passed the number of children that a node has an the - number of the child that should be placed. The special tree growth - function for tokens has a special mapping for each possible number - of children up to nine children. This mapping decides for each child - where it should be placed on top of the place. For example, a single - child is placed directly on top of the place. Two children are - placed next to each other, separated by the |token distance|. Three - children are placed in a triangle whose side lengths are - |token distance|; and so on up to nine tokens. If you wish to place - more than nice tokens on a place, you will have to write your own - placement code. + In detail, what happens is the following: Tree growth functions tell + \tikzname\ where it should place the children of nodes. These functions get + passed the number of children that a node has an the number of the child + that should be placed. The special tree growth function for tokens has a + special mapping for each possible number of children up to nine children. + This mapping decides for each child where it should be placed on top of the + place. For example, a single child is placed directly on top of the place. + Two children are placed next to each other, separated by the + |token distance|. Three children are placed in a triangle whose side + lengths are |token distance|; and so on up to nine tokens. If you wish to + place more than nice tokens on a place, you will have to write your own + placement code. + % \begin{codeexample}[] \begin{tikzpicture} \node[place,label=above:$p_2$] {} @@ -182,9 +177,10 @@ The Petri net library offers a solution to this problem: The \end{tikzpicture} \end{codeexample} - \begin{key}{/tikz/token distance=\meta{distance}} - This specifies the distance between the centers of the tokens in the - arrangements of the option |children are tokens|. + \begin{key}{/tikz/token distance=\meta{distance}} + This specifies the distance between the centers of the tokens in the + arrangements of the option |children are tokens|. + % \begin{codeexample}[] \begin{tikzpicture} \node[place,label=above:$p_3$] {} @@ -195,20 +191,21 @@ The Petri net library offers a solution to this problem: The child {node [token] {}}; \end{tikzpicture} \end{codeexample} - \end{key} + \end{key} \end{stylekey} -The |children are tokens| option gives you a lot of flexibility, but -it is a bit cumbersome to use. For this reason there are some options -that help in standard situations. They all use |children are tokens| -internally, so any change to, say, the |every token| style will -affect how these options depict tokens. +The |children are tokens| option gives you a lot of flexibility, but it is a +bit cumbersome to use. For this reason there are some options that help in +standard situations. They all use |children are tokens| internally, so any +change to, say, the |every token| style will affect how these options depict +tokens. \begin{key}{/tikz/tokens=\meta{number}} - This option is given to a |place| node, not to a |token| node. The - effect of this option is to add \meta{number} many child nodes to - the place, each having the style |token|. Thus, the following two - pieces of codes have the same effect: + This option is given to a |place| node, not to a |token| node. The effect + of this option is to add \meta{number} many child nodes to the place, each + having the style |token|. Thus, the following two pieces of codes have the + same effect: + % \begin{codeexample}[] \tikz \node[place] {} @@ -219,9 +216,11 @@ affect how these options depict tokens. \tikz \node[place,tokens=3] {}; \end{codeexample} - It is legal to say |tokens=0|, no tokens are drawn in this - case. This option does not handle ten or more tokens correctly. If - you need this many tokens, you will have to program your own code. + % + It is legal to say |tokens=0|, no tokens are drawn in this case. This + 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{tikzpicture}[every place/.style={minimum size=9mm}] @@ -231,22 +230,28 @@ affect how these options depict tokens. \node [place,tokens=\tokennumber] at (\x,\y) {}; \end{tikzpicture} \end{codeexample} + % \end{key} \begin{key}{/tikz/colored tokens=\meta{color list}} - This option, which must also be given when a place node is being - created, 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. + This option, which must also be given when a place node is being created, + 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}[] \tikz \node[place,colored tokens={black,black,red,blue}] {}; \end{codeexample} + % \end{key} + \begin{key}{/tikz/structured tokens=\meta{token texts}} - 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. + 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}[] \tikz \node[place,structured tokens={$x$,$y$,$z$}] {}; \end{codeexample} + % \begin{codeexample}[] \begin{tikzpicture}[every place/.style={minimum size=9mm}] @@ -256,14 +261,14 @@ affect how these options depict tokens. \node [place,structured tokens={1,...,\tokennumber}] at (\x,\y) {}; \end{tikzpicture} \end{codeexample} - If you use lots of structured tokens, consider redefining the - |every token| style so that the tokens are larger. + % + If you use lots of structured tokens, consider redefining the |every token| + style so that the tokens are larger. \end{key} \subsection{Examples} - \begin{codeexample}[] \begin{tikzpicture}[yscale=-1.6,xscale=1.5,thick, every transition/.style={draw=red,fill=red!20,minimum size=3mm}, @@ -314,6 +319,7 @@ affect how these options depict tokens. \end{codeexample} Here is the same net once more, but with these styles changes: +% \begin{codeexample}[code only] \begin{tikzpicture}[yscale=-1.1,thin,>=stealth, every transition/.style={fill,minimum width=1mm,minimum height=3.5mm}, @@ -337,36 +343,37 @@ Here is the same net once more, but with these styles changes: \node[token] at (m1f) {}; \node[token] at (m2f) {}; \node[token] at (h1) {}; - \node[transition] at (1.5,1.5) {} edge [pre] (p1) edge [post] (p2); - \node[transition] at (1.5,2.5) {} edge[pre] (p2) edge[pre] (m1f) - edge[post] (p3) edge[post] (m1t); - \node[transition] at (1.5,3.3) {} edge [pre] (p3) edge [post] (p4) - edge [pre and post] (h1); - \node[transition] at (1.5,3.7) {} edge [pre] (p3) edge [pre] (h2) + \node[transition] at (1.5,1.5) {} edge [pre] (p1) edge [post] (p2); + \node[transition] at (1.5,2.5) {} edge [pre] (p2) edge [pre] (m1f) + edge [post] (p3) edge [post] (m1t); + \node[transition] at (1.5,3.3) {} edge [pre] (p3) edge [post] (p4) + edge [pre and post] (h1); + \node[transition] at (1.5,3.7) {} edge [pre] (p3) edge [pre] (h2) edge [post] (p4) edge [post] (h1.west); - \node[transition] at (1.5,4.3) {} edge [pre] (p4) edge [post] (p5) - edge [pre and post] (m2f); - \node[transition] at (1.5,4.7) {} edge [pre] (p4) edge [post] (p5) - edge [pre and post] (h2); - \node[transition] at (1.5,5.5) {} edge [pre] (p5) edge [pre] (m1t) + \node[transition] at (1.5,4.3) {} edge [pre] (p4) edge [post] (p5) + edge [pre and post] (m2f); + \node[transition] at (1.5,4.7) {} edge [pre] (p4) edge [post] (p5) + edge [pre and post] (h2); + \node[transition] at (1.5,5.5) {} edge [pre] (p5) edge [pre] (m1t) edge [post] (p6) edge [post] (m1f); - \node[transition] at (1.5,6.5) {} edge [pre] (p6) edge [post] (p1.south east); - \node[transition] at (6.5,1.5) {} edge [pre] (q1) edge [post] (q2); - \node[transition] at (6.5,2.5) {} edge [pre] (q2) edge [pre] (m2f) + \node[transition] at (1.5,6.5) {} edge [pre] (p6) edge [post] (p1.south east); + \node[transition] at (6.5,1.5) {} edge [pre] (q1) edge [post] (q2); + \node[transition] at (6.5,2.5) {} edge [pre] (q2) edge [pre] (m2f) edge [post] (q3) edge [post] (m2t); - \node[transition] at (6.5,3.3) {} edge [pre] (q3) edge [post] (q4) - edge [pre and post] (h2); - \node[transition] at (6.5,3.7) {} edge [pre] (q3) edge [pre] (h1) + \node[transition] at (6.5,3.3) {} edge [pre] (q3) edge [post] (q4) + edge [pre and post] (h2); + \node[transition] at (6.5,3.7) {} edge [pre] (q3) edge [pre] (h1) edge [post] (q4) edge [post] (h2.east); - \node[transition] at (6.5,4.3) {} edge [pre] (q4) edge [post] (q5) - edge [pre and post] (m1f); - \node[transition] at (6.5,4.7) {} edge [pre] (q4) edge [post] (q5) - edge [pre and post] (h1); - \node[transition] at (6.5,5.5) {} edge [pre] (q5) edge [pre] (m2t) + \node[transition] at (6.5,4.3) {} edge [pre] (q4) edge [post] (q5) + edge [pre and post] (m1f); + \node[transition] at (6.5,4.7) {} edge [pre] (q4) edge [post] (q5) + edge [pre and post] (h1); + \node[transition] at (6.5,5.5) {} edge [pre] (q5) edge [pre] (m2t) edge [post] (q6) edge [post] (m2f); - \node[transition] at (6.5,6.5) {} edge [pre] (q6) edge [post] (q1.south west); + \node[transition] at (6.5,6.5) {} edge [pre] (q6) edge [post] (q1.south west); \end{tikzpicture} + %%% Local Variables: %%% mode: latex %%% TeX-master: "pgfmanual-pdftex-version" -- cgit v1.2.3