1

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

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}
  • I actually don't want line numbers but rather numbers that show steps of my algorithm (that's why I used enumerate) – Learn_and_Share Jan 5 '17 at 4:37
  • @MedNait: Uhmm... that's the same... – Werner Jan 5 '17 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. – Learn_and_Share Jan 5 '17 at 4:39

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.