我有以下算法的代码。
\begin{algorithm}
\label{alg:script}
\caption{Algorithm to calculate something}
\begin{algorithmic}[1]
\State One line sentence
\For {\texttt{i}}
\State Really long sentence that messes up the pseudocode and needs to be formatted
\For {\texttt{each j}} \State Really long sentence that messes up the pseudocode and needs to be formatted
\State Really long sentence that messes up the pseudocode and needs to be formatted
\EndFor
\State Really long sentence that messes up the pseudocode and needs to be formatted
\State Really long sentence that messes up the pseudocode and needs to be formatted
\EndFor
\State Final step
\end{algorithmic}
\end{algorithm}
我需要在伪代码中给出非常长的描述,这弄乱了我的格式。例如,在第 3 行中,代码超出了其上方的 for 循环。第 5、6、8 和 9 行也是如此。我尝试使用不同的算法包,但无法使其按照我想要的方式格式化。有人能帮我吗?
编辑我希望缩进的行与起始行一致。我总共有大约 10 个长句子。