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.

For many TikZ diagrams, I’d like to draw colored (often gray) arrows. I prefer the latex-style arrow tips (from the arrows library). These are filled by using the default background fill color. My problem is that complex paths cannot have a fill=… key because that would mean “fill the path (and the arrow tip)” rather than “fill the arrow tip” as in the following MWE:

\documentclass{minimal}

\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{tikzpicture}[>=latex, ->]
  % okay: all black
  \draw[] (2,0) to[bend left] ++(right:1cm); 

  % not okay: gray line, black tip
  \draw[draw=black!50] (3,0) to[bend left] ++(right:1cm); 

  % not okay: gray line, gray tip, path filled
  \draw[draw=black!50, fill=black!50] (4,0) to[bend left] ++(right:1cm); 

  % okay, but complicated: gray line, gray tip, path not filled
  \begin{scope}[fill=black!50]
    \draw[draw=black!50] (5,0) to[bend left] ++(right:1cm);
  \end{scope}
\end{tikzpicture}
\end{document}

Output

The last arrow actually achieves the correct result – i. e., gray arrow, gray arrow tip, no background fill for path – but it is a bit cumbersome to use a scope for every colored arrow that I'm drawing. So my question: Is there an easier way of influencing the arrow tip fill color?

BTW, I’m aware of the solution using the marking library in How to make an arrow bigger and change its color in TikZ?, but I was hoping for a more elegant solution because using markings feels not very “natural” compared to using lines and arrow tips in TikZ.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

you can do only

  \draw[black!50] (5,0) to[bend left] ++(right:1cm); 
share|improve this answer
    
Works for me, thanks. I didn’t think of just leaving out the fill or draw key. –  ilpssun Mar 14 '12 at 8:36
    
This is very useful, I had been looking for that for ages ! –  Vincent Fourmond Mar 19 '13 at 8:03
    
I feel stupid but I don't get this. How is this different from \draw[draw=black!50] (3,0) to[bend left] ++(right:1cm); in the OP's example? I just get a gray arrow with a black tip if I leave out the fill. –  badroit Oct 14 at 21:15

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.