itemize 또는 기타 환경을 사용하여 알고리즘에 번호를 매깁니다.

itemize 또는 기타 환경을 사용하여 알고리즘에 번호를 매깁니다.

두 환경에 번호를 매기고 algorithm서로 사이에 약간의 공간을 두려고 하는데 옆에 숫자만 표시하고 있는 건가요? 알고리즘 이전에 숫자를 얻으려면 어떻게 관리해야 합니까?

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

암호:

\documentclass{article}
\usepackage{german,t1enc}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e} 
\usepackage{amsmath}
\renewcommand{\baselinestretch}{1.5}
\usepackage{mathtools}

\begin{document}
\begin{itemize}
\item[1.]

\begin{algorithm}[H]
\SetAlgoLined
\KwData{2 graphs  T and \'{T} with nodes V and \'{V}.}
\KwResult{Find whether T and \'{T} are isomorph.}

function(T, \'{T}) \\
\Indp Find  bijection of $\forall v \in V$ with $v_1, v_2  \dots , v_k$ in T so that $\pi(v)$ has the following childern $\pi(v_1), \pi(v_2), \dots, \pi(v_n)$ in \'{T}; \\
\If{the bijection is permutation}{
  T and \'{T} are isomorph;
}
\end{algorithm}

\item[2.]

\begin{algorithm}[H]
\SetAlgoLined
\KwData{2 graphs  T and \'{T} with nodes V and \'{V}.}
\KwResult{Find whether T and \'{T} are isomorph.}

function(T, \'{T}) \\
\Indp Find  bijection of $\forall v \in V$ with $v_1, v_2  \dots , v_k$ in T so that $\pi(v)$ has the following childern $\pi(v_1), \pi(v_2), \dots, \pi(v_n)$ in \'{T}; \\
\If{the bijection is permutation}{
  T and \'{T} are isomorph;
}
\end{algorithm}

\end{itemize}


\end{document}

답변1

\mbox{}알고리즘 환경 앞에 a를 배치합니다 (각 뒤에 \item).

등을 대신하여 넘버링을 제공하는 환경 itemize으로 교체해야 합니다 .enumerate\item[1.]

\documentclass{article}
%\usepackage{german,t1enc} % Is this needed?
\usepackage{enumitem}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e} 
\usepackage{amsmath}
\renewcommand{\baselinestretch}{1.5}
\usepackage{mathtools}

\begin{document}
\begin{enumerate}
\item \mbox{}

\begin{algorithm}[H]
\SetAlgoLined
\KwData{2 graphs  T and \'{T} with nodes V and \'{V}.}
\KwResult{Find whether T and \'{T} are isomorph.}

function(T, \'{T}) \\
\Indp Find  bijection of $\forall v \in V$ with $v_1, v_2  \dots , v_k$ in T so that $\pi(v)$ has the following childern $\pi(v_1), \pi(v_2), \dots, \pi(v_n)$ in \'{T}; \\
\If{the bijection is permutation}{
  T and \'{T} are isomorph;
}
\end{algorithm}

\item \mbox{}

\begin{algorithm}[H]
\SetAlgoLined
\KwData{2 graphs  T and \'{T} with nodes V and \'{V}.}
\KwResult{Find whether T and \'{T} are isomorph.}

function(T, \'{T}) \\
\Indp Find  bijection of $\forall v \in V$ with $v_1, v_2  \dots , v_k$ in T so that $\pi(v)$ has the following childern $\pi(v_1), \pi(v_2), \dots, \pi(v_n)$ in \'{T}; \\
\If{the bijection is permutation}{
  T and \'{T} are isomorph;
}
\end{algorithm}

\end{enumerate}


\end{document}

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

관련 정보