我正在尝试将算法放入 beamer 文档中(使用algorithm2e
包)。但行号打印在框外。其余文本也打印得稍微左移。在这个问题完全相同,只是我没有导入parskip
包。
梅威瑟:
\documentclass[aspectratio = 169]{beamer}
\usepackage[linesnumbered, boxruled, boxed]{algorithm2e}
\usepackage{algpseudocode}
\SetKwInput{KwInput}{Input}
\begin{document}
\begin{frame}{Algorithm}
\begin{algorithm}[H]
\caption{An algorithm.}
\label{alg:example}
\DontPrintSemicolon
%
%%%%%%%%%%%%%%%%%%%%%
% I/O
%%%%%%%%%%%%%%%%%%%%%
\KwInput
{
Some input.
}
%
\BlankLine
%%%%%%%%%%%%%%%%%%%%%
% BODY
%%%%%%%%%%%%%%%%%%%%%
First step. \;
%
Second step. \;
%
Third step. \;
\end{algorithm}
\end{frame}
\end{document}
输出: