summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-paths.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-paths.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-paths.tex315
1 files changed, 219 insertions, 96 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-paths.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-paths.tex
index 77726100290..02456c9c869 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-paths.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-paths.tex
@@ -21,7 +21,7 @@ present section.
The \meta{specification} is a long stream of \emph{path
operations}. Most of these path operations tell \tikzname\ how the path
- is build. For example, when you write |--(0,0)|, you use a
+ is built. For example, when you write |--(0,0)|, you use a
\emph{line-to operation} and it means ``continue the path from
wherever you are to the origin.''
@@ -107,7 +107,7 @@ present section.
everything in a scope.
\begin{codeexample}[]
\begin{tikzpicture}
- [fill=examplefill, % only sets the color
+ [fill=yellow!80!black, % only sets the color
every path/.style={draw}] % all paths are drawn
\fill (0,0) rectangle +(1,1);
\shade (2,0) rectangle +(1,1);
@@ -186,27 +186,38 @@ expected.
described next.
\end{pathoperation}
+There is special coordinate called |current subpath start| that is
+always at the position of the last move-to operation on the current
+path.
-\subsection{The Line-To Operation}
+\begin{codeexample}[]
+\tikz [line width=2mm]
+ \draw (0,0) -- (1,0) -- (1,1)
+ -- (0,1) -- (current subpath start);
+\end{codeexample}
+
+Note how in the above example the path is not closed (as |--cycle|
+would do). Rather, the line just starts and ends at the origin without
+being a closed path.
+\subsection{The Line-To Operation}
+
\subsubsection{Straight Lines}
-\begin{pathoperation}{--}{\meta{coordinate}}
+\begin{pathoperation}{--}{\meta{coordinate or cycle}}
The line-to operation extends the current path from the current
- point in a straight line to the given coordinate. The ``current
+ point in a straight line to the given \meta{coordinate} (the ``or
+ cycle'' part is explained in a moment). The ``current
point'' is the endpoint of the previous drawing operation or the point
specified by a prior move-to operation.
- You use two minus signs followed by a coordinate in round
- brackets. You can add spaces before and after the~|--|.
-
When a line-to operation is used and some path segment has just been
constructed, for example by another line-to operation, the two line
segments become joined. This means that if they are drawn, the point
where they meet is ``joined'' smoothly. To appreciate the difference,
consider the following two examples: In the left example, the path
- consists of two path segments that are not joined, but that happen to
+ consists of two path segments that are not joined, but they happen to
share a point, while in the right example a smooth join is shown.
\begin{codeexample}[]
@@ -217,8 +228,36 @@ expected.
\end{tikzpicture}
\end{codeexample}
+ Instead of a coordinate following the two minus signs, you can also
+ use the text |cycle|. This causes the straight line from the current
+ point to go to the last point specified by a move-to operation. Note
+ that this need not be the beginning of the path. Furthermore, a
+ smooth join is created between the first segment created after the
+ last move-to operation and the straight line appended by the cycle
+ operation.
+
+ Consider the following example. In the left example, two triangles are
+ created using three straight lines, but they are not joined at the
+ ends. In the second example cycle operations are used.
+
+\begin{codeexample}[]
+\begin{tikzpicture}[line width=10pt]
+ \draw (0,0) -- (1,1) -- (1,0) -- (0,0) (2,0) -- (3,1) -- (3,0) -- (2,0);
+ \draw (5,0) -- (6,1) -- (6,0) -- cycle (7,0) -- (8,1) -- (8,0) -- cycle;
+ \useasboundingbox (0,1.5); % make bounding box higher
+\end{tikzpicture}
+\end{codeexample}
\end{pathoperation}
+Writing |cycle| instead of a coordinate at the end of a path operation
+is possible with all path operations that end with a coordinate (such
+as |--| or |..| or |sin| or |grid|, but not |graph| or |plot|).
+In all cases, the effect is that the coordinate of the last moveto is
+used as the coordinate expected by the path operation and that a
+smooth join is added. (What actually happens that the text |cycle|
+used with any path operation other than |--| gets replaced by
+|(current subpath start)--cycle|.)
+
\subsubsection{Horizontal and Vertical Lines}
@@ -227,21 +266,28 @@ only horizontal and vertical. For this, you can use two path
construction operations.
{\catcode`\|=12
-\begin{pathoperation}[noindex]{-|}{\meta{coordinate}}
+\begin{pathoperation}[noindex]{-|}{\meta{coordinate or cycle}}
\index{--1@\protect\texttt{-\protect\pgfmanualbar} path operation}%
\index{Path operations!--1@\protect\texttt{-\protect\pgfmanualbar}}%
\pgfmanualpdflabel[\catcode`\|=12 ]{-|}{}%
This operation means ``first horizontal, then vertical.''
- \begin{codeexample}[]
+\begin{codeexample}[]
\begin{tikzpicture}
\draw (0,0) node(a) [draw] {A} (1,1) node(b) [draw] {B};
\draw (a.north) |- (b.west);
\draw[color=red] (a.east) -| (2,1.5) -| (b.north);
\end{tikzpicture}
\end{codeexample}
+ Instead of a coordinate you can also write \verb!cycle! to close the
+ path:
+\begin{codeexample}[]
+\begin{tikzpicture}[ultra thick]
+ \draw (0,0) -- (1,1) -| cycle;
+\end{tikzpicture}
+\end{codeexample}
\end{pathoperation}
-\begin{pathoperation}[noindex]{|-}{\meta{coordinate}}
+\begin{pathoperation}[noindex]{|-}{\meta{coordinate or cycle}}
\index{--2@\protect\texttt{\protect\pgfmanualbar-} path operation}%
\index{Path operations!--2@\protect\texttt{\protect\pgfmanualbar-}}%
\pgfmanualpdflabel[\catcode`\|=12 ]{|-}{}%
@@ -252,13 +298,15 @@ construction operations.
\subsection{The Curve-To Operation}
-The curve-to operation allows you to extend a path using a Bézier
+The curve-to operation allows you to extend a path using a B\'ezier
curve.
-\begin{pathoperation}{..}{\declare{|controls|}\meta{c}\opt{|and|\meta{d}}\declare{|..|\meta{y}}}
+\begin{pathoperation}{..}{\declare{|controls|}\meta{c}\opt{|and|\meta{d}}\declare{|..|\meta{y or cycle}}}
This operation extends the current path from the current
- point, let us call it $x$, via a curve to a the current point~$y$.
- The curve is a cubic Bézier curve. For such a curve,
+ point, let us call it $x$, via a curve to a point~$y$ (if, instead
+ of a coordinate you say |cycle| at the end, $y$ will be the
+ coordinate of the last move-to operation).
+ The curve is a cubic B\'ezier curve. For such a curve,
apart from $y$, you also specify two control points $c$ and $d$. The
idea is that the curve starts at $x$, ``heading'' in the direction
of~$c$. Mathematically spoken, the tangent of the curve at $x$ goes
@@ -277,38 +325,21 @@ curve.
\end{tikzpicture}
\end{codeexample}
- As with the line-to operation, it makes a difference whether two curves
- are joined because they resulted from consecutive curve-to or line-to
- operations, or whether they just happen to have the same ending:
-
\begin{codeexample}[]
-\begin{tikzpicture}[line width=10pt]
- \draw (0,0) -- (1,1) (1,1) .. controls (1,0) and (2,0) .. (2,0);
- \draw (3,0) -- (4,1) .. controls (4,0) and (5,0) .. (5,0);
- \useasboundingbox (0,1.5); % make bounding box higher
+\begin{tikzpicture}
+ \draw[line width=10pt] (0,0) -- (2,0) .. controls (1,1) .. cycle;
\end{tikzpicture}
\end{codeexample}
-\end{pathoperation}
-
-
-\subsection{The Cycle Operation}
-
-\begin{pathoperation}{--cycle}{}
- This operation adds a straight line from the current
- point to the last point specified by a move-to operation. Note that
- this need not be the beginning of the path. Furthermore, a smooth join
- is created between the first segment created after the last move-to
- operation and the straight line appended by the cycle operation.
- Consider the following example. In the left example, two triangles are
- created using three straight lines, but they are not joined at the
- ends. In the second example cycle operations are used.
+ As with the line-to operation, it makes a difference whether two curves
+ are joined because they resulted from consecutive curve-to or line-to
+ operations, or whether they just happen to have a common (end) point:
\begin{codeexample}[]
\begin{tikzpicture}[line width=10pt]
- \draw (0,0) -- (1,1) -- (1,0) -- (0,0) (2,0) -- (3,1) -- (3,0) -- (2,0);
- \draw (5,0) -- (6,1) -- (6,0) -- cycle (7,0) -- (8,1) -- (8,0) -- cycle;
- \useasboundingbox (0,1.5); % make bounding box higher
+ \draw (0,0) -- (1,1) (1,1) .. controls (1,0) and (2,0) .. (2,0);
+ \draw [yshift=-1.5cm]
+ (0,0) -- (1,1) .. controls (1,0) and (2,0) .. (2,0);
\end{tikzpicture}
\end{codeexample}
\end{pathoperation}
@@ -321,10 +352,10 @@ A rectangle can obviously be created using four straight lines and a
cycle operation. However, since rectangles are needed so often, a
special syntax is available for them.
-\begin{pathoperation}{rectangle}{\meta{corner}}
+\begin{pathoperation}{rectangle}{\meta{corner or cycle}}
When this operation is used, one corner will be the current point,
another corner is given by \meta{corner}, which becomes the new
- current point.
+ current point.
\begin{codeexample}[]
\begin{tikzpicture}
@@ -332,6 +363,9 @@ special syntax is available for them.
\draw (.5,1) rectangle (2,0.5) (3,0) rectangle (3.5,1.5) -- (2,0);
\end{tikzpicture}
\end{codeexample}
+
+ Just for consistency, you can also use |cycle| instead of a
+ coordinate, but it is a bit unclear what use this might have.
\end{pathoperation}
@@ -440,7 +474,7 @@ special path operation.
It is possible to set the |radius| also in some enclosing scope, in
this case the options can be left out (but see the note below on
- what may follow:
+ what may follow):
\begin{codeexample}[]
\begin{tikzpicture}[radius=2pt]
\draw (0,0) circle -- (1,1) circle -- ++(0,1) circle;
@@ -449,7 +483,7 @@ special path operation.
The following style is used with every circle:
\begin{stylekey}{/tikz/every circle}
- You can use this key to setup, say, a default radius for every
+ You can use this key to set up, say, a default radius for every
circle. The key will also be used with the |ellipse| operation.
\end{stylekey}
@@ -553,9 +587,12 @@ path.
You can add a grid to the current path using the |grid| path
operation.
-\begin{pathoperation}{grid}{\opt{\oarg{options}}\meta{corner}}
+\begin{pathoperation}{grid}{\opt{\oarg{options}}\meta{corner or cycle}}
This operations adds a grid filling a rectangle whose two corners
- are given by \meta{corner} and by the previous coordinate. Thus, the
+ are given by \meta{corner} and by the previous coordinate. (Instead
+ of a coordinate you can also say |cycle| to use the position of the
+ last move-to as the corner coordinate, but it not very natural to
+ do so.) corner Thus, the
typical way in which a grid is drawn is |\draw (1,1) grid (3,3);|,
which yields a grid filling the rectangle whose corners are at
$(1,1)$ and $(3,3)$. All coordinate transformations apply to the
@@ -643,20 +680,26 @@ equation $f(x) = x^2$ and looks like this: \tikz \draw (-1ex,1.5ex)
parabola[parabola height=-1.5ex] +(2ex,0ex);.
\begin{pathoperation}{parabola}{\opt{\oarg{options}|bend|\meta{bend
- coordinate}}\meta{coordinate}}
+ coordinate}}\meta{coordinate or cycle}}
This operation adds a parabola through the current point and the
- given \meta{coordinate}. If the |bend| is given, it specifies where
+ given \meta{coordinate} or, if |cycle| is used instead of coordinate
+ at the end, the \meta{coordinate} is set to the position of the last
+ move-to and the path gets closed after the parabola. If the |bend|
+ is given, it specifies where
the bend should go; the \meta{options} can also be used to specify
where the bend is. By default, the bend is at the old current point.
\begin{codeexample}[]
\begin{tikzpicture}
- \draw (0,0) rectangle (1,1.5)
- (0,0) parabola (1,1.5);
- \draw[xshift=1.5cm] (0,0) rectangle (1,1.5)
- (0,0) parabola[bend at end] (1,1.5);
- \draw[xshift=3cm] (0,0) rectangle (1,1.5)
- (0,0) parabola bend (.75,1.75) (1,1.5);
+ \draw (0,0) rectangle (1,1.5)
+ (0,0) parabola (1,1.5);
+ \draw[xshift=1.5cm] (0,0) rectangle (1,1.5)
+ (0,0) parabola[bend at end] (1,1.5);
+ \draw[xshift=3cm] (0,0) rectangle (1,1.5)
+ (0,0) parabola bend (.75,1.75) (1,1.5);
+
+ \draw[yshift=-2cm] (1,1.5) --
+ (0,0) parabola cycle;
\end{tikzpicture}
\end{codeexample}
@@ -672,7 +715,7 @@ parabola[parabola height=-1.5ex] +(2ex,0ex);.
There is one special property of the \meta{coordinate}: When a
relative coordinate is given like |+(0,0)|, the position relative
- to which this coordinate is ``flexible.'' More precisely, this
+ to this coordinate is ``flexible.'' More precisely, this
position lies somewhere on a line from the old current point to the
new current point. The exact position depends on the next
option.
@@ -733,7 +776,7 @@ The |sin| and |cos| operations are similar to the |parabola|
operation. They, too, can be used to draw (parts of) a sine or cosine
curve.
-\begin{pathoperation}{sin}{\meta{coordinate}}
+\begin{pathoperation}{sin}{\meta{coordinate or cycle}}
The effect of |sin| is to draw a scaled and shifted version of a sine
curve in the interval $[0,\pi/2]$. The scaling and shifting is done in
such a way that the start of the sine curve in the interval is at the
@@ -746,7 +789,7 @@ curve.
\end{codeexample}
\end{pathoperation}
-\begin{pathoperation}{cos}{\meta{coordinate}}
+\begin{pathoperation}{cos}{\meta{coordinate or cycle}}
This operation works similarly, only a cosine in the interval
$[0,\pi/2]$ is drawn. By correctly alternating |sin| and |cos|
operations, you can create a complete sine or cosine curve:
@@ -770,21 +813,21 @@ given in the \textsc{svg} path data syntax. This syntax is described
in detail in Section 8.3 of the \textsc{svg 1.1} specification, please
consult this specification for details.
-\begin{pathoperation}{svg}{\opt{\oarg{options}}|"|\meta{path data}|"|}
+\begin{pathoperation}{svg}{\opt{\oarg{options}}\marg{path data}}
This operation adds the path specified in the \meta{path data} in
\textsc{svg 1.1 path data} syntax to the current path. Unlike the
\textsc{svg}-specification, it \emph{is} permissible that the path
- data does not start with a moveto command (|m| or |M|), in which
+ data does not start with a move-to command (|m| or |M|), in which
case the last point of the current path is used as start point.
The optional \meta{options} apply locally to this path operation,
- typically you will use them to setup, say, some transformations.
+ typically you will use them to set up, say, some transformations.
\begin{codeexample}[]
\begin{tikzpicture}
- \filldraw [fill=red!20] (0,1) svg[scale=2] "h 10 v 10 h -10"
+ \filldraw [fill=red!20] (0,1) svg[scale=2] {h 10 v 10 h -10}
node [above left] {upper left} -- cycle;
- \draw svg "M 0 0 L 20 20 h 10 a 10 10 0 0 0 -20 0";
+ \draw svg {M 0 0 L 20 20 h 10 a 10 10 0 0 0 -20 0};
\end{tikzpicture}
\end{codeexample}
@@ -795,8 +838,11 @@ consult this specification for details.
(yes, this works, although some rather evil magic is involved) will
cause 1cm to be the basic unit.
- \emph{Warning:} The arc operations (|a| and |A|) are not numerically
- stable. This means that they will be quite imprecise, except when
+ Instead of curly braces, you can also use quotation marks to
+ indicate the start and end of the \textsc{svg} path.
+
+ \emph{Warning:} The arc operations (|a| and |A|) are numerically
+ instable. This means that they will be quite imprecise, except when
the angle is a multiple of $90^\circ$ (as is, fortunately, most
often the case).
\end{pathoperation}
@@ -823,14 +869,14 @@ of 45$^\circ$ at |b|. This is because the options |in| and |out|
trigger a special path to be used instead of the straight line.
\begin{pathoperation}{to}{\opt{|[|\meta{options}|]|}
- \opt{\meta{nodes}} |(|\meta{coordinate}|)|}
+ \opt{\meta{nodes}} \meta{coordinate or cycle}}
- This path operation inserts the path current set via the |to path|
+ This path operation inserts the path currently set via the |to path|
option at the current position. The \meta{options} can be used to
- modify (perhaps implicitly) the |to path| and to setup how the path
+ modify (perhaps implicitly) the |to path| and to set up how the path
will be rendered.
- Before the |to path| is inserted, a number of macros are setup that
+ Before the |to path| is inserted, a number of macros are set up that
can ``help'' the |to path|. These are |\tikztostart|,
|\tikztotarget|, and |\tikztonodes|; they are explained in the
following.
@@ -838,28 +884,31 @@ trigger a special path to be used instead of the straight line.
\medskip
\textbf{Start and Target Coordinates.}\ \
The |to| operation is always followed by a \meta{coordinate}, called
- the target coordinate. The macro |\tikztotarget| is set to this
- coordinate (without the parentheses). There is also a \emph{start
- coordinate}, which is the coordinate preceding the |to|
- operation. This coordinate can be accessed via the macro
- |\tikztostart|. In the following example, for the first |to|, the
- macro |\tikztostart| is |0pt,0pt| and the |\tikztotarget| is
- |0,2|. For the second |to|, the macro |\tikztostart| is |10pt,10pt|
- and |\tikztotarget| is |a|.
+ the target coordinate, or the text |cycle|, in which case the last
+ move-to is used as a coordinate and the path gets closed. The macro
+ |\tikztotarget| is set to this coordinate (without its
+ parentheses). There is also a \emph{start coordinate}, which is the
+ coordinate preceding the |to| operation. This coordinate can be
+ accessed via the macro |\tikztostart|. In the following example, for
+ the first |to|, the macro |\tikztostart| is |0pt,0pt| and the
+ |\tikztotarget| is |0,2|. For the second |to|, the macro
+ |\tikztostart| is |10pt,10pt| and |\tikztotarget| is |a|. For the
+ third, they are set to |a| and |current subpath start|.
\begin{codeexample}[]
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,2);
+ \node (a) at (2,2) {a};
- \draw (0,0) to (0,2);
- \node (a) at (2,2) {a};
- \draw[red] (10pt,10pt) to (a);
+ \draw (0,0) to (0,2);
+ \draw[red] (10pt,10pt) to (a);
+ \draw[blue] (3,0) -- (3,2) -- (a) to cycle;
\end{tikzpicture}
\end{codeexample}
\medskip
- \textbf{Nodes on tos.}\ \
+ \textbf{Nodes on to--paths.}\ \
It is possible to add nodes to the paths constructed by a |to|
operation. To do so, you specify the nodes between the |to|
keyword and the coordinate (if there are options to the |to|
@@ -876,6 +925,42 @@ trigger a special path to be used instead of the straight line.
\end{tikzpicture}
\end{codeexample}
+ Instead of writing the node between the |to| keyword and the
+ target coordinate, you may also use the following keys to create
+ such nodes:
+ \begin{key}{/tikz/edge node=\meta{node specification}}
+ This key can be used inside the \meta{options} of a |to| path
+ command. It will add the \meta{node specification} to the list of
+ nodes to be placed on the connecting line, just as if you had
+ written the \meta{node specification} directly after the |to|
+ keyword:
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \draw (0,0) to [edge node={node [sloped,above] {x}}] (3,2);
+
+ \draw (0,0) to [out=90,in=180,
+ edge node={node [sloped,above] {x}}] (3,2);
+\end{tikzpicture}
+\end{codeexample}
+ This key is mostly useful to create labels automatically using
+ other keys.
+ \end{key}
+ \begin{key}{/tikz/edge label=\meta{text}}
+ A shorthand for |edge node={node[auto]{|\meta{text}|}}|.
+\begin{codeexample}[]
+\tikz \draw (0,0) to [edge label=x] (3,2);
+\end{codeexample}
+ \end{key}
+ \begin{key}{/tikz/edge label'=\meta{text}}
+ A shorthand for |edge node={node[auto,swap]{|\meta{text}|}}|.
+\begin{codeexample}[]
+\tikz \draw (0,0) to [edge label=x, edge label'=y] (3,2);
+\end{codeexample}
+ \end{key}
+
+ When the |quotes| library is loaded, additional ways of specifying
+ nodes on to--paths become available, see Section~\ref{section-edge-quotes}.
+
\medskip
\textbf{Styles for to-paths.}\ \
In addition to the \meta{options} given after the |to| operation,
@@ -886,6 +971,14 @@ trigger a special path to be used instead of the straight line.
\tikz[every to/.style={bend left}]
\draw (0,0) to (3,2);
\end{codeexample}
+ Note that, as explained below, every to path is implicitly
+ surrounded by curly braces. This means that options like |draw|
+ given in an |every to| do not actually influence the path. You can
+ fix this by using the |append after command| option:
+\begin{codeexample}[]
+\tikz[every to/.style={append after command={[draw,dashed]}}]
+ \draw (0,0) to (3,2);
+\end{codeexample}
\end{stylekey}
\medskip
@@ -910,16 +1003,16 @@ trigger a special path to be used instead of the straight line.
Inside the \meta{path}, different macros are used to reference the
from- and to-coordinates. In detail, these are:
\begin{itemize}
- \item \declare{|\tikztostart|} will expand to the from-coordinate
+ \item \declareandlabel{\tikztostart} will expand to the from-coordinate
(without the parentheses).
- \item \declare{|\tikztotarget|} will expand to the to-coordinate.
- \item \declare{|\tikztonodes|} will expand to the nodes between
+ \item \declareandlabel{\tikztotarget} will expand to the to-coordinate.
+ \item \declareandlabel{\tikztonodes} will expand to the nodes between
the |to| operation and the coordinate. Furthermore, these
nodes will have the |pos| option set implicitly.
\end{itemize}
Let us have a look at a simple example. The standard straight line
- for an to is achieved by the following \meta{path}:
+ for a |to| is achieved by the following \meta{path}:
\begin{quote}
|-- (\tikztotarget) \tikztonodes|
\end{quote}
@@ -932,7 +1025,7 @@ trigger a special path to be used instead of the straight line.
\end{quote}
the \meta{path} will expand to
\begin{quote}
- |(a) -- (b) node[pos] {x}|
+ |(a) -- (b) node[red] {x}|
\end{quote}
It is not possible to specify the path
@@ -976,7 +1069,7 @@ trigger a special path to be used instead of the straight line.
\end{codeexample}
\begin{key}{/tikz/execute at begin to=\meta{code}}
- The \meta{code} is executed prior to the to. This can be used to
+ The \meta{code} is executed prior to the |to|. This can be used to
draw one or more additional paths or to do additional
computations.
\end{key}
@@ -998,6 +1091,23 @@ There are a number of predefined |to path|s, see
Section~\ref{library-to-paths} for a reference.
+\subsection{The Foreach Operation}
+
+\begin{pathoperation}{foreach}{\meta{variables}\opt{\oarg{options}} |in|
+ \marg{path commands}}
+ The |foreach| operation can be used to repeatedly insert the
+ \meta{path commands} into the current path. Naturally, the
+ \meta{path commands} should internally reference some of the
+ \meta{variables} so that you do not insert exactly the same path
+ repeatedly, but rather variations. For historical reasons, you can
+ also write |\foreach| instead of |foreach|.
+\begin{codeexample}[]
+\tikz \draw (0,0) foreach \x in {1,...,3} { -- (\x,1) -- (\x,0) };
+\end{codeexample}
+ See Section~\ref{section-foreach} for more details on the
+ for-each-command.
+\end{pathoperation}
+
\subsection{The Let Operation}
The \emph{let operation} is the first of a number of path operations
@@ -1020,7 +1130,7 @@ local, effects.
|\n|\meta{number register}|={|\meta{formula}|}|
\end{quote}
When an assignment has this form, the \meta{formula} is evaluated
- using the |\pgfmathparse| operation. The result stored in the
+ using the |\pgfmathparse| operation. The result is stored in the
\meta{number register}. If the \meta{formula} involves a dimension
anywhere (as in |2*3cm/2|), then the \meta{number register} stores
the resulting dimension with a trailing |pt|. A \meta{number register} can
@@ -1050,7 +1160,7 @@ local, effects.
\end{quote}
Point position registers store a single point, consisting
of an $x$-part and a $y$-part measured in \TeX\ points (|pt|). In
- particular, point registers do not stored nodes or node names.
+ particular, point registers do not store nodes or node names.
Here is an example:
\begin{codeexample}[]
\begin{tikzpicture}
@@ -1077,7 +1187,7 @@ local, effects.
what you intended.
\end{command}
\begin{command}{\x\marg{point register}}
- This macro expand just to the $x$-part of the point
+ This macro expands just to the $x$-part of the point
register. If we say as above, as we did above,
|let \p1=(1pt,1pt+2pt) in ...|, then
inside the |...| part the macro |\x1| expands to |1pt|.
@@ -1127,7 +1237,7 @@ local, effects.
\end{tikzpicture}
\end{codeexample}
- For a more useful application of the let operation, let use draw a
+ For a more useful application of the let operation, let us draw a
circle that touches a given line:
\begin{codeexample}[]
\begin{tikzpicture}
@@ -1164,8 +1274,7 @@ please see Section~\ref{section-scopes-relative}.
\subsection{The Node and Edge Operations}
-There are two more operations that can be found in paths:
-|node| and |edge|. The first is used to add a so-called node to a
+The |node| operation adds a so-called node to a
path. This operation is special in the following sense: It does not
change the current path in any way. In other words, this operation
is not really a path operation, but has an effect that is
@@ -1178,6 +1287,20 @@ Since these operations are quite complex, they are described in the
separate Section~\ref{section-nodes}.
+\subsection{The Graph Operation}
+
+The |graph| operation can be used to specify easily how a large number
+of nodes are connected. This operation is documented in a separate
+section, see Section~\ref{section-library-graphs}.
+
+
+\subsection{The Pic Operation}
+
+The |pic| operation is used to insert a ``short picture'' (hence the
+``short'' name) at the current position of the path. This operation is
+somewhat similar to the |node| operation and discussed in detail in
+Section~\ref{section-pics}.
+
\subsection{The PGF-Extra Operation}
@@ -1209,9 +1332,9 @@ used deep inside clever macros, not on normal paths.
This is an alternative syntax for the |\pgfextra| command. If the
code following |\pgfextra| does not start with a brace, the
\meta{code} is executed until |\endpgfextra| is encountered. What
- actually happens is that |\pgfextra| that is not followed by a brace
- completely shuts down the \tikzname\ parse and |\endpgfextra| is a
- normal macro that restarts the parser.
+ actually happens is that when |\pgfextra| is not followed by a
+ brace, this completely shuts down the \tikzname\ parser and
+ |\endpgfextra| is a normal macro that restarts the parser.
\begin{codeexample}[]
\newdimen\mydim