I'm writing a paper, but in the process, I encounter a problems : when I drawing a map with the following codes
\documentclass{article}
\usepackage{amsmath,amssymb,booktabs}
\begin{document}
\begin{figure}
\[
\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 ID_A, Cert_A, X } \\
&& y\in_R [1,q-1] ,\quad Y=g^{H_1(y,b)} \\
& \xleftarrow {\textstyle ID_B,Cert_B, 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}
\]
\caption{title}
\end{figure}
\end{document}
I find that this it beyond the margin. Just like this

You can see very obviously that it beyond the margin. Both changing the font size and rotating the map won't get it to adapt to my article(I tried these two ways). who can help me?
\\)... – Alex Nelson Apr 17 '14 at 15:40arrayto show the same concept but in a different way. You can resize the entire thing to make it fit within the margins (which may be sufficient):\resizebox{\linewidth}{!}{$\begin{array}...\end{array}$}or some techniques from Center figure that is wider than \textwidth. – Werner Apr 18 '14 at 00:18\usepackage{graphicx}to your document preamble? – Werner Apr 18 '14 at 03:12\resizebox{\linewidth}{!}{$\begin{array}...\end{array}$}reduce the size to make it flush to each side. But if I want to make it smaller, what can I do ?(P.s. I think you can arrange your comments into a single answer) – Nax Apr 18 '14 at 03:32