Latex에서 하나의 열거 항목에 여러 줄 블록을 포함하는 방법은 무엇입니까?

Latex에서 하나의 열거 항목에 여러 줄 블록을 포함하는 방법은 무엇입니까?

라텍스의 경우:

\documentclass{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[utf8]{inputenc}
\title{example}
\author{ }
\date{October 2022}
\begin{document}
\maketitle
\section{Introduction}

\begin{algorithm}
    \begin{algorithmic}
    
            \State $InvariantList \gets FD(PDDL)$
            \State $StateVar \gets StateVar(LatPlan)$
            
            \While{$InvariantList \neq $ $\emptyset$}
                \State 
                    \begin{enumerate}
                        \item \textit{Inv} = $highInv($InvariantList) 
                        \item Train LatPlan by enforcing \textit{Inv}
                        \item  $StateVarTmp \gets StateVar(LatPlan)$ \\ \If{$StateVarTmp <    $ StateVar} \State Keep Inv in the loss function and in InvariantList\Else \State Discard Inv from the loss function and from InvariantList \EndIf
                        \item other item
                    \end{enumerate}
                    
            \EndWhile
    \end{algorithmic}
\end{algorithm}

\end{document}

내가 기대하는 것을 렌더링하지 않습니다.

여기에 이미지 설명을 입력하세요

즉, "If" 블록의 숫자를 제거하고 싶습니다. 왜냐하면 이 블록이 세 번째 항목의 일부가 되기를 원하기 때문입니다.

어떤 아이디어?

답변1

패키지 enumite와 약간의 DIY로

  • \세트리스트{코셉}

     \documentclass{article}
     \usepackage{algorithm}
     \usepackage{algpseudocode}
     \usepackage{enumitem}
    
     \begin{document}
     \setlist{nosep}
     \begin{algorithm}
     \begin{algorithmic}
         \State $InvariantList \gets FD(PDDL)$
         \State $StateVar \gets StateVar(LatPlan)$
         \While{$InvariantList \neq $ $\emptyset$}
             \State              
                 \begin{enumerate}\vspace{-1\baselineskip}
                     \item \textit{Inv} = $highInv($InvariantList) 
                     \item Train LatPlan by enforcing \textit{Inv}
                     \item  
                     $StateVarTmp \gets StateVar(LatPlan)$
                 \end{enumerate}
                 \begin{itemize}[label =]\vspace{-1.\baselineskip}
                     \item\If{$StateVarTmp <    $ StateVar} \State Keep Inv in the loss function and in InvariantList\Else \State Discard Inv from the loss function and from InvariantList \EndIf
                 \end{itemize}
                     \begin{enumerate}[resume]
                 \item other item
                 \end{enumerate} 
         \EndWhile         
     \end{algorithmic}
     \end{algorithm}
     \end{document}
    

여기에 이미지 설명을 입력하세요

관련 정보