# Protocol in Latex

I want to create a protocol like the following picture. I also mention I work in beamer.

My attempt is

$\begin{array}{c c c} \text{\textsf{\underline{\textbf{Prover}}}} & & \text{\textsf{\underline{\textbf{Verifier}}}} \\ k_{\text{sk}},\,k_{r},\,k_{b} \xleftarrow{\} \mathbb{Z}_q & & \\ A_y = g^{k_\text{sk}} & & \\ A_D = D^{k_\text{r}} & & \\ A_{\Bar{y}} = (\frac{y}{\Bar{y}})^{k_r} & \xrightarrow{\hspace{1em}A_y,\,A_D,\,A_{\Bar{y}}\hspace{1em}} & \\ & & c\xleftarrow{\} \mathbb{Z}_q \\ & \xleftarrow{\hspace{2.7em}c\hspace{2.7em}} & \\ \end{array}$


I want the letters to start from a straight line.

• And, what's the problem? Sep 21 at 8:06
• @Ignasi I want the letters to start from a straight line. Sep 21 at 8:10
• @mathali Can you update your question so it actually says what the problem is? The title, as it is now, is rather non-descriptive and unlikely to help future users with the same problem to find a solution. Sep 21 at 8:33

You also want to align the three = symbols vertically, right?. If that's the case, using two additional, nested array environments for the material in the "Prover" column will let you accomplish your formatting goal.

I would also like to suggest that you simplify and streamline your code. E.g., I believe that \text{\textsf{\underline{\textbf{Prover}}}} may be written more succinctly as \underline{\textbf{Prover}}.

\documentclass{beamer}
\begin{document}
\begin{frame}

$\begin{array}{@{} ccc @{}} \underline{\textbf{Prover}} & & \underline{\textbf{Verifier}} \\[1ex] \setlength\arraycolsep{0pt} \begin{array}[b]{l} k_{\mathsf{sk}},\, k_{r},\, k_{b} \xleftarrow{\} \mathbb{Z}_q \\ \begin{array}[b]{ll} A_y & {}= g^{k_\mathsf{sk}} \\ A_D & {}= D^{k_\mathsf{r}} \\ A_{\Bar{y}} & {}= (y/\Bar{y})^{k_r} \end{array} \end{array} & \xrightarrow{\hspace{1em} A_y,\, A_D,\, A_{\Bar{y}} \hspace{1em}} \\ & & c\xleftarrow{\} \mathbb{Z}_q \\ & \xleftarrow{\hspace{2.7em}c\hspace{2.7em}} \end{array}$

\end{frame}
\end{document}


A solution with the fleqn environment from nccmath and some simplifications of your code:

    \documentclass{article}
\usepackage{amsfonts}
\usepackage{nccmath}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}

\begin{document}

\begin{fleqn}
$\begin{array}{@{}l c c} \textsf{\underline{\textbf{Prover}}} & & \textsf{\underline{\textbf{Verifier}}} \\ k_{\text{sk}},\,k_{r},\,k_{b} \xleftarrow{\} \mathbb{Z}_q & & \\ A_y = g^{k_\text{sk}} & & \\ A_D = D^{k_\text{r}} & & \\ A_{\Bar{y}} = (\frac{y}{\Bar{y}})^{k_r} & \xrightarrow{\hspace{1em}A_y,\,A_D,\,A_{\Bar{y}}\hspace{1em}} & \\ & & c\xleftarrow{\} \mathbb{Z}_q \\ & \xleftarrow{\hspace{2.7em}c\hspace{2.7em}} & \\ \end{array}$
\end{fleqn}

\end{document}


• Oh: yes ! I should have changed the specifier of the first column in the array! Thanks, Mico, I'lll fix that instantly. Sep 21 at 8:56