我正在尝试在我的 beamer 演示文稿中添加算法伪代码,只需复制并粘贴我在撰写论文时使用的代码,如下所示:
\documentclass{beamer}
\mode<presentation> {
\usetheme{Madrid}
}
\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{biblatex}
\usepackage{xcolor}
\usepackage{algorithm,algorithmic}
\begin{document}
\begin{frame}[fragile]
\begin{algorithm}[H]
\caption{Text Summarization Algorithm}\label{euclid}
\begin{algorithmic}[1]
\Procedure{Summary Construction}{}\newline
\textbf{Input:} Text Document.\newline
\textbf{Output:} Summary sentences.
\State{Creating information table from a text document.}
\State{Generate matrices.}
\State {\textbf{Call Pocedure:} Reduct Construction \textbf{[Algorithm 2]}}
\State {\textbf{Return:} Summary sentences}
\EndProcedure
\end{algorithmic}
\label{alg_1}
\end{algorithm}
\end{frame}
\end{document}
我得到的错误是Undefined control sequence. \end{frame}
。如果有人能帮助我解决这个问题,我将不胜感激。
答案1
请提供完整的最小示例。这在 TeX Live 2015 下编译得很好。
\documentclass[a4paper]{beamer}
\usepackage{algorithm,algpseudocode}
\begin{document}
\begin{frame}
\begin{algorithm}[H]
\caption{Text Summarization Algorithm}\label{euclid}
\begin{algorithmic}[1]
\Procedure{Summary Construction}{}\newline
\textbf{Input:} Text Document.\newline
\textbf{Output:} Summary sentences.
\State{Creating information table from a text document.}
\State{Generate matrices.}
\State {\textbf{Call Pocedure:} Reduct Construction \textbf{[Algorithm 2]}}
\State {\textbf{Return:} Summary sentences}
\EndProcedure
\end{algorithmic}
\label{alg_1}
\end{algorithm}
\end{frame}
\end{document}