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.tex353
1 files changed, 263 insertions, 90 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 700d15208e2..77726100290 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
@@ -8,6 +8,7 @@
% See the file doc/generic/pgf/licenses/LICENSE for more details.
\section{Syntax for Path Specifications}
+\label{section-paths}
A \emph{path} is a series of straight and curved line segments. It is
specified following a |\path| command and the specification must
@@ -59,7 +60,7 @@ present section.
the path always applies to all parts of the path. If several
different colors are given for different parts of the path, only
the last one (on the outermost scope) ``wins'':
-
+
\begin{codeexample}[]
\tikz \draw (0,0) -- (1,1)
[color=red] -- (2,0) -- (3,1)
@@ -77,13 +78,13 @@ present section.
By default, the |\path| command does ``nothing'' with the
path, it just ``throws it away.'' Thus, if you write
- |\path(0,0)--(1,1);|, nothing is drawn
+ |\path(0,0)--(1,1);|, nothing is drawn
in your picture. The only effect is that the area occupied by the
picture is (possibly) enlarged so that the path fits inside the
area. To actually ``do'' something with the path, an option like
|draw| or |fill| must be given somewhere on the path. Commands like
|\draw| do this implicitly.
-
+
Finally, it is also possible to give \emph{node specifications} on a
path. Such specifications can come at different locations, but they
are always allowed when a normal path operation could follow. A node
@@ -97,8 +98,8 @@ present section.
specified by the path options (like filling and drawing the path due
to a |fill| and a |draw| option somewhere in the
\meta{specification}), the nodes are added in a post-processing
- step.
-
+ step.
+
The following style influences scopes:
\begin{stylekey}{/tikz/every path (initially \normalfont empty)}
This style is installed at the beginning of every path. This can
@@ -117,6 +118,44 @@ present section.
\end{command}
+\begin{key}{/tikz/insert path=\meta{path}}
+ This key can be used inside an option to add something to the
+ current path. This is mostly useful for defining styles that create
+ graphic contents. This option should be used with care, for instance
+ it should not be used as an argument of, say, a |node|. In the
+ following example, we use a style to add little circles to a path.
+\begin{codeexample}[]
+\tikz [c/.style={insert path={circle[radius=2pt]}}]
+ \draw (0,0) -- (1,1) [c] -- (3,2) [c];
+\end{codeexample}
+ The effect is the same as of
+ |(0,0) -- (1,1) circle[radius=2pt] -- (3,2) circle[radius=2pt]|.
+\end{key}
+
+The following options are for experts only:
+
+\begin{key}{/tikz/append after command=\meta{path}}
+ Some of the path commands described in the following sections take
+ optional arguments. For these commands, when you use this key inside
+ these options, the \meta{path} will be inserted \emph{after} the
+ path command is done. For instance, when you give this command in
+ the option list of a node, the \meta{path} will be added after the
+ node. This is used by, for instance, the |label| option to allow you
+ to specify a label in the option list of a node, but have this
+ |label| cause a node to be added after another node.
+\begin{codeexample}[]
+\tikz \draw node [append after command={(foo)--(1,1)},draw] (foo){foo};
+\end{codeexample}
+ If this key is called multiple times, the effects accumulate, that
+ is, all of the paths are added in the order to keys were found.
+\end{key}
+
+\begin{key}{/tikz/prefix after command=\meta{path}}
+ Works like |append after command|, only the accumulation order is
+ inverse: The \meta{path} is added before any earlier paths added
+ using either |append after command| or |prefix after command|.
+\end{key}
+
\subsection{The Move-To Operation}
@@ -129,7 +168,7 @@ expected.
\index{empty@\protect\meta{empty} path operation}%
\index{Path operations!empty@\protect\texttt{\meta{empty}}}%
The move-to operation normally starts a path at a certain
- point. This does not cause a line segment to be created, but it
+ point. This does not cause a line segment to be created, but it
specifies the starting point of the next segment. If a path is
already under construction, that is, if several segments have
already been created, a move-to operation will start a new part of the
@@ -191,6 +230,7 @@ construction operations.
\begin{pathoperation}[noindex]{-|}{\meta{coordinate}}
\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}[]
@@ -204,6 +244,7 @@ construction operations.
\begin{pathoperation}[noindex]{|-}{\meta{coordinate}}
\index{--2@\protect\texttt{\protect\pgfmanualbar-} path operation}%
\index{Path operations!--2@\protect\texttt{\protect\pgfmanualbar-}}%
+ \pgfmanualpdflabel[\catcode`\|=12 ]{|-}{}%
This operations means ``first vertical, then horizontal.''
\end{pathoperation}
}
@@ -217,7 +258,7 @@ curve.
\begin{pathoperation}{..}{\declare{|controls|}\meta{c}\opt{|and|\meta{d}}\declare{|..|\meta{y}}}
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,
+ The curve is a cubic Bézier 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
@@ -301,7 +342,7 @@ influenced by the following option:
\begin{key}{/tikz/rounded corners=\meta{inset} (default 4pt)}
When this option is in force, all corners (places where a line is
continued either via line-to or a curve-to operation) are replaced by
- little arcs so that the corner becomes smooth.
+ little arcs so that the corner becomes smooth.
\begin{codeexample}[]
\tikz \draw [rounded corners] (0,0) -- (1,1)
@@ -310,11 +351,11 @@ influenced by the following option:
The \meta{inset} describes how big the corner is. Note that the
\meta{inset} is \emph{not} scaled along if you use a scaling option
- like |scale=2|.
+ like |scale=2|.
\begin{codeexample}[]
\begin{tikzpicture}
- \draw[color=gray,very thin] (10pt,15pt) circle (10pt);
+ \draw[color=gray,very thin] (10pt,15pt) circle[radius=10pt];
\draw[rounded corners=10pt] (0,0) -- (0pt,25pt) -- (40pt,25pt);
\end{tikzpicture}
\end{codeexample}
@@ -342,80 +383,175 @@ Here is a rectangle with rounded corners:
corner will still be round, but ``not as nice.''
Second, if there are very short line segments in a path, the
- ``rounding'' may cause inadverted effects. In such case it may be
+ ``rounding'' may cause inadvertent effects. In such case it may be
necessary to temporarily switch off the rounding using
- |sharp corners|.
+ |sharp corners|.
\end{key}
\begin{key}{/tikz/sharp corners}
This options switches off any rounding on subsequent corners of the
- path.
+ path.
\end{key}
\subsection{The Circle and Ellipse Operations}
-A circle can be approximated well using four Bézier curves. However,
-it is difficult to do so correctly. For this reason, a special syntax
-is available for adding such an approximation of a circle to the
-current path.
+Circles and ellipses are common path elements for which there is a
+special path operation.
+
+\begin{pathoperation}{circle}{\opt{|[|\meta{options}|]|}}
+ This command adds a circle to the current path where the center of
+ the circle is the current point by default, but you can use the |at|
+ option to change this. The new current point of the path
+ will be (typically just remain) the center of the circle.
+
+ The radius of the circle is specified using the following options:
+ \begin{key}{/tikz/x radius=\meta{value}}
+ Sets the horizontal radius of the circle (which, when this value
+ is different form the vertical radius, is actually an
+ ellipse). The \meta{value} may either be a dimension or a
+ dimensionless number. In the latter case, the number is
+ interpreted in the $xy$-coordinate system (if the $x$-unit is set
+ to, say, |2cm|, then |x radius=3| will have the same effect as
+ |x radius=6cm|).
+ \end{key}
+ \begin{key}{/tikz/y radius=\meta{value}}
+ Works like the |x radius|.
+ \end{key}
+ \begin{key}{/tikz/radius=\meta{value}}
+ Sets the |x radius| and |y radius| simultaneously.
+ \end{key}
+ \begin{key}{/tikz/at=\meta{coordinate}}
+ If this option is explicitly set inside the \meta{options} (or
+ indirectly via the |every circle| style), the \meta{coordinate} is
+ used as the center of the circle instead of the current
+ point. Setting |at| to some value in an enclosing scope has no
+ effect.
+ \end{key}
+ The \meta{options} may also contain additional options like, say, a
+ |rotate| or |scale|, that will only have an effect on the circle.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \draw (1,0) circle [radius=1.5];
+ \fill (1,0) circle [x radius=1cm, y radius=5mm, rotate=30];
+\end{tikzpicture}
+\end{codeexample}
+
+ 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:
+\begin{codeexample}[]
+\begin{tikzpicture}[radius=2pt]
+ \draw (0,0) circle -- (1,1) circle -- ++(0,1) circle;
+\end{tikzpicture}
+\end{codeexample}
-\begin{pathoperation}{circle}{|(|\meta{radius}|)|}
- The center of the circle is given by the current point. The new
- current point of the path will remain to be the center of the
- circle.
-\end{pathoperation}
+ 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
+ circle. The key will also be used with the |ellipse| operation.
+ \end{stylekey}
-\begin{pathoperation}{ellipse}{|(|\meta{half width}| and |\meta{half height}|)|}
- Note that you can add spaces after |ellipse|, but you have to place
- spaces around |and|.
+ In case you feel that the names |radius| and |x radius| are too long
+ for your taste, you can easily created shorter aliases:
+\begin{codeexample}[code only]
+\tikzset{r/.style={radius=#1},rx/.style={x radius=#1},ry/.style={y radius=#1}}
+\end{codeexample}
+ You can then say |circle [r=1cm]| or |circle [rx=1,ry=1.5]|. The
+ reason \tikzname\ uses the longer names by default is that it
+ encourages people to write more readable code.
+
+ \emph{Note:} There also exists an older syntax for circles, where
+ the radius of the circle is given in parentheses right after the
+ |circle| command as in |circle (1pt)|. Although this syntax is a bit
+ more succinct, it is harder to understand for readers of the code
+ and the use of parentheses for something other than a coordinate is
+ ill-chosen.
+
+ \tikzname\ will use the following rule to determine whether the old
+ or the normal syntax is used: If |circle| is directly followed by
+ something that (expands to) an opening parenthesis, then the old
+ syntax is used and inside these following parentheses there must be
+ a single number or dimension representing a radius. In all other
+ cases the new syntax is used.
+\end{pathoperation}
+\begin{pathoperation}{ellipse}{|[|\meta{options}|]|}
+ This command has exactly the same effect as |circle|. The older
+ syntax for this command is |ellipse (|\meta{x radius} |and| \meta{y
+ radius}|)|. As for the |circle| command, this syntax is not as
+ good as the standard syntax.
\begin{codeexample}[]
\begin{tikzpicture}
- \draw (1,0) circle (.5cm);
- \draw (3,0) ellipse (1cm and .5cm) -- ++(3,0) circle (.5cm)
- -- ++(2,-.5) circle (.25cm);
+ \draw [help lines] (0,0) grid (3,2);
+ \draw (1,1) ellipse [x radius=1cm,y radius=.5cm];
\end{tikzpicture}
\end{codeexample}
\end{pathoperation}
+
\subsection{The Arc Operation}
The \emph{arc operation} allows you to add an arc to the current
path.
-\begin{pathoperation}{arc}{|(|\meta{start angle}|:|\meta{end
- angle}|:|\meta{radius}\opt{| and |\meta{half height}}|)|}
- The arc operation adds a part of a circle of the given radius
- between the given angles. The arc will start at the current point
- and will end at the end of the arc.
+\begin{pathoperation}{arc}{\oarg{options}}
+ The |arc| operation adds a part of an ellipse to the current
+ path. The radii of the ellipse are given by the values of |x radius|
+ and |y radius|, which should be set in the \meta{options}. The arc
+ will start at the current point and will end at the end of the
+ arc. The arc will start and end at angles computed from the three
+ keys |start angle|, |end angle|, and |delta angle|. Normally, the
+ first two keys specify the start and end angle. However, in case one
+ of them is empty, it is computed from the other key plus or minus
+ the |delta angle|. In detail, if |end angle| is empty, it is set to
+ the start angle plus the delta angle. If the start angle is missing,
+ it is set to the end angle minus the delta angle. If all three keys
+ are set, the delta angle is ignored.
+ \begin{key}{/tikz/start angle=\meta{degrees}}
+ Sets the start angle.
+ \end{key}
+ \begin{key}{/tikz/end angle=\meta{degrees}}
+ Sets the end angle.
+ \end{key}
+ \begin{key}{/tikz/delta angle=\meta{degrees}}
+ Sets the delta angle.
+ \end{key}
\begin{codeexample}[]
-\begin{tikzpicture}
- \draw (0,0) arc (180:90:1cm) -- (2,.5) arc (90:0:1cm);
- \draw (4,0) -- +(30:1cm) arc (30:60:1cm) -- cycle;
- \draw (8,0) arc (0:270:1cm and .5cm) -- cycle;
+\begin{tikzpicture}[radius=1cm]
+ \draw (0,0) arc[start angle=180, end angle=90]
+ -- (2,.5) arc[start angle=90, delta angle=-90];
+ \draw (4,0) -- +(30:1cm)
+ arc [start angle=30, delta angle=30] -- cycle;
+ \draw (8,0) arc [start angle=0, end angle=270,
+ x radius=1cm, y radius=5mm] -- cycle;
\end{tikzpicture}
\end{codeexample}
\begin{codeexample}[]
-\begin{tikzpicture}
+\begin{tikzpicture}[radius=1cm,delta angle=30]
\draw (-1,0) -- +(3.5,0);
\draw (1,0) ++(210:2cm) -- +(30:4cm);
- \draw (1,0) +(0:1cm) arc (0:30:1cm);
- \draw (1,0) +(180:1cm) arc (180:210:1cm);
+ \draw (1,0) +(0:1cm) arc [start angle=0];
+ \draw (1,0) +(180:1cm) arc [start angle=180];
\path (1,0) ++(15:.75cm) node{$\alpha$};
\path (1,0) ++(15:-.75cm) node{$\beta$};
\end{tikzpicture}
\end{codeexample}
+
+ There also exists a shorter syntax for the arc operation, namely
+ |arc| begin directly followed by |(|\meta{start angle}|:|\meta{end
+ angle}|:|\meta{radius}). However, this syntax is harder to read,
+ so the normal syntax should be preferred in general.
\end{pathoperation}
\subsection{The Grid Operation}
You can add a grid to the current path using the |grid| path
-operation.
+operation.
\begin{pathoperation}{grid}{\opt{\oarg{options}}\meta{corner}}
This operations adds a grid filling a rectangle whose two corners
@@ -431,7 +567,7 @@ operation.
The \meta{options}, which are local to the |grid| operation, can be
used to influence the appearance of the grid. The stepping of the
- grid is governed by the following options:
+ grid is governed by the following options:
\begin{key}{/tikz/step=\meta{number or dimension or coordinate}
(initially 1cm)}
@@ -451,10 +587,10 @@ operation.
\draw[red] (0,0) grid [step=.75cm] (3,2);
\end{tikzpicture}
\begin{tikzpicture}
- \draw (0,0) circle (1);
+ \draw (0,0) circle [radius=1];
\draw[blue] (0,0) grid [step=(45:1)] (3,2);
\end{tikzpicture}
-\end{codeexample}
+\end{codeexample}
A complication arises when the $x$- and/or $y$-vector do not point
along the axes. Because of this, the actual rule for computing the
@@ -463,18 +599,18 @@ operation.
vectors: The first vector is either $(\meta{x-grid-step-number},0)$
or $(\meta{x-grid-step-dimension},0\mathrm{pt})$, the second vector
is $(0,\meta{y-grid-step-number})$ or
- $(0\mathrm{pt},\meta{x-grid-step-dimension})$.
-\end{key}
+ $(0\mathrm{pt},\meta{x-grid-step-dimension})$.
+\end{key}
\begin{key}{/tikz/xstep=\meta{dimension or number} (initially 1cm)}
- Sets the stepping in the $x$-direction.
+ Sets the stepping in the $x$-direction.
\begin{codeexample}[]
\tikz \draw (0,0) grid [xstep=.5,ystep=.75] (3,2);
\end{codeexample}
\end{key}
\begin{key}{/tikz/ystep=\meta{dimension or number} (initially 1cm)}
- Sets the stepping in the $y$-direction.
+ Sets the stepping in the $y$-direction.
\end{key}
It is important to note that the grid is always ``phased'' such that
@@ -511,7 +647,7 @@ parabola[parabola height=-1.5ex] +(2ex,0ex);.
This operation adds a parabola through the current point and the
given \meta{coordinate}. 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.
+ where the bend is. By default, the bend is at the old current point.
\begin{codeexample}[]
\begin{tikzpicture}
@@ -567,7 +703,7 @@ parabola[parabola height=-1.5ex] +(2ex,0ex);.
option:
\begin{key}{/tikz/parabola height=\meta{dimension}}
This option has the same effect as
- |[bend pos=0.5,bend={+(0pt,|\meta{dimension}|)}]|.
+ |[bend pos=0.5,bend={+(0pt,|\meta{dimension}|)}]|.
\begin{codeexample}[]
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,2);
@@ -627,6 +763,43 @@ Note that there is no way to (conveniently) draw an interval on a sine
or cosine curve whose end points are not multiples of $\pi/2$.
+\subsection{The SVG Operation}
+
+The |svg| operation can be used to extend the current path by a path
+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}|"|}
+ 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
+ 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.
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \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";
+\end{tikzpicture}
+\end{codeexample}
+
+ An \textsc{svg} coordinate like |10 20| is always interpreted as
+ |(10pt,20pt)|, so the basic unit is always points (|pt|). The
+ $xy$-coordinate system is not used. However, you can use scaling to
+ (locally) change the basic unit. For instance, |svg[scale=1cm]|
+ (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
+ the angle is a multiple of $90^\circ$ (as is, fortunately, most
+ often the case).
+\end{pathoperation}
\subsection{The Plot Operation}
@@ -647,7 +820,7 @@ to |b|, exactly as if you had written |(a) -- (b)|. However, if you
write |(a) to [out=135,in=45] (b)| a curve is added to the path,
which leaves at an angle of 135$^\circ$ at |a| and arrives at an angle
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.
+trigger a special path to be used instead of the straight line.
\begin{pathoperation}{to}{\opt{|[|\meta{options}|]|}
\opt{\meta{nodes}} |(|\meta{coordinate}|)|}
@@ -655,15 +828,15 @@ trigger a special path to be used instead of the straight line.
This path operation inserts the path current 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
- will be rendered.
+ will be rendered.
Before the |to path| is inserted, a number of macros are setup that
can ``help'' the |to path|. These are |\tikztostart|,
|\tikztotarget|, and |\tikztonodes|; they are explained in the
- following.
-
+ following.
+
\medskip
- \textbf{Start and Target Coordinates.}\ \
+ \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
@@ -673,11 +846,11 @@ trigger a special path to be used instead of the straight line.
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|.
-
+
\begin{codeexample}[]
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,2);
-
+
\draw (0,0) to (0,2);
\node (a) at (2,2) {a};
\draw[red] (10pt,10pt) to (a);
@@ -690,11 +863,11 @@ trigger a special path to be used instead of the straight line.
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|
- operation, these come first). The effect of |(a) to node {x} (b)|
+ operation, these come first). The effect of |(a) to node {x} (b)|
(typically) is the same as if you had written
|(a) -- node {x} (b)|, namely that the node is placed on the
- to. This can be used to add labels to tos:
-
+ to. This can be used to add labels to tos:
+
\begin{codeexample}[]
\begin{tikzpicture}
\draw (0,0) to node [sloped,above] {x} (3,2);
@@ -704,23 +877,22 @@ trigger a special path to be used instead of the straight line.
\end{codeexample}
\medskip
- \textbf{Styles for nodes.}\ \
+ \textbf{Styles for to-paths.}\ \
In addition to the \meta{options} given after the |to| operation,
the following style is also set at the beginning of the to path:
\begin{stylekey}{/tikz/every to (initially \normalfont empty)}
- This style is installed at the beginning of every to. By
- default, it is set to |draw|.
+ This style is installed at the beginning of every to.
\begin{codeexample}[]
-\tikz[every to/.style={draw,dashed}]
- \path (0,0) to (3,2);
+\tikz[every to/.style={bend left}]
+ \draw (0,0) to (3,2);
\end{codeexample}
\end{stylekey}
\medskip
- \textbf{Options.}\ \
+ \textbf{Options.}\ \
The \meta{options} given with the |to| allow you to influence the
appearance of the |to path|. Mostly, these options are used to
- change the |to path|. This can be used to change the path from a
+ change the |to path|. This can be used to change the path from a
straight line to, say, a curve.
The path used is set using the following option:
@@ -729,9 +901,9 @@ trigger a special path to be used instead of the straight line.
inserted. More precisely, the following path is added:
\begin{quote}
- |[every to,|\meta{options}|] |\meta{path}
+ |{[every to,|\meta{options}|] |\meta{path} |}|
\end{quote}
-
+
The \meta{options} are the options given to the |to| operation,
the \meta{path} is the path set by this option |to path|.
@@ -743,7 +915,7 @@ trigger a special path to be used instead of the straight line.
\item \declare{|\tikztotarget|} will expand to the to-coordinate.
\item \declare{|\tikztonodes|} will expand to the nodes between
the |to| operation and the coordinate. Furthermore, these
- nodes will have the |pos| option set implicitly.
+ nodes will have the |pos| option set implicitly.
\end{itemize}
Let us have a look at a simple example. The standard straight line
@@ -772,7 +944,7 @@ trigger a special path to be used instead of the straight line.
Now let us have a look at how we can modify the \meta{path}
sensibly. The simplest way is to use a curve.
-
+
\begin{codeexample}[]
\begin{tikzpicture}[to path={
.. controls +(1,0) and +(1,0) .. (\tikztotarget) \tikztonodes}]
@@ -780,7 +952,7 @@ trigger a special path to be used instead of the straight line.
\node (a) at (0,0) {a};
\node (b) at (2,1) {b};
\node (c) at (1,2) {c};
-
+
\draw (a) to node {x} (b)
(a) to (c);
\end{tikzpicture}
@@ -790,16 +962,16 @@ trigger a special path to be used instead of the straight line.
\begin{codeexample}[]
\tikzset{
- my loop/.style={->,to path={
+ my loop/.style={to path={
.. controls +(80:1) and +(100:1) .. (\tikztotarget) \tikztonodes}},
my state/.style={circle,draw}}
-
+
\begin{tikzpicture}[shorten >=2pt]
\node [my state] (a) at (210:1) {$q_a$};
\node [my state] (b) at (330:1) {$q_b$};
-
- \draw (a) to node[below] {1} (b)
- to [my loop] node[above right] {0} (b);
+
+ \draw[->] (a) to node[below] {1} (b)
+ to [my loop] node[above right] {0} (b);
\end{tikzpicture}
\end{codeexample}
@@ -809,9 +981,10 @@ trigger a special path to be used instead of the straight line.
computations.
\end{key}
- \begin{key}{/tikz/executed at end to=\meta{code}}
+ \begin{key}{/tikz/execute at end to=\meta{code}}
Works like the previous option, only this code is executed after
the to path has been added.
+ % FIXME : provide examples...
\end{key}
@@ -834,7 +1007,7 @@ local, effects.
\begin{pathoperation}{let}{\meta{assignment}
\opt{|,|\meta{assignment}}%
\opt{|,|\meta{assignment}\dots}\declare{| in |}}
- When this path operation is encountered, the \meta{assignment}s are
+ When this path operation is encountered, the \meta{assignment}s are
evaluated, one by one. This will store coordinate and number in
special \emph{registers} (which are local to \tikzname, they have
nothing to do with \TeX\ registers). Subsequently, one can access the
@@ -853,7 +1026,7 @@ local, effects.
the resulting dimension with a trailing |pt|. A \meta{number register} can
be named arbitrarily and is a normal \TeX\ parameter to the |\n|
macro. Possible names are |{left corner}|, but also just a single
- digit like~|5|.
+ digit like~|5|.
Let us call the path that follows a let operation its
\emph{body}. Inside the body, the |\n| macro can be used to access
@@ -871,7 +1044,7 @@ local, effects.
|\n2| expands to |3|.
\end{command}
- The second kind of \meta{assignements} have the following form:
+ The second kind of \meta{assignments} have the following form:
\begin{quote}
|\p|\meta{point register}|={|\meta{formula}|}|
\end{quote}
@@ -895,7 +1068,7 @@ local, effects.
|=|-sign or in the body of the let operation, then it expands to
the $x$-part (measured in \TeX\ points) of the coordinate stored
in the \meta{register}, followed, by a comma, followed by the
- $y$-part.
+ $y$-part.
For instance, if we say |let \p1=(1pt,1pt+2pt) in ...|, then
inside the |...| part the macro |\p1| will expand to exactly the
@@ -913,7 +1086,7 @@ local, effects.
Works like |\x|, only for the $y$-part.
\end{command}
Note that the above macros are available only inside a let
- operation.
+ operation.
Here is an example where let clauses are used to assemble a coordinate
from the $x$-coordinate of a first point and the $y$-coordinate of a
@@ -928,7 +1101,7 @@ local, effects.
\fill[red] let \p1 = (first point),
\p2 = (second point) in
- (\x1,\y2) circle (2pt);
+ (\x1,\y2) circle [radius=2pt];
\end{tikzpicture}
\end{codeexample}
@@ -948,9 +1121,9 @@ local, effects.
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (center) at (\p{center});
-
+
\draw (p1) -- (p2);
- \fill[red] (center) circle (2pt);
+ \fill[red] (center) circle [radius=2pt];
\end{tikzpicture}
\end{codeexample}
@@ -968,7 +1141,7 @@ local, effects.
\draw let \p1 = ($ (a)!(c)!(b) - (c) $),
\n1 = {veclen(\x1,\y1)}
- in (c) circle (\n1);
+ in circle [at=(c), radius=\n1];
\end{tikzpicture}
\end{codeexample}
\end{pathoperation}
@@ -993,8 +1166,8 @@ please see Section~\ref{section-scopes-relative}.
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
-path. This operation is special in the following sense: It does not
-change the current path in any way. In other words, this operation
+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
``external'' to the path. The |edge| operation has similar effect in
that it adds something \emph{after} the main path has been
@@ -1002,7 +1175,7 @@ drawn. However, it works like the |to| operation, that is, it adds a
|to| path to the picture after the main path has been drawn.
Since these operations are quite complex, they are described in the
-separate Section~\ref{section-nodes}.
+separate Section~\ref{section-nodes}.