[Tex/LaTex] How to get the end in algorithm2e

algorithm2e

I am using algorithm2e to typeset an algorithm. I like the appearance of the following, but I am not able to get the end to close the `

begin

`. Any way to do this?

\documentclass{article}
\usepackage[longend,ruled,vlined]{algorithm2e} 

\begin{document}

\begin{algorithm}
    \caption{PHORIZONTAL Algorithm}\label{alg:phorizontal}
\KwIn{$R$: relation; $Pr$: set of simple predicates}
\KwOut{$F_{R}$: set of horizontal fragments of $R$}
    \Begin{
$Pr' \leftarrow $COM\_MIN($R, Pr$) \;
determine the set $M$ of minterm predicates \;
determine the set $I$ of implications among $p_i \in Pr'$ \;
\ForEach{$m_{i} \in M$}{
    \If{ $m_{i}$ is contradictory according to $I$}{$M \leftarrow M - m_{i}$} 
}
$F_{R} = \{R_{i} | \sigma_{m_{i}} R, m_{i} \in M\}, \forall m_{i} \in M$ \;
}
\end{algorithm} 
\end{document} 

enter image description here

Best Answer

Referring to the answert by @egreg in End word is hidden in algorithm block , the vlined option suppresses the printing of “end”. Just remove the option:

\documentclass{article}
\usepackage[longend,ruled]{algorithm2e}

\begin{document}

\begin{algorithm}
    \caption{PHORIZONTAL Algorithm}\label{alg:phorizontal}
\KwIn{$R$: relation; $Pr$: set of simple predicates}
\KwOut{$F_{R}$: set of horizontal fragments of $R$}
    \Begin{
$Pr' \leftarrow $COM\_MIN($R, Pr$) \;
determine the set $M$ of minterm predicates \;
determine the set $I$ of implications among $p_i \in Pr'$ \;
\ForEach{$m_{i} \in M$}{
    \If{ $m_{i}$ is contradictory according to $I$}{$M \leftarrow M - m_{i}$}
}
$F_{R} = \{R_{i} | \sigma_{m_{i}} R, m_{i} \in M\}, \forall m_{i} \in M$ \;
}
\end{algorithm}
\end{document} 

enter image description here