itemizeまたはその他の環境でアルゴリズムに番号を付ける

itemizeまたはその他の環境でアルゴリズムに番号を付ける

2 つの環境に番号を付けて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{}アルゴリズム環境の前にを置く(各 の後\item

環境は、 etcの代わりに番号付けを提供する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}

ここに画像の説明を入力してください

関連情報