summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex634
1 files changed, 405 insertions, 229 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex
index 950dbe71a28..5cd58695209 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-shapes.tex
@@ -15,12 +15,12 @@
In the present section, the usage of \emph{nodes} in
\tikzname\ is explained. A node is typically a rectangle or circle or
-another simple shape with some text on it.
+another simple shape with some text on it.
Nodes are added to paths using the special path
operation |node|. Nodes \emph{are not part of the path
itself}. Rather, they are added to the picture after the path has
-been drawn.
+been drawn.
In Section~\ref{section-nodes-basic} the basic syntax of the node
operation is explained, followed in Section~\ref{section-nodes-multi}
@@ -38,8 +38,7 @@ Section~\ref{section-nodes-connecting} it is explained how a node can
be used as a ``pseudo-coordinate.'' Section~\ref{section-nodes-edges}
introduces the |edge| operation, which
works similar to the |to| operation and also similar to the |node|
-operation. Finally, Section~\ref{section-nodes-executing} explains the
-special |after node path| options.
+operation.
\subsection{Nodes and Their Shapes}
@@ -71,7 +70,7 @@ current position of the path \emph{after the path has been
drawn}. Thus, all nodes are drawn ``on top'' of the path and
retained until the path is complete. If there are several nodes on a
path, they are drawn on top of the path in the order they are
-encountered.
+encountered.
\begin{codeexample}[]
\tikz \fill[fill=examplefill]
@@ -87,7 +86,7 @@ The syntax for specifying nodes is the following:
after |at| and not, as would normally be the case, at the last
position. The |at| syntax is not available when a node is given
inside a path operation (it would not make any sense, there).
-
+
The |(|\meta{name}|)| is a name for later reference and it is
optional. You may also add the option |name=|\meta{name} to the
\meta{option} list; it has the same effect.
@@ -99,7 +98,7 @@ The syntax for specifying nodes is the following:
can name a node just |1| or perhaps |start of chart| or even
|y_1|. Your node name should \emph{not} contain any punctuation like
a dot, a comma, or a colon since these are used to detect what kind
- of coordinate you mean when you reference a node.
+ of coordinate you mean when you reference a node.
\end{key}
\begin{key}{/tikz/alias=\meta{another node name}}
@@ -110,7 +109,7 @@ The syntax for specifying nodes is the following:
\end{key}
\begin{key}{/tikz/at=\meta{coordinate}}
- This is another way of specifying ath |at| coordinate. Note that,
+ This is another way of specifying the |at| coordinate. Note that,
typically, you will have to enclose the \meta{coordinate} in curly
braces so that a comma inside the \meta{coordinate} does not
confuse \TeX.
@@ -125,7 +124,7 @@ The syntax for specifying nodes is the following:
node (unless some special other options are used, deep sigh).
As mentioned before, we can add a border and even a background to a
- node:
+ node:
\begin{codeexample}[]
\tikz \fill[fill=examplefill]
(0,0) node {first node}
@@ -136,8 +135,8 @@ The syntax for specifying nodes is the following:
The ``border'' is actually just a special case of a much more general
mechanism. Each node has a certain \emph{shape} which, by default, is
a rectangle. However, we can also ask \tikzname\ to use a circle shape
- instead or an ellipse shape (you have to include |pgflibraryshapes| for
- the latter shape):
+ instead or an ellipse shape (you have to include one of the
+ |shapes.geometric| library for the latter shape):
\begin{codeexample}[]
\tikz \fill[fill=examplefill]
@@ -164,15 +163,15 @@ The syntax for specifying nodes is the following:
check whether this option is the name of some shape. If so, that
shape is selected as if you had said |shape=|\meta{shape name}.
- By default, the following shapes are available: |rectangle|,
+ By default, the following shapes are available: |rectangle|, % this par has to be adapted: no more shapes library available, only several sublibraries
|circle|, |coordinate|, and, when the package |pgflibraryshapes| is
loaded, also |ellipse|. Details of these shapes, like their anchors
and size options, are discussed in Section~\ref{section-the-shapes}.
\end{key}
-
+
The following styles influences how nodes are rendered:
\begin{stylekey}{/tikz/every node (initially \normalfont empty)}
- This style is installed at the beginning of every node.
+ This style is installed at the beginning of every node.
\begin{codeexample}[]
\begin{tikzpicture}[every node/.style={draw}]
\draw (0,0) node {A} -- (1,1) node {B};
@@ -185,7 +184,7 @@ The syntax for specifying nodes is the following:
rectangle nodes, and so on.
\begin{codeexample}[]
\begin{tikzpicture}
- [every rectangle node/.style={draw},
+ [every rectangle node/.style={draw},
every circle node/.style={draw,double}]
\draw (0,0) node[rectangle] {A} -- (1,1) node[circle] {B};
\end{tikzpicture}
@@ -199,7 +198,7 @@ There is a special syntax for specifying ``light-weighed'' nodes:
This has the same effect as
|node[shape=coordinate][|\meta{options}|](|\meta{name}|)at(|\meta{coordinate}|){}|,
-
+
where the |at| part might be missing.
\end{pathoperation}
@@ -232,7 +231,7 @@ special commands for creating paths containing only a node:
\end{itemize}
By loading library packages, you can define more shapes like ellipses
or diamonds; see Section~\ref{section-libs-shapes} for the complete
-list of shapes.
+list of shapes.
\label{section-tikz-coordinate-shape}
The |coordinate| shape is handled in a special way by \tikzname. When
@@ -241,14 +240,14 @@ this has the same effect as if you had said |(x.center)|. None of the
special ``line shortening rules'' apply in this case. This can be
useful since, normally, the line shortening causes paths to be
segmented and they cannot be used for filling. Here is an example that
-demonstrates the difference:
+demonstrates the difference:
\begin{codeexample}[]
\begin{tikzpicture}[every node/.style={draw}]
\path[yshift=1.5cm,shape=rectangle]
(0,0) node(a1){} (1,0) node(a2){}
(1,1) node(a3){} (0,1) node(a4){};
\filldraw[fill=examplefill] (a1) -- (a2) -- (a3) -- (a4);
-
+
\path[shape=coordinate]
(0,0) coordinate(b1) (1,0) coordinate(b2)
(1,1) coordinate(b3) (0,1) coordinate(b4);
@@ -278,7 +277,7 @@ shapes:
to make it a bit ``larger.''
For those familiar with \textsc{css}, this is the same as
- \emph{padding}.
+ \emph{padding}.
\begin{codeexample}[]
\begin{tikzpicture}
@@ -297,7 +296,7 @@ shapes:
\begin{key}{/pgf/inner ysep=\meta{dimension} (initially .3333em)}
\keyalias{tikz}
Specifies the inner separation in the $y$-direction, only.
-\end{key}
+\end{key}
\begin{key}{/pgf/outer sep=\meta{dimension} (initially .5\string\pgflinewidth)}
\keyalias{tikz}
@@ -313,7 +312,7 @@ shapes:
exactly on the ``outside border'' of the path (not on the path
itself). When the shape is filled, but not drawn, this may not be
desirable. In this case, the |outer sep| should be set to zero
- point.
+ point.
\begin{codeexample}[]
\begin{tikzpicture}
\draw[line width=5pt]
@@ -321,7 +320,7 @@ shapes:
(2,0) node[inner sep=.5\pgflinewidth+2pt,draw] (d) {drawn};
\draw[->] (1,-1) -- (f);
- \draw[->] (1,-1) -- (d);
+ \draw[->] (1,-1) -- (d);
\end{tikzpicture}
\end{codeexample}
\end{key}
@@ -341,7 +340,7 @@ shapes:
This option ensures that the height of the shape (including the
inner, but ignoring the outer separation) will be at least
\meta{dimension}. Thus, if the text plus the inner separation is not
- at least as large as \meta{dimension}, the shape will be enlarged
+ at least as large as \meta{dimension}, the shape will be enlarged
appropriately. However, if the text is already larger than
\meta{dimension}, the shape will not be shrunk.
\begin{codeexample}[]
@@ -387,12 +386,12 @@ shapes:
\label{section-rotating-shape-borders}
-Some shapes (but not all), support a special kind of rotation. This
-rotation affects only the border of a shape and is independent of the
+Some shapes (but not all), support a special kind of rotation. This
+rotation affects only the border of a shape and is independent of the
node contents, but \emph{in addition} to any other transformations.
\begin{codeexample}[]
-\tikzstyle{every node}=[dart, shape border uses incircle,
+\tikzstyle{every node}=[dart, shape border uses incircle,
inner sep=1pt, draw]
\begin{tikzpicture}
\foreach \a/\b/\c in {A/0/0, B/45/0, C/0/45, D/45/45}
@@ -400,22 +399,22 @@ node contents, but \emph{in addition} to any other transformations.
\end{tikzpicture}
\end{codeexample}
-There are two types of rotation: restricted and unrestricted. Which
-type of rotation is applied is determined by on how the shape border
-is constructed. If the shape border is contructed using an incircle,
-that is, a circle that tightly fits the node contents (including
+There are two types of rotation: restricted and unrestricted. Which
+type of rotation is applied is determined by on how the shape border
+is constructed. If the shape border is constructed using an incircle,
+that is, a circle that tightly fits the node contents (including
the |inner sep|), then the rotation can be unrestricted. If, however,
the border is constructed using the natural dimensions of the node
-contents, the rotation is restricted to integer multiples of 90
+contents, the rotation is restricted to integer multiples of 90
degrees.
Why should there be two kinds of rotation and border construction?
Borders constructed using the natural dimensions of the node contents
-provide a much tighter fit to the node contents, but to maintain
-this tight fit, the border rotation must be restricted to integer
+provide a much tighter fit to the node contents, but to maintain
+this tight fit, the border rotation must be restricted to integer
multiples of 90 degrees. By using an incircle, unrestricted rotation
is possible, but the border will not make a very tight fit to the
-node contents.
+node contents.
\begin{codeexample}[]
\tikzstyle{every node}=[isosceles triangle, draw]
@@ -425,16 +424,16 @@ node contents.
\end{tikzpicture}
\end{codeexample}
-There are \pgfname{} keys determine how a shape border is
-contructed, and to specify its rotation.
-It should be noted that not all shapes support these keys, so
-reference should be made to the documentation for individual
-shapes.
+There are \pgfname{} keys determine how a shape border is
+constructed, and to specify its rotation.
+It should be noted that not all shapes support these keys, so
+reference should be made to the documentation for individual
+shapes.
\begin{key}{/pgf/shape border uses incircle=\opt{\meta{boolean}}
(default true)}
\keyalias{tikz}
- Determines if the border of a shape is constructed using the
+ Determines if the border of a shape is constructed using the
incircle. If no value is given \meta{boolean} will take the default
value |true|.
\end{key}
@@ -443,15 +442,15 @@ shapes.
\begin{key}{/pgf/shape border rotate=\meta{angle} (initially 0)}
\keyalias{tikz}
Rotates the border of a shape independently of the node contents,
- but in addition to any other transformations. If the shape
+ but in addition to any other transformations. If the shape
border is not constructed using the incircle, the rotation will be
rounded to the nearest integer multiple of 90 degrees when the
- shape is drawn.
+ shape is drawn.
\end{key}
-Note that if the border of the shape is rotated,
-the compass point anchors, and `text box' anchors (including
-|mid east|, |base west|, and so on), \emph{do not rotate}, but the
+Note that if the border of the shape is rotated,
+the compass point anchors, and `text box' anchors (including
+|mid east|, |base west|, and so on), \emph{do not rotate}, but the
other anchors do:
\begin{codeexample}[]
@@ -459,7 +458,7 @@ other anchors do:
\begin{tikzpicture}
\node at (0,0) (A) {A};
\node [shape border rotate=30] at (1.5,0) (B) {B};
- \foreach \s/\t in
+ \foreach \s/\t in
{left side/base east, bottom side/north, bottom left corner/base}{
\fill[red] (A.\s) circle(1.5pt) (B.\s) circle(1.5pt);
\fill[blue] (A.\t) circle(1.5pt) (B.\t) circle(1.5pt);
@@ -467,10 +466,10 @@ other anchors do:
\end{tikzpicture}
\end{codeexample}
-Finally, a somewhat unfortunate side-effect of rotating shape borders
-is that the supporting shapes do not distinguish between
-|outer xsep| and |outer ysep|, and typically, the larger of the
-two values will be used.
+Finally, a somewhat unfortunate side-effect of rotating shape borders
+is that the supporting shapes do not distinguish between
+|outer xsep| and |outer ysep|, and typically, the larger of the
+two values will be used.
@@ -494,13 +493,14 @@ lower level, \pgfname\ provides a system for specifying that a shape
consists of several parts. On the \tikzname\ level, you specify the
different node parts by using the following command:
-\begin{command}{\nodepart\marg{part name}}
+\begin{command}{\nodepart\opt{|[|\meta{options}|]|}\marg{part name}}
This command can only be used inside the \meta{text} argument of a
|node| path operation. It works a little bit like a |\part| command
in \LaTeX. It will stop the typesetting of whatever node part was
typeset until now and then start putting all following text into the
node part named \meta{part name}---until another |\partname| is
- encountered or until the node \meta{text} ends.
+ encountered or until the node \meta{text} ends. The \meta{options}
+ will be local to this part.
\begin{codeexample}[]
\begin{tikzpicture}
@@ -508,7 +508,7 @@ different node parts by using the following command:
{
% No \nodepart has been used, yet. So, the following is put in the
% ``text'' node part by default.
- $q_1$
+ $q_1$
\nodepart{lower} % Ok, end ``text'' part, start ``output'' part
$00$
}; % output part ended.
@@ -521,7 +521,7 @@ different node parts by using the following command:
\begin{stylekey}{/tikz/every \meta{part name} node part (initially
\normalfont empty)}
This style is installed at the beginning of every node part named
- \meta{part name}.
+ \meta{part name}.
\begin{codeexample}[]
\tikz [every lower node part/.style={red}]
\node [circle split,draw] {$q_1$ \nodepart{lower} $00$};
@@ -531,13 +531,15 @@ different node parts by using the following command:
-\subsection{Options for the Text in Nodes}
+\subsection{The Node Text}
\label{section-nodes-options}
+\subsubsection{Text Parameters: Color and Opacity}
+
The simplest option for the text in nodes is its color. Normally, this
color is just the last color installed using |color=|, possibly
-inherited from another scope. However, it is possible to specificly
+inherited from another scope. However, it is possible to specifically
set the color used for text using the following option:
\begin{key}{/tikz/text=\meta{color}}
@@ -556,10 +558,12 @@ Just like the color itself, you may also wish to set the opacity of
the text only. For this, use the option |text opacity| option, which
is detailed in Section~\ref{section-tikz-transparency}.
+\subsubsection{Text Parameters: Font}
+
Next, you may wish to adjust the font used for the text. Use the
following option for this:
\begin{key}{/tikz/font=\meta{font commands}}
- Sets the font used for text labels.
+ Sets the font used for text labels.
\begin{codeexample}[]
\begin{tikzpicture}
\draw[font=\itshape] (1,0) -- +(1,1) node[above] {italic};
@@ -568,92 +572,244 @@ following option for this:
A perhaps more useful example is the following:
\begin{codeexample}[]
-\tikz [every text node part/.style={font=\itshape},
+\tikz [every text node part/.style={font=\itshape},
every lower node part/.style={font=\footnotesize}]
\node [circle split,draw] {state \nodepart{lower} output};
\end{codeexample}
\end{key}
+
+\subsubsection{Text Parameters: Alignment and Width for Multi-Line Text}
+
Normally, when a node is typeset, all the text you give in the braces
-is but in one long line (in an |\hbox|, to be precise) and the node
+is put in one long line (in an |\hbox|, to be precise) and the node
will become as wide as necessary.
-You can change this behaviour using the following options. They allow
-you to limit the width of a node (naturally, at the expense of its
-height).
+From time to time you may wish to create nodes that contain multiple
+lines of text. There are three different ways of achieving this:
+\begin{enumerate}
+\item Inside the node, you can put some standard environment that
+ produces multi-line, aligned text. For instance, you can use a
+ |{tabular}| inside a node:
+\begin{codeexample}[]
+\tikz \node [draw] {
+ \begin{tabular}{cc}
+ upper left & upper right\\
+ lower left & lower right
+ \end{tabular}
+};
+\end{codeexample}
+ This approach offers the most flexibility in the sense that it
+ allows you to use all of the alignment commands offered by your
+ format of choice.
+\item You use |\\| inside your node to mark the end of lines and then
+ request \tikzname\ to arrange these lines in some manner. This will
+ only be done, however, if the |align| option has been given.
+\begin{codeexample}[]
+\tikz[align=left] \node[draw] {This is a\\demonstration.};
+\end{codeexample}
+\begin{codeexample}[]
+\tikz[align=center] \node[draw] {This is a\\demonstration.};
+\end{codeexample}
+ The |\\| command takes an optional extra space as an argument in square
+ brackets.
+\begin{codeexample}[]
+\tikz \node[fill=examplefill,align=right]
+ {This is a\\[-2pt] demonstration text for\\[1ex] alignments.};
+\end{codeexample}
+\item You can request that \tikzname\ does an automatic line-breaking
+ for you inside the node by specifying a fixed |text width| for the
+ node. In this case, you can still use |\\| to enforce a
+ line-break. Note that when you specify a text width, the node will
+ have this width, independently of whether the text actually
+ ``reaches the end'' of the node.
+\end{enumerate}
+Let us now first have a look at the |text width| command.
\begin{key}{/tikz/text width=\meta{dimension}}
This option will put the text of a node in a box of the given width
- (more precisely, in a |{minipage}| of this width; for plain \TeX\ a
- rudimentary ``minipage emulation'' is used).
-
- If the node text is not as wide as \meta{dimension}, it will
- nevertheless be put in a box of this width. If it is larger, line
- breaking will be done.
+ (something akin to a |{minipage}| of this width, only portable
+ across formats). If the node text is not as wide as
+ \meta{dimension}, it will nevertheless be put in a box of this
+ width. If it is larger, line breaking will be done.
By default, when this option is given, a ragged right border will be
- used. This is sensible since, typically, these boxes are narrow and
- justifying the text looks ugly.
+ used (|align=left|). This is sensible since, typically, these boxes
+ are narrow and justifying the text looks ugly. You can, however,
+ change the alignment using |align| or directly using commands line
+ |\centering|.
\begin{codeexample}[]
\tikz \draw (0,0) node[fill=examplefill,text width=3cm]
- {This is a demonstration text for showing how line breaking works.};
+ {This is a demonstration text for showing how line breaking works.};
\end{codeexample}
+ Setting \meta{dimension} to an empty string causes the automatic
+ line breaking to be disabled.
\end{key}
-\begin{key}{/tikz/text justified}
- Causes the text to be justified instead of (right)ragged. Use this
- only with pretty broad nodes.
-{%
-\hbadness=10000
+\begin{key}{/tikz/align=\meta{how}}
+ This key is used to setup an alignment for multi-line text inside a
+ node. If |text width| is set to some width (let us call this
+ \emph{alignment with line breaking}), the |align| key will
+ setup the |\leftskip| and the |\rightskip| in such a way that the
+ text is broken and aligned according to \meta{how}. If |text width|
+ is not set (that is, set to the empty string; let us call this
+ \emph{alignment without line breaking}), then a different
+ mechanism is used internally, namely the key |node halign header|, is
+ set to an appropriate value. While this key, which is documented
+ below, is not to be used by beginners, the net effect is simple:
+ When |text width| is not set, you can use |\\| to break lines and
+ align them according to \meta{how} and the resulting node's width
+ will be minimal to encompass the resulting lines.
+
+ In detail, you can set \meta{how} to one of the following values:
+ \begin{description}
+ \item[|align=|\declare{|left|}]
+ For alignment without line breaking, the different lines are simply
+ aligned such that their left borders are below one another.
\begin{codeexample}[]
-\tikz \draw (0,0) node[fill=examplefill,text width=3cm,text justified]
- {This is a demonstration text for showing how line breaking works.};
+\tikz \node[fill=examplefill,align=left]
+ {This is a\\ demonstration text for\\ alignments.};
+\end{codeexample}
+ For alignment with line breaking, the same will happen only
+ the lines will now, additionally, be broken automatically:
+\begin{codeexample}[]
+\tikz \node[fill=examplefill,text width=3cm,align=left]
+ {This is a demonstration text for showing how line breaking works.};
\end{codeexample}
-}
- In the above example, \TeX\ complains (rightfully) about three very
- badly typeset lines. (For this manual I asked \TeX\ to stop
- complaining by using |\hbadness=10000|, but this is a foul deed,
- indeed.)
-\end{key}
-\begin{key}{/tikz/text ragged}
- Causes the text to be typeset with a ragged right. This uses the
- original plain \TeX\ definition of a ragged right border, in which
- \TeX\ will try to balance the right border as well as possible. This
- is the default.
+ \item[|align=|\declare{|flush left|}]
+ For alignment without line breaking this option has exactly the
+ same effect as |left|. However, for alignment with line breaking,
+ there is a difference: While |left| uses the
+ original plain \TeX\ definition of a ragged right border, in which
+ \TeX\ will try to balance the right border as well as possible,
+ |flush left| causes the right border to be ragged in the
+ \LaTeX-style, in which no balancing occurs. This looks ugly, but
+ it may be useful for very narrow boxes and when you wish to avoid
+ hyphenations.
\begin{codeexample}[]
-\tikz \draw (0,0) node[fill=examplefill,text width=3cm,text ragged]
- {This is a demonstration text for showing how line breaking works.};
+\tikz \node[fill=examplefill,text width=3cm,align=flush left]
+ {This is a demonstration text for showing how line breaking works.};
\end{codeexample}
-\end{key}
-\begin{key}{/tikz/text badly ragged}
- Causes the right border to be ragged in the \LaTeX-style, in which
- no balancing occurs. This looks ugly, but it may be useful for very
- narrow boxes and when you wish to avoid hyphenations.
+ \item[|align=|\declare{|right|}]
+ Works like |left|, only for right alignment.
\begin{codeexample}[]
-\tikz \draw (0,0) node[fill=examplefill,text width=3cm,text badly ragged]
- {This is a demonstration text for showing how line breaking works.};
+\tikz \node[fill=examplefill,align=right]
+ {This is a\\ demonstration text for\\ alignments.};
+\end{codeexample}
+\begin{codeexample}[]
+\tikz \node[fill=examplefill,text width=3cm,align=right]
+ {This is a demonstration text for showing how line breaking works.};
\end{codeexample}
-\end{key}
-\begin{key}{/tikz/text centered}
- Centers the text, but tries to balance the lines.
+ \item[|align=|\declare{|flush right|}]
+ Works like |flush left|, only for right alignment.
\begin{codeexample}[]
-\tikz \draw (0,0) node[fill=examplefill,text width=3cm,text centered]
- {This is a demonstration text for showing how line breaking works.};
+\tikz \node[fill=examplefill,text width=3cm,align=flush right]
+ {This is a demonstration text for showing how line breaking works.};
\end{codeexample}
-\end{key}
-\begin{key}{/tikz/text badly centered}
- Centers the text, without balancing the lines.
+ \item[|align=|\declare{|center|}]
+ Works like |left| or |right|, only for centered alignment.
+\begin{codeexample}[]
+\tikz \node[fill=examplefill,align=center]
+ {This is a\\ demonstration text for\\ alignments.};
+\end{codeexample}
\begin{codeexample}[]
-\tikz \draw (0,0) node[fill=examplefill,text width=3cm,text badly centered]
- {This is a demonstration text for showing how line breaking works.};
+\tikz \node[fill=examplefill,text width=3cm,align=center]
+ {This is a demonstration text for showing how line breaking works.};
\end{codeexample}
+
+ \item[|align=|\declare{|flush center|}]
+ Works like |flush left| or |flush right|, only for center alignment.
+\begin{codeexample}[]
+\tikz \node[fill=examplefill,text width=3cm,align=flush center]
+ {This is a demonstration text for showing how line breaking works.};
+\end{codeexample}
+
+ \item[|align=|\declare{|justify|}]
+ For alignment without line breaking, this has the same effect as
+ |left|. For alignment with line breaking, this causes the text to
+ be ``justified.'' Use this
+ only with pretty broad nodes.
+{%
+\hbadness=10000
+\begin{codeexample}[]
+\tikz \node[fill=examplefill,text width=3cm,align=justify]
+ {This is a demonstration text for showing how line breaking works.};
+\end{codeexample}
+}
+ In the above example, \TeX\ complains (rightfully) about three very
+ badly typeset lines. (For this manual I asked \TeX\ to stop
+ complaining by using |\hbadness=10000|, but this is a foul deed,
+ indeed.)
+
+ \item[|align=|\declare{|none|}]
+ Disables all alignments and |\\| will not be redefined.
+ \end{description}
\end{key}
+
+\begin{key}{/tikz/node halign header=\meta{macro storing a header} (initially
+ \normalfont empty)}
+ This is the key that is used by |align| internally for alignment
+ without line breaking. Read the following only if you are familiar
+ with the |\halign| command.
+
+ This key only has an effect if |text width|
+ is empty, otherwise it is ignored. Furthermore, if \meta{header} is
+ empty, then this key also has no effect. So, suppose |text width| is
+ empty, but \meta{header} is not. In this case the following happens:
+
+ When the node text is parsed, the command |\\| is redefined
+ internally. This redefinition is done in such a way that the text
+ from the start of the node to the first occurrence of |\\| is put in
+ an |\hbox|. Then the text following |\\| up to the next |\\| is put
+ in another |\hbox|. This goes on until the text between the last
+ |\\| and the closing |}| is also put in an |\hbox|.
+
+ The \meta{macro storing a header} should be a macro that contains
+ some text suitable for use as a header for the |\halign|
+ command. For instance, you might define
+\begin{codeexample}[code only]
+\def\myheader{\hfil\hfil##\hfil\cr}
+\tikz [node halign header=\myheader] ...
+\end{codeexample}
+ You cannot just say |node halign header=\hfil\hfil#\hfil\cr| because
+ this confuses \TeX\ inside matrices, so this detour via a macro is
+ needed.
+
+ Next, conceptually, all these boxes are recursively put inside an
+ |\halign| command. Assuming that \meta{first} is the first of the
+ above boxes, the command |\halign{|\meta{header} |\box|\meta{first}
+ |\cr}| is used to create a new box, which we will call the
+ \meta{previous box}. Then, the following box is created, where
+ \meta{second} is the second input box:
+ |\halign{|\meta{header} |\box|\meta{previous box} |\cr|
+ |\box|\meta{second}|\cr}|. Let us call the resulting box the
+ \meta{previous box} once more. Then the next box that is created is
+ |\halign{|\meta{header} |\box|\meta{previous box} |\cr|
+ |\box|\meta{third}|\cr}|.
+
+ All of this means that if \meta{header} is an |\halign| header
+ like |\hfil#\hfil\cr|, then all boxes will be centered relative to
+ one another. Similarly, a \meta{header} of |\hfil#\cr| causes the
+ text to be flushed right.
+
+ Note that this mechanism is not flexible enough to all multiple
+ columns inside \meta{header}. You will have to use a |tabular| or a
+ |matrix| in such cases.
+
+ One further note: Since the text of each line is placed in a box,
+ settings will be local to each ``line.'' This is very similar to the
+ way a cell in a |tabular| or a |matrix| behaves.
+\end{key}
+
+
+\subsubsection{Text Parameters: Height and Depth of Text}
+
In addition to changing the width of nodes, you can also change the
height of nodes. This can be done in two ways: First, you can use the
option |minimum height|, which ensures that the height of the whole
@@ -677,20 +833,19 @@ special situations.
write |text height=| without specifying anything, the ``natural''
size of the text box remains unchanged.
\begin{codeexample}[]
-\tikz \node[draw] {y};
-\tikz \node[draw,text height=10pt] {y};
+\tikz \node[draw] {y};
+\tikz \node[draw,text height=10pt] {y};
\end{codeexample}
\end{key}
\begin{key}{/tikz/text depth=\meta{dimension}}
This option works like |text height|, only for the depth of the text
box. This option is mostly useful when you need to ensure a uniform
- depth of text boxes that need to be aligned.
+ depth of text boxes that need to be aligned.
\end{key}
-
\subsection{Positioning Nodes}
\label{section-nodes-anchors}
@@ -747,7 +902,7 @@ position.
directions.'' Furthermore, the standard shapes also define a |base|
anchor, as well as |base west| and |base east|, for placing things on
the baseline of the text.
-
+
The standard shapes also define a |mid| anchor (and |mid west| and
|mid east|). This anchor is half the height of the character ``x''
above the base line. This anchor is useful for vertically centering
@@ -778,7 +933,7 @@ more intuitively:
\begin{key}{/tikz/above=\meta{offset} (default 0pt)}
Does the same as |anchor=south|. If the \meta{offset} is specified,
the node is additionally shifted upwards by the given
- \meta{offset}.
+ \meta{offset}.
\begin{codeexample}[]
\tikz \fill (0,0) circle (2pt) node[above] {above};
\end{codeexample}
@@ -806,7 +961,7 @@ more intuitively:
takes an \meta{offset} parameter, but using this parameter without
using the |positioning| library is deprecated. (The |positioning|
library changes the meaning of this parameter to something more
- sensible.)
+ sensible.)
\begin{codeexample}[]
\tikz \fill (0,0) circle (2pt) node[above left] {above left};
\end{codeexample}
@@ -831,7 +986,7 @@ more intuitively:
% as the options without |of|, however, their parameter is different:
% You must provide the name of another node. The current node will then
% be placed, say, above this specified node at a distance given by the
-% option |node distance|.
+% option |node distance|.
% \begin{key}{/tikz/above of=\meta{node}}
% This option causes the node to be placed at the distance
% |node distance| above of \meta{node}. The anchor is |center|.
@@ -874,7 +1029,7 @@ more intuitively:
% \begin{key}{/tikz/node distance=\meta{dimension}}
% Sets the distance between nodes that are placed using the
% |... of| options. Note that this distance is the distance between
-% the centers of the nodes, not the distance between their borders.
+% the centers of the nodes, not the distance between their borders.
% \end{key}
@@ -895,7 +1050,7 @@ differently.
\begin{key}{/tikz/above=\opt{\meta{specification}} (default 0pt)}
With the |positioning| library loaded, the |above| option does not
- take a simple \meta{dimension} as its paramter. Rather, it can
+ take a simple \meta{dimension} as its parameter. Rather, it can
(also) take a more elaborate \meta{specification} as parameter. This
\meta{specification} has the following general form: It starts with
an optional \meta{shifting part} and is followed by an optional
@@ -957,14 +1112,14 @@ differently.
|of somenode.north| or |of 2,3|. In this case, the
following happens: First, the node's |at| parameter is set to the
\meta{coordinate}. Second, the node is shifted according to the
- \meta{shift-part}. Third, the anchor is set to |south|.
+ \meta{shift-part}. Third, the anchor is set to |south|.
Here is a basic example:
\begin{codeexample}[]
\begin{tikzpicture}[every node/.style=draw]
\draw[help lines] (0,0) grid (2,2);
\node (somenode) at (1,1) {some node};
-
+
\node [above=5mm of somenode.north east] {\tiny 5mm of somenode.north east};
\node [above=1cm of somenode.north] {\tiny 1cm of somenode.north};
\end{tikzpicture}
@@ -978,13 +1133,13 @@ differently.
rather the value of the |node distance| key is used, see below.
\item The \meta{of-part} can have be |of |\meta{node name}. An
example would be |of somenode|. In this case, the following
- usually happens:
+ usually happens:
\begin{itemize}
\item The anchor is set to |south|.
\item The node is shifted according to the \meta{shifting part}
or, if it is missing, according to the value of |node distance|.
\item The node's |at| parameter is set to \meta{node
- name}|.north|.
+ name}|.north|.
\end{itemize}
The net effect of all this is that the new node will be placed in
such a way that the distance between is south border and
@@ -993,7 +1148,7 @@ differently.
\begin{tikzpicture}[every node/.style=draw]
\draw[help lines] (0,0) grid (2,2);
\node (some node) at (1,1) {some node};
-
+
\node (other node) [above=1cm of some node] {\tiny above=1cm of some node};
\draw [<->] (some node.north) -- (other node.south)
@@ -1013,7 +1168,7 @@ differently.
will be placed in such a way that its center is 1cm above the
center of |somenode|. Repeatedly placing nodes in this way will
result in nodes that are centered on ``grid coordinate,'' hence
- the name of the option.
+ the name of the option.
\begin{codeexample}[]
\begin{tikzpicture}[every node/.style=draw]
\draw[help lines] (0,0) grid (2,3);
@@ -1035,7 +1190,7 @@ differently.
\begin{key}{/tikz/node distance=\meta{shifting part} (initially 1cm and 1cm)}
The value of this key is used as \meta{shifting part} is used if
and only if a \meta{of-part} is present, but no \meta{shifting
- part}.
+ part}.
\begin{codeexample}[]
\begin{tikzpicture}[every node/.style=draw,node distance=5mm]
\draw[help lines] (0,0) grid (2,3);
@@ -1095,7 +1250,7 @@ differently.
left. A more mathematical way of phrasing this is the following: A
plain \meta{dimension} is measured in the $l_2$-norm, while a
\meta{dimension}| and |\meta{dimension} is measured in the
- $l_1$-norm.
+ $l_1$-norm.
\end{enumerate}
The following example should help to illustrate the difference:
\begin{codeexample}[]
@@ -1116,7 +1271,7 @@ differently.
\node [below left=of b] {7}; \node [below right=of b] {8};
\end{scope}
\end{tikzpicture}
-\end{codeexample}
+\end{codeexample}
\begin{codeexample}[]
\begin{tikzpicture}[every node/.style={draw,rectangle}]
\draw[help lines] (0,0) grid (2,5);
@@ -1135,7 +1290,7 @@ differently.
\node [below left=of b] {7}; \node [below right=of b] {8};
\end{scope}
\end{tikzpicture}
-\end{codeexample}
+\end{codeexample}
\begin{codeexample}[]
\begin{tikzpicture}[every node/.style={draw,rectangle},on grid]
\draw[help lines] (0,0) grid (4,4);
@@ -1154,7 +1309,7 @@ differently.
\node [below left=of b] {7}; \node [below right=of b] {8};
\end{scope}
\end{tikzpicture}
-\end{codeexample}
+\end{codeexample}
\end{key}
\begin{key}{/tikz/below left=\opt{\meta{specification}}}
@@ -1183,12 +1338,12 @@ keys:
\node (X) at (0,1) {X};
\node (a) [right=of X] {a};
\node (y) [right=of a] {y};
-
+
\node (X) at (0,0) {X};
\node (a) [base right=of X] {a};
\node (y) [base right=of a] {y};
\end{tikzpicture}
-\end{codeexample}
+\end{codeexample}
\end{key}
\begin{key}{/tikz/base right=\opt{\meta{specification}}}
Works like |base left|.
@@ -1213,7 +1368,7 @@ library and the |matrix| library. The first is mostly useful for
creating ``chains of nodes'' and, more generally, ``flows.'' The
second allows you to arrange multiple nodes in rows and columns. These
methods for positioning nodes are described in two separate
-Sections~\ref{section-matrices} and~\ref{section-chains}.
+Sections~\ref{section-matrices} and~\ref{section-chains}.
\subsection{Fitting Nodes to a Set of Coordinates}
@@ -1225,7 +1380,7 @@ given using anchors and size parameters, rather one would sometimes
have a box be placed and be sized such that it ``is just large enough
to contain this, that, and that point.'' This situation typically
arises when a picture has been drawn an, afterwards, parts of the
-picture are supposed to be encircled or hilighted.
+picture are supposed to be encircled or highlighted.
In this situation the |fit| option from the |fit| library is useful,
see Section~\ref{section-library-fit} for a the details. The idea is
@@ -1295,7 +1450,7 @@ example, it certainly sometimes makes sense to rotate a node by
You can give transformation option \emph{inside} the option list of
the node. \emph{These} transformations always apply to the node.
\begin{codeexample}[]
-\begin{tikzpicture}[every node/.style={draw}]
+\begin{tikzpicture}[every node/.style={draw}]
\draw[help lines](0,0) grid (3,2);
\draw (1,0) node{A}
(2,0) node[rotate=90,scale=1.5] {B};
@@ -1332,7 +1487,7 @@ ways are described in the following.
dictates how ``far'' on the line the point should be. A
\meta{fraction} or 0 is the previous coordinate, 1 is the current
one, everything else is in between. In particular, 0.5 is the
- middle.
+ middle.
Now, what is ``the previous line''? This depends on the previous
path construction operation.
@@ -1354,7 +1509,7 @@ ways are described in the following.
connect the start and end points to the control points). The exact
math is a bit complicated (depending on your point of view, of
course); you may wish to consult a good book on computer graphics
- and Bézier curves if you are intrigued.
+ and Bézier curves if you are intrigued.
\begin{codeexample}[]
\tikz \draw (0,0) .. controls +(right:3.5cm) and +(right:3.5cm) .. (0,3)
\foreach \p in {0,0.125,...,1} {node[pos=\p]{\p}};
@@ -1376,7 +1531,7 @@ ways are described in the following.
For all other path construction operations, \emph{the position
placement does not work}, currently. This will hopefully change in
- the future (especially for the arc operation).
+ the future (especially for the arc operation).
\end{key}
\begin{key}{/tikz/auto=\meta{left or right} (default \normalfont is scope's setting)}
@@ -1392,7 +1547,7 @@ ways are described in the following.
|anchor| option or by one of the |above|, |below|, etc.\ options.
This option only has an effect for nodes that are placed on lines or
- curves.
+ curves.
\begin{codeexample}[]
\begin{tikzpicture}
@@ -1419,7 +1574,7 @@ ways are described in the following.
|right| is set instead and the other way round.
\begin{codeexample}[]
\begin{tikzpicture}[auto]
- \draw[help lines,use as bounding box] (0,-.5) grid (4,5);
+ \draw[help lines,use as bounding box] (0,-.5) grid (4,5);
\draw (0.5,0) .. controls (9,6) and (-5,6) .. (3.5,0)
\foreach \pos in {0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1}
@@ -1449,7 +1604,7 @@ ways are described in the following.
\begin{key}{/tikz/sloped}
This option causes the node to be rotated such that a horizontal
- line becomes a tangent to the curve. The rotation is normally
+ line becomes a tangent to the curve. The rotation is normally
done in such a way that text is never ``upside down.'' To get
upside-down text, use can use |[rotate=180]| or
|[allow upside down]|, see below.
@@ -1467,7 +1622,7 @@ ways are described in the following.
\begin{key}{/tikz/allow upside down=\meta{boolean} (default true, initially false)}
- If set to |true|, \tikzname\ will not ``righten'' upside down text.
+ If set to |true|, \tikzname\ will not ``righten'' upside down text.
\begin{codeexample}[]
\tikz [allow upside down]
\draw (0,0) .. controls +(up:2cm) and +(left:2cm) .. (1,3)
@@ -1536,7 +1691,7 @@ What happens is the following: The syntax of the line-to path
operation is actually |--|
\opt{|node|\meta{node specification}}\meta{coordinate}. (It is even
possible to give multiple nodes in this way.) When the optional
-|node| is encountered, that is,
+|node| is encountered, that is,
when the |--| is directly followed by |node|, then the
specification(s) are read and ``stored away.'' Then, after the
\meta{coordinate} has finally been reached, they are inserted again,
@@ -1559,7 +1714,7 @@ should make this clearer:
\begin{codeexample}[]
\begin{tikzpicture}[near end]
- \draw (0cm,4em) -- (3cm,4em) node{A};
+ \draw (0cm,4em) -- (3cm,4em) node{A};
\draw (0cm,3em) -- node{B} (3cm,3em);
\draw (0cm,2em) -- node[midway] {C} (3cm,2em);
\draw (0cm,1em) -- (3cm,1em) node[midway] {D} ;
@@ -1577,30 +1732,79 @@ the operation with the |pos| option set.
In addition to the |node| path operation, nodes can also be added
using the |label| and the |pin| option. This is mostly useful
-for simple nodes.
+for simple nodes.
-\begin{key}{/tikz/label=\opt{|[|\meta{options}|]|}\meta{angle}|:|\meta{text}}
+\begin{key}{/tikz/label=\opt{|[|\meta{options}|]|\meta{angle}|:|}\meta{text}}
+ \label{label-option}%
When this option is given to a |node| operation, it causes
\emph{another} node to be added to the path after the current node
has been finished. This extra node will have the text
- \meta{text}. It is placed according to the following rule: Suppose
- the |node| currently under construction is called |main node| and let us
- call the label node |label node|. Then the anchor of |label node| is
- placed at |main node.|\meta{angle}. The anchor that is chosen
- depends on the \meta{angle}. If the \meta{angle} lies between
- $-3^\circ$ and $+3^\circ$, then the anchor |west| is chosen, which
- causes |label node| to be placed right of the right end
- |main node|. If \meta{angle} lies between $4^\circ$ and $86^\circ$,
- the anchor |south west| is chosen, causing the |label node| to be
- placed above and right of the |main node|; and so on.
+ \meta{text}. It is placed, in principle, in the direction
+ \meta{angle} relative to the main node, but the exact rules are a
+ bit complex. Suppose the |node| currently under construction is called
+ |main node| and let us call the label node |label node|. Then the
+ following happens:
+ \begin{enumerate}
+ \item The \meta{angle} is used to determine a position on the border
+ of the |main node|. If the \meta{angle} is missing, the value of
+ the following key is used instead:
+ \begin{key}{/tikz/label position=\meta{angle} (initially above)}
+ Sets the default position for labels.
+ \end{key}
+ The \meta{angle} determines the position on the border of the
+ shape in two different ways. Normally, the border position is
+ given by |main node.|\meta{angle}. This means that the
+ \meta{angle} can either be a number like |0| or |-340|, but it can
+ also be an anchor like |north|. Additionally, the special angles
+ |above|, |below|, |left|, |right|, |above left|, and so on are
+ automatically replaced by the corresponding angles |90|, |270|,
+ |180|, |0|, |135|, and so on.
+
+ A special case arises when the following key is set:
+ \begin{key}{/tikz/absolute=\meta{true or false} (default true)}
+ When this key is set, the \meta{angle} is interpreted
+ differently: We still use a point on the border of the
+ |main node|, but the angle is measured ``absolutely,'' that is,
+ an angle of |0| refers to the point on the border that lies on a
+ straight line from the |main node|'s center to the right
+ (relative to the paper, not relative to the local coordinate
+ system or either the node or the scope).
+
+ The difference can be seen in the following example:
+\begin{codeexample}[]
+\tikz [rotate=-80,every label/.style={draw,red}]
+ \node [transform shape,rectangle,draw,label=right:label] {main node};
+\end{codeexample}
+\begin{codeexample}[]
+\tikz [rotate=-80,every label/.style={draw,red},absolute]
+ \node [transform shape,rectangle,draw,label=right:label] {main node};
+\end{codeexample}
+ \end{key}
+ \item Then, an anchor point for the |label node|. It is determined
+ in such a way that the |labe node| will ``face away'' from the
+ border of the |main node|. The anchor that is chosen depends on
+ the position of the border point that is chosen and its position
+ relative to the center of the |main node| and on whether the
+ |transform shape| option is set. In general, the choice should be
+ what you would expect, but you may have to set the anchor yourself
+ in difficult situations.
\begin{codeexample}[]
\tikz
- \node [circle,draw,label=60:$60^\circ$,label=below:$-90^\circ$] {my circle};
+ \node [circle,draw,
+ label=default,
+ label=60:$60^\circ$,
+ label=below:$-90^\circ$] {my circle};
\end{codeexample}
-
- As can be seen in the above example, instead of specifying
- \meta{angle} as a number, it is also possible to use |left|,
- |right|, |above|, |above left|, and so on.
+ \item
+ One \meta{angle} is special: If you set the \meta{angle} to
+ |center|, then the label will be placed on the center of the main
+ node. This is mainly useful for adding a label text to an existing
+ node, especially if it has been rotated.
+\begin{codeexample}[]
+\tikz \node [transform shape,rotate=90,
+ rectangle,draw,label={[red]center:R}] {main node};
+\end{codeexample}
+ \end{enumerate}
You can pass \meta{options} to the node |label node|. For this, you
provide the options in square brackets before the \meta{angle}. If you
@@ -1640,9 +1844,9 @@ for simple nodes.
\begin{key}{/tikz/pin=\opt{|[|\meta{options}|]|}\meta{angle}|:|\meta{text}}
This is option is quite similar to the |label| option, but there is
- one difference: In addition to adding a extra node to the picture,
+ one difference: In addition to adding a extra node to the picture,
it also adds an edge from this node to the main node. This causes
- the node to look like a pin that has been added to the main node:
+ the node to look like a pin that has been added to the main node:
\begin{codeexample}[]
\tikz \node [circle,fill=blue!50,minimum size=1cm,pin=60:$q_0$] {};
\end{codeexample}
@@ -1660,12 +1864,15 @@ for simple nodes.
pin=above:Z] {my circle};
\end{codeexample}
\end{key}
- \begin{stylekey}{/tikz/every pin (initially \normalfont draw=none,fill=none)}
+ \begin{stylekey}{/tikz/every pin (initially {draw=none,fill=none})}
This style is used in every node created by the |pin|
option.
\end{stylekey}
+ \begin{key}{/tikz/pin position=\meta{angle} (initially above)}
+ The default pin position. Works like |label position|.
+ \end{key}
\begin{stylekey}{/tikz/every pin edge (initially help lines)}
- This style is used in every edge created by the |pin| optins.
+ This style is used in every edge created by the |pin| options.
\begin{codeexample}[]
\tikz [pin distance=15mm,
every pin edge/.style={<-,shorten <=1pt,decorate,
@@ -1678,7 +1885,7 @@ for simple nodes.
\begin{key}{/tikz/pin edge=\meta{options} (initially \normalfont empty)}
This option can be used to set the options that are to be used
- in the edge created by the |pin| option.
+ in the edge created by the |pin| option.
\begin{codeexample}[]
\tikz[pin distance=10mm]
\node [circle,draw,pin={[pin edge={blue,thick}]right:X},
@@ -1701,7 +1908,7 @@ for simple nodes.
Once you have defined a node and given it a name, you can use this
name to reference it. This can be done in two ways, see also
Section~\ref{section-node-coordinates}. Suppose you have said
-|\path(0,0) node(x) {Hello World!};| in order to define a node named |x|.
+|\path(0,0) node(x) {Hello World!};| in order to define a node named |x|.
\begin{enumerate}
\item
Once the node |x| has been defined, you can use
@@ -1752,7 +1959,7 @@ The |edge| operation works like a |to| operation that is added after
the main path has been drawn, much like a node is added after the main
path has been drawn. This allows you to have each |edge| to have a
different appearance. As the |node| operation, an |edge| temporarily
-suspends the construction of the current path and a new path $p$ is
+suspends the construction of the current path and a new path $p$ is
constructed. This new path $p$ will be drawn after the main path has
been drawn. Note that $p$ can be totally different from the main
path with respect to its options. Also note that if there are
@@ -1773,22 +1980,22 @@ are encountered on the path.
coordinate is already part of the main path).
The |\tikztostart| is the last coordinate on the path just before
- the |edge| operation, just as for the |node| or |to| operations.
+ the |edge| operation, just as for the |node| or |to| operations.
However, there is one exception to this rule: If the |edge|
operation is directly preceded by a |node| operation, then this
just-declared node is the start coordinate (and not, as would
normally be the case, the coordinate where this just-declared node
is placed -- a small, but subtle difference). In this regard, |edge|
differs from both |node| and |to|.
-
+
If there are several |edge| operations in a row, the start coordinate
- is the same for all of them as their target coordiantes are not,
+ is the same for all of them as their target coordinates are not,
after all, part of the main path. The start coordinate is, thus, the
coordinate preceding the first |edge| operation. This is
similar to nodes insofar as the |edge| operation does not modify the
current path at all. In particular, it does not change the last
coordinate visited, see the following example:
-
+
\begin{codeexample}[]
\begin{tikzpicture}
\node (a) at (0:1) {$a$};
@@ -1797,12 +2004,12 @@ are encountered on the path.
edge [<-] (b);
\node (d) at (270:1) {$d$} edge [->] (a)
edge [dotted] (b)
- edge [<-] (c);
+ edge [<-] (c);
\end{tikzpicture}
\end{codeexample}
A different way of specifying the above graph using the |edge|
- operation is the following:
+ operation is the following:
\begin{codeexample}[]
\begin{tikzpicture}
@@ -1831,14 +2038,14 @@ are encountered on the path.
edge [-,dotted] node[below,sloped] {missing} (d)
(c) edge (a)
edge (d)
- (d) edge [red] node[above,sloped] {very}
+ (d) edge [red] node[above,sloped] {very}
node[below,sloped] {bad} (a);
\end{tikzpicture}
\end{codeexample}
Instead of |every to|, the style |every edge| is installed at the
beginning of the main path.
- \begin{stylekey}{/tikz/every edge (inititially draw)}
+ \begin{stylekey}{/tikz/every edge (inititially draw)} % inititially --> initially? (ff) (this is the definition of the key, so please have a look)
Executed for each |edge|.
\begin{codeexample}[]
\begin{tikzpicture}[every to/.style={draw,dashed}]
@@ -1858,7 +2065,7 @@ are encountered on the path.
It is possible (but not quite trivial) to reference nodes in pictures
other than the current one. This means that you can create a picture
and a node therein and, later, you can draw a line from some other
-position to this node.
+position to this node.
To reference nodes in different pictures, proceed as follows:
\begin{enumerate}
@@ -1883,9 +2090,9 @@ Let us have a look at the effect of these options.
depending on which backend driver is used. Also, even if remembering
works, the position may only be available on a second run of \TeX.
- Provided that remebering works, you may consider saying
+ Provided that remembering works, you may consider saying
\begin{codeexample}[code only]
-\tikzsytle{every picture}+=[remember picture]
+\tikzstyle{every picture}+=[remember picture]
\end{codeexample}
to make \tikzname\ remember all pictures. This will add one line in
the |.aux| file for each picture in your document -- which typically
@@ -1943,7 +2150,7 @@ that we do not wish to count as part of the picture.
\begin{codeexample}[]
\begin{tikzpicture}[remember picture]
\node (c) [circle,draw] {Big circle};
-
+
\draw [overlay,->,very thick,red,opacity=.5]
(c) to[bend left] (n1) (n1) -| (n2);
\end{tikzpicture}
@@ -1996,55 +2203,22 @@ page).
-\subsection{Late Code and Options}
+\subsection{Late Code and Late Options}
All options given to a node only locally affect this one node. While
this is a blessing in most cases, you may sometimes want to cause
options to have effects ``later'' on. The other way round, you may
sometimes note ``only later'' that some options should be added to the
-options of a node. The present section describes ways of achieving
-these effects.
-
-
-\subsubsection{Executing Code After Nodes}
-
-\label{section-nodes-executing}
-
-It is possible to add a path right after a node using the option
-|after node path|. The idea is that a style might use this option to
-add some additional stuff to the node that has just been
-typeset. Examples of such styles include the |label| option and the
-|pin| option.
-
-\begin{key}{/tikz/after node path=\meta{path}}
- The \meta{path} is added to the main path right after the node, as
- if you had given the path thereafter. This option can only be given
- inside the option list of a node and multiple calls of this option
- accumulate.
-
- Inside the \meta{path} you have access to the node that has just
- been created via the macro \declare{|\tikzlastnode|}.
-\begin{codeexample}[]
-\tikz
- \draw node [draw,after node path={(\tikzlastnode) circle (2cm)}]
- {hello};
-\end{codeexample}
-
- Note that in the above example, if we had written |\path| instead of
- |\draw|, the circle would not have been drawn since the circle is
- part of the main path, not part of the node itself.
-\end{key}
-
-\begin{command}{\tikzaddafternodepathoption\marg{code}}
- This command allows you to specify that the \meta{code} should be
- executed at the beginning of the |after node path| of the current
- node. The code will also be executed immediately, but also again at
- the beginning of an |after node path|.
+options of a node.
+
+As explained in Section~\ref{section-paths}, you
+can use the options |append after command| and
+|prefix after command| to add a path after a node. The following macro may be
+useful there:
+\begin{command}{\tikzlastnode}
+ Expands to the last node on the path.
\end{command}
-
-\subsection{Late Options}
-
A \emph{late option} for a node is an option that is given a long time
after the node has already been constructed.
@@ -2055,10 +2229,11 @@ after the node has already been constructed.
and, then, the \meta{options} are executed in a local scope. Most of
these options will have no effect since you \emph{cannot change the
appearance of the node,} that is, you cannot change a red node
- into a green node using late options. However, giving the
- the |after node path| option inside the \meta{options} (directly or
- indirectly) does have the desired effect: The after node path gets
- executed with the |\tikzlastnode| set to the determined node.
+ into a green node using late options. However, giving
+ the |append after command| and |prefix after command| options inside
+ the \meta{options} (directly or indirectly) does have the desired
+ effect: The given path gets executed with the |\tikzlastnode|
+ set to the determined node.
The net effect of all this is that you can provide, say, the |label|
option inside the \meta{options} to a add a label to a node that has
@@ -2077,11 +2252,12 @@ after the node has already been constructed.
\node (a) [draw,circle] {Hello};
\path (a) [late options={label=above:world}];
\end{tikzpicture}
-\end{codeexample}
+\end{codeexample}
+
\end{key}
-%%% Local Variables:
+%%% Local Variables:
%%% mode: latex
%%% TeX-master: "pgfmanual"
-%%% End:
+%%% End: