# ! Undefined control sequence. <argument>

\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}


The error:

*************************************************
* 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 }
?

• I haven't used algorithm2e for a long time but: shouldn't it be \eIf (capital "I", small "f")? – campa Nov 24 '15 at 8:46

Your code has two else-if statements, but there are no if statements. The first eIF should be If. And I think the second one also should be If. Also pay attention to the lowercase f in both \If and \eIf. By the way, there is no need in using flushright or flushleft and XePersian fix all this automatically.

\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}