Here is minimal working example:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage[algo2e]{algorithm2e}
\begin{document}
\newcommand{\nextnode}{\ensuremath{\text{Next}}}
\newcommand{\intree}{\ensuremath{\text{InTree}}}
\begin{algorithm}[H]
\KwData{}
\KwResult{}
asdf\;
$\nextnode[r] \leftarrow nil$\;
$\intree[r] \leftarrow true$\;
\caption{}
\end{algorithm}
\end{document}
With the output:
I am expecting line breaks, but it just doesn't happen.
Why?
Best Answer
You have loaded the
algorithm2e
package with thealgo2e
option. This changes the name of the environment toalgorithm2e
. Using that name works as expected: