I tried to draw the following diagram in LaTeX

enter image description here

I reference the method from here:

I can successfully compile the code from above link, but when I attempted to draw more lines between A and B by modifying the number in the:

\draw[shorten <=-1cm,shorten >=-1cm,-latex] (m-4-2.south west)--(m-4-2.south east);
\draw[shorten <=-1cm,shorten >=-1cm,-latex] (m-7-2.south east)--(m-7-2.south west);

I always got the error message said:

Package pgf Error: No shape named m-5-2 is known.

Any solution for this problem? Thanks.


Use a simple array environment:


\def\XLR#1{\xleftrightarrow[\rule{2cm}{0pt}]{#1}}% \rule defines the width

\begin{array}{@{} c c c @{}}
A  &  & B \\
   & \XLR{\text{KE}} \\
\text{obtain }k,T^A_{\text{KE}} &  & \text{obtain }k,T^B_{\text{KE}} \\
K:= \text{PRF}(k,\text{"KE"})   &  & K:= \text{PRF}(k,\text{"KE"})   \\
K_\text{mac}:= \text{PRF}(k,\text{"MAC"})   &  & K_\text{mac}:= \text{PRF}(k,\text{"MAC"}) \\
   & \XR{r_A} \\
   & \XL{r_B} \\

enter image description here

| improve this answer | |

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.