8

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.

1 Answer 1

6

you can do only

  \draw[black!50] (5,0) to[bend left] ++(right:1cm); 
3
  • Works for me, thanks. I didn’t think of just leaving out the fill or draw key.
    – ilpssun
    Mar 14, 2012 at 8:36
  • This is very useful, I had been looking for that for ages ! Mar 19, 2013 at 8:03
  • 3
    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, 2014 at 21:15

You must log in to answer this question.

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