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}
  • 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). – Mark Wibrow May 1 '13 at 13:38
  • ...and remove the semitransparent key from the \draw command. – Mark Wibrow May 1 '13 at 13:39
7

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

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.