Vous êtes sur la page 1sur 4

24

New Arrow Tips Library

A \usepgflibrary{arrows.new} % L TEX and plain TEX and pure pgf \usepgflibrary[arrows.new] % ConTEXt and pure pgf A \usetikzlibrary{arrows.new} % L TEX and plain TEX when using Tik Z \usetikzlibrary[arrows.new] % ConTEXt when using Tik Z This package introduces a new set of arrow tips derived from the predened ones and from those supplied in the arrows library. The new arrow tips keep the shape of the originals, but can be used both in the traditional fashion, as meta-arrows, and by explicitly specifying the arrow head size.

The names of the new arrow tips are formed by adding the adjective new after the original ones. So latex new, latex new, stealth new reversed, ) new, ( new, and fast cap new, for instance, are all available new arrow heads. Furthermore, > new and < new are aliases for to new and to new reversed, respectively. A complete list of the new arrow tips may be found at the end of the section for reference. If you want to use a new arrow tip as meta-arrow, that is you dont want to specify its size, then just follow the traditional syntax:
\begin{tikzpicture} \draw [-latex new] (0,0) -- (1,0); \draw [-latex new, ultra thick] (0,-0.5) -- (1,-0.5); \draw [) new-] (1.2,-0.25) -- (2.2,-0.25); \end{tikzpicture}

Otherwise, if you want to specify the tip size regardless of the shaft thickness, you simply need to set the arrow head key: /tikz/arrow head= dimension (default -1pt) Sets the size of the arrow tip. For the majority of the new arrows, the size of the tip means in fact its length, except ) new, ] new, | new, hooks new, and their reversed forms for which the size means the width of the tip and left hook new, right hook new, and their reversed forms for which it means in fact the width of the analogous hooks new arrow tip. All the new line caps, implies new, serif cm new, and space new are simply copies of the originals added just for completeness, i.e. implies new is the same as implies, for example. Therefore, for these arrow tips the arrow head key has obviously no eect.
\begin{tikzpicture} \useasboundingbox (-0.1,0.1) rectangle (2.3,-3.1); \draw [-latex new, arrow head=0.15in] (0,0) -- (1,0); \draw [-latex new, ultra thick, arrow head=10.8pt] (0,-0.5) -- (1,-0.5); \draw [) new-, arrow head=0.5cm] (1.2,-0.25) -- (2.2,-0.25); \draw [hooks new-left hook new, arrow head=3mm] (0,-1) -- (1,-1); \draw [right hook new-hooks new, arrow head=3mm] (1.2,-1) -- (2.2,-1); \draw [-stealth new, arrow head=0.5in, line width=2pt, fill=blue] (0,-3) -- (2.2,-1.5); \end{tikzpicture}

Setting the arrow head key to a negative value or not providing any value at all is the same as using the original meta-arrows, so the following lines of code are all equivalent:
\tikz \tikz \tikz \tikz \draw \draw \draw \draw [-to] (0,0) -- (1,0); [-to new] (0,0) -- (1,0); [-to new, arrow head] (0,0) -- (1,0); [-to new, arrow head=-10pt] (0,0) -- (1,0);

The use of the command \pgfsetarrowoptions instead of the arrow head key is allowed but discouraged, because it overwrites the normal behaviour unless a new negative value is provided afterwards, as in the following example:
\begin{tikzpicture} \useasboundingbox (-0.1,0.2) rectangle (1.1,-0.6); \pgfsetarrowoptions{square new}{10pt} \draw [-square new] (0,0) -- (1,0); \pgfsetarrowoptions{square new}{-1pt} \draw [-square new] (0,-0.5) -- (1,-0.5); \end{tikzpicture}

Of course, the new arrows can be used as markings too, see Section 31. 258

24.1

Possible riddles and issues

Depending on its size, when an arrow tip lies close to the border of the picture, the bounding box may be computed inaccurately:
\tikz\draw [-angle 90 new, arrow head=2.5mm] (0,0) -- (1,0);

In such a case, you should override the automatic bounding mechanism by means of the \useasboundingbox command, as in some of the preceding examples, or with some kind of invisible path. The scale key has no eect on the arrow tip size, so if you need to scale both the head and the shaft of an arrow, you have to set the scaled arrow tip size somehow, for instance:
\begin{tikzpicture} \draw [-> new, arrow head=1.5pt] (0,0) -- (1,0); \draw [-> new, arrow head=1.5pt, scale=2] (0,-0.2) -- (1,-0.2); \draw [-> new, arrow head=3pt, scale=2] (0,-0.4) -- (1,-0.4); \end{tikzpicture}

The new arrows are designed to work properly in most cases, but as the size of the tip can be set regardless of the line width, its up to the user to work with suitable values. About the stroked arrow heads, you need to leave enough room for the lines to be drawn, taking into account the thickness, the line caps, and the line joins. For example, for a 1pt-thick o new arrow, the size of the tip should be greater than 2pt to work as expected, or the inner radius of the ring would be zero or negative. So, if you want to ll a closed arrow head, you should ensure that its interior is not empty, i.e. its inner area is not zero. Look at the following clarifying examples: correct behaviour wrong behaviour
\begin{tikzpicture} \useasboundingbox (-0.3,0.7) rectangle (3.3,-4.3); \node at (0.5,0) [align=center, anchor=base] {correct\\behaviour}; \node at (2.5,0) [align=center, anchor=base] {wrong\\behaviour}; \draw [-angle 45 new, line width=4pt, arrow head=24pt] (0,-1) -- (1,-1);% this works properly \draw [-angle 45 new, line width=4pt, arrow head=4pt] (2,-1) -- (3,-1);% this works properly \draw [-o new, line width=4pt, arrow head=12pt] (0,-2.5) -- (1,-2.5);% this works properly \draw [-o new, line width=4pt, arrow head=4pt] (2,-2.5) -- (3,-2.5);% this doesnt work properly \draw [-diamond new, line width=4pt, arrow head=20pt, fill=red] (0,-4) -- (1,-4);% this works properly \draw [-diamond new, line width=4pt, arrow head=10pt, fill=red] (2,-4) -- (3,-4);% this doesnt properly \end{tikzpicture}

As to non-stroked arrow heads (latex new, latex new, and stealth new), if the line thickness twice as much for double arrows approaches or exceedes the tip width, the arrow shaft may protrude from the frame of the arrow tip, as in the following examples: correct behaviour wrong behaviour
\begin{tikzpicture} \node at (0.5,0) [align=center, anchor=base] {correct\\behaviour}; \node at (2.5,0) [align=center, anchor=base] {wrong\\behaviour}; \draw [-stealth new, line width=4pt, arrow head=18pt, red, fill=blue] (0,-1) -- (1,-1);% this works properly \draw [-stealth new, line width=14pt, arrow head=18pt, red, fill=blue] (2,-1) -- (3,-1);% this doesnt work properly \draw [-latex new, line width=4pt, arrow head=18pt, red, fill=blue] (0,-2.5) -- (1,-2.5);% this works properly \draw [-latex new, line width=18pt, arrow head=18pt, red, fill=blue] (2,-2.5) -- (3,-2.5);% this doesnt work properly \draw [-latex new, line width=4pt, arrow head=10pt, red, fill=blue] (0,-4) -- (1,-4);% this works properly \draw [-latex new, double, line width=4pt, arrow head=10pt, red, fill=blue] (2,-4) -- (3,-4);% this doesnt work properly \end{tikzpicture}

Finally, about to new, left to new, and right to new arrow heads, you should bear in mind that the join between the shaft and the tip has been set arbitrarily, because it is too dicult and time consuming to calculate its exact position taking into account the line thickness. For this reason, there is a remote chance that the shaft will protrude from the frame of the tip, or detach from it, depending on whether the arrow head length-to-line-width ratio is very large or very small, respectively. In such cases, using these new arrow tips as markings, along with the shorten > or shorten < key, can be resolving. 259

24.2

Complete list of the new arrows

The complete set of the new arrows is displayed below, just for reference. Each arrow tip is drawn both in the traditional fashion and by setting the arrow head key to an arbitrary value for illustrative purposes, whenever applicable. 24.2.1 New Mathematical Arrow Tips yields default yields default yields default and 3 points-long and 3 points-long

to new to new reversed implies new 24.2.2

New Triangular Arrow Tips yields yields yields yields yields yields yields yields yields yields yields yields yields yields yields yields yields yields yields yields default default default default default default default default default default default default default default default default default default default default and and and and and and and and and and and and and and and and and and and and 7 7 7 7 7 7 7 7 5 5 7 7 7 7 5 5 7 7 7 7 points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long points-long

latex new latex new reversed latex new latex new reversed stealth new stealth new reversed stealth new stealth new reversed triangle 90 new triangle 90 new reversed triangle 60 new triangle 60 new reversed triangle 45 new triangle 45 new reversed open triangle 90 new open triangle 90 new reversed open triangle 60 new open triangle 60 new reversed open triangle 45 new open triangle 45 new reversed 24.2.3 angle angle angle angle angle angle hooks hooks 24.2.4 New Barbed Arrow Tips 90 new 90 new reversed 60 new 60 new reversed 45 new 45 new reversed new new reversed yields yields yields yields yields yields yields yields

default default default default default default default default

and and and and and and and and

4 4 5 5 5 5 9 9

points-long points-long points-long points-long points-long points-long points-wide points-wide

New Partial Arrow Tips yields yields yields yields yields yields yields yields default default default default default default default default and and and and and and and and 3 3 3 3 9 9 9 9 points-long points-long points-long points-long points-wide points-wide points-wide points-wide

left to new left to new reversed right to new right to new reversed left hook new left hook new reversed right hook new right hook new reversed 24.2.5

New Serif-Like Arrow Tips yields default

serif cm new

260

24.2.6 [ ] ( ) |

New Bracket-Like Arrow Tips new new new new new yields yields yields yields yields default default default default default and and and and and 9 9 9 9 9 points-wide points-wide points-wide points-wide points-wide

new-] new-[ new-) new-( new-|

24.2.7

New Circle, Diamond and Square Arrow Tips yields yields yields yields yields yields default default default default default default and and and and and and 7 7 7 7 7 7 points-long points-long points-long points-long points-long points-long

o new * new diamond new open diamond new square new open square new 24.2.8

New Line Caps yields yields yields yields yields yields for for for for for for line line line line line line width width width width width width 1ex 1ex 1ex 1ex 1ex 1ex

round cap new butt cap new triangle 90 cap new triangle 90 cap new reversed fast cap new fast cap new reversed 24.2.9 New Spacing Tips yields default

space new

261

Vous aimerez peut-être aussi