From 18d9ec0eba21e6b8c55cdd50afb91c56e02ce7bf Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 20 Dec 2019 03:00:48 +0000 Subject: CTAN sync 201912200300 --- .../base/doc/text-en/pgfmanual-en-tikz-shapes.tex | 92 ++++++++++++---------- 1 file changed, 49 insertions(+), 43 deletions(-) (limited to 'graphics/pgf/base/doc/text-en/pgfmanual-en-tikz-shapes.tex') diff --git a/graphics/pgf/base/doc/text-en/pgfmanual-en-tikz-shapes.tex b/graphics/pgf/base/doc/text-en/pgfmanual-en-tikz-shapes.tex index 01af022c29..e4c7d11f92 100644 --- a/graphics/pgf/base/doc/text-en/pgfmanual-en-tikz-shapes.tex +++ b/graphics/pgf/base/doc/text-en/pgfmanual-en-tikz-shapes.tex @@ -175,7 +175,7 @@ The syntax for specifying nodes is the following: Note that |behind path| only applies to the current path; not to the current scope or picture. To put a node ``behind everything'' you need to use layers and options like |on background layer|, see the - background library in Section~\ref{section-tikz-backgrounds}. + |backgrounds| library in Section~\ref{section-tikz-backgrounds}. \end{key} \begin{key}{/tikz/in front of path} @@ -237,7 +237,7 @@ The syntax for specifying nodes is the following: instead or an ellipse shape (you have to include one of the |shapes.geometric| library for the latter shape): % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{shapes.geometric}}] \tikz \fill[fill=yellow!80!black] (0,0) node {first node} -- (1,1) node[ellipse,draw, behind path] {second node} @@ -275,7 +275,7 @@ The syntax for specifying nodes is the following: Section~\ref{section-tikz-animations}. Here is a typical example of how this syntax can be used: % -\begin{codeexample}[animation list={0.5,1,1.5,2}] +\begin{codeexample}[preamble={\usetikzlibrary{animations}},animation list={0.5,1,1.5,2}] \tikz \node :fill opacity = { 0s="1", 2s="0", begin on=click } :rotate = { 0s="0", 2s="90", begin on=click } @@ -632,7 +632,7 @@ that apply to most shapes: Sets a desired aspect ratio for the shape. For the |diamond| shape, this option sets the ratio between width and height of the shape. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{shapes.geometric}}] \begin{tikzpicture} \draw (0,0) node[shape aspect=1,diamond,draw] {aspect 1}; \draw (0,-2) node[shape aspect=2,diamond,draw] {aspect 2}; @@ -647,7 +647,7 @@ 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}[] +\begin{codeexample}[preamble={\usetikzlibrary{shapes.geometric}}] \tikzset{every node/.style={dart, shape border uses incircle, inner sep=1pt, draw}} \tikz \node foreach \a/\b/\c in {A/0/0, B/45/0, C/0/45, D/45/45} @@ -669,7 +669,7 @@ 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. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{shapes.geometric}}] \tikzset{every node/.style={isosceles triangle, draw}} \begin{tikzpicture} \node {abc}; @@ -699,7 +699,7 @@ 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}[] +\begin{codeexample}[preamble={\usetikzlibrary{shapes.geometric}}] \tikzset{every node/.style={shape=trapezium, draw, shape border uses incircle}} \begin{tikzpicture} \node at (0,0) (A) {A}; @@ -742,7 +742,7 @@ the following command: name} -- until another |\partname| is encountered or until the node \meta{text} ends. The \meta{options} will be local to this part. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{shapes.multipart}}] \begin{tikzpicture} \node [circle split,draw,double,fill=red!20] { @@ -763,7 +763,7 @@ the following command: This style is installed at the beginning of every node part named \meta{part name}. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{shapes.multipart}}] \tikz [every lower node part/.style={red}] \node [circle split,draw] {$q_1$ \nodepart{lower} $00$}; \end{codeexample} @@ -851,7 +851,7 @@ The other font command is: A useful example of how the |font| option can be used is the following: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{shapes.multipart}}] \tikz [every text node part/.style={font=\itshape}, every lower node part/.style={font=\footnotesize}] \node [circle split,draw] {state \nodepart{lower} output}; @@ -1424,7 +1424,7 @@ differently. node is shifted by the vertical component of this point. The anchor is set to |south|. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \begin{tikzpicture} \draw[help lines] (0,0) grid (2,2); \node at (1,1) [above=.2 and 3mm,draw] {above}; @@ -1440,14 +1440,14 @@ differently. \item The \meta{of-part} can be \declareandlabel{of}| |\meta{coordinate}, where \meta{coordinate} is \emph{not} in parentheses and it is \emph{not} just a node name. An - example would be |of somenode.north| or |of 2,3|. In this case, the + example would be |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|. Here is a basic example: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \begin{tikzpicture}[every node/.style=draw] \draw[help lines] (0,0) grid (2,2); \node (somenode) at (1,1) {some node}; @@ -1480,7 +1480,7 @@ differently. such a way that the distance between its south border and \meta{node name}'s north border is exactly the given distance. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \begin{tikzpicture}[every node/.style=draw] \draw[help lines] (0,0) grid (2,2); \node (some node) at (1,1) {some node}; @@ -1508,7 +1508,7 @@ differently. will result in nodes that are centered on ``grid coordinate'', hence the name of the option. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \begin{tikzpicture}[every node/.style=draw] \draw[help lines] (0,0) grid (2,3); @@ -1530,7 +1530,7 @@ differently. 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}. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \begin{tikzpicture}[every node/.style=draw,node distance=5mm] \draw[help lines] (0,0) grid (2,3); @@ -1595,7 +1595,7 @@ differently. % The following example should help to illustrate the difference: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \begin{tikzpicture}[every node/.style={draw,circle}] \draw[help lines] (0,0) grid (2,5); \begin{scope}[node distance=5mm and 5mm] @@ -1615,7 +1615,7 @@ differently. \end{tikzpicture} \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \begin{tikzpicture}[every node/.style={draw,rectangle}] \draw[help lines] (0,0) grid (2,5); \begin{scope}[node distance=5mm and 5mm] @@ -1635,7 +1635,7 @@ differently. \end{tikzpicture} \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \begin{tikzpicture}[every node/.style={draw,rectangle},on grid] \draw[help lines] (0,0) grid (4,4); \begin{scope}[node distance=1] @@ -1679,7 +1679,7 @@ The |positioning| package also introduces the following new placement keys: This key is useful for chaining together nodes so that their base lines are aligned. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \begin{tikzpicture}[node distance=1ex] \draw[help lines] (0,0) grid (3,1); \huge @@ -1734,7 +1734,7 @@ give the |fit| option to a node. The |fit| option expects a list of coordinates the node's text area has exactly the necessary size so that it contains all the given coordinates. Here is an example: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{fit,shapes.geometric}}] \begin{tikzpicture}[level distance=8mm] \node (root) {root} child { node (a) {a} } @@ -1751,7 +1751,7 @@ given coordinates. Here is an example: If you want to fill the fitted node you will usually have to place it on a background layer. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{backgrounds,fit,shapes.geometric}}] \begin{tikzpicture}[level distance=8mm] \node (root) {root} child { node (a) {a} } @@ -1792,7 +1792,10 @@ ways to achieve this: \item You can give transformation options \emph{inside} the option list of the node. \emph{These} transformations always apply to the node. % -\begin{codeexample}[] +\begin{codeexample}[ + preamble={\usepgfmodule{nonlineartransformations}\usetikzlibrary{curvilinear}}, + pre={\makeatletter}, +] \begin{tikzpicture}[every node/.style={draw}] \draw[help lines](0,0) grid (3,2); \draw (1,0) node{A} @@ -1820,7 +1823,10 @@ force: Section~\ref{section-nonlinear-transformations}. % \makeatletter -\begin{codeexample}[] +\begin{codeexample}[ + preamble={\usepgfmodule{nonlineartransformations}\usetikzlibrary{curvilinear}}, + pre={\makeatletter}, +] \begin{tikzpicture} % Install a nonlinear transformation: \pgfsetcurvilinearbeziercurve @@ -1960,7 +1966,7 @@ explicitly by using the |pos| option or implicitly by placing the node placement. That is, if |left| is the current |auto| placement, |right| is set instead and the other way round. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{automata}}] \begin{tikzpicture}[auto] \draw[help lines,use as bounding box] (0,-.5) grid (4,5); @@ -1972,7 +1978,7 @@ explicitly by using the |pos| option or implicitly by placing the node \end{tikzpicture} \end{codeexample} % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{automata}}] \begin{tikzpicture}[shorten >=1pt,node distance=2cm,auto] \draw[help lines] (0,0) grid (3,2); @@ -2132,7 +2138,7 @@ In addition to the |node| path operation, the two options |label| and |pin| can be used to ``add a node next to another node''. As an example, suppose we want to draw a graph in which the nodes are small circles: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \tikz [circle] { \node [draw] (s) {}; \node [draw] (a) [right=of s] {} edge (s); @@ -2149,7 +2155,7 @@ the start node and the last node is the target node. We could write option allow us to do exactly this without having to use the cumbersome |node| syntax: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{positioning}}] \tikz [circle] { \node [draw] (s) [label=$s$] {}; \node [draw] (a) [right=of s] {} edge (s); @@ -2338,7 +2344,7 @@ nodes. \begin{stylekey}{/tikz/every pin edge (initially help lines)} This style is used in every edge created by the |pin| options. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{decorations.pathmorphing}}] \tikz [pin distance=15mm, every pin edge/.style={<-,shorten <=1pt,decorate, decoration={snake,pre length=4pt}}] @@ -2403,7 +2409,7 @@ When a \meta{string} of the above form is encountered inside the options of a Let us have a look at an example: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz \node ["my label" red, draw] {my node}; \end{codeexample} % @@ -2417,7 +2423,7 @@ Here are further examples, one where no \meta{options} are added to the |label|, one where a position is specified, and examples with more complicated options in curly braces: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \begin{tikzpicture} \matrix [row sep=5mm] { \node [draw, "label"] {A}; \\ @@ -2470,7 +2476,7 @@ provides: the \meta{text} relative to the main node you can just put something like |left| or |above right| inside the \meta{options}: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz \node ["$90^\circ$" above, "$180^\circ$" left, circle, draw] {circle}; \end{codeexample} @@ -2479,7 +2485,7 @@ provides: your \meta{text}. This works since the |label| command allows you to specify a direction at the beginning when it is separated by a colon: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz \node ["90:$90^\circ$", "left:$180^\circ$", circle, draw] {circle}; \end{codeexample} @@ -2491,7 +2497,7 @@ provides: following style is also executed: % \begin{stylekey}{/tikz/every label quotes} -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz [every label quotes/.style=red] \node ["90:$90^\circ$", "left:$180^\circ$", circle, draw] {circle}; \end{codeexample} @@ -2505,7 +2511,7 @@ provides: just add curly braces around either the comma or just around the whole \meta{text}: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz \node ["{yes, we can}", draw] {foo}; \end{codeexample} % @@ -2513,7 +2519,7 @@ provides: specifically the colon by curly braces to stop the |label| option from interpreting everything before the colon as a direction: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz \node ["yes{:} we can", draw] {foo}; \end{codeexample} @@ -2542,7 +2548,7 @@ provides: instead of transforming quoted text to the |label| option, they get transformed to the |pin| option: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz [quotes mean pin] \node ["$90^\circ$" above, "$180^\circ$" left, circle, draw] {circle}; \end{codeexample} @@ -2577,7 +2583,7 @@ interpreted in a different manner, you can also define your own handlers: Here is an example, where the quotes are used to define labels that are automatically named according to the |text|: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikzset{node quotes mean={label={[#2,name={#1}]#1}}} \tikz { @@ -2783,14 +2789,14 @@ The following style is important for the placement of the labels: quotes-syntax to be placed next to the edges. Unless the setting of |auto| has been changed, they will be placed to the left. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz \draw (0,0) edge ["left", ->] (2,0); \end{codeexample} In order to place all labels to the right by default, change this style to |auto=right|: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz [every edge quotes/.style={auto=right}] \draw (0,0) edge ["right", ->] (2,0); \end{codeexample} @@ -2798,7 +2804,7 @@ The following style is important for the placement of the labels: To place all nodes ``on'' the edge, just make this style empty (and, possibly, make your labels opaque): % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz [every edge quotes/.style={fill=white,font=\footnotesize}] \draw (0,0) edge ["mid", ->] (2,1); \end{codeexample} @@ -2815,7 +2821,7 @@ placed on the other side. Because of the special treatment, you can even add another option like |near end| after the apostrophe without having to add curly braces and commas: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz \draw (0,0) edge ["left", "right"', "start" near start, @@ -2825,7 +2831,7 @@ braces and commas: In order to modify the distance between the edge labels and the edge, you should consider introducing some styles: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{quotes}}] \tikz [tight/.style={inner sep=1pt}, loose/.style={inner sep=.7em}] \draw (0,0) edge ["left" tight, "right"' loose, -- cgit v1.2.3