9

How can I set the transparency so that the arrow belongs to the same transparency group as the path?

enter image description here

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
  \tikzset{%
    > = stealth,
    arrow over path/.style = {%
      decoration = {%
        markings,
        mark = at position .5 with {\arrow {>};}
      },
      postaction = decorate
    }
  }
  \draw[arrow over path, semitransparent] (0,0) -- (1,1);
\end{tikzpicture}
\end{document}
2
  • 1
    I don't think this can be done easily within a path (but I could be wrong). Surrounding the \draw command with \begin{scope}[opacity=.5,transparency group] and \end{scope} should work (provided the back-end driver supports it). May 1, 2013 at 13:38
  • ...and remove the semitransparent key from the \draw command. May 1, 2013 at 13:39

1 Answer 1

8

As requested, the comment becomes an answer:

This cannot be done currently within a path as far as I can tell. But, a transparency group can be used (provided the back-end driver supports it). Note, that the transparency is specified in the surrounding scope not the path:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\tikzset{%
    > = stealth,
        arrow over path/.style = {%
        decoration = {%
        markings,
        mark = at position .5 with {\arrow {>};}
        },
        postaction = decorate
    }
}
\begin{scope}[opacity=.5, transparency group]
    \draw [arrow over path] (0,0) -- (1,1);
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

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