Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can one draw "just the arrow tip" from one of the arrows in the arrow tip library in TikZ?

The problem is that if you try a brute-force solution, eg.

\tikz \draw[-triangle 90] (0,0) -- +(.1,0);

you run into trouble because this produces a small line, the (0,0) to (.1, 0) part, which cannot be removed (a remnant remains no matter if you change .1 to .00001). This is a problem when one wants to rotate the arrow for use in "dropping arrow tips" along a path, as in Andrew Stacey's solution from this question.

share|improve this question
    
If you just want the triangle, there are certainly other methods to get it. –  Thorsten Donig Dec 14 '11 at 17:04

2 Answers 2

up vote 10 down vote accepted
\documentclass{minimal}
\usepackage{tikz} 
\usetikzlibrary{arrows}

\begin{document}
\fbox{ \begin{tikzpicture}
\node[inner sep=0pt] {\tikz\draw[-triangle 90](0,0) ;};  
 \end{tikzpicture}} 
\fbox{ \begin{tikzpicture}
\node[rotate=90,inner sep=0pt] {\tikz\draw[-triangle 90](0,0) ;};  
 \end{tikzpicture}  }
\fbox{ \begin{tikzpicture}
\node[rotate=180,inner sep=0pt] {\tikz\draw[-triangle 90](0,0) ;};  
 \end{tikzpicture}  }
\fbox{  \begin{tikzpicture}
\node[rotate=270,inner sep=0pt] {\tikz\draw[-triangle 90](0,0) ;};  
 \end{tikzpicture}  }     

\end{document}

enter image description here

share|improve this answer
    
Nice. For some reason I felt that I had to draw from some point A to some other point B... just writing \draw[some arrow] (coordinate) never entered my mind. –  Bruce Bartlett Dec 14 '11 at 18:01
    
But what you want to do with the arrow tip ? Another solution is to get the code inside the source. The tip is a normal object. –  Alain Matthes Dec 14 '11 at 18:29
    
I wanted a "fixed up" version of Andrew Stacey's answer to the question "How to draw an arrow in the middle of a line"? The most elegant way to do this is now clear: you simply create a macro \myarrow which draws your favourite arrow tip. Then you can "drop" arrow heads very conveniently along curved paths, as follows: \draw (0,0) to[out=right, in=down] node {\myarrow} (1,1);. This way of doing it means you can drop multiple arrow heads along the path no hassle. –  Bruce Bartlett Dec 14 '11 at 20:41
    
@BruceBartlett: For putting separate arrows anywhere I prefer the solution from Altermundus. If you want to draw them at specified positions on paths, you should really have a look at the markings library though. I updated my answer with some examples. –  Roelof Spijker Dec 15 '11 at 8:54

You can use the markings decoration library like so:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows}
\begin{document}
\tikz\path[decoration={markings,mark=at position 1 with \arrow{triangle 90}}, decorate] (0,0);
\end{document}

That won't draw the line, only the arrow. You can change the coordinate to get it elsewhere.

Edit: I see from your comment that your intention with this is to get arrows on a cruved path. That just makes the markings method more useful, since markings can also be used like this:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows}
\begin{document}
  \begin{tikzpicture}
    \path[draw,%
          decoration={%
            markings,%
            mark=at position 0.0   with \arrow{triangle 90},%
            mark=at position 0.5   with \arrow{triangle 90},%
            mark=at position 0.999 with \arrow{triangle 90},% 1 does not work for some reason, not exactly sure why...
          },%
          postaction=decorate] (0,0) to[out=90, in=180] (2,2);
    \node at (3,1) {or};
    \path[xshift=4cm, draw,%
          decoration={%
            markings,%
            mark=between positions 0 and 1 step 5mm with \arrow{triangle 90},%
          },%
          postaction=decorate] (0,0) to[out=90, in=180] (2,2);
    \node at (7,1) {or};
    \path[xshift=8cm, draw,%
          decoration={%
            markings,%
            mark=at position 0   cm with \arrow{triangle 90},%
            mark=at position 0.5 cm with \arrow{triangle 90},%
            mark=at position 1   cm with \arrow{triangle 90},%
            mark=at position 2   cm with \arrow{triangle 90},%
            mark=at position 3   cm with \arrow{triangle 90},%
          },%
          postaction=decorate] (0,0) to[out=90, in=180] (2,2);
  \end{tikzpicture}
\end{document}

Which results in:

TikZ arrow markings

As you can see, you can give fractions of the path, there is a step syntax and you can give absolute positions on the path. You can place other things than arrows as well, pretty much anything you can draw with TikZ actually. The following is perfectly valid for instance:

mark=between positions 0 and 1 step 5mm with {\node[draw,circle,fill=blue!20, inner sep=1pt] {x};}
share|improve this answer
    
Thanks, I didn't know you could write \arrow{some arrow} to draw an arrow tip. –  Bruce Bartlett Dec 14 '11 at 17:57
    
Oh, I see that can't be done in normal code, it can only live inside the decoration environment. –  Bruce Bartlett Dec 14 '11 at 18:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.