diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-actions.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-actions.tex | 215 |
1 files changed, 62 insertions, 153 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-actions.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-actions.tex index c80846dcd85..bb201599575 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-actions.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-actions.tex @@ -55,8 +55,8 @@ all have the same effect: \filldraw (0,0) circle (1cm); \end{codeexample} -In the following subsection the different actions are explained that -can be performed on a path. The following commands are abbreviations for +In the following subsection the different actions that +can be performed on a path are explained. The following commands are abbreviations for certain sets of actions, but for many useful combinations there are no abbreviations: @@ -174,7 +174,7 @@ You can draw a path using the following option: Although this option is normally used on paths to indicate that the path should be drawn, it also makes sense to use the option with a |{scope}| or |{tikzpicture}| environment. However, this will - \emph{not} cause all path to drawn. Instead, this just sets the + \emph{not} cause all paths to be drawn. Instead, this just sets the \meta{color} to be used for drawing paths inside the environment. \begin{codeexample}[] @@ -187,7 +187,7 @@ You can draw a path using the following option: The following subsections list the different options that influence how a path is drawn. All of these options only have an effect if the -|draw| options is given (directly or indirectly). +|draw| option is given (directly or indirectly). \subsubsection{Graphic Parameters: Line Width, Line Cap, and Line Join} @@ -255,6 +255,8 @@ styles. \end{stylekey} +\label{section-line-cap} + \begin{key}{/tikz/line cap=\meta{type} (initially butt)} Specifies how lines ``end.'' Permissible \meta{type} are |round|, |rect|, and |butt|. They have the following effects: @@ -281,7 +283,7 @@ styles. \draw[line join=round] (0,0) -- ++(.5,1) -- ++(.5,-1); \draw[line join=bevel] (1.25,0) -- ++(.5,1) -- ++(.5,-1); \draw[line join=miter] (2.5,0) -- ++(.5,1) -- ++(.5,-1); - \useasboundingbox (0,1.5); % make bounding box bigger + \useasboundingbox (0,1.5); % enlarge bounding box \end{tikzpicture} \end{codeexample} @@ -389,52 +391,52 @@ dashing conveniently. \end{stylekey} -\begin{stylekey}{/tikz/dashdotted} +\begin{stylekey}{/tikz/dash dot} Shorthand for setting a dashed and dotted dash pattern. \begin{codeexample}[] -\tikz \draw[dashdotted] (0pt,0pt) -- (50pt,0pt); +\tikz \draw[dash dot] (0pt,0pt) -- (50pt,0pt); \end{codeexample} \end{stylekey} -\begin{stylekey}{/tikz/densely dashdotted} +\begin{stylekey}{/tikz/densely dash dot} Shorthand for setting a densely dashed and dotted dash pattern. \begin{codeexample}[] -\tikz \draw[densely dashdotted] (0pt,0pt) -- (50pt,0pt); +\tikz \draw[densely dash dot] (0pt,0pt) -- (50pt,0pt); \end{codeexample} \end{stylekey} -\begin{stylekey}{/tikz/loosely dashdotted} +\begin{stylekey}{/tikz/loosely dash dot} Shorthand for setting a loosely dashed and dotted dash pattern. \begin{codeexample}[] -\tikz \draw[loosely dashdotted] (0pt,0pt) -- (50pt,0pt); +\tikz \draw[loosely dash dot] (0pt,0pt) -- (50pt,0pt); \end{codeexample} \end{stylekey} -\begin{stylekey}{/tikz/dashdotdotted} +\begin{stylekey}{/tikz/dash dot dot} Shorthand for setting a dashed and dotted dash pattern with more dots. \begin{codeexample}[] -\tikz \draw[dashdotdotted] (0pt,0pt) -- (50pt,0pt); +\tikz \draw[dash dot dot] (0pt,0pt) -- (50pt,0pt); \end{codeexample} \end{stylekey} -\begin{stylekey}{/tikz/densely dashdotdotted} +\begin{stylekey}{/tikz/densely dash dot dot} Shorthand for setting a densely dashed and dotted dash pattern with more dots. \begin{codeexample}[] -\tikz \draw[densely dashdotdotted] (0pt,0pt) -- (50pt,0pt); +\tikz \draw[densely dash dot dot] (0pt,0pt) -- (50pt,0pt); \end{codeexample} \end{stylekey} -\begin{stylekey}{/tikz/loosely dashdotdotted} +\begin{stylekey}{/tikz/loosely dash dot dot} Shorthand for setting a loosely dashed and dotted dash pattern with more dots. \begin{codeexample}[] -\tikz \draw[loosely dashdotdotted] (0pt,0pt) -- (50pt,0pt); +\tikz \draw[loosely dash dot dot] (0pt,0pt) -- (50pt,0pt); \end{codeexample} \end{stylekey} @@ -442,130 +444,13 @@ dashing conveniently. \subsubsection{Graphic Parameters: Draw Opacity} When a line is drawn, it will normally ``obscure'' everything behind -it as if you has used perfectly opaque ink. It is also possible to ask +it as if you had used perfectly opaque ink. It is also possible to ask \tikzname\ to use an ink that is a little bit (or a big bit) transparent using the |draw opacity| option. This is explained in Section~\ref{section-tikz-transparency} on transparency in more detail. -\subsubsection{Graphic Parameters: Arrow Tips} - -When you draw a line, you can add arrow tips at the ends. It is -only possible to add one arrow tip at the start and one at the end. If -the path consists of several segments, only the last segment gets -arrow tips. The behavior for paths that are closed is not specified -and may change in the future. - -\begin{key}{/tikz/arrows=\meta{start arrow kind}|-|\meta{end arrow kind}} - This option sets the start and end arrow tips (an empty value as in |->| - indicates that no arrow tip should be drawn at the start).% - \indexoption{arrows} - - \emph{Note: Since the arrow option is so often used, you can leave - out the text |arrows=|.} What happens is that every option that - contains a |-| is interpreted as an arrow specification. - -\begin{codeexample}[] -\begin{tikzpicture} - \draw[->] (0,0) -- (1,0); - \draw[o-stealth] (0,0.3) -- (1,0.3); -\end{tikzpicture} -\end{codeexample} - - The permissible values are all predefined arrow tips, though - you can also define new arrow tip kinds as explained in - Section~\ref{section-arrows}. This is often necessary to obtain - ``double'' arrow tips and arrow tips that have a fixed size. You - need to load the |arrows| library if you need arrow tips other than - the default ones, see Section~\ref{section-library-arrows}. - - One arrow tip kind is special: |>| (and all arrow tip kinds containing the - arrow tip kind such as |<<| or \verb!>|!). This arrow tip type is not - fixed. Rather, you can redefine it using the |>=| option, see - below. - - \example You can also combine arrow tip types as in -\begin{codeexample}[] -\begin{tikzpicture}[thick] - \draw[to reversed-to] (0,0) .. controls +(.5,0) and +(-.5,-.5) .. +(1.5,1); - \draw[[-latex reversed] (1,0) .. controls +(.5,0) and +(-.5,-.5) .. +(1.5,1); - \draw[latex-)] (2,0) .. controls +(.5,0) and +(-.5,-.5) .. +(1.5,1); - \useasboundingbox (-.1,-.1) rectangle (3.1,1.1); % make bounding box bigger -\end{tikzpicture} -\end{codeexample} -\end{key} - -\begin{key}{/tikz/>=\meta{end arrow kind}} - This option can be used to redefine the ``standard'' arrow tip |>|. The - idea is that different people have different ideas what arrow tip kind - should normally be used. I prefer the arrow tip of \TeX's |\to| command - (which is used in things like $f\colon A \to B$). Other people will - prefer \LaTeX's standard arrow tip, which looks like this: \tikz - \draw[-latex] (0,0) -- (10pt,1ex);. Since the arrow tip kind |>| is - certainly the most ``natural'' one to use, it is kept free of any - predefined meaning. Instead, you can change it by saying |>=to| to - set the ``standard'' arrow tip kind to \TeX's arrow tip, whereas |>=latex| - will set it to \LaTeX's arrow tip and |>=stealth| will use a - \textsc{pstricks}-like arrow tip. - - Apart from redefining the arrow tip kind |>| (and |<| for the start), - this option also redefines the following arrow tip kinds: |>| and |<| as - the swapped version of \meta{end arrow kind}, |<<| and |>>| as - doubled versions, |>>| and |<<| as swapped doubled versions, %>> - and \verb!|<! and \verb!>|! as arrow tips ending with a vertical bar. - -\begin{codeexample}[] -\begin{tikzpicture}[scale=2] - \begin{scope}[>=latex] - \draw[->] (0pt,6ex) -- (1cm,6ex); - \draw[>->>] (0pt,5ex) -- (1cm,5ex); - \draw[|<->|] (0pt,4ex) -- (1cm,4ex); - \end{scope} - \begin{scope}[>=diamond] - \draw[->] (0pt,2ex) -- (1cm,2ex); - \draw[>->>] (0pt,1ex) -- (1cm,1ex); - \draw[|<->|] (0pt,0ex) -- (1cm,0ex); - \end{scope} -\end{tikzpicture} -\end{codeexample} -% << -\end{key} - -\begin{key}{/tikz/shorten >=\meta{dimension} (initially 0pt)} - This option will shorten the end of lines by the given - \meta{dimension}. If you specify an arrow tip, lines are already - shortened a bit such that the arrow tip touches the specified endpoint - and does not ``protrude over'' this point. Here is an example: - -\begin{codeexample}[] -\begin{tikzpicture}[line width=20pt] - \useasboundingbox (0,-1.5) rectangle (3.5,1.5); - \draw[red] (0,0) -- (3,0); - \draw[gray,->] (0,0) -- (3,0); -\end{tikzpicture} -\end{codeexample} - - The |shorten >| option allows you to shorten the end on the line - \emph{additionally} by the given distance. This option can also be - useful if you have not specified an arrow tip at all. - -\begin{codeexample}[] -\begin{tikzpicture}[line width=20pt] - \useasboundingbox (0,-1.5) rectangle (3.5,1.5); - \draw[red] (0,0) -- (3,0); - \draw[-to,shorten >=10pt,gray] (0,0) -- (3,0); -\end{tikzpicture} -\end{codeexample} -\end{key} - - -\begin{key}{/tikz/shorten <=\meta{dimension}} - Works like |shorten >|, but for the start. -\end{key} - - - \subsubsection{Graphic Parameters: Double Lines and Bordered Lines} \begin{key}{/tikz/double=\meta{core color} (default white)} @@ -612,7 +497,7 @@ and may change in the future. \begin{key}{/tikz/double distance between line centers=\meta{dimension}} This option works like |double distance|, only the distance is not - the distance between (inner) borders of the two main lines, ut + the distance between (inner) borders of the two main lines, but between their centers. Thus, the thickness the \emph{first} time the path is drawn is the normal line width plus the given \meta{dimension}, while the line width of the @@ -653,7 +538,35 @@ and may change in the future. +\subsection{Adding Arrow Tips to a Path} +\label{section-arrow-tip-action} + +In different situations, \tikzname\ will add arrow tips to the end of +a path. For this to happen, a number of different things need to be +specified: + +\begin{enumerate} +\item You must have used the |arrows| key, explained in detail in + Section~\ref{section-tikz-arrows}, to setup which kinds of arrow + tips you would like. +\item The path may not be closed (like a circle or a rectangle) and, + if it consists of several subpath, further restrictions apply as + explained in Section~\ref{section-tikz-arrows}. +\item The |tips| key must be set to an appropriate value, see + Section~\ref{section-tikz-arrows} once more. +\end{enumerate} +For the current section on paths, it is only important that when you +add the |tips| option to a path that is not drawn, arrow tips will +still be added at the beginning and at the end of the current +path. This is true even when ``only'' arrow tips get drawn for a path +without drawing the path itself. Here is an example: +\begin{codeexample}[width=2cm] +\tikz \path[tips, -{Latex[open,length=10pt,bend]}] (0,0) to[bend left] (1,0); +\end{codeexample} +\begin{codeexample}[width=2cm] +\tikz \draw[tips, -{Latex[open,length=10pt,bend]}] (0,0) to[bend left] (1,0); +\end{codeexample} \subsection{Filling a Path} @@ -692,7 +605,7 @@ To fill a path, use the following option: area because of the thickness of the ``pen.'' \begin{codeexample}[] -\begin{tikzpicture}[fill=examplefill,line width=5pt] +\begin{tikzpicture}[fill=yellow!80!black,line width=5pt] \filldraw (0,0) -- (1,1) -- (2,1); \filldraw (4,0) circle (.5cm) (4.5,0) circle (.5cm); \filldraw[even odd rule] (6,0) circle (.5cm) (6.5,0) circle (.5cm); @@ -722,7 +635,7 @@ is used the current \emph{pattern color} is used as its color. Patterns are not overly flexible. In particular, it is not possible to change the size or orientation of a pattern without declaring a new -pattern. For complicated case, it may be easier to use two nested +pattern. For complicated cases, it may be easier to use two nested |\foreach| statements to simulate a pattern, but patterns are rendered \emph{much} more quickly than simulated ones. @@ -788,7 +701,7 @@ should be determined: \begin{codeexample}[] \begin{tikzpicture} - \filldraw[fill=examplefill] + \filldraw[fill=yellow!80!black] % Clockwise rectangle (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle % Counter-clockwise rectangle @@ -800,7 +713,7 @@ should be determined: \draw[->] (0.5,0.5) -- +(0,1) node[above] {crossings: $-1+1 = 0$}; \begin{scope}[yshift=-3cm] - \filldraw[fill=examplefill] + \filldraw[fill=yellow!80!black] % Clockwise rectangle (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle % Clockwise rectangle @@ -829,7 +742,7 @@ should be determined: \begin{codeexample}[] \begin{tikzpicture} - \filldraw[fill=examplefill,even odd rule] + \filldraw[fill=yellow!80!black,even odd rule] (0,0) rectangle (1,1) (0.5,0.5) circle (0.4cm); \draw[->] (0.5,0.5) -- +(0,1) [above] node{crossings: $1+1 = 2$}; \end{tikzpicture} @@ -841,8 +754,7 @@ should be determined: \subsubsection{Graphic Parameters: Fill Opacity} \label{section-fill-opacity} -Analogously to the |draw opacity|, you can also set the filling -opacity. Please see Section~\ref{section-tikz-transparency} for more +Analogously to the |draw opacity|, you can also set the fill opacity. Please see Section~\ref{section-tikz-transparency} for more details. @@ -866,13 +778,10 @@ this process much easier: and, possibly, the path is stroked, provided the |draw| option has been given. - As with other keys like |fill| or |draw| this option needs to be - given on a path, setting the |path picture| outside a path has not - effect (the path picture is cleared at the beginning of each path). + As with other keys like |fill| or |draw| this option needs to be given on a path, setting the |path picture| outside a path has no effect (the path picture is cleared at the beginning of each path). The \meta{code} can be any normal \tikzname\ code like |\draw ...| - or |\node ...|. As always, when you include an external graphic you - need to put it inside a |\node|. + or |\node ...|. As always, when you include an external graphic, you need to put it inside a |\node|. Note that no special actions are taken to transform the origin in any way. This means that the coordinate |(0,0)| is still where is @@ -969,7 +878,7 @@ is drawn, scaled and shifted such that all parts of the path are filled. The default shading is a smooth transition from gray -to white and from above to bottom. However, other shadings are also +to white and from top to bottom. However, other shadings are also possible, for example a shading that will sweep a color from the center to the corners outward. To choose the shading, you can use the |shading=| option, which will also automatically invoke the |shade| @@ -991,7 +900,7 @@ needed, which are explained below. To change the color of a shading, special options are needed like |left color|, which sets the color of an axis shading from left to - right. These options implicitly also select the right shading type, + right. These options implicitly also select the correct shading type, see the following example \begin{codeexample}[] \tikz \shadedraw [left color=red,right color=blue] @@ -1066,7 +975,7 @@ right of picture. \end{codeexample} Note: If this option is used on a path inside a \TeX\ group (scope), - the effect ``lasts'' only till the end of the scope. Again, this + the effect ``lasts'' only until the end of the scope. Again, this behavior is the same as for clipping. @@ -1260,7 +1169,7 @@ with a color, then repaint the path with a pattern and then repaint it with yet another pattern. In such cases you can use the following two options: -\begin{key}{/tikz/preactions=\meta{options}} +\begin{key}{/tikz/preaction=\meta{options}} This option can be given to a |\path| command (or to derived commands like |\draw| which internally call |\path|). Similarly to options like |draw|, this option only has an effect when given to a @@ -1415,7 +1324,7 @@ options: Before a path is used, it is possible to first ``decorate'' and/or ``morph'' it. Morphing means that the path is replaced by another path -that slightly varied. Such morphings are a special case +that is slightly varied. Such morphings are a special case of the more general ``decorations'' described in detail in Section~\ref{section-tikz-decorations}. For instance, in the following example the path is drawn twice: Once normally and then in a morphed |