我正在使用 Latex 演示包,并且想要将以下算法(由于出版原因,我不得不删除文本)塑造到一张幻灯片上 - 我该怎么做?
\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
你至少有三种可能性:你可以使用\resizebox
,你可以减小字体大小,或者你可以使用邪恶shrink
选项:
\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}
附注:也许您可以使用其中一个专用包来编写算法:algorithmicx
或者listings
, 例如。
答案2
如果需要,可以使用缩小框架。使用两列或多列。如果需要,可以减小字体大小。
\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}