I want to draw a picture with some text masking the background shape lines. I tried with opacity but the fill is not very nature.
\documentclass[border=5mm, convert, usenames, dvipsnames]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes, positioning, calc, arrows.meta, fit}
\begin{document}
\begin{tikzpicture}
\node [draw, rectangle, minimum width=2cm, minimum height=4cm] (a) {};
\node [draw, rectangle, minimum width=2cm, minimum height=4cm, right = 1cm of a] (b) {};
\draw [->, >=latex] (a) to node [above, fill, opacity=0.2,text opacity=1] {HelloWorld} (b);
\end{tikzpicture}
\end{document}
However what I want is like this
Forget the background color, i use some image editing tool to get this. What I want is that part of rectangle shape line dissolved behind the text. I tried to use backgrounds but it also don't work.
Is there a possible solution?




fill=white,fill opacity=1? – Oct 16 '18 at 14:37fill=whitewill mask the arrow line below.yshiftmay be added as a workaround. But I am wondering if there are some elegant way of "fill of no color", it is better that it only mask the lines intersecting with the text – Eric Sun Oct 16 '18 at 14:46\begin{document} \begin{tikzpicture} \node [draw, rectangle, minimum width=2cm, minimum height=4cm] (a) {}; \node [draw, rectangle, minimum width=2cm, minimum height=4cm, right = 1cm of a] (b) {}; \path (a) to node [above, fill=white] {HelloWorld} (b); \draw [-latex] (a) to (b); \end{tikzpicture} \end{document}`
– Oct 16 '18 at 14:51fill=whitecan be replaced with things likefill=nocolorso that I can use the generated png in any color background – Eric Sun Oct 16 '18 at 15:02save pathanduse path(from this answer) to define thereversecliptrick (see this answer) to spare out the node when drawing the boxes. A correspondingERASERstyle has been defined here. – Oct 16 '18 at 15:27