Document Classesarrow tips and double arrows in tikz pgf

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
leloo_d
Posts: 1
Joined: Wed Sep 24, 2008 11:32 am

arrow tips and double arrows in tikz pgf

Post by leloo_d »

Hi
I have a question concerning arrows in tikz pgf
I need to create a diagramm that looks like the one shown in the attatched picture. I suppose that this was done in tex to, but I do not know how.
(The diagramm is a representation of the Needham Schroeder Protocol modelled in Strand Spaces,a verification technique for security protocols).



I would like to do it with tikz pgf, but my problem is, that the double arrows do not look like the arrows in the sample. The tip is way to thick
(As far as I understood the explanation i found in the 300 pages manual, this has to do with the way double arrows are drawn: one thick line and than a thin line in the background color. )

Code: Select all

\draw [->,double,shorten <=1pt,>=angle 90,thick](A2) -- (A1);
\node  [place] (B2)[below of =B1] {}
	edge [double distance=2pt,->,>=angle 90,thick]node {b}(A2);
Thank you

Sarah
Attachments
Needham Schroeder as Strand Spaces
Needham Schroeder as Strand Spaces
needham schroeder.jpg (16.63 KiB) Viewed 40567 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

propell
Posts: 44
Joined: Fri May 30, 2008 11:16 am

arrow tips and double arrows in tikz pgf

Post by propell »

TikZ has a special option for sizing such arrows: 'double equal sign distance'
You should also use the -implies arrow style.

Here is a simple example that shows how it works:

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix}

\begin{document}

\begin{tikzpicture}[
    implies/.style={double,double equal sign distance,-implies},
    dot/.style={shape=circle,fill=black,minimum size=2pt,
                inner sep=0pt,outer sep=2pt},
]
\matrix[matrix of nodes] {
    |[dot,label=above:$A$] (A1)| {} &[2cm] |[dot,label=above:$B$] (B1)| {}\\[1cm]
    |[dot] (A2)| {} & |[dot] (B2)| {}\\
};
\draw (A1) edge[->] node[above] {${N_aA}_{K_B}$} (B1)
           edge[implies] (A2); 
\draw (B2) edge[->] node[above] {${N_aA}_{K_B}$} (A2)
           edge[implies,implies-] (B1); 
\end{tikzpicture}

\end{document}
Hope this helps.

- Kjell Magne Fauske
server988
Posts: 2
Joined: Fri Jun 26, 2009 4:04 pm

arrow tips and double arrows in tikz pgf

Post by server988 »

TikZ has a special option for sizing such arrows: 'double equal sign distance'
You should also use the -implies arrow style.

Here is a simple example that shows how it works:
First thanks very much for your answer.

Did you see my code ? Does this mean that i have to re-write a ' virtual ' matrix of nodes in order to have the proper arrows ?

And my problem is that when I try this :

Code: Select all

 \draw[|-,-|,->, thick ] (imp.east) |-+(0,0em)-| (ond.east);
I Get this : ( see attachement )


Starting with your code, could i draw the arrow the way i want to ?

Thanks

Code: Select all

I know your question was specifically about the tikz pgf, but I'm also drawing Strand Spaces pictures in latex. I've been successfully using \xymatrix for quite some time, and the pictures look exactly like shown in your example. For Needham-Schroeder, for instance, the code would be:
I don't know why it didn't work when i compiled it. Anyway maybe i can reach you with MSN.


By the way, i need to finish this tonight... because i have to show it in an exam.

I know that i should have done this a long time ago.... :oops: , anyway if anyone could help me to finish this i would be sooo grateful. Thanks
Attachments
Sans titre.png
Sans titre.png (26.09 KiB) Viewed 38176 times
Post Reply