2

When writing a long sentence inside my algorithm, I am getting an indent in the new line. Is there a way to aviod this indent without creating a new number in this line? I am using the package algorithm2e.

What I get: enter image description here

What I want to get: enter image description here

My code:

\documentclass[a4paper]{article}
\usepackage[linesnumbered,ruled]{algorithm2e}[H]

\begin{document}

\begin{algorithm}[p] Determine parameters:\ Now the algortihm tries to find a way to sort the parameters in some order following the list.\ loadList(parameters); startFunction();\ \caption{New Method} \end{algorithm}

\end{document}

1 Answers1

3

For some reasons the noalgohanging option does not work as expected. Anyway you can avoid the hanging with

\SetAlgoHangIndent{0pt}

Here is a mwe:

\documentclass[a4paper]{article}
\usepackage[linesnumbered,ruled]{algorithm2e}[H]
\SetAlgoHangIndent{0pt}
\begin{document}

\begin{algorithm}[p] Determine parameters:\ Now the algortihm tries to find a way to sort the parameters in some order following the list.\ loadList(parameters); startFunction();\ \caption{New Method} \end{algorithm}

\end{document}

enter image description here

Ivan
  • 4,368