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?

2
  • I suggest you to have a look to the library decorations.text. Nov 12 '13 at 6:26
  • You can add fill=white to the node. You can use the decorations.markings library (which doesn’t work good for lines with an arrow tip, but you could only use the vertical part) or you place the node first and then you connect the nodes. See path with both mark connection node and arrow tip Nov 12 '13 at 6:40
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

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.