7

Can we define a style telling "put all arrows on the same transparency group as the path" ?

In the following example, I would like to redefine ephemeral style such that the blue and the red arrows look the same (with no visible overlapping between the end of the path and the arrow's head).

How can I do that?

\documentclass[varwidth,border=50]{standalone}
\usepackage{tikz}
\begin{document}

\tikzset{
  ephemeral/.style = {opacity=.35}
}
\begin{tikzpicture}
  \draw[ephemeral, ultra thick,-latex, blue] (0,0) -- (1,0);
  \begin{scope}[opacity=.35, transparency group, yshift=-.5cm]
    \draw[ultra thick,-latex, red] (0,0) -- (1,0);
  \end{scope}
\end{tikzpicture}
\end{document}

enter image description here

4

Can you use arrows.meta TiKZ 3.0 library? Is it the inset value for your arrows 0 like in LaTeX (latex) kind of arrows?

If your answer was yes to both questions you can use an arrow like -{.Latex}. In arrows.meta syntax . forces the line to stop just before the arrow tip. Next figure shows the result, top most arrows is declared with -{.Latex} and the second with -{LaTeX}.

enter image description here

\documentclass[varwidth,border=50]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}

\tikzset{
  ephemeral/.style = {opacity=.35}
}
\begin{tikzpicture}
  \draw[ephemeral, ultra thick,-{.Latex}, blue] (0,.5) -- (1,0.5);
  \draw[ephemeral, ultra thick,-{Latex}, blue] (0,0) -- (1,0);
  \begin{scope}[opacity=.35, transparency group, yshift=-.5cm]
    \draw[ultra thick,-.Latex, red] (0,0) -- (1,0);
  \end{scope}
\end{tikzpicture}
\end{document}

Note: Don't trust on TeXworks viewer to watch the result, use another pdf viewer. In TeXworks viewer the figure looks like

enter image description here

  • Thanks for your answer. Unfortunately, this works well only for straight lines (in some viewers). You can check with \draw[ephemeral, ultra thick,-{.Latex}, blue] (0,.5) parabola (1,1.5);. And there is another problem, not only the TeXworks fails. Under Windows, Sumatra and the viewer of TikzEdt fails too. Chrome is ok for straight lines, like Acrobat. But strangely, for curved lines, Chrome and Acrobat fails in a different way. – Kpym Dec 19 '14 at 17:34
  • @Kpym Your welcome. I knew it was just a very partial solution. But after reading section about transparency group I think there are no general one. – Ignasi Dec 19 '14 at 18:10
  • I think too, that there is no "standard" solution. But some hack may allow to insert before and after the path scope the begin/end transpagancy group, in the spirit of tex.stackexchange.com/a/20426/9335. One more time a good hook system is missing in TikZ :( – Kpym Dec 19 '14 at 19:40

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.