# Fitting an array of formulas to the frame

i have drawn a picture with the following code :

 \documentclass{beamer}
\usepackage{amsmath,amssymb,booktabs}
\usetheme{Warsaw}
\begin{document}
\begin{frame}
$\begin{array}{@{}l@{}c@{}l@{}} \toprule \hat{A} && \hat{B} \\ (a,A=g^a) && (b,B=g^b) \\ x\in_R[1,q-1] ,\quad X=g^{H_1(x,a)} \\ & \xrightarrow{\textstyle X } \\ && y\in_R [1,q-1] ,\quad Y=g^{H_1(y,b)} \\ & \xleftarrow {\textstyle Y } \\ K=H_2(Y^a,B^{H_1(x,a)},Y^{H_1(x,a)},\hat{A},\hat{B}) \\ && K=H_2(A^{H_1(y,b)},X^b,X^{H_1(y,b)},\hat{A},\hat{B}) \\ \bottomrule \end{array}$
\end{frame}
\end{document}


it likes this Can someone help me to adjust it to frame? thanks

it appears again....

\begin{array}{@{}c@{}c@{}c@{}}
\toprule
\hat{A}&&\hat{B}  \\
(a,A=g^a)&&(b,B=g^b)  \\
x\in_R\mathbb{Z}_q ,X=g^{H_1(x,a)} \\
\delta_{\hat{A}}=SIG.Sign(a,\hat{B}\parallel\hat{A}\parallel X)  \\
&\xrightarrow{\displaystyle (\hat{B},\hat{A},X,\delta_{\hat{A}})} \\

&& Verify  X\in \mathbb{Z}_q    \\
&&SIG.Verify(A,\delta_{\hat{A}},\hat{B}\parallel\hat{A}\parallel X) \\
&& y\in_R \mathbb{Z}_q , Y=g^{H_1(y,b)}  \\
&& \delta_{\hat{B}}=SIG.Sign(b,\hat{A}\parallel\hat{B}\parallel X \parallel   \delta_{\hat{A}} \parallel Y) \\
& \xleftarrow {\displaystyle (\hat{A},\hat{B},X,Y,\delta_{\hat{B}}) } \\
&&  K=H(X^y) \\
Verify Y\in\mathbb{Z}_q \\
SIG.Verify(B,\delta_{\hat{B}},\hat{A}\parallel\hat{B}\parallel X \parallel \delta_{\hat{A}} \parallel Y) \\
K=H(Y^x) \\
\bottomrule
\end{array}


like this i really don't know why?

• You may add \footnotesize at the beginning of your frame. Commented Sep 24, 2013 at 5:11

## 1 Answer

I would really reconsider doing this because not only it looks very ugly but also doesn't convey much of a message in terms of mapping back and forth. But here is a fit

\documentclass{beamer}
\usepackage{amsmath,amssymb,booktabs}
\usetheme{Warsaw}
\begin{document}
\begin{frame}
$\begin{array}{@{}r@{}c@{}l@{}} \hat{A} && \hat{B} \\ (a,A=g^a) && (b,B=g^b) \\ x\in_R[1,q-1] && \\ X=g^{H_1(x,a)} &&\\ & \xrightarrow{\displaystyle X } \\ && y\in_R [1,q-1],\\ &&Y=g^{H_1(y,b)}\\ & \xleftarrow {\displaystyle Y } \\ K=H_2(Y^a,B^{H_1(x,a)},Y^{H_1(x,a)},\hat{A},\hat{B}) \\ &=&H_2(A^{H_1(y,b)},X^b,X^{H_1(y,b)},\hat{A},\hat{B}) \\ \end{array}$
\end{frame}
\end{document}


• i've got another example but it appears the problem i give in the picture again ,i don't know why please help me
– Nax
Commented Sep 24, 2013 at 7:17
• @Alex It's not a problem. You are filling up the frame with excessive amount of material and the paper area is limited. You have to find another way to convey your message. Commented Sep 24, 2013 at 7:47
• it's not in the middle of frame, as you can see. always a little to the right. why?how can i adjust this ?
– Nax
Commented Sep 24, 2013 at 7:53
• @Alex it starts from the left margin but it doesn't fit so it overflows the page. Either use smaller fonts or remove stuff. There is no other way. Commented Sep 24, 2013 at 7:58