未定义的控制序列参数

未定义的控制序列参数
\begin{algorithm}
\SetKwData{Candidates}{candidates}
\SetKwData{Links}{links}
\SetKwData{Visited}{visited}
\SetKwData{URL}{URL}
\SetKwData{TraversalDepth}{traversalDepth}
\SetKwFunction{RetrieveByTraversal}{retrieveByTraversal}
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\Input{Starting page URL, Traversal parameter traversalDepth, Set of visited pages Visited, Already retrieved pages Candidates}
\Output{School list page candidates}
\BlankLine
\Candidates $= \emptyset$\;
\Visited $= \emptyset$\;
\Candidates = \Candidates $\cup$ \URL\;
\Links = Retrieve all but media type links from \URL\;
\Visited = \Visited $\cup$ \Links\;
\ForEach{link $link$ in \Links} {
   %\RetrieveByTraversal($link$, \TraversalDepth-1, \Visisted, \Candidates)\;
}
return \Candidates\;
\caption{Retrieving School List Page Candidates Using Traversal}
\label{algo_traversal_s}
\end{algorithm}

我在注释掉的行上遇到了未定义的控制序列参数错误。注释掉后,一切都正常。我不知道那一行出了什么问题。

编辑:根据要求,我发布了一个最小工作示例和相应的错误消息。

\documentclass[12pt,letterpaper]{report}

\usepackage{array}
\usepackage{graphicx}
\usepackage{cite}
\usepackage{subfigure}
\usepackage{amsmath}
\usepackage[indent,bf]{caption}
\usepackage{rotating}
\usepackage{setspace}
\usepackage{longtable}
\usepackage{rotating}
\usepackage[algochapter,linesnumbered,noend,ruled,oldcommands]{algorithm2e}
\usepackage{url}
\usepackage{float}
\usepackage{bookmark}

\begin{document}

\begin{algorithm}
\SetKwData{Candidates}{candidates}
\SetKwData{Links}{links}
\SetKwData{Visited}{visited}
\SetKwData{URL}{URL}
\SetKwData{TraversalDepth}{traversalDepth}
\SetKwFunction{Union}{Union}
\SetKwFunction{RetrieveByTraversal}{retrieveByTraversal}
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\Input{Starting page URL, Traversal parameter traversalDepth, Set of visited pages Visited, Already retrieved pages Candidates}
\Output{School list page candidates}
\BlankLine
\Candidates $= \emptyset$\;
\Visited $= \emptyset$\;
\Candidates = \Candidates $\cup$ \URL\;
\Links = Retrieve all but media type links from \URL\;
\Visited = \Visited $\cup$ \Links\;
\ForEach{link $link$ in \Links} {
   \RetrieveByTraversal($link$, \TraversalDepth-1, \Visisted, \Candidates)\;
}
return \Candidates\;
\caption{Retrieving School List Page Candidates Using Traversal}
\label{algo_traversal_s}
\end{algorithm}

\end{document}

对应的错误信息如下:

! Undefined control sequence.
<argument> ...ink$, \TraversalDepth -1, \Visisted 
                                                  , \Candidates )\; 
l.45 }

? 

答案1

你只是打错了:

它应该\Visited代替\Visisted

相关内容