答案1
我一直太笨了,无法理解tikz
,所以我给出了一个解决方案tabular
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,array}
\begin{document}
\renewcommand*{\arraystretch}{2}
\begin{tabular}{|l|}
\hline
My procedure (input : c, input : d) \\
\hline
\begin{tabular}{r>{$}c<{$}l}
John does $a$\\
John calculates $b$ \\
& \xrightarrow{\qquad\text{sends $(a,b)$}\qquad} & Peter receives $a$, $b$ \\
& & calculates $c$, $d$ \\
& \xleftarrow{\qquad\text{sends $(c,d)$}\qquad}\\
John receives $c$, $d$
\end{tabular} \\
\hline
\end{tabular}
\end{document}