
답변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}