summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-nodes.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-nodes.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-nodes.tex164
1 files changed, 147 insertions, 17 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-nodes.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-nodes.tex
index c2231219113..891cfeef345 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-nodes.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-nodes.tex
@@ -1,8 +1,11 @@
-% Copyright 2003 by Till Tantau <tantau@cs.tu-berlin.de>.
+% Copyright 2006 by Till Tantau
%
-% This program can be redistributed and/or modified under the terms
-% of the LaTeX Project Public License Distributed from CTAN
-% archives in directory macros/latex/base/lppl.txt.
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Free Documentation License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
\section{Nodes and Shapes}
@@ -218,19 +221,19 @@ You create a node using on of the following commands:
When this command is called, for each node part of the node you must
have setup one \TeX-box. Suppose the shape has two parts: The |text|
- part and the |output| part. Then, prior to calling
+ part and the |lower| part. Then, prior to calling
|\pgfmultipartnode|, you must have setup the boxes
- |\pgfnodeparttextbox| and |\pgfnodepartoutputbox|. These boxes may
+ |\pgfnodeparttextbox| and |\pgfnodepartlowerbox|. These boxes may
contain any \TeX-text. The shape code will then compute the
positions of the shape's anchors based on the sizes of the these
shapes. Finally, when the node is drawn, the boxes are placed at the
- anchor positions |text| and |output|.
+ anchor positions |text| and |lower|.
\begin{codeexample}[]
\setbox\pgfnodeparttextbox=\hbox{$q_1$}
-\setbox\pgfnodepartoutputbox=\hbox{01}
+\setbox\pgfnodepartlowerbox=\hbox{01}
\begin{pgfpicture}
- \pgfmultipartnode{state with output}{center}{my state}{\pgfusepath{stroke}}
+ \pgfmultipartnode{circle split}{center}{my state}{\pgfusepath{stroke}}
\end{pgfpicture}
\end{codeexample}
@@ -245,12 +248,12 @@ You create a node using on of the following commands:
part name. Although you need a different box for each part of a
single shape, two different shapes may very well use the same box
even when the names of the parts are different. Suppose you have a
- |state with output| shape that has an |output| part and you have a
+ |circle split| shape that has an |lower| part and you have a
|uml class| shape that has a |methods| part. Then, in order to avoid
exhausting \TeX's limited number of box registers, you can say
\begin{codeexample}[code only]
-\newbox\pgfnodepartoutputbox
-\let\pgfnodepartmethodsbox=\pgfnodepartoutputbox
+\newbox\pgfnodepartlowerbox
+\let\pgfnodepartmethodsbox=\pgfnodepartlowerbox
\end{codeexample}
Also, when you have a node part name with spaces like |class name|,
it may be useful to create an alias:
@@ -342,6 +345,13 @@ node. These parameters can be changed using the following commands:
Works like |\pgfsetshapeouterysep|.
\end{command}
+\begin{command}{\pgfsetshapeaspect\marg{value}}
+ This command sets the macro \declare{|\pgfshapeaspect|} to
+ \meta{value}. Furthermore, \declare{|\pgfshapeaspectinverse|} is set
+ to the reciprocal of \meta{value}. The aspect is a recommendation
+ for the quotient of the width and the height of a shape.
+\end{command}
+
\subsection{Using Anchors}
@@ -355,6 +365,9 @@ One has to look up the set of anchors of each shape, there is no
should always be present. Also, most shapes will declare anchors like
|north| or |east|, but this is not guaranteed.
+
+\subsubsection{Referencing Anchors of Nodes in the Same Picture}
+
Once a node has been defined, you can refer to its anchors using the
following commands:
@@ -411,6 +424,20 @@ following commands:
\pgfusepath{fill}
\end{pgfpicture}
\end{codeexample}
+
+ A special situation arises when the \meta{node} lies in a picture
+ different from the current picture. In this case, if you have not
+ told \pgfname\ that the picture should be ``remembered,'' the
+ \meta{node} will be treated as if it lied in the current
+ picture. For example, if the \meta{node} was at position $(3,2)$ in
+ the original picture, it is treated as if it lied at position
+ $(3,2)$ in the current picture. However, if you have told \pgfname\
+ to remember the picture position of the node's picture and also of
+ the current picture,
+ then |\pgfpointanchor| will return a coordinate that corresponds to
+ the position of the node's anchor on the page, transformed into the
+ current coordinate system. For examples and more details see
+ Section~\ref{section-cross-pictures-pgf}.
\end{command}
\begin{command}{\pgfpointshapeborder\marg{node}\marg{point}}
@@ -436,6 +463,110 @@ following commands:
\end{command}
+\subsubsection{Referencing Anchors of Nodes in Different Pictures}
+\label{section-cross-pictures-pgf}
+
+As a picture is typeset, \pgfname\ keeps track of the positions of all
+nodes inside the picture. What \pgfname\ does not remember is the
+position of the picture \emph{itself} on the page. Thus, if you define
+a node in one picture and then try to reference this node while
+another picture is typeset, \pgfname\ will only know the position of
+the nodes that you try to typeset inside the original picture, but it
+will not know where this picture lies. What is missing is the relative
+positioning of the two pictures.
+
+To overcome this problem, you need to tell \pgfname\ that it should
+remember the position of pictures on a page. If these positions are
+remembered, then \pgfname\ can compute the offset between the pictures
+and make nodes in different pictures accessible.
+
+Determining the positions of pictures on the page is, alas,
+not-so-easy. Because of this, \pgfname\ does not do so
+automatically. Rather, you have to proceed as follows:
+\begin{enumerate}
+\item You have to use a backend driver that supports position
+ tracking. pdf\TeX\ is one such drivers, |dvips| currently is not.
+\item You have to say |\pgfrememberpicturepositiononpagetrue|
+ somewhere before or inside every picture
+ \begin{itemize}
+ \item in which you wish to reference a node and
+ \item from which you wish to reference a node in another picture.
+ \end{itemize}
+ The second item is important since \pgfname\ does not only need to
+ know the position of the picture in which the node you wish to
+ reference lies, but it also needs to know where the current picture
+ lies.
+\item You typically have to run \TeX\ twice (depending on the backend
+ driver) since the position information typically gets written into
+ an external file on the first run and is available only on the
+ second run.
+\item You have to switch off automatic bounding bound
+ computations. The reason is that the node in the other picture
+ should not influence the size of the bouding box of the current
+ picture. You should say |\pgfusepath{use as bounding box}| before
+ using a coordinate in another picture.
+\end{enumerate}
+
+
+
+\subsection{Predefined Nodes}
+
+There are several special nodes that are always defined and which you
+should not attempt to redefine.
+
+\begin{predefinednode}{current bounding box}
+ This node is of shape |rectangle|. Unlike normal nodes, its size
+ changes constantly and always reflects the size of the bounding box
+ of the current picture. This means that, for instance, that
+\begin{codeexample}[code only]
+\pgfpointanchor{current bounding box}{south east}
+\end{codeexample}
+ returns the lower left corner of the bounding box of the current
+ picture.
+\end{predefinednode}
+
+\begin{predefinednode}{current path bounding box}
+ This node is also of shape |rectangle|. Its size is the size of the
+ bounding box of the current path.
+\end{predefinednode}
+
+\begin{predefinednode}{current page}
+ This node is inside a virtual remembered picture. The size of this
+ node is the size of the current page. This means that if you create
+ a remembered picture and inside this picture you reference an anchor
+ of this node, you reference an absolute position on the page. To
+ demonstrate the effect, the following code puts some text in the
+ lower left corner of the current page. Note that this works only if
+ the backend driver supports it, otherwise the text is inserted right
+ here.%
+{%
+\pgfrememberpicturepositiononpagetrue%
+\begin{pgfpicture}
+ \pgfusepath{use as bounding box}
+ \pgftransformshift{\pgfpointanchor{current page}{south west}}
+ \pgftransformshift{\pgfpoint{1cm}{1cm}}
+ \pgftext[left,base]{
+ \textcolor{red}{
+ Text absolutely positioned in
+ the lower left corner.}
+ }
+\end{pgfpicture}
+}%
+\begin{codeexample}[code only]
+\pgfrememberpicturepositiononpagetrue
+\begin{pgfpicture}
+ \pgfusepath{use as bounding box}
+ \pgftransformshift{\pgfpointanchor{current page}{south west}}
+ \pgftransformshift{\pgfpoint{1cm}{1cm}}
+ \pgftext[left,base]{
+ \textcolor{red}{
+ Text absolutely positioned in
+ the lower left corner.}
+ }
+\end{pgfpicture}
+\end{codeexample}
+\end{predefinednode}
+
\subsection{Declaring New Shapes}
@@ -557,11 +688,10 @@ The following command declares a new shape:
By default, a shape has just one node part called |text|. However,
there can be several node parts. For example, the
- |state with output| shape has two parts: the |text| part, which
- shows that state's name, and an |output| part, which shows the
- output produced when the state is reached. For the
- |state with output| shape the |\nodeparts| command was called with
- the argument |{text,output}|.
+ |circle split| shape has two parts: the |text| part, which
+ shows that upper text, and a |lower| part, which shows the
+ lower text. For the |circle split| shape the |\nodeparts| command
+ was called with the argument |{text,lower}|.
When a multipart node is created, the text labels are drawn in the
sequences listed in the \meta{list of node parts}. For each node