# ! Undefined control sequence. <recently read> \elf

I am trying to open an if statement after entering this if statement\eIf{$list size > 0$} at the position \elf{$stopAfterNext$ is not empty} but I am getting the error below. I can compile the document just if I remove the slash from elf{$stopAfterNext$ is not empty}. How can I fix it?

Error:

! Undefined control sequence.
l.26 }


Code:

\documentclass{article}
%\usepackage{algorithmic}% http://ctan.org/pkg/algorithms
\usepackage[]{algorithm2e}
\begin{document}
\begin{algorithm}[H]
\SetAlgoLined
\KwData{latitude, longitude, mac, route, direction}
%\KwResult{how to write algorithm with \LaTeX2e }
initialize $list$ as an empty  list of integers. \\
%\While{not at end of this document}{
$list$ = Get stop Order from behaviour; \\
\eIf{$list size > 0$}{
find the last stop name in the behaviour table of this mac;\\
find the $stop\_id$ of the current location; \\
find all possible avialable next stops of this
$stop\_id$; \\

calculate the distance to all after next;\\
insert the result into after next;    \\
String $stopAfterNext$ = check  $stop\_name$ with $stop\_distance < 150$ in after next table; \\
\elf{$stopAfterNext$ is not empty}{ \\
String $stopBetween$ = find the name in the stops table;\\

}
}{
find the closet stop of the producer current location; \\
insert it into next table; \\
find initializer; \\
\eIf{initializer is available}{
get the initializer stop name;  \\
restore all stop name for this mac to the behaviour table;

}

}
\caption{Detection algorithm.}
\end{algorithm}

\end{document}

• did you mean \eIf you have used that in most cases (capital I) but have one \elf (lower case l) Oct 2 '15 at 21:58
• @DavidCarlisle: thanks I changed it but I am getting now ! LaTeX Error: There's no line here to end. Oct 2 '15 at 22:05
• that's a different question so you may want to edit the title and remove any part of the example unrelated to that, it just means you have used \\  to end a line before you have started a line. I didn't run it but this \\  looks wrong { \\  Oct 2 '15 at 22:08

I'm not so sure if this is the output you expect but this compiles error-free:

\documentclass{article}
\usepackage[]{algorithm2e}
\begin{document}
\begin{algorithm}[H]
\SetAlgoLined
\KwData{latitude, longitude, mac, route, direction}
%\KwResult{how to write algorithm with \LaTeX2e }
initialize $list$ as an empty  list of integers. \\
%\While{not at end of this document}{
$list$ = Get stop Order from behaviour; \\
\eIf{$list size > 0$}{
find the last stop name in the behaviour table of this mac;\\
find the $stop\_id$ of the current location; \\
find all possible avialable next stops of this
$stop\_id$;
calculate the distance to all after next;\\
insert the result into after next;    \\
String $stopAfterNext$ = check  $stop\_name$ with $stop\_distance < 150$ in after next table; \\
\eIf{$stopAfterNext$ is not empty}{%\\
String $stopBetween$ = find the name in the stops table;
}

}{%
find the closet stop of the producer current location; \\
insert it into next table; \\
find initializer; \\
\eIf{initializer is available}{
get the initializer stop name;  \\
restore all stop name for this mac to the behaviour table;
}

}
\caption{Detection algorithm.}
\end{algorithm}

\end{document}