6

How to tell tikz not to apply the (otherwise useful) effect of "adding" (incidentally: how does tikz calculate the opacity-factor here? Obviously, it is not literally "adding" the values, for then the overlapping region would be rendered with 0.5+0.5=1.0=black.) partially transparent regions in one and the same arrow? Example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}

 \begin{document}
 \thispagestyle{empty}
 \begin{tikzpicture}
  \node (a) at (0,0) [] {};
  \node (b) at (100pt,0) [] {};
  \draw[->,line width = 20pt,opacity=0.5] (a)--(b);
 \end{tikzpicture}

\end{document}

enter image description here

5

Opacity is applied to each path separately and hence overlapping paths look "odd". For this reason, paths need to be connected when the same opacity needs to be applied to all of them. To achieve this, use a scope with the option [transparency group]. This key applies the proper opacity with no overlapping. In your case,

\begin{scope}[transparency group, opacity = 0.5]
\node (a) at (0,0) [] {};
\node (b) at (100pt,0) [] {};
\draw[->,line width = 20pt] (a)--(b);
\end{scope}

In the pgf manual, this is explained in section 23.5, Transparency Groups.

As for your question regarding several opacities: Opacities are generally multiplicative. You can set the way of multiplication (regarding colour, cut-off and son) via [blend mode =], as detailed in section 23.3, same manual. (Again, the key has to be applied to a surrounding scope, not the path itself.) Manual can be found here: http://ctan.org/pkg/pgf

| improve this answer | |
2

Use transparency group

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
  \thispagestyle{empty}
  \begin{tikzpicture}
    \begin{scope}[transparency group, opacity=0.5]
      \node (a) at (0,0) [] {};
      \node (b) at (100pt,0) [] {};
      \draw[->,line width = 20pt] (a)--(b);
    \end{scope}
  \end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |

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.