このような疑似コードは LaTeX でどのように記述されるのでしょうか?

このような疑似コードは LaTeX でどのように記述されるのでしょうか?

これは、LaTeX の通常のアルゴリズム ライブラリの命令を使用してフォーマットされていないようです。ここに画像の説明を入力してください

単純にフォーマットされたテキストのようですが、よくわかりません。

答え1

これを実現する簡単な方法は、enumitemネストされたリストを作成するパッケージを使用することです。リストを新しい行で開始するというトリックは、この答えすべての項目にテキストが含まれている場合は必要ありませんが、ステップがリストの項目として直接埋め込まれる場合は必要です。ステップがこのように埋め込まれない場合は、コードbefore={\apptocmd{\item}{\mbox{}}{}{}}は必要ありません。

\documentclass{article}
\usepackage{enumitem}
\usepackage{etoolbox}
\newlist{algolist}{enumerate}{3}
\setlist*[algolist]{leftmargin=*,before={\apptocmd{\item}{\mbox{}}{}{}}}
\setlist*[algolist,1]{label={\itshape Step \arabic*:}}
\setlist*[algolist,2]{label={\itshape Step \arabic{algolisti}.\arabic*:}}
\setlist*[algolist,3]{label={\itshape Step \arabic{algolisti}.\arabic{algolistii}.\arabic*:}}
\begin{document}
\begin{algolist}
\item This is the first step of the algorithm. It can have many lines in it and they will wrap as you would expect. 
\item This is the second step of the algorithm.
    \begin{algolist}
    \item This is the first substep of the second step of the algorithm.
    \item This is the second substep of the second step of the algorithm.
        \begin{algolist}
        \item This is the first substep of the second substep of the algorithm.
        \item This is the second substep of the second substep of the algorithm.
        \end{algolist}
    \end{algolist}
\end{algolist}
\end{document}

コードの出力

関連情報