2

When I tried to use the enumerate environment inside the algorithm environment (algorithm2e package) I got this warning message:

Overfull \hbox (15.0pt too wide) detected at line 13

Here is a minimal working example I used to test the warning:

\documentclass{article}
\usepackage{algorithm2e}

\begin{document}

\begin{algorithm}
    \caption{Test}
        \begin{enumerate}
            \item first item
        \end{enumerate}
    \label{alg:test}
\end{algorithm}

\end{document}

Does anyone know what the problem is and how to solve it?

P.S: I really need to get rid of this warning.

1

1 Answer 1

1

If you want to enumerate lines inside algorithm, don't use a enumerate, but rather the linesnumbered option when you load algorithm2e:

enter image description here

\documentclass{article}

\usepackage[linesnumbered]{algorithm2e}
\DontPrintSemicolon

\begin{document}

\begin{algorithm}
  \caption{Test}
  first item\;
\end{algorithm}

\end{document}
3
  • I actually don't want line numbers but rather numbers that show steps of my algorithm (that's why I used enumerate) Commented Jan 5, 2017 at 4:37
  • @MedNait: Uhmm... that's the same...
    – Werner
    Commented Jan 5, 2017 at 4:38
  • Okay, then I just have to use line numbers as step numbers and make sure to stay in the same line for each step I guess. Commented Jan 5, 2017 at 4:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .