1

I try to make my text overlay over the stealth, as if that part of stealth is covered by the text and thus invisible.

What I have now is

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds, calc, positioning, fit}

\begin{document}

\begin{tikzpicture}
    \node[draw] (a) {A node};
    \node[draw,align=center] (b) at (0,-5) {Another\\node};
    \draw[-stealth] (a.west) --++ (-1, 0) |- (b.west)node[pos=0.4, above]{Text};
\end{tikzpicture}

\end{document}

which gives me

enter image description here

As can be seen the stealth "goes through" the text node, which is undesired.

How can I fix it?

1 Answers1

3

As Qrrbrbirlbel suggested, it's easy to place text node with a path command and draw the path with a posterior command. This way you don't need to fill text node to cover the stealth or use decorations to place a node over it.

\documentclass[tikz]{standalone}

\begin{document}
\begin{tikzpicture}
    \node[draw] (a) {A node};
    \node[draw,align=center] (b) at (0,-5) {Another\\node};
    % next command will place text node where you want. Assign a name to it.
    \path (a.west) --++ (-1, 0) |- (b.west)node[pos=0.4, above](text) {Text};
    % Draw a fragmented stealth
    \draw (a) -| (text);
    \draw[-stealth] (text) |- (b);
\end{tikzpicture}
\end{document} 

enter image description here

Ignasi
  • 136,588