14

Drawing a semi-transparent arrow should be easy enough, right?

\documentclass{article}

\usepackage{tikz}
%\usetikzlibrary{arrows} % this doesn't change the result

\pagenumbering{gobble}

\begin{document}

\begin{tikzpicture}
  \draw[-stealth,line width=12pt,opacity=0.5] (0, 0) -- (0, 2);
\end{tikzpicture}

\end{document}

However, this produces the following result:

Result of the above MWE, demonstrating an arrow with overlapping regions in the rectangle and arrowhead

Note that the arrow is darker than it should be where the rectangle and arrowhead overlap.

How can I get an arrow of this shape and size without this artifact? (Clean solutions preferred.)

  • It's a lot easier to stick an arrowhead on the end of a line than combine the two into a single shape. Hmmm, create an outline then fill it? – John Kormylo Feb 11 '15 at 20:49
  • 7
    This is what the transparency group feature is for: wrap your arrow in \begin{scope}[transparency group, opacity=0.5] ... \end{scope} – Jake Feb 11 '15 at 21:16
  • 2
    @jake - And after all the work I just did creating a new arrowhead! – John Kormylo Feb 11 '15 at 22:29
  • 1
    @Jake An answer? – cfr Feb 11 '15 at 23:11
  • Related: tex.stackexchange.com/q/217912/1952 – Ignasi Feb 18 '15 at 17:38
19

This is what the transparency group feature is for: wrap your arrow in \begin{scope}[transparency group, opacity=0.5] ... \end{scope}:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw [line width=10pt, cyan] (-1,0) -- (1,2);
\begin{scope}[transparency group, opacity=0.75]
\draw[-stealth,line width=12pt, red] (0, 0) -- (0, 2);
\end{scope}
\end{tikzpicture}

\end{document}
  • Perfect—thanks very much! For reference, this is on pp. 240–241 of texdoc tikz, v2.10. – wchargin Feb 12 '15 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.