32

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?

1
  • What do you mean by "bigger... without impacting the line"? Do you mean just to increase the size of the arrow-head? Sep 2, 2011 at 17:08

3 Answers 3

29

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.

2
  • For me at position 1 did not always work. This might be a matter of low accuracy. I used at position 0.9999 as workaround. BTW: The second case, where the triangle should be filled did also not work for me; it is red. I use TikZ 3.0.1a.
    – John
    Mar 14, 2017 at 17:57
  • @John: I suspect your issue is related to Arrows disappear if 0.9999 is replaced with 1 in TikZ. If you still want to get to the bottom of this I suggest posting a new question with a MWE and showing the output you get. Mar 14, 2017 at 20:16
23

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 https://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

0
13

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .