diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex | 90 |
1 files changed, 57 insertions, 33 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex index 009660a911d..f1027d3bc88 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex @@ -16,7 +16,11 @@ Decorations are a general concept to make (sub)paths ``more interesting''. Before we have a look at the details, let us have a look at some examples: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{ + decorations.pathmorphing, + decorations.pathreplacing, + decorations.shapes, +}}] \begin{tikzpicture}[thick] \draw (0,3) -- (3,3); \draw[decorate,decoration=zigzag] (0,2.5) -- (3,2.5); @@ -28,7 +32,7 @@ Before we have a look at the details, let us have a look at some examples: \end{tikzpicture} \end{codeexample} -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \begin{tikzpicture} \node [fill=red!20,draw,decorate,decoration={bumps,mirror}, minimum height=1cm] @@ -36,7 +40,7 @@ Before we have a look at the details, let us have a look at some examples: \end{tikzpicture} \end{codeexample} -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \begin{tikzpicture} \filldraw[fill=blue!20] (0,3) decorate [decoration=saw] { -- (3,3) } @@ -45,7 +49,7 @@ Before we have a look at the details, let us have a look at some examples: \end{tikzpicture} \end{codeexample} -\begin{codeexample}[] +\begin{codeexample}[pre={\pgfmathsetseed{1}},preamble={\usetikzlibrary{decorations.pathmorphing}}] \begin{tikzpicture} \node [fill=yellow!50,draw,thick, minimum height=2cm, minimum width=3cm, decorate, decoration={random steps,segment length=3pt,amplitude=1pt}] @@ -65,12 +69,12 @@ Let us have a look at an example: In the first picture, we see a path that consists of a line, an arc, and a line. In the second picture, this path has been used as the basis of a decoration. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \tikz \fill [fill=blue!20,draw=blue,thick] (0,0) -- (2,1) arc (90:-90:.5) -- cycle; \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \tikz \fill [decorate,decoration={zigzag}] [fill=blue!20,draw=blue,thick] (0,0) -- (2,1) arc (90:-90:.5) -- cycle; \end{codeexample} @@ -78,7 +82,7 @@ been used as the basis of a decoration. It is also possible to decorate only a subpath (the exact syntax will be explained later in this section). % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \tikz \fill [decoration={zigzag}] [fill=blue!20,draw=blue,thick] (0,0) -- (2,1) decorate { arc (90:-90:.5) } -- cycle; @@ -106,7 +110,7 @@ decorations. path has no effect since the path consist only of (numerous) unconnected straight line subpaths: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.shapes}}] \tikz \fill [decorate,decoration={crosses}] [fill=blue!20,draw=blue,thick] (0,0) -- (2,1) arc (90:-90:.5) -- cycle; \end{codeexample} @@ -122,7 +126,7 @@ decorations. such decorations the path usage command for the main path have no influence on how the decoration looks like. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.text}}] \tikz \fill [decorate,decoration={text along path, text=This is a text along a path. Note how the path is lost.}] [fill=blue!20,draw=blue,thick] (0,0) -- (2,1) arc (90:-90:.5) -- cycle; @@ -144,13 +148,16 @@ decorate the decorated path once more. (0,0) rectangle (3,2); \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \tikz \fill [fill=blue!20,draw=blue,thick] decorate[decoration={zigzag,segment length=10mm,amplitude=2.5mm}] { (0,0) rectangle (3,2) }; \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{ + decorations.pathmorphing, + decorations.shapes, +}}] \tikz \fill [fill=blue!20,draw=blue,thick] decorate[decoration={crosses,segment length=2mm}] { decorate[decoration={zigzag,segment length=10mm,amplitude=2.5mm}] { @@ -169,11 +176,11 @@ pattern will literally be thousands of times faster to typeset. However, for most decorations there are no real alternatives. \begin{tikzlibrary}{decorations} - In order to use decorations, you first have to load a decoration library. - This |decoration| library defines the basic options described in the + In order to use decorations, you first have to load a |decorations| library. + This |decorations| library defines the basic options described in the following, but it does not define any new decorations. This is done by libraries like |decorations.text|. Since these more specialized libraries - include the |decoration| library automatically, you usually do not have to + include the |decorations| library automatically, you usually do not have to bother about it. \end{tikzlibrary} @@ -187,7 +194,7 @@ The most general way to decorate a (sub)path is the following path command. current decoration. Depending on the decoration, this may or may not extend the current path. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \begin{tikzpicture} \draw [help lines] grid (3,2); \draw decorate [decoration={name=zigzag}] @@ -205,7 +212,10 @@ The most general way to decorate a (sub)path is the following path command. You can use nodes normally inside the \meta{subpath}. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{ + decorations.pathmorphing, + decorations.shapes, +}}] \begin{tikzpicture} \draw [help lines] grid (3,2); \draw decorate [decoration={name=zigzag}] @@ -230,7 +240,10 @@ The most general way to decorate a (sub)path is the following path command. |decorate| path command. Naturally, any local options of the |decorate| path command override these ``global'' options. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{ + decorations.pathmorphing, + decorations.shapes, +}}] \begin{tikzpicture}[decoration=zigzag] \draw decorate {(0,0) -- (3,2)}; \draw [red] decorate [decoration=crosses] {(0,2) -- (3,0)}; @@ -254,7 +267,7 @@ The most general way to decorate a (sub)path is the following path command. If you set \meta{name} to |none|, no decorations are added. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \begin{tikzpicture} \draw [help lines] grid (3,2); \draw decorate [decoration={name=zigzag}] @@ -266,7 +279,7 @@ The most general way to decorate a (sub)path is the following path command. |name=| part. Thus, the above example can be rewritten more succinctly: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \begin{tikzpicture} \draw [help lines] grid (3,2); \draw decorate [decoration=zigzag] @@ -289,7 +302,7 @@ The most general way to decorate a (sub)path is the following path command. path. In such cases, the construction of the main path is resumed after the |decorate| path command ends. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.text}}] \begin{tikzpicture}[decoration={text along path,text= around and around and around and around we go}] @@ -306,7 +319,7 @@ The most general way to decorate a (sub)path is the following path command. Repeatedly applying this transformation to a triangle yields a fractal that looks a bit like a snowflake, hence the name. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.fractals}}] \begin{tikzpicture}[decoration=Koch snowflake,draw=blue,fill=blue!20,thick] \filldraw (0,0) -- ++(60:1) -- ++(-60:1) -- cycle ; \filldraw decorate{ (0,-1) -- ++(60:1) -- ++(-60:1) -- cycle }; @@ -341,7 +354,11 @@ the following option, which allows you to decorate a path ``after the fact''. in contrast to the |decorate| path command you cannot apply this option twice (this would just set it to |true|, once more). % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{ + decorations.pathmorphing, + decorations.text, + shapes.geometric, +}}] \begin{tikzpicture}[decoration=zigzag] \draw [help lines] (0,0) grid (3,5); @@ -360,7 +377,11 @@ the following option, which allows you to decorate a path ``after the fact''. Incidentally, this is another application of the |decorate| option that you cannot achieve with the decorate path command. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{ + decorations.pathmorphing, + decorations.text, + shapes.geometric, +}}] \begin{tikzpicture}[decoration=zigzag] \node at (1.5,1) [inner sep=6mm,fill=red!20,ellipse, postaction={decorate,decoration= @@ -372,7 +393,7 @@ the following option, which allows you to decorate a path ``after the fact''. after the main path has been drawn. % % \catcode`\|12 % !? -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.text}}] \begin{tikzpicture} \draw [help lines] grid (3,2); \fill [draw=red,fill=red!20, @@ -403,7 +424,7 @@ modify the positioning of decorations relative to the to-be-decorated path. A negative \meta{dimension} will offset the decoration ``to the right'' of the to-be-decorated path. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.shapes}}] \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -422,7 +443,7 @@ modify the positioning of decorations relative to the to-be-decorated path. to-be-decorated path. This is done after and in addition to any transformations set using the |transform| and/or |raise| options. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathreplacing}}] \begin{tikzpicture} \node (a) {A}; \node (b) at (2,1) {B}; @@ -445,7 +466,7 @@ modify the positioning of decorations relative to the to-be-decorated path. In the following example the |shift only| transformation is used to make sure that the crosses are \emph{not} sloped along the path. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.shapes}}] \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -475,17 +496,20 @@ decorations, not with meta-decorations. also need to set the |pre length| option. % % TODO: Nesting tikzpictures is NOT supported -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \tikz [decoration={zigzag,pre=lineto,pre length=1cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \tikz [decoration={zigzag,pre=moveto,pre length=1cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{ + decorations.pathmorphing, + decorations.shapes, +}}] \tikz [decoration={zigzag,pre=crosses,pre length=1cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); \end{codeexample} @@ -494,12 +518,12 @@ decorations, not with meta-decorations. that the default |pre| decoration will not follow curves (for efficiency reasons). Change the |pre| key to |curveto| if you have a curved path. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \tikz [decoration={zigzag,pre length=3cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \tikz [decoration={zigzag,pre=curveto,pre length=3cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); \end{codeexample} @@ -523,7 +547,7 @@ decorations, not with meta-decorations. Here is a typical example that shows how these keys can be used: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \begin{tikzpicture} [decoration=snake, line around/.style={decoration={pre length=#1,post length=#1}}] |