I am using the Latex presentation package and would like to mold the following algorithm (I had to remove the text due to publication reasons) onto one slide - how can I do that?

\underline{Algorithm Example} \\


\begin{tabbing}
%%%%%%%%%%%%%%%
% set tabs here
\hspace*{0.5cm}\=\hspace*{0.5cm}\=\hspace*{0.5cm}\=\hspace*{0.1cm}\=\kill
%%%%%%%%%%%%%%%
1. Set rrrrrrrrrrrrrrr \\
2. \>(a) Grow rrrrrrrrrrrrrrrr \\
   \>(b) Reduce rrrrrrrrrrrrrrrrrr$

\\[5 pt] while $r \geq 1$ \\[5 pt]
\> 3. Decide rrrrrrrrrrrrrrrrrrrrrr \\
\> \> if (xxxxx) \\
\> \> \>(a) aaaaaaaaaaaaaaa \\
\> \> \>(b) bbbbbbbbbbbbbbbbbbbbbbbbbbb \\
\> 4. If aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\
\> \> if (ccccccc) \\
\> \> \> (a) ddddddddddddd\\
\> \> \> (b) ddddddddddddddddddddddddddddddddd \\
\> \> \> \> ddddddddddddd\\
\> \> eeeeeeeeeeeeeeeeeeeeeee\\
\> \> \>(a) Ddddddddddddddddddddddddddddddddddddddddddd \\
\> \> \> \>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
\> \> \> \>bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \\
\> \> \>(b) teeeeeeeeeeeeeeeeeeeeeesst \\
\> \> \> \>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\
\> \> end if \\
[5 pt] end while \\[2 pt]
\end{tabbing}
  • 1
    Do you know allowframebreaks option for frame environment? Does it help you? – kiss my armpit Sep 3 '13 at 13:50

You have, at least, three possibilities: you can use \resizebox, you can reduce the font size, or you can use the evil shrink option:

\documentclass{beamer}
\usetheme{Boadilla}
\begin{document}

\begin{frame}[shrink=28]
\underline{Algorithm Example}\par
\begin{tabbing}
\hspace*{0.5cm}\=\hspace*{0.5cm}\=\hspace*{0.5cm}\=\hspace*{0.1cm}\=\kill
1. Set rrrrrrrrrrrrrrr \\
2. \>(a) Grow rrrrrrrrrrrrrrrr \\
   \>(b) Reduce $rrrrrrrrrrrrrrrrrr$

\\[5 pt] while $r \geq 1$ \\[5 pt]
\> 3. Decide rrrrrrrrrrrrrrrrrrrrrr \\
\> \> if (xxxxx) \\
\> \> \>(a) aaaaaaaaaaaaaaa \\
\> \> \>(b) bbbbbbbbbbbbbbbbbbbbbbbbbbb \\
\> 4. If aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\
\> \> if (ccccccc) \\
\> \> \> (a) ddddddddddddd\\
\> \> \> (b) ddddddddddddddddddddddddddddddddd \\
\> \> \> \> ddddddddddddd\\
\> \> eeeeeeeeeeeeeeeeeeeeeee\\
\> \> \>(a) Ddddddddddddddddddddddddddddddddddddddddddd \\
\> \> \> \>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
\> \> \> \>bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \\
\> \> \>(b) teeeeeeeeeeeeeeeeeeeeeesst \\
\> \> \> \>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\
\> \> end if \\[5 pt] 
end while \\[2 pt]
\end{tabbing}
\end{frame}

\begin{frame}
\underline{Algorithm Example}\par
\resizebox{!}{\textheight}{%
\vbox{\begin{tabbing}
\hspace*{0.5cm}\=\hspace*{0.5cm}\=\hspace*{0.5cm}\=\hspace*{0.1cm}\=\kill
1. Set rrrrrrrrrrrrrrr \\
2. \>(a) Grow rrrrrrrrrrrrrrrr \\
   \>(b) Reduce $rrrrrrrrrrrrrrrrrr$

\\[5 pt] while $r \geq 1$ \\[5 pt]
\> 3. Decide rrrrrrrrrrrrrrrrrrrrrr \\
\> \> if (xxxxx) \\
\> \> \>(a) aaaaaaaaaaaaaaa \\
\> \> \>(b) bbbbbbbbbbbbbbbbbbbbbbbbbbb \\
\> 4. If aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\
\> \> if (ccccccc) \\
\> \> \> (a) ddddddddddddd\\
\> \> \> (b) ddddddddddddddddddddddddddddddddd \\
\> \> \> \> ddddddddddddd\\
\> \> eeeeeeeeeeeeeeeeeeeeeee\\
\> \> \>(a) Ddddddddddddddddddddddddddddddddddddddddddd \\
\> \> \> \>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
\> \> \> \>bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \\
\> \> \>(b) teeeeeeeeeeeeeeeeeeeeeesst \\
\> \> \> \>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\
\> \> end if \\[5 pt] 
end while \\[2 pt]
\end{tabbing}}%
}
\end{frame}

\begin{frame}
\underline{Algorithm Example}\par
\scriptsize
\begin{tabbing}
\hspace*{0.5cm}\=\hspace*{0.5cm}\=\hspace*{0.5cm}\=\hspace*{0.1cm}\=\kill
1. Set rrrrrrrrrrrrrrr \\
2. \>(a) Grow rrrrrrrrrrrrrrrr \\
   \>(b) Reduce $rrrrrrrrrrrrrrrrrr$

\\[5 pt] while $r \geq 1$ \\[5 pt]
\> 3. Decide rrrrrrrrrrrrrrrrrrrrrr \\
\> \> if (xxxxx) \\
\> \> \>(a) aaaaaaaaaaaaaaa \\
\> \> \>(b) bbbbbbbbbbbbbbbbbbbbbbbbbbb \\
\> 4. If aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\
\> \> if (ccccccc) \\
\> \> \> (a) ddddddddddddd\\
\> \> \> (b) ddddddddddddddddddddddddddddddddd \\
\> \> \> \> ddddddddddddd\\
\> \> eeeeeeeeeeeeeeeeeeeeeee\\
\> \> \>(a) Ddddddddddddddddddddddddddddddddddddddddddd \\
\> \> \> \>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
\> \> \> \>bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \\
\> \> \>(b) teeeeeeeeeeeeeeeeeeeeeesst \\
\> \> \> \>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\
\> \> end if \\[5 pt] 
end while \\[2 pt]
\end{tabbing}
\end{frame}


\end{document}

enter image description here

As a side note, perhaps you could use one of the dedicated packages to write your algorithms: algorithmicx or listings, for example.

Use shrink frame if needed. Use two or several columns. Decrease font size if needed.

\begin{frame}[shrink=20]
\begin{algorithm}[H]
\algsetup{linenosize=\tiny}   
\scriptsize
\begin{algorithmic}[1] 
\begin{columns}  
\begin{column}{.5\hsize}


\STATE  Your Statements 


\end{column}%  
\begin{column}{.5\hsize} 


\STATE  Your Statements 


\end{column}    
\end{columns}
\end{algorithmic}
\caption{blah blah} 
\label{alg:seq} 
\end{algorithm}
\end{frame}

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.