summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex112
1 files changed, 43 insertions, 69 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex
index fb8d072b7ba..2fba592ad7e 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex
@@ -1,3 +1,12 @@
+% Copyright 2006 by Till Tantau
+%
+% 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{Tutorial: A Picture for Karl's Students}
This tutorial is intended for new users of \pgfname\ and \tikzname. It
@@ -49,9 +58,9 @@ cosine. What he would like to have is something that looks like this
\colorlet{coscolor}{blue}
% Styles
- \tikzstyle axes=[]
- \tikzstyle important line=[very thick]
- \tikzstyle information text=[rounded corners,fill=red!10,inner sep=1ex]
+ \tikzstyle{axes}=[]
+ \tikzstyle{important line}=[very thick]
+ \tikzstyle{information text}=[rounded corners,fill=red!10,inner sep=1ex]
% The graphic
\draw[style=help lines,step=0.5cm] (-1.4,-1.4) grid (1.4,1.4);
@@ -203,6 +212,31 @@ inputs |tikz.tex| or |pgf.tex|.
+\subsubsection{Setting up the Environment in Con\TeX t}
+
+Karl's uncle Hans uses Con\TeX t. Like Gerda, Hans can also use
+\tikzname. Instead of |\usepackage{tikz}| he says
+|\usemodule[tikz]|. Instead of |\begin{tikzpicture}| he writes
+ |\starttikzpicture| and instead of |\end{tikzpicture}| he writes
+|\stoptikzpicture|.
+
+His version of the example looks like this:
+\begin{codeexample}[code only]
+%% ConTeXt file
+\usemodule[tikz]
+
+\starttext
+ We are working on
+ \starttikzpicture
+ \draw (-1.5,0) -- (1.5,0);
+ \draw (0,-1.5) -- (0,1.5);
+ \stoptikzpicture.
+\stoptext
+\end{codeexample}
+
+Hans will now typeset this file in the usual way using |texexec|.
+
+
\subsection{Straight Path Construction}
@@ -937,11 +971,12 @@ be drawn ``normally.''
If Karl wishes to set a certain graphic option for the whole picture,
he can simply pass this option to the |\tikz| command or to the
|{tikzpicture}| environment (Gerda would pass the options to
-|\tikzpicture|). However, if Karl wants to apply graphic options to a
-local group, he put these commands inside a |{scope}| environment
-(Gerda uses |\scope| and |\endscope|). This environment takes graphic
-options as an optional argument and these options apply to everything
-inside the scope, but not to anything outside.
+|\tikzpicture| and Hans passes them to |\starttikzpicture|). However,
+if Karl wants to apply graphic options to a local group, he put these
+commands inside a |{scope}| environment (Gerda uses |\scope| and
+|\endscope|, Hans uses |\startscope| and |\stopscope|). This
+environment takes graphic options as an optional argument and these
+options apply to everything inside the scope, but not to anything outside.
Here is an example:
@@ -1354,64 +1389,3 @@ desired effect. So, here is the full code:
\end{tikzpicture}
\end{codeexample}
-
-\subsection{Nodes}
-
-Placing text at a given position is just a special case of a more
-general underlying mechanism. When you say |\draw (0,0) node{text};|,
-what actually happens is that a rectangular node, anchored at its center, is
-put at position $(0,0)$. On top of the rectangular node the text
-|text| is drawn. Since no action is specified for the rectangle (like
-|draw| or |fill|), the rectangle is actually discarded and only the
-text is shown. However, by adding |fill| or |draw|, we can make the
-underlying shape visible. Furthermore, we can \emph{change} the
-shape using for example |shape=circle| or just |circle|. If we include
-the package |pgflibraryshapes| we also get |ellipse|:
-
-
-\begin{codeexample}[]
-\begin{tikzpicture}
- \path (0,0) node[ellipse,fill=examplefill,draw]
- (h1) {hello world}
- (0.5,2) node[circle,shade,ball color=examplefill]
- (h2) {hello world};
- \draw [->,shorten >=2pt] (h1.north) -- (h2.south);
-\end{tikzpicture}
-\end{codeexample}
-
-As the above example shows, we can add the a name to a node by
-putting it in parentheses between |node| and the |{|\meta{text}|}|
-(you can also use the |name=| option). This will make \tikzname\ remember your node and all
-its anchors. You can then refer to these anchors when specifying
-coordinates. The syntax is |(|\meta{node
- name}|.|\meta{anchor}|)|. Currently, and also in the near future,
-\emph{this will not work across pictures since \tikzname\ looses track
- of the positions when it returns control to \TeX.} Magic hackery is
-possible for certain drivers, but a portable implementation seems
-impossible (just think of a possible \textsc{svg} driver).
-
-The option |shorten >| causes lines to be shortened by 2pt at the
-end. Similarly, |shorten <| can be used to shorten (or even lengthen)
-lines at the beginning. This is possible even if no arrow is drawn.
-
-It is not always necessary to specify the anchor. If you do not give
-an anchor, \tikzname\ will try to determine a reasonable border anchor by
-itself (if \tikzname\ fails to find anything useful, it will use the
-center instead). Here is a typical example:
-
-\begin{codeexample}[]
-\begin{tikzpicture}
- \begin{scope}[shape=circle,minimum size=1cm,fill=examplefill]
- \tikzstyle{every node}=[draw,fill]
- \node (q_A) at (0,0) {$q_A$};
- \node (q_E) at (6,0) {$q_E$};
- \node (q_1) at (2,0) {$q_1$};
- \node (q_2) at (4,2) {$q_2$};
- \end{scope}
- \draw (q_A) -- (q_1) -- (q_2) -| (q_E);
- \draw[->,shorten >=2pt] (q_A) .. controls +(75:1.4cm) and +(105:1.4cm) .. node[above] {$x$} (q_A);
-\end{tikzpicture}
-\end{codeexample}
-
-In the example, we used the |\node| command, which is an abbreviation
-for |\path node|.