Numere los algoritmos con itemize u otro entorno.

Numere los algoritmos con itemize u otro entorno.

Estoy tratando de numerar los dos algorithmentornos y dejar algo de espacio entre sí, pero ¿solo obtengo la numeración al costado? ¿Cómo puedo lograr que obtenga el número antes que los algoritmos?

ingrese la descripción de la imagen aquí

Código:

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

Respuesta1

Coloque un \mbox{}antes de los entornos del algoritmo (después de cada uno \item)

El itemizeentorno debe reemplazarse por enumerateel que proporciona la numeración en lugar de \item[1.]etc.

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

ingrese la descripción de la imagen aquí

información relacionada