Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to draw a stealth from destination node's east horizontally to the source node's west. I now can achieve this by adjusting the stealth length (trial-and-error) like so:

\draw[stealth-](dest.east)--++(0.31, 0)node[pos=0.5, above=0cm]{\tiny{\textbf{$R$}}};

But this nice intersection will collapse once the distance between them varies away from 0.31.

So I am looking for a way to make the stealth go horizontally until it reaches the west of src.west.


Using @percusse's method, I did the encountered problems when the stealth does not come out at the edge center.

Both

\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 (2,1) {Another\\node};
    \draw[-stealth] ($(a.north east)!0.1!(a.south east)$) -- (a-|b.east);
\end{tikzpicture}

\end{document}

and

\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 (2,1) {Another\\node};
    \draw[-stealth] ($(a.north east)!0.1!(a.south east)$) -- ($(a.north east)!0.1!(a.south east)$-|b.east);
\end{tikzpicture}

\end{document}

are not what I want. I want the stealth always horizontal. How may I fix it?

share|improve this question
3  
It's always preferred to have complete minimal example documents instead of code snippets that take some guesswork to complete. What's dest? Where does src come into play (it's only mentioned in your question, but not in the code)? What TikZ libraries are needed? –  Jake Oct 23 '13 at 9:50
    
I guess you may be looking for the edge path action... –  Bordaigorl Oct 23 '13 at 11:19
2  
Why not \draw[-stealth](source.west) -- (dest.east);? –  percusse Oct 23 '13 at 11:36
    
@percusse Oh, because they are not on the same horizontal level. Doing so will make the stealth not horizontal. I wish for a horizontal one. –  Sibbs Gambling Oct 23 '13 at 13:01
    
Could you provide a MWE? From the question it is not clear what you are asking. Does the path action -| go in the direction you are looking for? –  Bordaigorl Oct 23 '13 at 13:11

1 Answer 1

up vote 5 down vote accepted

Engaging crystal ball... (please put a minimal example instead of describing it)

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\node[draw] (a) {A node};
\node[draw,align=center] (b) at (2,1) {Another\\node};
\draw[-stealth] (a) -- (a-|b.east);
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
Aaaaah! Yes, that could be what perfectionm1ng wants. Nice clairvoyance! =) –  Jake Oct 23 '13 at 13:24
    
@Jake Yes! Exactly! Thanks to both of you! :) –  Sibbs Gambling Oct 23 '13 at 13:40
    
@Jake In English.... please.... :) –  percusse Oct 23 '13 at 14:12
    
@percusse: Um, "helderziendheid", according to Google? –  Jake Oct 23 '13 at 14:17
    
@Jake Heheh, fair enough. I would pretend that I have psychic powers. –  percusse Oct 23 '13 at 14:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.