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
add comment

2 Answers

up vote 7 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
add comment

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
add comment

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.