当我在算法中写一个长句子时,新行会缩进。有没有办法避免这种缩进,而不在此行创建新的数字?我正在使用 algorithm2e 包。
我的代码:
\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
由于某些原因,该noalgohanging
选项无法按预期工作。无论如何,你可以避免挂起
\SetAlgoHangIndent{0pt}
以下是一个 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}