4

Suppose that i have this code:

\usepackage[ruled,vlined]{algorithm2e}
\begin{dcocument}
\begin{algorithm}[H]
 \KwData{this text}
 \KwResult{how to write algorithm with \LaTeX2e }
 initialization\;
 \While{not at end of this document}{
  read current\;
  \eIf{understand}{
   go to next section\;
   current section becomes this one\;
   }{
   go back to the beginning of current section\;
  }
 }
 \caption{How to write algorithms}
\end{algorithm}
\end{dcocument}

Result:

enter image description here

Where are end words?

1 Answer 1

6

The vlined option suppresses the printing of “end”. Just remove the option, keeping just ruled:

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

\begin{document}
\begin{algorithm}[H]
\caption{How to write algorithms}
 \KwData{this text}
 \KwResult{how to write algorithm with \LaTeX2e }
 initialization\;
 \While{not at end of this document}{
  read current\;
  \eIf{understand}{
   go to next section\;
   current section becomes this one\;
   }{
   go back to the beginning of current section\;
  }
 }
\end{algorithm}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.