Como esse tipo de pseudocódigo é escrito em látex?

Como esse tipo de pseudocódigo é escrito em látex?

Não parece estar formatado usando instruções das bibliotecas de algoritmos usuais do Latex.insira a descrição da imagem aqui

Parece ser um texto formatado simplesmente, não tenho certeza.

Responder1

Uma maneira simples de fazer isso é usar o enumitempacote para criar listas aninhadas. O truque de iniciar a lista em uma nova linha foi adaptado deesta resposta. Isto não é necessário se cada item contiver algum texto, mas é necessário se uma etapa for incorporada diretamente como um item da lista. Se uma etapa nunca for incorporada dessa forma, o before={\apptocmd{\item}{\mbox{}}{}{}}código não será necessário.

\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}

saída de código

informação relacionada