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.

I draw a line with an arrow at the end by \draw[->] .... Now I would like to make the arrow bigger, and change its color to red (without impacting the line). Does anyone know how to do it?

share|improve this question
    
What do you mean by "bigger... without impacting the line"? Do you mean just to increase the size of the arrow-head? –  Niel de Beaudrap Sep 2 '11 at 17:08

3 Answers 3

up vote 10 down vote accepted

Here is three methods that works:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{tikzpicture}

\draw[red,
    decoration={markings,mark=at position 1 with {\arrow[scale=4,blue]{>}}},
    postaction={decorate},
    shorten >=0.4pt
    ]
    (0,1.0) -- (2,1.0);

\draw[draw=red,-triangle 90,fill=blue]  (0,0.5) -- (2,0.5);

\draw[red]  (0,0) -- (2,0);
\draw [-to,shorten >=-1pt,gray,ultra thick] (1.99,0) -- (2,0); 

\end{tikzpicture}
\end{document}

enter image description here

I think the first method presented here is probably the way to go but perhaps more elegant solutions will be presented by other.

share|improve this answer

I agree that Peter's solution is the way to go, and I think a more elegant (and reusable) solution would be to define a style using \tikzset. The below will make the style big blue arrow available in any picture in the document.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}

\begin{document}

\tikzset{
  big blue arrow/.style={
    decoration={markings,mark=at position 1 with {\arrow[scale=4,blue]{>}}},
    postaction={decorate},
    shorten >=0.4pt}}

\begin{tikzpicture}    
\draw[red, big blue arrow] (0,1.0) -- (2,1.0);

\draw[draw=red,-triangle 90,fill=blue]  (0,0.5) -- (2,0.5);

\draw[red]  (0,0) -- (2,0);
\draw [-to,shorten >=-1pt,gray,ultra thick] (1.99,0) -- (2,0); 

\end{tikzpicture}
\end{document}

It is also easy to define styles that accept an argument, and to specify a default value (I hope the code is self-explaining):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}

\begin{document}

\tikzset{
  big arrow/.style={
    decoration={markings,mark=at position 1 with {\arrow[scale=4,#1]{>}}},
    postaction={decorate},
    shorten >=0.4pt},
  big arrow/.default=blue}

\begin{tikzpicture}

\draw[red, big arrow] (0,1.0) -- (2,1.0);

\draw[red, big arrow=green]  (0,0.5) -- (2,0.5);

\end{tikzpicture}
\end{document}

output

share|improve this answer

As of PGF 3.0 (maybe another version; just going by the manual), it is a lot easier to change the style of the arrow tips compared to using post decorations. Here are similar version of the three examples given in the answer http://tex.stackexchange.com/a/27287/6993 by @Peter Grill above:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}    

  \draw[red, arrows={->[scale=4,blue]}] (0,0.0) -- (2,0.0);
  \draw[red, arrows={-Triangle[angle=90:10pt,red,fill=blue]}]  (0,1.0) -- (2,1.0);
  \draw[red, arrows={->[line width=5pt,gray,length=5mm,width=10mm]}] (0,2.0) -- (2,2.0); 

\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
+1, although I'm missing a screenshot :) –  quinmars May 7 at 0:39

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.