但它有一个错误。请帮帮我。
\documentclass{article}
\usepackage[ruled,lined]{algorithm2e}
\usepackage{xepersian}
\settextfont[Scale=1]{XB Niloofar}
\setdigitfont{XB Niloofar}
\begin{document}
\renewcommand*{\listalgorithmcfname}{فهرست الگوریتم ها} % used for list of algorithms
\renewcommand*{\algorithmcfname}{الگوریتم} % used for title
\renewcommand*{\algorithmautorefname}{االگوریتم} % used for autoref
\begin{algorithm}[H]
\begin{flushright}
\begin{persian}
\caption{اضافه کردن به history table}
\end{persian}
\end{flushright}
\begin{flushleft}
\begin{latin}
\While{TTl>0}{
select Ni\;
NbR = Neighbors Of (Ni)\;
j=count of (NbR)\;
TTl = TTL - 1\;
\While{j<>0}{
send query to NbRj\;
n= Number Of Row (history\_t\_NbRj)\;
n=n+1\;
history\_t\_NbRj(n).Msg\_ID=Msg\_ID\;
history\_t\_NbRj(n).Node\_ID=Ni.ID\;
\eIF {search for find Msg\_ID in history\_t\_NbRj }
{del connection between Ni,NbRj\;
del Row (history\_t\_NbRj(n))\;
}
}
\eIF {TTL <>0 \textbf{OR} response not find}{
Ni=NbR\;
}{
end\;
}
}
\end{latin}
\end{flushleft}
\end{algorithm}
\end{document}
错误:
*************************************************
* fontspec warning: "rename-feature-not-exist"
*
* The feature Renderer doesn't appear to be defined.
*************************************************
)) (./inert_history.aux) (c:/texlive/2014/texmf-dist/tex/latex/tipa/t3cmr.fd)
! Undefined control sequence.
<argument> ...y\_t\_NbRj(n).Node\_ID=Ni.ID\; \eIF
{search for find Msg\_ID i...
l.46 }
?
答案1
您的代码有两个else-if
语句,但没有if
语句。第一个eIF
应该是If
。我认为第二个也应该是If
。还要注意和中的小写 f \If
。\eIf
顺便说一句,没有必要使用flushright
或flushleft
和XePersian
自动修复所有这些问题。
\documentclass{article}
\usepackage[ruled,lined]{algorithm2e}
\usepackage{xepersian}
\settextfont[Scale=1]{XB Niloofar}
\setdigitfont{XB Niloofar}
\begin{document}
\renewcommand*{\listalgorithmcfname}{فهرست الگوریتم ها} % used for list of algorithms
\renewcommand*{\algorithmcfname}{الگوریتم} % used for title
\renewcommand*{\algorithmautorefname}{االگوریتم} % used for autoref
\begin{algorithm}[H]
\begin{persian}
\caption{اضافه کردن به history table}
\end{persian}
\begin{latin}
\While{TTl>0}{
select Ni\;
NbR = Neighbors Of (Ni)\;
j=count of (NbR)\;
TTl = TTL - 1\;
\While{j<>0}{
send query to NbRj\;
n= Number Of Row (history\_t\_NbRj)\;
n=n+1\;
history\_t\_NbRj(n).Msg\_ID=Msg\_ID\;
history\_t\_NbRj(n).Node\_ID=Ni.ID\;
\If {search for find Msg\_ID in history\_t\_NbRj }
{del connection between Ni,NbRj\;
del Row (history\_t\_NbRj(n))\;
}
}
\eIf {TTL <>0 \textbf{OR} response not find}{
Ni=NbR\;
}{
end\;
}
}
\end{latin}
\end{algorithm}
\end{document}