0

I need to draw an arrow that looks like the usual \Rightarrow but has a blue outline with 0.5 opacity. I can get this far:

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

\begin{document}

\begin{tikzpicture} \draw (-1.5,-0.7) rectangle (1.5,0.7); \draw[-{implies}, double equal sign distance, blue] (-1,0) -- (1,0); \end{tikzpicture}

\end{document}

arrow1

As soon as I change the opacity, though, this happens:

\begin{tikzpicture}
    \draw (-1.5,-0.7) rectangle (1.5,0.7);
    \draw[-{implies}, double equal sign distance, blue, opacity = 0.5] (-1,0) -- (1,0);
\end{tikzpicture}

arrow2

Is there something wrong with my syntax, or is this an unavoidable behavior of this kind of arrow?

1 Answers1

1

It can never work. You need to ask a question about what you want to achieve.

To get rid of the effect, you talk about, you can use a transparency group like this:

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{arrows.meta, patterns}
\begin{document}
\begin{tikzpicture}
%\pattern[pattern=checkerboard] (-1.5,-0.7) rectangle (1.5,0.7);
\begin{scope}[transparency group, opacity=0.5]
\draw[-{Implies}, double equal sign distance, blue] (-1,0) -- (1,0);
\end{scope}
\end{tikzpicture}
\end{document}

Light blue double arrow

But with something in the background(the only reason to make something transparent)

Double arrow with mixed colors on checker board

It can be seen that the middle of the double line is not empty but filled with the background color(white) and this covers the pattern.

A double line is really just drawing twice - first a fat blue line and then a center white line.


Edit: I suppose that it works with a transparency group in the particular case where the thing in the background is not behind the center of the double line:

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\fill (-1,0.4) to[bend right] (1,0.25);
\begin{scope}[transparency group, opacity=0.5]
\draw[-{Implies}, double equal sign distance, blue, very thick] (-1,0) -- (1,0);
\end{scope}
\end{tikzpicture}
\end{document}

Light blue double line with a black area

  • Thanks, this works! – Lorenzo Riva Feb 18 '24 at 17:26
  • @LorenzoRiva: Strange - I am making the argument that it does not work. I am curious of what you your use case is!? – hpekristiansen Feb 18 '24 at 17:32
  • Just found that you can use nfold see e.g. https://tex.stackexchange.com/a/709938/8650 – hpekristiansen Feb 18 '24 at 22:02
  • Sorry for the delay in my response. Since all I wanted was for the contour of my arrow to be blue and slightly transparent I used your first example with transparency group. It appears on a white background so the issue you bring up does not occur. Thank you! – Lorenzo Riva Feb 28 '24 at 15:13
  • But you must have something else in the background otherwise it does not make sense to make the arrow transparent. It is like installing a window right in front of a brick wall - no nothing to be seen. – hpekristiansen Feb 28 '24 at 16:34
  • Aaaah, I see what's happening. There are two distinct arrows I need to draw in the picture I want. The first is a normal blue arrow with 0.5 opacity that crosses a red label (which is in the foreground). The second is the Implies arrow with blue contour. Strictly speaking the latter does not need to be transparent because it is not crossing anything in the foreground, but I would like its contour to have the same shade of blue as the first arrow. So either 1. I use your method to achieve the same color while adding unnecessary transparency, or 2. I find a way to match the blue... – Lorenzo Riva Feb 28 '24 at 17:19
  • ... in the second arrow to the toned down blue in the first arrow. I know I should go for the second method but I am worried about a different part of my paper at the moment and so I don't really feel like scouring the TikZ documentation for the correct commands. – Lorenzo Riva Feb 28 '24 at 17:21