summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-nodes.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-nodes.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-nodes.tex59
1 files changed, 28 insertions, 31 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-nodes.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-nodes.tex
index f9c5eb8de53..b9a97e2046e 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-nodes.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-nodes.tex
@@ -14,11 +14,11 @@ In this second tutorial we explore the node mechanism of
Hagen must give a talk tomorrow about his favorite formalism for
distributed systems: Petri nets! Hagen used to give his talks using a
-blackboard and everyone seemed to be perfectly concent with % TODOsp: concent --> consent?
+blackboard and everyone seemed to be perfectly content with
this. Unfortunately, his audience has been spoiled recently with fancy
projector-based presentations and there seems to be a certain amount
-of peer pressure that this Petri nets should also be drawn using a
-graphic program. One of the professors at his institutes recommends
+of peer pressure that his Petri nets should also be drawn using a
+graphic program. One of the professors at his institute recommends
\tikzname\ for this and Hagen decides to give it a try.
@@ -102,10 +102,10 @@ capacities. The graphic should look like this, ideally:
edge [post,bend left] node {2} (w2');
\end{scope}
- \begin{pgfonlayer}{background}
+ \begin{scope}[on background layer]
\node (r1) [fill=black!10,rounded corners,fit=(w1)(w2)(e1)(e2)(l1)(l2)] {};
\node (r2) [fill=black!10,rounded corners,fit=(w1')(w2')(e1')(e2')(l1')(l2')] {};
- \end{pgfonlayer}
+ \end{scope}
\draw [shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment
length=2mm,pre=moveto,pre length=1mm,post length=2mm}]
@@ -128,7 +128,7 @@ loaded explicitly.
Hagen will need to load several libraries: The |arrows| library for the
special arrow tip used in the graphic, the |decoration.pathmorphing|
-library for the ``snaking line'' in the middle, the background
+library for the ``snaking line'' in the middle, the |backgrounds|
library for the two rectangular areas that are behind the two main
parts of the picture, the |fit| library to easily compute the sizes of
these rectangles, and the |positioning| library for placing nodes
@@ -173,9 +173,7 @@ When using plain \TeX\ use:
\subsubsection{Setting up the Environment in Con\TeX t}
-When using Con\TeX\ use\footnote{Note that \pgfname/\tikzname{} is not
- supported by recent Con\TeX t versions (like mark IV, the
- Lua\TeX-aware part of Con\TeX t).}:
+When using Con\TeX, use:
\begin{codeexample}[code only]
%% ConTeXt file
\usemodule[tikz]
@@ -201,8 +199,7 @@ However, this approach has numerous disadvantages: First, it is hard
to change anything at a later stage. For example, if we decide to add
more places to the Petri nets (the circles are called places in Petri
net theory), all of the coordinates change and we need to recalculate
-everything. Second, it is hard to read the code for the Petri net as
-it just a long and complicated list of coordinates and drawing
+everything. Second, it is hard to read the code for the Petri net as it is just a long and complicated list of coordinates and drawing
commands -- the underlying structure of the Petri net is lost.
Fortunately, \tikzname\ offers a powerful mechanism for avoiding the
@@ -214,7 +211,7 @@ A node is a small part of a picture. When a node is created, you
provide a position where the node should be drawn and a
\emph{shape}. A node of shape |circle| will be drawn as a circle, a
node of shape |rectangle| as a rectangle, and so on. A node may also
-contain same text, which is why Karl used nodes to show text. Finally,
+contain some text, which is why Karl used nodes to show text. Finally,
a node can get a \emph{name} for later reference.
In Hagen's picture we will use nodes for the places and for the
@@ -239,7 +236,7 @@ Hagen notes that this does not quite look like the final picture, but
it seems like a good first step.
Let us have a more detailed look at the code. The whole picture
-consists of a single path. Ignoring the |node| operations there is not
+consists of a single path. Ignoring the |node| operations, there is not
much going on in this path: It is just a sequence of coordinates with
nothing ``happening'' between them. Indeed, even if something were to
happen like a line-to or a curve-to, the |\path| command would not
@@ -256,10 +253,10 @@ answer is the |draw| option for the |node| operation: It causes the
So, the code |(0,2) node [shape=circle,draw] {}| means the following:
``In the main path, add a move-to to the coordinate |(0,2)|. Then,
temporarily suspend the construction of the main path while the node
-is build. This node will be a |circle| around an empty text. This
+is built. This node will be a |circle| around an empty text. This
circle is to be |draw|n, but not filled or otherwise used. Once this
whole node is constructed, it is saved until after the
-main path is finished. Then, it is drawn.'' Then following
+main path is finished. Then, it is drawn.'' The following
|(0,1) node [shape=circle,draw] {}| then has the following effect:
``Continue the main path with a move-to to |(0,1)|. Then construct a
node at this position also. This node is also shown after the main
@@ -353,7 +350,7 @@ places and another style for transitions:
Before Hagen starts naming and connecting the nodes, let us first
make sure that the nodes get their final appearance. They are still
too small. Indeed, Hagen wonders why they have any size at all, after
-all, the text is empty. The reason is than \tikzname\ automatically
+all, the text is empty. The reason is that \tikzname\ automatically
adds some space around the text. The amount is set using the option
|inner sep|. So, to increase the size of the nodes, Hagen could write:
@@ -373,7 +370,7 @@ adds some space around the text. The amount is set using the option
However, this is not really the best way to achieve the desired
effect. It is much better to use the |minimum size| option
instead. This option allows Hagen to specify a minimum size that the
-node should have. If the nodes actually needs to be bigger because of
+node should have. If the node actually needs to be bigger because of
a longer text, it will be larger, but if the text is empty, then the
node will have |minimum size|. This option is also useful to ensure
that several nodes containing different amounts of text have the same
@@ -414,7 +411,7 @@ Fortunately, \pgfname\ will perform all the necessary calculations for
him. However, he first has to assign names to the nodes so that he can
reference them later on.
-There are two ways to name a node. The first is the use the |name=|
+There are two ways to name a node. The first is to use the |name=|
option. The second method is to write the desired name in parentheses
after the |node| operation. Hagen thinks that this second method seems
strange, but he will soon change his opinion.
@@ -425,7 +422,7 @@ strange, but he will soon change his opinion.
transition/.style={rectangle,draw=black!50,fill=black!20,thick,
inner sep=0pt,minimum size=4mm}}
\begin{codeexample}[]
-% ... setup styles
+% ... set up styles
\begin{tikzpicture}
\node (waiting 1) at ( 0,2) [place] {};
\node (critical 1) at ( 0,1) [place] {};
@@ -499,7 +496,7 @@ either the distance between the centers of the nodes (when the
|on grid| option is set to true) or the distance between the borders
(when the |on grid| option is set to false, which is the default).
-Even though the above code has the same effect the earlier code, Hagen
+Even though the above code has the same effect as the earlier code, Hagen
can pass it to his colleagues who will be able to just read and
understand it, perhaps without even having to see the picture.
@@ -710,7 +707,7 @@ transition/.style={rectangle,draw=black!50,fill=black!20,thick,
There is another option for the |to| operation, that is even better
suited to Hagen's problem: The |bend right| option. This option also
takes an angle, but this angle only specifies the angle by which the
-curve is bend to the right:
+curve is bent to the right:
{
\tikzset{place/.style={circle,draw=blue!50,fill=blue!20,thick,
@@ -737,7 +734,7 @@ to the |to| operation, but there is one important difference: Like a
node the edge generated by the |edge| operation is not part of the
main path, but is added only later. This may not seem very important,
but it has some nice consequences. For example, every edge can have
-its own arrow tips and its own color and so one and, still, all the
+its own arrow tips and its own color and so on and, still, all the
edges can be given on the same path. This allows Hagen to write the
following:
@@ -869,7 +866,7 @@ nets. What he is unsure of is how he can create the snaked line
between the nets.
For this he can use a \emph{decoration}.
-To draw the snake, Hagen only needs to set the two options
+To draw the snaked line, Hagen only needs to set the two options
|decoration=snake| and |decorate| on
the path. This causes all lines of the path to be replaced by
snakes. It is also possible to use snakes only in certain parts of a
@@ -943,8 +940,9 @@ rectangle. If Hagen draws the rectangle first, then he needs to know
the exact size of the Petri net -- which he does not.
The solution is to use \emph{layers}. When the background library is
-loaded, Hagen can put parts of his picture inside a |{pgfonlayer}|
-environment. Then this part of the picture becomes part of the layer
+loaded, Hagen can put parts of his picture inside a scope with the
+|on background layer| option. Then this part of the picture becomes
+part of the layer
that is given as an argument to this environment. When the
|{tikzpicture}| environment ends, the layers are put on top of each
other, starting with the background layer. This causes everything
@@ -955,7 +953,7 @@ Naturally, Hagen can compute the size ``by hand'' or using some clever
observations concerning the $x$- and $y$-coordinates of the nodes, but
it would be nicer to just have \tikzname\ compute a rectangle into
which all the nodes ``fit.'' For this, the |fit| library can be
-used. It defines the |fit| options, which, when give to a node, causes
+used. It defines the |fit| options, which, when given to a node, causes
the node to be resized and shifted such that it exactly covers all the
nodes and coordinates given as parameters to the |fit| option.
@@ -982,17 +980,16 @@ post/.style={->,shorten >=1pt,>=stealth',semithick}}
edge [pre, bend left] (waiting)
edge [post,bend right] (semaphore);
- \begin{pgfonlayer}{background}
+ \begin{scope}[on background layer]
\node [fill=black!30,fit=(waiting) (critical) (semaphore)
(leave critical) (enter critical)] {};
- \end{pgfonlayer}
+ \end{scope}
\end{tikzpicture}
\end{codeexample}
}
-
\subsection{The Complete Code}
Hagen has now finally put everything together. Only then does he learn
@@ -1096,10 +1093,10 @@ every picture/.style={on grid,node distance=1.3cm,>=stealth',bend angle=45,auto}
The code for the background and the snake is the following:
\begin{codeexample}[code only]
- \begin{pgfonlayer}{background}
+ \begin{scope}[on background layer]
\node (r1) [fill=black!10,rounded corners,fit=(w1)(w2)(e1)(e2)(l1)(l2)] {};
\node (r2) [fill=black!10,rounded corners,fit=(w1')(w2')(e1')(e2')(l1')(l2')] {};
- \end{pgfonlayer}
+ \end{scope}
\draw [shorten >=1mm,-to,thick,decorate,
decoration={snake,amplitude=.4mm,segment length=2mm,