I am using this code to show a pseudocode:
\usepackage{algorithm2e}
...
\begin{algorithm}[H]
\SetAlgoLined
\KwResult{Write here the result }
initialization\;
\While{While condition}{
instructions\;
\eIf{condition}{
instructions1\;
instructions2\;
}{
instructions3\;
}
}
\caption{How to write algorithms}
\end{algorithm}
The result is this without any frame around:
If I include \usepackage{algorithm}
I get a better result (altho non correct, see while):
But Latex (sharelatex.com
) outputs some errors:
/usr/local/texlive/2014/texmf-dist/tex/latex/algorithm2e/algorithm2e.sty, line 2334
LaTeX Error: Command \algorithm already defined.
What could be the problem?
Best Answer
You need to add
ruled
in the option while loading the package.Code