10

Can I have any harpoons in TikZ?

I refer to my previous question on harpoons: "How to draw protocol interaction" using amsmath.
The closest thing I have found is this code:

\begin{tikzpicture}[decoration={bent,aspect=.3}]  
    \node[circle,draw] (A) at (.5,.5) {A};   
    \node[circle,draw] (B) at (3,1.5) {B};   
    \draw[->,decorate] (A) -- (B);   
    \draw[->,decorate] (B) -- (A);  
\end{tikzpicture}  

1 Answer 1

8

There are so called partial arrow tips in TikZ. Use for instance left to, right to, left hook or right hook. They are desribed in section 23.7 of the pfg 2.10 manual (22.6 in the pgf 2.0 manual).

Inserting this into your example:

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
    \node[circle,draw] (A) at (.5,.5) {A};   
    \node[circle,draw] (B) at (3,1.5) {B};   
    \draw[-left to] (A.north east) -- (B.west);   
    \draw[-left to] (B) -- (A);  
\end{tikzpicture}  
\end{document}

alt text

2
  • I saw that manual. I need two arrows over each other to show protocol interaction. Can you put two arrow connected to two nodes atop of each other in a way that implies simultaneous exchange of messages? Dec 11, 2010 at 15:31
  • @Yasser: I've added an example.
    – Stefan Kottwitz
    Dec 11, 2010 at 15:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .